From 3617ae9242e665c3331457b7b41d458242b60b41 Mon Sep 17 00:00:00 2001 From: David Capello Date: Wed, 16 Feb 2011 00:07:09 -0300 Subject: [PATCH] Change "thumbnails" variable in src/util/thmbnail.cpp from JList to std::vector<> type. --- src/util/thmbnail.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/util/thmbnail.cpp b/src/util/thmbnail.cpp index 8f994f644..8b075d514 100644 --- a/src/util/thmbnail.cpp +++ b/src/util/thmbnail.cpp @@ -50,20 +50,20 @@ struct Thumbnail } }; -static JList thumbnails = NULL; +typedef std::vector ThumbnailsList; + +static ThumbnailsList* thumbnails = NULL; static void thumbnail_render(BITMAP* bmp, const Image* image, bool has_alpha, const Palette* palette); void destroy_thumbnails() { if (thumbnails) { - JLink link; + for (ThumbnailsList::iterator it = thumbnails->begin(); it != thumbnails->end(); ++it) + delete *it; - JI_LIST_FOR_EACH(thumbnails, link) - delete reinterpret_cast(link->data); - - jlist_free(thumbnails); - thumbnails = NULL; + thumbnails->clear(); + delete thumbnails; } } @@ -71,14 +71,13 @@ BITMAP* generate_thumbnail(const Layer* layer, const Cel* cel, const Sprite *spr { Thumbnail* thumbnail; BITMAP* bmp; - JLink link; if (!thumbnails) - thumbnails = jlist_new(); + thumbnails = new ThumbnailsList(); - /* find the thumbnail */ - JI_LIST_FOR_EACH(thumbnails, link) { - thumbnail = reinterpret_cast(link->data); + // Find the thumbnail + for (ThumbnailsList::iterator it = thumbnails->begin(); it != thumbnails->end(); ++it) { + thumbnail = *it; if (thumbnail->cel == cel) return thumbnail->bmp; } @@ -98,7 +97,7 @@ BITMAP* generate_thumbnail(const Layer* layer, const Cel* cel, const Sprite *spr return NULL; } - jlist_append(thumbnails, thumbnail); + thumbnails->push_back(thumbnail); return thumbnail->bmp; }