[gtk+/wip/baedert/gl: 116/177] GskRenderer: Remove viewport property



commit 7356df7342c6382df4702089a4864dee7e1f0afd
Author: Timm Bäder <mail baedert org>
Date:   Sat Nov 4 20:05:56 2017 +0100

    GskRenderer: Remove viewport property

 gsk/gskcairorenderer.c |   10 ++----
 gsk/gskrenderer.c      |   83 +-----------------------------------------------
 gsk/gskrenderer.h      |    6 ---
 gtk/gtkwindow.c        |    8 -----
 4 files changed, 4 insertions(+), 103 deletions(-)
---
diff --git a/gsk/gskcairorenderer.c b/gsk/gskcairorenderer.c
index c4aa4e9..bc596e2 100644
--- a/gsk/gskcairorenderer.c
+++ b/gsk/gskcairorenderer.c
@@ -99,7 +99,7 @@ gsk_cairo_renderer_render (GskRenderer   *renderer,
                            GskRenderNode *root)
 {
   GdkDrawingContext *context = gsk_renderer_get_drawing_context (renderer);
-  graphene_rect_t viewport;
+  GdkWindow *window = gsk_renderer_get_window (renderer);
 
   cairo_t *cr;
 
@@ -107,17 +107,13 @@ gsk_cairo_renderer_render (GskRenderer   *renderer,
 
   g_return_if_fail (cr != NULL);
 
-  gsk_renderer_get_viewport (renderer, &viewport);
-
   if (GSK_RENDER_MODE_CHECK (GEOMETRY))
     {
       cairo_save (cr);
       cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
       cairo_rectangle (cr,
-                       viewport.origin.x,
-                       viewport.origin.y,
-                       viewport.size.width,
-                       viewport.size.height);
+                       0, 0,
+                       gdk_window_get_width (window), gdk_window_get_height (window));
       cairo_set_source_rgba (cr, 0, 0, 0.85, 0.5);
       cairo_stroke (cr);
       cairo_restore (cr);
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index 5b8944e..f40a378 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -66,8 +66,6 @@ typedef struct
 {
   GObject parent_instance;
 
-  graphene_rect_t viewport;
-
   GskScalingFilter min_filter;
   GskScalingFilter mag_filter;
 
@@ -84,8 +82,7 @@ typedef struct
 G_DEFINE_ABSTRACT_TYPE_WITH_PRIVATE (GskRenderer, gsk_renderer, G_TYPE_OBJECT)
 
 enum {
-  PROP_VIEWPORT = 1,
-  PROP_WINDOW,
+  PROP_WINDOW = 1,
   PROP_DISPLAY,
   PROP_DRAWING_CONTEXT,
 
@@ -194,10 +191,6 @@ gsk_renderer_set_property (GObject      *gobject,
 
   switch (prop_id)
     {
-    case PROP_VIEWPORT:
-      gsk_renderer_set_viewport (self, g_value_get_boxed (value));
-      break;
-
     case PROP_DISPLAY:
       /* Construct-only */
       priv->display = g_value_dup_object (value);
@@ -220,10 +213,6 @@ gsk_renderer_get_property (GObject    *gobject,
 
   switch (prop_id)
     {
-    case PROP_VIEWPORT:
-      g_value_set_boxed (value, &priv->viewport);
-      break;
-
     case PROP_WINDOW:
       g_value_set_object (value, priv->window);
       break;
@@ -278,22 +267,6 @@ gsk_renderer_class_init (GskRendererClass *klass)
   gobject_class->dispose = gsk_renderer_dispose;
 
   /**
-   * GskRenderer:viewport:
-   *
-   * The visible area used by the #GskRenderer to render its contents.
-   *
-   * Since: 3.90
-   */
-  gsk_renderer_properties[PROP_VIEWPORT] =
-    g_param_spec_boxed ("viewport",
-                       "Viewport",
-                       "The visible area used by the renderer",
-                       GRAPHENE_TYPE_RECT,
-                       G_PARAM_READWRITE |
-                       G_PARAM_STATIC_STRINGS |
-                       G_PARAM_EXPLICIT_NOTIFY);
-
-  /**
    * GskRenderer:display:
    *
    * The #GdkDisplay used by the #GskRenderer.
@@ -344,60 +317,6 @@ gsk_renderer_init (GskRenderer *self)
 }
 
 /**
- * gsk_renderer_set_viewport:
- * @renderer: a #GskRenderer
- * @viewport: (nullable): the viewport rectangle used by the @renderer
- *
- * Sets the visible rectangle to be used as the viewport for
- * the rendering.
- *
- * Since: 3.90
- */
-void
-gsk_renderer_set_viewport (GskRenderer           *renderer,
-                           const graphene_rect_t *viewport)
-{
-  GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
-
-  g_return_if_fail (GSK_IS_RENDERER (renderer));
-
-  if (viewport == NULL)
-    {
-      graphene_rect_init (&priv->viewport, 0.f, 0.f, 0.f, 0.f);
-      g_object_notify_by_pspec (G_OBJECT (renderer), gsk_renderer_properties[PROP_VIEWPORT]);
-      return;
-    }
-
-  if (graphene_rect_equal (viewport, &priv->viewport))
-    return;
-
-  graphene_rect_init_from_rect (&priv->viewport, viewport);
-
-  g_object_notify_by_pspec (G_OBJECT (renderer), gsk_renderer_properties[PROP_VIEWPORT]);
-}
-
-/**
- * gsk_renderer_get_viewport:
- * @renderer: a #GskRenderer
- * @viewport: (out caller-allocates): return location for the viewport rectangle
- *
- * Retrieves the viewport of the #GskRenderer.
- *
- * Since: 3.90
- */
-void
-gsk_renderer_get_viewport (GskRenderer     *renderer,
-                           graphene_rect_t *viewport)
-{
-  GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
-
-  g_return_if_fail (GSK_IS_RENDERER (renderer));
-  g_return_if_fail (viewport != NULL);
-
-  graphene_rect_init_from_rect (viewport, &priv->viewport);
-}
-
-/**
  * gsk_renderer_get_window:
  * @renderer: a #GskRenderer
  *
diff --git a/gsk/gskrenderer.h b/gsk/gskrenderer.h
index 8ae8ff1..46e160d 100644
--- a/gsk/gskrenderer.h
+++ b/gsk/gskrenderer.h
@@ -42,12 +42,6 @@ GDK_AVAILABLE_IN_3_90
 GskRenderer *           gsk_renderer_new_for_window             (GdkWindow               *window);
 
 GDK_AVAILABLE_IN_3_90
-void                    gsk_renderer_set_viewport               (GskRenderer             *renderer,
-                                                                 const graphene_rect_t   *viewport);
-GDK_AVAILABLE_IN_3_90
-void                    gsk_renderer_get_viewport               (GskRenderer             *renderer,
-                                                                 graphene_rect_t         *viewport);
-GDK_AVAILABLE_IN_3_90
 GdkWindow *             gsk_renderer_get_window                 (GskRenderer             *renderer);
 
 GDK_AVAILABLE_IN_3_90
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c
index 2af3e50..6e52a24 100644
--- a/gtk/gtkwindow.c
+++ b/gtk/gtkwindow.c
@@ -7070,14 +7070,6 @@ _gtk_window_set_allocation (GtkWindow           *window,
   child_allocation.width = allocation->width;
   child_allocation.height = allocation->height;
 
-  if (priv->renderer != NULL)
-    {
-      graphene_rect_t viewport;
-
-      graphene_rect_init (&viewport, 0, 0, allocation->width, allocation->height);
-      gsk_renderer_set_viewport (priv->renderer, &viewport);
-    }
-
   get_shadow_width (window, &window_border);
 
   if (_gtk_widget_get_realized (widget))


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