mirror of
https://github.com/labwc/labwc.git
synced 2025-10-29 05:40:24 -04:00
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:
parent
9a3412324d
commit
16dbdc64e5
25 changed files with 647 additions and 391 deletions
|
|
@ -13,14 +13,13 @@ void box_union(struct wlr_box *box_dest, struct wlr_box *box_a,
|
|||
struct wlr_box *box_b);
|
||||
|
||||
/*
|
||||
* Fits and centers a content box (width & height) within a bounding box
|
||||
* (max_width & max_height). The content box is downscaled if necessary
|
||||
* (preserving aspect ratio) but not upscaled.
|
||||
* Fits and centers a content box (width & height) within a bounding box.
|
||||
* The content box is downscaled if necessary (preserving aspect ratio) but
|
||||
* not upscaled.
|
||||
*
|
||||
* The returned x & y coordinates are the centered content position
|
||||
* relative to the top-left corner of the bounding box.
|
||||
*/
|
||||
struct wlr_box box_fit_within(int width, int height, int max_width,
|
||||
int max_height);
|
||||
struct wlr_box box_fit_within(int width, int height, struct wlr_box *bounding_box);
|
||||
|
||||
#endif /* LABWC_BOX_H */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue