OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef GrLayerCache_DEFINED | 8 #ifndef GrLayerCache_DEFINED |
9 #define GrLayerCache_DEFINED | 9 #define GrLayerCache_DEFINED |
10 | 10 |
(...skipping 16 matching lines...) Expand all Loading... |
27 // plot may be used to store layers from multiple pictures. | 27 // plot may be used to store layers from multiple pictures. |
28 struct GrPictureInfo { | 28 struct GrPictureInfo { |
29 public: | 29 public: |
30 static const int kNumPlots = 4; | 30 static const int kNumPlots = 4; |
31 | 31 |
32 // for SkTDynamicHash - just use the pictureID as the hash key | 32 // for SkTDynamicHash - just use the pictureID as the hash key |
33 static const uint32_t& GetKey(const GrPictureInfo& pictInfo) { return pictIn
fo.fPictureID; } | 33 static const uint32_t& GetKey(const GrPictureInfo& pictInfo) { return pictIn
fo.fPictureID; } |
34 static uint32_t Hash(const uint32_t& key) { return SkChecksum::Mix(key); } | 34 static uint32_t Hash(const uint32_t& key) { return SkChecksum::Mix(key); } |
35 | 35 |
36 // GrPictureInfo proper | 36 // GrPictureInfo proper |
37 GrPictureInfo(uint32_t pictureID) | 37 GrPictureInfo(uint32_t pictureID) |
38 : fPictureID(pictureID) | 38 : fPictureID(pictureID) |
39 , fPlotUsage(kNumPlots) { | 39 , fPlotUsage(kNumPlots) { |
40 #if !GR_CACHE_HOISTED_LAYERS | 40 #if !GR_CACHE_HOISTED_LAYERS |
41 memset(fPlotUses, 0, sizeof(fPlotUses)); | 41 memset(fPlotUses, 0, sizeof(fPlotUses)); |
42 #endif | 42 #endif |
43 } | 43 } |
44 | 44 |
45 #if !GR_CACHE_HOISTED_LAYERS | 45 #if !GR_CACHE_HOISTED_LAYERS |
46 void incPlotUsage(int plotID) { | 46 void incPlotUsage(int plotID) { |
47 SkASSERT(plotID < kNumPlots); | 47 SkASSERT(plotID < kNumPlots); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 SkASSERT(fPlotLocks[plotIdx] > 0); | 423 SkASSERT(fPlotLocks[plotIdx] > 0); |
424 --fPlotLocks[plotIdx]; | 424 --fPlotLocks[plotIdx]; |
425 } | 425 } |
426 | 426 |
427 // for testing | 427 // for testing |
428 friend class TestingAccess; | 428 friend class TestingAccess; |
429 int numLayers() const { return fLayerHash.count(); } | 429 int numLayers() const { return fLayerHash.count(); } |
430 }; | 430 }; |
431 | 431 |
432 #endif | 432 #endif |
OLD | NEW |