| 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 #ifndef CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | |
| 6 #define CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | |
| 7 | |
| 8 #if defined(_SKIA_SUPPORT_) | |
| 9 | |
| 10 class SkCanvas; | |
| 11 class SkPaint; | |
| 12 class SkPath; | |
| 13 struct SkIRect; | |
| 14 | |
| 15 class CFX_SkiaDeviceDriver : public IFX_RenderDeviceDriver { | |
| 16 public: | |
| 17 CFX_SkiaDeviceDriver(CFX_DIBitmap* pBitmap, | |
| 18 int dither_bits, | |
| 19 FX_BOOL bRgbByteOrder, | |
| 20 CFX_DIBitmap* pOriDevice, | |
| 21 FX_BOOL bGroupKnockout); | |
| 22 ~CFX_SkiaDeviceDriver() override; | |
| 23 | |
| 24 /** Options */ | |
| 25 virtual int GetDeviceCaps(int caps_id); | |
| 26 | |
| 27 /** Save and restore all graphic states */ | |
| 28 virtual void SaveState(); | |
| 29 virtual void RestoreState(FX_BOOL bKeepSaved); | |
| 30 | |
| 31 /** Set clipping path using filled region */ | |
| 32 virtual FX_BOOL SetClip_PathFill( | |
| 33 const CFX_PathData* pPathData, // path info | |
| 34 const CFX_Matrix* pObject2Device, // optional transformation | |
| 35 int fill_mode); // fill mode, WINDING or ALTERNATE | |
| 36 | |
| 37 /** Set clipping path using stroked region */ | |
| 38 virtual FX_BOOL SetClip_PathStroke( | |
| 39 const CFX_PathData* pPathData, // path info | |
| 40 const CFX_Matrix* pObject2Device, // optional transformation | |
| 41 const CFX_GraphStateData* | |
| 42 pGraphState); // graphic state, for pen attributes | |
| 43 | |
| 44 /** Draw a path */ | |
| 45 virtual FX_BOOL DrawPath(const CFX_PathData* pPathData, | |
| 46 const CFX_Matrix* pObject2Device, | |
| 47 const CFX_GraphStateData* pGraphState, | |
| 48 FX_DWORD fill_color, | |
| 49 FX_DWORD stroke_color, | |
| 50 int fill_mode, | |
| 51 int alpha_flag = 0, | |
| 52 void* pIccTransform = NULL, | |
| 53 int blend_type = FXDIB_BLEND_NORMAL); | |
| 54 | |
| 55 virtual FX_BOOL SetPixel(int x, | |
| 56 int y, | |
| 57 FX_DWORD color, | |
| 58 int alpha_flag = 0, | |
| 59 void* pIccTransform = NULL); | |
| 60 | |
| 61 virtual FX_BOOL FillRect(const FX_RECT* pRect, | |
| 62 FX_DWORD fill_color, | |
| 63 int alpha_flag = 0, | |
| 64 void* pIccTransform = NULL, | |
| 65 int blend_type = FXDIB_BLEND_NORMAL); | |
| 66 | |
| 67 /** Draw a single pixel (device dependant) line */ | |
| 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 = 0, | |
| 74 void* pIccTransform = NULL, | |
| 75 int blend_type = FXDIB_BLEND_NORMAL) { | |
| 76 return FALSE; | |
| 77 } | |
| 78 | |
| 79 virtual FX_BOOL GetClipBox(FX_RECT* pRect); | |
| 80 | |
| 81 /** Load device buffer into a DIB */ | |
| 82 virtual FX_BOOL GetDIBits(CFX_DIBitmap* pBitmap, | |
| 83 int left, | |
| 84 int top, | |
| 85 void* pIccTransform = NULL, | |
| 86 FX_BOOL bDEdge = FALSE); | |
| 87 | |
| 88 virtual CFX_DIBitmap* GetBackDrop() { return m_pAggDriver->GetBackDrop(); } | |
| 89 | |
| 90 virtual FX_BOOL SetDIBits(const CFX_DIBSource* pBitmap, | |
| 91 FX_DWORD color, | |
| 92 const FX_RECT* pSrcRect, | |
| 93 int dest_left, | |
| 94 int dest_top, | |
| 95 int blend_type, | |
| 96 int alpha_flag = 0, | |
| 97 void* pIccTransform = NULL); | |
| 98 virtual FX_BOOL StretchDIBits(const CFX_DIBSource* pBitmap, | |
| 99 FX_DWORD color, | |
| 100 int dest_left, | |
| 101 int dest_top, | |
| 102 int dest_width, | |
| 103 int dest_height, | |
| 104 const FX_RECT* pClipRect, | |
| 105 FX_DWORD flags, | |
| 106 int alpha_flag = 0, | |
| 107 void* pIccTransform = NULL, | |
| 108 int blend_type = FXDIB_BLEND_NORMAL); | |
| 109 | |
| 110 virtual FX_BOOL StartDIBits(const CFX_DIBSource* pBitmap, | |
| 111 int bitmap_alpha, | |
| 112 FX_DWORD color, | |
| 113 const CFX_Matrix* pMatrix, | |
| 114 FX_DWORD flags, | |
| 115 void*& handle, | |
| 116 int alpha_flag = 0, | |
| 117 void* pIccTransform = NULL, | |
| 118 int blend_type = FXDIB_BLEND_NORMAL); | |
| 119 virtual FX_BOOL ContinueDIBits(void* handle, IFX_Pause* pPause); | |
| 120 virtual void CancelDIBits(void* handle); | |
| 121 | |
| 122 virtual FX_BOOL DrawDeviceText(int nChars, | |
| 123 const FXTEXT_CHARPOS* pCharPos, | |
| 124 CFX_Font* pFont, | |
| 125 CFX_FontCache* pCache, | |
| 126 const CFX_Matrix* pObject2Device, | |
| 127 FX_FLOAT font_size, | |
| 128 FX_DWORD color, | |
| 129 int alpha_flag = 0, | |
| 130 void* pIccTransform = NULL); | |
| 131 | |
| 132 virtual FX_BOOL RenderRasterizer(agg::rasterizer_scanline_aa& rasterizer, | |
| 133 FX_DWORD color, | |
| 134 FX_BOOL bFullCover, | |
| 135 FX_BOOL bGroupKnockout, | |
| 136 int alpha_flag, | |
| 137 void* pIccTransform); | |
| 138 void SetClipMask(agg::rasterizer_scanline_aa& rasterizer); | |
| 139 void SetClipMask(SkPath& skPath, SkPaint* spaint); | |
| 140 virtual uint8_t* GetBuffer() const { return m_pAggDriver->GetBuffer(); } | |
| 141 void PaintStroke(SkPaint* spaint, const CFX_GraphStateData* pGraphState); | |
| 142 | |
| 143 private: | |
| 144 CFX_AggDeviceDriver* m_pAggDriver; | |
| 145 SkCanvas* m_canvas; | |
| 146 }; | |
| 147 #endif // defined(_SKIA_SUPPORT_) | |
| 148 | |
| 149 #endif // CORE_SRC_FXGE_SKIA_FX_SKIA_DEVICE_H_ | |
| OLD | NEW |