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

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

Issue 1548643002: revised strokerect gm (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: handle halfway case in scan converter Created 5 years 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 | « gm/strokerect.cpp ('k') | include/core/SkScalar.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 /* 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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 * 831 *
832 * e.g. 832 * e.g.
833 * SkScalar x = 0.49999997f; 833 * SkScalar x = 0.49999997f;
834 * int ix = SkScalarRoundToInt(x); 834 * int ix = SkScalarRoundToInt(x);
835 * SkASSERT(0 == ix); // <--- fails 835 * SkASSERT(0 == ix); // <--- fails
836 * ix = SkDScalarRoundToInt(x); 836 * ix = SkDScalarRoundToInt(x);
837 * SkASSERT(0 == ix); // <--- succeeds 837 * SkASSERT(0 == ix); // <--- succeeds
838 */ 838 */
839 void dround(SkIRect* dst) const { 839 void dround(SkIRect* dst) const {
840 SkASSERT(dst); 840 SkASSERT(dst);
841 dst->set(SkDScalarRoundToInt(fLeft), SkDScalarRoundToInt(fTop), 841 dst->set(SkDScalarRoundDownToInt(fLeft), SkDScalarRoundDownToInt(fTop),
842 SkDScalarRoundToInt(fRight), SkDScalarRoundToInt(fBottom)); 842 SkDScalarRoundToInt(fRight), SkDScalarRoundToInt(fBottom));
843 } 843 }
844 844
845 /** 845 /**
846 * Set the dst rectangle by rounding "out" this rectangle, choosing the 846 * Set the dst rectangle by rounding "out" this rectangle, choosing the
847 * SkScalarFloor of top and left, and the SkScalarCeil of right and bottom. 847 * SkScalarFloor of top and left, and the SkScalarCeil of right and bottom.
848 */ 848 */
849 void roundOut(SkIRect* dst) const { 849 void roundOut(SkIRect* dst) const {
850 SkASSERT(dst); 850 SkASSERT(dst);
851 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), 851 dst->set(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop),
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 void dumpHex() const { this->dump(true); } 917 void dumpHex() const { this->dump(true); }
918 }; 918 };
919 919
920 inline bool SkIRect::contains(const SkRect& r) const { 920 inline bool SkIRect::contains(const SkRect& r) const {
921 return !r.isEmpty() && !this->isEmpty() && // check for empties 921 return !r.isEmpty() && !this->isEmpty() && // check for empties
922 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && 922 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
923 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; 923 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
924 } 924 }
925 925
926 #endif 926 #endif
OLDNEW
« no previous file with comments | « gm/strokerect.cpp ('k') | include/core/SkScalar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698