annotate src/video/SDL_draw.h @ 3594:c8bed77b0386

Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects() Fixed line drawing so when blending a sequence of lines there are no overlapping pixels drawn.
author Sam Lantinga <slouken@libsdl.org>
date Fri, 18 Dec 2009 07:41:59 +0000
parents b931bcfd94a0
children f638ded38b8a
rev   line source
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2009 Sam Lantinga
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #include "SDL_blit.h"
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26 /* This code assumes that r, g, b, a are the source color,
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
27 * and in the blend and add case, the RGB values are premultiplied by a.
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
28 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
29
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
30 #define DRAW_MUL(_a, _b) (((unsigned)(_a)*(_b))/255)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
31
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
32 #define DRAW_FASTSETPIXEL(x, y, type, bpp, color) \
2918
bd518fc76f28 Updated to build on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 2903
diff changeset
33 *(type *)((Uint8 *)dst->pixels + y * dst->pitch + x * bpp) = (type) color
2901
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
34
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
35 #define DRAW_FASTSETPIXEL1(x, y) DRAW_FASTSETPIXEL(x, y, Uint8, 1, color);
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
36 #define DRAW_FASTSETPIXEL2(x, y) DRAW_FASTSETPIXEL(x, y, Uint16, 2, color);
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
37 #define DRAW_FASTSETPIXEL4(x, y) DRAW_FASTSETPIXEL(x, y, Uint32, 4, color);
133601e3b255 Added RenderPiont() API
Sam Lantinga <slouken@libsdl.org>
parents: 2900
diff changeset
38
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 #define DRAW_SETPIXEL(setpixel) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
40 do { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
41 unsigned sr = r, sg = g, sb = b, sa = a; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
42 setpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
43 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
44
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
45 #define DRAW_SETPIXEL_BLEND(getpixel, setpixel) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
46 do { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
47 unsigned sr, sg, sb, sa; sa; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
48 getpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
49 sr = DRAW_MUL(inva, sr) + r; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
50 sg = DRAW_MUL(inva, sg) + g; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
51 sb = DRAW_MUL(inva, sb) + b; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
52 setpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
53 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
54
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
55 #define DRAW_SETPIXEL_ADD(getpixel, setpixel) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
56 do { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
57 unsigned sr, sg, sb, sa; sa; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
58 getpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
59 sr += r; if (sr > 0xff) sr = 0xff; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 sg += g; if (sg > 0xff) sg = 0xff; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 sb += b; if (sb > 0xff) sb = 0xff; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 setpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 #define DRAW_SETPIXEL_MOD(getpixel, setpixel) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
66 do { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
67 unsigned sr, sg, sb, sa; sa; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
68 getpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
69 sr = DRAW_MUL(sr, r); \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
70 sg = DRAW_MUL(sg, g); \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71 sb = DRAW_MUL(sb, b); \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
72 setpixel; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
73 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
74
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
75 #define DRAW_SETPIXELXY(x, y, type, bpp, op) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
76 do { \
2918
bd518fc76f28 Updated to build on Windows
Sam Lantinga <slouken@libsdl.org>
parents: 2903
diff changeset
77 type *pixel = (type *)((Uint8 *)dst->pixels + y * dst->pitch + x * bpp); \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
78 op; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
79 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
81 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
82 * Define draw operators for RGB555
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
83 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
84
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
85 #define DRAW_SETPIXEL_RGB555 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
86 DRAW_SETPIXEL(RGB555_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
87
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
88 #define DRAW_SETPIXEL_BLEND_RGB555 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
89 DRAW_SETPIXEL_BLEND(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
90 RGB555_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
91
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
92 #define DRAW_SETPIXEL_ADD_RGB555 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
93 DRAW_SETPIXEL_ADD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 RGB555_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
96 #define DRAW_SETPIXEL_MOD_RGB555 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
97 DRAW_SETPIXEL_MOD(RGB_FROM_RGB555(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 RGB555_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
100 #define DRAW_SETPIXELXY_RGB555(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
101 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB555)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103 #define DRAW_SETPIXELXY_BLEND_RGB555(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB555)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 #define DRAW_SETPIXELXY_ADD_RGB555(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
107 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB555)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
108
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
109 #define DRAW_SETPIXELXY_MOD_RGB555(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
110 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB555)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
111
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
112 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
113 * Define draw operators for RGB565
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
114 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
115
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
116 #define DRAW_SETPIXEL_RGB565 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
117 DRAW_SETPIXEL(RGB565_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
118
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
119 #define DRAW_SETPIXEL_BLEND_RGB565 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
120 DRAW_SETPIXEL_BLEND(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
121 RGB565_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
122
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
123 #define DRAW_SETPIXEL_ADD_RGB565 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
124 DRAW_SETPIXEL_ADD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
125 RGB565_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
126
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
127 #define DRAW_SETPIXEL_MOD_RGB565 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
128 DRAW_SETPIXEL_MOD(RGB_FROM_RGB565(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
129 RGB565_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
130
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
131 #define DRAW_SETPIXELXY_RGB565(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
132 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB565)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
133
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
134 #define DRAW_SETPIXELXY_BLEND_RGB565(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
135 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB565)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
136
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
137 #define DRAW_SETPIXELXY_ADD_RGB565(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
138 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB565)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
139
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
140 #define DRAW_SETPIXELXY_MOD_RGB565(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
141 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB565)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
142
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
143 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
144 * Define draw operators for RGB888
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
145 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
146
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
147 #define DRAW_SETPIXEL_RGB888 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
148 DRAW_SETPIXEL(RGB888_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
149
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
150 #define DRAW_SETPIXEL_BLEND_RGB888 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
151 DRAW_SETPIXEL_BLEND(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
152 RGB888_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
153
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
154 #define DRAW_SETPIXEL_ADD_RGB888 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
155 DRAW_SETPIXEL_ADD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
156 RGB888_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
157
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
158 #define DRAW_SETPIXEL_MOD_RGB888 \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
159 DRAW_SETPIXEL_MOD(RGB_FROM_RGB888(*pixel, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
160 RGB888_FROM_RGB(*pixel, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
161
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
162 #define DRAW_SETPIXELXY_RGB888(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
163 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGB888)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
164
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
165 #define DRAW_SETPIXELXY_BLEND_RGB888(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
166 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGB888)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
167
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
168 #define DRAW_SETPIXELXY_ADD_RGB888(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
169 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGB888)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
170
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
171 #define DRAW_SETPIXELXY_MOD_RGB888(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
172 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGB888)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
173
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
174 /*
2899
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
175 * Define draw operators for ARGB8888
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
176 */
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
177
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
178 #define DRAW_SETPIXEL_ARGB8888 \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
179 DRAW_SETPIXEL(ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
180
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
181 #define DRAW_SETPIXEL_BLEND_ARGB8888 \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
182 DRAW_SETPIXEL_BLEND(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
183 ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
184
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
185 #define DRAW_SETPIXEL_ADD_ARGB8888 \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
186 DRAW_SETPIXEL_ADD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
187 ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
188
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
189 #define DRAW_SETPIXEL_MOD_ARGB8888 \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
190 DRAW_SETPIXEL_MOD(RGBA_FROM_ARGB8888(*pixel, sr, sg, sb, sa), \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
191 ARGB8888_FROM_RGBA(*pixel, sr, sg, sb, sa))
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
192
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
193 #define DRAW_SETPIXELXY_ARGB8888(x, y) \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
194 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ARGB8888)
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
195
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
196 #define DRAW_SETPIXELXY_BLEND_ARGB8888(x, y) \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
197 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_ARGB8888)
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
198
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
199 #define DRAW_SETPIXELXY_ADD_ARGB8888(x, y) \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
200 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_ARGB8888)
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
201
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
202 #define DRAW_SETPIXELXY_MOD_ARGB8888(x, y) \
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
203 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_ARGB8888)
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
204
a0c837a16e4c Added ARGB optimized case for Mac OS X
Sam Lantinga <slouken@libsdl.org>
parents: 2898
diff changeset
205 /*
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
206 * Define draw operators for general RGB
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
207 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
208
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
209 #define DRAW_SETPIXEL_RGB \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
210 DRAW_SETPIXEL(PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
211
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
212 #define DRAW_SETPIXEL_BLEND_RGB \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
213 DRAW_SETPIXEL_BLEND(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
214 PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
215
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
216 #define DRAW_SETPIXEL_ADD_RGB \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
217 DRAW_SETPIXEL_ADD(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
218 PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
219
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
220 #define DRAW_SETPIXEL_MOD_RGB \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
221 DRAW_SETPIXEL_MOD(RGB_FROM_PIXEL(*pixel, fmt, sr, sg, sb), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
222 PIXEL_FROM_RGB(*pixel, fmt, sr, sg, sb))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
223
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
224 #define DRAW_SETPIXELXY2_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
225 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
226
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
227 #define DRAW_SETPIXELXY4_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
228 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
229
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
230 #define DRAW_SETPIXELXY2_BLEND_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
231 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_BLEND_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
232
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
233 #define DRAW_SETPIXELXY4_BLEND_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
234 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
235
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
236 #define DRAW_SETPIXELXY2_ADD_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
237 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_ADD_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
238
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
239 #define DRAW_SETPIXELXY4_ADD_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
240 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
241
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
242 #define DRAW_SETPIXELXY2_MOD_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
243 DRAW_SETPIXELXY(x, y, Uint16, 2, DRAW_SETPIXEL_MOD_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
244
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
245 #define DRAW_SETPIXELXY4_MOD_RGB(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
246 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGB)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
247
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
248
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
249 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
250 * Define draw operators for general RGBA
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
251 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
252
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
253 #define DRAW_SETPIXEL_RGBA \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
254 DRAW_SETPIXEL(PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
255
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
256 #define DRAW_SETPIXEL_BLEND_RGBA \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
257 DRAW_SETPIXEL_BLEND(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
258 PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
259
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
260 #define DRAW_SETPIXEL_ADD_RGBA \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
261 DRAW_SETPIXEL_ADD(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
262 PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
263
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
264 #define DRAW_SETPIXEL_MOD_RGBA \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
265 DRAW_SETPIXEL_MOD(RGBA_FROM_PIXEL(*pixel, fmt, sr, sg, sb, sa), \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
266 PIXEL_FROM_RGBA(*pixel, fmt, sr, sg, sb, sa))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
267
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
268 #define DRAW_SETPIXELXY4_RGBA(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
269 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_RGBA)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
270
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
271 #define DRAW_SETPIXELXY4_BLEND_RGBA(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
272 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_BLEND_RGBA)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
273
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
274 #define DRAW_SETPIXELXY4_ADD_RGBA(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
275 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_ADD_RGBA)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
276
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
277 #define DRAW_SETPIXELXY4_MOD_RGBA(x, y) \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
278 DRAW_SETPIXELXY(x, y, Uint32, 4, DRAW_SETPIXEL_MOD_RGBA)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
279
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
280 /*
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
281 * Define line drawing macro
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
282 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
283
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
284 #define ABS(_x) ((_x) < 0 ? -(_x) : (_x))
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
285
3594
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
286 #define BRESENHAM(x1, y1, x2, y2, op, draw_end) \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
287 { \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
288 int i, deltax, deltay, numpixels; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
289 int d, dinc1, dinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
290 int x, xinc1, xinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
291 int y, yinc1, yinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
292 \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
293 deltax = ABS(x2 - x1); \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
294 deltay = ABS(y2 - y1); \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
295 \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
296 if (deltax >= deltay) { \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
297 numpixels = deltax + 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
298 d = (2 * deltay) - deltax; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
299 dinc1 = deltay * 2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
300 dinc2 = (deltay - deltax) * 2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
301 xinc1 = 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
302 xinc2 = 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
303 yinc1 = 0; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
304 yinc2 = 1; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
305 } else { \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
306 numpixels = deltay + 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
307 d = (2 * deltax) - deltay; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
308 dinc1 = deltax * 2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
309 dinc2 = (deltax - deltay) * 2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
310 xinc1 = 0; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
311 xinc2 = 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
312 yinc1 = 1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
313 yinc2 = 1; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
314 } \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
315 \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
316 if (x1 > x2) { \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
317 xinc1 = -xinc1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
318 xinc2 = -xinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
319 } \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
320 if (y1 > y2) { \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
321 yinc1 = -yinc1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
322 yinc2 = -yinc2; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
323 } \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
324 \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
325 x = x1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
326 y = y1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
327 \
3594
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
328 if (!draw_end) { \
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
329 --numpixels; \
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
330 } \
3063
9f2482d6662c Fixed off by one error in line drawing code
Sam Lantinga <slouken@libsdl.org>
parents: 2918
diff changeset
331 for (i = 0; i < numpixels; ++i) { \
2903
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
332 op(x, y); \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
333 if (d < 0) { \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
334 d += dinc1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
335 x += xinc1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
336 y += yinc1; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
337 } else { \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
338 d += dinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
339 x += xinc2; \
e426c4fc9cf7 Working Bresenham line drawing algorithm. We can optimize later, if needed.
Sam Lantinga <slouken@libsdl.org>
parents: 2901
diff changeset
340 y += yinc2; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
341 } \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
342 } \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
343 }
3594
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
344 #define DRAWLINE BRESENHAM
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
345
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
346 /*
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
347 * Define draw rect macro
3594
c8bed77b0386 Added SDL_DrawRect(), SDL_DrawRects(), SDL_BlendRect() and SDL_BlendRects()
Sam Lantinga <slouken@libsdl.org>
parents: 3593
diff changeset
348 * (not tested, this level of optimization not needed ... yet?)
3593
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
349 */
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
350 #define DRAWRECT(type, op) \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
351 do { \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
352 int width = rect->w; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
353 int height = rect->h; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
354 int pitch = (dst->pitch / dst->format->BytesPerPixel); \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
355 int skip = pitch - width; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
356 type *pixel; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
357 pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
358 { int n = (width+3)/4; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
359 switch (width & 3) { \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
360 case 0: do { op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
361 case 3: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
362 case 2: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
363 case 1: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
364 } while ( --n > 0 ); \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
365 } \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
366 } \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
367 pixel += skip; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
368 width -= 1; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
369 height -= 2; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
370 while (height--) { \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
371 op; pixel += width; op; pixel += skip; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
372 } \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
373 { int n = (width+3)/4; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
374 switch (width & 3) { \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
375 case 0: do { op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
376 case 3: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
377 case 2: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
378 case 1: op; pixel++; \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
379 } while ( --n > 0 ); \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
380 } \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
381 } \
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
382 } while (0)
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
383
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
384 /*
b931bcfd94a0 In the process of adding rectangle drawing
Sam Lantinga <slouken@libsdl.org>
parents: 3536
diff changeset
385 * Define fill rect macro
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
386 */
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
387
2900
3a9636c83849 Make it possible to switch algorithms in the future
Sam Lantinga <slouken@libsdl.org>
parents: 2899
diff changeset
388 #define FILLRECT(type, op) \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
389 do { \
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3063
diff changeset
390 int width = rect->w; \
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3063
diff changeset
391 int height = rect->h; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
392 int pitch = (dst->pitch / dst->format->BytesPerPixel); \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
393 int skip = pitch - width; \
3536
0267b8b1595c Added interfaces for batch drawing of points, lines and rects:
Sam Lantinga <slouken@libsdl.org>
parents: 3063
diff changeset
394 type *pixel = (type *)dst->pixels + rect->y * pitch + rect->x; \
2898
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
395 while (height--) { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
396 { int n = (width+3)/4; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
397 switch (width & 3) { \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
398 case 0: do { op; pixel++; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
399 case 3: op; pixel++; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
400 case 2: op; pixel++; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
401 case 1: op; pixel++; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
402 } while ( --n > 0 ); \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
403 } \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
404 } \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
405 pixel += skip; \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
406 } \
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
407 } while (0)
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
408
e40448bc7727 Share code between fill and line drawing
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
409 /* vi: set ts=4 sw=4 expandtab: */