@@ -144,8 +144,7 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
144
144
locY = - node . _offsetPosition . y - node . _rect . height ,
145
145
locWidth = node . _rect . width ,
146
146
locHeight = node . _rect . height ,
147
- image ,
148
- curColor ;
147
+ image , curColor , contentSize ;
149
148
150
149
var blendChange = ( node . _blendFuncStr !== "source" ) , alpha = ( node . _displayedOpacity / 255 ) ;
151
150
/*if(cc.renderer.contextSession.globalAlpha !== alpha){
@@ -194,9 +193,12 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
194
193
) ;
195
194
}
196
195
} else {
197
- curColor = node . _displayedColor ;
198
- context . fillStyle = "rgba(" + curColor . r + "," + curColor . g + "," + curColor . b + "," + node . _displayedOpacity + ")" ;
199
- context . fillRect ( locX , locY , locWidth , locHeight ) ;
196
+ contentSize = node . _contentSize ;
197
+ if ( contentSize . width !== 0 && contentSize . height !== 0 ) {
198
+ curColor = node . _displayedColor ;
199
+ context . fillStyle = "rgba(" + curColor . r + "," + curColor . g + "," + curColor . b + "," + node . _displayedOpacity + ")" ;
200
+ context . fillRect ( locX * scaleX , locY * scaleY , contentSize . width * scaleX , contentSize . height * scaleY ) ;
201
+ }
200
202
}
201
203
context . restore ( ) ;
202
204
} else {
@@ -231,9 +233,12 @@ if (cc._renderType === cc._RENDER_TYPE_CANVAS) {
231
233
locHeight * scaleY ) ;
232
234
}
233
235
} else {
234
- curColor = node . _displayedColor ;
235
- context . fillStyle = "rgba(" + curColor . r + "," + curColor . g + "," + curColor . b + "," + node . _displayedOpacity + ")" ;
236
- context . fillRect ( t . tx * scaleX + locX , - t . ty * scaleY + locY , locWidth , locHeight ) ;
236
+ contentSize = node . _contentSize ;
237
+ if ( contentSize . width !== 0 && contentSize . height !== 0 ) {
238
+ curColor = node . _displayedColor ;
239
+ context . fillStyle = "rgba(" + curColor . r + "," + curColor . g + "," + curColor . b + "," + node . _displayedOpacity + ")" ;
240
+ context . fillRect ( locX * scaleX , locY * scaleY , contentSize . width * scaleX , contentSize . height * scaleY ) ;
241
+ }
237
242
}
238
243
if ( blendChange )
239
244
context . restore ( ) ;
0 commit comments