diff options
author | npm <npm@chromium.org> | 2016-11-21 07:28:42 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-21 07:28:43 -0800 |
commit | ca5300a2cb1332dbdcf877653658910ccdad5326 (patch) | |
tree | 0cbffc8e05edb58171951a984e1b029b7f9aff38 | |
parent | 88cb0a32586cae4d00654c679dbb41fa0133c3e5 (diff) | |
download | pdfium-ca5300a2cb1332dbdcf877653658910ccdad5326.tar.xz |
Continue splitting up render_int
Moved CPDF_ImageLoader, CPDF_ImageLoaderHandle, and CPDF_TransferFunc
Review-Url: https://codereview.chromium.org/2518553002
-rw-r--r-- | BUILD.gn | 4 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_generalstate.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_docrenderdata.cpp | 1 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.cpp | 136 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_imageloader.h | 47 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_renderstatus.cpp | 21 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_transferfunc.cpp | 25 | ||||
-rw-r--r-- | core/fpdfapi/render/cpdf_transferfunc.h | 26 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_image.cpp | 33 | ||||
-rw-r--r-- | core/fpdfapi/render/fpdf_render_loadimage.cpp | 91 | ||||
-rw-r--r-- | core/fpdfapi/render/render_int.h | 75 |
11 files changed, 260 insertions, 200 deletions
@@ -538,6 +538,8 @@ static_library("fpdfapi") { "core/fpdfapi/render/cpdf_charposlist.h", "core/fpdfapi/render/cpdf_docrenderdata.cpp", "core/fpdfapi/render/cpdf_docrenderdata.h", + "core/fpdfapi/render/cpdf_imageloader.cpp", + "core/fpdfapi/render/cpdf_imageloader.h", "core/fpdfapi/render/cpdf_pagerendercache.h", "core/fpdfapi/render/cpdf_progressiverenderer.h", "core/fpdfapi/render/cpdf_rendercontext.h", @@ -545,6 +547,8 @@ static_library("fpdfapi") { "core/fpdfapi/render/cpdf_renderstatus.cpp", "core/fpdfapi/render/cpdf_renderstatus.h", "core/fpdfapi/render/cpdf_textrenderer.h", + "core/fpdfapi/render/cpdf_transferfunc.cpp", + "core/fpdfapi/render/cpdf_transferfunc.h", "core/fpdfapi/render/cpdf_type3cache.cpp", "core/fpdfapi/render/cpdf_type3cache.h", "core/fpdfapi/render/cpdf_type3glyphs.cpp", diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp index 33e8e5ecb4..e06adbee79 100644 --- a/core/fpdfapi/page/cpdf_generalstate.cpp +++ b/core/fpdfapi/page/cpdf_generalstate.cpp @@ -8,6 +8,7 @@ #include "core/fpdfapi/parser/cpdf_document.h" #include "core/fpdfapi/render/cpdf_docrenderdata.h" +#include "core/fpdfapi/render/cpdf_transferfunc.h" #include "core/fpdfapi/render/render_int.h" namespace { diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index 9a1691711b..c17b4d594e 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/page/pageint.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" +#include "core/fpdfapi/render/cpdf_transferfunc.h" #include "core/fpdfapi/render/cpdf_type3cache.h" #include "core/fpdfapi/render/render_int.h" diff --git a/core/fpdfapi/render/cpdf_imageloader.cpp b/core/fpdfapi/render/cpdf_imageloader.cpp new file mode 100644 index 0000000000..e36a3f1b9c --- /dev/null +++ b/core/fpdfapi/render/cpdf_imageloader.cpp @@ -0,0 +1,136 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fpdfapi/render/cpdf_imageloader.h" + +#include "core/fpdfapi/page/cpdf_image.h" +#include "core/fpdfapi/page/cpdf_imageobject.h" +#include "core/fpdfapi/render/cpdf_pagerendercache.h" +#include "core/fpdfapi/render/cpdf_renderstatus.h" +#include "core/fpdfapi/render/render_int.h" +#include "core/fxcrt/fx_basic.h" + +class CPDF_ImageLoaderHandle { + public: + CPDF_ImageLoaderHandle(); + ~CPDF_ImageLoaderHandle(); + + bool Start(CPDF_ImageLoader* pImageLoader, + const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t nDownsampleWidth, + int32_t nDownsampleHeight); + bool Continue(IFX_Pause* pPause); + + private: + void HandleFailure(); + + CPDF_ImageLoader* m_pImageLoader; + CPDF_PageRenderCache* m_pCache; + CPDF_ImageObject* m_pImage; + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; +}; + +CPDF_ImageLoaderHandle::CPDF_ImageLoaderHandle() { + m_pImageLoader = nullptr; + m_pCache = nullptr; + m_pImage = nullptr; +} + +CPDF_ImageLoaderHandle::~CPDF_ImageLoaderHandle() {} + +bool CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, + const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t nDownsampleWidth, + int32_t nDownsampleHeight) { + m_pImageLoader = pImageLoader; + m_pCache = pCache; + m_pImage = const_cast<CPDF_ImageObject*>(pImage); + m_nDownsampleWidth = nDownsampleWidth; + m_nDownsampleHeight = nDownsampleHeight; + bool ret; + if (pCache) { + ret = pCache->StartGetCachedBitmap( + m_pImage->GetImage()->GetStream(), bStdCS, GroupFamily, bLoadMask, + pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); + } else { + ret = m_pImage->GetImage()->StartLoadDIBSource( + pRenderStatus->m_pFormResource, pRenderStatus->m_pPageResource, bStdCS, + GroupFamily, bLoadMask); + } + if (!ret) + HandleFailure(); + return ret; +} + +bool CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) { + bool ret = m_pCache ? m_pCache->Continue(pPause) + : m_pImage->GetImage()->Continue(pPause); + if (!ret) + HandleFailure(); + return ret; +} + +void CPDF_ImageLoaderHandle::HandleFailure() { + if (m_pCache) { + CPDF_ImageCacheEntry* entry = m_pCache->GetCurImageCacheEntry(); + m_pImageLoader->m_bCached = true; + m_pImageLoader->m_pBitmap = entry->DetachBitmap(); + m_pImageLoader->m_pMask = entry->DetachMask(); + m_pImageLoader->m_MatteColor = entry->m_MatteColor; + return; + } + CPDF_Image* pImage = m_pImage->GetImage(); + m_pImageLoader->m_bCached = false; + m_pImageLoader->m_pBitmap = pImage->DetachBitmap(); + m_pImageLoader->m_pMask = pImage->DetachMask(); + m_pImageLoader->m_MatteColor = pImage->m_MatteColor; +} + +CPDF_ImageLoader::CPDF_ImageLoader() + : m_pBitmap(nullptr), + m_pMask(nullptr), + m_MatteColor(0), + m_bCached(false), + m_nDownsampleWidth(0), + m_nDownsampleHeight(0) {} + +CPDF_ImageLoader::~CPDF_ImageLoader() { + if (!m_bCached) { + delete m_pBitmap; + delete m_pMask; + } +} + +bool CPDF_ImageLoader::Start(const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t nDownsampleWidth, + int32_t nDownsampleHeight) { + m_nDownsampleWidth = nDownsampleWidth; + m_nDownsampleHeight = nDownsampleHeight; + m_pLoadHandle.reset(new CPDF_ImageLoaderHandle); + return m_pLoadHandle->Start(this, pImage, pCache, bStdCS, GroupFamily, + bLoadMask, pRenderStatus, m_nDownsampleWidth, + m_nDownsampleHeight); +} + +bool CPDF_ImageLoader::Continue(IFX_Pause* pPause) { + return m_pLoadHandle->Continue(pPause); +} diff --git a/core/fpdfapi/render/cpdf_imageloader.h b/core/fpdfapi/render/cpdf_imageloader.h new file mode 100644 index 0000000000..da578a321f --- /dev/null +++ b/core/fpdfapi/render/cpdf_imageloader.h @@ -0,0 +1,47 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_RENDER_CPDF_IMAGELOADER_H_ +#define CORE_FPDFAPI_RENDER_CPDF_IMAGELOADER_H_ + +#include <memory> + +#include "core/fxcrt/fx_basic.h" +#include "core/fxge/fx_dib.h" + +class CPDF_ImageLoaderHandle; +class CPDF_ImageObject; +class CPDF_PageRenderCache; +class CPDF_RenderStatus; + +class CPDF_ImageLoader { + public: + CPDF_ImageLoader(); + ~CPDF_ImageLoader(); + + bool Start(const CPDF_ImageObject* pImage, + CPDF_PageRenderCache* pCache, + bool bStdCS, + uint32_t GroupFamily, + bool bLoadMask, + CPDF_RenderStatus* pRenderStatus, + int32_t nDownsampleWidth, + int32_t nDownsampleHeight); + bool Continue(IFX_Pause* pPause); + + CFX_DIBSource* m_pBitmap; + CFX_DIBSource* m_pMask; + uint32_t m_MatteColor; + bool m_bCached; + + private: + int32_t m_nDownsampleWidth; + int32_t m_nDownsampleHeight; + + std::unique_ptr<CPDF_ImageLoaderHandle> m_pLoadHandle; +}; + +#endif // CORE_FPDFAPI_RENDER_CPDF_IMAGELOADER_H_ diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index d9f2a82276..7c389ef37c 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -38,6 +38,7 @@ #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" #include "core/fpdfapi/render/cpdf_textrenderer.h" +#include "core/fpdfapi/render/cpdf_transferfunc.h" #include "core/fpdfapi/render/cpdf_type3cache.h" #include "core/fpdfapi/render/render_int.h" #include "core/fpdfdoc/cpdf_occontext.h" @@ -895,6 +896,16 @@ std::unique_ptr<CFX_DIBitmap> DrawPatternBitmap( return pBitmap; } +bool IsAvailableMatrix(const CFX_Matrix& matrix) { + if (matrix.a == 0 || matrix.d == 0) + return matrix.b != 0 && matrix.c != 0; + + if (matrix.b == 0 || matrix.c == 0) + return matrix.a != 0 && matrix.d != 0; + + return true; +} + } // namespace // static @@ -1219,16 +1230,6 @@ bool CPDF_RenderStatus::ProcessForm(const CPDF_FormObject* pFormObj, return true; } -bool IsAvailableMatrix(const CFX_Matrix& matrix) { - if (matrix.a == 0 || matrix.d == 0) { - return matrix.b != 0 && matrix.c != 0; - } - if (matrix.b == 0 || matrix.c == 0) { - return matrix.a != 0 && matrix.d != 0; - } - return true; -} - bool CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_Matrix* pObj2Device) { int FillType = pPathObj->m_FillType; diff --git a/core/fpdfapi/render/cpdf_transferfunc.cpp b/core/fpdfapi/render/cpdf_transferfunc.cpp new file mode 100644 index 0000000000..a2cee3992d --- /dev/null +++ b/core/fpdfapi/render/cpdf_transferfunc.cpp @@ -0,0 +1,25 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#include "core/fpdfapi/render/cpdf_transferfunc.h" + +#include "core/fpdfapi/parser/cpdf_document.h" +#include "core/fpdfapi/render/render_int.h" + +CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} + +FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { + return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], + m_Samples[256 + FXSYS_GetGValue(rgb)], + m_Samples[512 + FXSYS_GetBValue(rgb)]); +} + +CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, + bool bAutoDropSrc) { + CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); + pDest->LoadSrc(pSrc, bAutoDropSrc); + return pDest; +} diff --git a/core/fpdfapi/render/cpdf_transferfunc.h b/core/fpdfapi/render/cpdf_transferfunc.h new file mode 100644 index 0000000000..829b274d9b --- /dev/null +++ b/core/fpdfapi/render/cpdf_transferfunc.h @@ -0,0 +1,26 @@ +// Copyright 2016 PDFium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com + +#ifndef CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_ +#define CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_ + +#include "core/fxge/fx_dib.h" + +class CPDF_Document; + +class CPDF_TransferFunc { + public: + explicit CPDF_TransferFunc(CPDF_Document* pDoc); + + FX_COLORREF TranslateColor(FX_COLORREF src) const; + CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc); + + CPDF_Document* const m_pPDFDoc; + bool m_bIdentity; + uint8_t m_Samples[256 * 3]; +}; + +#endif // CORE_FPDFAPI_RENDER_CPDF_TRANSFERFUNC_H_ diff --git a/core/fpdfapi/render/fpdf_render_image.cpp b/core/fpdfapi/render/fpdf_render_image.cpp index 0c89a7521c..cf5f97bab8 100644 --- a/core/fpdfapi/render/fpdf_render_image.cpp +++ b/core/fpdfapi/render/fpdf_render_image.cpp @@ -25,6 +25,7 @@ #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" #include "core/fpdfapi/render/cpdf_renderstatus.h" +#include "core/fpdfapi/render/cpdf_transferfunc.h" #include "core/fpdfdoc/cpdf_occontext.h" #include "core/fxcodec/fx_codec.h" #include "core/fxcrt/fx_safe_types.h" @@ -35,21 +36,6 @@ #include "core/fxge/skia/fx_skia_device.h" #endif -CPDF_TransferFunc::CPDF_TransferFunc(CPDF_Document* pDoc) : m_pPDFDoc(pDoc) {} - -FX_COLORREF CPDF_TransferFunc::TranslateColor(FX_COLORREF rgb) const { - return FXSYS_RGB(m_Samples[FXSYS_GetRValue(rgb)], - m_Samples[256 + FXSYS_GetGValue(rgb)], - m_Samples[512 + FXSYS_GetBValue(rgb)]); -} - -CFX_DIBSource* CPDF_TransferFunc::TranslateImage(const CFX_DIBSource* pSrc, - bool bAutoDropSrc) { - CPDF_DIBTransferFunc* pDest = new CPDF_DIBTransferFunc(this); - pDest->LoadSrc(pSrc, bAutoDropSrc); - return pDest; -} - CPDF_DIBTransferFunc::~CPDF_DIBTransferFunc() {} FXDIB_Format CPDF_DIBTransferFunc::GetDestFormat() { @@ -251,15 +237,12 @@ bool CPDF_ImageRenderer::StartLoadDIBSource() { if (m_ImageMatrix.d > 0) { dest_height = -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; - } + 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)) { + m_Status = 4; + return true; } return false; } @@ -810,7 +793,7 @@ bool CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause); if (m_Status == 4) { - if (m_Loader.Continue(m_LoadHandle.get(), pPause)) + if (m_Loader.Continue(pPause)) return true; if (StartRenderDIBSource()) diff --git a/core/fpdfapi/render/fpdf_render_loadimage.cpp b/core/fpdfapi/render/fpdf_render_loadimage.cpp index 0a1be1b976..d797b06135 100644 --- a/core/fpdfapi/render/fpdf_render_loadimage.cpp +++ b/core/fpdfapi/render/fpdf_render_loadimage.cpp @@ -1503,94 +1503,3 @@ bool CPDF_DIBSource::TransMask() const { return m_bLoadMask && m_GroupFamily == PDFCS_DEVICECMYK && m_Family == PDFCS_DEVICECMYK; } - -CPDF_ImageLoaderHandle::CPDF_ImageLoaderHandle() { - m_pImageLoader = nullptr; - m_pCache = nullptr; - m_pImage = nullptr; -} - -CPDF_ImageLoaderHandle::~CPDF_ImageLoaderHandle() {} - -bool CPDF_ImageLoaderHandle::Start(CPDF_ImageLoader* pImageLoader, - const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t nDownsampleWidth, - int32_t nDownsampleHeight) { - m_pImageLoader = pImageLoader; - m_pCache = pCache; - m_pImage = const_cast<CPDF_ImageObject*>(pImage); - m_nDownsampleWidth = nDownsampleWidth; - m_nDownsampleHeight = nDownsampleHeight; - bool ret; - if (pCache) { - ret = pCache->StartGetCachedBitmap( - m_pImage->GetImage()->GetStream(), bStdCS, GroupFamily, bLoadMask, - pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); - } else { - ret = m_pImage->GetImage()->StartLoadDIBSource( - pRenderStatus->m_pFormResource, pRenderStatus->m_pPageResource, bStdCS, - GroupFamily, bLoadMask); - } - if (!ret) - HandleFailure(); - return ret; -} - -bool CPDF_ImageLoaderHandle::Continue(IFX_Pause* pPause) { - bool ret = m_pCache ? m_pCache->Continue(pPause) - : m_pImage->GetImage()->Continue(pPause); - if (!ret) - HandleFailure(); - return ret; -} - -void CPDF_ImageLoaderHandle::HandleFailure() { - if (m_pCache) { - CPDF_ImageCacheEntry* entry = m_pCache->GetCurImageCacheEntry(); - m_pImageLoader->m_bCached = true; - m_pImageLoader->m_pBitmap = entry->DetachBitmap(); - m_pImageLoader->m_pMask = entry->DetachMask(); - m_pImageLoader->m_MatteColor = entry->m_MatteColor; - } else { - CPDF_Image* pImage = m_pImage->GetImage(); - m_pImageLoader->m_bCached = false; - m_pImageLoader->m_pBitmap = pImage->DetachBitmap(); - m_pImageLoader->m_pMask = pImage->DetachMask(); - m_pImageLoader->m_MatteColor = pImage->m_MatteColor; - } -} - -bool CPDF_ImageLoader::Start( - const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle, - bool bStdCS, - uint32_t GroupFamily, - bool bLoadMask, - CPDF_RenderStatus* pRenderStatus, - int32_t nDownsampleWidth, - int32_t nDownsampleHeight) { - m_nDownsampleWidth = nDownsampleWidth; - m_nDownsampleHeight = nDownsampleHeight; - pLoadHandle->reset(new CPDF_ImageLoaderHandle); - return (*pLoadHandle) - ->Start(this, pImage, pCache, bStdCS, GroupFamily, bLoadMask, - pRenderStatus, m_nDownsampleWidth, m_nDownsampleHeight); -} - -bool CPDF_ImageLoader::Continue(CPDF_ImageLoaderHandle* LoadHandle, - IFX_Pause* pPause) { - return LoadHandle->Continue(pPause); -} - -CPDF_ImageLoader::~CPDF_ImageLoader() { - if (!m_bCached) { - delete m_pBitmap; - delete m_pMask; - } -} diff --git a/core/fpdfapi/render/render_int.h b/core/fpdfapi/render/render_int.h index 4e45597693..3e35e14520 100644 --- a/core/fpdfapi/render/render_int.h +++ b/core/fpdfapi/render/render_int.h @@ -15,6 +15,7 @@ #include "core/fpdfapi/page/cpdf_countedobject.h" #include "core/fpdfapi/page/cpdf_graphicstates.h" #include "core/fpdfapi/parser/cpdf_stream_acc.h" +#include "core/fpdfapi/render/cpdf_imageloader.h" #include "core/fpdfapi/render/cpdf_rendercontext.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" #include "core/fxge/cfx_fxgedevice.h" @@ -31,7 +32,6 @@ class CPDF_Document; class CPDF_Font; class CPDF_FormObject; class CPDF_ImageCacheEntry; -class CPDF_ImageLoaderHandle; class CPDF_ImageObject; class CPDF_ImageRenderer; class CPDF_Object; @@ -50,78 +50,6 @@ class CPDF_Type3Glyphs; class CPDF_Type3Char; class CPDF_Type3Font; -bool IsAvailableMatrix(const CFX_Matrix& matrix); - -class CPDF_TransferFunc { - public: - explicit CPDF_TransferFunc(CPDF_Document* pDoc); - - FX_COLORREF TranslateColor(FX_COLORREF src) const; - CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, bool bAutoDropSrc); - - CPDF_Document* const m_pPDFDoc; - bool m_bIdentity; - uint8_t m_Samples[256 * 3]; -}; - -class CPDF_ImageLoader { - public: - CPDF_ImageLoader() - : m_pBitmap(nullptr), - m_pMask(nullptr), - m_MatteColor(0), - m_bCached(false), - m_nDownsampleWidth(0), - m_nDownsampleHeight(0) {} - ~CPDF_ImageLoader(); - - bool Start(const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - std::unique_ptr<CPDF_ImageLoaderHandle>* pLoadHandle, - bool bStdCS = false, - uint32_t GroupFamily = 0, - bool bLoadMask = false, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t nDownsampleWidth = 0, - int32_t nDownsampleHeight = 0); - bool Continue(CPDF_ImageLoaderHandle* LoadHandle, IFX_Pause* pPause); - - CFX_DIBSource* m_pBitmap; - CFX_DIBSource* m_pMask; - uint32_t m_MatteColor; - bool m_bCached; - - protected: - int32_t m_nDownsampleWidth; - int32_t m_nDownsampleHeight; -}; - -class CPDF_ImageLoaderHandle { - public: - CPDF_ImageLoaderHandle(); - ~CPDF_ImageLoaderHandle(); - - bool Start(CPDF_ImageLoader* pImageLoader, - const CPDF_ImageObject* pImage, - CPDF_PageRenderCache* pCache, - bool bStdCS = false, - uint32_t GroupFamily = 0, - bool bLoadMask = false, - CPDF_RenderStatus* pRenderStatus = nullptr, - int32_t nDownsampleWidth = 0, - int32_t nDownsampleHeight = 0); - bool Continue(IFX_Pause* pPause); - - protected: - void HandleFailure(); - - CPDF_ImageLoader* m_pImageLoader; - CPDF_PageRenderCache* m_pCache; - CPDF_ImageObject* m_pImage; - int32_t m_nDownsampleWidth; - int32_t m_nDownsampleHeight; -}; - class CPDF_ImageRenderer { public: CPDF_ImageRenderer(); @@ -168,7 +96,6 @@ class CPDF_ImageRenderer { uint32_t m_Flags; std::unique_ptr<CFX_ImageTransformer> m_pTransformer; void* m_DeviceHandle; - std::unique_ptr<CPDF_ImageLoaderHandle> m_LoadHandle; bool m_bStdCS; int m_BlendType; }; |