LCOV - code coverage report
Current view: top level - gfx/skia/skia/src/gpu/gl - GrGLBuffer.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 5 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /*
       2             :  * Copyright 2016 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             : #ifndef GrGLBuffer_DEFINED
       9             : #define GrGLBuffer_DEFINED
      10             : 
      11             : #include "GrBuffer.h"
      12             : #include "gl/GrGLTypes.h"
      13             : 
      14             : class GrGLGpu;
      15             : class GrGLCaps;
      16             : 
      17             : class GrGLBuffer : public GrBuffer {
      18             : public:
      19             :     static GrGLBuffer* Create(GrGLGpu*, size_t size, GrBufferType intendedType, GrAccessPattern,
      20             :                               const void* data = nullptr);
      21             : 
      22           0 :     ~GrGLBuffer() override {
      23             :         // either release or abandon should have been called by the owner of this object.
      24           0 :         SkASSERT(0 == fBufferID);
      25           0 :     }
      26             : 
      27           0 :     GrGLuint bufferID() const { return fBufferID; }
      28             : 
      29             :     /**
      30             :      * Returns the actual size of the underlying GL buffer object. In certain cases we may make this
      31             :      * smaller than the size reported by GrBuffer.
      32             :      */
      33             :     size_t glSizeInBytes() const { return fGLSizeInBytes; }
      34             : 
      35           0 :     void setHasAttachedToTexture() { fHasAttachedToTexture = true; }
      36           0 :     bool hasAttachedToTexture() const { return fHasAttachedToTexture; }
      37             : 
      38             : protected:
      39             :     GrGLBuffer(GrGLGpu*, size_t size, GrBufferType intendedType, GrAccessPattern, const void* data);
      40             : 
      41             :     void onAbandon() override;
      42             :     void onRelease() override;
      43             :     void setMemoryBacking(SkTraceMemoryDump* traceMemoryDump,
      44             :                           const SkString& dumpName) const override;
      45             : 
      46             : private:
      47             :     GrGLGpu* glGpu() const;
      48             :     const GrGLCaps& glCaps() const;
      49             : 
      50             :     void onMap() override;
      51             :     void onUnmap() override;
      52             :     bool onUpdateData(const void* src, size_t srcSizeInBytes) override;
      53             : 
      54             : #ifdef SK_DEBUG
      55             :     void validate() const;
      56             : #endif
      57             : 
      58             :     GrBufferType   fIntendedType;
      59             :     GrGLuint       fBufferID;
      60             :     GrGLenum       fUsage;
      61             :     size_t         fGLSizeInBytes;
      62             :     bool           fHasAttachedToTexture;
      63             : 
      64             :     typedef GrBuffer INHERITED;
      65             : };
      66             : 
      67             : #endif

Generated by: LCOV version 1.13