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

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

Issue 1187523005: Add support for creating texture backed images where Skia will delete the texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default param to support Chrome's current callers Created 5 years, 6 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
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 10
(...skipping 12 matching lines...) Expand all
23 : GrSurface(gpu, idDesc.fLifeCycle, desc) 23 : GrSurface(gpu, idDesc.fLifeCycle, desc)
24 , INHERITED(gpu, idDesc.fLifeCycle, desc) { 24 , INHERITED(gpu, idDesc.fLifeCycle, desc) {
25 this->init(desc, idDesc); 25 this->init(desc, idDesc);
26 } 26 }
27 27
28 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { 28 void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) {
29 SkASSERT(0 != idDesc.fTextureID); 29 SkASSERT(0 != idDesc.fTextureID);
30 fTexParams.invalidate(); 30 fTexParams.invalidate();
31 fTexParamsTimestamp = GrGpu::kExpiredTimestamp; 31 fTexParamsTimestamp = GrGpu::kExpiredTimestamp;
32 fTextureID = idDesc.fTextureID; 32 fTextureID = idDesc.fTextureID;
33 fIsWrapped = kWrapped_LifeCycle == idDesc.fLifeCycle; 33 fTextureIDLifecycle = idDesc.fLifeCycle;
34 } 34 }
35 35
36 void GrGLTexture::onRelease() { 36 void GrGLTexture::onRelease() {
37 if (fTextureID) { 37 if (fTextureID) {
38 if (!fIsWrapped) { 38 if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) {
39 GL_CALL(DeleteTextures(1, &fTextureID)); 39 GL_CALL(DeleteTextures(1, &fTextureID));
40 } 40 }
41 fTextureID = 0; 41 fTextureID = 0;
42 fIsWrapped = false;
43 } 42 }
44 INHERITED::onRelease(); 43 INHERITED::onRelease();
45 } 44 }
46 45
47 void GrGLTexture::onAbandon() { 46 void GrGLTexture::onAbandon() {
48 fTextureID = 0; 47 fTextureID = 0;
49 fIsWrapped = false;
50 INHERITED::onAbandon(); 48 INHERITED::onAbandon();
51 } 49 }
52 50
53 GrBackendObject GrGLTexture::getTextureHandle() const { 51 GrBackendObject GrGLTexture::getTextureHandle() const {
54 return static_cast<GrBackendObject>(this->textureID()); 52 return static_cast<GrBackendObject>(this->textureID());
55 } 53 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLTexture.h ('k') | src/image/SkImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698