diff options
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/render/cpdf_imagecacheentry.cpp | 19 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imagecacheentry.h | 4 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.cpp | 14 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.h | 6 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imagerenderer.cpp | 15 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.cpp | 9 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_pagerendercache.h | 4 |
7 files changed, 26 insertions, 45 deletions
diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.cpp b/core/fpdfapi/render/cpdf_imagecacheentry.cpp index 74e0bf16d7..6ea1caf68f 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.cpp +++ b/core/fpdfapi/render/cpdf_imagecacheentry.cpp @@ -51,21 +51,20 @@ CFX_RetainPtr<CFX_DIBSource> CPDF_ImageCacheEntry::DetachMask() { return std::move(m_pCurMask); } -int CPDF_ImageCacheEntry::StartGetCachedBitmap(CPDF_Dictionary* pFormResources, - CPDF_Dictionary* pPageResources, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t downsampleWidth, - int32_t downsampleHeight) { +int CPDF_ImageCacheEntry::StartGetCachedBitmap( + CPDF_Dictionary* pFormResources, + CPDF_Dictionary* pPageResources, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus) { + ASSERT(pRenderStatus); + if (m_pCachedBitmap) { m_pCurBitmap = m_pCachedBitmap; m_pCurMask = m_pCachedMask; return 1; } - if (!pRenderStatus) - return 0; m_pCurBitmap = pdfium::MakeRetain<CPDF_DIBSource>(); int ret = m_pCurBitmap.As<CPDF_DIBSource>()->StartLoadDIBSource( diff --git a/core/fpdfapi/render/cpdf_imagecacheentry.h b/core/fpdfapi/render/cpdf_imagecacheentry.h index b908fb78d0..0909f80da9 100644 --- a/core/fpdfapi/render/cpdf_imagecacheentry.h +++ b/core/fpdfapi/render/cpdf_imagecacheentry.h @@ -36,9 +36,7 @@ class CPDF_ImageCacheEntry { bool bStdCS, uint32_t GroupFamily, bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t downsampleWidth, - int32_t downsampleHeight); + CPDF_RenderStatus* pRenderStatus); int Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); CFX_RetainPtr<CFX_DIBSource> DetachBitmap(); CFX_RetainPtr<CFX_DIBSource> DetachMask(); diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp index af441a5b00..bf540c610d 100644 --- a/core/fpdfapi/render/cpdf_imageloader.cpp +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -17,8 +17,6 @@ CPDF_ImageLoader::CPDF_ImageLoader() : m_MatteColor(0), m_bCached(false), - m_nDownsampleWidth(0), - m_nDownsampleHeight(0), m_pCache(nullptr), m_pImage(nullptr) {} @@ -29,18 +27,14 @@ bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, bool bStdCS, uint32_t GroupFamily, bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t nDownsampleWidth, - int32_t nDownsampleHeight) { - m_nDownsampleWidth = nDownsampleWidth; - m_nDownsampleHeight = nDownsampleHeight; + CPDF_RenderStatus* pRenderStatus) { m_pCache = pCache; m_pImage = const_cast<CPDF_ImageObject*>(pImage); bool ret; if (pCache) { - ret = pCache->StartGetCachedBitmap( - m_pImage->GetImage()->GetStream(), bStdCS, GroupFamily, bLoadMask, - pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); + ret = + pCache->StartGetCachedBitmap(m_pImage->GetImage()->GetStream(), bStdCS, + GroupFamily, bLoadMask, pRenderStatus); } else { ret = m_pImage->GetImage()->StartLoadDIBSource( pRenderStatus->m_pFormResource, pRenderStatus->m_pPageResource, bStdCS, diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h index 4b2119455e..d7c6f60fcc 100644 --- a/core/fpdfapi/render/cpdf_imageloader.h +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -26,9 +26,7 @@ class CPDF_ImageLoader { bool bStdCS, uint32_t GroupFamily, bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t nDownsampleWidth, - int32_t nDownsampleHeight); + CPDF_RenderStatus* pRenderStatus); bool Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); CFX_RetainPtr<CFX_DIBSource> m_pBitmap; @@ -39,8 +37,6 @@ class CPDF_ImageLoader { private: void HandleFailure(); - int32_t m_nDownsampleWidth; - int32_t m_nDownsampleHeight; CPDF_PageRenderCache* m_pCache; CPDF_ImageObject* m_pImage; }; diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index 12c354076b..22eb32b4e9 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -59,14 +59,10 @@ bool CPDF_ImageRenderer::StartLoadDIBSource() { if (!image_rect.Valid()) return false; - int dest_width = - m_ImageMatrix.a >= 0 ? image_rect.Width() : -image_rect.Width(); - int dest_height = - m_ImageMatrix.d <= 0 ? image_rect.Height() : -image_rect.Height(); - if (m_Loader.Start( - m_pImageObject, m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS, - m_pRenderStatus->m_GroupFamily, m_pRenderStatus->m_bLoadMask, - m_pRenderStatus, dest_width, dest_height)) { + if (m_Loader.Start(m_pImageObject, + m_pRenderStatus->m_pContext->GetPageCache(), m_bStdCS, + m_pRenderStatus->m_GroupFamily, + m_pRenderStatus->m_bLoadMask, m_pRenderStatus)) { m_Status = 4; return true; } @@ -284,7 +280,8 @@ bool CPDF_ImageRenderer::DrawPatternImage(const CFX_Matrix* pObj2Device) { &m_pRenderStatus->m_Options, 0, m_pRenderStatus->m_bDropObjects, nullptr, true); CFX_Matrix patternDevice = *pObj2Device; - patternDevice.Translate((float)-rect.left, (float)-rect.top); + patternDevice.Translate(static_cast<float>(-rect.left), + static_cast<float>(-rect.top)); if (CPDF_TilingPattern* pTilingPattern = m_pPattern->AsTilingPattern()) { bitmap_render.DrawTilingPattern(pTilingPattern, m_pImageObject, &patternDevice, false); diff --git a/core/fpdfapi/render/cpdf_pagerendercache.cpp b/core/fpdfapi/render/cpdf_pagerendercache.cpp index 2fa7220409..e427627a9b 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.cpp +++ b/core/fpdfapi/render/cpdf_pagerendercache.cpp @@ -19,7 +19,8 @@ struct CACHEINFO { extern "C" { static int compare(const void* data1, const void* data2) { - return ((CACHEINFO*)data1)->time - ((CACHEINFO*)data2)->time; + return reinterpret_cast<const CACHEINFO*>(data1)->time - + reinterpret_cast<const CACHEINFO*>(data2)->time; } } // extern "C" @@ -84,9 +85,7 @@ bool CPDF_PageRenderCache::StartGetCachedBitmap( bool bStdCS, uint32_t GroupFamily, bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t downsampleWidth, - int32_t downsampleHeight) { + CPDF_RenderStatus* pRenderStatus) { const auto it = m_ImageCache.find(pStream); m_bCurFindCache = it != m_ImageCache.end(); if (m_bCurFindCache) { @@ -97,7 +96,7 @@ bool CPDF_PageRenderCache::StartGetCachedBitmap( } int ret = m_pCurImageCacheEntry->StartGetCachedBitmap( pRenderStatus->m_pFormResource, m_pPage->m_pPageResources, bStdCS, - GroupFamily, bLoadMask, pRenderStatus, downsampleWidth, downsampleHeight); + GroupFamily, bLoadMask, pRenderStatus); if (ret == 2) return true; diff --git a/core/fpdfapi/render/cpdf_pagerendercache.h b/core/fpdfapi/render/cpdf_pagerendercache.h index e6528ddeea..8235cec22d 100644 --- a/core/fpdfapi/render/cpdf_pagerendercache.h +++ b/core/fpdfapi/render/cpdf_pagerendercache.h @@ -39,9 +39,7 @@ class CPDF_PageRenderCache { bool bStdCS, uint32_t GroupFamily, bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t downsampleWidth, - int32_t downsampleHeight); + CPDF_RenderStatus* pRenderStatus); bool Continue(IFX_Pause* pPause, CPDF_RenderStatus* pRenderStatus); |