gfx/skia/trunk/src/gpu/gl/debug/GrFrameBufferObj.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/debug/GrFrameBufferObj.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,67 @@
     1.4 +
     1.5 +/*
     1.6 + * Copyright 2012 Google Inc.
     1.7 + *
     1.8 + * Use of this source code is governed by a BSD-style license that can be
     1.9 + * found in the LICENSE file.
    1.10 + */
    1.11 +
    1.12 +#include "GrFrameBufferObj.h"
    1.13 +#include "GrFBBindableObj.h"
    1.14 +
    1.15 +void GrFrameBufferObj::setColor(GrFBBindableObj *buffer) {
    1.16 +    if (fColorBuffer) {
    1.17 +        // automatically break the binding of the old buffer
    1.18 +        GrAlwaysAssert(fColorBuffer->getColorBound(this));
    1.19 +        fColorBuffer->resetColorBound(this);
    1.20 +
    1.21 +        GrAlwaysAssert(!fColorBuffer->getDeleted());
    1.22 +        fColorBuffer->unref();
    1.23 +    }
    1.24 +    fColorBuffer = buffer;
    1.25 +    if (fColorBuffer) {
    1.26 +        GrAlwaysAssert(!fColorBuffer->getDeleted());
    1.27 +        fColorBuffer->ref();
    1.28 +
    1.29 +        GrAlwaysAssert(!fColorBuffer->getColorBound(this));
    1.30 +        fColorBuffer->setColorBound(this);
    1.31 +    }
    1.32 +}
    1.33 +
    1.34 +void GrFrameBufferObj::setDepth(GrFBBindableObj *buffer) {
    1.35 +    if (fDepthBuffer) {
    1.36 +        // automatically break the binding of the old buffer
    1.37 +        GrAlwaysAssert(fDepthBuffer->getDepthBound(this));
    1.38 +        fDepthBuffer->resetDepthBound(this);
    1.39 +
    1.40 +        GrAlwaysAssert(!fDepthBuffer->getDeleted());
    1.41 +        fDepthBuffer->unref();
    1.42 +    }
    1.43 +    fDepthBuffer = buffer;
    1.44 +    if (fDepthBuffer) {
    1.45 +        GrAlwaysAssert(!fDepthBuffer->getDeleted());
    1.46 +        fDepthBuffer->ref();
    1.47 +
    1.48 +        GrAlwaysAssert(!fDepthBuffer->getDepthBound(this));
    1.49 +        fDepthBuffer->setDepthBound(this);
    1.50 +    }
    1.51 +}
    1.52 +
    1.53 +void GrFrameBufferObj::setStencil(GrFBBindableObj *buffer) {
    1.54 +    if (fStencilBuffer) {
    1.55 +        // automatically break the binding of the old buffer
    1.56 +        GrAlwaysAssert(fStencilBuffer->getStencilBound(this));
    1.57 +        fStencilBuffer->resetStencilBound(this);
    1.58 +
    1.59 +        //GrAlwaysAssert(!fStencilBuffer->getDeleted());
    1.60 +        fStencilBuffer->unref();
    1.61 +    }
    1.62 +    fStencilBuffer = buffer;
    1.63 +    if (fStencilBuffer) {
    1.64 +        GrAlwaysAssert(!fStencilBuffer->getDeleted());
    1.65 +        fStencilBuffer->ref();
    1.66 +
    1.67 +        GrAlwaysAssert(!fStencilBuffer->getStencilBound(this));
    1.68 +        fStencilBuffer->setStencilBound(this);
    1.69 +    }
    1.70 +}

mercurial