Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(820)

Unified Diff: src/gpu/GrContext.cpp

Issue 752233002: Revert "Use scratch keys for stencil buffers." (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrGpu.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698