diff --git a/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js b/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js index 09463e6c54..5c0489e466 100644 --- a/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js +++ b/cocos2d/core/base-nodes/CCSGNodeCanvasRenderCmd.js @@ -28,46 +28,11 @@ //The _ccsg.Node's render command for Canvas _ccsg.Node.CanvasRenderCmd = function (renderable) { this._ctor(renderable); - - this._currentRegion = new cc.Region(); - this._oldRegion = new cc.Region(); - this._regionFlag = 0; -}; - -_ccsg.Node.CanvasRenderCmd.RegionStatus = { - NotDirty: 0, //the region is not dirty - Dirty: 1, //the region is dirty, because of color, opacity or context - DirtyDouble: 2 //the region is moved, the old and the new one need considered when rendering }; var proto = _ccsg.Node.CanvasRenderCmd.prototype = Object.create(_ccsg.Node.RenderCmd.prototype); proto.constructor = _ccsg.Node.CanvasRenderCmd; proto._rootCtor = _ccsg.Node.CanvasRenderCmd; -proto._notifyRegionStatus = function(status) { - if (this._needDraw && this._regionFlag < status) { - this._regionFlag = status; - } -}; - -var localBB = new cc.Rect(); -proto.getLocalBB = function() { - var node = this._node; - localBB.x = localBB.y = 0; - localBB.width = node._contentSize.width; - localBB.height = node._contentSize.height; - return localBB; -}; - -proto._updateCurrentRegions = function() { - var temp = this._currentRegion; - this._currentRegion = this._oldRegion; - this._oldRegion = temp; - //hittest will call the transform, and set region flag to DirtyDouble, and the changes need to be considered for rendering - if(_ccsg.Node.CanvasRenderCmd.RegionStatus.DirtyDouble === this._regionFlag && (!this._currentRegion.isEmpty())) { - this._oldRegion.union(this._currentRegion); - } - this._currentRegion.updateRegion(this.getLocalBB(), this._worldTransform); -}; proto.detachFromParent = function () { var selChildren = this._node._children, item; diff --git a/cocos2d/core/platform/CCView.js b/cocos2d/core/platform/CCView.js index 7133a3b434..aeff6c10bf 100644 --- a/cocos2d/core/platform/CCView.js +++ b/cocos2d/core/platform/CCView.js @@ -460,13 +460,6 @@ var View = cc._Class.extend({ var ctx = cc._canvas.getContext('2d'); ctx.imageSmoothingEnabled = enabled; ctx.mozImageSmoothingEnabled = enabled; - // refresh canvas - var dirtyRegion = cc.rendererCanvas._dirtyRegion; - if (dirtyRegion) { - var oldRegion = new cc.Region(); - oldRegion.setTo(0, 0, cc.visibleRect.width, cc.visibleRect.height); - dirtyRegion.addRegion(oldRegion); - } } }, diff --git a/cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js b/cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js index 74160bbf3f..429da52a67 100644 --- a/cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js +++ b/cocos2d/particle/CCSGParticleSystemCanvasRenderCmd.js @@ -30,8 +30,6 @@ _ccsg.ParticleSystem.CanvasRenderCmd = function(renderable){ this._needDraw = true; this._pointRect = cc.rect(0, 0, 0, 0); - //region for local bb - this._localRegion = new cc.Region(); this._tintCache = null; }; var proto = _ccsg.ParticleSystem.CanvasRenderCmd.prototype = Object.create(_ccsg.Node.CanvasRenderCmd.prototype); @@ -45,29 +43,6 @@ proto.updateParticlePosition = function(particle, position){ cc.pIn(particle.drawPos, position); }; -var particleRegion = new cc.Region(); -var localBB = new cc.Rect(); -proto.updateLocalBB = function() { - var region = this._localRegion; - var particles = this._node._particles; - region.setEmpty(); - for(var index = particles.length - 1; index >=0; --index) { - var particle = particles[index]; - var pos = particle.drawPos; - var size = particle.size * 1.415 /*a little bigger than sqrt(2)*/; - particleRegion.setTo(pos.x - size, pos.y - size, pos.x + size, pos.y + size); - region.union(particleRegion); - } - - localBB.x = region._minX; localBB.y = region._minY; - localBB.width = region._maxX - region._minX; - localBB.height = region._maxY - region._minY; -}; - -proto.getLocalBB = function() { - return localBB; -}; - proto.updateStatus = function() { this.originUpdateStatus(); this._updateCurrentRegions();