From 708db30ba67192e37462a849efe59a437b2d8319 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 22 Feb 2013 21:32:50 -0500 Subject: Optionally list palette colors of loaded images. --- (limited to 'src/resources') diff --git a/src/resources/image.c b/src/resources/image.c index cd2c317..ae7cd30 100644 --- a/src/resources/image.c +++ b/src/resources/image.c @@ -1,5 +1,6 @@ #include #include +#include #include "../logging.h" #include "image.h" #include "resource.h" @@ -11,6 +12,9 @@ img_png_get(const char *path) { SDL_RWops *rwops; struct image *img; +#ifdef DEBUG_PALETTES + int i; +#endif img = (struct image *) resource_get(&img_res, path); if (img != NULL) { @@ -26,6 +30,16 @@ img_png_get(const char *path) path, IMG_GetError()); } +#ifdef DEBUG_PALETTES + for (i = 0; i < img->image->format->palette->ncolors; ++i) { + debug("Color %3.3d: 0x%2.2x%2.2x%2.2x", + i, + img->image->format->palette->colors[i].r, + img->image->format->palette->colors[i].g, + img->image->format->palette->colors[i].b); + } +#endif + resource_use((struct resource *) img); resource_add(&img_res, path, (struct resource *) img); -- cgit v0.9.1