mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-21 03:52:33 +00:00
Code review & cleanup:
2004-07-14 Michael Natterer <mitch@gimp.org> Code review & cleanup: * app/config/gimpguiconfig.[ch]: removed transparency-size, transparency-type and snap-distance properties... * app/config/gimpdisplayconfig.[ch]: ...and added them here. * app/display/gimpdisplayshell.c * app/tools/gimpmovetool.c: changed accordingly. * app/core/gimpimage-scale.[ch] (gimp_layer_scale_check): added a "max_memsize" parameter instead of looking it up in GimpGuiConfig. * app/actions/image-commands.c: changed accordingly. * app/core/gimparea.c * app/core/gimpdrawable.c: converted tabs to spaces, cleanup. * app/core/gimpprojection.[ch]: renamed IdleRenderStruct to GimpProjectionIdleRender, reordered functions, cleanup. * app/display/gimpdisplay-handlers.c * app/display/gimpdisplay.c: removed unused #includes. * app/display/gimpdisplayshell.[ch] * app/display/gimpdisplayshell-close.c: renamed shell->warning_dialog to shell->close_dialog, some random cleanups. * app/display/gimpdisplayshell-handlers.c * app/widgets/gimpselectioneditor.c: minor coding style cleanup.
This commit is contained in:
parent
53249872f6
commit
fe9d9be66b
34
ChangeLog
34
ChangeLog
|
@ -1,3 +1,37 @@
|
|||
2004-07-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
Code review & cleanup:
|
||||
|
||||
* app/config/gimpguiconfig.[ch]: removed transparency-size,
|
||||
transparency-type and snap-distance properties...
|
||||
|
||||
* app/config/gimpdisplayconfig.[ch]: ...and added them here.
|
||||
|
||||
* app/display/gimpdisplayshell.c
|
||||
* app/tools/gimpmovetool.c: changed accordingly.
|
||||
|
||||
* app/core/gimpimage-scale.[ch] (gimp_layer_scale_check): added a
|
||||
"max_memsize" parameter instead of looking it up in GimpGuiConfig.
|
||||
|
||||
* app/actions/image-commands.c: changed accordingly.
|
||||
|
||||
* app/core/gimparea.c
|
||||
* app/core/gimpdrawable.c: converted tabs to spaces, cleanup.
|
||||
|
||||
* app/core/gimpprojection.[ch]: renamed IdleRenderStruct to
|
||||
GimpProjectionIdleRender, reordered functions, cleanup.
|
||||
|
||||
* app/display/gimpdisplay-handlers.c
|
||||
* app/display/gimpdisplay.c: removed unused #includes.
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]
|
||||
* app/display/gimpdisplayshell-close.c: renamed
|
||||
shell->warning_dialog to shell->close_dialog, some random
|
||||
cleanups.
|
||||
|
||||
* app/display/gimpdisplayshell-handlers.c
|
||||
* app/widgets/gimpselectioneditor.c: minor coding style cleanup.
|
||||
|
||||
2004-07-13 Bill Skaggs <weskaggs@primate.ucdavis.edu>
|
||||
|
||||
* app/core/gimpitem.c: added documentation comments to some
|
||||
|
|
|
@ -478,13 +478,18 @@ image_scale_callback (GtkWidget *widget,
|
|||
{
|
||||
ImageResizeOptions *options = data;
|
||||
GimpImageScaleCheckType scale_check;
|
||||
gint64 max_memsize;
|
||||
gint64 new_memsize;
|
||||
|
||||
gtk_widget_set_sensitive (options->dialog->shell, FALSE);
|
||||
|
||||
max_memsize =
|
||||
GIMP_GUI_CONFIG (options->gimage->gimp->config)->max_new_image_size;
|
||||
|
||||
scale_check = gimp_image_scale_check (options->gimage,
|
||||
options->dialog->width,
|
||||
options->dialog->height,
|
||||
max_memsize,
|
||||
&new_memsize);
|
||||
switch (scale_check)
|
||||
{
|
||||
|
@ -495,8 +500,7 @@ image_scale_callback (GtkWidget *widget,
|
|||
gchar *warning_message;
|
||||
|
||||
size_str = gimp_memsize_to_string (new_memsize);
|
||||
max_size_str = gimp_memsize_to_string
|
||||
(GIMP_GUI_CONFIG (options->gimage->gimp->config)->max_new_image_size);
|
||||
max_size_str = gimp_memsize_to_string (max_memsize);
|
||||
|
||||
warning_message = g_strdup_printf
|
||||
(_("You are trying to create an image with a size of %s.\n\n"
|
||||
|
|
|
@ -70,6 +70,9 @@ static void gimp_display_config_fullscreen_notify (GObject *object,
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_TRANSPARENCY_SIZE,
|
||||
PROP_TRANSPARENCY_TYPE,
|
||||
PROP_SNAP_DISTANCE,
|
||||
PROP_MARCHING_ANTS_SPEED,
|
||||
PROP_RESIZE_WINDOWS_ON_ZOOM,
|
||||
PROP_RESIZE_WINDOWS_ON_RESIZE,
|
||||
|
@ -141,6 +144,18 @@ gimp_display_config_class_init (GimpDisplayConfigClass *klass)
|
|||
gimp_rgba_set (&white, 1.0, 1.0, 1.0, 1.0);
|
||||
gimp_rgba_set (&black, 0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_SIZE,
|
||||
"transparency-size", TRANSPARENCY_SIZE_BLURB,
|
||||
GIMP_TYPE_CHECK_SIZE, GIMP_MEDIUM_CHECKS,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_TYPE,
|
||||
"transparency-type", TRANSPARENCY_TYPE_BLURB,
|
||||
GIMP_TYPE_CHECK_TYPE, GIMP_GRAY_CHECKS,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_SNAP_DISTANCE,
|
||||
"snap-distance", DEFAULT_SNAP_DISTANCE_BLURB,
|
||||
1, 255, 8,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_MARCHING_ANTS_SPEED,
|
||||
"marching-ants-speed",
|
||||
MARCHING_ANTS_SPEED_BLURB,
|
||||
|
@ -287,6 +302,15 @@ gimp_display_config_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_TRANSPARENCY_SIZE:
|
||||
display_config->transparency_size = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_TRANSPARENCY_TYPE:
|
||||
display_config->transparency_type = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_SNAP_DISTANCE:
|
||||
display_config->snap_distance = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_MARCHING_ANTS_SPEED:
|
||||
display_config->marching_ants_speed = g_value_get_int (value);
|
||||
break;
|
||||
|
@ -371,6 +395,15 @@ gimp_display_config_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_TRANSPARENCY_SIZE:
|
||||
g_value_set_enum (value, display_config->transparency_size);
|
||||
break;
|
||||
case PROP_TRANSPARENCY_TYPE:
|
||||
g_value_set_enum (value, display_config->transparency_type);
|
||||
break;
|
||||
case PROP_SNAP_DISTANCE:
|
||||
g_value_set_int (value, display_config->snap_distance);
|
||||
break;
|
||||
case PROP_MARCHING_ANTS_SPEED:
|
||||
g_value_set_int (value, display_config->marching_ants_speed);
|
||||
break;
|
||||
|
|
|
@ -40,6 +40,9 @@ struct _GimpDisplayConfig
|
|||
{
|
||||
GimpCoreConfig parent_instance;
|
||||
|
||||
GimpCheckSize transparency_size;
|
||||
GimpCheckType transparency_type;
|
||||
gint snap_distance;
|
||||
gint marching_ants_speed;
|
||||
gboolean resize_windows_on_zoom;
|
||||
gboolean resize_windows_on_resize;
|
||||
|
|
|
@ -62,9 +62,6 @@ static void gimp_gui_config_get_property (GObject *object,
|
|||
enum
|
||||
{
|
||||
PROP_0,
|
||||
PROP_TRANSPARENCY_SIZE,
|
||||
PROP_TRANSPARENCY_TYPE,
|
||||
PROP_SNAP_DISTANCE,
|
||||
PROP_DEFAULT_THRESHOLD,
|
||||
PROP_INFO_WINDOW_PER_DISPLAY,
|
||||
PROP_TRUST_DIRTY_FLAG,
|
||||
|
@ -137,18 +134,6 @@ gimp_gui_config_class_init (GimpGuiConfigClass *klass)
|
|||
object_class->set_property = gimp_gui_config_set_property;
|
||||
object_class->get_property = gimp_gui_config_get_property;
|
||||
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_SIZE,
|
||||
"transparency-size", TRANSPARENCY_SIZE_BLURB,
|
||||
GIMP_TYPE_CHECK_SIZE, GIMP_MEDIUM_CHECKS,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_TRANSPARENCY_TYPE,
|
||||
"transparency-type", TRANSPARENCY_TYPE_BLURB,
|
||||
GIMP_TYPE_CHECK_TYPE, GIMP_GRAY_CHECKS,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_SNAP_DISTANCE,
|
||||
"snap-distance", DEFAULT_SNAP_DISTANCE_BLURB,
|
||||
1, 255, 8,
|
||||
0);
|
||||
GIMP_CONFIG_INSTALL_PROP_INT (object_class, PROP_DEFAULT_THRESHOLD,
|
||||
"default-threshold", DEFAULT_THRESHOLD_BLURB,
|
||||
0, 255, 15,
|
||||
|
@ -294,15 +279,6 @@ gimp_gui_config_set_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_TRANSPARENCY_SIZE:
|
||||
gui_config->transparency_size = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_TRANSPARENCY_TYPE:
|
||||
gui_config->transparency_type = g_value_get_enum (value);
|
||||
break;
|
||||
case PROP_SNAP_DISTANCE:
|
||||
gui_config->snap_distance = g_value_get_int (value);
|
||||
break;
|
||||
case PROP_DEFAULT_THRESHOLD:
|
||||
gui_config->default_threshold = g_value_get_int (value);
|
||||
break;
|
||||
|
@ -402,15 +378,6 @@ gimp_gui_config_get_property (GObject *object,
|
|||
|
||||
switch (property_id)
|
||||
{
|
||||
case PROP_TRANSPARENCY_SIZE:
|
||||
g_value_set_enum (value, gui_config->transparency_size);
|
||||
break;
|
||||
case PROP_TRANSPARENCY_TYPE:
|
||||
g_value_set_enum (value, gui_config->transparency_type);
|
||||
break;
|
||||
case PROP_SNAP_DISTANCE:
|
||||
g_value_set_int (value, gui_config->snap_distance);
|
||||
break;
|
||||
case PROP_DEFAULT_THRESHOLD:
|
||||
g_value_set_int (value, gui_config->default_threshold);
|
||||
break;
|
||||
|
|
|
@ -40,9 +40,6 @@ struct _GimpGuiConfig
|
|||
{
|
||||
GimpDisplayConfig parent_instance;
|
||||
|
||||
GimpCheckSize transparency_size;
|
||||
GimpCheckType transparency_type;
|
||||
gint snap_distance;
|
||||
gint default_threshold;
|
||||
gboolean info_window_per_display;
|
||||
gboolean trust_dirty_flag;
|
||||
|
|
|
@ -57,19 +57,18 @@ gimp_area_list_process (GSList *list,
|
|||
GSList *new_list;
|
||||
GSList *l;
|
||||
gint area1, area2, area3;
|
||||
GimpArea *ga2;
|
||||
|
||||
/* start new list off */
|
||||
new_list = g_slist_prepend (NULL, area);
|
||||
|
||||
for (l = list; l; l = g_slist_next (l))
|
||||
{
|
||||
ga2 = (GimpArea *) l->data;
|
||||
GimpArea *ga2 = l->data;
|
||||
|
||||
area1 = (area->x2 - area->x1) * (area->y2 - area->y1) + OVERHEAD;
|
||||
area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD;
|
||||
area3 = (MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
|
||||
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD;
|
||||
area3 = ((MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
|
||||
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD);
|
||||
|
||||
if ((area1 + area2) < area3)
|
||||
{
|
||||
|
|
|
@ -197,15 +197,10 @@ gimp_drawable_get_type (void)
|
|||
static void
|
||||
gimp_drawable_class_init (GimpDrawableClass *klass)
|
||||
{
|
||||
GObjectClass *object_class;
|
||||
GimpObjectClass *gimp_object_class;
|
||||
GimpViewableClass *viewable_class;
|
||||
GimpItemClass *item_class;
|
||||
|
||||
object_class = G_OBJECT_CLASS (klass);
|
||||
gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
item_class = GIMP_ITEM_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
|
||||
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
|
||||
GimpItemClass *item_class = GIMP_ITEM_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
|
@ -297,11 +292,9 @@ static gint64
|
|||
gimp_drawable_get_memsize (GimpObject *object,
|
||||
gint64 *gui_size)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (object);
|
||||
gint64 memsize = 0;
|
||||
|
||||
drawable = GIMP_DRAWABLE (object);
|
||||
|
||||
if (drawable->tiles)
|
||||
memsize += tile_manager_get_memsize (drawable->tiles);
|
||||
|
||||
|
@ -315,13 +308,11 @@ gimp_drawable_get_memsize (GimpObject *object,
|
|||
static void
|
||||
gimp_drawable_invalidate_preview (GimpViewable *viewable)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpDrawable *drawable = GIMP_DRAWABLE (viewable);
|
||||
|
||||
if (GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview)
|
||||
GIMP_VIEWABLE_CLASS (parent_class)->invalidate_preview (viewable);
|
||||
|
||||
drawable = GIMP_DRAWABLE (viewable);
|
||||
|
||||
drawable->preview_valid = FALSE;
|
||||
|
||||
if (drawable->preview_cache)
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
#include "gimplayer.h"
|
||||
#include "gimplist.h"
|
||||
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
|
@ -190,6 +188,7 @@ gimp_image_scale (GimpImage *gimage,
|
|||
* @gimage: A #GimpImage.
|
||||
* @new_width: The new width.
|
||||
* @new_height: The new height.
|
||||
* @max_memsize: The maximum new memory size.
|
||||
* @new_memsize: The new memory size.
|
||||
*
|
||||
* Inventory the layer list in gimage and check that it may be
|
||||
|
@ -197,8 +196,7 @@ gimp_image_scale (GimpImage *gimage,
|
|||
*
|
||||
* Return value: #GIMP_IMAGE_SCALE_OK if scaling the image will shrink none
|
||||
* of its layers completely away, and the new image size
|
||||
* is smaller than the maximum specified in the
|
||||
* preferences.
|
||||
* is smaller than @max_memsize.
|
||||
* #GIMP_IMAGE_SCALE_TOO_SMALL if scaling would remove some
|
||||
* existing layers.
|
||||
* #GIMP_IMAGE_SCALE_TOO_BIG if the new image size would
|
||||
|
@ -208,6 +206,7 @@ GimpImageScaleCheckType
|
|||
gimp_image_scale_check (const GimpImage *gimage,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint64 max_memsize,
|
||||
gint64 *new_memsize)
|
||||
{
|
||||
GList *list;
|
||||
|
@ -244,8 +243,7 @@ gimp_image_scale_check (const GimpImage *gimage,
|
|||
|
||||
*new_memsize = new_size;
|
||||
|
||||
if (new_size > current_size &&
|
||||
new_size > GIMP_GUI_CONFIG (gimage->gimp->config)->max_new_image_size)
|
||||
if (new_size > current_size && new_size > max_memsize)
|
||||
return GIMP_IMAGE_SCALE_TOO_BIG;
|
||||
|
||||
for (list = GIMP_LIST (gimage->layers)->list;
|
||||
|
|
|
@ -31,6 +31,7 @@ GimpImageScaleCheckType
|
|||
gimp_image_scale_check (const GimpImage *gimage,
|
||||
gint new_width,
|
||||
gint new_height,
|
||||
gint64 max_memsize,
|
||||
gint64 *new_memsize);
|
||||
|
||||
|
||||
|
|
|
@ -57,10 +57,15 @@ static guchar * gimp_projection_get_color_at (GimpPickable *pickabl
|
|||
gint y);
|
||||
|
||||
static void gimp_projection_alloc_tiles (GimpProjection *proj);
|
||||
static void gimp_projection_add_update_area (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h);
|
||||
static void gimp_projection_flush_whenever (GimpProjection *proj,
|
||||
gboolean now);
|
||||
static void gimp_projection_idlerender_init (GimpProjection *proj);
|
||||
static gboolean gimp_projection_idlerender_callback (gpointer data);
|
||||
static void gimp_projection_idle_render_init (GimpProjection *proj);
|
||||
static gboolean gimp_projection_idle_render_callback (gpointer data);
|
||||
static gboolean gimp_projection_idle_render_next_area (GimpProjection *proj);
|
||||
static void gimp_projection_paint_area (GimpProjection *proj,
|
||||
gboolean now,
|
||||
|
@ -197,7 +202,10 @@ gimp_projection_finalize (GObject *object)
|
|||
}
|
||||
|
||||
gimp_area_list_free (proj->update_areas);
|
||||
proj->update_areas = NULL;
|
||||
|
||||
gimp_area_list_free (proj->idle_render.update_areas);
|
||||
proj->idle_render.update_areas = NULL;
|
||||
|
||||
if (proj->tiles)
|
||||
{
|
||||
|
@ -275,25 +283,6 @@ gimp_projection_new (GimpImage *gimage)
|
|||
return proj;
|
||||
}
|
||||
|
||||
void
|
||||
gimp_projection_add_update_area (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpArea *area;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PROJECTION (proj));
|
||||
|
||||
area = gimp_area_new (CLAMP (x, 0, proj->gimage->width),
|
||||
CLAMP (y, 0, proj->gimage->height),
|
||||
CLAMP (x + w, 0, proj->gimage->width),
|
||||
CLAMP (y + h, 0, proj->gimage->height));
|
||||
|
||||
proj->update_areas = gimp_area_list_process (proj->update_areas, area);
|
||||
}
|
||||
|
||||
TileManager *
|
||||
gimp_projection_get_tiles (GimpProjection *proj)
|
||||
{
|
||||
|
@ -351,6 +340,20 @@ gimp_projection_flush_now (GimpProjection *proj)
|
|||
gimp_projection_flush_whenever (proj, TRUE);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_projection_finish_draw (GimpProjection *proj)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PROJECTION (proj));
|
||||
|
||||
if (proj->idle_render.idle_id)
|
||||
{
|
||||
g_source_remove (proj->idle_render.idle_id);
|
||||
proj->idle_render.idle_id = 0;
|
||||
|
||||
while (gimp_projection_idle_render_callback (proj));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* private functions */
|
||||
|
||||
|
@ -409,6 +412,25 @@ gimp_projection_alloc_tiles (GimpProjection *proj)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_projection_add_update_area (GimpProjection *proj,
|
||||
gint x,
|
||||
gint y,
|
||||
gint w,
|
||||
gint h)
|
||||
{
|
||||
GimpArea *area;
|
||||
|
||||
g_return_if_fail (GIMP_IS_PROJECTION (proj));
|
||||
|
||||
area = gimp_area_new (CLAMP (x, 0, proj->gimage->width),
|
||||
CLAMP (y, 0, proj->gimage->height),
|
||||
CLAMP (x + w, 0, proj->gimage->width),
|
||||
CLAMP (y + h, 0, proj->gimage->height));
|
||||
|
||||
proj->update_areas = gimp_area_list_process (proj->update_areas, area);
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_projection_flush_whenever (GimpProjection *proj,
|
||||
gboolean now)
|
||||
|
@ -437,7 +459,7 @@ gimp_projection_flush_whenever (GimpProjection *proj,
|
|||
}
|
||||
else /* Asynchronous */
|
||||
{
|
||||
gimp_projection_idlerender_init (proj);
|
||||
gimp_projection_idle_render_init (proj);
|
||||
}
|
||||
|
||||
/* Free the update lists */
|
||||
|
@ -445,22 +467,8 @@ gimp_projection_flush_whenever (GimpProjection *proj,
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
gimp_projection_finish_draw (GimpProjection *proj)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_PROJECTION (proj));
|
||||
|
||||
if (proj->idle_render.idle_id)
|
||||
{
|
||||
g_source_remove (proj->idle_render.idle_id);
|
||||
proj->idle_render.idle_id = 0;
|
||||
|
||||
while (gimp_projection_idlerender_callback (proj));
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gimp_projection_idlerender_init (GimpProjection *proj)
|
||||
gimp_projection_idle_render_init (GimpProjection *proj)
|
||||
{
|
||||
GSList *list;
|
||||
GimpArea *area;
|
||||
|
@ -484,12 +492,12 @@ gimp_projection_idlerender_init (GimpProjection *proj)
|
|||
if (proj->idle_render.idle_id)
|
||||
{
|
||||
area =
|
||||
gimp_area_new (proj->idle_render.basex,
|
||||
gimp_area_new (proj->idle_render.base_x,
|
||||
proj->idle_render.y,
|
||||
proj->idle_render.basex + proj->idle_render.width,
|
||||
proj->idle_render.base_x + proj->idle_render.width,
|
||||
proj->idle_render.y + (proj->idle_render.height -
|
||||
(proj->idle_render.y -
|
||||
proj->idle_render.basey)));
|
||||
proj->idle_render.base_y)));
|
||||
|
||||
proj->idle_render.update_areas =
|
||||
gimp_area_list_process (proj->idle_render.update_areas, area);
|
||||
|
@ -500,19 +508,18 @@ gimp_projection_idlerender_init (GimpProjection *proj)
|
|||
{
|
||||
if (proj->idle_render.update_areas == NULL)
|
||||
{
|
||||
g_warning ("Wanted to start idlerender thread with no update_areas. (+memleak)");
|
||||
g_warning ("%s: wanted to start idle render with no update_areas",
|
||||
G_STRFUNC);
|
||||
return;
|
||||
}
|
||||
|
||||
gimp_projection_idle_render_next_area (proj);
|
||||
|
||||
proj->idle_render.idle_id = g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_projection_idlerender_callback,
|
||||
proj,
|
||||
NULL);
|
||||
proj->idle_render.idle_id =
|
||||
g_idle_add_full (G_PRIORITY_LOW,
|
||||
gimp_projection_idle_render_callback,
|
||||
proj, NULL);
|
||||
}
|
||||
|
||||
/* Caller frees proj->update_areas */
|
||||
}
|
||||
|
||||
/* Unless specified otherwise, projection re-rendering is organised by
|
||||
|
@ -522,41 +529,43 @@ gimp_projection_idlerender_init (GimpProjection *proj)
|
|||
* operations. -- Adam
|
||||
*/
|
||||
static gboolean
|
||||
gimp_projection_idlerender_callback (gpointer data)
|
||||
gimp_projection_idle_render_callback (gpointer data)
|
||||
{
|
||||
const gint CHUNK_WIDTH = 256;
|
||||
const gint CHUNK_HEIGHT = 128;
|
||||
gint workx, worky, workw, workh;
|
||||
GimpProjection *proj = data;
|
||||
gint workx, worky;
|
||||
gint workw, workh;
|
||||
|
||||
#define CHUNK_WIDTH 256
|
||||
#define CHUNK_HEIGHT 128
|
||||
|
||||
workw = CHUNK_WIDTH;
|
||||
workh = CHUNK_HEIGHT;
|
||||
workx = proj->idle_render.x;
|
||||
worky = proj->idle_render.y;
|
||||
|
||||
if (workx + workw > proj->idle_render.basex + proj->idle_render.width)
|
||||
if (workx + workw > proj->idle_render.base_x + proj->idle_render.width)
|
||||
{
|
||||
workw = proj->idle_render.basex + proj->idle_render.width - workx;
|
||||
workw = proj->idle_render.base_x + proj->idle_render.width - workx;
|
||||
}
|
||||
|
||||
if (worky + workh > proj->idle_render.basey + proj->idle_render.height)
|
||||
if (worky + workh > proj->idle_render.base_y + proj->idle_render.height)
|
||||
{
|
||||
workh = proj->idle_render.basey + proj->idle_render.height - worky;
|
||||
workh = proj->idle_render.base_y + proj->idle_render.height - worky;
|
||||
}
|
||||
|
||||
gimp_projection_paint_area (proj, TRUE, /* sic! */
|
||||
gimp_projection_paint_area (proj, TRUE /* sic! */,
|
||||
workx, worky, workw, workh);
|
||||
|
||||
proj->idle_render.x += CHUNK_WIDTH;
|
||||
|
||||
if (proj->idle_render.x >=
|
||||
proj->idle_render.basex + proj->idle_render.width)
|
||||
proj->idle_render.base_x + proj->idle_render.width)
|
||||
{
|
||||
proj->idle_render.x = proj->idle_render.basex;
|
||||
proj->idle_render.x = proj->idle_render.base_x;
|
||||
proj->idle_render.y += CHUNK_HEIGHT;
|
||||
|
||||
if (proj->idle_render.y >=
|
||||
proj->idle_render.basey + proj->idle_render.height)
|
||||
proj->idle_render.base_y + proj->idle_render.height)
|
||||
{
|
||||
if (! gimp_projection_idle_render_next_area (proj))
|
||||
{
|
||||
|
@ -585,8 +594,8 @@ gimp_projection_idle_render_next_area (GimpProjection *proj)
|
|||
proj->idle_render.update_areas =
|
||||
g_slist_remove (proj->idle_render.update_areas, area);
|
||||
|
||||
proj->idle_render.x = proj->idle_render.basex = area->x1;
|
||||
proj->idle_render.y = proj->idle_render.basey = area->y1;
|
||||
proj->idle_render.x = proj->idle_render.base_x = area->x1;
|
||||
proj->idle_render.y = proj->idle_render.base_y = area->y1;
|
||||
proj->idle_render.width = area->x2 - area->x1;
|
||||
proj->idle_render.height = area->y2 - area->y1;
|
||||
|
||||
|
|
|
@ -23,16 +23,16 @@
|
|||
#include "gimpobject.h"
|
||||
|
||||
|
||||
typedef struct _IdleRenderStruct IdleRenderStruct;
|
||||
typedef struct _GimpProjectionIdleRender GimpProjectionIdleRender;
|
||||
|
||||
struct _IdleRenderStruct
|
||||
struct _GimpProjectionIdleRender
|
||||
{
|
||||
gint width;
|
||||
gint height;
|
||||
gint x;
|
||||
gint y;
|
||||
gint basex;
|
||||
gint basey;
|
||||
gint base_x;
|
||||
gint base_y;
|
||||
guint idle_id;
|
||||
GSList *update_areas; /* flushed update areas */
|
||||
};
|
||||
|
@ -59,7 +59,7 @@ struct _GimpProjection
|
|||
TileManager *tiles;
|
||||
|
||||
GSList *update_areas;
|
||||
IdleRenderStruct idle_render;
|
||||
GimpProjectionIdleRender idle_render;
|
||||
|
||||
gboolean construct_flag;
|
||||
};
|
||||
|
@ -88,6 +88,7 @@ gdouble gimp_projection_get_opacity (const GimpProjection *proj);
|
|||
|
||||
void gimp_projection_flush (GimpProjection *proj);
|
||||
void gimp_projection_flush_now (GimpProjection *proj);
|
||||
void gimp_projection_finish_draw (GimpProjection *proj);
|
||||
|
||||
|
||||
#endif /* __GIMP_PROJECTION_H__ */
|
||||
|
|
|
@ -26,7 +26,6 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "gimpdisplay.h"
|
||||
#include "gimpdisplay-handlers.h"
|
||||
|
|
|
@ -25,10 +25,8 @@
|
|||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimparea.h"
|
||||
#include "core/gimpdrawable.h"
|
||||
#include "core/gimpimage.h"
|
||||
#include "core/gimplist.h"
|
||||
#include "core/gimpprojection.h"
|
||||
|
||||
#include "tools/gimptool.h"
|
||||
#include "tools/tool_manager.h"
|
||||
|
|
|
@ -100,9 +100,9 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
|
|||
gchar *title;
|
||||
gchar *message;
|
||||
|
||||
if (shell->warning_dialog)
|
||||
if (shell->close_dialog)
|
||||
{
|
||||
gtk_window_present (GTK_WINDOW (shell->warning_dialog));
|
||||
gtk_window_present (GTK_WINDOW (shell->close_dialog));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -110,7 +110,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
|
|||
|
||||
title = g_strdup_printf (_("Close %s?"), name);
|
||||
|
||||
shell->warning_dialog =
|
||||
shell->close_dialog =
|
||||
dialog = gimp_dialog_new (title,
|
||||
"gimp-display-shell-close",
|
||||
GTK_WIDGET (shell), 0,
|
||||
|
@ -126,7 +126,7 @@ gimp_display_shell_close_dialog (GimpDisplayShell *shell,
|
|||
|
||||
g_signal_connect (dialog, "destroy",
|
||||
G_CALLBACK (gtk_widget_destroyed),
|
||||
&shell->warning_dialog);
|
||||
&shell->close_dialog);
|
||||
|
||||
g_signal_connect (dialog, "response",
|
||||
G_CALLBACK (gimp_display_shell_close_response),
|
||||
|
@ -174,7 +174,7 @@ gimp_display_shell_close_response (GtkWidget *widget,
|
|||
gint response_id,
|
||||
GimpDisplayShell *shell)
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (shell->warning_dialog));
|
||||
gtk_widget_destroy (widget);
|
||||
|
||||
if (response_id == GTK_RESPONSE_OK)
|
||||
gimp_display_delete (shell->gdisp);
|
||||
|
|
|
@ -622,9 +622,7 @@ gimp_display_shell_ants_speed_notify_handler (GObject *config,
|
|||
static gboolean
|
||||
gimp_display_shell_idle_update_icon (gpointer data)
|
||||
{
|
||||
GimpDisplayShell *shell;
|
||||
|
||||
shell = GIMP_DISPLAY_SHELL (data);
|
||||
GimpDisplayShell *shell = GIMP_DISPLAY_SHELL (data);
|
||||
|
||||
shell->icon_idle_id = 0;
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpcolor/gimpcolor.h"
|
||||
#include "libgimpwidgets/gimpwidgets.h"
|
||||
|
||||
#include "display-types.h"
|
||||
|
@ -35,7 +34,6 @@
|
|||
#include "config/gimpconfig-params.h"
|
||||
#include "config/gimpconfig-utils.h"
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
#include "config/gimpguiconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpbuffer.h"
|
||||
|
@ -50,8 +48,6 @@
|
|||
#include "core/gimpmarshal.h"
|
||||
#include "core/gimppattern.h"
|
||||
|
||||
#include "file/file-utils.h"
|
||||
|
||||
#include "vectors/gimpvectors.h"
|
||||
#include "vectors/gimpstroke.h"
|
||||
|
||||
|
@ -163,13 +159,9 @@ gimp_display_shell_get_type (void)
|
|||
static void
|
||||
gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
||||
{
|
||||
GObjectClass *gobject_class;
|
||||
GtkObjectClass *object_class;
|
||||
GtkWidgetClass *widget_class;
|
||||
|
||||
gobject_class = G_OBJECT_CLASS (klass);
|
||||
object_class = GTK_OBJECT_CLASS (klass);
|
||||
widget_class = GTK_WIDGET_CLASS (klass);
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (klass);
|
||||
GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (klass);
|
||||
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
|
||||
|
||||
parent_class = g_type_class_peek_parent (klass);
|
||||
|
||||
|
@ -200,11 +192,11 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
gimp_marshal_VOID__VOID,
|
||||
G_TYPE_NONE, 0);
|
||||
|
||||
gobject_class->finalize = gimp_display_shell_finalize;
|
||||
gobject_class->set_property = gimp_display_shell_set_property;
|
||||
gobject_class->get_property = gimp_display_shell_get_property;
|
||||
object_class->finalize = gimp_display_shell_finalize;
|
||||
object_class->set_property = gimp_display_shell_set_property;
|
||||
object_class->get_property = gimp_display_shell_get_property;
|
||||
|
||||
object_class->destroy = gimp_display_shell_destroy;
|
||||
gtk_object_class->destroy = gimp_display_shell_destroy;
|
||||
|
||||
widget_class->screen_changed = gimp_display_shell_screen_changed;
|
||||
widget_class->delete_event = gimp_display_shell_delete_event;
|
||||
|
@ -214,11 +206,12 @@ gimp_display_shell_class_init (GimpDisplayShellClass *klass)
|
|||
klass->scrolled = NULL;
|
||||
klass->reconnect = NULL;
|
||||
|
||||
g_object_class_install_property (gobject_class, PROP_SCALE,
|
||||
g_object_class_install_property (object_class, PROP_SCALE,
|
||||
g_param_spec_double ("scale", NULL, NULL,
|
||||
1.0 / 256, 256, 1.0,
|
||||
G_PARAM_READWRITE));
|
||||
g_object_class_install_property (gobject_class, PROP_UNIT,
|
||||
|
||||
g_object_class_install_property (object_class, PROP_UNIT,
|
||||
gimp_param_spec_unit ("unit", NULL, NULL,
|
||||
TRUE, FALSE,
|
||||
GIMP_UNIT_PIXEL,
|
||||
|
@ -294,7 +287,7 @@ gimp_display_shell_init (GimpDisplayShell *shell)
|
|||
shell->cursor_x = 0;
|
||||
shell->cursor_y = 0;
|
||||
|
||||
shell->warning_dialog = NULL;
|
||||
shell->close_dialog = NULL;
|
||||
shell->info_dialog = NULL;
|
||||
shell->scale_dialog = NULL;
|
||||
shell->nav_popup = NULL;
|
||||
|
@ -567,7 +560,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
{
|
||||
GimpDisplayShell *shell;
|
||||
GimpDisplayConfig *display_config;
|
||||
GimpGuiConfig *gui_config;
|
||||
GtkWidget *main_vbox;
|
||||
GtkWidget *disp_vbox;
|
||||
GtkWidget *upper_hbox;
|
||||
|
@ -597,7 +589,6 @@ gimp_display_shell_new (GimpDisplay *gdisp,
|
|||
image_height = gdisp->gimage->height;
|
||||
|
||||
display_config = GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config);
|
||||
gui_config = GIMP_GUI_CONFIG (display_config);
|
||||
|
||||
shell->dot_for_dot = display_config->default_dot_for_dot;
|
||||
|
||||
|
@ -1065,7 +1056,7 @@ gimp_display_shell_snap_coords (GimpDisplayShell *shell,
|
|||
gint snap_distance;
|
||||
|
||||
snap_distance =
|
||||
GIMP_GUI_CONFIG (shell->gdisp->gimage->gimp->config)->snap_distance;
|
||||
GIMP_DISPLAY_CONFIG (shell->gdisp->gimage->gimp->config)->snap_distance;
|
||||
|
||||
if (snap_width > 0 && snap_height > 0)
|
||||
{
|
||||
|
|
|
@ -135,7 +135,7 @@ struct _GimpDisplayShell
|
|||
gint cursor_x; /* software cursor X value */
|
||||
gint cursor_y; /* software cursor Y value */
|
||||
|
||||
GtkWidget *warning_dialog; /* close warning dialog */
|
||||
GtkWidget *close_dialog; /* close dialog */
|
||||
InfoDialog *info_dialog; /* image information dialog */
|
||||
GtkWidget *scale_dialog; /* scale (zoom) dialog */
|
||||
GtkWidget *nav_popup; /* navigation popup */
|
||||
|
@ -143,7 +143,7 @@ struct _GimpDisplayShell
|
|||
|
||||
GimpColorDisplayStack *filter_stack; /* color display conversion stuff */
|
||||
guint filter_idle_id;
|
||||
GtkWidget *filters_dialog;/* color display filter dialog */
|
||||
GtkWidget *filters_dialog; /* color display filter dialog */
|
||||
|
||||
gint paused_count;
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "tools-types.h"
|
||||
|
||||
#include "config/gimpguiconfig.h"
|
||||
#include "config/gimpdisplayconfig.h"
|
||||
|
||||
#include "core/gimp.h"
|
||||
#include "core/gimpimage.h"
|
||||
|
@ -259,7 +259,7 @@ gimp_move_tool_button_press (GimpTool *tool,
|
|||
gint snap_distance;
|
||||
|
||||
snap_distance =
|
||||
GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
|
||||
if (gimp_display_shell_get_show_guides (shell) &&
|
||||
(guide = gimp_image_find_guide (gdisp->gimage,
|
||||
|
@ -562,7 +562,9 @@ gimp_move_tool_oper_update (GimpTool *tool,
|
|||
{
|
||||
gint snap_distance;
|
||||
|
||||
snap_distance = GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
snap_distance =
|
||||
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
|
||||
guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y,
|
||||
FUNSCALEX (shell, snap_distance),
|
||||
FUNSCALEY (shell, snap_distance));
|
||||
|
@ -631,7 +633,7 @@ gimp_move_tool_cursor_update (GimpTool *tool,
|
|||
gint snap_distance;
|
||||
|
||||
snap_distance =
|
||||
GIMP_GUI_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
GIMP_DISPLAY_CONFIG (gdisp->gimage->gimp->config)->snap_distance;
|
||||
|
||||
if (gimp_display_shell_get_show_guides (shell) &&
|
||||
(guide = gimp_image_find_guide (gdisp->gimage, coords->x, coords->y,
|
||||
|
|
Loading…
Reference in a new issue