Skip to content

Commit a27a026

Browse files
committed
Fix canvas renderer issues
1 parent 41ee632 commit a27a026

File tree

4 files changed

+30
-17
lines changed

4 files changed

+30
-17
lines changed

Diff for: extensions/ccui/layouts/UILayoutCanvasRenderCmd.js

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
var proto = ccui.Layout.CanvasRenderCmd.prototype = Object.create(ccui.ProtectedNode.CanvasRenderCmd.prototype);
4040
proto.constructor = ccui.Layout.CanvasRenderCmd;
4141

42+
cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED, function () {
43+
ccui.Layout.CanvasRenderCmd.prototype.widgetVisit = ccui.Widget.CanvasRenderCmd.prototype.widgetVisit;
44+
});
45+
4246
proto.visit = function(parentCmd){
4347
var node = this._node;
4448
if (!node._visible)

Diff for: extensions/cocostudio/armature/CCArmatureCanvasRenderCmd.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,9 @@
101101

102102
proto.initShaderCache = function(){};
103103
proto.setShaderProgram = function(){};
104-
proto.updateChildPosition = function(ctx, dis){
105-
//dis.visit(ctx);
106-
cc.renderer.pushRenderCommand(dis._renderCmd);
104+
proto.updateChildPosition = function(dis, bone){
105+
dis.visit();
106+
// cc.renderer.pushRenderCommand(dis._renderCmd);
107107
};
108108

109109
proto.rendering = function(ctx, scaleX, scaleY){
@@ -120,7 +120,7 @@
120120
switch (selBone.getDisplayRenderNodeType()) {
121121
case ccs.DISPLAY_TYPE_SPRITE:
122122
if(selNode instanceof ccs.Skin)
123-
this.updateChildPosition(ctx, selNode, selBone, alphaPremultiplied, alphaNonPremultipled);
123+
this.updateChildPosition(selNode, selBone, alphaPremultiplied, alphaNonPremultipled);
124124
break;
125125
case ccs.DISPLAY_TYPE_ARMATURE:
126126
selNode._renderCmd.rendering(ctx, scaleX, scaleY);

Diff for: extensions/cocostudio/armature/display/CCSkin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ ccs.Skin = ccs.Sprite.extend(/** @lends ccs.Skin# */{
108108
this.setRotationY(cc.radiansToDegrees(-skinData.skewY));
109109
this.setPosition(skinData.x, skinData.y);
110110

111-
this.updateArmatureTransform();
111+
this._renderCmd.transform();
112112
},
113113

114114
/**

Diff for: extensions/cocostudio/armature/display/CCSkinRenderCmd.js

+21-12
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,28 @@
4646
wt.tx = t.tx * pt.a + t.ty * pt.c + pt.tx;
4747
wt.ty = t.tx * pt.b + t.ty * pt.d + pt.ty;
4848

49-
var lx = node._offsetPosition.x, rx = lx + node._rect.width,
50-
by = node._offsetPosition.y, ty = by + node._rect.height;
51-
5249
var vertices = this._vertices;
53-
vertices[0].x = lx * wt.a + ty * wt.c + wt.tx; // tl
54-
vertices[0].y = lx * wt.b + ty * wt.d + wt.ty;
55-
vertices[1].x = lx * wt.a + by * wt.c + wt.tx; // bl
56-
vertices[1].y = lx * wt.b + by * wt.d + wt.ty;
57-
vertices[2].x = rx * wt.a + ty * wt.c + wt.tx; // tr
58-
vertices[2].y = rx * wt.b + ty * wt.d + wt.ty;
59-
vertices[3].x = rx * wt.a + by * wt.c + wt.tx; // br
60-
vertices[3].y = rx * wt.b + by * wt.d + wt.ty;
50+
if (vertices) {
51+
var lx = node._offsetPosition.x, rx = lx + node._rect.width,
52+
by = node._offsetPosition.y, ty = by + node._rect.height;
53+
54+
vertices[0].x = lx * wt.a + ty * wt.c + wt.tx; // tl
55+
vertices[0].y = lx * wt.b + ty * wt.d + wt.ty;
56+
vertices[1].x = lx * wt.a + by * wt.c + wt.tx; // bl
57+
vertices[1].y = lx * wt.b + by * wt.d + wt.ty;
58+
vertices[2].x = rx * wt.a + ty * wt.c + wt.tx; // tr
59+
vertices[2].y = rx * wt.b + ty * wt.d + wt.ty;
60+
vertices[3].x = rx * wt.a + by * wt.c + wt.tx; // br
61+
vertices[3].y = rx * wt.b + by * wt.d + wt.ty;
62+
}
63+
}
64+
else {
65+
wt.a = t.a;
66+
wt.b = t.b;
67+
wt.c = t.c;
68+
wt.d = t.d;
69+
wt.tx = t.tx;
70+
wt.ty = t.ty;
6171
}
6272
},
6373

@@ -76,7 +86,6 @@
7686

7787
ccs.Skin.CanvasRenderCmd = function(renderable){
7888
cc.Sprite.CanvasRenderCmd.call(this, renderable);
79-
this._needDraw = true;
8089
};
8190

8291
var proto = ccs.Skin.CanvasRenderCmd.prototype = Object.create(cc.Sprite.CanvasRenderCmd.prototype);

0 commit comments

Comments
 (0)