Index: src/gpu/GrTexture.cpp |
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp |
index 7984460545db61d3b5dfb8c6120f24719e909365..ba739a819c40b66e17d253a22eb11743c44bcf4d 100644 |
--- a/src/gpu/GrTexture.cpp |
+++ b/src/gpu/GrTexture.cpp |
@@ -98,18 +98,24 @@ GrTexture::GrTexture(GrGpu* gpu, LifeCycle lifeCycle, const GrSurfaceDesc& desc) |
void GrTexturePriv::ComputeScratchKey(const GrSurfaceDesc& desc, GrScratchKey* key) { |
static const GrScratchKey::ResourceType kType = GrScratchKey::GenerateResourceType(); |
- GrScratchKey::Builder builder(key, kType, 2); |
- |
GrSurfaceOrigin origin = resolve_origin(desc); |
uint32_t flags = desc.fFlags & ~kCheckAllocation_GrSurfaceFlag; |
- SkASSERT(desc.fWidth <= SK_MaxU16); |
- SkASSERT(desc.fHeight <= SK_MaxU16); |
SkASSERT(static_cast<int>(desc.fConfig) < (1 << 6)); |
SkASSERT(desc.fSampleCnt < (1 << 8)); |
SkASSERT(flags < (1 << 10)); |
SkASSERT(static_cast<int>(origin) < (1 << 8)); |
robertphillips
2015/10/01 17:51:01
If we do this I propose we just always use the 3 e
bsalomon
2015/10/01 18:05:44
Agreed.
|
- builder[0] = desc.fWidth | (desc.fHeight << 16); |
- builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); |
+ if (desc.fWidth <= SK_MaxU16 && desc.fHeight <= SK_MaxU16) { |
+ GrScratchKey::Builder builder(key, kType, 2); |
+ |
+ builder[0] = desc.fWidth | (desc.fHeight << 16); |
+ builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); |
+ } else { |
+ GrScratchKey::Builder builder(key, kType, 3); |
+ |
+ builder[0] = desc.fWidth; |
+ builder[1] = desc.fHeight; |
+ builder[2] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24); |
+ } |
} |