| 57 | */ |
| 58 | |
| 59 | class ImageCacheEntry |
| 60 | { |
| 61 | public: |
| 62 | /** |
| 63 | * @brief Constructor |
| 64 | * On creation, the entry is in "open" state and will be closed once the data has been |
| 65 | * committed with "close". |
| 66 | * "Precious" entries will be preserved as far as possible. |
| 67 | */ |
| 68 | ImageCacheEntry (const lay::Viewport &vp, const std::vector<lay::RedrawLayerInfo> &layers, bool precious); |
| 69 | |
| 70 | /** |
| 71 | * @brief Returns a value indicating whether the entry complies with the given viewport |
| 72 | */ |
| 73 | bool equals (const lay::Viewport &vp, const std::vector<lay::RedrawLayerInfo> &layers) const; |
| 74 | |
| 75 | /** |
| 76 | * @brief Closes the entry and stores the given data |
| 77 | */ |
| 78 | void close (const BitmapCanvasData &data); |
| 79 | |
| 80 | /** |
| 81 | * @brief Returns a value indicating whether the entry is opened |
| 82 | */ |
| 83 | bool opened () const |
| 84 | { |
| 85 | return m_opened; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * @brief Returns a value indicating whether the entry is precious |
| 90 | */ |
| 91 | bool precious () const |
| 92 | { |
| 93 | return m_precious; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * @brief Sets a value indicating whether the entry is precious |
| 98 | */ |
| 99 | void set_precious (bool p) |
| 100 | { |
| 101 | m_precious = p; |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @brief Gets the stored bitmap data |
| 106 | */ |
| 107 | const BitmapCanvasData &data () const |
| 108 | { |
| 109 | return m_data; |
| 110 | } |
| 111 | |
| 112 | /** |
| 113 | * @brief Swaps this entry with another one |
| 114 | */ |
| 115 | void swap (ImageCacheEntry &other); |
| 116 | |