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
cpdf_renderoptions.cpp
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#include "core/fpdfapi/render/cpdf_renderoptions.h"
8
9namespace {
10
11constexpr uint32_t kCacheSizeLimitBytes = 100 * 1024 * 1024;
12
13} // namespace
14
16
18 default;
19
21 const CPDF_RenderOptions::Options& rhs) = default;
22
24 // TODO(thestig): Make constexpr to initialize |m_Options| once C++14 is
25 // available.
26 m_Options.bClearType = true;
27}
28
30
32
33FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const {
35 return argb;
37 return argb;
38
39 int a;
40 int r;
41 int g;
42 int b;
43 std::tie(a, r, g, b) = ArgbDecode(argb);
44 int gray = FXRGB2GRAY(r, g, b);
45 return ArgbEncode(a, gray, gray, gray);
46}
47
49 FX_ARGB argb,
50 CPDF_PageObject::Type object_type) const {
52 return TranslateColor(argb);
53 }
54 switch (object_type) {
56 return m_ColorScheme.path_fill_color;
58 return m_ColorScheme.text_fill_color;
59 default:
60 return argb;
61 }
62}
63
65 FX_ARGB argb,
66 CPDF_PageObject::Type object_type) const {
68 return TranslateColor(argb);
69 }
70 switch (object_type) {
72 return m_ColorScheme.path_stroke_color;
74 return m_ColorScheme.text_stroke_color;
75 default:
76 return argb;
77 }
78}
79
81 return kCacheSizeLimitBytes;
82}
83
84bool CPDF_RenderOptions::CheckOCGDictVisible(const CPDF_Dictionary* pOC) const {
85 return !m_pOCContext || m_pOCContext->CheckOCGDictVisible(pOC);
86}
87
89 const CPDF_PageObject* pPageObj) const {
90 return !m_pOCContext || m_pOCContext->CheckPageObjectVisible(pPageObj);
91}
FX_ARGB TranslateColor(FX_ARGB argb) const
uint32_t GetCacheSizeLimit() const
bool CheckPageObjectVisible(const CPDF_PageObject *pPageObj) const
bool CheckOCGDictVisible(const CPDF_Dictionary *pOC) const
CPDF_RenderOptions(const CPDF_RenderOptions &rhs)
FX_ARGB TranslateObjectStrokeColor(FX_ARGB argb, CPDF_PageObject::Type object_type) const
bool ColorModeIs(Type mode) const
FX_ARGB TranslateObjectFillColor(FX_ARGB argb, CPDF_PageObject::Type object_type) const
#define FXRGB2GRAY(r, g, b)
Definition fx_dib.h:131
constexpr FX_ARGB ArgbEncode(uint32_t a, uint32_t r, uint32_t g, uint32_t b)
Definition fx_dib.h:118
Options(const Options &rhs)
Options & operator=(const Options &rhs)