| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | |
| 6 | |
| 7 #ifndef CORE_SRC_FXGE_DIB_DIB_INT_H_ | |
| 8 #define CORE_SRC_FXGE_DIB_DIB_INT_H_ | |
| 9 | |
| 10 #include <stdint.h> | |
| 11 | |
| 12 #include "core/include/fxcrt/fx_coordinates.h" | |
| 13 #include "core/include/fxge/fx_dib.h" | |
| 14 | |
| 15 class IFX_ScanlineComposer; | |
| 16 | |
| 17 extern const int16_t SDP_Table[513]; | |
| 18 | |
| 19 class CPDF_FixedMatrix { | |
| 20 public: | |
| 21 CPDF_FixedMatrix(const CFX_Matrix& src, int bits) { | |
| 22 base = 1 << bits; | |
| 23 a = FXSYS_round(src.a * base); | |
| 24 b = FXSYS_round(src.b * base); | |
| 25 c = FXSYS_round(src.c * base); | |
| 26 d = FXSYS_round(src.d * base); | |
| 27 e = FXSYS_round(src.e * base); | |
| 28 f = FXSYS_round(src.f * base); | |
| 29 } | |
| 30 inline void Transform(int x, int y, int& x1, int& y1) { | |
| 31 x1 = (a * x + c * y + e + base / 2) / base; | |
| 32 y1 = (b * x + d * y + f + base / 2) / base; | |
| 33 } | |
| 34 int a, b, c, d, e, f; | |
| 35 int base; | |
| 36 }; | |
| 37 #define FPDF_HUGE_IMAGE_SIZE 60000000 | |
| 38 struct PixelWeight { | |
| 39 int m_SrcStart; | |
| 40 int m_SrcEnd; | |
| 41 int m_Weights[1]; | |
| 42 }; | |
| 43 class CWeightTable { | |
| 44 public: | |
| 45 CWeightTable() { m_pWeightTables = NULL; } | |
| 46 ~CWeightTable() { | |
| 47 FX_Free(m_pWeightTables); | |
| 48 m_pWeightTables = NULL; | |
| 49 } | |
| 50 void Calc(int dest_len, | |
| 51 int dest_min, | |
| 52 int dest_max, | |
| 53 int src_len, | |
| 54 int src_min, | |
| 55 int src_max, | |
| 56 int flags); | |
| 57 PixelWeight* GetPixelWeight(int pixel) { | |
| 58 return (PixelWeight*)(m_pWeightTables + (pixel - m_DestMin) * m_ItemSize); | |
| 59 } | |
| 60 int m_DestMin, m_ItemSize; | |
| 61 uint8_t* m_pWeightTables; | |
| 62 }; | |
| 63 class CStretchEngine { | |
| 64 public: | |
| 65 CStretchEngine(IFX_ScanlineComposer* pDestBitmap, | |
| 66 FXDIB_Format dest_format, | |
| 67 int dest_width, | |
| 68 int dest_height, | |
| 69 const FX_RECT& clip_rect, | |
| 70 const CFX_DIBSource* pSrcBitmap, | |
| 71 int flags); | |
| 72 ~CStretchEngine(); | |
| 73 FX_BOOL Continue(IFX_Pause* pPause); | |
| 74 | |
| 75 public: | |
| 76 FXDIB_Format m_DestFormat; | |
| 77 int m_DestBpp, m_SrcBpp, m_bHasAlpha; | |
| 78 IFX_ScanlineComposer* m_pDestBitmap; | |
| 79 int m_DestWidth, m_DestHeight; | |
| 80 FX_RECT m_DestClip; | |
| 81 uint8_t* m_pDestScanline; | |
| 82 uint8_t* m_pDestMaskScanline; | |
| 83 FX_RECT m_SrcClip; | |
| 84 const CFX_DIBSource* m_pSource; | |
| 85 FX_DWORD* m_pSrcPalette; | |
| 86 int m_SrcWidth, m_SrcHeight; | |
| 87 int m_SrcPitch, m_InterPitch; | |
| 88 int m_ExtraMaskPitch; | |
| 89 unsigned char* m_pInterBuf; | |
| 90 unsigned char* m_pExtraAlphaBuf; | |
| 91 int m_TransMethod; | |
| 92 int m_Flags; | |
| 93 CWeightTable m_WeightTable; | |
| 94 int m_CurRow; | |
| 95 FX_BOOL StartStretchHorz(); | |
| 96 FX_BOOL ContinueStretchHorz(IFX_Pause* pPause); | |
| 97 void StretchVert(); | |
| 98 int m_State; | |
| 99 }; | |
| 100 | |
| 101 FX_RECT FXDIB_SwapClipBox(FX_RECT& clip, | |
| 102 int width, | |
| 103 int height, | |
| 104 FX_BOOL bFlipX, | |
| 105 FX_BOOL bFlipY); | |
| 106 | |
| 107 #endif // CORE_SRC_FXGE_DIB_DIB_INT_H_ | |
| OLD | NEW |