[mutter/23-fix-icon-scaling: 4/4] theme: Fix icon scaling
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/23-fix-icon-scaling: 4/4] theme: Fix icon scaling
- Date: Sat, 3 Mar 2018 15:49:18 +0000 (UTC)
commit 67bf936ef8a963cfe3d55913541fbce05dfa0878
Author: Egmont Koblinger <egmont gmail com>
Date: Thu Mar 1 17:08:41 2018 +0100
theme: Fix icon scaling
When painting the titlebar, button icons that aren't available in the
desired size need to be scaled. However the current code inverses the
scale factor, with the result that the adjusted icons are much worse
than the original icons, whoops.
This went unnoticed for a long time given that most icons are availa-
ble in the desired 16x16 size, and the most likely exceptions - window
icons - are not shown by default.
https://gitlab.gnome.org/GNOME/mutter/issues/23
src/core/window.c | 4 ++--
src/ui/theme.c | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 1a277ff12..f4ed4633b 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -446,12 +446,12 @@ meta_window_class_init (MetaWindowClass *klass)
obj_props[PROP_ICON] =
g_param_spec_pointer ("icon",
"Icon",
- "96 pixel sized icon",
+ "Normal icon, usually 96x96 pixels",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_props[PROP_MINI_ICON] =
g_param_spec_pointer ("mini-icon",
"Mini Icon",
- "16 pixel sized icon",
+ "Mini icon, usually 16x16 pixels",
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);
obj_props[PROP_DECORATED] =
g_param_spec_boolean ("decorated",
diff --git a/src/ui/theme.c b/src/ui/theme.c
index 2f527fb24..2b3cd5eaf 100644
--- a/src/ui/theme.c
+++ b/src/ui/theme.c
@@ -885,13 +885,13 @@ meta_frame_layout_draw_with_style (MetaFrameLayout *layout,
width = cairo_image_surface_get_width (surface) / scale;
height = cairo_image_surface_get_height (surface) / scale;
- x = button_rect.x + (button_rect.width - width) / 2;
- y = button_rect.y + (button_rect.height - height) / 2;
+ x = button_rect.x + (button_rect.width - layout->icon_size) / 2;
+ y = button_rect.y + (button_rect.height - layout->icon_size) / 2;
cairo_translate (cr, x, y);
cairo_scale (cr,
- width / layout->icon_size,
- height / layout->icon_size);
+ layout->icon_size / width,
+ layout->icon_size / height);
cairo_set_source_surface (cr, surface, 0, 0);
cairo_paint (cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]