Small tight fixes
cover Small tight fixes
Hi,
Here is two small tight fix and another small patch related to vnc encodings. Thanks,
Corentin Chary (3):
vnc: tight: don't forget last pixel in tight_encode_indexed_rect
vnc: tight: don't forget the third color
vnc: add missing target for vnc-encodings-*.o
Makefile | 6 +++--- vnc-encoding-tight.c | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-)
PATCH 1/3 vnc: tight: don't forget last pixel in tight_encode_indexed_rect
A simple patch would have been to just remove count -= 1, but this one also replace the while (count--) with a for(i = 0; i < count; i++) which I believe is more easy to understand.
--- vnc-encoding-tight.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)
vnc-encoding-tight.c +4 -5
@@ -249,18 +249,16 @@ static void print_palette(const char *key, QObject *obj, void *opaque) uint##bpp##_t *src; \ uint##bpp##_t rgb; \ uint8_t key[6]; \ - int rep = 0; \ + int i, rep; \ uint8_t idx; \ \ src = (uint##bpp##_t *) buf; \ \ - count -= 1; \ - while (count--) { \ + for (i = 0; i < count; i++) { \ rgb = *src++; \ rep = 0; \ - while (count && *src == rgb) { \ - rep++, src++, count--; \ + while (i < count && *src == rgb) { \ + rep++, src++, i++; \ } \ tight_palette_rgb2buf(rgb, bpp, key); \ if (!qdict_haskey(palette, (char *)key)) { \
Signature · 1 line
1.7.1
Anthony Liguori
AppliedRe: [Qemu-devel] [PATCH 1/3] vnc: tight: don't forget last pixel in tight_encode_indexed_rect
Quoted 6 lines · Corentin Chary
A simple patch would have been to just remove count -= 1, but this one also replace the while (count--) with a for(i = 0; i< count; i++) which I believe is more easy to understand.
Signed-off-by Corentin Chary<[email protected]>
Applied all. Thanks.
Regards,
Anthony Liguori
Quoted 31 lines
--- vnc-encoding-tight.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-)vnc-encoding-tight.c +4
-5@@ -249,18 +249,16 @@ static void print_palette(const char *key, QObject *obj, void *opaque) uint##bpp##_t *src; \ uint##bpp##_t rgb; \ uint8_t key[6]; \ - int rep = 0; \ + int i, rep; \ uint8_t idx; \ \ src = (uint##bpp##_t *) buf; \ \ - count -= 1; \ - while (count--) { \ + for (i = 0; i< count; i++) { \ rgb = *src++; \ rep = 0; \ - while (count&& *src == rgb) { \ - rep++, src++, count--; \ + while (i< count&& *src == rgb) { \ + rep++, src++, i++; \ } \ tight_palette_rgb2buf(rgb, bpp, key); \ if (!qdict_haskey(palette, (char *)key)) { \
PATCH 2/3 vnc: tight: don't forget the third color
In reply to Corentin CharyWhile couting color, if the third color was only present one time it wasn't added to the palette.
--- vnc-encoding-tight.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
vnc-encoding-tight.c +1 -0
@@ -177,6 +177,7 @@ static int tight_palette_insert(QDict *palette, uint32_t rgb, int bpp, int max) *palette =qdict_new (); \tight_palette_insert (*palette, c0, bpp, max); \tight_palette_insert (*palette, c1, bpp, max); \ +tight_palette_insert (*palette, ci, bpp, max); \ \for (i++; i < count; i++) { \if (data[i] == ci) { \
Signature · 1 line
1.7.1
PATCH 3/3 vnc: add missing target for vnc-encodings-*.o
In reply to Corentin Charyvnc-encodings-*.c dependencies where missing.
--- Makefile | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
Makefile +3 -3
@@ -120,11 +120,11 @@ vnc-auth-vencrypt.o: vnc-auth-vencrypt.c vnc.h vnc-auth-sasl.o: vnc-auth-sasl.c vnc.h -vnc-encoding-zlib.o: vnc.h +vnc-encoding-zlib.o: vnc-encoding-zlib.c vnc.h -vnc-encoding-hextile.o: vnc.h +vnc-encoding-hextile.o: vnc-encoding-hextile.c vnc.h -vnc-encoding-tight.o: vnc.h vnc-encoding-tight.h +vnc-encoding-tight.o: vnc-encoding-tight.c vnc.h vnc-encoding-tight.h curses.o: curses.c keymaps.h curses_keys.h
Signature · 1 line
1.7.1