Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: src/gpu/GrTexturePriv.h

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Cleaning up the allocated SkMipMap object. Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 21 matching lines...) Expand all
32 void dirtyMipMaps(bool mipMapsDirty) { fTexture->dirtyMipMaps(mipMapsDirty); } 32 void dirtyMipMaps(bool mipMapsDirty) { fTexture->dirtyMipMaps(mipMapsDirty); }
33 33
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 void setMaxMipMapLevel(int maxMipMapLevel) const {
43 fTexture->fMaxMipMapLevel = maxMipMapLevel;
44 }
45
46 int maxMipMapLevel() const {
47 return fTexture->fMaxMipMapLevel;
48 }
49
42 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*); 50 static void ComputeScratchKey(const GrSurfaceDesc&, GrScratchKey*);
43 51
44 // TODO: Move this logic and the shift values out of here and to the callers . 52 // TODO: Move this logic and the shift values out of here and to the callers .
45 SkFixed normalizeFixedX(SkFixed x) const { 53 SkFixed normalizeFixedX(SkFixed x) const {
46 SkASSERT(SkIsPow2(fTexture->fDesc.fWidth)); 54 SkASSERT(SkIsPow2(fTexture->fDesc.fWidth));
47 return x >> fTexture->fShiftFixedX; 55 return x >> fTexture->fShiftFixedX;
48 } 56 }
49 57
50 SkFixed normalizeFixedY(SkFixed y) const { 58 SkFixed normalizeFixedY(SkFixed y) const {
51 SkASSERT(SkIsPow2(fTexture->fDesc.fHeight)); 59 SkASSERT(SkIsPow2(fTexture->fDesc.fHeight));
52 return y >> fTexture->fShiftFixedY; 60 return y >> fTexture->fShiftFixedY;
53 } 61 }
54 62
55 private: 63 private:
56 GrTexturePriv(GrTexture* texture) : fTexture(texture) { } 64 GrTexturePriv(GrTexture* texture) : fTexture(texture) { }
57 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { } 65 GrTexturePriv(const GrTexturePriv& that) : fTexture(that.fTexture) { }
58 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl 66 GrTexturePriv& operator=(const GrTexturePriv&); // unimpl
59 67
60 // No taking addresses of this type. 68 // No taking addresses of this type.
61 const GrTexturePriv* operator&() const; 69 const GrTexturePriv* operator&() const;
62 GrTexturePriv* operator&(); 70 GrTexturePriv* operator&();
63 71
64 GrTexture* fTexture; 72 GrTexture* fTexture;
65 73
66 friend class GrTexture; // to construct/copy this type. 74 friend class GrTexture; // to construct/copy this type.
67 }; 75 };
68 76
69 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } 77 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); }
70 78
71 inline const GrTexturePriv GrTexture::texturePriv () const { 79 inline const GrTexturePriv GrTexture::texturePriv () const {
72 return GrTexturePriv(const_cast<GrTexture*>(this)); 80 return GrTexturePriv(const_cast<GrTexture*>(this));
73 } 81 }
74 82
75 #endif 83 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698