[gimp/gimp-2-10] app: add gimp_image_invalidate_all()



commit 2e30ec353a45f09a3b9517de2ba0638cbc9c04c7
Author: Ell <ell_se yahoo com>
Date:   Wed Sep 4 14:37:38 2019 +0300

    app: add gimp_image_invalidate_all()
    
    ... which invalidates the entire image.  This replaces all calls to
    gimp_image_invalidate() with the full canvas size, since the image
    content can now be larger than the canvas.

 app/actions/debug-commands.c |  5 +----
 app/core/gimpimage.c         | 24 ++++++++++++++++--------
 app/core/gimpimage.h         |  1 +
 app/file/file-open.c         |  4 +---
 4 files changed, 19 insertions(+), 15 deletions(-)
---
diff --git a/app/actions/debug-commands.c b/app/actions/debug-commands.c
index ad3a6b2a0f..c00c1fea15 100644
--- a/app/actions/debug-commands.c
+++ b/app/actions/debug-commands.c
@@ -298,10 +298,7 @@ debug_benchmark_projection (GimpDisplay *display)
 
       GIMP_TIMER_START ();
 
-      gimp_image_invalidate (image,
-                             0, 0,
-                             gimp_image_get_width  (image),
-                             gimp_image_get_height (image));
+      gimp_image_invalidate_all (image);
       gimp_projection_flush_now (projection, TRUE);
 
       GIMP_TIMER_END ("Validation of the entire projection");
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index f4960197f5..2434b4a85a 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -1351,10 +1351,7 @@ gimp_image_real_colormap_changed (GimpImage *image,
   if (gimp_image_get_base_type (image) == GIMP_INDEXED)
     {
       /* A colormap alteration affects the whole image */
-      gimp_image_invalidate (image,
-                             0, 0,
-                             gimp_image_get_width  (image),
-                             gimp_image_get_height (image));
+      gimp_image_invalidate_all (image);
 
       gimp_item_stack_invalidate_previews (GIMP_ITEM_STACK (private->layers->container));
     }
@@ -3066,10 +3063,7 @@ gimp_image_set_component_visible (GimpImage       *image,
                      gimp_image_signals[COMPONENT_VISIBILITY_CHANGED], 0,
                      channel);
 
-      gimp_image_invalidate (image,
-                             0, 0,
-                             gimp_image_get_width  (image),
-                             gimp_image_get_height (image));
+      gimp_image_invalidate_all (image);
     }
 }
 
@@ -3178,6 +3172,20 @@ gimp_image_invalidate (GimpImage *image,
   GIMP_IMAGE_GET_PRIVATE (image)->flush_accum.preview_invalidated = TRUE;
 }
 
+void
+gimp_image_invalidate_all (GimpImage *image)
+{
+  const GeglRectangle *bounding_box;
+
+  g_return_if_fail (GIMP_IS_IMAGE (image));
+
+  bounding_box = &GIMP_IMAGE_GET_PRIVATE (image)->bounding_box;
+
+  gimp_image_invalidate (image,
+                         bounding_box->x,     bounding_box->y,
+                         bounding_box->width, bounding_box->height);
+}
+
 void
 gimp_image_guide_added (GimpImage *image,
                         GimpGuide *guide)
diff --git a/app/core/gimpimage.h b/app/core/gimpimage.h
index caded196a4..38852aeae5 100644
--- a/app/core/gimpimage.h
+++ b/app/core/gimpimage.h
@@ -250,6 +250,7 @@ void            gimp_image_invalidate            (GimpImage          *image,
                                                   gint                y,
                                                   gint                width,
                                                   gint                height);
+void            gimp_image_invalidate_all        (GimpImage          *image);
 void            gimp_image_guide_added           (GimpImage          *image,
                                                   GimpGuide          *guide);
 void            gimp_image_guide_removed         (GimpImage          *image,
diff --git a/app/file/file-open.c b/app/file/file-open.c
index e187bfb737..b4976547f0 100644
--- a/app/file/file-open.c
+++ b/app/file/file-open.c
@@ -773,9 +773,7 @@ file_open_sanitize_image (GimpImage *image,
    * layers, this is needed in case something triggers projection or
    * image preview creation before all layers are loaded, see bug #767663.
    */
-  gimp_image_invalidate (image, 0, 0,
-                         gimp_image_get_width  (image),
-                         gimp_image_get_height (image));
+  gimp_image_invalidate_all (image);
 
   /* Make sure all image states are up-to-date */
   gimp_image_flush (image);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]