From cfe1bcf107acc6b285fffc0482be41578656a569 Mon Sep 17 00:00:00 2001 From: Lynix Date: Sat, 17 Jan 2015 22:48:27 +0100 Subject: [PATCH] Fixed Font::[Get|Set]Atlas interface Former-commit-id: 7670317dc2684fc0f9240a1f188e4ba92592a263 --- include/Nazara/Utility/Font.hpp | 4 ++-- src/Nazara/Graphics/TextSprite.cpp | 2 +- src/Nazara/Utility/Font.cpp | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/Nazara/Utility/Font.hpp b/include/Nazara/Utility/Font.hpp index db675ff8c..99ef0555d 100644 --- a/include/Nazara/Utility/Font.hpp +++ b/include/Nazara/Utility/Font.hpp @@ -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; - const NzAbstractAtlas* GetAtlas() const; + const std::shared_ptr& GetAtlas() const; unsigned int GetCachedGlyphCount(unsigned int characterSize, nzUInt32 style) const; unsigned int GetCachedGlyphCount() 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 OpenFromStream(NzInputStream& stream, const NzFontParams& params = NzFontParams()); - void SetAtlas(std::shared_ptr atlas); + void SetAtlas(const std::shared_ptr& atlas); void SetGlyphBorder(unsigned int borderSize); void SetMinimumStepSize(unsigned int minimumStepSize); diff --git a/src/Nazara/Graphics/TextSprite.cpp b/src/Nazara/Graphics/TextSprite.cpp index 3b34b1ce3..59630ab57 100644 --- a/src/Nazara/Graphics/TextSprite.cpp +++ b/src/Nazara/Graphics/TextSprite.cpp @@ -132,7 +132,7 @@ void NzTextSprite::SetText(const NzAbstractTextDrawer& drawer) unsigned int fontCount = drawer.GetFontCount(); 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) atlas->AddListener(this); } diff --git a/src/Nazara/Utility/Font.cpp b/src/Nazara/Utility/Font.cpp index a2b4bc645..9052c15a1 100644 --- a/src/Nazara/Utility/Font.cpp +++ b/src/Nazara/Utility/Font.cpp @@ -104,9 +104,9 @@ bool NzFont::ExtractGlyph(unsigned int characterSize, char32_t character, nzUInt return m_data->ExtractGlyph(characterSize, character, style, glyph); } -const NzAbstractAtlas* NzFont::GetAtlas() const +const std::shared_ptr& NzFont::GetAtlas() const { - return m_atlas.get(); + return m_atlas; } 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); } -void NzFont::SetAtlas(std::shared_ptr atlas) +void NzFont::SetAtlas(const std::shared_ptr& atlas) { if (m_atlas != atlas) {