Fixed Font::[Get|Set]Atlas interface

Former-commit-id: 7670317dc2684fc0f9240a1f188e4ba92592a263
This commit is contained in:
Lynix 2015-01-17 22:48:27 +01:00
parent 722fba5d0c
commit cfe1bcf107
3 changed files with 6 additions and 6 deletions

View File

@ -49,7 +49,7 @@ class NAZARA_API NzFont : public NzResource, NzAbstractAtlas::Listener, NzNonCop
bool ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt32 style, NzFontGlyph* glyph) const; bool ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt32 style, NzFontGlyph* glyph) const;
const NzAbstractAtlas* GetAtlas() const; const std::shared_ptr<NzAbstractAtlas>& GetAtlas() const;
unsigned int GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const; unsigned int GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const;
unsigned int GetCachedGlyphCount() const; unsigned int GetCachedGlyphCount() const;
NzString GetFamilyName() const; NzString GetFamilyName() const;
@ -70,7 +70,7 @@ class NAZARA_API NzFont : public NzResource, NzAbstractAtlas::Listener, NzNonCop
bool OpenFromMemory(const void* data, std::size_t size, const NzFontParams& params = NzFontParams()); bool OpenFromMemory(const void* data, std::size_t size, const NzFontParams& params = NzFontParams());
bool OpenFromStream(NzInputStream& stream, const NzFontParams& params = NzFontParams()); bool OpenFromStream(NzInputStream& stream, const NzFontParams& params = NzFontParams());
void SetAtlas(std::shared_ptr<NzAbstractAtlas> atlas); void SetAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas);
void SetGlyphBorder(unsigned int borderSize); void SetGlyphBorder(unsigned int borderSize);
void SetMinimumStepSize(unsigned int minimumStepSize); void SetMinimumStepSize(unsigned int minimumStepSize);

View File

@ -132,7 +132,7 @@ void NzTextSprite::SetText(const NzAbstractTextDrawer& drawer)
unsigned int fontCount = drawer.GetFontCount(); unsigned int fontCount = drawer.GetFontCount();
for (unsigned int i = 0; i < fontCount; ++i) for (unsigned int i = 0; i < fontCount; ++i)
{ {
const NzAbstractAtlas* atlas = drawer.GetFont(i)->GetAtlas(); const NzAbstractAtlas* atlas = drawer.GetFont(i)->GetAtlas().get();
if (m_atlases.insert(atlas).second) if (m_atlases.insert(atlas).second)
atlas->AddListener(this); atlas->AddListener(this);
} }

View File

@ -104,9 +104,9 @@ bool NzFont::ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt
return m_data->ExtractGlyph(characterSize, character, style, glyph); return m_data->ExtractGlyph(characterSize, character, style, glyph);
} }
const NzAbstractAtlas* NzFont::GetAtlas() const const std::shared_ptr<NzAbstractAtlas>& NzFont::GetAtlas() const
{ {
return m_atlas.get(); return m_atlas;
} }
unsigned int NzFont::GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const unsigned int NzFont::GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const
@ -277,7 +277,7 @@ bool NzFont::OpenFromStream(NzInputStream& stream, const NzFontParams& params)
return NzFontLoader::LoadFromStream(this, stream, params); return NzFontLoader::LoadFromStream(this, stream, params);
} }
void NzFont::SetAtlas(std::shared_ptr<NzAbstractAtlas> atlas) void NzFont::SetAtlas(const std::shared_ptr<NzAbstractAtlas>& atlas)
{ {
if (m_atlas != atlas) if (m_atlas != atlas)
{ {