From d9d84858bf0efa6fccd093aeafc29dd5f0b0356c Mon Sep 17 00:00:00 2001 From: Robert Phillips Date: Fri, 9 Jun 2017 10:48:29 -0400 Subject: [PATCH] Retract GrTexture.h a bit This began as cleaning up SkSpecialImage.h & spiraled out of control from there. Change-Id: I9a570ecd2a7af9ee724ebfebe4e9185748f38bbc Reviewed-on: https://skia-review.googlesource.com/19290 Reviewed-by: Brian Salomon Commit-Queue: Robert Phillips --- gm/image_pict.cpp | 2 -- include/core/SkMaskFilter.h | 2 +- include/private/GrTextureProxy.h | 2 +- src/core/SkMaskFilter.cpp | 6 ------ src/core/SkSpecialImage.cpp | 6 ------ src/core/SkSpecialImage.h | 4 ---- src/effects/SkBlurMaskFilter.cpp | 1 - src/effects/SkMorphologyImageFilter.cpp | 1 - src/effects/SkRRectsGaussianEdgeMaskFilter.cpp | 6 ++---- src/gpu/GrBlurUtils.cpp | 3 +-- src/gpu/GrTextureAdjuster.cpp | 3 --- src/gpu/GrTextureProducer.cpp | 4 +--- src/gpu/GrTextureRenderTargetProxy.cpp | 2 +- src/gpu/GrXferProcessor.h | 1 - src/gpu/SkGpuDevice.cpp | 2 +- src/gpu/SkGr.cpp | 2 +- src/gpu/effects/GrCustomXfermode.cpp | 1 - src/gpu/effects/GrSimpleTextureEffect.cpp | 1 - src/gpu/gl/builders/GrGLProgramBuilder.cpp | 1 - tests/ClipStackTest.cpp | 1 + 20 files changed, 10 insertions(+), 41 deletions(-) diff --git a/gm/image_pict.cpp b/gm/image_pict.cpp index 709ee6e73d..2a902ccbb9 100644 --- a/gm/image_pict.cpp +++ b/gm/image_pict.cpp @@ -18,8 +18,6 @@ #include "GrContext.h" #include "GrContextPriv.h" #include "GrSurfaceContext.h" -#include "GrSurfaceProxy.h" -#include "GrTexture.h" #include "GrTextureProxy.h" #include "../src/image/SkImage_Gpu.h" #endif diff --git a/include/core/SkMaskFilter.h b/include/core/SkMaskFilter.h index 5cd5535904..1714d17bca 100644 --- a/include/core/SkMaskFilter.h +++ b/include/core/SkMaskFilter.h @@ -78,7 +78,7 @@ public: * If effect is non-NULL, a new GrProcessor instance is stored in it. The caller assumes * ownership of the effect and must unref it. */ - virtual bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix& ctm) const; + virtual bool asFragmentProcessor(GrFragmentProcessor**) const { return false; } /** * If asFragmentProcessor() fails the filter may be implemented on the GPU by a subclass diff --git a/include/private/GrTextureProxy.h b/include/private/GrTextureProxy.h index dcc3afcdb1..2736e61c12 100644 --- a/include/private/GrTextureProxy.h +++ b/include/private/GrTextureProxy.h @@ -8,8 +8,8 @@ #ifndef GrTextureProxy_DEFINED #define GrTextureProxy_DEFINED +#include "GrSamplerParams.h" #include "GrSurfaceProxy.h" -#include "GrTexture.h" class GrCaps; class GrResourceProvider; diff --git a/src/core/SkMaskFilter.cpp b/src/core/SkMaskFilter.cpp index e8577488fc..382e24e9ed 100644 --- a/src/core/SkMaskFilter.cpp +++ b/src/core/SkMaskFilter.cpp @@ -16,9 +16,7 @@ #include "SkRasterClip.h" #if SK_SUPPORT_GPU -#include "GrTexture.h" #include "GrTextureProxy.h" -#include "SkGr.h" #endif SkMaskFilter::NinePatch::~NinePatch() { @@ -303,10 +301,6 @@ SkMaskFilter::filterRectsToNine(const SkRect[], int count, const SkMatrix&, } #if SK_SUPPORT_GPU -bool SkMaskFilter::asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix&) const { - return false; -} - bool SkMaskFilter::canFilterMaskGPU(const SkRRect& devRRect, const SkIRect& clipBounds, const SkMatrix& ctm, diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp index b22335bb75..db40329204 100644 --- a/src/core/SkSpecialImage.cpp +++ b/src/core/SkSpecialImage.cpp @@ -20,11 +20,7 @@ #include "GrContextPriv.h" #include "GrResourceProvider.h" #include "GrSurfaceContext.h" -#include "GrSurfaceProxyPriv.h" -#include "GrTexture.h" -#include "GrSamplerParams.h" #include "GrTextureProxy.h" -#include "SkGr.h" #include "SkImage_Gpu.h" #endif @@ -342,8 +338,6 @@ sk_sp SkSpecialImage::MakeFromRaster(const SkIRect& subset, #if SK_SUPPORT_GPU /////////////////////////////////////////////////////////////////////////////// -#include "GrTexture.h" - static sk_sp wrap_proxy_in_image(GrContext* context, sk_sp proxy, SkAlphaType alphaType, sk_sp colorSpace) { return sk_make_sp(context, kNeedNewImageUniqueID, alphaType, diff --git a/src/core/SkSpecialImage.h b/src/core/SkSpecialImage.h index 33de36ca23..d694fa22e2 100644 --- a/src/core/SkSpecialImage.h +++ b/src/core/SkSpecialImage.h @@ -16,8 +16,6 @@ #include "SkImageInfo.h" // for SkAlphaType class GrContext; -class GrSurfaceProxy; -class GrTexture; class GrTextureProxy; class SkBitmap; class SkCanvas; @@ -119,7 +117,6 @@ public: */ sk_sp asImage(const SkIRect* subset = nullptr) const; - // TODO: hide this when GrLayerHoister uses SkSpecialImages more fully (see skbug.com/5063) /** * If the SpecialImage is backed by a gpu texture, return true. */ @@ -138,7 +135,6 @@ public: sk_sp asTextureProxyRef(GrContext*) const; #endif - // TODO: hide this whe the imagefilter all have a consistent draw path (see skbug.com/5063) /** * Regardless of the underlying backing store, return the contents as an SkBitmap * diff --git a/src/effects/SkBlurMaskFilter.cpp b/src/effects/SkBlurMaskFilter.cpp index 50a97ff196..93f335bfb9 100644 --- a/src/effects/SkBlurMaskFilter.cpp +++ b/src/effects/SkBlurMaskFilter.cpp @@ -25,7 +25,6 @@ #include "GrResourceProvider.h" #include "GrShaderCaps.h" #include "GrStyle.h" -#include "GrTexture.h" #include "GrTextureProxy.h" #include "effects/GrSimpleTextureEffect.h" #include "glsl/GrGLSLFragmentProcessor.h" diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index 57abec9ebf..689563afc5 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -19,7 +19,6 @@ #include "GrContext.h" #include "GrFixedClip.h" #include "GrRenderTargetContext.h" -#include "GrTexture.h" #include "GrTextureProxy.h" #include "SkGr.h" diff --git a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp index 1c7134ee94..2cae9a4631 100644 --- a/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp +++ b/src/effects/SkRRectsGaussianEdgeMaskFilter.cpp @@ -33,7 +33,7 @@ public: SkIPoint* margin) const override; #if SK_SUPPORT_GPU - bool asFragmentProcessor(GrFragmentProcessor**, GrTexture*, const SkMatrix& ctm) const override; + bool asFragmentProcessor(GrFragmentProcessor**) const override; #endif SK_TO_STRING_OVERRIDE() @@ -494,9 +494,7 @@ private: }; //////////////////////////////////////////////////////////////////////////// -bool SkRRectsGaussianEdgeMaskFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp, - GrTexture*, const - SkMatrix& ctm) const { +bool SkRRectsGaussianEdgeMaskFilterImpl::asFragmentProcessor(GrFragmentProcessor** fp) const { if (fp) { *fp = new RRectsGaussianEdgeFP(fFirst, fSecond, fRadius); } diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index 9d28b54f54..76443ff938 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -15,7 +15,6 @@ #include "GrResourceProvider.h" #include "effects/GrSimpleTextureEffect.h" #include "GrStyle.h" -#include "GrTexture.h" #include "GrTextureProxy.h" #include "SkDraw.h" #include "SkGr.h" @@ -302,7 +301,7 @@ void GrBlurUtils::drawPathWithMaskFilter(GrContext* context, } GrAA aa = GrBoolToAA(paint.isAntiAlias()); SkMaskFilter* mf = paint.getMaskFilter(); - if (mf && !mf->asFragmentProcessor(nullptr, nullptr, viewMatrix)) { + if (mf && !mf->asFragmentProcessor(nullptr)) { // The MaskFilter wasn't already handled in SkPaintToGrPaint draw_path_with_mask_filter(context, renderTargetContext, clip, std::move(grPaint), aa, viewMatrix, mf, style, path, pathIsMutable); diff --git a/src/gpu/GrTextureAdjuster.cpp b/src/gpu/GrTextureAdjuster.cpp index bb4d92aa54..183ec70fcf 100644 --- a/src/gpu/GrTextureAdjuster.cpp +++ b/src/gpu/GrTextureAdjuster.cpp @@ -8,10 +8,7 @@ #include "GrTextureAdjuster.h" #include "GrContext.h" -#include "GrGpu.h" -#include "GrGpuResourcePriv.h" #include "GrResourceProvider.h" -#include "GrTexture.h" #include "SkGr.h" GrTextureAdjuster::GrTextureAdjuster(GrContext* context, sk_sp original, diff --git a/src/gpu/GrTextureProducer.cpp b/src/gpu/GrTextureProducer.cpp index b9e7dfc9b6..c8ab782276 100644 --- a/src/gpu/GrTextureProducer.cpp +++ b/src/gpu/GrTextureProducer.cpp @@ -9,9 +9,7 @@ #include "GrClip.h" #include "GrRenderTargetContext.h" #include "GrResourceProvider.h" -#include "GrSurfaceProxy.h" -#include "GrSurfaceProxyPriv.h" -#include "GrTexture.h" +#include "GrTextureProxy.h" #include "effects/GrBicubicEffect.h" #include "effects/GrSimpleTextureEffect.h" #include "effects/GrTextureDomain.h" diff --git a/src/gpu/GrTextureRenderTargetProxy.cpp b/src/gpu/GrTextureRenderTargetProxy.cpp index 3981f17e30..97c990dabe 100644 --- a/src/gpu/GrTextureRenderTargetProxy.cpp +++ b/src/gpu/GrTextureRenderTargetProxy.cpp @@ -26,7 +26,7 @@ GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(const GrCaps& caps, // GrRenderTargetProxy) so its constructor must be explicitly called. GrTextureRenderTargetProxy::GrTextureRenderTargetProxy(sk_sp surf) : GrSurfaceProxy(surf, SkBackingFit::kExact) - , GrTextureProxy(sk_ref_sp(surf->asTexture())) + , GrTextureProxy(surf) , GrRenderTargetProxy(sk_ref_sp(surf->asRenderTarget())) { SkASSERT(surf->asTexture()); SkASSERT(surf->asRenderTarget()); diff --git a/src/gpu/GrXferProcessor.h b/src/gpu/GrXferProcessor.h index b7f465fb45..6bffba2495 100644 --- a/src/gpu/GrXferProcessor.h +++ b/src/gpu/GrXferProcessor.h @@ -13,7 +13,6 @@ #include "GrNonAtomicRef.h" #include "GrProcessor.h" #include "GrProcessorAnalysis.h" -#include "GrTexture.h" #include "GrTypes.h" class GrGLSLXferProcessor; diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp index 949fdbc79b..28cb5f8c53 100644 --- a/src/gpu/SkGpuDevice.cpp +++ b/src/gpu/SkGpuDevice.cpp @@ -412,7 +412,7 @@ void SkGpuDevice::drawRRect(const SkRRect& rrect, const SkPaint& paint) { } SkMaskFilter* mf = paint.getMaskFilter(); - if (mf && mf->asFragmentProcessor(nullptr, nullptr, this->ctm())) { + if (mf && mf->asFragmentProcessor(nullptr)) { mf = nullptr; // already handled in SkPaintToGrPaint } diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index fd9be57359..8b54aaa780 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -529,7 +529,7 @@ static inline bool skpaint_to_grpaint_impl(GrContext* context, SkMaskFilter* maskFilter = skPaint.getMaskFilter(); if (maskFilter) { GrFragmentProcessor* mfFP; - if (maskFilter->asFragmentProcessor(&mfFP, nullptr, viewM)) { + if (maskFilter->asFragmentProcessor(&mfFP)) { grPaint->addCoverageFragmentProcessor(sk_sp(mfFP)); } } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index a2302e0345..17e0ba13f0 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -13,7 +13,6 @@ #include "GrPipeline.h" #include "GrProcessor.h" #include "GrShaderCaps.h" -#include "GrTexture.h" #include "glsl/GrGLSLBlend.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index a41ed8b0b9..307188b96a 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -7,7 +7,6 @@ #include "GrSimpleTextureEffect.h" #include "GrProxyMove.h" -#include "GrTexture.h" #include "glsl/GrGLSLColorSpaceXformHelper.h" #include "glsl/GrGLSLFragmentProcessor.h" #include "glsl/GrGLSLFragmentShaderBuilder.h" diff --git a/src/gpu/gl/builders/GrGLProgramBuilder.cpp b/src/gpu/gl/builders/GrGLProgramBuilder.cpp index dda2ac13ba..e4c4cb98c3 100644 --- a/src/gpu/gl/builders/GrGLProgramBuilder.cpp +++ b/src/gpu/gl/builders/GrGLProgramBuilder.cpp @@ -14,7 +14,6 @@ #include "GrProgramDesc.h" #include "GrShaderCaps.h" #include "GrSwizzle.h" -#include "GrTexture.h" #include "SkAutoMalloc.h" #include "SkATrace.h" #include "SkTraceEvent.h" diff --git a/tests/ClipStackTest.cpp b/tests/ClipStackTest.cpp index 1cb644a80f..af57f9e5c2 100644 --- a/tests/ClipStackTest.cpp +++ b/tests/ClipStackTest.cpp @@ -17,6 +17,7 @@ #include "GrReducedClip.h" #include "GrResourceCache.h" #include "GrSurfaceProxyPriv.h" +#include "GrTexture.h" #include "GrTextureProxy.h" typedef GrReducedClip::ElementList ElementList; typedef GrReducedClip::InitialState InitialState;