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