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