mirror of https://github.com/libsdl-org/SDL.git
SDL_BlitSurfaceScaled(): Do not divide by zero
This commit is contained in:
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;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue