From 0afc0e9e121f21cb521f07800ff287aa9dac05c5 Mon Sep 17 00:00:00 2001 From: pandamicro Date: Sat, 24 Feb 2018 15:04:15 +0800 Subject: [PATCH] Fix simple sprite rendering issue with rotated frame --- cocos2d/core/renderer/assemblers/sprite/simple.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/renderer/assemblers/sprite/simple.js b/cocos2d/core/renderer/assemblers/sprite/simple.js index eb45139c5f..58bfefed86 100644 --- a/cocos2d/core/renderer/assemblers/sprite/simple.js +++ b/cocos2d/core/renderer/assemblers/sprite/simple.js @@ -55,12 +55,12 @@ module.exports = { texh = texture._height; let frame = sprite.spriteFrame; let rect = frame._rect; - let l = texw === 0 ? 0 : rect.x / texw; - let r = texw === 0 ? 0 : (rect.x + rect.width) / texw; - let b = texh === 0 ? 0 : (rect.y + rect.height) / texh; - let t = texh === 0 ? 0 : rect.y / texh; if (frame._rotated) { + let l = texw === 0 ? 0 : rect.x / texw; + let r = texw === 0 ? 0 : (rect.x + rect.height) / texw; + let b = texh === 0 ? 0 : (rect.y + rect.width) / texh; + let t = texh === 0 ? 0 : rect.y / texh; data[0].u = l; data[0].v = t; data[1].u = l; @@ -71,6 +71,10 @@ module.exports = { data[3].v = b; } else { + let l = texw === 0 ? 0 : rect.x / texw; + let r = texw === 0 ? 0 : (rect.x + rect.width) / texw; + let b = texh === 0 ? 0 : (rect.y + rect.height) / texh; + let t = texh === 0 ? 0 : rect.y / texh; data[0].u = l; data[0].v = b; data[1].u = r;