From: Corentin Chary <corentincj@iksaif.net>
To: Qemu-development List <qemu-devel@nongnu.org>
Cc: Corentin Chary <corentincj@iksaif.net>,
Anthony Liguori <aliguori@linux.vnet.ibm.com>,
Alexander Graf <agraf@suse.de>,
Andre Przywara <andre.przywara@amd.com>
Subject: [Qemu-devel] [PATCH 07/15] vnc: palette: and fill and color calls.
Date: Wed, 11 Aug 2010 07:49:37 +0200 [thread overview]
Message-ID: <1281505785-22523-8-git-send-email-corentincj@iksaif.net> (raw)
In-Reply-To: <1281505785-22523-1-git-send-email-corentincj@iksaif.net>
These two helpers are needed for zrle and zywrle.
Signed-off-by: Corentin Chary <corentincj@iksaif.net>
---
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
next prev parent reply other threads:[~2010-08-11 5:50 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 5:49 [Qemu-devel] [PATCH 00/15] vnc: adapative tight, zrle, zywrle, and bitmap module Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 01/15] vnc: don't set the quality if lossy encoding are disabled Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 02/15] vnc: add a way to get the update frequency for a given region Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 03/15] vnc: refresh lossy rect after a given timeout Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 04/15] vnc: tight: use the update frequency to choose between lossy and lossless Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 05/15] vnc: palette: use a pool to reduce memory allocations Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 06/15] vnc: palette: add palette_init calls Corentin Chary
2010-08-11 5:49 ` Corentin Chary [this message]
2010-08-11 5:49 ` [Qemu-devel] [PATCH 08/15] vnc: Add ZRLE and ZYWRLE encodings Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 09/15] vnc: fix uint8_t comparisons with negative values Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 10/15] vnc: fix lossy rect refreshing Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 11/15] bitmap: add a generic bitmap and bitops library Corentin Chary
2010-09-07 9:16 ` Stefan Hajnoczi
2010-08-11 5:49 ` [Qemu-devel] [PATCH 12/15] vnc: use the new generic bitmap functions Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 13/15] vnc: don't try to send bigger updates that client height Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 14/15] vnc: tight: tweak adaptive tight settings Corentin Chary
2010-08-11 13:06 ` Chris Krumme
2010-08-11 13:17 ` Corentin Chary
2010-08-12 6:12 ` Corentin Chary
2010-08-11 5:49 ` [Qemu-devel] [PATCH 15/15] vnc: add a non-adaptive option Corentin Chary
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1281505785-22523-8-git-send-email-corentincj@iksaif.net \
--to=corentincj@iksaif.net \
--cc=agraf@suse.de \
--cc=aliguori@linux.vnet.ibm.com \
--cc=andre.przywara@amd.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).