[gtk/deprecate-render: 19/36] render: Use the new layout render api
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/deprecate-render: 19/36] render: Use the new layout render api
- Date: Sun, 9 Oct 2022 12:13:09 +0000 (UTC)
commit 141041f4a551b36d138dc15395952e284f5f9243
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Oct 8 15:17:27 2022 -0400
render: Use the new layout render api
gtk/deprecated/gtkrender.c | 28 ++++++----------------------
1 file changed, 6 insertions(+), 22 deletions(-)
---
diff --git a/gtk/deprecated/gtkrender.c b/gtk/deprecated/gtkrender.c
index 3256c03908..3c9012ec49 100644
--- a/gtk/deprecated/gtkrender.c
+++ b/gtk/deprecated/gtkrender.c
@@ -30,6 +30,7 @@
#include "gtkrendericonprivate.h"
#include "gtkrenderborderprivate.h"
#include "gtkrenderbackgroundprivate.h"
+#include "gtkrenderlayoutprivate.h"
#include "gtkstylecontextprivate.h"
#include "gtksettings.h"
@@ -667,33 +668,16 @@ gtk_snapshot_render_layout (GtkSnapshot *snapshot,
double y,
PangoLayout *layout)
{
- const bool needs_translate = (x != 0 || y != 0);
- const GdkRGBA *fg_color;
- GtkCssValue *shadows_value;
- gboolean has_shadow;
+ GtkCssBoxes boxes;
g_return_if_fail (snapshot != NULL);
g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
g_return_if_fail (PANGO_IS_LAYOUT (layout));
- if (needs_translate)
- {
- gtk_snapshot_save (snapshot);
- gtk_snapshot_translate (snapshot, &GRAPHENE_POINT_INIT (x, y));
- }
-
- fg_color = gtk_css_color_value_get_rgba (_gtk_style_context_peek_property (context,
GTK_CSS_PROPERTY_COLOR));
-
- shadows_value = _gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_SHADOW);
- has_shadow = gtk_css_shadow_value_push_snapshot (shadows_value, snapshot);
-
- gtk_snapshot_append_layout (snapshot, layout, fg_color);
-
- if (has_shadow)
- gtk_snapshot_pop (snapshot);
-
- if (needs_translate)
- gtk_snapshot_restore (snapshot);
+ gtk_css_boxes_init_border_box (&boxes,
+ gtk_style_context_lookup_style (context),
+ x, y, 0, 0);
+ gtk_css_style_snapshot_layout (&boxes, snapshot, x, y, layout);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]