add vitrual function invalidate_preview().

2008-11-04  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpprojectable.[ch]: add vitrual function
	invalidate_preview().

	* app/core/gimpimage.c: implement it and redirect to
	gimp_viewable_invalidate_preview().

	* app/core/gimpprojection.c: call the new API instead of
	gimp_viewable_invalidate_preview(). Some cleanup in the disabled
	cow-projection code.


svn path=/trunk/; revision=27553
This commit is contained in:
Michael Natterer
2008-11-04 20:13:12 +00:00
committed by Michael Natterer
parent 716e00f88b
commit 7d8b7f5534
6 changed files with 67 additions and 42 deletions

View File

@ -1,3 +1,15 @@
2008-11-04 Michael Natterer <mitch@gimp.org>
* app/core/gimpprojectable.[ch]: add vitrual function
invalidate_preview().
* app/core/gimpimage.c: implement it and redirect to
gimp_viewable_invalidate_preview().
* app/core/gimpprojection.c: call the new API instead of
gimp_viewable_invalidate_preview(). Some cleanup in the disabled
cow-projection code.
2008-11-04 Michael Natterer <mitch@gimp.org>
Unfinished first step to make the projection independent of

View File

@ -563,6 +563,7 @@ gimp_projectable_iface_init (GimpProjectableInterface *iface)
iface->flush = gimp_image_projectable_flush;
iface->get_image = gimp_image_get_image;
iface->get_graph = gimp_image_get_graph;
iface->invalidate_preview = (void (*) (GimpProjectable *p)) gimp_viewable_invalidate_preview;
}
static void

View File

@ -161,3 +161,16 @@ gimp_projectable_get_graph (GimpProjectable *projectable)
return NULL;
}
void
gimp_projectable_invalidate_preview (GimpProjectable *projectable)
{
GimpProjectableInterface *iface;
g_return_if_fail (GIMP_IS_PROJECTABLE (projectable));
iface = GIMP_PROJECTABLE_GET_INTERFACE (projectable);
if (iface->invalidate_preview)
iface->invalidate_preview (projectable);
}

View File

@ -47,6 +47,7 @@ struct _GimpProjectableInterface
/* virtual functions */
GimpImage * (* get_image) (GimpProjectable *projectable);
GeglNode * (* get_graph) (GimpProjectable *projectable);
void (* invalidate_preview) (GimpProjectable *projectable);
};
@ -62,6 +63,7 @@ void gimp_projectable_flush (GimpProjectable *projectable,
GimpImage * gimp_projectable_get_image (GimpProjectable *projectable);
GeglNode * gimp_projectable_get_graph (GimpProjectable *projectable);
void gimp_projectable_invalidate_preview (GimpProjectable *projectable);
#endif /* __GIMP_PROJECTABLE_H__ */

View File

@ -103,25 +103,23 @@ gimp_projection_construct (GimpProjection *proj,
#if 0
GimpImage *image = gimp_projectable_get_image (proj->projectable);
if ((gimp_container_num_children (image->layers) == 1)) /* a single layer */
if (gimp_container_num_children (image->layers) == 1) /* a single layer */
{
GimpDrawable *layer;
gint off_x, off_y;
layer = GIMP_DRAWABLE (gimp_image_get_layer_by_index (image, 0));
gimp_item_get_offset (GIMP_ITEM (layer), &off_x, &off_y);
if (gimp_drawable_has_alpha (layer) &&
(gimp_item_get_visible (GIMP_ITEM (layer))) &&
(gimp_item_get_width (GIMP_ITEM (layer)) == image->width) &&
(gimp_item_get_height (GIMP_ITEM (layer)) == image->height) &&
(! gimp_drawable_is_indexed (layer)) &&
(gimp_layer_get_opacity (GIMP_LAYER (layer)) == GIMP_OPACITY_OPAQUE))
{
gint xoff;
gint yoff;
gimp_item_get_offset (GIMP_ITEM (layer), &xoff, &yoff);
if (xoff == 0 && yoff == 0)
gimp_item_get_visible (GIMP_ITEM (layer)) &&
gimp_item_get_width (GIMP_ITEM (layer)) == image->width &&
gimp_item_get_height (GIMP_ITEM (layer)) == image->height &&
! gimp_drawable_is_indexed (layer) &&
gimp_layer_get_opacity (GIMP_LAYER (layer)) == GIMP_OPACITY_OPAQUE &&
off_x == 0 &&
off_y == 0)
{
PixelRegion srcPR, destPR;
@ -143,7 +141,6 @@ gimp_projection_construct (GimpProjection *proj,
return;
}
}
}
#endif
/* First, determine if the projection image needs to be

View File

@ -270,7 +270,7 @@ gimp_projection_pickable_flush (GimpPickable *pickable)
*/
proj->invalidate_preview = FALSE;
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
gimp_projectable_invalidate_preview (proj->projectable);
}
}
@ -561,7 +561,7 @@ gimp_projection_flush_whenever (GimpProjection *proj,
*/
proj->invalidate_preview = FALSE;
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
gimp_projectable_invalidate_preview (proj->projectable);
}
}
@ -678,7 +678,7 @@ gimp_projection_idle_render_callback (gpointer data)
*/
proj->invalidate_preview = FALSE;
gimp_viewable_invalidate_preview (GIMP_VIEWABLE (proj->projectable));
gimp_projectable_invalidate_preview (proj->projectable);
}
return FALSE;