new directory app/base/

2001-05-15  Michael Natterer  <mitch@gimp.org>

	* configure.in: new directory app/base/

	* app/Makefile.am
	* app/boundary.[ch]
	* app/brush_scale.[ch]
	* app/gimpchecks.h
	* app/gimplut.[ch]
	* app/pixel_processor.[ch]
	* app/pixel_region.[ch]
	* app/pixel_surround.[ch]
	* app/temp_buf.[ch]
	* app/tile.[ch]
	* app/tile_cache.[ch]
	* app/tile_manager.[ch]
	* app/tile_manager_pvt.h
	* app/tile_pvt.h
	* app/tile_swap.[ch]: moved to base/

	* app/base/Makefile.am
	* app/base/base-types.h
	* app/base/*: new directory for the sub-object pixel maniplation
	and storage stuff. Does not include Gtk+ or anything outside
	base/. Did some cleanup in all files.

	* app/appenums.h
	* app/apptypes.h
	* app/core/gimpimage.h: removed types which are now in
	base/base-types.h.

	* app/base/base-config.[ch]
	* app/gimprc.[ch]: put the config variables for base/ to their own
	file so base/ doesn not have to include gimprc.h (does not yet
	work, i.e. the variables are un-configurable right now)

	* app/main.c: set a log handler for "Gimp-Base".

	* app/paint-funcs/Makefile.am
	* app/paint-funcs/paint-funcs.[ch]: removed the color hash which
	maps RGB to color indices because it's a totally standalone system
	which has nothing to do with the paint-funcs and introduced a
	GimpImage dependency.

	paint-funcs/ should be considered on the same sub-object
	(glib-only) level as base/, only in a different directory.

	* app/core/Makefile.am
	* app/core/gimpimage-colorhash.[ch]: put the color hash here.

	* app/gimage.c: don't invalidate the color hash here...

	* app/core/gimpimage.c: ... but in the colormap_changed() default
	inplementation. Initialize the hash in class_init().

	* tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums.

	* tools/pdbgen/enums.pl: regenerated.

	* app/[lots]
	* app/core/[of]
	* app/gui/[files]
	* app/pdb/[all]
	* app/tools/[over]
	* app/widgets/[the]
	* tools/pdbgen/pdb/[place]: changed #includes accordingly. And use
	base_config->value instead of the stuff from gimprc.h.
This commit is contained in:
Michael Natterer 2001-05-15 11:25:25 +00:00 committed by Michael Natterer
parent 9059fd20f4
commit d240f623f1
275 changed files with 1607 additions and 7638 deletions

View file

@ -1,3 +1,71 @@
2001-05-15 Michael Natterer <mitch@gimp.org>
* configure.in: new directory app/base/
* app/Makefile.am
* app/boundary.[ch]
* app/brush_scale.[ch]
* app/gimpchecks.h
* app/gimplut.[ch]
* app/pixel_processor.[ch]
* app/pixel_region.[ch]
* app/pixel_surround.[ch]
* app/temp_buf.[ch]
* app/tile.[ch]
* app/tile_cache.[ch]
* app/tile_manager.[ch]
* app/tile_manager_pvt.h
* app/tile_pvt.h
* app/tile_swap.[ch]: moved to base/
* app/base/Makefile.am
* app/base/base-types.h
* app/base/*: new directory for the sub-object pixel maniplation
and storage stuff. Does not include Gtk+ or anything outside
base/. Did some cleanup in all files.
* app/appenums.h
* app/apptypes.h
* app/core/gimpimage.h: removed types which are now in
base/base-types.h.
* app/base/base-config.[ch]
* app/gimprc.[ch]: put the config variables for base/ to their own
file so base/ doesn not have to include gimprc.h (does not yet
work, i.e. the variables are un-configurable right now)
* app/main.c: set a log handler for "Gimp-Base".
* app/paint-funcs/Makefile.am
* app/paint-funcs/paint-funcs.[ch]: removed the color hash which
maps RGB to color indices because it's a totally standalone system
which has nothing to do with the paint-funcs and introduced a
GimpImage dependency.
paint-funcs/ should be considered on the same sub-object
(glib-only) level as base/, only in a different directory.
* app/core/Makefile.am
* app/core/gimpimage-colorhash.[ch]: put the color hash here.
* app/gimage.c: don't invalidate the color hash here...
* app/core/gimpimage.c: ... but in the colormap_changed() default
inplementation. Initialize the hash in class_init().
* tools/pdbgen/Makefile.am: scan app/base/base-types.h for enums.
* tools/pdbgen/enums.pl: regenerated.
* app/[lots]
* app/core/[of]
* app/gui/[files]
* app/pdb/[all]
* app/tools/[over]
* app/widgets/[the]
* tools/pdbgen/pdb/[place]: changed #includes accordingly. And use
base_config->value instead of the stuff from gimprc.h.
2001-05-14 Michael Natterer <mitch@gimp.org>
* README.patch_xinput_airbrush

View file

@ -1,6 +1,6 @@
## Process this file with automake to produce Makefile.in
SUBDIRS = paint-funcs core pdb tools widgets gui
SUBDIRS = paint-funcs base core pdb tools widgets gui
scriptdata =
@ -101,36 +101,6 @@ gimp_SOURCES = \
scan_convert.c \
scan_convert.h \
##
## lowlevel stuff for base/
##
boundary.c \
boundary.h \
brush_scale.c \
brush_scale.h \
gimpcheck.h \
gimplut.c \
gimplut.h \
lut_funcs.c \
lut_funcs.h \
pixel_processor.c \
pixel_processor.h \
pixel_region.c \
pixel_region.h \
pixel_surround.c \
pixel_surround.h \
temp_buf.c \
temp_buf.h \
tile.c \
tile.h \
tile_pvt.h \
tile_cache.c \
tile_cache.h \
tile_manager.c \
tile_manager.h \
tile_manager_pvt.h \
tile_swap.c \
tile_swap.h \
##
## stuff that needs to be sorted into yet undecided subsystems, split up,
## removed or otherwise tortured
##
@ -171,6 +141,8 @@ gimp_SOURCES = \
image_new.h \
libgimp_glue.c \
libgimp_glue.h \
lut_funcs.c \
lut_funcs.h \
main.c \
path.c \
path.h \
@ -225,6 +197,7 @@ gimp_LDADD = \
gui/libappgui.la \
widgets/libappwidgets.la \
core/libappcore.la \
base/libappbase.la \
$(top_builddir)/libgimpcolor/libgimpcolor-$(LT_RELEASE).la \
$(top_builddir)/libgimpmath/libgimpmath-$(LT_RELEASE).la \
$(top_builddir)/libgimpwidgets/libgimpwidgets-$(LT_RELEASE).la \

View file

@ -85,6 +85,9 @@
#include "libgimp/gimpprotocol.h"
#include "libgimp/gimpwire.h"
#include "base/tile.h"
#include "base/tile-manager.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
@ -102,8 +105,6 @@
#include "gimpprogress.h"
#include "gimprc.h"
#include "plug_in.h"
#include "tile.h"
#include "tile_manager.h"
#include "libgimp/gimpintl.h"

View file

@ -46,6 +46,10 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "base/tile-swap.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpdatafactory.h"
@ -75,8 +79,6 @@
#include "plug_in.h"
#include "module_db.h"
#include "temp_buf.h"
#include "tile_swap.h"
#include "undo.h"
#include "unitrc.h"
#include "xcf.h"
@ -165,7 +167,7 @@ app_init (void)
g_free (filename);
if (parse_buffers_init ())
if (gimprc_init ())
{
parse_unitrc (); /* this needs to be done before gimprc loading */
parse_gimprc (); /* parse the local GIMP configuration file */
@ -243,12 +245,13 @@ app_init (void)
RESET_BAR();
/* Add the swap file */
if (swap_path == NULL)
swap_path = g_get_tmp_dir ();
if (base_config->swap_path == NULL)
base_config->swap_path = g_get_tmp_dir ();
toast_old_temp_files ();
path = g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimpswap.%lu",
swap_path, (unsigned long) getpid ());
base_config->swap_path,
(unsigned long) getpid ());
tile_swap_add (path, NULL, NULL);
g_free (path);
@ -380,7 +383,7 @@ toast_old_temp_files (void)
struct dirent *entry;
GString *filename = g_string_new ("");
dir = opendir (swap_path);
dir = opendir (base_config->swap_path);
if (!dir)
return;
@ -405,7 +408,7 @@ toast_old_temp_files (void)
* so no harm trying.
*/
g_string_sprintf (filename, "%s" G_DIR_SEPARATOR_S "%s",
swap_path, entry->d_name);
base_config->swap_path, entry->d_name);
unlink (filename->str);
}
}

View file

@ -30,41 +30,6 @@ typedef enum
NO_FILL /*< nick=NO_IMAGE_FILL >*/
} GimpFillType;
/* Layer modes */
typedef enum
{
NORMAL_MODE,
DISSOLVE_MODE,
BEHIND_MODE,
MULTIPLY_MODE,
SCREEN_MODE,
OVERLAY_MODE,
DIFFERENCE_MODE,
ADDITION_MODE,
SUBTRACT_MODE,
DARKEN_ONLY_MODE,
LIGHTEN_ONLY_MODE,
HUE_MODE,
SATURATION_MODE,
COLOR_MODE,
VALUE_MODE,
DIVIDE_MODE,
DODGE_MODE,
BURN_MODE,
HARDLIGHT_MODE,
ERASE_MODE, /*< skip >*/
REPLACE_MODE, /*< skip >*/
ANTI_ERASE_MODE /*< skip >*/
} LayerModeEffects;
/* Types of convolutions */
typedef enum
{
NORMAL_CONVOL, /* Negative numbers truncated */
ABSOLUTE_CONVOL, /* Absolute value */
NEGATIVE_CONVOL /* add 127 to values */
} ConvolutionType;
/* Brush application types */
typedef enum
{
@ -99,13 +64,6 @@ typedef enum
ONCE_END_COLOR /* paint once, but keep painting with the end color */
} GradientPaintMode;
typedef enum
{
LINEAR_INTERPOLATION,
CUBIC_INTERPOLATION,
NEAREST_NEIGHBOR_INTERPOLATION
} InterpolationType;
typedef enum /*< skip >*/
{
ORIENTATION_UNKNOWN,

View file

@ -44,9 +44,4 @@ extern MessageHandlerType message_handler;
extern gboolean gimp_busy;
#ifdef G_OS_WIN32
gchar * quote_spaces (gchar *string);
#endif
#endif /* __APPENV_H__ */

View file

@ -25,6 +25,8 @@
#include "libgimpcolor/gimpcolortypes.h"
#include "libgimpmath/gimpmathtypes.h"
#include "base/base-types.h"
#include "undo_types.h"
#include "appenums.h"
@ -34,8 +36,6 @@
typedef struct _Argument Argument;
typedef struct _BoundSeg BoundSeg;
typedef struct _ColorNotebook ColorNotebook;
typedef struct _GDisplay GDisplay;
@ -44,8 +44,6 @@ typedef struct _GimpHistogram GimpHistogram;
typedef struct _GimpImageNewValues GimpImageNewValues;
typedef struct _GimpLut GimpLut;
typedef struct _GimpParasite GimpParasite;
typedef struct _GimpProgress GimpProgress;
@ -66,23 +64,11 @@ typedef struct _PlugInProcDef PlugInProcDef;
typedef struct _ParasiteList ParasiteList;
typedef struct _PixelRegionIterator PixelRegionIterator;
typedef struct _PixelRegion PixelRegion;
typedef struct _PixelRegionHolder PixelRegionHolder;
typedef struct _ProcArg ProcArg;
typedef struct _ProcRecord ProcRecord;
typedef guint32 Tattoo;
typedef struct _TempBuf TempBuf;
typedef struct _TempBuf MaskBuf;
typedef struct _Tile Tile;
typedef struct _TileManager TileManager;
typedef struct _ScanConvertPoint ScanConvertPoint;
typedef struct _Selection Selection;
@ -99,9 +85,6 @@ typedef GSList PathUndo;
/* functions */
typedef void (* TileValidateProc) (TileManager *tm,
Tile *tile);
typedef void (* ImageMapApplyFunc) (PixelRegion *srcPR,
PixelRegion *destPR,
gpointer data);

View file

@ -3,6 +3,9 @@
noinst_LTLIBRARIES = libappbase.la
libappbase_la_SOURCES = \
base-types.h \
base-config.c \
base-config.h \
boundary.c \
boundary.h \
brush-scale.c \

View file

@ -16,13 +16,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __TILE_CACHE_H__
#define __TILE_CACHE_H__
#include "config.h"
#include <glib.h>
#include "base-types.h"
#include "base-config.h"
void tile_cache_insert (Tile *tile);
void tile_cache_flush (Tile *tile);
void tile_cache_set_size (gulong cache_size);
static GimpBaseConfig static_base_config =
{
NULL,
NULL,
33554432, /* 32 MB */
FALSE,
LINEAR_INTERPOLATION
};
#endif /* __TILE_CACHE_H__ */
GimpBaseConfig *base_config = &static_base_config;

View file

@ -16,23 +16,23 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BRUSH_SCALE_H__
#define __BRUSH_SCALE_H__
MaskBuf * brush_scale_mask (MaskBuf *brush_mask,
gint dest_width,
gint dest_height);
MaskBuf * brush_scale_pixmap (MaskBuf *pixmap,
gint dest_width,
gint dest_height);
#endif /* __BRUSH_SCALE_H__ */
#ifndef __BASE_CONFIG_H__
#define __BASE_CONFIG_H__
typedef struct _GimpBaseConfig GimpBaseConfig;
struct _GimpBaseConfig
{
gchar *temp_path;
gchar *swap_path;
guint tile_cache_size;
gboolean stingy_memory_use;
InterpolationType interpolation_type;
};
extern GimpBaseConfig *base_config;
#endif /* __BASE_CONFIG_H__ */

125
app/base/base-types.h Normal file
View file

@ -0,0 +1,125 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BASE_TYPES_H__
#define __BASE_TYPES_H__
/* magic constants */
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
/* enums */
/* Layer modes */
typedef enum
{
NORMAL_MODE,
DISSOLVE_MODE,
BEHIND_MODE,
MULTIPLY_MODE,
SCREEN_MODE,
OVERLAY_MODE,
DIFFERENCE_MODE,
ADDITION_MODE,
SUBTRACT_MODE,
DARKEN_ONLY_MODE,
LIGHTEN_ONLY_MODE,
HUE_MODE,
SATURATION_MODE,
COLOR_MODE,
VALUE_MODE,
DIVIDE_MODE,
DODGE_MODE,
BURN_MODE,
HARDLIGHT_MODE,
ERASE_MODE, /*< skip >*/
REPLACE_MODE, /*< skip >*/
ANTI_ERASE_MODE /*< skip >*/
} LayerModeEffects;
/* Types of convolutions */
typedef enum
{
NORMAL_CONVOL, /* Negative numbers truncated */
ABSOLUTE_CONVOL, /* Absolute value */
NEGATIVE_CONVOL /* add 127 to values */
} ConvolutionType;
typedef enum
{
LINEAR_INTERPOLATION,
CUBIC_INTERPOLATION,
NEAREST_NEIGHBOR_INTERPOLATION
} InterpolationType;
/* Transparency representation */
typedef enum /*< skip >*/
{
LIGHT_CHECKS = 0,
GRAY_CHECKS = 1,
DARK_CHECKS = 2,
WHITE_ONLY = 3,
GRAY_ONLY = 4,
BLACK_ONLY = 5
} GimpCheckType;
typedef enum /*< skip >*/
{
SMALL_CHECKS = 0,
MEDIUM_CHECKS = 1,
LARGE_CHECKS = 2
} GimpCheckSize;
/* types */
typedef struct _BoundSeg BoundSeg;
typedef struct _GimpLut GimpLut;
typedef struct _PixelRegionIterator PixelRegionIterator;
typedef struct _PixelRegion PixelRegion;
typedef struct _PixelRegionHolder PixelRegionHolder;
typedef struct _TempBuf TempBuf;
typedef struct _TempBuf MaskBuf;
typedef struct _Tile Tile;
typedef struct _TileManager TileManager;
typedef struct _ScanConvertPoint ScanConvertPoint;
/* functions */
typedef void (* TileValidateProc) (TileManager *tm,
Tile *tile);
#endif /* __BASE_TYPES_H__ */

View file

@ -22,13 +22,12 @@
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "boundary.h"
#include "errors.h"
#include "pixel_region.h"
#include "pixel-region.h"
#include "tile.h"
#include "tile_manager.h"
#include "tile-manager.h"
/* half intensity for mask */
@ -237,9 +236,6 @@ make_seg (gint x1,
tmp_segs = (BoundSeg *) g_realloc ((void *) tmp_segs,
sizeof (BoundSeg) * max_segs);
if (!tmp_segs)
gimp_fatal_error ("make_seg(): Unable to reallocate segments array for mask boundary.");
}
tmp_segs[num_segs].x1 = x1;
@ -280,9 +276,6 @@ allocate_empty_segs (void)
empty_segs_n = (gint *) g_realloc (empty_segs_n, sizeof (gint) * max_empty_segs);
empty_segs_c = (gint *) g_realloc (empty_segs_c, sizeof (gint) * max_empty_segs);
empty_segs_l = (gint *) g_realloc (empty_segs_l, sizeof (gint) * max_empty_segs);
if (!empty_segs_n || !empty_segs_l || !empty_segs_c)
gimp_fatal_error ("allocate_empty_segs(): Unable to reallocate empty segments array for mask boundary.");
}
}

View file

@ -38,16 +38,16 @@ struct _BoundSeg
};
BoundSeg * find_mask_boundary (PixelRegion *maskPR,
gint *num_elems,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2);
BoundSeg * sort_boundary (BoundSeg *segs,
gint num_segs,
gint *num_groups);
BoundSeg * find_mask_boundary (PixelRegion *maskPR,
gint *num_elems,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2);
BoundSeg * sort_boundary (BoundSeg *segs,
gint num_segs,
gint *num_groups);
#endif /* __BOUNDARY_H__ */

View file

@ -20,10 +20,10 @@
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "brush_scale.h"
#include "temp_buf.h"
#include "brush-scale.h"
#include "temp-buf.h"
MaskBuf *

View file

@ -29,10 +29,3 @@ MaskBuf * brush_scale_pixmap (MaskBuf *pixmap,
#endif /* __BRUSH_SCALE_H__ */

View file

@ -27,17 +27,17 @@
#include <gtk/gtk.h>
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
#include "core/core-types.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "gimphistogram.h"
#include "gimprc.h"
#include "pixel_processor.h"
#include "pixel_region.h"
struct _GimpHistogram

View file

@ -22,25 +22,25 @@
#include <stdio.h>
#include <gtk/gtk.h>
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "gimplut.h"
#include "pixel_region.h"
#include "pixel-region.h"
GimpLut *
gimp_lut_new (void)
{
GimpLut *lut;
GimpLut *lut;
lut = g_new (GimpLut, 1);
lut = g_new (GimpLut, 1);
lut->luts = NULL;
lut->nchannels = 0;
lut->luts = NULL;
lut->nchannels = 0;
return lut;
return lut;
}
void
@ -50,6 +50,7 @@ gimp_lut_free (GimpLut *lut)
for (i = 0; i < lut->nchannels; i++)
g_free (lut->luts[i]);
g_free (lut->luts);
}
@ -66,17 +67,22 @@ gimp_lut_setup (GimpLut *lut,
{
for (i = 0; i < lut->nchannels; i++)
g_free (lut->luts[i]);
g_free (lut->luts);
}
lut->nchannels = nchannels;
lut->luts = g_new (guchar*, lut->nchannels);
lut->luts = g_new (guchar *, lut->nchannels);
for (i = 0; i < lut->nchannels; i++)
{
lut->luts[i] = g_new (guchar, 256);
for (v = 0; v < 256; v++)
{ /* to add gamma correction use func(v ^ g) ^ 1/g instead. */
{
/* to add gamma correction use func(v ^ g) ^ 1/g instead. */
val = 255.0 * func (user_data, lut->nchannels, i, v/255.0) + 0.5;
if (val < 0.0)
lut->luts[i][v] = 0;
else if (val >= 255.0)
@ -114,11 +120,11 @@ gimp_lut_process (GimpLut *lut,
if (lut->nchannels > 3)
lut3 = lut->luts[3];
h = srcPR->h;
src = srcPR->data;
dest = destPR->data;
width = srcPR->w;
src_r_i = srcPR->rowstride - (srcPR->bytes * srcPR->w);
h = srcPR->h;
src = srcPR->data;
dest = destPR->data;
width = srcPR->w;
src_r_i = srcPR->rowstride - (srcPR->bytes * srcPR->w);
dest_r_i = destPR->rowstride - (destPR->bytes * srcPR->w);
if (src_r_i == 0 && dest_r_i == 0)
@ -196,9 +202,9 @@ gimp_lut_process_inline (GimpLut *lut,
if (lut->nchannels > 3)
lut3 = lut->luts[3];
h = srcPR->h;
src = srcPR->data;
width = srcPR->w;
h = srcPR->h;
src = srcPR->data;
width = srcPR->w;
src_r_i = srcPR->rowstride - (srcPR->bytes * srcPR->w);
if (src_r_i == 0)

View file

@ -29,14 +29,18 @@ struct _GimpLut
};
/* TODO: the GimpLutFunc should really be passed the ColorModel of the region,
not just the number of channels */
* not just the number of channels
*/
/* GimpLutFuncs should assume that the input and output gamma are 1.0
and do no correction as this will be handled by gimp_lut_setup */
* and do no correction as this will be handled by gimp_lut_setup
*/
typedef gfloat (*GimpLutFunc) (gpointer user_data,
gint nchannels,
gint channel,
gfloat value);
GimpLut * gimp_lut_new (void);
void gimp_lut_free (GimpLut *lut);
@ -46,8 +50,9 @@ void gimp_lut_setup (GimpLut *lut,
gint nchannels);
/* gimp_lut_setup_exact is currently identical to gimp_lut_setup. It
however is guaranteed to never perform any interpolation or gamma
correction on the lut */
* however is guaranteed to never perform any interpolation or gamma
* correction on the lut
*/
void gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func,
gpointer user_data,
@ -58,19 +63,20 @@ void gimp_lut_process (GimpLut *lut,
PixelRegion *destPR);
/* gimp_lut_process_inline is like gimp_lut_process except it uses a
single PixelRegion as both the source and destination */
* single PixelRegion as both the source and destination
*/
void gimp_lut_process_inline (GimpLut *lut,
PixelRegion *src_destPR);
/* gimp_lut_process_2 is the same as gimp_lut_process but the lut
perameter is last instead of first. this is necesary because
pixel_region_process_paralell sends the user_data as the 1st
parameter, and the image_map functions send user_data as the last
parameter */
* parameter is last instead of first. this is necesary because
* pixel_region_process_paralell sends the user_data as the 1st
* parameter, and the image_map functions send user_data as the last
* parameter
*/
void gimp_lut_process_2 (PixelRegion *srcPR,
PixelRegion *destPR,
GimpLut *lut);
#endif /* __GIMP_LUT_H__ */

View file

@ -26,7 +26,8 @@
#include "core/core-types.h"
#include "gimplut.h"
#include "base/gimplut.h"
#include "gimphistogram.h"

View file

@ -29,10 +29,10 @@
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "pixel_processor.h"
#include "pixel_region.h"
#include "pixel-processor.h"
#include "pixel-region.h"
#ifdef ENABLE_MP
#include "tile.h"
@ -54,6 +54,7 @@ typedef void (* p4_func) (gpointer ,
PixelRegion *,
PixelRegion *);
struct _PixelProcessor
{
gpointer data;
@ -68,23 +69,24 @@ struct _PixelProcessor
ProgressReportFunc progress_report_func;
};
IF_THREAD(
static void *
do_parallel_regions (PixelProcessor *p_s)
{
PixelRegion tr[4];
int ntiles = 0;
int i;
int cont = 1;
gint n tiles = 0;
gint i;
gint cont = 1;
pthread_mutex_lock(&p_s->mutex);
pthread_mutex_lock (&p_s->mutex);
if (p_s->nthreads != 0 && p_s->PRI)
p_s->PRI = (PixelRegionIterator*)pixel_regions_process(p_s->PRI);
if (p_s->PRI == NULL)
{
pthread_mutex_unlock(&p_s->mutex);
pthread_mutex_unlock (&p_s->mutex);
return NULL;
}
@ -100,7 +102,7 @@ do_parallel_regions (PixelProcessor *p_s)
tile_lock(tr[i].curtile);
}
pthread_mutex_unlock(&p_s->mutex);
pthread_mutex_unlock (&p_s->mutex);
ntiles++;
switch(p_s->n_regions)
@ -136,7 +138,7 @@ do_parallel_regions (PixelProcessor *p_s)
p_s->n_regions);
}
pthread_mutex_lock(&p_s->mutex);
pthread_mutex_lock (&p_s->mutex);
for (i = 0; i < p_s->n_regions; i++)
if (p_s->r[i])
@ -157,7 +159,7 @@ do_parallel_regions (PixelProcessor *p_s)
p_s->nthreads--;
pthread_mutex_unlock(&p_s->mutex);
pthread_mutex_unlock (&p_s->mutex);
return NULL;
}
@ -372,7 +374,7 @@ pixel_regions_process_parallel_progress (p_func f,
va_list va;
va_start (va, num_regions);
ret = pixel_regions_real_process_parallel (f, data,
progress_func, progress_data,
num_regions, va);
@ -403,13 +405,13 @@ pixel_processor_cont (PixelProcessor *pp)
if (pp->PRI)
return pp;
pixel_processor_free (pp);
return NULL;
}
void
void
pixel_processor_free (PixelProcessor *pp)
{
if (pp->PRI)
@ -417,4 +419,3 @@ pixel_processor_free (PixelProcessor *pp)
else
g_free(pp);
}

View file

@ -24,28 +24,29 @@
typedef struct _PixelProcessor PixelProcessor;
typedef void (* p_func) (void);
typedef gint (* ProgressReportFunc) (void *,
gint,
gint,
gint,
gint);
typedef gint (* ProgressReportFunc) (gpointer ,
gint ,
gint ,
gint ,
gint );
void pixel_regions_process_parallel (p_func f,
gpointer data,
gint num_regions,
void pixel_regions_process_parallel (p_func f,
gpointer data,
gint num_regions,
...);
PixelProcessor * pixel_process_progress (p_func f,
gpointer data,
PixelProcessor * pixel_process_progress (p_func f,
gpointer data,
ProgressReportFunc progress_func,
gpointer progress_data,
gint num_regions,
gpointer progress_data,
gint num_regions,
...);
void pixel_processor_free (PixelProcessor *);
void pixel_processor_stop (PixelProcessor *);
PixelProcessor * pixel_processor_cont (PixelProcessor *);
void pixel_processor_free (PixelProcessor *pp);
void pixel_processor_stop (PixelProcessor *pp);
PixelProcessor * pixel_processor_cont (PixelProcessor *pp);
#endif /* __PIXEL_PROCESSOR_H__ */

View file

@ -21,12 +21,12 @@
#include <stdarg.h>
#include <string.h>
#include <gtk/gtk.h>
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "pixel-region.h"
#include "tile-manager.h"
#include "tile.h"
@ -147,7 +147,7 @@ pixel_region_get_row (PixelRegion *PR,
{
for (b = 0; b < tilebpp; b++)
*data++ = tile_data[b];
tile_data += inc;
}
}

View file

@ -19,6 +19,7 @@
#ifndef __PIXEL_REGION_H__
#define __PIXEL_REGION_H__
struct _PixelRegion
{
guchar *data; /* pointer to region data */

View file

@ -18,15 +18,13 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib.h>
#include "core/core-types.h"
#include "base-types.h"
#include "core/gimpimage.h"
#include "pixel_region.h"
#include "pixel_surround.h"
#include "tile_manager.h"
#include "pixel-region.h"
#include "pixel-surround.h"
#include "tile-manager.h"
#include "tile.h"

View file

@ -18,7 +18,7 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib.h>
#include <errno.h>
#include <stdlib.h>
@ -33,20 +33,17 @@
#ifdef G_OS_WIN32
#include <process.h> /* For _getpid() */
#endif
#include "libgimpcolor/gimpcolor.h"
#include "core/core-types.h"
#include "base-types.h"
#include "base-config.h"
#include "pixel-region.h"
#include "temp-buf.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
#include "gimprc.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "image_render.h"
static guchar * temp_buf_allocate (guint);
static void temp_buf_to_color (TempBuf *src_buf,
@ -574,7 +571,9 @@ generate_unique_filename (void)
pid = getpid ();
return g_strdup_printf ("%s" G_DIR_SEPARATOR_S "gimp%d.%d",
temp_path, (int) pid, swap_index++);
base_config->temp_path,
(gint) pid,
swap_index++);
}
void
@ -592,7 +591,7 @@ temp_buf_swap (TempBuf *buf)
/* Set the swapped flag */
buf->swapped = TRUE;
if (stingy_memory_use)
if (base_config->stingy_memory_use)
swap = buf;
else
{

View file

@ -19,7 +19,6 @@
#ifndef __TEMP_BUF_H__
#define __TEMP_BUF_H__
#include "gimpchecks.h"
struct _TempBuf
{
@ -37,52 +36,52 @@ struct _TempBuf
/* The temp buffer functions */
TempBuf * temp_buf_new (gint width,
gint height,
gint bytes,
gint x,
gint y,
guchar *col);
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,
gint bytes,
gint x,
gint y,
gint width,
gint height);
TempBuf * temp_buf_scale (TempBuf *buf,
gint width,
gint height);
TempBuf * temp_buf_copy_area (TempBuf *src,
TempBuf *dest,
gint x,
gint y,
gint width,
gint height,
gint dest_x,
gint dest_y);
void temp_buf_free (TempBuf *buf);
guchar * temp_buf_data (TempBuf *buf);
guchar * temp_buf_data_clear (TempBuf *buf);
TempBuf * temp_buf_new (gint width,
gint height,
gint bytes,
gint x,
gint y,
guchar *col);
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,
gint bytes,
gint x,
gint y,
gint width,
gint height);
TempBuf * temp_buf_scale (TempBuf *buf,
gint width,
gint height);
TempBuf * temp_buf_copy_area (TempBuf *src,
TempBuf *dest,
gint x,
gint y,
gint width,
gint height,
gint dest_x,
gint dest_y);
void temp_buf_free (TempBuf *buf);
guchar * temp_buf_data (TempBuf *buf);
guchar * temp_buf_data_clear (TempBuf *buf);
/* The mask buffer functions */
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);
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);
/* The disk caching functions */
void temp_buf_swap (TempBuf *buf);
void temp_buf_unswap (TempBuf *buf);
void temp_buf_swap_free (TempBuf *buf);
void temp_buf_swap (TempBuf *buf);
void temp_buf_unswap (TempBuf *buf);
void temp_buf_swap_free (TempBuf *buf);
/* Called by app_procs:exit() to free up the cached undo buffer */

View file

@ -22,15 +22,15 @@
#include <pthread.h>
#endif
#include <gtk/gtk.h>
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "gimprc.h"
#include "base-config.h"
#include "tile.h"
#include "tile_cache.h"
#include "tile_swap.h"
#include "tile_pvt.h"
#include "tile-cache.h"
#include "tile-swap.h"
#include "tile-private.h"
/* This is the percentage of the maximum cache size that should be cleared
@ -48,11 +48,11 @@ static void tile_cache_flush_internal (Tile *tile);
#ifdef USE_PTHREADS
static gpointer tile_idle_thread (gpointer data);
#else
static gint tile_idle_preswap (gpointer data);
static gboolean tile_idle_preswap (gpointer data);
#endif
static int initialize = TRUE;
static gboolean initialize = TRUE;
typedef struct _TileList
{
@ -60,24 +60,24 @@ typedef struct _TileList
Tile *last;
} TileList;
static unsigned long max_tile_size = TILE_WIDTH * TILE_HEIGHT * 4;
static unsigned long cur_cache_size = 0;
static unsigned long max_cache_size = 0;
static unsigned long cur_cache_dirty = 0;
static gulong max_tile_size = TILE_WIDTH * TILE_HEIGHT * 4;
static gulong cur_cache_size = 0;
static gulong max_cache_size = 0;
static gulong cur_cache_dirty = 0;
static TileList clean_list = { NULL, NULL };
static TileList dirty_list = { NULL, NULL };
#ifdef USE_PTHREADS
static pthread_t preswap_thread;
static pthread_t preswap_thread;
static pthread_mutex_t dirty_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_cond_t dirty_signal = PTHREAD_COND_INITIALIZER;
static pthread_cond_t dirty_signal = PTHREAD_COND_INITIALIZER;
static pthread_mutex_t tile_mutex = PTHREAD_MUTEX_INITIALIZER;
#define CACHE_LOCK pthread_mutex_lock(&tile_mutex)
#define CACHE_LOCK pthread_mutex_lock(&tile_mutex)
#define CACHE_UNLOCK pthread_mutex_unlock(&tile_mutex)
#else
static gint idle_swapper = 0;
#define CACHE_LOCK /*nothing*/
#define CACHE_UNLOCK /*nothing*/
static guint idle_swapper = 0;
#define CACHE_LOCK /* nothing */
#define CACHE_UNLOCK /* nothing */
#endif
@ -252,14 +252,14 @@ tile_cache_init (void)
clean_list.first = clean_list.last = NULL;
dirty_list.first = dirty_list.last = NULL;
max_cache_size = tile_cache_size;
max_cache_size = base_config->tile_cache_size;
#ifdef USE_PTHREADS
pthread_create (&preswap_thread, NULL, &tile_idle_thread, NULL);
#else
idle_swapper = gtk_timeout_add (IDLE_SWAPPER_TIMEOUT,
(GtkFunction) tile_idle_preswap,
(gpointer) 0);
idle_swapper = g_timeout_add (IDLE_SWAPPER_TIMEOUT,
tile_idle_preswap,
NULL);
#endif
}
}
@ -374,7 +374,7 @@ tile_idle_thread (gpointer data)
}
#else
static gint
static gboolean
tile_idle_preswap (gpointer data)
{
Tile *tile;

View file

@ -22,14 +22,14 @@
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "tile.h"
#include "tile_pvt.h"
#include "tile_cache.h"
#include "tile_manager.h"
#include "tile_manager_pvt.h"
#include "tile_swap.h"
#include "tile-private.h"
#include "tile-cache.h"
#include "tile-manager.h"
#include "tile-manager-private.h"
#include "tile-swap.h"
static gint tile_manager_get_tile_num (TileManager *tm,

View file

@ -25,6 +25,7 @@
* used to compute the number of levels and there
* size. Each level is 1/2 the width and height of
* the level above it.
*
* The toplevel is level 0. The smallest level in the
* hierarchy is "nlevels - 1". That level will be smaller
* than TILE_WIDTH x TILE_HEIGHT
@ -95,23 +96,23 @@ void tile_invalidate_tile (Tile **tile_ptr,
/* Given a toplevel tile, this procedure will invalidate
* (set the dirty bit) for this toplevel tile.
*/
void tile_manager_invalidate_tiles (TileManager *tm,
Tile *toplevel_tile);
void tile_manager_invalidate_tiles (TileManager *tm,
Tile *toplevel_tile);
void tile_manager_set_user_data (TileManager *tm,
gpointer user_data);
gpointer tile_manager_get_user_data (const TileManager *tm);
void tile_manager_set_user_data (TileManager *tm,
gpointer user_data);
gpointer tile_manager_get_user_data (const TileManager *tm);
gint tile_manager_width (const TileManager *tm);
gint tile_manager_height (const TileManager *tm);
gint tile_manager_bpp (const TileManager *tm);
gint tile_manager_width (const TileManager *tm);
gint tile_manager_height (const TileManager *tm);
gint tile_manager_bpp (const TileManager *tm);
void tile_manager_get_offsets (const TileManager *tm,
gint *x,
gint *y);
void tile_manager_set_offsets (TileManager *tm,
gint x,
gint y);
void tile_manager_get_offsets (const TileManager *tm,
gint *x,
gint *y);
void tile_manager_set_offsets (TileManager *tm,
gint x,
gint y);
void tile_manager_get_tile_coordinates (TileManager *tm,
Tile *tile,
@ -122,4 +123,5 @@ void tile_manager_map_over_tile (TileManager *tm,
Tile *tile,
Tile *srctile);
#endif /* __TILE_MANAGER_H__ */

View file

@ -1,6 +1,23 @@
#ifndef __TILE_PVT_H__
#define __TILE_PVT_H__
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __TILE_PRIVATE_H__
#define __TILE_PRIVATE_H__
#include "config.h"
@ -9,6 +26,7 @@
#endif
#include <sys/types.h>
#include <glib.h>
@ -27,26 +45,26 @@ struct _TileLink
struct _Tile
{
gshort ref_count; /* reference count. when the reference count is
* non-zero then the "data" for this tile must
* be valid. when the reference count for a tile
* is 0 then the "data" for this tile must be
* NULL.
*/
gshort write_count; /* write count: number of references that are
for write access */
gshort share_count; /* share count: number of tile managers that
hold this tile */
guint dirty : 1; /* is the tile dirty? has it been modified? */
guint valid : 1; /* is the tile valid? */
gshort ref_count; /* reference count. when the reference count is
* non-zero then the "data" for this tile must
* be valid. when the reference count for a tile
* is 0 then the "data" for this tile must be
* NULL.
*/
gshort write_count; /* write count: number of references that are
for write access */
gshort share_count; /* share count: number of tile managers that
hold this tile */
guint dirty : 1; /* is the tile dirty? has it been modified? */
guint valid : 1; /* is the tile valid? */
guchar bpp; /* the bytes per pixel (1, 2, 3 or 4) */
gushort ewidth; /* the effective width of the tile */
gushort eheight; /* the effective height of the tile
* a tile's effective width and height may be smaller
* (but not larger) than TILE_WIDTH and TILE_HEIGHT.
* this is to handle edge tiles of a drawable.
*/
guchar bpp; /* the bytes per pixel (1, 2, 3 or 4) */
gushort ewidth; /* the effective width of the tile */
gushort eheight; /* the effective height of the tile
* a tile's effective width and height may be smaller
* (but not larger) than TILE_WIDTH and TILE_HEIGHT.
* this is to handle edge tiles of a drawable.
*/
TileRowHint *rowhint; /* An array of hints for rendering purposes */
@ -81,4 +99,4 @@ struct _Tile
#endif
#endif /* __TILE_PVT_H__ */
#endif /* __TILE_PRIVATE_H__ */

View file

@ -43,11 +43,11 @@
#define _O_TEMPORARY 0
#endif
#include "apptypes.h"
#include "base-types.h"
#include "tile.h"
#include "tile_pvt.h"
#include "tile_swap.h"
#include "tile-private.h"
#include "tile-swap.h"
#define MAX_OPEN_SWAP_FILES 16
@ -142,7 +142,9 @@ static GSList * async_swapin_tiles = NULL;
static GSList * async_swapin_tiles_end = NULL;
#endif
static gboolean seek_err_msg = TRUE, read_err_msg = TRUE, write_err_msg = TRUE;
static gboolean seek_err_msg = TRUE;
static gboolean read_err_msg = TRUE;
static gboolean write_err_msg = TRUE;
static void

View file

@ -29,10 +29,11 @@ typedef enum
SWAP_COMPRESS
} SwapCommand;
typedef gint (*SwapFunc) (gint fd,
Tile *tile,
gint cmd,
gpointer user_data);
typedef gint (* SwapFunc) (gint fd,
Tile *tile,
gint cmd,
gpointer user_data);
void tile_swap_exit (void);

View file

@ -20,13 +20,13 @@
#include <glib.h>
#include "apptypes.h"
#include "base-types.h"
#include "tile.h"
#include "tile_pvt.h"
#include "tile_cache.h"
#include "tile_manager.h"
#include "tile_swap.h"
#include "tile-private.h"
#include "tile-cache.h"
#include "tile-manager.h"
#include "tile-swap.h"
static void tile_destroy (Tile *tile);

View file

@ -1,557 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <string.h>
#include <glib.h>
#include "apptypes.h"
#include "boundary.h"
#include "errors.h"
#include "pixel_region.h"
#include "tile.h"
#include "tile_manager.h"
/* half intensity for mask */
#define HALF_WAY 127
/* BoundSeg array growth parameter */
#define MAX_SEGS_INC 2048
/* The array of vertical segments */
static gint *vert_segs = NULL;
/* The array of segments */
static BoundSeg *tmp_segs = NULL;
static gint num_segs = 0;
static gint max_segs = 0;
/* static empty segment arrays */
static gint *empty_segs_n = NULL;
static gint num_empty_n = 0;
static gint *empty_segs_c = NULL;
static gint num_empty_c = 0;
static gint *empty_segs_l = NULL;
static gint num_empty_l = 0;
static gint max_empty_segs = 0;
/* global state variables--improve parameter efficiency */
static PixelRegion *cur_PR = NULL;
/* local function prototypes */
static void find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2);
static void make_seg (gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void allocate_vert_segs (void);
static void allocate_empty_segs (void);
static void process_horiz_seg (gint x1,
gint y1,
gint x2,
gint y2,
gboolean open);
static void make_horiz_segs (gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top);
static void generate_boundary (BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2);
/* Function definitions */
static void
find_empty_segs (PixelRegion *maskPR,
gint scanline,
gint empty_segs[],
gint max_empty,
gint *num_empty,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2)
{
unsigned char *data;
int x;
int start, end;
int val, last;
int tilex;
Tile *tile = NULL;
int endx, l_num_empty, dstep = 0;
data = NULL;
start = 0;
end = 0;
*num_empty = 0;
if (scanline < maskPR->y || scanline >= (maskPR->y + maskPR->h))
{
empty_segs[(*num_empty)++] = 0;
empty_segs[(*num_empty)++] = G_MAXINT;
return;
}
if (type == WithinBounds)
{
if (scanline < y1 || scanline >= y2)
{
empty_segs[(*num_empty)++] = 0;
empty_segs[(*num_empty)++] = G_MAXINT;
return;
}
start = x1;
end = x2;
}
else if (type == IgnoreBounds)
{
start = maskPR->x;
end = maskPR->x + maskPR->w;
if (scanline < y1 || scanline >= y2)
x2 = -1;
}
tilex = -1;
empty_segs[(*num_empty)++] = 0;
last = -1;
l_num_empty = *num_empty;
for (x = start; x < end;)
{
/* Check to see if we must advance to next tile */
if ((x / TILE_WIDTH) != tilex)
{
if (tile)
tile_release (tile, FALSE);
tile = tile_manager_get_tile (maskPR->tiles, x, scanline, TRUE, FALSE);
data = (guchar *) tile_data_pointer (tile,
x % TILE_WIDTH,
scanline % TILE_HEIGHT) + (tile_bpp(tile) - 1);
tilex = x / TILE_WIDTH;
dstep = tile_bpp (tile);
}
endx = x + (TILE_WIDTH - (x%TILE_WIDTH));
endx = MIN (end, endx);
if (type == IgnoreBounds && (endx > x1 || x < x2))
{
for (; x < endx; x++)
{
if (*data > HALF_WAY)
if (x >= x1 && x < x2)
val = -1;
else
val = 1;
else
val = -1;
data += dstep;
if (last != val)
empty_segs[l_num_empty++] = x;
last = val;
}
}
else
{
for (; x < endx; x++)
{
if (*data > HALF_WAY)
val = 1;
else
val = -1;
data += dstep;
if (last != val)
empty_segs[l_num_empty++] = x;
last = val;
}
}
}
*num_empty = l_num_empty;
if (last > 0)
empty_segs[(*num_empty)++] = x;
empty_segs[(*num_empty)++] = G_MAXINT;
if (tile)
tile_release (tile, FALSE);
}
static void
make_seg (gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
{
if (num_segs >= max_segs)
{
max_segs += MAX_SEGS_INC;
tmp_segs = (BoundSeg *) g_realloc ((void *) tmp_segs,
sizeof (BoundSeg) * max_segs);
if (!tmp_segs)
gimp_fatal_error ("make_seg(): Unable to reallocate segments array for mask boundary.");
}
tmp_segs[num_segs].x1 = x1;
tmp_segs[num_segs].y1 = y1;
tmp_segs[num_segs].x2 = x2;
tmp_segs[num_segs].y2 = y2;
tmp_segs[num_segs].open = open;
num_segs ++;
}
static void
allocate_vert_segs (void)
{
gint i;
/* allocate and initialize the vert_segs array */
vert_segs = (gint *) g_realloc ((void *) vert_segs,
(cur_PR->w + cur_PR->x + 1) * sizeof (gint));
for (i = 0; i <= (cur_PR->w + cur_PR->x); i++)
vert_segs[i] = -1;
}
static void
allocate_empty_segs (void)
{
gint need_num_segs;
/* find the maximum possible number of empty segments given the current mask */
need_num_segs = cur_PR->w + 3;
if (need_num_segs > max_empty_segs)
{
max_empty_segs = need_num_segs;
empty_segs_n = (gint *) g_realloc (empty_segs_n, sizeof (gint) * max_empty_segs);
empty_segs_c = (gint *) g_realloc (empty_segs_c, sizeof (gint) * max_empty_segs);
empty_segs_l = (gint *) g_realloc (empty_segs_l, sizeof (gint) * max_empty_segs);
if (!empty_segs_n || !empty_segs_l || !empty_segs_c)
gimp_fatal_error ("allocate_empty_segs(): Unable to reallocate empty segments array for mask boundary.");
}
}
static void
process_horiz_seg (gint x1,
gint y1,
gint x2,
gint y2,
gboolean open)
{
/* This procedure accounts for any vertical segments that must be
drawn to close in the horizontal segments. */
if (vert_segs[x1] >= 0)
{
make_seg (x1, vert_segs[x1], x1, y1, !open);
vert_segs[x1] = -1;
}
else
vert_segs[x1] = y1;
if (vert_segs[x2] >= 0)
{
make_seg (x2, vert_segs[x2], x2, y2, open);
vert_segs[x2] = -1;
}
else
vert_segs[x2] = y2;
make_seg (x1, y1, x2, y2, open);
}
static void
make_horiz_segs (gint start,
gint end,
gint scanline,
gint empty[],
gint num_empty,
gint top)
{
gint empty_index;
gint e_s, e_e; /* empty segment start and end values */
for (empty_index = 0; empty_index < num_empty; empty_index += 2)
{
e_s = *empty++;
e_e = *empty++;
if (e_s <= start && e_e >= end)
process_horiz_seg (start, scanline, end, scanline, top);
else if ((e_s > start && e_s < end) ||
(e_e < end && e_e > start))
process_horiz_seg (MAX (e_s, start), scanline,
MIN (e_e, end), scanline, top);
}
}
static void
generate_boundary (BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2)
{
gint scanline;
gint i;
gint start, end;
gint *tmp_segs;
start = 0;
end = 0;
/* array for determining the vertical line segments which must be drawn */
allocate_vert_segs ();
/* make sure there is enough space for the empty segment array */
allocate_empty_segs ();
num_segs = 0;
if (type == WithinBounds)
{
start = y1;
end = y2;
}
else if (type == IgnoreBounds)
{
start = cur_PR->y;
end = cur_PR->y + cur_PR->h;
}
/* Find the empty segments for the previous and current scanlines */
find_empty_segs (cur_PR, start - 1, empty_segs_l,
max_empty_segs, &num_empty_l,
type, x1, y1, x2, y2);
find_empty_segs (cur_PR, start, empty_segs_c,
max_empty_segs, &num_empty_c,
type, x1, y1, x2, y2);
for (scanline = start; scanline < end; scanline++)
{
/* find the empty segment list for the next scanline */
find_empty_segs (cur_PR, scanline + 1, empty_segs_n,
max_empty_segs, &num_empty_n,
type, x1, y1, x2, y2);
/* process the segments on the current scanline */
for (i = 1; i < num_empty_c - 1; i += 2)
{
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
scanline, empty_segs_l, num_empty_l, 1);
make_horiz_segs (empty_segs_c [i], empty_segs_c [i+1],
scanline+1, empty_segs_n, num_empty_n, 0);
}
/* get the next scanline of empty segments, swap others */
tmp_segs = empty_segs_l;
empty_segs_l = empty_segs_c;
num_empty_l = num_empty_c;
empty_segs_c = empty_segs_n;
num_empty_c = num_empty_n;
empty_segs_n = tmp_segs;
}
}
BoundSeg *
find_mask_boundary (PixelRegion *maskPR,
int *num_elems,
BoundaryType type,
int x1,
int y1,
int x2,
int y2)
{
BoundSeg * new_segs = NULL;
/* The mask paramater can be any PixelRegion. If the region
* has more than 1 bytes/pixel, the last byte of each pixel is
* used to determine the boundary outline.
*/
cur_PR = maskPR;
/* Calculate the boundary */
generate_boundary (type, x1, y1, x2, y2);
/* Set the number of X segments */
*num_elems = num_segs;
/* Make a copy of the boundary */
if (num_segs)
{
new_segs = (BoundSeg *) g_malloc (sizeof (BoundSeg) * num_segs);
memcpy (new_segs, tmp_segs, (sizeof (BoundSeg) * num_segs));
}
/* Return the new boundary */
return new_segs;
}
/************************/
/* Sorting a Boundary */
static int find_segment (BoundSeg *, int, int, int);
static int
find_segment (BoundSeg *segs,
gint ns,
gint x,
gint y)
{
gint index;
for (index = 0; index < ns; index++)
if (((segs[index].x1 == x && segs[index].y1 == y) || (segs[index].x2 == x && segs[index].y2 == y)) &&
segs[index].visited == FALSE)
return index;
return -1;
}
BoundSeg *
sort_boundary (BoundSeg *segs,
gint ns,
gint *num_groups)
{
gint i;
gint index;
gint x, y;
gint startx, starty;
gint empty = (num_segs == 0);
BoundSeg *new_segs;
index = 0;
new_segs = NULL;
for (i = 0; i < ns; i++)
segs[i].visited = FALSE;
num_segs = 0;
*num_groups = 0;
while (! empty)
{
empty = TRUE;
/* find the index of a non-visited segment to start a group */
for (i = 0; i < ns; i++)
if (segs[i].visited == FALSE)
{
index = i;
empty = FALSE;
i = ns;
}
if (! empty)
{
make_seg (segs[index].x1, segs[index].y1,
segs[index].x2, segs[index].y2,
segs[index].open);
segs[index].visited = TRUE;
startx = segs[index].x1;
starty = segs[index].y1;
x = segs[index].x2;
y = segs[index].y2;
while ((index = find_segment (segs, ns, x, y)) != -1)
{
/* make sure ordering is correct */
if (x == segs[index].x1 && y == segs[index].y1)
{
make_seg (segs[index].x1, segs[index].y1,
segs[index].x2, segs[index].y2,
segs[index].open);
x = segs[index].x2;
y = segs[index].y2;
}
else
{
make_seg (segs[index].x2, segs[index].y2,
segs[index].x1, segs[index].y1,
segs[index].open);
x = segs[index].x1;
y = segs[index].y1;
}
segs[index].visited = TRUE;
}
if (x != startx || y != starty)
g_message ("sort_boundary(): Unconnected boundary group!");
/* Mark the end of a group */
*num_groups = *num_groups + 1;
make_seg (-1, -1, -1, -1, 0);
}
}
/* Make a copy of the boundary */
if (num_segs)
{
new_segs = (BoundSeg *) g_malloc (sizeof (BoundSeg) * num_segs);
memcpy (new_segs, tmp_segs, (sizeof (BoundSeg) * num_segs));
}
/* Return the new boundary */
return new_segs;
}

View file

@ -1,350 +0,0 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <glib.h>
#include "apptypes.h"
#include "brush_scale.h"
#include "temp_buf.h"
MaskBuf *
brush_scale_mask (MaskBuf *brush_mask,
gint dest_width,
gint dest_height)
{
MaskBuf *scale_brush;
gint src_width;
gint src_height;
gint value;
gint area;
gint i, j;
gint x, x0, y, y0;
gint dx, dx0, dy, dy0;
gint fx, fx0, fy, fy0;
guchar *src, *dest;
g_return_val_if_fail (brush_mask != NULL &&
dest_width != 0 && dest_height != 0, NULL);
src_width = brush_mask->width;
src_height = brush_mask->height;
scale_brush = mask_buf_new (dest_width, dest_height);
g_return_val_if_fail (scale_brush != NULL, NULL);
/* get the data */
dest = mask_buf_data (scale_brush);
src = mask_buf_data (brush_mask);
fx = fx0 = (256.0 * src_width) / dest_width;
fy = fy0 = (256.0 * src_height) / dest_height;
area = fx0 * fy0;
x = x0 = 0;
y = y0 = 0;
dx = dx0 = 0;
dy = dy0 = 0;
for (i=0; i<dest_height; i++)
{
for (j=0; j<dest_width; j++)
{
value = 0;
fy = fy0;
y = y0;
dy = dy0;
if (dy)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
value += dx * dy * src[x + src_width * y];
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
value += 256 * dy * src[x + src_width * y];
x++;
fx -= 256;
}
if (fx)
{
value += fx * dy * src[x + src_width * y];
dx = 256 - fx;
}
y++;
fy -= dy;
dy = 0;
}
while (fy >= 256)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
value += dx * 256 * src[x + src_width * y];
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
value += 256 * 256 * src[x + src_width * y];
x++;
fx -= 256;
}
if (fx)
{
value += fx * 256 * src[x + src_width * y];
dx = 256 - fx;
}
y++;
fy -= 256;
}
if (fy)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
value += dx * fy * src[x + src_width * y];
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
value += 256 * fy * src[x + src_width * y];
x++;
fx -= 256;
}
if (fx)
{
value += fx * fy * src[x + src_width * y];
dx = 256 - fx;
}
dy = 256 - fy;
}
*dest++ = MIN ((value / area), 255);
x0 = x;
dx0 = dx;
}
x0 = 0;
dx0 = 0;
y0 = y;
dy0 = dy;
}
return scale_brush;
}
#define ADD_RGB(dest, factor, src) \
dest[0] += factor * src[0]; \
dest[1] += factor * src[1]; \
dest[2] += factor * src[2];
MaskBuf *
brush_scale_pixmap (MaskBuf *pixmap,
gint dest_width,
gint dest_height)
{
MaskBuf *scale_brush;
gint src_width;
gint src_height;
gint value[3];
gint factor;
gint area;
gint i, j;
gint x, x0, y, y0;
gint dx, dx0, dy, dy0;
gint fx, fx0, fy, fy0;
guchar *src, *src_ptr, *dest;
g_return_val_if_fail (pixmap != NULL && pixmap->bytes == 3 &&
dest_width != 0 && dest_height != 0, NULL);
src_width = pixmap->width;
src_height = pixmap->height;
scale_brush = temp_buf_new (dest_width, dest_height, 3, 0, 0, NULL);
g_return_val_if_fail (scale_brush != NULL, NULL);
/* get the data */
dest = mask_buf_data (scale_brush);
src = mask_buf_data (pixmap);
fx = fx0 = (256.0 * src_width) / dest_width;
fy = fy0 = (256.0 * src_height) / dest_height;
area = fx0 * fy0;
x = x0 = 0;
y = y0 = 0;
dx = dx0 = 0;
dy = dy0 = 0;
for (i=0; i<dest_height; i++)
{
for (j=0; j<dest_width; j++)
{
value[0] = 0;
value[1] = 0;
value[2] = 0;
fy = fy0;
y = y0;
dy = dy0;
if (dy)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
factor = dx * dy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
factor = 256 * dy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= 256;
}
if (fx)
{
factor = fx * dy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
dx = 256 - fx;
}
y++;
fy -= dy;
dy = 0;
}
while (fy >= 256)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
factor = dx * 256;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
factor = 256 * 256;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= 256;
}
if (fx)
{
factor = fx * 256;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
dx = 256 - fx;
}
y++;
fy -= 256;
}
if (fy)
{
fx = fx0;
x = x0;
dx = dx0;
if (dx)
{
factor = dx * fy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= dx;
dx = 0;
}
while (fx >= 256)
{
factor = 256 * fy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
x++;
fx -= 256;
}
if (fx)
{
factor = fx * fy;
src_ptr = src + 3 * (x + y * src_width);
ADD_RGB (value, factor, src_ptr);
dx = 256 - fx;
}
dy = 256 - fy;
}
*dest++ = MIN ((value[0] / area), 255);
*dest++ = MIN ((value[1] / area), 255);
*dest++ = MIN ((value[2] / area), 255);
x0 = x;
dx0 = dx;
}
x0 = 0;
dx0 = 0;
y0 = y;
dy0 = dy;
}
return scale_brush;
}
#undef ADD_RGB

View file

@ -39,6 +39,8 @@ libappcore_la_SOURCES = \
gimpgradient.h \
gimpimage.c \
gimpimage.h \
gimpimage-colorhash.c \
gimpimage-colorhash.h \
gimpimage-convert.c \
gimpimage-convert.h \
gimpimage-duplicate.c \

View file

@ -27,6 +27,9 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
@ -44,8 +47,6 @@
#include "gimage.h"
#include "global_edit.h"
#include "image_new.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -27,6 +27,12 @@
#include "tools-types.h"
#include "base/base-config.h"
#include "base/pixel-region.h"
#include "base/pixel-surround.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
@ -45,13 +51,8 @@
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gimprc.h"
#include "path_transform.h"
#include "pixel_region.h"
#include "pixel_surround.h"
#include "undo.h"
#include "tile_manager.h"
#include "tile.h"
#include "path_transform.h"
#include "tool_manager.h"
#include "tool_options.h"
@ -1149,7 +1150,7 @@ gimp_transform_tool_do (GimpImage *gimage,
/* turn interpolation off for simple transformations (e.g. rot90) */
if (gimp_matrix3_is_simple (matrix) ||
interpolation_type == NEAREST_NEIGHBOR_INTERPOLATION)
base_config->interpolation_type == NEAREST_NEIGHBOR_INTERPOLATION)
interpolation = FALSE;
/* Get the background color */
@ -1247,7 +1248,7 @@ gimp_transform_tool_do (GimpImage *gimage,
/* initialise the pixel_surround accessor */
if (interpolation)
{
if (interpolation_type == CUBIC_INTERPOLATION)
if (base_config->interpolation_type == CUBIC_INTERPOLATION)
{
pixel_surround_init (&surround, float_tiles, 4, 4, bg_col);
}
@ -1309,7 +1310,7 @@ gimp_transform_tool_do (GimpImage *gimage,
if (interpolation)
{
if (interpolation_type == CUBIC_INTERPOLATION)
if (base_config->interpolation_type == CUBIC_INTERPOLATION)
{
/* ttx & tty are the subpixel coordinates of the point in
* the original selection's floating buffer.

View file

@ -43,17 +43,17 @@
#include "core-types.h"
#include "brush_scale.h"
#include "base/base-config.h"
#include "base/brush-scale.h"
#include "base/temp-buf.h"
#include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/tools-types.h"
#include "tools/gimppainttool.h"
#include "brush_scale.h"
#include "libgimp/gimpintl.h"
@ -322,7 +322,7 @@ gimp_brush_load (const gchar *filename)
gimp_data_set_filename (GIMP_DATA (brush), filename);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
{
temp_buf_swap (brush->mask);

View file

@ -43,17 +43,17 @@
#include "core-types.h"
#include "brush_scale.h"
#include "base/base-config.h"
#include "base/brush-scale.h"
#include "base/temp-buf.h"
#include "gimpbrush.h"
#include "gimpbrush-header.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/tools-types.h"
#include "tools/gimppainttool.h"
#include "brush_scale.h"
#include "libgimp/gimpintl.h"
@ -322,7 +322,7 @@ gimp_brush_load (const gchar *filename)
gimp_data_set_filename (GIMP_DATA (brush), filename);
/* Swap the brush to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
{
temp_buf_swap (brush->mask);

View file

@ -34,10 +34,10 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "gimpbrush.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
@ -227,7 +227,7 @@ gimp_brush_generated_dirty (GimpData *data)
gbrush = GIMP_BRUSH (brush);
if (stingy_memory_use && gbrush->mask)
if (base_config->stingy_memory_use && gbrush->mask)
temp_buf_unswap (gbrush->mask);
if (gbrush->mask)
@ -419,7 +419,7 @@ gimp_brush_generated_load (const gchar *filename)
GIMP_DATA (brush)->dirty = FALSE;
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_DATA (brush);

View file

@ -34,10 +34,10 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "gimpbrush.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
@ -227,7 +227,7 @@ gimp_brush_generated_dirty (GimpData *data)
gbrush = GIMP_BRUSH (brush);
if (stingy_memory_use && gbrush->mask)
if (base_config->stingy_memory_use && gbrush->mask)
temp_buf_unswap (gbrush->mask);
if (gbrush->mask)
@ -419,7 +419,7 @@ gimp_brush_generated_load (const gchar *filename)
GIMP_DATA (brush)->dirty = FALSE;
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_DATA (brush);

View file

@ -34,10 +34,10 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "gimpbrushgenerated.h"
#include "gimprc.h"
#include "gimpbrush.h"
#include "temp_buf.h"
/* this needs to go away */
#include "tools/gimppainttool.h"
@ -227,7 +227,7 @@ gimp_brush_generated_dirty (GimpData *data)
gbrush = GIMP_BRUSH (brush);
if (stingy_memory_use && gbrush->mask)
if (base_config->stingy_memory_use && gbrush->mask)
temp_buf_unswap (gbrush->mask);
if (gbrush->mask)
@ -419,7 +419,7 @@ gimp_brush_generated_load (const gchar *filename)
GIMP_DATA (brush)->dirty = FALSE;
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_DATA (brush);

View file

@ -28,22 +28,23 @@
#include "core-types.h"
#include "base/boundary.h"
#include "base/gimplut.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "boundary.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimplut.h"
#include "parasitelist.h"
#include "pixel_processor.h"
#include "pixel_region.h"
#include "lut_funcs.h"
#include "temp_buf.h"
#include "tile.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -28,22 +28,23 @@
#include "core-types.h"
#include "base/boundary.h"
#include "base/gimplut.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "boundary.h"
#include "drawable.h"
#include "gimpimage.h"
#include "gimpimage-mask.h"
#include "gimpchannel.h"
#include "gimplayer.h"
#include "gimplut.h"
#include "parasitelist.h"
#include "pixel_processor.h"
#include "pixel_region.h"
#include "lut_funcs.h"
#include "temp_buf.h"
#include "tile.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -27,6 +27,9 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
/* FIXME: make a GimpToolFactory out of the tool_manager and put it here */
#include "tools/tools-types.h"
@ -46,7 +49,6 @@
#include "context_manager.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "temp_buf.h"
typedef void (* GimpContextCopyArgFunc) (GimpContext *src,
@ -1827,7 +1829,7 @@ gimp_context_real_set_brush (GimpContext *context,
}
/* make sure the active brush is swapped before we get a new one... */
if (stingy_memory_use &&
if (base_config->stingy_memory_use &&
context->brush && context->brush->mask &&
GTK_OBJECT (context->brush)->ref_count == 2)
{
@ -1856,8 +1858,8 @@ gimp_context_real_set_brush (GimpContext *context,
context);
/* Make sure the active brush is unswapped... */
if (stingy_memory_use &&
brush->mask &&
if (base_config->stingy_memory_use &&
brush->mask &&
GTK_OBJECT (brush)->ref_count < 2)
{
temp_buf_unswap (brush->mask);
@ -1995,7 +1997,7 @@ gimp_context_real_set_pattern (GimpContext *context,
}
/* make sure the active pattern is swapped before we get a new one... */
if (stingy_memory_use &&
if (base_config->stingy_memory_use &&
context->pattern && context->pattern->mask &&
GTK_OBJECT (context->pattern)->ref_count == 2)
{
@ -2021,8 +2023,8 @@ gimp_context_real_set_pattern (GimpContext *context,
context);
/* Make sure the active pattern is unswapped... */
if (stingy_memory_use &&
pattern->mask &&
if (base_config->stingy_memory_use &&
pattern->mask &&
GTK_OBJECT (pattern)->ref_count < 2)
{
temp_buf_unswap (pattern->mask);

View file

@ -28,6 +28,10 @@
#include "tools-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
@ -45,13 +49,9 @@
#include "errors.h"
#include "gdisplay.h"
#include "gimpprogress.h"
#include "pixel_region.h"
#include "selection.h"
#include "undo.h"
#include "tile.h"
#include "tile_manager.h"
#include "gimpblendtool.h"
#include "paint_options.h"
#include "tool_manager.h"

View file

@ -22,13 +22,14 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "paint-funcs/paint-funcs.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-desaturate.h"
#include "gimpimage.h"
#include "pixel_region.h"
void

View file

@ -22,15 +22,16 @@
#include "core-types.h"
#include "base/gimplut.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-equalize.h"
#include "gimpimage.h"
#include "gimplut.h"
#include "lut_funcs.h"
#include "gimphistogram.h"
#include "pixel_processor.h"
#include "pixel_region.h"
void

View file

@ -22,13 +22,14 @@
#include "core-types.h"
#include "base/gimplut.h"
#include "base/pixel-processor.h"
#include "base/pixel-region.h"
#include "drawable.h"
#include "gimpdrawable.h"
#include "gimpdrawable-invert.h"
#include "gimplut.h"
#include "lut_funcs.h"
#include "pixel_processor.h"
#include "pixel_region.h"
void

View file

@ -27,6 +27,9 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "drawable.h"
@ -34,8 +37,6 @@
#include "gimpdrawable.h"
#include "gimpdrawable-offset.h"
#include "gimpimage.h"
#include "pixel_region.h"
#include "tile_manager.h"
void

View file

@ -26,6 +26,11 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "gimpchannel.h"
@ -33,10 +38,6 @@
#include "gimpdrawable.h"
#include "gimplayer.h"
#include "gimppreviewcache.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
/* local function prototypes */

View file

@ -27,6 +27,12 @@
#include "tools-types.h"
#include "base/base-config.h"
#include "base/pixel-region.h"
#include "base/pixel-surround.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
@ -45,13 +51,8 @@
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gimprc.h"
#include "path_transform.h"
#include "pixel_region.h"
#include "pixel_surround.h"
#include "undo.h"
#include "tile_manager.h"
#include "tile.h"
#include "path_transform.h"
#include "tool_manager.h"
#include "tool_options.h"
@ -1149,7 +1150,7 @@ gimp_transform_tool_do (GimpImage *gimage,
/* turn interpolation off for simple transformations (e.g. rot90) */
if (gimp_matrix3_is_simple (matrix) ||
interpolation_type == NEAREST_NEIGHBOR_INTERPOLATION)
base_config->interpolation_type == NEAREST_NEIGHBOR_INTERPOLATION)
interpolation = FALSE;
/* Get the background color */
@ -1247,7 +1248,7 @@ gimp_transform_tool_do (GimpImage *gimage,
/* initialise the pixel_surround accessor */
if (interpolation)
{
if (interpolation_type == CUBIC_INTERPOLATION)
if (base_config->interpolation_type == CUBIC_INTERPOLATION)
{
pixel_surround_init (&surround, float_tiles, 4, 4, bg_col);
}
@ -1309,7 +1310,7 @@ gimp_transform_tool_do (GimpImage *gimage,
if (interpolation)
{
if (interpolation_type == CUBIC_INTERPOLATION)
if (base_config->interpolation_type == CUBIC_INTERPOLATION)
{
/* ttx & tty are the subpixel coordinates of the point in
* the original selection's floating buffer.

View file

@ -29,6 +29,10 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "base/tile.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "gimpchannel.h"
@ -41,9 +45,6 @@
#include "gimppreviewcache.h"
#include "gimpparasite.h"
#include "parasitelist.h"
#include "pixel_region.h"
#include "tile.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpparasite.h"

View file

@ -27,6 +27,9 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
@ -44,8 +47,6 @@
#include "gimage.h"
#include "global_edit.h"
#include "image_new.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -26,16 +26,17 @@
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "libgimp/gimplimits.h"
#include "core-types.h"
#include "errors.h"
#include "base/temp-buf.h"
#include "gimpimage.h"
#include "gimpgradient.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimplimits.h"
#include "errors.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"

View file

@ -0,0 +1,157 @@
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <gtk/gtk.h>
#include "core/core-types.h"
#include "gimpimage.h"
#define MAXDIFF 195076
#define HASH_TABLE_SIZE 1021
typedef struct _ColorHash ColorHash;
struct _ColorHash
{
gint pixel; /* R << 16 | G << 8 | B */
gint index; /* colormap index */
GimpImage *gimage;
};
static ColorHash color_hash_table[HASH_TABLE_SIZE];
static gint color_hash_misses;
static gint color_hash_hits;
void
gimp_image_color_hash_init (void)
{
gint i;
/* initialize the color hash table--invalidate all entries */
for (i = 0; i < HASH_TABLE_SIZE; i++)
color_hash_table[i].gimage = NULL;
color_hash_misses = 0;
color_hash_hits = 0;
}
void
gimp_image_color_hash_exit (void)
{
/* print out the hash table statistics
printf ("RGB->indexed hash table lookups: %d\n", color_hash_hits + color_hash_misses);
printf ("RGB->indexed hash table hits: %d\n", color_hash_hits);
printf ("RGB->indexed hash table misses: %d\n", color_hash_misses);
printf ("RGB->indexed hash table hit rate: %f\n",
100.0 * color_hash_hits / (color_hash_hits + color_hash_misses));
*/
}
void
gimp_image_color_hash_invalidate (GimpImage* gimage,
gint index)
{
gint i;
g_return_if_fail (gimage != NULL);
g_return_if_fail (GIMP_IS_IMAGE (gimage));
if (index == -1) /* invalidate all entries */
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage)
color_hash_table[i].gimage = NULL;
}
else
{
for (i = 0; i < HASH_TABLE_SIZE; i++)
if (color_hash_table[i].gimage == gimage &&
color_hash_table[i].index == index)
color_hash_table[i].gimage = NULL;
}
}
gint
gimp_image_color_hash_rgb_to_indexed (const GimpImage *gimage,
gint r,
gint g,
gint b)
{
guchar *cmap;
gint num_cols;
guint pixel;
gint hash_index;
gint cmap_index;
cmap = gimage->cmap;
num_cols = gimage->num_cols;
pixel = (r << 16) | (g << 8) | b;
hash_index = pixel % HASH_TABLE_SIZE;
if (color_hash_table[hash_index].gimage == gimage &&
color_hash_table[hash_index].pixel == pixel)
{
/* Hash table lookup hit */
cmap_index = color_hash_table[hash_index].index;
color_hash_hits++;
}
else
{
/* Hash table lookup miss */
const guchar *col;
gint diff, sum, max;
gint i;
max = MAXDIFF;
cmap_index = 0;
col = cmap;
for (i = 0; i < num_cols; i++)
{
diff = r - *col++;
sum = diff * diff;
diff = g - *col++;
sum += diff * diff;
diff = b - *col++;
sum += diff * diff;
if (sum < max)
{
cmap_index = i;
max = sum;
}
}
/* update the hash table */
color_hash_table[hash_index].pixel = pixel;
color_hash_table[hash_index].index = cmap_index;
color_hash_table[hash_index].gimage = (GimpImage *) gimage;
color_hash_misses++;
}
return cmap_index;
}

View file

@ -16,38 +16,20 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BOUNDARY_H__
#define __BOUNDARY_H__
#ifndef __GIMP_IMAGE_COLOR_HASH_H__
#define __GIMP_IMAGE_COLOR_HASH_H__
typedef enum
{
WithinBounds,
IgnoreBounds
} BoundaryType;
void gimp_image_color_hash_init (void);
void gimp_image_color_hash_exit (void);
void gimp_image_color_hash_invalidate (GimpImage *gimage,
gint index);
gint gimp_image_color_hash_rgb_to_indexed (const GimpImage *gimage,
gint r,
gint g,
gint b);
struct _BoundSeg
{
gint x1;
gint y1;
gint x2;
gint y2;
gboolean open;
gboolean visited;
};
BoundSeg * find_mask_boundary (PixelRegion *maskPR,
gint *num_elems,
BoundaryType type,
gint x1,
gint y1,
gint x2,
gint y2);
BoundSeg * sort_boundary (BoundSeg *segs,
gint num_segs,
gint *num_groups);
#endif /* __BOUNDARY_H__ */
#endif /* __GIMP_IMAGE_COLOR_HASH_H__ */

View file

@ -104,6 +104,9 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "app_procs.h"
#include "gdisplay.h"
@ -115,8 +118,6 @@
#include "gimplist.h"
#include "gimplayer.h"
#include "gimppalette.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"

View file

@ -25,14 +25,15 @@
#include "libgimpcolor/gimpcolor.h"
#include "libgimpmath/gimpmath.h"
#include "apptypes.h"
#include "core-types.h"
#include "base/pixel-region.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "paint-funcs/paint-funcs.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
@ -46,8 +47,6 @@
#include "gimplist.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "libgimp/gimpintl.h"

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -22,11 +22,14 @@
#include "core-types.h"
/* FIXME: move the "stroke" stuff into the core entirely */
#include "tools/tools-types.h"
#include "base/boundary.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: move the "stroke" stuff into the core entirely */
#include "tools/tools-types.h"
#include "tools/tool_manager.h"
#include "gimpchannel.h"
@ -35,13 +38,10 @@
#include "gimplayer.h"
#include "gimplayermask.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimprc.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"
#include "pdb/procedural_db.h"

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -26,6 +26,10 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpchannel.h"
@ -50,9 +54,6 @@
#include "gimprc.h"
#include "parasitelist.h"
#include "path_transform.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimpparasite.h"

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -22,6 +22,10 @@
#include "core/core-types.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpdrawable.h"
@ -30,9 +34,6 @@
#include "drawable.h"
#include "gdisplay.h"
#include "image_map.h"
#include "pixel_region.h"
#include "tile.h"
#include "tile_manager.h"
#define WAITING 0

View file

@ -24,6 +24,10 @@
#include "core/core-types.h"
#include "base/boundary.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpimage.h"
@ -31,12 +35,9 @@
#include "core/gimplayer.h"
#include "core/gimplayermask.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "pixel_region.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -29,9 +29,13 @@
#include "core-types.h"
#include "base/boundary.h"
#include "base/pixel-region.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
#include "boundary.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
@ -40,11 +44,7 @@
#include "gimplayer.h"
#include "gimplayermask.h"
#include "parasitelist.h"
#include "pixel_region.h"
#include "undo.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "libgimp/gimpparasite.h"

View file

@ -27,15 +27,13 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "paint-funcs/paint-funcs.h"
#include "boundary.h"
#include "drawable.h"
#include "gimplayermask.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "drawable.h"
#include "undo.h"
#include "libgimp/gimpparasite.h"

View file

@ -26,14 +26,13 @@
#include "core-types.h"
#include "base/pixel-region.h"
#include "gimpcontainer.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimppalette.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View file

@ -32,10 +32,11 @@
#include "core-types.h"
#include "base/temp-buf.h"
#include "gimppalette.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View file

@ -32,10 +32,11 @@
#include "core-types.h"
#include "base/temp-buf.h"
#include "gimppalette.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View file

@ -32,10 +32,11 @@
#include "core-types.h"
#include "base/temp-buf.h"
#include "gimppalette.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View file

@ -42,13 +42,13 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimppattern-header.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"
@ -180,7 +180,7 @@ gimp_pattern_duplicate (GimpData *data)
pattern->mask = temp_buf_copy (GIMP_PATTERN (data)->mask, NULL);
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);
@ -211,7 +211,7 @@ gimp_pattern_new (const gchar *name)
}
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);
@ -334,7 +334,7 @@ gimp_pattern_load (const gchar *filename)
gimp_data_set_filename (GIMP_DATA (pattern), filename);
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);

View file

@ -42,13 +42,13 @@
#include "core-types.h"
#include "base/base-config.h"
#include "base/temp-buf.h"
#include "gimpimage.h"
#include "gimppattern.h"
#include "gimppattern-header.h"
#include "gimprc.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"
@ -180,7 +180,7 @@ gimp_pattern_duplicate (GimpData *data)
pattern->mask = temp_buf_copy (GIMP_PATTERN (data)->mask, NULL);
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);
@ -211,7 +211,7 @@ gimp_pattern_new (const gchar *name)
}
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);
@ -334,7 +334,7 @@ gimp_pattern_load (const gchar *filename)
gimp_data_set_filename (GIMP_DATA (pattern), filename);
/* Swap the pattern to disk (if we're being stingy with memory) */
if (stingy_memory_use)
if (base_config->stingy_memory_use)
temp_buf_swap (pattern->mask);
return GIMP_DATA (pattern);

View file

@ -18,9 +18,11 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib.h>
#include "apptypes.h"
#include "base/base-types.h"
#include "base/temp-buf.h"
#include "gimppreviewcache.h"

View file

@ -20,9 +20,6 @@
#define __GIMPPREVIEWCACHE_H__
#include "temp_buf.h"
#define PREVIEW_CACHE_PRIME_WIDTH 112
#define PREVIEW_CACHE_PRIME_HEIGHT 112

View file

@ -27,17 +27,23 @@
#include "core-types.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "base/tile.h"
#include "paint-funcs/paint-funcs.h"
/* FIXME: remove the Path <-> BezierSelect dependency */
#include "tools/tools-types.h"
#include "app_procs.h"
#include "drawable.h"
#include "floating_sel.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-mask.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
@ -49,10 +55,6 @@
#include "gimpundostack.h"
#include "parasitelist.h"
#include "path.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"
#include "undo.h"
#include "libgimp/gimplimits.h"
@ -74,6 +76,8 @@ static void gimp_image_init (GimpImage *gimage);
static void gimp_image_destroy (GtkObject *object);
static void gimp_image_name_changed (GimpObject *object);
static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol);
static TempBuf *gimp_image_get_preview (GimpViewable *gimage,
gint width,
gint height);
@ -368,10 +372,12 @@ gimp_image_class_init (GimpImageClass *klass)
klass->clean = NULL;
klass->dirty = NULL;
klass->repaint = NULL;
klass->colormap_changed = NULL;
klass->colormap_changed = gimp_image_real_colormap_changed;
klass->undo_event = NULL;
klass->undo = gimp_image_undo;
klass->redo = gimp_image_redo;
gimp_image_color_hash_init ();
}
@ -523,6 +529,14 @@ gimp_image_invalidate_preview (GimpViewable *viewable)
gimage->comp_preview_valid = FALSE;
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint ncol)
{
if (gimp_image_base_type (gimage) == INDEXED)
gimp_image_color_hash_invalidate (gimage, ncol);
}
static void
gimp_image_allocate_projection (GimpImage *gimage)
{
@ -1332,12 +1346,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[RED_PIX],
src[GREEN_PIX],
src[BLUE_PIX]);
break;
}
break;
@ -1356,12 +1368,10 @@ gimp_image_transform_color (const GimpImage *gimage,
break;
case INDEXED_GIMAGE: case INDEXEDA_GIMAGE:
/* Least squares method */
*dest = map_rgb_to_indexed (gimage->cmap,
gimage->num_cols,
gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
*dest = gimp_image_color_hash_rgb_to_indexed (gimage,
src[GRAY_PIX],
src[GRAY_PIX],
src[GRAY_PIX]);
break;
}
break;

View file

@ -25,17 +25,6 @@
#define GIMP_IMAGE_TYPE_HAS_ALPHA(t) ((t)==RGBA_GIMAGE || (t)==GRAYA_GIMAGE || (t)==INDEXEDA_GIMAGE)
#define MAX_CHANNELS 4
#define GRAY_PIX 0
#define ALPHA_G_PIX 1
#define RED_PIX 0
#define GREEN_PIX 1
#define BLUE_PIX 2
#define ALPHA_PIX 3
#define INDEXED_PIX 0
#define ALPHA_I_PIX 1
#define COLORMAP_SIZE 768
typedef enum

View file

@ -28,6 +28,8 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/temp-buf.h"
#include "core/gimpchannel.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
@ -57,7 +59,6 @@
#include "qmask.h"
#include "scale.h"
#include "selection.h"
#include "temp_buf.h"
#include "undo.h"
#ifdef DISPLAY_FILTERS

View file

@ -26,10 +26,11 @@
#include "core/core-types.h"
#include "base/pixel-region.h"
#include "core/gimpchannel.h"
#include "core/gimpimage.h"
#include "pixel_region.h"
#include "scan_convert.h"

View file

@ -21,15 +21,16 @@
#include <gtk/gtk.h>
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/temp-buf.h"
#include "gimpcontext.h"
#include "gimptoolinfo.h"
#include "context_manager.h"
#include "temp_buf.h"
/* GRMPF */
#include "tools/tools-types.h"
#include "tools/gimprectselecttool.h"

View file

@ -22,11 +22,12 @@
#include "core-types.h"
#include "base/temp-buf.h"
#include "gimpimage.h"
#include "gimpundo.h"
#include "gimprc.h"
#include "temp_buf.h"
enum

View file

@ -25,9 +25,10 @@
#include "core-types.h"
#include "base/temp-buf.h"
#include "gimpmarshal.h"
#include "gimpviewable.h"
#include "temp_buf.h"
enum

View file

@ -40,6 +40,8 @@
#include "core/core-types.h"
#include "base/temp-buf.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
@ -57,7 +59,6 @@
#include "file-open.h"
#include "file-utils.h"
#include "plug_in.h"
#include "temp_buf.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -49,7 +49,6 @@
#include "file-save.h"
#include "file-utils.h"
#include "plug_in.h"
#include "temp_buf.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -27,6 +27,8 @@
#include "core/core-types.h"
#include "base/temp-buf.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpdatafactory.h"
@ -41,7 +43,6 @@
#include "context_manager.h"
#include "gimage.h"
#include "temp_buf.h"
#include "libgimp/gimpintl.h"

View file

@ -28,6 +28,9 @@
#include "core/core-types.h"
#include "base/base-config.h"
#include "base/tile-cache.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
@ -42,7 +45,6 @@
#include "gimprc.h"
#include "image_render.h"
#include "resolution_calibrate.h"
#include "tile_cache.h"
#include "libgimp/gimpintl.h"
@ -440,7 +442,7 @@ prefs_ok_callback (GtkWidget *widget,
if (edit_tile_cache_size != old_tile_cache_size)
{
tile_cache_size = edit_tile_cache_size;
base_config->tile_cache_size = edit_tile_cache_size;
tile_cache_set_size (edit_tile_cache_size);
}
break;
@ -513,7 +515,7 @@ prefs_save_callback (GtkWidget *widget,
prefs_dlg = NULL;
/* Save variables so that we can restore them later */
save_stingy_memory_use = stingy_memory_use;
save_stingy_memory_use = base_config->stingy_memory_use;
save_min_colors = min_colors;
save_install_cmap = install_cmap;
save_cycled_marching_ants = cycled_marching_ants;
@ -522,8 +524,8 @@ prefs_save_callback (GtkWidget *widget,
save_nav_window_per_display = nav_window_per_display;
save_info_window_follows_mouse = info_window_follows_mouse;
save_temp_path = temp_path;
save_swap_path = swap_path;
save_temp_path = base_config->temp_path;
save_swap_path = base_config->swap_path;
save_brush_path = brush_path;
save_pattern_path = pattern_path;
save_palette_path = palette_path;
@ -569,7 +571,7 @@ prefs_save_callback (GtkWidget *widget,
update = g_list_append (update, "show-statusbar");
remove = g_list_append (remove, "dont-show-statusbar");
}
if (interpolation_type != old_interpolation_type)
if (base_config->interpolation_type != old_interpolation_type)
{
update = g_list_append (update, "interpolation-type");
}
@ -710,7 +712,7 @@ prefs_save_callback (GtkWidget *widget,
/* values which can't be changed on the fly */
if (edit_stingy_memory_use != old_stingy_memory_use)
{
stingy_memory_use = edit_stingy_memory_use;
base_config->stingy_memory_use = edit_stingy_memory_use;
update = g_list_append (update, "stingy-memory-use");
}
if (edit_min_colors != old_min_colors)
@ -759,12 +761,12 @@ prefs_save_callback (GtkWidget *widget,
if (prefs_strcmp (old_temp_path, edit_temp_path))
{
temp_path = edit_temp_path;
base_config->temp_path = edit_temp_path;
update = g_list_append (update, "temp-path");
}
if (prefs_strcmp (old_swap_path, edit_swap_path))
{
swap_path = edit_swap_path;
base_config->swap_path = edit_swap_path;
update = g_list_append (update, "swap-path");
}
if (prefs_strcmp (old_brush_path, edit_brush_path))
@ -801,7 +803,7 @@ prefs_save_callback (GtkWidget *widget,
/* values which are changed on "OK" or "Save" */
if (edit_tile_cache_size != old_tile_cache_size)
{
tile_cache_size = edit_tile_cache_size;
base_config->tile_cache_size = edit_tile_cache_size;
update = g_list_append (update, "tile-cache-size");
}
@ -813,23 +815,23 @@ prefs_save_callback (GtkWidget *widget,
gdisplay_xserver_resolution (&monitor_xres, &monitor_yres);
/* restore variables which must not change */
stingy_memory_use = save_stingy_memory_use;
min_colors = save_min_colors;
install_cmap = save_install_cmap;
cycled_marching_ants = save_cycled_marching_ants;
last_opened_size = save_last_opened_size;
show_indicators = save_show_indicators;
nav_window_per_display = save_nav_window_per_display;
info_window_follows_mouse = save_info_window_follows_mouse;
base_config->stingy_memory_use = save_stingy_memory_use;
min_colors = save_min_colors;
install_cmap = save_install_cmap;
cycled_marching_ants = save_cycled_marching_ants;
last_opened_size = save_last_opened_size;
show_indicators = save_show_indicators;
nav_window_per_display = save_nav_window_per_display;
info_window_follows_mouse = save_info_window_follows_mouse;
temp_path = save_temp_path;
swap_path = save_swap_path;
brush_path = save_brush_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
base_config->temp_path = save_temp_path;
base_config->swap_path = save_swap_path;
brush_path = save_brush_path;
pattern_path = save_pattern_path;
palette_path = save_palette_path;
gradient_path = save_gradient_path;
plug_in_path = save_plug_in_path;
module_path = save_module_path;
/* no need to restore values which are only changed on "OK" and "Save" */
@ -845,6 +847,7 @@ prefs_cancel_callback (GtkWidget *widget,
prefs_dlg = NULL;
/* restore ordinary gimprc variables */
base_config->interpolation_type = old_interpolation_type;
levels_of_undo = old_levels_of_undo;
marching_speed = old_marching_speed;
allow_resize_windows = old_allow_resize_windows;
@ -854,7 +857,6 @@ prefs_cancel_callback (GtkWidget *widget,
show_tool_tips = old_show_tool_tips;
show_rulers = old_show_rulers;
show_statusbar = old_show_statusbar;
interpolation_type = old_interpolation_type;
confirm_on_close = old_confirm_on_close;
save_session_info = old_save_session_info;
save_device_status = old_save_device_status;
@ -969,11 +971,11 @@ prefs_toggle_callback (GtkWidget *widget,
}
/* radio buttons */
else if (data == &thumbnail_mode ||
data == &interpolation_type ||
data == &trust_dirty_flag ||
data == &help_browser ||
data == &cursor_mode ||
else if (data == &thumbnail_mode ||
data == &base_config->interpolation_type ||
data == &trust_dirty_flag ||
data == &help_browser ||
data == &cursor_mode ||
data == &default_type)
{
*val = (gint) gtk_object_get_user_data (GTK_OBJECT (widget));
@ -1389,7 +1391,7 @@ preferences_dialog_create (void)
/* first time dialog is opened -
* copy config vals to edit variables.
*/
edit_stingy_memory_use = stingy_memory_use;
edit_stingy_memory_use = base_config->stingy_memory_use;
edit_min_colors = min_colors;
edit_install_cmap = install_cmap;
edit_cycled_marching_ants = cycled_marching_ants;
@ -1399,8 +1401,8 @@ preferences_dialog_create (void)
edit_info_window_follows_mouse = info_window_follows_mouse;
edit_disable_tearoff_menus = disable_tearoff_menus;
edit_temp_path = prefs_strdup (temp_path);
edit_swap_path = prefs_strdup (swap_path);
edit_temp_path = prefs_strdup (base_config->temp_path);
edit_swap_path = prefs_strdup (base_config->swap_path);
edit_plug_in_path = prefs_strdup (plug_in_path);
edit_module_path = prefs_strdup (module_path);
edit_brush_path = prefs_strdup (brush_path);
@ -1412,9 +1414,10 @@ preferences_dialog_create (void)
/* assign edit variables for values which get changed on "OK" and "Save"
* but not on the fly.
*/
edit_tile_cache_size = tile_cache_size;
edit_tile_cache_size = base_config->tile_cache_size;
/* remember all old values */
old_interpolation_type = base_config->interpolation_type;
old_perfectmouse = perfectmouse;
old_transparency_type = transparency_type;
old_transparency_size = transparency_size;
@ -1428,7 +1431,6 @@ preferences_dialog_create (void)
old_show_tool_tips = show_tool_tips;
old_show_rulers = show_rulers;
old_show_statusbar = show_statusbar;
old_interpolation_type = interpolation_type;
old_confirm_on_close = confirm_on_close;
old_save_session_info = save_session_info;
old_save_device_status = save_device_status;
@ -2266,7 +2268,8 @@ preferences_dialog_create (void)
optionmenu =
gimp_option_menu_new2 (FALSE, prefs_toggle_callback,
&interpolation_type, (gpointer) interpolation_type,
&base_config->interpolation_type,
(gpointer) base_config->interpolation_type,
_("Nearest Neighbor (Fast)"),
(gpointer) NEAREST_NEIGHBOR_INTERPOLATION, NULL,

View file

@ -35,6 +35,8 @@
#include "core/core-types.h"
#include "base/base-config.h"
#include "appenv.h"
#include "gdisplay_ops.h"
#include "gimprc.h"
@ -381,7 +383,7 @@ user_install_continue_callback (GtkWidget *widget,
#ifdef G_OS_WIN32
FreeConsole ();
#endif
parse_buffers_init ();
gimprc_init ();
parse_unitrc ();
parse_gimprc ();
user_install_tuning ();
@ -896,7 +898,7 @@ user_install_dialog_create (UserInstallCallback callback)
#ifdef G_OS_WIN32
char *
static char *
quote_spaces (char *string)
{
int nspaces = 0;
@ -1106,7 +1108,7 @@ user_install_tuning (void)
gtk_box_pack_start (GTK_BOX (tuning_page), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
tile_cache_adj = gtk_adjustment_new (tile_cache_size,
tile_cache_adj = gtk_adjustment_new (base_config->tile_cache_size,
0, (4069.0 * 1024 * 1024), 1.0, 1.0, 0.0);
memsize = gimp_mem_size_entry_new (GTK_ADJUSTMENT (tile_cache_adj));
gtk_box_pack_end (GTK_BOX (hbox), memsize, FALSE, FALSE, 0);
@ -1132,7 +1134,8 @@ user_install_tuning (void)
gtk_box_pack_start (GTK_BOX (tuning_page), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
swap_path_filesel = gimp_file_selection_new (_("Select Swap Dir"), swap_path,
swap_path_filesel = gimp_file_selection_new (_("Select Swap Dir"),
base_config->swap_path,
TRUE, TRUE);
gtk_box_pack_end (GTK_BOX (hbox), swap_path_filesel, FALSE, FALSE, 0);
gtk_widget_show (swap_path_filesel);
@ -1291,15 +1294,16 @@ user_install_resolution_done (void)
new_monitor_yres =
gimp_size_entry_get_refval (GIMP_SIZE_ENTRY (resolution_entry), 1);
if (tile_cache_size != new_tile_cache_size)
if (base_config->tile_cache_size != new_tile_cache_size)
{
tile_cache_size = new_tile_cache_size;
base_config->tile_cache_size = new_tile_cache_size;
update = g_list_append (update, "tile-cache-size");
}
if (swap_path && new_swap_path &&
strcmp (swap_path, new_swap_path))
if (base_config->swap_path && new_swap_path &&
strcmp (base_config->swap_path, new_swap_path))
{
g_free (swap_path); swap_path = new_swap_path;
g_free (base_config->swap_path);
base_config->swap_path = new_swap_path;
update = g_list_append (update, "swap-path");
}
if (using_xserver_resolution != new_using_xserver_resolution ||

View file

@ -28,6 +28,10 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
@ -53,12 +57,9 @@
#include "drawable.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

View file

@ -28,6 +28,10 @@
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "base/pixel-region.h"
#include "base/temp-buf.h"
#include "base/tile-manager.h"
#include "paint-funcs/paint-funcs.h"
#include "core/gimpcontext.h"
@ -53,12 +57,9 @@
#include "drawable.h"
#include "gimprc.h"
#include "gimpui.h"
#include "pixel_region.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "undo.h"
#include "libgimp/gimpintl.h"

Some files were not shown because too many files have changed in this diff Show more