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_ALPHA in "Constant Overlay" mode on B_RGBA32.
7 *
8 */
9
10#ifndef DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
11#define DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
12
13#include "DrawingModeAlphaCOSUBPIX.h"
14#include "GlobalSubpixelSettings.h"
15
16
17// blend_solid_hspan_alpha_co_solid_subpix
18void
19blend_solid_hspan_alpha_co_solid_subpix(int x, int y, unsigned len,
20	const color_type& c, const uint8* covers, agg_buffer* buffer,
21	const PatternHandler* pattern)
22{
23	uint8* p = buffer->row_ptr(y) + (x << 2);
24	uint8 hAlpha = pattern->HighColor().alpha;
25	uint16 alphaRed;
26	uint16 alphaGreen;
27	uint16 alphaBlue;
28	const int subpixelL = gSubpixelOrderingRGB ? 2 : 0;
29	const int subpixelM = 1;
30	const int subpixelR = gSubpixelOrderingRGB ? 0 : 2;
31	do {
32		alphaRed = hAlpha * covers[subpixelL];
33		alphaGreen = hAlpha * covers[subpixelM];
34		alphaBlue = hAlpha * covers[subpixelR];
35		BLEND_ALPHA_CO_SUBPIX(p, c.r, c.g, c.b,
36			alphaBlue, alphaGreen, alphaRed);
37		covers += 3;
38		p += 4;
39		x++;
40		len -= 3;
41	} while (len);
42}
43
44
45#endif // DRAWING_MODE_ALPHA_CO_SOLID_SUBPIX_H
46
47