[gimp/gimp-2-10] app: fix projection update-area offset upon buffer allocation/reisizing
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: fix projection update-area offset upon buffer allocation/reisizing
- Date: Fri, 10 Aug 2018 07:22:59 +0000 (UTC)
commit 2f1041bed0fe6be48390752fca5e45d89e5ac800
Author: Ell <ell_se yahoo com>
Date: Fri Aug 10 02:36:29 2018 -0400
app: fix projection update-area offset upon buffer allocation/reisizing
In GimpProjection, change gimp_projection_add_update_area() to take
coordinates in the projection's coordinate system, rather than the
image coordinate system, and move the offset adjustment to the
projectable invalidation handler.
Modify gimp_projection_projectable_structure_changed() to pass
projection-space coordinates to gimp_projection_add_update_area().
gimp_projection_get_buffer() and
gimp_projection_projectable_bounds_changed() already pass
projection-space coordinates to gimp_projection_add_update_area(),
which was wrong before, when the projection had a nontrivial
offset, but is correct now.
(cherry picked from commit 2d63bc6e0a15d6ebd2446ebd7f067a811a4f85a6)
app/core/gimpprojection.c | 30 +++++++++++++++---------------
1 file changed, 15 insertions(+), 15 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index f49653c364..fa37f4e755 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -715,20 +715,11 @@ gimp_projection_add_update_area (GimpProjection *proj,
gint w,
gint h)
{
- cairo_rectangle_int_t rect;
- gint off_x, off_y;
- gint width, height;
+ cairo_rectangle_int_t rect;
+ gint width, height;
- gimp_projectable_get_offset (proj->priv->projectable, &off_x, &off_y);
gimp_projectable_get_size (proj->priv->projectable, &width, &height);
- /* subtract the projectable's offsets because the list of update
- * areas is in tile-pyramid coordinates, but our external API is
- * always in terms of image coordinates.
- */
- x -= off_x;
- y -= off_y;
-
/* align the rectangle to the UPDATE_CHUNK_WIDTH x UPDATE_CHUNK_HEIGHT grid,
* to decrease the complexity of the update area.
*/
@@ -1067,6 +1058,17 @@ gimp_projection_projectable_invalidate (GimpProjectable *projectable,
gint h,
GimpProjection *proj)
{
+ gint off_x, off_y;
+
+ gimp_projectable_get_offset (proj->priv->projectable, &off_x, &off_y);
+
+ /* subtract the projectable's offsets because the list of update
+ * areas is in tile-pyramid coordinates, but our external API is
+ * always in terms of image coordinates.
+ */
+ x -= off_x;
+ y -= off_y;
+
gimp_projection_add_update_area (proj, x, y, w, h);
}
@@ -1085,15 +1087,13 @@ static void
gimp_projection_projectable_structure_changed (GimpProjectable *projectable,
GimpProjection *proj)
{
- gint off_x, off_y;
gint width, height;
gimp_projection_free_buffer (proj);
- gimp_projectable_get_offset (proj->priv->projectable, &off_x, &off_y);
- gimp_projectable_get_size (projectable, &width, &height);
+ gimp_projectable_get_size (projectable, &width, &height);
- gimp_projection_add_update_area (proj, off_x, off_y, width, height);
+ gimp_projection_add_update_area (proj, 0, 0, width, height);
proj->priv->priority_rect.x = 0;
proj->priv->priority_rect.y = 0;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]