simon-git: puzzles (main): Ben Harris
Commits to Tartarus hosted VCS
tartarus-commits at lists.tartarus.org
Thu May 15 23:14:01 BST 2025
TL;DR:
6d09ad2 GTK: avoid explicitly using Cairo image surfaces
Repository: https://git.tartarus.org/simon/puzzles.git
On the web: https://git.tartarus.org/?p=simon/puzzles.git
Branch updated: main
Committer: Ben Harris <bjh21 at bjh21.me.uk>
Date: 2025-05-15 23:14:01
commit 6d09ad23b51ec5ce91ab135200315389c5548f8c
web diff https://git.tartarus.org/?p=simon/puzzles.git;a=commitdiff;h=6d09ad23b51ec5ce91ab135200315389c5548f8c;hp=682119abebda4d0dbc233231a18b4735ffdfce10
Author: Ben Harris <bjh21 at bjh21.me.uk>
Date: Thu May 15 23:00:12 2025 +0100
GTK: avoid explicitly using Cairo image surfaces
Where we want to create a surface that's suitable for copying to and
from another surface, it's better to use cairo_surface_create_similar()
based on our window rather than explicitly creating an image surface.
This has two major advantages. First, it means that the surface is one
that can be copied easily to the target window (usually an Xlib surface
when running under X, for instance). Second, the new surface naturally
inherits the device scale from the original.
The first of these means that there's no longer any benefit in having a
separate pixmap when using Cairo, so USE_CAIRO_WITHOUT_PIXMAP becomes
equivalent to USE_CAIRO. The second means that a lot of code for
explicitly handling scale factors can be removed. Essentially the only
remaining reason for recording the scale factor is to detect when it
changes and re-create the backing surface.
There is one place where we still create an image surface, and that's
when running in headless mode to create icons.
gtk.c | 97 ++++++++++++++++++++++---------------------------------------------
1 file changed, 32 insertions(+), 65 deletions(-)
More information about the tartarus-commits
mailing list