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 | |
43 class SkScan { | 25 class SkScan { |
44 public: | 26 public: |
45 /* | 27 /* |
46 * Draws count-1 line segments, one at a time: | 28 * Draws count-1 line segments, one at a time: |
47 * line(pts[0], pts[1]) | 29 * line(pts[0], pts[1]) |
48 * line(pts[1], pts[2]) | 30 * line(pts[1], pts[2]) |
49 * line(......, pts[count - 1]) | 31 * line(......, pts[count - 1]) |
50 */ | 32 */ |
51 typedef void (*HairRgnProc)(const SkPoint[], int count, const SkRegion*, SkB
litter*); | 33 typedef void (*HairRgnProc)(const SkPoint[], int count, const SkRegion*, SkB
litter*); |
52 typedef void (*HairRCProc)(const SkPoint[], int count, const SkRasterClip&,
SkBlitter*); | 34 typedef void (*HairRCProc)(const SkPoint[], int count, const SkRasterClip&,
SkBlitter*); |
53 | 35 |
54 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); | 36 static void FillPath(const SkPath&, const SkIRect&, SkBlitter*); |
55 | 37 |
56 /////////////////////////////////////////////////////////////////////////// | 38 /////////////////////////////////////////////////////////////////////////// |
57 // rasterclip | 39 // rasterclip |
58 | 40 |
59 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); | 41 static void FillIRect(const SkIRect&, const SkRasterClip&, SkBlitter*); |
60 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 42 static void FillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
61 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 43 static void FillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
62 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 44 static void AntiFillRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
63 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); | 45 static void AntiFillXRect(const SkXRect&, const SkRasterClip&, SkBlitter*); |
64 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 46 static void FillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
65 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 47 static void AntiFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
66 static void AAAFillPath(const SkPath&, const SkRasterClip&, SkBlitter*); | |
67 static void FrameRect(const SkRect&, const SkPoint& strokeSize, | 48 static void FrameRect(const SkRect&, const SkPoint& strokeSize, |
68 const SkRasterClip&, SkBlitter*); | 49 const SkRasterClip&, SkBlitter*); |
69 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 50 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
70 const SkRasterClip&, SkBlitter*); | 51 const SkRasterClip&, SkBlitter*); |
71 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); | 52 static void FillTriangle(const SkPoint pts[], const SkRasterClip&, SkBlitter
*); |
72 static void HairLine(const SkPoint[], int count, const SkRasterClip&, SkBlit
ter*); | 53 static void HairLine(const SkPoint[], int count, const SkRasterClip&, SkBlit
ter*); |
73 static void AntiHairLine(const SkPoint[], int count, const SkRasterClip&, Sk
Blitter*); | 54 static void AntiHairLine(const SkPoint[], int count, const SkRasterClip&, Sk
Blitter*); |
74 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 55 static void HairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
75 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); | 56 static void AntiHairRect(const SkRect&, const SkRasterClip&, SkBlitter*); |
76 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); | 57 static void HairPath(const SkPath&, const SkRasterClip&, SkBlitter*); |
(...skipping 14 matching lines...) Expand all Loading... |
91 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); | 72 static void AntiFillXRect(const SkXRect&, const SkRegion*, SkBlitter*); |
92 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); | 73 static void FillPath(const SkPath&, const SkRegion& clip, SkBlitter*); |
93 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, | 74 static void AntiFillPath(const SkPath&, const SkRegion& clip, SkBlitter*, |
94 bool forceRLE = false); | 75 bool forceRLE = false); |
95 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); | 76 static void FillTriangle(const SkPoint pts[], const SkRegion*, SkBlitter*); |
96 | 77 |
97 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, | 78 static void AntiFrameRect(const SkRect&, const SkPoint& strokeSize, |
98 const SkRegion*, SkBlitter*); | 79 const SkRegion*, SkBlitter*); |
99 static void HairLineRgn(const SkPoint[], int count, const SkRegion*, SkBlitt
er*); | 80 static void HairLineRgn(const SkPoint[], int count, const SkRegion*, SkBlitt
er*); |
100 static void AntiHairLineRgn(const SkPoint[], int count, const SkRegion*, SkB
litter*); | 81 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); | |
104 }; | 82 }; |
105 | 83 |
106 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates | 84 /** Assign an SkXRect from a SkIRect, by promoting the src rect's coordinates |
107 from int to SkFixed. Does not check for overflow if the src coordinates | 85 from int to SkFixed. Does not check for overflow if the src coordinates |
108 exceed 32K | 86 exceed 32K |
109 */ | 87 */ |
110 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { | 88 static inline void XRect_set(SkXRect* xr, const SkIRect& src) { |
111 xr->fLeft = SkIntToFixed(src.fLeft); | 89 xr->fLeft = SkIntToFixed(src.fLeft); |
112 xr->fTop = SkIntToFixed(src.fTop); | 90 xr->fTop = SkIntToFixed(src.fTop); |
113 xr->fRight = SkIntToFixed(src.fRight); | 91 xr->fRight = SkIntToFixed(src.fRight); |
(...skipping 24 matching lines...) Expand all Loading... |
138 for right/bottom), and store the result in the SkIRect. | 116 for right/bottom), and store the result in the SkIRect. |
139 */ | 117 */ |
140 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { | 118 static inline void XRect_roundOut(const SkXRect& xr, SkIRect* dst) { |
141 dst->fLeft = SkFixedFloorToInt(xr.fLeft); | 119 dst->fLeft = SkFixedFloorToInt(xr.fLeft); |
142 dst->fTop = SkFixedFloorToInt(xr.fTop); | 120 dst->fTop = SkFixedFloorToInt(xr.fTop); |
143 dst->fRight = SkFixedCeilToInt(xr.fRight); | 121 dst->fRight = SkFixedCeilToInt(xr.fRight); |
144 dst->fBottom = SkFixedCeilToInt(xr.fBottom); | 122 dst->fBottom = SkFixedCeilToInt(xr.fBottom); |
145 } | 123 } |
146 | 124 |
147 #endif | 125 #endif |
OLD | NEW |