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

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.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,62 @@
     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 +#ifndef GrGLStencilBuffer_DEFINED
    1.13 +#define GrGLStencilBuffer_DEFINED
    1.14 +
    1.15 +#include "gl/GrGLInterface.h"
    1.16 +#include "GrStencilBuffer.h"
    1.17 +
    1.18 +class GrGLStencilBuffer : public GrStencilBuffer {
    1.19 +public:
    1.20 +    static const GrGLenum kUnknownInternalFormat = ~0U;
    1.21 +    static const GrGLuint kUnknownBitCount = ~0U;
    1.22 +    struct Format {
    1.23 +        GrGLenum  fInternalFormat;
    1.24 +        GrGLuint  fStencilBits;
    1.25 +        GrGLuint  fTotalBits;
    1.26 +        bool      fPacked;
    1.27 +    };
    1.28 +
    1.29 +    GrGLStencilBuffer(GrGpu* gpu,
    1.30 +                      bool isWrapped,
    1.31 +                      GrGLint rbid,
    1.32 +                      int width, int height,
    1.33 +                      int sampleCnt,
    1.34 +                      const Format& format)
    1.35 +        : GrStencilBuffer(gpu, isWrapped, width, height, format.fStencilBits, sampleCnt)
    1.36 +        , fFormat(format)
    1.37 +        , fRenderbufferID(rbid) {
    1.38 +    }
    1.39 +
    1.40 +    virtual ~GrGLStencilBuffer();
    1.41 +
    1.42 +    virtual size_t sizeInBytes() const SK_OVERRIDE;
    1.43 +
    1.44 +    GrGLuint renderbufferID() const {
    1.45 +        return fRenderbufferID;
    1.46 +    }
    1.47 +
    1.48 +    const Format& format() const { return fFormat; }
    1.49 +
    1.50 +protected:
    1.51 +    // overrides of GrResource
    1.52 +    virtual void onRelease() SK_OVERRIDE;
    1.53 +    virtual void onAbandon() SK_OVERRIDE;
    1.54 +
    1.55 +private:
    1.56 +    Format fFormat;
    1.57 +    // may be zero for external SBs associated with external RTs
    1.58 +    // (we don't require the client to give us the id, just tell
    1.59 +    // us how many bits of stencil there are).
    1.60 +    GrGLuint fRenderbufferID;
    1.61 +
    1.62 +    typedef GrStencilBuffer INHERITED;
    1.63 +};
    1.64 +
    1.65 +#endif

mercurial