code cleanup.

2005-02-16  Sven Neumann  <sven@gimp.org>

	* app/core/gimplayer.c (gimp_layer_transform_color): code cleanup.
This commit is contained in:
Sven Neumann 2005-02-15 23:38:59 +00:00 committed by Sven Neumann
parent ca9ba32c45
commit ddf6688fc8
2 changed files with 21 additions and 18 deletions

View File

@ -1,3 +1,7 @@
2005-02-16 Sven Neumann <sven@gimp.org>
* app/core/gimplayer.c (gimp_layer_transform_color): code cleanup.
2005-02-15 Sven Neumann <sven@gimp.org> 2005-02-15 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.[ch]: formatting. * app/paint-funcs/paint-funcs.[ch]: formatting.

View File

@ -475,12 +475,10 @@ gimp_layer_duplicate (GimpItem *item,
/* duplicate the layer mask if necessary */ /* duplicate the layer mask if necessary */
if (layer->mask) if (layer->mask)
{ {
GimpLayerMask *layer_mask = GimpItem *dup = gimp_item_duplicate (GIMP_ITEM (layer->mask),
GIMP_LAYER_MASK (gimp_item_duplicate (GIMP_ITEM (layer->mask),
G_TYPE_FROM_INSTANCE (layer->mask), G_TYPE_FROM_INSTANCE (layer->mask),
FALSE)); FALSE);
gimp_layer_add_mask (new_layer, GIMP_LAYER_MASK (dup), FALSE);
gimp_layer_add_mask (new_layer, layer_mask, FALSE);
} }
return new_item; return new_item;
@ -778,30 +776,31 @@ gimp_layer_transform_color (GimpImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,
GimpImageBaseType src_type) GimpImageBaseType src_type)
{ {
gint i;
gint h;
guchar *src;
guchar *dest;
gpointer pr; gpointer pr;
for (pr = pixel_regions_register (2, layerPR, bufPR); for (pr = pixel_regions_register (2, layerPR, bufPR);
pr != NULL; pr != NULL;
pr = pixel_regions_process (pr)) pr = pixel_regions_process (pr))
{ {
h = layerPR->h; const guchar *src = bufPR->data;
src = bufPR->data; guchar *dest = layerPR->data;
dest = layerPR->data; gint h = layerPR->h;
while (h--) while (h--)
{ {
const guchar *s = src;
guchar *d = dest;
gint i;
for (i = 0; i < layerPR->w; i++) for (i = 0; i < layerPR->w; i++)
{ {
gimp_image_transform_color (gimage, drawable, gimp_image_transform_color (gimage, drawable, d, src_type, s);
dest + (i * layerPR->bytes),
src_type,
src + (i * bufPR->bytes));
/* copy alpha channel */ /* copy alpha channel */
dest[(i + 1) * layerPR->bytes - 1] = src[(i + 1) * bufPR->bytes - 1]; d[layerPR->bytes - 1] = src[bufPR->bytes - 1];
s += bufPR->bytes;
d += layerPR->bytes;
} }
src += bufPR->rowstride; src += bufPR->rowstride;