summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qrasterizer.cpp
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2010-08-09 18:16:27 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2010-08-16 06:13:32 (GMT)
commit69fc9e594e6d5da87bff42707973683f84b67c93 (patch)
treea37b98ad5c3014bc8671af0bf0153df609367ae8 /src/gui/painting/qrasterizer.cpp
parent1efed3f163164a9c98b4ea7d747507b6fdc52d63 (diff)
downloadQt-69fc9e594e6d5da87bff42707973683f84b67c93.zip
Qt-69fc9e594e6d5da87bff42707973683f84b67c93.tar.gz
Qt-69fc9e594e6d5da87bff42707973683f84b67c93.tar.bz2
Fix how subpixel positions are intepreted in an aliased grid.
With this change we break with the traditional X11 and GDI way of rasterzing aliased polygons, but we become consistent across integer and sub-pixel positions. The new model uses the same rules as the antialised rasterizer which means that a primitive edge on 0.4 becomes 0.0, 0.5 becomes 1 and 0.9 becomes one, which is also in line with how one normally thinks of rounding rules.
Diffstat (limited to 'src/gui/painting/qrasterizer.cpp')
-rw-r--r--src/gui/painting/qrasterizer.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gui/painting/qrasterizer.cpp b/src/gui/painting/qrasterizer.cpp
index f8f8afb..c92d8d5 100644
--- a/src/gui/painting/qrasterizer.cpp
+++ b/src/gui/painting/qrasterizer.cpp
@@ -62,8 +62,8 @@ typedef int Q16Dot16;
#define SPAN_BUFFER_SIZE 256
-#define COORD_ROUNDING 1 // 0: round up, 1: round down
-#define COORD_OFFSET 32 // 26.6, 32 is half a pixel
+#define COORD_ROUNDING 0 // 0: round up, 1: round down
+#define COORD_OFFSET 0 // 26.6, 32 is half a pixel
class QSpanBuffer {
public:
@@ -718,7 +718,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
QPointF pa = a;
QPointF pb = b;
- QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
+ QPointF offs = QPointF(qAbs(b.y() - a.y()), qAbs(b.x() - a.x())) * width * 0.5;
if (squareCap)
offs += QPointF(offs.y(), offs.x());
const QRectF clip(d->clipRect.topLeft() - offs, d->clipRect.bottomRight() + QPoint(1, 1) + offs);