OLD | NEW |
1 | |
2 /* | 1 /* |
3 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 The Android Open Source Project |
4 * | 3 * |
5 * 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 |
6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
7 */ | 6 */ |
8 | 7 |
9 | |
10 #include "SkQuadClipper.h" | 8 #include "SkQuadClipper.h" |
11 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
12 | 10 |
13 static inline void clamp_le(SkScalar& value, SkScalar max) { | |
14 if (value > max) { | |
15 value = max; | |
16 } | |
17 } | |
18 | |
19 static inline void clamp_ge(SkScalar& value, SkScalar min) { | |
20 if (value < min) { | |
21 value = min; | |
22 } | |
23 } | |
24 | |
25 SkQuadClipper::SkQuadClipper() { | 11 SkQuadClipper::SkQuadClipper() { |
26 fClip.setEmpty(); | 12 fClip.setEmpty(); |
27 } | 13 } |
28 | 14 |
29 void SkQuadClipper::setClip(const SkIRect& clip) { | 15 void SkQuadClipper::setClip(const SkIRect& clip) { |
30 // conver to scalars, since that's where we'll see the points | 16 // conver to scalars, since that's where we'll see the points |
31 fClip.set(clip); | 17 fClip.set(clip); |
32 } | 18 } |
33 | 19 |
34 /////////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 } | 105 } |
120 } | 106 } |
121 } | 107 } |
122 } | 108 } |
123 | 109 |
124 if (reverse) { | 110 if (reverse) { |
125 SkTSwap<SkPoint>(dst[0], dst[2]); | 111 SkTSwap<SkPoint>(dst[0], dst[2]); |
126 } | 112 } |
127 return true; | 113 return true; |
128 } | 114 } |
OLD | NEW |