Draw more inactive style elements in retina res.
Update drawColorLessButton() and qt_mac_cg_context() to handle paint devices with a devicePixelRatio greater than one. Task-number: QTBUG-36792 Change-Id: I9d642846b299fc7048bb8e08765b9e1d7ee631fc Reviewed-by: Denis Dzyubenko <denis@ddenis.info> Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
This commit is contained in:
parent
2b26f801b5
commit
fa6ebaa2e9
@ -1719,8 +1719,9 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int width = int(macRect.size.width) + extraWidth;
|
int devicePixelRatio = p->device()->devicePixelRatio();
|
||||||
int height = int(macRect.size.height) + extraHeight;
|
int width = devicePixelRatio * (int(macRect.size.width) + extraWidth);
|
||||||
|
int height = devicePixelRatio * (int(macRect.size.height) + extraHeight);
|
||||||
|
|
||||||
if (width <= 0 || height <= 0)
|
if (width <= 0 || height <= 0)
|
||||||
return; // nothing to draw
|
return; // nothing to draw
|
||||||
@ -1732,6 +1733,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
|
|||||||
QPixmap pm;
|
QPixmap pm;
|
||||||
if (!QPixmapCache::find(key, pm)) {
|
if (!QPixmapCache::find(key, pm)) {
|
||||||
QPixmap activePixmap(width, height);
|
QPixmap activePixmap(width, height);
|
||||||
|
activePixmap.setDevicePixelRatio(devicePixelRatio);
|
||||||
activePixmap.fill(Qt::transparent);
|
activePixmap.fill(Qt::transparent);
|
||||||
{
|
{
|
||||||
if (combo){
|
if (combo){
|
||||||
@ -1782,6 +1784,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
|
|||||||
QImage colorlessImage;
|
QImage colorlessImage;
|
||||||
{
|
{
|
||||||
QPixmap colorlessPixmap(width, height);
|
QPixmap colorlessPixmap(width, height);
|
||||||
|
colorlessPixmap.setDevicePixelRatio(devicePixelRatio);
|
||||||
colorlessPixmap.fill(Qt::transparent);
|
colorlessPixmap.fill(Qt::transparent);
|
||||||
|
|
||||||
QMacCGContext cg(&colorlessPixmap);
|
QMacCGContext cg(&colorlessPixmap);
|
||||||
@ -1815,7 +1818,7 @@ void QMacStylePrivate::drawColorlessButton(const HIRect &macRect, HIThemeButtonD
|
|||||||
}
|
}
|
||||||
QPixmapCache::insert(key, pm);
|
QPixmapCache::insert(key, pm);
|
||||||
}
|
}
|
||||||
p->drawPixmap(int(macRect.origin.x) - xoff, int(macRect.origin.y) + finalyoff, width, height, pm);
|
p->drawPixmap(int(macRect.origin.x) - xoff, int(macRect.origin.y) + finalyoff, width / devicePixelRatio, height / devicePixelRatio , pm);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMacStyle::QMacStyle()
|
QMacStyle::QMacStyle()
|
||||||
@ -6719,6 +6722,8 @@ CGContextRef qt_mac_cg_context(const QPaintDevice *pdev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CGContextTranslateCTM(ret, 0, pm->height());
|
CGContextTranslateCTM(ret, 0, pm->height());
|
||||||
|
int devicePixelRatio = pdev->devicePixelRatio();
|
||||||
|
CGContextScaleCTM(ret, devicePixelRatio, devicePixelRatio);
|
||||||
CGContextScaleCTM(ret, 1, -1);
|
CGContextScaleCTM(ret, 1, -1);
|
||||||
return ret;
|
return ret;
|
||||||
} else if (pdev->devType() == QInternal::Widget) {
|
} else if (pdev->devType() == QInternal::Widget) {
|
||||||
|
Loading…
Reference in New Issue
Block a user