xref: /haiku/src/servers/app/drawing/Painter/drawing_modes/DrawingModeOverSUBPIX.h (revision b06a48ab8f30b45916a9c157b992827779182163)
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_OVER on B_RGBA32.
7  *
8  */
9 
10 #ifndef DRAWING_MODE_OVER_SUBPIX_H
11 #define DRAWING_MODE_OVER_SUBPIX_H
12 
13 #include "DrawingMode.h"
14 #include "GlobalSubpixelSettings.h"
15 
16 // BLEND_OVER_SUBPIX
17 #define BLEND_OVER_SUBPIX(d, r, g, b, a1, a2, a3) \
18 { \
19 	BLEND_SUBPIX(d, r, g, b, a1, a2, a3) \
20 }
21 
22 
23 // blend_solid_hspan_over_subpix
24 void
25 blend_solid_hspan_over_subpix(int x, int y, unsigned len, const color_type& c,
26 	const uint8* covers, agg_buffer* buffer, const PatternHandler* pattern)
27 {
28 	uint8* p = buffer->row_ptr(y) + (x << 2);
29 	rgb_color color = pattern->HighColor();
30 	const int subpixelL = gSubpixelOrderingRGB ? 2 : 0;
31 	const int subpixelM = 1;
32 	const int subpixelR = gSubpixelOrderingRGB ? 0 : 2;
33 	do {
34 		if (pattern->IsHighColor(x, y)) {
35 			BLEND_OVER_SUBPIX(p, color.red, color.green, color.blue,
36 				covers[subpixelL], covers[subpixelM], covers[subpixelR]);
37 		}
38 		covers += 3;
39 		p += 4;
40 		x++;
41 		len -= 3;
42 	} while (len);
43 }
44 
45 #endif // DRAWING_MODE_OVER_SUBPIX_H
46 
47