Commit 4ba6db4e authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

Michael Natterer <mitch@gimp.org>

2001-12-03  Sven Neumann  <sven@gimp.org>
	    Michael Natterer <mitch@gimp.org>

	* app/paint-funcs/paint-funcs-mmx.h: removed redefiniton of HAS_ALPHA
	macro.

	* app/core/gimp.c: reverted Daniel's change; it doesn't make the code
	simpler, only more error-prone.

	* app/gui/info-dialog.h
	* app/gui/resize-dialog.h
	* app/core/gimp.h
	* app/core/gimpbrushgenerated.h
	* app/core/gimpbrushpipe.h
	* app/core/gimpchannel.[ch]
	* app/core/gimpcontainer.h
	* app/core/gimpcoreconfig.h
	* app/core/gimpdata.h
	* app/core/gimpdatafactory.[ch]
	* app/core/gimpdrawable-blend.c
	* app/core/gimpdrawable.[ch]
	* app/core/gimpimage.h
	* app/core/gimpimagefile.h
	* app/core/gimplayer.h
	* app/core/gimplayermask.h
	* app/core/gimpmoduleinfo.h
	* app/core/gimppalette.h
	* app/core/gimpundo.h
	* app/widgets/gimpbrushfactoryview.h
	* app/widgets/gimpconstrainedhwrapbox.h
	* app/widgets/gimpcontainermenu.h
	* app/widgets/gimpcontainerview.h
	* app/widgets/gimpdialogfactory.h
	* app/widgets/gimpimagedock.h
	* app/widgets/gimplistitem.h
	* app/widgets/gimpmenuitem.h
	* app/widgets/gimpnavigationpreview.h
	* app/widgets/gimppreview.h
	* app/gimprc.h
	* app/pathP.h
	* app/tools/gimpbezierselecttool.h
	* app/tools/gimpcolorbalancetool.h
	* app/tools/gimpcurvestool.h
	* app/tools/gimpdodgeburntool.c
	* app/tools/gimpfreeselecttool.h
	* app/tools/gimphuesaturationtool.h
	* app/tools/gimpinktool-blob.h
	* app/tools/gimpinktool.h
	* app/tools/gimpiscissorstool.h
	* app/tools/gimpmagnifytool.h
	* app/tools/gimpmeasuretool.h
	* app/tools/gimppainttool.h
	* app/tools/gimppathtool.h
	* app/tools/gimprectselecttool.h
	* app/tools/gimpthresholdtool.h
	* app/tools/gimptool.h
	* app/tools/gimptransformtool.h
	* app/base/base-config.h
	* app/base/gimplut.[ch]
	* app/base/pixel-region.h
	* app/base/pixel-surround.[ch]
	* app/base/temp-buf.[ch]
	* app/base/tile-manager-private.h
	* app/base/tile-manager.[ch]
	* app/base/tile-private.h
	* app/base/tile.[ch]
	* app/display/gimpdisplay.h
	* app/display/gimpdisplayshell-selection.h
	* app/display/gimpdisplayshell.h
	* app/gui/brush-select.h
	* app/gui/gradient-editor.h
	* app/gui/gradient-select.h: reverted most of Daniel's changes.

	There's no reason to use unsigned integers here and in lots of places
	it is even wrong.

	Then it's way too early to convert gbooleans into bitfields. This
	change may make sense in a few places but can happen later when the
	API has settled and the code is more stable.

	* app/gimprc.c: reverted Daniel's change. This is a GCC-ism and this
	code is about to die soon anyway.
parent ae3211fe
2001-12-03 Sven Neumann <sven@gimp.org>
Michael Natterer <mitch@gimp.org>
* app/paint-funcs/paint-funcs-mmx.h: removed redefiniton of HAS_ALPHA
macro.
* app/core/gimp.c: reverted Daniel's change; it doesn't make the code
simpler, only more error-prone.
* app/gui/info-dialog.h
* app/gui/resize-dialog.h
* app/core/gimp.h
* app/core/gimpbrushgenerated.h
* app/core/gimpbrushpipe.h
* app/core/gimpchannel.[ch]
* app/core/gimpcontainer.h
* app/core/gimpcoreconfig.h
* app/core/gimpdata.h
* app/core/gimpdatafactory.[ch]
* app/core/gimpdrawable-blend.c
* app/core/gimpdrawable.[ch]
* app/core/gimpimage.h
* app/core/gimpimagefile.h
* app/core/gimplayer.h
* app/core/gimplayermask.h
* app/core/gimpmoduleinfo.h
* app/core/gimppalette.h
* app/core/gimpundo.h
* app/widgets/gimpbrushfactoryview.h
* app/widgets/gimpconstrainedhwrapbox.h
* app/widgets/gimpcontainermenu.h
* app/widgets/gimpcontainerview.h
* app/widgets/gimpdialogfactory.h
* app/widgets/gimpimagedock.h
* app/widgets/gimplistitem.h
* app/widgets/gimpmenuitem.h
* app/widgets/gimpnavigationpreview.h
* app/widgets/gimppreview.h
* app/gimprc.h
* app/pathP.h
* app/tools/gimpbezierselecttool.h
* app/tools/gimpcolorbalancetool.h
* app/tools/gimpcurvestool.h
* app/tools/gimpdodgeburntool.c
* app/tools/gimpfreeselecttool.h
* app/tools/gimphuesaturationtool.h
* app/tools/gimpinktool-blob.h
* app/tools/gimpinktool.h
* app/tools/gimpiscissorstool.h
* app/tools/gimpmagnifytool.h
* app/tools/gimpmeasuretool.h
* app/tools/gimppainttool.h
* app/tools/gimppathtool.h
* app/tools/gimprectselecttool.h
* app/tools/gimpthresholdtool.h
* app/tools/gimptool.h
* app/tools/gimptransformtool.h
* app/base/base-config.h
* app/base/gimplut.[ch]
* app/base/pixel-region.h
* app/base/pixel-surround.[ch]
* app/base/temp-buf.[ch]
* app/base/tile-manager-private.h
* app/base/tile-manager.[ch]
* app/base/tile-private.h
* app/base/tile.[ch]
* app/display/gimpdisplay.h
* app/display/gimpdisplayshell-selection.h
* app/display/gimpdisplayshell.h
* app/gui/brush-select.h
* app/gui/gradient-editor.h
* app/gui/gradient-select.h: reverted most of Daniel's changes.
There's no reason to use unsigned integers here and in lots of places
it is even wrong.
Then it's way too early to convert gbooleans into bitfields. This
change may make sense in a few places but can happen later when the
API has settled and the code is more stable.
* app/gimprc.c: reverted Daniel's change. This is a GCC-ism and this
code is about to die soon anyway.
2001-12-03 Daniel Egger <degger@fhm.edu>
* app/core/gimp.c: Simplified logic thanks to bitfields.
......
......@@ -29,7 +29,7 @@ struct _GimpBaseConfig
guint tile_cache_size;
gboolean stingy_memory_use;
InterpolationType interpolation_type;
guint num_processors;
gint num_processors;
};
......
......@@ -67,8 +67,8 @@ struct _ColorBalanceDialog
guchar g_lookup[256];
guchar b_lookup[256];
guint preserve_luminosity : 1;
guint preview : 1;
gboolean preserve_luminosity;
gboolean preview;
GimpTransferMode application_mode;
};
......
......@@ -70,7 +70,7 @@ struct _CurvesDialog
gint color;
gint channel;
guint preview : 1;
gboolean preview;
gint grab_point;
gint last;
......
......@@ -58,7 +58,7 @@ void
gimp_lut_setup (GimpLut *lut,
GimpLutFunc func,
void *user_data,
guint nchannels)
gint nchannels)
{
guint i, v;
gdouble val;
......@@ -92,7 +92,7 @@ void
gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func,
void *user_data,
guint nchannels)
gint nchannels)
{
gimp_lut_setup (lut, func, user_data, nchannels);
}
......
......@@ -25,7 +25,7 @@
struct _GimpLut
{
guchar **luts;
guint nchannels;
gint nchannels;
};
/* TODO: the GimpLutFunc should really be passed the ColorModel of the region,
......@@ -36,17 +36,18 @@ struct _GimpLut
* and do no correction as this will be handled by gimp_lut_setup
*/
typedef gfloat (*GimpLutFunc) (gpointer user_data,
guint nchannels,
guint channel,
gint nchannels,
gint channel,
gfloat value);
GimpLut * gimp_lut_new (void);
void gimp_lut_free (GimpLut *lut);
void gimp_lut_setup (GimpLut *lut,
GimpLutFunc func,
gpointer user_data,
guint nchannels);
gint nchannels);
/* gimp_lut_setup_exact is currently identical to gimp_lut_setup. It
* however is guaranteed to never perform any interpolation or gamma
......@@ -55,7 +56,7 @@ void gimp_lut_setup (GimpLut *lut,
void gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func,
gpointer user_data,
guint nchannels);
gint nchannels);
void gimp_lut_process (GimpLut *lut,
PixelRegion *srcPR,
......@@ -77,4 +78,5 @@ void gimp_lut_process_2 (PixelRegion *srcPR,
PixelRegion *destPR,
GimpLut *lut);
#endif /* __GIMP_LUT_H__ */
......@@ -77,7 +77,7 @@ struct _HueSaturationDialog
gdouble saturation[7];
HueRange hue_partition;
guint preview : 1;
gboolean preview;
};
......
......@@ -27,14 +27,14 @@ struct _PixelRegion
Tile *curtile; /* current tile */
gint offx; /* tile offsets */
gint offy; /* tile offsets */
guint rowstride; /* bytes per pixel row */
gint rowstride; /* bytes per pixel row */
gint x; /* origin */
gint y; /* origin */
guint w; /* width of region */
guint h; /* height of region */
guint bytes; /* bytes per pixel */
guint dirty : 1; /* will this region be dirtied? */
guint process_count; /* used internally */
gint w; /* width of region */
gint h; /* height of region */
gint bytes; /* bytes per pixel */
gboolean dirty; /* will this region be dirtied? */
gint process_count; /* used internally */
};
struct _PixelRegionHolder
......@@ -43,18 +43,18 @@ struct _PixelRegionHolder
guchar *original_data;
gint startx;
gint starty;
guint count;
gint count;
};
struct _PixelRegionIterator
{
GSList *pixel_regions;
guint dirty_tiles;
guint region_width;
guint region_height;
guint portion_width;
guint portion_height;
guint process_count;
gint dirty_tiles;
gint region_width;
gint region_height;
gint portion_width;
gint portion_height;
gint process_count;
};
......
......@@ -31,11 +31,11 @@
void
pixel_surround_init (PixelSurround *ps,
TileManager *tm,
guint w,
guint h,
gint w,
gint h,
guchar bg[MAX_CHANNELS])
{
guint i;
gint i;
for (i = 0; i < MAX_CHANNELS; ++i)
{
......@@ -55,10 +55,10 @@ pixel_surround_init (PixelSurround *ps,
guchar *
pixel_surround_lock (PixelSurround *ps,
guint x,
guint y)
gint x,
gint y)
{
guint i, j;
gint i, j;
guchar *k;
guchar *ptr;
......@@ -119,7 +119,7 @@ pixel_surround_lock (PixelSurround *ps,
return ps->buff;
}
guint
gint
pixel_surround_rowstride (PixelSurround *ps)
{
return ps->row_stride;
......
......@@ -29,19 +29,19 @@ typedef struct _PixelSurround
Tile *tile;
TileManager *mgr;
guchar *buff;
guint buff_size;
guint bpp;
guint w;
guint h;
gint buff_size;
gint bpp;
gint w;
gint h;
guchar bg[MAX_CHANNELS];
guint row_stride;
gint row_stride;
} PixelSurround;
void pixel_surround_init (PixelSurround *ps,
TileManager *tm,
guint w,
guint h,
gint w,
gint h,
guchar bg[MAX_CHANNELS]);
/* return a pointer to a buffer which contains all the surrounding pixels
......@@ -49,10 +49,10 @@ void pixel_surround_init (PixelSurround *ps,
* otherwise just copy into our own malloced buffer and return that
*/
guchar * pixel_surround_lock (PixelSurround *ps,
guint x,
guint y);
gint x,
gint y);
guint pixel_surround_rowstride (PixelSurround *ps);
gint pixel_surround_rowstride (PixelSurround *ps);
void pixel_surround_release (PixelSurround *ps);
......
......@@ -54,7 +54,7 @@ static void temp_buf_to_gray (TempBuf *src_buf,
/* Memory management */
static inline guchar *
static guchar *
temp_buf_allocate (guint size)
{
guchar *data;
......@@ -73,7 +73,7 @@ temp_buf_to_color (TempBuf *src_buf,
{
guchar *src;
guchar *dest;
gulong num_bytes;
glong num_bytes;
src = temp_buf_data (src_buf);
dest = temp_buf_data (dest_buf);
......@@ -97,7 +97,7 @@ temp_buf_to_gray (TempBuf *src_buf,
{
guchar *src;
guchar *dest;
gulong num_bytes;
glong num_bytes;
gfloat pix;
src = temp_buf_data (src_buf);
......@@ -117,20 +117,19 @@ temp_buf_to_gray (TempBuf *src_buf,
}
TempBuf *
temp_buf_new (guint width,
guint height,
guint bytes,
temp_buf_new (gint width,
gint height,
gint bytes,
gint x,
gint y,
guchar *col)
{
const gulong size = width * height * bytes;
glong i;
gint j;
guchar *data;
TempBuf *temp;
glong i;
gint j;
guchar *data;
TempBuf *temp;
g_return_val_if_fail (size > 0, NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
temp = g_new (TempBuf, 1);
......@@ -142,7 +141,7 @@ temp_buf_new (guint width,
temp->swapped = FALSE;
temp->filename = NULL;
temp->data = data = temp_buf_allocate (size);
temp->data = data = temp_buf_allocate (width * height * bytes);
/* initialize the data */
if (col)
......@@ -198,8 +197,8 @@ temp_buf_new (guint width,
parameters into a newly allocated tempbuf */
TempBuf *
temp_buf_new_check (guint width,
guint height,
temp_buf_new_check (gint width,
gint height,
GimpCheckType check_type,
GimpCheckSize check_size)
{
......@@ -208,7 +207,7 @@ temp_buf_new_check (guint width,
guchar check_shift = 0;
guchar fg_color = 0;
guchar bg_color = 0;
guint i, j;
gint i, j;
g_return_val_if_fail (width > 0 && height > 0, NULL);
......@@ -309,16 +308,18 @@ temp_buf_copy (TempBuf *src,
TempBuf *
temp_buf_resize (TempBuf *buf,
guint bytes,
gint bytes,
gint x,
gint y,
guint width,
guint height)
gint width,
gint height)
{
/* calculate the requested size */
const gulong size = width * height * bytes;
gint size;
g_return_val_if_fail (size > 0, NULL);
g_return_val_if_fail (width > 0 && height > 0, NULL);
/* calculate the requested size */
size = width * height * bytes;
/* First, configure the canvas buffer */
if (!buf)
......@@ -349,11 +350,11 @@ temp_buf_resize (TempBuf *buf,
TempBuf *
temp_buf_scale (TempBuf *src,
guint new_width,
guint new_height)
gint new_width,
gint new_height)
{
guint loop1;
guint loop2;
gint loop1;
gint loop2;
gdouble x_ratio;
gdouble y_ratio;
guchar *src_data;
......@@ -402,8 +403,8 @@ temp_buf_copy_area (TempBuf *src,
TempBuf *dest,
gint x,
gint y,
guint width,
guint height,
gint width,
gint height,
gint dest_x,
gint dest_y)
{
......@@ -507,8 +508,8 @@ temp_buf_data_clear (TempBuf *temp_buf)
MaskBuf *
mask_buf_new (guint width,
guint height)
mask_buf_new (gint width,
gint height)
{
static guchar empty = 0;
......
......@@ -22,48 +22,48 @@
struct _TempBuf
{
guint width;
guint height;
gint x, y; /* origin of data source */
gint bytes; /* the necessary info */
gint width;
gint height;
gint x, y; /* origin of data source */
guint bytes : 4; /* the necessary info */
guint swapped : 1; /* flag indicating whether buf is cached to disk */
gchar *filename; /* filename of cached information */
gboolean swapped; /* flag indicating whether buf is cached to disk */
gchar *filename; /* filename of cached information */
guchar *data; /* The data buffer. Do never access this field
guchar *data; /* The data buffer. Do never access this field
directly, use temp_buf_data() instead !! */
};
/* The temp buffer functions */
TempBuf * temp_buf_new (guint width,
guint height,
guint bytes,
TempBuf * temp_buf_new (gint width,
gint height,
gint bytes,
gint x,
gint y,
guchar *col);
TempBuf * temp_buf_new_check (guint width,
guint height,
TempBuf * temp_buf_new_check (gint width,
gint height,
GimpCheckType check_type,
GimpCheckSize check_size);
TempBuf * temp_buf_copy (TempBuf *src,
TempBuf *dest);
TempBuf * temp_buf_resize (TempBuf *buf,
guint bytes,
gint bytes,
gint x,
gint y,
guint width,
guint height);
gint width,
gint height);
TempBuf * temp_buf_scale (TempBuf *buf,
guint width,
guint height);
gint width,
gint height);
TempBuf * temp_buf_copy_area (TempBuf *src,
TempBuf *dest,
gint x,
gint y,
guint width,
guint height,
gint width,
gint height,
gint dest_x,
gint dest_y);
void temp_buf_free (TempBuf *buf);
......@@ -72,8 +72,8 @@ guchar * temp_buf_data_clear (TempBuf *buf);
/* The mask buffer functions */
MaskBuf * mask_buf_new (guint width,
guint height);
MaskBuf * mask_buf_new (gint width,
gint height);
void mask_buf_free (MaskBuf *mask_buf);
guchar * mask_buf_data (MaskBuf *mask_buf);
guchar * mask_buf_data_clear (MaskBuf *mask_buf);
......
......@@ -57,14 +57,14 @@ struct _ThresholdDialog
GimpHistogramView *histogram;
GimpHistogram *hist;
GimpDrawable *drawable;
ImageMap *image_map;
GimpDrawable *drawable;
ImageMap *image_map;
gint color;
gint low_threshold;
gint high_threshold;
gint color;
gint low_threshold;
gint high_threshold;
guint preview : 1;
gboolean preview;
};
......
......@@ -24,12 +24,12 @@ struct _TileManager
{
gint x, y; /* tile manager offsets */
guint width; /* the width of the tiled area */
guint height; /* the height of the tiled area */
guint bpp; /* the bpp of each tile */
gint width; /* the width of the tiled area */
gint height; /* the height of the tiled area */
gint bpp; /* the bpp of each tile */
guint ntile_rows; /* the number of tiles in each row */
guint ntile_cols; /* the number of tiles in each columns */
gint ntile_rows; /* the number of tiles in each row */
gint ntile_cols; /* the number of tiles in each columns */
Tile **tiles; /* the tiles for this level */
TileValidateProc validate_proc; /* this proc is called when an attempt
......@@ -45,11 +45,11 @@ struct _PixelDataHandlePrivate
{
PixelDataHandle public;
TileManager *tm;
Tile *tile;
gint x1, x2, y1, y2;
guint readable : 1;
guint writeable : 1;
guint local_buffer : 1;
gboolean readable;
gboolean writeable;
gboolean local_buffer;
Tile *tile;
};
......
......@@ -32,17 +32,15 @@
#include "tile-swap.h"
static inline gboolean
tile_manager_get_tile_num (TileManager *tm,
gint xpixel,
gint ypixel,
guint *tile_num);
static gint tile_manager_get_tile_num (TileManager *tm,
gint xpixel,
gint ypixel);
TileManager *
tile_manager_new (guint toplevel_width,
guint toplevel_height,
guint bpp)
tile_manager_new (gint toplevel_width,
gint toplevel_height,
gint bpp)
{
TileManager *tm;
gint width;
......@@ -71,8 +69,8 @@ tile_manager_new (guint toplevel_width,
void
tile_manager_destroy (TileManager *tm)
{
guint ntiles;
guint i;
gint ntiles;
gint i;
g_return_if_fail (tm != NULL);
......@@ -107,14 +105,15 @@ Tile *
tile_manager_get_tile (TileManager *tm,
gint xpixel,
gint ypixel,
gboolean wantread,
gboolean wantwrite)
gint wantread,
gint wantwrite)
{
guint tile_num;
gint tile_num;
g_return_val_if_fail (tm != NULL, NULL);
if (!tile_manager_get_tile_num (tm, xpixel, ypixel, &tile_num))
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
if (tile_num < 0)
return NULL;
return tile_manager_get (tm, tile_num, wantread, wantwrite);
......@@ -122,23 +121,23 @@ tile_manager_get_tile (TileManager *tm,
Tile *
tile_manager_get (TileManager *tm,
guint tile_num,
gboolean wantread,
gboolean wantwrite)
gint tile_num,
gint wantread,
gint wantwrite)
{
Tile **tiles;
Tile **tile_ptr;
guint ntiles;
guint nrows, ncols;
gint ntiles;
gint nrows, ncols;
gint right_tile;
gint bottom_tile;
guint i, j, k;
gint i, j, k;
g_return_val_if_fail (tm != NULL, NULL);
ntiles = tm->ntile_rows * tm->ntile_cols;
if (tile_num >= ntiles)
if ((tile_num < 0) || (tile_num >= ntiles))
return NULL;
if (!tm->tiles)
......@@ -176,6 +175,14 @@ tile_manager_get (TileManager *tm,
g_warning("WRITE-ONLY TILE... UNTESTED!");
}
/*
if ((*tile_ptr)->share_count &&
(*tile_ptr)->write_count)
fprintf(stderr," >> MEEPITY %d,%d << ",
(*tile_ptr)->share_count,
(*tile_ptr)->write_count
); */
if (wantread)
{
TILE_MUTEX_LOCK (*tile_ptr);
......@@ -225,6 +232,11 @@ tile_manager_get (TileManager *tm,
(*tile_ptr)->write_count++;
(*tile_ptr)->dirty = TRUE;
}
/* else
{
if ((*tile_ptr)->write_count)
fprintf(stderr,"STINK! r/o on r/w tile /%d\007 ",(*tile_ptr)->write_count);
} */
TILE_MUTEX_UNLOCK (*tile_ptr);
tile_lock (*tile_ptr);
}
......@@ -238,14 +250,16 @@ tile_manager_get_async (TileManager *tm,
gint ypixel)
{
Tile *tile_ptr;
guint tile_num;
gint tile_num;
g_return_if_fail (tm != NULL);
if (!tile_manager_get_tile_num (tm, xpixel, ypixel, &tile_num))
tile_num = tile_manager_get_tile_num (tm, xpixel, ypixel);
if (tile_num < 0)
return;