]> mj.ucw.cz Git - libucw.git/commitdiff
fixed forbidden access to rows gaps
authorPavel Charvat <pavel.charvat@netcentrum.cz>
Wed, 13 Sep 2006 07:06:56 +0000 (09:06 +0200)
committerPavel Charvat <pavel.charvat@netcentrum.cz>
Wed, 13 Sep 2006 07:06:56 +0000 (09:06 +0200)
images/image.c

index 914d0f17c4f52112f3fabe20e637b3a2ff52d0d3..deb8f9f81141f81b4d53425ad2e6074c5a9b8b7c 100644 (file)
@@ -145,7 +145,7 @@ image_clone(struct image_thread *it, struct image *src, uns flags, struct mempoo
 #         define IMAGE_WALK_DO_STEP do{ walk_pos[0] = walk_sec_pos[0]; walk_pos[1] = walk_sec_pos[1]; walk_pos[2] = walk_sec_pos[2]; }while(0)
 #         include "images/image-walk.h"
        }
-      else if (src->row_size != img->row_size)
+      else if (src->row_size != img->row_size || ((img->flags | src->flags) & IMAGE_GAPS_PROTECTED))
         {
           byte *s = src->pixels;
           byte *d = img->pixels;
@@ -176,7 +176,15 @@ image_clear(struct image_thread *it UNUSED, struct image *img)
 {
   DBG("image_clear(img=%p)", img);
   if (img->image_size)
-    bzero(img->pixels, img->image_size);
+    if (img->flags & IMAGE_GAPS_PROTECTED)
+      {
+        byte *p = img->pixels;
+        uns bytes = img->cols * img->pixel_size;
+       for (uns row = img->rows; row--; p += img->row_size)
+         bzero(p, bytes);
+      }
+    else
+      bzero(img->pixels, img->image_size);
 }
 
 struct image *