[gimp/gimp-2-10] app: avoid updating image bounding box multiple times when reordering layer
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid updating image bounding box multiple times when reordering layer
- Date: Sat, 28 Sep 2019 08:14:34 +0000 (UTC)
commit a93d410916544b86121c037ad4acaa035ffe4f9f
Author: Ell <ell_se yahoo com>
Date: Sat Sep 28 11:08:22 2019 +0300
app: avoid updating image bounding box multiple times when reordering layer
Add internal gimp_image_{freeze,thaw}_bounding_box() functions, and
use them in gimp_image_reorder_item() to avoid updating the
bounding box multiple times while moving a layer across group
boundary, to prevent flickering.
(cherry picked from commit a6ebbfe3170d80fbac42745ed1fbbbe477c4ee05)
app/core/gimpimage.c | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)
---
diff --git a/app/core/gimpimage.c b/app/core/gimpimage.c
index 8b51f3ab56..abb6b36875 100644
--- a/app/core/gimpimage.c
+++ b/app/core/gimpimage.c
@@ -264,6 +264,8 @@ static void gimp_image_active_vectors_notify (GimpItemTree *tree,
const GParamSpec *pspec,
GimpImage *image);
+static void gimp_image_freeze_bounding_box (GimpImage *image);
+static void gimp_image_thaw_bounding_box (GimpImage *image);
static void gimp_image_update_bounding_box (GimpImage *image);
@@ -1792,12 +1794,43 @@ gimp_image_active_vectors_notify (GimpItemTree *tree,
g_signal_emit (image, gimp_image_signals[ACTIVE_VECTORS_CHANGED], 0);
}
+static void
+gimp_image_freeze_bounding_box (GimpImage *image)
+{
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ private->bounding_box_freeze_count++;
+}
+
+static void
+gimp_image_thaw_bounding_box (GimpImage *image)
+{
+ GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
+
+ private->bounding_box_freeze_count--;
+
+ if (private->bounding_box_freeze_count == 0 &&
+ private->bounding_box_update_pending)
+ {
+ private->bounding_box_update_pending = FALSE;
+
+ gimp_image_update_bounding_box (image);
+ }
+}
+
static void
gimp_image_update_bounding_box (GimpImage *image)
{
GimpImagePrivate *private = GIMP_IMAGE_GET_PRIVATE (image);
GeglRectangle bounding_box;
+ if (private->bounding_box_freeze_count > 0)
+ {
+ private->bounding_box_update_pending = TRUE;
+
+ return;
+ }
+
bounding_box.x = 0;
bounding_box.y = 0;
bounding_box.width = gimp_image_get_width (image);
@@ -4444,6 +4477,8 @@ gimp_image_reorder_item (GimpImage *image,
undo_desc);
}
+ gimp_image_freeze_bounding_box (image);
+
gimp_item_start_move (item, push_undo);
/* item and new_parent are type-checked in GimpItemTree
@@ -4454,6 +4489,8 @@ gimp_image_reorder_item (GimpImage *image,
gimp_item_end_move (item, push_undo);
+ gimp_image_thaw_bounding_box (image);
+
if (push_undo)
gimp_image_undo_group_end (image);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]