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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { | 81 if (kDefault_GrSurfaceOrigin == desc.fOrigin) { |
82 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; | 82 return renderTarget ? kBottomLeft_GrSurfaceOrigin : kTopLeft_GrSurfaceOr
igin; |
83 } else { | 83 } else { |
84 return desc.fOrigin; | 84 return desc.fOrigin; |
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 bool wasMipMapDataProvided) | 91 GrSLType samplerType, bool wasMipMapDataProvided) |
92 : INHERITED(gpu, lifeCycle, desc) { | 92 : INHERITED(gpu, lifeCycle, desc) |
| 93 , fSamplerType(samplerType) { |
93 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) && | 94 if (!this->isExternal() && !GrPixelConfigIsCompressed(desc.fConfig) && |
94 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { | 95 !desc.fTextureStorageAllocator.fAllocateTextureStorage) { |
95 GrScratchKey key; | 96 GrScratchKey key; |
96 GrTexturePriv::ComputeScratchKey(desc, &key); | 97 GrTexturePriv::ComputeScratchKey(desc, &key); |
97 this->setScratchKey(key); | 98 this->setScratchKey(key); |
98 } | 99 } |
99 | 100 |
100 if (wasMipMapDataProvided) { | 101 if (wasMipMapDataProvided) { |
101 fMipMapsStatus = kValid_MipMapsStatus; | 102 fMipMapsStatus = kValid_MipMapsStatus; |
102 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh
t); | 103 fMaxMipMapLevel = SkMipMap::ComputeLevelCount(fDesc.fWidth, fDesc.fHeigh
t); |
(...skipping 15 matching lines...) Expand all Loading... |
118 SkASSERT(desc.fSampleCnt < (1 << 8)); | 119 SkASSERT(desc.fSampleCnt < (1 << 8)); |
119 SkASSERT(flags < (1 << 10)); | 120 SkASSERT(flags < (1 << 10)); |
120 SkASSERT(static_cast<int>(origin) < (1 << 8)); | 121 SkASSERT(static_cast<int>(origin) < (1 << 8)); |
121 | 122 |
122 GrScratchKey::Builder builder(key, kType, 3); | 123 GrScratchKey::Builder builder(key, kType, 3); |
123 builder[0] = desc.fWidth; | 124 builder[0] = desc.fWidth; |
124 builder[1] = desc.fHeight; | 125 builder[1] = desc.fHeight; |
125 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) | 126 builder[2] = desc.fConfig | (desc.fIsMipMapped << 5) | (desc.fSampleCnt << 6
) | (flags << 14) |
126 | (origin << 24); | 127 | (origin << 24); |
127 } | 128 } |
OLD | NEW |