Bug fix own collection:

- 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.
This commit is contained in:
Sergey Sharybin
2011-05-08 20:21:31 +00:00
parent b432520799
commit f8f4f73cc5
2 changed files with 8 additions and 1 deletions

View 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;
}

View 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]) {