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

Side by Side Diff: src/gpu/gl/GrGLStencilAttachment.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/GrGLRenderTarget.cpp ('k') | src/gpu/gl/GrGLTexture.h » ('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 8
9 #include "GrGLStencilAttachment.h" 9 #include "GrGLStencilAttachment.h"
10 #include "GrGLGpu.h" 10 #include "GrGLGpu.h"
11 11
12 size_t GrGLStencilAttachment::onGpuMemorySize() const { 12 size_t GrGLStencilAttachment::onGpuMemorySize() const {
13 uint64_t size = this->width(); 13 uint64_t size = this->width();
14 size *= this->height(); 14 size *= this->height();
15 size *= fFormat.fTotalBits; 15 size *= fFormat.fTotalBits;
16 size *= SkTMax(1,this->numSamples()); 16 size *= SkTMax(1,this->numSamples());
17 return static_cast<size_t>(size / 8); 17 return static_cast<size_t>(size / 8);
18 } 18 }
19 19
20 void GrGLStencilAttachment::onRelease() { 20 void GrGLStencilAttachment::onRelease() {
21 if (0 != fRenderbufferID && !this->isWrapped()) { 21 if (0 != fRenderbufferID && this->shouldFreeResources()) {
22 GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu(); 22 GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu();
23 const GrGLInterface* gl = gpuGL->glInterface(); 23 const GrGLInterface* gl = gpuGL->glInterface();
24 GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID)); 24 GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID));
25 fRenderbufferID = 0; 25 fRenderbufferID = 0;
26 } 26 }
27 27
28 INHERITED::onRelease(); 28 INHERITED::onRelease();
29 } 29 }
30 30
31 void GrGLStencilAttachment::onAbandon() { 31 void GrGLStencilAttachment::onAbandon() {
32 fRenderbufferID = 0; 32 fRenderbufferID = 0;
33 33
34 INHERITED::onAbandon(); 34 INHERITED::onAbandon();
35 } 35 }
OLDNEW
« no previous file with comments | « src/gpu/gl/GrGLRenderTarget.cpp ('k') | src/gpu/gl/GrGLTexture.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698