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