mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-07 03:48:14 +00:00
SDL_BlitSurfaceScaled(): Do not divide by zero
This commit is contained in:

committed by
Sam Lantinga

parent
8017d38adc
commit
fe849f1572
@@ -1142,6 +1142,13 @@ bool SDL_BlitSurfaceScaled(SDL_Surface *src, const SDL_Rect *srcrect, SDL_Surfac
|
|||||||
return SDL_BlitSurface(src, srcrect, dst, dstrect);
|
return SDL_BlitSurface(src, srcrect, dst, dstrect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (src_w == 0) {
|
||||||
|
src_w = 1;
|
||||||
|
}
|
||||||
|
if (src_h == 0) {
|
||||||
|
src_h = 1;
|
||||||
|
}
|
||||||
|
|
||||||
scaling_w = (double)dst_w / src_w;
|
scaling_w = (double)dst_w / src_w;
|
||||||
scaling_h = (double)dst_h / src_h;
|
scaling_h = (double)dst_h / src_h;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user