Skip to content

Commit

Permalink
Remove SDL2 code.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jul 3, 2014
1 parent b16ded3 commit 707cda2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 94 deletions.
81 changes: 0 additions & 81 deletions src/image.cpp
Expand Up @@ -125,18 +125,11 @@ image::image_cache images_,
tod_colored_images_,
brightened_images_;

#if SDL_VERSION_ATLEAST(2,0,0)
/** Rexture caches */
image::texture_cache txt_images_,
txt_hexed_images_,
txt_brightened_images_;
#else
#ifdef SDL_GPU
image::texture_cache txt_images_,
txt_hexed_images_,
txt_brightened_images_;
#endif
#endif

// cache storing if each image fit in a hex
image::bool_cache in_hex_info_;
Expand Down Expand Up @@ -629,17 +622,6 @@ surface load_from_disk(const locator &loc)
}
}

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture load_texture(const locator &loc, const int access)
{
surface img = load_from_disk(loc);
if (!img.null()) {
return CVideo::get_window()->create_texture(access, img);
} else {
return sdl::ttexture();
}
}
#else
#ifdef SDL_GPU
sdl::ttexture load_texture(const locator &loc)
{
Expand All @@ -651,7 +633,6 @@ sdl::ttexture load_texture(const locator &loc)
}
}
#endif
#endif

manager::manager() {}

Expand Down Expand Up @@ -920,67 +901,6 @@ surface get_image(const image::locator& i_locator, TYPE type)
return res;
}

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture get_texture(const locator& loc, TYPE type)
{
if (loc.is_void()) {
return sdl::ttexture();
}

texture_cache *cache;

switch (type) {
case UNSCALED:
case SCALED_TO_ZOOM:
cache = &txt_images_;
break;
case BRIGHTENED:
cache = &txt_brightened_images_;
break;
case HEXED:
case SCALED_TO_HEX:
case TOD_COLORED:
cache = &txt_hexed_images_;
break;
default:
return sdl::ttexture();
}

if (!loc.in_cache(*cache)) {
if (type == UNSCALED || type == SCALED_TO_ZOOM) {
sdl::ttexture txt = load_texture(loc);
loc.add_to_cache(*cache, txt);
} else if (type == BRIGHTENED) {
surface surf = get_brightened(loc);
sdl::ttexture txt = CVideo::get_window()->create_texture(SDL_TEXTUREACCESS_STATIC, surf);
loc.add_to_cache(*cache, txt);
} else {
surface surf = get_hexed(loc);
sdl::ttexture txt = CVideo::get_window()->create_texture(SDL_TEXTUREACCESS_STATIC, surf);
loc.add_to_cache(*cache, txt);
}
}

sdl::ttexture result = loc.locate_in_cache(*cache);

switch (type) {
case UNSCALED:
case HEXED:
case BRIGHTENED:
break;
case TOD_COLORED:
result.set_color_mod(red_adjust, green_adjust, blue_adjust);
case SCALED_TO_ZOOM:
case SCALED_TO_HEX:
result.set_scale(zoom, zoom);
break;
default:
return sdl::ttexture();
}

return result;
}
#else
#ifdef SDL_GPU
sdl::ttexture get_texture(const locator& loc, TYPE type)
{
Expand Down Expand Up @@ -1042,7 +962,6 @@ sdl::ttexture get_texture(const locator& loc, TYPE type)
return result;
}
#endif
#endif

surface get_lighted_image(const image::locator& i_locator, const light_string& ls, TYPE type)
{
Expand Down
13 changes: 0 additions & 13 deletions src/image.hpp
Expand Up @@ -126,25 +126,16 @@ namespace image {

surface load_from_disk(const locator &loc);

#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture load_texture(const locator &loc,
const int access = SDL_TEXTUREACCESS_STATIC);
#else
#ifdef SDL_GPU
sdl::ttexture load_texture(const locator &loc);
#endif
#endif

size_t hash_value(const locator::value&);


typedef cache_type<surface> image_cache;
#if SDL_VERSION_ATLEAST(2,0,0)
typedef cache_type<sdl::ttexture> texture_cache;
#else
#ifdef SDL_GPU
typedef cache_type<sdl::ttexture> texture_cache;
#endif
#endif
typedef cache_type<bool> bool_cache;

Expand Down Expand Up @@ -218,12 +209,8 @@ namespace image {
///note that this surface must be freed by the user by calling
///SDL_FreeSurface()
surface get_image(const locator& i_locator, TYPE type=UNSCALED);
#if SDL_VERSION_ATLEAST(2,0,0)
sdl::ttexture get_texture(const locator& loc, TYPE type=UNSCALED);
#else
#ifdef SDL_GPU
sdl::ttexture get_texture(const locator &loc, TYPE type=UNSCALED);
#endif
#endif

///function to get the surface corresponding to an image.
Expand Down

0 comments on commit 707cda2

Please sign in to comment.