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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 | 131 |
132 void validate() const { | 132 void validate() const { |
133 SkASSERT(fKey[kHash_MetaDataIdx] == | 133 SkASSERT(fKey[kHash_MetaDataIdx] == |
134 GrResourceKeyHash(&fKey[kHash_MetaDataIdx] + 1, | 134 GrResourceKeyHash(&fKey[kHash_MetaDataIdx] + 1, |
135 this->internalSize() - sizeof(uint32_t))); | 135 this->internalSize() - sizeof(uint32_t))); |
136 SkASSERT(SkIsAlign4(this->internalSize())); | 136 SkASSERT(SkIsAlign4(this->internalSize())); |
137 } | 137 } |
138 | 138 |
139 friend class TestResource; // For unit test to access kMetaDataCnt. | 139 friend class TestResource; // For unit test to access kMetaDataCnt. |
140 | 140 |
141 // bmp textures require 4 uint32_t values. | 141 // bmp textures require 5 uint32_t values. |
142 SkAutoSTMalloc<kMetaDataCnt + 4, uint32_t> fKey; | 142 SkAutoSTMalloc<kMetaDataCnt + 5, uint32_t> fKey; |
143 }; | 143 }; |
144 | 144 |
145 /** | 145 /** |
146 * A key used for scratch resources. There are three important rules about scrat
ch keys: | 146 * A key used for scratch resources. There are three important rules about scrat
ch keys: |
147 * * Multiple resources can share the same scratch key. Therefore resourc
es assigned the same | 147 * * Multiple resources can share the same scratch key. Therefore resourc
es assigned the same |
148 * scratch key should be interchangeable with respect to the code that
uses them. | 148 * scratch key should be interchangeable with respect to the code that
uses them. |
149 * * A resource can have at most one scratch key and it is set at resourc
e creation by the | 149 * * A resource can have at most one scratch key and it is set at resourc
e creation by the |
150 * resource itself. | 150 * resource itself. |
151 * * When a scratch resource is ref'ed it will not be returned from the | 151 * * When a scratch resource is ref'ed it will not be returned from the |
152 * cache for a subsequent cache request until all refs are released. Th
is facilitates using | 152 * cache for a subsequent cache request until all refs are released. Th
is facilitates using |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 fKey = that.fKey; | 312 fKey = that.fKey; |
313 return *this; | 313 return *this; |
314 } | 314 } |
315 | 315 |
316 const GrUniqueKey& key() const { return fKey; } | 316 const GrUniqueKey& key() const { return fKey; } |
317 | 317 |
318 private: | 318 private: |
319 GrUniqueKey fKey; | 319 GrUniqueKey fKey; |
320 }; | 320 }; |
321 #endif | 321 #endif |
OLD | NEW |