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_shadingobject.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_shadingobject.h"
8
9#include <utility>
10
11#include "core/fpdfapi/page/cpdf_shadingpattern.h"
12
13CPDF_ShadingObject::CPDF_ShadingObject(int32_t content_stream,
14 RetainPtr<CPDF_ShadingPattern> pattern,
15 const CFX_Matrix& matrix)
16 : CPDF_PageObject(content_stream),
18 m_Matrix(matrix) {}
19
20CPDF_ShadingObject::~CPDF_ShadingObject() = default;
21
22CPDF_PageObject::Type CPDF_ShadingObject::GetType() const {
23 return Type::kShading;
24}
25
26void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
27 CPDF_ClipPath& clip_path = mutable_clip_path();
28 if (clip_path.HasRef()) {
29 clip_path.Transform(matrix);
30 }
31
32 m_Matrix.Concat(matrix);
33 if (clip_path.HasRef()) {
35 } else {
36 SetRect(matrix.TransformRect(GetRect()));
37 }
38 SetDirty(true);
39}
40
41bool CPDF_ShadingObject::IsShading() const {
42 return true;
43}
44
45CPDF_ShadingObject* CPDF_ShadingObject::AsShading() {
46 return this;
47}
48
49const CPDF_ShadingObject* CPDF_ShadingObject::AsShading() const {
50 return this;
51}
52
53void CPDF_ShadingObject::CalcBoundingBox() {
54 if (!clip_path().HasRef()) {
55 return;
56 }
57 SetRect(clip_path().GetClipBox());
58}
void Concat(const CFX_Matrix &right)
CFX_Matrix(const CFX_Matrix &other)=default
void Transform(const CFX_Matrix &matrix)
bool HasRef() const
void SetRect(const CFX_FloatRect &rect)
void SetDirty(bool value)
CPDF_PageObject(int32_t content_stream)
const CPDF_ClipPath & clip_path() const
const CFX_FloatRect & GetRect() const
CPDF_ClipPath & mutable_clip_path()
bool IsShading() const override
~CPDF_ShadingObject() override
const CPDF_ShadingObject * AsShading() const override
CPDF_ShadingObject * AsShading() override
CPDF_ShadingObject(int32_t content_stream, RetainPtr< CPDF_ShadingPattern > pattern, const CFX_Matrix &matrix)
Type GetType() const override
void Transform(const CFX_Matrix &matrix) override