refactored some code. compiles now without suppresing any warning with gcc-6.3.0.
[AROS.git] / rom / graphics / loadrgb32.c
blob1ea1224ec6bc1c296dbc26ec45643912c034f990
1 /*
2 Copyright © 1995-2010, The AROS Development Team. All rights reserved.
3 $Id$
5 Desc:
6 Lang: english
7 */
9 #include <aros/debug.h>
10 #include "graphics_intern.h"
12 /*****************************************************************************
14 NAME */
15 #include <proto/graphics.h>
17 AROS_LH2(void, LoadRGB32,
19 /* SYNOPSIS */
20 AROS_LHA(struct ViewPort *, vp, A0),
21 AROS_LHA(const ULONG *, table, A1),
23 /* LOCATION */
24 struct GfxBase *, GfxBase, 147, Graphics)
26 /* FUNCTION
27 Load RGB color values from table.
29 INPUTS
30 vp - ViewPort
31 table - pointer to table of records
32 1 Word with the number of colors to load
33 1 Word with the first color to be loaded.
34 3 Longwords representing a left justified 32 bit RGB triplet.
35 The list is terminated by a count value of 0.
36 RESULT
38 NOTES
40 EXAMPLE
41 ULONG table[] = { 1l << 16 + 0 , 0xffffffff , 0 , 0 , 0}
42 ULONG table[] = { 256l << 16 + 0 , r1 , g1 , b1 , r2 , g2 , b2 , ..... 0}
44 BUGS
46 SEE ALSO
48 INTERNALS
50 HISTORY
51 27-11-96 digulla automatically created from
52 graphics_lib.fd and clib/graphics_protos.h
54 *****************************************************************************/
56 AROS_LIBFUNC_INIT
58 ASSERT_VALID_PTR(vp);
59 ASSERT_VALID_PTR_OR_NULL(table);
61 /* it is legal to pass a NULL table */
63 D(bug("LoadRGB32(0x%p)\n", vp));
64 if (table)
66 ULONG count;
68 /* table is terminated by a count value of 0 */
70 while ((count = (*table) >> 16))
72 ULONG first, t;
74 first = (*table) & 0xFFFF;
76 table ++;
78 D(bug("[LoadRGB32] Setting %u colors starting from %u\n", count, first));
79 for (t = 0; t < count; t++)
81 D(bug("[LoadRGB32] Color %u R 0x%08lX G 0x%08lX B %08lX\n", t + first, table[0], table[1], table[2]));
82 SetRGB32 (vp,
83 t + first,
84 table[0],
85 table[1],
86 table[2]);
88 table += 3;
91 } /* while (*table) */
94 AROS_LIBFUNC_EXIT
96 } /* LoadRGB32 */