@@ -2406,7 +2406,6 @@ var egret;
2406
2406
else {
2407
2407
var buffer = egret.sys.hitTestBuffer;
2408
2408
buffer.resize(3, 3);
2409
- var node = this.$getRenderNode();
2410
2409
var matrix = egret.Matrix.create();
2411
2410
matrix.identity();
2412
2411
matrix.translate(1 - localX, 1 - localY);
@@ -14637,6 +14636,7 @@ var egret;
14637
14636
};
14638
14637
/**
14639
14638
* 覆盖父类方法,不自动清空缓存的绘图数据,改为手动调用clear()方法清空。
14639
+ * 这里只是想清空绘制命令,因此不调用super
14640
14640
*/
14641
14641
p.cleanBeforeRender = function () {
14642
14642
var data = this.drawData;
@@ -14686,6 +14686,124 @@ var egret;
14686
14686
// EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14687
14687
//
14688
14688
//////////////////////////////////////////////////////////////////////////////////////
14689
+ var egret;
14690
+ (function (egret) {
14691
+ var sys;
14692
+ (function (sys) {
14693
+ /**
14694
+ * @private
14695
+ * 位图渲染节点
14696
+ */
14697
+ var SetAlphaNode = (function (_super) {
14698
+ __extends(SetAlphaNode, _super);
14699
+ function SetAlphaNode() {
14700
+ _super.call(this);
14701
+ this.type = 6 /* SetAlphaNode */;
14702
+ }
14703
+ var d = __define,c=SetAlphaNode,p=c.prototype;
14704
+ /**
14705
+ * 绘制一次位图
14706
+ */
14707
+ p.setAlpha = function (alpha) {
14708
+ if (this.drawData.length != 0) {
14709
+ this.drawData.length = 0;
14710
+ }
14711
+ this.drawData.push(alpha);
14712
+ this.renderCount++;
14713
+ };
14714
+ return SetAlphaNode;
14715
+ })(sys.RenderNode);
14716
+ sys.SetAlphaNode = SetAlphaNode;
14717
+ egret.registerClass(SetAlphaNode,'egret.sys.SetAlphaNode');
14718
+ })(sys = egret.sys || (egret.sys = {}));
14719
+ })(egret || (egret = {}));
14720
+ //////////////////////////////////////////////////////////////////////////////////////
14721
+ //
14722
+ // Copyright (c) 2014-2015, Egret Technology Inc.
14723
+ // All rights reserved.
14724
+ // Redistribution and use in source and binary forms, with or without
14725
+ // modification, are permitted provided that the following conditions are met:
14726
+ //
14727
+ // * Redistributions of source code must retain the above copyright
14728
+ // notice, this list of conditions and the following disclaimer.
14729
+ // * Redistributions in binary form must reproduce the above copyright
14730
+ // notice, this list of conditions and the following disclaimer in the
14731
+ // documentation and/or other materials provided with the distribution.
14732
+ // * Neither the name of the Egret nor the
14733
+ // names of its contributors may be used to endorse or promote products
14734
+ // derived from this software without specific prior written permission.
14735
+ //
14736
+ // THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
14737
+ // OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14738
+ // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14739
+ // IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
14740
+ // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14741
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
14742
+ // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14743
+ // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
14744
+ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
14745
+ // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14746
+ //
14747
+ //////////////////////////////////////////////////////////////////////////////////////
14748
+ var egret;
14749
+ (function (egret) {
14750
+ var sys;
14751
+ (function (sys) {
14752
+ /**
14753
+ * @private
14754
+ * 位图渲染节点
14755
+ */
14756
+ var SetTransformNode = (function (_super) {
14757
+ __extends(SetTransformNode, _super);
14758
+ function SetTransformNode() {
14759
+ _super.call(this);
14760
+ this.type = 5 /* SetTransformNode */;
14761
+ }
14762
+ var d = __define,c=SetTransformNode,p=c.prototype;
14763
+ /**
14764
+ * 绘制一次位图
14765
+ */
14766
+ p.setTransform = function (a, b, c, d, tx, ty) {
14767
+ if (this.drawData.length != 0) {
14768
+ this.drawData.length = 0;
14769
+ }
14770
+ this.drawData.push(a, b, c, d, tx, ty);
14771
+ this.renderCount++;
14772
+ };
14773
+ return SetTransformNode;
14774
+ })(sys.RenderNode);
14775
+ sys.SetTransformNode = SetTransformNode;
14776
+ egret.registerClass(SetTransformNode,'egret.sys.SetTransformNode');
14777
+ })(sys = egret.sys || (egret.sys = {}));
14778
+ })(egret || (egret = {}));
14779
+ //////////////////////////////////////////////////////////////////////////////////////
14780
+ //
14781
+ // Copyright (c) 2014-2015, Egret Technology Inc.
14782
+ // All rights reserved.
14783
+ // Redistribution and use in source and binary forms, with or without
14784
+ // modification, are permitted provided that the following conditions are met:
14785
+ //
14786
+ // * Redistributions of source code must retain the above copyright
14787
+ // notice, this list of conditions and the following disclaimer.
14788
+ // * Redistributions in binary form must reproduce the above copyright
14789
+ // notice, this list of conditions and the following disclaimer in the
14790
+ // documentation and/or other materials provided with the distribution.
14791
+ // * Neither the name of the Egret nor the
14792
+ // names of its contributors may be used to endorse or promote products
14793
+ // derived from this software without specific prior written permission.
14794
+ //
14795
+ // THIS SOFTWARE IS PROVIDED BY EGRET AND CONTRIBUTORS "AS IS" AND ANY EXPRESS
14796
+ // OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
14797
+ // OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
14798
+ // IN NO EVENT SHALL EGRET AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
14799
+ // INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
14800
+ // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA,
14801
+ // OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
14802
+ // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
14803
+ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
14804
+ // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
14805
+ //
14806
+ //////////////////////////////////////////////////////////////////////////////////////
14689
14807
//////////////////////////////////////////////////////////////////////////////////////
14690
14808
//
14691
14809
// Copyright (c) 2014-2015, Egret Technology Inc.
@@ -15343,20 +15461,7 @@ var egret;
15343
15461
context.setTransform(m.a, m.b, m.c, m.d, m.tx + matrix.tx, m.ty + matrix.ty);
15344
15462
}
15345
15463
context.globalAlpha = renderAlpha;
15346
- switch (node.type) {
15347
- case 1 /* BitmapNode */:
15348
- this.renderBitmap(node, context);
15349
- break;
15350
- case 2 /* TextNode */:
15351
- this.renderText(node, context);
15352
- break;
15353
- case 3 /* GraphicsNode */:
15354
- this.renderGraphics(node, context);
15355
- break;
15356
- case 4 /* GroupNode */:
15357
- this.renderGroup(node, context);
15358
- break;
15359
- }
15464
+ this.renderNode(node, context);
15360
15465
node.needRedraw = false;
15361
15466
}
15362
15467
}
@@ -15593,6 +15698,12 @@ var egret;
15593
15698
p.drawNodeToBuffer = function (node, buffer, matrix, forHitTest) {
15594
15699
var context = buffer.context;
15595
15700
context.setTransform(matrix.a, matrix.b, matrix.c, matrix.d, matrix.tx, matrix.ty);
15701
+ this.renderNode(node, context, forHitTest);
15702
+ };
15703
+ /**
15704
+ * @private
15705
+ */
15706
+ p.renderNode = function (node, context, forHitTest) {
15596
15707
switch (node.type) {
15597
15708
case 1 /* BitmapNode */:
15598
15709
this.renderBitmap(node, context);
@@ -15606,6 +15717,12 @@ var egret;
15606
15717
case 4 /* GroupNode */:
15607
15718
this.renderGroup(node, context);
15608
15719
break;
15720
+ case 5 /* SetTransformNode */:
15721
+ context.setTransform(node.drawData[0], node.drawData[1], node.drawData[2], node.drawData[3], node.drawData[4], node.drawData[5]);
15722
+ break;
15723
+ case 6 /* SetAlphaNode */:
15724
+ context.globalAlpha = node.drawData[0];
15725
+ break;
15609
15726
}
15610
15727
};
15611
15728
/**
@@ -15726,20 +15843,7 @@ var egret;
15726
15843
var length = children.length;
15727
15844
for (var i = 0; i < length; i++) {
15728
15845
var node = children[i];
15729
- switch (node.type) {
15730
- case 1 /* BitmapNode */:
15731
- this.renderBitmap(node, context);
15732
- break;
15733
- case 2 /* TextNode */:
15734
- this.renderText(node, context);
15735
- break;
15736
- case 3 /* GraphicsNode */:
15737
- this.renderGraphics(node, context);
15738
- break;
15739
- case 4 /* GroupNode */:
15740
- this.renderGroup(node, context);
15741
- break;
15742
- }
15846
+ this.renderNode(node, context);
15743
15847
}
15744
15848
};
15745
15849
/**
0 commit comments