OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkRect.h" | 10 #include "SkRect.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 a.fTop < b.fBottom && b.fTop < a.fBottom) { | 139 a.fTop < b.fBottom && b.fTop < a.fBottom) { |
140 fLeft = SkMaxScalar(a.fLeft, b.fLeft); | 140 fLeft = SkMaxScalar(a.fLeft, b.fLeft); |
141 fTop = SkMaxScalar(a.fTop, b.fTop); | 141 fTop = SkMaxScalar(a.fTop, b.fTop); |
142 fRight = SkMinScalar(a.fRight, b.fRight); | 142 fRight = SkMinScalar(a.fRight, b.fRight); |
143 fBottom = SkMinScalar(a.fBottom, b.fBottom); | 143 fBottom = SkMinScalar(a.fBottom, b.fBottom); |
144 return true; | 144 return true; |
145 } | 145 } |
146 return false; | 146 return false; |
147 } | 147 } |
148 | 148 |
149 void SkRect::join(SkScalar left, SkScalar top, SkScalar right, | 149 void SkRect::join(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom)
{ |
150 SkScalar bottom) { | |
151 // do nothing if the params are empty | 150 // do nothing if the params are empty |
152 if (left >= right || top >= bottom) { | 151 if (left >= right || top >= bottom) { |
153 return; | 152 return; |
154 } | 153 } |
155 | 154 |
156 // if we are empty, just assign | 155 // if we are empty, just assign |
157 if (fLeft >= fRight || fTop >= fBottom) { | 156 if (fLeft >= fRight || fTop >= fBottom) { |
158 this->set(left, top, right, bottom); | 157 this->set(left, top, right, bottom); |
159 } else { | 158 } else { |
160 if (left < fLeft) fLeft = left; | 159 fLeft = SkMinScalar(fLeft, left); |
161 if (top < fTop) fTop = top; | 160 fTop = SkMinScalar(fTop, top); |
162 if (right > fRight) fRight = right; | 161 fRight = SkMaxScalar(fRight, right); |
163 if (bottom > fBottom) fBottom = bottom; | 162 fBottom = SkMaxScalar(fBottom, bottom); |
164 } | 163 } |
165 } | 164 } |
OLD | NEW |