| 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 _FPDF_DIB_H_ | 7 #ifndef _FPDF_DIB_H_ |
| 8 #define _FPDF_DIB_H_ | 8 #define _FPDF_DIB_H_ |
| 9 #ifndef _FXCRT_EXTENSION_ | 9 #ifndef _FXCRT_EXTENSION_ |
| 10 #include "../fxcrt/fx_ext.h" | 10 #include "../fxcrt/fx_ext.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)
) | 129 *((FX_LPBYTE)(dest)+2) = *((FX_LPBYTE)(src)
) |
| 130 #define FXARGB_TODIB(argb) (argb) | 130 #define FXARGB_TODIB(argb) (argb) |
| 131 #define FXCMYK_TODIB(cmyk) ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16))
<< 8 | ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) | 131 #define FXCMYK_TODIB(cmyk) ((FX_BYTE)((cmyk) >> 24) | ((FX_BYTE)((cmyk) >> 16))
<< 8 | ((FX_BYTE)((cmyk) >> 8)) << 16 | ((FX_BYTE)(cmyk) << 24)) |
| 132 #define FXARGB_TOBGRORDERDIB(argb) ((FX_BYTE)(argb>>16) | ((FX_BYTE)(argb>>8)) <
< 8 | ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb>>24) << 24)) | 132 #define FXARGB_TOBGRORDERDIB(argb) ((FX_BYTE)(argb>>16) | ((FX_BYTE)(argb>>8)) <
< 8 | ((FX_BYTE)(argb)) << 16 | ((FX_BYTE)(argb>>24) << 24)) |
| 133 #define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag)>>8) | 133 #define FXGETFLAG_COLORTYPE(flag) (FX_BYTE)((flag)>>8) |
| 134 #define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) | 134 #define FXGETFLAG_ALPHA_FILL(flag) (FX_BYTE)(flag) |
| 135 #define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag)>>16) | 135 #define FXGETFLAG_ALPHA_STROKE(flag) (FX_BYTE)((flag)>>16) |
| 136 #define FXSETFLAG_COLORTYPE(flag, val) flag = (((val)<<8)|(flag&0xffff0
0ff)) | 136 #define FXSETFLAG_COLORTYPE(flag, val) flag = (((val)<<8)|(flag&0xffff0
0ff)) |
| 137 #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val)|(flag&0xffffff00)) | 137 #define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val)|(flag&0xffffff00)) |
| 138 #define FXSETFLAG_ALPHA_STROKE(flag, val) flag = (((val)<<16)|(flag&0xff00
ffff)) | 138 #define FXSETFLAG_ALPHA_STROKE(flag, val) flag = (((val)<<16)|(flag&0xff00
ffff)) |
| 139 class CFX_DIBSource : public CFX_Object | 139 class CFX_DIBSource |
| 140 { | 140 { |
| 141 public: | 141 public: |
| 142 | 142 |
| 143 virtual ~CFX_DIBSource(); | 143 virtual ~CFX_DIBSource(); |
| 144 | 144 |
| 145 | 145 |
| 146 | 146 |
| 147 int GetWidth() const | 147 int GetWidth() const |
| 148 { | 148 { |
| 149 return m_Width; | 149 return m_Width; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 | 346 |
| 347 FX_BOOL DitherFS(const FX_DWORD* pPalette, int pal_size,
const FX_RECT* pRect = NULL); | 347 FX_BOOL DitherFS(const FX_DWORD* pPalette, int pal_size,
const FX_RECT* pRect = NULL); |
| 348 protected: | 348 protected: |
| 349 | 349 |
| 350 FX_LPBYTE m_pBuffer; | 350 FX_LPBYTE m_pBuffer; |
| 351 | 351 |
| 352 FX_BOOL m_bExtBuf; | 352 FX_BOOL m_bExtBuf; |
| 353 | 353 |
| 354 FX_BOOL GetGrayData(void* pIccTransform = NULL); | 354 FX_BOOL GetGrayData(void* pIccTransform = NULL); |
| 355 }; | 355 }; |
| 356 class CFX_DIBExtractor : public CFX_Object | 356 class CFX_DIBExtractor |
| 357 { | 357 { |
| 358 public: | 358 public: |
| 359 | 359 |
| 360 CFX_DIBExtractor(const CFX_DIBSource* pSrc); | 360 CFX_DIBExtractor(const CFX_DIBSource* pSrc); |
| 361 | 361 |
| 362 ~CFX_DIBExtractor(); | 362 ~CFX_DIBExtractor(); |
| 363 | 363 |
| 364 operator CFX_DIBitmap*() | 364 operator CFX_DIBitmap*() |
| 365 { | 365 { |
| 366 return m_pBitmap; | 366 return m_pBitmap; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 }; | 401 }; |
| 402 class IFX_ScanlineComposer | 402 class IFX_ScanlineComposer |
| 403 { | 403 { |
| 404 public: | 404 public: |
| 405 virtual ~IFX_ScanlineComposer() { } | 405 virtual ~IFX_ScanlineComposer() { } |
| 406 | 406 |
| 407 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha = NULL) = 0; | 407 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha = NULL) = 0; |
| 408 | 408 |
| 409 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette) = 0; | 409 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette) = 0; |
| 410 }; | 410 }; |
| 411 class CFX_ScanlineCompositor : public CFX_Object | 411 class CFX_ScanlineCompositor |
| 412 { | 412 { |
| 413 public: | 413 public: |
| 414 CFX_ScanlineCompositor(); | 414 CFX_ScanlineCompositor(); |
| 415 | 415 |
| 416 ~CFX_ScanlineCompositor(); | 416 ~CFX_ScanlineCompositor(); |
| 417 | 417 |
| 418 FX_BOOL Init(FXDIB_Format dest_format, FXDIB_For
mat src_format, FX_INT32 width, FX_DWORD* pSrcPalette, | 418 FX_BOOL Init(FXDIB_Format dest_format, FXDIB_For
mat src_format, FX_INT32 width, FX_DWORD* pSrcPalette, |
| 419 FX_DWORD mask_color, int blend_type, FX_BOOL bClip,
FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); | 419 FX_DWORD mask_color, int blend_type, FX_BOOL bClip,
FX_BOOL bRgbByteOrder = FALSE, int alpha_flag = 0, void* pIccTransform = NULL); |
| 420 | 420 |
| 421 | 421 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 443 m_MaskRed, | 443 m_MaskRed, |
| 444 m_MaskGreen, | 444 m_MaskGreen, |
| 445 m_MaskBlue, | 445 m_MaskBlue, |
| 446 m_MaskBlack; | 446 m_MaskBlack; |
| 447 int m_BlendType; | 447 int m_BlendType; |
| 448 void* m_pIccTransform; | 448 void* m_pIccTransform; |
| 449 FX_LPBYTE m_pCacheScanline; | 449 FX_LPBYTE m_pCacheScanline; |
| 450 int m_CacheSize; | 450 int m_CacheSize; |
| 451 FX_BOOL m_bRgbByteOrder; | 451 FX_BOOL m_bRgbByteOrder; |
| 452 }; | 452 }; |
| 453 class CFX_BitmapComposer : public IFX_ScanlineComposer, public CFX_Object | 453 class CFX_BitmapComposer : public IFX_ScanlineComposer |
| 454 { | 454 { |
| 455 public: | 455 public: |
| 456 | 456 |
| 457 CFX_BitmapComposer(); | 457 CFX_BitmapComposer(); |
| 458 | 458 |
| 459 ~CFX_BitmapComposer(); | 459 ~CFX_BitmapComposer(); |
| 460 | 460 |
| 461 | 461 |
| 462 void Compose(CFX_DIBitmap* pDest, const CFX_C
lipRgn* pClipRgn, int bitmap_alpha, | 462 void Compose(CFX_DIBitmap* pDest, const CFX_C
lipRgn* pClipRgn, int bitmap_alpha, |
| 463 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL
bVertical, | 463 FX_DWORD mask_color, FX_RECT& dest_rect, FX_BOOL
bVertical, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 480 const CFX_DIBitmap* m_pClipMask; | 480 const CFX_DIBitmap* m_pClipMask; |
| 481 CFX_ScanlineCompositor m_Compositor; | 481 CFX_ScanlineCompositor m_Compositor; |
| 482 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; | 482 FX_BOOL m_bVertical, m_bFlipX, m_bFlipY; |
| 483 int m_AlphaFlag; | 483 int m_AlphaFlag; |
| 484 void* m_pIccTransform; | 484 void* m_pIccTransform; |
| 485 FX_BOOL m_bRgbByteOrder; | 485 FX_BOOL m_bRgbByteOrder; |
| 486 int m_BlendType; | 486 int m_BlendType; |
| 487 void ComposeScanlineV(int line, FX_LPCBYTE sc
anline, FX_LPCBYTE scan_extra_alpha = NULL); | 487 void ComposeScanlineV(int line, FX_LPCBYTE sc
anline, FX_LPCBYTE scan_extra_alpha = NULL); |
| 488 FX_LPBYTE m_pScanlineV, m_pClipScanV, m_pAddClipScan, m_pS
canlineAlphaV; | 488 FX_LPBYTE m_pScanlineV, m_pClipScanV, m_pAddClipScan, m_pS
canlineAlphaV; |
| 489 }; | 489 }; |
| 490 class CFX_BitmapStorer : public IFX_ScanlineComposer, public CFX_Object | 490 class CFX_BitmapStorer : public IFX_ScanlineComposer |
| 491 { | 491 { |
| 492 public: | 492 public: |
| 493 | 493 |
| 494 CFX_BitmapStorer(); | 494 CFX_BitmapStorer(); |
| 495 | 495 |
| 496 ~CFX_BitmapStorer(); | 496 ~CFX_BitmapStorer(); |
| 497 | 497 |
| 498 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha); | 498 virtual void ComposeScanline(int line, FX_LPCBYTE scanline, F
X_LPCBYTE scan_extra_alpha); |
| 499 | 499 |
| 500 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); | 500 virtual FX_BOOL SetInfo(int width, int height, FXDIB_Format src_
format, FX_DWORD* pSrcPalette); |
| 501 | 501 |
| 502 CFX_DIBitmap* GetBitmap() | 502 CFX_DIBitmap* GetBitmap() |
| 503 { | 503 { |
| 504 return m_pBitmap; | 504 return m_pBitmap; |
| 505 } | 505 } |
| 506 | 506 |
| 507 CFX_DIBitmap* Detach(); | 507 CFX_DIBitmap* Detach(); |
| 508 | 508 |
| 509 void Replace(CFX_DIBitmap* pBitmap); | 509 void Replace(CFX_DIBitmap* pBitmap); |
| 510 private: | 510 private: |
| 511 CFX_DIBitmap* m_pBitmap; | 511 CFX_DIBitmap* m_pBitmap; |
| 512 }; | 512 }; |
| 513 class CStretchEngine; | 513 class CStretchEngine; |
| 514 class CFX_ImageStretcher : public CFX_Object | 514 class CFX_ImageStretcher |
| 515 { | 515 { |
| 516 public: | 516 public: |
| 517 | 517 |
| 518 CFX_ImageStretcher(); | 518 CFX_ImageStretcher(); |
| 519 | 519 |
| 520 ~CFX_ImageStretcher(); | 520 ~CFX_ImageStretcher(); |
| 521 | 521 |
| 522 FX_INT32 Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource*
pBitmap, | 522 FX_INT32 Start(IFX_ScanlineComposer* pDest, const CFX_DIBSource*
pBitmap, |
| 523 int dest_width, int dest_height, const FX_RECT& bitmap
_rect, FX_DWORD flags); | 523 int dest_width, int dest_height, const FX_RECT& bitmap
_rect, FX_DWORD flags); |
| 524 | 524 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 541 FX_INT32 m_Status; | 541 FX_INT32 m_Status; |
| 542 | 542 |
| 543 FX_INT32 StartQuickStretch(); | 543 FX_INT32 StartQuickStretch(); |
| 544 | 544 |
| 545 FX_INT32 StartStretch(); | 545 FX_INT32 StartStretch(); |
| 546 | 546 |
| 547 FX_INT32 ContinueQuickStretch(IFX_Pause* pPause); | 547 FX_INT32 ContinueQuickStretch(IFX_Pause* pPause); |
| 548 | 548 |
| 549 FX_INT32 ContinueStretch(IFX_Pause* pPause); | 549 FX_INT32 ContinueStretch(IFX_Pause* pPause); |
| 550 }; | 550 }; |
| 551 class CFX_ImageTransformer : public CFX_Object | 551 class CFX_ImageTransformer |
| 552 { | 552 { |
| 553 public: | 553 public: |
| 554 | 554 |
| 555 CFX_ImageTransformer(); | 555 CFX_ImageTransformer(); |
| 556 | 556 |
| 557 ~CFX_ImageTransformer(); | 557 ~CFX_ImageTransformer(); |
| 558 | 558 |
| 559 FX_INT32 Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix
, int flags, const FX_RECT* pClip); | 559 FX_INT32 Start(const CFX_DIBSource* pSrc, const CFX_AffineMatrix* pMatrix
, int flags, const FX_RECT* pClip); |
| 560 | 560 |
| 561 | 561 |
| 562 FX_INT32 Continue(IFX_Pause* pPause); | 562 FX_INT32 Continue(IFX_Pause* pPause); |
| 563 CFX_AffineMatrix* m_pMatrix; | 563 CFX_AffineMatrix* m_pMatrix; |
| 564 FX_RECT m_StretchClip; | 564 FX_RECT m_StretchClip; |
| 565 int m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight
; | 565 int m_ResultLeft, m_ResultTop, m_ResultWidth, m_ResultHeight
; |
| 566 CFX_AffineMatrix m_dest2stretch; | 566 CFX_AffineMatrix m_dest2stretch; |
| 567 CFX_ImageStretcher m_Stretcher; | 567 CFX_ImageStretcher m_Stretcher; |
| 568 CFX_BitmapStorer m_Storer; | 568 CFX_BitmapStorer m_Storer; |
| 569 FX_DWORD m_Flags; | 569 FX_DWORD m_Flags; |
| 570 int m_Status; | 570 int m_Status; |
| 571 }; | 571 }; |
| 572 class CFX_ImageRenderer : public CFX_Object | 572 class CFX_ImageRenderer |
| 573 { | 573 { |
| 574 public: | 574 public: |
| 575 | 575 |
| 576 CFX_ImageRenderer(); | 576 CFX_ImageRenderer(); |
| 577 | 577 |
| 578 ~CFX_ImageRenderer(); | 578 ~CFX_ImageRenderer(); |
| 579 | 579 |
| 580 FX_INT32 Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn*
pClipRgn, | 580 FX_INT32 Start(CFX_DIBitmap* pDevice, const CFX_ClipRgn*
pClipRgn, |
| 581 const CFX_DIBSource* pSource, int bitmap_alpha, | 581 const CFX_DIBSource* pSource, int bitmap_alpha, |
| 582 FX_DWORD mask_color, const CFX_AffineMatrix* pMatr
ix, FX_DWORD dib_flags, | 582 FX_DWORD mask_color, const CFX_AffineMatrix* pMatr
ix, FX_DWORD dib_flags, |
| (...skipping 13 matching lines...) Expand all Loading... |
| 596 int m_Status; | 596 int m_Status; |
| 597 int m_DestLeft, m_DestTop; | 597 int m_DestLeft, m_DestTop; |
| 598 FX_RECT m_ClipBox; | 598 FX_RECT m_ClipBox; |
| 599 FX_DWORD m_Flags; | 599 FX_DWORD m_Flags; |
| 600 int m_AlphaFlag; | 600 int m_AlphaFlag; |
| 601 void* m_pIccTransform; | 601 void* m_pIccTransform; |
| 602 FX_BOOL m_bRgbByteOrder; | 602 FX_BOOL m_bRgbByteOrder; |
| 603 int m_BlendType; | 603 int m_BlendType; |
| 604 }; | 604 }; |
| 605 #endif | 605 #endif |
| OLD | NEW |