diff options
author | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-11-10 20:04:41 (GMT) |
---|---|---|
committer | Aleksandar Sasha Babic <aleksandar.babic@nokia.com> | 2009-11-11 12:47:42 (GMT) |
commit | 72c170b64056a59dce9f849a5789d2968071f7b9 (patch) | |
tree | 0fe45271f034f845b3f3cf7ceeeb856c1b52f3bd /src/gui/image | |
parent | c327076817dad875bd057bf28eab36b1d4e732ef (diff) | |
download | Qt-72c170b64056a59dce9f849a5789d2968071f7b9.zip Qt-72c170b64056a59dce9f849a5789d2968071f7b9.tar.gz Qt-72c170b64056a59dce9f849a5789d2968071f7b9.tar.bz2 |
Revert "Using qreal more consistently in code (prevent misuse of double)"
This reverts commit 676780d515cedca85829ae962e4f501c5e5b6581.
Conflicts:
src/gui/painting/qblendfunctions.cpp
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qimage.cpp | 30 | ||||
-rw-r--r-- | src/gui/image/qpaintengine_pic.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpixmap_raster.cpp | 4 | ||||
-rw-r--r-- | src/gui/image/qpixmap_s60.cpp | 9 | ||||
-rw-r--r-- | src/gui/image/qpnghandler.cpp | 4 |
6 files changed, 27 insertions, 28 deletions
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index ebad019..6d96d7a 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5351,19 +5351,19 @@ int QImage::metric(PaintDeviceMetric metric) const break; case PdmDpiX: - return qRound(d->dpmx * qreal(0.0254)); + return qRound(d->dpmx * 0.0254); break; case PdmDpiY: - return qRound(d->dpmy * qreal(0.0254)); + return qRound(d->dpmy * 0.0254); break; case PdmPhysicalDpiX: - return qRound(d->dpmx * qreal(0.0254)); + return qRound(d->dpmx * 0.0254); break; case PdmPhysicalDpiY: - return qRound(d->dpmy * qreal(0.0254)); + return qRound(d->dpmy * 0.0254); break; default: @@ -5429,12 +5429,12 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth uchar *dptr, int dbpl, int p_inc, int dHeight, const uchar *sptr, int sbpl, int sWidth, int sHeight) { - int m11 = int(trueMat.m11()*qreal(4096.0)); - int m12 = int(trueMat.m12()*qreal(4096.0)); - int m21 = int(trueMat.m21()*qreal(4096.0)); - int m22 = int(trueMat.m22()*qreal(4096.0)); - int dx = qRound(trueMat.dx()*qreal(4096.0)); - int dy = qRound(trueMat.dy()*qreal(4096.0)); + int m11 = int(trueMat.m11()*4096.0); + int m12 = int(trueMat.m12()*4096.0); + int m21 = int(trueMat.m21()*4096.0); + int m22 = int(trueMat.m22()*4096.0); + int dx = qRound(trueMat.dx()*4096.0); + int dy = qRound(trueMat.dy()*4096.0); int m21ydx = dx + (xoffset<<16) + (m11 + m21) / 2; int m22ydy = dy + (m12 + m22) / 2; @@ -6018,22 +6018,22 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode if (mat.type() <= QTransform::TxScale) { if (mat.type() == QTransform::TxNone) // identity matrix return *this; - else if (mat.m11() == qreal(-1.) && mat.m22() == qreal(-1.)) + else if (mat.m11() == -1. && mat.m22() == -1.) return rotated180(*this); if (mode == Qt::FastTransformation) { hd = qRound(qAbs(mat.m22()) * hs); wd = qRound(qAbs(mat.m11()) * ws); } else { - hd = int(qAbs(mat.m22()) * hs + qreal(0.9999)); - wd = int(qAbs(mat.m11()) * ws + qreal(0.9999)); + hd = int(qAbs(mat.m22()) * hs + 0.9999); + wd = int(qAbs(mat.m11()) * ws + 0.9999); } scale_xform = true; } else { if (mat.type() <= QTransform::TxRotate && mat.m11() == 0 && mat.m22() == 0) { - if (mat.m12() == qreal(1.) && mat.m21() == qreal(-1.)) + if (mat.m12() == 1. && mat.m21() == -1.) return rotated90(*this); - else if (mat.m12() == qreal(-1.) && mat.m21() == qreal(1.)) + else if (mat.m12() == -1. && mat.m21() == 1.) return rotated270(*this); } diff --git a/src/gui/image/qpaintengine_pic.cpp b/src/gui/image/qpaintengine_pic.cpp index b6fea8b..80b16cf 100644 --- a/src/gui/image/qpaintengine_pic.cpp +++ b/src/gui/image/qpaintengine_pic.cpp @@ -342,7 +342,7 @@ void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) } d->pic_d->pictb.seek(newpos); // set to new position - if (br.width() > qreal(0.0) || br.height() > qreal(0.0)) { + if (br.width() > 0.0 || br.height() > 0.0) { if (corr) { // widen bounding rect int w2 = painter()->pen().width() / 2; br.setCoords(br.left() - w2, br.top() - w2, @@ -354,7 +354,7 @@ void QPicturePaintEngine::writeCmdLength(int pos, const QRectF &r, bool corr) br &= cr; } - if (br.width() > qreal(0.0) || br.height() > qreal(0.0)) { + if (br.width() > 0.0 || br.height() > 0.0) { int minx = qFloor(br.left()); int miny = qFloor(br.top()); int maxx = qCeil(br.right()); diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index 39a4fcc..f502827 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -967,10 +967,10 @@ int QPicture::metric(PaintDeviceMetric m) const val = brect.height(); break; case PdmWidthMM: - val = int(qreal(25.4)/qt_defaultDpiX()*brect.width()); + val = int(25.4/qt_defaultDpiX()*brect.width()); break; case PdmHeightMM: - val = int(qreal(25.4)/qt_defaultDpiY()*brect.height()); + val = int(25.4/qt_defaultDpiY()*brect.height()); break; case PdmDpiX: case PdmPhysicalDpiX: diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index 5ff3109..1b01e6f 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -373,9 +373,9 @@ int QRasterPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const case QPaintDevice::PdmHeight: return h; case QPaintDevice::PdmWidthMM: - return qRound(d->width * qreal(25.4) / qt_defaultDpiX()); + return qRound(d->width * 25.4 / qt_defaultDpiX()); case QPaintDevice::PdmHeightMM: - return qRound(d->width * qreal(25.4) / qt_defaultDpiY()); + return qRound(d->width * 25.4 / qt_defaultDpiY()); case QPaintDevice::PdmNumColors: return d->colortable.size(); case QPaintDevice::PdmDepth: diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index cc73e3e..f7a880c 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -568,7 +568,6 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const if (!cfbsBitmap) return 0; - qreal div_by_KTwipsPerInch = 1 / (qreal)KTwipsPerInch; switch (metric) { case QPaintDevice::PdmWidth: return cfbsBitmap->SizeInPixels().iWidth; @@ -576,23 +575,23 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return cfbsBitmap->SizeInPixels().iHeight; case QPaintDevice::PdmWidthMM: { TInt twips = cfbsBitmap->SizeInTwips().iWidth; - return (int)(twips * (qreal(25.4) * div_by_KTwipsPerInch)); + return (int)(twips * (25.4/KTwipsPerInch)); } case QPaintDevice::PdmHeightMM: { TInt twips = cfbsBitmap->SizeInTwips().iHeight; - return (int)(twips * (qreal(25.4) * div_by_KTwipsPerInch)); + return (int)(twips * (25.4/KTwipsPerInch)); } case QPaintDevice::PdmNumColors: return TDisplayModeUtils::NumDisplayModeColors(cfbsBitmap->DisplayMode()); case QPaintDevice::PdmDpiX: case QPaintDevice::PdmPhysicalDpiX: { - qreal inches = cfbsBitmap->SizeInTwips().iWidth * div_by_KTwipsPerInch; + TReal inches = cfbsBitmap->SizeInTwips().iWidth / (TReal)KTwipsPerInch; TInt pixels = cfbsBitmap->SizeInPixels().iWidth; return pixels / inches; } case QPaintDevice::PdmDpiY: case QPaintDevice::PdmPhysicalDpiY: { - qreal inches = cfbsBitmap->SizeInTwips().iHeight * div_by_KTwipsPerInch; + TReal inches = cfbsBitmap->SizeInTwips().iHeight / (TReal)KTwipsPerInch; TInt pixels = cfbsBitmap->SizeInPixels().iHeight; return pixels / inches; } diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index a52ba77..14c863b 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -732,8 +732,8 @@ bool Q_INTERNAL_WIN_NO_THROW QPNGImageWriter::writeImage(const QImage& image_in, png_set_compression_level(png_ptr, quality); } - if (gamma != qreal(0.0)) { - png_set_gAMA(png_ptr, info_ptr, qreal(1.0)/gamma); + if (gamma != 0.0) { + png_set_gAMA(png_ptr, info_ptr, 1.0/gamma); } png_set_write_fn(png_ptr, (void*)this, qpiw_write_fn, qpiw_flush_fn); |