Skip to content

Commit

Permalink
libgui|Atlas: Added OutOfSpace audience
Browse files Browse the repository at this point in the history
Notified when allocation of an image fails.
  • Loading branch information
skyjake committed Jul 4, 2013
1 parent 5c0a841 commit 199409d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions doomsday/libgui/include/de/gui/atlas.h
Expand Up @@ -111,6 +111,12 @@ class LIBGUI_PUBLIC Atlas : public Lockable
*/
DENG2_DEFINE_AUDIENCE(Reposition, void atlasContentRepositioned(Atlas &))

/**
* Audience that will be notified when an allocation fails due to the atlas
* being so full that there is no room for the new image.
*/
DENG2_DEFINE_AUDIENCE(OutOfSpace, void atlasOutOfSpace(Atlas &))

public:
/**
* Constructs a new atlas.
Expand Down
5 changes: 5 additions & 0 deletions doomsday/libgui/src/atlas.cpp
Expand Up @@ -251,6 +251,11 @@ Id Atlas::alloc(Image const &image)
else
{
LOG_DEBUG("Atlas is full with %.1f%% usage") << d->usedPercentage()*100;

DENG2_FOR_AUDIENCE(OutOfSpace, i)
{
i->atlasOutOfSpace(*this);
}
}
return id;
}
Expand Down

0 comments on commit 199409d

Please sign in to comment.