Move GrFixedClip into src directory

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2254343003

Review-Url: https://codereview.chromium.org/2254343003
This commit is contained in:
csmartdalton 2016-08-19 13:29:27 -07:00 committed by Commit bot
parent 3688bfa710
commit 02fa32c6d1
17 changed files with 82 additions and 52 deletions

View File

@ -12,6 +12,7 @@
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#include "SkColorPriv.h" #include "SkColorPriv.h"
#include "effects/GrPorterDuffXferProcessor.h" #include "effects/GrPorterDuffXferProcessor.h"
#include "effects/GrSimpleTextureEffect.h" #include "effects/GrSimpleTextureEffect.h"

View File

@ -84,7 +84,6 @@
'<(skia_src_path)/gpu/GrBufferAllocPool.cpp', '<(skia_src_path)/gpu/GrBufferAllocPool.cpp',
'<(skia_src_path)/gpu/GrBufferAllocPool.h', '<(skia_src_path)/gpu/GrBufferAllocPool.h',
'<(skia_src_path)/gpu/GrCaps.cpp', '<(skia_src_path)/gpu/GrCaps.cpp',
'<(skia_src_path)/gpu/GrClip.cpp',
'<(skia_src_path)/gpu/GrClipStackClip.h', '<(skia_src_path)/gpu/GrClipStackClip.h',
'<(skia_src_path)/gpu/GrClipStackClip.cpp', '<(skia_src_path)/gpu/GrClipStackClip.cpp',
'<(skia_src_path)/gpu/GrColorSpaceXform.cpp', '<(skia_src_path)/gpu/GrColorSpaceXform.cpp',
@ -101,6 +100,8 @@
'<(skia_src_path)/gpu/GrDrawingManager.h', '<(skia_src_path)/gpu/GrDrawingManager.h',
'<(skia_src_path)/gpu/GrDrawTarget.cpp', '<(skia_src_path)/gpu/GrDrawTarget.cpp',
'<(skia_src_path)/gpu/GrDrawTarget.h', '<(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/GrFragmentProcessor.cpp',
'<(skia_src_path)/gpu/GrGeometryProcessor.h', '<(skia_src_path)/gpu/GrGeometryProcessor.h',
'<(skia_src_path)/gpu/GrGlyph.h', '<(skia_src_path)/gpu/GrGlyph.h',

View File

@ -8,10 +8,11 @@
#ifndef GrClip_DEFINED #ifndef GrClip_DEFINED
#define GrClip_DEFINED #define GrClip_DEFINED
#include "GrFragmentProcessor.h" #include "SkRect.h"
#include "GrTypesPriv.h" #include "SkRRect.h"
class GrAppliedClip; class GrAppliedClip;
class GrContext;
class GrDrawContext; class GrDrawContext;
/** /**
@ -108,46 +109,19 @@ public:
*/ */
class GrNoClip final : public GrClip { class GrNoClip final : public GrClip {
private: private:
bool quickContains(const SkRect&) const final { return true; } bool quickContains(const SkRect&) const final {
void getConservativeBounds(int width, int height, SkIRect* devResult, return true;
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;
} }
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, void getConservativeBounds(int width, int height, SkIRect* devResult,
bool* isIntersectionOfRects) const final; bool* isIntersectionOfRects) const final {
devResult->setXYWH(0, 0, width, height);
private: if (isIntersectionOfRects) {
bool apply(GrContext*, GrDrawContext*, bool useHWAA, bool hasUserStencilSettings, *isIntersectionOfRects = true;
GrAppliedClip* out) const final; }
}
GrScissorState fScissorState; bool apply(GrContext*, GrDrawContext*, bool, bool, GrAppliedClip*) const final {
bool fHasStencilClip; return true;
}
}; };
#endif #endif

View File

@ -21,6 +21,7 @@
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#endif #endif
#ifndef SK_IGNORE_TO_STRING #ifndef SK_IGNORE_TO_STRING

View File

@ -17,6 +17,7 @@
#include "GrAlphaThresholdFragmentProcessor.h" #include "GrAlphaThresholdFragmentProcessor.h"
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#endif #endif
class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter { class SK_API SkAlphaThresholdFilterImpl : public SkImageFilter {

View File

@ -15,6 +15,7 @@
#include "GrContext.h" #include "GrContext.h"
#include "GrCaps.h" #include "GrCaps.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#define MAX_BLUR_SIGMA 4.0f #define MAX_BLUR_SIGMA 4.0f

View File

@ -17,6 +17,7 @@
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#include "GrFragmentProcessor.h" #include "GrFragmentProcessor.h"
#include "GrInvariantOutput.h" #include "GrInvariantOutput.h"
#include "GrPaint.h" #include "GrPaint.h"

View File

@ -18,6 +18,7 @@
#if SK_SUPPORT_GPU #if SK_SUPPORT_GPU
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrFixedClip.h"
#include "GrInvariantOutput.h" #include "GrInvariantOutput.h"
#include "GrTexture.h" #include "GrTexture.h"
#include "SkGr.h" #include "SkGr.h"

View File

@ -9,6 +9,7 @@
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrCaps.h" #include "GrCaps.h"
#include "GrContext.h" #include "GrContext.h"
#include "GrFixedClip.h"
#include "effects/GrSimpleTextureEffect.h" #include "effects/GrSimpleTextureEffect.h"
#include "GrStyle.h" #include "GrStyle.h"
#include "GrTexture.h" #include "GrTexture.h"

View File

@ -10,6 +10,7 @@
#include "GrAppliedClip.h" #include "GrAppliedClip.h"
#include "GrDrawingManager.h" #include "GrDrawingManager.h"
#include "GrDrawContextPriv.h" #include "GrDrawContextPriv.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h" #include "GrGpuResourcePriv.h"
#include "GrRenderTargetPriv.h" #include "GrRenderTargetPriv.h"
#include "GrStencilAttachment.h" #include "GrStencilAttachment.h"

View File

@ -8,12 +8,13 @@
#define GrClipStackClip_DEFINED #define GrClipStackClip_DEFINED
#include "GrClip.h" #include "GrClip.h"
#include "GrReducedClip.h" #include "GrReducedClip.h"
#include "SkClipStack.h" #include "SkClipStack.h"
class GrTextureProvider;
class GrPathRenderer; class GrPathRenderer;
class GrTexture;
class GrTextureProvider;
class GrUniqueKey;
/** /**
* GrClipStackClip can apply a generic SkClipStack to the draw state. It may need to generate an * GrClipStackClip can apply a generic SkClipStack to the draw state. It may need to generate an

View File

@ -10,6 +10,7 @@
#include "GrDrawContext.h" #include "GrDrawContext.h"
#include "GrDrawContextPriv.h" #include "GrDrawContextPriv.h"
#include "GrDrawingManager.h" #include "GrDrawingManager.h"
#include "GrFixedClip.h"
#include "GrGpuResourcePriv.h" #include "GrGpuResourcePriv.h"
#include "GrOvalRenderer.h" #include "GrOvalRenderer.h"
#include "GrPathRenderer.h" #include "GrPathRenderer.h"

View File

@ -5,19 +5,11 @@
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#include "GrClip.h" #include "GrFixedClip.h"
#include "GrAppliedClip.h" #include "GrAppliedClip.h"
#include "GrDrawContext.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 { bool GrFixedClip::quickContains(const SkRect& rect) const {
if (fHasStencilClip) { if (fHasStencilClip) {
return false; return false;

50
src/gpu/GrFixedClip.h Normal file
View File

@ -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

View File

@ -11,6 +11,7 @@
#include "GrBatchTest.h" #include "GrBatchTest.h"
#include "GrContext.h" #include "GrContext.h"
#include "GrDefaultGeoProcFactory.h" #include "GrDefaultGeoProcFactory.h"
#include "GrFixedClip.h"
#include "GrMesh.h" #include "GrMesh.h"
#include "GrPathUtils.h" #include "GrPathUtils.h"
#include "GrPipelineBuilder.h" #include "GrPipelineBuilder.h"

View File

@ -11,6 +11,7 @@
#include "GrBatchFlushState.h" #include "GrBatchFlushState.h"
#include "GrClip.h" #include "GrClip.h"
#include "GrDefaultGeoProcFactory.h" #include "GrDefaultGeoProcFactory.h"
#include "GrFixedClip.h"
#include "GrPathStencilSettings.h" #include "GrPathStencilSettings.h"
#include "GrPathUtils.h" #include "GrPathUtils.h"
#include "GrPipelineBuilder.h" #include "GrPipelineBuilder.h"

View File

@ -11,6 +11,7 @@
#include "GrContext.h" #include "GrContext.h"
#include "GrDrawContextPriv.h" #include "GrDrawContextPriv.h"
#include "GrDrawPathBatch.h" #include "GrDrawPathBatch.h"
#include "GrFixedClip.h"
#include "GrGpu.h" #include "GrGpu.h"
#include "GrPath.h" #include "GrPath.h"
#include "GrPipelineBuilder.h" #include "GrPipelineBuilder.h"