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