inline void split(VBezier *firstHalf, VBezier *secondHalf) const;
float tAtLength(float len) const;
void splitAtLength(float len, VBezier *left, VBezier *right);
- VPointF pt1() const { return VPointF(x1, y1); }
- VPointF pt2() const { return VPointF(x2, y2); }
- VPointF pt3() const { return VPointF(x3, y3); }
- VPointF pt4() const { return VPointF(x4, y4); }
+ VPointF pt1() const { return {x1, y1}; }
+ VPointF pt2() const { return {x2, y2}; }
+ VPointF pt3() const { return {x3, y3}; }
+ VPointF pt4() const { return {x4, y4}; }
private:
VPointF derivative(float t) const;
b = b * m_t + c * t;
y = a * m_t + b * t;
}
- return VPointF(x, y);
+ return {x, y};
}
inline void VBezier::parameterSplitLeft(float t, VBezier *left)
}
float length() const { return length(mX1, mY1, mX2, mY2);}
void splitAtLength(float length, VLine &left, VLine &right) const;
- VPointF p1() const { return VPointF(mX1, mY1); }
- VPointF p2() const { return VPointF(mX2, mY2); }
+ VPointF p1() const { return {mX1, mY1}; }
+ VPointF p2() const { return {mX2, mY2}; }
static float length(float x1, float y1, float x2, float y2);
h = -h;
y -= h;
}
- return VRect(x, y, w, h);
+ return {x, y, w, h};
} else if (t < MatrixType::Project) {
// see mapToPolygon for explanations of the algorithm.
float x = 0, y = 0;
y *= w;
}
}
- return VPointF(x, y);
+ return {x, y};
}
static std::string type_helper(VMatrix::MatrixType t)
{
int *point_count)
{
if (rect.isNull()) {
- return VPointF();
+ return {};
}
float x = rect.x();
inline float & ry() noexcept { return my; }
inline void setX(float x) { mx = x; }
inline void setY(float y) { my = y; }
- inline VPointF operator-() noexcept { return VPointF(-mx, -my); }
+ inline VPointF operator-() noexcept { return {-mx, -my}; }
inline VPointF & operator+=(const VPointF &p) noexcept;
inline VPointF & operator-=(const VPointF &p) noexcept;
friend const VPointF operator+(const VPointF &p1, const VPointF &p2)
inline VPointF operator-(const VPointF &p1, const VPointF &p2)
{
- return VPointF(p1.mx - p2.mx, p1.my - p2.my);
+ return {p1.mx - p2.mx, p1.my - p2.my};
}
inline const VPointF operator*(const VPointF &p, float c)
inline VPoint operator-(const VPoint &p1, const VPoint &p2)
{
- return VPoint(p1.mx - p2.mx, p1.my - p2.my);
+ return {p1.mx - p2.mx, p1.my - p2.my};
}
constexpr inline bool VPoint::operator==(const VPoint &o) const
inline VRect VRect::translated(int dx, int dy) const
{
- return VRect(x1 + dx, y1 + dy, x2 - x1, y2 - y1);
+ return {x1 + dx, y1 + dy, x2 - x1, y2 - y1};
}
inline void VRect::translate(int dx, int dy)
V_CONSTEXPR inline float y() const;
V_CONSTEXPR inline VPointF center() const
{
- return VPointF(x1 + (x2 - x1) / 2.f, y1 + (y2 - y1) / 2.f);
+ return {x1 + (x2 - x1) / 2.f, y1 + (y2 - y1) / 2.f};
}
inline void setLeft(float l) { x1 = l; }
inline void setTop(float t) { y1 = t; }
inline VRect box_to_rect(box_type_t *box)
{
- return VRect(box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1);
+ return {box->x1, box->y1, box->x2 - box->x1, box->y2 - box->y1};
}
void VRegion::cleanUp(VRegionData *x)
VRect VRegion::rectAt(int index) const
{
VRegionPrivate *reg = d->rgn;
- if (!reg) return VRect();
+ if (!reg) return {};
box_type_t *box = PIXREGION_RECTS(reg) + index;
VRect VRegion::boundingRect() const noexcept
{
- if (isEmpty()) return VRect();
+ if (isEmpty()) return {};
return box_to_rect(&d->rgn->extents);
}