diff --git a/cocos2d/core/CCNode.js b/cocos2d/core/CCNode.js index 3eb80ebbe3..828c33bdfe 100644 --- a/cocos2d/core/CCNode.js +++ b/cocos2d/core/CCNode.js @@ -969,6 +969,12 @@ var Node = cc.Class({ // activate cc.director.getActionManager().resumeTarget(this); cc.eventManager.resumeTarget(this); + if (this._touchListener) { + this._touchListener.mask = _searchMaskParent(this); + } + if (this._mouseListener) { + this._mouseListener.mask = _searchMaskParent(this); + } } else { // deactivate diff --git a/cocos2d/core/label/CCSGLabel.js b/cocos2d/core/label/CCSGLabel.js index 34c6ca0545..9140092841 100644 --- a/cocos2d/core/label/CCSGLabel.js +++ b/cocos2d/core/label/CCSGLabel.js @@ -359,6 +359,7 @@ _ccsg.Label = _ccsg.Node.extend({ this._fontHandle = fontHandle; this._labelType = _ccsg.Label.Type.SystemFont; this._blendFunc = cc.BlendFunc._alphaPremultiplied(); + this._renderCmd._needDraw = true; this._notifyLabelSkinDirty(); this.emit('load'); return; @@ -367,11 +368,13 @@ _ccsg.Label = _ccsg.Node.extend({ if (extName === ".ttf") { this._labelType = _ccsg.Label.Type.TTF; this._blendFunc = cc.BlendFunc._alphaPremultiplied(); + this._renderCmd._needDraw = true; this._fontHandle = this._loadTTFFont(fontHandle); } else if (extName === ".fnt") { //todo add bmfont here this._labelType = _ccsg.Label.Type.BMFont; this._blendFunc = cc.BlendFunc._alphaNonPremultiplied(); + this._renderCmd._needDraw = false; this._initBMFontWithString(this._string, fontHandle, textureUrl); } this._notifyLabelSkinDirty(); diff --git a/cocos2d/core/label/CCSGLabelWebGLRenderCmd.js b/cocos2d/core/label/CCSGLabelWebGLRenderCmd.js index 541e2f3c11..5247004163 100644 --- a/cocos2d/core/label/CCSGLabelWebGLRenderCmd.js +++ b/cocos2d/core/label/CCSGLabelWebGLRenderCmd.js @@ -69,7 +69,8 @@ proto._updateDisplayOpacity = function (parentOpacity) { proto.transform = function (parentCmd, recursive) { this.originTransform(parentCmd, recursive); - var lx = 0, rx = this._labelCanvas.width, + var node = this._node, + lx = 0, rx = this._labelCanvas.width, by = 0, ty = this._labelCanvas.height, wt = this._worldTransform; @@ -83,6 +84,12 @@ proto.transform = function (parentCmd, recursive) { vert[3].x = rx * wt.a + by * wt.c + wt.tx; // br vert[3].y = rx * wt.b + by * wt.d + wt.ty; + if (!node._string || (node._labelType !== _ccsg.Label.Type.TTF && + node._labelType !== _ccsg.Label.Type.SystemFont)) { + // No culling for bmfont + return; + } + var rect = cc.visibleRect, vl = rect.left.x, vr = rect.right.x, vt = rect.top.y, vb = rect.bottom.y; if (((vert[0].x-vl) & (vert[1].x-vl) & (vert[2].x-vl) & (vert[3].x-vl)) >> 31 || // All outside left diff --git a/cocos2d/core/textures/CCTexture2D.js b/cocos2d/core/textures/CCTexture2D.js index 3f6a17b485..abafe8d952 100644 --- a/cocos2d/core/textures/CCTexture2D.js +++ b/cocos2d/core/textures/CCTexture2D.js @@ -96,7 +96,6 @@ var Texture2D = cc.Class(/** @lends cc.Texture2D# */{ this._isGray = false; } else if (cc._renderType === game.RENDER_TYPE_WEBGL) { - this._hasPremultipliedAlpha = false; this._pixelFormat = Texture2D.defaultPixelFormat; this._hasPremultipliedAlpha = false; this._hasMipmaps = false;