Chromium Code Reviews| Index: src/gpu/SkGpuDevice.cpp |
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
| index 4b7743123993c6369c19006da9315066b97ff676..977a1602b3b4f1cae4096982d4b4356ca9e56fff 100644 |
| --- a/src/gpu/SkGpuDevice.cpp |
| +++ b/src/gpu/SkGpuDevice.cpp |
| @@ -335,23 +335,42 @@ void SkGpuDevice::drawPoints(const SkDraw& draw, SkCanvas::PointMode mode, |
| return; |
| } |
| + SkScalar scales[2]; |
| + bool isHairline = (0 == width) || (1 == width && draw.fMatrix->getMinMaxScales(scales) && |
| + SkScalarNearlyEqual(scales[0], 1.f) && |
| + SkScalarNearlyEqual(scales[1], 1.f)); |
| // we only handle non-antialiased hairlines and paints without path effects or mask filters, |
| // else we let the SkDraw call our drawPath() |
| - if (width > 0 || paint.getPathEffect() || paint.getMaskFilter() || |
| + if (!isHairline || paint.getPathEffect() || paint.getMaskFilter() || |
| (paint.isAntiAlias() && needs_antialiasing(mode, count, pts))) { |
| draw.drawPoints(mode, count, pts, paint, true); |
| return; |
| } |
|
robertphillips
2016/09/12 17:16:51
PrimtiveType - missing 'i' ?
bsalomon
2016/09/12 17:59:15
Done.
|
| + GrPrimitiveType primitiveType = gPointMode2PrimtiveType[mode]; |
| + |
| + const SkMatrix* viewMatrix = draw.fMatrix; |
| +#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK |
| + // This offsetting in device space matches the expectations of the Android framework for non-AA |
| + // points and lines. |
| + SkMatrix tempMatrix; |
| + if (GrIsPrimTypeLines(primitiveType) || kPoints_GrPrimitiveType == primitiveType) { |
| + tempMatrix = *viewMatrix; |
| + static const SkScalar kOffset = 0.063f; // Just greater than 1/16. |
| + tempMatrix.postTranslate(kOffset, kOffset); |
| + viewMatrix = &tempMatrix; |
| + } |
| +#endif |
| + |
| GrPaint grPaint; |
| - if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) { |
| + if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *viewMatrix, &grPaint)) { |
| return; |
| } |
| fDrawContext->drawVertices(fClip, |
| grPaint, |
| - *draw.fMatrix, |
| - gPointMode2PrimtiveType[mode], |
| + *viewMatrix, |
| + primitiveType, |
| SkToS32(count), |
| (SkPoint*)pts, |
| nullptr, |