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