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 _DIB_INT_H_ | 7 #ifndef _DIB_INT_H_ |
8 #define _DIB_INT_H_ | 8 #define _DIB_INT_H_ |
9 | 9 |
10 class CPDF_FixedMatrix : public CFX_Object | 10 class CPDF_FixedMatrix |
11 { | 11 { |
12 public: | 12 public: |
13 CPDF_FixedMatrix(const CFX_AffineMatrix& src, int bits) | 13 CPDF_FixedMatrix(const CFX_AffineMatrix& src, int bits) |
14 { | 14 { |
15 base = 1 << bits; | 15 base = 1 << bits; |
16 a = FXSYS_round(src.a * base); | 16 a = FXSYS_round(src.a * base); |
17 b = FXSYS_round(src.b * base); | 17 b = FXSYS_round(src.b * base); |
18 c = FXSYS_round(src.c * base); | 18 c = FXSYS_round(src.c * base); |
19 d = FXSYS_round(src.d * base); | 19 d = FXSYS_round(src.d * base); |
20 e = FXSYS_round(src.e * base); | 20 e = FXSYS_round(src.e * base); |
21 f = FXSYS_round(src.f * base); | 21 f = FXSYS_round(src.f * base); |
22 } | 22 } |
23 inline void Transform(int x, int y, int& x1, int& y1) | 23 inline void Transform(int x, int y, int& x1, int& y1) |
24 { | 24 { |
25 x1 = (a * x + c * y + e + base / 2) / base; | 25 x1 = (a * x + c * y + e + base / 2) / base; |
26 y1 = (b * x + d * y + f + base / 2) / base; | 26 y1 = (b * x + d * y + f + base / 2) / base; |
27 } | 27 } |
28 int a, b, c, d, e, f; | 28 int a, b, c, d, e, f; |
29 int base; | 29 int base; |
30 }; | 30 }; |
31 #define FPDF_HUGE_IMAGE_SIZE 60000000 | 31 #define FPDF_HUGE_IMAGE_SIZE 60000000 |
32 struct PixelWeight { | 32 struct PixelWeight { |
33 int m_SrcStart; | 33 int m_SrcStart; |
34 int m_SrcEnd; | 34 int m_SrcEnd; |
35 int m_Weights[1]; | 35 int m_Weights[1]; |
36 }; | 36 }; |
37 class CWeightTable : public CFX_Object | 37 class CWeightTable |
38 { | 38 { |
39 public: | 39 public: |
40 CWeightTable() | 40 CWeightTable() |
41 { | 41 { |
42 m_pWeightTables = NULL; | 42 m_pWeightTables = NULL; |
43 } | 43 } |
44 ~CWeightTable() | 44 ~CWeightTable() |
45 { | 45 { |
46 if(m_pWeightTables) { | 46 if(m_pWeightTables) { |
47 FX_Free(m_pWeightTables); | 47 FX_Free(m_pWeightTables); |
48 } | 48 } |
49 m_pWeightTables = NULL; | 49 m_pWeightTables = NULL; |
50 } | 50 } |
51 void Calc(int dest_len, int dest_min, int dest_max, i
nt src_len, int src_min, int src_max, int flags); | 51 void Calc(int dest_len, int dest_min, int dest_max, i
nt src_len, int src_min, int src_max, int flags); |
52 PixelWeight* GetPixelWeight(int pixel) | 52 PixelWeight* GetPixelWeight(int pixel) |
53 { | 53 { |
54 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize
); | 54 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize
); |
55 } | 55 } |
56 int m_DestMin, m_ItemSize; | 56 int m_DestMin, m_ItemSize; |
57 FX_LPBYTE m_pWeightTables; | 57 FX_LPBYTE m_pWeightTables; |
58 }; | 58 }; |
59 class CStretchEngine : public CFX_Object | 59 class CStretchEngine |
60 { | 60 { |
61 public: | 61 public: |
62 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format dest_format, | 62 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, FXDIB_Format dest_format, |
63 int dest_width, int dest_height, const FX_RECT& clip_rect, | 63 int dest_width, int dest_height, const FX_RECT& clip_rect, |
64 const CFX_DIBSource* pSrcBitmap, int flags); | 64 const CFX_DIBSource* pSrcBitmap, int flags); |
65 ~CStretchEngine(); | 65 ~CStretchEngine(); |
66 FX_BOOL Continue(IFX_Pause* pPause); | 66 FX_BOOL Continue(IFX_Pause* pPause); |
67 public: | 67 public: |
68 FXDIB_Format m_DestFormat; | 68 FXDIB_Format m_DestFormat; |
69 int m_DestBpp, m_SrcBpp, m_bHasAlpha; | 69 int m_DestBpp, m_SrcBpp, m_bHasAlpha; |
(...skipping 14 matching lines...) Expand all Loading... |
84 int m_Flags; | 84 int m_Flags; |
85 CWeightTable m_WeightTable; | 85 CWeightTable m_WeightTable; |
86 int m_CurRow; | 86 int m_CurRow; |
87 FX_BOOL StartStretchHorz(); | 87 FX_BOOL StartStretchHorz(); |
88 FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); | 88 FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); |
89 void StretchVert(); | 89 void StretchVert(); |
90 int m_State; | 90 int m_State; |
91 }; | 91 }; |
92 | 92 |
93 #endif // _DIB_INT_H_ | 93 #endif // _DIB_INT_H_ |
OLD | NEW |