mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 16:12:40 +08:00
reuse textDirty dirty flag
This commit is contained in:
@@ -44,8 +44,7 @@ _ccsg.Node._dirtyFlags = {
|
||||
orderDirty: 1 << 5,
|
||||
textDirty: 1 << 6,
|
||||
gradientDirty: 1 << 7,
|
||||
labelDirty: 1 << 8,
|
||||
COUNT: 9
|
||||
COUNT: 8
|
||||
};
|
||||
cc.js.get(_ccsg.Node._dirtyFlags, 'all', function () {
|
||||
var count = _ccsg.Node._dirtyFlags.COUNT;
|
||||
|
||||
@@ -436,7 +436,7 @@ _ccsg.Label = _ccsg.Node.extend({
|
||||
if (CC_EDITOR) {
|
||||
this._updateLabel();
|
||||
} else {
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.labelDirty);
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.textDirty);
|
||||
}
|
||||
},
|
||||
_createRenderCmd: function() {
|
||||
@@ -449,19 +449,19 @@ _ccsg.Label = _ccsg.Node.extend({
|
||||
|
||||
getContentSize: function() {
|
||||
if (!CC_EDITOR && !cc.sizeEqualToSize(this._contentSize, this._renderCmd._realRenderingSize)) {
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.labelDirty);
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.textDirty);
|
||||
}
|
||||
return _ccsg.Node.prototype.getContentSize.call(this);
|
||||
},
|
||||
_getWidth: function () {
|
||||
if (!CC_EDITOR && !cc.sizeEqualToSize(this._contentSize, this._renderCmd._realRenderingSize)) {
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.labelDirty);
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.textDirty);
|
||||
}
|
||||
return _ccsg.Node.prototype._getWidth.call(this);
|
||||
},
|
||||
_getHeight: function () {
|
||||
if (!CC_EDITOR && !cc.sizeEqualToSize(this._contentSize, this._renderCmd._realRenderingSize)) {
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.labelDirty);
|
||||
this._renderCmd.setDirtyFlag(_ccsg.Node._dirtyFlags.textDirty);
|
||||
}
|
||||
return _ccsg.Node.prototype._getHeight.call(this);
|
||||
},
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
|
||||
if(colorDirty || opacityDirty){
|
||||
this._updateColor();
|
||||
}else if(locFlag & flags.labelDirty) {
|
||||
}else if(locFlag & flags.textDirty) {
|
||||
this._rebuildLabelSkin();
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
|
||||
if(colorDirty || opacityDirty){
|
||||
this._updateColor();
|
||||
} else if(locFlag & flags.labelDirty) {
|
||||
} else if(locFlag & flags.textDirty) {
|
||||
this._rebuildLabelSkin();
|
||||
}
|
||||
|
||||
@@ -438,7 +438,7 @@
|
||||
};
|
||||
|
||||
proto._rebuildLabelSkin = function () {
|
||||
this._dirtyFlag = this._dirtyFlag & _ccsg.Node._dirtyFlags.labelDirty ^ this._dirtyFlag;
|
||||
this._dirtyFlag = this._dirtyFlag & _ccsg.Node._dirtyFlags.textDirty ^ this._dirtyFlag;
|
||||
var node = this._node;
|
||||
this._realRenderingSize = _ccsg.Node.prototype.getContentSize.call(node);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user