diff options
author | 2015-01-21 09:32:40 -0800 | |
---|---|---|
committer | 2015-01-21 09:32:40 -0800 | |
commit | 1c60dfe7ca0db010fa3118a1a2c7ff4c09136ab0 (patch) | |
tree | 03466f3cf17d16076ede33cd3a25122a5fa7ef47 /include/gpu/GrResourceKey.h | |
parent | a092d2eaf8a05cde31c6a23f62bb2099ac2e93cd (diff) |
Reland https://codereview.chromium.org/860333002 with fix for test failures.
Revert "Revert of Make GrScratchKey memory buffer correct size on copy (patchset #1 id:1 of https://codereview.chromium.org/860333002/)"
This reverts commit 988018c817f341c0ce09297b7ba5ba60ba76eba9.
BUG=skia:
Review URL: https://codereview.chromium.org/863983003
Diffstat (limited to 'include/gpu/GrResourceKey.h')
-rw-r--r-- | include/gpu/GrResourceKey.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/gpu/GrResourceKey.h b/include/gpu/GrResourceKey.h index f662ed5511..9922c8f5d0 100644 --- a/include/gpu/GrResourceKey.h +++ b/include/gpu/GrResourceKey.h @@ -46,9 +46,9 @@ public: const uint32_t* data() const { return &fKey[kMetaDataCnt]; } GrScratchKey& operator=(const GrScratchKey& that) { - size_t size = that.size(); - fKey.reset(SkToInt(size)); - memcpy(fKey.get(), that.fKey.get(), size); + size_t bytes = that.size(); + fKey.reset(SkToInt(bytes / sizeof(uint32_t))); + memcpy(fKey.get(), that.fKey.get(), bytes); return *this; } @@ -96,6 +96,8 @@ private: static const uint32_t kInvalidResourceType = 0; static const uint32_t kMetaDataCnt = kLastMetaDataIdx + 1; + friend class TestResource; // For unit test to access kMetaDataCnt. + // Stencil and textures each require 2 uint32_t values. SkAutoSTArray<kMetaDataCnt + 2, uint32_t> fKey; }; |