Go to the source code of this file.
◆ CHECK_INTERSECT
#define CHECK_INTERSECT |
( |
|
al, |
|
|
|
at, |
|
|
|
ar, |
|
|
|
ab, |
|
|
|
bl, |
|
|
|
bt, |
|
|
|
br, |
|
|
|
bb |
|
) |
| |
Value:
do {
if (!(
L <
R &&
T <
B))
return false; }
while (0)
static float max(float r, float g, float b)
static float min(float r, float g, float b)
Definition at line 106 of file SkRect.cpp.
◆ set_scalar()
Definition at line 146 of file SkRect.cpp.
146 {
149 return storage->
c_str();
150}
void SkAppendScalar(SkString *str, SkScalar value, SkScalarAsStringType asType)
const char * c_str() const
◆ subtract()
static bool subtract |
( |
const R & |
a, |
|
|
const R & |
b, |
|
|
R * |
out |
|
) |
| |
|
static |
Definition at line 177 of file SkRect.cpp.
177 {
178 if (
a.isEmpty() ||
b.isEmpty() || !R::Intersects(
a,
b)) {
179
180
182 return true;
183 }
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204 float aHeight = (
float)
a.height();
205 float aWidth = (
float)
a.width();
206 float leftArea = 0.f, rightArea = 0.f, topArea = 0.f, bottomArea = 0.f;
207 int positiveCount = 0;
208 if (
b.fLeft >
a.fLeft) {
209 leftArea = (
b.fLeft -
a.fLeft) / aWidth;
210 positiveCount++;
211 }
212 if (
a.fRight >
b.fRight) {
213 rightArea = (
a.fRight -
b.fRight) / aWidth;
214 positiveCount++;
215 }
216 if (
b.fTop >
a.fTop) {
217 topArea = (
b.fTop -
a.fTop) / aHeight;
218 positiveCount++;
219 }
220 if (
a.fBottom >
b.fBottom) {
221 bottomArea = (
a.fBottom -
b.fBottom) / aHeight;
222 positiveCount++;
223 }
224
225 if (positiveCount == 0) {
227 *
out = R::MakeEmpty();
228 return true;
229 }
230
232 if (leftArea > rightArea && leftArea > topArea && leftArea > bottomArea) {
233
234 out->fRight =
b.fLeft;
235 } else if (rightArea > topArea && rightArea > bottomArea) {
236
237 out->fLeft =
b.fRight;
238 } else if (topArea > bottomArea) {
239
240 out->fBottom =
b.fTop;
241 } else {
242
244 out->fTop =
b.fBottom;
245 }
246
247
249 return positiveCount == 1;
250}