2013-11-07 09:05:13 +08:00
|
|
|
/****************************************************************************
|
|
|
|
Copyright (c) 2013 Zynga Inc.
|
2014-01-07 11:25:07 +08:00
|
|
|
Copyright (c) 2013-2014 Chukong Technologies Inc.
|
|
|
|
|
2013-11-07 09:05:13 +08:00
|
|
|
http://www.cocos2d-x.org
|
|
|
|
|
|
|
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
|
|
of this software and associated documentation files (the "Software"), to deal
|
|
|
|
in the Software without restriction, including without limitation the rights
|
|
|
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
|
|
copies of the Software, and to permit persons to whom the Software is
|
|
|
|
furnished to do so, subject to the following conditions:
|
|
|
|
|
|
|
|
The above copyright notice and this permission notice shall be included in
|
|
|
|
all copies or substantial portions of the Software.
|
|
|
|
|
|
|
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
|
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
|
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
|
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
|
|
THE SOFTWARE.
|
|
|
|
****************************************************************************/
|
2014-01-17 13:35:58 +08:00
|
|
|
|
2014-05-01 10:09:13 +08:00
|
|
|
#include "2d/CCFontAtlas.h"
|
|
|
|
#include "2d/CCFontFreeType.h"
|
2014-05-17 05:36:00 +08:00
|
|
|
#include "base/ccUTF8.h"
|
2014-04-30 08:37:36 +08:00
|
|
|
#include "base/CCDirector.h"
|
|
|
|
#include "base/CCEventListenerCustom.h"
|
|
|
|
#include "base/CCEventDispatcher.h"
|
|
|
|
#include "base/CCEventType.h"
|
2013-07-20 01:33:26 +08:00
|
|
|
|
2014-07-09 23:03:04 +08:00
|
|
|
|
2013-07-20 01:33:26 +08:00
|
|
|
NS_CC_BEGIN
|
|
|
|
|
2014-05-14 16:41:26 +08:00
|
|
|
const int FontAtlas::CacheTextureWidth = 512;
|
|
|
|
const int FontAtlas::CacheTextureHeight = 512;
|
2015-01-21 21:58:18 +08:00
|
|
|
const char* FontAtlas::CMD_PURGE_FONTATLAS = "__cc_PURGE_FONTATLAS";
|
|
|
|
const char* FontAtlas::CMD_RESET_FONTATLAS = "__cc_RESET_FONTATLAS";
|
2014-03-05 15:54:40 +08:00
|
|
|
|
2014-03-07 11:42:13 +08:00
|
|
|
FontAtlas::FontAtlas(Font &theFont)
|
|
|
|
: _font(&theFont)
|
|
|
|
, _currentPageData(nullptr)
|
|
|
|
, _fontAscender(0)
|
2014-07-09 23:03:04 +08:00
|
|
|
, _rendererRecreatedListener(nullptr)
|
2014-03-27 15:35:51 +08:00
|
|
|
, _antialiasEnabled(true)
|
2015-07-03 18:08:32 +08:00
|
|
|
, _currLineHeight(0)
|
2013-07-25 01:22:46 +08:00
|
|
|
{
|
2013-10-31 17:52:22 +08:00
|
|
|
_font->retain();
|
2013-12-13 12:42:15 +08:00
|
|
|
|
2013-10-31 17:52:22 +08:00
|
|
|
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
|
2014-01-20 10:32:12 +08:00
|
|
|
if (fontTTf)
|
2013-10-29 20:25:03 +08:00
|
|
|
{
|
2014-03-07 11:42:13 +08:00
|
|
|
_commonLineHeight = _font->getFontMaxHeight();
|
|
|
|
_fontAscender = fontTTf->getFontAscender();
|
2014-08-28 07:31:57 +08:00
|
|
|
auto texture = new (std::nothrow) Texture2D;
|
2013-10-29 20:25:03 +08:00
|
|
|
_currentPage = 0;
|
|
|
|
_currentPageOrigX = 0;
|
|
|
|
_currentPageOrigY = 0;
|
2014-01-22 14:57:11 +08:00
|
|
|
_letterPadding = 0;
|
2014-01-21 10:36:32 +08:00
|
|
|
|
2014-03-05 15:54:40 +08:00
|
|
|
if(fontTTf->isDistanceFieldEnabled())
|
2013-12-13 12:42:15 +08:00
|
|
|
{
|
2014-01-21 10:36:32 +08:00
|
|
|
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
|
2013-12-13 12:42:15 +08:00
|
|
|
}
|
2014-03-05 15:54:40 +08:00
|
|
|
_currentPageDataSize = CacheTextureWidth * CacheTextureHeight;
|
2014-09-12 16:03:01 +08:00
|
|
|
auto outlineSize = fontTTf->getOutlineSize();
|
|
|
|
if(outlineSize > 0)
|
2014-03-05 15:54:40 +08:00
|
|
|
{
|
2014-10-22 14:34:01 +08:00
|
|
|
_commonLineHeight += 2 * outlineSize;
|
2014-03-05 15:54:40 +08:00
|
|
|
_currentPageDataSize *= 2;
|
2015-07-03 18:08:32 +08:00
|
|
|
}
|
2013-10-29 20:25:03 +08:00
|
|
|
|
2014-03-14 14:59:26 +08:00
|
|
|
_currentPageData = new unsigned char[_currentPageDataSize];
|
2014-03-27 15:11:04 +08:00
|
|
|
memset(_currentPageData, 0, _currentPageDataSize);
|
|
|
|
|
2014-09-12 16:03:01 +08:00
|
|
|
auto pixelFormat = outlineSize > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8;
|
2014-03-27 15:11:04 +08:00
|
|
|
texture->initWithData(_currentPageData, _currentPageDataSize,
|
|
|
|
pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) );
|
|
|
|
|
2014-03-05 16:51:16 +08:00
|
|
|
addTexture(texture,0);
|
2014-03-05 15:54:40 +08:00
|
|
|
texture->release();
|
2014-07-09 23:03:04 +08:00
|
|
|
|
2014-03-14 14:59:26 +08:00
|
|
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
|
|
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
2014-07-09 23:03:04 +08:00
|
|
|
|
|
|
|
_rendererRecreatedListener = EventListenerCustom::create(EVENT_RENDERER_RECREATED, CC_CALLBACK_1(FontAtlas::listenRendererRecreated, this));
|
|
|
|
eventDispatcher->addEventListenerWithFixedPriority(_rendererRecreatedListener, 1);
|
2014-03-14 14:59:26 +08:00
|
|
|
#endif
|
2014-01-21 10:36:32 +08:00
|
|
|
}
|
2013-07-25 01:22:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
FontAtlas::~FontAtlas()
|
|
|
|
{
|
2014-03-14 14:59:26 +08:00
|
|
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
|
|
|
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
|
2014-07-09 23:03:04 +08:00
|
|
|
if (fontTTf && _rendererRecreatedListener)
|
2014-03-14 14:59:26 +08:00
|
|
|
{
|
|
|
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
2014-07-09 23:03:04 +08:00
|
|
|
eventDispatcher->removeEventListener(_rendererRecreatedListener);
|
|
|
|
_rendererRecreatedListener = nullptr;
|
2014-03-14 14:59:26 +08:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2013-10-31 17:52:22 +08:00
|
|
|
_font->release();
|
2013-07-25 01:22:46 +08:00
|
|
|
relaseTextures();
|
2013-10-29 20:25:03 +08:00
|
|
|
|
2013-10-31 17:52:22 +08:00
|
|
|
delete []_currentPageData;
|
2013-07-25 01:22:46 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void FontAtlas::relaseTextures()
|
|
|
|
{
|
|
|
|
for( auto &item: _atlasTextures)
|
|
|
|
{
|
2013-08-06 07:41:23 +08:00
|
|
|
item.second->release();
|
2013-07-25 01:22:46 +08:00
|
|
|
}
|
2014-03-14 14:59:26 +08:00
|
|
|
_atlasTextures.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
void FontAtlas::purgeTexturesAtlas()
|
|
|
|
{
|
|
|
|
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
|
|
|
|
if (fontTTf && _atlasTextures.size() > 1)
|
|
|
|
{
|
|
|
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
2015-01-21 21:58:18 +08:00
|
|
|
eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this);
|
|
|
|
eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this);
|
2014-03-14 14:59:26 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-07-09 23:03:04 +08:00
|
|
|
void FontAtlas::listenRendererRecreated(EventCustom *event)
|
2014-03-14 14:59:26 +08:00
|
|
|
{
|
|
|
|
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
|
2014-07-09 23:03:04 +08:00
|
|
|
if (fontTTf)
|
2014-03-14 14:59:26 +08:00
|
|
|
{
|
2014-07-09 23:03:04 +08:00
|
|
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
2015-01-21 21:58:18 +08:00
|
|
|
eventDispatcher->dispatchCustomEvent(CMD_PURGE_FONTATLAS,this);
|
|
|
|
eventDispatcher->dispatchCustomEvent(CMD_RESET_FONTATLAS,this);
|
2014-03-14 14:59:26 +08:00
|
|
|
}
|
2013-07-25 01:22:46 +08:00
|
|
|
}
|
|
|
|
|
2013-08-06 08:49:20 +08:00
|
|
|
void FontAtlas::addLetterDefinition(const FontLetterDefinition &letterDefinition)
|
2013-07-20 01:33:26 +08:00
|
|
|
{
|
|
|
|
_fontLetterDefinitions[letterDefinition.letteCharUTF16] = letterDefinition;
|
|
|
|
}
|
|
|
|
|
2014-05-08 11:12:59 +08:00
|
|
|
bool FontAtlas::getLetterDefinitionForChar(char16_t letteCharUTF16, FontLetterDefinition &outDefinition)
|
2013-07-20 01:33:26 +08:00
|
|
|
{
|
2013-07-30 04:43:23 +08:00
|
|
|
auto outIterator = _fontLetterDefinitions.find(letteCharUTF16);
|
2014-03-27 15:35:51 +08:00
|
|
|
|
2013-07-30 04:43:23 +08:00
|
|
|
if (outIterator != _fontLetterDefinitions.end())
|
|
|
|
{
|
2013-08-06 08:49:20 +08:00
|
|
|
outDefinition = (*outIterator).second;
|
|
|
|
return true;
|
2013-07-30 04:43:23 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2014-01-16 11:47:06 +08:00
|
|
|
outDefinition.validDefinition = false;
|
2013-08-06 08:49:20 +08:00
|
|
|
return false;
|
2013-07-30 04:43:23 +08:00
|
|
|
}
|
2013-07-20 01:33:26 +08:00
|
|
|
}
|
|
|
|
|
2014-05-08 11:12:59 +08:00
|
|
|
bool FontAtlas::prepareLetterDefinitions(const std::u16string& utf16String)
|
2013-10-29 20:25:03 +08:00
|
|
|
{
|
2014-03-14 14:59:26 +08:00
|
|
|
FontFreeType* fontTTf = dynamic_cast<FontFreeType*>(_font);
|
2014-05-08 11:12:59 +08:00
|
|
|
if(fontTTf == nullptr)
|
2013-10-29 20:25:03 +08:00
|
|
|
return false;
|
2014-07-09 23:03:04 +08:00
|
|
|
|
2014-05-08 11:12:59 +08:00
|
|
|
size_t length = utf16String.length();
|
2013-10-29 20:25:03 +08:00
|
|
|
|
2014-03-05 15:54:40 +08:00
|
|
|
float offsetAdjust = _letterPadding / 2;
|
2014-03-20 11:58:36 +08:00
|
|
|
long bitmapWidth;
|
|
|
|
long bitmapHeight;
|
2014-03-05 15:54:40 +08:00
|
|
|
Rect tempRect;
|
|
|
|
FontLetterDefinition tempDef;
|
|
|
|
|
|
|
|
auto scaleFactor = CC_CONTENT_SCALE_FACTOR();
|
|
|
|
auto pixelFormat = fontTTf->getOutlineSize() > 0 ? Texture2D::PixelFormat::AI88 : Texture2D::PixelFormat::A8;
|
|
|
|
|
|
|
|
bool existNewLetter = false;
|
2014-03-24 14:16:27 +08:00
|
|
|
int bottomHeight = _commonLineHeight - _fontAscender;
|
2014-04-09 20:41:09 +08:00
|
|
|
|
2014-03-27 15:11:04 +08:00
|
|
|
float startY = _currentPageOrigY;
|
2014-03-24 14:16:27 +08:00
|
|
|
|
2014-05-08 21:06:32 +08:00
|
|
|
for (size_t i = 0; i < length; ++i)
|
2013-10-29 20:25:03 +08:00
|
|
|
{
|
|
|
|
auto outIterator = _fontLetterDefinitions.find(utf16String[i]);
|
2014-03-05 15:54:40 +08:00
|
|
|
|
2013-10-29 20:25:03 +08:00
|
|
|
if (outIterator == _fontLetterDefinitions.end())
|
2013-12-13 12:42:15 +08:00
|
|
|
{
|
2014-03-05 15:54:40 +08:00
|
|
|
existNewLetter = true;
|
2013-12-13 12:42:15 +08:00
|
|
|
|
2014-03-05 15:54:40 +08:00
|
|
|
auto bitmap = fontTTf->getGlyphBitmap(utf16String[i],bitmapWidth,bitmapHeight,tempRect,tempDef.xAdvance);
|
|
|
|
if (bitmap)
|
|
|
|
{
|
|
|
|
tempDef.validDefinition = true;
|
|
|
|
tempDef.letteCharUTF16 = utf16String[i];
|
|
|
|
tempDef.width = tempRect.size.width + _letterPadding;
|
|
|
|
tempDef.height = tempRect.size.height + _letterPadding;
|
|
|
|
tempDef.offsetX = tempRect.origin.x + offsetAdjust;
|
2014-03-07 11:42:13 +08:00
|
|
|
tempDef.offsetY = _fontAscender + tempRect.origin.y - offsetAdjust;
|
2014-03-24 14:16:27 +08:00
|
|
|
tempDef.clipBottom = bottomHeight - (tempDef.height + tempRect.origin.y + offsetAdjust);
|
2013-10-29 20:25:03 +08:00
|
|
|
|
2015-07-03 18:08:32 +08:00
|
|
|
if (bitmapHeight > _currLineHeight)
|
|
|
|
{
|
|
|
|
_currLineHeight = bitmapHeight + 1;
|
|
|
|
}
|
2014-03-05 15:54:40 +08:00
|
|
|
if (_currentPageOrigX + tempDef.width > CacheTextureWidth)
|
|
|
|
{
|
2015-07-03 18:08:32 +08:00
|
|
|
_currentPageOrigY += _currLineHeight;
|
|
|
|
_currLineHeight = 0;
|
2014-03-05 15:54:40 +08:00
|
|
|
_currentPageOrigX = 0;
|
2014-03-07 11:42:13 +08:00
|
|
|
if(_currentPageOrigY + _commonLineHeight >= CacheTextureHeight)
|
2014-06-09 10:12:22 +08:00
|
|
|
{
|
|
|
|
unsigned char *data = nullptr;
|
|
|
|
if(pixelFormat == Texture2D::PixelFormat::AI88)
|
|
|
|
{
|
|
|
|
data = _currentPageData + CacheTextureWidth * (int)startY * 2;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
data = _currentPageData + CacheTextureWidth * (int)startY;
|
|
|
|
}
|
2014-03-27 15:11:04 +08:00
|
|
|
_atlasTextures[_currentPage]->updateWithData(data, 0, startY,
|
|
|
|
CacheTextureWidth, CacheTextureHeight - startY);
|
2014-04-09 20:41:09 +08:00
|
|
|
|
2014-03-27 15:11:04 +08:00
|
|
|
startY = 0.0f;
|
|
|
|
|
2014-03-05 15:54:40 +08:00
|
|
|
_currentPageOrigY = 0;
|
|
|
|
memset(_currentPageData, 0, _currentPageDataSize);
|
|
|
|
_currentPage++;
|
2014-08-28 07:31:57 +08:00
|
|
|
auto tex = new (std::nothrow) Texture2D;
|
2014-03-27 15:35:51 +08:00
|
|
|
if (_antialiasEnabled)
|
|
|
|
{
|
|
|
|
tex->setAntiAliasTexParameters();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
tex->setAliasTexParameters();
|
|
|
|
}
|
2014-03-27 15:11:04 +08:00
|
|
|
tex->initWithData(_currentPageData, _currentPageDataSize,
|
|
|
|
pixelFormat, CacheTextureWidth, CacheTextureHeight, Size(CacheTextureWidth,CacheTextureHeight) );
|
2014-03-05 16:51:16 +08:00
|
|
|
addTexture(tex,_currentPage);
|
2014-03-05 15:54:40 +08:00
|
|
|
tex->release();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
fontTTf->renderCharAt(_currentPageData,_currentPageOrigX,_currentPageOrigY,bitmap,bitmapWidth,bitmapHeight);
|
|
|
|
|
|
|
|
tempDef.U = _currentPageOrigX;
|
|
|
|
tempDef.V = _currentPageOrigY;
|
|
|
|
tempDef.textureID = _currentPage;
|
|
|
|
_currentPageOrigX += tempDef.width + 1;
|
|
|
|
// take from pixels to points
|
|
|
|
tempDef.width = tempDef.width / scaleFactor;
|
|
|
|
tempDef.height = tempDef.height / scaleFactor;
|
|
|
|
tempDef.U = tempDef.U / scaleFactor;
|
|
|
|
tempDef.V = tempDef.V / scaleFactor;
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
if(tempDef.xAdvance)
|
|
|
|
tempDef.validDefinition = true;
|
|
|
|
else
|
|
|
|
tempDef.validDefinition = false;
|
2013-10-29 20:25:03 +08:00
|
|
|
|
|
|
|
tempDef.letteCharUTF16 = utf16String[i];
|
|
|
|
tempDef.width = 0;
|
|
|
|
tempDef.height = 0;
|
|
|
|
tempDef.U = 0;
|
2014-01-17 14:04:52 +08:00
|
|
|
tempDef.V = 0;
|
|
|
|
tempDef.offsetX = 0;
|
2013-10-29 20:25:03 +08:00
|
|
|
tempDef.offsetY = 0;
|
|
|
|
tempDef.textureID = 0;
|
2014-03-24 14:16:27 +08:00
|
|
|
tempDef.clipBottom = 0;
|
2014-03-05 15:54:40 +08:00
|
|
|
_currentPageOrigX += 1;
|
2013-10-29 20:25:03 +08:00
|
|
|
}
|
2014-03-05 15:54:40 +08:00
|
|
|
|
|
|
|
_fontLetterDefinitions[tempDef.letteCharUTF16] = tempDef;
|
2013-10-29 20:25:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-03-05 15:54:40 +08:00
|
|
|
if(existNewLetter)
|
2013-10-29 20:25:03 +08:00
|
|
|
{
|
2015-01-21 21:58:18 +08:00
|
|
|
unsigned char *data = nullptr;
|
|
|
|
if(pixelFormat == Texture2D::PixelFormat::AI88)
|
2014-06-09 10:12:22 +08:00
|
|
|
{
|
2015-01-21 21:58:18 +08:00
|
|
|
data = _currentPageData + CacheTextureWidth * (int)startY * 2;
|
|
|
|
}
|
2014-06-09 10:12:22 +08:00
|
|
|
else
|
|
|
|
{
|
2015-01-21 21:58:18 +08:00
|
|
|
data = _currentPageData + CacheTextureWidth * (int)startY;
|
2014-06-09 10:12:22 +08:00
|
|
|
}
|
2015-01-21 21:58:18 +08:00
|
|
|
_atlasTextures[_currentPage]->updateWithData(data, 0, startY,
|
|
|
|
CacheTextureWidth, _currentPageOrigY - startY + _commonLineHeight);
|
2013-10-29 20:25:03 +08:00
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2014-03-05 16:51:16 +08:00
|
|
|
void FontAtlas::addTexture(Texture2D *texture, int slot)
|
2013-07-20 01:33:26 +08:00
|
|
|
{
|
2014-03-05 16:51:16 +08:00
|
|
|
texture->retain();
|
|
|
|
_atlasTextures[slot] = texture;
|
2013-07-20 01:33:26 +08:00
|
|
|
}
|
|
|
|
|
2014-03-05 16:51:16 +08:00
|
|
|
Texture2D* FontAtlas::getTexture(int slot)
|
2013-07-20 01:33:26 +08:00
|
|
|
{
|
2014-03-05 16:51:16 +08:00
|
|
|
return _atlasTextures[slot];
|
2013-07-20 01:33:26 +08:00
|
|
|
}
|
|
|
|
|
2013-09-13 11:46:46 +08:00
|
|
|
float FontAtlas::getCommonLineHeight() const
|
2013-07-25 01:22:46 +08:00
|
|
|
{
|
|
|
|
return _commonLineHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FontAtlas::setCommonLineHeight(float newHeight)
|
|
|
|
{
|
|
|
|
_commonLineHeight = newHeight;
|
|
|
|
}
|
|
|
|
|
2013-10-31 17:52:22 +08:00
|
|
|
const Font * FontAtlas::getFont() const
|
2013-07-25 01:22:46 +08:00
|
|
|
{
|
|
|
|
return _font;
|
|
|
|
}
|
|
|
|
|
2014-03-27 15:35:51 +08:00
|
|
|
void FontAtlas::setAliasTexParameters()
|
|
|
|
{
|
|
|
|
if (_antialiasEnabled)
|
|
|
|
{
|
|
|
|
_antialiasEnabled = false;
|
|
|
|
for (const auto & tex : _atlasTextures)
|
|
|
|
{
|
|
|
|
tex.second->setAliasTexParameters();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void FontAtlas::setAntiAliasTexParameters()
|
|
|
|
{
|
|
|
|
if (! _antialiasEnabled)
|
|
|
|
{
|
|
|
|
_antialiasEnabled = true;
|
|
|
|
for (const auto & tex : _atlasTextures)
|
|
|
|
{
|
|
|
|
tex.second->setAntiAliasTexParameters();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-01-20 15:03:16 +08:00
|
|
|
NS_CC_END
|