From: Toni Wilen Date: Sat, 26 Nov 2022 17:53:24 +0000 (+0200) Subject: D3D scaling fix. X-Git-Tag: 41000~48 X-Git-Url: https://git.unchartedbackwaters.co.uk/w/?a=commitdiff_plain;h=486abffa78b0359e71fc3f41a8040576cdb9a081;p=francis%2Fwinuae.git D3D scaling fix. --- diff --git a/od-win32/direct3d.cpp b/od-win32/direct3d.cpp index 4650ed9c..3fee1cd4 100644 --- a/od-win32/direct3d.cpp +++ b/od-win32/direct3d.cpp @@ -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; diff --git a/od-win32/direct3d11.cpp b/od-win32/direct3d11.cpp index 71effa3b..8c50226d 100644 --- a/od-win32/direct3d11.cpp +++ b/od-win32/direct3d11.cpp @@ -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; + VertexType* verticesPtr; 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.