Bug fix own collection:
authorSergey Sharybin <sergey.vfx@gmail.com>
Sun, 8 May 2011 20:21:31 +0000 (20:21 +0000)
committerSergey Sharybin <sergey.vfx@gmail.com>
Sun, 8 May 2011 20:21:31 +0000 (20:21 +0000)
 - Recreate mipmaps if they're dirty when drawing background image
   (this prevents "delayed" update of background image when you're paiting on it
    in image editor).
 - Mark mipmaps as dirty when inverting image channels.

TODO: there's memory leak caused by IMB_remakemipmap, but it'll be
      anuther bugfix commit after discussion with other devs.

source/blender/editors/space_image/image_ops.c
source/blender/editors/space_view3d/view3d_draw.c

index 13e855f60b149d40d9252b86b6dd67ff2274d13d..17244a5251c869f313c2e83804165a3a0fc0f345 100644 (file)
@@ -1423,6 +1423,9 @@ static int image_invert_exec(bContext *C, wmOperator *op)
        }
 
        ibuf->userflags |= IB_BITMAPDIRTY;
+       if(ibuf->mipmap[0])
+               ibuf->userflags |= IB_MIPMAP_INVALID;
+
        WM_event_add_notifier(C, NC_IMAGE|NA_EDITED, ima);
        return OPERATOR_FINISHED;
 }
index 1bbad6220efb2021f1148172b20baa164d672da2..e967e8ed2e7b3f395fe87df636e5bd9ecdd0989f 100644 (file)
@@ -1317,7 +1317,11 @@ static void draw_bgpic(Scene *scene, ARegion *ar, View3D *v3d)
                                float tzoom= MIN2(zoomx, zoomy);
                                int mip= 0;
 
-                               if(ibuf->mipmap[0]==NULL)
+                               if((ibuf->userflags&IB_MIPMAP_INVALID) != 0) {
+                                       IMB_remakemipmap(ibuf, 0);
+                                       ibuf->userflags&= ~IB_MIPMAP_INVALID;
+                               }
+                               else if(ibuf->mipmap[0]==NULL)
                                        IMB_makemipmap(ibuf, 0);
 
                                while(tzoom < 1.0f && mip<8 && ibuf->mipmap[mip]) {