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 23 matching lines...) Expand all Loading... |
34 bool mipMapsAreDirty() const { | 34 bool mipMapsAreDirty() const { |
35 return GrTexture::kValid_MipMapsStatus != fTexture->fMipMapsStatus; | 35 return GrTexture::kValid_MipMapsStatus != fTexture->fMipMapsStatus; |
36 } | 36 } |
37 | 37 |
38 bool hasMipMaps() const { | 38 bool hasMipMaps() const { |
39 return GrTexture::kNotAllocated_MipMapsStatus != fTexture->fMipMapsStatu
s; | 39 return GrTexture::kNotAllocated_MipMapsStatus != fTexture->fMipMapsStatu
s; |
40 } | 40 } |
41 | 41 |
42 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*); | 42 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*); |
43 | 43 |
44 // TODO: Move this logic and the shift values out of here and to the callers
. | |
45 SkFixed normalizeFixedX(SkFixed x) const { | |
46 SkASSERT(SkIsPow2(fTexture->fDesc.fWidth)); | |
47 return x >> fTexture->fShiftFixedX; | |
48 } | |
49 | |
50 SkFixed normalizeFixedY(SkFixed y) const { | |
51 SkASSERT(SkIsPow2(fTexture->fDesc.fHeight)); | |
52 return y >> fTexture->fShiftFixedY; | |
53 } | |
54 | |
55 private: | 44 private: |
56 GrTexturePriv(GrTexture* texture) : fTexture(texture) { } | 45 GrTexturePriv(GrTexture* texture) : fTexture(texture) { } |
57 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { } | 46 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { } |
58 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl | 47 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl |
59 | 48 |
60 // No taking addresses of this type. | 49 // No taking addresses of this type. |
61 const GrTexturePriv* operator&() const; | 50 const GrTexturePriv* operator&() const; |
62 GrTexturePriv* operator&(); | 51 GrTexturePriv* operator&(); |
63 | 52 |
64 GrTexture* fTexture; | 53 GrTexture* fTexture; |
65 | 54 |
66 friend class GrTexture; // to construct/copy this type. | 55 friend class GrTexture; // to construct/copy this type. |
67 }; | 56 }; |
68 | 57 |
69 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } | 58 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } |
70 | 59 |
71 inline const GrTexturePriv GrTexture::texturePriv () const { | 60 inline const GrTexturePriv GrTexture::texturePriv () const { |
72 return GrTexturePriv(const_cast<GrTexture*>(this)); | 61 return GrTexturePriv(const_cast<GrTexture*>(this)); |
73 } | 62 } |
74 | 63 |
75 #endif | 64 #endif |
OLD | NEW |