7#ifndef CORE_FXCRT_FX_COORDINATES_H_
8#define CORE_FXCRT_FX_COORDINATES_H_
16#include "third_party/base/containers/span.h"
18template <
class BaseType>
23 :
x(new_x),
y(new_y) {}
28 return x == other.x &&
y == other.y;
31 return !(*
this == other);
57template <
class BaseType>
66 template <
typename OtherType>
69 static_cast<OtherType>(
height));
77 return width == other.width &&
height == other.height;
80 return !(*
this == other);
121template <
class BaseType>
135 :
CFX_PTemplate<BaseType>(point2.x - point1.x, point2.y - point1.y) {}
140using CFX_Vector = CFX_VTemplate<int32_t>;
141using CFX_VectorF = CFX_VTemplate<
float>;
205 bool Contains(
const CFX_PointF& point)
const;
236 void Inflate(
float x,
float y);
243 void Deflate(
float x,
float y);
254 void Scale(
float fScale);
286 using PointType = CFX_PointF;
287 using SizeType = CFX_SizeF;
298 CFX_RectF(
float dst_left,
float dst_top,
const SizeType& dst_size)
301 width(dst_size.width),
302 height(dst_size.height) {}
303 CFX_RectF(
const PointType& p,
float dst_width,
float dst_height)
309 top(
static_cast<
float>(that
.top)),
345 void Inflate(
const PointType& p) { Inflate(p.x, p.y); }
352 width += off_left + off_right;
353 height += off_top + off_bottom;
364 void Deflate(
const PointType& p) { Deflate(p.x, p.y); }
371 width -= off_left + off_right;
372 height -= off_top + off_bottom;
404 void Union(
float x,
float y);
405 void Union(
const PointType& p) { Union(p.x, p.y); }
423 return !(rc1
== rc2);
457 :
a(n[0]),
b(n[1]),
c(n[2]),
d(n[3]),
e(n[4]),
f(n[5]) {}
459 CFX_Matrix(
float a1,
float b1,
float c1,
float d1,
float e1,
float f1)
460 :
a(a1),
b(b1),
c(c1),
d(d1),
e(e1),
f(f1) {}
467 return a == other
.a &&
b == other
.b &&
c == other
.c &&
d == other
.d &&
468 e == other
.e &&
f == other
.f;
479 *
this = *
this * other;
488 bool WillScale()
const {
return a != 1.0f ||
b != 0 ||
c != 0 ||
d != 1.0f; }
494 Translate(static_cast<
float>(x)
, static_cast<
float>(y)
);
500 void Scale(
float sx,
float sy);
501 void Rotate(
float fRadian);
512 CFX_PointF
Transform(
const CFX_PointF& point)
const;
void Deflate(const CFX_FloatRect &rt)
void Deflate(float other_left, float other_bottom, float other_right, float other_top)
FX_RECT ToRoundedFxRect() const
bool Contains(const CFX_PointF &point) const
CFX_FloatRect(const CFX_FloatRect &that)=default
CFX_FloatRect GetCenterSquare() const
constexpr CFX_FloatRect(float l, float b, float r, float t)
constexpr CFX_FloatRect()=default
FX_RECT GetClosestRect() const
bool operator==(const CFX_FloatRect &other) const
CFX_FloatRect(const FX_RECT &rect)
void UpdateRect(const CFX_PointF &point)
void Intersect(const CFX_FloatRect &other_rect)
void ScaleFromCenterPoint(float fScale)
void Inflate(float x, float y)
FX_RECT GetInnerRect() const
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
void Deflate(float x, float y)
bool Contains(const CFX_FloatRect &other_rect) const
FX_RECT GetOuterRect() const
void Inflate(const CFX_FloatRect &rt)
static CFX_FloatRect GetBBox(pdfium::span< const CFX_PointF > pPoints)
void Translate(float e, float f)
CFX_FloatRect GetDeflated(float x, float y) const
void Inflate(float other_left, float other_bottom, float other_right, float other_top)
void Union(const CFX_FloatRect &other_rect)
CFX_FloatRect(const CFX_PointF &point)
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_Matrix(const float n[6])
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
float TransformDistance(float distance) const
CFX_Matrix & operator*=(const CFX_Matrix &other)
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
CFX_RectF TransformRect(const CFX_RectF &rect) const
void MatchRect(const CFX_FloatRect &dest, const CFX_FloatRect &src)
CFX_Matrix operator*(const CFX_Matrix &right) const
CFX_PointF Transform(const CFX_PointF &point) const
void Translate(int32_t x, int32_t y)
void TranslatePrepend(int32_t x, int32_t y)
CFX_FloatRect GetUnitRect() const
CFX_Matrix GetInverse() const
bool operator!=(const CFX_Matrix &other) const
void TranslatePrepend(float x, float y)
void Rotate(float fRadian)
void Scale(float sx, float sy)
void Translate(float x, float y)
void Concat(const CFX_Matrix &right)
bool operator==(const CFX_Matrix &other) const
float TransformXDistance(float dx) const
CFX_Matrix(const CFX_Matrix &other)=default
constexpr CFX_PTemplate(BaseType new_x, BaseType new_y)
CFX_PTemplate(const CFX_PTemplate &other)=default
CFX_PTemplate & operator-=(const CFX_PTemplate< BaseType > &obj)
constexpr CFX_PTemplate()=default
CFX_PTemplate operator+(const CFX_PTemplate &other) const
CFX_PTemplate operator-(const CFX_PTemplate &other) const
bool operator==(const CFX_PTemplate &other) const
bool operator!=(const CFX_PTemplate &other) const
CFX_PTemplate & operator+=(const CFX_PTemplate< BaseType > &obj)
CFX_PTemplate & operator=(const CFX_PTemplate &other)=default
void Union(const PointType &p)
CFX_RectF(const CFX_RectF &other)=default
void Offset(float dx, float dy)
CFX_FloatRect ToFloatRect() const
PointType BottomLeft() const
bool IntersectWith(const CFX_RectF &rt, float fEpsilon) const
PointType BottomRight() const
constexpr CFX_RectF()=default
friend bool operator==(const CFX_RectF &rc1, const CFX_RectF &rc2)
bool IsEmpty(float fEpsilon) const
void Inflate(float off_left, float off_top, float off_right, float off_bottom)
void Deflate(const CFX_RectF &rt)
CFX_RectF & operator+=(const PointType &p)
bool Contains(const CFX_RectF &rt) const
bool IntersectWith(const CFX_RectF &rt) const
void Intersect(const CFX_RectF &rt)
FX_RECT GetOuterRect() const
void Deflate(float off_left, float off_top, float off_right, float off_bottom)
friend bool operator!=(const CFX_RectF &rc1, const CFX_RectF &rc2)
void Inflate(const CFX_RectF &rt)
void Inflate(const PointType &p)
void Inflate(float x, float y)
CFX_RectF & operator=(const CFX_RectF &other)=default
CFX_RectF(const FX_RECT &that)
bool Contains(const PointType &p) const
CFX_RectF & operator-=(const PointType &p)
CFX_RectF(float dst_left, float dst_top, const SizeType &dst_size)
void Union(float x, float y)
void Deflate(const PointType &p)
CFX_RectF(const PointType &p, float dst_width, float dst_height)
PointType TopLeft() const
constexpr CFX_RectF(float dst_left, float dst_top, float dst_width, float dst_height)
void Union(const CFX_RectF &rt)
CFX_RectF(const PointType &p1, const SizeType &s2)
void Deflate(float x, float y)
PointType TopRight() const
bool operator!=(const CFX_STemplate &other) const
CFX_STemplate & operator/=(BaseType divisor)
bool operator==(const CFX_STemplate &other) const
constexpr CFX_STemplate(BaseType new_width, BaseType new_height)
CFX_STemplate & operator+=(const CFX_STemplate< BaseType > &obj)
CFX_STemplate< OtherType > As() const
constexpr CFX_STemplate()=default
CFX_STemplate & operator-=(const CFX_STemplate< BaseType > &obj)
CFX_STemplate(const CFX_STemplate &other)=default
CFX_STemplate operator+(const CFX_STemplate &other) const
CFX_STemplate operator-(const CFX_STemplate &other) const
CFX_STemplate operator*(BaseType factor) const
CFX_STemplate & operator*=(BaseType factor)
CFX_STemplate & operator=(const CFX_STemplate &other)=default
CFX_STemplate operator/(BaseType divisor) const
CFX_VTemplate(const CFX_VTemplate &other)
CFX_VTemplate(BaseType new_x, BaseType new_y)
CFX_VTemplate(const CFX_PTemplate< BaseType > &point1, const CFX_PTemplate< BaseType > &point2)
std::ostream & WritePoint(std::ostream &stream, const CFX_PointF &point)
std::ostream & WriteFloat(std::ostream &stream, float value)
std::ostream & WriteRect(std::ostream &stream, const CFX_FloatRect &rect)
std::ostream & WriteMatrix(std::ostream &stream, const CFX_Matrix &matrix)
void Offset(int dx, int dy)
FX_RECT & operator=(const FX_RECT &that)=default
bool operator==(const FX_RECT &src) const
constexpr FX_RECT()=default
FX_RECT(const FX_RECT &that)=default
void Intersect(int l, int t, int r, int b)
FX_RECT SwappedClipBox(int width, int height, bool bFlipX, bool bFlipY) const
bool Contains(int x, int y) const
void Intersect(const FX_RECT &src)
constexpr FX_RECT(int l, int t, int r, int b)