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_SOLID_SUBPIX_H 11 #define DRAWING_MODE_OVER_SOLID_SUBPIX_H 12 13 #include "DrawingModeOverSUBPIX.h" 14 15 // blend_hline_over_solid_subpix 16 void 17 blend_hline_over_solid_subpix(int x, int y, unsigned len, const color_type& c, 18 uint8 cover, agg_buffer* buffer, const PatternHandler* pattern) 19 { 20 if (pattern->IsSolidLow()) 21 return; 22 23 if (cover == 255) { 24 uint32 v; 25 uint8* p8 = (uint8*)&v; 26 p8[0] = (uint8)c.b; 27 p8[1] = (uint8)c.g; 28 p8[2] = (uint8)c.r; 29 p8[3] = 255; 30 uint32* p32 = (uint32*)(buffer->row_ptr(y)) + x; 31 do { 32 *p32 = v; 33 p32++; 34 x++; 35 len -= 3; 36 } while (len); 37 } else { 38 uint8* p = buffer->row_ptr(y) + (x << 2); 39 do { 40 BLEND_OVER(p, c.r, c.g, c.b, cover); 41 x++; 42 p += 4; 43 len -= 3; 44 } while (len); 45 } 46 } 47 48 49 // blend_solid_hspan_over_solid_subpix 50 void 51 blend_solid_hspan_over_solid_subpix(int x, int y, unsigned len, 52 const color_type& c, const uint8* covers, agg_buffer* buffer, 53 const PatternHandler* pattern) 54 { 55 if (pattern->IsSolidLow()) 56 return; 57 58 uint8* p = buffer->row_ptr(y) + (x << 2); 59 do { 60 BLEND_OVER_SUBPIX(p, c.r, c.g, c.b, covers[2], covers[1], covers[0]); 61 covers += 3; 62 p += 4; 63 x++; 64 len -= 3; 65 } while (len); 66 } 67 68 #endif // DRAWING_MODE_OVER_SUBPIX_H 69 70