1
0
Fork 0
forked from len0rd/rockbox

Theme Editor: Implemented caching for rendered text, added profiling info to debug build, added a 500msec delay when rendering after code changes to prevent editor from hanging on large themes

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27332 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Robert Bieber 2010-07-07 09:33:47 +00:00
parent 6f06793f58
commit 6d609e009f
11 changed files with 158 additions and 18 deletions

View file

@ -23,24 +23,24 @@
#include <QPainter>
RBText::RBText(const QImage &image, int maxWidth, QGraphicsItem *parent)
RBText::RBText(QImage* image, int maxWidth, QGraphicsItem *parent)
:QGraphicsItem(parent), image(image), maxWidth(maxWidth)
{
}
QRectF RBText::boundingRect() const
{
if(image.width() < maxWidth)
return QRectF(0, 0, image.width(), image.height());
if(image->width() < maxWidth)
return QRectF(0, 0, image->width(), image->height());
else
return QRectF(0, 0, maxWidth, image.height());
return QRectF(0, 0, maxWidth, image->height());
}
void RBText::paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
if(image.width() < maxWidth)
painter->drawImage(0, 0, image, 0, 0, image.width(), image.height());
if(image->width() < maxWidth)
painter->drawImage(0, 0, *image, 0, 0, image->width(), image->height());
else
painter->drawImage(0, 0, image, 0, 0, maxWidth, image.height());
painter->drawImage(0, 0, *image, 0, 0, maxWidth, image->height());
}