summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2009-09-22 15:03:47 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2009-09-22 16:12:37 (GMT)
commit2fafc136542a4aea51d1aee3e0d07374b1f52b41 (patch)
tree207441f11e77c8546419c4aa89408bd0ca4e419a /src/gui
parentc079a392306df4a273e511e7ce08d94d79319d36 (diff)
downloadQt-2fafc136542a4aea51d1aee3e0d07374b1f52b41.zip
Qt-2fafc136542a4aea51d1aee3e0d07374b1f52b41.tar.gz
Qt-2fafc136542a4aea51d1aee3e0d07374b1f52b41.tar.bz2
QPixMap::fromWinHICON compile fix for Windows CE
Reviewed-by: thartman
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/image/qpixmap_win.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index a9bcca2..87cb46c 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -393,6 +393,7 @@ QPixmap QPixmap::fromWinHICON(HICON icon)
int w = iconinfo.xHotspot * 2;
int h = iconinfo.yHotspot * 2;
+ const DWORD dwImageSize = w * h * 4;
BITMAPINFO bmi;
memset(&bmi, 0, sizeof(bmi));
@@ -402,44 +403,44 @@ QPixmap QPixmap::fromWinHICON(HICON icon)
bmi.bmiHeader.biPlanes = 1;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- bmi.bmiHeader.biSizeImage = size*size*4;
+ bmi.bmiHeader.biSizeImage = dwImageSize;
uchar* bits;
HBITMAP winBitmap = CreateDIBSection(hdc, &bmi, DIB_RGB_COLORS, (void**) &bits, 0, 0);
if (winBitmap )
- memset(bits, 0xff, size*size*4);
+ memset(bits, 0xff, dwImageSize);
if (!winBitmap) {
qWarning("QPixmap::fromWinHICON(), failed to CreateDIBSection()");
return QPixmap();
}
HGDIOBJ oldhdc = (HBITMAP)SelectObject(hdc, winBitmap);
- if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_NORMAL))
+ if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_NORMAL))
qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
uint mask = 0xff000000;
// Create image and copy data into image.
- QImage image(size, size, QImage::Format_ARGB32);
+ QImage image(w, h, QImage::Format_ARGB32);
if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = size * sizeof(QRgb);
- for (int y=0; y<size; ++y) {
+ int bytes_per_line = w * sizeof(QRgb);
+ for (int y=0; y < h; ++y) {
QRgb *dest = (QRgb *) image.scanLine(y);
const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x<size; ++x) {
+ for (int x=0; x < w; ++x) {
dest[x] = src[x];
}
}
}
- if (!DrawIconEx( hdc, 0, 0, icon, size, size, 0, 0, DI_MASK))
+ if (!DrawIconEx( hdc, 0, 0, icon, w, h, 0, 0, DI_MASK))
qWarning("QPixmap::fromWinHICON(), failed to DrawIcon()");
if (!image.isNull()) { // failed to alloc?
- int bytes_per_line = size * sizeof(QRgb);
- for (int y=0; y<size; ++y) {
+ int bytes_per_line = w * sizeof(QRgb);
+ for (int y=0; y < h; ++y) {
QRgb *dest = (QRgb *) image.scanLine(y);
const QRgb *src = (const QRgb *) (bits + y * bytes_per_line);
- for (int x=0; x<size; ++x) {
+ for (int x=0; x < w; ++x) {
if (!src[x])
dest[x] = dest[x] | mask;
}