2
2
// Anti-Grain Geometry - Version 2.4
3
3
// Copyright (C) 2002-2005 Maxim Shemanarev (http://www.antigrain.com)
4
4
//
5
- // Permission to copy, use, modify, sell and distribute this software
6
- // is granted provided this copyright notice appears in all copies.
5
+ // Permission to copy, use, modify, sell and distribute this software
6
+ // is granted provided this copyright notice appears in all copies.
7
7
// This software is provided "as is" without express or implied
8
8
// warranty, and with no claim as to its suitability for any purpose.
9
9
//
13
13
// http://www.antigrain.com
14
14
// ----------------------------------------------------------------------------
15
15
//
16
- // Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by
16
+ // Adaptation for 32-bit screen coordinates (scanline32_u) has been sponsored by
17
17
// Liberty Technology Systems, Inc., visit http://lib-sys.com
18
18
//
19
19
// Liberty Technology Systems, Inc. is the provider of
20
20
// PostScript and PDF technology for software developers.
21
- //
21
+ //
22
22
// ----------------------------------------------------------------------------
23
23
24
24
#ifndef AGG_SCANLINE_U_INCLUDED
@@ -32,22 +32,22 @@ namespace agg
32
32
//
33
33
// Unpacked scanline container class
34
34
//
35
- // This class is used to transfer data from a scanline rasterizer
36
- // to the rendering buffer. It's organized very simple. The class stores
37
- // information of horizontal spans to render it into a pixel-map buffer.
38
- // Each span has staring X, length, and an array of bytes that determine the
39
- // cover-values for each pixel.
40
- // Before using this class you should know the minimal and maximal pixel
35
+ // This class is used to transfer data from a scanline rasterizer
36
+ // to the rendering buffer. It's organized very simple. The class stores
37
+ // information of horizontal spans to render it into a pixel-map buffer.
38
+ // Each span has staring X, length, and an array of bytes that determine the
39
+ // cover-values for each pixel.
40
+ // Before using this class you should know the minimal and maximal pixel
41
41
// coordinates of your scanline. The protocol of using is:
42
42
// 1. reset(min_x, max_x)
43
- // 2. add_cell() / add_span() - accumulate scanline.
43
+ // 2. add_cell() / add_span() - accumulate scanline.
44
44
// When forming one scanline the next X coordinate must be always greater
45
45
// than the last stored one, i.e. it works only with ordered coordinates.
46
46
// 3. Call finalize(y) and render the scanline.
47
47
// 3. Call reset_spans() to prepare for the new scanline.
48
- //
48
+ //
49
49
// 4. Rendering:
50
- //
50
+ //
51
51
// Scanline provides an iterator class that allows you to extract
52
52
// the spans and the cover values for each pixel. Be aware that clipping
53
53
// has not been done yet, so you should perform it yourself.
@@ -61,10 +61,10 @@ namespace agg
61
61
// ************************************
62
62
//
63
63
// scanline_u8::const_iterator span = sl.begin();
64
- //
65
- // unsigned char* row = m_rbuf->row(y); // The the address of the beginning
64
+ //
65
+ // unsigned char* row = m_rbuf->row(y); // The the address of the beginning
66
66
// // of the current row
67
- //
67
+ //
68
68
// unsigned num_spans = sl.num_spans(); // Number of spans. It's guaranteed that
69
69
// // num_spans is always greater than 0.
70
70
//
@@ -75,7 +75,7 @@ namespace agg
75
75
//
76
76
// int num_pix = span->len; // Number of pixels of the span.
77
77
// // Always greater than 0, still it's
78
- // // better to use "int" instead of
78
+ // // better to use "int" instead of
79
79
// // "unsigned" because it's more
80
80
// // convenient for clipping
81
81
// int x = span->x;
@@ -86,24 +86,24 @@ namespace agg
86
86
// **************************************
87
87
//
88
88
// unsigned char* dst = row + x; // Calculate the start address of the row.
89
- // // In this case we assume a simple
89
+ // // In this case we assume a simple
90
90
// // grayscale image 1-byte per pixel.
91
91
// do
92
92
// {
93
- // *dst++ = *covers++; // Hypotetical rendering.
93
+ // *dst++ = *covers++; // Hypotetical rendering.
94
94
// }
95
95
// while(--num_pix);
96
96
//
97
97
// ++span;
98
- // }
98
+ // }
99
99
// while(--num_spans); // num_spans cannot be 0, so this loop is quite safe
100
100
// ------------------------------------------------------------------------
101
101
//
102
102
// The question is: why should we accumulate the whole scanline when we
103
103
// could render just separate spans when they're ready?
104
- // That's because using the scanline is generally faster. When is consists
104
+ // That's because using the scanline is generally faster. When is consists
105
105
// of more than one span the conditions for the processor cash system
106
- // are better, because switching between two different areas of memory
106
+ // are better, because switching between two different areas of memory
107
107
// (that can be very large) occurs less frequently.
108
108
// ------------------------------------------------------------------------
109
109
class scanline_u8
@@ -203,9 +203,9 @@ namespace agg
203
203
}
204
204
205
205
// --------------------------------------------------------------------
206
- void finalize (int y)
207
- {
208
- m_y = y;
206
+ void finalize (int y)
207
+ {
208
+ m_y = y;
209
209
}
210
210
211
211
// --------------------------------------------------------------------
@@ -238,11 +238,11 @@ namespace agg
238
238
239
239
240
240
// ==========================================================scanline_u8_am
241
- //
241
+ //
242
242
// The scanline container with alpha-masking
243
- //
243
+ //
244
244
// ------------------------------------------------------------------------
245
- template <class AlphaMask >
245
+ template <class AlphaMask >
246
246
class scanline_u8_am : public scanline_u8
247
247
{
248
248
public:
@@ -264,9 +264,9 @@ namespace agg
264
264
unsigned count = base_type::num_spans ();
265
265
do
266
266
{
267
- m_alpha_mask->combine_hspan (span->x ,
268
- base_type::y (),
269
- span->covers ,
267
+ m_alpha_mask->combine_hspan (span->x ,
268
+ base_type::y (),
269
+ span->covers ,
270
270
span->len );
271
271
++span;
272
272
}
@@ -390,8 +390,8 @@ namespace agg
390
390
}
391
391
else
392
392
{
393
- m_spans.add (span (coord_type (x + m_min_x),
394
- coord_type (len),
393
+ m_spans.add (span (coord_type (x + m_min_x),
394
+ coord_type (len),
395
395
&m_covers[x]));
396
396
}
397
397
m_last_x = x + len - 1 ;
@@ -408,17 +408,17 @@ namespace agg
408
408
}
409
409
else
410
410
{
411
- m_spans.add (span (coord_type (x + m_min_x),
412
- coord_type (len),
411
+ m_spans.add (span (coord_type (x + m_min_x),
412
+ coord_type (len),
413
413
&m_covers[x]));
414
414
}
415
415
m_last_x = x + len - 1 ;
416
416
}
417
417
418
418
// --------------------------------------------------------------------
419
- void finalize (int y)
420
- {
421
- m_y = y;
419
+ void finalize (int y)
420
+ {
421
+ m_y = y;
422
422
}
423
423
424
424
// --------------------------------------------------------------------
@@ -450,15 +450,15 @@ namespace agg
450
450
451
451
452
452
// ========================================================scanline32_u8_am
453
- //
453
+ //
454
454
// The scanline container with alpha-masking
455
- //
455
+ //
456
456
// ------------------------------------------------------------------------
457
- template <class AlphaMask >
457
+ template <class AlphaMask >
458
458
class scanline32_u8_am : public scanline32_u8
459
459
{
460
460
public:
461
- typedef scanline_u8 base_type;
461
+ typedef scanline32_u8 base_type;
462
462
typedef AlphaMask alpha_mask_type;
463
463
typedef base_type::cover_type cover_type;
464
464
typedef base_type::coord_type coord_type;
@@ -477,9 +477,9 @@ namespace agg
477
477
unsigned count = base_type::num_spans ();
478
478
do
479
479
{
480
- m_alpha_mask->combine_hspan (span->x ,
481
- base_type::y (),
482
- span->covers ,
480
+ m_alpha_mask->combine_hspan (span->x ,
481
+ base_type::y (),
482
+ span->covers ,
483
483
span->len );
484
484
++span;
485
485
}
0 commit comments