]> Dogcows Code - chaz/openbox/blob - render/gradient.c
unused variables
[chaz/openbox] / render / gradient.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3 gradient.c for the Openbox window manager
4 Copyright (c) 2006 Mikael Magnusson
5 Copyright (c) 2003-2007 Dana Jansens
6 Copyright (c) 2003 Derek Foreman
7
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
12
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
17
18 See the COPYING file for a copy of the GNU General Public License.
19 */
20
21 #include "render.h"
22 #include "gradient.h"
23 #include "color.h"
24 #include <glib.h>
25
26 static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised);
27 static void gradient_parentrelative(RrAppearance *a, gint w, gint h);
28 static void gradient_solid(RrAppearance *l, gint w, gint h);
29 static void gradient_splitvertical(RrAppearance *a, gint w, gint h);
30 static void gradient_vertical(RrSurface *sf, gint w, gint h);
31 static void gradient_horizontal(RrSurface *sf, gint w, gint h);
32 static void gradient_mirrorhorizontal(RrSurface *sf, gint w, gint h);
33 static void gradient_diagonal(RrSurface *sf, gint w, gint h);
34 static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h);
35 static void gradient_pyramid(RrSurface *sf, gint inw, gint inh);
36
37 void RrRender(RrAppearance *a, gint w, gint h)
38 {
39 RrPixel32 *data = a->surface.pixel_data;
40 RrPixel32 current;
41 guint r,g,b;
42 gint off, x;
43
44 switch (a->surface.grad) {
45 case RR_SURFACE_PARENTREL:
46 gradient_parentrelative(a, w, h);
47 break;
48 case RR_SURFACE_SOLID:
49 gradient_solid(a, w, h);
50 break;
51 case RR_SURFACE_SPLIT_VERTICAL:
52 gradient_splitvertical(a, w, h);
53 break;
54 case RR_SURFACE_VERTICAL:
55 gradient_vertical(&a->surface, w, h);
56 break;
57 case RR_SURFACE_HORIZONTAL:
58 gradient_horizontal(&a->surface, w, h);
59 break;
60 case RR_SURFACE_MIRROR_HORIZONTAL:
61 gradient_mirrorhorizontal(&a->surface, w, h);
62 break;
63 case RR_SURFACE_DIAGONAL:
64 gradient_diagonal(&a->surface, w, h);
65 break;
66 case RR_SURFACE_CROSS_DIAGONAL:
67 gradient_crossdiagonal(&a->surface, w, h);
68 break;
69 case RR_SURFACE_PYRAMID:
70 gradient_pyramid(&a->surface, w, h);
71 break;
72 default:
73 g_assert_not_reached(); /* unhandled gradient */
74 return;
75 }
76
77 if (a->surface.interlaced) {
78 gint i;
79 RrPixel32 *p;
80
81 r = a->surface.interlace_color->r;
82 g = a->surface.interlace_color->g;
83 b = a->surface.interlace_color->b;
84 current = (r << RrDefaultRedOffset)
85 + (g << RrDefaultGreenOffset)
86 + (b << RrDefaultBlueOffset);
87 p = data;
88 for (i = 0; i < h; i += 2, p += w)
89 for (x = 0; x < w; ++x, ++p)
90 *p = current;
91 }
92
93 if (a->surface.relief == RR_RELIEF_FLAT && a->surface.border) {
94 r = a->surface.border_color->r;
95 g = a->surface.border_color->g;
96 b = a->surface.border_color->b;
97 current = (r << RrDefaultRedOffset)
98 + (g << RrDefaultGreenOffset)
99 + (b << RrDefaultBlueOffset);
100 for (off = 0, x = 0; x < w; ++x, off++) {
101 *(data + off) = current;
102 *(data + off + ((h-1) * w)) = current;
103 }
104 for (off = 0, x = 0; x < h; ++x, off++) {
105 *(data + (off * w)) = current;
106 *(data + (off * w) + w - 1) = current;
107 }
108 }
109
110 if (a->surface.relief != RR_RELIEF_FLAT) {
111 if (a->surface.bevel == RR_BEVEL_1) {
112 for (off = 1, x = 1; x < w - 1; ++x, off++)
113 highlight(data + off,
114 data + off + (h-1) * w,
115 a->surface.relief==RR_RELIEF_RAISED);
116 for (off = 0, x = 0; x < h; ++x, off++)
117 highlight(data + off * w,
118 data + off * w + w - 1,
119 a->surface.relief==RR_RELIEF_RAISED);
120 }
121
122 if (a->surface.bevel == RR_BEVEL_2) {
123 for (off = 2, x = 2; x < w - 2; ++x, off++)
124 highlight(data + off + w,
125 data + off + (h-2) * w,
126 a->surface.relief==RR_RELIEF_RAISED);
127 for (off = 1, x = 1; x < h-1; ++x, off++)
128 highlight(data + off * w + 1,
129 data + off * w + w - 2,
130 a->surface.relief==RR_RELIEF_RAISED);
131 }
132 }
133 }
134
135 static void highlight(RrPixel32 *x, RrPixel32 *y, gboolean raised)
136 {
137 gint r, g, b;
138
139 RrPixel32 *up, *down;
140 if (raised) {
141 up = x;
142 down = y;
143 } else {
144 up = y;
145 down = x;
146 }
147 r = (*up >> RrDefaultRedOffset) & 0xFF;
148 r += r >> 1;
149 g = (*up >> RrDefaultGreenOffset) & 0xFF;
150 g += g >> 1;
151 b = (*up >> RrDefaultBlueOffset) & 0xFF;
152 b += b >> 1;
153 if (r > 0xFF) r = 0xFF;
154 if (g > 0xFF) g = 0xFF;
155 if (b > 0xFF) b = 0xFF;
156 *up = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
157 + (b << RrDefaultBlueOffset);
158
159 r = (*down >> RrDefaultRedOffset) & 0xFF;
160 r = (r >> 1) + (r >> 2);
161 g = (*down >> RrDefaultGreenOffset) & 0xFF;
162 g = (g >> 1) + (g >> 2);
163 b = (*down >> RrDefaultBlueOffset) & 0xFF;
164 b = (b >> 1) + (b >> 2);
165 *down = (r << RrDefaultRedOffset) + (g << RrDefaultGreenOffset)
166 + (b << RrDefaultBlueOffset);
167 }
168
169 static void create_bevel_colors(RrAppearance *l)
170 {
171 gint r, g, b;
172
173 /* light color */
174 r = l->surface.primary->r;
175 r += r >> 1;
176 g = l->surface.primary->g;
177 g += g >> 1;
178 b = l->surface.primary->b;
179 b += b >> 1;
180 if (r > 0xFF) r = 0xFF;
181 if (g > 0xFF) g = 0xFF;
182 if (b > 0xFF) b = 0xFF;
183 g_assert(!l->surface.bevel_light);
184 l->surface.bevel_light = RrColorNew(l->inst, r, g, b);
185
186 /* dark color */
187 r = l->surface.primary->r;
188 r = (r >> 1) + (r >> 2);
189 g = l->surface.primary->g;
190 g = (g >> 1) + (g >> 2);
191 b = l->surface.primary->b;
192 b = (b >> 1) + (b >> 2);
193 g_assert(!l->surface.bevel_dark);
194 l->surface.bevel_dark = RrColorNew(l->inst, r, g, b);
195 }
196
197 static void gradient_parentrelative(RrAppearance *a, gint w, gint h)
198 {
199 RrPixel32 *source, *dest;
200 gint sw, sh, partial_w, partial_h, i;
201
202 g_assert (a->surface.parent);
203 g_assert (a->surface.parent->w);
204
205 sw = a->surface.parent->w;
206 sh = a->surface.parent->h;
207
208 source = (a->surface.parent->surface.pixel_data +
209 a->surface.parentx + sw * a->surface.parenty);
210 dest = a->surface.pixel_data;
211
212 if (a->surface.parentx + w > sw) {
213 partial_w = sw - a->surface.parentx;
214 } else partial_w = w;
215
216 if (a->surface.parenty + h > sh) {
217 partial_h = sh - a->surface.parenty;
218 } else partial_h = h;
219
220 for (i = 0; i < partial_h; i++, source += sw, dest += w) {
221 memcpy(dest, source, partial_w * sizeof(RrPixel32));
222 }
223 }
224
225 static void gradient_solid(RrAppearance *l, gint w, gint h)
226 {
227 gint i;
228 RrPixel32 pix;
229 RrPixel32 *data = l->surface.pixel_data;
230 RrSurface *sp = &l->surface;
231 gint left = 0, top = 0, right = w - 1, bottom = h - 1;
232
233 pix = (sp->primary->r << RrDefaultRedOffset)
234 + (sp->primary->g << RrDefaultGreenOffset)
235 + (sp->primary->b << RrDefaultBlueOffset);
236
237 for (i = 0; i < w * h; i++)
238 *data++ = pix;
239
240 if (sp->interlaced)
241 return;
242
243 XFillRectangle(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->primary),
244 0, 0, w, h);
245
246 switch (sp->relief) {
247 case RR_RELIEF_RAISED:
248 if (!sp->bevel_dark)
249 create_bevel_colors(l);
250
251 switch (sp->bevel) {
252 case RR_BEVEL_1:
253 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
254 left, bottom, right, bottom);
255 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
256 right, bottom, right, top);
257
258 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
259 left, top, right, top);
260 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
261 left, bottom, left, top);
262 break;
263 case RR_BEVEL_2:
264 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
265 left + 2, bottom - 1, right - 2, bottom - 1);
266 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
267 right - 1, bottom - 1, right - 1, top + 1);
268
269 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
270 left + 2, top + 1, right - 2, top + 1);
271 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
272 left + 1, bottom - 1, left + 1, top + 1);
273 break;
274 default:
275 g_assert_not_reached(); /* unhandled BevelType */
276 }
277 break;
278 case RR_RELIEF_SUNKEN:
279 if (!sp->bevel_dark)
280 create_bevel_colors(l);
281
282 switch (sp->bevel) {
283 case RR_BEVEL_1:
284 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
285 left, bottom, right, bottom);
286 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
287 right, bottom, right, top);
288
289 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
290 left, top, right, top);
291 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
292 left, bottom, left, top);
293 break;
294 case RR_BEVEL_2:
295 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
296 left + 2, bottom - 1, right - 2, bottom - 1);
297 XDrawLine(RrDisplay(l->inst), l->pixmap,RrColorGC(sp->bevel_light),
298 right - 1, bottom - 1, right - 1, top + 1);
299
300 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
301 left + 2, top + 1, right - 2, top + 1);
302 XDrawLine(RrDisplay(l->inst), l->pixmap, RrColorGC(sp->bevel_dark),
303 left + 1, bottom - 1, left + 1, top + 1);
304 break;
305 default:
306 g_assert_not_reached(); /* unhandled BevelType */
307 }
308 break;
309 case RR_RELIEF_FLAT:
310 if (sp->border) {
311 XDrawRectangle(RrDisplay(l->inst), l->pixmap,
312 RrColorGC(sp->border_color),
313 left, top, right, bottom);
314 }
315 break;
316 default:
317 g_assert_not_reached(); /* unhandled ReliefType */
318 }
319 }
320
321 /* * * * * * * * * * * * * * GRADIENT MAGIC WOOT * * * * * * * * * * * * * * */
322
323 #define VARS(x) \
324 guint color##x[3]; \
325 gint len##x, cdelta##x[3], error##x[3] = { 0, 0, 0 }, inc##x[3]; \
326 gboolean bigslope##x[3] /* color slope > 1 */
327
328 #define SETUP(x, from, to, w) \
329 len##x = w; \
330 \
331 color##x[0] = from->r; \
332 color##x[1] = from->g; \
333 color##x[2] = from->b; \
334 \
335 cdelta##x[0] = to->r - from->r; \
336 cdelta##x[1] = to->g - from->g; \
337 cdelta##x[2] = to->b - from->b; \
338 \
339 if (cdelta##x[0] < 0) { \
340 cdelta##x[0] = -cdelta##x[0]; \
341 inc##x[0] = -1; \
342 } else \
343 inc##x[0] = 1; \
344 if (cdelta##x[1] < 0) { \
345 cdelta##x[1] = -cdelta##x[1]; \
346 inc##x[1] = -1; \
347 } else \
348 inc##x[1] = 1; \
349 if (cdelta##x[2] < 0) { \
350 cdelta##x[2] = -cdelta##x[2]; \
351 inc##x[2] = -1; \
352 } else \
353 inc##x[2] = 1; \
354 bigslope##x[0] = cdelta##x[0] > w;\
355 bigslope##x[1] = cdelta##x[1] > w;\
356 bigslope##x[2] = cdelta##x[2] > w
357
358 #define COLOR_RR(x, c) \
359 c->r = color##x[0]; \
360 c->g = color##x[1]; \
361 c->b = color##x[2]
362
363 #define COLOR(x) \
364 ((color##x[0] << RrDefaultRedOffset) + \
365 (color##x[1] << RrDefaultGreenOffset) + \
366 (color##x[2] << RrDefaultBlueOffset))
367
368 #define INCREMENT(x, i) \
369 (inc##x[i])
370
371 #define NEXT(x) \
372 { \
373 gint i; \
374 for (i = 2; i >= 0; --i) { \
375 if (!cdelta##x[i]) continue; \
376 \
377 if (!bigslope##x[i]) { \
378 /* Y (color) is dependant on X */ \
379 error##x[i] += cdelta##x[i]; \
380 if ((error##x[i] << 1) >= len##x) { \
381 color##x[i] += INCREMENT(x, i); \
382 error##x[i] -= len##x; \
383 } \
384 } else { \
385 /* X is dependant on Y (color) */ \
386 while (1) { \
387 color##x[i] += INCREMENT(x, i); \
388 error##x[i] += len##x; \
389 if ((error##x[i] << 1) >= cdelta##x[i]) { \
390 error##x[i] -= cdelta##x[i]; \
391 break; \
392 } \
393 } \
394 } \
395 } \
396 }
397
398 static void gradient_splitvertical(RrAppearance *a, gint w, gint h)
399 {
400 gint x, y1, y3, r, g, b;
401 RrSurface *sf = &a->surface;
402 RrPixel32 *data = sf->pixel_data;
403 RrPixel32 current;
404 RrColor *primary_light, *secondary_light;
405
406 VARS(y1);
407 VARS(y3);
408
409 r = sf->primary->r;
410 r += r >> 2;
411 g = sf->primary->g;
412 g += g >> 2;
413 b = sf->primary->b;
414 b += b >> 2;
415 if (r > 0xFF) r = 0xFF;
416 if (g > 0xFF) g = 0xFF;
417 if (b > 0xFF) b = 0xFF;
418 primary_light = RrColorNew(a->inst, r, g, b);
419
420 r = sf->secondary->r;
421 r += r >> 4;
422 g = sf->secondary->g;
423 g += g >> 4;
424 b = sf->secondary->b;
425 b += b >> 4;
426 if (r > 0xFF) r = 0xFF;
427 if (g > 0xFF) g = 0xFF;
428 if (b > 0xFF) b = 0xFF;
429 secondary_light = RrColorNew(a->inst, r, g, b);
430
431 SETUP(y1, primary_light, sf->primary, (h / 2) -1);
432 SETUP(y3, sf->secondary, secondary_light, (h / 2) -1);
433
434 for (y1 = h - 1; y1 > (h / 2) -1; --y1) { /* 0 -> h-1 */
435 current = COLOR(y1);
436 for (x = w - 1; x >= 0; --x) /* 0 -> w */
437 *(data++) = current;
438
439 NEXT(y1);
440 }
441
442
443 for (y3 = (h / 2) - 1; y3 > 0; --y3) {
444 current = COLOR(y3);
445 for (x = w - 1; x >= 0; --x)
446 *(data++) = current;
447
448 NEXT(y3);
449 }
450
451 current = COLOR(y3);
452 for (x = w - 1; x >= 0; --x) /* 0 -> w */
453 *(data++) = current;
454
455 RrColorFree(primary_light);
456 RrColorFree(secondary_light);
457 }
458
459 static void gradient_horizontal(RrSurface *sf, gint w, gint h)
460 {
461 gint x, y;
462 RrPixel32 *data = sf->pixel_data, *datav;
463 RrPixel32 current;
464
465 VARS(x);
466 SETUP(x, sf->primary, sf->secondary, w);
467
468 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
469 current = COLOR(x);
470 datav = data;
471 for (y = h - 1; y >= 0; --y) { /* 0 -> h */
472 *datav = current;
473 datav += w;
474 }
475 ++data;
476
477 NEXT(x);
478 }
479 current = COLOR(x);
480 for (y = h - 1; y >= 0; --y) /* 0 -> h */
481 *(data + y * w) = current;
482 }
483
484 static void gradient_mirrorhorizontal(RrSurface *sf, gint w, gint h)
485 {
486 gint x, y;
487 RrPixel32 *data = sf->pixel_data, *datav;
488 RrPixel32 current;
489
490 VARS(x);
491 SETUP(x, sf->primary, sf->secondary, w/2);
492
493 if (w > 1) {
494 for (x = w - 1; x > w/2-1; --x) { /* 0 -> w-1 */
495 current = COLOR(x);
496 datav = data;
497 for (y = h - 1; y >= 0; --y) { /* 0 -> h */
498 *datav = current;
499 datav += w;
500 }
501 ++data;
502
503 NEXT(x);
504 }
505 SETUP(x, sf->secondary, sf->primary, w/2);
506 for (x = w/2 - 1; x > 0; --x) { /* 0 -> w-1 */
507 current = COLOR(x);
508 datav = data;
509 for (y = h - 1; y >= 0; --y) { /* 0 -> h */
510 *datav = current;
511 datav += w;
512 }
513 ++data;
514
515 NEXT(x);
516 }
517 }
518 current = COLOR(x);
519 for (y = h - 1; y >= 0; --y) /* 0 -> h */
520 *(data + y * w) = current;
521 }
522
523 static void gradient_vertical(RrSurface *sf, gint w, gint h)
524 {
525 gint x, y;
526 RrPixel32 *data = sf->pixel_data;
527 RrPixel32 current;
528
529 VARS(y);
530 SETUP(y, sf->primary, sf->secondary, h);
531
532 for (y = h - 1; y > 0; --y) { /* 0 -> h-1 */
533 current = COLOR(y);
534 for (x = w - 1; x >= 0; --x) /* 0 -> w */
535 *(data++) = current;
536
537 NEXT(y);
538 }
539 current = COLOR(y);
540 for (x = w - 1; x >= 0; --x) /* 0 -> w */
541 *(data++) = current;
542 }
543
544
545 static void gradient_diagonal(RrSurface *sf, gint w, gint h)
546 {
547 gint x, y;
548 RrPixel32 *data = sf->pixel_data;
549 RrColor left, right;
550 RrColor extracorner;
551
552 VARS(lefty);
553 VARS(righty);
554 VARS(x);
555
556 extracorner.r = (sf->primary->r + sf->secondary->r) / 2;
557 extracorner.g = (sf->primary->g + sf->secondary->g) / 2;
558 extracorner.b = (sf->primary->b + sf->secondary->b) / 2;
559
560 SETUP(lefty, sf->primary, (&extracorner), h);
561 SETUP(righty, (&extracorner), sf->secondary, h);
562
563 for (y = h - 1; y > 0; --y) { /* 0 -> h-1 */
564 COLOR_RR(lefty, (&left));
565 COLOR_RR(righty, (&right));
566
567 SETUP(x, (&left), (&right), w);
568
569 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
570 *(data++) = COLOR(x);
571
572 NEXT(x);
573 }
574 *(data++) = COLOR(x);
575
576 NEXT(lefty);
577 NEXT(righty);
578 }
579 COLOR_RR(lefty, (&left));
580 COLOR_RR(righty, (&right));
581
582 SETUP(x, (&left), (&right), w);
583
584 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
585 *(data++) = COLOR(x);
586
587 NEXT(x);
588 }
589 *data = COLOR(x);
590 }
591
592 static void gradient_crossdiagonal(RrSurface *sf, gint w, gint h)
593 {
594 gint x, y;
595 RrPixel32 *data = sf->pixel_data;
596 RrColor left, right;
597 RrColor extracorner;
598
599 VARS(lefty);
600 VARS(righty);
601 VARS(x);
602
603 extracorner.r = (sf->primary->r + sf->secondary->r) / 2;
604 extracorner.g = (sf->primary->g + sf->secondary->g) / 2;
605 extracorner.b = (sf->primary->b + sf->secondary->b) / 2;
606
607 SETUP(lefty, (&extracorner), sf->secondary, h);
608 SETUP(righty, sf->primary, (&extracorner), h);
609
610 for (y = h - 1; y > 0; --y) { /* 0 -> h-1 */
611 COLOR_RR(lefty, (&left));
612 COLOR_RR(righty, (&right));
613
614 SETUP(x, (&left), (&right), w);
615
616 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
617 *(data++) = COLOR(x);
618
619 NEXT(x);
620 }
621 *(data++) = COLOR(x);
622
623 NEXT(lefty);
624 NEXT(righty);
625 }
626 COLOR_RR(lefty, (&left));
627 COLOR_RR(righty, (&right));
628
629 SETUP(x, (&left), (&right), w);
630
631 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
632 *(data++) = COLOR(x);
633
634 NEXT(x);
635 }
636 *data = COLOR(x);
637 }
638
639 static void gradient_pyramid(RrSurface *sf, gint inw, gint inh)
640 {
641 gint x, y, w = (inw >> 1) + 1, h = (inh >> 1) + 1;
642 RrPixel32 *data = sf->pixel_data;
643 RrPixel32 *end = data + inw*inh - 1;
644 RrPixel32 current;
645 RrColor left, right;
646 RrColor extracorner;
647
648 VARS(lefty);
649 VARS(righty);
650 VARS(x);
651
652 extracorner.r = (sf->primary->r + sf->secondary->r) / 2;
653 extracorner.g = (sf->primary->g + sf->secondary->g) / 2;
654 extracorner.b = (sf->primary->b + sf->secondary->b) / 2;
655
656 SETUP(lefty, (&extracorner), sf->secondary, h);
657 SETUP(righty, sf->primary, (&extracorner), h);
658
659 for (y = h - 1; y > 0; --y) { /* 0 -> h-1 */
660 COLOR_RR(lefty, (&left));
661 COLOR_RR(righty, (&right));
662
663 SETUP(x, (&left), (&right), w);
664
665 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
666 current = COLOR(x);
667 *(data+x) = current;
668 *(data+inw-x) = current;
669 *(end-x) = current;
670 *(end-(inw-x)) = current;
671
672 NEXT(x);
673 }
674 current = COLOR(x);
675 *(data+x) = current;
676 *(data+inw-x) = current;
677 *(end-x) = current;
678 *(end-(inw-x)) = current;
679
680 data+=inw;
681 end-=inw;
682
683 NEXT(lefty);
684 NEXT(righty);
685 }
686 COLOR_RR(lefty, (&left));
687 COLOR_RR(righty, (&right));
688
689 SETUP(x, (&left), (&right), w);
690
691 for (x = w - 1; x > 0; --x) { /* 0 -> w-1 */
692 current = COLOR(x);
693 *(data+x) = current;
694 *(data+inw-x) = current;
695 *(end-x) = current;
696 *(end-(inw-x)) = current;
697
698 NEXT(x);
699 }
700 current = COLOR(x);
701 *(data+x) = current;
702 *(data+inw-x) = current;
703 *(end-x) = current;
704 *(end-(inw-x)) = current;
705 }
706
This page took 0.073456 seconds and 4 git commands to generate.