[gtk+/wip/otte/rendernode: 28/34] roundedbox: Remove _gtk_rounded_box_path()



commit 1f75305c2fd5125b87bd9815567b66b69859cdd5
Author: Benjamin Otte <otte redhat com>
Date:   Tue Dec 13 21:00:28 2016 +0100

    roundedbox: Remove _gtk_rounded_box_path()
    
    Use gsk_rounded_rect_path() instead.
    
    That's a private GSK function, be we can just include its header.

 gtk/gtkcssshadowvalue.c    |   10 ++++++----
 gtk/gtkpopover.c           |    4 +++-
 gtk/gtkrender.c            |    4 +++-
 gtk/gtkrenderbackground.c  |    6 ++++--
 gtk/gtkrenderborder.c      |    8 +++++---
 gtk/gtkroundedbox.c        |   34 ----------------------------------
 gtk/gtkroundedboxprivate.h |    2 --
 7 files changed, 21 insertions(+), 47 deletions(-)
---
diff --git a/gtk/gtkcssshadowvalue.c b/gtk/gtkcssshadowvalue.c
index fa68e85..24e852b 100644
--- a/gtk/gtkcssshadowvalue.c
+++ b/gtk/gtkcssshadowvalue.c
@@ -30,6 +30,8 @@
 #include "gtkrenderprivate.h"
 #include "gtkpango.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #include <math.h>
 
 struct _GtkCssValue {
@@ -653,7 +655,7 @@ draw_shadow (const GtkCssValue   *shadow,
     shadow_cr = cr;
 
   cairo_set_fill_rule (shadow_cr, CAIRO_FILL_RULE_EVEN_ODD);
-  _gtk_rounded_box_path (box, shadow_cr);
+  gsk_rounded_rect_path (box, shadow_cr);
   if (shadow->inset)
     _gtk_rounded_box_clip_path (clip_box, shadow_cr);
 
@@ -808,7 +810,7 @@ draw_shadow_corner (const GtkCssValue     *shadow,
       mask_cr = cairo_create (mask);
       _gtk_rounded_box_init_rect (&corner_box, clip_radius, clip_radius, 2*drawn_rect->width, 
2*drawn_rect->height);
       corner_box.corner[0] = box->corner[corner];
-      _gtk_rounded_box_path (&corner_box, mask_cr);
+      gsk_rounded_rect_path (&corner_box, mask_cr);
       cairo_fill (mask_cr);
       _gtk_cairo_blur_surface (mask, radius, GTK_BLUR_X | GTK_BLUR_Y);
       cairo_destroy (mask_cr);
@@ -914,13 +916,13 @@ _gtk_css_shadow_value_paint_box (const GtkCssValue   *shadow,
 
   if (shadow->inset)
     {
-      _gtk_rounded_box_path (padding_box, cr);
+      gsk_rounded_rect_path (padding_box, cr);
       cairo_clip (cr);
     }
   else
     {
       cairo_set_fill_rule (cr, CAIRO_FILL_RULE_EVEN_ODD);
-      _gtk_rounded_box_path (padding_box, cr);
+      gsk_rounded_rect_path (padding_box, cr);
       outside = spread + clip_radius + MAX (fabs (x), fabs (y));
       clip_box = *padding_box;
       _gtk_rounded_box_grow (&clip_box, outside, outside, outside, outside);
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 5112ba5..298d245 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -114,6 +114,8 @@
 #include "gtkprogresstrackerprivate.h"
 #include "gtksettingsprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #ifdef GDK_WINDOWING_WAYLAND
 #include "wayland/gdkwayland.h"
 #endif
@@ -920,7 +922,7 @@ gtk_popover_fill_border_path (GtkPopover *popover,
   _gtk_rounded_box_apply_border_radius_for_style (&box,
                                                   gtk_style_context_lookup_style (context),
                                                   0);
-  _gtk_rounded_box_path (&box, cr);
+  gsk_rounded_rect_path (&box, cr);
   cairo_fill (cr);
 }
 
diff --git a/gtk/gtkrender.c b/gtk/gtkrender.c
index bd48057..e23d712 100644
--- a/gtk/gtkrender.c
+++ b/gtk/gtkrender.c
@@ -35,6 +35,8 @@
 #include "gtkrendericonprivate.h"
 #include "gtkstylecontextprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 #include "fallback-c89.c"
 
 static void
@@ -994,5 +996,5 @@ gtk_render_content_path (GtkStyleContext *context,
                            _gtk_css_number_value_get (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_BORDER_LEFT_WIDTH), 100)
                            + _gtk_css_number_value_get (_gtk_style_context_peek_property (context, 
GTK_CSS_PROPERTY_PADDING_LEFT), 100));
 
-  _gtk_rounded_box_path (&box, cr);
+  gsk_rounded_rect_path (&box, cr);
 }
diff --git a/gtk/gtkrenderbackground.c b/gtk/gtkrenderbackground.c
index b4091f6..658bfd1 100644
--- a/gtk/gtkrenderbackground.c
+++ b/gtk/gtkrenderbackground.c
@@ -40,6 +40,8 @@
 
 #include <gdk/gdk.h>
 
+#include "gsk/gskroundedrectprivate.h"
+
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
  */
@@ -67,7 +69,7 @@ _gtk_theming_background_paint_color (GtkThemingBackground *bg,
      (gtk_css_style_get_value (bg->style, GTK_CSS_PROPERTY_BACKGROUND_CLIP), 
       n_values - 1));
 
-  _gtk_rounded_box_path (&bg->boxes[clip], cr);
+  gsk_rounded_rect_path (&bg->boxes[clip], cr);
   gdk_cairo_set_source_rgba (cr, bg_color);
   cairo_fill (cr);
 }
@@ -161,7 +163,7 @@ gtk_theming_background_paint_layer (GtkThemingBackground *bg,
 
   cairo_save (cr);
 
-  _gtk_rounded_box_path (
+  gsk_rounded_rect_path (
       &bg->boxes[
           _gtk_css_area_value_get (
               _gtk_css_array_value_get_nth (
diff --git a/gtk/gtkrenderborder.c b/gtk/gtkrenderborder.c
index a848573..7c41861 100644
--- a/gtk/gtkrenderborder.c
+++ b/gtk/gtkrenderborder.c
@@ -36,6 +36,8 @@
 #include "gtkhslaprivate.h"
 #include "gtkroundedboxprivate.h"
 
+#include "gsk/gskroundedrectprivate.h"
+
 /* this is in case round() is not provided by the compiler, 
  * such as in the case of C89 compilers, like MSVC
  */
@@ -373,8 +375,8 @@ render_frame_fill (cairo_t        *cr,
     {
       gdk_cairo_set_source_rgba (cr, &colors[0]);
 
-      _gtk_rounded_box_path (border_box, cr);
-      _gtk_rounded_box_path (&padding_box, cr);
+      gsk_rounded_rect_path (border_box, cr);
+      gsk_rounded_rect_path (&padding_box, cr);
       cairo_fill (cr);
     }
   else
@@ -501,7 +503,7 @@ render_frame_stroke (cairo_t        *cr,
           length += _gtk_rounded_box_guess_length (&stroke_box, i);
         }
 
-      _gtk_rounded_box_path (&stroke_box, cr);
+      gsk_rounded_rect_path (&stroke_box, cr);
       gdk_cairo_set_source_rgba (cr, &colors[0]);
       set_stroke_style (cr, border_width[0], stroke_style, length);
       cairo_stroke (cr);
diff --git a/gtk/gtkroundedbox.c b/gtk/gtkroundedbox.c
index 8231db4..73b9746 100644
--- a/gtk/gtkroundedbox.c
+++ b/gtk/gtkroundedbox.c
@@ -345,40 +345,6 @@ _cairo_ellipsis_negative (cairo_t *cr,
   cairo_set_matrix (cr, &save);
 }
 
-void
-_gtk_rounded_box_path (const GskRoundedRect *box,
-                       cairo_t              *cr)
-{
-  cairo_new_sub_path (cr);
-
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->corner[GSK_CORNER_TOP_LEFT].width,
-                   box->bounds.origin.y + box->corner[GSK_CORNER_TOP_LEFT].height,
-                   box->corner[GSK_CORNER_TOP_LEFT].width,
-                   box->corner[GSK_CORNER_TOP_LEFT].height,
-                   G_PI, 3 * G_PI_2);
-  _cairo_ellipsis (cr, 
-                   box->bounds.origin.x + box->bounds.size.width - box->corner[GSK_CORNER_TOP_RIGHT].width,
-                   box->bounds.origin.y + box->corner[GSK_CORNER_TOP_RIGHT].height,
-                   box->corner[GSK_CORNER_TOP_RIGHT].width,
-                   box->corner[GSK_CORNER_TOP_RIGHT].height,
-                   - G_PI_2, 0);
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->bounds.size.width - 
box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
-                   box->bounds.origin.y + box->bounds.size.height - 
box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
-                   box->corner[GSK_CORNER_BOTTOM_RIGHT].width,
-                   box->corner[GSK_CORNER_BOTTOM_RIGHT].height,
-                   0, G_PI_2);
-  _cairo_ellipsis (cr,
-                   box->bounds.origin.x + box->corner[GSK_CORNER_BOTTOM_LEFT].width,
-                   box->bounds.origin.y + box->bounds.size.height - 
box->corner[GSK_CORNER_BOTTOM_LEFT].height,
-                   box->corner[GSK_CORNER_BOTTOM_LEFT].width,
-                   box->corner[GSK_CORNER_BOTTOM_LEFT].height,
-                   G_PI_2, G_PI);
-
-  cairo_close_path (cr);
-}
-
 double
 _gtk_rounded_box_guess_length (const GskRoundedRect *box,
                                GtkCssSide            side)
diff --git a/gtk/gtkroundedboxprivate.h b/gtk/gtkroundedboxprivate.h
index f4a0910..957bb3e 100644
--- a/gtk/gtkroundedboxprivate.h
+++ b/gtk/gtkroundedboxprivate.h
@@ -56,8 +56,6 @@ void            _gtk_rounded_box_shrink                         (GskRoundedRect
 double          _gtk_rounded_box_guess_length                   (const GskRoundedRect   *box,
                                                                  GtkCssSide              side);
 
-void            _gtk_rounded_box_path                           (const GskRoundedRect   *box,
-                                                                 cairo_t                *cr);
 void            _gtk_rounded_box_path_side                      (const GskRoundedRect   *box,
                                                                  cairo_t                *cr,
                                                                  GtkCssSide              side);


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