Skip to content

Commit

Permalink
Fixed bug 2123 - SDL_BlitScaled crashes in src/video/SDL_blit_N.c:2145
Browse files Browse the repository at this point in the history
We need to reset the blit function when switching between scaled and unscaled blits.
  • Loading branch information
slouken committed Oct 18, 2013
1 parent a329c7f commit 379c005
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/video/SDL_surface.c
Expand Up @@ -596,6 +596,12 @@ SDL_UpperBlit(SDL_Surface * src, const SDL_Rect * srcrect,
h -= dy;
}

/* Switch back to a fast blit if we were previously stretching */
if (src->map->info.flags & SDL_COPY_NEAREST) {
src->map->info.flags &= ~SDL_COPY_NEAREST;
SDL_InvalidateMap(src->map);
}

if (w > 0 && h > 0) {
SDL_Rect sr;
sr.x = srcx;
Expand Down Expand Up @@ -747,7 +753,10 @@ SDL_LowerBlitScaled(SDL_Surface * src, SDL_Rect * srcrect,
return 0;
}

src->map->info.flags |= SDL_COPY_NEAREST;
if (!(src->map->info.flags & SDL_COPY_NEAREST)) {
src->map->info.flags |= SDL_COPY_NEAREST;
SDL_InvalidateMap(src->map);
}

if ( !(src->map->info.flags & complex_copy_flags) &&
src->format->format == dst->format->format &&
Expand Down

0 comments on commit 379c005

Please sign in to comment.