Commit 21ae8245 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed #defines and added enum CurvesType instead.

2002-08-27  Michael Natterer  <mitch@gimp.org>

	* app/base/curves.h: removed #defines and added enum CurvesType
	instead.

	* app/core/gimpchannel.c: use TRANSPARENT_OPACITY and
	OPAQUE_OPACITY instead of 0 and 255.

	* app/core/gimplayer.c (gimp_layer_create_mask): fixed inverse
	layer mask creation by setting GIMP_CHANNEL(mask)->bounds_known to
	FALSE correctly (fixes #90982). Also optimized mask creation
	by calling gimp_channel_all() and gimp_channel_clear() for
	white and black masks.
parent 1806e66f
2002-08-27 Michael Natterer <mitch@gimp.org>
* app/base/curves.h: removed #defines and added enum CurvesType
instead.
* app/core/gimpchannel.c: use TRANSPARENT_OPACITY and
OPAQUE_OPACITY instead of 0 and 255.
* app/core/gimplayer.c (gimp_layer_create_mask): fixed inverse
layer mask creation by setting GIMP_CHANNEL(mask)->bounds_known to
FALSE correctly (fixes #90982). Also optimized mask creation
by calling gimp_channel_all() and gimp_channel_clear() for
white and black masks.
2002-08-27 Sven Neumann <sven@gimp.org>
* app/gui/menus.c
......@@ -46,7 +60,7 @@
to base/color-balance.c).
* app/tools/gimpimagemaptool.[ch]: added most code which was
diplicated in subclasses. Create the dialog here with a nice title
duplicated in subclasses. Create the dialog here with a nice title
bar including image preview and name (fixes #66033). Added virtual
functions map(), dialog() and reset() which need to be implemented
by subclasses.
......
......@@ -20,15 +20,18 @@
#define __CURVES_H__
#define CURVES_SMOOTH 0
#define CURVES_FREE 1
typedef enum
{
CURVES_SMOOTH,
CURVES_FREE,
} CurvesType;
struct _Curves
{
gint curve_type[5];
gint points[5][17][2];
guchar curve[5][256];
CurvesType curve_type[5];
gint points[5][17][2];
guchar curve[5][256];
};
......
......@@ -1282,7 +1282,7 @@ gimp_channel_clear (GimpChannel *mask,
gboolean push_undo)
{
PixelRegion maskPR;
guchar bg = 0;
guchar bg = TRANSPARENT_OPACITY;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
......@@ -1320,7 +1320,7 @@ gimp_channel_all (GimpChannel *mask,
gboolean push_undo)
{
PixelRegion maskPR;
guchar bg = 255;
guchar bg = OPAQUE_OPACITY;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
......
......@@ -1282,7 +1282,7 @@ gimp_channel_clear (GimpChannel *mask,
gboolean push_undo)
{
PixelRegion maskPR;
guchar bg = 0;
guchar bg = TRANSPARENT_OPACITY;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
......@@ -1320,7 +1320,7 @@ gimp_channel_all (GimpChannel *mask,
gboolean push_undo)
{
PixelRegion maskPR;
guchar bg = 255;
guchar bg = OPAQUE_OPACITY;
g_return_if_fail (GIMP_IS_CHANNEL (mask));
......
......@@ -633,6 +633,20 @@ gimp_layer_create_mask (const GimpLayer *layer,
GIMP_DRAWABLE (mask)->offset_x = GIMP_DRAWABLE (layer)->offset_x;
GIMP_DRAWABLE (mask)->offset_y = GIMP_DRAWABLE (layer)->offset_y;
switch (add_mask_type)
{
case GIMP_ADD_WHITE_MASK:
gimp_channel_all (GIMP_CHANNEL (mask), FALSE);
return mask;
case GIMP_ADD_BLACK_MASK:
gimp_channel_clear (GIMP_CHANNEL (mask), FALSE);
return mask;
default:
break;
}
pixel_region_init (&destPR, GIMP_DRAWABLE (mask)->tiles,
0, 0,
GIMP_DRAWABLE (mask)->width,
......@@ -642,19 +656,7 @@ gimp_layer_create_mask (const GimpLayer *layer,
switch (add_mask_type)
{
case GIMP_ADD_WHITE_MASK:
{
guchar white_mask = OPAQUE_OPACITY;
color_region (&destPR, &white_mask);
}
break;
case GIMP_ADD_BLACK_MASK:
{
guchar black_mask = TRANSPARENT_OPACITY;
color_region (&destPR, &black_mask);
}
break;
case GIMP_ADD_ALPHA_MASK:
......@@ -672,9 +674,9 @@ gimp_layer_create_mask (const GimpLayer *layer,
case GIMP_ADD_SELECTION_MASK:
case GIMP_ADD_INVERSE_SELECTION_MASK:
{
GimpDrawable *selection;
GimpChannel *selection;
selection = GIMP_DRAWABLE (gimage->selection_mask);
selection = gimp_image_get_mask (gimage);
pixel_region_init (&srcPR, GIMP_DRAWABLE (selection)->tiles,
GIMP_DRAWABLE (layer)->offset_x,
......@@ -683,6 +685,9 @@ gimp_layer_create_mask (const GimpLayer *layer,
GIMP_DRAWABLE (layer)->height,
FALSE);
copy_region (&srcPR, &destPR);
if (! (selection->bounds_known && selection->empty))
GIMP_CHANNEL (mask)->bounds_known = FALSE;
}
break;
......@@ -724,6 +729,8 @@ gimp_layer_create_mask (const GimpLayer *layer,
tile_manager_destroy (copy_tiles);
}
GIMP_CHANNEL (mask)->bounds_known = FALSE;
}
switch (add_mask_type)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment