[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 07/15] vnc: palette: and fill and color calls.
From: |
Corentin Chary |
Subject: |
[Qemu-devel] [PATCH 07/15] vnc: palette: and fill and color calls. |
Date: |
Wed, 11 Aug 2010 07:49:37 +0200 |
These two helpers are needed for zrle and zywrle.
Signed-off-by: Corentin Chary <address@hidden>
---
ui/vnc-palette.c | 33 +++++++++++++++++++++++++++++++++
ui/vnc-palette.h | 3 +++
2 files changed, 36 insertions(+), 0 deletions(-)
diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c
index f93250b..d691a0c 100644
--- a/ui/vnc-palette.c
+++ b/ui/vnc-palette.c
@@ -126,3 +126,36 @@ void palette_iter(const VncPalette *palette,
}
}
}
+
+uint32_t palette_color(const VncPalette *palette, int idx, bool *found)
+{
+ int i;
+ VncPaletteEntry *entry;
+
+ for (i = 0; i < VNC_PALETTE_HASH_SIZE; i++) {
+ QLIST_FOREACH(entry, &palette->table[i], next) {
+ if (entry->idx == idx) {
+ *found = true;
+ return entry->color;
+ }
+ }
+ }
+
+ *found = false;
+ return -1;
+}
+
+static void palette_fill_cb(int idx, uint32_t color, void *opaque)
+{
+ uint32_t *colors = opaque;
+
+ colors[idx] = color;
+}
+
+size_t palette_fill(const VncPalette *palette,
+ uint32_t colors[VNC_PALETTE_MAX_SIZE])
+{
+ palette_iter(palette, palette_fill_cb, colors);
+ return palette_size(palette);
+}
+
diff --git a/ui/vnc-palette.h b/ui/vnc-palette.h
index c646e4d..3260885 100644
--- a/ui/vnc-palette.h
+++ b/ui/vnc-palette.h
@@ -61,5 +61,8 @@ size_t palette_size(const VncPalette *palette);
void palette_iter(const VncPalette *palette,
void (*iter)(int idx, uint32_t color, void *opaque),
void *opaque);
+uint32_t palette_color(const VncPalette *palette, int idx, bool *found);
+size_t palette_fill(const VncPalette *palette,
+ uint32_t colors[VNC_PALETTE_MAX_SIZE]);
#endif /* VNC_PALETTE_H */
--
1.7.1
- [Qemu-devel] [PATCH 00/15] vnc: adapative tight, zrle, zywrle, and bitmap module, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 01/15] vnc: don't set the quality if lossy encoding are disabled, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 02/15] vnc: add a way to get the update frequency for a given region, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 03/15] vnc: refresh lossy rect after a given timeout, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 04/15] vnc: tight: use the update frequency to choose between lossy and lossless, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 05/15] vnc: palette: use a pool to reduce memory allocations, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 06/15] vnc: palette: add palette_init calls, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 07/15] vnc: palette: and fill and color calls.,
Corentin Chary <=
- [Qemu-devel] [PATCH 09/15] vnc: fix uint8_t comparisons with negative values, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 08/15] vnc: Add ZRLE and ZYWRLE encodings., Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 10/15] vnc: fix lossy rect refreshing, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 11/15] bitmap: add a generic bitmap and bitops library, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 12/15] vnc: use the new generic bitmap functions, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 13/15] vnc: don't try to send bigger updates that client height, Corentin Chary, 2010/08/11
- [Qemu-devel] [PATCH 14/15] vnc: tight: tweak adaptive tight settings, Corentin Chary, 2010/08/11