[blitter] Initialize m_devicePixelRatio to fix crash
When using directfb platform the drawing of some widgets (e.g. Toolbar) would crash the application. Pixmap device pixel ratio can be used in QCommonStyle::drawControl() as a denominator to calculate pixmap width or size. The drawing of some widgets (e.g. Toolbar) would fail the assertion of a non-zero denominator. This commit initializes the device pixel ratio when generating BlitterClass pixmaps and makes QBlittablePlatformPixmap::metric( PdmDevicePixelRatio) return devicePixelRatio() instead of 1. Task-number: QTBUG-38709 Change-Id: Ia8b96c5341b5ac1297c483deed1c695846398b88 Reviewed-by: Gunnar Sletta <gunnar.sletta@jollamobile.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>bb10
parent
8e48707cea
commit
a5bba1f9da
|
|
@ -59,6 +59,7 @@ static int global_ser_no = 0;
|
|||
QBlittablePlatformPixmap::QBlittablePlatformPixmap()
|
||||
: QPlatformPixmap(QPlatformPixmap::PixmapType,BlitterClass)
|
||||
, m_alpha(false)
|
||||
, m_devicePixelRatio(1.0)
|
||||
#ifdef QT_BLITTER_RASTEROVERLAY
|
||||
,m_rasterOverlay(0), m_unmergedCopy(0)
|
||||
#endif //QT_BLITTER_RASTEROVERLAY
|
||||
|
|
@ -121,7 +122,7 @@ int QBlittablePlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) con
|
|||
case QPaintDevice::PdmPhysicalDpiY:
|
||||
return qt_defaultDpiY();
|
||||
case QPaintDevice::PdmDevicePixelRatio:
|
||||
return 1;
|
||||
return devicePixelRatio();
|
||||
default:
|
||||
qWarning("QRasterPlatformPixmap::metric(): Unhandled metric type %d", metric);
|
||||
break;
|
||||
|
|
@ -178,6 +179,7 @@ void QBlittablePlatformPixmap::fromImage(const QImage &image,
|
|||
Qt::ImageConversionFlags flags)
|
||||
{
|
||||
m_alpha = image.hasAlphaChannel();
|
||||
m_devicePixelRatio = image.devicePixelRatio();
|
||||
resize(image.width(),image.height());
|
||||
markRasterOverlay(QRect(0,0,w,h));
|
||||
QImage *thisImg = buffer();
|
||||
|
|
|
|||
Loading…
Reference in New Issue