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
//
@@ -30,15 +30,15 @@ namespace agg
30
30
{
31
31
static unsigned calculate (const int8u* p) { return *p; }
32
32
};
33
-
33
+
34
34
35
35
// =====================================================rgb_to_gray_mask_u8
36
36
template <unsigned R, unsigned G, unsigned B>
37
37
struct rgb_to_gray_mask_u8
38
38
{
39
- static unsigned calculate (const int8u* p)
40
- {
41
- return (p[R]*77 + p[G]*150 + p[B]*29 ) >> 8 ;
39
+ static unsigned calculate (const int8u* p)
40
+ {
41
+ return (p[R]*77 + p[G]*150 + p[B]*29 ) >> 8 ;
42
42
}
43
43
};
44
44
@@ -50,7 +50,7 @@ namespace agg
50
50
typedef int8u cover_type;
51
51
typedef alpha_mask_u8<Step, Offset, MaskF> self_type;
52
52
enum cover_scale_e
53
- {
53
+ {
54
54
cover_shift = 8 ,
55
55
cover_none = 0 ,
56
56
cover_full = 255
@@ -64,12 +64,12 @@ namespace agg
64
64
MaskF& mask_function () { return m_mask_function; }
65
65
const MaskF& mask_function () const { return m_mask_function; }
66
66
67
-
67
+
68
68
// --------------------------------------------------------------------
69
69
cover_type pixel (int x, int y) const
70
70
{
71
- if (x >= 0 && y >= 0 &&
72
- x < (int )m_rbuf->width () &&
71
+ if (x >= 0 && y >= 0 &&
72
+ x < (int )m_rbuf->width () &&
73
73
y < (int )m_rbuf->height ())
74
74
{
75
75
return (cover_type)m_mask_function.calculate (
@@ -81,13 +81,13 @@ namespace agg
81
81
// --------------------------------------------------------------------
82
82
cover_type combine_pixel (int x, int y, cover_type val) const
83
83
{
84
- if (x >= 0 && y >= 0 &&
85
- x < (int )m_rbuf->width () &&
84
+ if (x >= 0 && y >= 0 &&
85
+ x < (int )m_rbuf->width () &&
86
86
y < (int )m_rbuf->height ())
87
87
{
88
- return (cover_type)((cover_full + val *
88
+ return (cover_type)((cover_full + val *
89
89
m_mask_function.calculate (
90
- m_rbuf->row_ptr (y) + x * Step + Offset)) >>
90
+ m_rbuf->row_ptr (y) + x * Step + Offset)) >>
91
91
cover_shift);
92
92
}
93
93
return 0 ;
@@ -112,7 +112,7 @@ namespace agg
112
112
if (x < 0 )
113
113
{
114
114
count += x;
115
- if (count <= 0 )
115
+ if (count <= 0 )
116
116
{
117
117
memset (dst, 0 , num_pix * sizeof (cover_type));
118
118
return ;
@@ -126,7 +126,7 @@ namespace agg
126
126
{
127
127
int rest = x + count - xmax - 1 ;
128
128
count -= rest;
129
- if (count <= 0 )
129
+ if (count <= 0 )
130
130
{
131
131
memset (dst, 0 , num_pix * sizeof (cover_type));
132
132
return ;
@@ -162,7 +162,7 @@ namespace agg
162
162
if (x < 0 )
163
163
{
164
164
count += x;
165
- if (count <= 0 )
165
+ if (count <= 0 )
166
166
{
167
167
memset (dst, 0 , num_pix * sizeof (cover_type));
168
168
return ;
@@ -176,7 +176,7 @@ namespace agg
176
176
{
177
177
int rest = x + count - xmax - 1 ;
178
178
count -= rest;
179
- if (count <= 0 )
179
+ if (count <= 0 )
180
180
{
181
181
memset (dst, 0 , num_pix * sizeof (cover_type));
182
182
return ;
@@ -187,8 +187,8 @@ namespace agg
187
187
const int8u* mask = m_rbuf->row_ptr (y) + x * Step + Offset;
188
188
do
189
189
{
190
- *covers = (cover_type)((cover_full + (*covers) *
191
- m_mask_function.calculate (mask)) >>
190
+ *covers = (cover_type)((cover_full + (*covers) *
191
+ m_mask_function.calculate (mask)) >>
192
192
cover_shift);
193
193
++covers;
194
194
mask += Step;
@@ -214,7 +214,7 @@ namespace agg
214
214
if (y < 0 )
215
215
{
216
216
count += y;
217
- if (count <= 0 )
217
+ if (count <= 0 )
218
218
{
219
219
memset (dst, 0 , num_pix * sizeof (cover_type));
220
220
return ;
@@ -228,7 +228,7 @@ namespace agg
228
228
{
229
229
int rest = y + count - ymax - 1 ;
230
230
count -= rest;
231
- if (count <= 0 )
231
+ if (count <= 0 )
232
232
{
233
233
memset (dst, 0 , num_pix * sizeof (cover_type));
234
234
return ;
@@ -263,7 +263,7 @@ namespace agg
263
263
if (y < 0 )
264
264
{
265
265
count += y;
266
- if (count <= 0 )
266
+ if (count <= 0 )
267
267
{
268
268
memset (dst, 0 , num_pix * sizeof (cover_type));
269
269
return ;
@@ -277,7 +277,7 @@ namespace agg
277
277
{
278
278
int rest = y + count - ymax - 1 ;
279
279
count -= rest;
280
- if (count <= 0 )
280
+ if (count <= 0 )
281
281
{
282
282
memset (dst, 0 , num_pix * sizeof (cover_type));
283
283
return ;
@@ -288,8 +288,8 @@ namespace agg
288
288
const int8u* mask = m_rbuf->row_ptr (y) + x * Step + Offset;
289
289
do
290
290
{
291
- *covers = (cover_type)((cover_full + (*covers) *
292
- m_mask_function.calculate (mask)) >>
291
+ *covers = (cover_type)((cover_full + (*covers) *
292
+ m_mask_function.calculate (mask)) >>
293
293
cover_shift);
294
294
++covers;
295
295
mask += m_rbuf->stride ();
@@ -302,10 +302,10 @@ namespace agg
302
302
alpha_mask_u8 (const self_type&);
303
303
const self_type& operator = (const self_type&);
304
304
305
- rendering_buffer* m_rbuf;
305
+ agg:: rendering_buffer* m_rbuf;
306
306
MaskF m_mask_function;
307
307
};
308
-
308
+
309
309
310
310
typedef alpha_mask_u8<1 , 0 > alpha_mask_gray8; // ----alpha_mask_gray8
311
311
@@ -354,7 +354,7 @@ namespace agg
354
354
typedef int8u cover_type;
355
355
typedef amask_no_clip_u8<Step, Offset, MaskF> self_type;
356
356
enum cover_scale_e
357
- {
357
+ {
358
358
cover_shift = 8 ,
359
359
cover_none = 0 ,
360
360
cover_full = 255
@@ -376,13 +376,13 @@ namespace agg
376
376
m_rbuf->row_ptr (y) + x * Step + Offset);
377
377
}
378
378
379
-
379
+
380
380
// --------------------------------------------------------------------
381
381
cover_type combine_pixel (int x, int y, cover_type val) const
382
382
{
383
- return (cover_type)((cover_full + val *
383
+ return (cover_type)((cover_full + val *
384
384
m_mask_function.calculate (
385
- m_rbuf->row_ptr (y) + x * Step + Offset)) >>
385
+ m_rbuf->row_ptr (y) + x * Step + Offset)) >>
386
386
cover_shift);
387
387
}
388
388
@@ -407,8 +407,8 @@ namespace agg
407
407
const int8u* mask = m_rbuf->row_ptr (y) + x * Step + Offset;
408
408
do
409
409
{
410
- *dst = (cover_type)((cover_full + (*dst) *
411
- m_mask_function.calculate (mask)) >>
410
+ *dst = (cover_type)((cover_full + (*dst) *
411
+ m_mask_function.calculate (mask)) >>
412
412
cover_shift);
413
413
++dst;
414
414
mask += Step;
@@ -436,8 +436,8 @@ namespace agg
436
436
const int8u* mask = m_rbuf->row_ptr (y) + x * Step + Offset;
437
437
do
438
438
{
439
- *dst = (cover_type)((cover_full + (*dst) *
440
- m_mask_function.calculate (mask)) >>
439
+ *dst = (cover_type)((cover_full + (*dst) *
440
+ m_mask_function.calculate (mask)) >>
441
441
cover_shift);
442
442
++dst;
443
443
mask += m_rbuf->stride ();
@@ -449,10 +449,10 @@ namespace agg
449
449
amask_no_clip_u8 (const self_type&);
450
450
const self_type& operator = (const self_type&);
451
451
452
- rendering_buffer* m_rbuf;
452
+ agg:: rendering_buffer* m_rbuf;
453
453
MaskF m_mask_function;
454
454
};
455
-
455
+
456
456
457
457
typedef amask_no_clip_u8<1 , 0 > amask_no_clip_gray8; // ----amask_no_clip_gray8
458
458
0 commit comments