1 /*
2 * Copyright 2005, Stephan Aßmus <superstippi@gmx.de>.
3 * Copyright 2008, Andrej Spielmann <andrej.spielmann@seh.ox.ac.uk>.
4 * All rights reserved. Distributed under the terms of the MIT License.
5 *
6 * DrawingMode implementing B_OP_INVERT on B_RGBA32.
7 *
8 */
9
10 #ifndef DRAWING_MODE_INVERT_SUBPIX_H
11 #define DRAWING_MODE_INVERT_SUBPIX_H
12
13 #include "DrawingMode.h"
14 #include "GlobalSubpixelSettings.h"
15
16 // BLEND_INVERT_SUBPIX
17 #define BLEND_INVERT_SUBPIX(d, a1, a2, a3) \
18 { \
19 pixel32 _p; \
20 _p.data32 = *(uint32*)d; \
21 BLEND_SUBPIX(d, 255 - _p.data8[2], 255 - _p.data8[1], 255 - _p.data8[0], \
22 a1, a2, a3); \
23 (void)_p; \
24 }
25
26
27 // blend_solid_hspan_invert_subpix
28 void
blend_solid_hspan_invert_subpix(int x,int y,unsigned len,const color_type & c,const uint8 * covers,agg_buffer * buffer,const PatternHandler * pattern)29 blend_solid_hspan_invert_subpix(int x, int y, unsigned len, const color_type& c,
30 const uint8* covers, agg_buffer* buffer, const PatternHandler* pattern)
31 {
32 uint8* p = buffer->row_ptr(y) + (x << 2);
33 const int subpixelL = gSubpixelOrderingRGB ? 2 : 0;
34 const int subpixelM = 1;
35 const int subpixelR = gSubpixelOrderingRGB ? 0 : 2;
36 do {
37 if (pattern->IsHighColor(x, y)) {
38 BLEND_INVERT_SUBPIX(p, covers[subpixelL], covers[subpixelM],
39 covers[subpixelR]);
40 }
41 covers += 3;
42 p += 4;
43 x++;
44 len -= 3;
45 } while (len);
46 }
47
48
49 #endif // DRAWING_MODE_INVERT_SUBPIX_H
50
51