1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #ifndef _FPDF_PAGEOBJ_H_ 8 #include "../../../include/fpdfapi/fpdf_pageobj.h" 9 #endif 10 class CPDF_QuickStretcher; 11 #define TYPE3_MAX_BLUES 16 12 class CPDF_Type3Glyphs : public CFX_Object 13 { 14 public: CPDF_Type3Glyphs()15 CPDF_Type3Glyphs() 16 { 17 m_GlyphMap.InitHashTable(253); 18 m_TopBlueCount = m_BottomBlueCount = 0; 19 } 20 ~CPDF_Type3Glyphs(); 21 CFX_MapPtrToPtr m_GlyphMap; 22 void AdjustBlue(FX_FLOAT top, FX_FLOAT bottom, int& top_line, int& bottom_line); 23 24 int m_TopBlue[TYPE3_MAX_BLUES], m_BottomBlue[TYPE3_MAX_BLUES]; 25 int m_TopBlueCount, m_BottomBlueCount; 26 }; 27 class CFX_GlyphBitmap; 28 class CPDF_Type3Cache : public CFX_Object 29 { 30 public: CPDF_Type3Cache(CPDF_Type3Font * pFont)31 CPDF_Type3Cache(CPDF_Type3Font* pFont) 32 { 33 m_pFont = pFont; 34 } 35 ~CPDF_Type3Cache(); 36 CFX_GlyphBitmap* LoadGlyph(FX_DWORD charcode, const CFX_AffineMatrix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); 37 protected: 38 CFX_GlyphBitmap* RenderGlyph(CPDF_Type3Glyphs* pSize, FX_DWORD charcode, const CFX_AffineMatrix* pMatrix, FX_FLOAT retinaScaleX = 1.0f, FX_FLOAT retinaScaleY = 1.0f); 39 CPDF_Type3Font* m_pFont; 40 CFX_MapByteStringToPtr m_SizeMap; 41 }; 42 class CPDF_TransferFunc : public CFX_Object 43 { 44 public: 45 CPDF_Document* m_pPDFDoc; 46 FX_BYTE m_Samples[256 * 3]; 47 FX_BOOL m_bIdentity; 48 49 CFX_DIBSource* TranslateImage(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc); 50 FX_COLORREF TranslateColor(FX_COLORREF src); 51 }; 52 typedef CFX_MapPtrTemplate<CPDF_Font*, CPDF_CountedObject<CPDF_Type3Cache*>*> CPDF_Type3CacheMap; 53 typedef CFX_MapPtrTemplate<CPDF_Object*, CPDF_CountedObject<CPDF_TransferFunc*>*> CPDF_TransferFuncMap; 54 class CPDF_DocRenderData : public CFX_Object 55 { 56 public: 57 CPDF_DocRenderData(CPDF_Document* pPDFDoc = NULL); 58 ~CPDF_DocRenderData(); 59 FX_BOOL Initialize(); 60 CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); 61 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObj); GetFontCache()62 CFX_FontCache* GetFontCache() 63 { 64 return m_pFontCache; 65 } 66 void Clear(FX_BOOL bRelease = FALSE); 67 void ReleaseCachedType3(CPDF_Type3Font* pFont); 68 void ReleaseTransferFunc(CPDF_Object* pObj); 69 private: 70 CPDF_Document* m_pPDFDoc; 71 CFX_FontCache* m_pFontCache; 72 CPDF_Type3CacheMap m_Type3FaceMap; 73 CPDF_TransferFuncMap m_TransferFuncMap; 74 }; 75 struct _PDF_RenderItem { 76 public: 77 CPDF_PageObjects* m_pObjectList; 78 CFX_AffineMatrix m_Matrix; 79 }; 80 typedef CFX_ArrayTemplate<_PDF_RenderItem> CPDF_RenderLayer; 81 class IPDF_ObjectRenderer : public CFX_Object 82 { 83 public: 84 static IPDF_ObjectRenderer* Create(int type); ~IPDF_ObjectRenderer()85 virtual ~IPDF_ObjectRenderer() {} 86 virtual FX_BOOL Start(CPDF_RenderStatus* pRenderStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL) = 0; 87 virtual FX_BOOL Continue(IFX_Pause* pPause) = 0; 88 FX_BOOL m_Result; 89 }; 90 class CPDF_RenderStatus : public CFX_Object 91 { 92 public: 93 CPDF_RenderStatus(); 94 ~CPDF_RenderStatus(); 95 FX_BOOL Initialize(int level, class CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, const CFX_AffineMatrix* pDeviceMatrix, 96 const CPDF_PageObject* pStopObj, const CPDF_RenderStatus* pParentStatus, 97 const CPDF_GraphicStates* pInitialStates, const CPDF_RenderOptions* pOptions, 98 int transparency, FX_BOOL bDropObjects, CPDF_Dictionary* pFormResource = NULL, 99 FX_BOOL bStdCS = FALSE, CPDF_Type3Char* pType3Char = NULL, FX_ARGB fill_color = 0, 100 FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); 101 void RenderObjectList(const CPDF_PageObjects* pObjs, const CFX_AffineMatrix* pObj2Device); 102 void RenderSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device); 103 FX_BOOL ContinueSingleObject(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, IFX_Pause* pPause); 104 CPDF_RenderOptions m_Options; 105 CPDF_Dictionary* m_pFormResource; 106 CPDF_Dictionary* m_pPageResource; 107 CFX_PtrArray m_Type3FontCache; GetContext()108 CPDF_RenderContext* GetContext() 109 { 110 return m_pContext; 111 } 112 protected: 113 friend class CPDF_ImageRenderer; 114 friend class CPDF_RenderContext; 115 void ProcessClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMatrix* pObj2Device); 116 void DrawClipPath(CPDF_ClipPath ClipPath, const CFX_AffineMatrix* pObj2Device); 117 FX_BOOL ProcessTransparency(const CPDF_PageObject* PageObj, const CFX_AffineMatrix* pObj2Device); 118 void ProcessObjectNoClip(const CPDF_PageObject* PageObj, const CFX_AffineMatrix* pObj2Device); 119 void DrawObjWithBackground(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device); 120 FX_BOOL DrawObjWithBlend(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device); 121 FX_BOOL ProcessPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device); 122 void ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, int& filltype, FX_BOOL& bStroke); 123 void DrawPathWithPattern(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, CPDF_Color* pColor, FX_BOOL bStroke); 124 void DrawTilingPattern(CPDF_TilingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke); 125 void DrawShadingPattern(CPDF_ShadingPattern* pPattern, CPDF_PageObject* pPageObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke); 126 FX_BOOL SelectClipPath(CPDF_PathObject* pPathObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStroke); 127 FX_BOOL ProcessImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pObj2Device); 128 FX_BOOL OutputBitmapAlpha(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device); 129 FX_BOOL OutputImage(CPDF_ImageObject* pImageObj, const CFX_AffineMatrix* pImage2Device); 130 FX_BOOL OutputDIBSource(const CFX_DIBSource* pOutputBitmap, FX_ARGB fill_argb, int bitmap_alpha, 131 const CFX_AffineMatrix* pImage2Device, CPDF_ImageCache* pImageCache, FX_DWORD flags); 132 void CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, FX_ARGB mask_argb, 133 int bitmap_alpha, int blend_mode, int bIsolated); 134 FX_BOOL ProcessInlines(CPDF_InlineImages* pInlines, const CFX_AffineMatrix* pObj2Device); 135 FX_BOOL ProcessShading(CPDF_ShadingObject* pShadingObj, const CFX_AffineMatrix* pObj2Device); 136 void DrawShading(CPDF_ShadingPattern* pPattern, CFX_AffineMatrix* pMatrix, FX_RECT& clip_rect, 137 int alpha, FX_BOOL bAlphaMode); 138 FX_BOOL ProcessType3Text(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device); 139 FX_BOOL ProcessText(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, CFX_PathData* pClippingPath); 140 void DrawTextPathWithPattern(const CPDF_TextObject* textobj, const CFX_AffineMatrix* pObj2Device, 141 CPDF_Font* pFont, FX_FLOAT font_size, 142 const CFX_AffineMatrix* pTextMatrix, FX_BOOL bFill, FX_BOOL bStroke); 143 FX_BOOL ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device); 144 CFX_DIBitmap* GetBackdrop(const CPDF_PageObject* pObj, const FX_RECT& rect, int& left, int& top, 145 FX_BOOL bBackAlphaRequired); 146 CFX_DIBitmap* LoadSMask(CPDF_Dictionary* pSMaskDict, FX_RECT* pClipRect, const CFX_AffineMatrix* pMatrix); 147 void Init(CPDF_RenderContext* pParent); 148 static class CPDF_Type3Cache* GetCachedType3(CPDF_Type3Font* pFont); 149 static CPDF_GraphicStates* CloneObjStates(const CPDF_GraphicStates* pPathObj, FX_BOOL bStroke); 150 CPDF_TransferFunc* GetTransferFunc(CPDF_Object* pObject) const; 151 FX_ARGB GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bType3 = FALSE) const; 152 FX_ARGB GetStrokeArgb(const CPDF_PageObject* pObj) const; 153 CPDF_RenderContext* m_pContext; 154 FX_BOOL m_bStopped; 155 void DitherObjectArea(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device); 156 FX_BOOL GetObjectClippedRect(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bLogical, FX_RECT &rect) const; 157 void GetScaledMatrix(CFX_Matrix &matrix) const; 158 protected: 159 int m_Level; 160 CFX_RenderDevice* m_pDevice; 161 CFX_AffineMatrix m_DeviceMatrix; 162 CPDF_ClipPath m_LastClipPath; 163 const CPDF_PageObject* m_pCurObj; 164 const CPDF_PageObject* m_pStopObj; 165 CPDF_GraphicStates m_InitialStates; 166 int m_HalftoneLimit; 167 IPDF_ObjectRenderer* m_pObjectRenderer; 168 FX_BOOL m_bPrint; 169 int m_Transparency; 170 int m_DitherBits; 171 FX_BOOL m_bDropObjects; 172 FX_BOOL m_bStdCS; 173 FX_DWORD m_GroupFamily; 174 FX_BOOL m_bLoadMask; 175 CPDF_Type3Char * m_pType3Char; 176 FX_ARGB m_T3FillColor; 177 int m_curBlend; 178 }; 179 class CPDF_ImageLoader : public CFX_Object 180 { 181 public: CPDF_ImageLoader()182 CPDF_ImageLoader() 183 { 184 m_pBitmap = NULL; 185 m_pMask = NULL; 186 m_MatteColor = 0; 187 m_bCached = FALSE; 188 m_nDownsampleWidth = 0; 189 m_nDownsampleHeight = 0; 190 } 191 192 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); 193 194 FX_BOOL StartLoadImage(const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_LPVOID& LoadHandle, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); 195 FX_BOOL Continue(FX_LPVOID LoadHandle, IFX_Pause* pPause); 196 ~CPDF_ImageLoader(); 197 CFX_DIBSource* m_pBitmap; 198 CFX_DIBSource* m_pMask; 199 FX_DWORD m_MatteColor; 200 FX_BOOL m_bCached; 201 protected: 202 FX_INT32 m_nDownsampleWidth; 203 FX_INT32 m_nDownsampleHeight; 204 }; 205 class CPDF_ProgressiveImageLoaderHandle : public CFX_Object 206 { 207 public: 208 CPDF_ProgressiveImageLoaderHandle(); 209 ~CPDF_ProgressiveImageLoaderHandle(); 210 211 FX_BOOL Start(CPDF_ImageLoader* pImageLoader, const CPDF_ImageObject* pImage, CPDF_PageRenderCache* pCache, FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 nDownsampleWidth = 0, FX_INT32 nDownsampleHeight = 0); 212 FX_BOOL Continue(IFX_Pause* pPause); 213 protected: 214 CPDF_ImageLoader* m_pImageLoader; 215 CPDF_PageRenderCache* m_pCache; 216 CPDF_ImageObject* m_pImage; 217 FX_INT32 m_nDownsampleWidth; 218 FX_INT32 m_nDownsampleHeight; 219 }; 220 class CFX_ImageTransformer; 221 class CPDF_ImageRenderer : public IPDF_ObjectRenderer 222 { 223 public: 224 CPDF_ImageRenderer(); 225 ~CPDF_ImageRenderer(); 226 FX_BOOL Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL); 227 FX_BOOL Start(CPDF_RenderStatus* pStatus, const CFX_DIBSource* pDIBSource, FX_ARGB bitmap_argb, 228 int bitmap_alpha, const CFX_AffineMatrix* pImage2Device, FX_DWORD flags, FX_BOOL bStdCS, int blendType = FXDIB_BLEND_NORMAL); 229 FX_BOOL Continue(IFX_Pause* pPause); 230 protected: 231 CPDF_RenderStatus* m_pRenderStatus; 232 CPDF_ImageObject* m_pImageObject; 233 int m_Status; 234 const CFX_AffineMatrix* m_pObj2Device; 235 CFX_AffineMatrix m_ImageMatrix; 236 CPDF_ImageLoader m_Loader; 237 const CFX_DIBSource* m_pDIBSource; 238 CFX_DIBitmap* m_pClone; 239 int m_BitmapAlpha; 240 FX_BOOL m_bPatternColor; 241 CPDF_Pattern* m_pPattern; 242 FX_ARGB m_FillArgb; 243 FX_DWORD m_Flags; 244 CPDF_QuickStretcher* m_pQuickStretcher; 245 CFX_ImageTransformer* m_pTransformer; 246 CPDF_ImageRenderer* m_pRenderer2; 247 FX_LPVOID m_DeviceHandle; 248 FX_LPVOID m_LoadHandle; 249 FX_BOOL m_bStdCS; 250 int m_BlendType; 251 FX_BOOL StartBitmapAlpha(); 252 FX_BOOL StartDIBSource(); 253 FX_BOOL StartRenderDIBSource(); 254 FX_BOOL StartLoadDIBSource(); 255 FX_BOOL DrawMaskedImage(); 256 FX_BOOL DrawPatternImage(const CFX_Matrix* pObj2Device); 257 }; 258 class CPDF_ScaledRenderBuffer : public CFX_Object 259 { 260 public: 261 CPDF_ScaledRenderBuffer(); 262 ~CPDF_ScaledRenderBuffer(); 263 FX_BOOL Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect, 264 const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions = NULL, int max_dpi = 0); GetDevice()265 CFX_RenderDevice* GetDevice() 266 { 267 return m_pBitmapDevice ? m_pBitmapDevice : m_pDevice; 268 } GetMatrix()269 CFX_AffineMatrix* GetMatrix() 270 { 271 return &m_Matrix; 272 } 273 void OutputToDevice(); 274 private: 275 CFX_RenderDevice* m_pDevice; 276 CPDF_RenderContext* m_pContext; 277 FX_RECT m_Rect; 278 const CPDF_PageObject* m_pObject; 279 CFX_FxgeDevice* m_pBitmapDevice; 280 CFX_AffineMatrix m_Matrix; 281 }; 282 class ICodec_ScanlineDecoder; 283 class CPDF_QuickStretcher : public CFX_Object 284 { 285 public: 286 CPDF_QuickStretcher(); 287 ~CPDF_QuickStretcher(); 288 FX_BOOL Start(CPDF_ImageObject* pImageObj, CFX_AffineMatrix* pImage2Device, const FX_RECT* pClipBox); 289 FX_BOOL Continue(IFX_Pause* pPause); 290 CFX_DIBitmap* m_pBitmap; 291 int m_ResultLeft, m_ResultTop, m_ClipLeft, m_ClipTop; 292 int m_DestWidth, m_DestHeight, m_ResultWidth, m_ResultHeight; 293 int m_Bpp, m_SrcWidth, m_SrcHeight; 294 FX_BOOL m_bFlipX, m_bFlipY; 295 CPDF_ColorSpace* m_pCS; 296 ICodec_ScanlineDecoder* m_pDecoder; 297 CPDF_StreamAcc m_StreamAcc; 298 int m_LineIndex; 299 }; 300 class CPDF_DeviceBuffer : public CFX_Object 301 { 302 public: 303 CPDF_DeviceBuffer(); 304 ~CPDF_DeviceBuffer(); 305 FX_BOOL Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect, 306 const CPDF_PageObject* pObj, int max_dpi = 0); 307 void OutputToDevice(); GetBitmap()308 CFX_DIBitmap* GetBitmap() const 309 { 310 return m_pBitmap; 311 } GetMatrix()312 const CFX_AffineMatrix* GetMatrix() const 313 { 314 return &m_Matrix; 315 } 316 private: 317 CFX_RenderDevice* m_pDevice; 318 CPDF_RenderContext* m_pContext; 319 FX_RECT m_Rect; 320 const CPDF_PageObject* m_pObject; 321 CFX_DIBitmap* m_pBitmap; 322 CFX_AffineMatrix m_Matrix; 323 }; 324 class CPDF_ImageCache : public CFX_Object 325 { 326 public: 327 CPDF_ImageCache(CPDF_Document* pDoc, CPDF_Stream* pStream); 328 ~CPDF_ImageCache(); 329 void ClearImageData(); 330 void Reset(const CFX_DIBitmap* pBitmap); 331 FX_BOOL GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource*& pMask, FX_DWORD& MatteColor, CPDF_Dictionary* pPageResources, 332 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE, 333 CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); EstimateSize()334 FX_DWORD EstimateSize() const 335 { 336 return m_dwCacheSize; 337 } GetTimeCount()338 FX_DWORD GetTimeCount() const 339 { 340 return m_dwTimeCount; 341 } GetStream()342 CPDF_Stream* GetStream() const 343 { 344 return m_pStream; 345 } SetTimeCount(FX_DWORD dwTimeCount)346 void SetTimeCount(FX_DWORD dwTimeCount) 347 { 348 m_dwTimeCount = dwTimeCount; 349 } 350 int m_dwTimeCount; 351 public: 352 int StartGetCachedBitmap(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, 353 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, 354 FX_BOOL bLoadMask = FALSE, CPDF_RenderStatus* pRenderStatus = NULL, FX_INT32 downsampleWidth = 0, FX_INT32 downsampleHeight = 0); 355 int Continue(IFX_Pause* pPause); 356 int ContinueGetCachedBitmap(); 357 CFX_DIBSource* DetachBitmap(); 358 CFX_DIBSource* DetachMask(); 359 CFX_DIBSource* m_pCurBitmap; 360 CFX_DIBSource* m_pCurMask; 361 FX_DWORD m_MatteColor; 362 CPDF_RenderStatus* m_pRenderStatus; 363 protected: 364 CPDF_Document* m_pDocument; 365 CPDF_Stream* m_pStream; 366 CFX_DIBSource* m_pCachedBitmap; 367 CFX_DIBSource* m_pCachedMask; 368 FX_DWORD m_dwCacheSize; 369 void CalcSize(); 370 }; 371 typedef struct { 372 FX_FLOAT m_DecodeMin; 373 FX_FLOAT m_DecodeStep; 374 int m_ColorKeyMin; 375 int m_ColorKeyMax; 376 } DIB_COMP_DATA; 377 class CPDF_DIBSource : public CFX_DIBSource 378 { 379 public: 380 CPDF_DIBSource(); 381 virtual ~CPDF_DIBSource(); 382 FX_BOOL Load(CPDF_Document* pDoc, const CPDF_Stream* pStream, 383 CPDF_DIBSource** ppMask, FX_DWORD* pMatteColor, 384 CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, 385 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); 386 virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const; 387 virtual FX_LPBYTE GetBuffer() const; 388 virtual FX_LPCBYTE GetScanline(int line) const; 389 virtual void DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bpp, 390 int dest_width, FX_BOOL bFlipX, int clip_left, int clip_width) const; 391 virtual void SetDownSampleSize(int dest_width, int dest_height) const; 392 CFX_DIBitmap* GetBitmap() const; 393 void ReleaseBitmap(CFX_DIBitmap*) const; 394 void ClearImageData(); 395 public: 396 int StartLoadDIBSource(CPDF_Document* pDoc, const CPDF_Stream* pStream, FX_BOOL bHasMask, 397 CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources, 398 FX_BOOL bStdCS = FALSE, FX_DWORD GroupFamily = 0, FX_BOOL bLoadMask = FALSE); 399 int ContinueLoadDIBSource(IFX_Pause* pPause); 400 int StratLoadMask(); 401 int StartLoadMaskDIB(); 402 int ContinueLoadMaskDIB(IFX_Pause* pPause); 403 int ContinueToLoadMask(); 404 CPDF_DIBSource* DetachMask(); 405 CPDF_DIBSource* m_pMask; 406 FX_DWORD m_MatteColor; 407 FX_LPVOID m_pJbig2Context; 408 CPDF_StreamAcc* m_pGlobalStream; 409 FX_BOOL m_bStdCS; 410 int m_Status; 411 CPDF_Object* m_pMaskStream; 412 FX_BOOL m_bHasMask; 413 protected: 414 FX_BOOL LoadColorInfo(CPDF_Dictionary* pFormResources, CPDF_Dictionary* pPageResources); 415 CPDF_DIBSource* LoadMask(FX_DWORD& MatteColor); 416 CPDF_DIBSource* LoadMaskDIB(CPDF_Stream* pMask); 417 void LoadJpxBitmap(); 418 void LoadJbig2Bitmap(); 419 void LoadPalette(); 420 FX_BOOL CreateDecoder(); 421 void TranslateScanline24bpp(FX_LPBYTE dest_scan, FX_LPCBYTE src_scan) const; 422 FX_DWORD GetValidBpp() const; 423 424 CPDF_Document* m_pDocument; 425 const CPDF_Stream* m_pStream; 426 CPDF_StreamAcc* m_pStreamAcc; 427 const CPDF_Dictionary* m_pDict; 428 CPDF_ColorSpace* m_pColorSpace; 429 FX_DWORD m_Family, m_bpc, m_nComponents, m_GroupFamily; 430 FX_BOOL m_bLoadMask; 431 FX_BOOL m_bDefaultDecode, m_bImageMask, m_bColorKey; 432 DIB_COMP_DATA* m_pCompData; 433 FX_LPBYTE m_pLineBuf; 434 FX_LPBYTE m_pMaskedLine; 435 CFX_DIBitmap* m_pCachedBitmap; 436 ICodec_ScanlineDecoder* m_pDecoder; 437 }; 438 #ifdef _FPDFAPI_MINI_ 439 #define FPDF_HUGE_IMAGE_SIZE 3000000 440 #else 441 #define FPDF_HUGE_IMAGE_SIZE 60000000 442 #endif 443 class CPDF_DIBTransferFunc : public CFX_FilteredDIB 444 { 445 public: 446 CPDF_DIBTransferFunc(const CPDF_TransferFunc* pTransferFunc); 447 virtual FXDIB_Format GetDestFormat(); GetDestPalette()448 virtual FX_ARGB* GetDestPalette() 449 { 450 return NULL; 451 } 452 virtual void TranslateScanline(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf) const; 453 virtual void TranslateDownSamples(FX_LPBYTE dest_buf, FX_LPCBYTE src_buf, int pixels, int Bpp) const; 454 FX_LPCBYTE m_RampR; 455 FX_LPCBYTE m_RampG; 456 FX_LPCBYTE m_RampB; 457 }; 458 struct _CPDF_UniqueKeyGen { 459 void Generate(int count, ...); 460 FX_CHAR m_Key[128]; 461 int m_KeyLen; 462 }; 463