Fix line rendering with TileGrid and Rtree

BUG=http://code.google.com/p/skia/issues/detail?id=1014
TEST=gm hairmodes with --tileGrid and --rtree
Review URL: https://codereview.appspot.com/6947056

git-svn-id: http://skia.googlecode.com/svn/trunk@6841 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
junov@chromium.org 2012-12-17 14:38:59 +00:00
parent 9be5727d96
commit b3470c8c42

View File

@ -24,6 +24,18 @@ void SkBBoxRecord::drawPoints(PointMode mode, size_t count, const SkPoint pts[],
const SkPaint& paint) {
SkRect bbox;
bbox.set(pts, count);
// Small min width value, just to ensure hairline point bounding boxes aren't empty.
// Even though we know hairline primitives are drawn one pixel wide, we do not use a
// minimum of 1 because the playback scale factor is unknown at record time. Later
// outsets will take care of adding additional padding for antialiasing and rounding out
// to integer device coordinates, guaranteeing that the rasterized pixels will be included
// in the computed bounds.
// Note: The device coordinate outset in SkBBoxHierarchyRecord::handleBBox is currently
// done in the recording coordinate space, which is wrong.
// http://code.google.com/p/skia/issues/detail?id=1021
static const SkScalar kMinWidth = SkFloatToScalar(0.01f);
SkScalar halfStrokeWidth = SkMaxScalar(paint.getStrokeWidth(), kMinWidth) / 2;
bbox.outset(halfStrokeWidth, halfStrokeWidth);
if (this->transformBounds(bbox, &paint)) {
INHERITED::drawPoints(mode, count, pts, paint);
}