Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
fx_agg_driver.h
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
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 CORE_FXGE_AGG_FX_AGG_DRIVER_H_
8#define CORE_FXGE_AGG_FX_AGG_DRIVER_H_
9
10#include <memory>
11#include <vector>
12
13#include "build/build_config.h"
14#include "core/fxcrt/retain_ptr.h"
15#include "core/fxge/cfx_fillrenderoptions.h"
16#include "core/fxge/renderdevicedriver_iface.h"
17
18#if BUILDFLAG(IS_APPLE)
19#include "core/fxcrt/unowned_ptr_exclusion.h"
20#endif
21
22class CFX_ClipRgn;
24class CFX_Matrix;
25class CFX_Path;
26
27namespace pdfium {
28
29namespace agg {
30class rasterizer_scanline_aa;
31} // namespace agg
32
33class CFX_AggDeviceDriver final : public RenderDeviceDriverIface {
34 public:
35 CFX_AggDeviceDriver(RetainPtr<CFX_DIBitmap> pBitmap,
36 bool bRgbByteOrder,
37 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
38 bool bGroupKnockout);
39 ~CFX_AggDeviceDriver() override;
40
41 void InitPlatform();
42 void DestroyPlatform();
43
44 // RenderDeviceDriverIface:
45 DeviceType GetDeviceType() const override;
46 int GetDeviceCaps(int caps_id) const override;
47 void SaveState() override;
48 void RestoreState(bool bKeepSaved) override;
49 bool SetClip_PathFill(const CFX_Path& path,
50 const CFX_Matrix* pObject2Device,
51 const CFX_FillRenderOptions& fill_options) override;
52 bool SetClip_PathStroke(const CFX_Path& path,
53 const CFX_Matrix* pObject2Device,
54 const CFX_GraphStateData* pGraphState) override;
55 bool DrawPath(const CFX_Path& path,
56 const CFX_Matrix* pObject2Device,
57 const CFX_GraphStateData* pGraphState,
58 uint32_t fill_color,
59 uint32_t stroke_color,
60 const CFX_FillRenderOptions& fill_options,
61 BlendMode blend_type) override;
62 bool FillRectWithBlend(const FX_RECT& rect,
63 uint32_t fill_color,
64 BlendMode blend_type) override;
65 bool GetClipBox(FX_RECT* pRect) override;
66 bool GetDIBits(const RetainPtr<CFX_DIBitmap>& pBitmap,
67 int left,
68 int top) override;
69 RetainPtr<CFX_DIBitmap> GetBackDrop() override;
70 bool SetDIBits(const RetainPtr<const CFX_DIBBase>& pBitmap,
71 uint32_t argb,
72 const FX_RECT& src_rect,
73 int left,
74 int top,
75 BlendMode blend_type) override;
76 bool StretchDIBits(RetainPtr<const CFX_DIBBase> bitmap,
77 uint32_t argb,
78 int dest_left,
79 int dest_top,
80 int dest_width,
81 int dest_height,
82 const FX_RECT* pClipRect,
83 const FXDIB_ResampleOptions& options,
84 BlendMode blend_type) override;
85 bool StartDIBits(RetainPtr<const CFX_DIBBase> bitmap,
86 float alpha,
87 uint32_t argb,
88 const CFX_Matrix& matrix,
89 const FXDIB_ResampleOptions& options,
90 std::unique_ptr<CFX_ImageRenderer>* handle,
91 BlendMode blend_type) override;
93 PauseIndicatorIface* pPause) override;
94 bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
95 CFX_Font* pFont,
96 const CFX_Matrix& mtObject2Device,
97 float font_size,
98 uint32_t color,
99 const CFX_TextRenderOptions& options) override;
100 int GetDriverType() const override;
101 bool MultiplyAlpha(float alpha) override;
102 bool MultiplyAlphaMask(const RetainPtr<const CFX_DIBBase>& mask) override;
103
104 void Clear(uint32_t color);
105
106 private:
107 void RenderRasterizer(pdfium::agg::rasterizer_scanline_aa& rasterizer,
108 uint32_t color,
109 bool bFullCover,
110 bool bGroupKnockout);
111
112 void SetClipMask(pdfium::agg::rasterizer_scanline_aa& rasterizer);
113
114 RetainPtr<CFX_DIBitmap> const m_pBitmap;
115 std::unique_ptr<CFX_ClipRgn> m_pClipRgn;
116 std::vector<std::unique_ptr<CFX_ClipRgn>> m_StateStack;
117#if BUILDFLAG(IS_APPLE)
118 UNOWNED_PTR_EXCLUSION void* m_pPlatformGraphics = nullptr;
119#endif
120 CFX_FillRenderOptions m_FillOptions;
121 const bool m_bRgbByteOrder;
122 const bool m_bGroupKnockout;
123 RetainPtr<CFX_DIBitmap> m_pBackdropBitmap;
124};
125
126} // namespace pdfium
127
128#endif // CORE_FXGE_AGG_FX_AGG_DRIVER_H_
ClipType GetType() const
Definition cfx_cliprgn.h:23
const FX_RECT & GetBox() const
Definition cfx_cliprgn.h:24
constexpr CFX_FloatRect(float l, float b, float r, float t)
void Intersect(const CFX_FloatRect &other_rect)
FX_RECT GetOuterRect() const
bool Continue(PauseIndicatorIface *pPause)
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
CFX_Matrix operator*(const CFX_Matrix &right) const
CFX_PointF Transform(const CFX_PointF &point) const
float GetXUnit() const
CFX_Matrix GetInverse() const
float GetYUnit() const
void SetBitmap(RetainPtr< CFX_DIBitmap > bitmap)
bool FillRectWithBlend(const FX_RECT &rect, uint32_t fill_color, BlendMode blend_type) override
CFX_AggDeviceDriver(RetainPtr< CFX_DIBitmap > pBitmap, bool bRgbByteOrder, RetainPtr< CFX_DIBitmap > pBackdropBitmap, bool bGroupKnockout)
bool ContinueDIBits(CFX_ImageRenderer *handle, PauseIndicatorIface *pPause) 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
void RestoreState(bool bKeepSaved) override
bool StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t argb, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, std::unique_ptr< CFX_ImageRenderer > *handle, BlendMode blend_type) override
bool GetClipBox(FX_RECT *pRect) override
int GetDeviceCaps(int caps_id) const override
bool GetDIBits(const RetainPtr< CFX_DIBitmap > &pBitmap, int left, int top) override
RetainPtr< CFX_DIBitmap > GetBackDrop() override
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState) override
int GetDriverType() const override
bool MultiplyAlpha(float alpha) override
DeviceType GetDeviceType() const 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 MultiplyAlphaMask(const RetainPtr< const CFX_DIBBase > &mask) override
bool SetDIBits(const RetainPtr< const CFX_DIBBase > &pBitmap, uint32_t argb, const FX_RECT &src_rect, int left, int top, BlendMode blend_type) override
bool StretchDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t argb, 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 SetClip_PathFill(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_FillRenderOptions &fill_options) override
BlendMode
Definition fx_dib.h:49
#define FXRGB2GRAY(r, g, b)
Definition fx_dib.h:131
#define FXARGB_B(argb)
Definition fx_dib.h:127
#define FXARGB_G(argb)
Definition fx_dib.h:126
#define FXARGB_SETRGBORDERDIB(p, argb)
Definition fx_dib.h:142
#define FXARGB_A(argb)
Definition fx_dib.h:124
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
#define FXARGB_TOBGRORDERDIB(argb)
Definition fx_dib.h:150
#define FXARGB_SETDIB(p, argb)
Definition fx_dib.h:137
#define FXARGB_R(argb)
Definition fx_dib.h:125
FXDIB_Format
Definition fx_dib.h:19
#define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha)
Definition fx_dib.h:132
#define CHECK(cvref)
#define FXDC_BITS_PIXEL
#define FXDC_RENDER_CAPS
#define FXDC_PIXEL_WIDTH
#define FXRC_ALPHA_OUTPUT
#define FXDC_VERT_SIZE
#define FXDC_PIXEL_HEIGHT
#define FXDC_HORZ_SIZE
#define FXRC_ALPHA_PATH
#define FXRC_BLEND_MODE
#define FXRC_ALPHA_IMAGE
#define FXRC_GET_BITS
#define FXRC_BYTEMASK_OUTPUT
#define FXRC_SOFT_CLIP
void Offset(int dx, int dy)
int Height() const
int32_t bottom
int32_t right
int Width() const
void Normalize()
int32_t top
int32_t left
void Intersect(const FX_RECT &src)
bool IsEmpty() const
constexpr FX_RECT(int l, int t, int r, int b)
#define UNOWNED_PTR_EXCLUSION