Merging r50192 through r50223 from trunk into soc-2011-tomato
[blender.git] / source / blender / editors / sculpt_paint / paint_image.c
index 66b78f2..35db965 100644 (file)
@@ -390,7 +390,11 @@ typedef struct UndoImageTile {
        char idname[MAX_ID_NAME];  /* name instead of pointer*/
        char ibufname[IB_FILENAME_SIZE];
 
-       void *rect;
+       union {
+               float        *fp;
+               unsigned int *uint;
+               void         *pt;
+       } rect;
        int x, y;
 
        short source, use_float;
@@ -408,10 +412,10 @@ static void undo_copy_tile(UndoImageTile *tile, ImBuf *tmpibuf, ImBuf *ibuf, int
                    tile->y * IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE);
 
        if (ibuf->rect_float) {
-               SWAP(void *, tmpibuf->rect_float, tile->rect);
+               SWAP(float *, tmpibuf->rect_float, tile->rect.fp);
        }
        else {
-               SWAP(void *, tmpibuf->rect, tile->rect);
+               SWAP(unsigned int *, tmpibuf->rect, tile->rect.uint);
        }
        
        if (restore)
@@ -430,7 +434,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
                if (tile->x == x_tile && tile->y == y_tile && ima->gen_type == tile->gen_type && ima->source == tile->source)
                        if (tile->use_float == use_float)
                                if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0)
-                                       return tile->rect;
+                                       return tile->rect.pt;
        
        if (*tmpibuf == NULL)
                *tmpibuf = IMB_allocImBuf(IMAPAINT_TILE_SIZE, IMAPAINT_TILE_SIZE, 32, IB_rectfloat | IB_rect);
@@ -442,7 +446,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
 
        allocsize = IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE * 4;
        allocsize *= (ibuf->rect_float) ? sizeof(float) : sizeof(char);
-       tile->rect = MEM_mapallocN(allocsize, "UndeImageTile.rect");
+       tile->rect.pt = MEM_mapallocN(allocsize, "UndeImageTile.rect");
 
        BLI_strncpy(tile->ibufname, ibuf->name, sizeof(tile->ibufname));
 
@@ -455,7 +459,7 @@ static void *image_undo_push_tile(Image *ima, ImBuf *ibuf, ImBuf **tmpibuf, int
 
        BLI_addtail(lb, tile);
        
-       return tile->rect;
+       return tile->rect.pt;
 }
 
 static void image_undo_restore(bContext *C, ListBase *lb)
@@ -519,7 +523,7 @@ static void image_undo_free(ListBase *lb)
        UndoImageTile *tile;
 
        for (tile = lb->first; tile; tile = tile->next)
-               MEM_freeN(tile->rect);
+               MEM_freeN(tile->rect.pt);
 }
 
 /* get active image for face depending on old/new shading system */
@@ -4550,15 +4554,15 @@ static int imapaint_canvas_set(ImagePaintState *s, Image *ima)
 
                /* temporarily add float rect for cloning */
                if (s->canvas->rect_float && !s->clonecanvas->rect_float) {
-                       int profile = IB_PROFILE_NONE;
+                       short profile = IB_PROFILE_NONE;
                        
                        /* Don't want to color manage, but don't disturb existing profiles */
-                       SWAP(int, s->clonecanvas->profile, profile);
+                       SWAP(short, s->clonecanvas->profile, profile);
 
                        IMB_float_from_rect(s->clonecanvas);
                        s->clonefreefloat = 1;
                        
-                       SWAP(int, s->clonecanvas->profile, profile);
+                       SWAP(short, s->clonecanvas->profile, profile);
                }
                else if (!s->canvas->rect_float && !s->clonecanvas->rect)
                        IMB_rect_from_float(s->clonecanvas);