From ba60fb99bddb5b65358dbce314a062c541a19664 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 28 Sep 2013 10:02:43 +0200 Subject: [PATCH] Draw quads before resizing. #33 --- spine-cocos2dx/src/spine/CCSkeleton.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/spine-cocos2dx/src/spine/CCSkeleton.cpp b/spine-cocos2dx/src/spine/CCSkeleton.cpp index 87955838a..ea64cc247 100644 --- a/spine-cocos2dx/src/spine/CCSkeleton.cpp +++ b/spine-cocos2dx/src/spine/CCSkeleton.cpp @@ -150,6 +150,7 @@ void CCSkeleton::draw () { Slot* slot = skeleton->drawOrder[i]; if (!slot->attachment || slot->attachment->type != ATTACHMENT_REGION) continue; RegionAttachment* attachment = (RegionAttachment*)slot->attachment; + CCTextureAtlas* regionTextureAtlas = getTextureAtlas(attachment); if (regionTextureAtlas != textureAtlas) { if (textureAtlas) { @@ -158,8 +159,14 @@ void CCSkeleton::draw () { } } textureAtlas = regionTextureAtlas; + int quadCount = textureAtlas->getTotalQuads(); - if (textureAtlas->getCapacity() == quadCount && !textureAtlas->resizeCapacity(textureAtlas->getCapacity() * 2)) return; + if (textureAtlas->getCapacity() == quadCount) { + textureAtlas->drawQuads(); + textureAtlas->removeAllQuads(); + if (!textureAtlas->resizeCapacity(textureAtlas->getCapacity() * 2)) return; + } + RegionAttachment_updateQuad(attachment, slot, &quad, premultipliedAlpha); textureAtlas->updateQuad(&quad, quadCount); }