Changeset 264
- Timestamp:
- Oct 28, 2009, 10:10:28 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gui/image/qpixmap_pm.cpp
r262 r264 47 47 #include "qicon.h" 48 48 #include "qbitmap.h" 49 #include "qpainter.h" 49 50 50 51 #include "qt_os2.h" … … 230 231 return NULLHANDLE; 231 232 233 // get the system icon size 232 234 int w = WinQuerySysValue(HWND_DESKTOP, isPointer ? SV_CXPOINTER : SV_CXICON); 233 235 int h = WinQuerySysValue(HWND_DESKTOP, isPointer ? SV_CYPOINTER : SV_CYICON); 236 int w2 = w / 2; 237 int h2 = h / 2; 238 239 // obtain the closest (but never larger) icon sizes we have 234 240 QSize size = icon.actualSize(QSize(w, h)); 235 QSize sizeMini = icon.actualSize(QSize(w / 2, h /2));241 QSize sizeMini = icon.actualSize(QSize(w2, h2)); 236 242 237 243 QPixmap pm = icon.pixmap(size); … … 239 245 if (pm.isNull() && pmMini.isNull()) 240 246 return NULLHANDLE; 247 248 // if we got smaller pixmaps then center them inside the system sized rect 249 // instead of letting WinCreatePointerIndirect() scale them (this covers a 250 // usual case when we got 32 and 16 px pixmaps on a 120 DPI system where the 251 // icon size is 40 and 20 px respectively): scaling such small images looks 252 // really ugly. 253 if (!pm.isNull() && (pm.width() < w || pm.height() < h)) { 254 Q_ASSERT(pm.width() <= w && pm.height() <= h); 255 QPixmap pmNew(w, h); 256 pmNew.fill(Qt::transparent); 257 QPainter painter(&pmNew); 258 painter.drawPixmap((w - pm.width()) / 2, (h - pm.height()) / 2, pm); 259 pm = pmNew; 260 } 261 if (!pmMini.isNull() && (pmMini.width() < w2 || pmMini.height() < h2)) { 262 Q_ASSERT(pmMini.width() <= w2 && pmMini.height() <= h2); 263 QPixmap pmNew(w2, h2); 264 pmNew.fill(Qt::transparent); 265 QPainter painter(&pmNew); 266 painter.drawPixmap((w2 - pmMini.width()) / 2, (h2 - pmMini.height()) / 2, pmMini); 267 pmMini = pmNew; 268 } 241 269 242 270 if (pm.isNull()) {
Note:
See TracChangeset
for help on using the changeset viewer.