Coverage Report

Created: 2026-06-13 06:44

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/libcdr/src/lib/CDRTransforms.h
Line
Count
Source
1
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2
/*
3
 * This file is part of the libcdr project.
4
 *
5
 * This Source Code Form is subject to the terms of the Mozilla Public
6
 * License, v. 2.0. If a copy of the MPL was not distributed with this
7
 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8
 */
9
10
#ifndef __CDRTRANSFORMS_H__
11
#define __CDRTRANSFORMS_H__
12
13
#include <vector>
14
#include <librevenge/librevenge.h>
15
16
namespace libcdr
17
{
18
19
class CDRTransform
20
{
21
public:
22
  CDRTransform();
23
  CDRTransform(double v0, double v1, double x0, double v3, double v4, double y0);
24
  CDRTransform(const CDRTransform &trafo) = default;
25
26
  CDRTransform &operator=(const CDRTransform &trafo) = default;
27
28
  void applyToPoint(double &x, double &y) const;
29
  void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &endx, double &endy) const;
30
  double getScaleX() const;
31
  double getScaleY() const;
32
  double getTranslateX() const;
33
  double getTranslateY() const;
34
  bool getFlipX() const;
35
  bool getFlipY() const;
36
37
  librevenge::RVNGString toString() const;
38
39
private:
40
  double _getScaleX() const;
41
  double _getScaleY() const;
42
  double m_v0;
43
  double m_v1;
44
  double m_x0;
45
  double m_v3;
46
  double m_v4;
47
  double m_y0;
48
};
49
50
class CDRTransforms
51
{
52
public:
53
  CDRTransforms();
54
1.75k
  CDRTransforms(const CDRTransforms &trafos) = default;
55
  ~CDRTransforms();
56
57
786k
  CDRTransforms &operator=(const CDRTransforms &trafo) = default;
58
59
  void append(double v0, double v1, double x0, double v3, double v4, double y0);
60
  void append(const CDRTransform &trafo);
61
  void clear();
62
  bool empty() const;
63
64
  void applyToPoint(double &x, double &y) const;
65
  void applyToArc(double &rx, double &ry, double &rotation, bool &sweep, double &x, double &y) const;
66
  double getScaleX() const;
67
  double getScaleY() const;
68
  double getTranslateX() const;
69
  double getTranslateY() const;
70
  bool getFlipX() const;
71
  bool getFlipY() const;
72
73
private:
74
  double _getScaleX() const;
75
  double _getScaleY() const;
76
  std::vector<CDRTransform> m_trafos;
77
};
78
79
} // namespace libcdr
80
81
#endif /* __CDRTRANSFORMS_H__ */
82
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */