]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
D3D scaling fix.
authorToni Wilen <twilen@winuae.net>
Sat, 26 Nov 2022 17:53:24 +0000 (19:53 +0200)
committerToni Wilen <twilen@winuae.net>
Sat, 26 Nov 2022 17:53:24 +0000 (19:53 +0200)
od-win32/direct3d.cpp
od-win32/direct3d11.cpp

index 4650ed9caf59be0315a242d4fb83ee8dc78beecb..3fee1cd4e9c496ba93e0d4433c9ff6188d9deeef 100644 (file)
@@ -2150,8 +2150,8 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender)
 
        } else {
 
-               tx = dw * d3d->tin_w / d3d->window_w / 2;
-               ty = dh * d3d->tin_h / d3d->window_h / 2;
+               tx = -0.5f + dw * d3d->tin_w / d3d->window_w / 2;
+               ty = +0.5f + dh * d3d->tin_h / d3d->window_h / 2;
 
                float xshift = (float)(- zr.left - sr.left); // - (tin_w - 2 * zr.left - w),
                float yshift = (float)(+ zr.top + sr.top - (d3d->tin_h - h));
@@ -2159,14 +2159,9 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender)
                sw = dw * d3d->tin_w / d3d->window_w;
                sh = dh * d3d->tin_h / d3d->window_h;
 
-               //sw -= 0.5f;
-               //sh += 0.5f;
-
                tx += xshift;
                ty += yshift;
 
-               tx = (float)(int)(tx + 0.0f);
-               ty = (float)(int)(ty + 0.0f);
        }
 
        d3d->xmult = filterrectmult(d3d->window_w, w, d3d->dmode);
@@ -2185,9 +2180,6 @@ static void setupscenecoords(struct d3dstruct *d3d, bool normalrender)
        float sw2 = dw * d3d->tin_w / d3d->window_w;
        float sh2 = dh * d3d->tin_h / d3d->window_h;
 
-       //sw2 -= 0.5f;
-       //sh2 += 0.5f;
-
        d3d->maskmult.x = sw2 * d3d->maskmult_x / w;
        d3d->maskmult.y = sh2 * d3d->maskmult_y / h;
 
index 71effa3bbfeb9af616d6b3c3c9e88911b92f6989..8c50226d288caf45c213455ab1c7066636e6e712 100644 (file)
@@ -1448,7 +1448,7 @@ static bool UpdateVertexArray(struct d3d11struct *d3d, ID3D11Buffer *vertexbuffe
        float left, float top, float right, float bottom,
        float slleft, float sltop, float slright, float slbottom)
 {
-       VertexType *verticesPtr;
+       VertexTypeverticesPtr;
        D3D11_MAPPED_SUBRESOURCE mappedResource;
        HRESULT result;
        VertexType vertices[4];
@@ -1506,14 +1506,14 @@ static bool UpdateBuffers(struct d3d11struct *d3d)
        positionY = (sh - bh) / 2 + d3d->yoffset;
 
        // Calculate the screen coordinates of the left side of the bitmap.
-       left = (sw + 0.5f) / -2.0f;
+       left = sw / -2.0f;
        left += positionX;
 
        // Calculate the screen coordinates of the right side of the bitmap.
        right = left + bw;
 
        // Calculate the screen coordinates of the top of the bitmap.
-       top = (sh + 0.5f) / 2.0f;
+       top = sh / 2.0f;
        top -= positionY;
 
        // Calculate the screen coordinates of the bottom of the bitmap.