replace ImBuf.depth with ImBuf.planes to match ImageFormatData.planes & to avoid...
authorCampbell Barton <ideasman42@gmail.com>
Mon, 21 Nov 2011 20:47:19 +0000 (20:47 +0000)
committerCampbell Barton <ideasman42@gmail.com>
Mon, 21 Nov 2011 20:47:19 +0000 (20:47 +0000)
34 files changed:
release/scripts/startup/bl_ui/properties_render.py
source/blender/blenkernel/intern/bmfont.c
source/blender/blenkernel/intern/image.c
source/blender/blenkernel/intern/movieclip.c
source/blender/blenkernel/intern/scene.c
source/blender/blenkernel/intern/sequencer.c
source/blender/blenkernel/intern/tracking.c
source/blender/editors/object/object_bake.c
source/blender/editors/render/render_opengl.c
source/blender/editors/sculpt_paint/paint_image.c
source/blender/editors/space_image/image_buttons.c
source/blender/editors/space_image/image_ops.c
source/blender/imbuf/IMB_imbuf_types.h
source/blender/imbuf/intern/IMB_filter.h
source/blender/imbuf/intern/allocimbuf.c
source/blender/imbuf/intern/filter.c
source/blender/imbuf/intern/imbuf_cocoa.m
source/blender/imbuf/intern/iris.c
source/blender/imbuf/intern/jp2.c
source/blender/imbuf/intern/jpeg.c
source/blender/imbuf/intern/openexr/openexr_api.cpp
source/blender/imbuf/intern/png.c
source/blender/imbuf/intern/scaling.c
source/blender/imbuf/intern/targa.c
source/blender/imbuf/intern/thumbs.c
source/blender/imbuf/intern/tiff.c
source/blender/makesdna/DNA_scene_types.h
source/blender/makesrna/intern/rna_image.c
source/blender/makesrna/intern/rna_image_api.c
source/blender/makesrna/intern/rna_scene.c
source/blender/render/intern/source/pipeline.c
source/blender/render/intern/source/rendercore.c
source/creator/creator.c
source/gameengine/GamePlayer/common/bmfont.cpp

index e8da457f296738c051a8e1fabad1af80d42bb842..100f5b1730fc29f8d7c3e39412da489137eddac1 100644 (file)
@@ -467,53 +467,6 @@ class RENDER_PT_output(RenderButtonsPanel, Panel):
         col.prop(rd, "use_overwrite")
         col.prop(rd, "use_placeholder")
 
-        """
-        if file_format in {'AVI_JPEG', 'JPEG'}:
-            layout.prop(rd, "file_quality", slider=True)
-
-        if file_format == 'PNG':
-            layout.prop(rd, "file_quality", slider=True, text="Compression")
-
-        if file_format in {'OPEN_EXR', 'MULTILAYER'}:
-            row = layout.row()
-            row.prop(rd, "exr_codec", text="Codec")
-
-            if file_format == 'OPEN_EXR':
-                row = layout.row()
-                row.prop(rd, "use_exr_half")
-                row.prop(rd, "exr_zbuf")
-                row.prop(rd, "exr_preview")
-
-        elif file_format == 'JPEG2000':
-            split = layout.split()
-            col = split.column()
-            col.label(text="Depth:")
-            col.row().prop(rd, "jpeg2k_depth", expand=True)
-
-            col = split.column()
-            col.prop(rd, "jpeg2k_preset", text="")
-            col.prop(rd, "jpeg2k_ycc")
-
-        elif file_format in {'CINEON', 'DPX'}:
-
-            split = layout.split()
-            split.label("FIXME: hard coded Non-Linear, Gamma:1.0")
-            '''
-            col = split.column()
-            col.prop(rd, "use_cineon_log", text="Convert to Log")
-
-            col = split.column(align=True)
-            col.active = rd.use_cineon_log
-            col.prop(rd, "cineon_black", text="Black")
-            col.prop(rd, "cineon_white", text="White")
-            col.prop(rd, "cineon_gamma", text="Gamma")
-            '''
-
-        elif file_format == 'TIFF':
-            layout.prop(rd, "use_tiff_16bit")
-
-        elif  """
-
         if file_format == 'QUICKTIME_CARBON':
             layout.operator("scene.render_data_set_quicktime_codec")
 
index f1e6de9a0c482ebede89992a80b57b637e773ee7..0211dcdf42c067acff2d5f08cc5ccd7dc57b1052 100644 (file)
@@ -159,7 +159,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
                ibuf->userdata = bmfont;
                ibuf->userflags |= IB_BITMAPFONT;
 
-               if (ibuf->depth < 32) {
+               if (ibuf->planes < 32) {
                        // we're going to fake alpha here:
                        calcAlpha(ibuf);
                }
index 6a4cb049be75a1571f1feb0f613513a5c5dbf777..c99396e6939fd54146e6d0561955e78c67759a7d 100644 (file)
@@ -601,7 +601,7 @@ void BKE_image_memorypack(Image *ima)
        }
        
        ibuf->ftype= PNG;
-       ibuf->depth= 32;
+       ibuf->planes= R_IMF_PLANES_RGBA;
        
        IMB_saveiff(ibuf, ibuf->name, IB_rect | IB_mem);
        if(ibuf->encodedbuffer==NULL) {
@@ -1535,7 +1535,7 @@ int BKE_write_ibuf(ImBuf *ibuf, const char *name, ImageFormatData *imf)
                /* R_JPEG90, etc. default we save jpegs */
                if(quality < 10) quality= 90;
                ibuf->ftype= JPG|quality;
-               if(ibuf->depth==32) ibuf->depth= 24;    /* unsupported feature only confuses other s/w */
+               if(ibuf->planes==32) ibuf->planes= 24;  /* unsupported feature only confuses other s/w */
        }
        
        BLI_make_existing_file(name);
@@ -2487,13 +2487,13 @@ int BKE_image_has_alpha(struct Image *image)
 {
        ImBuf *ibuf;
        void *lock;
-       int depth;
+       int planes;
        
        ibuf= BKE_image_acquire_ibuf(image, NULL, &lock);
-       depth = (ibuf?ibuf->depth:0);
+       planes = (ibuf?ibuf->planes:0);
        BKE_image_release_ibuf(image, lock);
 
-       if (depth == 32)
+       if (planes == 32)
                return 1;
        else
                return 0;
index 540d757f0c9d037d1bd3c5175dd12ddd5150bef1..12a2fe28bc8b123ed6531613969fe96aa37aaa15 100644 (file)
@@ -913,8 +913,8 @@ static void movieclip_build_proxy_ibuf(MovieClip *clip, ImBuf *ibuf, int cfra, i
        scaleibuf->ftype= JPG | quality;
 
        /* unsupported feature only confuses other s/w */
-       if(scaleibuf->depth==32)
-               scaleibuf->depth= 24;
+       if(scaleibuf->planes==32)
+               scaleibuf->planes= 24;
 
        BLI_lock_thread(LOCK_MOVIECLIP);
 
index 68e5ebeed4f0ac4b3aa6942e3f6033de415acd1e..ea0593aba66462001b521b382784f8443e861c2f 100644 (file)
@@ -348,7 +348,7 @@ Scene *add_scene(const char *name)
        sce->r.filtertype= R_FILTER_MITCH;
        sce->r.size= 50;
 
-       sce->r.im_format.planes= R_PLANES24;
+       sce->r.im_format.planes= R_IMF_PLANES_RGB;
        sce->r.im_format.imtype= R_PNG;
        sce->r.im_format.quality= 90;
 
index 5d35867d9c32fc06279a5325dd34a687510e0507..880bdbfaa962e80643c9df611a2fb193b9c9acb0 100644 (file)
@@ -1327,8 +1327,8 @@ static void seq_proxy_build_frame(SeqRenderData context,
        ibuf->ftype= JPG | quality;
 
        /* unsupported feature only confuses other s/w */
-       if(ibuf->depth==32)
-               ibuf->depth= 24;
+       if(ibuf->planes==32)
+               ibuf->planes= 24;
 
        BLI_make_existing_file(name);
        
@@ -1729,7 +1729,7 @@ static ImBuf * input_preprocess(
        }
 
        if(seq->flag & SEQ_MAKE_PREMUL) {
-               if(ibuf->depth == 32 && ibuf->zbuf == NULL) {
+               if(ibuf->planes == 32 && ibuf->zbuf == NULL) {
                        IMB_premultiply_alpha(ibuf);
                }
        }
index 0c395931212075fa456edcbf3ca8f1005e8c6cf7..474b00e626bf0de7cee0a6b12389f520509c313c 100644 (file)
@@ -2022,7 +2022,7 @@ static ImBuf* stabilize_alloc_ibuf(ImBuf *cacheibuf, ImBuf *srcibuf, int fill)
                }
        }
        else {
-               cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->depth, flags);
+               cacheibuf= IMB_allocImBuf(srcibuf->x, srcibuf->y, srcibuf->planes, flags);
                cacheibuf->profile= srcibuf->profile;
        }
 
index 63a316e7f7b621e847e85dd2afd5ad27d764e9f1..5dc1c1b0f03c3f94c2435c19211e69dfbca7eefd 100644 (file)
@@ -1039,7 +1039,7 @@ static void clear_images(MTFace *mtface, int totface)
                if((ima->id.flag&LIB_DOIT)==0) {
                        ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
 
-                       IMB_rectfill(ibuf, (ibuf->depth == 32) ? vec_alpha : vec_solid);
+                       IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
                        ima->id.flag|= LIB_DOIT;
                }
        }
index 97e93eb2e7f6a54ea6f1a8ac678e3b191424811b..a68286b8e88ad3561c7eaf36ddae915e7bb277e2 100644 (file)
@@ -440,7 +440,7 @@ static int screen_opengl_render_anim_step(bContext *C, wmOperator *op)
        if(ibuf) {
                /* color -> greyscale */
                /* editing directly would alter the render view */
-               if(scene->r.im_format.planes == R_PLANESBW) {
+               if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
                        ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
                        IMB_color_to_bw(ibuf_bw);
                        // IMB_freeImBuf(ibuf); /* owned by the image */
index 9b256acbca9be130f70561f844d89826d653de9e..f165c83b55182b7601261accf3c9c3c30ae79315 100644 (file)
@@ -4333,7 +4333,7 @@ static ImBuf *imapaint_lift_clone(ImBuf *ibuf, ImBuf *ibufb, int *pos)
        /* note: allocImbuf returns zero'd memory, so regions outside image will
           have zero alpha, and hence not be blended onto the image */
        int w=ibufb->x, h=ibufb->y, destx=0, desty=0, srcx=pos[0], srcy=pos[1];
-       ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->depth, ibufb->flags);
+       ImBuf *clonebuf= IMB_allocImBuf(w, h, ibufb->planes, ibufb->flags);
 
        IMB_rectclip(clonebuf, ibuf, &destx, &desty, &srcx, &srcy, &w, &h);
        IMB_rectblend(clonebuf, ibuf, destx, desty, srcx, srcy, w, h,
index 48627e9d1eded0c41094c1948c8ec2e53b32bde6..54ee92a4413ca2b0bdb6062683a41a570ff0fc5a 100644 (file)
@@ -122,13 +122,13 @@ static void image_info(Scene *scene, ImageUser *iuser, Image *ima, ImBuf *ibuf,
                        if(ibuf->channels!=4) {
                                ofs+= sprintf(str+ofs, "%d float channel(s)", ibuf->channels);
                        }
-                       else if(ibuf->depth==32)
+                       else if(ibuf->planes == R_IMF_PLANES_RGBA)
                                ofs+= sprintf(str+ofs, " RGBA float");
                        else
                                ofs+= sprintf(str+ofs, " RGB float");
                }
                else {
-                       if(ibuf->depth==32)
+                       if(ibuf->planes == R_IMF_PLANES_RGBA)
                                ofs+= sprintf(str+ofs, " RGBA byte");
                        else
                                ofs+= sprintf(str+ofs, " RGB byte");
index 448e109e98a793f154ae22abc9f457c4cd793621..7e2a86f9324b4eacc3c72c9fabc9eb2596243081 100644 (file)
@@ -949,7 +949,7 @@ typedef struct {
 
 static void save_image_options_defaults(SaveImageOptions *simopts)
 {
-       simopts->planes= R_PLANES24;
+       simopts->planes= R_IMF_PLANES_RGB;
        simopts->imtype= R_PNG;
        simopts->subimtype= 0;
        simopts->quality= 90;
@@ -964,7 +964,7 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
        if(ibuf) {
                Image *ima= sima->image;
 
-               simopts->planes= ibuf->depth;
+               simopts->planes= ibuf->planes;
 
                if(ELEM(ima->type, IMA_TYPE_R_RESULT, IMA_TYPE_COMPOSITE)) {
                        simopts->imtype= scene->r.im_format.imtype;
@@ -984,8 +984,8 @@ static int save_image_options_init(SaveImageOptions *simopts, SpaceImage *sima,
                /* sanitize all settings */
 
                /* unlikely but just incase */
-               if (ELEM3(simopts->planes, R_PLANESBW, R_PLANES24, R_PLANES32) == 0) {
-                       simopts->planes= R_PLANES32;
+               if (ELEM3(simopts->planes, R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA) == 0) {
+                       simopts->planes= R_IMF_PLANES_RGBA;
                }
 
                /* some formats dont use quality so fallback to scenes quality */
@@ -1060,18 +1060,18 @@ static void save_image_doit(bContext *C, SpaceImage *sima, wmOperator *op, SaveI
 
                if(ima->type == IMA_TYPE_R_RESULT) {
                        /* enforce user setting for RGB or RGBA, but skip BW */
-                       if(simopts->planes==R_PLANES32) {
-                               ibuf->depth= 32;
+                       if(simopts->planes==R_IMF_PLANES_RGBA) {
+                               ibuf->planes= R_IMF_PLANES_RGBA;
                        }
-                       else if(simopts->planes==R_PLANES24) {
-                               ibuf->depth= 24;
+                       else if(simopts->planes==R_IMF_PLANES_RGB) {
+                               ibuf->planes= R_IMF_PLANES_RGB;
                        }
                }
                else {
                        /* TODO, better solution, if a 24bit image is painted onto it may contain alpha */
                        if(ibuf->userflags & IB_BITMAPDIRTY) { /* it has been painted onto */
                                /* checks each pixel, not ideal */
-                               ibuf->depth= BKE_alphatest_ibuf(ibuf) ? 32 : 24;
+                               ibuf->planes= BKE_alphatest_ibuf(ibuf) ? 32 : 24;
                        }
                }
                
@@ -1240,7 +1240,7 @@ void IMAGE_OT_save_as(wmOperatorType *ot)
 
        /* format options */
        RNA_def_enum(ot->srna, "file_format", image_file_type_items, R_PNG, "File Type", "File type to save image as");
-       RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_PLANES24, "Channels", "Image channels to save");
+       RNA_def_enum(ot->srna, "color_mode", image_color_mode_items, R_IMF_PLANES_RGB, "Channels", "Image channels to save");
        prop= RNA_def_int(ot->srna, "file_quality", 90, 0, 100, "Quality", "", 0, 100);
        RNA_def_property_subtype(prop, PROP_PERCENTAGE);
 
index 59899dc74902ae816959744c85d7b673f5872edb..5ce3d63fe86079d32087da9106ef42eee4c470e8 100644 (file)
@@ -74,7 +74,7 @@ typedef struct ImBuf {
                                                         * but this is problematic with texture math in imagetexture.c
                                                         * avoid problems and use int. - campbell */
 
-       unsigned char depth;    /* Active amount of bits/bitplanes */
+       unsigned char planes;   /* Active amount of bits/bitplanes */
        int channels;                   /* amount of channels in rect_float (0 = 4 channel default) */
 
        /* flags */
index a9e9e0ae776cc7c77ea3de1c662877c1195819bb..29e6c4950dff39a07820b24595b1816bf3b3a7df 100644 (file)
@@ -40,8 +40,8 @@ struct ImBuf;
 
 void imb_filterx(struct ImBuf *ibuf);
 
-void IMB_premultiply_rect(unsigned int *rect, int depth, int w, int h);
-void IMB_premultiply_rect_float(float *rect_float, int depth, int w, int h);
+void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h);
+void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h);
 
 void imb_onehalf_no_alloc(struct ImBuf *ibuf2, struct ImBuf *ibuf1);
 
index 5bbabd846488ee6baa8b853d148c30d012119dd6..d08c86aacbc2f49778e59e668eeef561c0443557 100644 (file)
@@ -323,7 +323,7 @@ short imb_addrectImBuf(ImBuf *ibuf)
        if((ibuf->rect = MEM_mapallocN(size, "imb_addrectImBuf"))) {
                ibuf->mall |= IB_rect;
                ibuf->flags |= IB_rect;
-               if(ibuf->depth > 32) return (addzbufImBuf(ibuf));
+               if(ibuf->planes > 32) return (addzbufImBuf(ibuf));
                else return TRUE;
        }
 
@@ -341,7 +341,7 @@ short imb_addtilesImBuf(ImBuf *ibuf)
        return (ibuf->tiles != NULL);
 }
 
-ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flags)
+ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar planes, unsigned int flags)
 {
        ImBuf *ibuf;
 
@@ -350,7 +350,7 @@ ImBuf *IMB_allocImBuf(unsigned int x, unsigned int y, uchar d, unsigned int flag
        if(ibuf) {
                ibuf->x= x;
                ibuf->y= y;
-               ibuf->depth= d;
+               ibuf->planes= planes;
                ibuf->ftype= TGA;
                ibuf->channels= 4;      /* float option, is set to other values when buffers get assigned */
                ibuf->ppm[0]= ibuf->ppm[1]= 150.0 / 0.0254; /* 150dpi -> pixels-per-meter */
@@ -402,7 +402,7 @@ ImBuf *IMB_dupImBuf(ImBuf *ibuf1)
        y = ibuf1->y;
        if(ibuf1->flags & IB_fields) y *= 2;
        
-       ibuf2 = IMB_allocImBuf(x, y, ibuf1->depth, flags);
+       ibuf2 = IMB_allocImBuf(x, y, ibuf1->planes, flags);
        if(ibuf2 == NULL) return NULL;
 
        if(flags & IB_rect)
index 479c7ed5626ec32118f7bfd6a4508332a1d5e86a..29da7973654bf10e94a1de1720a137042e8f8273 100644 (file)
@@ -148,7 +148,7 @@ void IMB_filtery(struct ImBuf *ibuf)
 
        for (;x>0;x--){
                if (point) {
-                       if (ibuf->depth > 24) filtcolum(point,y,skip);
+                       if (ibuf->planes > 24) filtcolum(point,y,skip);
                        point++;
                        filtcolum(point,y,skip);
                        point++;
@@ -158,7 +158,7 @@ void IMB_filtery(struct ImBuf *ibuf)
                        point++;
                }
                if (pointf) {
-                       if (ibuf->depth > 24) filtcolumf(pointf,y,skip);
+                       if (ibuf->planes > 24) filtcolumf(pointf,y,skip);
                        pointf++;
                        filtcolumf(pointf,y,skip);
                        pointf++;
@@ -186,7 +186,7 @@ void imb_filterx(struct ImBuf *ibuf)
 
        for (;y>0;y--){
                if (point) {
-                       if (ibuf->depth > 24) filtrow(point,x);
+                       if (ibuf->planes > 24) filtrow(point,x);
                        point++;
                        filtrow(point,x);
                        point++;
@@ -196,7 +196,7 @@ void imb_filterx(struct ImBuf *ibuf)
                        point+=skip;
                }
                if (pointf) {
-                       if (ibuf->depth > 24) filtrowf(pointf,x);
+                       if (ibuf->planes > 24) filtrowf(pointf,x);
                        pointf++;
                        filtrowf(pointf,x);
                        pointf++;
@@ -529,12 +529,12 @@ ImBuf *IMB_getmipmap(ImBuf *ibuf, int level)
        return (level == 0)? ibuf: ibuf->mipmap[level-1];
 }
 
-void IMB_premultiply_rect(unsigned int *rect, int depth, int w, int h)
+void IMB_premultiply_rect(unsigned int *rect, char planes, int w, int h)
 {
        char *cp;
        int x, y, val;
 
-       if(depth == 24) {       /* put alpha at 255 */
+       if(planes == 24) {      /* put alpha at 255 */
                cp= (char *)(rect);
 
                for(y=0; y<h; y++)
@@ -555,12 +555,12 @@ void IMB_premultiply_rect(unsigned int *rect, int depth, int w, int h)
        }
 }
 
-void IMB_premultiply_rect_float(float *rect_float, int depth, int w, int h)
+void IMB_premultiply_rect_float(float *rect_float, char planes, int w, int h)
 {
        float val, *cp;
        int x, y;
 
-       if(depth==24) { /* put alpha at 1.0 */
+       if(planes==24) {        /* put alpha at 1.0 */
                cp= rect_float;
 
                for(y=0; y<h; y++)
@@ -587,9 +587,9 @@ void IMB_premultiply_alpha(ImBuf *ibuf)
                return;
 
        if(ibuf->rect)
-               IMB_premultiply_rect(ibuf->rect, ibuf->depth, ibuf->x, ibuf->y);
+               IMB_premultiply_rect(ibuf->rect, ibuf->planes, ibuf->x, ibuf->y);
 
        if(ibuf->rect_float)
-               IMB_premultiply_rect_float(ibuf->rect_float, ibuf->depth, ibuf->x, ibuf->y);
+               IMB_premultiply_rect_float(ibuf->rect_float, ibuf->planes, ibuf->x, ibuf->y);
 }
 
index 7005558d753c6f714a94c90d695453ef0edaf885..b79b1358ec2f90df9594992f839f3063e8f839c5 100644 (file)
@@ -228,7 +228,7 @@ short imb_cocoaSaveImage(struct ImBuf *ibuf, char *name, int flags)
        /* check for a valid number of bytes per pixel.  Like the PNG writer,
         * the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
         * to gray, RGB, RGBA respectively. */
-       samplesperpixel = (uint16_t)((ibuf->depth + 7) >> 3);
+       samplesperpixel = (uint16_t)((ibuf->planes + 7) >> 3);
        switch (samplesperpixel) {
                case 4: /*RGBA type*/
                        hasAlpha = YES;
index cf7337a574bc295444e3a351735a8e909a0abbee..83351b5e0e417014efa1ac136b64a6168d0ca0ad 100644 (file)
@@ -320,7 +320,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
                if (bpp == 1) {
                        
                        ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
-                       if (ibuf->depth > 32) ibuf->depth = 32;
+                       if (ibuf->planes > 32) ibuf->planes = 32;
                        base = ibuf->rect;
                        zbase = (unsigned int *)ibuf->zbuf;
                        
@@ -404,7 +404,7 @@ struct ImBuf *imb_loadiris(unsigned char *mem, size_t size, int flags)
                if (bpp == 1) {
                        
                        ibuf = IMB_allocImBuf(xsize, ysize, 8 * zsize, IB_rect);
-                       if (ibuf->depth > 32) ibuf->depth = 32;
+                       if (ibuf->planes > 32) ibuf->planes = 32;
 
                        base = ibuf->rect;
                        zbase = (unsigned int *)ibuf->zbuf;
@@ -822,7 +822,7 @@ int imb_saveiris(struct ImBuf * ibuf, const char *name, int flags)
        short zsize;
        int ret;
 
-       zsize = (ibuf->depth + 7) >> 3;
+       zsize = (ibuf->planes + 7) >> 3;
        if (flags & IB_zbuf &&  ibuf->zbuf != NULL) zsize = 8;
        
        IMB_convert_rgba_to_abgr(ibuf);
index 151933d6651ec2bf4be5dfef655dff5efefd5618..568dd7a9fb75da44dc7e1efb7d88760f1ff5dd1a 100644 (file)
@@ -101,7 +101,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
 
        int index;
        
-       int w, h, depth;
+       int w, h, planes;
        
        opj_dparameters_t parameters;   /* decompression parameters */
        
@@ -166,10 +166,10 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
        switch (image->numcomps) {
        case 1: /* Greyscale */
        case 3: /* Color */
-               depth= 24; 
+               planes= 24;
                break;
        default: /* 2 or 4 - Greyscale or Color + alpha */
-               depth= 32; /* greyscale + alpha */
+               planes= 32; /* greyscale + alpha */
                break;
        }
        
@@ -190,7 +190,7 @@ struct ImBuf *imb_jp2_decode(unsigned char *mem, size_t size, int flags)
                float_divs[i]= (1<<image->comps[i].prec)-1;
        }
        
-       ibuf= IMB_allocImBuf(w, h, depth, use_float ? IB_rectfloat : IB_rect);
+       ibuf= IMB_allocImBuf(w, h, planes, use_float ? IB_rectfloat : IB_rect);
        
        if (ibuf==NULL) {
                if(dinfo)
@@ -494,7 +494,7 @@ static opj_image_t* ibuftoimage(ImBuf *ibuf, opj_cparameters_t *parameters) {
                
                /* 32bit images == alpha channel */
                /* grayscale not supported yet */
-               numcomps= (ibuf->depth==32) ? 4 : 3;
+               numcomps= (ibuf->planes==32) ? 4 : 3;
        }
        
        w= ibuf->x;
index 89038d7d1d270f70a2b7635bf1895becc92a2a61..5a40de0a65e280973e94fcc22082a15d57d89fa8 100644 (file)
@@ -571,8 +571,8 @@ static int init_jpeg(FILE * outfile, struct jpeg_compress_struct * cinfo, struct
        cinfo->image_height = ibuf->y;
 
        cinfo->in_color_space = JCS_RGB;
-       if (ibuf->depth == 8) cinfo->in_color_space = JCS_GRAYSCALE;
-       if (ibuf->depth == 32) cinfo->in_color_space = JCS_UNKNOWN;
+       if (ibuf->planes == 8) cinfo->in_color_space = JCS_GRAYSCALE;
+       if (ibuf->planes == 32) cinfo->in_color_space = JCS_UNKNOWN;
        
        switch(cinfo->in_color_space){
        case JCS_RGB:
index 1084355dd74dbc554525d876039c16da1f1bde7b..a5a9427ea89be652e1c883b5ca769da81438d5ef 100644 (file)
@@ -208,7 +208,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
                header.channels().insert ("R", Channel (HALF));
                header.channels().insert ("G", Channel (HALF));
                header.channels().insert ("B", Channel (HALF));
-               if (ibuf->depth==32 && channels >= 4)
+               if (ibuf->planes==32 && channels >= 4)
                        header.channels().insert ("A", Channel (HALF));
                if (write_zbuf)         // z we do as float always
                        header.channels().insert ("Z", Channel (FLOAT));
@@ -226,7 +226,7 @@ static int imb_save_openexr_half(struct ImBuf *ibuf, const char *name, int flags
                frameBuffer.insert ("R", Slice (HALF,  (char *) &pixels[0].r, xstride, ystride));       
                frameBuffer.insert ("G", Slice (HALF,  (char *) &pixels[0].g, xstride, ystride));
                frameBuffer.insert ("B", Slice (HALF,  (char *) &pixels[0].b, xstride, ystride));
-               if (ibuf->depth==32 && channels >= 4)
+               if (ibuf->planes==32 && channels >= 4)
                        frameBuffer.insert ("A", Slice (HALF, (char *) &pixels[0].a, xstride, ystride));
                if (write_zbuf)
                        frameBuffer.insert ("Z", Slice (FLOAT, (char *)(ibuf->zbuf_float + (height-1)*width),
@@ -335,7 +335,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
                header.channels().insert ("R", Channel (FLOAT));
                header.channels().insert ("G", Channel (FLOAT));
                header.channels().insert ("B", Channel (FLOAT));
-               if (ibuf->depth==32 && channels >= 4)
+               if (ibuf->planes==32 && channels >= 4)
                        header.channels().insert ("A", Channel (FLOAT));
                if (write_zbuf)
                        header.channels().insert ("Z", Channel (FLOAT));
@@ -355,7 +355,7 @@ static int imb_save_openexr_float(struct ImBuf *ibuf, const char *name, int flag
                frameBuffer.insert ("R", Slice (FLOAT,  (char *)rect[0], xstride, ystride));
                frameBuffer.insert ("G", Slice (FLOAT,  (char *)rect[1], xstride, ystride));
                frameBuffer.insert ("B", Slice (FLOAT,  (char *)rect[2], xstride, ystride));
-               if (ibuf->depth==32 && channels >= 4)
+               if (ibuf->planes==32 && channels >= 4)
                        frameBuffer.insert ("A", Slice (FLOAT,  (char *)rect[3], xstride, ystride));
                if (write_zbuf)
                        frameBuffer.insert ("Z", Slice (FLOAT, (char *) (ibuf->zbuf_float + (height-1)*width),
index be245baef21670a756a267c5c5e2a8386ef6028b..74047ae74f5313e18f5ddff1b5734bbfc8ab8ebd 100644 (file)
@@ -117,7 +117,7 @@ int imb_savepng(struct ImBuf *ibuf, const char *name, int flags)
        if(flags & IB_mem)
                name= "<memory>";
 
-       bytesperpixel = (ibuf->depth + 7) >> 3;
+       bytesperpixel = (ibuf->planes + 7) >> 3;
        if ((bytesperpixel > 4) || (bytesperpixel == 2)) {
                printf("imb_savepng: Cunsupported bytes per pixel: %d for file: '%s'\n", bytesperpixel, name);
                return (0);
index 6519e389a212731a2cdcf051712d108071ad1c01..4ee4aa218da5324276df1dbfe9b54b6c155eb3f1 100644 (file)
@@ -67,7 +67,7 @@ struct ImBuf *IMB_half_x(struct ImBuf *ibuf1)
        
        if (ibuf1->x <= 1) return(IMB_dupImBuf(ibuf1));
        
-       ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->depth, ibuf1->flags);
+       ibuf2 = IMB_allocImBuf((ibuf1->x)/2, ibuf1->y, ibuf1->planes, ibuf1->flags);
        if (ibuf2==NULL) return (NULL);
 
        _p1 = (uchar *) ibuf1->rect;
@@ -128,7 +128,7 @@ struct ImBuf *IMB_double_fast_x(struct ImBuf *ibuf1)
        do_rect= (ibuf1->rect != NULL);
        do_float= (ibuf1->rect_float != NULL);
        
-       ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->depth, ibuf1->flags);
+       ibuf2 = IMB_allocImBuf(2 * ibuf1->x , ibuf1->y , ibuf1->planes, ibuf1->flags);
        if (ibuf2==NULL) return (NULL);
 
        p1 = (int *) ibuf1->rect;
@@ -187,7 +187,7 @@ struct ImBuf *IMB_half_y(struct ImBuf *ibuf1)
        do_rect= (ibuf1->rect != NULL);
        do_float= (ibuf1->rect_float != NULL);
 
-       ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->depth, ibuf1->flags);
+       ibuf2 = IMB_allocImBuf(ibuf1->x , (ibuf1->y) / 2 , ibuf1->planes, ibuf1->flags);
        if (ibuf2==NULL) return (NULL);
 
        _p1 = (uchar *) ibuf1->rect;
@@ -255,7 +255,7 @@ struct ImBuf *IMB_double_fast_y(struct ImBuf *ibuf1)
        do_rect= (ibuf1->rect != NULL);
        do_float= (ibuf1->rect_float != NULL);
 
-       ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->depth, ibuf1->flags);
+       ibuf2 = IMB_allocImBuf(ibuf1->x , 2 * ibuf1->y , ibuf1->planes, ibuf1->flags);
        if (ibuf2==NULL) return (NULL);
 
        p1 = (int *) ibuf1->rect;
@@ -353,7 +353,7 @@ struct ImBuf *IMB_onehalf(struct ImBuf *ibuf1)
        if (ibuf1->x <= 1) return(IMB_half_y(ibuf1));
        if (ibuf1->y <= 1) return(IMB_half_x(ibuf1));
        
-       ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->depth, ibuf1->flags);
+       ibuf2=IMB_allocImBuf((ibuf1->x)/2, (ibuf1->y)/2, ibuf1->planes, ibuf1->flags);
        if (ibuf2==NULL) return (NULL);
        
        imb_onehalf_no_alloc(ibuf2, ibuf1);
index 2efed56ac2cba7708569480683a7e8c3587a9a61..895f922a0da9e94f777ed0e62f606cb3df2eba21 100644 (file)
@@ -200,20 +200,20 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
        size = ibuf->x * ibuf->y;
        rect = (uchar *) ibuf->rect;
 
-       if (ibuf->depth <= 8) {
+       if (ibuf->planes <= 8) {
                while(size > 0){
                        if (putc(*rect, file) == EOF) return (0);
                        size--;
                        rect += 4;
                }
-       } else if (ibuf->depth <= 16) {
+       } else if (ibuf->planes <= 16) {
                while(size > 0){
                        putc(rect[0], file);
                        if (putc(rect[1], file) == EOF) return (0);
                        size--;
                        rect += 4;
                }
-       } else if (ibuf->depth <= 24) {
+       } else if (ibuf->planes <= 24) {
                while(size > 0){
                        putc(rect[2], file);
                        putc(rect[1], file);
@@ -221,7 +221,7 @@ static int dumptarga(struct ImBuf * ibuf, FILE * file)
                        size--;
                        rect += 4;
                }
-       } else if (ibuf->depth <= 32) {
+       } else if (ibuf->planes <= 32) {
                while(size > 0){
                        putc(rect[2], file);
                        putc(rect[1], file);
@@ -244,8 +244,8 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
        
        (void)flags; /* unused */
 
-       buf[16] = (ibuf->depth + 0x7 ) & ~0x7;
-       if (ibuf->depth > 8 ){
+       buf[16] = (ibuf->planes + 0x7 ) & ~0x7;
+       if (ibuf->planes > 8 ){
                buf[2] = 10;
        } else{
                buf[2] = 11;
@@ -265,7 +265,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
 
        /* Don't forget to indicate that your 32 bit
         * targa uses 8 bits for the alpha channel! */
-       if (ibuf->depth==32) {
+       if (ibuf->planes==32) {
                buf[17] |= 0x08;
        }
        fildes = fopen(name,"wb");
@@ -279,7 +279,7 @@ int imb_savetarga(struct ImBuf * ibuf, const char *name, int flags)
        if (ibuf->ftype == RAWTGA) {
                ok = dumptarga(ibuf, fildes);
        } else {                
-               switch((ibuf->depth + 7) >> 3){
+               switch((ibuf->planes + 7) >> 3){
                case 1:
                        ok = makebody_tga(ibuf, fildes, tga_out1);
                        break;
@@ -582,7 +582,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
                
                size = 0;
                for (col = maxcol - 1; col > 0; col >>= 1) size++;
-               ibuf->depth = size;
+               ibuf->planes = size;
 
                if (tga.mapbits != 32) {        /* set alpha bits  */
                        cmap[0] &= BIG_LONG(0x00ffffffl);
@@ -643,7 +643,7 @@ struct ImBuf *imb_loadtarga(unsigned char *mem, size_t mem_size, int flags)
                        cp[3] += cp[3] >> 5;
                        cp[0] = 0xff;
                }
-               ibuf->depth = 24;
+               ibuf->planes = 24;
        }
        
        if (tga.imgtyp == 3 || tga.imgtyp == 11){
index ffe255ab9ebf236398585524bfa0e09fe9c971dc..41278e8381a39e1a313f5e6f6c44aed00599fc09 100644 (file)
@@ -363,7 +363,7 @@ ImBuf* IMB_thumb_create(const char* path, ThumbSize size, ThumbSource source, Im
                        IMB_metadata_change_field(img, "Thumb::Image::Height", cheight);
                }
                img->ftype = PNG;
-               img->depth = 32;                
+               img->planes = 32;
                if (IMB_saveiff(img, temp, IB_rect | IB_metadata)) {
 #ifndef WIN32
                        chmod(temp, S_IRUSR | S_IWUSR);
index d9580961cf575e21c679ff9083d39235efffa8b8..2051b8d21955683394589e665862a9ef757fbb5c 100644 (file)
@@ -404,7 +404,7 @@ static int imb_read_tiff_pixels(ImBuf *ibuf, TIFF *image, int premul)
                ib_flag = IB_rect;
        }
        
-       tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->depth, ib_flag);
+       tmpibuf= IMB_allocImBuf(ibuf->x, ibuf->y, ibuf->planes, ib_flag);
        
        /* simple RGBA image */
        if (!(bitspersample == 32 || bitspersample == 16)) {
@@ -685,7 +685,7 @@ int imb_savetiff(ImBuf *ibuf, const char *name, int flags)
        /* check for a valid number of bytes per pixel.  Like the PNG writer,
         * the TIFF writer supports 1, 3 or 4 bytes per pixel, corresponding
         * to gray, RGB, RGBA respectively. */
-       samplesperpixel = (uint16)((ibuf->depth + 7) >> 3);
+       samplesperpixel = (uint16)((ibuf->planes + 7) >> 3);
        if((samplesperpixel > 4) || (samplesperpixel == 2)) {
                fprintf(stderr,
                        "imb_savetiff: unsupported number of bytes per " 
index ce9903e91ee3af30676aad1ca1d36475cee15232..9df8fc5c5d81a0b65cdf592ddf35d1777d4fdae6 100644 (file)
@@ -218,7 +218,7 @@ typedef struct ImageFormatData {
        char depth;    /* bits per channel, R_IMF_CHAN_DEPTH_8 -> 32,
                        * not a flag, only set 1 at a time */
 
-       char planes  ; /* - R_PLANESBW, R_PLANES24, R_PLANES32 */
+       char planes  ; /* - R_IMF_PLANES_BW, R_IMF_PLANES_RGB, R_IMF_PLANES_RGBA */
        char flag;     /* generic options for all image types, alpha zbuffer */
 
        char quality;  /* (0 - 100), eg: jpeg quality */
@@ -262,6 +262,10 @@ typedef struct ImageFormatData {
 #define R_IMF_CHAN_DEPTH_24 (1<<4) /* 24bits (unused) */
 #define R_IMF_CHAN_DEPTH_32 (1<<5) /* 32bits (full float exr) */
 
+/* ImageFormatData.planes */
+#define R_IMF_PLANES_RGB   24
+#define R_IMF_PLANES_RGBA  32
+#define R_IMF_PLANES_BW    8
 
 typedef struct RenderData {
        struct ImageFormatData im_format;
@@ -1044,11 +1048,6 @@ typedef struct Scene {
 #define R_ALPHAPREMUL  1
 #define R_ALPHAKEY             2
 
-/* planes */
-#define R_PLANES24             24
-#define R_PLANES32             32
-#define R_PLANESBW             8
-
 /* color_mgt_flag */
 #define R_COLOR_MANAGEMENT     1
 
index ad6f459f851e42d31051e1c3f3accbb2131180c7..737ce73ff1d2a816ff2e0a38931f64b0e12cd064 100644 (file)
@@ -258,20 +258,20 @@ static int rna_Image_depth_get(PointerRNA *ptr)
        Image *im= (Image*)ptr->data;
        ImBuf *ibuf;
        void *lock;
-       int depth;
+       int planes;
        
        ibuf= BKE_image_acquire_ibuf(im, NULL, &lock);
 
        if(!ibuf)
-               depth= 0;
+               planes= 0;
        else if(ibuf->rect_float)
-               depth= ibuf->depth * 4;
+               planes= ibuf->planes * 4;
        else
-               depth= ibuf->depth;
+               planes= ibuf->planes;
 
        BKE_image_release_ibuf(im, lock);
 
-       return depth;
+       return planes;
 }
 
 static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY_DIMENSION])
index 09af7fe1c5b545a3cceef99307f627b1346c0655..91aa9daac2549d2f67b7ac6f3e20d7e1dbe69f33 100644 (file)
@@ -82,14 +82,14 @@ static void rna_Image_save_render(Image *image, bContext *C, ReportList *reports
                }
                else {
                        /* temp swap out the color */
-                       const unsigned char imb_depth_back= ibuf->depth;
+                       const unsigned char imb_planes_back= ibuf->planes;
                        const float dither_back= ibuf->dither; 
-                       ibuf->depth= scene->r.im_format.planes;
+                       ibuf->planes= scene->r.im_format.planes;
                        ibuf->dither= scene->r.dither_intensity;
                        if (!BKE_write_ibuf(ibuf, path, &scene->r.im_format)) {
                                BKE_reportf(reports, RPT_ERROR, "Couldn't write image: %s", path);
                        }
-                       ibuf->depth= imb_depth_back;
+                       ibuf->planes= imb_planes_back;
                        ibuf->dither= dither_back;
                }
 
index e862652e9fb9a6944fb04e56c90e43352810273f..8dcab8f5b0433a06eb6973f50b64c17368fd68c9 100644 (file)
@@ -208,9 +208,9 @@ EnumPropertyItem image_type_items[] = {
        {0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem image_color_mode_items[] ={
-       {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
-       {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
-       {R_PLANES32, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
+       {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
+       {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
+       {R_IMF_PLANES_RGBA, "RGBA", 0, "RGBA", "Images are saved with RGB and Alpha data (if supported)"},
        {0, NULL, 0, NULL, NULL}};
 
 EnumPropertyItem image_color_depth_items[] = {
@@ -616,7 +616,7 @@ static void rna_ImageFormatSettings_file_format_set(PointerRNA *ptr, int value)
 
        /* ensure depth and color settings match */
        if (!BKE_imtype_is_alpha_ok(imf->imtype)) {
-               imf->planes= R_PLANES24;
+               imf->planes= R_IMF_PLANES_RGB;
        }
 
        /* ensure usable depth */
@@ -677,8 +677,8 @@ static EnumPropertyItem *rna_ImageFormatSettings_color_mode_itemf(bContext *C, P
        }
        else {
                static EnumPropertyItem color_mode_items[] ={
-                       {R_PLANESBW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
-                       {R_PLANES24, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
+                       {R_IMF_PLANES_BW, "BW", 0, "BW", "Images get saved in 8 bits grayscale (only PNG, JPEG, TGA, TIF)"},
+                       {R_IMF_PLANES_RGB, "RGB", 0, "RGB", "Images are saved with RGB (color) data"},
                        {0, NULL, 0, NULL, NULL}};
                return color_mode_items;
        }
index 9f96d28f1e61efc2a50ef1b03b61f8b15bb871cd..b6dc50702226264c7dc3cccab270d42ae0a9a29a 100644 (file)
@@ -3039,7 +3039,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
 
                        /* color -> greyscale */
                        /* editing directly would alter the render view */
-                       if(scene->r.im_format.planes == R_PLANESBW) {
+                       if(scene->r.im_format.planes == R_IMF_PLANES_BW) {
                                ImBuf *ibuf_bw= IMB_dupImBuf(ibuf);
                                IMB_color_to_bw(ibuf_bw);
                                IMB_freeImBuf(ibuf);
@@ -3061,7 +3061,7 @@ static int do_write_image_or_movie(Render *re, Main *bmain, Scene *scene, bMovie
                                if(BLI_testextensie(name, ".exr")) 
                                        name[strlen(name)-4]= 0;
                                BKE_add_image_extension(name, R_JPEG90);
-                               ibuf->depth= 24; 
+                               ibuf->planes= 24;
                                BKE_write_ibuf_stamp(scene, camera, ibuf, name, &imf);
                                printf("\nSaved: %s", name);
                        }
index 456702e082716d52bd65fd52160f3dc2ff2ddff8..5559d2ff34c2389bf31aaa73a263032182bf9533 100644 (file)
@@ -2458,7 +2458,7 @@ static int get_next_bake_face(BakeShade *bs)
                                                        imb_freerectImBuf(ibuf);
                                                /* clear image */
                                                if(R.r.bake_flag & R_BAKE_CLEAR)
-                                                       IMB_rectfill(ibuf, (ibuf->depth == 32) ? vec_alpha : vec_solid);
+                                                       IMB_rectfill(ibuf, (ibuf->planes == R_IMF_PLANES_RGBA) ? vec_alpha : vec_solid);
                                        
                                                /* might be read by UI to set active image for display */
                                                R.bakebuf= ima;
@@ -2566,7 +2566,7 @@ static void *do_bake_thread(void *bs_v)
 void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
 {
        /* must check before filtering */
-       const short is_new_alpha= (ibuf->depth != 32) && BKE_alphatest_ibuf(ibuf);
+       const short is_new_alpha= (ibuf->planes != R_IMF_PLANES_RGBA) && BKE_alphatest_ibuf(ibuf);
 
        /* Margin */
        if(filter) {
@@ -2575,10 +2575,10 @@ void RE_bake_ibuf_filter(ImBuf *ibuf, char *mask, const int filter)
 
        /* if the bake results in new alpha then change the image setting */
        if(is_new_alpha) {
-               ibuf->depth= 32;
+               ibuf->planes= R_IMF_PLANES_RGBA;
        }
        else {
-               if(filter && ibuf->depth != 32) {
+               if(filter && ibuf->planes != R_IMF_PLANES_RGBA) {
                        /* clear alpha added by filtering */
                        IMB_rectfill_alpha(ibuf, 1.0f);
                }
index 67646a19cb7a4a6accdabe4ae7b04998fc533f80..0fa60b96bf44de78805fd07285a365915bd915c4 100644 (file)
@@ -619,7 +619,7 @@ static int set_image_type(int argc, const char **argv, void *data)
 #endif
                        else {
                                printf("\nError: Format from '-F / --render-format' not known or not compiled in this release.\n");
-                               imtype_new= imtype_new;
+                               imtype_new= scene->r.im_format.imtype;
                        }
 
                        scene->r.im_format.imtype= imtype_new;
index b03d7f40bdda9c29378dc102a0f48b694f332a82..dd7126b294445dba82e692160280537e8a8d498f 100644 (file)
@@ -171,7 +171,7 @@ void readBitmapFontVersion0(ImBuf * ibuf, unsigned char * rect, int step)
                ibuf->userdata = bmfont;
                ibuf->userflags |= IB_BITMAPFONT;
 
-               if (ibuf->depth < 32) {
+               if (ibuf->planes < 32) {
                        // we're going to fake alpha here:
                        calcAlpha(ibuf);
                }