Skip to content

Commit 4a3ceaf

Browse files
author
minggo
committed
revert the modification of CCNode_mobile.cpp and CCSprite.cpp
1 parent f2ee0a9 commit 4a3ceaf

File tree

2 files changed

+48
-51
lines changed

2 files changed

+48
-51
lines changed

cocos2dx/platform/CCNode_mobile.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -458,10 +458,7 @@ CCRect CCNode::boundingBox()
458458
CCRect CCNode::boundingBoxInPixels()
459459
{
460460
CCRect rect = CCRectMake(0, 0, m_tContentSizeInPixels.width, m_tContentSizeInPixels.height);
461-
rect = CCRectApplyAffineTransform(rect, nodeToParentTransform());
462-
rect.origin.x *= CC_CONTENT_SCALE_FACTOR();
463-
rect.origin.y *= CC_CONTENT_SCALE_FACTOR();
464-
return rect;
461+
return CCRectApplyAffineTransform(rect, nodeToParentTransform());
465462
}
466463

467464

cocos2dx/sprite_nodes/CCSprite.cpp

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -428,14 +428,14 @@ void CCSprite::updateTextureCoords(CCRect rect)
428428
if (m_bRectRotated)
429429
{
430430
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
431-
left = (2*rect.origin.x+1)/(2*atlasWidth);
432-
right = left+(rect.size.height*2-2)/(2*atlasWidth);
433-
top = (2*rect.origin.y+1)/(2*atlasHeight);
431+
left = (2*rect.origin.x+1)/(2*atlasWidth);
432+
right = left+(rect.size.height*2-2)/(2*atlasWidth);
433+
top = (2*rect.origin.y+1)/(2*atlasHeight);
434434
bottom = top+(rect.size.width*2-2)/(2*atlasHeight);
435435
#else
436-
left = rect.origin.x/atlasWidth;
437-
right = left+(rect.size.height/atlasWidth);
438-
top = rect.origin.y/atlasHeight;
436+
left = rect.origin.x/atlasWidth;
437+
right = left+(rect.size.height/atlasWidth);
438+
top = rect.origin.y/atlasHeight;
439439
bottom = top+(rect.size.width/atlasHeight);
440440
#endif // CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
441441

@@ -449,46 +449,46 @@ void CCSprite::updateTextureCoords(CCRect rect)
449449
CC_SWAP(left, right, float);
450450
}
451451

452-
m_sQuad.bl.texCoords.u = left;
453-
m_sQuad.bl.texCoords.v = top;
454-
m_sQuad.br.texCoords.u = left;
455-
m_sQuad.br.texCoords.v = bottom;
456-
m_sQuad.tl.texCoords.u = right;
457-
m_sQuad.tl.texCoords.v = top;
458-
m_sQuad.tr.texCoords.u = right;
452+
m_sQuad.bl.texCoords.u = left;
453+
m_sQuad.bl.texCoords.v = top;
454+
m_sQuad.br.texCoords.u = left;
455+
m_sQuad.br.texCoords.v = bottom;
456+
m_sQuad.tl.texCoords.u = right;
457+
m_sQuad.tl.texCoords.v = top;
458+
m_sQuad.tr.texCoords.u = right;
459459
m_sQuad.tr.texCoords.v = bottom;
460460
}
461461
else
462462
{
463-
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
464-
left = (2*rect.origin.x+1)/(2*atlasWidth);
465-
right = left + (rect.size.width*2-2)/(2*atlasWidth);
466-
top = (2*rect.origin.y+1)/(2*atlasHeight);
467-
bottom = top + (rect.size.height*2-2)/(2*atlasHeight);
468-
#else
469-
left = rect.origin.x/atlasWidth;
470-
right = left + rect.size.width/atlasWidth;
471-
top = rect.origin.y/atlasHeight;
472-
bottom = top + rect.size.height/atlasHeight;
473-
#endif // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
474-
475-
if(m_bFlipX)
476-
{
477-
CC_SWAP(left,right,float);
478-
}
479-
480-
if(m_bFlipY)
481-
{
482-
CC_SWAP(top,bottom,float);
483-
}
484-
485-
m_sQuad.bl.texCoords.u = left;
486-
m_sQuad.bl.texCoords.v = bottom;
487-
m_sQuad.br.texCoords.u = right;
488-
m_sQuad.br.texCoords.v = bottom;
489-
m_sQuad.tl.texCoords.u = left;
490-
m_sQuad.tl.texCoords.v = top;
491-
m_sQuad.tr.texCoords.u = right;
463+
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
464+
left = (2*rect.origin.x+1)/(2*atlasWidth);
465+
right = left + (rect.size.width*2-2)/(2*atlasWidth);
466+
top = (2*rect.origin.y+1)/(2*atlasHeight);
467+
bottom = top + (rect.size.height*2-2)/(2*atlasHeight);
468+
#else
469+
left = rect.origin.x/atlasWidth;
470+
right = left + rect.size.width/atlasWidth;
471+
top = rect.origin.y/atlasHeight;
472+
bottom = top + rect.size.height/atlasHeight;
473+
#endif // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
474+
475+
if(m_bFlipX)
476+
{
477+
CC_SWAP(left,right,float);
478+
}
479+
480+
if(m_bFlipY)
481+
{
482+
CC_SWAP(top,bottom,float);
483+
}
484+
485+
m_sQuad.bl.texCoords.u = left;
486+
m_sQuad.bl.texCoords.v = bottom;
487+
m_sQuad.br.texCoords.u = right;
488+
m_sQuad.br.texCoords.v = bottom;
489+
m_sQuad.tl.texCoords.u = left;
490+
m_sQuad.tl.texCoords.v = top;
491+
m_sQuad.tr.texCoords.u = right;
492492
m_sQuad.tr.texCoords.v = top;
493493
}
494494
}
@@ -543,10 +543,10 @@ void CCSprite::updateTransform(void)
543543
// If any of the parents are not visible, then don't draw this node
544544
if (! tv.visible)
545545
{
546-
m_sQuad.br.vertices = m_sQuad.tl.vertices = m_sQuad.tr.vertices = m_sQuad.bl.vertices = vertex3(0,0,0);
547-
m_pobTextureAtlas->updateQuad(&m_sQuad, m_uAtlasIndex);
548-
m_bDirty = m_bRecursiveDirty = false;
549-
546+
m_sQuad.br.vertices = m_sQuad.tl.vertices = m_sQuad.tr.vertices = m_sQuad.bl.vertices = vertex3(0,0,0);
547+
m_pobTextureAtlas->updateQuad(&m_sQuad, m_uAtlasIndex);
548+
m_bDirty = m_bRecursiveDirty = false;
549+
550550
return;
551551
}
552552

@@ -675,7 +675,7 @@ void CCSprite::draw(void)
675675
}
676676

677677
#if CC_SPRITE_DEBUG_DRAW
678-
CCSize s = m_tContentSizeInPixels;
678+
CCSize s = m_tContentSize;
679679
CCPoint vertices[4]={
680680
ccp(0,0),ccp(s.width,0),
681681
ccp(s.width,s.height),ccp(0,s.height),

0 commit comments

Comments
 (0)