Line data Source code
1 : /*
2 : * Copyright 2011 Google Inc.
3 : *
4 : * Use of this source code is governed by a BSD-style license that can be
5 : * found in the LICENSE file.
6 : */
7 :
8 :
9 : #include "GrGLStencilAttachment.h"
10 : #include "GrGLGpu.h"
11 : #include "SkTraceMemoryDump.h"
12 :
13 0 : size_t GrGLStencilAttachment::onGpuMemorySize() const {
14 0 : uint64_t size = this->width();
15 0 : size *= this->height();
16 0 : size *= fFormat.fTotalBits;
17 0 : size *= SkTMax(1,this->numSamples());
18 0 : return static_cast<size_t>(size / 8);
19 : }
20 :
21 0 : void GrGLStencilAttachment::onRelease() {
22 0 : if (0 != fRenderbufferID) {
23 0 : GrGLGpu* gpuGL = (GrGLGpu*) this->getGpu();
24 0 : const GrGLInterface* gl = gpuGL->glInterface();
25 0 : GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID));
26 0 : fRenderbufferID = 0;
27 : }
28 :
29 0 : INHERITED::onRelease();
30 0 : }
31 :
32 0 : void GrGLStencilAttachment::onAbandon() {
33 0 : fRenderbufferID = 0;
34 :
35 0 : INHERITED::onAbandon();
36 0 : }
37 :
38 0 : void GrGLStencilAttachment::setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
39 : const SkString& dumpName) const {
40 0 : SkString renderbuffer_id;
41 0 : renderbuffer_id.appendU32(this->renderbufferID());
42 0 : traceMemoryDump->setMemoryBacking(dumpName.c_str(), "gl_renderbuffer",
43 0 : renderbuffer_id.c_str());
44 0 : }
|