Remove ClipMaskType from GrCMM
Review URL: https://codereview.chromium.org/1391653002
This commit is contained in:
parent
0ba8c2401e
commit
c988d2c1c8
@ -68,8 +68,7 @@ static bool path_needs_SW_renderer(GrContext* context,
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget)
|
GrClipMaskManager::GrClipMaskManager(GrDrawTarget* drawTarget)
|
||||||
: fCurrClipMaskType(kNone_ClipMaskType)
|
: fDrawTarget(drawTarget)
|
||||||
, fDrawTarget(drawTarget)
|
|
||||||
, fClipMode(kIgnoreClip_StencilClipMode) {
|
, fClipMode(kIgnoreClip_StencilClipMode) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,7 +208,6 @@ bool GrClipMaskManager::setupClipping(const GrPipelineBuilder& pipelineBuilder,
|
|||||||
GrScissorState* scissorState,
|
GrScissorState* scissorState,
|
||||||
const SkRect* devBounds,
|
const SkRect* devBounds,
|
||||||
GrAppliedClip* out) {
|
GrAppliedClip* out) {
|
||||||
fCurrClipMaskType = kNone_ClipMaskType;
|
|
||||||
if (kRespectClip_StencilClipMode == fClipMode) {
|
if (kRespectClip_StencilClipMode == fClipMode) {
|
||||||
fClipMode = kIgnoreClip_StencilClipMode;
|
fClipMode = kIgnoreClip_StencilClipMode;
|
||||||
}
|
}
|
||||||
@ -535,12 +533,10 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
|
|||||||
const GrReducedClip::ElementList& elements,
|
const GrReducedClip::ElementList& elements,
|
||||||
const SkVector& clipToMaskOffset,
|
const SkVector& clipToMaskOffset,
|
||||||
const SkIRect& clipSpaceIBounds) {
|
const SkIRect& clipSpaceIBounds) {
|
||||||
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
|
|
||||||
GrResourceProvider* resourceProvider = fDrawTarget->cmmAccess().resourceProvider();
|
GrResourceProvider* resourceProvider = fDrawTarget->cmmAccess().resourceProvider();
|
||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
GetClipMaskKey(elementsGenID, clipSpaceIBounds, &key);
|
GetClipMaskKey(elementsGenID, clipSpaceIBounds, &key);
|
||||||
if (GrTexture* texture = resourceProvider->findAndRefTextureByUniqueKey(key)) {
|
if (GrTexture* texture = resourceProvider->findAndRefTextureByUniqueKey(key)) {
|
||||||
fCurrClipMaskType = kAlpha_ClipMaskType;
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -678,7 +674,6 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fCurrClipMaskType = kAlpha_ClipMaskType;
|
|
||||||
return texture.detach();
|
return texture.detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -691,7 +686,6 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
|||||||
const GrReducedClip::ElementList& elements,
|
const GrReducedClip::ElementList& elements,
|
||||||
const SkIRect& clipSpaceIBounds,
|
const SkIRect& clipSpaceIBounds,
|
||||||
const SkIPoint& clipSpaceToStencilOffset) {
|
const SkIPoint& clipSpaceToStencilOffset) {
|
||||||
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
|
|
||||||
SkASSERT(rt);
|
SkASSERT(rt);
|
||||||
|
|
||||||
GrStencilAttachment* stencilAttachment =
|
GrStencilAttachment* stencilAttachment =
|
||||||
@ -871,9 +865,6 @@ bool GrClipMaskManager::createStencilClipMask(GrRenderTarget* rt,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// set this last because recursive draws may overwrite it back to kNone.
|
|
||||||
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
|
|
||||||
fCurrClipMaskType = kStencil_ClipMaskType;
|
|
||||||
fClipMode = kRespectClip_StencilClipMode;
|
fClipMode = kRespectClip_StencilClipMode;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -999,8 +990,6 @@ void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
|
|||||||
if (func >= kBasicStencilFuncCount) {
|
if (func >= kBasicStencilFuncCount) {
|
||||||
int respectClip = kRespectClip_StencilClipMode == mode;
|
int respectClip = kRespectClip_StencilClipMode == mode;
|
||||||
if (respectClip) {
|
if (respectClip) {
|
||||||
// The GrGpu class should have checked this
|
|
||||||
SkASSERT(this->isClipInStencil());
|
|
||||||
switch (func) {
|
switch (func) {
|
||||||
case kAlwaysIfInClip_StencilFunc:
|
case kAlwaysIfInClip_StencilFunc:
|
||||||
funcMask = clipBit;
|
funcMask = clipBit;
|
||||||
@ -1055,7 +1044,6 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
|
|||||||
const GrReducedClip::ElementList& elements,
|
const GrReducedClip::ElementList& elements,
|
||||||
const SkVector& clipToMaskOffset,
|
const SkVector& clipToMaskOffset,
|
||||||
const SkIRect& clipSpaceIBounds) {
|
const SkIRect& clipSpaceIBounds) {
|
||||||
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
|
|
||||||
GrUniqueKey key;
|
GrUniqueKey key;
|
||||||
GetClipMaskKey(elementsGenID, clipSpaceIBounds, &key);
|
GetClipMaskKey(elementsGenID, clipSpaceIBounds, &key);
|
||||||
GrResourceProvider* resourceProvider = fDrawTarget->cmmAccess().resourceProvider();
|
GrResourceProvider* resourceProvider = fDrawTarget->cmmAccess().resourceProvider();
|
||||||
@ -1118,7 +1106,6 @@ GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
|
|||||||
}
|
}
|
||||||
helper.toTexture(result);
|
helper.toTexture(result);
|
||||||
|
|
||||||
fCurrClipMaskType = kAlpha_ClipMaskType;
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,14 +67,6 @@ public:
|
|||||||
const SkRect* devBounds,
|
const SkRect* devBounds,
|
||||||
GrAppliedClip*);
|
GrAppliedClip*);
|
||||||
|
|
||||||
bool isClipInStencil() const {
|
|
||||||
return kStencil_ClipMaskType == fCurrClipMaskType;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isClipInAlpha() const {
|
|
||||||
return kAlpha_ClipMaskType == fCurrClipMaskType;
|
|
||||||
}
|
|
||||||
|
|
||||||
void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*);
|
void adjustPathStencilParams(const GrStencilAttachment*, GrStencilSettings*);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -170,17 +162,6 @@ private:
|
|||||||
|
|
||||||
GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, bool renderTarget);
|
GrTexture* createCachedMask(int width, int height, const GrUniqueKey& key, bool renderTarget);
|
||||||
|
|
||||||
/**
|
|
||||||
* We may represent the clip as a mask in the stencil buffer or as an alpha
|
|
||||||
* texture. It may be neither because the scissor rect suffices or we
|
|
||||||
* haven't yet examined the clip.
|
|
||||||
*/
|
|
||||||
enum ClipMaskType {
|
|
||||||
kNone_ClipMaskType,
|
|
||||||
kStencil_ClipMaskType,
|
|
||||||
kAlpha_ClipMaskType,
|
|
||||||
} fCurrClipMaskType;
|
|
||||||
|
|
||||||
static const int kMaxAnalyticElements = 4;
|
static const int kMaxAnalyticElements = 4;
|
||||||
|
|
||||||
GrDrawTarget* fDrawTarget; // This is our owning draw target.
|
GrDrawTarget* fDrawTarget; // This is our owning draw target.
|
||||||
|
Loading…
Reference in New Issue
Block a user