Rename fillRectWithLocalMatrix -> fillPixelsWithLocalMatrix

Rounding out to pixel grid boundaries makes this method dmsaa-ready by
ensuring no pixels have partial msaa sample coverage.

Bug: skia:11396
Change-Id: I2543c8806f94692992a692bd5adedf41326c8910
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/383416
Commit-Queue: Chris Dalton <csmartdalton@google.com>
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
This commit is contained in:
Chris Dalton 2021-03-10 19:20:43 -07:00 committed by Skia Commit-Bot
parent 3f35ac10b4
commit 3561955b0a
4 changed files with 19 additions and 23 deletions

View File

@ -694,13 +694,12 @@ bool SkBlurMaskFilterImpl::directFilterMaskGPU(GrRecordingContext* context,
return false;
}
SkIRect proxyBounds;
float extra=3.f*SkScalarCeilToScalar(xformedSigma-1/6.0f);
SkRect proxyRect = devRRect.rect();
proxyRect.outset(extra, extra);
devRRect.rect().makeOutset(extra, extra).roundOut(&proxyBounds);
paint.setCoverageFragmentProcessor(std::move(fp));
surfaceDrawContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo,
SkMatrix::I(), proxyRect, inverse);
surfaceDrawContext->fillPixelsWithLocalMatrix(clip, std::move(paint), proxyBounds, inverse);
}
return true;

View File

@ -42,7 +42,7 @@ static constexpr auto kMaskOrigin = kTopLeft_GrSurfaceOrigin;
static bool draw_mask(GrSurfaceDrawContext* surfaceDrawContext,
const GrClip* clip,
const SkMatrix& viewMatrix,
const SkIRect& maskRect,
const SkIRect& maskBounds,
GrPaint&& paint,
GrSurfaceProxyView mask) {
SkMatrix inverse;
@ -52,14 +52,13 @@ static bool draw_mask(GrSurfaceDrawContext* surfaceDrawContext,
mask.concatSwizzle(GrSwizzle("aaaa"));
SkMatrix matrix = SkMatrix::Translate(-SkIntToScalar(maskRect.fLeft),
-SkIntToScalar(maskRect.fTop));
SkMatrix matrix = SkMatrix::Translate(-SkIntToScalar(maskBounds.fLeft),
-SkIntToScalar(maskBounds.fTop));
matrix.preConcat(viewMatrix);
paint.setCoverageFragmentProcessor(
GrTextureEffect::Make(std::move(mask), kUnknown_SkAlphaType, matrix));
surfaceDrawContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(maskRect), inverse);
surfaceDrawContext->fillPixelsWithLocalMatrix(clip, std::move(paint), maskBounds, inverse);
return true;
}

View File

@ -387,10 +387,10 @@ void GrSurfaceDrawContext::drawPaint(const GrClip* clip,
const SkMatrix& viewMatrix) {
// Start with the render target, since that is the maximum content we could possibly fill.
// drawFilledQuad() will automatically restrict it to clip bounds for us if possible.
SkRect r = this->asSurfaceProxy()->getBoundsRect();
if (!paint.numTotalFragmentProcessors()) {
// The paint is trivial so we won't need to use local coordinates, so skip calculating the
// inverse view matrix.
SkRect r = this->asSurfaceProxy()->getBoundsRect();
this->fillRectToRect(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), r, r);
} else {
// Use the inverse view matrix to arrive at appropriate local coordinates for the paint.
@ -398,8 +398,8 @@ void GrSurfaceDrawContext::drawPaint(const GrClip* clip,
if (!viewMatrix.invert(&localMatrix)) {
return;
}
this->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(), r,
localMatrix);
SkIRect bounds = SkIRect::MakeSize(this->asSurfaceProxy()->dimensions());
this->fillPixelsWithLocalMatrix(clip, std::move(paint), bounds, localMatrix);
}
}

View File

@ -189,18 +189,16 @@ public:
}
/**
* Fills a rect with a paint and a localMatrix.
* Fills a block of pixels with a paint and a localMatrix, respecting the clip.
*/
void fillRectWithLocalMatrix(const GrClip* clip,
GrPaint&& paint,
GrAA aa,
const SkMatrix& viewMatrix,
const SkRect& rect,
const SkMatrix& localMatrix) {
DrawQuad quad{GrQuad::MakeFromRect(rect, viewMatrix),
GrQuad::MakeFromRect(rect, localMatrix),
aa == GrAA::kYes ? GrQuadAAFlags::kAll : GrQuadAAFlags::kNone};
this->drawFilledQuad(clip, std::move(paint), aa, &quad);
void fillPixelsWithLocalMatrix(const GrClip* clip,
GrPaint&& paint,
const SkIRect& bounds,
const SkMatrix& localMatrix) {
SkRect rect = SkRect::Make(bounds);
DrawQuad quad{GrQuad::MakeFromRect(rect, SkMatrix::I()),
GrQuad::MakeFromRect(rect, localMatrix), GrQuadAAFlags::kNone};
this->drawFilledQuad(clip, std::move(paint), GrAA::kNo, &quad);
}
/**