| 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 FX_AGG_DRIVER_H_ | 7 #ifndef FX_AGG_DRIVER_H_ |
| 8 #define FX_AGG_DRIVER_H_ | 8 #define FX_AGG_DRIVER_H_ |
| 9 | 9 |
| 10 #include "../../../../../third_party/agg23/agg_clip_liang_barsky.h" | 10 #include "../../../../../third_party/agg23/agg_clip_liang_barsky.h" |
| 11 #include "../../../../../third_party/agg23/agg_path_storage.h" | 11 #include "../../../../../third_party/agg23/agg_path_storage.h" |
| 12 #include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h" | 12 #include "../../../../../third_party/agg23/agg_rasterizer_scanline_aa.h" |
| 13 | 13 |
| 14 class CAgg_PathData { | 14 class CAgg_PathData { |
| 15 public: | 15 public: |
| 16 CAgg_PathData() {} | 16 CAgg_PathData() {} |
| 17 ~CAgg_PathData() {} | 17 ~CAgg_PathData() {} |
| 18 FX_NAMESPACE_DECLARE(agg, path_storage) m_PathData; | 18 FX_NAMESPACE_DECLARE(agg, path_storage) m_PathData; |
| 19 void BuildPath(const CFX_PathData* pPathData, | 19 void BuildPath(const CFX_PathData* pPathData, |
| 20 const CFX_AffineMatrix* pObject2Device); | 20 const CFX_AffineMatrix* pObject2Device); |
| 21 }; | 21 }; |
| 22 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { | 22 class CFX_AggDeviceDriver : public IFX_RenderDeviceDriver { |
| 23 public: | 23 public: |
| 24 CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, | 24 CFX_AggDeviceDriver(CFX_DIBitmap* pBitmap, |
| 25 int dither_bits, | 25 int dither_bits, |
| 26 FX_BOOL bRgbByteOrder, | 26 FX_BOOL bRgbByteOrder, |
| 27 CFX_DIBitmap* pOriDevice, | 27 CFX_DIBitmap* pOriDevice, |
| 28 FX_BOOL bGroupKnockout); | 28 FX_BOOL bGroupKnockout); |
| 29 virtual ~CFX_AggDeviceDriver(); | 29 ~CFX_AggDeviceDriver() override; |
| 30 |
| 30 void InitPlatform(); | 31 void InitPlatform(); |
| 31 void DestroyPlatform(); | 32 void DestroyPlatform(); |
| 32 | 33 |
| 33 virtual int GetDeviceCaps(int caps_id); | 34 // IFX_RenderDeviceDriver |
| 34 | 35 int GetDeviceCaps(int caps_id) override; |
| 35 virtual void SaveState(); | 36 void SaveState() override; |
| 36 virtual void RestoreState(FX_BOOL bKeepSaved); | 37 void RestoreState(FX_BOOL bKeepSaved) override; |
| 37 | 38 FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
| 38 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, | |
| 39 const CFX_AffineMatrix* pObject2Device, | |
| 40 int fill_mode); | |
| 41 | |
| 42 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, | |
| 43 const CFX_AffineMatrix* pObject2Device, | |
| 44 const CFX_GraphStateData* pGraphState); | |
| 45 | |
| 46 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, | |
| 47 const CFX_AffineMatrix* pObject2Device, | 39 const CFX_AffineMatrix* pObject2Device, |
| 48 const CFX_GraphStateData* pGraphState, | 40 int fill_mode) override; |
| 49 FX_DWORD fill_color, | 41 FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
| 50 FX_DWORD stroke_color, | 42 const CFX_AffineMatrix* pObject2Device, |
| 51 int fill_mode, | 43 const CFX_GraphStateData* pGraphState) override; |
| 44 FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 45 const CFX_AffineMatrix* pObject2Device, |
| 46 const CFX_GraphStateData* pGraphState, |
| 47 FX_DWORD fill_color, |
| 48 FX_DWORD stroke_color, |
| 49 int fill_mode, |
| 50 int alpha_flag, |
| 51 void* pIccTransform, |
| 52 int blend_type) override; |
| 53 FX_BOOL SetPixel(int x, |
| 54 int y, |
| 55 FX_DWORD color, |
| 56 int alpha_flag, |
| 57 void* pIccTransform) override; |
| 58 FX_BOOL FillRect(const FX_RECT* pRect, |
| 59 FX_DWORD fill_color, |
| 60 int alpha_flag, |
| 61 void* pIccTransform, |
| 62 int blend_type) override; |
| 63 FX_BOOL DrawCosmeticLine(FX_FLOAT x1, |
| 64 FX_FLOAT y1, |
| 65 FX_FLOAT x2, |
| 66 FX_FLOAT y2, |
| 67 FX_DWORD color, |
| 52 int alpha_flag, | 68 int alpha_flag, |
| 53 void* pIccTransform, | 69 void* pIccTransform, |
| 54 int blend_type); | 70 int blend_type) override { |
| 71 return FALSE; |
| 72 } |
| 73 FX_BOOL GetClipBox(FX_RECT* pRect) override; |
| 74 FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, |
| 75 int left, |
| 76 int top, |
| 77 void* pIccTransform = NULL, |
| 78 FX_BOOL bDEdge = FALSE) override; |
| 79 CFX_DIBitmap* GetBackDrop() override { return m_pOriDevice; } |
| 80 FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, |
| 81 FX_DWORD color, |
| 82 const FX_RECT* pSrcRect, |
| 83 int left, |
| 84 int top, |
| 85 int blend_type, |
| 86 int alpha_flag, |
| 87 void* pIccTransform) override; |
| 88 FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, |
| 89 FX_DWORD color, |
| 90 int dest_left, |
| 91 int dest_top, |
| 92 int dest_width, |
| 93 int dest_height, |
| 94 const FX_RECT* pClipRect, |
| 95 FX_DWORD flags, |
| 96 int alpha_flag, |
| 97 void* pIccTransform, |
| 98 int blend_type) override; |
| 99 FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, |
| 100 int bitmap_alpha, |
| 101 FX_DWORD color, |
| 102 const CFX_AffineMatrix* pMatrix, |
| 103 FX_DWORD flags, |
| 104 void*& handle, |
| 105 int alpha_flag, |
| 106 void* pIccTransform, |
| 107 int blend_type) override; |
| 108 FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause) override; |
| 109 void CancelDIBits(void* handle) override; |
| 110 FX_BOOL DrawDeviceText(int nChars, |
| 111 const FXTEXT_CHARPOS* pCharPos, |
| 112 CFX_Font* pFont, |
| 113 CFX_FontCache* pCache, |
| 114 const CFX_AffineMatrix* pObject2Device, |
| 115 FX_FLOAT font_size, |
| 116 FX_DWORD color, |
| 117 int alpha_flag, |
| 118 void* pIccTransform) override; |
| 119 int GetDriverType() override { return 1; } |
| 55 | 120 |
| 56 virtual FX_BOOL SetPixel(int x, | 121 FX_BOOL RenderRasterizer(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & |
| 57 int y, | 122 rasterizer, |
| 58 FX_DWORD color, | 123 FX_DWORD color, |
| 124 FX_BOOL bFullCover, |
| 125 FX_BOOL bGroupKnockout, |
| 59 int alpha_flag, | 126 int alpha_flag, |
| 60 void* pIccTransform); | 127 void* pIccTransform); |
| 61 | 128 |
| 62 virtual FX_BOOL FillRect(const FX_RECT* pRect, | |
| 63 FX_DWORD fill_color, | |
| 64 int alpha_flag, | |
| 65 void* pIccTransform, | |
| 66 int blend_type); | |
| 67 | |
| 68 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, | |
| 69 FX_FLOAT y1, | |
| 70 FX_FLOAT x2, | |
| 71 FX_FLOAT y2, | |
| 72 FX_DWORD color, | |
| 73 int alpha_flag, | |
| 74 void* pIccTransform, | |
| 75 int blend_type) { | |
| 76 return FALSE; | |
| 77 } | |
| 78 | |
| 79 virtual FX_BOOL GetClipBox(FX_RECT* pRect); | |
| 80 | |
| 81 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, | |
| 82 int left, | |
| 83 int top, | |
| 84 void* pIccTransform = NULL, | |
| 85 FX_BOOL bDEdge = FALSE); | |
| 86 virtual CFX_DIBitmap* GetBackDrop() { return m_pOriDevice; } | |
| 87 | |
| 88 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | |
| 89 FX_DWORD color, | |
| 90 const FX_RECT* pSrcRect, | |
| 91 int left, | |
| 92 int top, | |
| 93 int blend_type, | |
| 94 int alpha_flag, | |
| 95 void* pIccTransform); | |
| 96 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | |
| 97 FX_DWORD color, | |
| 98 int dest_left, | |
| 99 int dest_top, | |
| 100 int dest_width, | |
| 101 int dest_height, | |
| 102 const FX_RECT* pClipRect, | |
| 103 FX_DWORD flags, | |
| 104 int alpha_flag, | |
| 105 void* pIccTransform, | |
| 106 int blend_type); | |
| 107 | |
| 108 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | |
| 109 int bitmap_alpha, | |
| 110 FX_DWORD color, | |
| 111 const CFX_AffineMatrix* pMatrix, | |
| 112 FX_DWORD flags, | |
| 113 void*& handle, | |
| 114 int alpha_flag, | |
| 115 void* pIccTransform, | |
| 116 int blend_type); | |
| 117 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); | |
| 118 virtual void CancelDIBits(void* handle); | |
| 119 | |
| 120 virtual FX_BOOL DrawDeviceText(int nChars, | |
| 121 const FXTEXT_CHARPOS* pCharPos, | |
| 122 CFX_Font* pFont, | |
| 123 CFX_FontCache* pCache, | |
| 124 const CFX_AffineMatrix* pObject2Device, | |
| 125 FX_FLOAT font_size, | |
| 126 FX_DWORD color, | |
| 127 int alpha_flag, | |
| 128 void* pIccTransform); | |
| 129 virtual FX_BOOL RenderRasterizer( | |
| 130 FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & rasterizer, | |
| 131 FX_DWORD color, | |
| 132 FX_BOOL bFullCover, | |
| 133 FX_BOOL bGroupKnockout, | |
| 134 int alpha_flag, | |
| 135 void* pIccTransform); | |
| 136 | |
| 137 void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & | 129 void SetClipMask(FX_NAMESPACE_DECLARE(agg, rasterizer_scanline_aa) & |
| 138 rasterizer); | 130 rasterizer); |
| 139 | 131 |
| 140 virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } | 132 virtual uint8_t* GetBuffer() const { return m_pBitmap->GetBuffer(); } |
| 141 virtual int GetDriverType() { return 1; } | |
| 142 | 133 |
| 143 CFX_DIBitmap* m_pBitmap; | 134 CFX_DIBitmap* m_pBitmap; |
| 144 CFX_ClipRgn* m_pClipRgn; | 135 CFX_ClipRgn* m_pClipRgn; |
| 145 CFX_PtrArray m_StateStack; | 136 CFX_PtrArray m_StateStack; |
| 146 void* m_pPlatformGraphics; | 137 void* m_pPlatformGraphics; |
| 147 void* m_pPlatformBitmap; | 138 void* m_pPlatformBitmap; |
| 148 void* m_pDwRenderTartget; | 139 void* m_pDwRenderTartget; |
| 149 int m_FillFlags; | 140 int m_FillFlags; |
| 150 int m_DitherBits; | 141 int m_DitherBits; |
| 151 FX_BOOL m_bRgbByteOrder; | 142 FX_BOOL m_bRgbByteOrder; |
| 152 CFX_DIBitmap* m_pOriDevice; | 143 CFX_DIBitmap* m_pOriDevice; |
| 153 FX_BOOL m_bGroupKnockout; | 144 FX_BOOL m_bGroupKnockout; |
| 154 }; | 145 }; |
| 155 | 146 |
| 156 #endif // FX_AGG_DRIVER_H_ | 147 #endif // FX_AGG_DRIVER_H_ |
| OLD | NEW |