Commit Graph

20 Commits

Author SHA1 Message Date
Benjamin Otte
fba0b359d4 css: Report sizes as absolute
All PangoFontDescriptions that GTK creates now use
pango_font_description_set_absolute_size().
2018-07-04 06:15:33 +02:00
Benjamin Otte
73b4a62f51 snapshot: Redo debug messages
Instead of every snapshot function having debug messages, have an
explicit gtk_snapshot_push_debug() function that appends a debug node.
2018-04-24 04:06:58 +02:00
Timm Bäder
4f3c7cd48a gsk: Make gsk_text_node_new_with_bounds private
We pulled out the bounds calculation for performance reasons, but the
caller can't know how to properly compute them. Inside gtk+, we can do
that but it's not good enough for public API.
2018-04-21 11:20:15 +02:00
Benjamin Otte
2db43edbd6 snapshot: Don't handle clip anymore
If widgets want to clip things, they now need to do it themselves.

By not taking care of clip, we avoid the need to track clip. And by not
tracking clip, we can avoid all unnecessary cache invalidations that we
were doing for render nodes whenever the clip changed.

And when you are scrolling, the clip changes *a lot*.
2018-04-17 23:21:37 +02:00
Benjamin Otte
278ab3c4de snapshot: Track clip as a rect only 2018-04-05 14:56:38 +02:00
Benjamin Otte
9b83116fcb snapshot: Export gtk_snapshot_append_layout()
This is the equivalent snapshot function to pango_cairo_show_layout().

Not to be confused with gtk_snapshot_render_layout(), which is the
equivalent to gtk_render_layout().
2018-03-26 18:16:36 +02:00
Benjamin Otte
e6d24f4c15 snapshot: Make gtk_snapshot_append_node() take care of offset
Push an offset node when append_node is called. That resets the offset.
2018-03-26 18:16:36 +02:00
Matthias Clasen
d55da3fd44 Use GtkSnapshot getters
We can avoid direct struct access and gtksnapshotprivate.h
everywhere.
2018-03-11 00:31:44 -05:00
Timm Bäder
8a062f4f9a gskpango: Don't create text nodes for clipped text
Measure the text here directly and check if the created node bounds will
be clipped away before even creating the text node.
2018-03-04 19:15:03 +01:00
Chun-wei Fan
a687fd9aeb gtk/gskpango.c: Use g_snprintf()
This fixes the build of GTK+ master on Visual Studio 2013 (and possibly
others) as snprintf() may not be supported even if the required C99
features are supported by the compiler.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-11-21 14:22:23 +08:00
Matthias Clasen
b0e8d8483d More work on text nodes
This commit takes several steps towards rendering text
like we want to.

The creation of the cairo surface and texture is moved
to the backend (in GskVulkanRenderer). We add a mask
shader that is used in the next text pipeline to use
the texture as a mask, like cairo_mask_surface does.
There is a separate color text pipeline that uses the
already existing blend shaders to use the texture as
a source, like cairo_paint does.

The text node api is simplified to have just a single
offset, which determines the left end of the text baseline,
like all our other text drawing APIs.
2017-09-10 14:36:26 -04:00
Chun-wei Fan
1b7f08171a gskpango.c: Include cairo.h consistently
The other source files use "#include <cairo.h>", so we should do
likewise.

https://bugzilla.gnome.org/show_bug.cgi?id=773299
2017-09-06 10:42:32 +08:00
Matthias Clasen
d281cd7498 Fix a compiler warning 2017-09-03 19:53:29 -04:00
Matthias Clasen
59b1206468 Avoid empty nodes another way
Make gsk_text_node_new return NULL if the extents are empty.
2017-09-03 19:35:02 -04:00
Matthias Clasen
7bb202e4a2 Add a workaround for vulkan crashes
I see 'out of memory' errors and crashes inside libvulkan when
creating nodes that have empty bounds and end up in the fallback
paths, like a shadow around an empty text node. Prevent this
by not creating text nodes in that case.
2017-09-03 11:57:21 -04:00
Matthias Clasen
eab50246e1 Only record node names when we should
This is the same thing we do for render nodes elsewhere.
2017-09-03 10:30:32 -04:00
Matthias Clasen
1440bb25de Fix text colors
This was lost in some reshuffling of the gskpango branch.
2017-09-01 14:12:20 -04:00
Matthias Clasen
f199f7b87b Fix the build 2017-09-01 13:42:43 -04:00
Matthias Clasen
a367d34949 Use a text render node in GskPangoRenderer
This pushes the rendering closer to the place where we can
insert a texture atlas for glyph caching.
2017-09-01 13:30:03 -04:00
Matthias Clasen
82e8f3a542 Add a Pango renderer
Copy the PangoCairoRenderer into GTK+, rename it to GskPangoRenderer,
and strip it down far enough to build without private pango apis.
This means we currently don't support hexboxes or shapes.

Currently, this lives in gtk, but it might be nicer to put it
in gsk eventually.
2017-09-01 13:30:03 -04:00