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 bool Create(int width,
31 int height,
32 FXDIB_Format format,
33 RetainPtr<CFX_DIBitmap> pBackdropBitmap);
34 void Clear(uint32_t color);
35
36#if defined(PDF_USE_SKIA)
37 bool AttachCanvas(SkCanvas* canvas);
38#endif
39
40 // Runtime check to see if Skia is the renderer variant in use.
41 static bool UseSkiaRenderer();
42
43#if defined(PDF_USE_SKIA)
44 // This internal definition of renderer types must stay updated with respect
45 // to the public definition of `FPDF_RENDERER_TYPE`, so that all public
46 // definition values can be mapped to a value in
47 // `CFX_DefaultRenderDevice::RendererType`.
48 enum class RendererType {
49 kAgg = 0,
50 kSkia = 1,
51 };
52
53 // When Skia is enabled at compile time, this constant is assigned as the
54 // default value UseSkiaRenderer() returns. SetRendererType() may override it.
55 static constexpr RendererType kDefaultRenderer = RendererType::kSkia;
56
57 static void SetRendererType(RendererType renderer_type);
58#endif // defined(PDF_USE_SKIA)
59
60 private:
61 bool AttachImpl(RetainPtr<CFX_DIBitmap> pBitmap,
62 bool bRgbByteOrder,
63 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
64 bool bGroupKnockout);
65
66 bool AttachAggImpl(RetainPtr<CFX_DIBitmap> pBitmap,
67 bool bRgbByteOrder,
68 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
69 bool bGroupKnockout);
70
71 bool CreateAgg(int width,
72 int height,
73 FXDIB_Format format,
74 RetainPtr<CFX_DIBitmap> pBackdropBitmap);
75
76#if defined(PDF_USE_SKIA)
77 bool AttachSkiaImpl(RetainPtr<CFX_DIBitmap> pBitmap,
78 bool bRgbByteOrder,
79 RetainPtr<CFX_DIBitmap> pBackdropBitmap,
80 bool bGroupKnockout);
81
82 bool CreateSkia(int width,
83 int height,
84 FXDIB_Format format,
85 RetainPtr<CFX_DIBitmap> pBackdropBitmap);
86#endif
87};
88
89#endif // CORE_FXGE_CFX_DEFAULTRENDERDEVICE_H_
bool Create(int width, int height, FXDIB_Format format, RetainPtr< CFX_DIBitmap > pBackdropBitmap)
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)
void VerifySavedHelloWorldDocumentWithPassword(const char *password)
void VerifySavedModifiedHelloWorldDocumentWithPassword(const char *password)
void OpenAndVerifyHelloWorldDocumentWithPassword(const char *filename, const char *password)
RetainPtr< CPDF_Object > RemoveFor(ByteStringView key)
CPDF_Parser * GetParser() const
CPDF_Dictionary * GetMutableTrailerForTesting()
FPDF_DOCUMENT OpenSavedDocumentWithPassword(const char *password)
void CloseSavedDocument()
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 LoadPage(int page_number)
FPDF_PAGE LoadSavedPage(int page_number)
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_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:19
const char * HelloWorldChecksum()
const char * HelloWorldRemovedChecksum()