[gimp/gimp-2-10] app: avoid deleting empty layer groups when downscaling image
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid deleting empty layer groups when downscaling image
- Date: Tue, 21 Jan 2020 18:16:10 +0000 (UTC)
commit 4f9c3f2a6a005f7fc89384e58de057c20a6e7e51
Author: Ell <ell_se yahoo com>
Date: Tue Jan 21 20:01:20 2020 +0200
app: avoid deleting empty layer groups when downscaling image
When dowscaling an image (or a layer group), empty layer groups
can be discarded as a result of their new dimensions being too
small, since we're calculating their new dimensions according to
their fake 1x1 dimensions. However, these dimensions are purely an
implementation detail and shouldn't affect the result, and neither
do we show a warning for them.
Instead, simply avoid discarding empty layer groups.
(cherry picked from commit b99a2631efd70c0f04bfcc6abc7dfdea31384ba8)
app/core/gimpitem.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 6960d0b461..c0f732c078 100644
--- a/app/core/gimpitem.c
+++ b/app/core/gimpitem.c
@@ -31,6 +31,7 @@
#include "gimp.h"
#include "gimp-parasites.h"
#include "gimpchannel.h"
+#include "gimpcontainer.h"
#include "gimpidtable.h"
#include "gimpimage.h"
#include "gimpimage-undo.h"
@@ -1456,6 +1457,7 @@ gimp_item_scale_by_factors_with_origin (GimpItem *item,
GimpProgress *progress)
{
GimpItemPrivate *private;
+ GimpContainer *children;
gint new_width, new_height;
gint new_offset_x, new_offset_y;
@@ -1471,6 +1473,12 @@ gimp_item_scale_by_factors_with_origin (GimpItem *item,
return FALSE;
}
+ children = gimp_viewable_get_children (GIMP_VIEWABLE (item));
+
+ /* avoid discarding empty layer groups */
+ if (children && gimp_container_is_empty (children))
+ return TRUE;
+
new_offset_x = SIGNED_ROUND (w_factor * (private->offset_x - origin_x));
new_offset_y = SIGNED_ROUND (h_factor * (private->offset_y - origin_y));
new_width = SIGNED_ROUND (w_factor * (private->offset_x - origin_x +
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]