mirror of https://github.com/GNOME/gimp.git
app: use GEGL to invert channels/selections
This commit is contained in:
parent
4c6907c53c
commit
c334fe936c
|
@ -51,6 +51,7 @@
|
||||||
#include "gimpchannel-project.h"
|
#include "gimpchannel-project.h"
|
||||||
#include "gimpchannel-select.h"
|
#include "gimpchannel-select.h"
|
||||||
#include "gimpcontext.h"
|
#include "gimpcontext.h"
|
||||||
|
#include "gimpdrawable-operation.h"
|
||||||
#include "gimpdrawable-stroke.h"
|
#include "gimpdrawable-stroke.h"
|
||||||
#include "gimpmarshal.h"
|
#include "gimpmarshal.h"
|
||||||
#include "gimppaintinfo.h"
|
#include "gimppaintinfo.h"
|
||||||
|
@ -1396,11 +1397,13 @@ static void
|
||||||
gimp_channel_real_invert (GimpChannel *channel,
|
gimp_channel_real_invert (GimpChannel *channel,
|
||||||
gboolean push_undo)
|
gboolean push_undo)
|
||||||
{
|
{
|
||||||
|
GimpDrawable *drawable = GIMP_DRAWABLE (channel);
|
||||||
|
|
||||||
if (push_undo)
|
if (push_undo)
|
||||||
gimp_channel_push_undo (channel,
|
gimp_channel_push_undo (channel,
|
||||||
GIMP_CHANNEL_GET_CLASS (channel)->invert_desc);
|
GIMP_CHANNEL_GET_CLASS (channel)->invert_desc);
|
||||||
else
|
else
|
||||||
gimp_drawable_invalidate_boundary (GIMP_DRAWABLE (channel));
|
gimp_drawable_invalidate_boundary (drawable);
|
||||||
|
|
||||||
if (channel->bounds_known && channel->empty)
|
if (channel->bounds_known && channel->empty)
|
||||||
{
|
{
|
||||||
|
@ -1408,22 +1411,15 @@ gimp_channel_real_invert (GimpChannel *channel,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
PixelRegion maskPR;
|
GeglNode *node = g_object_new (GEGL_TYPE_NODE,
|
||||||
GimpLut *lut;
|
"operation", "gegl:invert",
|
||||||
|
NULL);
|
||||||
|
|
||||||
pixel_region_init (&maskPR,
|
gimp_drawable_apply_operation_to_tiles (drawable, NULL, NULL,
|
||||||
gimp_drawable_get_tiles (GIMP_DRAWABLE (channel)),
|
node, TRUE,
|
||||||
0, 0,
|
gimp_drawable_get_tiles (drawable));
|
||||||
gimp_item_get_width (GIMP_ITEM (channel)),
|
|
||||||
gimp_item_get_height (GIMP_ITEM (channel)), TRUE);
|
|
||||||
|
|
||||||
lut = invert_lut_new (1);
|
g_object_unref (node);
|
||||||
|
|
||||||
pixel_regions_process_parallel ((PixelProcessorFunc)
|
|
||||||
gimp_lut_process_inline,
|
|
||||||
lut, 1, &maskPR);
|
|
||||||
|
|
||||||
gimp_lut_free (lut);
|
|
||||||
|
|
||||||
channel->bounds_known = FALSE;
|
channel->bounds_known = FALSE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue