| 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 #include "GrContext.h" | 9 #include "GrContext.h" |
| 10 #include "GrDrawTargetCaps.h" | 10 #include "GrDrawTargetCaps.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 } else { | 114 } else { |
| 115 return desc.fOrigin; | 115 return desc.fOrigin; |
| 116 } | 116 } |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 ////////////////////////////////////////////////////////////////////////////// | 120 ////////////////////////////////////////////////////////////////////////////// |
| 121 GrTexture::GrTexture(GrGpu* gpu, bool isWrapped, const GrSurfaceDesc& desc) | 121 GrTexture::GrTexture(GrGpu* gpu, bool isWrapped, const GrSurfaceDesc& desc) |
| 122 : INHERITED(gpu, isWrapped, desc) | 122 : INHERITED(gpu, isWrapped, desc) |
| 123 , fMipMapsStatus(kNotAllocated_MipMapsStatus) { | 123 , fMipMapsStatus(kNotAllocated_MipMapsStatus) { |
| 124 this->setScratchKey(GrTexturePriv::ComputeScratchKey(desc)); | 124 |
| 125 if (!isWrapped) { |
| 126 this->setScratchKey(GrTexturePriv::ComputeScratchKey(desc)); |
| 127 } |
| 125 // only make sense if alloc size is pow2 | 128 // only make sense if alloc size is pow2 |
| 126 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); | 129 fShiftFixedX = 31 - SkCLZ(fDesc.fWidth); |
| 127 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); | 130 fShiftFixedY = 31 - SkCLZ(fDesc.fHeight); |
| 128 } | 131 } |
| 129 | 132 |
| 130 GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu, | 133 GrResourceKey GrTexturePriv::ComputeKey(const GrGpu* gpu, |
| 131 const GrTextureParams* params, | 134 const GrTextureParams* params, |
| 132 const GrSurfaceDesc& desc, | 135 const GrSurfaceDesc& desc, |
| 133 const GrCacheID& cacheID) { | 136 const GrCacheID& cacheID) { |
| 134 GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc); | 137 GrResourceKey::ResourceFlags flags = get_texture_flags(gpu, params, desc); |
| (...skipping 19 matching lines...) Expand all Loading... |
| 154 return GrResourceKey(cacheID, ResourceType(), 0); | 157 return GrResourceKey(cacheID, ResourceType(), 0); |
| 155 } | 158 } |
| 156 | 159 |
| 157 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { | 160 bool GrTexturePriv::NeedsResizing(const GrResourceKey& key) { |
| 158 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); | 161 return SkToBool(key.getResourceFlags() & kStretchToPOT_TextureFlag); |
| 159 } | 162 } |
| 160 | 163 |
| 161 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { | 164 bool GrTexturePriv::NeedsBilerp(const GrResourceKey& key) { |
| 162 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); | 165 return SkToBool(key.getResourceFlags() & kBilerp_TextureFlag); |
| 163 } | 166 } |
| OLD | NEW |