osdWindow: Fix blurry level bar

ClutterActor:width is a floating point property, so it will not be
automatically rounded to non-fractional values that properly align
to pixels. To fix the resulting blurriness, add explicit rounding.

https://bugzilla.gnome.org/show_bug.cgi?id=768317
This commit is contained in:
Florian Müllner 2016-07-01 18:54:03 +02:00
parent 775187b2e4
commit 424fa01eca

View File

@ -39,7 +39,7 @@ const LevelBar = new Lang.Class({
this._level = Math.max(0, Math.min(value, 100));
let alloc = this.actor.get_allocation_box();
let newWidth = (alloc.x2 - alloc.x1) * this._level / 100;
let newWidth = Math.round((alloc.x2 - alloc.x1) * this._level / 100);
if (newWidth != this._bar.width)
this._bar.width = newWidth;
}