Skip to content

Commit 9660068

Browse files
author
Thayer J Andrews
committed
Merge branch 'develop' into thayer/effectScreenSpaceCoordsAreOut
2 parents 1bb1822 + b57f392 commit 9660068

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

cocos2d/CCSprite.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,18 @@ -(void) setTextureRect:(CGRect)rect
239239

240240
-(void) setTextureRect:(CGRect)rect rotated:(BOOL)rotated untrimmedSize:(CGSize)untrimmedSize
241241
{
242-
_textureRectRotated = rotated;
242+
[self setTextureRect:rect forTexture:self.texture rotated:rotated untrimmedSize:untrimmedSize];
243+
}
243244

245+
- (void)setTextureRect:(CGRect)rect forTexture:(CCTexture*)texture rotated:(BOOL)rotated untrimmedSize:(CGSize)untrimmedSize
246+
{
247+
_textureRectRotated = rotated;
248+
244249
self.contentSizeType = CCSizeTypePoints;
245250
[self setContentSize:untrimmedSize];
246251
_textureRect = rect;
247252

248-
CCSpriteTexCoordSet texCoords = [CCSprite textureCoordsForTexture:self.texture withRect:rect rotated:rotated xFlipped:_flipX yFlipped:_flipY];
253+
CCSpriteTexCoordSet texCoords = [CCSprite textureCoordsForTexture:texture withRect:rect rotated:rotated xFlipped:_flipX yFlipped:_flipY];
249254
_verts.bl.texCoord1 = texCoords.bl;
250255
_verts.br.texCoord1 = texCoords.br;
251256
_verts.tr.texCoord1 = texCoords.tr;
@@ -533,7 +538,7 @@ -(void) setNormalMapSpriteFrame:(CCSpriteFrame*)frame
533538
// If there is no texture set on the sprite, set the sprite's texture rect from the
534539
// normal map's sprite frame. Note that setting the main texture, then the normal map,
535540
// and then removing the main texture will leave the texture rect from the main texture.
536-
[self setTextureRect:frame.rect rotated:frame.rotated untrimmedSize:frame.originalSize];
541+
[self setTextureRect:frame.rect forTexture:frame.texture rotated:frame.rotated untrimmedSize:frame.originalSize];
537542
}
538543

539544
// Set the second texture coordinate set from the normal map's sprite frame.

0 commit comments

Comments
 (0)