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

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: cleanup Created 6 years, 2 months 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 98adf1d667df87ac278de9c3225e17f53fdccfcd..b7674c77f6974caf98b51d5db150e02b6112c2ed 100755
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -266,8 +266,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,
@@ -481,7 +485,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