Fix for texture width or height are greater than 2^16

BUG=skia:3467
TBR=

Review URL: https://codereview.chromium.org/1380153002
This commit is contained in:
joshualitt 2015-10-01 11:54:34 -07:00 committed by Commit bot
parent d1d4460547
commit b90de31355

View File

@ -98,18 +98,16 @@ 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));
builder[0] = desc.fWidth | (desc.fHeight << 16);
builder[1] = desc.fConfig | (desc.fSampleCnt << 6) | (flags << 14) | (origin << 24);
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);
}