[gnome-shell] StIcon: Center the icon rather than scaling it up
- From: Owen Taylor <otaylor src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] StIcon: Center the icon rather than scaling it up
- Date: Fri, 12 Nov 2010 22:37:57 +0000 (UTC)
commit 3ca86b2197335b5c592f4652cc2778a59e1aa42d
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Nov 2 17:35:22 2010 -0400
StIcon: Center the icon rather than scaling it up
Scaling up icons from the loaded size to a larger size is uniformly
ugly and results in a long series of "fuzzy icon" bugs. It's better
to just load at the specified size and center. (Centering can be
overridden by packing not-fill in the parent container.)
https://bugzilla.gnome.org/show_bug.cgi?id=633865
src/st/st-icon.c | 15 +++++++++++++++
1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/src/st/st-icon.c b/src/st/st-icon.c
index 1e92955..1716986 100644
--- a/src/st/st-icon.c
+++ b/src/st/st-icon.c
@@ -183,6 +183,21 @@ st_icon_allocate (ClutterActor *actor,
ClutterActorBox content_box;
st_theme_node_get_content_box (theme_node, box, &content_box);
+
+ /* Center the texture in the allocation; scaling up the icon from the size
+ * we loaded it at is just a bad idea and probably accidental. Main downside
+ * of doing this is that it may not be obvious that they have to turn off
+ * fill to align the icon non-centered in the parent container.
+ *
+ * We don't use _st_allocate_fill() for a bit of efficiency and because we
+ * expect to get rid of the child actor in favor of a CoglTexture in the
+ * future.
+ */
+ content_box.x1 = (int)(0.5 + content_box.x1 + (content_box.x2 - content_box.x1 - priv->icon_size) / 2.);
+ content_box.x2 = content_box.x1 + priv->icon_size;
+ content_box.y1 = (int)(0.5 + content_box.y1 + (content_box.y2 - content_box.y1 - priv->icon_size) / 2.);
+ content_box.y2 = content_box.y1 + priv->icon_size;
+
clutter_actor_allocate (priv->icon_texture, &content_box, flags);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]