OLD | NEW |
1 | 1 |
2 //---------------------------------------------------------------------------- | 2 //---------------------------------------------------------------------------- |
3 // Anti-Grain Geometry - Version 2.3 | 3 // Anti-Grain Geometry - Version 2.3 |
4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) | 4 // Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com) |
5 // | 5 // |
6 // Permission to copy, use, modify, sell and distribute this software | 6 // Permission to copy, use, modify, sell and distribute this software |
7 // is granted provided this copyright notice appears in all copies. | 7 // is granted provided this copyright notice appears in all copies. |
8 // This software is provided "as is" without express or implied | 8 // This software is provided "as is" without express or implied |
9 // warranty, and with no claim as to its suitability for any purpose. | 9 // warranty, and with no claim as to its suitability for any purpose. |
10 // | 10 // |
(...skipping 28 matching lines...) Expand all Loading... |
39 { | 39 { |
40 enum poly_base_scale_e { | 40 enum poly_base_scale_e { |
41 poly_base_shift = 8, | 41 poly_base_shift = 8, |
42 poly_base_size = 1 << poly_base_shift, | 42 poly_base_size = 1 << poly_base_shift, |
43 poly_base_mask = poly_base_size - 1 | 43 poly_base_mask = poly_base_size - 1 |
44 }; | 44 }; |
45 inline int poly_coord(FX_FLOAT c) | 45 inline int poly_coord(FX_FLOAT c) |
46 { | 46 { |
47 return int(c * poly_base_size); | 47 return int(c * poly_base_size); |
48 } | 48 } |
49 struct cell_aa : public CFX_Object { | 49 struct cell_aa { |
50 int x; | 50 int x; |
51 int y; | 51 int y; |
52 int cover; | 52 int cover; |
53 int area; | 53 int area; |
54 void set(int x, int y, int c, int a); | 54 void set(int x, int y, int c, int a); |
55 void set_coord(int x, int y); | 55 void set_coord(int x, int y); |
56 void set_cover(int c, int a); | 56 void set_cover(int c, int a); |
57 void add_cover(int c, int a); | 57 void add_cover(int c, int a); |
58 }; | 58 }; |
59 class outline_aa : public CFX_Object | 59 class outline_aa |
60 { | 60 { |
61 enum cell_block_scale_e { | 61 enum cell_block_scale_e { |
62 cell_block_shift = 12, | 62 cell_block_shift = 12, |
63 cell_block_size = 1 << cell_block_shift, | 63 cell_block_size = 1 << cell_block_shift, |
64 cell_block_mask = cell_block_size - 1, | 64 cell_block_mask = cell_block_size - 1, |
65 cell_block_pool = 256, | 65 cell_block_pool = 256, |
66 cell_block_limit = 1024 | 66 cell_block_limit = 1024 |
67 }; | 67 }; |
68 struct sorted_y : public CFX_Object { | 68 struct sorted_y { |
69 unsigned start; | 69 unsigned start; |
70 unsigned num; | 70 unsigned num; |
71 }; | 71 }; |
72 public: | 72 public: |
73 ~outline_aa(); | 73 ~outline_aa(); |
74 outline_aa(); | 74 outline_aa(); |
75 void reset(); | 75 void reset(); |
76 void move_to(int x, int y); | 76 void move_to(int x, int y); |
77 void line_to(int x, int y); | 77 void line_to(int x, int y); |
78 int min_x() const | 78 int min_x() const |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 pod_array<sorted_y> m_sorted_y; | 127 pod_array<sorted_y> m_sorted_y; |
128 cell_aa m_cur_cell; | 128 cell_aa m_cur_cell; |
129 int m_cur_x; | 129 int m_cur_x; |
130 int m_cur_y; | 130 int m_cur_y; |
131 int m_min_x; | 131 int m_min_x; |
132 int m_min_y; | 132 int m_min_y; |
133 int m_max_x; | 133 int m_max_x; |
134 int m_max_y; | 134 int m_max_y; |
135 bool m_sorted; | 135 bool m_sorted; |
136 }; | 136 }; |
137 class scanline_hit_test : public CFX_Object | 137 class scanline_hit_test |
138 { | 138 { |
139 public: | 139 public: |
140 scanline_hit_test(int x) : m_x(x), m_hit(false) {} | 140 scanline_hit_test(int x) : m_x(x), m_hit(false) {} |
141 void reset_spans() {} | 141 void reset_spans() {} |
142 void finalize(int) {} | 142 void finalize(int) {} |
143 void add_cell(int x, int) | 143 void add_cell(int x, int) |
144 { | 144 { |
145 if(m_x == x) { | 145 if(m_x == x) { |
146 m_hit = true; | 146 m_hit = true; |
147 } | 147 } |
(...skipping 13 matching lines...) Expand all Loading... |
161 return m_hit; | 161 return m_hit; |
162 } | 162 } |
163 private: | 163 private: |
164 int m_x; | 164 int m_x; |
165 bool m_hit; | 165 bool m_hit; |
166 }; | 166 }; |
167 enum filling_rule_e { | 167 enum filling_rule_e { |
168 fill_non_zero, | 168 fill_non_zero, |
169 fill_even_odd | 169 fill_even_odd |
170 }; | 170 }; |
171 class rasterizer_scanline_aa : public CFX_Object | 171 class rasterizer_scanline_aa |
172 { | 172 { |
173 enum status { | 173 enum status { |
174 status_initial, | 174 status_initial, |
175 status_line_to, | 175 status_line_to, |
176 status_closed | 176 status_closed |
177 }; | 177 }; |
178 public: | 178 public: |
179 enum aa_scale_e { | 179 enum aa_scale_e { |
180 aa_num = 1 << 8, | 180 aa_num = 1 << 8, |
181 aa_mask = aa_num - 1, | 181 aa_mask = aa_num - 1, |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 int m_prev_x; | 463 int m_prev_x; |
464 int m_prev_y; | 464 int m_prev_y; |
465 unsigned m_prev_flags; | 465 unsigned m_prev_flags; |
466 unsigned m_status; | 466 unsigned m_status; |
467 rect m_clip_box; | 467 rect m_clip_box; |
468 bool m_clipping; | 468 bool m_clipping; |
469 int m_cur_y; | 469 int m_cur_y; |
470 }; | 470 }; |
471 } | 471 } |
472 #endif | 472 #endif |
OLD | NEW |