From 1f2e5621296c35af5d2e2e0756087d2e214e7430 Mon Sep 17 00:00:00 2001 From: ddennedy Date: Thu, 7 May 2009 03:26:29 +0000 Subject: [PATCH] Prevent potential divide-by-zero errors in sdl_still consumer. Signed-off-by: Dan Dennedy git-svn-id: https://mlt.svn.sourceforge.net/svnroot/mlt/trunk/mlt@1422 d19143bc-622f-0410-bfdd-b5b2a6649095 --- src/modules/sdl/consumer_sdl_still.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-) diff --git a/src/modules/sdl/consumer_sdl_still.c b/src/modules/sdl/consumer_sdl_still.c index 202b434..3efd8f4 100644 --- a/src/modules/sdl/consumer_sdl_still.c +++ b/src/modules/sdl/consumer_sdl_still.c @@ -252,6 +252,7 @@ static void sdl_unlock_display( ) static inline void display_1( SDL_Surface *screen, SDL_Rect rect, uint8_t *image, int width, int height ) { // Generate the affine transform scaling values + if ( rect.w == 0 || rect.h == 0 ) return; int scale_width = ( width << 16 ) / rect.w; int scale_height = ( height << 16 ) / rect.h; int stride = width * 3; @@ -281,6 +282,7 @@ static inline void display_1( SDL_Surface *screen, SDL_Rect rect, uint8_t *image static inline void display_2( SDL_Surface *screen, SDL_Rect rect, uint8_t *image, int width, int height ) { // Generate the affine transform scaling values + if ( rect.w == 0 || rect.h == 0 ) return; int scale_width = ( width << 16 ) / rect.w; int scale_height = ( height << 16 ) / rect.h; int stride = width * 3; @@ -310,6 +312,7 @@ static inline void display_2( SDL_Surface *screen, SDL_Rect rect, uint8_t *image static inline void display_3( SDL_Surface *screen, SDL_Rect rect, uint8_t *image, int width, int height ) { // Generate the affine transform scaling values + if ( rect.w == 0 || rect.h == 0 ) return; int scale_width = ( width << 16 ) / rect.w; int scale_height = ( height << 16 ) / rect.h; int stride = width * 3; @@ -343,6 +346,7 @@ static inline void display_3( SDL_Surface *screen, SDL_Rect rect, uint8_t *image static inline void display_4( SDL_Surface *screen, SDL_Rect rect, uint8_t *image, int width, int height ) { // Generate the affine transform scaling values + if ( rect.w == 0 || rect.h == 0 ) return; int scale_width = ( width << 16 ) / rect.w; int scale_height = ( height << 16 ) / rect.h; int stride = width * 3; -- 1.7.4.4