[gtk+] vulkan: Fix repeat node coordinates



commit fe6e80fdde96c500c896809ee69595ea265d22ce
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 8 08:44:02 2017 -0400

    vulkan: Fix repeat node coordinates
    
    We were not treating non-trivial child bounds right at all.
    This was visible in the css blendmode cmyk example in gtk4-demo,
    for the normal blendmode.

 gsk/gskvulkanrenderpass.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/gsk/gskvulkanrenderpass.c b/gsk/gskvulkanrenderpass.c
index 69c8b38..90c3808 100644
--- a/gsk/gskvulkanrenderpass.c
+++ b/gsk/gskvulkanrenderpass.c
@@ -808,7 +808,10 @@ got_surface:
 
   gsk_vulkan_render_add_cleanup_image (render, result);
 
-  *tex_rect = GRAPHENE_RECT_INIT(0, 0, 1, 1);
+  tex_rect->origin.x = (node->bounds.origin.x - bounds->origin.x)/bounds->size.width;
+  tex_rect->origin.y = (node->bounds.origin.y - bounds->origin.y)/bounds->size.height;
+  tex_rect->size.width = node->bounds.size.width/bounds->size.width;
+  tex_rect->size.height = node->bounds.size.height/bounds->size.height;
 
   return result;
 }
@@ -956,15 +959,21 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass  *self,
         case GSK_VULKAN_OP_REPEAT:
           {
             GskRenderNode *child = gsk_repeat_node_get_child (op->render.node);
-            const graphene_rect_t *bounds = gsk_repeat_node_peek_child_bounds (op->render.node);
+            const graphene_rect_t *bounds = &op->render.node->bounds;
+            const graphene_rect_t *child_bounds = gsk_repeat_node_peek_child_bounds (op->render.node);
 
             op->render.source = gsk_vulkan_render_pass_get_node_as_texture (self,
                                                                             render,
                                                                             uploader,
                                                                             child,
-                                                                            bounds,
+                                                                            child_bounds,
                                                                             NULL,
                                                                             &op->render.source_rect);
+
+            op->render.source_rect.origin.x = (bounds->origin.x - 
child_bounds->origin.x)/child_bounds->size.width;
+            op->render.source_rect.origin.y = (bounds->origin.y - 
child_bounds->origin.y)/child_bounds->size.height;
+            op->render.source_rect.size.width = bounds->size.width / child_bounds->size.width;
+            op->render.source_rect.size.height = bounds->size.height / child_bounds->size.height;
           }
           break;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]