summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_coordinates.h
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /core/fxcrt/fx_coordinates.h
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'core/fxcrt/fx_coordinates.h')
-rw-r--r--core/fxcrt/fx_coordinates.h95
1 files changed, 39 insertions, 56 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index f00675842d..359bf46884 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -270,48 +270,22 @@ class CFX_RTemplate {
: left(p.x), top(p.y), width(dst_width), height(dst_height) {}
CFX_RTemplate(const PointType& p1, const SizeType& s2)
: left(p1.x), top(p1.y), width(s2.x), height(s2.y) {}
-
- void Set(BaseType dst_left,
- BaseType dst_top,
- BaseType dst_width,
- BaseType dst_height) {
- left = dst_left;
- top = dst_top;
- width = dst_width;
- height = dst_height;
- }
- void Set(BaseType dst_left, BaseType dst_top, const SizeType& dst_size) {
- left = dst_left;
- top = dst_top;
- width = dst_size.x;
- height = dst_size.y;
- }
- void Set(const PointType& p, BaseType dst_width, BaseType dst_height) {
- left = p.x;
- top = p.y;
- width = dst_width;
- height = dst_height;
- }
- void Set(const PointType& p, const SizeType& s) {
- left = p.x;
- top = p.y;
- width = s.x;
- height = s.y;
- }
- void Set(const PointType& p1, const PointType& p2) {
- left = p1.x;
- top = p1.y;
- width = p2.x - p1.x;
- height = p2.y - p1.y;
+ CFX_RTemplate(const PointType& p1, const PointType& p2)
+ : left(p1.x), top(p1.y), width(p2.x - p1.x), height(p2.y - p1.y) {
Normalize();
}
- void Set(const PointType& p, const VectorType& v) {
- left = p.x;
- top = p.y;
- width = v.x;
- height = v.y;
+ CFX_RTemplate(const PointType& p, const VectorType& v)
+ : left(p.x), top(p.y), width(v.x), height(v.y) {
Normalize();
}
+
+ // NOLINTNEXTLINE(runtime/explicit)
+ CFX_RTemplate(const RectType& other)
+ : left(other.left),
+ top(other.top),
+ width(other.width),
+ height(other.height) {}
+
void Reset() {
left = 0;
top = 0;
@@ -595,31 +569,40 @@ class CFX_Matrix {
public:
CFX_Matrix() { SetIdentity(); }
+ explicit CFX_Matrix(const FX_FLOAT n[6])
+ : a(n[0]), b(n[1]), c(n[2]), d(n[3]), e(n[4]), f(n[5]) {}
+
+ CFX_Matrix(const CFX_Matrix& other)
+ : a(other.a),
+ b(other.b),
+ c(other.c),
+ d(other.d),
+ e(other.e),
+ f(other.f) {}
CFX_Matrix(FX_FLOAT a1,
FX_FLOAT b1,
FX_FLOAT c1,
FX_FLOAT d1,
FX_FLOAT e1,
- FX_FLOAT f1) {
- a = a1;
- b = b1;
- c = c1;
- d = d1;
- e = e1;
- f = f1;
- }
-
- void Set(FX_FLOAT a,
- FX_FLOAT b,
- FX_FLOAT c,
- FX_FLOAT d,
- FX_FLOAT e,
- FX_FLOAT f);
- void Set(const FX_FLOAT n[6]);
+ FX_FLOAT f1)
+ : a(a1), b(b1), c(c1), d(d1), e(e1), f(f1) {}
+
+ void operator=(const CFX_Matrix& other) {
+ a = other.a;
+ b = other.b;
+ c = other.c;
+ d = other.d;
+ e = other.e;
+ f = other.f;
+ }
void SetIdentity() {
- a = d = 1;
- b = c = e = f = 0;
+ a = 1;
+ b = 0;
+ c = 0;
+ d = 1;
+ e = 0;
+ f = 0;
}
void SetReverse(const CFX_Matrix& m);