ssd: rework titlebar button rendering

- fix that icons for normal/hovered/rounded buttons are not placed
  exactly the same position
- fix blurry window button icons in scaled outputs

This commit introduces lab_img and scaled_img_buffer and uses them for
rendering icons in the window titlebar. Now the process of rendering
button icons are split into 2 phases: loading with lab_img_load() and
creating scene-nodes for them with scaled_img_buffer_create(). This
might incur some additional overhead since we no longer preload icon
textures, but the rendering of icon only happens for the first window
as backing buffers are shared and the overhead won't be noticeable.
This commit also simplifies the process of centering icon buffer in the
button, by creating icon buffers in a fixed geometry via
lab_img_render().
This commit is contained in:
tokyo4j 2024-11-28 19:21:18 +09:00 committed by Hiroaki Yamamoto
parent 9a3412324d
commit 16dbdc64e5
25 changed files with 647 additions and 391 deletions

View file

@ -61,18 +61,6 @@ struct lab_data_buffer *buffer_adopt_cairo_surface(cairo_surface_t *surface);
struct lab_data_buffer *buffer_create_cairo(uint32_t logical_width,
uint32_t logical_height, float scale);
/*
* Create a buffer from an image surface, for display as an icon.
*
* The surface is either adopted by the buffer (which takes ownership),
* or copied and then destroyed.
*
* This function allows non-ARGB32 source images and converts to
* CAIRO_FORMAT_ARGB32 if needed.
*/
struct lab_data_buffer *buffer_convert_cairo_surface_for_icon(
cairo_surface_t *surface, uint32_t icon_size, float scale);
/*
* Create a buffer which holds (and takes ownership of) raw pixel data
* in pre-multiplied ARGB32 format.