OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrTexturePriv_DEFINED | 8 #ifndef GrTexturePriv_DEFINED |
9 #define GrTexturePriv_DEFINED | 9 #define GrTexturePriv_DEFINED |
10 | 10 |
(...skipping 11 matching lines...) Expand all Loading... |
22 } | 22 } |
23 | 23 |
24 void resetFlag(GrSurfaceFlags flags) { | 24 void resetFlag(GrSurfaceFlags flags) { |
25 fTexture->fDesc.fFlags = fTexture->fDesc.fFlags & ~flags; | 25 fTexture->fDesc.fFlags = fTexture->fDesc.fFlags & ~flags; |
26 } | 26 } |
27 | 27 |
28 bool isSetFlag(GrSurfaceFlags flags) const { | 28 bool isSetFlag(GrSurfaceFlags flags) const { |
29 return 0 != (fTexture->fDesc.fFlags & flags); | 29 return 0 != (fTexture->fDesc.fFlags & flags); |
30 } | 30 } |
31 | 31 |
32 void dirtyMipMaps(bool mipMapsDirty, bool sRGBCorrect = false) { | 32 void dirtyMipMaps(bool mipMapsDirty) { |
33 fTexture->dirtyMipMaps(mipMapsDirty, sRGBCorrect); | 33 fTexture->dirtyMipMaps(mipMapsDirty); |
34 } | 34 } |
35 | 35 |
36 bool mipMapsAreDirty() const { | 36 bool mipMapsAreDirty() const { |
37 return GrTexture::kValid_MipMapsStatus != fTexture->fMipMapsStatus; | 37 return GrTexture::kValid_MipMapsStatus != fTexture->fMipMapsStatus; |
38 } | 38 } |
39 | 39 |
40 bool hasMipMaps() const { | 40 bool hasMipMaps() const { |
41 return GrTexture::kNotAllocated_MipMapsStatus != fTexture->fMipMapsStatu
s; | 41 return GrTexture::kNotAllocated_MipMapsStatus != fTexture->fMipMapsStatu
s; |
42 } | 42 } |
43 | 43 |
44 void setMaxMipMapLevel(int maxMipMapLevel) const { | 44 void setMaxMipMapLevel(int maxMipMapLevel) const { |
45 fTexture->fMaxMipMapLevel = maxMipMapLevel; | 45 fTexture->fMaxMipMapLevel = maxMipMapLevel; |
46 } | 46 } |
47 | 47 |
48 int maxMipMapLevel() const { | 48 int maxMipMapLevel() const { |
49 return fTexture->fMaxMipMapLevel; | 49 return fTexture->fMaxMipMapLevel; |
50 } | 50 } |
51 | 51 |
52 bool mipMapsAreSRGBCorrect() const { | 52 void setGammaTreatment(SkSourceGammaTreatment gammaTreatment) const { |
53 return fTexture->fMipMapsAreSRGBCorrect; | 53 fTexture->fGammaTreatment = gammaTreatment; |
54 } | 54 } |
| 55 SkSourceGammaTreatment gammaTreatment() const { return fTexture->fGammaTreat
ment; } |
55 | 56 |
56 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*); | 57 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*); |
57 | 58 |
58 private: | 59 private: |
59 GrTexturePriv(GrTexture* texture) : fTexture(texture) { } | 60 GrTexturePriv(GrTexture* texture) : fTexture(texture) { } |
60 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { } | 61 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { } |
61 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl | 62 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl |
62 | 63 |
63 // No taking addresses of this type. | 64 // No taking addresses of this type. |
64 const GrTexturePriv* operator&() const; | 65 const GrTexturePriv* operator&() const; |
65 GrTexturePriv* operator&(); | 66 GrTexturePriv* operator&(); |
66 | 67 |
67 GrTexture* fTexture; | 68 GrTexture* fTexture; |
68 | 69 |
69 friend class GrTexture; // to construct/copy this type. | 70 friend class GrTexture; // to construct/copy this type. |
70 }; | 71 }; |
71 | 72 |
72 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } | 73 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } |
73 | 74 |
74 inline const GrTexturePriv GrTexture::texturePriv () const { | 75 inline const GrTexturePriv GrTexture::texturePriv () const { |
75 return GrTexturePriv(const_cast<GrTexture*>(this)); | 76 return GrTexturePriv(const_cast<GrTexture*>(this)); |
76 } | 77 } |
77 | 78 |
78 #endif | 79 #endif |
OLD | NEW |