Skip to content

Commit

Permalink
libappfw: Redesigned TextDrawable with better multitasking
Browse files Browse the repository at this point in the history
This new implementation of TextDrawable can cleanly have multiple
ongoing wrapping tasks, can be deleted immediately without waiting,
and does no questionable copying of front/back wrapping data.
  • Loading branch information
skyjake committed Oct 21, 2014
1 parent 55b0f65 commit ee85daf
Show file tree
Hide file tree
Showing 3 changed files with 233 additions and 150 deletions.
1 change: 0 additions & 1 deletion doomsday/libappfw/include/de/framework/textdrawable.h
Expand Up @@ -94,7 +94,6 @@ class LIBAPPFW_PUBLIC TextDrawable : public GLTextComposer

Vector2ui wrappedSize() const;
String text() const;
String plainText() const;
bool isBeingWrapped() const;
Font const &font() const;

Expand Down
9 changes: 8 additions & 1 deletion doomsday/libappfw/src/gltextcomposer.cpp
Expand Up @@ -374,7 +374,11 @@ void GLTextComposer::setAtlas(Atlas &atlas)

void GLTextComposer::setWrapping(FontLineWrapping const &wrappedLines)
{
d->wraps = &wrappedLines;
if(d->wraps != &wrappedLines)
{
d->wraps = &wrappedLines;
forceUpdate();
}
}

void GLTextComposer::setText(String const &text)
Expand Down Expand Up @@ -410,6 +414,9 @@ bool GLTextComposer::update()
{
DENG2_ASSERT(d->wraps != 0);

// If a font hasn't been defined, there isn't much to do.
if(!d->wraps->hasFont()) return false;

if(d->font != &d->wraps->font())
{
d->font = &d->wraps->font();
Expand Down

0 comments on commit ee85daf

Please sign in to comment.