* Make image Histogram only update when region is visible
authorMatt Ebb <matt@mke3.net>
Tue, 19 Jan 2010 02:26:36 +0000 (02:26 +0000)
committerMatt Ebb <matt@mke3.net>
Tue, 19 Jan 2010 02:26:36 +0000 (02:26 +0000)
* Clean up some remaining code

source/blender/editors/space_image/image_draw.c
source/blender/editors/space_image/space_image.c

index 2b2f1f0b3e46149e2a7d323fe81427816f7310f6..8889ca5c05238005c3d12077a9c4d9b2195141aa 100644 (file)
@@ -204,16 +204,6 @@ void draw_image_info(ARegion *ar, int channels, int x, int y, char *cp, float *f
        UI_DrawString(10, 10, str);
 }
 
-static inline int get_bin_float(float f)
-{
-       CLAMP(f, 0.0, 1.0);
-       
-       //return (int) (((f + 0.25) / 1.5) * 512);
-
-       return (int)(f * 511);
-}
-
-
 /* image drawing */
 
 static void draw_image_grid(ARegion *ar, float zoomx, float zoomy)
index 62021f824ae1d5b11ae03849cf2079d8b6dc143e..0a3367b0427841b9c25605ae6c32003b1e717d36 100644 (file)
 
 #include "image_intern.h"
 
+
+static void image_histogram_tag_refresh(ScrArea *sa)
+{
+       SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
+       ARegion *ar;
+       
+       /* only while histogram is visible */
+       for (ar=sa->regionbase.first; ar; ar=ar->next) {
+               if (ar->regiontype == RGN_TYPE_PREVIEW && ar->flag & RGN_FLAG_HIDDEN)
+                       return;
+       }
+       
+       sima->hist.ok=0;
+}
+
 /* ******************** manage regions ********************* */
 
 ARegion *image_has_buttons_region(ScrArea *sa)
@@ -128,6 +143,8 @@ ARegion *image_has_scope_region(ScrArea *sa)
        
        arnew->flag = RGN_FLAG_HIDDEN;
        
+       image_histogram_tag_refresh(sa);
+       
        return arnew;
 }
 
@@ -315,12 +332,6 @@ static void image_refresh(const bContext *C, ScrArea *sa)
        }
 }
 
-static void image_histogram_tag_refresh(ScrArea *sa)
-{
-       SpaceImage *sima= (SpaceImage *)sa->spacedata.first;
-       sima->hist.ok=0;
-}
-
 static void image_listener(ScrArea *sa, wmNotifier *wmn)
 {
        SpaceImage *sima= (SpaceImage *)sa->spacedata.first;