aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBlurUtils.cpp
diff options
context:
space:
mode:
authorGravatar Brian Salomon <bsalomon@google.com>2016-12-08 10:35:19 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-08 16:27:44 +0000
commit9f549358b3ac9f61e78b194e39d6ac6eb322e35e (patch)
tree870b370b9985b1863abf4b1df0cce6d6f6ad5ac5 /src/gpu/GrBlurUtils.cpp
parent978ccebd8af61417ecdb6d45a31cc68657eee752 (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/GrBlurUtils.cpp')
-rw-r--r--src/gpu/GrBlurUtils.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 8f14bf75e5..04a002288d 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -44,8 +44,8 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext,
if (!viewMatrix.invert(&inverse)) {
return false;
}
- renderTargetContext->fillRectWithLocalMatrix(clip, *grp, SkMatrix::I(), SkRect::Make(maskRect),
- inverse);
+ renderTargetContext->fillRectWithLocalMatrix(clip, *grp, GrAA::kNo, SkMatrix::I(),
+ SkRect::Make(maskRect), inverse);
return true;
}
@@ -97,9 +97,9 @@ static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context,
const SkIRect& maskRect,
const SkPath& devPath,
SkStrokeRec::InitStyle fillOrHairline,
- bool doAA,
+ GrAA aa,
int sampleCnt) {
- if (!doAA) {
+ if (GrAA::kNo == aa) {
// Don't need MSAA if mask isn't AA
sampleCnt = 0;
}
@@ -114,7 +114,6 @@ static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context,
rtContext->clear(nullptr, 0x0, true);
GrPaint tempPaint;
- tempPaint.setAntiAlias(doAA);
tempPaint.setCoverageSetOpXPFactory(SkRegion::kReplace_Op);
// setup new clip
@@ -125,7 +124,7 @@ static sk_sp<GrTextureProxy> create_mask_GPU(GrContext* context,
// the origin using tempPaint.
SkMatrix translate;
translate.setTranslate(-SkIntToScalar(maskRect.fLeft), -SkIntToScalar(maskRect.fTop));
- rtContext->drawPath(clip, tempPaint, translate, devPath, GrStyle(fillOrHairline));
+ rtContext->drawPath(clip, tempPaint, aa, translate, devPath, GrStyle(fillOrHairline));
return sk_ref_sp(rtContext->asDeferredTexture());
}
@@ -133,6 +132,7 @@ static void draw_path_with_mask_filter(GrContext* context,
GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
GrPaint* paint,
+ GrAA aa,
const SkMatrix& viewMatrix,
const SkMaskFilter* maskFilter,
const GrStyle& style,
@@ -210,7 +210,7 @@ static void draw_path_with_mask_filter(GrContext* context,
finalIRect,
*path,
fillOrHairline,
- paint->isAntiAlias(),
+ aa,
renderTargetContext->numColorSamples()));
if (maskProxy) {
GrTexture* filtered;
@@ -241,11 +241,12 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
const GrClip& clip,
const SkPath& path,
GrPaint* paint,
+ GrAA aa,
const SkMatrix& viewMatrix,
const SkMaskFilter* mf,
const GrStyle& style,
bool pathIsMutable) {
- draw_path_with_mask_filter(context, renderTargetContext, clip, paint, viewMatrix, mf,
+ draw_path_with_mask_filter(context, renderTargetContext, clip, paint, aa, viewMatrix, mf,
style, &path, pathIsMutable);
}
@@ -289,14 +290,14 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context,
if (!SkPaintToGrPaint(context, renderTargetContext, paint, viewMatrix, &grPaint)) {
return;
}
-
+ GrAA aa = GrBoolToAA(paint.isAntiAlias());
SkMaskFilter* mf = paint.getMaskFilter();
if (mf && !mf->asFragmentProcessor(nullptr, nullptr, viewMatrix)) {
// The MaskFilter wasn't already handled in SkPaintToGrPaint
- draw_path_with_mask_filter(context, renderTargetContext, clip, &grPaint, viewMatrix,
+ draw_path_with_mask_filter(context, renderTargetContext, clip, &grPaint, aa, viewMatrix,
mf, style,
path, pathIsMutable);
} else {
- renderTargetContext->drawPath(clip, grPaint, viewMatrix, *path, style);
+ renderTargetContext->drawPath(clip, grPaint, aa, viewMatrix, *path, style);
}
}