gfx/skia/trunk/src/gpu/gl/GrGLStencilBuffer.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/gfx/skia/trunk/src/gpu/gl/GrGLStencilBuffer.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,39 @@
     1.4 +/*
     1.5 + * Copyright 2011 Google Inc.
     1.6 + *
     1.7 + * Use of this source code is governed by a BSD-style license that can be
     1.8 + * found in the LICENSE file.
     1.9 + */
    1.10 +
    1.11 +
    1.12 +#include "GrGLStencilBuffer.h"
    1.13 +#include "GrGpuGL.h"
    1.14 +
    1.15 +GrGLStencilBuffer::~GrGLStencilBuffer() {
    1.16 +    this->release();
    1.17 +}
    1.18 +
    1.19 +size_t GrGLStencilBuffer::sizeInBytes() const {
    1.20 +    uint64_t size = this->width();
    1.21 +    size *= this->height();
    1.22 +    size *= fFormat.fTotalBits;
    1.23 +    size *= GrMax(1,this->numSamples());
    1.24 +    return static_cast<size_t>(size / 8);
    1.25 +}
    1.26 +
    1.27 +void GrGLStencilBuffer::onRelease() {
    1.28 +    if (0 != fRenderbufferID && !this->isWrapped()) {
    1.29 +        GrGpuGL* gpuGL = (GrGpuGL*) this->getGpu();
    1.30 +        const GrGLInterface* gl = gpuGL->glInterface();
    1.31 +        GR_GL_CALL(gl, DeleteRenderbuffers(1, &fRenderbufferID));
    1.32 +        fRenderbufferID = 0;
    1.33 +    }
    1.34 +
    1.35 +    INHERITED::onRelease();
    1.36 +}
    1.37 +
    1.38 +void GrGLStencilBuffer::onAbandon() {
    1.39 +    fRenderbufferID = 0;
    1.40 +
    1.41 +    INHERITED::onAbandon();
    1.42 +}

mercurial