summaryrefslogtreecommitdiff
path: root/core/fxcrt/fx_coordinates.cpp
AgeCommit message (Collapse)Author
2018-10-06Simplify CFX_FloatRect::Inflate() and Deflate().Lei Zhang
Make all the other Inflate() methods to call the 4 parameters version. Make all the other Deflate() methods to call the 4 parameters version. Make the 4 parameters version of Deflate() call Inflate(). Change-Id: I1d2702898206bf9845f0bb176c2bf4d5a315cf96 Reviewed-on: https://pdfium-review.googlesource.com/c/43573 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2018-10-06Move CFX_FloatRect method impls out of the header.Lei Zhang
Change-Id: Ice814a84f699ea32325e98bbcea1a5b7db065fc6 Reviewed-on: https://pdfium-review.googlesource.com/c/43572 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-09-13Use safe math in MatchFloatRange().Tom Sepez
Bug: 882959 Change-Id: I3ce17916da1346158dbf5282be6696879a22567a Reviewed-on: https://pdfium-review.googlesource.com/42355 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>
2018-08-15Remove optional prepend argument from matrix transformations.Tom Sepez
Callers always want one form or the other, so split into separate methods. This may save some branching. Remove forms that are not used. Put more helpful helper function in .cpp file. Change-Id: I4e025de7f69ce3f323cd290a5dc8202dd4f8ca07 Reviewed-on: https://pdfium-review.googlesource.com/40270 Commit-Queue: Tom Sepez <tsepez@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org>
2018-04-10Add static_asserts for FX_RECT and FX_COLORREF.Lei Zhang
Make sure they match their win32 equivalent data types. Change-Id: I395054ce5c5ae110c78dbae30dd985fc498045fb Reviewed-on: https://pdfium-review.googlesource.com/30070 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-04-10Remove CFX_Rect.Lei Zhang
It is rarely used and FX_RECT is the more common integer rect type. Change-Id: I7c5b875321c2d587becedcd058bb3a57fd1f0b61 Reviewed-on: https://pdfium-review.googlesource.com/30053 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2018-03-15Use Width()/Height() methods from rectangles.Lei Zhang
Change-Id: I07f4363046be920816e8d0dae766c7af833284db Reviewed-on: https://pdfium-review.googlesource.com/28582 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2018-02-16Implement operator<< for CFX_Rect and CFX_RectF.Henrique Nakashima
This is for debugging, so gated by #ifndef NDEBUG. Also make label the printed values to make them clear and differentiate top>bottom and bottom>top rect systems. Change-Id: I2d816b6b8b1be5fb5464630e771d200f2534917e Reviewed-on: https://pdfium-review.googlesource.com/26911 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
2018-01-19Fix CFX_Matrix.RotateAt()Henrique Nakashima
The translations were in the opposite order they should be. First the specified (x, y) coord needs to be translated to the origin, then rotation should be applied, then the translation should be reversed. To translate (x, y) to the origin, the initial translation should be Tx = -x, Ty = -y. Bug: pdfium:987 Change-Id: I7f873c6a20858bf7fd03e5fdb49020b196b44a1d Reviewed-on: https://pdfium-review.googlesource.com/23210 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Reviewed-by: Nicolás Peña Moreno <npm@chromium.org> Reviewed-by: Shirleen Lou <xlou@chromium.org>
2018-01-11Add operator<< to CFX_FloatRect.Henrique Nakashima
This helps debugging. Change-Id: I4d14dd5975d8d8f4566009ed4a4127f9c56d36dd Reviewed-on: https://pdfium-review.googlesource.com/22790 Commit-Queue: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
2017-12-19Remove some dead code.Lei Zhang
Change-Id: I8edb14c024860c66b5e6c014136393e71e38387d Reviewed-on: https://pdfium-review.googlesource.com/21570 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-12-04Simplify some CFX_FloatRect methods.chromium/3285Lei Zhang
Also add a comment about the various CFX_FloatRect to FX_RECT conversion methods. Change-Id: Ia9984797dc513cdc487fe9972b32c216c9f99ec1 Reviewed-on: https://pdfium-review.googlesource.com/20217 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
2017-12-01Add CFX_FloatRect::ToRoundedFxRect().Lei Zhang
Unlike ToFxRect(), which floors the LBRT values. Also fix some nits. Change-Id: I0680eebb09031807a14402ca30b13558ea5b56d9 Reviewed-on: https://pdfium-review.googlesource.com/20213 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Add CFX_FloatRect::Scale().Lei Zhang
Unlike ScaleFromCenterPoint(), Scale() just scales the LBRT values. Also add unit tests for CFX_FloatRect::Normalize(). Change-Id: Iebf48fa9adcf47adff3255b157d3e3056f3687fc Reviewed-on: https://pdfium-review.googlesource.com/20212 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Rename CFX_FloatRect::Scale() to ScaleFromCenterPoint().Lei Zhang
Change-Id: I6baab14c989e8ae692ed1c846b135af95c09ce37 Reviewed-on: https://pdfium-review.googlesource.com/20210 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
2017-12-01Remove unused CFX_FloatRect::Substract4().Lei Zhang
Change-Id: I08706f53bf3960cbea60b09a1702bf0ba371f1ce Reviewed-on: https://pdfium-review.googlesource.com/20211 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
2017-08-22Converted CFX_Matrix::TransformRect() to take in constsJane Liu
Currently, all three of CFX_Matrix::TransformRect() take in rect values and modify them in place. This CL converts them to take in constant values and return the transformed values instead, and fixes all the call sites. Bug=pdfium:874 Change-Id: I9c274df3b14e9d88c100ba0530068e06e8fec32b Reviewed-on: https://pdfium-review.googlesource.com/11550 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Jane Liu <janeliulwq@google.com>
2017-08-21Converted CFX_FloatRect::{Init|Update}Rect() to take point objectsJane Liu
Converted CFX_FloatRect::Init() and CFX_FloatRect::UpdateRect() to take in a CFX_PointF object instead of two coordinates. Bug=pdfium:770 Change-Id: Ibcb620f192d6c086158c39f23c411777286005d0 Reviewed-on: https://pdfium-review.googlesource.com/11450 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
2017-07-13Move CPWL_Utils::GetCenterSquare to CFX_FloatRectDan Sinclair
This method is working on the FloatRect content so move it to CFX_FloatRect. Change-Id: I60aabf6e3b86aa9acc59f86cff69347ec5fe5033 Reviewed-on: https://pdfium-review.googlesource.com/7712 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-06-29Change SetReverse to GetInverse in CFX_MatrixNicolas Pena
CFX_Matrix::GetInverse is much clearer. Change-Id: Id10ab1723735332e1a78de853f28415ec3a4d834 Reviewed-on: https://pdfium-review.googlesource.com/7090 Reviewed-by: Lei Zhang <thestig@chromium.org> Commit-Queue: Nicolás Peña <npm@chromium.org>
2017-05-26Use more STL algorithms in fx_coordinates.cpp.Lei Zhang
Change-Id: I061132b3de0f388f4f4c103ff0377405de2ecf29 Reviewed-on: https://pdfium-review.googlesource.com/6012 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
2017-04-25Rename core/fxcrt/fx_basic_coords.cpp to fx_coordinates.cppTom Sepez
Its contents are delcared in fx_coordinates.h Remove unused GetIntersection(). Move FXSYS_round to fx_system.cpp. Change-Id: I70749581d1321dd919e35fa2daab9591098f68e9 Reviewed-on: https://pdfium-review.googlesource.com/4479 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Tom Sepez <tsepez@chromium.org>