| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #ifndef GrTexture_DEFINED | 9 #ifndef GrTexture_DEFINED |
| 10 #define GrTexture_DEFINED | 10 #define GrTexture_DEFINED |
| 11 | 11 |
| 12 #include "GrSurface.h" | 12 #include "GrSurface.h" |
| 13 #include "SkPoint.h" | 13 #include "SkPoint.h" |
| 14 #include "SkRefCnt.h" | 14 #include "SkRefCnt.h" |
| 15 | 15 |
| 16 class GrTextureParams; | 16 class GrTextureParams; |
| 17 class GrTexturePriv; | 17 class GrTexturePriv; |
| 18 | 18 |
| 19 class GrTexture : virtual public GrSurface { | 19 class GrTexture : virtual public GrSurface { |
| 20 public: | 20 public: |
| 21 GrTexture* asTexture() override { return this; } | 21 GrTexture* asTexture() override { return this; } |
| 22 const GrTexture* asTexture() const override { return this; } | 22 const GrTexture* asTexture() const override { return this; } |
| 23 GrSLType samplerType() const { return fSamplerType; } |
| 23 | 24 |
| 24 /** | 25 /** |
| 25 * Return the native ID or handle to the texture, depending on the | 26 * Return the native ID or handle to the texture, depending on the |
| 26 * platform. e.g. on OpenGL, return the texture ID. | 27 * platform. e.g. on OpenGL, return the texture ID. |
| 27 */ | 28 */ |
| 28 virtual GrBackendObject getTextureHandle() const = 0; | 29 virtual GrBackendObject getTextureHandle() const = 0; |
| 29 | 30 |
| 30 /** | 31 /** |
| 31 * This function indicates that the texture parameters (wrap mode, filtering
, ...) have been | 32 * This function indicates that the texture parameters (wrap mode, filtering
, ...) have been |
| 32 * changed externally to Skia. | 33 * changed externally to Skia. |
| 33 */ | 34 */ |
| 34 virtual void textureParamsModified() = 0; | 35 virtual void textureParamsModified() = 0; |
| 35 | 36 |
| 36 #ifdef SK_DEBUG | 37 #ifdef SK_DEBUG |
| 37 void validate() const { | 38 void validate() const { |
| 38 this->INHERITED::validate(); | 39 this->INHERITED::validate(); |
| 39 this->validateDesc(); | 40 this->validateDesc(); |
| 40 } | 41 } |
| 41 #endif | 42 #endif |
| 42 | 43 |
| 43 /** Access methods that are only to be used within Skia code. */ | 44 /** Access methods that are only to be used within Skia code. */ |
| 44 inline GrTexturePriv texturePriv(); | 45 inline GrTexturePriv texturePriv(); |
| 45 inline const GrTexturePriv texturePriv() const; | 46 inline const GrTexturePriv texturePriv() const; |
| 46 | 47 |
| 47 protected: | 48 protected: |
| 48 GrTexture(GrGpu*, LifeCycle, const GrSurfaceDesc&, bool wasMipMapDataProvide
d); | 49 GrTexture(GrGpu*, LifeCycle, const GrSurfaceDesc&, GrSLType, bool wasMipMapD
ataProvided); |
| 49 | 50 |
| 50 void validateDesc() const; | 51 void validateDesc() const; |
| 51 | 52 |
| 52 private: | 53 private: |
| 53 size_t onGpuMemorySize() const override; | 54 size_t onGpuMemorySize() const override; |
| 54 void dirtyMipMaps(bool mipMapsDirty); | 55 void dirtyMipMaps(bool mipMapsDirty); |
| 55 | 56 |
| 56 enum MipMapsStatus { | 57 enum MipMapsStatus { |
| 57 kNotAllocated_MipMapsStatus, | 58 kNotAllocated_MipMapsStatus, |
| 58 kAllocated_MipMapsStatus, | 59 kAllocated_MipMapsStatus, |
| 59 kValid_MipMapsStatus | 60 kValid_MipMapsStatus |
| 60 }; | 61 }; |
| 61 | 62 |
| 63 GrSLType fSamplerType; |
| 62 MipMapsStatus fMipMapsStatus; | 64 MipMapsStatus fMipMapsStatus; |
| 63 int fMaxMipMapLevel; | 65 int fMaxMipMapLevel; |
| 64 | 66 |
| 65 friend class GrTexturePriv; | 67 friend class GrTexturePriv; |
| 66 | 68 |
| 67 typedef GrSurface INHERITED; | 69 typedef GrSurface INHERITED; |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 #endif | 72 #endif |
| OLD | NEW |