[gimp] app: avoid deleting empty layer groups when downscaling image
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: avoid deleting empty layer groups when downscaling image
- Date: Tue, 21 Jan 2020 18:16:15 +0000 (UTC)
commit b99a2631efd70c0f04bfcc6abc7dfdea31384ba8
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.
app/core/gimpitem.c | 8 ++++++++
1 file changed, 8 insertions(+)
---
diff --git a/app/core/gimpitem.c b/app/core/gimpitem.c
index 5edaf3804b..56dfa07ada 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"
@@ -1450,6 +1451,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;
@@ -1465,6 +1467,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]