OLD | NEW |
| (Empty) |
1 /* libs/graphics/sgl/SkScan.cpp | |
2 ** | |
3 ** Copyright 2006, The Android Open Source Project | |
4 ** | |
5 ** Licensed under the Apache License, Version 2.0 (the "License"); | |
6 ** you may not use this file except in compliance with the License. | |
7 ** You may obtain a copy of the License at | |
8 ** | |
9 ** http://www.apache.org/licenses/LICENSE-2.0 | |
10 ** | |
11 ** Unless required by applicable law or agreed to in writing, software | |
12 ** distributed under the License is distributed on an "AS IS" BASIS, | |
13 ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
14 ** See the License for the specific language governing permissions and | |
15 ** limitations under the License. | |
16 */ | |
17 | |
18 #include "SkScan.h" | |
19 #include "SkBlitter.h" | |
20 #include "SkRegion.h" | |
21 | |
22 static inline void blitrect(SkBlitter* blitter, const SkIRect& r) { | |
23 blitter->blitRect(r.fLeft, r.fTop, r.width(), r.height()); | |
24 } | |
25 | |
26 void SkScan::FillIRect(const SkIRect& r, const SkRegion* clip, | |
27 SkBlitter* blitter) { | |
28 if (!r.isEmpty()) { | |
29 if (clip) { | |
30 if (clip->isRect()) { | |
31 const SkIRect& clipBounds = clip->getBounds(); | |
32 | |
33 if (clipBounds.contains(r)) { | |
34 blitrect(blitter, r); | |
35 } else { | |
36 SkIRect rr = r; | |
37 if (rr.intersect(clipBounds)) { | |
38 blitrect(blitter, rr); | |
39 } | |
40 } | |
41 } else { | |
42 SkRegion::Cliperator cliper(*clip, r); | |
43 const SkIRect& rr = cliper.rect(); | |
44 | |
45 while (!cliper.done()) { | |
46 blitrect(blitter, rr); | |
47 cliper.next(); | |
48 } | |
49 } | |
50 } else { | |
51 blitrect(blitter, r); | |
52 } | |
53 } | |
54 } | |
55 | |
56 void SkScan::FillXRect(const SkXRect& xr, const SkRegion* clip, | |
57 SkBlitter* blitter) { | |
58 SkIRect r; | |
59 | |
60 XRect_round(xr, &r); | |
61 SkScan::FillIRect(r, clip, blitter); | |
62 } | |
63 | |
64 #ifdef SK_SCALAR_IS_FLOAT | |
65 | |
66 void SkScan::FillRect(const SkRect& r, const SkRegion* clip, | |
67 SkBlitter* blitter) { | |
68 SkIRect ir; | |
69 | |
70 r.round(&ir); | |
71 SkScan::FillIRect(ir, clip, blitter); | |
72 } | |
73 | |
74 #endif | |
75 | |
OLD | NEW |