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
This commit is contained in:
parent
e5130877e7
commit
01b646169c
@ -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);
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user