| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrContext.h" | 8 #include "GrContext.h" |
| 9 #include "GrCaps.h" | 9 #include "GrCaps.h" |
| 10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 return desc.fOrigin; | 83 return desc.fOrigin; |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 ////////////////////////////////////////////////////////////////////////////// | 88 ////////////////////////////////////////////////////////////////////////////// |
| 89 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, | 89 GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc, |
| 90 GrSLType samplerType, bool wasMipMapDataProvided) | 90 GrSLType samplerType, bool wasMipMapDataProvided) |
| 91 : INHERITED(gpu, lifeCycle, desc) | 91 : INHERITED(gpu, lifeCycle, desc) |
| 92 , fSamplerType(samplerType) { | 92 , fSamplerType(samplerType) { |
| 93 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) && | 93 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig)) { |
| 94 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { | |
| 95 GrScratchKey key; | 94 GrScratchKey key; |
| 96 GrTexturePriv::ComputeScratchKey(desc, &key); | 95 GrTexturePriv::ComputeScratchKey(desc, &key); |
| 97 this->setScratchKey(key); | 96 this->setScratchKey(key); |
| 98 } | 97 } |
| 99 | 98 |
| 100 if (wasMipMapDataProvided) { | 99 if (wasMipMapDataProvided) { |
| 101 fMipMapsStatus = kValid_MipMapsStatus; | 100 fMipMapsStatus = kValid_MipMapsStatus; |
| 102 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh
t); | 101 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh
t); |
| 103 } else { | 102 } else { |
| 104 fMipMapsStatus = kNotAllocated_MipMapsStatus; | 103 fMipMapsStatus = kNotAllocated_MipMapsStatus; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 118 SkASSERT(desc.fSampleCnt < (1 << 8)); | 117 SkASSERT(desc.fSampleCnt < (1 << 8)); |
| 119 SkASSERT(flags < (1 << 10)); | 118 SkASSERT(flags < (1 << 10)); |
| 120 SkASSERT(static_cast<int>(origin) < (1 << 8)); | 119 SkASSERT(static_cast<int>(origin) < (1 << 8)); |
| 121 | 120 |
| 122 GrScratchKey::Builder builder(key, kType, 3); | 121 GrScratchKey::Builder builder(key, kType, 3); |
| 123 builder[0] = desc.fWidth; | 122 builder[0] = desc.fWidth; |
| 124 builder[1] = desc.fHeight; | 123 builder[1] = desc.fHeight; |
| 125 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) | 124 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) |
| 126 | (origin << 24); | 125 | (origin << 24); |
| 127 } | 126 } |
| OLD | NEW |