| 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 |
| 11 #include "GrAtlas.h" | 11 #include "GrAtlas.h" |
| 12 #include "GrPictureUtils.h" | 12 #include "GrPictureUtils.h" |
| 13 #include "GrRect.h" | 13 #include "GrRect.h" |
| 14 |
| 14 #include "SkChecksum.h" | 15 #include "SkChecksum.h" |
| 16 #include "SkMessageBus.h" |
| 15 #include "SkTDynamicHash.h" | 17 #include "SkTDynamicHash.h" |
| 16 #include "SkMessageBus.h" | |
| 17 | 18 |
| 18 class SkPicture; | 19 class SkPicture; |
| 19 | 20 |
| 20 // The layer cache listens for these messages to purge picture-related resources
. | 21 // The layer cache listens for these messages to purge picture-related resources
. |
| 21 struct GrPictureDeletedMessage { | 22 struct GrPictureDeletedMessage { |
| 22 uint32_t pictureID; | 23 uint32_t pictureID; |
| 23 }; | 24 }; |
| 24 | 25 |
| 25 // GrPictureInfo stores the atlas plots used by a single picture. A single | 26 // GrPictureInfo stores the atlas plots used by a single picture. A single |
| 26 // plot may be used to store layers from multiple pictures. | 27 // plot may be used to store layers from multiple pictures. |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 bool operator==(const Key& other) const { | 69 bool operator==(const Key& other) const { |
| 69 return fPictureID == other.fPictureID && | 70 return fPictureID == other.fPictureID && |
| 70 fStart == other.fStart && | 71 fStart == other.fStart && |
| 71 fBounds == other.fBounds && | 72 fBounds == other.fBounds && |
| 72 fCTM.cheapEqualTo(other.fCTM); | 73 fCTM.cheapEqualTo(other.fCTM); |
| 73 } | 74 } |
| 74 | 75 |
| 75 uint32_t pictureID() const { return fPictureID; } | 76 uint32_t pictureID() const { return fPictureID; } |
| 76 int start() const { return fStart; } | 77 int start() const { return fStart; } |
| 77 const SkIRect& bound() const { return fBounds; } | 78 const SkIRect& bound() const { return fBounds; } |
| 78 const SkMatrix& ctm() const { return fCTM; } | |
| 79 | 79 |
| 80 private: | 80 private: |
| 81 // ID of the picture of which this layer is a part | 81 // ID of the picture of which this layer is a part |
| 82 const uint32_t fPictureID; | 82 const uint32_t fPictureID; |
| 83 // The the index of the saveLayer command in the picture | 83 // The the index of the saveLayer command in the picture |
| 84 const int fStart; | 84 const int fStart; |
| 85 // The bounds of the layer. The TL corner is its offset. | 85 // The bounds of the layer. The TL corner is its offset. |
| 86 const SkIRect fBounds; | 86 const SkIRect fBounds; |
| 87 // The 2x2 portion of the CTM applied to this layer in the picture | 87 // The 2x2 portion of the CTM applied to this layer in the picture |
| 88 SkMatrix fCTM; | 88 SkMatrix fCTM; |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 SkASSERT(fPlotLocks[plotIdx] > 0); | 297 SkASSERT(fPlotLocks[plotIdx] > 0); |
| 298 --fPlotLocks[plotIdx]; | 298 --fPlotLocks[plotIdx]; |
| 299 } | 299 } |
| 300 | 300 |
| 301 // for testing | 301 // for testing |
| 302 friend class TestingAccess; | 302 friend class TestingAccess; |
| 303 int numLayers() const { return fLayerHash.count(); } | 303 int numLayers() const { return fLayerHash.count(); } |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 #endif | 306 #endif |
| OLD | NEW |