mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-01-04 20:37:49 +00:00
Enable RLE more often in the software renderer
We don't need to aggressively disable RLE acceleration anymore because the original pixels remain available for operations that aren't supported by the RLE blitter.
This commit is contained in:
@@ -154,10 +154,7 @@ static bool SW_CreateTexture(SDL_Renderer *renderer, SDL_Texture *texture, SDL_P
|
||||
}
|
||||
}
|
||||
|
||||
/* Only RLE encode textures without an alpha channel since the RLE coder
|
||||
* discards the color values of pixels with an alpha value of zero.
|
||||
*/
|
||||
if (texture->access == SDL_TEXTUREACCESS_STATIC && !SDL_ISPIXELFORMAT_ALPHA(surface->format)) {
|
||||
if (texture->access == SDL_TEXTUREACCESS_STATIC) {
|
||||
SDL_SetSurfaceRLE(surface, true);
|
||||
}
|
||||
|
||||
@@ -674,13 +671,6 @@ static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *
|
||||
const SDL_BlendMode blend = cmd->data.draw.blend;
|
||||
SDL_Texture *texture = cmd->data.draw.texture;
|
||||
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
||||
const bool colormod = ((r & g & b) != 0xFF);
|
||||
const bool alphamod = (a != 0xFF);
|
||||
const bool blending = ((blend == SDL_BLENDMODE_ADD) || (blend == SDL_BLENDMODE_MOD) || (blend == SDL_BLENDMODE_MUL));
|
||||
|
||||
if (colormod || alphamod || blending) {
|
||||
SDL_SetSurfaceRLE(surface, false);
|
||||
}
|
||||
|
||||
// !!! FIXME: we can probably avoid some of these calls.
|
||||
SDL_SetSurfaceColorMod(surface, r, g, b);
|
||||
@@ -876,11 +866,6 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
||||
if (srcrect->w == dstrect->w && srcrect->h == dstrect->h) {
|
||||
SDL_BlitSurface(src, srcrect, surface, dstrect);
|
||||
} else {
|
||||
/* If scaling is ever done, permanently disable RLE (which doesn't support scaling)
|
||||
* to avoid potentially frequent RLE encoding/decoding.
|
||||
*/
|
||||
SDL_SetSurfaceRLE(surface, false);
|
||||
|
||||
// Prevent to do scaling + clipping on viewport boundaries as it may lose proportion
|
||||
if (dstrect->x < 0 || dstrect->y < 0 || dstrect->x + dstrect->w > surface->w || dstrect->y + dstrect->h > surface->h) {
|
||||
SDL_Surface *tmp = SDL_CreateSurface(dstrect->w, dstrect->h, surface->format);
|
||||
|
||||
Reference in New Issue
Block a user