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 | 9 |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 kBilerp_TextureFlag = 0x2, | 165 kBilerp_TextureFlag = 0x2, |
166 }; | 166 }; |
167 | 167 |
168 namespace { | 168 namespace { |
169 GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu, | 169 GrResourceKey::ResourceFlags get_texture_flags(const GrGpu* gpu, |
170 const GrTextureParams* params, | 170 const GrTextureParams* params, |
171 const GrTextureDesc& desc) { | 171 const GrTextureDesc& desc) { |
172 GrResourceKey::ResourceFlags flags = 0; | 172 GrResourceKey::ResourceFlags flags = 0; |
173 bool tiled = params && params->isTiled(); | 173 bool tiled = params && params->isTiled(); |
174 if (tiled && !gpu->caps()->npotTextureTileSupport()) { | 174 if (tiled && !gpu->caps()->npotTextureTileSupport()) { |
175 if (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight)) { | 175 if (!SkIsPow2(desc.fWidth) || !SkIsPow2(desc.fHeight) || !SkIsPow2(desc.
fDepth)) { |
176 flags |= kStretchToPOT_TextureFlag; | 176 flags |= kStretchToPOT_TextureFlag; |
177 switch(params->filterMode()) { | 177 switch(params->filterMode()) { |
178 case GrTextureParams::kNone_FilterMode: | 178 case GrTextureParams::kNone_FilterMode: |
179 break; | 179 break; |
180 case GrTextureParams::kBilerp_FilterMode: | 180 case GrTextureParams::kBilerp_FilterMode: |
181 case GrTextureParams::kMipMap_FilterMode: | 181 case GrTextureParams::kMipMap_FilterMode: |
182 flags |= kBilerp_TextureFlag; | 182 flags |= kBilerp_TextureFlag; |
183 break; | 183 break; |
184 } | 184 } |
185 } | 185 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 return GrResourceKey(cacheID, texture_resource_type(), 0); | 240 return GrResourceKey(cacheID, texture_resource_type(), 0); |
241 } | 241 } |
242 | 242 |
243 bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) { | 243 bool GrTextureImpl::NeedsResizing(const GrResourceKey& key) { |
244 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); | 244 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
245 } | 245 } |
246 | 246 |
247 bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) { | 247 bool GrTextureImpl::NeedsBilerp(const GrResourceKey& key) { |
248 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); | 248 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
249 } | 249 } |
OLD | NEW |