Ensure that GrCacheID::Key instances are fully initialized.
authorbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 2 Jan 2013 19:29:57 +0000 (19:29 +0000)
committerbsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 2 Jan 2013 19:29:57 +0000 (19:29 +0000)
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/7036046

git-svn-id: http://skia.googlecode.com/svn/trunk@6971 2bbb7eff-a529-9590-31e7-b0007b416f81

src/gpu/GrStencilBuffer.cpp
src/gpu/SkGr.cpp

index 623861df8fe705622ade47ddbddef38102947268..865961acdc7f9891618dc1d20b044a8932c54af3 100644 (file)
@@ -29,6 +29,7 @@ void gen_cache_id(int width, int height, int sampleCnt, GrCacheID* cacheID) {
     keyData[0] = width;
     keyData[1] = height;
     keyData[2] = sampleCnt;
+    memset(keyData + 3, 0, sizeof(key) - 3 * sizeof(uint32_t));
     GR_STATIC_ASSERT(sizeof(key) >= 3 * sizeof(uint32_t));
     cacheID->reset(gStencilBufferDomain, key);
 }
index 695b1df8521b0ae27db0e8ff481131b09169a3e8..fac18e969e606686024982afc2f744704c2c2a61 100644 (file)
@@ -69,6 +69,8 @@ static void generate_bitmap_cache_id(const SkBitmap& bitmap, GrCacheID* id) {
     memcpy(key.fData8 + 4, &width, 2);
     memcpy(key.fData8 + 6, &height, 2);
     memcpy(key.fData8 + 8, &offset, sizeof(size_t));
+    static const size_t kKeyDataSize = 8 + sizeof(size_t);
+    memset(key.fData8 + kKeyDataSize, 0, sizeof(key) - kKeyDataSize);
     GR_STATIC_ASSERT(sizeof(key) >= 8 + sizeof(size_t));
     static const GrCacheID::Domain gBitmapTextureDomain = GrCacheID::GenerateDomain();
     id->reset(gBitmapTextureDomain, key);