Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
cpdf_tilingpattern.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/page/cpdf_tilingpattern.h"
8
9
#
include
<
math
.
h
>
10
11
#
include
<
utility
>
12
13
#
include
"core/fpdfapi/page/cpdf_allstates.h"
14
#
include
"core/fpdfapi/page/cpdf_form.h"
15
#
include
"core/fpdfapi/page/cpdf_pageobject.h"
16
#
include
"core/fpdfapi/parser/cpdf_dictionary.h"
17
#
include
"core/fpdfapi/parser/cpdf_object.h"
18
#
include
"core/fpdfapi/parser/cpdf_stream.h"
19
#
include
"core/fxcrt/check.h"
20
21
CPDF_TilingPattern::CPDF_TilingPattern(
CPDF_Document
* pDoc,
22
RetainPtr
<
CPDF_Object
> pPatternObj,
23
const
CFX_Matrix
& parentMatrix)
24
:
CPDF_Pattern
(pDoc,
std
::move(pPatternObj), parentMatrix) {
25
DCHECK
(document());
26
m_bColored = pattern_obj()->GetDict()->GetIntegerFor(
"PaintType"
) == 1;
27
SetPatternToFormMatrix
();
28
}
29
30
CPDF_TilingPattern::~
CPDF_TilingPattern
() =
default
;
31
32
CPDF_TilingPattern* CPDF_TilingPattern::
AsTilingPattern
() {
33
return
this
;
34
}
35
36
std
::
unique_ptr
<
CPDF_Form
> CPDF_TilingPattern::
Load
(
CPDF_PageObject
* pPageObj) {
37
RetainPtr
<
const
CPDF_Dictionary
> pDict = pattern_obj()->GetDict();
38
m_bColored = pDict->GetIntegerFor(
"PaintType"
) == 1;
39
m_XStep = fabsf(pDict->GetFloatFor(
"XStep"
));
40
m_YStep = fabsf(pDict->GetFloatFor(
"YStep"
));
41
42
RetainPtr
<CPDF_Stream> pStream = ToStream(pattern_obj());
43
if
(!pStream)
44
return
nullptr
;
45
46
const
CFX_Matrix
& matrix =
parent_matrix
();
47
auto
form =
48
std
::make_unique<CPDF_Form>(
document
(),
nullptr
,
std
::move(pStream));
49
50
CPDF_AllStates
all_states;
51
all_states
.
mutable_color_state
(
)
.
Emplace
(
)
;
52
all_states
.
mutable_graph_state
(
)
.
Emplace
(
)
;
53
all_states
.
mutable_text_state
(
)
.
Emplace
(
)
;
54
all_states
.
mutable_general_state
(
)
= pPageObj
->
general_state
(
)
;
55
form->ParseContent(&all_states, &matrix,
nullptr
);
56
m_BBox = pDict->GetRectFor(
"BBox"
);
57
return
form;
58
}
DCHECK
#define DCHECK
Definition
check.h:33
CFX_GraphState::Emplace
void Emplace()
Definition
cfx_graphstate.cpp:17
CFX_Matrix
Definition
fx_coordinates.h:440
CPDF_AllStates
Definition
cpdf_allstates.h:17
CPDF_AllStates::mutable_text_state
CPDF_TextState & mutable_text_state()
Definition
cpdf_allstates.h:80
CPDF_AllStates::mutable_graph_state
CFX_GraphState & mutable_graph_state()
Definition
cpdf_allstates.h:66
CPDF_AllStates::mutable_color_state
CPDF_ColorState & mutable_color_state()
Definition
cpdf_allstates.h:73
CPDF_AllStates::mutable_general_state
CPDF_GeneralState & mutable_general_state()
Definition
cpdf_allstates.h:87
CPDF_ColorState::Emplace
void Emplace()
Definition
cpdf_colorstate.cpp:23
CPDF_Dictionary::DictMap
std::map< ByteString, RetainPtr< CPDF_Object >, std::less<> > DictMap
Definition
cpdf_dictionary.h:31
CPDF_Document
Definition
cpdf_document.h:29
CPDF_Object
Definition
cpdf_object.h:50
CPDF_PageObject
Definition
cpdf_pageobject.h:27
CPDF_PageObject::general_state
const CPDF_GeneralState & general_state() const
Definition
cpdf_pageobject.h:125
CPDF_Pattern
Definition
cpdf_pattern.h:20
CPDF_Pattern::parent_matrix
const CFX_Matrix & parent_matrix() const
Definition
cpdf_pattern.h:39
CPDF_Pattern::SetPatternToFormMatrix
void SetPatternToFormMatrix()
Definition
cpdf_pattern.cpp:34
CPDF_Pattern::document
CPDF_Document * document() const
Definition
cpdf_pattern.h:37
CPDF_TextState::Emplace
void Emplace()
Definition
cpdf_textstate.cpp:24
CPDF_TilingPattern::Load
std::unique_ptr< CPDF_Form > Load(CPDF_PageObject *pPageObj)
Definition
cpdf_tilingpattern.cpp:36
CPDF_TilingPattern::~CPDF_TilingPattern
~CPDF_TilingPattern() override
CPDF_TilingPattern::AsTilingPattern
CPDF_TilingPattern * AsTilingPattern() override
Definition
cpdf_tilingpattern.cpp:32
fxcrt::RetainPtr
Definition
retain_ptr.h:28
std
[33]
Definition
src_corelib_tools_qhash.cpp:421
qtwebengine
src
3rdparty
chromium
third_party
pdfium
core
fpdfapi
page
cpdf_tilingpattern.cpp
Generated on
for Qt by
1.18.0