diff options
author | Brian Salomon <bsalomon@google.com> | 2016-12-08 10:35:19 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-12-08 16:27:44 +0000 |
commit | 9f549358b3ac9f61e78b194e39d6ac6eb322e35e (patch) | |
tree | 870b370b9985b1863abf4b1df0cce6d6f6ad5ac5 /src/gpu/GrSWMaskHelper.cpp | |
parent | 978ccebd8af61417ecdb6d45a31cc68657eee752 (diff) |
Remove antialiasing control from GrPaint.
This adds an additional param (of new enum type GrAA) to draws that can antialias and a new enum GrAAType to indicate the AA technique (none, fragment shader computed coverage, msaa).
Some GMs change due to this:
1) In some places we weren't disabling MSAA when the draw was supposed to be unantialiased.
2) Some bounding rect draws that use GrFragmentProcessors were unnecessarily turning on antialiasing, by disabling it a very small number of pixel LSBs change.
Change-Id: I7d8d8793dda70bcd373d09055beb9949c1a8a4d0
Reviewed-on: https://skia-review.googlesource.com/5608
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/GrSWMaskHelper.cpp')
-rw-r--r-- | src/gpu/GrSWMaskHelper.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/gpu/GrSWMaskHelper.cpp b/src/gpu/GrSWMaskHelper.cpp index ec76c48bf9..7351ecd547 100644 --- a/src/gpu/GrSWMaskHelper.cpp +++ b/src/gpu/GrSWMaskHelper.cpp @@ -38,12 +38,11 @@ static SkBlendMode op_to_mode(SkRegion::Op op) { /** * Draw a single rect element of the clip stack into the accumulation bitmap */ -void GrSWMaskHelper::drawRect(const SkRect& rect, SkRegion::Op op, - bool antiAlias, uint8_t alpha) { +void GrSWMaskHelper::drawRect(const SkRect& rect, SkRegion::Op op, GrAA aa, uint8_t alpha) { SkPaint paint; paint.setBlendMode(op_to_mode(op)); - paint.setAntiAlias(antiAlias); + paint.setAntiAlias(GrAA::kYes == aa); paint.setColor(SkColorSetARGB(alpha, alpha, alpha, alpha)); fDraw.drawRect(rect, paint); @@ -52,12 +51,11 @@ void GrSWMaskHelper::drawRect(const SkRect& rect, SkRegion::Op op, /** * Draw a single path element of the clip stack into the accumulation bitmap */ -void GrSWMaskHelper::drawShape(const GrShape& shape, SkRegion::Op op, bool antiAlias, - uint8_t alpha) { +void GrSWMaskHelper::drawShape(const GrShape& shape, SkRegion::Op op, GrAA aa, uint8_t alpha) { SkPaint paint; paint.setPathEffect(sk_ref_sp(shape.style().pathEffect())); shape.style().strokeRec().applyToPaint(&paint); - paint.setAntiAlias(antiAlias); + paint.setAntiAlias(GrAA::kYes == aa); SkPath path; shape.asPath(&path); @@ -141,7 +139,7 @@ void GrSWMaskHelper::toSDF(unsigned char* sdf) { GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider, const GrShape& shape, const SkIRect& resultBounds, - bool antiAlias, + GrAA aa, TextureType textureType, const SkMatrix* matrix) { GrSWMaskHelper helper(texProvider); @@ -150,7 +148,7 @@ GrTexture* GrSWMaskHelper::DrawShapeMaskToTexture(GrTextureProvider* texProvider return nullptr; } - helper.drawShape(shape, SkRegion::kReplace_Op, antiAlias, 0xFF); + helper.drawShape(shape, SkRegion::kReplace_Op, aa, 0xFF); GrTexture* texture(helper.createTexture(textureType)); if (!texture) { @@ -185,7 +183,7 @@ void GrSWMaskHelper::DrawToTargetWithShapeMask(GrTexture* texture, maskMatrix.preTranslate(SkIntToScalar(-textureOriginInDeviceSpace.fX), SkIntToScalar(-textureOriginInDeviceSpace.fY)); maskMatrix.preConcat(viewMatrix); - GrPipelineBuilder pipelineBuilder(paint, renderTargetContext->mustUseHWAA(paint)); + GrPipelineBuilder pipelineBuilder(paint, GrAAType::kNone); pipelineBuilder.setUserStencil(&userStencilSettings); pipelineBuilder.addCoverageFragmentProcessor( |