Search
Monday, 14th of May 2018, 15:56:15 UTC
15:56:58
loke
My code is based on some xrender examples in C that I started with
15:57:24
oleo
that's already too advanced, i just did some simple windows with X
15:57:35
oleo
didn't even cover the color stuff
15:57:40
loke
Now... the "pen" object (the one that holds the foreground colour) is created with a pixmap as its backing object. After creating that picture, the pixmap is freed.
15:57:49
loke
So when the hell is the picture freed if I don't do it myself? :-)
15:58:15
loke
If it's freed when the X connection is closed, then I can just tie the cached pen to the XDisplay object and be done with it.
15:58:48
oleo
err, afaik what you call drawing to is just X copying it to it's hardware
15:59:01
oleo
after it you don't need it even anymore
15:59:36
oleo
so what X does is just display it
16:00:01
oleo
so you can free the pixmap just after invoking the call to X
16:00:57
oleo
if you want to free the image, as in alter it or destroy it (like setting all bits to zero etc) then you have to have another pixmap of the same bounds, drawn onto the same window
16:01:10
oleo
the image that is displayed i mean
16:01:54
oleo
with pixmap X does shallow copying i think
16:03:46
loke
Yeah, that's not the issue. The problem is when/if the Xrender picture gets freed if I don't do it manually.
16:04:58
oleo
yes, the hw bits won't get freed
16:05:32
oleo
unless some other call is intevening on the same display area of the window
16:06:09
oleo
it can even get garbled by just you changing window focus
16:07:40
oleo
i think there are ways to guard against that tho
16:08:09
loke
OK, I looked at the old font renderer that also uses xrender
16:08:27
loke
they tie that picture to the plist of the GC
16:08:46
loke
So I'm going to assume that they understood it, and that the picture gets freed when the GC is dropped.
16:08:51
loke
Because they have no code to free them.
16:09:04
oleo
if you drop the gc then yes it can get garbled
16:09:14
oleo
unless you unmap it directly after it
16:09:39
oleo
the rule is as many gc's as needed but not too much....
16:09:54
oleo
you can switch gc's on the fly for some stuff
16:10:17
oleo
say for color switching etc...
16:10:41
loke
Wow. Font rendering is so much faster now.
16:11:14
oleo
gc is just copied into the hw bits
16:11:36
oleo
and those bits are just maintained as there is that gc
16:11:49
oleo
otherwise they are open for garbling
16:13:16
loke
https://github.com/lokedhs/McCLIM/commit/5bed002252e20372a1fb6139e67d7c066332cff9
16:13:19
oleo
say you can have as many gcs as fonts, for font switching
16:13:33
oleo
but don't include all fonts ofc
16:13:35
loke
I don't manage the GC's. Those come from the CLIM side.
16:13:47
loke
I am caching the glyphsets though.
16:14:13
loke
Well, I only cache glyphsets for untransformed glyphs.
16:15:41
oleo
what do you do for the transformed ones ?
16:17:16
loke
oleo: Compute them, draw them, and drop the glyphset
16:18:36
loke
Here: https://github.com/lokedhs/McCLIM/blob/freetype2/Extensions/fonts/freetype.lisp#L321
16:20:06
oleo
so gcs are one and pixmaps are another where X does direct copying
16:31:33
oleo
good night, have a nice dream
16:32:04
oleo
of glyphsets dancin around....
Tuesday, 15th of May 2018, 3:56:15 UTC