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