Implement support for origin-TopLeft render targets in GL backend.
Review URL: https://codereview.appspot.com/7230049
git-svn-id: http://skia.googlecode.com/svn/trunk@7545 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrTexture.cpp b/src/gpu/GrTexture.cpp
index 614d771..4dea2a6 100644
--- a/src/gpu/GrTexture.cpp
+++ b/src/gpu/GrTexture.cpp
@@ -165,14 +165,16 @@
GrCacheID::Key idKey;
// Instead of a client-provided key of the texture contents we create a key from the
// descriptor.
- GR_STATIC_ASSERT(sizeof(idKey) >= 12);
+ GR_STATIC_ASSERT(sizeof(idKey) >= 16);
GrAssert(desc.fHeight < (1 << 16));
GrAssert(desc.fWidth < (1 << 16));
idKey.fData32[0] = (desc.fWidth) | (desc.fHeight << 16);
idKey.fData32[1] = desc.fConfig | desc.fSampleCnt << 16;
idKey.fData32[2] = desc.fFlags;
- static const int kPadSize = sizeof(idKey) - 12;
- memset(idKey.fData8 + 12, 0, kPadSize);
+ idKey.fData32[3] = desc.fOrigin; // Only needs 2 bits actually
+ static const int kPadSize = sizeof(idKey) - 16;
+ GR_STATIC_ASSERT(kPadSize >= 0);
+ memset(idKey.fData8 + 16, 0, kPadSize);
GrCacheID cacheID(GrResourceKey::ScratchDomain(), idKey);
return GrResourceKey(cacheID, texture_resource_type(), 0);