Improved Atlas class
It now handles layer resize failure and will notify listeners of a pointer change Former-commit-id: df5e2a129897128a4e41e0b3205f6a1dbeb2069c
This commit is contained in:
@@ -17,8 +17,7 @@ class NAZARA_API NzGuillotineTextureAtlas : public NzGuillotineImageAtlas
|
||||
~NzGuillotineTextureAtlas() = default;
|
||||
|
||||
private:
|
||||
unsigned int GetMaxAtlasSize() const override;
|
||||
bool ResizeImage(Layer& layer, const NzVector2ui& size) const override;
|
||||
NzAbstractImage* ResizeImage(NzAbstractImage* oldImage, const NzVector2ui& size) const override;
|
||||
};
|
||||
|
||||
#endif // NAZARA_GUILLOTINETEXTUREATLAS_HPP
|
||||
|
||||
@@ -40,11 +40,13 @@ class NAZARA_API NzAbstractAtlas
|
||||
virtual ~Listener();
|
||||
|
||||
virtual bool OnAtlasCleared(const NzAbstractAtlas* atlas, void* userdata);
|
||||
virtual bool OnAtlasLayerChange(const NzAbstractAtlas* atlas, NzAbstractImage* oldLayer, NzAbstractImage* newLayer, void* userdata);
|
||||
virtual void OnAtlasReleased(const NzAbstractAtlas* atlas, void* userdata);
|
||||
};
|
||||
|
||||
protected:
|
||||
void NotifyCleared();
|
||||
void NotifyLayerChange(NzAbstractImage* oldLayer, NzAbstractImage* newLayer);
|
||||
|
||||
private:
|
||||
mutable std::unordered_map<Listener*, void*> m_listeners;
|
||||
|
||||
@@ -37,8 +37,8 @@ class NAZARA_API NzGuillotineImageAtlas : public NzAbstractAtlas
|
||||
protected:
|
||||
struct Layer;
|
||||
|
||||
virtual unsigned int GetMaxAtlasSize() const;
|
||||
virtual bool ResizeImage(Layer& layer, const NzVector2ui& size) const;
|
||||
virtual NzAbstractImage* ResizeImage(NzAbstractImage* oldImage, const NzVector2ui& size) const;
|
||||
bool ResizeLayer(Layer& layer, const NzVector2ui& size);
|
||||
|
||||
struct QueuedGlyph
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user