diff options
author | Jørgen Lind <jorgen.lind@nokia.com> | 2009-11-25 09:54:54 (GMT) |
---|---|---|
committer | Jørgen Lind <jorgen.lind@nokia.com> | 2009-11-25 09:56:00 (GMT) |
commit | cd33927ac31c37ed3feb6a5a3be28d3d152bda19 (patch) | |
tree | 6177060e187f0dc09a37e50823be9e46ede1d7cf /src/gui/image/qpixmap_blitter.cpp | |
parent | 79b6ad01115cc9208e8a22d8dc925215da9792ed (diff) | |
download | Qt-cd33927ac31c37ed3feb6a5a3be28d3d152bda19.zip Qt-cd33927ac31c37ed3feb6a5a3be28d3d152bda19.tar.gz Qt-cd33927ac31c37ed3feb6a5a3be28d3d152bda19.tar.bz2 |
Fix QBlittablePixmapData::fromImage
There is still a stride problem when running the browser demo
Diffstat (limited to 'src/gui/image/qpixmap_blitter.cpp')
-rw-r--r-- | src/gui/image/qpixmap_blitter.cpp | 28 |
1 files changed, 17 insertions, 11 deletions
diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 82e0045..35d6ddb 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -1,5 +1,7 @@ #include "qpixmap_blitter_p.h" +#include <qpainter.h> + #include <private/qapplication_p.h> #include <private/qgraphicssystem_p.h> @@ -14,10 +16,11 @@ QBlittablePixmapData::~QBlittablePixmapData() delete m_engine; } -QBlittable *QBlittablePixmapData::blittable() +QBlittable *QBlittablePixmapData::blittable() const { if (!m_blittable) { - m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); + QBlittablePixmapData *that = const_cast<QBlittablePixmapData *>(this); + that->m_blittable = QApplicationPrivate::graphicsSystem()->createBlittable(QRect(0,0,w,h)); } return m_blittable; @@ -73,32 +76,35 @@ int QBlittablePixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const void QBlittablePixmapData::fill(const QColor &color) { - if (m_blittable->capabilities() & QBlittable::SolidRectCapability) - m_blittable->fillRect(m_blittable->rect(),color); + if (blittable()->capabilities() & QBlittable::SolidRectCapability) + blittable()->fillRect(m_blittable->rect(),color); else - m_blittable->lock()->fill(color.rgb()); + blittable()->lock()->fill(color.rgb()); } QImage *QBlittablePixmapData::buffer() { - return m_blittable->lock(); + return blittable()->lock(); } QImage QBlittablePixmapData::toImage() const { - return m_blittable->lock()->copy(); + return blittable()->lock()->copy(); } bool QBlittablePixmapData::hasAlphaChannel() const { - return m_blittable->lock()->hasAlphaChannel(); + return blittable()->lock()->hasAlphaChannel(); } void QBlittablePixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags) + Qt::ImageConversionFlags flags) { - m_blittable = new QImageBlitter(image); - m_engine = 0; + resize(image.width(),image.height()); + QImage *thisImg = blittable()->lock(); + QPainter p(thisImg); + p.drawImage(0,0,image,flags); + } QPaintEngine *QBlittablePixmapData::paintEngine() const |