diff --git a/gm/texdata.cpp b/gm/texdata.cpp index 4cad11336e..0c23749e02 100644 --- a/gm/texdata.cpp +++ b/gm/texdata.cpp @@ -12,6 +12,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #include "SkColorPriv.h" #include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrSimpleTextureEffect.h" diff --git a/gyp/gpu.gypi b/gyp/gpu.gypi index e85b72ee35..9d7a08465b 100644 --- a/gyp/gpu.gypi +++ b/gyp/gpu.gypi @@ -84,7 +84,6 @@ '<(skia_src_path)/gpu/GrBufferAllocPool.cpp', '<(skia_src_path)/gpu/GrBufferAllocPool.h', '<(skia_src_path)/gpu/GrCaps.cpp', - '<(skia_src_path)/gpu/GrClip.cpp', '<(skia_src_path)/gpu/GrClipStackClip.h', '<(skia_src_path)/gpu/GrClipStackClip.cpp', '<(skia_src_path)/gpu/GrColorSpaceXform.cpp', @@ -101,6 +100,8 @@ '<(skia_src_path)/gpu/GrDrawingManager.h', '<(skia_src_path)/gpu/GrDrawTarget.cpp', '<(skia_src_path)/gpu/GrDrawTarget.h', + '<(skia_src_path)/gpu/GrFixedClip.cpp', + '<(skia_src_path)/gpu/GrFixedClip.h', '<(skia_src_path)/gpu/GrFragmentProcessor.cpp', '<(skia_src_path)/gpu/GrGeometryProcessor.h', '<(skia_src_path)/gpu/GrGlyph.h', diff --git a/include/gpu/GrClip.h b/include/gpu/GrClip.h index 6457d03051..168827b9f8 100644 --- a/include/gpu/GrClip.h +++ b/include/gpu/GrClip.h @@ -8,10 +8,11 @@ #ifndef GrClip_DEFINED #define GrClip_DEFINED -#include "GrFragmentProcessor.h" -#include "GrTypesPriv.h" +#include "SkRect.h" +#include "SkRRect.h" class GrAppliedClip; +class GrContext; class GrDrawContext; /** @@ -108,46 +109,19 @@ public: */ class GrNoClip final : public GrClip { private: - bool quickContains(const SkRect&) const final { return true; } - void getConservativeBounds(int width, int height, SkIRect* devResult, - bool* isIntersectionOfRects) const final; - bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const final { return true; } -}; - -/** - * GrFixedClip is a clip that can be represented by fixed-function hardware. It never modifies the - * stencil buffer itself, but can be configured to use whatever clip is already there. - */ -class GrFixedClip final : public GrClip { -public: - GrFixedClip() : fHasStencilClip(false) {} - GrFixedClip(const SkIRect& scissorRect) - : fScissorState(scissorRect) - , fHasStencilClip(false) {} - - void reset() { - fScissorState.setDisabled(); - fHasStencilClip = false; + bool quickContains(const SkRect&) const final { + return true; } - - void reset(const SkIRect& scissorRect) { - fScissorState.set(scissorRect); - fHasStencilClip = false; - } - - void enableStencilClip() { fHasStencilClip = true; } - void disableStencilClip() { fHasStencilClip = false; } - - bool quickContains(const SkRect&) const final; void getConservativeBounds(int width, int height, SkIRect* devResult, - bool* isIntersectionOfRects) const final; - -private: - bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings, - GrAppliedClip* out) const final; - - GrScissorState fScissorState; - bool fHasStencilClip; + bool* isIntersectionOfRects) const final { + devResult->setXYWH(0, 0, width, height); + if (isIntersectionOfRects) { + *isIntersectionOfRects = true; + } + } + bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const final { + return true; + } }; #endif diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index bf6fa96540..b2c04450ff 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -21,6 +21,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #endif #ifndef SK_IGNORE_TO_STRING diff --git a/src/effects/SkAlphaThresholdFilter.cpp b/src/effects/SkAlphaThresholdFilter.cpp index 0871d2bc6e..5170a3d098 100644 --- a/src/effects/SkAlphaThresholdFilter.cpp +++ b/src/effects/SkAlphaThresholdFilter.cpp @@ -17,6 +17,7 @@ #include "GrAlphaThresholdFragmentProcessor.h" #include "GrContext.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #endif class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { diff --git a/src/effects/SkGpuBlurUtils.cpp b/src/effects/SkGpuBlurUtils.cpp index ebb480d3df..ca762e88e3 100644 --- a/src/effects/SkGpuBlurUtils.cpp +++ b/src/effects/SkGpuBlurUtils.cpp @@ -15,6 +15,7 @@ #include "GrContext.h" #include "GrCaps.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #define MAX_BLUR_SIGMA 4.0f diff --git a/src/effects/SkLightingImageFilter.cpp b/src/effects/SkLightingImageFilter.cpp index a9e833539c..5e5aca96af 100644 --- a/src/effects/SkLightingImageFilter.cpp +++ b/src/effects/SkLightingImageFilter.cpp @@ -17,6 +17,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #include "GrFragmentProcessor.h" #include "GrInvariantOutput.h" #include "GrPaint.h" diff --git a/src/effects/SkMorphologyImageFilter.cpp b/src/effects/SkMorphologyImageFilter.cpp index d5c3a2d190..cdc236b63a 100644 --- a/src/effects/SkMorphologyImageFilter.cpp +++ b/src/effects/SkMorphologyImageFilter.cpp @@ -18,6 +18,7 @@ #if SK_SUPPORT_GPU #include "GrContext.h" #include "GrDrawContext.h" +#include "GrFixedClip.h" #include "GrInvariantOutput.h" #include "GrTexture.h" #include "SkGr.h" diff --git a/src/gpu/GrBlurUtils.cpp b/src/gpu/GrBlurUtils.cpp index b99cb34e5d..2b7540da0a 100644 --- a/src/gpu/GrBlurUtils.cpp +++ b/src/gpu/GrBlurUtils.cpp @@ -9,6 +9,7 @@ #include "GrDrawContext.h" #include "GrCaps.h" #include "GrContext.h" +#include "GrFixedClip.h" #include "effects/GrSimpleTextureEffect.h" #include "GrStyle.h" #include "GrTexture.h" diff --git a/src/gpu/GrClipStackClip.cpp b/src/gpu/GrClipStackClip.cpp index 975f56a757..695eda981f 100644 --- a/src/gpu/GrClipStackClip.cpp +++ b/src/gpu/GrClipStackClip.cpp @@ -10,6 +10,7 @@ #include "GrAppliedClip.h" #include "GrDrawingManager.h" #include "GrDrawContextPriv.h" +#include "GrFixedClip.h" #include "GrGpuResourcePriv.h" #include "GrRenderTargetPriv.h" #include "GrStencilAttachment.h" diff --git a/src/gpu/GrClipStackClip.h b/src/gpu/GrClipStackClip.h index 15025471d2..cb1f683702 100644 --- a/src/gpu/GrClipStackClip.h +++ b/src/gpu/GrClipStackClip.h @@ -8,12 +8,13 @@ #define GrClipStackClip_DEFINED #include "GrClip.h" - #include "GrReducedClip.h" #include "SkClipStack.h" -class GrTextureProvider; class GrPathRenderer; +class GrTexture; +class GrTextureProvider; +class GrUniqueKey; /** * GrClipStackClip can apply a generic SkClipStack to the draw state. It may need to generate an diff --git a/src/gpu/GrDrawContext.cpp b/src/gpu/GrDrawContext.cpp index db14498962..9e80f732c2 100644 --- a/src/gpu/GrDrawContext.cpp +++ b/src/gpu/GrDrawContext.cpp @@ -10,6 +10,7 @@ #include "GrDrawContext.h" #include "GrDrawContextPriv.h" #include "GrDrawingManager.h" +#include "GrFixedClip.h" #include "GrGpuResourcePriv.h" #include "GrOvalRenderer.h" #include "GrPathRenderer.h" diff --git a/src/gpu/GrClip.cpp b/src/gpu/GrFixedClip.cpp similarity index 84% rename from src/gpu/GrClip.cpp rename to src/gpu/GrFixedClip.cpp index f89a366963..c42214b271 100644 --- a/src/gpu/GrClip.cpp +++ b/src/gpu/GrFixedClip.cpp @@ -5,19 +5,11 @@ * found in the LICENSE file. */ -#include "GrClip.h" +#include "GrFixedClip.h" #include "GrAppliedClip.h" #include "GrDrawContext.h" -void GrNoClip::getConservativeBounds(int width, int height, SkIRect* devResult, - bool* isIntersectionOfRects) const { - devResult->setXYWH(0, 0, width, height); - if (isIntersectionOfRects) { - *isIntersectionOfRects = true; - } -} - bool GrFixedClip::quickContains(const SkRect& rect) const { if (fHasStencilClip) { return false; diff --git a/src/gpu/GrFixedClip.h b/src/gpu/GrFixedClip.h new file mode 100644 index 0000000000..01498c1161 --- /dev/null +++ b/src/gpu/GrFixedClip.h @@ -0,0 +1,50 @@ +/* + * Copyright 2016 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrFixedClip_DEFINED +#define GrFixedClip_DEFINED + +#include "GrClip.h" +#include "GrTypesPriv.h" + +/** + * GrFixedClip is a clip that can be represented by fixed-function hardware. It never modifies the + * stencil buffer itself, but can be configured to use whatever clip is already there. + */ +class GrFixedClip final : public GrClip { +public: + GrFixedClip() : fHasStencilClip(false) {} + GrFixedClip(const SkIRect& scissorRect) + : fScissorState(scissorRect) + , fHasStencilClip(false) {} + + void reset() { + fScissorState.setDisabled(); + fHasStencilClip = false; + } + + void reset(const SkIRect& scissorRect) { + fScissorState.set(scissorRect); + fHasStencilClip = false; + } + + void enableStencilClip() { fHasStencilClip = true; } + void disableStencilClip() { fHasStencilClip = false; } + + bool quickContains(const SkRect&) const final; + void getConservativeBounds(int width, int height, SkIRect* devResult, + bool* isIntersectionOfRects) const final; + +private: + bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings, + GrAppliedClip* out) const final; + + GrScissorState fScissorState; + bool fHasStencilClip; +}; + +#endif diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp index 7954716059..7dbdd4b48f 100644 --- a/src/gpu/batches/GrDefaultPathRenderer.cpp +++ b/src/gpu/batches/GrDefaultPathRenderer.cpp @@ -11,6 +11,7 @@ #include "GrBatchTest.h" #include "GrContext.h" #include "GrDefaultGeoProcFactory.h" +#include "GrFixedClip.h" #include "GrMesh.h" #include "GrPathUtils.h" #include "GrPipelineBuilder.h" diff --git a/src/gpu/batches/GrMSAAPathRenderer.cpp b/src/gpu/batches/GrMSAAPathRenderer.cpp index 05a23a1e05..d6b5578d8a 100644 --- a/src/gpu/batches/GrMSAAPathRenderer.cpp +++ b/src/gpu/batches/GrMSAAPathRenderer.cpp @@ -11,6 +11,7 @@ #include "GrBatchFlushState.h" #include "GrClip.h" #include "GrDefaultGeoProcFactory.h" +#include "GrFixedClip.h" #include "GrPathStencilSettings.h" #include "GrPathUtils.h" #include "GrPipelineBuilder.h" diff --git a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp index 5d280efac2..4f2c6b35b6 100644 --- a/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp +++ b/src/gpu/batches/GrStencilAndCoverPathRenderer.cpp @@ -11,6 +11,7 @@ #include "GrContext.h" #include "GrDrawContextPriv.h" #include "GrDrawPathBatch.h" +#include "GrFixedClip.h" #include "GrGpu.h" #include "GrPath.h" #include "GrPipelineBuilder.h"