Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Static analysis fix: division by zero.
- Loading branch information
Showing
with
6 additions
and
1 deletion.
-
+6
−1
src/render/SDL_yuv_sw.c
|
@@ -1274,11 +1274,16 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, |
|
|
Uint32 target_format, int w, int h, void *pixels, |
|
|
int pitch) |
|
|
{ |
|
|
const int targetbpp = SDL_BYTESPERPIXEL(target_format); |
|
|
int stretch; |
|
|
int scale_2x; |
|
|
Uint8 *lum, *Cr, *Cb; |
|
|
int mod; |
|
|
|
|
|
if (targetbpp == 0) { |
|
|
return SDL_SetError("Invalid target pixel format"); |
|
|
} |
|
|
|
|
|
/* Make sure we're set up to display in the desired format */ |
|
|
if (target_format != swdata->target_format) { |
|
|
if (SDL_SW_SetupYUVDisplay(swdata, target_format) < 0) { |
|
@@ -1366,7 +1371,7 @@ SDL_SW_CopyYUVToRGB(SDL_SW_YUVTexture * swdata, const SDL_Rect * srcrect, |
|
|
default: |
|
|
return SDL_SetError("Unsupported YUV format in copy"); |
|
|
} |
|
|
mod = (pitch / SDL_BYTESPERPIXEL(target_format)); |
|
|
mod = (pitch / targetbpp); |
|
|
|
|
|
if (scale_2x) { |
|
|
mod -= (swdata->w * 2); |
|
|