small fix to prevent graphic drawing overflow
authorHolger Schemel <info@artsoft.org>
Thu, 20 Oct 2016 09:49:40 +0000 (11:49 +0200)
committerHolger Schemel <info@artsoft.org>
Thu, 20 Oct 2016 09:49:40 +0000 (11:49 +0200)
src/editor.c

index ffad0a5cb9a32bbfe1b75bca50c21a8fc9b40360..98c25977c1e0b3ea09bdf7bf26297a76eb4b9f6b 100644 (file)
@@ -7669,7 +7669,9 @@ void DrawLevelEd()
   BlitBitmap(graphic_info[IMG_BACKGROUND_PALETTE].bitmap, drawto,
             graphic_info[IMG_BACKGROUND_PALETTE].src_x,
             graphic_info[IMG_BACKGROUND_PALETTE].src_y,
-            DXSIZE, DYSIZE, DX, DY);
+            MIN(DXSIZE, graphic_info[IMG_BACKGROUND_PALETTE].width),
+            MIN(DYSIZE, graphic_info[IMG_BACKGROUND_PALETTE].height),
+            DX, DY);
 
   /* draw bigger door */
   DrawSpecialEditorDoor();
@@ -7678,7 +7680,9 @@ void DrawLevelEd()
   BlitBitmap(graphic_info[IMG_BACKGROUND_TOOLBOX].bitmap, drawto,
             graphic_info[IMG_BACKGROUND_TOOLBOX].src_x,
             graphic_info[IMG_BACKGROUND_TOOLBOX].src_y,
-            EXSIZE, EYSIZE, EX, EY);
+            MIN(EXSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].width),
+            MIN(EYSIZE, graphic_info[IMG_BACKGROUND_TOOLBOX].height),
+            EX, EY);
 
   // redraw_mask |= REDRAW_ALL;