app: remove the legacy projection construction code
This commit is contained in:
@ -32,7 +32,6 @@
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "widgets/gimpactiongroup.h"
|
||||
#include "widgets/gimprender.h"
|
||||
@ -232,14 +231,7 @@ static const GimpToggleActionEntry view_toggle_actions[] =
|
||||
NC_("view-action", "Toggle fullscreen view"),
|
||||
G_CALLBACK (view_fullscreen_cmd_callback),
|
||||
FALSE,
|
||||
GIMP_HELP_VIEW_FULLSCREEN },
|
||||
|
||||
{ "view-use-gegl", GIMP_STOCK_GEGL,
|
||||
NC_("view-action", "Use GEGL"), NULL,
|
||||
NC_("view-action", "Use GEGL to create this window's projection"),
|
||||
G_CALLBACK (view_use_gegl_cmd_callback),
|
||||
FALSE,
|
||||
NULL }
|
||||
GIMP_HELP_VIEW_FULLSCREEN }
|
||||
};
|
||||
|
||||
static const GimpEnumActionEntry view_zoom_actions[] =
|
||||
@ -576,7 +568,6 @@ view_actions_update (GimpActionGroup *group,
|
||||
gchar *label = NULL;
|
||||
gboolean fullscreen = FALSE;
|
||||
gboolean revert_enabled = FALSE; /* able to revert zoom? */
|
||||
gboolean use_gegl = FALSE;
|
||||
|
||||
if (display)
|
||||
{
|
||||
@ -594,9 +585,6 @@ view_actions_update (GimpActionGroup *group,
|
||||
shell->no_image_options);
|
||||
|
||||
revert_enabled = gimp_display_shell_scale_can_revert (shell);
|
||||
|
||||
if (image)
|
||||
use_gegl = gimp_image_get_projection (image)->use_gegl;
|
||||
}
|
||||
|
||||
#define SET_ACTIVE(action,condition) \
|
||||
@ -702,7 +690,6 @@ view_actions_update (GimpActionGroup *group,
|
||||
|
||||
SET_SENSITIVE ("view-shrink-wrap", image);
|
||||
SET_ACTIVE ("view-fullscreen", display && fullscreen);
|
||||
SET_ACTIVE ("view-use-gegl", use_gegl);
|
||||
|
||||
if (GIMP_IS_IMAGE_WINDOW (group->user_data) ||
|
||||
GIMP_IS_GIMP (group->user_data))
|
||||
|
@ -32,7 +32,6 @@
|
||||
#include "core/gimpcontext.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpgrouplayer.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "widgets/gimpactiongroup.h"
|
||||
#include "widgets/gimpcolordialog.h"
|
||||
@ -656,40 +655,6 @@ view_fullscreen_cmd_callback (GtkAction *action,
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
view_use_gegl_cmd_callback (GtkAction *action,
|
||||
gpointer data)
|
||||
{
|
||||
GimpImage *image;
|
||||
GimpDisplayShell *shell;
|
||||
GList *layers;
|
||||
GList *list;
|
||||
gboolean active;
|
||||
return_if_no_image (image, data);
|
||||
return_if_no_shell (shell, data);
|
||||
|
||||
active = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
|
||||
|
||||
gimp_image_get_projection (image)->use_gegl = active;
|
||||
|
||||
layers = gimp_image_get_layer_list (image);
|
||||
|
||||
for (list = layers; list; list = g_list_next (list))
|
||||
{
|
||||
GimpLayer *layer = list->data;
|
||||
|
||||
if (GIMP_IS_GROUP_LAYER (layer))
|
||||
gimp_group_layer_get_projection (GIMP_GROUP_LAYER (layer))->use_gegl = active;
|
||||
}
|
||||
|
||||
g_list_free (layers);
|
||||
|
||||
gimp_image_invalidate (image, 0, 0,
|
||||
gimp_image_get_width (image),
|
||||
gimp_image_get_height (image));
|
||||
gimp_image_flush (image);
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
@ -86,8 +86,5 @@ void view_shrink_wrap_cmd_callback (GtkAction *action,
|
||||
void view_fullscreen_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
void view_use_gegl_cmd_callback (GtkAction *action,
|
||||
gpointer data);
|
||||
|
||||
|
||||
#endif /* __VIEW_COMMANDS_H__ */
|
||||
|
@ -86,8 +86,6 @@ libappcore_a_sources = \
|
||||
gimpchannel.h \
|
||||
gimpchannel-combine.c \
|
||||
gimpchannel-combine.h \
|
||||
gimpchannel-project.c \
|
||||
gimpchannel-project.h \
|
||||
gimpchannel-select.c \
|
||||
gimpchannel-select.h \
|
||||
gimpchannelpropundo.c \
|
||||
@ -272,8 +270,6 @@ libappcore_a_sources = \
|
||||
gimplayer.h \
|
||||
gimplayer-floating-sel.c \
|
||||
gimplayer-floating-sel.h \
|
||||
gimplayer-project.c \
|
||||
gimplayer-project.h \
|
||||
gimplayermask.c \
|
||||
gimplayermask.h \
|
||||
gimplayermaskpropundo.c \
|
||||
|
@ -1,84 +0,0 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpchannel-project.h
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <cairo.h>
|
||||
#include <gegl.h>
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "gimpchannel.h"
|
||||
#include "gimpchannel-project.h"
|
||||
|
||||
|
||||
void
|
||||
gimp_channel_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine)
|
||||
{
|
||||
GimpChannel *channel = GIMP_CHANNEL (drawable);
|
||||
PixelRegion srcPR;
|
||||
GeglBuffer *temp_buffer;
|
||||
guchar col[3];
|
||||
guchar opacity;
|
||||
|
||||
gimp_rgba_get_uchar (&channel->color,
|
||||
&col[0], &col[1], &col[2], &opacity);
|
||||
|
||||
gimp_drawable_init_src_region (drawable, &srcPR,
|
||||
x, y, width, height,
|
||||
&temp_buffer);
|
||||
|
||||
if (combine)
|
||||
{
|
||||
combine_regions (projPR, &srcPR, projPR, NULL, col,
|
||||
opacity,
|
||||
GIMP_NORMAL_MODE,
|
||||
NULL,
|
||||
(gimp_channel_get_show_masked (channel) ?
|
||||
COMBINE_INTEN_A_CHANNEL_MASK :
|
||||
COMBINE_INTEN_A_CHANNEL_SELECTION));
|
||||
}
|
||||
else
|
||||
{
|
||||
initial_region (&srcPR, projPR, NULL, col,
|
||||
opacity,
|
||||
GIMP_NORMAL_MODE,
|
||||
NULL,
|
||||
(gimp_channel_get_show_masked (channel) ?
|
||||
INITIAL_CHANNEL_MASK :
|
||||
INITIAL_CHANNEL_SELECTION));
|
||||
}
|
||||
|
||||
if (temp_buffer)
|
||||
g_object_unref (temp_buffer);
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimpchannel-project.h
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_CHANNEL_PROJECT_H__
|
||||
#define __GIMP_CHANNEL_PROJECT_H__
|
||||
|
||||
|
||||
void gimp_channel_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine);
|
||||
|
||||
|
||||
#endif /* __GIMP_CHANNEL_PROJECT_H__ */
|
@ -45,7 +45,6 @@
|
||||
#include "gimpimage-undo.h"
|
||||
#include "gimpimage-undo-push.h"
|
||||
#include "gimpchannel.h"
|
||||
#include "gimpchannel-project.h"
|
||||
#include "gimpchannel-select.h"
|
||||
#include "gimpcontext.h"
|
||||
#include "gimpdrawable-operation.h"
|
||||
@ -290,7 +289,6 @@ gimp_channel_class_init (GimpChannelClass *klass)
|
||||
drawable_class->get_active_mask = gimp_channel_get_active_mask;
|
||||
drawable_class->apply_buffer = gimp_channel_apply_buffer;
|
||||
drawable_class->replace_buffer = gimp_channel_replace_buffer;
|
||||
drawable_class->project_region = gimp_channel_project_region;
|
||||
drawable_class->set_buffer = gimp_channel_set_buffer;
|
||||
drawable_class->swap_pixels = gimp_channel_swap_pixels;
|
||||
|
||||
|
@ -27,8 +27,6 @@
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
|
||||
#include "gegl/gimp-babl.h"
|
||||
#include "gegl/gimp-gegl-nodes.h"
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
@ -1237,127 +1235,6 @@ gimp_drawable_replace_buffer (GimpDrawable *drawable,
|
||||
x, y);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (projPR != NULL);
|
||||
|
||||
GIMP_DRAWABLE_GET_CLASS (drawable)->project_region (drawable,
|
||||
x, y, width, height,
|
||||
projPR, combine);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_drawable_init_src_region (GimpDrawable *drawable,
|
||||
PixelRegion *srcPR,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglBuffer **temp_buffer)
|
||||
{
|
||||
GeglBuffer *buffer;
|
||||
GimpLayer *fs;
|
||||
|
||||
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
|
||||
g_return_if_fail (gimp_item_is_attached (GIMP_ITEM (drawable)));
|
||||
g_return_if_fail (srcPR != NULL);
|
||||
g_return_if_fail (temp_buffer != NULL);
|
||||
|
||||
fs = gimp_drawable_get_floating_sel (drawable);
|
||||
|
||||
if (fs)
|
||||
{
|
||||
gint off_x, off_y;
|
||||
gint fs_off_x, fs_off_y;
|
||||
gint combine_x, combine_y;
|
||||
gint combine_width, combine_height;
|
||||
|
||||
gimp_item_get_offset (GIMP_ITEM (drawable), &off_x, &off_y);
|
||||
gimp_item_get_offset (GIMP_ITEM (fs), &fs_off_x, &fs_off_y);
|
||||
|
||||
if (gimp_item_get_visible (GIMP_ITEM (fs)) &&
|
||||
gimp_rectangle_intersect (x + off_x, y + off_y,
|
||||
width, height,
|
||||
fs_off_x, fs_off_y,
|
||||
gimp_item_get_width (GIMP_ITEM (fs)),
|
||||
gimp_item_get_height (GIMP_ITEM (fs)),
|
||||
&combine_x, &combine_y,
|
||||
&combine_width, &combine_height))
|
||||
{
|
||||
gboolean lock_alpha = FALSE;
|
||||
|
||||
/* a temporary buffer for the compisition of the drawable and
|
||||
* its floating selection
|
||||
*/
|
||||
*temp_buffer = gimp_gegl_buffer_new (GEGL_RECTANGLE (0, 0,
|
||||
width, height),
|
||||
gimp_drawable_get_format (drawable));
|
||||
|
||||
gegl_buffer_copy (gimp_drawable_get_buffer (drawable),
|
||||
GEGL_RECTANGLE (x, y, width, height),
|
||||
*temp_buffer,
|
||||
GEGL_RECTANGLE (0, 0, 0, 0));
|
||||
|
||||
/* then, apply the floating selection onto the buffer just as
|
||||
* we apply it onto the drawable when anchoring the floating
|
||||
* selection
|
||||
*/
|
||||
|
||||
lock_alpha = (GIMP_IS_LAYER (drawable) &&
|
||||
gimp_layer_get_lock_alpha (GIMP_LAYER (drawable)));
|
||||
|
||||
if (lock_alpha)
|
||||
gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), FALSE, FALSE);
|
||||
|
||||
gimp_drawable_apply_buffer (drawable,
|
||||
gimp_drawable_get_buffer (GIMP_DRAWABLE (fs)),
|
||||
GEGL_RECTANGLE (combine_x - fs_off_x,
|
||||
combine_y - fs_off_y,
|
||||
combine_width,
|
||||
combine_height),
|
||||
FALSE, NULL,
|
||||
gimp_layer_get_opacity (fs),
|
||||
gimp_layer_get_mode (fs),
|
||||
NULL,
|
||||
combine_x - off_x,
|
||||
combine_y - off_y,
|
||||
*temp_buffer,
|
||||
combine_x - x - off_x,
|
||||
combine_y - y - off_y);
|
||||
|
||||
gimp_gegl_buffer_refetch_tiles (*temp_buffer);
|
||||
|
||||
if (lock_alpha)
|
||||
gimp_layer_set_lock_alpha (GIMP_LAYER (drawable), TRUE, FALSE);
|
||||
|
||||
/* finally, return a PixelRegion on the composited buffer instead
|
||||
* of the drawable's tiles
|
||||
*/
|
||||
pixel_region_init (srcPR, gimp_gegl_buffer_get_tiles (*temp_buffer),
|
||||
0, 0, width, height,
|
||||
FALSE);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
buffer = gimp_drawable_get_buffer (drawable);
|
||||
|
||||
pixel_region_init (srcPR, gimp_gegl_buffer_get_tiles (buffer),
|
||||
x, y, width, height,
|
||||
FALSE);
|
||||
*temp_buffer = NULL;
|
||||
}
|
||||
|
||||
GeglBuffer *
|
||||
gimp_drawable_get_buffer (GimpDrawable *drawable)
|
||||
{
|
||||
|
@ -88,13 +88,6 @@ struct _GimpDrawableClass
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
void (* project_region) (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine);
|
||||
GeglBuffer * (* get_buffer) (GimpDrawable *drawable);
|
||||
void (* set_buffer) (GimpDrawable *drawable,
|
||||
gboolean push_undo,
|
||||
@ -172,20 +165,6 @@ void gimp_drawable_replace_buffer (GimpDrawable *drawable,
|
||||
const GeglRectangle *mask_region,
|
||||
gint x,
|
||||
gint y);
|
||||
void gimp_drawable_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine);
|
||||
void gimp_drawable_init_src_region (GimpDrawable *drawable,
|
||||
PixelRegion *srcPR,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
GeglBuffer **temp_buffer);
|
||||
|
||||
GeglBuffer * gimp_drawable_get_buffer (GimpDrawable *drawable);
|
||||
void gimp_drawable_set_buffer (GimpDrawable *drawable,
|
||||
|
@ -984,9 +984,6 @@ gimp_group_layer_new (GimpImage *image)
|
||||
0, 0, 1, 1,
|
||||
format));
|
||||
|
||||
if (gimp_image_get_projection (image)->use_gegl)
|
||||
GET_PRIVATE (group)->projection->use_gegl = TRUE;
|
||||
|
||||
return GIMP_LAYER (group);
|
||||
}
|
||||
|
||||
|
@ -1,155 +0,0 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimplayer-project.h
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <gegl.h>
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
#include "base/tile-manager.h"
|
||||
|
||||
#include "paint-funcs/paint-funcs.h"
|
||||
|
||||
#include "gegl/gimp-babl-compat.h"
|
||||
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-project.h"
|
||||
#include "gimplayermask.h"
|
||||
|
||||
|
||||
void
|
||||
gimp_layer_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine)
|
||||
{
|
||||
GimpLayer *layer = GIMP_LAYER (drawable);
|
||||
GimpLayerMask *mask = gimp_layer_get_mask (layer);
|
||||
|
||||
if (mask && gimp_layer_get_show_mask (layer))
|
||||
{
|
||||
/* If we're showing the layer mask instead of the layer... */
|
||||
|
||||
PixelRegion srcPR;
|
||||
GeglBuffer *temp_buffer;
|
||||
|
||||
gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &srcPR,
|
||||
x, y, width, height,
|
||||
&temp_buffer);
|
||||
|
||||
copy_gray_to_region (&srcPR, projPR);
|
||||
|
||||
if (temp_buffer)
|
||||
g_object_unref (temp_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Otherwise, normal */
|
||||
|
||||
GimpImage *image = gimp_item_get_image (GIMP_ITEM (layer));
|
||||
PixelRegion srcPR;
|
||||
PixelRegion maskPR;
|
||||
PixelRegion *mask_pr = NULL;
|
||||
const guchar *colormap = NULL;
|
||||
GeglBuffer *temp_mask_buffer = NULL;
|
||||
GeglBuffer *temp_layer_buffer = NULL;
|
||||
InitialMode initial_mode;
|
||||
CombinationMode combination_mode;
|
||||
gboolean visible[MAX_CHANNELS];
|
||||
|
||||
gimp_drawable_init_src_region (drawable, &srcPR,
|
||||
x, y, width, height,
|
||||
&temp_layer_buffer);
|
||||
|
||||
if (mask && gimp_layer_get_apply_mask (layer))
|
||||
{
|
||||
gimp_drawable_init_src_region (GIMP_DRAWABLE (mask), &maskPR,
|
||||
x, y, width, height,
|
||||
&temp_mask_buffer);
|
||||
mask_pr = &maskPR;
|
||||
}
|
||||
|
||||
/* Based on the type of the layer, project the layer onto the
|
||||
* projection image...
|
||||
*/
|
||||
switch (gimp_babl_format_get_image_type (gimp_drawable_get_format (drawable)))
|
||||
{
|
||||
case GIMP_RGB_IMAGE:
|
||||
case GIMP_GRAY_IMAGE:
|
||||
initial_mode = INITIAL_INTENSITY;
|
||||
combination_mode = COMBINE_INTEN_A_INTEN;
|
||||
break;
|
||||
|
||||
case GIMP_RGBA_IMAGE:
|
||||
case GIMP_GRAYA_IMAGE:
|
||||
initial_mode = INITIAL_INTENSITY_ALPHA;
|
||||
combination_mode = COMBINE_INTEN_A_INTEN_A;
|
||||
break;
|
||||
|
||||
case GIMP_INDEXED_IMAGE:
|
||||
colormap = gimp_drawable_get_colormap (drawable),
|
||||
initial_mode = INITIAL_INDEXED;
|
||||
combination_mode = COMBINE_INTEN_A_INDEXED;
|
||||
break;
|
||||
|
||||
case GIMP_INDEXEDA_IMAGE:
|
||||
colormap = gimp_drawable_get_colormap (drawable),
|
||||
initial_mode = INITIAL_INDEXED_ALPHA;
|
||||
combination_mode = COMBINE_INTEN_A_INDEXED_A;
|
||||
break;
|
||||
|
||||
default:
|
||||
g_assert_not_reached ();
|
||||
break;
|
||||
}
|
||||
|
||||
gimp_image_get_visible_array (image, visible);
|
||||
|
||||
if (combine)
|
||||
{
|
||||
combine_regions (projPR, &srcPR, projPR, mask_pr,
|
||||
colormap,
|
||||
gimp_layer_get_opacity (layer) * 255.999,
|
||||
gimp_layer_get_mode (layer),
|
||||
visible,
|
||||
combination_mode);
|
||||
}
|
||||
else
|
||||
{
|
||||
initial_region (&srcPR, projPR, mask_pr,
|
||||
colormap,
|
||||
gimp_layer_get_opacity (layer) * 255.999,
|
||||
gimp_layer_get_mode (layer),
|
||||
visible,
|
||||
initial_mode);
|
||||
}
|
||||
|
||||
if (temp_layer_buffer)
|
||||
g_object_unref (temp_layer_buffer);
|
||||
|
||||
if (temp_mask_buffer)
|
||||
g_object_unref (temp_mask_buffer);
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
/* GIMP - The GNU Image Manipulation Program
|
||||
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
||||
*
|
||||
* gimplayer-project.h
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __GIMP_LAYER_PROJECT_H__
|
||||
#define __GIMP_LAYER_PROJECT_H__
|
||||
|
||||
|
||||
void gimp_layer_project_region (GimpDrawable *drawable,
|
||||
gint x,
|
||||
gint y,
|
||||
gint width,
|
||||
gint height,
|
||||
PixelRegion *projPR,
|
||||
gboolean combine);
|
||||
|
||||
|
||||
#endif /* __GIMP_LAYER_PROJECT_H__ */
|
@ -45,7 +45,6 @@
|
||||
#include "gimpimage.h"
|
||||
#include "gimplayer-floating-sel.h"
|
||||
#include "gimplayer.h"
|
||||
#include "gimplayer-project.h"
|
||||
#include "gimplayermask.h"
|
||||
#include "gimpmarshal.h"
|
||||
#include "gimppickable.h"
|
||||
@ -309,7 +308,6 @@ gimp_layer_class_init (GimpLayerClass *klass)
|
||||
drawable_class->invalidate_boundary = gimp_layer_invalidate_boundary;
|
||||
drawable_class->get_active_components = gimp_layer_get_active_components;
|
||||
drawable_class->get_active_mask = gimp_layer_get_active_mask;
|
||||
drawable_class->project_region = gimp_layer_project_region;
|
||||
|
||||
klass->opacity_changed = NULL;
|
||||
klass->mode_changed = NULL;
|
||||
|
@ -21,12 +21,9 @@
|
||||
|
||||
#include "core-types.h"
|
||||
|
||||
#include "base/pixel-region.h"
|
||||
|
||||
#include "gegl/gimp-gegl-utils.h"
|
||||
|
||||
#include "gimplayer.h"
|
||||
#include "gimppickable.h"
|
||||
#include "gimpprojectable.h"
|
||||
#include "gimpprojection.h"
|
||||
#include "gimpprojection-construct.h"
|
||||
@ -34,21 +31,11 @@
|
||||
|
||||
/* local function prototypes */
|
||||
|
||||
static void gimp_projection_construct_gegl (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_projection_construct_legacy (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_projection_initialize (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_projection_initialize (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
|
||||
|
||||
/* public functions */
|
||||
@ -60,6 +47,8 @@ gimp_projection_construct (GimpProjection *proj,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GeglRectangle rect = { x, y, w, h };
|
||||
|
||||
g_return_if_fail (GIMP_IS_PROJECTION (proj));
|
||||
|
||||
/* First, determine if the projection image needs to be
|
||||
@ -69,33 +58,6 @@ gimp_projection_construct (GimpProjection *proj,
|
||||
*/
|
||||
gimp_projection_initialize (proj, x, y, w, h);
|
||||
|
||||
/* call functions which process the list of layers and
|
||||
* the list of channels
|
||||
*/
|
||||
if (proj->use_gegl)
|
||||
{
|
||||
gimp_projection_construct_gegl (proj, x, y, w, h);
|
||||
}
|
||||
else
|
||||
{
|
||||
proj->construct_flag = FALSE;
|
||||
|
||||
gimp_projection_construct_legacy (proj, x, y, w, h);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
gimp_projection_construct_gegl (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GeglRectangle rect = { x, y, w, h };
|
||||
|
||||
if (! proj->processor)
|
||||
{
|
||||
GeglNode *sink = gimp_projection_get_sink_node (proj);
|
||||
@ -110,89 +72,6 @@ gimp_projection_construct_gegl (GimpProjection *proj,
|
||||
while (gegl_processor_work (proj->processor, NULL));
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_projection_construct_legacy (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GList *list;
|
||||
GList *reverse_list = NULL;
|
||||
gint proj_off_x;
|
||||
gint proj_off_y;
|
||||
|
||||
for (list = gimp_projectable_get_channels (proj->projectable);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
if (gimp_item_get_visible (GIMP_ITEM (list->data)))
|
||||
{
|
||||
reverse_list = g_list_prepend (reverse_list, list->data);
|
||||
}
|
||||
}
|
||||
|
||||
for (list = gimp_projectable_get_layers (proj->projectable);
|
||||
list;
|
||||
list = g_list_next (list))
|
||||
{
|
||||
GimpLayer *layer = list->data;
|
||||
|
||||
if (! gimp_layer_is_floating_sel (layer) &&
|
||||
gimp_item_get_visible (GIMP_ITEM (layer)))
|
||||
{
|
||||
/* only add layers that are visible and not floating selections
|
||||
* to the list
|
||||
*/
|
||||
reverse_list = g_list_prepend (reverse_list, layer);
|
||||
}
|
||||
}
|
||||
|
||||
gimp_projectable_get_offset (proj->projectable, &proj_off_x, &proj_off_y);
|
||||
|
||||
for (list = reverse_list; list; list = g_list_next (list))
|
||||
{
|
||||
GimpItem *item = list->data;
|
||||
GeglBuffer *proj_buffer;
|
||||
PixelRegion projPR;
|
||||
gint x1, y1;
|
||||
gint x2, y2;
|
||||
gint off_x;
|
||||
gint off_y;
|
||||
|
||||
gimp_item_get_offset (item, &off_x, &off_y);
|
||||
|
||||
/* subtract the projectable's offsets because the list of
|
||||
* update areas is in tile-pyramid coordinates, but our
|
||||
* external API is always in terms of image coordinates.
|
||||
*/
|
||||
off_x -= proj_off_x;
|
||||
off_y -= proj_off_y;
|
||||
|
||||
x1 = CLAMP (off_x, x, x + w);
|
||||
y1 = CLAMP (off_y, y, y + h);
|
||||
x2 = CLAMP (off_x + gimp_item_get_width (item), x, x + w);
|
||||
y2 = CLAMP (off_y + gimp_item_get_height (item), y, y + h);
|
||||
|
||||
proj_buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
|
||||
|
||||
pixel_region_init (&projPR,
|
||||
gimp_gegl_buffer_get_tiles (proj_buffer),
|
||||
x1, y1, x2 - x1, y2 - y1,
|
||||
TRUE);
|
||||
|
||||
gimp_drawable_project_region (GIMP_DRAWABLE (item),
|
||||
x1 - off_x, y1 - off_y,
|
||||
x2 - x1, y2 - y1,
|
||||
&projPR,
|
||||
proj->construct_flag);
|
||||
|
||||
proj->construct_flag = TRUE; /* something was projected */
|
||||
}
|
||||
|
||||
g_list_free (reverse_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* gimp_projection_initialize:
|
||||
* @proj: A #GimpProjection.
|
||||
@ -256,17 +135,9 @@ gimp_projection_initialize (GimpProjection *proj,
|
||||
{
|
||||
GeglBuffer *buffer;
|
||||
|
||||
if (proj->use_gegl)
|
||||
{
|
||||
/* GEGL should really do this for us... */
|
||||
gegl_node_get (gimp_projection_get_sink_node (proj),
|
||||
"buffer", &buffer, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
buffer = gimp_pickable_get_buffer (GIMP_PICKABLE (proj));
|
||||
g_object_ref (buffer);
|
||||
}
|
||||
/* GEGL should really do this for us... */
|
||||
gegl_node_get (gimp_projection_get_sink_node (proj),
|
||||
"buffer", &buffer, NULL);
|
||||
|
||||
gegl_buffer_clear (buffer, GEGL_RECTANGLE (x, y, w, h));
|
||||
g_object_unref (buffer);
|
||||
|
@ -154,7 +154,6 @@ gimp_projection_init (GimpProjection *proj)
|
||||
proj->idle_render.idle_id = 0;
|
||||
proj->idle_render.update_areas = NULL;
|
||||
proj->construct_flag = FALSE;
|
||||
proj->use_gegl = TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -66,8 +66,6 @@ struct _GimpProjection
|
||||
|
||||
gboolean construct_flag;
|
||||
gboolean invalidate_preview;
|
||||
|
||||
gboolean use_gegl;
|
||||
};
|
||||
|
||||
struct _GimpProjectionClass
|
||||
|
@ -305,7 +305,6 @@
|
||||
<menuitem action="view-show-scrollbars" />
|
||||
<menuitem action="view-show-statusbar" />
|
||||
<separator />
|
||||
<menuitem action="view-use-gegl" />
|
||||
</menu>
|
||||
|
||||
<menu action="image-menu" name="Image">
|
||||
|
Reference in New Issue
Block a user