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
cfx_agg_devicedriver.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_CFX_AGG_DEVICEDRIVER_H_
8#define CORE_FXGE_AGG_CFX_AGG_DEVICEDRIVER_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_AggClipRgn;
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) override;
61 bool FillRect(const FX_RECT& rect, uint32_t fill_color) override;
62 FX_RECT GetClipBox() const override;
63 bool GetDIBits(RetainPtr<CFX_DIBitmap> bitmap,
64 int left,
65 int top) const override;
66 RetainPtr<const CFX_DIBitmap> GetBackDrop() const override;
67 bool SetDIBits(RetainPtr<const CFX_DIBBase> bitmap,
68 uint32_t argb,
69 const FX_RECT& src_rect,
70 int left,
71 int top,
72 BlendMode blend_type) override;
73 bool StretchDIBits(RetainPtr<const CFX_DIBBase> bitmap,
74 uint32_t argb,
75 int dest_left,
76 int dest_top,
77 int dest_width,
78 int dest_height,
79 const FX_RECT* pClipRect,
80 const FXDIB_ResampleOptions& options,
81 BlendMode blend_type) override;
83 float alpha,
84 uint32_t argb,
85 const CFX_Matrix& matrix,
86 const FXDIB_ResampleOptions& options,
87 BlendMode blend_type) override;
89 PauseIndicatorIface* pPause) override;
90 bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
91 CFX_Font* pFont,
92 const CFX_Matrix& mtObject2Device,
93 float font_size,
94 uint32_t color,
95 const CFX_TextRenderOptions& options) override;
96 int GetDriverType() const override;
97 bool MultiplyAlpha(float alpha) override;
98 bool MultiplyAlphaMask(RetainPtr<const CFX_DIBitmap> mask) override;
99
100 void Clear(uint32_t color);
101
102 private:
103 void RenderRasterizer(pdfium::agg::rasterizer_scanline_aa& rasterizer,
104 uint32_t color,
105 bool bFullCover,
106 bool bGroupKnockout);
107
108 void SetClipMask(pdfium::agg::rasterizer_scanline_aa& rasterizer);
109
110 RetainPtr<CFX_DIBitmap> const m_pBitmap;
111 std::unique_ptr<CFX_AggClipRgn> m_pClipRgn;
112 std::vector<std::unique_ptr<CFX_AggClipRgn>> m_StateStack;
113#if BUILDFLAG(IS_APPLE)
114 UNOWNED_PTR_EXCLUSION void* m_pPlatformGraphics = nullptr;
115#endif
116 CFX_FillRenderOptions m_FillOptions;
117 const bool m_bRgbByteOrder;
118 const bool m_bGroupKnockout;
119 RetainPtr<CFX_DIBitmap> m_pBackdropBitmap;
120};
121
122} // namespace pdfium
123
124#endif // CORE_FXGE_AGG_CFX_AGG_DEVICEDRIVER_H_
#define DCHECK
Definition check.h:33
#define CHECK_EQ(x, y)
Definition check_op.h:10
#define CHECK_NE(x, y)
Definition check_op.h:11
const FX_RECT & GetBox() const
ClipType GetType() const
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 operator*(const CFX_Matrix &right) const
CFX_PointF Transform(const CFX_PointF &point) const
float GetXUnit() const
CFX_Matrix GetInverse() const
float GetYUnit() const
constexpr CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
void SetBitmap(RetainPtr< CFX_DIBitmap > bitmap)
CFX_AggDeviceDriver(RetainPtr< CFX_DIBitmap > pBitmap, bool bRgbByteOrder, RetainPtr< CFX_DIBitmap > pBackdropBitmap, bool bGroupKnockout)
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 SetDIBits(RetainPtr< const CFX_DIBBase > bitmap, uint32_t argb, const FX_RECT &src_rect, int left, int top, BlendMode blend_type) override
int GetDeviceCaps(int caps_id) const override
bool GetDIBits(RetainPtr< CFX_DIBitmap > bitmap, int left, int top) const override
StartResult StartDIBits(RetainPtr< const CFX_DIBBase > bitmap, float alpha, uint32_t argb, const CFX_Matrix &matrix, const FXDIB_ResampleOptions &options, BlendMode blend_type) override
bool MultiplyAlphaMask(RetainPtr< const CFX_DIBitmap > mask) override
FX_RECT GetClipBox() const override
bool SetClip_PathStroke(const CFX_Path &path, const CFX_Matrix *pObject2Device, const CFX_GraphStateData *pGraphState) override
bool MultiplyAlpha(float alpha) override
DeviceType GetDeviceType() const override
bool FillRect(const FX_RECT &rect, uint32_t fill_color) 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
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) override
bool ContinueDIBits(CFX_AggImageRenderer *handle, PauseIndicatorIface *pPause) override
RetainPtr< const CFX_DIBitmap > GetBackDrop() const override
#define UNSAFE_TODO(...)
CFX_PTemplate< float > CFX_PointF
uint32_t FX_ARGB
Definition fx_dib.h:36
BlendMode
Definition fx_dib.h:119
#define FXRGB2GRAY(r, g, b)
Definition fx_dib.h:203
#define FXARGB_B(argb)
Definition fx_dib.h:199
#define FXARGB_G(argb)
Definition fx_dib.h:198
#define FXARGB_A(argb)
Definition fx_dib.h:196
#define FXARGB_TOBGRORDERDIB(argb)
Definition fx_dib.h:210
#define FXARGB_R(argb)
Definition fx_dib.h:197
FXDIB_Format
Definition fx_dib.h:21
#define FXDIB_ALPHA_MERGE(backdrop, source, source_alpha)
Definition fx_dib.h:204
#define NOTREACHED_NORETURN()
Definition notreached.h:22
#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