summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2017-08-26 01:49:44 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-08-28 19:20:53 +0000
commit9084a1286c8cd9ead4d6d7bd177a22a3c67d3afb (patch)
treefdca0d663a448ef5512dc34b04786b75558ef669
parent61cb1121729d7e5f53c95077dcc57a61b3f575e8 (diff)
downloadpdfium-9084a1286c8cd9ead4d6d7bd177a22a3c67d3afb.tar.xz
Remove unused / rarely used CFX_PTemplate methods.
CFX_Point and CFX_PointF are derived from CFX_PTemplate. Add a helper function to replace the rarely used method where its used. Change-Id: I28448d44bbae9aa6773d1ad5fd7daf342b67c84c Reviewed-on: https://pdfium-review.googlesource.com/12071 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
-rw-r--r--core/fxcrt/fx_coordinates.h21
-rw-r--r--xfa/fwl/theme/cfwl_checkboxtp.cpp27
2 files changed, 18 insertions, 30 deletions
diff --git a/core/fxcrt/fx_coordinates.h b/core/fxcrt/fx_coordinates.h
index a4074a4afa..d84b866a57 100644
--- a/core/fxcrt/fx_coordinates.h
+++ b/core/fxcrt/fx_coordinates.h
@@ -20,10 +20,7 @@ class CFX_PTemplate {
CFX_PTemplate() : x(0), y(0) {}
CFX_PTemplate(BaseType new_x, BaseType new_y) : x(new_x), y(new_y) {}
CFX_PTemplate(const CFX_PTemplate& other) : x(other.x), y(other.y) {}
- void clear() {
- x = 0;
- y = 0;
- }
+
CFX_PTemplate operator=(const CFX_PTemplate& other) {
if (this != &other) {
x = other.x;
@@ -47,28 +44,12 @@ class CFX_PTemplate {
y -= obj.y;
return *this;
}
- CFX_PTemplate& operator*=(BaseType factor) {
- x *= factor;
- y *= factor;
- return *this;
- }
- CFX_PTemplate& operator/=(BaseType divisor) {
- x /= divisor;
- y /= divisor;
- return *this;
- }
CFX_PTemplate operator+(const CFX_PTemplate& other) const {
return CFX_PTemplate(x + other.x, y + other.y);
}
CFX_PTemplate operator-(const CFX_PTemplate& other) const {
return CFX_PTemplate(x - other.x, y - other.y);
}
- CFX_PTemplate operator*(BaseType factor) const {
- return CFX_PTemplate(x * factor, y * factor);
- }
- CFX_PTemplate operator/(BaseType divisor) const {
- return CFX_PTemplate(x / divisor, y / divisor);
- }
BaseType x;
BaseType y;
diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp
index e783098347..8d73738aab 100644
--- a/xfa/fwl/theme/cfwl_checkboxtp.cpp
+++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp
@@ -20,6 +20,13 @@ namespace {
const int kSignPath = 100;
+CFX_PointF ScaleBezierPoint(const CFX_PointF& point) {
+ CFX_PointF scaled_point(point);
+ scaled_point.x *= FX_BEZIER;
+ scaled_point.y *= FX_BEZIER;
+ return scaled_point;
+}
+
} // namespace
#define CHECKBOX_COLOR_BOXLT1 (ArgbEncode(255, 172, 168, 153))
@@ -234,24 +241,24 @@ void CFWL_CheckBoxTP::InitCheckPath(float fCheckLen) {
CFX_PointF pt15(fWidth / 3.5f, fBottom + fHeight * 3.5f / 5.0f);
m_pCheckPath->MoveTo(pt1);
- CFX_PointF p1 = CFX_PointF(pt12.x - pt1.x, pt12.y - pt1.y) * FX_BEZIER;
- CFX_PointF p2 = CFX_PointF(pt21.x - pt2.x, pt21.y - pt2.y) * FX_BEZIER;
+ CFX_PointF p1 = ScaleBezierPoint(pt12 - pt1);
+ CFX_PointF p2 = ScaleBezierPoint(pt21 - pt2);
m_pCheckPath->BezierTo(pt1 + p1, pt2 + p2, pt2);
- p1 = CFX_PointF(pt23.x - pt2.x, pt23.y - pt2.y) * FX_BEZIER;
- p2 = CFX_PointF(pt32.x - pt3.x, pt32.y - pt3.y) * FX_BEZIER;
+ p1 = ScaleBezierPoint(pt23 - pt2);
+ p2 = ScaleBezierPoint(pt32 - pt3);
m_pCheckPath->BezierTo(pt2 + p1, pt3 + p2, pt3);
- p1 = CFX_PointF(pt34.x - pt3.x, pt34.y - pt3.y) * FX_BEZIER;
- p2 = CFX_PointF(pt43.x - pt4.x, pt43.y - pt4.y) * FX_BEZIER;
+ p1 = ScaleBezierPoint(pt34 - pt3);
+ p2 = ScaleBezierPoint(pt43 - pt4);
m_pCheckPath->BezierTo(pt3 + p1, pt4 + p2, pt4);
- p1 = CFX_PointF(pt45.x - pt4.x, pt45.y - pt4.y) * FX_BEZIER;
- p2 = CFX_PointF(pt54.x - pt5.x, pt54.y - pt5.y) * FX_BEZIER;
+ p1 = ScaleBezierPoint(pt45 - pt4);
+ p2 = ScaleBezierPoint(pt54 - pt5);
m_pCheckPath->BezierTo(pt4 + p1, pt5 + p2, pt5);
- p1 = CFX_PointF(pt51.x - pt5.x, pt51.y - pt5.y) * FX_BEZIER;
- p2 = CFX_PointF(pt15.x - pt1.x, pt15.y - pt1.y) * FX_BEZIER;
+ p1 = ScaleBezierPoint(pt51 - pt5);
+ p2 = ScaleBezierPoint(pt15 - pt1);
m_pCheckPath->BezierTo(pt5 + p1, pt1 + p2, pt1);
float fScale = fCheckLen / kSignPath;