void CPDF_PageRenderCache::GetCachedBitmap(CPDF_Stream* pStream, CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, FX_BOOL bStdCS, FX_DWORD GroupFamily, FX_BOOL bLoadMask, CPDF_RenderStatus* pRenderStatus, int32_t downsampleWidth, int32_t downsampleHeight) { CPDF_ImageCache* pImageCache; FX_BOOL bFind = m_ImageCaches.Lookup(pStream, (void*&)pImageCache); if (!bFind) { pImageCache = new CPDF_ImageCache(m_pPage->m_pDocument, pStream); } m_nTimeCount++; FX_BOOL bCached = pImageCache->GetCachedBitmap( pBitmap, pMask, MatteColor, m_pPage->m_pPageResources, bStdCS, GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); if (!bFind) { m_ImageCaches.SetAt(pStream, pImageCache); } if (!bCached) { m_nCacheSize += pImageCache->EstimateSize(); } }
FX_DWORD CPDF_PageRenderCache::GetCachedSize(CPDF_Stream* pStream) const { if (pStream == NULL) { return m_nCacheSize; } CPDF_ImageCache* pImageCache; if (!m_ImageCaches.Lookup(pStream, (void*&)pImageCache)) { return 0; } return pImageCache->EstimateSize(); }
void CPDF_PageRenderCache::ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap) { CPDF_ImageCache* pImageCache; if (!m_ImageCaches.Lookup(pStream, (FX_LPVOID&)pImageCache)) { if (pBitmap == NULL) { return; } pImageCache = FX_NEW CPDF_ImageCache(m_pPage->m_pDocument, pStream); m_ImageCaches.SetAt(pStream, pImageCache); } int oldsize = pImageCache->EstimateSize(); pImageCache->Reset(pBitmap); m_nCacheSize = pImageCache->EstimateSize() - oldsize; }