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

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

Issue 956083002: Revert of Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: Created 5 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/SkMaskFilter.h ('k') | include/gpu/GrClip.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 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 * not empty. 777 * not empty.
778 */ 778 */
779 bool contains(const SkRect& r) const { 779 bool contains(const SkRect& r) const {
780 // todo: can we eliminate the this->isEmpty check? 780 // todo: can we eliminate the this->isEmpty check?
781 return !r.isEmpty() && !this->isEmpty() && 781 return !r.isEmpty() && !this->isEmpty() &&
782 fLeft <= r.fLeft && fTop <= r.fTop && 782 fLeft <= r.fLeft && fTop <= r.fTop &&
783 fRight >= r.fRight && fBottom >= r.fBottom; 783 fRight >= r.fRight && fBottom >= r.fBottom;
784 } 784 }
785 785
786 /** 786 /**
787 * Returns true if the specified rectangle r is inside or equal to this rect angle.
788 */
789 bool contains(const SkIRect& r) const {
790 // todo: can we eliminate the this->isEmpty check?
791 return !r.isEmpty() && !this->isEmpty() &&
792 fLeft <= SkIntToScalar(r.fLeft) && fTop <= SkIntToScalar(r.fTop) &&
793 fRight >= SkIntToScalar(r.fRight) && fBottom >= SkIntToScalar(r. fBottom);
794 }
795
796 /**
797 * Set the dst rectangle by rounding this rectangle's coordinates to their 787 * Set the dst rectangle by rounding this rectangle's coordinates to their
798 * nearest integer values using SkScalarRoundToInt. 788 * nearest integer values using SkScalarRoundToInt.
799 */ 789 */
800 void round(SkIRect* dst) const { 790 void round(SkIRect* dst) const {
801 SkASSERT(dst); 791 SkASSERT(dst);
802 dst->set(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), 792 dst->set(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
803 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)); 793 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom));
804 } 794 }
805 795
806 /** 796 /**
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
896 void dumpHex() const { this->dump(true); } 886 void dumpHex() const { this->dump(true); }
897 }; 887 };
898 888
899 inline bool SkIRect::contains(const SkRect& r) const { 889 inline bool SkIRect::contains(const SkRect& r) const {
900 return !r.isEmpty() && !this->isEmpty() && // check for empties 890 return !r.isEmpty() && !this->isEmpty() && // check for empties
901 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && 891 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
902 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; 892 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
903 } 893 }
904 894
905 #endif 895 #endif
OLDNEW
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | include/gpu/GrClip.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698