summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-18 15:36:55 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-18 15:36:55 -0800
commitdf663f5fcfc860249ab318407353f0aca907522d (patch)
treec42746a1710764de5601106679fda5ee34d7d17a /core/src
parent0fa6fee0e48af8681f0cd50f6a9471ecc0a46c11 (diff)
downloadpdfium-df663f5fcfc860249ab318407353f0aca907522d.tar.xz
Merge to XFA: CPDF_ImageLoader::Load() unused.
Original Review URL: https://codereview.chromium.org/1535243002 . (cherry picked from commit b5385ba5d0c616cd4af994b2a9d674588086f75c) TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1539003002 .
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp13
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp81
-rw-r--r--core/src/fpdfapi/fpdf_render/render_int.h54
3 files changed, 58 insertions, 90 deletions
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index a9544d3c1b..ea6195dc8e 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -311,7 +311,7 @@ CPDF_ImageRenderer::~CPDF_ImageRenderer() {
if (m_DeviceHandle) {
m_pRenderStatus->m_pDevice->CancelDIBits(m_DeviceHandle);
}
- delete (CPDF_ProgressiveImageLoaderHandle*)m_LoadHandle;
+ delete m_LoadHandle;
delete m_pClone;
}
FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
@@ -325,16 +325,15 @@ FX_BOOL CPDF_ImageRenderer::StartLoadDIBSource() {
if (m_ImageMatrix.d > 0) {
dest_height = -dest_height;
}
- if (m_Loader.StartLoadImage(
- m_pImageObject, m_pRenderStatus->m_pContext->GetPageCache(),
- m_LoadHandle, 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_LoadHandle,
+ m_bStdCS, m_pRenderStatus->m_GroupFamily,
+ m_pRenderStatus->m_bLoadMask, m_pRenderStatus, dest_width,
+ dest_height)) {
if (m_LoadHandle) {
m_Status = 4;
return TRUE;
}
- return FALSE;
}
return FALSE;
}
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index fafba95527..0306ff0227 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -1534,22 +1534,21 @@ void CPDF_DIBSource::ClearImageData() {
}
}
-CPDF_ProgressiveImageLoaderHandle::CPDF_ProgressiveImageLoaderHandle() {
+CPDF_ImageLoaderHandle::CPDF_ImageLoaderHandle() {
m_pImageLoader = NULL;
m_pCache = NULL;
m_pImage = NULL;
}
-CPDF_ProgressiveImageLoaderHandle::~CPDF_ProgressiveImageLoaderHandle() {}
-FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(
- CPDF_ImageLoader* pImageLoader,
- const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
- FX_BOOL bLoadMask,
- CPDF_RenderStatus* pRenderStatus,
- int32_t nDownsampleWidth,
- int32_t nDownsampleHeight) {
+CPDF_ImageLoaderHandle::~CPDF_ImageLoaderHandle() {}
+FX_BOOL CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader,
+ const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ FX_BOOL bStdCS,
+ FX_DWORD GroupFamily,
+ FX_BOOL bLoadMask,
+ CPDF_RenderStatus* pRenderStatus,
+ int32_t nDownsampleWidth,
+ int32_t nDownsampleHeight) {
m_pImageLoader = pImageLoader;
m_pCache = pCache;
m_pImage = (CPDF_ImageObject*)pImage;
@@ -1581,7 +1580,7 @@ FX_BOOL CPDF_ProgressiveImageLoaderHandle::Start(
}
return ret;
}
-FX_BOOL CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause) {
+FX_BOOL CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) {
FX_BOOL ret;
if (m_pCache) {
ret = m_pCache->Continue(pPause);
@@ -1604,49 +1603,25 @@ FX_BOOL CPDF_ProgressiveImageLoaderHandle::Continue(IFX_Pause* pPause) {
}
return ret;
}
-FX_BOOL CPDF_ImageLoader::Load(const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
- FX_BOOL bLoadMask,
- CPDF_RenderStatus* pRenderStatus) {
- if (!pImage) {
- return FALSE;
- }
- if (pCache) {
- pCache->GetCachedBitmap(pImage->m_pImage->GetStream(), m_pBitmap, m_pMask,
- m_MatteColor, bStdCS, GroupFamily, bLoadMask,
- pRenderStatus, m_nDownsampleWidth,
- m_nDownsampleHeight);
- m_bCached = TRUE;
- } else {
- m_pBitmap = pImage->m_pImage->LoadDIBSource(&m_pMask, &m_MatteColor, bStdCS,
- GroupFamily, bLoadMask);
- m_bCached = FALSE;
- }
- return FALSE;
-}
-FX_BOOL CPDF_ImageLoader::StartLoadImage(const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- void*& LoadHandle,
- FX_BOOL bStdCS,
- FX_DWORD GroupFamily,
- FX_BOOL bLoadMask,
- CPDF_RenderStatus* pRenderStatus,
- int32_t nDownsampleWidth,
- int32_t nDownsampleHeight) {
+FX_BOOL CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ CPDF_ImageLoaderHandle*& LoadHandle,
+ FX_BOOL bStdCS,
+ FX_DWORD GroupFamily,
+ FX_BOOL bLoadMask,
+ CPDF_RenderStatus* pRenderStatus,
+ int32_t nDownsampleWidth,
+ int32_t nDownsampleHeight) {
m_nDownsampleWidth = nDownsampleWidth;
m_nDownsampleHeight = nDownsampleHeight;
- CPDF_ProgressiveImageLoaderHandle* pLoaderHandle =
- new CPDF_ProgressiveImageLoaderHandle;
- FX_BOOL ret = pLoaderHandle->Start(this, pImage, pCache, bStdCS, GroupFamily,
- bLoadMask, pRenderStatus,
- m_nDownsampleWidth, m_nDownsampleHeight);
- LoadHandle = pLoaderHandle;
- return ret;
+ LoadHandle = new CPDF_ImageLoaderHandle;
+ return LoadHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, bLoadMask,
+ pRenderStatus, m_nDownsampleWidth,
+ m_nDownsampleHeight);
}
-FX_BOOL CPDF_ImageLoader::Continue(void* LoadHandle, IFX_Pause* pPause) {
- return ((CPDF_ProgressiveImageLoaderHandle*)LoadHandle)->Continue(pPause);
+FX_BOOL CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle,
+ IFX_Pause* pPause) {
+ return LoadHandle->Continue(pPause);
}
CPDF_ImageLoader::~CPDF_ImageLoader() {
if (!m_bCached) {
diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h
index 80cf6ca9ff..6a63f61c06 100644
--- a/core/src/fpdfapi/fpdf_render/render_int.h
+++ b/core/src/fpdfapi/fpdf_render/render_int.h
@@ -14,7 +14,9 @@
#include "third_party/base/nonstd_unique_ptr.h"
class CFX_GlyphBitmap;
+class CFX_ImageTransformer;
class CPDF_ImageCacheEntry;
+class CPDF_ImageLoaderHandle;
class ICodec_ScanlineDecoder;
#define TYPE3_MAX_BLUES 16
@@ -266,33 +268,26 @@ class CPDF_RenderStatus {
};
class CPDF_ImageLoader {
public:
- CPDF_ImageLoader() {
- m_pBitmap = NULL;
- m_pMask = NULL;
- m_MatteColor = 0;
- m_bCached = FALSE;
- m_nDownsampleWidth = 0;
- m_nDownsampleHeight = 0;
- }
+ CPDF_ImageLoader()
+ : m_pBitmap(nullptr),
+ m_pMask(nullptr),
+ m_MatteColor(0),
+ m_bCached(FALSE),
+ m_nDownsampleWidth(0),
+ m_nDownsampleHeight(0) {}
+ ~CPDF_ImageLoader();
- FX_BOOL Load(const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = NULL);
+ FX_BOOL Start(const CPDF_ImageObject* pImage,
+ CPDF_PageRenderCache* pCache,
+ CPDF_ImageLoaderHandle*& LoadHandle,
+ FX_BOOL bStdCS = FALSE,
+ FX_DWORD GroupFamily = 0,
+ FX_BOOL bLoadMask = FALSE,
+ CPDF_RenderStatus* pRenderStatus = NULL,
+ int32_t nDownsampleWidth = 0,
+ int32_t nDownsampleHeight = 0);
+ FX_BOOL Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause);
- FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage,
- CPDF_PageRenderCache* pCache,
- void*& LoadHandle,
- FX_BOOL bStdCS = FALSE,
- FX_DWORD GroupFamily = 0,
- FX_BOOL bLoadMask = FALSE,
- CPDF_RenderStatus* pRenderStatus = NULL,
- int32_t nDownsampleWidth = 0,
- int32_t nDownsampleHeight = 0);
- FX_BOOL Continue(void* LoadHandle, IFX_Pause* pPause);
- ~CPDF_ImageLoader();
CFX_DIBSource* m_pBitmap;
CFX_DIBSource* m_pMask;
FX_DWORD m_MatteColor;
@@ -302,10 +297,10 @@ class CPDF_ImageLoader {
int32_t m_nDownsampleWidth;
int32_t m_nDownsampleHeight;
};
-class CPDF_ProgressiveImageLoaderHandle {
+class CPDF_ImageLoaderHandle {
public:
- CPDF_ProgressiveImageLoaderHandle();
- ~CPDF_ProgressiveImageLoaderHandle();
+ CPDF_ImageLoaderHandle();
+ ~CPDF_ImageLoaderHandle();
FX_BOOL Start(CPDF_ImageLoader* pImageLoader,
const CPDF_ImageObject* pImage,
@@ -325,7 +320,6 @@ class CPDF_ProgressiveImageLoaderHandle {
int32_t m_nDownsampleWidth;
int32_t m_nDownsampleHeight;
};
-class CFX_ImageTransformer;
class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
public:
@@ -365,7 +359,7 @@ class CPDF_ImageRenderer : public IPDF_ObjectRenderer {
FX_DWORD m_Flags;
CFX_ImageTransformer* m_pTransformer;
void* m_DeviceHandle;
- void* m_LoadHandle;
+ CPDF_ImageLoaderHandle* m_LoadHandle;
FX_BOOL m_bStdCS;
int m_BlendType;
FX_BOOL StartBitmapAlpha();