From a87c4748e5ad532c493d828147124c8a5aafb099 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Sun, 30 Mar 2014 22:28:14 +0200 Subject: [PATCH] app_server: Restore previous rounding 46b39e837829ece251b2a5a690b86d283a95c2c5 contained a change to the rounding for non-subpixel-precise drawing. This changes it back from using round() to casting to int32. This also reverts a change to StrokeLine() which meant that lines on integer pixels appeared at the same location regardless of using B_SUBPIXEL_PRECISE or not. On further thought, this doesn't make any sense, since it means to treat the meaning of coordinates different for stroking and filling. This fixes WonderBrush's brush tip preview, but breaks Gobe Productive's caret rendering for zooms smaller than 150%. The change to the rounding fixes #10690. --- src/servers/app/drawing/Painter/Painter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/servers/app/drawing/Painter/Painter.cpp b/src/servers/app/drawing/Painter/Painter.cpp index 1699155ff1..b22352893e 100644 --- a/src/servers/app/drawing/Painter/Painter.cpp +++ b/src/servers/app/drawing/Painter/Painter.cpp @@ -523,7 +523,7 @@ Painter::StrokeLine(BPoint a, BPoint b) } } else { // Do the pixel center offset here - if (fmodf(fPenSize, 2.0) != 0.0) { + if (!fSubpixelPrecise && fmodf(fPenSize, 2.0) != 0.0) { _Align(&a, true); _Align(&b, true); } @@ -531,7 +531,7 @@ Painter::StrokeLine(BPoint a, BPoint b) fPath.move_to(a.x, a.y); fPath.line_to(b.x, b.y); - if (fPenSize == 1.0f) { + if (!fSubpixelPrecise && fPenSize == 1.0f) { // Tweak ends to "include" the pixel at the index, // we need to do this in order to produce results like R5, // where coordinates were inclusive @@ -1516,7 +1516,7 @@ Painter::_Align(float coord, bool round, bool centerOffset) const { // rounding if (round) - coord = roundf(coord); + coord = (int32)coord; // This code is supposed to move coordinates to the center of pixels, // as AGG considers (0,0) to be the "upper left corner" of a pixel,