|
@@ -664,7 +664,7 @@ static bool SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *drawstate)
|
|
|
|
|
|
|
+static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *drawstate, const SDL_Rect *srcrect)
|
|
|
{
|
|
{
|
|
|
const Uint8 r = drawstate->color.r;
|
|
const Uint8 r = drawstate->color.r;
|
|
|
const Uint8 g = drawstate->color.g;
|
|
const Uint8 g = drawstate->color.g;
|
|
@@ -674,6 +674,14 @@ static void PrepTextureForCopy(const SDL_RenderCommand *cmd, SW_DrawStateCache *
|
|
|
SDL_Texture *texture = cmd->data.draw.texture;
|
|
SDL_Texture *texture = cmd->data.draw.texture;
|
|
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
|
SDL_Surface *surface = (SDL_Surface *)texture->internal;
|
|
|
|
|
|
|
|
|
|
+ if (SDL_SurfaceHasRLE(surface) &&
|
|
|
|
|
+ srcrect &&
|
|
|
|
|
+ texture->access == SDL_TEXTUREACCESS_STATIC &&
|
|
|
|
|
+ SDL_ISPIXELFORMAT_ALPHA(surface->format) &&
|
|
|
|
|
+ (srcrect->x != 0 || srcrect->y != 0 || srcrect->w != surface->w || srcrect->h != surface->h)) {
|
|
|
|
|
+ SDL_SetSurfaceRLE(surface, false);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// !!! FIXME: we can probably avoid some of these calls.
|
|
// !!! FIXME: we can probably avoid some of these calls.
|
|
|
SDL_SetSurfaceColorMod(surface, r, g, b);
|
|
SDL_SetSurfaceColorMod(surface, r, g, b);
|
|
|
SDL_SetSurfaceAlphaMod(surface, a);
|
|
SDL_SetSurfaceAlphaMod(surface, a);
|
|
@@ -857,7 +865,7 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
|
|
|
|
|
|
|
SetDrawState(surface, &drawstate);
|
|
SetDrawState(surface, &drawstate);
|
|
|
|
|
|
|
|
- PrepTextureForCopy(cmd, &drawstate);
|
|
|
|
|
|
|
+ PrepTextureForCopy(cmd, &drawstate, srcrect);
|
|
|
|
|
|
|
|
// Apply viewport
|
|
// Apply viewport
|
|
|
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
|
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
|
@@ -912,7 +920,7 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
|
|
{
|
|
{
|
|
|
CopyExData *copydata = (CopyExData *)(((Uint8 *)vertices) + cmd->data.draw.first);
|
|
CopyExData *copydata = (CopyExData *)(((Uint8 *)vertices) + cmd->data.draw.first);
|
|
|
SetDrawState(surface, &drawstate);
|
|
SetDrawState(surface, &drawstate);
|
|
|
- PrepTextureForCopy(cmd, &drawstate);
|
|
|
|
|
|
|
+ PrepTextureForCopy(cmd, &drawstate, ©data->srcrect);
|
|
|
|
|
|
|
|
// Apply viewport
|
|
// Apply viewport
|
|
|
if (drawstate.viewport &&
|
|
if (drawstate.viewport &&
|
|
@@ -943,7 +951,7 @@ static bool SW_RunCommandQueue(SDL_Renderer *renderer, SDL_RenderCommand *cmd, v
|
|
|
|
|
|
|
|
GeometryCopyData *ptr = (GeometryCopyData *)verts;
|
|
GeometryCopyData *ptr = (GeometryCopyData *)verts;
|
|
|
|
|
|
|
|
- PrepTextureForCopy(cmd, &drawstate);
|
|
|
|
|
|
|
+ PrepTextureForCopy(cmd, &drawstate, NULL);
|
|
|
|
|
|
|
|
// Apply viewport
|
|
// Apply viewport
|
|
|
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|
|
if (drawstate.viewport && (drawstate.viewport->x || drawstate.viewport->y)) {
|