fix Scale9Sprite draw extra pixels in spritesheet

Fixed https://github.com/cocos2d/cocos2d-x/issues/13564
This commit is contained in:
andyque 2015-08-26 16:15:00 +08:00
parent 7c091b7529
commit 7f73415189
2 changed files with 4 additions and 7 deletions

View File

@ -184,10 +184,7 @@ Rect NinePatchImageParser::parseCapInset() const
verticalLine.y - verticalLine.x);
}
capInsets = Rect(capInsets.origin.x / CC_CONTENT_SCALE_FACTOR(),
capInsets.origin.y / CC_CONTENT_SCALE_FACTOR(),
capInsets.size.width / CC_CONTENT_SCALE_FACTOR(),
capInsets.size.height / CC_CONTENT_SCALE_FACTOR());
capInsets = CC_RECT_PIXELS_TO_POINTS(capInsets);
return capInsets;
}

View File

@ -580,8 +580,8 @@ namespace ui {
float width = _originalSize.width;
float height = _originalSize.height;
Vec2 offsetPosition(ceilf(_offset.x + (_originalSize.width - _spriteRect.size.width) / 2),
ceilf(_offset.y + (_originalSize.height - _spriteRect.size.height) / 2));
Vec2 offsetPosition(floor(_offset.x + (_originalSize.width - _spriteRect.size.width) / 2),
floor(_offset.y + (_originalSize.height - _spriteRect.size.height) / 2));
// If there is no specified center region
if ( _capInsetsInternal.equals(Rect::ZERO) )
@ -794,7 +794,7 @@ namespace ui {
//shrink the image size when it is 9-patch
if(_isPatch9)
{
float offset = 1.4f;
float offset = 1.0f;
//Top left
if(!_spriteFrameRotated)
{