| 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 _FX_SKIA_DRIVER_ |
| 8 #define _FX_SKIA_DRIVER_ |
| 9 |
| 10 #include "fx_skia.h" |
| 11 |
| 12 class CFX_SkiaDriver : public IFX_RenderDeviceDriver |
| 13 { |
| 14 public: |
| 15 CFX_SkiaDriver(CFX_DIBitmap* pBitmap, int dither_bits, FX_BOOL bRgbByteOrder
, CFX_DIBitmap* pOriDevice, FX_BOOL bGroupKnockout); |
| 16 |
| 17 virtual ~CFX_SkiaDriver(); |
| 18 |
| 19 void InitPlatform(); |
| 20 |
| 21 void DestroyPlatform(); |
| 22 |
| 23 virtual int GetDeviceCaps(int caps_id); |
| 24 |
| 25 virtual void SaveState(); |
| 26 |
| 27 virtual void RestoreState(FX_BOOL bKeepSaved); |
| 28 |
| 29 virtual FX_BOOL SetClip_PathFill(const CFX_PathData* pPathData, |
| 30 const CFX_AffineMatrix* pObject2Device, |
| 31 int fill_mode |
| 32 ); |
| 33 |
| 34 virtual FX_BOOL SetClip_PathStroke(const CFX_PathData* pPathData, |
| 35 const CFX_AffineMatrix* pObject2Devic
e, |
| 36 const CFX_GraphStateData* pGraphState |
| 37 ); |
| 38 |
| 39 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, |
| 40 const CFX_AffineMatrix* pObject2Device, |
| 41 const CFX_GraphStateData* pGraphState, |
| 42 FX_DWORD fill_color, |
| 43 FX_DWORD stroke_color, |
| 44 int fill_mode, |
| 45 int alpha_flag, |
| 46 void* pIccTransform, |
| 47 int blend_type |
| 48 ); |
| 49 |
| 50 virtual FX_BOOL SetPixel(int x, int y, FX_DWORD color, |
| 51 int alpha_flag = 0, void* pIccTransform = NULL)
; |
| 52 |
| 53 virtual FX_BOOL FillRect(const FX_RECT* pRect, |
| 54 FX_DWORD fill_color, int alpha_flag, void* pIcc
Transform, int blend_type); |
| 55 |
| 56 virtual FX_BOOL DrawCosmeticLine(FX_FLOAT x1, FX_FLOAT y1, FX_FLOAT x2,
FX_FLOAT y2, FX_DWORD color, |
| 57 int alpha_flag, void* pIccTransform, in
t blend_type) |
| 58 { |
| 59 return FALSE; |
| 60 } |
| 61 |
| 62 virtual FX_BOOL GetClipBox(FX_RECT* pRect); |
| 63 |
| 64 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, void
* pIccTransform = NULL, FX_BOOL bDEdge = FALSE); |
| 65 |
| 66 virtual CFX_DIBitmap* GetBackDrop() |
| 67 { |
| 68 return m_pOriDevice; |
| 69 } |
| 70 |
| 71 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, FX_DWORD color,
const FX_RECT* pSrcRect, |
| 72 int dest_left, int dest_top, int blend_type, |
| 73 int alpha_flag = 0, void* pIccTransform = NULL
); |
| 74 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, FX_DWORD col
or, int dest_left, int dest_top, |
| 75 int dest_width, int dest_height, const FX_
RECT* pClipRect, FX_DWORD flags, |
| 76 int alpha_flag = 0 , void* pIccTransform =
NULL, int blend_type = FXDIB_BLEND_NORMAL); |
| 77 |
| 78 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, int bitmap_alp
ha, FX_DWORD color, |
| 79 const CFX_AffineMatrix* pMatrix, FX_DWORD fl
ags, FX_LPVOID& handle, |
| 80 int alpha_flag = 0, void* pIccTransform = NU
LL, int blend_type = FXDIB_BLEND_NORMAL); |
| 81 |
| 82 virtual FX_BOOL ContinueDIBits(FX_LPVOID handle, IFX_Pause* pPause); |
| 83 |
| 84 virtual void CancelDIBits(FX_LPVOID handle); |
| 85 |
| 86 virtual FX_BOOL DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPo
s, CFX_Font* pFont, |
| 87 CFX_FontCache* pCache, const CFX_AffineMa
trix* pObject2Device, FX_FLOAT font_size, FX_DWORD color, |
| 88 int alpha_flag = 0, void* pIccTransform =
NULL); |
| 89 |
| 90 virtual FX_BOOL RenderRasterizerSkia(SkPath& skPath, const SkPaint& orig
Paint, SkIRect& rect, FX_DWORD color, FX_BOOL bFullCover, FX_BOOL bGroupKnockout
, |
| 91 int alpha_flag, void* pIccTransform, FX_BOOL bFill = TRUE); |
| 92 |
| 93 void SetClipMask(SkPath& skPath, SkPaint* spaint); |
| 94 |
| 95 virtual FX_LPBYTE GetBuffer() const |
| 96 { |
| 97 return m_pBitmap->GetBuffer(); |
| 98 } |
| 99 |
| 100 private: |
| 101 CFX_DIBitmap* m_pBitmap; |
| 102 CFX_ClipRgn* m_pClipRgn; |
| 103 CFX_PtrArray m_StateStack; |
| 104 void* m_pPlatformGraphics; |
| 105 void* m_pPlatformBitmap; |
| 106 void* m_pDwRenderTartget; |
| 107 int m_FillFlags; |
| 108 int m_DitherBits; |
| 109 FX_BOOL m_bRgbByteOrder; |
| 110 CFX_DIBitmap* m_pOriDevice; |
| 111 FX_BOOL m_bGroupKnockout; |
| 112 }; |
| 113 |
| 114 class SuperBlitter_skia |
| 115 { |
| 116 public: |
| 117 static void DrawPath(const SkPath& srcPath, SkBlitter* blitter, const SkRast
erClip& rect, const SkPaint& origPaint); |
| 118 }; |
| 119 |
| 120 class CSkia_PathData : public CFX_Object |
| 121 { |
| 122 public: |
| 123 CSkia_PathData() {} |
| 124 ~CSkia_PathData() {} |
| 125 SkPath m_PathData; |
| 126 void BuildPath(const CFX_PathData* pPathData, const C
FX_AffineMatrix* pObject2Device); |
| 127 }; |
| 128 |
| 129 #endif |
| 130 |
| 131 FX_BOOL FxSkDrawTreatAsHairline(const SkPaint& paint, SkScalar* coverage); |
| 132 |
| 133 static void SkRasterizeStroke(SkPaint& spaint, SkPath* dstPathData, SkPath& path
_data, |
| 134 const CFX_AffineMatrix* pObject2Device, |
| 135 const CFX_GraphStateData* pGraphState, FX_FLOAT scale = 1.0f, |
| 136 FX_BOOL bStrokeAdjust = FALSE, FX_BOOL bTextMode = FALSE); |
| 137 |
| 138 void RgbByteOrderSetPixel(CFX_DIBitmap* pBitmap, int x, int y, FX_DWORD argb); |
| 139 |
| 140 FX_ARGB _DefaultCMYK2ARGB(FX_CMYK cmyk, FX_BYTE alpha); |
| 141 |
| 142 FX_BOOL _DibSetPixel(CFX_DIBitmap* pDevice, int x, int y, FX_DWORD color, int al
pha_flag, void* pIccTransform); |
| 143 |
| 144 void RgbByteOrderCompositeRect(CFX_DIBitmap* pBitmap, int left, int top, int wid
th, int height, FX_ARGB argb); |
| 145 |
| 146 void RgbByteOrderTransferBitmap(CFX_DIBitmap* pBitmap, int dest_left, int dest_t
op, int width, int height, |
| 147 const CFX_DIBSource* pSrcBitmap, int src_left, int src_top); |
| OLD | NEW |