Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Fixed scaled blitting for complex blit operations (e.g. color modulat…
Browse files Browse the repository at this point in the history
…ion and alpha blending)
  • Loading branch information
slouken committed Oct 1, 2012
1 parent a8d0bb2 commit 0b43c14
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/video/SDL_surface.c
Expand Up @@ -684,6 +684,12 @@ int
SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
SDL_Surface * dst, SDL_Rect * dstrect)
{
static const Uint32 complex_copy_flags = (
SDL_COPY_MODULATE_COLOR | SDL_COPY_MODULATE_ALPHA |
SDL_COPY_BLEND | SDL_COPY_ADD | SDL_COPY_MOD |
SDL_COPY_COLORKEY
);

/* Save off the original dst width, height */
int dstW = dstrect->w;
int dstH = dstrect->h;
Expand All @@ -710,7 +716,9 @@ SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,

src->map->info.flags |= SDL_COPY_NEAREST;

if ( src->format->format == dst->format->format && !SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
if ( !(src->map->info.flags & complex_copy_flags) &&
src->format->format == dst->format->format &&
!SDL_ISPIXELFORMAT_INDEXED(src->format->format) ) {
return SDL_SoftStretch( src, &final_src, dst, &final_dst );
} else {
return SDL_LowerBlit( src, &final_src, dst, &final_dst );
Expand Down

0 comments on commit 0b43c14

Please sign in to comment.