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 | 9 |
10 #include "GrResourceCache2.h" | 10 #include "GrResourceCache2.h" |
11 #include "GrGpuResource.h" | 11 #include "GrGpuResource.h" |
12 | 12 |
13 #include "SkChecksum.h" | 13 #include "SkChecksum.h" |
14 #include "SkGr.h" | 14 #include "SkGr.h" |
15 #include "SkMessageBus.h" | 15 #include "SkMessageBus.h" |
16 | 16 |
17 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage); | 17 DECLARE_SKMESSAGEBUS_MESSAGE(GrResourceInvalidatedMessage); |
18 | 18 |
19 ////////////////////////////////////////////////////////////////////////////// | 19 ////////////////////////////////////////////////////////////////////////////// |
20 | 20 |
21 GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() { | 21 GrScratchKey::ResourceType GrScratchKey::GenerateResourceType() { |
22 static int32_t gType = kInvalidResourceType + 1; | 22 static int32_t gType = kInvalidResourceType + 1; |
23 | 23 |
24 int32_t type = sk_atomic_inc(&gType); | 24 ResourceType type = static_cast<ResourceType>(sk_atomic_inc(&gType)); |
25 if (kInvalidResourceType == type) { | 25 if (kInvalidResourceType == type) { |
26 SkFAIL("Too many Resource Types"); | 26 SkFAIL("Too many Resource Types"); |
27 } | 27 } |
28 | 28 |
29 return static_cast<ResourceType>(type); | 29 return type; |
30 } | 30 } |
31 | 31 |
32 | 32 |
33 void GrScratchKey::Builder::finish() { | 33 void GrScratchKey::Builder::finish() { |
34 if (NULL == fKey) { | 34 if (NULL == fKey) { |
35 return; | 35 return; |
36 } | 36 } |
37 GR_STATIC_ASSERT(0 == kHash_MetaDataIdx); | 37 GR_STATIC_ASSERT(0 == kHash_MetaDataIdx); |
38 fKey->fKey[kHash_MetaDataIdx] = | 38 fKey->fKey[kHash_MetaDataIdx] = |
39 SkChecksum::Compute(&fKey->fKey[kHash_MetaDataIdx + 1], fKey->size() - s
izeof(uint32_t)); | 39 SkChecksum::Compute(&fKey->fKey[kHash_MetaDataIdx + 1], fKey->size() - s
izeof(uint32_t)); |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); | 484 SkDebugf("Budget: %d items %d bytes\n", fMaxCount, fMaxBytes); |
485 SkDebugf("\t\tEntry Count: current %d" | 485 SkDebugf("\t\tEntry Count: current %d" |
486 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", | 486 " (%d budgeted, %d wrapped, %d locked, %d scratch %.2g%% full), hig
h %d\n", |
487 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); | 487 fCount, fBudgetedCount, wrapped, locked, scratch, countUtilization, fHig
hWaterCount); |
488 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", | 488 SkDebugf("\t\tEntry Bytes: current %d (budgeted %d, %.2g%% full, %d unbudget
ed) high %d\n", |
489 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); | 489 fBytes, fBudgetedBytes, byteUtilization, unbudgetedSize, fHighWa
terBytes); |
490 } | 490 } |
491 | 491 |
492 #endif | 492 #endif |
OLD | NEW |