app: uncruftify combine_regions_replace() a bit to ease porting

This commit is contained in:
Michael Natterer
2012-04-23 22:38:44 +02:00
parent cdd3df6c51
commit 6bff1b21d0
3 changed files with 8 additions and 57 deletions

View File

@ -266,7 +266,6 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
gint x, y, width, height; gint x, y, width, height;
gint offset_x, offset_y; gint offset_x, offset_y;
PixelRegion src1PR, destPR; PixelRegion src1PR, destPR;
CombinationMode operation;
gboolean active_components[MAX_CHANNELS]; gboolean active_components[MAX_CHANNELS];
temp_buf = gimp_gegl_buffer_get_temp_buf (buffer); temp_buf = gimp_gegl_buffer_get_temp_buf (buffer);
@ -312,17 +311,6 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
/* configure the active channel array */ /* configure the active channel array */
gimp_drawable_get_active_components (drawable, active_components); gimp_drawable_get_active_components (drawable, active_components);
/* determine what sort of operation is being attempted and
* if it's actually legal...
*/
operation = gimp_image_get_combination_mode (gimp_drawable_type (drawable),
src2PR.bytes);
if (operation == -1)
{
g_warning ("%s: illegal parameters.", G_STRFUNC);
return;
}
/* get the layer offsets */ /* get the layer offsets */
gimp_item_get_offset (item, &offset_x, &offset_y); gimp_item_get_offset (item, &offset_x, &offset_y);
@ -392,18 +380,16 @@ gimp_drawable_real_replace_buffer (GimpDrawable *drawable,
pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height); pixel_region_init_temp_buf (&tempPR, temp_buf, 0, 0, width, height);
combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR, NULL, combine_regions_replace (&src1PR, &src2PR, &destPR, &tempPR,
opacity * 255.999, opacity * 255.999,
active_components, active_components);
operation);
gimp_temp_buf_unref (temp_buf); gimp_temp_buf_unref (temp_buf);
} }
else else
{ {
combine_regions_replace (&src1PR, &src2PR, &destPR, &maskPR, NULL, combine_regions_replace (&src1PR, &src2PR, &destPR, &maskPR,
opacity * 255.999, opacity * 255.999,
active_components, active_components);
operation);
} }
} }

View File

@ -96,18 +96,6 @@ static const guchar no_mask = OPAQUE_OPACITY;
/* Local function prototypes */ /* Local function prototypes */
static void apply_layer_mode_replace (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint x,
gint y,
guint opacity,
guint length,
guint bytes1,
guint bytes2,
const gboolean *affect);
static inline void rotate_pointers (guchar **p, static inline void rotate_pointers (guchar **p,
guint32 n); guint32 n);
@ -2608,10 +2596,8 @@ combine_regions_replace (PixelRegion *src1,
PixelRegion *src2, PixelRegion *src2,
PixelRegion *dest, PixelRegion *dest,
PixelRegion *mask, PixelRegion *mask,
const guchar *data,
guint opacity, guint opacity,
const gboolean *affect, const gboolean *affect)
CombinationMode type)
{ {
gpointer pr; gpointer pr;
@ -2627,10 +2613,8 @@ combine_regions_replace (PixelRegion *src1,
for (h = 0; h < src1->h; h++) for (h = 0; h < src1->h; h++)
{ {
/* Now, apply the paint mode */ replace_pixels (s1, s2, d, m, src1->w,
apply_layer_mode_replace (s1, s2, d, m, src1->x, src1->y + h, opacity, affect, src1->bytes, src2->bytes);
opacity, src1->w,
src1->bytes, src2->bytes, affect);
s1 += src1->rowstride; s1 += src1->rowstride;
s2 += src2->rowstride; s2 += src2->rowstride;
@ -2639,20 +2623,3 @@ combine_regions_replace (PixelRegion *src1,
} }
} }
} }
static void
apply_layer_mode_replace (const guchar *src1,
const guchar *src2,
guchar *dest,
const guchar *mask,
gint x,
gint y,
guint opacity,
guint length,
guint bytes1,
guint bytes2,
const gboolean *affect)
{
replace_pixels (src1, src2, dest, mask, length,
opacity, affect, bytes1, bytes2);
}

View File

@ -254,10 +254,8 @@ void combine_regions_replace (PixelRegion *src1,
PixelRegion *src2, PixelRegion *src2,
PixelRegion *dest, PixelRegion *dest,
PixelRegion *mask, PixelRegion *mask,
const guchar *data,
guint opacity, guint opacity,
const gboolean *affect, const gboolean *affect);
CombinationMode type);
#endif /* __PAINT_FUNCS_H__ */ #endif /* __PAINT_FUNCS_H__ */