浏览代码

Don't divide by zero in slow blitter

Other blitters seem to handle zero width/height destinations correctly.

Signed-off-by: Marcin Serwin <[email protected]>
Marcin Serwin 1 月之前
父节点
当前提交
53ee410d7a
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/video/SDL_blit_slow.c

+ 2 - 2
src/video/SDL_blit_slow.c

@@ -85,8 +85,8 @@ void SDL_Blit_Slow(SDL_BlitInfo *info)
         last_index = SDL_LookupRGBAColor(palette_map, last_pixel, dst_pal);
         last_index = SDL_LookupRGBAColor(palette_map, last_pixel, dst_pal);
     }
     }
 
 
-    incy = ((Uint64)info->src_h << 16) / info->dst_h;
-    incx = ((Uint64)info->src_w << 16) / info->dst_w;
+    incy = info->dst_h ? ((Uint64)info->src_h << 16) / info->dst_h : 0;
+    incx = info->dst_w ? ((Uint64)info->src_w << 16) / info->dst_w : 0;
     posy = incy / 2; // start at the middle of pixel
     posy = incy / 2; // start at the middle of pixel
 
 
     while (info->dst_h--) {
     while (info->dst_h--) {