slider: Use clutter_cairo_set_source_color
This cuts down on the denseness of the code. https://bugzilla.gnome.org/show_bug.cgi?id=702825
This commit is contained in:
parent
a01469fb08
commit
8d47afb195
@ -58,33 +58,17 @@ const Slider = new Lang.Class({
|
|||||||
let sliderActiveBorderColor = themeNode.get_color('-slider-active-border-color');
|
let sliderActiveBorderColor = themeNode.get_color('-slider-active-border-color');
|
||||||
let sliderActiveColor = themeNode.get_color('-slider-active-background-color');
|
let sliderActiveColor = themeNode.get_color('-slider-active-background-color');
|
||||||
|
|
||||||
cr.setSourceRGBA (
|
|
||||||
sliderActiveColor.red / 255,
|
|
||||||
sliderActiveColor.green / 255,
|
|
||||||
sliderActiveColor.blue / 255,
|
|
||||||
sliderActiveColor.alpha / 255);
|
|
||||||
cr.rectangle(0, (height - sliderHeight) / 2, width * this._value, sliderHeight);
|
cr.rectangle(0, (height - sliderHeight) / 2, width * this._value, sliderHeight);
|
||||||
|
Clutter.cairo_set_source_color(cr, sliderActiveColor);
|
||||||
cr.fillPreserve();
|
cr.fillPreserve();
|
||||||
cr.setSourceRGBA (
|
Clutter.cairo_set_source_color(cr, sliderActiveBorderColor);
|
||||||
sliderActiveBorderColor.red / 255,
|
|
||||||
sliderActiveBorderColor.green / 255,
|
|
||||||
sliderActiveBorderColor.blue / 255,
|
|
||||||
sliderActiveBorderColor.alpha / 255);
|
|
||||||
cr.setLineWidth(sliderBorderWidth);
|
cr.setLineWidth(sliderBorderWidth);
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
|
|
||||||
cr.setSourceRGBA (
|
|
||||||
sliderColor.red / 255,
|
|
||||||
sliderColor.green / 255,
|
|
||||||
sliderColor.blue / 255,
|
|
||||||
sliderColor.alpha / 255);
|
|
||||||
cr.rectangle(width * this._value, (height - sliderHeight) / 2, width * (1 - this._value), sliderHeight);
|
cr.rectangle(width * this._value, (height - sliderHeight) / 2, width * (1 - this._value), sliderHeight);
|
||||||
|
Clutter.cairo_set_source_color(cr, sliderColor);
|
||||||
cr.fillPreserve();
|
cr.fillPreserve();
|
||||||
cr.setSourceRGBA (
|
Clutter.cairo_set_source_color(cr, sliderBorderColor);
|
||||||
sliderBorderColor.red / 255,
|
|
||||||
sliderBorderColor.green / 255,
|
|
||||||
sliderBorderColor.blue / 255,
|
|
||||||
sliderBorderColor.alpha / 255);
|
|
||||||
cr.setLineWidth(sliderBorderWidth);
|
cr.setLineWidth(sliderBorderWidth);
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
|
|
||||||
@ -92,19 +76,11 @@ const Slider = new Lang.Class({
|
|||||||
let handleX = handleRadius + (width - 2 * handleRadius) * this._value;
|
let handleX = handleRadius + (width - 2 * handleRadius) * this._value;
|
||||||
|
|
||||||
let color = themeNode.get_foreground_color();
|
let color = themeNode.get_foreground_color();
|
||||||
cr.setSourceRGBA (
|
Clutter.cairo_set_source_color(cr, color);
|
||||||
color.red / 255,
|
|
||||||
color.green / 255,
|
|
||||||
color.blue / 255,
|
|
||||||
color.alpha / 255);
|
|
||||||
cr.arc(handleX, handleY, handleRadius, 0, 2 * Math.PI);
|
cr.arc(handleX, handleY, handleRadius, 0, 2 * Math.PI);
|
||||||
cr.fillPreserve();
|
cr.fillPreserve();
|
||||||
if (hasHandleColor && handleBorderWidth) {
|
if (hasHandleColor && handleBorderWidth) {
|
||||||
cr.setSourceRGBA(
|
Clutter.cairo_set_source_color(cr, handleBorderColor);
|
||||||
handleBorderColor.red / 255,
|
|
||||||
handleBorderColor.green / 255,
|
|
||||||
handleBorderColor.blue / 255,
|
|
||||||
handleBorderColor.alpha / 255);
|
|
||||||
cr.setLineWidth(handleBorderWidth);
|
cr.setLineWidth(handleBorderWidth);
|
||||||
cr.stroke();
|
cr.stroke();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user