src/hbcore/image/hbpixmapiconimpl_p.cpp
changeset 30 80e4d18b72f5
parent 28 b7da29130b0e
equal deleted inserted replaced
28:b7da29130b0e 30:80e4d18b72f5
   149     QSizeF pixmapSize = pixmapData.size();
   149     QSizeF pixmapSize = pixmapData.size();
   150 
   150 
   151     if (alignment & Qt::AlignRight) {
   151     if (alignment & Qt::AlignRight) {
   152         topLeft.setX(rect.right() - pixmapSize.width());
   152         topLeft.setX(rect.right() - pixmapSize.width());
   153     } else if (alignment & Qt::AlignHCenter) {
   153     } else if (alignment & Qt::AlignHCenter) {
   154         topLeft.setX(topLeft.x() + (rect.width() - pixmapSize.width()) / 2);
   154         topLeft.setX(topLeft.x() + (qRound(rect.width()) - qRound(pixmapSize.width())) / 2.0f);
   155     }
   155     }
   156 
   156 
   157     if (alignment & Qt::AlignBottom) {
   157     if (alignment & Qt::AlignBottom) {
   158         topLeft.setY(rect.bottom() - pixmapSize.height());
   158         topLeft.setY(rect.bottom() - pixmapSize.height());
   159     } else if (alignment & Qt::AlignVCenter) {
   159     } else if (alignment & Qt::AlignVCenter) {
   160         topLeft.setY(topLeft.y() + (rect.height() - pixmapSize.height()) / 2);
   160         topLeft.setY(topLeft.y() + (qRound(rect.height()) - qRound(pixmapSize.height())) / 2.0f);
   161     }
   161     }
   162 
   162 
   163     pixmapIconRenderer->draw(painter, topLeft, clipPath, maskIconData);
   163     pixmapIconRenderer->draw(painter, topLeft, clipPath, maskIconData);
   164 }
   164 }
   165 
   165