aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/effects/SkAlphaThresholdFilter.cpp
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2016-11-15 22:17:22 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-11-15 22:17:40 +0000
commit4e344c8b93c7c2d1ef3cb7fd339bba55c479ece0 (patch)
tree73aade9f0896ae2b413ca495b132e486e8bf5949 /src/effects/SkAlphaThresholdFilter.cpp
parentbe42c994b41a6d99b4bbf370aa1634350c773219 (diff)
Revert "Defer more renderTargetContexts in the GPU image filter paths"
This reverts commit fd01ce05ef7902c49b0272b3524a389693c72b35. Reason for revert: see if this is the cause of the Nexus7 assertion failure Original change's description: > Defer more renderTargetContexts in the GPU image filter paths > > GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4767 > > Change-Id: I4c1f27247ef340a49d1ac96761810e77e6047ca2 > Reviewed-on: https://skia-review.googlesource.com/4767 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Robert Phillips <robertphillips@google.com> > TBR=bsalomon@google.com,robertphillips@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true Change-Id: I158f96ec1252481345fc5dca15086ffd4b47cb95 Reviewed-on: https://skia-review.googlesource.com/4875 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/effects/SkAlphaThresholdFilter.cpp')
-rw-r--r--src/effects/SkAlphaThresholdFilter.cpp37
1 files changed, 17 insertions, 20 deletions
diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp
index abf924ca06..b1c8b21460 100644
--- a/src/effects/SkAlphaThresholdFilter.cpp
+++ b/src/effects/SkAlphaThresholdFilter.cpp
@@ -16,9 +16,8 @@
#if SK_SUPPORT_GPU
#include "GrAlphaThresholdFragmentProcessor.h"
#include "GrContext.h"
-#include "GrFixedClip.h"
#include "GrRenderTargetContext.h"
-#include "GrTextureProxy.h"
+#include "GrFixedClip.h"
#endif
class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {
@@ -38,9 +37,7 @@ protected:
SkIPoint* offset) const override;
#if SK_SUPPORT_GPU
- sk_sp<GrTextureProxy> createMaskTexture(GrContext*,
- const SkMatrix&,
- const SkIRect& bounds) const;
+ sk_sp<GrTexture> createMaskTexture(GrContext*, const SkMatrix&, const SkIRect& bounds) const;
#endif
private:
@@ -96,29 +93,29 @@ SkAlphaThresholdFilterImpl::SkAlphaThresholdFilterImpl(const SkRegion& region,
}
#if SK_SUPPORT_GPU
-sk_sp<GrTextureProxy> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* context,
- const SkMatrix& inMatrix,
- const SkIRect& bounds) const {
+sk_sp<GrTexture> SkAlphaThresholdFilterImpl::createMaskTexture(GrContext* context,
+ const SkMatrix& inMatrix,
+ const SkIRect& bounds) const {
- sk_sp<GrRenderTargetContext> rtContext(context->makeDeferredRenderTargetContextWithFallback(
+ sk_sp<GrRenderTargetContext> renderTargetContext(context->makeRenderTargetContextWithFallback(
SkBackingFit::kApprox, bounds.width(), bounds.height(), kAlpha_8_GrPixelConfig, nullptr));
- if (!rtContext) {
+ if (!renderTargetContext) {
return nullptr;
}
GrPaint grPaint;
grPaint.setPorterDuffXPFactory(SkBlendMode::kSrc);
SkRegion::Iterator iter(fRegion);
- rtContext->clear(nullptr, 0x0, true);
+ renderTargetContext->clear(nullptr, 0x0, true);
GrFixedClip clip(SkIRect::MakeWH(bounds.width(), bounds.height()));
while (!iter.done()) {
SkRect rect = SkRect::Make(iter.rect());
- rtContext->drawRect(clip, grPaint, inMatrix, rect);
+ renderTargetContext->drawRect(clip, grPaint, inMatrix, rect);
iter.next();
}
- return sk_ref_sp(rtContext->asDeferredTexture());
+ return renderTargetContext->asTexture();
}
#endif
@@ -161,7 +158,7 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
SkMatrix matrix(ctx.ctm());
matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top()));
- sk_sp<GrTextureProxy> maskTexture(this->createMaskTexture(context, matrix, bounds));
+ sk_sp<GrTexture> maskTexture(this->createMaskTexture(context, matrix, bounds));
if (!maskTexture) {
return nullptr;
}
@@ -170,12 +167,12 @@ sk_sp<SkSpecialImage> SkAlphaThresholdFilterImpl::onFilterImage(SkSpecialImage*
sk_sp<GrColorSpaceXform> colorSpaceXform = GrColorSpaceXform::Make(input->getColorSpace(),
outProps.colorSpace());
sk_sp<GrFragmentProcessor> fp(GrAlphaThresholdFragmentProcessor::Make(
- inputTexture.get(),
- std::move(colorSpaceXform),
- maskTexture->instantiate(context->textureProvider()),
- fInnerThreshold,
- fOuterThreshold,
- bounds));
+ inputTexture.get(),
+ std::move(colorSpaceXform),
+ maskTexture.get(),
+ fInnerThreshold,
+ fOuterThreshold,
+ bounds));
if (!fp) {
return nullptr;
}