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

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

Issue 936943002: Pass clip to context (Closed) Base URL: https://skia.googlesource.com/skia.git@pass_down_rendertarget
Patch Set: feedback inc Created 5 years, 10 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
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 /**
787 * Set the dst rectangle by rounding this rectangle's coordinates to their 797 * Set the dst rectangle by rounding this rectangle's coordinates to their
788 * nearest integer values using SkScalarRoundToInt. 798 * nearest integer values using SkScalarRoundToInt.
789 */ 799 */
790 void round(SkIRect* dst) const { 800 void round(SkIRect* dst) const {
791 SkASSERT(dst); 801 SkASSERT(dst);
792 dst->set(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), 802 dst->set(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop),
793 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)); 803 SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom));
794 } 804 }
795 805
796 /** 806 /**
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 void dumpHex() const { this->dump(true); } 896 void dumpHex() const { this->dump(true); }
887 }; 897 };
888 898
889 inline bool SkIRect::contains(const SkRect& r) const { 899 inline bool SkIRect::contains(const SkRect& r) const {
890 return !r.isEmpty() && !this->isEmpty() && // check for empties 900 return !r.isEmpty() && !this->isEmpty() && // check for empties
891 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && 901 (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop &&
892 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; 902 (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom;
893 } 903 }
894 904
895 #endif 905 #endif
OLDNEW
« no previous file with comments | « include/core/SkMaskFilter.h ('k') | include/gpu/GrClip.h » ('j') | src/gpu/GrTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698