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 19 matching lines...) Expand all Loading... |
30 if (fLeft > fRight) { | 30 if (fLeft > fRight) { |
31 SkTSwap<int32_t>(fLeft, fRight); | 31 SkTSwap<int32_t>(fLeft, fRight); |
32 } | 32 } |
33 if (fTop > fBottom) { | 33 if (fTop > fBottom) { |
34 SkTSwap<int32_t>(fTop, fBottom); | 34 SkTSwap<int32_t>(fTop, fBottom); |
35 } | 35 } |
36 } | 36 } |
37 | 37 |
38 ///////////////////////////////////////////////////////////////////////////// | 38 ///////////////////////////////////////////////////////////////////////////// |
39 | 39 |
40 void SkRect::sort() { | |
41 if (fLeft > fRight) { | |
42 SkTSwap<SkScalar>(fLeft, fRight); | |
43 } | |
44 if (fTop > fBottom) { | |
45 SkTSwap<SkScalar>(fTop, fBottom); | |
46 } | |
47 } | |
48 | |
49 void SkRect::toQuad(SkPoint quad[4]) const { | 40 void SkRect::toQuad(SkPoint quad[4]) const { |
50 SkASSERT(quad); | 41 SkASSERT(quad); |
51 | 42 |
52 quad[0].set(fLeft, fTop); | 43 quad[0].set(fLeft, fTop); |
53 quad[1].set(fRight, fTop); | 44 quad[1].set(fRight, fTop); |
54 quad[2].set(fRight, fBottom); | 45 quad[2].set(fRight, fBottom); |
55 quad[3].set(fLeft, fBottom); | 46 quad[3].set(fLeft, fBottom); |
56 } | 47 } |
57 | 48 |
58 bool SkRect::setBoundsCheck(const SkPoint pts[], int count) { | 49 bool SkRect::setBoundsCheck(const SkPoint pts[], int count) { |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 if (fLeft >= fRight || fTop >= fBottom) { | 123 if (fLeft >= fRight || fTop >= fBottom) { |
133 this->set(left, top, right, bottom); | 124 this->set(left, top, right, bottom); |
134 } else { | 125 } else { |
135 fLeft = SkMinScalar(fLeft, left); | 126 fLeft = SkMinScalar(fLeft, left); |
136 fTop = SkMinScalar(fTop, top); | 127 fTop = SkMinScalar(fTop, top); |
137 fRight = SkMaxScalar(fRight, right); | 128 fRight = SkMaxScalar(fRight, right); |
138 fBottom = SkMaxScalar(fBottom, bottom); | 129 fBottom = SkMaxScalar(fBottom, bottom); |
139 } | 130 } |
140 } | 131 } |
141 | 132 |
OLD | NEW |