Index: src/gpu/GrContext.cpp |
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp |
index 607d3c3cc7144788da553418b599084842bb7582..657e57da33cf6a092e8dab9e0d82cf49e55f7489 100755 |
--- a/src/gpu/GrContext.cpp |
+++ b/src/gpu/GrContext.cpp |
@@ -24,6 +24,7 @@ |
#include "GrPathUtils.h" |
#include "GrResourceCache2.h" |
#include "GrSoftwarePathRenderer.h" |
+#include "GrStencilBuffer.h" |
#include "GrStencilAndCoverTextContext.h" |
#include "GrStrokeInfo.h" |
#include "GrSurfacePriv.h" |
@@ -251,6 +252,22 @@ bool GrContext::isTextureInCache(const GrSurfaceDesc& desc, |
return fResourceCache2->hasContentKey(resourceKey); |
} |
+void GrContext::addStencilBuffer(GrStencilBuffer* sb) { |
+ // TODO: Make GrStencilBuffers use the scratch mechanism rather than content keys. |
+ ASSERT_OWNED_RESOURCE(sb); |
+ |
+ GrResourceKey resourceKey = GrStencilBuffer::ComputeKey(sb->width(), |
+ sb->height(), |
+ sb->numSamples()); |
+ SkAssertResult(sb->cacheAccess().setContentKey(resourceKey)); |
+} |
+ |
+GrStencilBuffer* GrContext::findAndRefStencilBuffer(int width, int height, int sampleCnt) { |
+ GrResourceKey resourceKey = GrStencilBuffer::ComputeKey(width, height, sampleCnt); |
+ GrGpuResource* resource = this->findAndRefCachedResource(resourceKey); |
+ return static_cast<GrStencilBuffer*>(resource); |
+} |
+ |
static void stretch_image(void* dst, |
int dstW, |
int dstH, |