mirror of https://github.com/GNOME/gimp.git
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.
This commit is contained in:
parent
885d4fb1cb
commit
b99a2631ef
|
@ -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 +
|
||||
|
|
Loading…
Reference in New Issue