summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qblendfunctions.cpp
diff options
context:
space:
mode:
authorAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-11-10 20:04:41 (GMT)
committerAleksandar Sasha Babic <aleksandar.babic@nokia.com>2009-11-11 12:47:42 (GMT)
commit72c170b64056a59dce9f849a5789d2968071f7b9 (patch)
tree0fe45271f034f845b3f3cf7ceeeb856c1b52f3bd /src/gui/painting/qblendfunctions.cpp
parentc327076817dad875bd057bf28eab36b1d4e732ef (diff)
downloadQt-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/painting/qblendfunctions.cpp')
-rw-r--r--src/gui/painting/qblendfunctions.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 2d434d3..ba1b642 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -223,9 +223,13 @@ void qt_scale_image_16bit(uchar *destPixels, int dbpl,
int h = ty2 - ty1;
int w = tx2 - tx1;
+
quint32 basex;
quint32 srcy;
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
+
if (sx < 0) {
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
@@ -738,6 +742,10 @@ template <typename T> void qt_scale_image_32bit(uchar *destPixels, int dbpl,
quint32 basex;
quint32 srcy;
+ const int dstx = qCeil((tx1 + 0.5 - qMin(targetRect.left(), targetRect.right())) * ix) - 1;
+ const int dsty = qCeil((ty1 + 0.5 - qMin(targetRect.top(), targetRect.bottom())) * iy) - 1;
+
+
if (sx < 0) {
int dstx = qFloor((tx1 + qreal(0.5) - targetRect.right()) * ix) + 1;
basex = quint32(srcRect.right() * 65536) + dstx;
@@ -842,8 +850,8 @@ void qt_transform_image_rasterize(DestT *destPixels, int dbpl,
qreal rightSlope = (bottomRight.x - topRight.x) / (bottomRight.y - topRight.y);
int dx_l = int(leftSlope * 0x10000);
int dx_r = int(rightSlope * 0x10000);
- int x_l = int((topLeft.x + (qreal(0.5) + fromY - topLeft.y) * leftSlope + qreal(0.5)) * 0x10000);
- int x_r = int((topRight.x + (qreal(0.5) + fromY - topRight.y) * rightSlope + qreal(0.5)) * 0x10000);
+ int x_l = int((topLeft.x + (0.5 + fromY - topLeft.y) * leftSlope + 0.5) * 0x10000);
+ int x_r = int((topRight.x + (0.5 + fromY - topRight.y) * rightSlope + 0.5) * 0x10000);
int fromX, toX, x1, x2, u, v, i, ii;
DestT *line;
@@ -1020,7 +1028,7 @@ void qt_transform_image(DestT *destPixels, int dbpl,
if (det == 0)
return;
- qreal invDet = qreal(1.0) / det;
+ qreal invDet = 1.0 / det;
qreal m11, m12, m21, m22, mdx, mdy;
m11 = (u.u * w.y - u.y * w.u) * invDet;
@@ -1034,8 +1042,8 @@ void qt_transform_image(DestT *destPixels, int dbpl,
int dvdx = int(m21 * 0x10000);
int dudy = int(m12 * 0x10000);
int dvdy = int(m22 * 0x10000);
- int u0 = qCeil((qreal(0.5) * m11 + qreal(0.5) * m12 + mdx) * 0x10000) - 1;
- int v0 = qCeil((qreal(0.5) * m21 + qreal(0.5) * m22 + mdy) * 0x10000) - 1;
+ int u0 = qCeil((0.5 * m11 + 0.5 * m12 + mdx) * 0x10000) - 1;
+ int v0 = qCeil((0.5 * m21 + 0.5 * m22 + mdy) * 0x10000) - 1;
int x1 = qFloor(sourceRect.left());
int y1 = qFloor(sourceRect.top());