Don't clone color if it is not necessary

This commit is contained in:
Zsolt Simon 2017-01-06 08:37:25 +10:00 committed by Zsolt Simon
parent 878f974c85
commit 2945ed25f9
2 changed files with 10 additions and 8 deletions

View File

@ -148,9 +148,9 @@ define([
model.shadows = Property.getValueOrDefault(modelGraphics._shadows, time, defaultShadows);
model.heightReference = Property.getValueOrDefault(modelGraphics._heightReference, time, defaultHeightReference);
model.distanceDisplayCondition = Property.getValueOrUndefined(modelGraphics._distanceDisplayCondition, time);
model.silhouetteColor = Property.getValueOrClonedDefault(modelGraphics.silhouetteColor, time, defaultSilhouetteColor, model.silhouetteColor);
model.silhouetteColor = Property.getValueOrDefault(modelGraphics.silhouetteColor, time, defaultSilhouetteColor, model._silhouetteColor);
model.silhouetteSize = Property.getValueOrDefault(modelGraphics.silhouetteSize, time, defaultSilhouetteSize);
model.color = Property.getValueOrClonedDefault(modelGraphics._color, time, defaultColor, model.color);
model.color = Property.getValueOrDefault(modelGraphics._color, time, defaultColor, model._color);
model.colorBlendMode = Property.getValueOrDefault(modelGraphics._colorBlendMode, time, defaultColorBlendMode);
model.colorBlendAmount = Property.getValueOrDefault(modelGraphics._colorBlendAmount, time, defaultColorBlendAmount);

View File

@ -416,8 +416,9 @@ define([
*
* @default Color.RED
*/
this.silhouetteColor = Color.clone(defaultValue(options.silhouetteColor, Color.RED));
this.silhouetteColor = defaultValue(options.silhouetteColor, Color.RED);
this._silhouetteColor = new Color();
this._silhouetteColorPrevAlpha = 1.0;
this._normalAttributeName = undefined;
/**
@ -554,8 +555,9 @@ define([
*
* @default Color.WHITE
*/
this.color = Color.clone(defaultValue(options.color, Color.WHITE));
this.color = defaultValue(options.color, Color.WHITE);
this._color = new Color();
this._colorPrevAlpha = 1.0;
/**
* Defines how the color blends with the model.
@ -3800,12 +3802,12 @@ define([
}
var nodeCommands = model._nodeCommands;
var dirty = alphaDirty(model.color.alpha, model._color.alpha) ||
alphaDirty(model.silhouetteColor.alpha, model._silhouetteColor.alpha) ||
var dirty = alphaDirty(model.color.alpha, model._colorPrevAlpha) ||
alphaDirty(model.silhouetteColor.alpha, model._silhouetteColorPrevAlpha) ||
!defined(nodeCommands[0].silhouetteModelCommand);
Color.clone(model.color, model._color);
Color.clone(model.silhouetteColor, model._silhouetteColor);
model._colorPrevAlpha = model.color.alpha;
model._silhouetteColorPrevAlpha = model.silhouetteColor.alpha;
if (dirty) {
createSilhouetteCommands(model, frameState);