diff options
author | Jyri Tahtela <jyri.tahtela@nokia.com> | 2011-06-27 08:47:01 (GMT) |
---|---|---|
committer | Jyri Tahtela <jyri.tahtela@nokia.com> | 2011-06-27 08:47:01 (GMT) |
commit | 9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267 (patch) | |
tree | e7d472a44f7b1c95961f8f31d792e8a04cf66c34 /src/gui/painting | |
parent | f078275a2a4b2a279a6fcc24df3c21fe8b21f007 (diff) | |
parent | 36a464681a349a0915f821786b4617695c1d02d4 (diff) | |
download | Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.zip Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.tar.gz Qt-9f3fc0e9ce48c52c33c0ea9ff3f8b04d0c276267.tar.bz2 |
Merge remote-tracking branch 'qt/4.8'
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/painting.pri | 4 | ||||
-rw-r--r-- | src/gui/painting/qbrush.cpp | 18 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_raster.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine.cpp | 1 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster_symbian.cpp (renamed from src/gui/painting/qpaintengine_s60.cpp) | 64 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster_symbian_p.h (renamed from src/gui/painting/qpaintengine_s60_p.h) | 18 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_qws.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_s60.cpp | 14 |
10 files changed, 70 insertions, 67 deletions
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index d5ae364..27b1bf2 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -198,12 +198,12 @@ qpa { symbian { SOURCES += \ - painting/qpaintengine_s60.cpp \ + painting/qpaintengine_raster_symbian.cpp \ painting/qregion_s60.cpp \ painting/qcolormap_s60.cpp HEADERS += \ - painting/qpaintengine_s60_p.h + painting/qpaintengine_raster_symbian_p.h } x11|embedded|qpa { diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index 5d8f43b..79c4c4e 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -1826,9 +1826,9 @@ static QPointF qt_radial_gradient_adapt_focal_point(const QPointF ¢er, radius and \a focalPoint. \note If the given focal point is outside the circle defined by the - center (\a cx, \a cy) and the \a radius it will be re-adjusted to - the intersection between the line from the center to the focal point - and the circle. + \a center point and \a radius, it will be re-adjusted to lie at a point on + the circle where it intersects with the line from \a center to + \a focalPoint. \sa QGradient::setColorAt(), QGradient::setStops() */ @@ -1947,11 +1947,9 @@ QRadialGradient::QRadialGradient(const QPointF ¢er, qreal centerRadius, cons /*! \since 4.8 - Constructs an extended radial gradient with the given \a center, \a - centerRadius, \a focalPoint, and \a focalRadius. - Constructs a radial gradient with the given center (\a cx, \a cy), - center radius \a centerRadius, focal point (\a fx, \a fy), and - focal radius \a focalRadius. + Constructs an extended radial gradient with the given center + (\a cx, \a cy), center radius, \a centerRadius, focal point, (\a fx, \a fy), + and focal radius \a focalRadius. */ QRadialGradient::QRadialGradient(qreal cx, qreal cy, qreal centerRadius, qreal fx, qreal fy, qreal focalRadius) { @@ -2049,7 +2047,7 @@ qreal QRadialGradient::centerRadius() const return m_data.radial.cradius; } -/* +/*! \since 4.8 Sets the center radius of this radial gradient in logical coordinates @@ -2080,7 +2078,7 @@ qreal QRadialGradient::focalRadius() const return u.f; } -/* +/*! \since 4.8 Sets the focal radius of this radial gradient in logical coordinates diff --git a/src/gui/painting/qgraphicssystem.cpp b/src/gui/painting/qgraphicssystem.cpp index d4a8015..04e45d2 100644 --- a/src/gui/painting/qgraphicssystem.cpp +++ b/src/gui/painting/qgraphicssystem.cpp @@ -54,7 +54,7 @@ # include <QtGui/private/qapplication_p.h> #endif #ifdef Q_OS_SYMBIAN -# include <private/qpixmap_s60_p.h> +# include <private/qpixmap_raster_symbian_p.h> # include <private/qgraphicssystemex_symbian_p.h> #else # include <private/qgraphicssystemex_p.h> @@ -80,7 +80,7 @@ QPixmapData *QGraphicsSystem::createDefaultPixmapData(QPixmapData::PixelType typ #elif defined(Q_WS_QPA) return QApplicationPrivate::platformIntegration()->createPixmapData(type); #elif defined(Q_OS_SYMBIAN) - return new QS60PixmapData(type); + return new QSymbianRasterPixmapData(type); #elif !defined(Q_WS_QWS) #error QGraphicsSystem::createDefaultPixmapData() not implemented #endif diff --git a/src/gui/painting/qgraphicssystem_raster.cpp b/src/gui/painting/qgraphicssystem_raster.cpp index 0edbe9f..addfff7 100644 --- a/src/gui/painting/qgraphicssystem_raster.cpp +++ b/src/gui/painting/qgraphicssystem_raster.cpp @@ -42,7 +42,7 @@ #include "qgraphicssystem_raster_p.h" #ifdef Q_OS_SYMBIAN -#include "private/qpixmap_s60_p.h" +#include "private/qpixmap_raster_symbian_p.h" #include "private/qwindowsurface_s60_p.h" #else #include "private/qpixmap_raster_p.h" @@ -54,7 +54,7 @@ QT_BEGIN_NAMESPACE QPixmapData *QRasterGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const { #ifdef Q_OS_SYMBIAN - return new QS60PixmapData(type); + return new QSymbianRasterPixmapData(type); #else return new QRasterPixmapData(type); #endif diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 9562d83..c46513a 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -387,6 +387,7 @@ void QPaintEngine::drawPolygon(const QPoint *points, int pointCount, PolygonDraw \value MaxUser Last user type ID \value OpenGL2 \value PaintBuffer + \value Blitter */ /*! diff --git a/src/gui/painting/qpaintengine_s60.cpp b/src/gui/painting/qpaintengine_raster_symbian.cpp index 091e2e6..3b27077 100644 --- a/src/gui/painting/qpaintengine_s60.cpp +++ b/src/gui/painting/qpaintengine_raster_symbian.cpp @@ -38,29 +38,30 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -#include <private/qpaintengine_s60_p.h> -#include <private/qpixmap_s60_p.h> + +#include <private/qpaintengine_raster_symbian_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <private/qt_s60_p.h> #include <private/qvolatileimage_p.h> QT_BEGIN_NAMESPACE -class QS60PaintEnginePrivate : public QRasterPaintEnginePrivate +class QSymbianRasterPaintEnginePrivate : public QRasterPaintEnginePrivate { public: - QS60PaintEnginePrivate() {} + QSymbianRasterPaintEnginePrivate() {} }; -QS60PaintEngine::QS60PaintEngine(QPaintDevice *device, QS60PixmapData *data) - : QRasterPaintEngine(*(new QS60PaintEnginePrivate), device), pixmapData(data) +QSymbianRasterPaintEngine::QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data) + : QRasterPaintEngine(*(new QSymbianRasterPaintEnginePrivate), device), pixmapData(data) { } -bool QS60PaintEngine::begin(QPaintDevice *device) +bool QSymbianRasterPaintEngine::begin(QPaintDevice *device) { - Q_D(QS60PaintEngine); + Q_D(QSymbianRasterPaintEngine); - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) { pixmapData->beginDataAccess(); bool ret = QRasterPaintEngine::begin(device); // Make sure QPaintEngine::paintDevice() returns the proper device. @@ -69,13 +70,12 @@ bool QS60PaintEngine::begin(QPaintDevice *device) d->pdev = device; return ret; } - return QRasterPaintEngine::begin(device); } -bool QS60PaintEngine::end() +bool QSymbianRasterPaintEngine::end() { - if (pixmapData->classId() == QPixmapData::RasterClass) { + if (pixmapData && pixmapData->classId() == QPixmapData::RasterClass) { bool ret = QRasterPaintEngine::end(); pixmapData->endDataAccess(); return ret; @@ -83,50 +83,51 @@ bool QS60PaintEngine::end() return QRasterPaintEngine::end(); } -void QS60PaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) +void QSymbianRasterPaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(p, pm); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(p, img->imageRef()); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + // imageRef() would detach and since we received the QVolatileImage + // from toVolatileImage() by value, it would cause a copy which + // would ruin our goal. So use constImageRef() instead. + QRasterPaintEngine::drawImage(p, img.constImageRef()); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(p, pm); } } } -void QS60PaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) +void QSymbianRasterPaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawPixmap(r, pm, sr); srcData->endDataAccess(); } else { - void *nativeData = pm.pixmapData()->toNativeType(QPixmapData::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast<QVolatileImage *>(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(r, img->imageRef(), sr); - img->endDataAccess(true); + QVolatileImage img = pm.pixmapData()->toVolatileImage(); + if (!img.isNull()) { + img.beginDataAccess(); + QRasterPaintEngine::drawImage(r, img.constImageRef(), sr); + img.endDataAccess(true); } else { QRasterPaintEngine::drawPixmap(r, pm, sr); } } } -void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) +void QSymbianRasterPaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const QPointF &sr) { if (pm.pixmapData()->classId() == QPixmapData::RasterClass) { - QS60PixmapData *srcData = static_cast<QS60PixmapData *>(pm.pixmapData()); + QSymbianRasterPixmapData *srcData = static_cast<QSymbianRasterPixmapData *>(pm.pixmapData()); srcData->beginDataAccess(); QRasterPaintEngine::drawTiledPixmap(r, pm, sr); srcData->endDataAccess(); @@ -135,7 +136,8 @@ void QS60PaintEngine::drawTiledPixmap(const QRectF &r, const QPixmap &pm, const } } -void QS60PaintEngine::prepare(QImage *image) +// used by QSymbianRasterPixmapData::beginDataAccess() +void QSymbianRasterPaintEngine::prepare(QImage *image) { QRasterBuffer *buffer = d_func()->rasterBuffer.data(); if (buffer) diff --git a/src/gui/painting/qpaintengine_s60_p.h b/src/gui/painting/qpaintengine_raster_symbian_p.h index 2a3b443..cb51ecb 100644 --- a/src/gui/painting/qpaintengine_s60_p.h +++ b/src/gui/painting/qpaintengine_raster_symbian_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QPAINTENGINE_S60_P_H -#define QPAINTENGINE_S60_P_H +#ifndef QPAINTENGINE_RASTER_SYMBIAN_P_H +#define QPAINTENGINE_RASTER_SYMBIAN_P_H // // W A R N I N G @@ -57,15 +57,15 @@ QT_BEGIN_NAMESPACE -class QS60PaintEnginePrivate; -class QS60PixmapData; +class QSymbianRasterPaintEnginePrivate; +class QSymbianRasterPixmapData; -class QS60PaintEngine : public QRasterPaintEngine +class QSymbianRasterPaintEngine : public QRasterPaintEngine { - Q_DECLARE_PRIVATE(QS60PaintEngine) + Q_DECLARE_PRIVATE(QSymbianRasterPaintEngine) public: - QS60PaintEngine(QPaintDevice *device, QS60PixmapData* data); + QSymbianRasterPaintEngine(QPaintDevice *device, QSymbianRasterPixmapData *data = 0); bool begin(QPaintDevice *device); bool end(); @@ -76,9 +76,9 @@ public: void prepare(QImage* image); private: - QS60PixmapData *pixmapData; + QSymbianRasterPixmapData *pixmapData; }; QT_END_NAMESPACE -#endif // QPAINTENGINE_S60_P_H +#endif // QPAINTENGINE_RASTER_SYMBIAN_P_H diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 8510416..5105d9a 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1084,7 +1084,7 @@ void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem) changedHints = true; } - fill(qtVectorPathForPath(path), staticTextItem->color); + fill(qtVectorPathForPath(path), s->pen.color()); if (changedHints) { s->renderHints = oldHints; diff --git a/src/gui/painting/qwindowsurface_qws.cpp b/src/gui/painting/qwindowsurface_qws.cpp index 7e8cf9b..3789a33 100644 --- a/src/gui/painting/qwindowsurface_qws.cpp +++ b/src/gui/painting/qwindowsurface_qws.cpp @@ -1065,10 +1065,12 @@ bool QWSSharedMemSurface::setMemory(int memId) return true; mem.detach(); - if (!mem.attach(memId)) { + + if (memId != -1 && !mem.attach(memId)) { +#ifndef QT_NO_DEBUG perror("QWSSharedMemSurface: attaching to shared memory"); - qCritical("QWSSharedMemSurface: Error attaching to" - " shared memory 0x%x", memId); + qCritical("QWSSharedMemSurface: Error attaching to shared memory 0x%x", memId); +#endif return false; } diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 8801d75..d1ac926 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -44,7 +44,7 @@ #include <QtGui/qpaintdevice.h> #include <private/qwidget_p.h> #include <private/qwindowsurface_s60_p.h> -#include <private/qpixmap_s60_p.h> +#include <private/qpixmap_raster_symbian_p.h> #include <private/qt_s60_p.h> #include <private/qapplication_p.h> #include <private/qdrawhelper_p.h> @@ -92,7 +92,7 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) Q_CHECK_PTR(bitmap); qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); - QS60PixmapData *data = new QS60PixmapData(QPixmapData::PixmapType); + QSymbianRasterPixmapData *data = new QSymbianRasterPixmapData(QPixmapData::PixmapType); if (data) { data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); @@ -131,7 +131,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) QWidgetPrivate *windowPrivate = qt_widget_private(window()); if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) { - QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *pixmapData = static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data()); TDisplayMode mode = displayMode(false); if (pixmapData->cfbsBitmap->DisplayMode() != mode) @@ -169,7 +169,7 @@ QImage* QS60WindowSurface::buffer(const QWidget *widget) return 0; const QPoint off = offset(widget); - QImage *img = &(static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data())->image); + QImage *img = &(static_cast<QSymbianRasterPixmapData *>(d_ptr->device.data_ptr().data())->image); QRect rect(off, widget->size()); rect &= QRect(QPoint(), img->size()); @@ -217,7 +217,7 @@ bool QS60WindowSurface::scroll(const QRegion &area, int dx, int dy) if (d_ptr->device.isNull()) return false; - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); data->scroll(dx, dy, rect); return true; @@ -233,7 +233,7 @@ void QS60WindowSurface::setGeometry(const QRect& rect) if (rect == geometry()) return; - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); data->resize(rect.width(), rect.height()); QWindowSurface::setGeometry(rect); @@ -246,7 +246,7 @@ QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const CFbsBitmap* QS60WindowSurface::symbianBitmap() const { - QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); + QSymbianRasterPixmapData *data = static_cast<QSymbianRasterPixmapData*>(d_ptr->device.data_ptr().data()); return data->cfbsBitmap; } |