summaryrefslogtreecommitdiff
path: root/gsk
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'transform-work' into 'master'Matthias Clasen2021-09-182-36/+310
|\ | | | | | | | | transform: Add sections See merge request GNOME/gtk!3974
| * Add gsk_transform_to_2d_componentsMatthias Clasen2021-09-182-13/+114
| | | | | | | | | | | | | | This function decomposes a general 2D transform into skew, scale, rotation and translation. Tests included.
| * gsk: Add skew transformsMatthias Clasen2021-09-172-20/+179
| | | | | | | | | | | | Add gsk_transform_skew() to make our transform api more complete wrt to what you would expect for a graphics api.
| * transform: Add sectionsMatthias Clasen2021-09-171-8/+22
| | | | | | | | This makes the code easier to navigate (for me).
* | Revert "gsk: Stop enlarging text bounding boxes"Matthias Clasen2021-09-171-4/+4
| | | | | | | | | | | | | | | | | | This reverts commit 87af45403ace1047b91ddbab98d9d5a5e15b84eb. I've found that this change is needed to ensure that the bounding boxes of text nodes encompass all the glyphd drawing. Without it, we overdraw the widget boundaries and cut off glyphs.
* | ngl: Use exact device scales for glyphsMatthias Clasen2021-09-171-15/+12
|/ | | | | | | | | We are rendering the glyphs on a larger surface, and we should avoid introducing unnecessary rounding errors here. Also, I've found that we always need to enlarge the surface by one pixels in each direction to avoid cutting off the tops of large glyphs.
* Fix glyph cache entry sizingMatthias Clasen2021-09-171-2/+8
| | | | The subpixel-positioned glyph extends on both sides.
* gsk: Stop enlarging text bounding boxesMatthias Clasen2021-09-171-4/+4
| | | | | This should not be necessary and only serves to make the actual bugs harder to find.
* transform: Improve docsMatthias Clasen2021-09-171-0/+7
| | | | Add an example for reconstructing transforms.
* gsk: Handle 2D transforms betterMatthias Clasen2021-09-171-1/+12
| | | | | | | | | For 2D transforms, we can read the scale factors more directly off the matrix. This should eventually be moved out into a function to decompose a 2D transform into scale + rotation + skew + translation.
* rendernodeparser: Avoid gdk_texture_new_for_pixbufMatthias Clasen2021-09-171-12/+5
| | | | | | We can just use gdk_texture_new_from_bytes here now. Update affected test output.
* rendernodeparser: Use gdk_texture_save_to_png_bytesMatthias Clasen2021-09-171-8/+5
| | | | | | Avoid cairo, and use our own api for saving png data. Update affected test output.
* rendernodeparser: Handle is_color attribute for glyphsBenjamin Otte2021-09-161-1/+10
|
* ngl: Avoid offscreens in more casesMatthias Clasen2021-09-161-0/+3
| | | | | | | | | | | | | | | We avoid an offscreen if we know the child node can 'handle' the transform. Shadow nodes can if their child node does - either the child node is a text node in which case the shortcuts we take for shadow nodes will work fine with the transform (we just render the text node offset), or the child is not a text node, in which case we render the shadow to an offscreen anyway. This change makes the label-shadows reftest pass with the GL renderer, not by fixing the issue but by avoiding it.
* ngl: Improve shortcuts for shadow nodesMatthias Clasen2021-09-161-9/+12
| | | | | | | | For shadow nodes, we try pretty hard to avoid rendering shadows, and and we have a shortcut that just renders text offset, but we can try harder to do nothing - if the text is offset by zero, we don't need to draw it at all.
* ngl Fix bottom-right border render failureBenjamin Otte2021-09-161-1/+1
| | | | | | The wrong index was used for offsetting the bottom border rect. Test included.
* ngl: Fix opacity handlingMatthias Clasen2021-09-161-9/+64
| | | | | | | | We need to use an offscreen whenever there is overlapping children somewhere in the tree below, just checking the direct child of the opacity node is not enough. Fixes: #4261
* ngl: Avoid cairo_to_png in debug outputMatthias Clasen2021-09-153-32/+29
| | | | | Just use a GL texture and gdk_texture_save_to_png, it was made for this.
* Annotate gsk_cairo_blur_compute_pixels as constMatthias Clasen2021-09-141-1/+1
|
* Annotate gsk_ngl_uniform_state_align as pureMatthias Clasen2021-09-141-1/+1
|
* Annotate gsk_rounded_rect_is_circular as pureMatthias Clasen2021-09-141-2/+2
| | | | And also mark gsk_rounded_rect_to_string as malloc.
* Annotate pango_glyph_string_num_glyphs as pureMatthias Clasen2021-09-141-1/+1
|
* ngl: Simplify and unbug texture downloadBenjamin Otte2021-09-131-19/+8
| | | | | If we can't handle the texture, always just download_texture() it, that way we are sure it's a memory texture.
* texture: Add GdkMemoryConversion private enumBenjamin Otte2021-09-122-2/+2
| | | | | Now gdk_memory_convert() converts to one of these conversions instead of re(ab)using parts of the GdkMemoryFormat enum.
* Merge branch 'wip/otte/for-master' into 'master'Benjamin Otte2021-09-111-8/+12
|\ | | | | | | | | rendernode: Write the whole node See merge request GNOME/gtk!3938
| * rendernode: Write the whole nodeBenjamin Otte2021-09-111-8/+12
| | | | | | | | | | It turns out g_output_stream_write_bytes() does not write the bytes. It should be renamed to g_output_stream_write_some_of_the_bytes() maybe.
* | Add vectorized half-float conversionMatthias Clasen2021-09-103-11/+180
|/ | | | | | | | We can't make the -4 versions inline, since we use ifuncs for them, so make vectorized versions. Test included.
* Avoid hand-rolled color glyph informationMatthias Clasen2021-09-051-10/+1
| | | | | | Followup to b244f31337eea. Pango provides color glyph information for us now, so we don't need to steal a bit anymore.
* Revert "gsk: Add font options to text nodes"Matthias Clasen2021-09-042-152/+20
| | | | This reverts commit f1347f5841ea526c7016a8fbd329b45001812a23.
* Revert "gsk: Add font options to the glyph cache"Matthias Clasen2021-09-042-12/+1
| | | | This reverts commit 6599cb001fa184ed224c655519d659f168e9face.
* Revert "gsk: Pass font options along"Matthias Clasen2021-09-041-7/+0
| | | | This reverts commit 299c7c35148e49369c151aa4eae6066d09e9d4b4.
* gsk: Pass font options alongMatthias Clasen2021-09-031-0/+7
| | | | | Use the font options from the text node when looking up glyphs.
* gsk: Add font options to the glyph cacheMatthias Clasen2021-09-032-1/+12
| | | | | | | | | | | | | | The cairo_t that we create to render glyphs for the glyph cache needs to match the font options that are supposedly governing how glyphs are drawn. Since we allow font options to be different per widget in gtk, we need to have them at least at the level of individual render nodes. Adding them to the lookup key for the glyph cache has the side effect of solving another problem: We are not flushing the cache when font options change.
* gsk: Add font options to text nodesMatthias Clasen2021-09-032-20/+152
| | | | | | | | | Since font options affect how the glyphs get rendered, we need to pass the font options down from the gtk level to where the glyph cache is populated. Add a new gsk_text_node_new_full api that takes a cairo_font_options_t in addition to the other parameters.
* Use color glyph information from Pangocolor-glyph-infoMatthias Clasen2021-09-012-53/+3
| | | | | | Pango now sets a bit in PangoGlyphVisAttr for color glyphs, so we don't need to do that ourselves anymore.
* rendernode: Add (de)serialization support for render nodesBenjamin Otte2021-08-301-0/+111
| | | | This includes our own new mime type for render nodes, too.
* rendernode: Add GValue functions for render nodesBenjamin Otte2021-08-302-1/+126
| | | | | | This is needed as GskRenderNode is its own fundamental type and has its own GValue infrastructure. And I want to put render nodes into the clipboard which uses GValues.
* ngl: Avoid a coordinate overflowtext-selection-missingMatthias Clasen2021-08-281-1/+4
| | | | | | | This was showing up as big text selections going missing sporadically. Fixes: #4214
* gsk: Drop the gl rendererMatthias Clasen2021-08-2052-10742/+7
| | | | | | ngl supports all the same platforms as gl now, and has seen more improvements in the last cycle.
* Merge branch 'wip/otte/for-master' into 'master'Benjamin Otte2021-08-081-1/+3
|\ | | | | | | | | ngl: Make current when unrealizing See merge request GNOME/gtk!3835
| * ngl: Make current when unrealizingBenjamin Otte2021-08-081-1/+3
| | | | | | | | | | The profiler (at least) discards GL objects and we want to discard them on the right context.
* | Merge branch 'wip/exalm/shadow-extents' into 'master'Matthias Clasen2021-08-051-5/+5
|\ \ | | | | | | | | | | | | Shrink shadow extents See merge request GNOME/gtk!3825
| * | Shrink shadow extentsAlexander Mikhaylenko2021-08-041-5/+5
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | Long time ago, Cairo shadows in both GTK3 and 4 were drawn at a size about twice their radius. Eventually this was fixed but the shadow extents are still calculated for the previous size and appear unreasonably large: for example, 141px for a 50px radius shadow. This can get very noticeable in places such as invisible window frame which gets included into screenshots. https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/3419 just divides the radius by 2 when drawing a shadow with Cairo, do the same when calculating extents. See https://gitlab.gnome.org/GNOME/gtk/-/issues/3841
* | Merge branch 'color-glyph-fixes' into 'master'Matthias Clasen2021-07-312-27/+88
|\ \ | | | | | | | | | | | | | | | | | | gsk: Make color glyphs Closes #4141 See merge request GNOME/gtk!3812
| * | gsk: Use harfbuzz for color fontsMatthias Clasen2021-07-311-105/+45
| | | | | | | | | | | | | | | | | | | | | harfbuzz has all the information we need, so we can avoid poking directly at freetype apis. Also drop the caching of color glyph information until it turns out to be a problem.
| * | gsk: Cache per-glyph color informationMatthias Clasen2021-07-311-1/+52
| | | | | | | | | | | | | | | | | | We don't really want to load the bitmaps every time we create a render node, so do it once and cache the information on the PangoFont.
| * | ngl: Use per-glyph color informationMatthias Clasen2021-07-311-10/+18
| | | | | | | | | | | | | | | | | | Decide per-glyph whether we need color nor not. Fixes: #4141
| * | gsk: Mark color glyphsMatthias Clasen2021-07-311-2/+64
| |/ | | | | | | | | Steal a bit from PangoGlyphVisAttr to mark glyphs that have color.
* | ngl: Bypass pango for glyph cache renderingMatthias Clasen2021-07-301-13/+5
|/ | | | | We can just use cairo directly here, and cut out some layers of pango in the middle.
* ngl: CosmeticsMatthias Clasen2021-07-261-2/+2
| | | | | Use the macro we already have to check that colors are fully transparent.