Plane, Sprite: Fix Bitmap flushes in draw handler
Comparing the current SceneElement classes to the earlier written documentation actually immediatelly exposed some bugs. Yay! :D
This commit is contained in:
parent
52dd1dbe2f
commit
82e2901726
2 changed files with 37 additions and 10 deletions
src
|
@ -59,6 +59,8 @@ struct SpritePrivate
|
|||
|
||||
EtcTemps tmp;
|
||||
|
||||
sigc::connection prepareCon;
|
||||
|
||||
SpritePrivate()
|
||||
: bitmap(0),
|
||||
srcRect(&tmp.rect),
|
||||
|
@ -73,11 +75,15 @@ struct SpritePrivate
|
|||
|
||||
{
|
||||
updateSrcRectCon();
|
||||
|
||||
prepareCon = shState->prepareDraw.connect
|
||||
(sigc::mem_fun(this, &SpritePrivate::prepare));
|
||||
}
|
||||
|
||||
~SpritePrivate()
|
||||
{
|
||||
srcRectCon.disconnect();
|
||||
prepareCon.disconnect();
|
||||
}
|
||||
|
||||
void recomputeBushDepth()
|
||||
|
@ -112,6 +118,12 @@ struct SpritePrivate
|
|||
srcRectCon = srcRect->valueChanged.connect
|
||||
(sigc::mem_fun(this, &SpritePrivate::onSrcRectChange));
|
||||
}
|
||||
|
||||
void prepare()
|
||||
{
|
||||
if (bitmap)
|
||||
bitmap->flush();
|
||||
}
|
||||
};
|
||||
|
||||
Sprite::Sprite(Viewport *viewport)
|
||||
|
@ -313,8 +325,6 @@ void Sprite::draw()
|
|||
if (emptyFlashFlag)
|
||||
return;
|
||||
|
||||
p->bitmap->flush();
|
||||
|
||||
ShaderBase *base;
|
||||
|
||||
bool renderEffect = p->color->hasEffect() ||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue