Merge lp:~widelands-dev/widelands/use_sdl_image_in_one_place into lp:widelands

Proposed by SirVer
Status: Merged
Merged at revision: 7295
Proposed branch: lp:~widelands-dev/widelands/use_sdl_image_in_one_place
Merge into: lp:widelands
Prerequisite: lp:~widelands-dev/widelands/texture_atlas
Diff against target: 42 lines (+2/-11)
2 files modified
src/map_io/CMakeLists.txt (+0/-1)
src/map_io/map_extradata_packet.cc (+2/-10)
To merge this branch: bzr merge lp:~widelands-dev/widelands/use_sdl_image_in_one_place
Reviewer Review Type Date Requested Status
GunChleoc Approve
SirVer Needs Resubmitting
Review via email: mp+243120@code.launchpad.net

Description of the change

This is part of chained branches. The base branch needs to be submitted first.

Only image_io depends on SDL_Image. This is the way it should be.

To post a comment you must log in.
Revision history for this message
GunChleoc (gunchleoc) wrote :

Added a streamlining idea.

Revision history for this message
SirVer (sirver) wrote :

Very reasonable suggestion. Done.

Revision history for this message
SirVer (sirver) :
review: Needs Resubmitting
Revision history for this message
GunChleoc (gunchleoc) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/map_io/CMakeLists.txt'
2--- src/map_io/CMakeLists.txt 2014-11-28 16:40:55 +0000
3+++ src/map_io/CMakeLists.txt 2014-12-01 21:31:32 +0000
4@@ -84,7 +84,6 @@
5 map_terrain_packet.h
6 map_version_packet.cc
7 map_version_packet.h
8- USES_SDL2_IMAGE
9 DEPENDS
10 base_exceptions
11 base_log
12
13=== modified file 'src/map_io/map_extradata_packet.cc'
14--- src/map_io/map_extradata_packet.cc 2014-11-28 05:40:53 +0000
15+++ src/map_io/map_extradata_packet.cc 2014-12-01 21:31:32 +0000
16@@ -19,9 +19,8 @@
17
18 #include "map_io/map_extradata_packet.h"
19
20-#include <SDL_image.h>
21-
22 #include "graphic/graphic.h"
23+#include "graphic/image_io.h"
24 #include "graphic/in_memory_image.h"
25 #include "graphic/texture.h"
26 #include "io/fileread.h"
27@@ -60,14 +59,7 @@
28 const std::string hash = std::string("map:") + FileSystem::fs_filename(pname->c_str());
29 const Image* image = nullptr;
30 if (!g_gr->images().has(hash)) {
31- FileRead fr;
32-
33- fr.open(fs, *pname);
34- SDL_Surface * const surf =
35- IMG_Load_RW(SDL_RWFromMem(fr.data(0), fr.get_size()), 1);
36- if (!surf)
37- continue; // Illegal pic. Skip it.
38- image = g_gr->images().insert(new_in_memory_image(hash, new Texture(surf)));
39+ image = g_gr->images().insert(new_in_memory_image(hash, load_image(*pname, &fs)));
40 } else {
41 image = g_gr->images().get(hash);
42 }

Subscribers

People subscribed via source and target branches

to status/vote changes: