summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_coordinates.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/fxcrt/fx_coordinates.cpp')
-rw-r--r--core/fxcrt/fx_coordinates.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/fxcrt/fx_coordinates.cpp b/core/fxcrt/fx_coordinates.cpp
index c345a822b9..136ae72527 100644
--- a/core/fxcrt/fx_coordinates.cpp
+++ b/core/fxcrt/fx_coordinates.cpp
@@ -148,6 +148,20 @@ void CFX_FloatRect::UpdateRect(const CFX_PointF& point) {
top = std::max(top, point.y);
}
+void CFX_FloatRect::ScaleFromCenterPoint(float fScale) {
+ float fHalfWidth = (right - left) / 2.0f;
+ float fHalfHeight = (top - bottom) / 2.0f;
+
+ float center_x = (left + right) / 2;
+ float center_y = (top + bottom) / 2;
+
+ left = center_x - fHalfWidth * fScale;
+ bottom = center_y - fHalfHeight * fScale;
+ right = center_x + fHalfWidth * fScale;
+ top = center_y + fHalfHeight * fScale;
+}
+
+// static
CFX_FloatRect CFX_FloatRect::GetBBox(const CFX_PointF* pPoints, int nPoints) {
if (nPoints == 0)
return CFX_FloatRect();