OLD | NEW |
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 7 #ifndef CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
8 #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 8 #define CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
9 | 9 |
10 #include <map> | 10 #include <map> |
11 | 11 |
12 #include "../../../../third_party/base/nonstd_unique_ptr.h" | 12 #include "../../../../third_party/base/nonstd_unique_ptr.h" |
13 #include "../../../include/fpdfapi/fpdf_pageobj.h" | 13 #include "../../../include/fpdfapi/fpdf_pageobj.h" |
14 | 14 |
15 class CPDF_QuickStretcher; | 15 class CPDF_QuickStretcher; |
16 #define TYPE3_MAX_BLUES»» 16 | 16 #define TYPE3_MAX_BLUES 16 |
17 class CPDF_Type3Glyphs | 17 class CPDF_Type3Glyphs { |
18 { | 18 public: |
19 public: | 19 CPDF_Type3Glyphs() { |
20 CPDF_Type3Glyphs() | 20 m_GlyphMap.InitHashTable(253); |
21 { | 21 m_TopBlueCount = m_BottomBlueCount = 0; |
22 m_GlyphMap.InitHashTable(253); | 22 } |
23 m_TopBlueCount = m_BottomBlueCount = 0; | 23 ~CPDF_Type3Glyphs(); |
24 } | 24 CFX_MapPtrToPtr m_GlyphMap; |
25 ~CPDF_Type3Glyphs(); | 25 void AdjustBlue(FX_FLOAT top, |
26 CFX_MapPtrToPtr» » » m_GlyphMap; | 26 FX_FLOAT bottom, |
27 void» » » » » AdjustBlue(FX_FLOAT top, FX_FLOA
T bottom, int& top_line, int& bottom_line); | 27 int& top_line, |
28 | 28 int& bottom_line); |
29 int»» » » » » m_TopBlue[TYPE3_MAX_BLUES], m_Bo
ttomBlue[TYPE3_MAX_BLUES]; | 29 |
30 int»» » » » » m_TopBlueCount, m_BottomBlueCoun
t; | 30 int m_TopBlue[TYPE3_MAX_BLUES], m_BottomBlue[TYPE3_MAX_BLUES]; |
| 31 int m_TopBlueCount, m_BottomBlueCount; |
31 }; | 32 }; |
32 class CFX_GlyphBitmap; | 33 class CFX_GlyphBitmap; |
33 class CPDF_Type3Cache | 34 class CPDF_Type3Cache { |
34 { | 35 public: |
35 public: | 36 CPDF_Type3Cache(CPDF_Type3Font* pFont) { m_pFont = pFont; } |
36 CPDF_Type3Cache(CPDF_Type3Font* pFont) | 37 ~CPDF_Type3Cache(); |
37 { | 38 CFX_GlyphBitmap* LoadGlyph(FX_DWORD charcode, |
38 m_pFont = pFont; | 39 const CFX_AffineMatrix* pMatrix, |
39 } | 40 FX_FLOAT retinaScaleX = 1.0f, |
40 ~CPDF_Type3Cache(); | 41 FX_FLOAT retinaScaleY = 1.0f); |
41 CFX_GlyphBitmap*» » LoadGlyph(FX_DWORD charcode, const CFX_AffineMat
rix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); | 42 |
42 protected: | 43 protected: |
43 CFX_GlyphBitmap*» » RenderGlyph(CPDF_Type3Glyphs* pSize, FX_DWORD ch
arcode, const CFX_AffineMatrix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT
retinaScaleY = 1.0f); | 44 CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, |
44 CPDF_Type3Font*» » » m_pFont; | 45 FX_DWORD charcode, |
45 CFX_MapByteStringToPtr» m_SizeMap; | 46 const CFX_AffineMatrix* pMatrix, |
46 }; | 47 FX_FLOAT retinaScaleX = 1.0f, |
47 class CPDF_TransferFunc | 48 FX_FLOAT retinaScaleY = 1.0f); |
48 { | 49 CPDF_Type3Font* m_pFont; |
49 public: | 50 CFX_MapByteStringToPtr m_SizeMap; |
50 CPDF_Document*» m_pPDFDoc; | 51 }; |
51 uint8_t» » » m_Samples[256 * 3]; | 52 class CPDF_TransferFunc { |
52 FX_BOOL» » » m_bIdentity; | 53 public: |
53 | 54 CPDF_Document* m_pPDFDoc; |
54 CFX_DIBSource*» TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoD
ropSrc); | 55 uint8_t m_Samples[256 * 3]; |
55 FX_COLORREF»» TranslateColor(FX_COLORREF src); | 56 FX_BOOL m_bIdentity; |
56 }; | 57 |
57 | 58 CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, |
58 class CPDF_DocRenderData | 59 FX_BOOL bAutoDropSrc); |
59 { | 60 FX_COLORREF TranslateColor(FX_COLORREF src); |
60 public: | 61 }; |
61 CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); | 62 |
62 ~CPDF_DocRenderData(); | 63 class CPDF_DocRenderData { |
63 CPDF_Type3Cache*» GetCachedType3(CPDF_Type3Font* pFont); | 64 public: |
64 CPDF_TransferFunc*» GetTransferFunc(CPDF_Object* pObj); | 65 CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); |
65 CFX_FontCache*» » GetFontCache() | 66 ~CPDF_DocRenderData(); |
66 { | 67 CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); |
67 return m_pFontCache; | 68 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); |
68 } | 69 CFX_FontCache* GetFontCache() { return m_pFontCache; } |
69 void» » » » Clear(FX_BOOL bRelease = FALSE); | 70 void Clear(FX_BOOL bRelease = FALSE); |
70 void» » » » ReleaseCachedType3(CPDF_Type3Font* pFont
); | 71 void ReleaseCachedType3(CPDF_Type3Font* pFont); |
71 void» » » » ReleaseTransferFunc(CPDF_Object* pObj); | 72 void ReleaseTransferFunc(CPDF_Object* pObj); |
72 private: | 73 |
73 using CPDF_Type3CacheMap = | 74 private: |
74 std::map<CPDF_Font*, CPDF_CountedObject<CPDF_Type3Cache>*>; | 75 using CPDF_Type3CacheMap = |
75 using CPDF_TransferFuncMap = | 76 std::map<CPDF_Font*, CPDF_CountedObject<CPDF_Type3Cache>*>; |
76 std::map<CPDF_Object*, CPDF_CountedObject<CPDF_TransferFunc>*> ; | 77 using CPDF_TransferFuncMap = |
77 | 78 std::map<CPDF_Object*, CPDF_CountedObject<CPDF_TransferFunc>*>; |
78 CPDF_Document* m_pPDFDoc; | 79 |
79 CFX_FontCache* m_pFontCache; | 80 CPDF_Document* m_pPDFDoc; |
80 CPDF_Type3CacheMap m_Type3FaceMap; | 81 CFX_FontCache* m_pFontCache; |
81 CPDF_TransferFuncMap m_TransferFuncMap; | 82 CPDF_Type3CacheMap m_Type3FaceMap; |
| 83 CPDF_TransferFuncMap m_TransferFuncMap; |
82 }; | 84 }; |
83 struct _PDF_RenderItem { | 85 struct _PDF_RenderItem { |
84 public: | 86 public: |
85 CPDF_PageObjects* m_pObjectList; | 87 CPDF_PageObjects* m_pObjectList; |
86 CFX_AffineMatrix m_Matrix; | 88 CFX_AffineMatrix m_Matrix; |
87 }; | 89 }; |
88 typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer; | 90 typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer; |
89 class IPDF_ObjectRenderer | 91 class IPDF_ObjectRenderer { |
90 { | 92 public: |
91 public: | 93 static IPDF_ObjectRenderer* Create(int type); |
92 static IPDF_ObjectRenderer* Create(int type); | 94 virtual ~IPDF_ObjectRenderer() {} |
93 virtual ~IPDF_ObjectRenderer() {} | 95 virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, |
94 virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, const CPDF_PageObjec
t* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FX
DIB_BLEND_NORMAL) = 0; | 96 const CPDF_PageObject* pObj, |
95 virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; | 97 const CFX_AffineMatrix* pObj2Device, |
96 FX_BOOL m_Result; | 98 FX_BOOL bStdCS, |
97 }; | 99 int blendType = FXDIB_BLEND_NORMAL) = 0; |
98 class CPDF_RenderStatus | 100 virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; |
99 { | 101 FX_BOOL m_Result; |
100 public: | 102 }; |
101 CPDF_RenderStatus(); | 103 class CPDF_RenderStatus { |
102 ~CPDF_RenderStatus(); | 104 public: |
103 FX_BOOL Initialize(class CPDF_RenderContext* pContext, C
FX_RenderDevice* pDevice, const CFX_AffineMatrix* pDeviceMatrix, | 105 CPDF_RenderStatus(); |
104 const CPDF_PageObject* pStopObj, const CPDF_Rende
rStatus* pParentStatus, | 106 ~CPDF_RenderStatus(); |
105 const CPDF_GraphicStates* pInitialStates, const C
PDF_RenderOptions* pOptions, | 107 FX_BOOL Initialize(class CPDF_RenderContext* pContext, |
106 int transparency, FX_BOOL bDropObjects, CPDF_Dict
ionary* pFormResource = NULL, | 108 CFX_RenderDevice* pDevice, |
107 FX_BOOL bStdCS = FALSE, CPDF_Type3Char* pType3Ch
ar = NULL, FX_ARGB fill_color = 0, | 109 const CFX_AffineMatrix* pDeviceMatrix, |
108 FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FAL
SE); | 110 const CPDF_PageObject* pStopObj, |
109 void RenderObjectList(const CPDF_PageObjects* pObjs,
const CFX_AffineMatrix* pObj2Device); | 111 const CPDF_RenderStatus* pParentStatus, |
110 void RenderSingleObject(const CPDF_PageObject* pObj,
const CFX_AffineMatrix* pObj2Device); | 112 const CPDF_GraphicStates* pInitialStates, |
111 FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj
, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause); | 113 const CPDF_RenderOptions* pOptions, |
112 CPDF_RenderOptions m_Options; | 114 int transparency, |
113 CPDF_Dictionary* m_pFormResource; | 115 FX_BOOL bDropObjects, |
114 CPDF_Dictionary* m_pPageResource; | 116 CPDF_Dictionary* pFormResource = NULL, |
115 CFX_PtrArray m_Type3FontCache; | 117 FX_BOOL bStdCS = FALSE, |
116 CPDF_RenderContext* GetContext() | 118 CPDF_Type3Char* pType3Char = NULL, |
117 { | 119 FX_ARGB fill_color = 0, |
118 return m_pContext; | 120 FX_DWORD GroupFamily = 0, |
119 } | 121 FX_BOOL bLoadMask = FALSE); |
120 protected: | 122 void RenderObjectList(const CPDF_PageObjects* pObjs, |
121 friend class CPDF_ImageRenderer; | 123 const CFX_AffineMatrix* pObj2Device); |
122 friend class CPDF_RenderContext; | 124 void RenderSingleObject(const CPDF_PageObject* pObj, |
123 void ProcessClipPath(CPDF_ClipPath ClipPath, const CF
X_AffineMatrix* pObj2Device); | 125 const CFX_AffineMatrix* pObj2Device); |
124 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_A
ffineMatrix* pObj2Device); | 126 FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, |
125 FX_BOOL ProcessTransparency(const CPDF_PageObject* PageO
bj, const CFX_AffineMatrix* pObj2Device); | 127 const CFX_AffineMatrix* pObj2Device, |
126 void ProcessObjectNoClip(const CPDF_PageObject* PageO
bj, const CFX_AffineMatrix* pObj2Device); | 128 IFX_Pause* pPause); |
127 void DrawObjWithBackground(const CPDF_PageObject* pOb
j, const CFX_AffineMatrix* pObj2Device); | 129 CPDF_RenderOptions m_Options; |
128 FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_Affi
neMatrix* pObj2Device); | 130 CPDF_Dictionary* m_pFormResource; |
129 FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX
_AffineMatrix* pObj2Device); | 131 CPDF_Dictionary* m_pPageResource; |
130 void ProcessPathPattern(CPDF_PathObject* pPathObj, co
nst CFX_AffineMatrix* pObj2Device, int& filltype, FX_BOOL& bStroke); | 132 CFX_PtrArray m_Type3FontCache; |
131 void DrawPathWithPattern(CPDF_PathObject* pPathObj, c
onst CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, FX_BOOL bStroke); | 133 CPDF_RenderContext* GetContext() { return m_pContext; } |
132 void DrawTilingPattern(CPDF_TilingPattern* pPattern,
CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke)
; | 134 |
133 void DrawShadingPattern(CPDF_ShadingPattern* pPattern
, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStrok
e); | 135 protected: |
134 FX_BOOL SelectClipPath(CPDF_PathObject* pPathObj, const
CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke); | 136 friend class CPDF_ImageRenderer; |
135 FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, const
CFX_AffineMatrix* pObj2Device); | 137 friend class CPDF_RenderContext; |
136 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, c
onst CFX_AffineMatrix* pImage2Device); | 138 void ProcessClipPath(CPDF_ClipPath ClipPath, |
137 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, const C
FX_AffineMatrix* pImage2Device); | 139 const CFX_AffineMatrix* pObj2Device); |
138 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitm
ap, FX_ARGB fill_argb, int bitmap_alpha, | 140 void DrawClipPath(CPDF_ClipPath ClipPath, |
139 const CFX_AffineMatrix* pImage2Device, CPDF_
ImageCache* pImageCache, FX_DWORD flags); | 141 const CFX_AffineMatrix* pObj2Device); |
140 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int l
eft, int top, FX_ARGB mask_argb, | 142 FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj, |
141 int bitmap_alpha, int blend_mode, int bIso
lated); | 143 const CFX_AffineMatrix* pObj2Device); |
142 FX_BOOL ProcessShading(CPDF_ShadingObject* pShadingObj,
const CFX_AffineMatrix* pObj2Device); | 144 void ProcessObjectNoClip(const CPDF_PageObject* PageObj, |
143 void DrawShading(CPDF_ShadingPattern* pPattern, CFX_A
ffineMatrix* pMatrix, FX_RECT& clip_rect, | 145 const CFX_AffineMatrix* pObj2Device); |
144 int alpha, FX_BOOL bAlphaMode); | 146 void DrawObjWithBackground(const CPDF_PageObject* pObj, |
145 FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj,
const CFX_AffineMatrix* pObj2Device); | 147 const CFX_AffineMatrix* pObj2Device); |
146 FX_BOOL ProcessText(const CPDF_TextObject* textobj, cons
t CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath); | 148 FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, |
147 void DrawTextPathWithPattern(const CPDF_TextObject* t
extobj, const CFX_AffineMatrix* pObj2Device, | 149 const CFX_AffineMatrix* pObj2Device); |
148 CPDF_Font* pFont, FX_FLOAT font_size
, | 150 FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, |
149 const CFX_AffineMatrix* pTextMatrix,
FX_BOOL bFill, FX_BOOL bStroke); | 151 const CFX_AffineMatrix* pObj2Device); |
150 FX_BOOL ProcessForm(CPDF_FormObject* pFormObj, const CFX
_AffineMatrix* pObj2Device); | 152 void ProcessPathPattern(CPDF_PathObject* pPathObj, |
151 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT&
rect, int& left, int& top, | 153 const CFX_AffineMatrix* pObj2Device, |
152 FX_BOOL bBackAlphaRequired); | 154 int& filltype, |
153 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRec
t, const CFX_AffineMatrix* pMatrix); | 155 FX_BOOL& bStroke); |
154 void Init(CPDF_RenderContext* pParent); | 156 void DrawPathWithPattern(CPDF_PathObject* pPathObj, |
155 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); | 157 const CFX_AffineMatrix* pObj2Device, |
156 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj
, FX_BOOL bStroke); | 158 CPDF_Color* pColor, |
157 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; | 159 FX_BOOL bStroke); |
158 FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL
bType3 = FALSE) const; | 160 void DrawTilingPattern(CPDF_TilingPattern* pPattern, |
159 FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const
; | 161 CPDF_PageObject* pPageObj, |
160 CPDF_RenderContext* m_pContext; | 162 const CFX_AffineMatrix* pObj2Device, |
161 FX_BOOL m_bStopped; | 163 FX_BOOL bStroke); |
162 void DitherObjectArea(const CPDF_PageObject* pObj, co
nst CFX_AffineMatrix* pObj2Device); | 164 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, |
163 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj
, const CFX_AffineMatrix* pObj2Device, FX_BOOL bLogical, FX_RECT &rect) const; | 165 CPDF_PageObject* pPageObj, |
164 void GetScaledMatrix(CFX_Matrix &matrix) const; | 166 const CFX_AffineMatrix* pObj2Device, |
165 | 167 FX_BOOL bStroke); |
166 protected: | 168 FX_BOOL SelectClipPath(CPDF_PathObject* pPathObj, |
167 static const int kRenderMaxRecursionDepth = 64; | 169 const CFX_AffineMatrix* pObj2Device, |
168 static int s_CurrentRecursionDepth; | 170 FX_BOOL bStroke); |
169 | 171 FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, |
170 CFX_RenderDevice* m_pDevice; | 172 const CFX_AffineMatrix* pObj2Device); |
171 CFX_AffineMatrix m_DeviceMatrix; | 173 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, |
172 CPDF_ClipPath m_LastClipPath; | 174 const CFX_AffineMatrix* pImage2Device); |
173 const CPDF_PageObject* m_pCurObj; | 175 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, |
174 const CPDF_PageObject* m_pStopObj; | 176 const CFX_AffineMatrix* pImage2Device); |
175 CPDF_GraphicStates m_InitialStates; | 177 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, |
176 int m_HalftoneLimit; | 178 FX_ARGB fill_argb, |
177 IPDF_ObjectRenderer* m_pObjectRenderer; | 179 int bitmap_alpha, |
178 FX_BOOL m_bPrint; | 180 const CFX_AffineMatrix* pImage2Device, |
179 int m_Transparency; | 181 CPDF_ImageCache* pImageCache, |
180 int m_DitherBits; | 182 FX_DWORD flags); |
181 FX_BOOL m_bDropObjects; | 183 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, |
182 FX_BOOL m_bStdCS; | 184 int left, |
183 FX_DWORD m_GroupFamily; | 185 int top, |
184 FX_BOOL m_bLoadMask; | 186 FX_ARGB mask_argb, |
185 CPDF_Type3Char * m_pType3Char; | 187 int bitmap_alpha, |
186 FX_ARGB m_T3FillColor; | 188 int blend_mode, |
187 int m_curBlend; | 189 int bIsolated); |
188 }; | 190 FX_BOOL ProcessShading(CPDF_ShadingObject* pShadingObj, |
189 class CPDF_ImageLoader | 191 const CFX_AffineMatrix* pObj2Device); |
190 { | 192 void DrawShading(CPDF_ShadingPattern* pPattern, |
191 public: | 193 CFX_AffineMatrix* pMatrix, |
192 CPDF_ImageLoader() | 194 FX_RECT& clip_rect, |
193 { | 195 int alpha, |
194 m_pBitmap = NULL; | 196 FX_BOOL bAlphaMode); |
195 m_pMask = NULL; | 197 FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj, |
196 m_MatteColor = 0; | 198 const CFX_AffineMatrix* pObj2Device); |
197 m_bCached = FALSE; | 199 FX_BOOL ProcessText(const CPDF_TextObject* textobj, |
198 m_nDownsampleWidth = 0; | 200 const CFX_AffineMatrix* pObj2Device, |
199 m_nDownsampleHeight = 0; | 201 CFX_PathData* pClippingPath); |
200 } | 202 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, |
201 | 203 const CFX_AffineMatrix* pObj2Device, |
202 FX_BOOL Load(const CPDF_ImageObject* pIm
age, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily
= 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL); | 204 CPDF_Font* pFont, |
203 | 205 FX_FLOAT font_size, |
204 FX_BOOL StartLoadImage(const CPDF_ImageO
bject* 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); | 206 const CFX_AffineMatrix* pTextMatrix, |
205 FX_BOOL Continue(void* LoadHandle, IFX_P
ause* pPause); | 207 FX_BOOL bFill, |
206 ~CPDF_ImageLoader(); | 208 FX_BOOL bStroke); |
207 CFX_DIBSource* m_pBitmap; | 209 FX_BOOL ProcessForm(CPDF_FormObject* pFormObj, |
208 CFX_DIBSource* m_pMask; | 210 const CFX_AffineMatrix* pObj2Device); |
209 FX_DWORD m_MatteColor; | 211 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, |
210 FX_BOOL m_bCached; | 212 const FX_RECT& rect, |
211 protected: | 213 int& left, |
212 int32_t m_nDownsampleWidth; | 214 int& top, |
213 int32_t m_nDownsampleHeight; | 215 FX_BOOL bBackAlphaRequired); |
214 }; | 216 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, |
215 class CPDF_ProgressiveImageLoaderHandle | 217 FX_RECT* pClipRect, |
216 { | 218 const CFX_AffineMatrix* pMatrix); |
217 public: | 219 void Init(CPDF_RenderContext* pParent); |
218 CPDF_ProgressiveImageLoaderHandle(); | 220 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); |
219 ~CPDF_ProgressiveImageLoaderHandle(); | 221 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, |
220 | 222 FX_BOOL bStroke); |
221 FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF
_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_D
WORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatu
s = NULL, int32_t nDownsampleWidth = 0, int32_t nDownsampleHeight = 0); | 223 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; |
222 FX_BOOL Continue(IFX_Pause* pPause); | 224 FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, |
223 protected: | 225 FX_BOOL bType3 = FALSE) const; |
224 CPDF_ImageLoader* m_pImageLoader; | 226 FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const; |
225 CPDF_PageRenderCache* m_pCache; | 227 CPDF_RenderContext* m_pContext; |
226 CPDF_ImageObject* m_pImage; | 228 FX_BOOL m_bStopped; |
227 int32_t m_nDownsampleWidth; | 229 void DitherObjectArea(const CPDF_PageObject* pObj, |
228 int32_t m_nDownsampleHeight; | 230 const CFX_AffineMatrix* pObj2Device); |
| 231 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, |
| 232 const CFX_AffineMatrix* pObj2Device, |
| 233 FX_BOOL bLogical, |
| 234 FX_RECT& rect) const; |
| 235 void GetScaledMatrix(CFX_Matrix& matrix) const; |
| 236 |
| 237 protected: |
| 238 static const int kRenderMaxRecursionDepth = 64; |
| 239 static int s_CurrentRecursionDepth; |
| 240 |
| 241 CFX_RenderDevice* m_pDevice; |
| 242 CFX_AffineMatrix m_DeviceMatrix; |
| 243 CPDF_ClipPath m_LastClipPath; |
| 244 const CPDF_PageObject* m_pCurObj; |
| 245 const CPDF_PageObject* m_pStopObj; |
| 246 CPDF_GraphicStates m_InitialStates; |
| 247 int m_HalftoneLimit; |
| 248 IPDF_ObjectRenderer* m_pObjectRenderer; |
| 249 FX_BOOL m_bPrint; |
| 250 int m_Transparency; |
| 251 int m_DitherBits; |
| 252 FX_BOOL m_bDropObjects; |
| 253 FX_BOOL m_bStdCS; |
| 254 FX_DWORD m_GroupFamily; |
| 255 FX_BOOL m_bLoadMask; |
| 256 CPDF_Type3Char* m_pType3Char; |
| 257 FX_ARGB m_T3FillColor; |
| 258 int m_curBlend; |
| 259 }; |
| 260 class CPDF_ImageLoader { |
| 261 public: |
| 262 CPDF_ImageLoader() { |
| 263 m_pBitmap = NULL; |
| 264 m_pMask = NULL; |
| 265 m_MatteColor = 0; |
| 266 m_bCached = FALSE; |
| 267 m_nDownsampleWidth = 0; |
| 268 m_nDownsampleHeight = 0; |
| 269 } |
| 270 |
| 271 FX_BOOL Load(const CPDF_ImageObject* pImage, |
| 272 CPDF_PageRenderCache* pCache, |
| 273 FX_BOOL bStdCS = FALSE, |
| 274 FX_DWORD GroupFamily = 0, |
| 275 FX_BOOL bLoadMask = FALSE, |
| 276 CPDF_RenderStatus* pRenderStatus = NULL); |
| 277 |
| 278 FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, |
| 279 CPDF_PageRenderCache* pCache, |
| 280 void*& LoadHandle, |
| 281 FX_BOOL bStdCS = FALSE, |
| 282 FX_DWORD GroupFamily = 0, |
| 283 FX_BOOL bLoadMask = FALSE, |
| 284 CPDF_RenderStatus* pRenderStatus = NULL, |
| 285 int32_t nDownsampleWidth = 0, |
| 286 int32_t nDownsampleHeight = 0); |
| 287 FX_BOOL Continue(void* LoadHandle, IFX_Pause* pPause); |
| 288 ~CPDF_ImageLoader(); |
| 289 CFX_DIBSource* m_pBitmap; |
| 290 CFX_DIBSource* m_pMask; |
| 291 FX_DWORD m_MatteColor; |
| 292 FX_BOOL m_bCached; |
| 293 |
| 294 protected: |
| 295 int32_t m_nDownsampleWidth; |
| 296 int32_t m_nDownsampleHeight; |
| 297 }; |
| 298 class CPDF_ProgressiveImageLoaderHandle { |
| 299 public: |
| 300 CPDF_ProgressiveImageLoaderHandle(); |
| 301 ~CPDF_ProgressiveImageLoaderHandle(); |
| 302 |
| 303 FX_BOOL Start(CPDF_ImageLoader* pImageLoader, |
| 304 const CPDF_ImageObject* pImage, |
| 305 CPDF_PageRenderCache* pCache, |
| 306 FX_BOOL bStdCS = FALSE, |
| 307 FX_DWORD GroupFamily = 0, |
| 308 FX_BOOL bLoadMask = FALSE, |
| 309 CPDF_RenderStatus* pRenderStatus = NULL, |
| 310 int32_t nDownsampleWidth = 0, |
| 311 int32_t nDownsampleHeight = 0); |
| 312 FX_BOOL Continue(IFX_Pause* pPause); |
| 313 |
| 314 protected: |
| 315 CPDF_ImageLoader* m_pImageLoader; |
| 316 CPDF_PageRenderCache* m_pCache; |
| 317 CPDF_ImageObject* m_pImage; |
| 318 int32_t m_nDownsampleWidth; |
| 319 int32_t m_nDownsampleHeight; |
229 }; | 320 }; |
230 class CFX_ImageTransformer; | 321 class CFX_ImageTransformer; |
231 class CPDF_ImageRenderer : public IPDF_ObjectRenderer | 322 class CPDF_ImageRenderer : public IPDF_ObjectRenderer { |
232 { | 323 public: |
233 public: | 324 CPDF_ImageRenderer(); |
234 CPDF_ImageRenderer(); | 325 ~CPDF_ImageRenderer(); |
235 ~CPDF_ImageRenderer(); | 326 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
236 FX_BOOL» » Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject*
pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FXDI
B_BLEND_NORMAL); | 327 const CPDF_PageObject* pObj, |
237 FX_BOOL» » Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* p
DIBSource, FX_ARGB bitmap_argb, | 328 const CFX_AffineMatrix* pObj2Device, |
238 int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, F
X_DWORD flags, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL); | 329 FX_BOOL bStdCS, |
239 FX_BOOL» » Continue(IFX_Pause* pPause); | 330 int blendType = FXDIB_BLEND_NORMAL); |
240 protected: | 331 FX_BOOL Start(CPDF_RenderStatus* pStatus, |
241 CPDF_RenderStatus*» m_pRenderStatus; | 332 const CFX_DIBSource* pDIBSource, |
242 CPDF_ImageObject*» m_pImageObject; | 333 FX_ARGB bitmap_argb, |
243 int»» » » » m_Status; | 334 int bitmap_alpha, |
244 const CFX_AffineMatrix* m_pObj2Device; | 335 const CFX_AffineMatrix* pImage2Device, |
245 CFX_AffineMatrix» m_ImageMatrix; | 336 FX_DWORD flags, |
246 CPDF_ImageLoader» m_Loader; | 337 FX_BOOL bStdCS, |
247 const CFX_DIBSource*» » m_pDIBSource; | 338 int blendType = FXDIB_BLEND_NORMAL); |
248 CFX_DIBitmap*» » m_pClone; | 339 FX_BOOL Continue(IFX_Pause* pPause); |
249 int»» » » » m_BitmapAlpha; | 340 |
250 FX_BOOL» » » » m_bPatternColor; | 341 protected: |
251 CPDF_Pattern*» » m_pPattern; | 342 CPDF_RenderStatus* m_pRenderStatus; |
252 FX_ARGB» » » » m_FillArgb; | 343 CPDF_ImageObject* m_pImageObject; |
253 FX_DWORD» » » m_Flags; | 344 int m_Status; |
254 CPDF_QuickStretcher*» m_pQuickStretcher; | 345 const CFX_AffineMatrix* m_pObj2Device; |
255 CFX_ImageTransformer*» m_pTransformer; | 346 CFX_AffineMatrix m_ImageMatrix; |
256 void*» » » m_DeviceHandle; | 347 CPDF_ImageLoader m_Loader; |
257 void* m_LoadHandle; | 348 const CFX_DIBSource* m_pDIBSource; |
258 FX_BOOL» » » » m_bStdCS; | 349 CFX_DIBitmap* m_pClone; |
259 int»» » » » m_BlendType; | 350 int m_BitmapAlpha; |
260 FX_BOOL» » » » StartBitmapAlpha(); | 351 FX_BOOL m_bPatternColor; |
261 FX_BOOL» » » » StartDIBSource(); | 352 CPDF_Pattern* m_pPattern; |
262 FX_BOOL» » » » StartRenderDIBSource(); | 353 FX_ARGB m_FillArgb; |
263 FX_BOOL» » » » StartLoadDIBSource(); | 354 FX_DWORD m_Flags; |
264 FX_BOOL» » » » DrawMaskedImage(); | 355 CPDF_QuickStretcher* m_pQuickStretcher; |
265 FX_BOOL» » » » DrawPatternImage(const CFX_Matrix* pObj2
Device); | 356 CFX_ImageTransformer* m_pTransformer; |
266 }; | 357 void* m_DeviceHandle; |
267 class CPDF_ScaledRenderBuffer | 358 void* m_LoadHandle; |
268 { | 359 FX_BOOL m_bStdCS; |
269 public: | 360 int m_BlendType; |
270 CPDF_ScaledRenderBuffer(); | 361 FX_BOOL StartBitmapAlpha(); |
271 ~CPDF_ScaledRenderBuffer(); | 362 FX_BOOL StartDIBSource(); |
272 FX_BOOL» » » » Initialize(CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice, FX_RECT* pRect, | 363 FX_BOOL StartRenderDIBSource(); |
273 const CPDF_PageObject* pObj, const CPDF_Rende
rOptions *pOptions = NULL, int max_dpi = 0); | 364 FX_BOOL StartLoadDIBSource(); |
274 CFX_RenderDevice*» GetDevice() | 365 FX_BOOL DrawMaskedImage(); |
275 { | 366 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); |
276 return m_pBitmapDevice ? m_pBitmapDevice : m_pDevice; | 367 }; |
277 } | 368 class CPDF_ScaledRenderBuffer { |
278 CFX_AffineMatrix*» GetMatrix() | 369 public: |
279 { | 370 CPDF_ScaledRenderBuffer(); |
280 return &m_Matrix; | 371 ~CPDF_ScaledRenderBuffer(); |
281 } | 372 FX_BOOL Initialize(CPDF_RenderContext* pContext, |
282 void» » » » OutputToDevice(); | 373 CFX_RenderDevice* pDevice, |
283 private: | 374 FX_RECT* pRect, |
284 CFX_RenderDevice*» m_pDevice; | 375 const CPDF_PageObject* pObj, |
285 CPDF_RenderContext*»m_pContext; | 376 const CPDF_RenderOptions* pOptions = NULL, |
286 FX_RECT» » » » m_Rect; | 377 int max_dpi = 0); |
287 const CPDF_PageObject* m_pObject; | 378 CFX_RenderDevice* GetDevice() { |
288 CFX_FxgeDevice*» m_pBitmapDevice; | 379 return m_pBitmapDevice ? m_pBitmapDevice : m_pDevice; |
289 CFX_AffineMatrix» m_Matrix; | 380 } |
| 381 CFX_AffineMatrix* GetMatrix() { return &m_Matrix; } |
| 382 void OutputToDevice(); |
| 383 |
| 384 private: |
| 385 CFX_RenderDevice* m_pDevice; |
| 386 CPDF_RenderContext* m_pContext; |
| 387 FX_RECT m_Rect; |
| 388 const CPDF_PageObject* m_pObject; |
| 389 CFX_FxgeDevice* m_pBitmapDevice; |
| 390 CFX_AffineMatrix m_Matrix; |
290 }; | 391 }; |
291 class ICodec_ScanlineDecoder; | 392 class ICodec_ScanlineDecoder; |
292 class CPDF_QuickStretcher | 393 class CPDF_QuickStretcher { |
293 { | 394 public: |
294 public: | 395 CPDF_QuickStretcher(); |
295 CPDF_QuickStretcher(); | 396 ~CPDF_QuickStretcher(); |
296 ~CPDF_QuickStretcher(); | 397 FX_BOOL Start(CPDF_ImageObject* pImageObj, |
297 FX_BOOL» » Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pIm
age2Device, const FX_RECT* pClipBox); | 398 CFX_AffineMatrix* pImage2Device, |
298 FX_BOOL» » Continue(IFX_Pause* pPause); | 399 const FX_RECT* pClipBox); |
299 CFX_DIBitmap*» m_pBitmap; | 400 FX_BOOL Continue(IFX_Pause* pPause); |
300 int»» » m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop; | 401 CFX_DIBitmap* m_pBitmap; |
301 int»» » m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight
; | 402 int m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop; |
302 int»» » m_Bpp, m_SrcWidth, m_SrcHeight; | 403 int m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight; |
303 FX_BOOL» » m_bFlipX, m_bFlipY; | 404 int m_Bpp, m_SrcWidth, m_SrcHeight; |
304 CPDF_ColorSpace*» m_pCS; | 405 FX_BOOL m_bFlipX, m_bFlipY; |
305 ICodec_ScanlineDecoder*» m_pDecoder; | 406 CPDF_ColorSpace* m_pCS; |
306 CPDF_StreamAcc m_StreamAcc; | 407 ICodec_ScanlineDecoder* m_pDecoder; |
307 int»» » m_LineIndex; | 408 CPDF_StreamAcc m_StreamAcc; |
308 }; | 409 int m_LineIndex; |
309 class CPDF_DeviceBuffer | 410 }; |
310 { | 411 class CPDF_DeviceBuffer { |
311 public: | 412 public: |
312 CPDF_DeviceBuffer(); | 413 CPDF_DeviceBuffer(); |
313 ~CPDF_DeviceBuffer(); | 414 ~CPDF_DeviceBuffer(); |
314 FX_BOOL» » » » Initialize(CPDF_RenderContext* pContext,
CFX_RenderDevice* pDevice, FX_RECT* pRect, | 415 FX_BOOL Initialize(CPDF_RenderContext* pContext, |
315 const CPDF_PageObject* pObj, int max_dpi = 0)
; | 416 CFX_RenderDevice* pDevice, |
316 void» » » » OutputToDevice(); | 417 FX_RECT* pRect, |
317 CFX_DIBitmap*» » GetBitmap() const | 418 const CPDF_PageObject* pObj, |
318 { | 419 int max_dpi = 0); |
319 return m_pBitmap; | 420 void OutputToDevice(); |
320 } | 421 CFX_DIBitmap* GetBitmap() const { return m_pBitmap; } |
321 const CFX_AffineMatrix*» GetMatrix() const | 422 const CFX_AffineMatrix* GetMatrix() const { return &m_Matrix; } |
322 { | 423 |
323 return &m_Matrix; | 424 private: |
324 } | 425 CFX_RenderDevice* m_pDevice; |
325 private: | 426 CPDF_RenderContext* m_pContext; |
326 CFX_RenderDevice*» m_pDevice; | 427 FX_RECT m_Rect; |
327 CPDF_RenderContext*»m_pContext; | 428 const CPDF_PageObject* m_pObject; |
328 FX_RECT» » » » m_Rect; | 429 CFX_DIBitmap* m_pBitmap; |
329 const CPDF_PageObject* m_pObject; | 430 CFX_AffineMatrix m_Matrix; |
330 CFX_DIBitmap*» » m_pBitmap; | 431 }; |
331 CFX_AffineMatrix» m_Matrix; | 432 class CPDF_ImageCache { |
332 }; | 433 public: |
333 class CPDF_ImageCache | 434 CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream); |
334 { | 435 ~CPDF_ImageCache(); |
335 public: | 436 void ClearImageData(); |
336 CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream); | 437 void Reset(const CFX_DIBitmap* pBitmap); |
337 ~CPDF_ImageCache(); | 438 FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, |
338 void» » » » ClearImageData(); | 439 CFX_DIBSource*& pMask, |
339 void» » » » Reset(const CFX_DIBitmap* pBitmap); | 440 FX_DWORD& MatteColor, |
340 FX_BOOL» » » » GetCachedBitmap(CFX_DIBSource*& pBitmap,
CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, | 441 CPDF_Dictionary* pPageResources, |
341 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFa
mily = 0, FX_BOOL bLoadMask = FALSE, | 442 FX_BOOL bStdCS = FALSE, |
342 CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); | 443 FX_DWORD GroupFamily = 0, |
343 FX_DWORD» » » EstimateSize() const | 444 FX_BOOL bLoadMask = FALSE, |
344 { | 445 CPDF_RenderStatus* pRenderStatus = NULL, |
345 return m_dwCacheSize; | 446 int32_t downsampleWidth = 0, |
346 } | 447 int32_t downsampleHeight = 0); |
347 FX_DWORD» » » GetTimeCount() const | 448 FX_DWORD EstimateSize() const { return m_dwCacheSize; } |
348 { | 449 FX_DWORD GetTimeCount() const { return m_dwTimeCount; } |
349 return m_dwTimeCount; | 450 CPDF_Stream* GetStream() const { return m_pStream; } |
350 } | 451 void SetTimeCount(FX_DWORD dwTimeCount) { m_dwTimeCount = dwTimeCount; } |
351 CPDF_Stream*» » GetStream() const | 452 int m_dwTimeCount; |
352 { | 453 |
353 return m_pStream; | 454 public: |
354 } | 455 int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, |
355 void» » » » SetTimeCount(FX_DWORD dwTimeCount) | 456 CPDF_Dictionary* pPageResources, |
356 { | 457 FX_BOOL bStdCS = FALSE, |
357 m_dwTimeCount = dwTimeCount; | 458 FX_DWORD GroupFamily = 0, |
358 } | 459 FX_BOOL bLoadMask = FALSE, |
359 int»» » » » m_dwTimeCount; | 460 CPDF_RenderStatus* pRenderStatus = NULL, |
360 public: | 461 int32_t downsampleWidth = 0, |
361 int»» » » » StartGetCachedBitmap(CPDF_Dictionary* pF
ormResources, CPDF_Dictionary* pPageResources, | 462 int32_t downsampleHeight = 0); |
362 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, | 463 int Continue(IFX_Pause* pPause); |
363 FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL,
int32_t downsampleWidth = 0, int32_t downsampleHeight = 0); | 464 int ContinueGetCachedBitmap(); |
364 int»» » » » Continue(IFX_Pause* pPause); | 465 CFX_DIBSource* DetachBitmap(); |
365 int » » » » ContinueGetCachedBitmap(); | 466 CFX_DIBSource* DetachMask(); |
366 CFX_DIBSource*» » DetachBitmap(); | 467 CFX_DIBSource* m_pCurBitmap; |
367 CFX_DIBSource*» » DetachMask(); | 468 CFX_DIBSource* m_pCurMask; |
368 CFX_DIBSource*» » m_pCurBitmap; | 469 FX_DWORD m_MatteColor; |
369 CFX_DIBSource*» » m_pCurMask; | 470 CPDF_RenderStatus* m_pRenderStatus; |
370 FX_DWORD» » » m_MatteColor; | 471 |
371 CPDF_RenderStatus* m_pRenderStatus; | 472 protected: |
372 protected: | 473 CPDF_Document* m_pDocument; |
373 CPDF_Document*» » m_pDocument; | 474 CPDF_Stream* m_pStream; |
374 CPDF_Stream*» » m_pStream; | 475 CFX_DIBSource* m_pCachedBitmap; |
375 CFX_DIBSource*» » m_pCachedBitmap; | 476 CFX_DIBSource* m_pCachedMask; |
376 CFX_DIBSource*» » m_pCachedMask; | 477 FX_DWORD m_dwCacheSize; |
377 FX_DWORD» » » m_dwCacheSize; | 478 void CalcSize(); |
378 void» CalcSize(); | |
379 }; | 479 }; |
380 typedef struct { | 480 typedef struct { |
381 FX_FLOAT» » » m_DecodeMin; | 481 FX_FLOAT m_DecodeMin; |
382 FX_FLOAT» » » m_DecodeStep; | 482 FX_FLOAT m_DecodeStep; |
383 int»» » » » m_ColorKeyMin; | 483 int m_ColorKeyMin; |
384 int»» » » » m_ColorKeyMax; | 484 int m_ColorKeyMax; |
385 } DIB_COMP_DATA; | 485 } DIB_COMP_DATA; |
386 class CPDF_DIBSource : public CFX_DIBSource | 486 class CPDF_DIBSource : public CFX_DIBSource { |
387 { | 487 public: |
388 public: | 488 CPDF_DIBSource(); |
389 CPDF_DIBSource(); | 489 virtual ~CPDF_DIBSource(); |
390 virtual ~CPDF_DIBSource(); | 490 FX_BOOL Load(CPDF_Document* pDoc, |
391 FX_BOOL» » » » Load(CPDF_Document* pDoc, const CPDF_Str
eam* pStream, | 491 const CPDF_Stream* pStream, |
392 CPDF_DIBSource** ppMask, FX_DWORD* pMatteColor, | 492 CPDF_DIBSource** ppMask, |
393 CPDF_Dictionary* pFormResources, CPDF_Dictionary* p
PageResources, | 493 FX_DWORD* pMatteColor, |
394 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, F
X_BOOL bLoadMask = FALSE); | 494 CPDF_Dictionary* pFormResources, |
395 virtual FX_BOOL» » SkipToScanline(int line, IFX_Pause* pPause) cons
t; | 495 CPDF_Dictionary* pPageResources, |
396 virtual» uint8_t*» GetBuffer() const; | 496 FX_BOOL bStdCS = FALSE, |
397 virtual const uint8_t*» GetScanline(int line) const; | 497 FX_DWORD GroupFamily = 0, |
398 virtual void» » DownSampleScanline(int line, uint8_t* dest_scan,
int dest_bpp, | 498 FX_BOOL bLoadMask = FALSE); |
399 int dest_width, FX_BOOL bFlipX, int c
lip_left, int clip_width) const; | 499 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; |
400 virtual void» » SetDownSampleSize(int dest_width, int dest_heigh
t) const; | 500 virtual uint8_t* GetBuffer() const; |
401 CFX_DIBitmap*» » GetBitmap() const; | 501 virtual const uint8_t* GetScanline(int line) const; |
402 void» » » » ReleaseBitmap(CFX_DIBitmap*) const; | 502 virtual void DownSampleScanline(int line, |
403 void» » » » ClearImageData(); | 503 uint8_t* dest_scan, |
404 public: | 504 int dest_bpp, |
405 int»» » » » StartLoadDIBSource(CPDF_Document* pDoc,
const CPDF_Stream* pStream, FX_BOOL bHasMask, | 505 int dest_width, |
406 CPDF_Dictionary* pFormResources, CPDF
_Dictionary* pPageResources, | 506 FX_BOOL bFlipX, |
407 FX_BOOL bStdCS = FALSE, FX_DWORD Grou
pFamily = 0, FX_BOOL bLoadMask = FALSE); | 507 int clip_left, |
408 int»» » » » ContinueLoadDIBSource(IFX_Pause* pPause)
; | 508 int clip_width) const; |
409 int»» » » » StratLoadMask(); | 509 virtual void SetDownSampleSize(int dest_width, int dest_height) const; |
410 int»» » » » StartLoadMaskDIB(); | 510 CFX_DIBitmap* GetBitmap() const; |
411 int»» » » » ContinueLoadMaskDIB(IFX_Pause* pPause); | 511 void ReleaseBitmap(CFX_DIBitmap*) const; |
412 int»» » » » ContinueToLoadMask(); | 512 void ClearImageData(); |
413 CPDF_DIBSource*» » DetachMask(); | 513 |
414 CPDF_DIBSource*» » m_pMask; | 514 public: |
415 FX_DWORD» » » m_MatteColor; | 515 int StartLoadDIBSource(CPDF_Document* pDoc, |
416 void*» » » m_pJbig2Context; | 516 const CPDF_Stream* pStream, |
417 CPDF_StreamAcc*» » m_pGlobalStream; | 517 FX_BOOL bHasMask, |
418 FX_BOOL» » » » m_bStdCS; | 518 CPDF_Dictionary* pFormResources, |
419 int»» » » » m_Status; | 519 CPDF_Dictionary* pPageResources, |
420 CPDF_Object*» » m_pMaskStream; | 520 FX_BOOL bStdCS = FALSE, |
421 FX_BOOL» » » » m_bHasMask; | 521 FX_DWORD GroupFamily = 0, |
422 protected: | 522 FX_BOOL bLoadMask = FALSE); |
423 FX_BOOL» » » » LoadColorInfo(CPDF_Dictionary* pFormReso
urces, CPDF_Dictionary* pPageResources); | 523 int ContinueLoadDIBSource(IFX_Pause* pPause); |
424 DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, FX_BOOL&
bColorKey); | 524 int StratLoadMask(); |
425 CPDF_DIBSource*» » LoadMask(FX_DWORD& MatteColor); | 525 int StartLoadMaskDIB(); |
426 CPDF_DIBSource*» » LoadMaskDIB(CPDF_Stream* pMask); | 526 int ContinueLoadMaskDIB(IFX_Pause* pPause); |
427 void» » » » LoadJpxBitmap(); | 527 int ContinueToLoadMask(); |
428 void» » » » LoadPalette(); | 528 CPDF_DIBSource* DetachMask(); |
429 int»» » » » CreateDecoder(); | 529 CPDF_DIBSource* m_pMask; |
430 void» » » » TranslateScanline24bpp(uint8_t* dest_sca
n, const uint8_t* src_scan) const; | 530 FX_DWORD m_MatteColor; |
431 void ValidateDictParam(); | 531 void* m_pJbig2Context; |
432 CPDF_Document*» » m_pDocument; | 532 CPDF_StreamAcc* m_pGlobalStream; |
433 const CPDF_Stream*» m_pStream; | 533 FX_BOOL m_bStdCS; |
434 CPDF_StreamAcc*» » m_pStreamAcc; | 534 int m_Status; |
435 const CPDF_Dictionary*» m_pDict; | 535 CPDF_Object* m_pMaskStream; |
436 CPDF_ColorSpace*» m_pColorSpace; | 536 FX_BOOL m_bHasMask; |
437 FX_DWORD» » » m_Family; | 537 |
438 FX_DWORD» » » m_bpc; | 538 protected: |
439 FX_DWORD» » » m_bpc_orig; | 539 FX_BOOL LoadColorInfo(CPDF_Dictionary* pFormResources, |
440 FX_DWORD» » » m_nComponents; | 540 CPDF_Dictionary* pPageResources); |
441 FX_DWORD» » » m_GroupFamily; | 541 DIB_COMP_DATA* GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode, |
442 FX_BOOL» » » » m_bLoadMask; | 542 FX_BOOL& bColorKey); |
443 FX_BOOL» » » » m_bDefaultDecode; | 543 CPDF_DIBSource* LoadMask(FX_DWORD& MatteColor); |
444 FX_BOOL» » » » m_bImageMask; | 544 CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask); |
445 FX_BOOL» » » » m_bDoBpcCheck; | 545 void LoadJpxBitmap(); |
446 FX_BOOL» » » » m_bColorKey; | 546 void LoadPalette(); |
447 DIB_COMP_DATA*» » m_pCompData; | 547 int CreateDecoder(); |
448 uint8_t*» » » m_pLineBuf; | 548 void TranslateScanline24bpp(uint8_t* dest_scan, |
449 uint8_t*» » » m_pMaskedLine; | 549 const uint8_t* src_scan) const; |
450 nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; | 550 void ValidateDictParam(); |
451 ICodec_ScanlineDecoder*» m_pDecoder; | 551 CPDF_Document* m_pDocument; |
452 }; | 552 const CPDF_Stream* m_pStream; |
453 #define FPDF_HUGE_IMAGE_SIZE» 60000000 | 553 CPDF_StreamAcc* m_pStreamAcc; |
454 class CPDF_DIBTransferFunc : public CFX_FilteredDIB | 554 const CPDF_Dictionary* m_pDict; |
455 { | 555 CPDF_ColorSpace* m_pColorSpace; |
456 public: | 556 FX_DWORD m_Family; |
457 CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc); | 557 FX_DWORD m_bpc; |
458 virtual FXDIB_Format» GetDestFormat(); | 558 FX_DWORD m_bpc_orig; |
459 virtual FX_ARGB*» » GetDestPalette() | 559 FX_DWORD m_nComponents; |
460 { | 560 FX_DWORD m_GroupFamily; |
461 return NULL; | 561 FX_BOOL m_bLoadMask; |
462 } | 562 FX_BOOL m_bDefaultDecode; |
463 virtual void» » » TranslateScanline(uint8_t* dest_buf, con
st uint8_t* src_buf) const; | 563 FX_BOOL m_bImageMask; |
464 virtual void» » » TranslateDownSamples(uint8_t* dest_buf,
const uint8_t* src_buf, int pixels, int Bpp) const; | 564 FX_BOOL m_bDoBpcCheck; |
465 const uint8_t*» » » » m_RampR; | 565 FX_BOOL m_bColorKey; |
466 const uint8_t*» » » » m_RampG; | 566 DIB_COMP_DATA* m_pCompData; |
467 const uint8_t*» » » » m_RampB; | 567 uint8_t* m_pLineBuf; |
| 568 uint8_t* m_pMaskedLine; |
| 569 nonstd::unique_ptr<CFX_DIBitmap> m_pCachedBitmap; |
| 570 ICodec_ScanlineDecoder* m_pDecoder; |
| 571 }; |
| 572 #define FPDF_HUGE_IMAGE_SIZE 60000000 |
| 573 class CPDF_DIBTransferFunc : public CFX_FilteredDIB { |
| 574 public: |
| 575 CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc); |
| 576 virtual FXDIB_Format GetDestFormat(); |
| 577 virtual FX_ARGB* GetDestPalette() { return NULL; } |
| 578 virtual void TranslateScanline(uint8_t* dest_buf, |
| 579 const uint8_t* src_buf) const; |
| 580 virtual void TranslateDownSamples(uint8_t* dest_buf, |
| 581 const uint8_t* src_buf, |
| 582 int pixels, |
| 583 int Bpp) const; |
| 584 const uint8_t* m_RampR; |
| 585 const uint8_t* m_RampG; |
| 586 const uint8_t* m_RampB; |
468 }; | 587 }; |
469 struct _CPDF_UniqueKeyGen { | 588 struct _CPDF_UniqueKeyGen { |
470 void» » Generate(int count, ...); | 589 void Generate(int count, ...); |
471 FX_CHAR» » m_Key[128]; | 590 FX_CHAR m_Key[128]; |
472 int»» » m_KeyLen; | 591 int m_KeyLen; |
473 }; | 592 }; |
474 | 593 |
475 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ | 594 #endif // CORE_SRC_FPDFAPI_FPDF_RENDER_RENDER_INT_H_ |
OLD | NEW |