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_FXGE_INCLUDE_FX_DIB_H_ | 7 #ifndef CORE_FXGE_INCLUDE_FX_DIB_H_ |
8 #define CORE_FXGE_INCLUDE_FX_DIB_H_ | 8 #define CORE_FXGE_INCLUDE_FX_DIB_H_ |
9 | 9 |
| 10 #include <memory> |
| 11 |
10 #include "core/fxcrt/include/fx_basic.h" | 12 #include "core/fxcrt/include/fx_basic.h" |
11 #include "core/fxcrt/include/fx_coordinates.h" | 13 #include "core/fxcrt/include/fx_coordinates.h" |
12 | 14 |
13 enum FXDIB_Format { | 15 enum FXDIB_Format { |
14 FXDIB_Invalid = 0, | 16 FXDIB_Invalid = 0, |
15 FXDIB_1bppMask = 0x101, | 17 FXDIB_1bppMask = 0x101, |
16 FXDIB_1bppRgb = 0x001, | 18 FXDIB_1bppRgb = 0x001, |
17 FXDIB_1bppCmyk = 0x401, | 19 FXDIB_1bppCmyk = 0x401, |
18 FXDIB_8bppMask = 0x108, | 20 FXDIB_8bppMask = 0x108, |
19 FXDIB_8bppRgb = 0x008, | 21 FXDIB_8bppRgb = 0x008, |
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 CFX_DIBitmap* Detach(); | 569 CFX_DIBitmap* Detach(); |
568 | 570 |
569 void Replace(CFX_DIBitmap* pBitmap); | 571 void Replace(CFX_DIBitmap* pBitmap); |
570 | 572 |
571 private: | 573 private: |
572 CFX_DIBitmap* m_pBitmap; | 574 CFX_DIBitmap* m_pBitmap; |
573 }; | 575 }; |
574 | 576 |
575 class CFX_ImageStretcher { | 577 class CFX_ImageStretcher { |
576 public: | 578 public: |
577 CFX_ImageStretcher(); | 579 CFX_ImageStretcher(IFX_ScanlineComposer* pDest, |
| 580 const CFX_DIBSource* pSource, |
| 581 int dest_width, |
| 582 int dest_height, |
| 583 const FX_RECT& bitmap_rect, |
| 584 uint32_t flags); |
578 ~CFX_ImageStretcher(); | 585 ~CFX_ImageStretcher(); |
579 | 586 |
580 FX_BOOL Start(IFX_ScanlineComposer* pDest, | 587 FX_BOOL Start(); |
581 const CFX_DIBSource* pBitmap, | 588 FX_BOOL Continue(IFX_Pause* pPause); |
582 int dest_width, | |
583 int dest_height, | |
584 const FX_RECT& bitmap_rect, | |
585 uint32_t flags); | |
586 | 589 |
587 FX_BOOL Continue(IFX_Pause* pPause); | 590 const CFX_DIBSource* source() { return m_pSource; } |
| 591 |
| 592 private: |
588 FX_BOOL StartQuickStretch(); | 593 FX_BOOL StartQuickStretch(); |
589 FX_BOOL StartStretch(); | 594 FX_BOOL StartStretch(); |
590 FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); | 595 FX_BOOL ContinueQuickStretch(IFX_Pause* pPause); |
591 FX_BOOL ContinueStretch(IFX_Pause* pPause); | 596 FX_BOOL ContinueStretch(IFX_Pause* pPause); |
592 | 597 |
593 IFX_ScanlineComposer* m_pDest; | 598 IFX_ScanlineComposer* const m_pDest; |
594 const CFX_DIBSource* m_pSource; | 599 const CFX_DIBSource* const m_pSource; |
595 CStretchEngine* m_pStretchEngine; | 600 std::unique_ptr<CStretchEngine> m_pStretchEngine; |
596 uint32_t m_Flags; | 601 uint8_t* m_pScanline; |
| 602 uint8_t* m_pMaskScanline; |
| 603 const uint32_t m_Flags; |
597 FX_BOOL m_bFlipX; | 604 FX_BOOL m_bFlipX; |
598 FX_BOOL m_bFlipY; | 605 FX_BOOL m_bFlipY; |
599 int m_DestWidth; | 606 int m_DestWidth; |
600 int m_DestHeight; | 607 int m_DestHeight; |
601 FX_RECT m_ClipRect; | 608 FX_RECT m_ClipRect; |
| 609 const FXDIB_Format m_DestFormat; |
| 610 const int m_DestBPP; |
602 int m_LineIndex; | 611 int m_LineIndex; |
603 int m_DestBPP; | |
604 uint8_t* m_pScanline; | |
605 uint8_t* m_pMaskScanline; | |
606 FXDIB_Format m_DestFormat; | |
607 }; | 612 }; |
| 613 |
608 class CFX_ImageTransformer { | 614 class CFX_ImageTransformer { |
609 public: | 615 public: |
610 CFX_ImageTransformer(); | 616 CFX_ImageTransformer(); |
611 ~CFX_ImageTransformer(); | 617 ~CFX_ImageTransformer(); |
612 | 618 |
613 FX_BOOL Start(const CFX_DIBSource* pSrc, | 619 FX_BOOL Start(const CFX_DIBSource* pSrc, |
614 const CFX_Matrix* pMatrix, | 620 const CFX_Matrix* pMatrix, |
615 int flags, | 621 int flags, |
616 const FX_RECT* pClip); | 622 const FX_RECT* pClip); |
617 | 623 |
618 FX_BOOL Continue(IFX_Pause* pPause); | 624 FX_BOOL Continue(IFX_Pause* pPause); |
619 | 625 |
620 CFX_Matrix* m_pMatrix; | 626 CFX_Matrix* m_pMatrix; |
621 FX_RECT m_StretchClip; | 627 FX_RECT m_StretchClip; |
622 int m_ResultLeft; | 628 int m_ResultLeft; |
623 int m_ResultTop; | 629 int m_ResultTop; |
624 int m_ResultWidth; | 630 int m_ResultWidth; |
625 int m_ResultHeight; | 631 int m_ResultHeight; |
626 CFX_Matrix m_dest2stretch; | 632 CFX_Matrix m_dest2stretch; |
627 CFX_ImageStretcher m_Stretcher; | 633 std::unique_ptr<CFX_ImageStretcher> m_Stretcher; |
628 CFX_BitmapStorer m_Storer; | 634 CFX_BitmapStorer m_Storer; |
629 uint32_t m_Flags; | 635 uint32_t m_Flags; |
630 int m_Status; | 636 int m_Status; |
631 }; | 637 }; |
| 638 |
632 class CFX_ImageRenderer { | 639 class CFX_ImageRenderer { |
633 public: | 640 public: |
634 CFX_ImageRenderer(); | 641 CFX_ImageRenderer(); |
635 ~CFX_ImageRenderer(); | 642 ~CFX_ImageRenderer(); |
636 | 643 |
637 FX_BOOL Start(CFX_DIBitmap* pDevice, | 644 FX_BOOL Start(CFX_DIBitmap* pDevice, |
638 const CFX_ClipRgn* pClipRgn, | 645 const CFX_ClipRgn* pClipRgn, |
639 const CFX_DIBSource* pSource, | 646 const CFX_DIBSource* pSource, |
640 int bitmap_alpha, | 647 int bitmap_alpha, |
641 uint32_t mask_color, | 648 uint32_t mask_color, |
642 const CFX_Matrix* pMatrix, | 649 const CFX_Matrix* pMatrix, |
643 uint32_t dib_flags, | 650 uint32_t dib_flags, |
644 FX_BOOL bRgbByteOrder = FALSE, | 651 FX_BOOL bRgbByteOrder = FALSE, |
645 int alpha_flag = 0, | 652 int alpha_flag = 0, |
646 void* pIccTransform = NULL, | 653 void* pIccTransform = NULL, |
647 int blend_type = FXDIB_BLEND_NORMAL); | 654 int blend_type = FXDIB_BLEND_NORMAL); |
648 | 655 |
649 FX_BOOL Continue(IFX_Pause* pPause); | 656 FX_BOOL Continue(IFX_Pause* pPause); |
650 | 657 |
651 protected: | 658 protected: |
652 CFX_DIBitmap* m_pDevice; | 659 CFX_DIBitmap* m_pDevice; |
653 const CFX_ClipRgn* m_pClipRgn; | 660 const CFX_ClipRgn* m_pClipRgn; |
654 int m_BitmapAlpha; | 661 int m_BitmapAlpha; |
655 uint32_t m_MaskColor; | 662 uint32_t m_MaskColor; |
656 CFX_Matrix m_Matrix; | 663 CFX_Matrix m_Matrix; |
657 CFX_ImageTransformer* m_pTransformer; | 664 CFX_ImageTransformer* m_pTransformer; |
658 CFX_ImageStretcher m_Stretcher; | 665 std::unique_ptr<CFX_ImageStretcher> m_Stretcher; |
659 CFX_BitmapComposer m_Composer; | 666 CFX_BitmapComposer m_Composer; |
660 int m_Status; | 667 int m_Status; |
661 FX_RECT m_ClipBox; | 668 FX_RECT m_ClipBox; |
662 uint32_t m_Flags; | 669 uint32_t m_Flags; |
663 int m_AlphaFlag; | 670 int m_AlphaFlag; |
664 void* m_pIccTransform; | 671 void* m_pIccTransform; |
665 FX_BOOL m_bRgbByteOrder; | 672 FX_BOOL m_bRgbByteOrder; |
666 int m_BlendType; | 673 int m_BlendType; |
667 }; | 674 }; |
668 | 675 |
669 #endif // CORE_FXGE_INCLUDE_FX_DIB_H_ | 676 #endif // CORE_FXGE_INCLUDE_FX_DIB_H_ |
OLD | NEW |