LibreOffice Module sd (master) 1
|
This basically is the implementation class for the PageCache class. More...
#include <SlsGenericPageCache.hxx>
Public Member Functions | |
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 model. More... | |
~GenericPageCache () | |
void | ChangePreviewSize (const Size &rPreviewSize, const bool bDoSuperSampling) |
Change the size of the preview bitmaps. More... | |
BitmapEx | GetPreviewBitmap (const CacheKey aKey, const bool bResize) |
Request a preview bitmap for the specified page object in the specified size. More... | |
BitmapEx | GetMarkedPreviewBitmap (const CacheKey aKey) |
void | SetMarkedPreviewBitmap (const CacheKey aKey, const BitmapEx &rMarkedBitmap) |
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 is scheduled. More... | |
bool | InvalidatePreviewBitmap (const CacheKey aKey) |
Tell the cache to replace the bitmap associated with the given request data with a new one that reflects recent changes in the content of the page object. More... | |
void | InvalidateCache () |
Call this method when all preview bitmaps have to be generated anew. More... | |
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 size to make room for other bitmaps or is so precious that it will not be touched. More... | |
void | Pause () |
void | Resume () |
Private Member Functions | |
void | ProvideCacheAndProcessor () |
Both bitmap cache and queue processor are created on demand by this method. More... | |
Private Attributes | |
std::shared_ptr< BitmapCache > | mpBitmapCache |
RequestQueue | maRequestQueue |
std::unique_ptr< QueueProcessor > | mpQueueProcessor |
SharedCacheContext | mpCacheContext |
Size | maPreviewSize |
The current size of preview bitmaps. More... | |
bool | mbDoSuperSampling |
This basically is the implementation class for the PageCache class.
Definition at line 34 of file SlsGenericPageCache.hxx.
sd::slidesorter::cache::GenericPageCache::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 model.
This allows the cache to fill itself with requests for all pages or just the visible ones.
rPreviewSize | The size of the previews is expected in pixel values. |
bDoSuperSampling | When <TRUE> the previews are rendered larger and then scaled down to the requested size to improve image quality. |
Definition at line 31 of file SlsGenericPageCache.cxx.
References DBG_ASSERT, Size::Height(), maPreviewSize, and Size::Width().
sd::slidesorter::cache::GenericPageCache::~GenericPageCache | ( | ) |
Definition at line 47 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::RequestQueue::Clear(), sd::slidesorter::cache::PageCacheManager::Instance(), maRequestQueue, mpBitmapCache, and mpQueueProcessor.
void sd::slidesorter::cache::GenericPageCache::ChangePreviewSize | ( | const Size & | rPreviewSize, |
const bool | bDoSuperSampling | ||
) |
Change the size of the preview bitmaps.
This may be caused by a resize of the slide sorter window or a change of the number of columns.
Definition at line 75 of file SlsGenericPageCache.cxx.
References DBG_ASSERT, Size::Height(), sd::slidesorter::cache::PageCacheManager::Instance(), maPreviewSize, mbDoSuperSampling, mpBitmapCache, mpQueueProcessor, and Size::Width().
Definition at line 140 of file SlsGenericPageCache.cxx.
References mpBitmapCache, mpCacheContext, and ProvideCacheAndProcessor().
BitmapEx sd::slidesorter::cache::GenericPageCache::GetPreviewBitmap | ( | const CacheKey | aKey, |
const bool | bResize | ||
) |
Request a preview bitmap for the specified page object in the specified size.
The returned bitmap may be a preview of the preview, i.e. either a scaled (up or down) version of a previous preview (of the wrong size) or an empty bitmap. In this case a request for the generation of a new preview is created and inserted into the request queue. When the preview is available the page shape will be told to paint itself again. When it then calls this method again if receives the correctly sized preview bitmap.
rRequestData | This data is used to determine the preview. |
bResize | When <TRUE> then when the available bitmap has not the requested size, it is scaled before it is returned. When <FALSE> then the bitmap is returned in the wrong size and it is the task of the caller to scale it. |
Definition at line 102 of file SlsGenericPageCache.cxx.
References BitmapEx::GetSizePixel(), Size::IsEmpty(), maPreviewSize, mpBitmapCache, mpCacheContext, ProvideCacheAndProcessor(), RequestPreviewBitmap(), and BitmapEx::Scale().
void sd::slidesorter::cache::GenericPageCache::InvalidateCache | ( | ) |
Call this method when all preview bitmaps have to be generated anew.
This is the case when the size of the page objects on the screen has changed or when the model has changed.
Definition at line 215 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::RequestQueue::Clear(), maRequestQueue, mpBitmapCache, mpCacheContext, and mpQueueProcessor.
bool sd::slidesorter::cache::GenericPageCache::InvalidatePreviewBitmap | ( | const CacheKey | aKey | ) |
Tell the cache to replace the bitmap associated with the given request data with a new one that reflects recent changes in the content of the page object.
Definition at line 200 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::PageCacheManager::Instance(), mpBitmapCache, and mpCacheContext.
void sd::slidesorter::cache::GenericPageCache::Pause | ( | ) |
Definition at line 262 of file SlsGenericPageCache.cxx.
References mpQueueProcessor, and ProvideCacheAndProcessor().
|
private |
Both bitmap cache and queue processor are created on demand by this method.
Definition at line 59 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::PageCacheManager::Instance(), maPreviewSize, maRequestQueue, mbDoSuperSampling, mpBitmapCache, mpCacheContext, and mpQueueProcessor.
Referenced by GetMarkedPreviewBitmap(), GetPreviewBitmap(), Pause(), RequestPreviewBitmap(), Resume(), SetMarkedPreviewBitmap(), and SetPreciousFlag().
void sd::slidesorter::cache::GenericPageCache::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 is scheduled.
Otherwise this method does nothing.
rRequestData | This data is used to determine the preview. |
bMayBeUpToDate | This flag helps the method to determine whether an existing preview that matches the request is up to date. If the caller knows that it is not then by passing <FALSE> he tells us that we do not have to check the up-to-date flag a second time. If unsure use <TRUE>. |
Definition at line 163 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::RequestQueue::AddRequest(), BitmapEx::GetSizePixel(), BitmapEx::IsEmpty(), maPreviewSize, maRequestQueue, mpBitmapCache, mpCacheContext, mpQueueProcessor, sd::slidesorter::cache::NOT_VISIBLE, ProvideCacheAndProcessor(), sd::slidesorter::cache::VISIBLE_NO_PREVIEW, and sd::slidesorter::cache::VISIBLE_OUTDATED_PREVIEW.
Referenced by GetPreviewBitmap().
void sd::slidesorter::cache::GenericPageCache::Resume | ( | ) |
Definition at line 269 of file SlsGenericPageCache.cxx.
References mpQueueProcessor, and ProvideCacheAndProcessor().
void sd::slidesorter::cache::GenericPageCache::SetMarkedPreviewBitmap | ( | const CacheKey | aKey, |
const BitmapEx & | rMarkedBitmap | ||
) |
Definition at line 152 of file SlsGenericPageCache.cxx.
References mpBitmapCache, mpCacheContext, and ProvideCacheAndProcessor().
void sd::slidesorter::cache::GenericPageCache::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 size to make room for other bitmaps or is so precious that it will not be touched.
A typical use is to set the precious flag for the visible pages.
Definition at line 233 of file SlsGenericPageCache.cxx.
References sd::slidesorter::cache::RequestQueue::ChangeClass(), maRequestQueue, mpBitmapCache, mpCacheContext, sd::slidesorter::cache::NOT_VISIBLE, ProvideCacheAndProcessor(), sd::slidesorter::cache::RequestQueue::RemoveRequest(), sd::slidesorter::cache::VISIBLE_NO_PREVIEW, and sd::slidesorter::cache::VISIBLE_OUTDATED_PREVIEW.
|
private |
The current size of preview bitmaps.
Definition at line 140 of file SlsGenericPageCache.hxx.
Referenced by ChangePreviewSize(), GenericPageCache(), GetPreviewBitmap(), ProvideCacheAndProcessor(), and RequestPreviewBitmap().
|
private |
Definition at line 132 of file SlsGenericPageCache.hxx.
Referenced by InvalidateCache(), ProvideCacheAndProcessor(), RequestPreviewBitmap(), SetPreciousFlag(), and ~GenericPageCache().
|
private |
Definition at line 142 of file SlsGenericPageCache.hxx.
Referenced by ChangePreviewSize(), and ProvideCacheAndProcessor().
|
private |
Definition at line 130 of file SlsGenericPageCache.hxx.
Referenced by ChangePreviewSize(), GetMarkedPreviewBitmap(), GetPreviewBitmap(), InvalidateCache(), InvalidatePreviewBitmap(), ProvideCacheAndProcessor(), RequestPreviewBitmap(), SetMarkedPreviewBitmap(), SetPreciousFlag(), and ~GenericPageCache().
|
private |
Definition at line 136 of file SlsGenericPageCache.hxx.
Referenced by GetMarkedPreviewBitmap(), GetPreviewBitmap(), InvalidateCache(), InvalidatePreviewBitmap(), ProvideCacheAndProcessor(), RequestPreviewBitmap(), SetMarkedPreviewBitmap(), and SetPreciousFlag().
|
private |
Definition at line 134 of file SlsGenericPageCache.hxx.
Referenced by ChangePreviewSize(), InvalidateCache(), Pause(), ProvideCacheAndProcessor(), RequestPreviewBitmap(), Resume(), and ~GenericPageCache().