mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-04 09:40:19 +00:00
gskpango: Remove bounds rect
We only need this to render shapes and trapezoids, i.e. only when falling back to cairo. Remove code to measure the layout and convert the ink_rect to a graphene_rect_t from gtk_snapshot_append_layout() and do it when drawing shapes and trapezoids instead.
This commit is contained in:
parent
bce4d669ee
commit
98b99201b0
@ -138,11 +138,19 @@ gsk_pango_renderer_draw_trapezoid (PangoRenderer *renderer,
|
|||||||
double x22)
|
double x22)
|
||||||
{
|
{
|
||||||
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
GskPangoRenderer *crenderer = (GskPangoRenderer *) (renderer);
|
||||||
|
PangoLayout *layout;
|
||||||
|
PangoRectangle ink_rect;
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
double x, y;
|
double x, y;
|
||||||
|
|
||||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
layout = pango_renderer_get_layout (renderer);
|
||||||
|
if (!layout)
|
||||||
|
return;
|
||||||
|
|
||||||
|
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||||
|
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||||
|
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||||
|
ink_rect.width, ink_rect.height));
|
||||||
set_color (crenderer, part, cr);
|
set_color (crenderer, part, cr);
|
||||||
|
|
||||||
x = y = 0;
|
x = y = 0;
|
||||||
@ -263,12 +271,16 @@ gsk_pango_renderer_draw_shape (PangoRenderer *renderer,
|
|||||||
if (!handled)
|
if (!handled)
|
||||||
{
|
{
|
||||||
cairo_t *cr;
|
cairo_t *cr;
|
||||||
|
PangoRectangle ink_rect;
|
||||||
|
|
||||||
layout = pango_renderer_get_layout (renderer);
|
layout = pango_renderer_get_layout (renderer);
|
||||||
if (!layout)
|
if (!layout)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
cr = gtk_snapshot_append_cairo (crenderer->snapshot, &crenderer->bounds);
|
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
||||||
|
cr = gtk_snapshot_append_cairo (crenderer->snapshot,
|
||||||
|
&GRAPHENE_RECT_INIT (ink_rect.x, ink_rect.y,
|
||||||
|
ink_rect.width, ink_rect.height));
|
||||||
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
shape_renderer = pango_cairo_context_get_shape_renderer (pango_layout_get_context (layout),
|
||||||
&shape_renderer_data);
|
&shape_renderer_data);
|
||||||
|
|
||||||
@ -483,7 +495,6 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
|||||||
const GdkRGBA *color)
|
const GdkRGBA *color)
|
||||||
{
|
{
|
||||||
GskPangoRenderer *crenderer;
|
GskPangoRenderer *crenderer;
|
||||||
PangoRectangle ink_rect;
|
|
||||||
|
|
||||||
g_return_if_fail (snapshot != NULL);
|
g_return_if_fail (snapshot != NULL);
|
||||||
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
g_return_if_fail (PANGO_IS_LAYOUT (layout));
|
||||||
@ -493,9 +504,6 @@ gtk_snapshot_append_layout (GtkSnapshot *snapshot,
|
|||||||
crenderer->snapshot = snapshot;
|
crenderer->snapshot = snapshot;
|
||||||
crenderer->fg_color = *color;
|
crenderer->fg_color = *color;
|
||||||
|
|
||||||
pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
|
|
||||||
graphene_rect_init (&crenderer->bounds, ink_rect.x, ink_rect.y, ink_rect.width, ink_rect.height);
|
|
||||||
|
|
||||||
pango_renderer_draw_layout (PANGO_RENDERER (crenderer), layout, 0, 0);
|
pango_renderer_draw_layout (PANGO_RENDERER (crenderer), layout, 0, 0);
|
||||||
|
|
||||||
gsk_pango_renderer_release (crenderer);
|
gsk_pango_renderer_release (crenderer);
|
||||||
|
@ -59,7 +59,6 @@ struct _GskPangoRenderer
|
|||||||
GtkWidget *widget;
|
GtkWidget *widget;
|
||||||
GtkSnapshot *snapshot;
|
GtkSnapshot *snapshot;
|
||||||
GdkRGBA fg_color;
|
GdkRGBA fg_color;
|
||||||
graphene_rect_t bounds;
|
|
||||||
|
|
||||||
/* Error underline color for this widget */
|
/* Error underline color for this widget */
|
||||||
GdkRGBA *error_color;
|
GdkRGBA *error_color;
|
||||||
|
@ -4166,8 +4166,6 @@ gtk_text_layout_snapshot (GtkTextLayout *layout,
|
|||||||
crenderer->snapshot = snapshot;
|
crenderer->snapshot = snapshot;
|
||||||
crenderer->fg_color = color;
|
crenderer->fg_color = color;
|
||||||
|
|
||||||
graphene_rect_init (&crenderer->bounds, 0, 0, clip->width, clip->height);
|
|
||||||
|
|
||||||
gtk_text_layout_wrap_loop_start (layout);
|
gtk_text_layout_wrap_loop_start (layout);
|
||||||
|
|
||||||
have_selection = gtk_text_buffer_get_selection_bounds (layout->buffer,
|
have_selection = gtk_text_buffer_get_selection_bounds (layout->buffer,
|
||||||
|
Loading…
Reference in New Issue
Block a user