aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrBlurUtils.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2017-01-30 08:06:27 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-01-30 13:40:15 +0000
commit40fd7c94c24bb30d888c3d85a79cbb96c7fbf800 (patch)
tree075e886c01de864ba982910f1854f47ba1ae95d8 /src/gpu/GrBlurUtils.cpp
parent55b72530fedeb58154635531751a8730982fbf2a (diff)
Push GrTextureProxy down to more effects
Change-Id: Ie3f32a88f25af082c25bc6daf3fe24e303e80f9e Reviewed-on: https://skia-review.googlesource.com/7616 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Brian Salomon <bsalomon@google.com>
Diffstat (limited to 'src/gpu/GrBlurUtils.cpp')
-rw-r--r--src/gpu/GrBlurUtils.cpp17
1 files changed, 7 insertions, 10 deletions
diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp
index 7a8a252cff..cec9cdc7ad 100644
--- a/src/gpu/GrBlurUtils.cpp
+++ b/src/gpu/GrBlurUtils.cpp
@@ -30,18 +30,13 @@ static bool clip_bounds_quick_reject(const SkIRect& clipBounds, const SkIRect& r
// Draw a mask using the supplied paint. Since the coverage/geometry
// is already burnt into the mask this boils down to a rect draw.
// Return true if the mask was successfully drawn.
-static bool draw_mask(GrRenderTargetContext* renderTargetContext,
- GrTextureProvider* textureProvider,
+static bool draw_mask(GrContext* context,
+ GrRenderTargetContext* renderTargetContext,
const GrClip& clip,
const SkMatrix& viewMatrix,
const SkIRect& maskRect,
GrPaint&& paint,
sk_sp<GrTextureProxy> mask) {
- // TODO: defer this instantiation
- GrTexture* maskTex = mask->instantiate(textureProvider);
- if (!maskTex) {
- return false;
- }
SkMatrix inverse;
if (!viewMatrix.invert(&inverse)) {
return false;
@@ -50,7 +45,8 @@ static bool draw_mask(GrRenderTargetContext* renderTargetContext,
SkMatrix matrix = SkMatrix::MakeTrans(-SkIntToScalar(maskRect.fLeft),
-SkIntToScalar(maskRect.fTop));
matrix.preConcat(viewMatrix);
- paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(maskTex, nullptr, matrix));
+ paint.addCoverageFragmentProcessor(GrSimpleTextureEffect::Make(context, std::move(mask),
+ nullptr, matrix));
renderTargetContext->fillRectWithLocalMatrix(clip, std::move(paint), GrAA::kNo, SkMatrix::I(),
SkRect::Make(maskRect), inverse);
@@ -86,6 +82,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
// we now have a device-aligned 8bit mask in dstM, ready to be drawn using
// the current clip (and identity matrix) and GrPaint settings
GrSurfaceDesc desc;
+ desc.fOrigin = kTopLeft_GrSurfaceOrigin;
desc.fWidth = dstM.fBounds.width();
desc.fHeight = dstM.fBounds.height();
desc.fConfig = kAlpha_8_GrPixelConfig;
@@ -103,7 +100,7 @@ static bool sw_draw_with_mask_filter(GrContext* context,
return false;
}
- return draw_mask(renderTargetContext, context->textureProvider(), clipData, viewMatrix,
+ return draw_mask(context, renderTargetContext, clipData, viewMatrix,
dstM.fBounds, std::move(paint), sk_ref_sp(sContext->asDeferredTexture()));
}
@@ -234,7 +231,7 @@ static void draw_path_with_mask_filter(GrContext* context,
viewMatrix,
finalIRect);
if (filtered) {
- if (draw_mask(renderTargetContext, context->textureProvider(), clip, viewMatrix,
+ if (draw_mask(context, renderTargetContext, clip, viewMatrix,
finalIRect, std::move(paint), std::move(filtered))) {
// This path is completely drawn
return;