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

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

Issue 682223002: rename GrTextureDesc->GrSurfaceDesc, GrTextureFlags->GrSurfaceFlags (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const Created 6 years, 1 month 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
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
11 #include "GrTexture.h" 11 #include "GrTexture.h"
12 12
13 /** Class that adds methods to GrTexture that are only intended for use internal to Skia. 13 /** Class that adds methods to GrTexture that are only intended for use internal to Skia.
14 This class is purely a privileged window into GrTexture. It should never hav e additional data 14 This class is purely a privileged window into GrTexture. It should never hav e additional data
15 members or virtual methods. 15 members or virtual methods.
16 Non-static methods that are not trivial inlines should be spring-boarded (e. g. declared and 16 Non-static methods that are not trivial inlines should be spring-boarded (e. g. declared and
17 implemented privately in GrTexture with a inline public method here). */ 17 implemented privately in GrTexture with a inline public method here). */
18 class GrTexturePriv { 18 class GrTexturePriv {
19 public: 19 public:
20 void setFlag(GrTextureFlags flags) { 20 void setFlag(GrSurfaceFlags flags) {
21 fTexture->fDesc.fFlags = fTexture->fDesc.fFlags | flags; 21 fTexture->fDesc.fFlags = fTexture->fDesc.fFlags | flags;
22 } 22 }
23 23
24 void resetFlag(GrTextureFlags 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(GrTextureFlags 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) { 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 static GrResourceKey::ResourceType ResourceType() { 42 static GrResourceKey::ResourceType ResourceType() {
43 static const GrResourceKey::ResourceType gType = GrResourceKey::Generate ResourceType(); 43 static const GrResourceKey::ResourceType gType = GrResourceKey::Generate ResourceType();
44 return gType; 44 return gType;
45 } 45 }
46 46
47 static GrResourceKey ComputeKey(const GrGpu* gpu, 47 static GrResourceKey ComputeKey(const GrGpu* gpu,
48 const GrTextureParams* params, 48 const GrTextureParams* params,
49 const GrTextureDesc& desc, 49 const GrSurfaceDesc& desc,
50 const GrCacheID& cacheID); 50 const GrCacheID& cacheID);
51 static GrResourceKey ComputeScratchKey(const GrTextureDesc& desc); 51 static GrResourceKey ComputeScratchKey(const GrSurfaceDesc& desc);
52 static bool NeedsResizing(const GrResourceKey& key); 52 static bool NeedsResizing(const GrResourceKey& key);
53 static bool NeedsBilerp(const GrResourceKey& key); 53 static bool NeedsBilerp(const GrResourceKey& key);
54 54
55 55
56 // TODO: Move this logic and the shift values out of here and to the callers . 56 // TODO: Move this logic and the shift values out of here and to the callers .
57 SkFixed normalizeFixedX(SkFixed x) const { 57 SkFixed normalizeFixedX(SkFixed x) const {
58 SkASSERT(SkIsPow2(fTexture->fDesc.fWidth)); 58 SkASSERT(SkIsPow2(fTexture->fDesc.fWidth));
59 return x >> fTexture->fShiftFixedX; 59 return x >> fTexture->fShiftFixedX;
60 } 60 }
61 61
(...skipping 16 matching lines...) Expand all
78 friend class GrTexture; // to construct/copy this type. 78 friend class GrTexture; // to construct/copy this type.
79 }; 79 };
80 80
81 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); } 81 inline GrTexturePriv GrTexture::texturePriv() { return GrTexturePriv(this); }
82 82
83 inline const GrTexturePriv GrTexture::texturePriv () const { 83 inline const GrTexturePriv GrTexture::texturePriv () const {
84 return GrTexturePriv(const_cast<GrTexture*>(this)); 84 return GrTexturePriv(const_cast<GrTexture*>(this));
85 } 85 }
86 86
87 #endif 87 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrTexture.cpp ('k') | src/gpu/SkGpuDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698