|
@@ -1356,7 +1356,7 @@ D3D11_GetRotationForCurrentRenderTarget(SDL_Renderer * renderer)
|
|
}
|
|
}
|
|
|
|
|
|
static int
|
|
static int
|
|
-D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect)
|
|
|
|
|
|
+D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRect, D3D11_RECT * outRect, BOOL includeViewportOffset)
|
|
{
|
|
{
|
|
D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
|
|
D3D11_RenderData *data = (D3D11_RenderData *) renderer->driverdata;
|
|
const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
|
const int rotation = D3D11_GetRotationForCurrentRenderTarget(renderer);
|
|
@@ -1366,6 +1366,12 @@ D3D11_GetViewportAlignedD3DRect(SDL_Renderer * renderer, const SDL_Rect * sdlRec
|
|
outRect->right = sdlRect->x + sdlRect->w;
|
|
outRect->right = sdlRect->x + sdlRect->w;
|
|
outRect->top = sdlRect->y;
|
|
outRect->top = sdlRect->y;
|
|
outRect->bottom = sdlRect->y + sdlRect->h;
|
|
outRect->bottom = sdlRect->y + sdlRect->h;
|
|
|
|
+ if (includeViewportOffset) {
|
|
|
|
+ outRect->left += renderer->viewport.x;
|
|
|
|
+ outRect->right += renderer->viewport.x;
|
|
|
|
+ outRect->top += renderer->viewport.y;
|
|
|
|
+ outRect->bottom += renderer->viewport.y;
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
case DXGI_MODE_ROTATION_ROTATE270:
|
|
case DXGI_MODE_ROTATION_ROTATE270:
|
|
outRect->left = sdlRect->y;
|
|
outRect->left = sdlRect->y;
|
|
@@ -2280,7 +2286,7 @@ D3D11_UpdateClipRect(SDL_Renderer * renderer)
|
|
ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 0, NULL);
|
|
ID3D11DeviceContext_RSSetScissorRects(data->d3dContext, 0, NULL);
|
|
} else {
|
|
} else {
|
|
D3D11_RECT scissorRect;
|
|
D3D11_RECT scissorRect;
|
|
- if (D3D11_GetViewportAlignedD3DRect(renderer, &renderer->clip_rect, &scissorRect) != 0) {
|
|
|
|
|
|
+ if (D3D11_GetViewportAlignedD3DRect(renderer, &renderer->clip_rect, &scissorRect, TRUE) != 0) {
|
|
/* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
|
|
/* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
|
|
return -1;
|
|
return -1;
|
|
}
|
|
}
|
|
@@ -2869,7 +2875,7 @@ D3D11_RenderReadPixels(SDL_Renderer * renderer, const SDL_Rect * rect,
|
|
}
|
|
}
|
|
|
|
|
|
/* Copy the desired portion of the back buffer to the staging texture: */
|
|
/* Copy the desired portion of the back buffer to the staging texture: */
|
|
- if (D3D11_GetViewportAlignedD3DRect(renderer, rect, &srcRect) != 0) {
|
|
|
|
|
|
+ if (D3D11_GetViewportAlignedD3DRect(renderer, rect, &srcRect, FALSE) != 0) {
|
|
/* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
|
|
/* D3D11_GetViewportAlignedD3DRect will have set the SDL error */
|
|
goto done;
|
|
goto done;
|
|
}
|
|
}
|