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

Unified Diff: src/gpu/GrContext.cpp

Issue 695813003: Add class GrGLTextureRenderTarget for GL texture/rendertarget objects (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: forgot to save file 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
Index: src/gpu/GrContext.cpp
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index 5f0001bad70f0258da0b16af822efca4bec0a9fb..c1fee0acb82b5a17b338b735e4fc0f66dd5a0a5e 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -255,8 +255,12 @@ GrTexture* GrContext::findAndRefTexture(const GrSurfaceDesc& desc,
const GrTextureParams* params) {
GrResourceKey resourceKey = GrTexturePriv::ComputeKey(fGpu, params, desc, cacheID);
GrGpuResource* resource = fResourceCache->find(resourceKey);
- SkSafeRef(resource);
- return static_cast<GrTexture*>(resource);
+ if (resource) {
+ resource->ref();
+ return static_cast<GrSurface*>(resource)->asTexture();
+ } else {
+ return NULL;
+ }
}
bool GrContext::isTextureInCache(const GrSurfaceDesc& desc,
@@ -471,7 +475,7 @@ GrTexture* GrContext::refScratchTexture(const GrSurfaceDesc& inDesc, ScratchTexM
GrGpuResource* resource = fResourceCache2->findAndRefScratchResource(key, scratchFlags);
if (resource) {
fResourceCache->makeResourceMRU(resource);
- return static_cast<GrTexture*>(resource);
+ return static_cast<GrSurface*>(resource)->asTexture();
}
if (kExact_ScratchTexMatch == match) {

Powered by Google App Engine
This is Rietveld 408576698