From 5a35288a7524c6b5cb9a4e8e3aa93d756b016743 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 1 Mar 2013 03:25:45 +0300 Subject: Fix arrow images load. --- data/graphics/sprites/CMakeLists.txt | 8 ++++---- data/graphics/sprites/Makefile.am | 8 ++++---- data/graphics/sprites/arrow_down.gif | Bin 152 -> 0 bytes data/graphics/sprites/arrow_down.png | Bin 0 -> 410 bytes data/graphics/sprites/arrow_left.gif | Bin 148 -> 0 bytes data/graphics/sprites/arrow_left.png | Bin 0 -> 412 bytes data/graphics/sprites/arrow_right.gif | Bin 145 -> 0 bytes data/graphics/sprites/arrow_right.png | Bin 0 -> 432 bytes data/graphics/sprites/arrow_up.gif | Bin 139 -> 0 bytes data/graphics/sprites/arrow_up.png | Bin 0 -> 402 bytes src/maplayer.cpp | 8 ++++---- src/resources/imagehelper.cpp | 7 +++++-- src/test/testlauncher.cpp | 8 ++++---- 13 files changed, 21 insertions(+), 18 deletions(-) delete mode 100644 data/graphics/sprites/arrow_down.gif create mode 100644 data/graphics/sprites/arrow_down.png delete mode 100644 data/graphics/sprites/arrow_left.gif create mode 100644 data/graphics/sprites/arrow_left.png delete mode 100644 data/graphics/sprites/arrow_right.gif create mode 100644 data/graphics/sprites/arrow_right.png delete mode 100644 data/graphics/sprites/arrow_up.gif create mode 100644 data/graphics/sprites/arrow_up.png diff --git a/data/graphics/sprites/CMakeLists.txt b/data/graphics/sprites/CMakeLists.txt index eb3802d13..d8b3c4ea9 100644 --- a/data/graphics/sprites/CMakeLists.txt +++ b/data/graphics/sprites/CMakeLists.txt @@ -1,8 +1,8 @@ SET(FILES - arrow_up.gif - arrow_down.gif - arrow_left.gif - arrow_right.gif + arrow_up.png + arrow_down.png + arrow_left.png + arrow_right.png error.png error.xml manaplus_emotions.png diff --git a/data/graphics/sprites/Makefile.am b/data/graphics/sprites/Makefile.am index 8cf8cfb49..eeb13f915 100644 --- a/data/graphics/sprites/Makefile.am +++ b/data/graphics/sprites/Makefile.am @@ -1,10 +1,10 @@ spritesdir = $(pkgdatadir)/data/graphics/sprites sprites_DATA = \ - arrow_down.gif \ - arrow_left.gif \ - arrow_right.gif \ - arrow_up.gif \ + arrow_down.png \ + arrow_left.png \ + arrow_right.png \ + arrow_up.png \ error.png \ error.xml \ manaplus_emotions.png\ diff --git a/data/graphics/sprites/arrow_down.gif b/data/graphics/sprites/arrow_down.gif deleted file mode 100644 index e371b0892..000000000 Binary files a/data/graphics/sprites/arrow_down.gif and /dev/null differ diff --git a/data/graphics/sprites/arrow_down.png b/data/graphics/sprites/arrow_down.png new file mode 100644 index 000000000..ef820401a Binary files /dev/null and b/data/graphics/sprites/arrow_down.png differ diff --git a/data/graphics/sprites/arrow_left.gif b/data/graphics/sprites/arrow_left.gif deleted file mode 100644 index 29ea8bcd9..000000000 Binary files a/data/graphics/sprites/arrow_left.gif and /dev/null differ diff --git a/data/graphics/sprites/arrow_left.png b/data/graphics/sprites/arrow_left.png new file mode 100644 index 000000000..5b1e7d024 Binary files /dev/null and b/data/graphics/sprites/arrow_left.png differ diff --git a/data/graphics/sprites/arrow_right.gif b/data/graphics/sprites/arrow_right.gif deleted file mode 100644 index e5c7d3038..000000000 Binary files a/data/graphics/sprites/arrow_right.gif and /dev/null differ diff --git a/data/graphics/sprites/arrow_right.png b/data/graphics/sprites/arrow_right.png new file mode 100644 index 000000000..508dc2ff0 Binary files /dev/null and b/data/graphics/sprites/arrow_right.png differ diff --git a/data/graphics/sprites/arrow_up.gif b/data/graphics/sprites/arrow_up.gif deleted file mode 100644 index 655e5bf40..000000000 Binary files a/data/graphics/sprites/arrow_up.gif and /dev/null differ diff --git a/data/graphics/sprites/arrow_up.png b/data/graphics/sprites/arrow_up.png new file mode 100644 index 000000000..ca96b3000 Binary files /dev/null and b/data/graphics/sprites/arrow_up.png differ diff --git a/src/maplayer.cpp b/src/maplayer.cpp index 96633215c..b6e259106 100644 --- a/src/maplayer.cpp +++ b/src/maplayer.cpp @@ -730,16 +730,16 @@ void MapItem::setType(const int type) switch (type) { case ARROW_UP: - name = "graphics/sprites/arrow_up.gif"; + name = "graphics/sprites/arrow_up.png"; break; case ARROW_DOWN: - name = "graphics/sprites/arrow_down.gif"; + name = "graphics/sprites/arrow_down.png"; break; case ARROW_LEFT: - name = "graphics/sprites/arrow_left.gif"; + name = "graphics/sprites/arrow_left.png"; break; case ARROW_RIGHT: - name = "graphics/sprites/arrow_right.gif"; + name = "graphics/sprites/arrow_right.png"; break; default: break; diff --git a/src/resources/imagehelper.cpp b/src/resources/imagehelper.cpp index eea15d29c..b0e02b75f 100644 --- a/src/resources/imagehelper.cpp +++ b/src/resources/imagehelper.cpp @@ -117,9 +117,12 @@ void ImageHelper::dumpSurfaceFormat(const SDL_Surface *const image) const SDL_Surface *ImageHelper::loadPng(SDL_RWops *const rw) { - if (!rw || !IMG_isPNG(rw)) + if (!rw) + return nullptr; + + if (!IMG_isPNG(rw)) { - logger->log("Error, image missing or not png"); + logger->log("Error, image is not png"); return nullptr; } SDL_Surface *const tmpImage = IMG_LoadPNG_RW(rw); diff --git a/src/test/testlauncher.cpp b/src/test/testlauncher.cpp index 917b8eedb..215793243 100644 --- a/src/test/testlauncher.cpp +++ b/src/test/testlauncher.cpp @@ -82,7 +82,7 @@ int TestLauncher::exec() int TestLauncher::testBackend() const { const Image *const img = Theme::getImageFromTheme( - "graphics/sprites/arrow_up.gif"); + "graphics/sprites/arrow_up.png"); if (!img) return 1; const int cnt = 100; @@ -129,7 +129,7 @@ int TestLauncher::testFps() Wallpaper::getWallpaper(800, 600); Image *img[5]; - img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.gif"); + img[0] = Theme::getImageFromTheme("graphics/sprites/arrow_up.png"); img[1] = Theme::getImageFromTheme( "graphics/gui/target-cursor-normal-l.png"); img[2] = Theme::getImageFromTheme("themes/wood/window.png"); @@ -190,8 +190,8 @@ int TestLauncher::testInternal() "graphics/sprites/manaplus_emotions.png"); img[1] = Theme::getImageFromTheme( "graphics/sprites/manaplus_emotions.png"); - img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.gif"); - img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.gif"); + img[2] = Theme::getImageFromTheme("graphics/sprites/arrow_left.png"); + img[3] = Theme::getImageFromTheme("graphics/sprites/arrow_right.png"); int idx = 0; const int mem = mainGraphics->getMemoryUsage(); -- cgit v1.2.3-70-g09d2