From d300688a5b7778798b96ecce9337fd224ac7343f Mon Sep 17 00:00:00 2001 From: Michael Jumper Date: Sun, 1 Apr 2012 23:01:53 -0700 Subject: [PATCH] Fix palette find. --- libguac/src/palette.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libguac/src/palette.c b/libguac/src/palette.c index be1a6518..b04d1ae9 100644 --- a/libguac/src/palette.c +++ b/libguac/src/palette.c @@ -89,9 +89,9 @@ guac_palette* guac_palette_alloc(cairo_surface_t* surface) { /* Store in palette */ c = &(palette->colors[palette->size]); - c->blue = (color & 0x0000FF); - c->green = (color & 0x00FF00) >> 8; - c->red = (color & 0xFF0000) >> 16; + c->blue = (color ) & 0xFF; + c->green = (color >> 8 ) & 0xFF; + c->red = (color >> 16) & 0xFF; /* Add color to map */ entry->index = ++palette->size; @@ -138,7 +138,7 @@ int guac_palette_find(guac_palette* palette, int color) { /* Otherwise, if color indeed stored here, done */ if (entry->color == color) - return entry->index; + return entry->index - 1; /* Otherwise, collision. Move on to another bucket */ hash = (hash+1) & 0xFFF;