]> mj.ucw.cz Git - libucw.git/blobdiff - images/image.c
small bugfixes about transparency
[libucw.git] / images / image.c
index 1db02b104ff287df2893b88fb343a08ce504ed0e..13576d8cd72e7a7fe9c49d59f300f8dd354adeaa 100644 (file)
@@ -125,12 +125,14 @@ image_clone(struct image_thread *it, struct image *src, uns flags, struct mempoo
     return NULL;
   if (img->image_size)
     {
-      if (src->pixel_size != img->pixel_size)
+      if (src->pixel_size != img->pixel_size) /* conversion between aligned and unaligned RGB */
         {
-         struct image *sec_img = src;
+#        define IMAGE_WALK_PREFIX(x) walk_##x
 #         define IMAGE_WALK_INLINE
+#        define IMAGE_WALK_IMAGE img
+#        define IMAGE_WALK_SEC_IMAGE src
 #         define IMAGE_WALK_DOUBLE
-#         define IMAGE_WALK_DO_STEP do{ *(u32 *)pos = *(u32 *)sec_pos; }while(0)
+#         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)
@@ -152,10 +154,10 @@ image_clone(struct image_thread *it, struct image *src, uns flags, struct mempoo
 }
 
 void
-image_destroy(struct image_thread *it UNUSED, struct image *img)
+image_destroy(struct image *img)
 {
   DBG("image_destroy(img=%p)", img);
-  xfree((byte *)img);
+  xfree(img);
 }
 
 void