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

          Line data    Source code
       1             : /*
       2             :  * Copyright 2014 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 GrTexturePriv_DEFINED
       9             : #define GrTexturePriv_DEFINED
      10             : 
      11             : #include "GrExternalTextureData.h"
      12             : #include "GrTexture.h"
      13             : 
      14             : /** Class that adds methods to GrTexture that are only intended for use internal to Skia.
      15             :     This class is purely a privileged window into GrTexture. It should never have additional data
      16             :     members or virtual methods.
      17             :     Non-static methods that are not trivial inlines should be spring-boarded (e.g. declared and
      18             :     implemented privately in GrTexture with a inline public method here). */
      19             : class GrTexturePriv {
      20             : public:
      21             :     void setFlag(GrSurfaceFlags flags) {
      22             :         fTexture->fDesc.fFlags = fTexture->fDesc.fFlags | flags;
      23             :     }
      24             : 
      25             :     void resetFlag(GrSurfaceFlags flags) {
      26             :         fTexture->fDesc.fFlags = fTexture->fDesc.fFlags & ~flags;
      27             :     }
      28             : 
      29             :     bool isSetFlag(GrSurfaceFlags flags) const {
      30             :         return 0 != (fTexture->fDesc.fFlags & flags);
      31             :     }
      32             : 
      33           0 :     void dirtyMipMaps(bool mipMapsDirty) {
      34           0 :         fTexture->dirtyMipMaps(mipMapsDirty);
      35           0 :     }
      36             : 
      37           0 :     bool mipMapsAreDirty() const {
      38           0 :         return GrTexture::kValid_MipMapsStatus != fTexture->fMipMapsStatus;
      39             :     }
      40             : 
      41           0 :     bool hasMipMaps() const {
      42           0 :         return GrTexture::kNotAllocated_MipMapsStatus != fTexture->fMipMapsStatus;
      43             :     }
      44             : 
      45           0 :     void setMaxMipMapLevel(int maxMipMapLevel) const {
      46           0 :         fTexture->fMaxMipMapLevel = maxMipMapLevel;
      47           0 :     }
      48             : 
      49           0 :     int maxMipMapLevel() const {
      50           0 :         return fTexture->fMaxMipMapLevel;
      51             :     }
      52             : 
      53           0 :     GrSLType imageStorageType() const {
      54           0 :         if (GrPixelConfigIsSint(fTexture->config())) {
      55           0 :             return kIImageStorage2D_GrSLType;
      56             :         } else {
      57           0 :             return kImageStorage2D_GrSLType;
      58             :         }
      59             :     }
      60             : 
      61           0 :     GrSLType samplerType() const { return fTexture->fSamplerType; }
      62             : 
      63             :     /** The filter used is clamped to this value in GrProcessor::TextureSampler. */
      64           0 :     GrSamplerParams::FilterMode highestFilterMode() const { return fTexture->fHighestFilterMode; }
      65             : 
      66           0 :     void setMipColorMode(SkDestinationSurfaceColorMode colorMode) const {
      67           0 :         fTexture->fMipColorMode = colorMode;
      68           0 :     }
      69           0 :     SkDestinationSurfaceColorMode mipColorMode() const { return fTexture->fMipColorMode; }
      70             : 
      71             :     /**
      72             :      *  Return the native bookkeeping data for this texture, and detach the backend object from
      73             :      *  this GrTexture. It's lifetime will no longer be managed by Ganesh, and this GrTexture will
      74             :      *  no longer refer to it. Leaves this GrTexture in an orphan state.
      75             :      */
      76           0 :     std::unique_ptr<GrExternalTextureData> detachBackendTexture() {
      77           0 :         return fTexture->detachBackendTexture();
      78             :     }
      79             : 
      80             :     static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*);
      81             : 
      82             : private:
      83           0 :     GrTexturePriv(GrTexture* texture) : fTexture(texture) { }
      84             :     GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { }
      85             :     GrTexturePriv& operator=(const GrTexturePriv&); // unimpl
      86             : 
      87             :     // No taking addresses of this type.
      88             :     const GrTexturePriv* operator&() const;
      89             :     GrTexturePriv* operator&();
      90             : 
      91             :     GrTexture* fTexture;
      92             : 
      93             :     friend class GrTexture; // to construct/copy this type.
      94             : };
      95             : 
      96           0 : inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); }
      97             : 
      98           0 : inline const GrTexturePriv GrTexture::texturePriv () const {
      99           0 :     return GrTexturePriv(const_cast<GrTexture*>(this));
     100             : }
     101             : 
     102             : #endif

Generated by: LCOV version 1.13