Commit Graph

927 Commits

Author SHA1 Message Date
Matthias Clasen
2529385fe4 glyph cache: Reinstate 1 pixel padding
This is necessary to prevent bleeding.
2019-06-04 23:00:01 +00:00
Matthias Clasen
f37274dbb0 gl: Don't leak texture atlases
We need to free the texture atlases, and the
textures backing them.
2019-06-04 23:00:01 +00:00
Matthias Clasen
a3757936c1 gl: Free icon data 2019-06-04 23:00:01 +00:00
Matthias Clasen
adb5df020c glyph cache: Clarify message
We have different kinds of caches now.
2019-06-04 23:00:01 +00:00
Timm Bäder
cf4ff56ca5 gl renderer: Add & use icon cache
Upload small icons all to the same texture atlas.
2019-06-04 23:00:01 +00:00
Timm Bäder
e2ffad7b07 glimage: Only support uploading one region 2019-06-04 23:00:01 +00:00
Timm Bäder
b74bb90c7d gl renderer: Move texture atlas into its own file
We want to reuse the code later.
2019-06-04 23:00:01 +00:00
Timm Bäder
66b081dc9c glglyphcache: Use stb_rect_pack for better glyph packing 2019-06-04 22:42:00 +00:00
Timm Bäder
4b3986ae1f rendernodeimpl: Inline container_node_get_bounds into _new
It's the only caller of the function and we can avoid a second loop over
all child nodes this way.
2019-06-04 16:48:08 +02:00
Matthias Clasen
206970c1e8 Merge branch 'transform-tests' into 'master'
Transform tests

See merge request GNOME/gtk!910
2019-06-03 16:41:17 +00:00
Matthias Clasen
4ed57449ba gsk: Fix printing of identity transforms
These need to print as "none", otherwise
the parser does not accept them.
2019-06-03 16:20:38 +00:00
Matthias Clasen
d93fb5a3fa Cosmetics
Fix up a variable name mismatch in GskTransform docs.
2019-06-03 16:15:16 +00:00
Benjamin Otte
4efa457a63 Merge branch 'for-master' into 'master'
rendernodeparser: Handle Cairo being stupid

See merge request GNOME/gtk!909
2019-06-03 15:45:20 +00:00
Timm Bäder
a1161456ff GskTransform: NULL is a valid transform 2019-06-03 17:36:31 +02:00
Benjamin Otte
d81cf5a443 rendernodeparser: Handle Cairo being stupid
Cairo writes to finished streams, so we have to make sure to keep the
stream around to allow it to do that.
2019-06-03 17:22:11 +02:00
Timm Bäder
a0cb68283d gl renderer: Dont' memcmp() a GskTransform 2019-06-03 17:07:26 +02:00
Timm Bäder
d228f4bb76 gl renderer: Don't ref transform twice
That's gonna leak it otherwise.
2019-06-03 17:03:02 +02:00
Timm Bäder
3a49c0eb2f glyphcache: Don't leak hashtables 2019-06-03 17:03:02 +02:00
Timm Bäder
05ca772631 GskTransform: Ignore identity transforms
We often end up with e.g. a scale of 1 or a translation by 0/0. Ignore
those transforms since they don't do anything.
2019-06-03 17:03:02 +02:00
Timm Bäder
efe9bba343 gl renderer: Ref transform before using it
Fixes #1929
2019-06-03 17:03:02 +02:00
Timm Bäder
fb1f929c38 gl renderer: Dont' unnecessarily to_matrix transforms 2019-06-03 17:03:02 +02:00
Matthias Clasen
3c6c07e94d gl: Avoid a memdup in glyph upload
We don't need to dup the memory here if we
set up the image surface properly. This won't
matter for most glyphs, but some of them can
be big.
2019-06-03 02:47:52 +00:00
Matthias Clasen
e0803f039f gl: Fix glyph cache aging
The logic here seems faulty. We want to keep
a timestamp that tells us when the glyph was
last used, so always update the timestamp.

And whenever we use a glyph, it turns 'young'
again, so remove it from the old pixels
accounting.

The (MAX_AGE, MAX_AGE+CHECK_INTERVAL) interval
is only relevant to prevent us from turning
a cached glyph old more than once, and that
is already taken care of.
2019-06-03 02:09:04 +00:00
Matthias Clasen
3059d76b4c Add code to dump out the glyph caches 2019-06-03 02:09:04 +00:00
Matthias Clasen
0a09b8dca7 gl: Improve cache dropping code
There was a TODO here to avoid iterating the
glyphs multiple times, so avoid that. And
actually log the number of glyphs that was dropped.
2019-06-03 02:09:04 +00:00
Matthias Clasen
ad2a1c92ce gl: Improve glyph cache logging
Use g_message to be consistent, and make the
message fit a line.
2019-06-03 02:09:04 +00:00
Matthias Clasen
fd4182f5c5 gl: Log creation of glyph caches
Now that they can be of different sizes, this
is somewhat interesting.
2019-06-03 02:09:04 +00:00
Matthias Clasen
a64dfb1dfc gl: Make the glyph cache survive big glyphs
Create an extra atlas of just the right size for
each huge glyph. Not pretty, but works.
2019-06-03 02:08:36 +00:00
Benjamin Otte
7e9cb07a92 Merge branch 'for-master' into 'master'
For master

See merge request GNOME/gtk!903
2019-06-03 00:22:40 +00:00
Benjamin Otte
5a0c8805fc transform: Coalesce similar transforms
If somebody does a transform like
  scale(5) scale(10) translate(1,1) translate(5,0)
store it instead as
  scale(50) translate(6,1)
This way, less memory is consumed and transforms are easier to read.

In particular, this simplifies the typical transforms we do in GTK,
which are just one translation after another.
2019-06-02 21:18:56 +02:00
Matthias Clasen
1a4e360c2c Don't generate mipmaps needlessly
GL_LINEAR doesn't use mipmaps, so don't generate them.
2019-06-02 18:29:11 +00:00
Benjamin Otte
69629ebb1a transform: Treat 0 perspective transforms as identity
This happens if you apply a perspective transform and its inverse, which
is the negative version of the perspective.
2019-06-02 15:12:37 +02:00
Timm Bäder
a51b694314 gl renderer: Remove homegrown transform_bounds code
GskTransform can do this for us now.
2019-06-02 11:43:06 +02:00
Timm Bäder
b6cc774312 transform: Add G_GNUC_WARN_UNUSED_RESULT annotations
These functions return the new transform so their return value should
really never be ignored.
2019-06-02 10:33:30 +02:00
Timm Bäder
db548ee2a0 gl renderer: Fix scale computation
We don't need to just look at the scale of the new modelview matrix, but
at the one we get when multiplying the new one with the current one.

Test case attached.
2019-06-02 10:25:39 +02:00
Timm Bäder
f999572e8f gl renderer: Use GskTransform in render ops builder
for the modelview matrix. We need this later.
2019-06-02 10:12:09 +02:00
Timm Bäder
f1996783ec gl renderer: Fix rounded rect intersection code
Test case attached.

Fixes #1920
2019-06-02 08:31:44 +02:00
Niels De Graef
df9aed6c61 Fix some GObject introspection annotations
Fixes several warnings by the GIR compiler.
2019-05-30 20:34:43 +02:00
Benjamin Otte
53f23f8ae9 rendernodeparser: Handle empty Cairo nodes
Cairo nodes can contain a NULL surface if they have never been drawn to.
Make this the default Cairo node.
2019-05-30 15:32:36 +02:00
Benjamin Otte
1e0c0c0ba7 rendernodeparser: Parse cairo script
Use cairo-script-interpreter to parse the scripts that generate cairo
nodes.

This requires libcairoscriptinterpreter.so to work properly, but if
it isn't found we disable this (unimportant for normal functioning)
code and just emits a parser warning.
The testsuite requires it however or it will fail.

A new test is included that tests all of this.
2019-05-30 15:32:36 +02:00
Timm Bäder
78ee4c0677 gl renderer: Properly flip scaled fallback nodes
Fixes cairo nodes in hidpi setups
2019-05-30 09:12:45 +02:00
Benjamin Otte
89fb752a8f css: Use %f, not %.17f
The testusite failures explain why:
We don't want to print "1.00000000000000000", but "1".
2019-05-29 14:30:13 +02:00
Benjamin Otte
9ee2b23176 rendernodeparser: Handle repeating linear gradients
Just handle them like regular gradients, only name them differently.
2019-05-29 07:14:31 +02:00
Benjamin Otte
d71c196c5c css: Don't print numbers with exponent
CSS does not do exponents, so printing numbers close to 0 as 1.234e-15
does not work.

Also up the accuracy to 17 digits because that's what everyone else
uses.
2019-05-29 07:14:31 +02:00
Benjamin Otte
6e15538328 broadway: Handle Cairo nodes with NULL surfaces 2019-05-29 07:14:31 +02:00
Matthias Clasen
848f658b32 Trivial 2019-05-26 00:08:39 -04:00
Benjamin Otte
928c85ccc3 rendernodeparser: Parse Cairo nodes
We also print the script, but we don't parse it yet.
2019-05-26 00:50:13 +02:00
Benjamin Otte
fda643952d rendernode: Remove unused function 2019-05-25 23:50:46 +02:00
Timm Bäder
fb86fd900e gl renderer: Make creating render targets easier 2019-05-23 18:42:00 +02:00
Timm Bäder
f32756e705 gl renderer: Remove some unused api form the GLDriver 2019-05-23 18:42:00 +02:00