Skip to content

Commit

Permalink
Make sure cut_surface gets a neutral surface.
Browse files Browse the repository at this point in the history
Also change its return to an optimised surface. Fixes bug #20876.

From the comment added to the source:
Unlike other image functions cut_surface does not convert the input
surface to a neutral surface, nor does it convert its return surface
to an optimised surface.

Since it seems to work for most cases, rather change this caller instead
of the function signature. (The issue was discovered in bug #20876).
  • Loading branch information
mordante committed Mar 8, 2014
1 parent 1c0323c commit 5d66e92
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/image_modifications.cpp
Expand Up @@ -216,7 +216,17 @@ surface crop_modification::operator()(const surface& src) const
ERR_DP << "start Y coordinate of CROP modification is negative - truncating to zero\n";
area.y = 0;
}
return cut_surface(src, area);

/*
* Unlike other image functions cut_surface does not convert the input
* surface to a neutral surface, nor does it convert its return surface
* to an optimised surface.
*
* Since it seems to work for most cases, rather change this caller instead
* of the function signature. (The issue was discovered in bug #20876).
*/
return create_optimized_surface(
cut_surface(make_neutral_surface(src), area));
}

const SDL_Rect& crop_modification::get_slice() const
Expand Down

0 comments on commit 5d66e92

Please sign in to comment.