| 79 | |
| 80 | |
| 81 | void UBSceneCache::insert (std::shared_ptr<UBDocumentProxy> proxy, int pageIndex, std::shared_ptr<UBGraphicsScene> scene) |
| 82 | { |
| 83 | // remove all entries pointing to this scene |
| 84 | const auto keylist = mSceneCache.keys(); |
| 85 | |
| 86 | for (const auto& key : keylist) |
| 87 | { |
| 88 | auto entry = mSceneCache.value(key); |
| 89 | |
| 90 | if (entry->isSceneAvailable() && entry->scene() == scene) |
| 91 | { |
| 92 | mSceneCache.remove(key); |
| 93 | mCachedKeyFIFO.removeAll(key); |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | UBSceneCacheID key{proxy, pageIndex}; |
| 98 | insertEntry(key, std::make_shared<SceneCacheEntry>(scene)); |
| 99 | |
| 100 | // restore view state |
| 101 | if (mViewStates.contains(key)) |
| 102 | { |
| 103 | scene->setViewState(mViewStates.value(key)); |
| 104 | } |
| 105 | } |
| 106 | |
| 107 | |
| 108 | bool UBSceneCache::contains(std::shared_ptr<UBDocumentProxy> proxy, int pageIndex) const |
no test coverage detected