aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrClipMaskManager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/GrClipMaskManager.cpp')
-rw-r--r--src/gpu/GrClipMaskManager.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/gpu/GrClipMaskManager.cpp b/src/gpu/GrClipMaskManager.cpp
index 0f915666fb..3aef3dee67 100644
--- a/src/gpu/GrClipMaskManager.cpp
+++ b/src/gpu/GrClipMaskManager.cpp
@@ -113,6 +113,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
fCurrClipMaskType = kNone_ClipMaskType;
ElementList elements(16);
+ int32_t genID;
InitialState initialState;
SkIRect clipSpaceIBounds;
bool requiresAA;
@@ -132,6 +133,7 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
ReduceClipStack(*clipDataIn->fClipStack,
clipSpaceRTIBounds,
&elements,
+ &genID,
&initialState,
&clipSpaceIBounds,
&requiresAA);
@@ -156,7 +158,6 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
// If MSAA is enabled we can do everything in the stencil buffer.
if (0 == rt->numSamples() && requiresAA) {
- int32_t genID = clipDataIn->fClipStack->getTopmostGenID();
GrTexture* result = NULL;
if (this->useSWOnlyPath(elements)) {
@@ -207,7 +208,8 @@ bool GrClipMaskManager::setupClipping(const GrClipData* clipDataIn,
// use the stencil clip if we can't represent the clip as a rectangle.
SkIPoint clipSpaceToStencilSpaceOffset = -clipDataIn->fOrigin;
- this->createStencilClipMask(initialState,
+ this->createStencilClipMask(genID,
+ initialState,
elements,
clipSpaceIBounds,
clipSpaceToStencilSpaceOffset);
@@ -390,11 +392,11 @@ void GrClipMaskManager::getTemp(int width, int height, GrAutoScratchTexture* tem
// Handles caching & allocation (if needed) of a clip alpha-mask texture for both the sw-upload
// or gpu-rendered cases. Returns true if there is no more work to be done (i.e., we got a cache
// hit)
-bool GrClipMaskManager::getMaskTexture(int32_t clipStackGenID,
+bool GrClipMaskManager::getMaskTexture(int32_t elementsGenID,
const SkIRect& clipSpaceIBounds,
GrTexture** result,
bool willUpload) {
- bool cached = fAACache.canReuse(clipStackGenID, clipSpaceIBounds);
+ bool cached = fAACache.canReuse(elementsGenID, clipSpaceIBounds);
if (!cached) {
// There isn't a suitable entry in the cache so we create a new texture to store the mask.
@@ -412,7 +414,7 @@ bool GrClipMaskManager::getMaskTexture(int32_t clipStackGenID,
desc.fConfig = kAlpha_8_GrPixelConfig;
}
- fAACache.acquireMask(clipStackGenID, desc, clipSpaceIBounds);
+ fAACache.acquireMask(elementsGenID, desc, clipSpaceIBounds);
}
*result = fAACache.getLastMask();
@@ -421,14 +423,14 @@ bool GrClipMaskManager::getMaskTexture(int32_t clipStackGenID,
////////////////////////////////////////////////////////////////////////////////
// Create a 8-bit clip mask in alpha
-GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t clipStackGenID,
+GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t elementsGenID,
InitialState initialState,
const ElementList& elements,
const SkIRect& clipSpaceIBounds) {
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
GrTexture* result;
- if (this->getMaskTexture(clipStackGenID, clipSpaceIBounds, &result, false)) {
+ if (this->getMaskTexture(elementsGenID, clipSpaceIBounds, &result, false)) {
fCurrClipMaskType = kAlpha_ClipMaskType;
return result;
}
@@ -569,7 +571,8 @@ GrTexture* GrClipMaskManager::createAlphaClipMask(int32_t clipStackGenID,
////////////////////////////////////////////////////////////////////////////////
// Create a 1-bit clip mask in the stencil buffer. 'devClipBounds' are in device
// (as opposed to canvas) coordinates
-bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
+bool GrClipMaskManager::createStencilClipMask(int32_t elementsGenID,
+ InitialState initialState,
const ElementList& elements,
const SkIRect& clipSpaceIBounds,
const SkIPoint& clipSpaceToStencilOffset) {
@@ -587,11 +590,10 @@ bool GrClipMaskManager::createStencilClipMask(InitialState initialState,
if (NULL == stencilBuffer) {
return false;
}
- int32_t genID = elements.tail()->getGenID();
- if (stencilBuffer->mustRenderClip(genID, clipSpaceIBounds, clipSpaceToStencilOffset)) {
+ if (stencilBuffer->mustRenderClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset)) {
- stencilBuffer->setLastClip(genID, clipSpaceIBounds, clipSpaceToStencilOffset);
+ stencilBuffer->setLastClip(elementsGenID, clipSpaceIBounds, clipSpaceToStencilOffset);
// Set the matrix so that rendered clip elements are transformed from clip to stencil space.
SkVector translate = {
@@ -921,14 +923,14 @@ void GrClipMaskManager::adjustStencilParams(GrStencilSettings* settings,
}
////////////////////////////////////////////////////////////////////////////////
-GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t clipStackGenID,
+GrTexture* GrClipMaskManager::createSoftwareClipMask(int32_t elementsGenID,
GrReducedClip::InitialState initialState,
const GrReducedClip::ElementList& elements,
const SkIRect& clipSpaceIBounds) {
SkASSERT(kNone_ClipMaskType == fCurrClipMaskType);
GrTexture* result;
- if (this->getMaskTexture(clipStackGenID, clipSpaceIBounds, &result, true)) {
+ if (this->getMaskTexture(elementsGenID, clipSpaceIBounds, &result, true)) {
return result;
}