render: Remove the logical presentation render target.
Now we render directly to the window, scaling as appropriate. This fixes some concerns the render target introduced, like the quality of the final scaled output, how to step outside of the logical size temporarily to draw some things sharply at the native resolution, and loss of sub-pixel precision. Fixes #8736.
This commit is contained in:
parent
bf7a48cdcc
commit
54459def69
16 changed files with 293 additions and 387 deletions
src/render/opengl
|
@ -1465,7 +1465,6 @@ static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
|||
SDL_PixelFormat format = renderer->target ? renderer->target->format : SDL_PIXELFORMAT_ARGB8888;
|
||||
GLint internalFormat;
|
||||
GLenum targetFormat, type;
|
||||
int w, h;
|
||||
SDL_Surface *surface;
|
||||
|
||||
GL_ActivateRenderer(renderer);
|
||||
|
@ -1480,13 +1479,16 @@ static SDL_Surface *GL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *
|
|||
return NULL;
|
||||
}
|
||||
|
||||
SDL_GetCurrentRenderOutputSize(renderer, &w, &h);
|
||||
int y = rect->y;
|
||||
if (!renderer->target) {
|
||||
int w, h;
|
||||
SDL_GetRenderOutputSize(renderer, &w, &h);
|
||||
y = (h - y) - rect->h;
|
||||
}
|
||||
|
||||
data->glPixelStorei(GL_PACK_ALIGNMENT, 1);
|
||||
data->glPixelStorei(GL_PACK_ROW_LENGTH, (surface->pitch / SDL_BYTESPERPIXEL(format)));
|
||||
|
||||
data->glReadPixels(rect->x, renderer->target ? rect->y : (h - rect->y) - rect->h,
|
||||
rect->w, rect->h, targetFormat, type, surface->pixels);
|
||||
data->glReadPixels(rect->x, y, rect->w, rect->h, targetFormat, type, surface->pixels);
|
||||
|
||||
if (!GL_CheckError("glReadPixels()", renderer)) {
|
||||
SDL_DestroySurface(surface);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue