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

Side by Side Diff: include/core/SkRect.h

Issue 1683743005: Simple cleanups related to SkFixed. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Revert changes to src/core/SkScan_Hairline.cpp; causes one layout test to regress. Created 4 years, 9 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 | « include/core/SkFixed.h ('k') | samplecode/SampleText.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef SkRect_DEFINED 8 #ifndef SkRect_DEFINED
9 #define SkRect_DEFINED 9 #define SkRect_DEFINED
10 10
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 */ 456 */
457 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; } 457 bool isEmpty() const { return fLeft >= fRight || fTop >= fBottom; }
458 458
459 bool isLargest() const { return SK_ScalarMin == fLeft && 459 bool isLargest() const { return SK_ScalarMin == fLeft &&
460 SK_ScalarMin == fTop && 460 SK_ScalarMin == fTop &&
461 SK_ScalarMax == fRight && 461 SK_ScalarMax == fRight &&
462 SK_ScalarMax == fBottom; } 462 SK_ScalarMax == fBottom; }
463 463
464 /** 464 /**
465 * Returns true iff all values in the rect are finite. If any are 465 * Returns true iff all values in the rect are finite. If any are
466 * infinite or NaN (or SK_FixedNaN when SkScalar is fixed) then this 466 * infinite or NaN then this returns false.
467 * returns false.
468 */ 467 */
469 bool isFinite() const { 468 bool isFinite() const {
470 float accum = 0; 469 float accum = 0;
471 accum *= fLeft; 470 accum *= fLeft;
472 accum *= fTop; 471 accum *= fTop;
473 accum *= fRight; 472 accum *= fRight;
474 accum *= fBottom; 473 accum *= fBottom;
475 474
476 // accum is either NaN or it is finite (zero). 475 // accum is either NaN or it is finite (zero).
477 SkASSERT(0 == accum || SkScalarIsNaN(accum)); 476 SkASSERT(0 == accum || SkScalarIsNaN(accum));
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 void dumpHex() const { this->dump(true); } 898 void dumpHex() const { this->dump(true); }
900 }; 899 };
901 900
902 inline bool SkIRect::contains(const SkRect& r) const { 901 inline bool SkIRect::contains(const SkRect& r) const {
903 return !r.isEmpty() && !this->isEmpty() && // check for empties 902 return !r.isEmpty() && !this->isEmpty() && // check for empties
904 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && 903 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
905 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; 904 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
906 } 905 }
907 906
908 #endif 907 #endif
OLDNEW
« no previous file with comments | « include/core/SkFixed.h ('k') | samplecode/SampleText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698