| 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_FXGE_DIB_DIB_INT_H_ | 7 #ifndef CORE_SRC_FXGE_DIB_DIB_INT_H_ |
| 8 #define CORE_SRC_FXGE_DIB_DIB_INT_H_ | 8 #define CORE_SRC_FXGE_DIB_DIB_INT_H_ |
| 9 | 9 |
| 10 class CPDF_FixedMatrix | 10 class CPDF_FixedMatrix { |
| 11 { | 11 public: |
| 12 public: | 12 CPDF_FixedMatrix(const CFX_AffineMatrix& src, int bits) { |
| 13 CPDF_FixedMatrix(const CFX_AffineMatrix& src, int bits) | 13 base = 1 << bits; |
| 14 { | 14 a = FXSYS_round(src.a * base); |
| 15 base = 1 << bits; | 15 b = FXSYS_round(src.b * base); |
| 16 a = FXSYS_round(src.a * base); | 16 c = FXSYS_round(src.c * base); |
| 17 b = FXSYS_round(src.b * base); | 17 d = FXSYS_round(src.d * base); |
| 18 c = FXSYS_round(src.c * base); | 18 e = FXSYS_round(src.e * base); |
| 19 d = FXSYS_round(src.d * base); | 19 f = FXSYS_round(src.f * base); |
| 20 e = FXSYS_round(src.e * base); | 20 } |
| 21 f = FXSYS_round(src.f * base); | 21 inline void Transform(int x, int y, int& x1, int& y1) { |
| 22 x1 = (a * x + c * y + e + base / 2) / base; |
| 23 y1 = (b * x + d * y + f + base / 2) / base; |
| 24 } |
| 25 int a, b, c, d, e, f; |
| 26 int base; |
| 27 }; |
| 28 #define FPDF_HUGE_IMAGE_SIZE 60000000 |
| 29 struct PixelWeight { |
| 30 int m_SrcStart; |
| 31 int m_SrcEnd; |
| 32 int m_Weights[1]; |
| 33 }; |
| 34 class CWeightTable { |
| 35 public: |
| 36 CWeightTable() { m_pWeightTables = NULL; } |
| 37 ~CWeightTable() { |
| 38 if (m_pWeightTables) { |
| 39 FX_Free(m_pWeightTables); |
| 22 } | 40 } |
| 23 inline void»Transform(int x, int y, int& x1, int& y1) | 41 m_pWeightTables = NULL; |
| 24 { | 42 } |
| 25 x1 = (a * x + c * y + e + base / 2) / base; | 43 void Calc(int dest_len, |
| 26 y1 = (b * x + d * y + f + base / 2) / base; | 44 int dest_min, |
| 27 } | 45 int dest_max, |
| 28 int»» a, b, c, d, e, f; | 46 int src_len, |
| 29 int»» base; | 47 int src_min, |
| 48 int src_max, |
| 49 int flags); |
| 50 PixelWeight* GetPixelWeight(int pixel) { |
| 51 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); |
| 52 } |
| 53 int m_DestMin, m_ItemSize; |
| 54 uint8_t* m_pWeightTables; |
| 30 }; | 55 }; |
| 31 #define FPDF_HUGE_IMAGE_SIZE» 60000000 | 56 class CStretchEngine { |
| 32 struct PixelWeight { | 57 public: |
| 33 int»» m_SrcStart; | 58 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, |
| 34 int»» m_SrcEnd; | 59 FXDIB_Format dest_format, |
| 35 int»» m_Weights[1]; | 60 int dest_width, |
| 36 }; | 61 int dest_height, |
| 37 class CWeightTable | 62 const FX_RECT& clip_rect, |
| 38 { | 63 const CFX_DIBSource* pSrcBitmap, |
| 39 public: | 64 int flags); |
| 40 CWeightTable() | 65 ~CStretchEngine(); |
| 41 { | 66 FX_BOOL Continue(IFX_Pause* pPause); |
| 42 m_pWeightTables = NULL; | 67 |
| 43 } | 68 public: |
| 44 ~CWeightTable() | 69 FXDIB_Format m_DestFormat; |
| 45 { | 70 int m_DestBpp, m_SrcBpp, m_bHasAlpha; |
| 46 if(m_pWeightTables) { | 71 IFX_ScanlineComposer* m_pDestBitmap; |
| 47 FX_Free(m_pWeightTables); | 72 int m_DestWidth, m_DestHeight; |
| 48 } | 73 FX_RECT m_DestClip; |
| 49 m_pWeightTables = NULL; | 74 uint8_t* m_pDestScanline; |
| 50 } | 75 uint8_t* m_pDestMaskScanline; |
| 51 void» » » Calc(int dest_len, int dest_min, int dest_max, i
nt src_len, int src_min, int src_max, int flags); | 76 FX_RECT m_SrcClip; |
| 52 PixelWeight*» GetPixelWeight(int pixel) | 77 const CFX_DIBSource* m_pSource; |
| 53 { | 78 FX_DWORD* m_pSrcPalette; |
| 54 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize
); | 79 int m_SrcWidth, m_SrcHeight; |
| 55 } | 80 int m_SrcPitch, m_InterPitch; |
| 56 int»» » » m_DestMin, m_ItemSize; | 81 int m_ExtraMaskPitch; |
| 57 uint8_t*» » m_pWeightTables; | 82 unsigned char* m_pInterBuf; |
| 58 }; | 83 unsigned char* m_pExtraAlphaBuf; |
| 59 class CStretchEngine | 84 int m_TransMethod; |
| 60 { | 85 int m_Flags; |
| 61 public: | 86 CWeightTable m_WeightTable; |
| 62 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format dest_format, | 87 int m_CurRow; |
| 63 int dest_width, int dest_height, const FX_RECT& clip_rect, | 88 FX_BOOL StartStretchHorz(); |
| 64 const CFX_DIBSource* pSrcBitmap, int flags); | 89 FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); |
| 65 ~CStretchEngine(); | 90 void StretchVert(); |
| 66 FX_BOOL» » Continue(IFX_Pause* pPause); | 91 int m_State; |
| 67 public: | |
| 68 FXDIB_Format m_DestFormat; | |
| 69 int»» m_DestBpp, m_SrcBpp, m_bHasAlpha; | |
| 70 IFX_ScanlineComposer*» m_pDestBitmap; | |
| 71 int»» m_DestWidth, m_DestHeight; | |
| 72 FX_RECT» m_DestClip; | |
| 73 uint8_t*» m_pDestScanline; | |
| 74 uint8_t* m_pDestMaskScanline; | |
| 75 FX_RECT» m_SrcClip; | |
| 76 const CFX_DIBSource*» m_pSource; | |
| 77 FX_DWORD*» m_pSrcPalette; | |
| 78 int»» m_SrcWidth, m_SrcHeight; | |
| 79 int»» m_SrcPitch, m_InterPitch; | |
| 80 int m_ExtraMaskPitch; | |
| 81 unsigned char*» m_pInterBuf; | |
| 82 unsigned char*» m_pExtraAlphaBuf; | |
| 83 int»» m_TransMethod; | |
| 84 int » m_Flags; | |
| 85 CWeightTable» m_WeightTable; | |
| 86 int»» m_CurRow; | |
| 87 FX_BOOL» StartStretchHorz(); | |
| 88 FX_BOOL» ContinueStretchHorz(IFX_Pause* pPause); | |
| 89 void» StretchVert(); | |
| 90 int»» m_State; | |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 #endif // CORE_SRC_FXGE_DIB_DIB_INT_H_ | 94 #endif // CORE_SRC_FXGE_DIB_DIB_INT_H_ |
| OLD | NEW |