| 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> | 10 #include <memory> |
| 11 #include <vector> |
| 11 | 12 |
| 12 #include "core/fxcrt/include/fx_basic.h" | 13 #include "core/fxcrt/include/fx_basic.h" |
| 13 #include "core/fxcrt/include/fx_coordinates.h" | 14 #include "core/fxcrt/include/fx_coordinates.h" |
| 14 | 15 |
| 15 enum FXDIB_Format { | 16 enum FXDIB_Format { |
| 16 FXDIB_Invalid = 0, | 17 FXDIB_Invalid = 0, |
| 17 FXDIB_1bppMask = 0x101, | 18 FXDIB_1bppMask = 0x101, |
| 18 FXDIB_1bppRgb = 0x001, | 19 FXDIB_1bppRgb = 0x001, |
| 19 FXDIB_1bppCmyk = 0x401, | 20 FXDIB_1bppCmyk = 0x401, |
| 20 FXDIB_8bppMask = 0x108, | 21 FXDIB_8bppMask = 0x108, |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 375 |
| 375 uint8_t* m_pBuffer; | 376 uint8_t* m_pBuffer; |
| 376 FX_BOOL m_bExtBuf; | 377 FX_BOOL m_bExtBuf; |
| 377 }; | 378 }; |
| 378 | 379 |
| 379 class CFX_DIBExtractor { | 380 class CFX_DIBExtractor { |
| 380 public: | 381 public: |
| 381 explicit CFX_DIBExtractor(const CFX_DIBSource* pSrc); | 382 explicit CFX_DIBExtractor(const CFX_DIBSource* pSrc); |
| 382 ~CFX_DIBExtractor(); | 383 ~CFX_DIBExtractor(); |
| 383 | 384 |
| 384 operator CFX_DIBitmap*() { return m_pBitmap; } | 385 CFX_DIBitmap* GetBitmap() { return m_pBitmap.get(); } |
| 385 | 386 |
| 386 private: | 387 private: |
| 387 CFX_DIBitmap* m_pBitmap; | 388 std::unique_ptr<CFX_DIBitmap> m_pBitmap; |
| 388 }; | 389 }; |
| 389 | 390 |
| 390 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; | 391 typedef CFX_CountRef<CFX_DIBitmap> CFX_DIBitmapRef; |
| 391 class CFX_FilteredDIB : public CFX_DIBSource { | 392 class CFX_FilteredDIB : public CFX_DIBSource { |
| 392 public: | 393 public: |
| 393 CFX_FilteredDIB(); | 394 CFX_FilteredDIB(); |
| 394 ~CFX_FilteredDIB() override; | 395 ~CFX_FilteredDIB() override; |
| 395 | 396 |
| 396 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); | 397 void LoadSrc(const CFX_DIBSource* pSrc, FX_BOOL bAutoDropSrc = FALSE); |
| 397 | 398 |
| 398 virtual FXDIB_Format GetDestFormat() = 0; | 399 virtual FXDIB_Format GetDestFormat() = 0; |
| 399 | 400 |
| 400 virtual uint32_t* GetDestPalette() = 0; | 401 virtual uint32_t* GetDestPalette() = 0; |
| 401 | 402 |
| 402 virtual void TranslateScanline(uint8_t* dest_buf, | 403 virtual void TranslateScanline(const uint8_t* src_buf, |
| 403 const uint8_t* src_buf) const = 0; | 404 std::vector<uint8_t>* dest_buf) const = 0; |
| 404 | 405 |
| 405 virtual void TranslateDownSamples(uint8_t* dest_buf, | 406 virtual void TranslateDownSamples(uint8_t* dest_buf, |
| 406 const uint8_t* src_buf, | 407 const uint8_t* src_buf, |
| 407 int pixels, | 408 int pixels, |
| 408 int Bpp) const = 0; | 409 int Bpp) const = 0; |
| 409 | 410 |
| 410 protected: | 411 protected: |
| 411 // CFX_DIBSource | 412 // CFX_DIBSource |
| 412 const uint8_t* GetScanline(int line) const override; | 413 const uint8_t* GetScanline(int line) const override; |
| 413 void DownSampleScanline(int line, | 414 void DownSampleScanline(int line, |
| 414 uint8_t* dest_scan, | 415 uint8_t* dest_scan, |
| 415 int dest_bpp, | 416 int dest_bpp, |
| 416 int dest_width, | 417 int dest_width, |
| 417 FX_BOOL bFlipX, | 418 FX_BOOL bFlipX, |
| 418 int clip_left, | 419 int clip_left, |
| 419 int clip_width) const override; | 420 int clip_width) const override; |
| 420 | 421 |
| 421 const CFX_DIBSource* m_pSrc; | 422 const CFX_DIBSource* m_pSrc; |
| 422 | |
| 423 FX_BOOL m_bAutoDropSrc; | 423 FX_BOOL m_bAutoDropSrc; |
| 424 | 424 mutable std::vector<uint8_t> m_Scanline; |
| 425 uint8_t* m_pScanline; | |
| 426 }; | 425 }; |
| 427 | 426 |
| 428 class IFX_ScanlineComposer { | 427 class IFX_ScanlineComposer { |
| 429 public: | 428 public: |
| 430 virtual ~IFX_ScanlineComposer() {} | 429 virtual ~IFX_ScanlineComposer() {} |
| 431 | 430 |
| 432 virtual void ComposeScanline(int line, | 431 virtual void ComposeScanline(int line, |
| 433 const uint8_t* scanline, | 432 const uint8_t* scanline, |
| 434 const uint8_t* scan_extra_alpha = nullptr) = 0; | 433 const uint8_t* scan_extra_alpha = nullptr) = 0; |
| 435 | 434 |
| 436 virtual FX_BOOL SetInfo(int width, | 435 virtual FX_BOOL SetInfo(int width, |
| 437 int height, | 436 int height, |
| 438 FXDIB_Format src_format, | 437 FXDIB_Format src_format, |
| 439 uint32_t* pSrcPalette) = 0; | 438 uint32_t* pSrcPalette) = 0; |
| 440 }; | 439 }; |
| 440 |
| 441 class CFX_ScanlineCompositor { | 441 class CFX_ScanlineCompositor { |
| 442 public: | 442 public: |
| 443 CFX_ScanlineCompositor(); | 443 CFX_ScanlineCompositor(); |
| 444 | 444 |
| 445 ~CFX_ScanlineCompositor(); | 445 ~CFX_ScanlineCompositor(); |
| 446 | 446 |
| 447 FX_BOOL Init(FXDIB_Format dest_format, | 447 FX_BOOL Init(FXDIB_Format dest_format, |
| 448 FXDIB_Format src_format, | 448 FXDIB_Format src_format, |
| 449 int32_t width, | 449 int32_t width, |
| 450 uint32_t* pSrcPalette, | 450 uint32_t* pSrcPalette, |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 656 int blend_type = FXDIB_BLEND_NORMAL); | 656 int blend_type = FXDIB_BLEND_NORMAL); |
| 657 | 657 |
| 658 FX_BOOL Continue(IFX_Pause* pPause); | 658 FX_BOOL Continue(IFX_Pause* pPause); |
| 659 | 659 |
| 660 protected: | 660 protected: |
| 661 CFX_DIBitmap* m_pDevice; | 661 CFX_DIBitmap* m_pDevice; |
| 662 const CFX_ClipRgn* m_pClipRgn; | 662 const CFX_ClipRgn* m_pClipRgn; |
| 663 int m_BitmapAlpha; | 663 int m_BitmapAlpha; |
| 664 uint32_t m_MaskColor; | 664 uint32_t m_MaskColor; |
| 665 CFX_Matrix m_Matrix; | 665 CFX_Matrix m_Matrix; |
| 666 CFX_ImageTransformer* m_pTransformer; | 666 std::unique_ptr<CFX_ImageTransformer> m_pTransformer; |
| 667 std::unique_ptr<CFX_ImageStretcher> m_Stretcher; | 667 std::unique_ptr<CFX_ImageStretcher> m_Stretcher; |
| 668 CFX_BitmapComposer m_Composer; | 668 CFX_BitmapComposer m_Composer; |
| 669 int m_Status; | 669 int m_Status; |
| 670 FX_RECT m_ClipBox; | 670 FX_RECT m_ClipBox; |
| 671 uint32_t m_Flags; | 671 uint32_t m_Flags; |
| 672 int m_AlphaFlag; | 672 int m_AlphaFlag; |
| 673 void* m_pIccTransform; | 673 void* m_pIccTransform; |
| 674 FX_BOOL m_bRgbByteOrder; | 674 FX_BOOL m_bRgbByteOrder; |
| 675 int m_BlendType; | 675 int m_BlendType; |
| 676 }; | 676 }; |
| 677 | 677 |
| 678 #endif // CORE_FXGE_INCLUDE_FX_DIB_H_ | 678 #endif // CORE_FXGE_INCLUDE_FX_DIB_H_ |
| OLD | NEW |