Commit c5ec0d4f authored by Michael Natterer's avatar Michael Natterer
Browse files

*** empty log message ***

parent f1706f09
2004-07-13 Michael Natterer <mitch@gimp.org>
Added a GimpProjection object which maintains the idle projection
logic that was in GimpDisplay and takes care of constructing the
projection even without any display open. Makes color picking and
other reads from the projection work without display and fixes the
major bug that we were constructing the projection n times (!)
for n displays.
* app/core/Makefile.am
* app/core/gimpimage-projection.[ch]: removed.
* app/core/core-types.h
* app/core/gimpmarshal.list
* app/core/gimparea.[ch]
* app/core/gimpprojection.[ch]
* app/core/gimpprojection-construct.[ch]: new files assembled from
the pieces of gimpdisplay.c and gimpimage-projection.c.
* app/core/gimpimage.[ch]: create a GimpProjection.
Removed explicit projection realloc calls because the projection
connects to the relevant GimpImage signals now.
Added gimp_image_coords_in_active_drawable().
* app/display/Makefile.am
* app/display/gimpdisplay-area.[ch]: removed.
* app/display/gimpdisplay.[ch]: stripped away the idle render stuff
and just keep a list of update_areas which is painted on flush().
Removed gimp_display_coords_in_active_drawable().
* app/display/gimpdisplay-foreach.[ch]: removed
gimp_display_finish_draw().
* app/core/gimpchannel.c
* app/core/gimpimage-contiguous-region.c
* app/core/gimpimage-convert.c
* app/core/gimpimage-crop.c
* app/core/gimpimage-merge.c
* app/core/gimpimage-pick-color.c
* app/core/gimpimage-scale.c
* app/core/gimppalette-import.c
* app/display/gimpdisplay-handlers.c
* app/display/gimpdisplayshell-render.c
* app/display/gimpdisplayshell.c
* app/gui/info-window.c
* app/tools/gimpbucketfilltool.c
* app/tools/gimpbycolorselecttool.c
* app/tools/gimpclonetool.c
* app/tools/gimpcolortool.c
* app/tools/gimpeditselectiontool.c
* app/tools/gimpfliptool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimpiscissorstool.c
* app/tools/gimppainttool.c
* app/tools/gimpselectiontool.c
* app/tools/gimptransformtool.c
* app/widgets/gimpselectioneditor.c: changed accordingly.
2004-07-13 Sven Neumann <sven@gimp.org>
* libgimpwidgets/gimppixmap.[ch]: declared GimpPixmap as deprecated.
......@@ -27,7 +86,7 @@
* plug-ins/pagecurl/pagecurl.c: undef GIMP_DISABLE_DEPRECATED until
GimpPixmap has been replaced here as well.
2004-07-13 Shlomi Fish <shlomif@iglu.org.il>
* plug-ins/gimpressionist/presets.c: fixed bug #147483 (gimpressionist
......
......@@ -42,6 +42,8 @@ libappcore_a_sources = \
gimp-units.h \
gimp-utils.c \
gimp-utils.h \
gimparea.c \
gimparea.h \
gimpbrush.c \
gimpbrush.h \
gimpbrush-header.h \
......@@ -131,8 +133,6 @@ libappcore_a_sources = \
gimpimage-pick-color.h \
gimpimage-preview.c \
gimpimage-preview.h \
gimpimage-projection.c \
gimpimage-projection.h \
gimpimage-qmask.c \
gimpimage-qmask.h \
gimpimage-resize.c \
......@@ -182,6 +182,10 @@ libappcore_a_sources = \
gimpparasitelist.h \
gimppreviewcache.c \
gimppreviewcache.h \
gimpprojection.c \
gimpprojection.h \
gimpprojection-construct.c \
gimpprojection-construct.h \
gimpscanconvert.c \
gimpscanconvert.h \
gimpselection.c \
......
......@@ -117,10 +117,12 @@ typedef struct _GimpImageMap GimpImageMap;
typedef struct _GimpDocumentList GimpDocumentList;
typedef struct _GimpEnvironTable GimpEnvironTable;
typedef struct _GimpParasiteList GimpParasiteList;
typedef struct _GimpProjection GimpProjection;
/* non-object types */
typedef struct _GimpArea GimpArea;
typedef struct _GimpCoords GimpCoords;
typedef struct _GimpGradientSegment GimpGradientSegment;
typedef struct _GimpGuide GimpGuide;
......
......@@ -18,11 +18,11 @@
#include "config.h"
#include <gtk/gtk.h>
#include <glib-object.h>
#include "display-types.h"
#include "core-types.h"
#include "gimpdisplay-area.h"
#include "gimparea.h"
#define OVERHEAD 25 /* in units of pixel area */
......@@ -51,8 +51,8 @@ gimp_area_new (gint x1,
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
*/
GSList *
gimp_display_area_list_process (GSList *list,
GimpArea *area)
gimp_area_list_process (GSList *list,
GimpArea *area)
{
GSList *new_list;
GSList *l;
......@@ -93,7 +93,7 @@ gimp_display_area_list_process (GSList *list,
}
GSList *
gimp_display_area_list_free (GSList *list)
gimp_area_list_free (GSList *list)
{
if (list)
{
......
......@@ -16,26 +16,24 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_DISPLAY_AREA_H__
#define __GIMP_DISPLAY_AREA_H__
#ifndef __GIMP_AREA_H__
#define __GIMP_AREA_H__
typedef struct _GimpArea GimpArea;
struct _GimpArea
{
gint x1, y1, x2, y2; /* area bounds */
};
GimpArea * gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2);
GimpArea * gimp_area_new (gint x1,
gint y1,
gint x2,
gint y2);
GSList * gimp_display_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_display_area_list_free (GSList *list);
GSList * gimp_area_list_process (GSList *list,
GimpArea *area);
GSList * gimp_area_list_free (GSList *list);
#endif /* __GIMP_DISPLAY_AREA_H__ */
#endif /* __GIMP_AREA_H__ */
......@@ -43,7 +43,6 @@
#include "gimp-utils.h"
#include "gimpcontainer.h"
#include "gimpimage.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimpchannel.h"
......@@ -51,6 +50,7 @@
#include "gimpdrawable-stroke.h"
#include "gimpmarshal.h"
#include "gimppaintinfo.h"
#include "gimpprojection.h"
#include "gimpstrokeoptions.h"
#include "gimp-intl.h"
......@@ -1497,7 +1497,7 @@ gimp_channel_new_from_component (GimpImage *gimage,
g_return_val_if_fail (pixel != -1, NULL);
projection = gimp_image_projection (gimage);
projection = gimp_projection_get_tiles (gimage->projection);
width = tile_manager_width (projection);
height = tile_manager_height (projection);
......
......@@ -33,7 +33,7 @@
#include "gimpchannel.h"
#include "gimpimage.h"
#include "gimpimage-contiguous-region.h"
#include "gimpimage-projection.h"
#include "gimpprojection.h"
/* local function prototypes */
......@@ -104,13 +104,14 @@ gimp_image_contiguous_region_by_seed (GimpImage *gimage,
if (sample_merged)
{
pixel_region_init (&srcPR, gimp_image_projection (gimage), 0, 0,
gimage->width, gimage->height, FALSE);
GimpProjection *projection = gimage->projection;
src_type = gimp_image_projection_type (gimage);
has_alpha =
GIMP_IMAGE_TYPE_HAS_ALPHA (gimp_image_projection_type (gimage));
bytes = gimp_image_projection_bytes (gimage);
pixel_region_init (&srcPR, gimp_projection_get_tiles (projection),
0, 0, gimage->width, gimage->height, FALSE);
src_type = gimp_projection_get_image_type (projection);
has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (src_type);
bytes = gimp_projection_get_bytes (projection);
}
else
{
......@@ -216,17 +217,16 @@ gimp_image_contiguous_region_by_color (GimpImage *gimage,
/* Get the image information */
if (sample_merged)
{
bytes = gimp_image_projection_bytes (gimage);
d_type = gimp_image_projection_type (gimage);
bytes = gimp_projection_get_bytes (gimage->projection);
d_type = gimp_projection_get_image_type (gimage->projection);
has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (d_type);
indexed = GIMP_IMAGE_TYPE_IS_INDEXED (d_type);
width = gimage->width;
height = gimage->height;
pixel_region_init (&imagePR, gimp_image_projection (gimage),
0, 0,
width, height,
FALSE);
pixel_region_init (&imagePR,
gimp_projection_get_tiles (gimage->projection),
0, 0, width, height, FALSE);
}
else
{
......@@ -238,9 +238,7 @@ gimp_image_contiguous_region_by_color (GimpImage *gimage,
height = gimp_item_height (GIMP_ITEM (drawable));
pixel_region_init (&imagePR, gimp_drawable_data (drawable),
0, 0,
width, height,
FALSE);
0, 0, width, height, FALSE);
}
if (has_alpha)
......
......@@ -139,7 +139,6 @@
#include "gimpdrawable.h"
#include "gimpimage.h"
#include "gimpimage-colormap.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplist.h"
......
......@@ -31,11 +31,11 @@
#include "gimpimage.h"
#include "gimpimage-crop.h"
#include "gimpimage-guides.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
#include "gimplayer.h"
#include "gimplist.h"
#include "gimpprojection.h"
#include "gimp-intl.h"
......@@ -293,9 +293,9 @@ gimp_image_crop_auto_shrink (GimpImage *gimage,
else
{
has_alpha = TRUE;
bytes = gimp_image_projection_bytes (gimage);
get_color_obj = G_OBJECT (gimage);
get_color_func = (GetColorFunc) gimp_image_projection_get_color_at;
bytes = gimp_projection_get_bytes (gimage->projection);
get_color_obj = G_OBJECT (gimage->projection);
get_color_func = (GetColorFunc) gimp_projection_get_color_at;
}
switch (gimp_image_crop_guess_bgcolor (get_color_obj, get_color_func,
......@@ -320,7 +320,7 @@ gimp_image_crop_auto_shrink (GimpImage *gimage,
pixel_region_init (&PR, gimp_drawable_data (active_drawable),
x1, y1, width, height, FALSE);
else
pixel_region_init (&PR, gimp_image_projection (gimage),
pixel_region_init (&PR, gimp_projection_get_tiles (gimage->projection),
x1, y1, width, height, FALSE);
/* The following could be optimized further by processing
......
......@@ -39,7 +39,6 @@
#include "gimpimage.h"
#include "gimpimage-colorhash.h"
#include "gimpimage-merge.h"
#include "gimpimage-projection.h"
#include "gimpimage-undo.h"
#include "gimplayer.h"
#include "gimplayer-floating-sel.h"
......
......@@ -27,7 +27,7 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "core/gimpimage-pick-color.h"
#include "core/gimpimage-projection.h"
#include "core/gimpprojection.h"
gboolean
......@@ -55,11 +55,11 @@ gimp_image_pick_color (GimpImage *gimage,
if (sample_merged)
{
my_sample_type = gimp_image_projection_type (gimage);
my_sample_type = gimp_projection_get_image_type (gimage->projection);
is_indexed = FALSE;
color_func = (GimpImagePickColorFunc) gimp_image_projection_get_color_at;
color_obj = GIMP_OBJECT (gimage);
color_func = (GimpImagePickColorFunc) gimp_projection_get_color_at;
color_obj = GIMP_OBJECT (gimage->projection);
}
else
{
......
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattisbvf
*
* 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 __GIMP_IMAGE_PROJECTION_H__
#define __GIMP_IMAGE_PROJECTION_H__
void gimp_image_projection_allocate (GimpImage *gimage);
void gimp_image_projection_free (GimpImage *gimage);
TileManager * gimp_image_projection (GimpImage *gimage);
GimpImageType gimp_image_projection_type (const GimpImage *gimage);
gint gimp_image_projection_bytes (const GimpImage *gimage);
gdouble gimp_image_projection_opacity (const GimpImage *gimage);
guchar * gimp_image_projection_get_color_at (GimpImage *gimage,
gint x,
gint y);
void gimp_image_invalidate (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gint x1,
gint y1,
gint x2,
gint y2);
void gimp_image_invalidate_without_render (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gint x1,
gint y1,
gint x2,
gint y2);
#endif /* __GIMP_IMAGE_PROJECTION_H__ */
......@@ -228,7 +228,7 @@ gimp_image_scale_check (const GimpImage *gimage,
gimp_object_get_memsize (GIMP_OBJECT (gimage->layers), NULL) +
gimp_object_get_memsize (GIMP_OBJECT (gimage->channels), NULL) +
gimp_object_get_memsize (GIMP_OBJECT (gimage->selection_mask), NULL) +
tile_manager_get_memsize (gimage->projection);
gimp_object_get_memsize (GIMP_OBJECT (gimage->projection), NULL);
undo_size = gimp_object_get_memsize (GIMP_OBJECT (gimage->undo_stack), NULL);
redo_size = gimp_object_get_memsize (GIMP_OBJECT (gimage->redo_stack), NULL);
......
......@@ -45,7 +45,6 @@
#include "gimpimage-colormap.h"
#include "gimpimage-guides.h"
#include "gimpimage-preview.h"
#include "gimpimage-projection.h"
#include "gimpimage-qmask.h"
#include "gimpimage-undo.h"
#include "gimpimage-undo-push.h"
......@@ -55,6 +54,7 @@
#include "gimplist.h"
#include "gimpmarshal.h"
#include "gimpparasitelist.h"
#include "gimpprojection.h"
#include "gimpselection.h"
#include "gimptemplate.h"
#include "gimpundostack.h"
......@@ -116,7 +116,6 @@ static void gimp_image_invalidate_preview (GimpViewable *viewable);
static void gimp_image_size_changed (GimpViewable *viewable);
static gchar * gimp_image_get_description (GimpViewable *viewable,
gchar **tooltip);
static void gimp_image_real_mode_changed (GimpImage *gimage);
static void gimp_image_real_colormap_changed (GimpImage *gimage,
gint color_index);
static void gimp_image_real_flush (GimpImage *gimage);
......@@ -435,7 +434,7 @@ gimp_image_class_init (GimpImageClass *klass)
viewable_class->get_new_preview = gimp_image_get_new_preview;
viewable_class->get_description = gimp_image_get_description;
klass->mode_changed = gimp_image_real_mode_changed;
klass->mode_changed = NULL;
klass->alpha_changed = NULL;
klass->floating_selection_changed = NULL;
klass->active_layer_changed = NULL;
......@@ -486,9 +485,7 @@ gimp_image_init (GimpImage *gimage)
gimage->shadow = NULL;
gimage->construct_flag = FALSE;
gimage->proj_type = GIMP_RGBA_IMAGE;
gimage->projection = NULL;
gimage->projection = gimp_projection_new (gimage);
gimage->guides = NULL;
......@@ -631,7 +628,10 @@ gimp_image_finalize (GObject *object)
}
if (gimage->projection)
gimp_image_projection_free (gimage);
{
g_object_unref (gimage->projection);
gimage->projection = NULL;
}
if (gimage->shadow)
gimp_image_free_shadow (gimage);
......@@ -739,7 +739,8 @@ gimp_image_get_memsize (GimpObject *object,
memsize += tile_manager_get_memsize (gimage->shadow);
if (gimage->projection)
memsize += tile_manager_get_memsize (gimage->projection);
memsize += gimp_object_get_memsize (GIMP_OBJECT (gimage->projection),
gui_size);
memsize += gimp_g_list_get_memsize (gimage->guides, sizeof (GimpGuide));
......@@ -819,8 +820,6 @@ gimp_image_size_changed (GimpViewable *viewable)
}
gimp_viewable_size_changed (GIMP_VIEWABLE (gimp_image_get_mask (gimage)));
gimp_image_projection_allocate (gimage);
}
static gchar *
......@@ -846,13 +845,6 @@ gimp_image_get_description (GimpViewable *viewable,
return retval;
}
static void
gimp_image_real_mode_changed (GimpImage *gimage)
{
gimp_image_projection_allocate (gimage);
gimp_image_update (gimage, 0, 0, gimage->width, gimage->height);
}
static void
gimp_image_real_colormap_changed (GimpImage *gimage,
gint color_index)
......@@ -3368,6 +3360,38 @@ gimp_image_pick_correlate_layer (const GimpImage *gimage,
return NULL;
}
gboolean
gimp_image_coords_in_active_drawable (GimpImage *gimage,
const GimpCoords *coords)
{
GimpDrawable *drawable;
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
drawable = gimp_image_active_drawable (gimage);
if (drawable)
{
GimpItem *item = GIMP_ITEM (drawable);
gint x, y;
gimp_item_offsets (item, &x, &y);
x = ROUND (coords->x) - x;
y = ROUND (coords->y) - y;
if (x < 0 || x > gimp_item_width (item))
return FALSE;
if (y < 0 || y > gimp_item_height (item))
return FALSE;
return TRUE;
}
return FALSE;
}
void
gimp_image_invalidate_layer_previews (GimpImage *gimage)
{
......
......@@ -124,12 +124,7 @@ struct _GimpImage
TileManager *shadow; /* shadow buffer tiles */
/* Projection attributes */
gboolean construct_flag; /* flag for construction */
GimpImageType proj_type; /* type of the projection image */
gint proj_bytes; /* bpp in projection image */
TileManager *projection; /* The projection--layers & */
/* channels */
GimpProjection *projection; /* projection layers & channels */
GList *guides; /* guides */
GimpGrid *grid; /* grid */
......@@ -493,6 +488,8 @@ gboolean gimp_image_layer_boundary (const GimpImage *gimage,
GimpLayer * gimp_image_pick_correlate_layer (const GimpImage *gimage,
gint x,
gint y);
gboolean gimp_image_coords_in_active_drawable (GimpImage *gimage,
const GimpCoords *coords);
void gimp_image_invalidate_layer_previews (GimpImage *gimage);
void gimp_image_invalidate_channel_previews (GimpImage *gimage);
......
......@@ -27,6 +27,7 @@ BOOLEAN: ENUM, INT
BOOLEAN: OBJECT, POINTER
BOOLEAN: OBJECT, POINTER, STRING
VOID: BOOLEAN, INT, INT, INT, INT
VOID: BOXED
VOID: DOUBLE
VOID: DOUBLE, DOUBLE
......
......@@ -44,8 +44,8 @@
#include "gimpcontainer.h"
#include "gimpgradient.h"
#include "gimpimage.h"
#include "gimpimage-projection.h"
#include "gimppalette.h"
#include "gimpprojection.h"
#include "gimp-intl.h"
......@@ -290,15 +290,15 @@ gimp_palette_import_from_image (GimpImage *gimage,
g_return_val_if_fail (threshold > 0, NULL);
/* Get the image information */
d_type = gimp_image_projection_type (gimage);
bytes = gimp_image_projection_bytes (gimage);
d_type = gimp_projection_get_image_type (gimage->projection);
bytes = gimp_projection_get_bytes (gimage->projection);
has_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (d_type);
indexed = GIMP_IMAGE_TYPE_IS_INDEXED (d_type);
width = gimage->width;
height = gimage->height;
pixel_region_init (&imagePR, gimp_image_projection (gimage), 0, 0,
width, height, FALSE);
pixel_region_init (&imagePR, gimp_projection_get_tiles (gimage->projection),
0, 0, width, height, FALSE);
alpha = bytes - 1;
......
This diff is collapsed.
......@@ -16,40 +16,15 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMP_IMAGE_PROJECTION_H__
#define __GIMP_IMAGE_PROJECTION_H__
#ifndef __GIMP_PROJECTION_CONSTRUCT_H__
#define __GIMP_PROJECTION_CONSTRUCT_H__
void gimp_image_projection_allocate (GimpImage *gimage);
void gimp_image_projection_free (GimpImage *gimage);