[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v3 08/16] vnc: palette: and fill and color calls.
From: |
Corentin Chary |
Subject: |
[Qemu-devel] [PATCH v3 08/16] vnc: palette: and fill and color calls. |
Date: |
Fri, 4 Feb 2011 09:06:00 +0100 |
These two helpers are needed for zrle and zywrle.
Signed-off-by: Corentin Chary <address@hidden>
---
ui/vnc-palette.c | 32 ++++++++++++++++++++++++++++++++
ui/vnc-palette.h | 3 +++
2 files changed, 35 insertions(+), 0 deletions(-)
diff --git a/ui/vnc-palette.c b/ui/vnc-palette.c
index f93250b..c478060 100644
--- a/ui/vnc-palette.c
+++ b/ui/vnc-palette.c
@@ -126,3 +126,35 @@ 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.3.4
- Re: [Qemu-devel] [PATCH v3 01/16] vnc: qemu can die if the client is disconnected while updating screen, (continued)
- [Qemu-devel] [PATCH v3 02/16] vnc: don't set the quality if lossy encoding are disabled, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 03/16] vnc: add a way to get the update frequency for a given region, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 04/16] vnc: refresh lossy rect after a given timeout, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 05/16] vnc: tight: use the update frequency to choose between lossy and lossless, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 06/16] vnc: palette: use a pool to reduce memory allocations, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 07/16] vnc: palette: add palette_init calls, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 08/16] vnc: palette: and fill and color calls.,
Corentin Chary <=
- [Qemu-devel] [PATCH v3 10/16] vnc: fix uint8_t comparisons with negative values, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 09/16] vnc: Add ZRLE and ZYWRLE encodings., Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 11/16] vnc: fix lossy rect refreshing, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 12/16] bitmap: add a generic bitmap and bitops library, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 13/16] vnc: use the new generic bitmap functions, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 14/16] vnc: don't try to send bigger updates that client height, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 15/16] vnc: tight: tweak adaptive tight settings, Corentin Chary, 2011/02/04
- [Qemu-devel] [PATCH v3 16/16] vnc: add a non-adaptive option, Corentin Chary, 2011/02/04
- Re: [Qemu-devel] [PATCH v3 00/16] vnc: adapative tight, zrle, zywrle, and bitmap module, Stefan Weil, 2011/02/24