Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: core/include/fxcrt/fx_coordinates.h

Issue 1172793002: Merge to XFA: Use stdint.h types throughout PDFium. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@xfa
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/include/fxcrt/fx_basic.h ('k') | core/include/fxcrt/fx_ext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #ifndef CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ 7 #ifndef CORE_INCLUDE_FXCRT_FX_COORDINATES_H_
8 #define CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ 8 #define CORE_INCLUDE_FXCRT_FX_COORDINATES_H_
9 9
10 #include "fx_basic.h" 10 #include "fx_basic.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 } 106 }
107 friend FXT_PSV operator / (const FXT_PSV &obj, baseType lamda) 107 friend FXT_PSV operator / (const FXT_PSV &obj, baseType lamda)
108 { 108 {
109 CFX_PSVTemplate t; 109 CFX_PSVTemplate t;
110 t.x = obj.x / lamda; 110 t.x = obj.x / lamda;
111 t.y = obj.y / lamda; 111 t.y = obj.y / lamda;
112 return t; 112 return t;
113 } 113 }
114 baseType x, y; 114 baseType x, y;
115 }; 115 };
116 typedef CFX_PSVTemplate<FX_INT32>» » » CFX_Point; 116 typedef CFX_PSVTemplate<int32_t>» » » CFX_Point;
117 typedef CFX_PSVTemplate<FX_FLOAT> CFX_PointF; 117 typedef CFX_PSVTemplate<FX_FLOAT> CFX_PointF;
118 typedef CFX_PSVTemplate<FX_INT32>» » » CFX_Size; 118 typedef CFX_PSVTemplate<int32_t>» » » CFX_Size;
119 typedef CFX_PSVTemplate<FX_FLOAT> CFX_SizeF; 119 typedef CFX_PSVTemplate<FX_FLOAT> CFX_SizeF;
120 typedef CFX_ArrayTemplate<CFX_Point> CFX_Points; 120 typedef CFX_ArrayTemplate<CFX_Point> CFX_Points;
121 typedef CFX_ArrayTemplate<CFX_PointF> CFX_PointsF; 121 typedef CFX_ArrayTemplate<CFX_PointF> CFX_PointsF;
122 typedef CFX_PSVTemplate<FX_INT32> *» » » FX_LPPOINT; 122 typedef CFX_PSVTemplate<int32_t> *» » » FX_LPPOINT;
123 typedef CFX_PSVTemplate<FX_FLOAT> * FX_LPPOINTF; 123 typedef CFX_PSVTemplate<FX_FLOAT> * FX_LPPOINTF;
124 typedef CFX_PSVTemplate<FX_INT32> const *» FX_LPCPOINT; 124 typedef CFX_PSVTemplate<int32_t> const *» FX_LPCPOINT;
125 typedef CFX_PSVTemplate<FX_FLOAT> const * FX_LPCPOINTF; 125 typedef CFX_PSVTemplate<FX_FLOAT> const * FX_LPCPOINTF;
126 #define CFX_FloatPoint CFX_PointF 126 #define CFX_FloatPoint CFX_PointF
127 template<class baseType> 127 template<class baseType>
128 class CFX_VTemplate: public CFX_PSVTemplate<baseType> 128 class CFX_VTemplate: public CFX_PSVTemplate<baseType>
129 { 129 {
130 public: 130 public:
131 typedef CFX_PSVTemplate<baseType> FXT_PSV; 131 typedef CFX_PSVTemplate<baseType> FXT_PSV;
132 typedef CFX_PSVTemplate<baseType> FXT_POINT; 132 typedef CFX_PSVTemplate<baseType> FXT_POINT;
133 typedef CFX_PSVTemplate<baseType> FXT_SIZE; 133 typedef CFX_PSVTemplate<baseType> FXT_SIZE;
134 typedef CFX_VTemplate<baseType> FXT_VECTOR; 134 typedef CFX_VTemplate<baseType> FXT_VECTOR;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 return (FX_FLOAT)FXSYS_acos(Cosine(v1, v2)); 220 return (FX_FLOAT)FXSYS_acos(Cosine(v1, v2));
221 } 221 }
222 friend FX_FLOAT SlopeAngle(const FXT_VECTOR &v) 222 friend FX_FLOAT SlopeAngle(const FXT_VECTOR &v)
223 { 223 {
224 CFX_VTemplate vx; 224 CFX_VTemplate vx;
225 vx.Set(1, 0); 225 vx.Set(1, 0);
226 FX_FLOAT fSlope = ArcCosine(v, vx); 226 FX_FLOAT fSlope = ArcCosine(v, vx);
227 return v.y < 0 ? -fSlope : fSlope; 227 return v.y < 0 ? -fSlope : fSlope;
228 } 228 }
229 }; 229 };
230 typedef CFX_VTemplate<FX_INT32> CFX_Vector; 230 typedef CFX_VTemplate<int32_t> CFX_Vector;
231 typedef CFX_VTemplate<FX_FLOAT> CFX_VectorF; 231 typedef CFX_VTemplate<FX_FLOAT> CFX_VectorF;
232 template<class baseType> 232 template<class baseType>
233 class CFX_RTemplate 233 class CFX_RTemplate
234 { 234 {
235 public: 235 public:
236 typedef CFX_PSVTemplate<baseType> FXT_POINT; 236 typedef CFX_PSVTemplate<baseType> FXT_POINT;
237 typedef CFX_PSVTemplate<baseType> FXT_SIZE; 237 typedef CFX_PSVTemplate<baseType> FXT_SIZE;
238 typedef CFX_VTemplate<baseType> FXT_VECTOR; 238 typedef CFX_VTemplate<baseType> FXT_VECTOR;
239 typedef CFX_PRLTemplate<baseType> FXT_PARAL; 239 typedef CFX_PRLTemplate<baseType> FXT_PARAL;
240 typedef CFX_RTemplate<baseType> FXT_RECT; 240 typedef CFX_RTemplate<baseType> FXT_RECT;
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 { 517 {
518 return rc1.left == rc2.left && rc1.top == rc2.top && rc1.width == rc2.wi dth && rc1.height == rc2.height; 518 return rc1.left == rc2.left && rc1.top == rc2.top && rc1.width == rc2.wi dth && rc1.height == rc2.height;
519 } 519 }
520 friend FX_BOOL operator != (const FXT_RECT &rc1, const FXT_RECT &rc2) 520 friend FX_BOOL operator != (const FXT_RECT &rc1, const FXT_RECT &rc2)
521 { 521 {
522 return rc1.left != rc2.left || rc1.top != rc2.top || rc1.width != rc2.wi dth || rc1.height != rc2.height; 522 return rc1.left != rc2.left || rc1.top != rc2.top || rc1.width != rc2.wi dth || rc1.height != rc2.height;
523 } 523 }
524 baseType left, top; 524 baseType left, top;
525 baseType width, height; 525 baseType width, height;
526 }; 526 };
527 typedef CFX_RTemplate<FX_INT32>»» » CFX_Rect; 527 typedef CFX_RTemplate<int32_t>» » » CFX_Rect;
528 typedef CFX_RTemplate<FX_FLOAT> CFX_RectF; 528 typedef CFX_RTemplate<FX_FLOAT> CFX_RectF;
529 typedef CFX_RTemplate<FX_INT32> *» » FX_LPRECT; 529 typedef CFX_RTemplate<int32_t> *» » FX_LPRECT;
530 typedef CFX_RTemplate<FX_FLOAT> * FX_LPRECTF; 530 typedef CFX_RTemplate<FX_FLOAT> * FX_LPRECTF;
531 typedef CFX_RTemplate<FX_INT32> const *»FX_LPCRECT; 531 typedef CFX_RTemplate<int32_t> const *» FX_LPCRECT;
532 typedef CFX_RTemplate<FX_FLOAT> const * FX_LPCRECTF; 532 typedef CFX_RTemplate<FX_FLOAT> const * FX_LPCRECTF;
533 typedef CFX_ArrayTemplate<CFX_RectF> CFX_RectFArray; 533 typedef CFX_ArrayTemplate<CFX_RectF> CFX_RectFArray;
534 struct FX_RECT { 534 struct FX_RECT {
535 535
536 int left; 536 int left;
537 537
538 int top; 538 int top;
539 539
540 int right; 540 int right;
541 541
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 return other_rect.left >= left && other_rect.right <= right && other_rec t.top >= top && other_rect.bottom <= bottom; 595 return other_rect.left >= left && other_rect.right <= right && other_rec t.top >= top && other_rect.bottom <= bottom;
596 } 596 }
597 597
598 FX_BOOL Contains(int x, int y) const 598 FX_BOOL Contains(int x, int y) const
599 { 599 {
600 return x >= left && x < right && y >= top && y < bottom; 600 return x >= left && x < right && y >= top && y < bottom;
601 } 601 }
602 }; 602 };
603 struct FX_SMALL_RECT { 603 struct FX_SMALL_RECT {
604 604
605 FX_SHORT» Left; 605 int16_t» Left;
606 606
607 FX_SHORT» Top; 607 int16_t» Top;
608 608
609 FX_SHORT» Right; 609 int16_t» Right;
610 610
611 FX_SHORT» Bottom; 611 int16_t» Bottom;
612 }; 612 };
613 class CFX_FloatRect 613 class CFX_FloatRect
614 { 614 {
615 public: 615 public:
616 616
617 CFX_FloatRect() 617 CFX_FloatRect()
618 { 618 {
619 left = right = bottom = top = 0; 619 left = right = bottom = top = 0;
620 } 620 }
621 621
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0; 800 return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0;
801 } 801 }
802 FX_BOOL IsInvertible() const; 802 FX_BOOL IsInvertible() const;
803 803
804 FX_BOOL Is90Rotated() const; 804 FX_BOOL Is90Rotated() const;
805 805
806 FX_BOOL IsScaled() const; 806 FX_BOOL IsScaled() const;
807 807
808 void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepe nded = FALSE); 808 void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepe nded = FALSE);
809 809
810 void» » » TranslateI(FX_INT32 x, FX_INT32 y, FX_BOOL bPrep ended = FALSE) 810 void» » » TranslateI(int32_t x, int32_t y, FX_BOOL bPrepen ded = FALSE)
811 { 811 {
812 Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); 812 Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended);
813 } 813 }
814 814
815 void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepend ed = FALSE); 815 void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepend ed = FALSE);
816 816
817 void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FA LSE); 817 void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FA LSE);
818 818
819 void RotateAt(FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); 819 void RotateAt(FX_FLOAT fRadian, FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE);
820 820
821 void Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadia n, FX_BOOL bPrepended = FALSE); 821 void Shear(FX_FLOAT fAlphaRadian, FX_FLOAT fBetaRadia n, FX_BOOL bPrepended = FALSE);
822 822
823 void MatchRect(const CFX_FloatRect &dest, const CFX_F loatRect &src); 823 void MatchRect(const CFX_FloatRect &dest, const CFX_F loatRect &src);
824 824
825 FX_FLOAT GetXUnit() const; 825 FX_FLOAT GetXUnit() const;
826 826
827 FX_FLOAT GetYUnit() const; 827 FX_FLOAT GetYUnit() const;
828 void GetUnitRect(CFX_RectF &rect) const; 828 void GetUnitRect(CFX_RectF &rect) const;
829 829
830 CFX_FloatRect GetUnitRect() const; 830 CFX_FloatRect GetUnitRect() const;
831 831
832 FX_FLOAT GetUnitArea() const; 832 FX_FLOAT GetUnitArea() const;
833 FX_FLOAT TransformXDistance(FX_FLOAT dx) const; 833 FX_FLOAT TransformXDistance(FX_FLOAT dx) const;
834 FX_INT32» » TransformXDistance(FX_INT32 dx) const; 834 int32_t» » TransformXDistance(int32_t dx) const;
835 FX_FLOAT TransformYDistance(FX_FLOAT dy) const; 835 FX_FLOAT TransformYDistance(FX_FLOAT dy) const;
836 FX_INT32» » TransformYDistance(FX_INT32 dy) const; 836 int32_t» » TransformYDistance(int32_t dy) const;
837 FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const; 837 FX_FLOAT TransformDistance(FX_FLOAT dx, FX_FLOAT dy) const;
838 FX_INT32» » TransformDistance(FX_INT32 dx, FX_INT32 dy) const; 838 int32_t» » TransformDistance(int32_t dx, int32_t dy) const;
839 839
840 FX_FLOAT TransformDistance(FX_FLOAT distance) const; 840 FX_FLOAT TransformDistance(FX_FLOAT distance) const;
841 void TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const; 841 void TransformPoint(FX_FLOAT &x, FX_FLOAT &y) const;
842 void» » » TransformPoint(FX_INT32 &x, FX_INT32 &y) const; 842 void» » » TransformPoint(int32_t &x, int32_t &y) const;
843 void» » » TransformPoints(CFX_PointF *points, FX_INT32 iCo unt) const; 843 void» » » TransformPoints(CFX_PointF *points, int32_t iCou nt) const;
844 void» » » TransformPoints(CFX_Point *points, FX_INT32 iCou nt) const; 844 void» » » TransformPoints(CFX_Point *points, int32_t iCoun t) const;
845 845
846 void Transform(FX_FLOAT& x, FX_FLOAT& y) const 846 void Transform(FX_FLOAT& x, FX_FLOAT& y) const
847 { 847 {
848 TransformPoint(x, y); 848 TransformPoint(x, y);
849 } 849 }
850 850
851 void Transform(FX_FLOAT x, FX_FLOAT y, FX_FLOAT& x1, FX_FLOAT& y1) const 851 void Transform(FX_FLOAT x, FX_FLOAT y, FX_FLOAT& x1, FX_FLOAT& y1) const
852 { 852 {
853 x1 = x, y1 = y; 853 x1 = x, y1 = y;
854 TransformPoint(x1, y1); 854 TransformPoint(x1, y1);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
898 FX_FLOAT a; 898 FX_FLOAT a;
899 FX_FLOAT b; 899 FX_FLOAT b;
900 FX_FLOAT c; 900 FX_FLOAT c;
901 FX_FLOAT d; 901 FX_FLOAT d;
902 FX_FLOAT e; 902 FX_FLOAT e;
903 FX_FLOAT f; 903 FX_FLOAT f;
904 }; 904 };
905 #define CFX_AffineMatrix CFX_Matrix 905 #define CFX_AffineMatrix CFX_Matrix
906 906
907 #endif // CORE_INCLUDE_FXCRT_FX_COORDINATES_H_ 907 #endif // CORE_INCLUDE_FXCRT_FX_COORDINATES_H_
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_basic.h ('k') | core/include/fxcrt/fx_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698