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

Side by Side Diff: src/gpu/gl/GrGLTexture.cpp

Issue 1623653002: skia: Add support for CHROMIUM_image backed textures. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Add test. Created 4 years, 11 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "GrGLTexture.h" 8 #include "GrGLTexture.h"
9 #include "GrGLGpu.h" 9 #include "GrGLGpu.h"
10 #include "SkTraceMemoryDump.h" 10 #include "SkTraceMemoryDump.h"
(...skipping 19 matching lines...) Expand all
30 SkASSERT(0 != idDesc.fInfo.fID); 30 SkASSERT(0 != idDesc.fInfo.fID);
31 fTexParams.invalidate(); 31 fTexParams.invalidate();
32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; 32 fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
33 fInfo = idDesc.fInfo; 33 fInfo = idDesc.fInfo;
34 fTextureIDLifecycle = idDesc.fLifeCycle; 34 fTextureIDLifecycle = idDesc.fLifeCycle;
35 } 35 }
36 36
37 void GrGLTexture::onRelease() { 37 void GrGLTexture::onRelease() {
38 if (fInfo.fID) { 38 if (fInfo.fID) {
39 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { 39 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
40 if (desc().fTextureStorageAllocator) {
41 desc().fTextureStorageAllocator->deallocateTextureStorage(fInfo. fID);
42 }
40 GL_CALL(DeleteTextures(1, &fInfo.fID)); 43 GL_CALL(DeleteTextures(1, &fInfo.fID));
41 } 44 }
42 fInfo.fID = 0; 45 fInfo.fID = 0;
43 } 46 }
44 INHERITED::onRelease(); 47 INHERITED::onRelease();
45 } 48 }
46 49
47 void GrGLTexture::onAbandon() { 50 void GrGLTexture::onAbandon() {
48 fInfo.fTarget = 0; 51 fInfo.fTarget = 0;
49 fInfo.fID = 0; 52 fInfo.fID = 0;
50 INHERITED::onAbandon(); 53 INHERITED::onAbandon();
51 } 54 }
52 55
53 GrBackendObject GrGLTexture::getTextureHandle() const { 56 GrBackendObject GrGLTexture::getTextureHandle() const {
54 #ifdef SK_IGNORE_GL_TEXTURE_TARGET 57 #ifdef SK_IGNORE_GL_TEXTURE_TARGET
55 return static_cast<GrBackendObject>(this->textureID()); 58 return static_cast<GrBackendObject>(this->textureID());
56 #else 59 #else
57 return reinterpret_cast<GrBackendObject>(&fInfo); 60 return reinterpret_cast<GrBackendObject>(&fInfo);
58 #endif 61 #endif
59 } 62 }
60 63
61 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump, 64 void GrGLTexture::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
62 const SkString& dumpName) const { 65 const SkString& dumpName) const {
63 SkString texture_id; 66 SkString texture_id;
64 texture_id.appendU32(this->textureID()); 67 texture_id.appendU32(this->textureID());
65 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture", 68 traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_texture",
66 texture_id.c_str()); 69 texture_id.c_str());
67 } 70 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698