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 #ifndef CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 5 #ifndef CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
6 #define CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 6 #define CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
7 | 7 |
8 #if defined(_SKIA_SUPPORT_) | 8 #if defined _SKIA_SUPPORT_ || defined _SKIA_SUPPORT_PATHS_ |
9 | 9 |
10 #include "core/fxge/cfx_pathdata.h" | 10 #include "core/fxge/cfx_pathdata.h" |
11 #include "core/fxge/ifx_renderdevicedriver.h" | 11 #include "core/fxge/ifx_renderdevicedriver.h" |
12 | 12 |
13 class SkCanvas; | 13 class SkCanvas; |
14 class SkMatrix; | 14 class SkMatrix; |
15 class SkPaint; | 15 class SkPaint; |
16 class SkPath; | 16 class SkPath; |
17 class SkPictureRecorder; | 17 class SkPictureRecorder; |
18 class SkiaState; | 18 class SkiaState; |
19 struct FXTEXT_CHARPOS; | 19 struct FXTEXT_CHARPOS; |
20 struct SkIRect; | 20 struct SkIRect; |
21 | 21 |
22 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { | 22 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { |
23 public: | 23 public: |
24 CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | 24 CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, |
25 bool bRgbByteOrder, | 25 bool bRgbByteOrder, |
26 CFX_DIBitmap* pOriDevice, | 26 CFX_DIBitmap* pOriDevice, |
27 bool bGroupKnockout); | 27 bool bGroupKnockout); |
| 28 #ifdef _SKIA_SUPPORT_ |
28 explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder); | 29 explicit CFX_SkiaDeviceDriver(SkPictureRecorder* recorder); |
29 CFX_SkiaDeviceDriver(int size_x, int size_y); | 30 CFX_SkiaDeviceDriver(int size_x, int size_y); |
| 31 #endif |
30 ~CFX_SkiaDeviceDriver() override; | 32 ~CFX_SkiaDeviceDriver() override; |
31 | 33 |
32 /** Options */ | 34 /** Options */ |
33 int GetDeviceCaps(int caps_id) const override; | 35 int GetDeviceCaps(int caps_id) const override; |
34 | 36 |
35 /** Save and restore all graphic states */ | 37 /** Save and restore all graphic states */ |
36 void SaveState() override; | 38 void SaveState() override; |
37 void RestoreState(bool bKeepSaved) override; | 39 void RestoreState(bool bKeepSaved) override; |
38 | 40 |
39 /** Set clipping path using filled region */ | 41 /** Set clipping path using filled region */ |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; | 79 bool GetDIBits(CFX_DIBitmap* pBitmap, int left, int top) override; |
78 | 80 |
79 CFX_DIBitmap* GetBackDrop() override; | 81 CFX_DIBitmap* GetBackDrop() override; |
80 | 82 |
81 bool SetDIBits(const CFX_DIBSource* pBitmap, | 83 bool SetDIBits(const CFX_DIBSource* pBitmap, |
82 uint32_t color, | 84 uint32_t color, |
83 const FX_RECT* pSrcRect, | 85 const FX_RECT* pSrcRect, |
84 int dest_left, | 86 int dest_left, |
85 int dest_top, | 87 int dest_top, |
86 int blend_type) override; | 88 int blend_type) override; |
| 89 #ifdef _SKIA_SUPPORT_ |
87 bool SetBitsWithMask(const CFX_DIBSource* pBitmap, | 90 bool SetBitsWithMask(const CFX_DIBSource* pBitmap, |
88 const CFX_DIBSource* pMask, | 91 const CFX_DIBSource* pMask, |
89 int dest_left, | 92 int dest_left, |
90 int dest_top, | 93 int dest_top, |
91 int bitmap_alpha, | 94 int bitmap_alpha, |
92 int blend_type) override; | 95 int blend_type) override; |
| 96 #else |
| 97 void SetClipMask(const FX_RECT& clipBox, const SkPath& skClipPath); |
| 98 #endif |
| 99 |
93 bool StretchDIBits(const CFX_DIBSource* pBitmap, | 100 bool StretchDIBits(const CFX_DIBSource* pBitmap, |
94 uint32_t color, | 101 uint32_t color, |
95 int dest_left, | 102 int dest_left, |
96 int dest_top, | 103 int dest_top, |
97 int dest_width, | 104 int dest_width, |
98 int dest_height, | 105 int dest_height, |
99 const FX_RECT* pClipRect, | 106 const FX_RECT* pClipRect, |
100 uint32_t flags, | 107 uint32_t flags, |
101 int blend_type) override; | 108 int blend_type) override; |
102 | 109 |
(...skipping 15 matching lines...) Expand all Loading... |
118 const CFX_Matrix* pMatrix, | 125 const CFX_Matrix* pMatrix, |
119 int blend_type); | 126 int blend_type); |
120 | 127 |
121 bool DrawDeviceText(int nChars, | 128 bool DrawDeviceText(int nChars, |
122 const FXTEXT_CHARPOS* pCharPos, | 129 const FXTEXT_CHARPOS* pCharPos, |
123 CFX_Font* pFont, | 130 CFX_Font* pFont, |
124 const CFX_Matrix* pObject2Device, | 131 const CFX_Matrix* pObject2Device, |
125 FX_FLOAT font_size, | 132 FX_FLOAT font_size, |
126 uint32_t color) override; | 133 uint32_t color) override; |
127 | 134 |
| 135 #ifdef _SKIA_SUPPORT_ |
128 bool DrawShading(const CPDF_ShadingPattern* pPattern, | 136 bool DrawShading(const CPDF_ShadingPattern* pPattern, |
129 const CFX_Matrix* pMatrix, | 137 const CFX_Matrix* pMatrix, |
130 const FX_RECT& clip_rect, | 138 const FX_RECT& clip_rect, |
131 int alpha, | 139 int alpha, |
132 bool bAlphaMode) override; | 140 bool bAlphaMode) override; |
| 141 #endif |
133 | 142 |
134 virtual uint8_t* GetBuffer() const; | 143 virtual uint8_t* GetBuffer() const; |
135 | 144 |
136 void PaintStroke(SkPaint* spaint, | 145 void PaintStroke(SkPaint* spaint, |
137 const CFX_GraphStateData* pGraphState, | 146 const CFX_GraphStateData* pGraphState, |
138 const SkMatrix& matrix); | 147 const SkMatrix& matrix); |
139 void Clear(uint32_t color); | 148 void Clear(uint32_t color); |
140 void Flush(); | 149 void Flush(); |
141 SkPictureRecorder* GetRecorder() const { return m_pRecorder; } | 150 SkPictureRecorder* GetRecorder() const { return m_pRecorder; } |
142 static void PreMultiply(CFX_DIBitmap* pDIBitmap); | 151 static void PreMultiply(CFX_DIBitmap* pDIBitmap); |
143 SkCanvas* SkiaCanvas() { return m_pCanvas; } | 152 SkCanvas* SkiaCanvas() { return m_pCanvas; } |
144 void DebugVerifyBitmapIsPreMultiplied() const; | 153 void DebugVerifyBitmapIsPreMultiplied() const; |
145 void Dump() const; | 154 void Dump() const; |
146 | 155 |
147 private: | 156 private: |
148 friend class SkiaState; | 157 friend class SkiaState; |
149 | 158 |
150 CFX_DIBitmap* m_pBitmap; | 159 CFX_DIBitmap* m_pBitmap; |
151 CFX_DIBitmap* m_pOriDevice; | 160 CFX_DIBitmap* m_pOriDevice; |
152 SkCanvas* m_pCanvas; | 161 SkCanvas* m_pCanvas; |
153 SkPictureRecorder* const m_pRecorder; | 162 SkPictureRecorder* const m_pRecorder; |
154 std::unique_ptr<SkiaState> m_pCache; | 163 std::unique_ptr<SkiaState> m_pCache; |
| 164 #ifndef _SKIA_SUPPORT_ |
| 165 std::unique_ptr<CFX_ClipRgn> m_pClipRgn; |
| 166 std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack; |
| 167 int m_FillFlags; |
| 168 bool m_bRgbByteOrder; |
| 169 #endif |
155 bool m_bGroupKnockout; | 170 bool m_bGroupKnockout; |
156 }; | 171 }; |
157 #endif // defined(_SKIA_SUPPORT_) | 172 #endif // defined(_SKIA_SUPPORT_) |
158 | 173 |
159 #endif // CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ | 174 #endif // CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_ |
OLD | NEW |