5#ifndef CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_
6#define CORE_FXGE_SKIA_FX_SKIA_DEVICE_H_
12#include "core/fxcrt/data_vector.h"
13#include "core/fxcrt/fx_memory_wrappers.h"
14#include "core/fxcrt/retain_ptr.h"
15#include "core/fxcrt/unowned_ptr.h"
16#include "core/fxge/cfx_fillrenderoptions.h"
17#include "core/fxge/cfx_path.h"
18#include "core/fxge/renderdevicedriver_iface.h"
19#include "third_party/base/check_op.h"
20#include "third_party/base/containers/span.h"
21#include "third_party/skia/include/core/SkPoint.h"
22#include "third_party/skia/include/core/SkRSXform.h"
23#include "third_party/skia/include/core/SkRefCnt.h"
75 uint32_t stroke_color,
85 const CFX_PointF& ptLineTo,
128 std::unique_ptr<CFX_ImageRenderer>* handle,
149 bool DrawShading(
const CPDF_ShadingPattern* pPattern,
153 bool bAlphaMode)
override;
158 void Clear(uint32_t color);
167 const DataVector<SkPoint>& GetPositions()
const {
return m_positions; }
168 void SetPositionAt(size_t index,
const SkPoint& position) {
169 m_positions[index] = position;
171 const DataVector<uint16_t>& GetGlyphs()
const {
return m_glyphs; }
172 void SetGlyphAt(size_t index, uint16_t glyph) { m_glyphs[index] = glyph; }
173 const DataVector<uint32_t>& GetFontCharWidths()
const {
174 return m_fontCharWidths;
176 void SetFontCharWidthAt(size_t index, uint32_t width) {
177 m_fontCharWidths[index] = width;
179 size_t Count()
const {
180 DCHECK_EQ(m_positions.size(), m_glyphs.size());
181 return m_glyphs.size();
183 void SetCount(size_t count) {
184 m_positions.resize(count);
185 m_glyphs.resize(count);
186 m_fontCharWidths.resize(count);
190 DataVector<SkPoint> m_positions;
191 DataVector<uint16_t> m_glyphs;
193 DataVector<uint32_t> m_fontCharWidths;
197 CFX_SkiaDeviceDriver(
RetainPtr<CFX_DIBitmap> pBitmap,
200 bool bGroupKnockout);
201 explicit CFX_SkiaDeviceDriver(SkCanvas* canvas);
203 bool TryDrawText(pdfium::span<
const TextCharPos> char_pos,
219 RetainPtr<CFX_DIBitmap> m_pBackdropBitmap;
223 RetainPtr<CFX_DIBitmap> m_pOriginalBitmap;
225 sk_sp<SkSurface> surface_;
228 bool m_bRgbByteOrder;
229 bool m_bGroupKnockout;
231 CharDetail m_charDetails;
233 DataVector<SkRSXform> m_rsxform;
uint32_t GetBits(uint32_t nBits)
uint32_t GetPitch() const
constexpr CFX_FloatRect(float l, float b, float r, float t)
void Intersect(const CFX_FloatRect &other_rect)
FX_RECT GetOuterRect() const
int GetSubstFontItalicAngle() const
FXFT_FaceRec * GetFaceRec() const
static CFX_Matrix GetFlipMatrix(float width, float height, float left, float top)
void SetBitmap(RetainPtr< CFX_DIBitmap > bitmap)
~CFX_SkiaDeviceDriver() override
bool GetClipBox(FX_RECT *pRect) override
bool DrawBitsWithMask(RetainPtr< const CFX_DIBBase > bitmap, RetainPtr< const CFX_DIBBase > mask, float alpha, const CFX_Matrix &matrix, BlendMode blend_type)
bool StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t color, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_type) override
bool DrawDeviceText(pdfium::span< const TextCharPos > pCharPos, CFX_Font *pFont, const CFX_Matrix &mtObject2Device, float font_size, uint32_t color, const CFX_TextRenderOptions &options) override
bool MultiplyAlpha(float alpha) override
void SetGroupKnockout(bool group_knockout) override
DeviceType GetDeviceType() const override
RetainPtr< CFX_DIBitmap > GetBackDrop() override
bool FillRectWithBlend(const FX_RECT &rect, uint32_t fill_color, BlendMode blend_type) override
bool SyncInternalBitmaps() override
void SaveState() override
bool SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options) override
bool ContinueDIBits(CFX_ImageRenderer *handle, PauseIndicatorIface *pPause) override
bool GetDIBits(const RetainPtr< CFX_DIBitmap > &pBitmap, int left, int top) override
static std::unique_ptr< CFX_SkiaDeviceDriver > Create(RetainPtr< CFX_DIBitmap > pBitmap, bool bRgbByteOrder, RetainPtr< CFX_DIBitmap > pBackdropBitmap, bool bGroupKnockout)
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t color, const FX_RECT &src_rect, int dest_left, int dest_top, BlendMode blend_type) override
bool MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask) override
static std::unique_ptr< CFX_SkiaDeviceDriver > Create(SkCanvas *canvas)
int GetDriverType() const override
int GetDeviceCaps(int caps_id) const override
bool DrawCosmeticLine(const CFX_PointF &ptMoveTo, const CFX_PointF &ptLineTo, uint32_t color, BlendMode blend_type) override
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t color, int dest_left, int dest_top, int dest_width, int dest_height, const FX_RECT *pClipRect, const FXDIB_ResampleOptions &options, BlendMode blend_type) override
bool DrawShading(const CPDF_ShadingPattern *pPattern, const CFX_Matrix *pMatrix, const FX_RECT &clip_rect, int alpha, bool bAlphaMode) override
void RestoreState(bool bKeepSaved) override
bool DrawPath(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState, uint32_t fill_color, uint32_t stroke_color, const CFX_FillRenderOptions &fill_options, BlendMode blend_type) override
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState) override
bool SetBitsWithMask(RetainPtr< const CFX_DIBBase > bitmap, RetainPtr< const CFX_DIBBase > mask, int dest_left, int dest_top, float alpha, BlendMode blend_type) override
void Clear(uint32_t color)
float GetExponent() const
uint32_t GetOrigOutputs() const
float GetRange(int i) const
uint32_t CountOutputs() const
float GetDomain(int i) const
uint32_t CountInputs() const
std::tuple< float, float, float > ReadColor()
uint32_t GetBitsPerSample() const
ShadingType GetShadingType() const
static bool UseInterpolateBilinear(const FXDIB_ResampleOptions &options, int dest_width, int dest_height, int src_width, int src_height)
#define FX_DATA_PARTITION_EXCEPTION(T)
#define FXRC_FILLSTROKE_PATH
#define FXRC_ALPHA_OUTPUT
#define FXDC_PIXEL_HEIGHT
constexpr CFX_FillRenderOptions()
AliasingType aliasing_type
bool bInterpolateBilinear