Revision f8562e32 ui/vnc-palette.c
b/ui/vnc-palette.c | ||
---|---|---|
126 | 126 |
} |
127 | 127 |
} |
128 | 128 |
} |
129 |
|
|
130 |
uint32_t palette_color(const VncPalette *palette, int idx, bool *found) |
|
131 |
{ |
|
132 |
int i; |
|
133 |
VncPaletteEntry *entry; |
|
134 |
|
|
135 |
for (i = 0; i < VNC_PALETTE_HASH_SIZE; i++) { |
|
136 |
QLIST_FOREACH(entry, &palette->table[i], next) { |
|
137 |
if (entry->idx == idx) { |
|
138 |
*found = true; |
|
139 |
return entry->color; |
|
140 |
} |
|
141 |
} |
|
142 |
} |
|
143 |
|
|
144 |
*found = false; |
|
145 |
return -1; |
|
146 |
} |
|
147 |
|
|
148 |
static void palette_fill_cb(int idx, uint32_t color, void *opaque) |
|
149 |
{ |
|
150 |
uint32_t *colors = opaque; |
|
151 |
|
|
152 |
colors[idx] = color; |
|
153 |
} |
|
154 |
|
|
155 |
size_t palette_fill(const VncPalette *palette, |
|
156 |
uint32_t colors[VNC_PALETTE_MAX_SIZE]) |
|
157 |
{ |
|
158 |
palette_iter(palette, palette_fill_cb, colors); |
|
159 |
return palette_size(palette); |
|
160 |
} |
Also available in: Unified diff