OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 The Android Open Source Project | 2 * Copyright 2011 The Android Open Source Project |
3 * | 3 * |
4 * 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 |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 | 8 |
9 #ifndef SkScan_DEFINED | 9 #ifndef SkScan_DEFINED |
10 #define SkScan_DEFINED | 10 #define SkScan_DEFINED |
11 | 11 |
12 #include "SkFixed.h" | 12 #include "SkFixed.h" |
13 #include "SkRect.h" | 13 #include "SkRect.h" |
14 | 14 |
15 class SkRasterClip; | 15 class SkRasterClip; |
16 class SkRegion; | 16 class SkRegion; |
17 class SkBlitter; | 17 class SkBlitter; |
18 class SkPath; | 18 class SkPath; |
19 | 19 |
20 /** Defines a fixed-point rectangle, identical to the integer SkIRect, but its | 20 /** Defines a fixed-point rectangle, identical to the integer SkIRect, but its |
21 coordinates are treated as SkFixed rather than int32_t. | 21 coordinates are treated as SkFixed rather than int32_t. |
22 */ | 22 */ |
23 typedef SkIRect SkXRect; | 23 typedef SkIRect SkXRect; |
24 | 24 |
| 25 class GlobalAAConfig { |
| 26 private: |
| 27 GlobalAAConfig() {} |
| 28 |
| 29 public: |
| 30 bool fUseAnalyticAA = false; |
| 31 |
| 32 GlobalAAConfig(const GlobalAAConfig&) = delete; |
| 33 void operator=(const GlobalAAConfig&) = delete; |
| 34 |
| 35 static GlobalAAConfig& getInstance() { |
| 36 static GlobalAAConfig instance; |
| 37 return instance; |
| 38 } |
| 39 }; |
| 40 |
| 41 class AdditiveBlitter; |
| 42 |
25 class SkScan { | 43 class SkScan { |
26 public: | 44 public: |
27 /* | 45 /* |
28 * Draws count-1 line segments, one at a time: | 46 * Draws count-1 line segments, one at a time: |
29 * line(pts[0], pts[1]) | 47 * line(pts[0], pts[1]) |
30 * line(pts[1], pts[2]) | 48 * line(pts[1], pts[2]) |
31 * line(......, pts[count - 1]) | 49 * line(......, pts[count - 1]) |
32 */ | 50 */ |
33 typedef void (*HairRgnProc)(const SkPoint[], int count, const SkRegion*, SkB
litter*); | 51 typedef void (*HairRgnProc)(const SkPoint[], int count, const SkRegion*, SkB
litter*); |
34 typedef void (*HairRCProc)(const SkPoint[], int count, const SkRasterClip&,
SkBlitter*); | 52 typedef void (*HairRCProc)(const SkPoint[], int count, const SkRasterClip&,
SkBlitter*); |
35 | 53 |
36 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); | 54 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); |
37 | 55 |
38 /////////////////////////////////////////////////////////////////////////// | 56 /////////////////////////////////////////////////////////////////////////// |
39 // rasterclip | 57 // rasterclip |
40 | 58 |
41 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); | 59 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); |
42 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 60 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
43 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 61 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
44 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 62 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
45 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 63 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
46 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 64 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
47 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 65 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
| 66 static void AAAFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
48 static void FrameRect(const SkRect&, const SkPoint& strokeSize, | 67 static void FrameRect(const SkRect&, const SkPoint& strokeSize, |
49 const SkRasterClip&, SkBlitter*); | 68 const SkRasterClip&, SkBlitter*); |
50 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 69 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
51 const SkRasterClip&, SkBlitter*); | 70 const SkRasterClip&, SkBlitter*); |
52 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); | 71 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); |
53 static void HairLine(const SkPoint[], int count, const SkRasterClip&, SkBlit
ter*); | 72 static void HairLine(const SkPoint[], int count, const SkRasterClip&, SkBlit
ter*); |
54 static void AntiHairLine(const SkPoint[], int count, const SkRasterClip&, Sk
Blitter*); | 73 static void AntiHairLine(const SkPoint[], int count, const SkRasterClip&, Sk
Blitter*); |
55 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 74 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
56 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 75 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
57 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 76 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
(...skipping 14 matching lines...) Expand all Loading... |
72 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); | 91 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); |
73 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); | 92 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); |
74 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, | 93 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, |
75 bool forceRLE = false); | 94 bool forceRLE = false); |
76 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); | 95 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); |
77 | 96 |
78 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 97 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
79 const SkRegion*, SkBlitter*); | 98 const SkRegion*, SkBlitter*); |
80 static void HairLineRgn(const SkPoint[], int count, const SkRegion*, SkBlitt
er*); | 99 static void HairLineRgn(const SkPoint[], int count, const SkRegion*, SkBlitt
er*); |
81 static void AntiHairLineRgn(const SkPoint[], int count, const SkRegion*, SkB
litter*); | 100 static void AntiHairLineRgn(const SkPoint[], int count, const SkRegion*, SkB
litter*); |
| 101 static void AAAFillPath(const SkPath& path, const SkRegion& origClip, SkBlit
ter* blitter); |
| 102 static void aaa_fill_path(const SkPath& path, const SkIRect* clipRect, Addit
iveBlitter*, |
| 103 int start_y, int stop_y, const SkRegion& clipRgn, bool isUsin
gMask); |
82 }; | 104 }; |
83 | 105 |
84 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates | 106 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates |
85 from int to SkFixed. Does not check for overflow if the src coordinates | 107 from int to SkFixed. Does not check for overflow if the src coordinates |
86 exceed 32K | 108 exceed 32K |
87 */ | 109 */ |
88 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { | 110 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { |
89 xr->fLeft = SkIntToFixed(src.fLeft); | 111 xr->fLeft = SkIntToFixed(src.fLeft); |
90 xr->fTop = SkIntToFixed(src.fTop); | 112 xr->fTop = SkIntToFixed(src.fTop); |
91 xr->fRight = SkIntToFixed(src.fRight); | 113 xr->fRight = SkIntToFixed(src.fRight); |
(...skipping 24 matching lines...) Expand all Loading... |
116 for right/bottom), and store the result in the SkIRect. | 138 for right/bottom), and store the result in the SkIRect. |
117 */ | 139 */ |
118 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { | 140 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { |
119 dst->fLeft = SkFixedFloorToInt(xr.fLeft); | 141 dst->fLeft = SkFixedFloorToInt(xr.fLeft); |
120 dst->fTop = SkFixedFloorToInt(xr.fTop); | 142 dst->fTop = SkFixedFloorToInt(xr.fTop); |
121 dst->fRight = SkFixedCeilToInt(xr.fRight); | 143 dst->fRight = SkFixedCeilToInt(xr.fRight); |
122 dst->fBottom = SkFixedCeilToInt(xr.fBottom); | 144 dst->fBottom = SkFixedCeilToInt(xr.fBottom); |
123 } | 145 } |
124 | 146 |
125 #endif | 147 #endif |
OLD | NEW |