32 const Size& rPreviewSize,
33 const bool bDoSuperSampling,
35 : maRequestQueue(rpCacheContext),
36 mpCacheContext(rpCacheContext),
37 maPreviewSize(rPreviewSize),
38 mbDoSuperSampling(bDoSuperSampling)
43 "GenericPageCache<>::GetPreviewBitmap(): bitmap requested with large width. "
44 "This may indicate an error.");
76 const Size& rPreviewSize,
77 const bool bDoSuperSampling)
85 "GenericPageCache<>::GetPreviewBitmap(): bitmap requested with large width. "
86 "This may indicate an error.");
106 assert(aKey !=
nullptr);
109 bool bMayBeUpToDate =
true;
120 if (bResize && !aBitmapSize.
IsEmpty())
124 bMayBeUpToDate =
false;
127 bMayBeUpToDate =
true;
130 bMayBeUpToDate =
false;
143 assert(aKey !=
nullptr);
149 return aMarkedPreview;
156 assert(aKey !=
nullptr);
165 const bool bMayBeUpToDate)
167 assert(aKey !=
nullptr);
174 bool bIsUpToDate =
false;
203 std::shared_ptr<cache::PageCacheManager> pCacheManager (
206 return pCacheManager->InvalidatePreviewBitmap(
235 const bool bIsPrecious)
bool Scale(const Size &rNewSize, BmpScaleFlag nScaleFlag=BmpScaleFlag::Default)
const Size & GetSizePixel() const
constexpr tools::Long Height() const
constexpr tools::Long Width() const
void RequestPreviewBitmap(const CacheKey aKey, const bool bMayBeUpToDate)
When the requested preview bitmap does not yet exist or is not up-to-date then the rendering of one i...
void ProvideCacheAndProcessor()
Both bitmap cache and queue processor are created on demand by this method.
void SetPreciousFlag(const CacheKey aKey, const bool bIsPrecious)
With the precious flag you can control whether a bitmap can be removed from the cache or reduced in s...
void ChangePreviewSize(const Size &rPreviewSize, const bool bDoSuperSampling)
Change the size of the preview bitmaps.
BitmapEx GetMarkedPreviewBitmap(const CacheKey aKey)
BitmapEx GetPreviewBitmap(const CacheKey aKey, const bool bResize)
Request a preview bitmap for the specified page object in the specified size.
GenericPageCache(const Size &rPreviewSize, const bool bDoSuperSampling, const SharedCacheContext &rpCacheContext)
The page cache is created with a reference to the SlideSorter and thus has access to both view and mo...
std::unique_ptr< QueueProcessor > mpQueueProcessor
void InvalidateCache()
Call this method when all preview bitmaps have to be generated anew.
Size maPreviewSize
The current size of preview bitmaps.
RequestQueue maRequestQueue
std::shared_ptr< BitmapCache > mpBitmapCache
bool InvalidatePreviewBitmap(const CacheKey aKey)
Tell the cache to replace the bitmap associated with the given request data with a new one that refle...
SharedCacheContext mpCacheContext
void SetMarkedPreviewBitmap(const CacheKey aKey, const BitmapEx &rMarkedBitmap)
static std::shared_ptr< PageCacheManager > Instance()
Return the one instance of the PageCacheManager class.
This queue processor is timer based, i.e.
bool RemoveRequest(CacheKey aKey)
Remove the specified request from the queue.
void AddRequest(CacheKey aKey, RequestPriorityClass eRequestClass)
Insert a request with highest or lowest priority in its priority class.
void Clear()
Remove all requests from the queue.
void ChangeClass(CacheKey aKey, RequestPriorityClass eNewRequestClass)
Change the priority class of the specified request.
#define DBG_ASSERT(sCon, aError)
RequestPriorityClass
Each request for a preview creation has a priority.
@ VISIBLE_OUTDATED_PREVIEW
std::shared_ptr< CacheContext > SharedCacheContext