[gnome-shell] Fix fuzziness for application icons



commit 01b646169ca1a5f3a7abe5840c62eb251dcbe37f
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Fri Feb 11 14:37:27 2011 -0500

    Fix fuzziness for application icons
    
    - Center the icon texture in the area allocated for it, and always give
      the nominal size - avoid off-by-one scaling if the parent allocated
      a little less or more size than we wanted.
    - Use Math.floor() when centering horizontally to avoid allocation
      at a half pixel.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=642124

 js/ui/iconGrid.js |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/iconGrid.js b/js/ui/iconGrid.js
index 4bd6485..91cc0c3 100644
--- a/js/ui/iconGrid.js
+++ b/js/ui/iconGrid.js
@@ -63,6 +63,7 @@ BaseIcon.prototype = {
         let iconSize = availHeight;
 
         let [iconMinHeight, iconNatHeight] = this._iconBin.get_preferred_height(-1);
+        let [iconMinWidth, iconNatWidth] = this._iconBin.get_preferred_width(-1);
         let preferredHeight = iconNatHeight;
 
         let childBox = new Clutter.ActorBox();
@@ -82,12 +83,10 @@ BaseIcon.prototype = {
             this._name.allocate(childBox, flags);
         }
 
-        let iconPadding = (availWidth - iconSize) / 2;
-
-        childBox.x1 = iconPadding;
-        childBox.y1 = 0;
-        childBox.x2 = availWidth - iconPadding;
-        childBox.y2 = iconSize;
+        childBox.x1 = Math.floor((availWidth - iconNatWidth) / 2);
+        childBox.y1 = Math.floor((iconSize - iconNatHeight) / 2);
+        childBox.x2 = childBox.x1 + iconNatWidth;
+        childBox.y2 = childBox.y1 + iconNatHeight;
         this._iconBin.allocate(childBox, flags);
     },
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]