summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_render
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2016-03-15 14:57:22 -0400
committerDan Sinclair <dsinclair@chromium.org>2016-03-15 14:57:22 -0400
commitaa403d3f68a966e24a6d8e8c109970930f096afb (patch)
treefeee638c1d8cee4b191bf09c2637009bb9cd6f30 /core/fpdfapi/fpdf_render
parente40764862208b8cb76f507c489b01e3795fd93bd (diff)
downloadpdfium-aa403d3f68a966e24a6d8e8c109970930f096afb.tar.xz
core/include/fdpfapi cleanup Part I.
This Cl moves a bunch of the files from core/include/fpdfapi to their correct location outside the core/include tree. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1805603002 .
Diffstat (limited to 'core/fpdfapi/fpdf_render')
-rw-r--r--core/fpdfapi/fpdf_render/cpdf_pagerendercache.h77
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render.cpp28
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_cache.cpp7
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_image.cpp12
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp10
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp7
-rw-r--r--core/fpdfapi/fpdf_render/fpdf_render_text.cpp7
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h62
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h68
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h52
-rw-r--r--core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h77
-rw-r--r--core/fpdfapi/fpdf_render/render_int.h7
12 files changed, 376 insertions, 38 deletions
diff --git a/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h
new file mode 100644
index 0000000000..26d71efcab
--- /dev/null
+++ b/core/fpdfapi/fpdf_render/cpdf_pagerendercache.h
@@ -0,0 +1,77 @@
+// 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_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_
+#define CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_
+
+#include <map>
+
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_Stream;
+class CPDF_ImageCacheEntry;
+class CPDF_Page;
+class CPDF_RenderStatus;
+class CFX_DIBitmap;
+class CFX_DIBSource;
+class IFX_Pause;
+
+class CPDF_PageRenderCache {
+ public:
+ explicit CPDF_PageRenderCache(CPDF_Page* pPage)
+ : m_pPage(pPage),
+ m_pCurImageCacheEntry(nullptr),
+ m_nTimeCount(0),
+ m_nCacheSize(0),
+ m_bCurFindCache(FALSE) {}
+ ~CPDF_PageRenderCache();
+ void ClearImageData();
+
+ FX_DWORD EstimateSize();
+ void CacheOptimization(int32_t dwLimitCacheSize);
+ FX_DWORD GetTimeCount() const { return m_nTimeCount; }
+ void SetTimeCount(FX_DWORD dwTimeCount) { m_nTimeCount = dwTimeCount; }
+
+ void GetCachedBitmap(CPDF_Stream* pStream,
+ CFX_DIBSource*& pBitmap,
+ CFX_DIBSource*& pMask,
+ FX_DWORD& MatteColor,
+ FX_BOOL bStdCS = FALSE,
+ FX_DWORD GroupFamily = 0,
+ FX_BOOL bLoadMask = FALSE,
+ CPDF_RenderStatus* pRenderStatus = NULL,
+ int32_t downsampleWidth = 0,
+ int32_t downsampleHeight = 0);
+
+ void ResetBitmap(CPDF_Stream* pStream, const CFX_DIBitmap* pBitmap);
+ void ClearImageCacheEntry(CPDF_Stream* pStream);
+ CPDF_Page* GetPage() const { return m_pPage; }
+ CPDF_ImageCacheEntry* GetCurImageCacheEntry() const {
+ return m_pCurImageCacheEntry;
+ }
+
+ FX_BOOL StartGetCachedBitmap(CPDF_Stream* pStream,
+ FX_BOOL bStdCS = FALSE,
+ FX_DWORD GroupFamily = 0,
+ FX_BOOL bLoadMask = FALSE,
+ CPDF_RenderStatus* pRenderStatus = NULL,
+ int32_t downsampleWidth = 0,
+ int32_t downsampleHeight = 0);
+
+ FX_BOOL Continue(IFX_Pause* pPause);
+
+ protected:
+ friend class CPDF_Page;
+
+ CPDF_Page* const m_pPage;
+ CPDF_ImageCacheEntry* m_pCurImageCacheEntry;
+ std::map<CPDF_Stream*, CPDF_ImageCacheEntry*> m_ImageCache;
+ FX_DWORD m_nTimeCount;
+ FX_DWORD m_nCacheSize;
+ FX_BOOL m_bCurFindCache;
+};
+
+#endif // CORE_FPDFAPI_FPDF_RENDER_CPDF_PAGERENDERCACHE_H_
diff --git a/core/fpdfapi/fpdf_render/fpdf_render.cpp b/core/fpdfapi/fpdf_render/fpdf_render.cpp
index 2b82ed4cc6..94398df296 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -7,11 +7,16 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_array.h"
-#include "core/include/fpdfapi/cpdf_dictionary.h"
-#include "core/include/fpdfapi/cpdf_document.h"
-#include "core/include/fpdfapi/fpdf_module.h"
-#include "core/include/fpdfapi/fpdf_render.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h"
+#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h"
+#include "core/fpdfapi/include/cpdf_modulemgr.h"
+#include "core/fpdfapi/ipdf_rendermodule.h"
#include "core/include/fxge/fx_ge.h"
CPDF_DocRenderData::CPDF_DocRenderData(CPDF_Document* pPDFDoc)
@@ -1322,16 +1327,3 @@ void CPDF_ScaledRenderBuffer::OutputToDevice() {
m_Rect.top, m_Rect.Width(), m_Rect.Height());
}
}
-FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) {
- const CPDF_ContentMarkData* pData = pObj->m_ContentMark;
- int nItems = pData->CountItems();
- for (int i = 0; i < nItems; i++) {
- const CPDF_ContentMarkItem& item = pData->GetItem(i);
- if (item.GetName() == "OC" &&
- item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict &&
- !CheckOCGVisible(item.GetParam())) {
- return FALSE;
- }
- }
- return TRUE;
-}
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
index f5ab7e0da5..fbe07842d9 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_cache.cpp
@@ -4,12 +4,13 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
-#include "core/fpdfapi/fpdf_render/render_int.h"
+#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_document.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
+#include "core/fpdfapi/fpdf_render/render_int.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
struct CACHEINFO {
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 6c235a0258..963ff246d9 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -10,12 +10,14 @@
#include <vector>
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_array.h"
-#include "core/include/fpdfapi/cpdf_dictionary.h"
-#include "core/include/fpdfapi/cpdf_document.h"
-#include "core/include/fpdfapi/fpdf_module.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_parser/ipdf_occontext.h"
+#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxcrt/fx_safe_types.h"
#include "core/include/fxge/fx_ge.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index f1a06c4fc7..905e7a60c6 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -11,12 +11,12 @@
#include <vector>
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_array.h"
-#include "core/include/fpdfapi/cpdf_dictionary.h"
-#include "core/include/fpdfapi/cpdf_document.h"
-#include "core/include/fpdfapi/fpdf_module.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_render/cpdf_pagerendercache.h"
+#include "core/fpdfapi/include/cpdf_modulemgr.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxcodec/fx_codec.h"
#include "core/include/fxcrt/fx_safe_types.h"
#include "core/include/fxge/fx_ge.h"
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 5ad8db1646..2e259126cf 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -7,10 +7,11 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_array.h"
-#include "core/include/fpdfapi/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
#define SHADING_STEPS 256
diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 24b77ed368..4db224939d 100644
--- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -7,10 +7,11 @@
#include "core/fpdfapi/fpdf_render/render_int.h"
#include "core/fpdfapi/fpdf_page/pageint.h"
-#include "core/include/fpdfapi/cpdf_dictionary.h"
-#include "core/include/fpdfapi/cpdf_document.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h"
+#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
+#include "core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
#include "core/include/fxge/fx_ge.h"
CPDF_Type3Cache::~CPDF_Type3Cache() {
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
new file mode 100644
index 0000000000..eddd4b0c83
--- /dev/null
+++ b/core/fpdfapi/fpdf_render/include/cpdf_progressiverenderer.h
@@ -0,0 +1,62 @@
+// 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_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_
+#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_
+
+#include <memory>
+
+#include "core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h"
+#include "core/include/fpdfapi/fpdf_page.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_system.h"
+
+class CPDF_RenderOptions;
+class CPDF_RenderStatus;
+class CFX_RenderDevice;
+class IFX_Pause;
+
+class CPDF_ProgressiveRenderer {
+ public:
+ // Must match FDF_RENDER_* definitions in public/fpdf_progressive.h, but
+ // cannot #include that header. fpdfsdk/fpdf_progressive.cpp has
+ // static_asserts to make sure the two sets of values match.
+ enum Status {
+ Ready, // FPDF_RENDER_READER
+ ToBeContinued, // FPDF_RENDER_TOBECOUNTINUED
+ Done, // FPDF_RENDER_DONE
+ Failed // FPDF_RENDER_FAILED
+ };
+
+ static int ToFPDFStatus(Status status) { return static_cast<int>(status); }
+
+ CPDF_ProgressiveRenderer(CPDF_RenderContext* pContext,
+ CFX_RenderDevice* pDevice,
+ const CPDF_RenderOptions* pOptions);
+ ~CPDF_ProgressiveRenderer();
+
+ Status GetStatus() const { return m_Status; }
+ void Start(IFX_Pause* pPause);
+ void Continue(IFX_Pause* pPause);
+
+ private:
+ void RenderStep();
+
+ // Maximum page objects to render before checking for pause.
+ static const int kStepLimit = 100;
+
+ Status m_Status;
+ CPDF_RenderContext* const m_pContext;
+ CFX_RenderDevice* const m_pDevice;
+ const CPDF_RenderOptions* const m_pOptions;
+ std::unique_ptr<CPDF_RenderStatus> m_pRenderStatus;
+ CFX_FloatRect m_ClipRect;
+ FX_DWORD m_LayerIndex;
+ CPDF_RenderContext::Layer* m_pCurrentLayer;
+ CPDF_PageObjectList::iterator m_LastObjectRendered;
+};
+
+#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_PROGRESSIVERENDERER_H_
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h
new file mode 100644
index 0000000000..4c55658163
--- /dev/null
+++ b/core/fpdfapi/fpdf_render/include/cpdf_rendercontext.h
@@ -0,0 +1,68 @@
+// 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_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_
+#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_
+
+#include "core/include/fxcrt/fx_basic.h"
+#include "core/include/fxcrt/fx_coordinates.h"
+
+class CPDF_Dictionary;
+class CPDF_Document;
+class CPDF_Page;
+class CPDF_PageObject;
+class CPDF_PageObjectHolder;
+class CPDF_PageRenderCache;
+class CPDF_RenderOptions;
+class CFX_DIBitmap;
+class CFX_Matrix;
+class CFX_RenderDevice;
+
+class CPDF_RenderContext {
+ public:
+ class Layer {
+ public:
+ CPDF_PageObjectHolder* m_pObjectHolder;
+ CFX_Matrix m_Matrix;
+ };
+
+ explicit CPDF_RenderContext(CPDF_Page* pPage);
+ CPDF_RenderContext(CPDF_Document* pDoc, CPDF_PageRenderCache* pPageCache);
+ ~CPDF_RenderContext();
+
+ void AppendLayer(CPDF_PageObjectHolder* pObjectHolder,
+ const CFX_Matrix* pObject2Device);
+
+ void Render(CFX_RenderDevice* pDevice,
+ const CPDF_RenderOptions* pOptions,
+ const CFX_Matrix* pFinalMatrix);
+
+ void Render(CFX_RenderDevice* pDevice,
+ const CPDF_PageObject* pStopObj,
+ const CPDF_RenderOptions* pOptions,
+ const CFX_Matrix* pFinalMatrix);
+
+ void GetBackground(CFX_DIBitmap* pBuffer,
+ const CPDF_PageObject* pObj,
+ const CPDF_RenderOptions* pOptions,
+ CFX_Matrix* pFinalMatrix);
+
+ FX_DWORD CountLayers() const { return m_Layers.GetSize(); }
+ Layer* GetLayer(FX_DWORD index) { return m_Layers.GetDataPtr(index); }
+
+ CPDF_Document* GetDocument() const { return m_pDocument; }
+ CPDF_Dictionary* GetPageResources() const { return m_pPageResources; }
+ CPDF_PageRenderCache* GetPageCache() const { return m_pPageCache; }
+
+ protected:
+ CPDF_Document* const m_pDocument;
+ CPDF_Dictionary* m_pPageResources;
+ CPDF_PageRenderCache* m_pPageCache;
+ FX_BOOL m_bFirstLayer;
+ CFX_ArrayTemplate<Layer> m_Layers;
+};
+
+#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDERCONTEXT_H_
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
new file mode 100644
index 0000000000..c0911e7cd2
--- /dev/null
+++ b/core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h
@@ -0,0 +1,52 @@
+// 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_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_
+#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_
+
+#include "core/include/fxcrt/fx_system.h"
+#include "core/include/fxge/fx_dib.h"
+
+class IPDF_OCContext;
+
+#define RENDER_COLOR_NORMAL 0
+#define RENDER_COLOR_GRAY 1
+#define RENDER_COLOR_TWOCOLOR 2
+#define RENDER_COLOR_ALPHA 3
+#define RENDER_CLEARTYPE 0x00000001
+#define RENDER_PRINTGRAPHICTEXT 0x00000002
+#define RENDER_FORCE_DOWNSAMPLE 0x00000004
+#define RENDER_PRINTPREVIEW 0x00000008
+#define RENDER_BGR_STRIPE 0x00000010
+#define RENDER_NO_NATIVETEXT 0x00000020
+#define RENDER_FORCE_HALFTONE 0x00000040
+#define RENDER_RECT_AA 0x00000080
+#define RENDER_FILL_FULLCOVER 0x00000100
+#define RENDER_PRINTIMAGETEXT 0x00000200
+#define RENDER_OVERPRINT 0x00000400
+#define RENDER_THINLINE 0x00000800
+#define RENDER_NOTEXTSMOOTH 0x10000000
+#define RENDER_NOPATHSMOOTH 0x20000000
+#define RENDER_NOIMAGESMOOTH 0x40000000
+#define RENDER_LIMITEDIMAGECACHE 0x80000000
+
+class CPDF_RenderOptions {
+ public:
+ CPDF_RenderOptions();
+ FX_ARGB TranslateColor(FX_ARGB argb) const;
+
+ int m_ColorMode;
+ FX_COLORREF m_BackColor;
+ FX_COLORREF m_ForeColor;
+ FX_DWORD m_Flags;
+ int m_Interpolation;
+ FX_DWORD m_AddFlags;
+ IPDF_OCContext* m_pOCContext;
+ FX_DWORD m_dwLimitCacheSize;
+ int m_HalftoneLimit;
+};
+
+#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_RENDEROPTIONS_H_
diff --git a/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
new file mode 100644
index 0000000000..1cf67cd2f2
--- /dev/null
+++ b/core/fpdfapi/fpdf_render/include/cpdf_textrenderer.h
@@ -0,0 +1,77 @@
+// 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_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_
+#define CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_
+
+#include "core/include/fxcrt/fx_coordinates.h"
+#include "core/include/fxcrt/fx_string.h"
+#include "core/include/fxcrt/fx_system.h"
+#include "core/include/fxge/fx_dib.h"
+
+class CFX_RenderDevice;
+class CFX_GraphStateData;
+class CFX_PathData;
+class CPDF_RenderOptions;
+class CPDF_Font;
+
+class CPDF_TextRenderer {
+ public:
+ static void DrawTextString(CFX_RenderDevice* pDevice,
+ int left,
+ int top,
+ CPDF_Font* pFont,
+ int height,
+ const CFX_ByteString& str,
+ FX_ARGB argb);
+
+ static void DrawTextString(CFX_RenderDevice* pDevice,
+ FX_FLOAT origin_x,
+ FX_FLOAT origin_y,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* matrix,
+ const CFX_ByteString& str,
+ FX_ARGB fill_argb,
+ FX_ARGB stroke_argb = 0,
+ const CFX_GraphStateData* pGraphState = NULL,
+ const CPDF_RenderOptions* pOptions = NULL);
+
+ static FX_BOOL DrawTextPath(CFX_RenderDevice* pDevice,
+ int nChars,
+ FX_DWORD* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2User,
+ const CFX_Matrix* pUser2Device,
+ const CFX_GraphStateData* pGraphState,
+ FX_ARGB fill_argb,
+ FX_ARGB stroke_argb,
+ CFX_PathData* pClippingPath,
+ int nFlag = 0);
+
+ static FX_BOOL DrawNormalText(CFX_RenderDevice* pDevice,
+ int nChars,
+ FX_DWORD* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ FX_ARGB fill_argb,
+ const CPDF_RenderOptions* pOptions);
+
+ static FX_BOOL DrawType3Text(CFX_RenderDevice* pDevice,
+ int nChars,
+ FX_DWORD* pCharCodes,
+ FX_FLOAT* pCharPos,
+ CPDF_Font* pFont,
+ FX_FLOAT font_size,
+ const CFX_Matrix* pText2Device,
+ FX_ARGB fill_argb);
+};
+
+#endif // CORE_FPDFAPI_FPDF_RENDER_INCLUDE_CPDF_TEXTRENDERER_H_
diff --git a/core/fpdfapi/fpdf_render/render_int.h b/core/fpdfapi/fpdf_render/render_int.h
index c15612466c..f4cc02357b 100644
--- a/core/fpdfapi/fpdf_render/render_int.h
+++ b/core/fpdfapi/fpdf_render/render_int.h
@@ -10,9 +10,12 @@
#include <map>
#include <memory>
+#include "core/fpdfapi/fpdf_render/include/cpdf_renderoptions.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
-#include "core/include/fpdfapi/fpdf_render.h"
+class CPDF_PageObjectHolder;
+class CPDF_PageRenderCache;
+class CPDF_RenderStatus;
class CFX_GlyphBitmap;
class CFX_ImageTransformer;
class CPDF_ImageCacheEntry;
@@ -21,6 +24,8 @@ class ICodec_ScanlineDecoder;
#define TYPE3_MAX_BLUES 16
+FX_BOOL IsAvailableMatrix(const CFX_Matrix& matrix);
+
class CPDF_Type3Glyphs {
public:
CPDF_Type3Glyphs() : m_TopBlueCount(0), m_BottomBlueCount(0) {}