summaryrefslogtreecommitdiffstats
path: root/src/declarative/fx/qfxrect.cpp
diff options
context:
space:
mode:
authorWarwick Allison <warwick.allison@nokia.com>2009-05-25 23:01:50 (GMT)
committerWarwick Allison <warwick.allison@nokia.com>2009-05-25 23:01:50 (GMT)
commit07929fef22cb9cffc059f949e216ec585e0e7466 (patch)
treeefb8e9b77a42e528c4e58b9346c773bb3c91688a /src/declarative/fx/qfxrect.cpp
parentf8efe236ec6cb0a8f162f74c9af9682705ff13ed (diff)
downloadQt-07929fef22cb9cffc059f949e216ec585e0e7466.zip
Qt-07929fef22cb9cffc059f949e216ec585e0e7466.tar.gz
Qt-07929fef22cb9cffc059f949e216ec585e0e7466.tar.bz2
Switch from QImage to QPixmap, to allow OpenVG optimization.
Switch QFxPixmap to use QPixmapCache, not own partial QImage cache. OpenGL prefers QImage for optimization, but that optimization is only partially preserved (QFxPixmap deals ONLY with QPixmap now). Opaque QFxPixmap no longer available.
Diffstat (limited to 'src/declarative/fx/qfxrect.cpp')
-rw-r--r--src/declarative/fx/qfxrect.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/src/declarative/fx/qfxrect.cpp b/src/declarative/fx/qfxrect.cpp
index f81f9b3..c5ee60b 100644
--- a/src/declarative/fx/qfxrect.cpp
+++ b/src/declarative/fx/qfxrect.cpp
@@ -187,7 +187,7 @@ void QFxRect::doUpdate()
{
#if defined(QFX_RENDER_QPAINTER)
Q_D(QFxRect);
- d->_rectImage = QSimpleCanvasConfig::Image();
+ d->_rectImage = QPixmap();
#endif
#if defined(QFX_RENDER_OPENGL)
Q_D(QFxRect);
@@ -241,7 +241,7 @@ void QFxRect::setRadius(qreal radius)
d->_radius = radius;
#if defined(QFX_RENDER_QPAINTER)
- d->_rectImage = QSimpleCanvasConfig::Image();
+ d->_rectImage = QPixmap();
#elif defined(QFX_RENDER_OPENGL)
d->_rectTexture.clear();
#endif
@@ -287,7 +287,7 @@ void QFxRect::setColor(const QColor &c)
d->_color = c;
#if defined(QFX_RENDER_QPAINTER)
- d->_rectImage = QSimpleCanvasConfig::Image();
+ d->_rectImage = QPixmap();
#endif
#if defined(QFX_RENDER_OPENGL)
d->_rectTexture.clear();
@@ -401,8 +401,8 @@ void QFxRect::generateRoundedRect()
Q_D(QFxRect);
if (d->_rectImage.isNull()) {
const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0;
- d->_rectImage = QImage(d->_radius*2 + 3 + pw*2, d->_radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied);
- d->_rectImage.fill(0);
+ d->_rectImage = QPixmap(d->_radius*2 + 3 + pw*2, d->_radius*2 + 3 + pw*2);
+ d->_rectImage.fill(Qt::transparent);
QPainter p(&(d->_rectImage));
p.setRenderHint(QPainter::Antialiasing);
if (d->_pen && d->_pen->isValid()) {
@@ -421,8 +421,8 @@ void QFxRect::generateBorderedRect()
Q_D(QFxRect);
if (d->_rectImage.isNull()) {
const int pw = d->_pen && d->_pen->isValid() ? d->_pen->width() : 0;
- d->_rectImage = QImage(d->pen()->width()*2 + 3 + pw*2, d->pen()->width()*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied);
- d->_rectImage.fill(0);
+ d->_rectImage = QPixmap(d->pen()->width()*2 + 3 + pw*2, d->pen()->width()*2 + 3 + pw*2);
+ d->_rectImage.fill(Qt::transparent);
QPainter p(&(d->_rectImage));
p.setRenderHint(QPainter::Antialiasing);
if (d->_pen && d->_pen->isValid()) {
@@ -560,39 +560,39 @@ void QFxRect::drawRect(QPainter &p)
}
// Upper left
- p.drawImage(QRect(-pw/2, -pw/2, xOffset, yOffset), d->_rectImage, QRect(0, 0, xOffset, yOffset));
+ p.drawPixmap(QRect(-pw/2, -pw/2, xOffset, yOffset), d->_rectImage, QRect(0, 0, xOffset, yOffset));
// Upper middle
if (xMiddles)
- p.drawImage(QRect(xOffset-pw/2, -pw/2, width() - xSide + pw, yOffset), d->_rectImage,
+ p.drawPixmap(QRect(xOffset-pw/2, -pw/2, width() - xSide + pw, yOffset), d->_rectImage,
QRect(d->_rectImage.width()/2, 0, 1, yOffset));
// Upper right
- p.drawImage(QPoint(width()-xOffset+pw/2, -pw/2), d->_rectImage,
+ p.drawPixmap(QPoint(width()-xOffset+pw/2, -pw/2), d->_rectImage,
QRect(d->_rectImage.width()-xOffset, 0, xOffset, yOffset));
// Middle left
if (yMiddles)
- p.drawImage(QRect(-pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage,
+ p.drawPixmap(QRect(-pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage,
QRect(0, d->_rectImage.height()/2, xOffset, 1));
// Middle
if (xMiddles && yMiddles)
// XXX paint errors in animation example
//p.fillRect(xOffset-pw/2, yOffset-pw/2, width() - xSide + pw, height() - ySide + pw, d->getColor());
- p.drawImage(QRect(xOffset-pw/2, yOffset-pw/2, width() - xSide + pw, height() - ySide + pw), d->_rectImage,
+ p.drawPixmap(QRect(xOffset-pw/2, yOffset-pw/2, width() - xSide + pw, height() - ySide + pw), d->_rectImage,
QRect(d->_rectImage.width()/2, d->_rectImage.height()/2, 1, 1));
// Middle right
if (yMiddles)
- p.drawImage(QRect(width()-xOffset+pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage,
+ p.drawPixmap(QRect(width()-xOffset+pw/2, yOffset-pw/2, xOffset, height() - ySide + pw), d->_rectImage,
QRect(d->_rectImage.width()-xOffset, d->_rectImage.height()/2, xOffset, 1));
// Lower left
- p.drawImage(QPoint(-pw/2, height() - yOffset + pw/2), d->_rectImage, QRect(0, d->_rectImage.height() - yOffset, xOffset, yOffset));
+ p.drawPixmap(QPoint(-pw/2, height() - yOffset + pw/2), d->_rectImage, QRect(0, d->_rectImage.height() - yOffset, xOffset, yOffset));
// Lower Middle
if (xMiddles)
- p.drawImage(QRect(xOffset-pw/2, height() - yOffset +pw/2, width() - xSide + pw, yOffset), d->_rectImage,
+ p.drawPixmap(QRect(xOffset-pw/2, height() - yOffset +pw/2, width() - xSide + pw, yOffset), d->_rectImage,
QRect(d->_rectImage.width()/2, d->_rectImage.height() - yOffset, 1, yOffset));
// Lower Right
- p.drawImage(QPoint(width()-xOffset+pw/2, height() - yOffset+pw/2), d->_rectImage,
+ p.drawPixmap(QPoint(width()-xOffset+pw/2, height() - yOffset+pw/2), d->_rectImage,
QRect(d->_rectImage.width()-xOffset, d->_rectImage.height() - yOffset, xOffset, yOffset));
}
}