Chromium Code Reviews| Index: src/gpu/SkGpuDevice.cpp |
| diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp |
| index a6c8a1fc74fceb34ff86038324c78d25368c2fa0..031219459fbbd227adc84fa8d255e3dd787c2184 100644 |
| --- a/src/gpu/SkGpuDevice.cpp |
| +++ b/src/gpu/SkGpuDevice.cpp |
| @@ -526,6 +526,30 @@ void SkGpuDevice::drawDRRect(const SkDraw& draw, const SkRRect& outer, |
| ///////////////////////////////////////////////////////////////////////////// |
| +static inline bool is_int(float x) { |
| + return x == (float) sk_float_round2int(x); |
| +} |
| + |
| +void SkGpuDevice::drawRegion(const SkDraw& draw, const SkRegion& region, const SkPaint& paint) { |
| + bool isNonTranslate = draw.fMatrix->getType() & ~(SkMatrix::kTranslate_Mask); |
|
bsalomon
2016/08/25 17:49:02
I think we should handle all the matrix, aa, and s
msarett
2016/08/25 20:51:42
SGTM, done.
|
| + bool complexPaint = paint.getStyle() != SkPaint::kFill_Style || paint.getMaskFilter() || |
| + paint.getPathEffect(); |
| + bool antiAlias = paint.isAntiAlias() && (!is_int(draw.fMatrix->getTranslateX()) || |
| + !is_int(draw.fMatrix->getTranslateY())); |
| + if (isNonTranslate || complexPaint || antiAlias) { |
| + SkPath path; |
| + region.getBoundaryPath(&path); |
| + return this->drawPath(draw, path, paint, nullptr, false); |
| + } |
| + |
| + GrPaint grPaint; |
| + if (!SkPaintToGrPaint(this->context(), fDrawContext.get(), paint, *draw.fMatrix, &grPaint)) { |
| + return; |
| + } |
| + |
| + fDrawContext->drawRegion(fClip, grPaint, *draw.fMatrix, region); |
| +} |
| + |
| void SkGpuDevice::drawOval(const SkDraw& draw, const SkRect& oval, const SkPaint& paint) { |
| ASSERT_SINGLE_OWNER |
| GR_CREATE_TRACE_MARKER_CONTEXT("SkGpuDevice", "drawOval", fContext); |