summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-11-30 18:50:23 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-11-30 18:50:23 (GMT)
commit2c8b7f0a4e8a7621e5efbb49e3af9ef1ee367b30 (patch)
tree59d646ce16266dc42bd113fb5e718a4ccc9c33c7
parentb498d78ce5cb62dce740fb366bbd76e3c66c7a85 (diff)
parent3e69b6b8f8e62bc7ca0944a957371e6d5de4640b (diff)
downloadQt-2c8b7f0a4e8a7621e5efbb49e3af9ef1ee367b30.zip
Qt-2c8b7f0a4e8a7621e5efbb49e3af9ef1ee367b30.tar.gz
Qt-2c8b7f0a4e8a7621e5efbb49e3af9ef1ee367b30.tar.bz2
Merge branch 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into master-integration
* 'master' of scm.dev.nokia.troll.no:qt/oslo-staging-1: avoid the warning about comparison between signed and unsigned integers QRasterPixmapData: Reuse underlying QImage in fill() if possible.
-rw-r--r--src/corelib/kernel/qeventdispatcher_win.cpp2
-rw-r--r--src/gui/image/qimage.cpp42
-rw-r--r--src/gui/image/qimage_p.h36
-rw-r--r--src/gui/image/qpixmap_raster.cpp8
4 files changed, 47 insertions, 41 deletions
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index 91c20b5..a363874 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -492,7 +492,7 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
// we also use a Windows timer to send posted events when the message queue is full
|| (message == WM_TIMER
&& d->sendPostedEventsWindowsTimerId != 0
- && wp == d->sendPostedEventsWindowsTimerId)) {
+ && wp == (uint)d->sendPostedEventsWindowsTimerId)) {
int localSerialNumber = d->serialNumber;
if (localSerialNumber != d->lastSerialNumber) {
d->lastSerialNumber = localSerialNumber;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index d86021cb9..747dd2f 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -139,42 +139,6 @@ QImageData::QImageData()
{
}
-static int depthForFormat(QImage::Format format)
-{
- int depth = 0;
- switch(format) {
- case QImage::Format_Invalid:
- case QImage::NImageFormats:
- Q_ASSERT(false);
- case QImage::Format_Mono:
- case QImage::Format_MonoLSB:
- depth = 1;
- break;
- case QImage::Format_Indexed8:
- depth = 8;
- break;
- case QImage::Format_RGB32:
- case QImage::Format_ARGB32:
- case QImage::Format_ARGB32_Premultiplied:
- depth = 32;
- break;
- case QImage::Format_RGB555:
- case QImage::Format_RGB16:
- case QImage::Format_RGB444:
- case QImage::Format_ARGB4444_Premultiplied:
- depth = 16;
- break;
- case QImage::Format_RGB666:
- case QImage::Format_ARGB6666_Premultiplied:
- case QImage::Format_ARGB8565_Premultiplied:
- case QImage::Format_ARGB8555_Premultiplied:
- case QImage::Format_RGB888:
- depth = 24;
- break;
- }
- return depth;
-}
-
/*! \fn QImageData * QImageData::create(const QSize &size, QImage::Format format, int numColors)
\internal
@@ -195,7 +159,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format, int nu
uint width = size.width();
uint height = size.height();
- uint depth = depthForFormat(format);
+ uint depth = qt_depthForFormat(format);
switch (format) {
case QImage::Format_Mono:
@@ -871,7 +835,7 @@ QImageData *QImageData::create(uchar *data, int width, int height, int bpl, QIm
return 0;
}
- const int depth = depthForFormat(format);
+ const int depth = qt_depthForFormat(format);
const int calc_bytes_per_line = ((width * depth + 31)/32) * 4;
const int min_bytes_per_line = (width * depth + 7)/8;
@@ -6321,7 +6285,7 @@ int QImage::bitPlaneCount() const
bpc = 12;
break;
default:
- bpc = depthForFormat(d->format);
+ bpc = qt_depthForFormat(d->format);
break;
}
return bpc;
diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h
index c687448..e054814 100644
--- a/src/gui/image/qimage_p.h
+++ b/src/gui/image/qimage_p.h
@@ -112,6 +112,42 @@ struct Q_GUI_EXPORT QImageData { // internal image data
void qInitImageConversions();
+inline int qt_depthForFormat(QImage::Format format)
+{
+ int depth = 0;
+ switch(format) {
+ case QImage::Format_Invalid:
+ case QImage::NImageFormats:
+ Q_ASSERT(false);
+ case QImage::Format_Mono:
+ case QImage::Format_MonoLSB:
+ depth = 1;
+ break;
+ case QImage::Format_Indexed8:
+ depth = 8;
+ break;
+ case QImage::Format_RGB32:
+ case QImage::Format_ARGB32:
+ case QImage::Format_ARGB32_Premultiplied:
+ depth = 32;
+ break;
+ case QImage::Format_RGB555:
+ case QImage::Format_RGB16:
+ case QImage::Format_RGB444:
+ case QImage::Format_ARGB4444_Premultiplied:
+ depth = 16;
+ break;
+ case QImage::Format_RGB666:
+ case QImage::Format_ARGB6666_Premultiplied:
+ case QImage::Format_ARGB8565_Premultiplied:
+ case QImage::Format_ARGB8555_Premultiplied:
+ case QImage::Format_RGB888:
+ depth = 24;
+ break;
+ }
+ return depth;
+}
+
QT_END_NAMESPACE
#endif
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 53f3559..65c0344 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -206,7 +206,13 @@ void QRasterPixmapData::fill(const QColor &color)
else
#endif
toFormat = QImage::Format_ARGB32_Premultiplied;
- image = QImage(image.width(), image.height(), toFormat);
+
+ if (!image.isNull() && qt_depthForFormat(image.format()) == qt_depthForFormat(toFormat)) {
+ image.detach();
+ image.d->format = toFormat;
+ } else {
+ image = QImage(image.width(), image.height(), toFormat);
+ }
}
switch (image.format()) {