static void gimp_projection_projectable_changed (GimpProjectable *projectable, GimpProjection *proj) { gint off_x, off_y; gint width, height; if (proj->idle_render.idle_id) { g_source_remove (proj->idle_render.idle_id); proj->idle_render.idle_id = 0; } gimp_area_list_free (proj->update_areas); proj->update_areas = NULL; if (proj->pyramid) { tile_pyramid_destroy (proj->pyramid); proj->pyramid = NULL; } if (proj->buffer) { g_object_unref (proj->buffer); proj->buffer = NULL; } gimp_projectable_get_offset (proj->projectable, &off_x, &off_y); gimp_projectable_get_size (projectable, &width, &height); gimp_projection_add_update_area (proj, off_x, off_y, width, height); }
static void gimp_projection_projectable_invalidate (GimpProjectable *projectable, gint x, gint y, gint w, gint h, GimpProjection *proj) { gimp_projection_add_update_area (proj, x, y, w, h); }
static GeglBuffer * gimp_projection_get_buffer (GimpPickable *pickable) { GimpProjection *proj = GIMP_PROJECTION (pickable); if (! proj->buffer) { GeglNode *graph; const Babl *format; gint width; gint height; graph = gimp_projectable_get_graph (proj->projectable); format = gimp_projection_get_format (GIMP_PICKABLE (proj)); gimp_projectable_get_size (proj->projectable, &width, &height); proj->buffer = gegl_buffer_new (GEGL_RECTANGLE (0, 0, width, height), format); proj->validate_handler = gimp_tile_handler_projection_new (graph); gegl_buffer_add_handler (proj->buffer, proj->validate_handler); /* This used to call gimp_tile_handler_projection_invalidate() * which forced the entire projection to be constructed in one * go for new images, causing a potentially huge delay. Now we * initially validate stuff the normal way, which makes the * image appear incrementally, but it keeps everything * responsive. */ gimp_projection_add_update_area (proj, 0, 0, width, height); proj->invalidate_preview = TRUE; gimp_projection_flush (proj); } return proj->buffer; }