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

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

Issue 2477443002: Remove FX_BOOL from core (Closed)
Patch Set: Created 4 years, 1 month 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/fxcrt/fx_basic_wstring.cpp ('k') | core/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_FXCRT_FX_COORDINATES_H_ 7 #ifndef CORE_FXCRT_FX_COORDINATES_H_
8 #define CORE_FXCRT_FX_COORDINATES_H_ 8 #define CORE_FXCRT_FX_COORDINATES_H_
9 9
10 #include "core/fxcrt/fx_basic.h" 10 #include "core/fxcrt/fx_basic.h"
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 baseType off_right, 293 baseType off_right,
294 baseType off_bottom) { 294 baseType off_bottom) {
295 left += off_left; 295 left += off_left;
296 top += off_top; 296 top += off_top;
297 width -= off_left + off_right; 297 width -= off_left + off_right;
298 height -= off_top + off_bottom; 298 height -= off_top + off_bottom;
299 } 299 }
300 void Deflate(const FXT_RECT& rt) { 300 void Deflate(const FXT_RECT& rt) {
301 Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height); 301 Deflate(rt.left, rt.top, rt.top + rt.width, rt.top + rt.height);
302 } 302 }
303 FX_BOOL IsEmpty() const { return width <= 0 || height <= 0; } 303 bool IsEmpty() const { return width <= 0 || height <= 0; }
304 FX_BOOL IsEmpty(FX_FLOAT fEpsilon) const { 304 bool IsEmpty(FX_FLOAT fEpsilon) const {
305 return width <= fEpsilon || height <= fEpsilon; 305 return width <= fEpsilon || height <= fEpsilon;
306 } 306 }
307 void Empty() { width = height = 0; } 307 void Empty() { width = height = 0; }
308 bool Contains(baseType x, baseType y) const { 308 bool Contains(baseType x, baseType y) const {
309 return x >= left && x < left + width && y >= top && y < top + height; 309 return x >= left && x < left + width && y >= top && y < top + height;
310 } 310 }
311 bool Contains(const FXT_POINT& p) const { return Contains(p.x, p.y); } 311 bool Contains(const FXT_POINT& p) const { return Contains(p.x, p.y); }
312 bool Contains(const FXT_RECT& rt) const { 312 bool Contains(const FXT_RECT& rt) const {
313 return rt.left >= left && rt.right() <= right() && rt.top >= top && 313 return rt.left >= left && rt.right() <= right() && rt.top >= top &&
314 rt.bottom() <= bottom(); 314 rt.bottom() <= bottom();
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 left = rt.left; 403 left = rt.left;
404 if (r > rt.right()) 404 if (r > rt.right())
405 r = rt.right(); 405 r = rt.right();
406 if (top < rt.top) 406 if (top < rt.top)
407 top = rt.top; 407 top = rt.top;
408 if (b > rt.bottom()) 408 if (b > rt.bottom())
409 b = rt.bottom(); 409 b = rt.bottom();
410 width = r - left; 410 width = r - left;
411 height = b - top; 411 height = b - top;
412 } 412 }
413 FX_BOOL IntersectWith(const FXT_RECT& rt) const { 413 bool IntersectWith(const FXT_RECT& rt) const {
414 FXT_RECT rect = rt; 414 FXT_RECT rect = rt;
415 rect.Intersect(*this); 415 rect.Intersect(*this);
416 return !rect.IsEmpty(); 416 return !rect.IsEmpty();
417 } 417 }
418 FX_BOOL IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const { 418 bool IntersectWith(const FXT_RECT& rt, FX_FLOAT fEpsilon) const {
419 FXT_RECT rect = rt; 419 FXT_RECT rect = rt;
420 rect.Intersect(*this); 420 rect.Intersect(*this);
421 return !rect.IsEmpty(fEpsilon); 421 return !rect.IsEmpty(fEpsilon);
422 } 422 }
423 friend bool operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) { 423 friend bool operator==(const FXT_RECT& rc1, const FXT_RECT& rc2) {
424 return rc1.left == rc2.left && rc1.top == rc2.top && 424 return rc1.left == rc2.left && rc1.top == rc2.top &&
425 rc1.width == rc2.width && rc1.height == rc2.height; 425 rc1.width == rc2.width && rc1.height == rc2.height;
426 } 426 }
427 friend bool operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) { 427 friend bool operator!=(const FXT_RECT& rc1, const FXT_RECT& rc2) {
428 return !(rc1 == rc2); 428 return !(rc1 == rc2);
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 } 581 }
582 582
583 void SetReverse(const CFX_Matrix& m); 583 void SetReverse(const CFX_Matrix& m);
584 584
585 void Concat(FX_FLOAT a, 585 void Concat(FX_FLOAT a,
586 FX_FLOAT b, 586 FX_FLOAT b,
587 FX_FLOAT c, 587 FX_FLOAT c,
588 FX_FLOAT d, 588 FX_FLOAT d,
589 FX_FLOAT e, 589 FX_FLOAT e,
590 FX_FLOAT f, 590 FX_FLOAT f,
591 FX_BOOL bPrepended = FALSE); 591 bool bPrepended = false);
592 void Concat(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); 592 void Concat(const CFX_Matrix& m, bool bPrepended = false);
593 void ConcatInverse(const CFX_Matrix& m, FX_BOOL bPrepended = FALSE); 593 void ConcatInverse(const CFX_Matrix& m, bool bPrepended = false);
594 594
595 FX_BOOL IsIdentity() const { 595 bool IsIdentity() const {
596 return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0; 596 return a == 1 && b == 0 && c == 0 && d == 1 && e == 0 && f == 0;
597 } 597 }
598 598
599 FX_BOOL IsInvertible() const; 599 bool IsInvertible() const;
600 FX_BOOL Is90Rotated() const; 600 bool Is90Rotated() const;
601 FX_BOOL IsScaled() const; 601 bool IsScaled() const;
602 602
603 void Translate(FX_FLOAT x, FX_FLOAT y, FX_BOOL bPrepended = FALSE); 603 void Translate(FX_FLOAT x, FX_FLOAT y, bool bPrepended = false);
604 void TranslateI(int32_t x, int32_t y, FX_BOOL bPrepended = FALSE) { 604 void TranslateI(int32_t x, int32_t y, bool bPrepended = false) {
605 Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended); 605 Translate((FX_FLOAT)x, (FX_FLOAT)y, bPrepended);
606 } 606 }
607 607
608 void Scale(FX_FLOAT sx, FX_FLOAT sy, FX_BOOL bPrepended = FALSE); 608 void Scale(FX_FLOAT sx, FX_FLOAT sy, bool bPrepended = false);
609 void Rotate(FX_FLOAT fRadian, FX_BOOL bPrepended = FALSE); 609 void Rotate(FX_FLOAT fRadian, bool bPrepended = false);
610 void RotateAt(FX_FLOAT fRadian, 610 void RotateAt(FX_FLOAT fRadian,
611 FX_FLOAT x, 611 FX_FLOAT x,
612 FX_FLOAT y, 612 FX_FLOAT y,
613 FX_BOOL bPrepended = FALSE); 613 bool bPrepended = false);
614 614
615 void Shear(FX_FLOAT fAlphaRadian, 615 void Shear(FX_FLOAT fAlphaRadian,
616 FX_FLOAT fBetaRadian, 616 FX_FLOAT fBetaRadian,
617 FX_BOOL bPrepended = FALSE); 617 bool bPrepended = false);
618 618
619 void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src); 619 void MatchRect(const CFX_FloatRect& dest, const CFX_FloatRect& src);
620 FX_FLOAT GetXUnit() const; 620 FX_FLOAT GetXUnit() const;
621 FX_FLOAT GetYUnit() const; 621 FX_FLOAT GetYUnit() const;
622 void GetUnitRect(CFX_RectF& rect) const; 622 void GetUnitRect(CFX_RectF& rect) const;
623 CFX_FloatRect GetUnitRect() const; 623 CFX_FloatRect GetUnitRect() const;
624 624
625 FX_FLOAT GetUnitArea() const; 625 FX_FLOAT GetUnitArea() const;
626 FX_FLOAT TransformXDistance(FX_FLOAT dx) const; 626 FX_FLOAT TransformXDistance(FX_FLOAT dx) const;
627 int32_t TransformXDistance(int32_t dx) const; 627 int32_t TransformXDistance(int32_t dx) const;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 public: 662 public:
663 FX_FLOAT a; 663 FX_FLOAT a;
664 FX_FLOAT b; 664 FX_FLOAT b;
665 FX_FLOAT c; 665 FX_FLOAT c;
666 FX_FLOAT d; 666 FX_FLOAT d;
667 FX_FLOAT e; 667 FX_FLOAT e;
668 FX_FLOAT f; 668 FX_FLOAT f;
669 }; 669 };
670 670
671 #endif // CORE_FXCRT_FX_COORDINATES_H_ 671 #endif // CORE_FXCRT_FX_COORDINATES_H_
OLDNEW
« no previous file with comments | « core/fxcrt/fx_basic_wstring.cpp ('k') | core/fxcrt/fx_ext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698