StThemeNode: use (out caller-allocates) on ClutterColor-returning methods
Properly annotate the themenode methods that return ClutterColors, and update their JS callers to take advantage of that. https://bugzilla.gnome.org/show_bug.cgi?id=642295
This commit is contained in:
@ -189,10 +189,8 @@ BoxPointer.prototype = {
|
||||
let halfBorder = borderWidth / 2;
|
||||
let halfBase = Math.floor(base/2);
|
||||
|
||||
let borderColor = new Clutter.Color();
|
||||
themeNode.get_color('-arrow-border-color', borderColor);
|
||||
let backgroundColor = new Clutter.Color();
|
||||
themeNode.get_color('-arrow-background-color', backgroundColor);
|
||||
let borderColor = themeNode.get_color('-arrow-border-color');
|
||||
let backgroundColor = themeNode.get_color('-arrow-background-color');
|
||||
|
||||
let [width, height] = area.get_surface_size();
|
||||
let [boxWidth, boxHeight] = [width, height];
|
||||
|
@ -29,10 +29,9 @@ function _onVertSepRepaint (area)
|
||||
let cr = area.get_context();
|
||||
let themeNode = area.get_theme_node();
|
||||
let [width, height] = area.get_surface_size();
|
||||
let stippleColor = new Clutter.Color();
|
||||
let stippleColor = themeNode.get_color('-stipple-color');
|
||||
let stippleWidth = themeNode.get_length('-stipple-width');
|
||||
let x = Math.floor(width/2) + 0.5;
|
||||
themeNode.lookup_color('-stipple-color', false, stippleColor);
|
||||
cr.moveTo(x, 0);
|
||||
cr.lineTo(x, height);
|
||||
Clutter.cairo_set_source_color(cr, stippleColor);
|
||||
|
@ -89,8 +89,7 @@ URLHighlighter.prototype = {
|
||||
this.actor = new St.Label({ reactive: true, style_class: 'url-highlighter' });
|
||||
this._linkColor = '#ccccff';
|
||||
this.actor.connect('style-changed', Lang.bind(this, function() {
|
||||
let color = new Clutter.Color();
|
||||
let hasColor = this.actor.get_theme_node().get_color('link-color', color);
|
||||
let [hasColor, color] = this.actor.get_theme_node().lookup_color('link-color', false);
|
||||
if (hasColor) {
|
||||
let linkColor = color.to_string().substr(0, 7);
|
||||
if (linkColor != this._linkColor) {
|
||||
|
@ -151,8 +151,7 @@ PopupBaseMenuItem.prototype = {
|
||||
_onRepaintDot: function(area) {
|
||||
let cr = area.get_context();
|
||||
let [width, height] = area.get_surface_size();
|
||||
let color = new Clutter.Color();
|
||||
area.get_theme_node().get_foreground_color(color);
|
||||
let color = area.get_theme_node().get_foreground_color();
|
||||
|
||||
cr.setSourceRGBA (
|
||||
color.red / 255,
|
||||
@ -309,10 +308,8 @@ PopupSeparatorMenuItem.prototype = {
|
||||
let [width, height] = area.get_surface_size();
|
||||
let margin = themeNode.get_length('-margin-horizontal');
|
||||
let gradientHeight = themeNode.get_length('-gradient-height');
|
||||
let startColor = new Clutter.Color();
|
||||
themeNode.get_color('-gradient-start', startColor);
|
||||
let endColor = new Clutter.Color();
|
||||
themeNode.get_color('-gradient-end', endColor);
|
||||
let startColor = themeNode.get_color('-gradient-start');
|
||||
let endColor = themeNode.get_color('-gradient-end');
|
||||
|
||||
let gradientWidth = (width - margin * 2);
|
||||
let gradientOffset = (height - gradientHeight) / 2;
|
||||
@ -373,10 +370,8 @@ PopupSliderMenuItem.prototype = {
|
||||
|
||||
let sliderBorderWidth = themeNode.get_length('-slider-border-width');
|
||||
|
||||
let sliderBorderColor = new Clutter.Color();
|
||||
themeNode.get_color('-slider-border-color', sliderBorderColor);
|
||||
let sliderColor = new Clutter.Color();
|
||||
themeNode.get_color('-slider-background-color', sliderColor);
|
||||
let sliderBorderColor = themeNode.get_color('-slider-border-color');
|
||||
let sliderColor = themeNode.get_color('-slider-background-color');
|
||||
|
||||
cr.setSourceRGBA (
|
||||
sliderColor.red / 255,
|
||||
@ -396,8 +391,7 @@ PopupSliderMenuItem.prototype = {
|
||||
let handleY = height / 2;
|
||||
let handleX = handleRadius + (width - 2 * handleRadius) * this._value;
|
||||
|
||||
let color = new Clutter.Color();
|
||||
themeNode.get_foreground_color(color);
|
||||
let color = themeNode.get_foreground_color();
|
||||
cr.setSourceRGBA (
|
||||
color.red / 255,
|
||||
color.green / 255,
|
||||
|
Reference in New Issue
Block a user