[gtk/wip/baedert/transforms6: 78/78] WIP



commit 17d2516b15acbd01a0bbaef23522cbc4ec7a141f
Author: Timm Bäder <mail baedert org>
Date:   Fri Nov 30 09:14:21 2018 +0100

    WIP

 gsk/gl/gskglrenderer.c         | 14 +++++++++++++-
 gsk/gl/gskglrenderopsprivate.h |  3 +--
 gtk/gtkbin.c                   | 32 ++++++++++++++++++++++++++------
 gtk/gtkwindow.c                | 14 +++++++++++++-
 4 files changed, 53 insertions(+), 10 deletions(-)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index ff66e803e9..e9550c5878 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -133,6 +133,7 @@ dump_framebuffer (const char *filename, int w, int h)
 
   glReadPixels (0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, data);
   s = cairo_image_surface_create_for_data (data, CAIRO_FORMAT_ARGB32, w, h, stride);
+  g_message ("%d, %d", w, h);
   cairo_surface_write_to_png (s, filename);
 
   cairo_surface_destroy (s);
@@ -247,6 +248,7 @@ node_supports_transform (GskRenderNode *node)
       case GSK_OPACITY_NODE:
       case GSK_COLOR_MATRIX_NODE:
       case GSK_TEXTURE_NODE:
+      case GSK_OFFSET_NODE:
         return TRUE;
 
       default:
@@ -821,10 +823,15 @@ render_transform_node (GskGLRenderer   *self,
       gboolean is_offscreen;
       /* For non-trivial transforms, we draw everything on a texture and then
        * draw the texture transformed. */
+
       /* TODO: We should compute a modelview containing only the "non-trivial"
        *       part (e.g. the rotation) and use that. We want to keep the scale
        *       for the texture.
        */
+
+      g_message ("%s:Offscreen drawing %s", __FUNCTION__, child->node_class->type_name);
+
+
       add_offscreen_ops (self, builder,
                          &node->bounds,
                          child,
@@ -832,7 +839,11 @@ render_transform_node (GskGLRenderer   *self,
                          FALSE, TRUE);
       ops_set_texture (builder, texture_id);
       ops_set_program (builder, &self->blit_program);
+      graphene_matrix_t m;
+      graphene_matrix_init_identity (&m);
+      /*ops_push_modelview (builder, &m);*/
       ops_draw (builder, vertex_data);
+      /*ops_pop_modelview (builder);*/
     }
   ops_pop_modelview (builder);
 }
@@ -2406,7 +2417,7 @@ add_offscreen_ops (GskGLRenderer         *self,
     }
 
   /* Check if we've already cached the drawn texture. */
-  {
+  if (0){
     const int cached_id = gsk_gl_driver_get_texture_for_pointer (self->gl_driver, child_node);
 
     if (cached_id != 0)
@@ -2632,6 +2643,7 @@ gsk_gl_renderer_render_ops (GskGLRenderer *self,
           break;
 
         case OP_DUMP_FRAMEBUFFER:
+          g_message ("--> Dumping to %s", op->dump.filename);
           dump_framebuffer (op->dump.filename, op->dump.width, op->dump.height);
           break;
 
diff --git a/gsk/gl/gskglrenderopsprivate.h b/gsk/gl/gskglrenderopsprivate.h
index 1d1594172d..22ea0a37ed 100644
--- a/gsk/gl/gskglrenderopsprivate.h
+++ b/gsk/gl/gskglrenderopsprivate.h
@@ -210,7 +210,7 @@ typedef struct
       int source2;
     } cross_fade;
     struct {
-      char *filename;
+      char *filename; /* Will leak */
       int width;
       int height;
     } dump;
@@ -271,7 +271,6 @@ void              ops_dump_framebuffer   (RenderOpBuilder         *builder,
                                           const char              *filename,
                                           int                      width,
                                           int                      height);
-
 void              ops_finish             (RenderOpBuilder         *builder);
 void              ops_push_modelview     (RenderOpBuilder         *builder,
                                           const graphene_matrix_t *mv);
diff --git a/gtk/gtkbin.c b/gtk/gtkbin.c
index 10b010f2d7..e383c2e4c5 100644
--- a/gtk/gtkbin.c
+++ b/gtk/gtkbin.c
@@ -62,7 +62,7 @@ static void               gtk_bin_measure                         (GtkWidget
                                                                    int            *natural_baseline);
 
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GtkBin, gtk_bin, GTK_TYPE_CONTAINER)
-
+#include "gtklabel.h"
 static void
 gtk_bin_size_allocate (GtkWidget *widget,
                        int        width,
@@ -73,11 +73,31 @@ gtk_bin_size_allocate (GtkWidget *widget,
   GtkBinPrivate *priv = gtk_bin_get_instance_private (bin);
 
   if (priv->child && gtk_widget_get_visible (priv->child))
-    gtk_widget_size_allocate (priv->child,
-                              &(GtkAllocation) {
-                                0, 0,
-                                width, height
-                              }, baseline);
+    {
+      if (!GTK_IS_LABEL (priv->child))
+        {
+          gtk_widget_size_allocate (priv->child,
+                                    &(GtkAllocation) {
+                                      0, 0,
+                                      width, height
+                                    }, baseline);
+        }
+      else
+        {
+          g_message ("ZOMG");
+          graphene_matrix_t m;
+          graphene_matrix_init_rotate (&m, 45.0f,
+                                       graphene_vec3_z_axis ());
+          /*graphene_matrix_translate (&m,*/
+                                     /*&(graphene_point3d_t) {rect.x, rect.y, 0 });*/
+
+          gtk_widget_size_allocate_transformed (priv->child,
+                                                width, height,
+                                                -1, &m);
+
+        }
+
+    }
 }
 
 static void
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 339b0e6f89..499e77b232 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7118,7 +7118,19 @@ popover_size_allocate (GtkWindowPopover *popover,
     gtk_popover_update_position (GTK_POPOVER (popover->widget));
 
   popover_get_rect (popover, window, &rect);
-  gtk_widget_size_allocate (popover->widget, &rect, -1);
+  /*gtk_widget_size_allocate (popover->widget, &rect, -1);*/
+
+  graphene_matrix_t m;
+  graphene_matrix_init_rotate (&m, 45.0f,
+                               graphene_vec3_z_axis ());
+  graphene_matrix_translate (&m,
+                             &(graphene_point3d_t) {rect.x, rect.y, 0 });
+
+  gtk_widget_size_allocate_transformed (popover->widget,
+                                        rect.width, rect.height,
+                                        -1, &m);
+
+
 }
 
 /* _gtk_window_set_allocation:


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