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_defaultrenderdevice.h
Go to the documentation of this file.
1// Copyright 2016 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_CFX_DEFAULTRENDERDEVICE_H_
8#define CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_
9
10#include <memory>
11
12#include "core/fxcrt/retain_ptr.h"
13#include "core/fxge/cfx_renderdevice.h"
14#include "core/fxge/dib/fx_dib.h"
15
16class SkCanvas;
17
18class CFX_DefaultRenderDevice final : public CFX_RenderDevice {
19 public:
22
23 bool Attach(RetainPtr<CFX_DIBitmap> pBitmap);
24 bool AttachWithRgbByteOrder(RetainPtr<CFX_DIBitmap> pBitmap,
25 bool bRgbByteOrder);
27 RetainPtr<CFX_DIBitmap> pBitmap,
28 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
29 bool bGroupKnockout);
30#if defined(PDF_USE_SKIA)
31 [[nodiscard]] bool AttachCanvas(SkCanvas& canvas);
32#endif
33
34 [[nodiscard]] bool Create(int width, int height, FXDIB_Format format);
35 [[nodiscard]] bool CreateWithBackdrop(int width,
36 int height,
37 FXDIB_Format format,
38 RetainPtr<CFX_DIBitmap> backdrop);
39
40 void Clear(uint32_t color);
41
42 // Runtime check to see if Skia is the renderer variant in use.
43 static bool UseSkiaRenderer();
44
45#if defined(PDF_USE_SKIA)
46 // This internal definition of renderer types must stay updated with respect
47 // to the public definition of `FPDF_RENDERER_TYPE`, so that all public
48 // definition values can be mapped to a value in
49 // `CFX_DefaultRenderDevice::RendererType`.
50 enum class RendererType {
51 kAgg = 0,
52 kSkia = 1,
53 };
54
55 // When Skia is enabled at compile time, this constant is assigned as the
56 // default value UseSkiaRenderer() returns. SetRendererType() may override it.
57 static constexpr RendererType kDefaultRenderer = RendererType::kSkia;
58
59 static void SetRendererType(RendererType renderer_type);
60#endif // defined(PDF_USE_SKIA)
61
62 private:
63 bool AttachImpl(RetainPtr<CFX_DIBitmap> pBitmap,
64 bool bRgbByteOrder,
65 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
66 bool bGroupKnockout);
67
68 bool AttachAggImpl(RetainPtr<CFX_DIBitmap> pBitmap,
69 bool bRgbByteOrder,
70 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
71 bool bGroupKnockout);
72
73 bool CreateAgg(int width,
74 int height,
75 FXDIB_Format format,
76 RetainPtr<CFX_DIBitmap> pBackdropBitmap);
77
78#if defined(PDF_USE_SKIA)
79 bool AttachSkiaImpl(RetainPtr<CFX_DIBitmap> pBitmap,
80 bool bRgbByteOrder,
81 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
82 bool bGroupKnockout);
83
84 bool CreateSkia(int width,
85 int height,
86 FXDIB_Format format,
87 RetainPtr<CFX_DIBitmap> pBackdropBitmap);
88#endif
89};
90
91#endif // CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_
bool Attach(RetainPtr< CFX_DIBitmap > pBitmap)
~CFX_DefaultRenderDevice() override
bool AttachWithBackdropAndGroupKnockout(RetainPtr< CFX_DIBitmap > pBitmap, RetainPtr< CFX_DIBitmap > pBackdropBitmap, bool bGroupKnockout)
bool AttachWithRgbByteOrder(RetainPtr< CFX_DIBitmap > pBitmap, bool bRgbByteOrder)
bool CreateWithBackdrop(int width, int height, FXDIB_Format format, RetainPtr< CFX_DIBitmap > backdrop)
bool Create(int width, int height, FXDIB_Format format)
void VerifySavedHelloWorldDocumentWithPassword(const char *password)
void VerifySavedModifiedHelloWorldDocumentWithPassword(const char *password)
void OpenAndVerifyHelloWorldDocumentWithPassword(const char *filename, const char *password)
RetainPtr< CPDF_Object > RemoveFor(ByteStringView key)
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
CPDF_Parser * GetParser() const
CPDF_Dictionary * GetMutableTrailerForTesting()
FPDF_DOCUMENT OpenSavedDocumentWithPassword(const char *password)
void CloseSavedDocument()
FPDF_PAGE LoadPage(int page_index)
static void CompareBitmap(FPDF_BITMAP bitmap, int expected_width, int expected_height, const char *expected_md5sum)
void UnloadPage(FPDF_PAGE page)
FPDF_DOCUMENT document() const
void CloseSavedPage(FPDF_PAGE page)
FPDF_PAGE LoadSavedPage(int page_index)
TEST_F(CPDFSecurityHandlerEmbedderTest, Unencrypted)
#define FPDF_FILLMODE_ALTERNATE
Definition fpdf_edit.h:52
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPath_SetDrawMode(FPDF_PAGEOBJECT path, int fillmode, FPDF_BOOL stroke)
FPDF_EXPORT void FPDF_CALLCONV FPDFPage_InsertObject(FPDF_PAGE page, FPDF_PAGEOBJECT page_object)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPageObj_SetFillColor(FPDF_PAGEOBJECT page_object, unsigned int R, unsigned int G, unsigned int B, unsigned int A)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPageObj_CreateNewRect(float x, float y, float w, float h)
FPDF_EXPORT FPDF_PAGEOBJECT FPDF_CALLCONV FPDFPage_GetObject(FPDF_PAGE page, int index)
FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_GenerateContent(FPDF_PAGE page)
FPDF_EXPORT FPDF_DOCUMENT FPDF_CALLCONV FPDF_LoadCustomDocument(FPDF_FILEACCESS *pFileAccess, FPDF_BYTESTRING password)
FXDIB_Format
Definition fx_dib.h:21
const char * HelloWorldChecksum()
const char * HelloWorldRemovedChecksum()