OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef GrResourceKey_DEFINED | 9 #ifndef GrResourceKey_DEFINED |
10 #define GrResourceKey_DEFINED | 10 #define GrResourceKey_DEFINED |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 | 213 |
214 class Builder : public INHERITED::Builder { | 214 class Builder : public INHERITED::Builder { |
215 public: | 215 public: |
216 Builder(GrContentKey* key, Domain domain, int data32Count) | 216 Builder(GrContentKey* key, Domain domain, int data32Count) |
217 : INHERITED::Builder(key, domain, data32Count) {} | 217 : INHERITED::Builder(key, domain, data32Count) {} |
218 | 218 |
219 /** Used to build a key that wraps another key and adds additional data.
*/ | 219 /** Used to build a key that wraps another key and adds additional data.
*/ |
220 Builder(GrContentKey* key, const GrContentKey& innerKey, Domain domain, | 220 Builder(GrContentKey* key, const GrContentKey& innerKey, Domain domain, |
221 int extraData32Cnt) | 221 int extraData32Cnt) |
222 : INHERITED::Builder(key, domain, Data32CntForInnerKey(innerKey) + e
xtraData32Cnt) { | 222 : INHERITED::Builder(key, domain, Data32CntForInnerKey(innerKey) + e
xtraData32Cnt) { |
| 223 SkASSERT(&innerKey != key); |
223 // add the inner key to the end of the key so that op[] can be index
ed normally. | 224 // add the inner key to the end of the key so that op[] can be index
ed normally. |
224 uint32_t* innerKeyData = &this->operator[](extraData32Cnt); | 225 uint32_t* innerKeyData = &this->operator[](extraData32Cnt); |
225 const uint32_t* srcData = innerKey.data(); | 226 const uint32_t* srcData = innerKey.data(); |
226 (*innerKeyData++) = innerKey.domain(); | 227 (*innerKeyData++) = innerKey.domain(); |
227 memcpy(innerKeyData, srcData, innerKey.dataSize()); | 228 memcpy(innerKeyData, srcData, innerKey.dataSize()); |
228 } | 229 } |
229 | 230 |
230 private: | 231 private: |
231 static int Data32CntForInnerKey(const GrContentKey& innerKey) { | 232 static int Data32CntForInnerKey(const GrContentKey& innerKey) { |
232 // key data + domain | 233 // key data + domain |
233 return SkToInt((innerKey.dataSize() >> 2) + 1); | 234 return SkToInt((innerKey.dataSize() >> 2) + 1); |
234 } | 235 } |
235 }; | 236 }; |
236 }; | 237 }; |
237 | 238 |
238 #endif | 239 #endif |
OLD | NEW |