Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: include/gpu/GrResourceKey.h

Issue 938943002: Allow GrGpuResources' unique keys to be changed. (Closed) Base URL: https://skia.googlesource.com/skia.git@rename
Patch Set: Address comments Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 27 matching lines...) Expand all
38 38
39 /** Reset to an invalid key. */ 39 /** Reset to an invalid key. */
40 void reset() { 40 void reset() {
41 GR_STATIC_ASSERT((uint16_t)kInvalidDomain == kInvalidDomain); 41 GR_STATIC_ASSERT((uint16_t)kInvalidDomain == kInvalidDomain);
42 fKey.reset(kMetaDataCnt); 42 fKey.reset(kMetaDataCnt);
43 fKey[kHash_MetaDataIdx] = 0; 43 fKey[kHash_MetaDataIdx] = 0;
44 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain; 44 fKey[kDomainAndSize_MetaDataIdx] = kInvalidDomain;
45 } 45 }
46 46
47 bool operator==(const GrResourceKey& that) const { 47 bool operator==(const GrResourceKey& that) const {
48 SkASSERT(this->isValid() && that.isValid());
49 return 0 == memcmp(fKey.get(), that.fKey.get(), this->size()); 48 return 0 == memcmp(fKey.get(), that.fKey.get(), this->size());
50 } 49 }
51 50
52 GrResourceKey& operator=(const GrResourceKey& that) { 51 GrResourceKey& operator=(const GrResourceKey& that) {
53 SkASSERT(that.isValid()); 52 SkASSERT(that.isValid());
54 if (this != &that) { 53 if (this != &that) {
55 size_t bytes = that.size(); 54 size_t bytes = that.size();
56 SkASSERT(SkIsAlign4(bytes)); 55 SkASSERT(SkIsAlign4(bytes));
57 fKey.reset(SkToInt(bytes / sizeof(uint32_t))); 56 fKey.reset(SkToInt(bytes / sizeof(uint32_t)));
58 memcpy(fKey.get(), that.fKey.get(), bytes); 57 memcpy(fKey.get(), that.fKey.get(), bytes);
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 fKey = that.fKey; 277 fKey = that.fKey;
279 return *this; 278 return *this;
280 } 279 }
281 280
282 const GrUniqueKey& key() const { return fKey; } 281 const GrUniqueKey& key() const { return fKey; }
283 282
284 private: 283 private:
285 GrUniqueKey fKey; 284 GrUniqueKey fKey;
286 }; 285 };
287 #endif 286 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698