From 7d3535645f6faafce314efcb83017ce09f2ada34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Boldizs=C3=A1r=20Lipka?= Date: Thu, 10 Jul 2014 05:57:46 +0200 Subject: [PATCH] Rename ttexture to timage. --- src/display.cpp | 38 +++++++++---------- src/display.hpp | 26 ++++++------- src/game_display.cpp | 18 ++++----- src/image.cpp | 22 +++++------ src/image.hpp | 6 +-- src/loadscreen.cpp | 2 +- src/loadscreen.hpp | 2 +- src/sdl/texture.cpp | 76 +++++++++++++++++++------------------- src/sdl/texture.hpp | 18 ++++----- src/storyscreen/part.cpp | 2 +- src/storyscreen/part.hpp | 2 +- src/storyscreen/render.cpp | 10 ++--- src/storyscreen/render.hpp | 2 +- src/text.cpp | 4 +- src/text.hpp | 4 +- src/unit_drawer.cpp | 10 ++--- src/video.cpp | 2 +- src/video.hpp | 4 +- 18 files changed, 124 insertions(+), 124 deletions(-) diff --git a/src/display.cpp b/src/display.cpp index d5595082d403..9b404d519764 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -338,7 +338,7 @@ void display::init_flags_for_side_internal(size_t n, const std::string& side_col } #ifdef SDL_GPU -sdl::ttexture display::get_flag(const map_location& loc) +sdl::timage display::get_flag(const map_location& loc) { t_translation::t_terrain terrain = get_map().get_terrain(loc); @@ -357,7 +357,7 @@ sdl::ttexture display::get_flag(const map_location& loc) } } - return sdl::ttexture(); + return sdl::timage(); } #else surface display::get_flag(const map_location& loc) @@ -949,7 +949,7 @@ static const std::string& get_direction(size_t n) } #ifdef SDL_GPU -std::vector display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type) +std::vector display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type) #else std::vector display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type) #endif @@ -1031,14 +1031,14 @@ std::vector display::get_fog_shroud_images(const map_location& loc, ima // now get the surfaces #ifdef SDL_GPU - std::vector res; + std::vector res; #else std::vector res; #endif BOOST_FOREACH(std::string& name, names) { #ifdef SDL_GPU - const sdl::ttexture img(image::get_texture(name, image_type)); + const sdl::timage img(image::get_texture(name, image_type)); if (!img.null()) res.push_back(img); #else @@ -1053,7 +1053,7 @@ std::vector display::get_fog_shroud_images(const map_location& loc, ima // TODO: proper SDL_gpu implementation #ifdef SDL_GPU -std::vector display::get_terrain_images( +std::vector display::get_terrain_images( const map_location &loc, const std::string& timeid, image::TYPE image_type, @@ -1066,7 +1066,7 @@ std::vector display::get_terrain_images(const map_location &loc, #endif { #ifdef SDL_GPU - std::vector res; + std::vector res; #else std::vector res; #endif @@ -1143,7 +1143,7 @@ std::vector display::get_terrain_images(const map_location &loc, if (!surf.null()) { #ifdef SDL_GPU - res.push_back(sdl::ttexture(surf)); + res.push_back(sdl::timage(surf)); #else res.push_back(surf); #endif @@ -1157,14 +1157,14 @@ std::vector display::get_terrain_images(const map_location &loc, #ifdef SDL_GPU void display::drawing_buffer_add(const tdrawing_layer layer, const map_location& loc, int x, int y, - const sdl::ttexture &img) + const sdl::timage &img) { drawing_buffer_.push_back(tblit(layer, loc, x, y, img)); } void display::drawing_buffer_add(const tdrawing_layer layer, const map_location& loc, int x, int y, - const std::vector &imgs) + const std::vector &imgs) { drawing_buffer_.push_back(tblit(layer, loc, x, y, imgs)); } @@ -1276,7 +1276,7 @@ void display::drawing_buffer_commit() */ BOOST_FOREACH(tblit &blit, drawing_buffer_) { - BOOST_FOREACH(sdl::ttexture& img, blit.images()) { + BOOST_FOREACH(sdl::timage& img, blit.images()) { if (!img.null()) { screen_.draw_texture(img, blit.x(), blit.y()); } @@ -1545,8 +1545,8 @@ void display::draw_text_in_hex(const map_location& loc, const int y = get_location_y(loc) - text_surf->h/2 + static_cast(y_in_hex* hex_size()); #ifdef SDL_GPU - sdl::ttexture text_img(text_surf); - sdl::ttexture back_img(back_surf); + sdl::timage text_img(text_surf); + sdl::timage back_img(back_surf); for (int dy=-1; dy <= 1; ++dy) { for (int dx=-1; dx <= 1; ++dx) { @@ -1612,7 +1612,7 @@ void display::render_image(int x, int y, const display::tdrawing_layer drawing_l return; } #ifdef SDL_GPU - sdl::ttexture img(surf); + sdl::timage img(surf); if(submerged > 0.0) { // divide the surface into 2 parts @@ -2760,7 +2760,7 @@ void display::draw_hex(const map_location& loc) { ? image::get_lighted_image(overlays.first->second.image, lt, image::SCALED_TO_HEX) : image::get_image(overlays.first->second.image, image_type); #ifdef SDL_GPU - drawing_buffer_add(LAYER_TERRAIN_BG, loc, xpos, ypos, sdl::ttexture(surf)); + drawing_buffer_add(LAYER_TERRAIN_BG, loc, xpos, ypos, sdl::timage(surf)); #else drawing_buffer_add(LAYER_TERRAIN_BG, loc, xpos, ypos, surf); #endif @@ -2854,8 +2854,8 @@ void display::draw_hex(const map_location& loc) { off_y -= text->h / 2; } #ifdef SDL_GPU - drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::ttexture(bg)); - drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::ttexture(text)); + drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::timage(bg)); + drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::timage(text)); #else drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, bg); drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, text); @@ -2873,8 +2873,8 @@ void display::draw_hex(const map_location& loc) { off_y -= text->h / 2; } #ifdef SDL_GPU - drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::ttexture(bg)); - drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::ttexture(text)); + drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::timage(bg)); + drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, sdl::timage(text)); #else drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, bg); drawing_buffer_add(LAYER_FOG_SHROUD, loc, off_x, off_y, text); diff --git a/src/display.hpp b/src/display.hpp index a3d9f57f6542..d1928b81d49f 100644 --- a/src/display.hpp +++ b/src/display.hpp @@ -439,11 +439,11 @@ class display : public filter_context * mouseover_hex_overlay_ require a prerendered surface * and is drawn underneath the mouse's location */ - void set_mouseover_hex_overlay(const sdl::ttexture& image) + void set_mouseover_hex_overlay(const sdl::timage& image) { mouseover_hex_overlay_ = image; } void clear_mouseover_hex_overlay() - { mouseover_hex_overlay_ = sdl::ttexture(); } + { mouseover_hex_overlay_ = sdl::timage(); } #else /** * mouseover_hex_overlay_ require a prerendered surface @@ -726,12 +726,12 @@ class display : public filter_context enum TERRAIN_TYPE { BACKGROUND, FOREGROUND}; #ifdef SDL_GPU - std::vector get_terrain_images(const map_location &loc, + std::vector get_terrain_images(const map_location &loc, const std::string& timeid, image::TYPE type, TERRAIN_TYPE terrain_type); - std::vector get_fog_shroud_images(const map_location& loc, image::TYPE image_type); + std::vector get_fog_shroud_images(const map_location& loc, image::TYPE image_type); #else std::vector get_terrain_images(const map_location &loc, const std::string& timeid, @@ -798,10 +798,10 @@ class display : public filter_context std::set invalidated_; std::set previous_invalidated_; #ifdef SDL_GPU - sdl::ttexture mouseover_hex_overlay_; + sdl::timage mouseover_hex_overlay_; // If we're transitioning from one time of day to the next, // then we will use these two masks on top of all hexes when we blit. - sdl::ttexture tod_hex_mask1, tod_hex_mask2; + sdl::timage tod_hex_mask1, tod_hex_mask2; #else surface mouseover_hex_overlay_; // If we're transitioning from one time of day to the next, @@ -825,7 +825,7 @@ class display : public filter_context #ifdef SDL_GPU // This surface must be freed by the caller - sdl::ttexture get_flag(const map_location& loc); + sdl::timage get_flag(const map_location& loc); #else // This surface must be freed by the caller surface get_flag(const map_location& loc); @@ -966,13 +966,13 @@ class display : public filter_context public: #ifdef SDL_GPU tblit(const tdrawing_layer layer, const map_location& loc, - const int x, const int y, const sdl::ttexture& image) + const int x, const int y, const sdl::timage& image) : x_(x), y_(y), images_(1, image), key_(loc, layer) {} tblit(const tdrawing_layer layer, const map_location& loc, const int x, const int y, - const std::vector& images) + const std::vector& images) : x_(x), y_(y), images_(images), key_(loc, layer) {} #else @@ -994,7 +994,7 @@ class display : public filter_context int x() const { return x_; } int y() const { return y_; } #ifdef SDL_GPU - std::vector &images() { return images_; } + std::vector &images() { return images_; } #else const std::vector &surf() const { return surf_; } const SDL_Rect &clip() const { return clip_; } @@ -1006,7 +1006,7 @@ class display : public filter_context int x_; /**< x screen coordinate to render at. */ int y_; /**< y screen coordinate to render at. */ #ifdef SDL_GPU - std::vector images_; + std::vector images_; #else std::vector surf_; /**< surface(s) to render. */ SDL_Rect clip_; /**< @@ -1024,11 +1024,11 @@ class display : public filter_context #ifdef SDL_GPU void drawing_buffer_add(const tdrawing_layer layer, const map_location& loc, int x, int y, - const sdl::ttexture& img); + const sdl::timage& img); void drawing_buffer_add(const tdrawing_layer layer, const map_location& loc, int x, int y, - const std::vector &imgs); + const std::vector &imgs); #else /** * Add an item to the drawing buffer. You need to update screen on affected area diff --git a/src/game_display.cpp b/src/game_display.cpp index 6cd77ad722d6..44e17ecbe80d 100644 --- a/src/game_display.cpp +++ b/src/game_display.cpp @@ -60,7 +60,7 @@ std::map game_display::debugHighlights_; * This function is only used internally by game_display so I have moved it out of the header into the compilaton unit. */ #ifdef SDL_GPU -std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_); +std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_); #else std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_); #endif @@ -123,12 +123,12 @@ void game_display::new_turn() #ifdef SDL_GPU if(old_mask != NULL) { const fixed_t proportion = ftofxp(1.0) - fxpdiv(i,niterations); - tod_hex_mask1 = sdl::ttexture(adjust_surface_alpha(old_mask,proportion)); + tod_hex_mask1 = sdl::timage(adjust_surface_alpha(old_mask,proportion)); } if(new_mask != NULL) { const fixed_t proportion = fxpdiv(i,niterations); - tod_hex_mask2 = sdl::ttexture(adjust_surface_alpha(new_mask,proportion)); + tod_hex_mask2 = sdl::timage(adjust_surface_alpha(new_mask,proportion)); } #else if(old_mask != NULL) { @@ -154,8 +154,8 @@ void game_display::new_turn() } #ifdef SDL_GPU - tod_hex_mask1 = sdl::ttexture(); - tod_hex_mask2 = sdl::ttexture(); + tod_hex_mask1 = sdl::timage(); + tod_hex_mask2 = sdl::timage(); #else tod_hex_mask1.assign(NULL); tod_hex_mask2.assign(NULL); @@ -373,7 +373,7 @@ void game_display::draw_hex(const map_location& loc) if (!(w->is_active() && w->has_temp_move())) { #ifdef SDL_GPU - std::vector footstepImages = footsteps_images(loc, route_, dc_); + std::vector footstepImages = footsteps_images(loc, route_, dc_); #else std::vector footstepImages = footsteps_images(loc, route_, dc_); #endif @@ -583,13 +583,13 @@ void game_display::draw_movement_info(const map_location& loc) } #ifdef SDL_GPU -std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_) +std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_) #else std::vector footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_) #endif { #ifdef SDL_GPU - std::vector res; + std::vector res; #else std::vector res; #endif @@ -618,7 +618,7 @@ std::vector footsteps_images(const map_location& loc, const pathfind::m const std::string foot_speed_prefix = game_config::foot_speed_prefix[image_number-1]; #ifdef SDL_GPU - sdl::ttexture teleport; + sdl::timage teleport; #else surface teleport = NULL; #endif diff --git a/src/image.cpp b/src/image.cpp index f3fb891c04c3..c2c5ddbc7e8b 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -623,13 +623,13 @@ surface load_from_disk(const locator &loc) } #ifdef SDL_GPU -sdl::ttexture load_texture(const locator &loc) +sdl::timage load_texture(const locator &loc) { surface img = load_from_disk(loc); if (!img.null()) { - return sdl::ttexture(img); + return sdl::timage(img); } else { - return sdl::ttexture(); + return sdl::timage(); } } #endif @@ -902,10 +902,10 @@ surface get_image(const image::locator& i_locator, TYPE type) } #ifdef SDL_GPU -sdl::ttexture get_texture(const locator& loc, TYPE type) +sdl::timage get_texture(const locator& loc, TYPE type) { if (loc.is_void()) { - return sdl::ttexture(); + return sdl::timage(); } texture_cache *cache; @@ -924,25 +924,25 @@ sdl::ttexture get_texture(const locator& loc, TYPE type) cache = &txt_hexed_images_; break; default: - return sdl::ttexture(); + return sdl::timage(); } if (!loc.in_cache(*cache)) { if (type == UNSCALED || type == SCALED_TO_ZOOM) { - sdl::ttexture txt = load_texture(loc); + sdl::timage txt = load_texture(loc); loc.add_to_cache(*cache, txt); } else if (type == BRIGHTENED) { surface surf = get_brightened(loc); - sdl::ttexture txt(surf); + sdl::timage txt(surf); loc.add_to_cache(*cache, txt); } else { surface surf = get_hexed(loc); - sdl::ttexture txt(surf); + sdl::timage txt(surf); loc.add_to_cache(*cache, txt); } } - sdl::ttexture result = loc.locate_in_cache(*cache); + sdl::timage result = loc.locate_in_cache(*cache); switch (type) { case UNSCALED: @@ -956,7 +956,7 @@ sdl::ttexture get_texture(const locator& loc, TYPE type) result.set_scale(zoom, zoom); break; default: - return sdl::ttexture(); + return sdl::timage(); } return result; diff --git a/src/image.hpp b/src/image.hpp index 2a63284552c1..de6a15f0dfe7 100644 --- a/src/image.hpp +++ b/src/image.hpp @@ -127,7 +127,7 @@ namespace image { surface load_from_disk(const locator &loc); #ifdef SDL_GPU - sdl::ttexture load_texture(const locator &loc); + sdl::timage load_texture(const locator &loc); #endif size_t hash_value(const locator::value&); @@ -135,7 +135,7 @@ namespace image { typedef cache_type image_cache; #ifdef SDL_GPU - typedef cache_type texture_cache; + typedef cache_type texture_cache; #endif typedef cache_type bool_cache; @@ -210,7 +210,7 @@ namespace image { ///SDL_FreeSurface() surface get_image(const locator& i_locator, TYPE type=UNSCALED); #ifdef SDL_GPU - sdl::ttexture get_texture(const locator &loc, TYPE type=UNSCALED); + sdl::timage get_texture(const locator &loc, TYPE type=UNSCALED); #endif ///function to get the surface corresponding to an image. diff --git a/src/loadscreen.cpp b/src/loadscreen.cpp index 81f76aa369a3..67c003a626d8 100644 --- a/src/loadscreen.cpp +++ b/src/loadscreen.cpp @@ -195,7 +195,7 @@ void loadscreen::draw_screen(const std::string &text) sdl::fill_rect(*target, textarea_, 0, 0, 0); font::ttext label; label.set_text(text, false); - sdl::ttexture txt = label.render_as_texture(); + sdl::timage txt = label.render_as_texture(); textarea_.w = txt.width(); textarea_.h = txt.height(); textarea_.x = scrx/2 + bw + bispw - textarea_.w / 2; diff --git a/src/loadscreen.hpp b/src/loadscreen.hpp index 5d27af4b33f4..b4f302797f46 100644 --- a/src/loadscreen.hpp +++ b/src/loadscreen.hpp @@ -77,7 +77,7 @@ class loadscreen { CVideo &screen_; SDL_Rect textarea_; #ifdef SDL_GPU - sdl::ttexture logo_image_; + sdl::timage logo_image_; #else surface logo_surface_; #endif diff --git a/src/sdl/texture.cpp b/src/sdl/texture.cpp index f6df59113c04..f5862921afdc 100644 --- a/src/sdl/texture.cpp +++ b/src/sdl/texture.cpp @@ -26,7 +26,7 @@ #include "rect.hpp" namespace sdl { -ttexture::ttexture(Uint16 w, Uint16 h) +timage::timage(Uint16 w, Uint16 h) : image_(NULL) , rotation_(0) , hscale_(1) @@ -45,7 +45,7 @@ ttexture::ttexture(Uint16 w, Uint16 h) } } -ttexture::ttexture(const std::string &file) +timage::timage(const std::string &file) : image_(GPU_LoadImage(file.c_str())) , rotation_(0) , hscale_(1) @@ -64,7 +64,7 @@ ttexture::ttexture(const std::string &file) } } -ttexture::ttexture(const surface &source) +timage::timage(const surface &source) : image_(GPU_CopyImageFromSurface(source)) , rotation_(0) , hscale_(1) @@ -83,7 +83,7 @@ ttexture::ttexture(const surface &source) } } -ttexture::ttexture(SDL_Surface *source) +timage::timage(SDL_Surface *source) : image_(GPU_CopyImageFromSurface(source)) , rotation_(0) , hscale_(1) @@ -102,7 +102,7 @@ ttexture::ttexture(SDL_Surface *source) } } -ttexture::ttexture() +timage::timage() : image_(NULL) , rotation_(0) , hscale_(1) @@ -115,7 +115,7 @@ ttexture::ttexture() { } -sdl::ttexture::~ttexture() +sdl::timage::~timage() { if (image_ != NULL) { image_->refcount -= 1; @@ -125,7 +125,7 @@ sdl::ttexture::~ttexture() } } -ttexture::ttexture(const ttexture &texture) +timage::timage(const timage &texture) : image_(texture.image_) , rotation_(texture.rotation_) , hscale_(texture.hscale_) @@ -141,17 +141,17 @@ ttexture::ttexture(const ttexture &texture) } } -ttexture &ttexture::operator =(const ttexture &texture) +timage &timage::operator =(const timage &texture) { if (&texture != this) { - this->~ttexture(); - new (this) ttexture(texture); + this->~timage(); + new (this) timage(texture); } return *this; } -void ttexture::draw(GPU_Target &target, const int x, const int y) +void timage::draw(GPU_Target &target, const int x, const int y) { GPU_SetImageFilter(image_, smooth_scaling_ @@ -163,73 +163,73 @@ void ttexture::draw(GPU_Target &target, const int x, const int y) y + height()/2, rotation_, hscale_, vscale_); } -void ttexture::set_rotation(float rotation) +void timage::set_rotation(float rotation) { rotation_ = rotation; } -float ttexture::rotation() const +float timage::rotation() const { return rotation_; } -void ttexture::set_hscale(float factor) +void timage::set_hscale(float factor) { hscale_ = factor; } -void ttexture::set_vscale(float factor) +void timage::set_vscale(float factor) { vscale_ = factor; } -void ttexture::set_scale(float hfactor, float vfactor) +void timage::set_scale(float hfactor, float vfactor) { hscale_ = hfactor; vscale_ = vfactor; } -float ttexture::hscale() const +float timage::hscale() const { return hscale_; } -float ttexture::vscale() const +float timage::vscale() const { return vscale_; } -void ttexture::set_smooth_scaling(bool use_smooth) +void timage::set_smooth_scaling(bool use_smooth) { smooth_scaling_ = use_smooth; } -bool ttexture::smooth_scaling() const +bool timage::smooth_scaling() const { return smooth_scaling_; } -Uint16 ttexture::width() const +Uint16 timage::width() const { return image_->w * hscale_; } -Uint16 ttexture::height() const +Uint16 timage::height() const { return image_->h * vscale_; } -Uint16 ttexture::base_width() const +Uint16 timage::base_width() const { return image_->h; } -Uint16 ttexture::base_height() const +Uint16 timage::base_height() const { return image_->w; } -void ttexture::set_clip(const SDL_Rect &rect) +void timage::set_clip(const SDL_Rect &rect) { clip_.x = rect.x; clip_.y = rect.y; @@ -237,7 +237,7 @@ void ttexture::set_clip(const SDL_Rect &rect) clip_.h = rect.h; } -SDL_Rect ttexture::clip() const +SDL_Rect timage::clip() const { SDL_Rect result; result.x = clip_.x; @@ -248,65 +248,65 @@ SDL_Rect ttexture::clip() const return result; } -void ttexture::set_alpha(Uint8 alpha) +void timage::set_alpha(Uint8 alpha) { color_mod_.unused = alpha; } -Uint8 ttexture::alpha() const +Uint8 timage::alpha() const { return color_mod_.unused; } -void ttexture::set_color_mod(Uint8 r, Uint8 g, Uint8 b) +void timage::set_color_mod(Uint8 r, Uint8 g, Uint8 b) { color_mod_.r = r; color_mod_.g = g; color_mod_.b = b; } -Uint8 ttexture::red_mod() const +Uint8 timage::red_mod() const { return color_mod_.r; } -Uint8 ttexture::green_mod() const +Uint8 timage::green_mod() const { return color_mod_.g; } -Uint8 ttexture::blue_mod() const +Uint8 timage::blue_mod() const { return color_mod_.b; } -void ttexture::set_hwrap(GPU_WrapEnum mode) +void timage::set_hwrap(GPU_WrapEnum mode) { hwrap_ = mode; } -void ttexture::set_vwrap(GPU_WrapEnum mode) +void timage::set_vwrap(GPU_WrapEnum mode) { vwrap_ = mode; } -void ttexture::set_wrap(GPU_WrapEnum hmode, GPU_WrapEnum vmode) +void timage::set_wrap(GPU_WrapEnum hmode, GPU_WrapEnum vmode) { hwrap_ = hmode; vwrap_ = vmode; } -GPU_WrapEnum ttexture::hwrap() const +GPU_WrapEnum timage::hwrap() const { return hwrap_; } -GPU_WrapEnum ttexture::vwrap() const +GPU_WrapEnum timage::vwrap() const { return vwrap_; } -bool ttexture::null() const +bool timage::null() const { return image_ == NULL; } diff --git a/src/sdl/texture.hpp b/src/sdl/texture.hpp index 270d9b597084..b45fffe92976 100644 --- a/src/sdl/texture.hpp +++ b/src/sdl/texture.hpp @@ -29,7 +29,7 @@ struct surface; namespace sdl { -class ttexture +class timage { public: /** @@ -38,36 +38,36 @@ class ttexture * @param w Width. * @param h Height. */ - ttexture(Uint16 w, Uint16 h); + timage(Uint16 w, Uint16 h); /** * Loads a texture from an image file. * * @param file Full path of the file. */ - ttexture(const std::string &file); + timage(const std::string &file); /** * Creates a texture from an SDL surface. * * @param source Pointer to the surface. */ - ttexture( SDL_Surface *source); + timage( SDL_Surface *source); /** * Creates a texture from an SDL surface. * * @param source The surface. */ - ttexture(const surface &source); + timage(const surface &source); - ttexture(); + timage(); - ~ttexture(); + ~timage(); - ttexture(const ttexture &texture); + timage(const timage &texture); - ttexture &operator=(const ttexture &texture); + timage &operator=(const timage &texture); /** * Render the texture on a specified target, with respect to the previously diff --git a/src/storyscreen/part.cpp b/src/storyscreen/part.cpp index f25262419a4b..b7de9281106a 100644 --- a/src/storyscreen/part.cpp +++ b/src/storyscreen/part.cpp @@ -70,7 +70,7 @@ floating_image::render_input floating_image::get_render_input(double xscale, dou #ifdef SDL_GPU render_input ri = { {0,0,0,0}, - file_.empty() ? sdl::ttexture() : image::get_texture(file_) + file_.empty() ? sdl::timage() : image::get_texture(file_) }; if(!ri.image.null()) { diff --git a/src/storyscreen/part.hpp b/src/storyscreen/part.hpp index f229630abfc5..e8e2c3ce8484 100644 --- a/src/storyscreen/part.hpp +++ b/src/storyscreen/part.hpp @@ -44,7 +44,7 @@ class floating_image { SDL_Rect rect; /**< Corrected rectangle for rendering surf. */ #ifdef SDL_GPU - sdl::ttexture image; + sdl::timage image; #else surface image; /**< Surface, scaled if required. */ #endif diff --git a/src/storyscreen/render.cpp b/src/storyscreen/render.cpp index 83a815ac9ea3..f1a760094a77 100644 --- a/src/storyscreen/render.cpp +++ b/src/storyscreen/render.cpp @@ -126,7 +126,7 @@ void part_ui::prepare_background() bool no_base_yet = true; BOOST_FOREACH(const background_layer& bl, p_.get_background_layers()) { - sdl::ttexture layer; + sdl::timage layer; if (!bl.file().empty()) { layer = image::get_texture(bl.file()); @@ -439,7 +439,7 @@ void part_ui::render_title_box() .set_foreground_color(titlebox_font_color) .set_maximum_width(titlebox_max_w) .set_maximum_height(titlebox_max_h, true); - sdl::ttexture txttxt = t.render_as_texture(); + sdl::timage txttxt = t.render_as_texture(); if(txttxt.null()) { ERR_NG << "storyscreen titlebox rendering resulted in a null surface" << std::endl; @@ -554,8 +554,8 @@ void part_ui::render_story_box_borders(SDL_Rect& update_area) const part::BLOCK_LOCATION tbl = p_.story_text_location(); if(has_background_) { - sdl::ttexture border_top; - sdl::ttexture border_bottom; + sdl::timage border_top; + sdl::timage border_bottom; if(tbl == part::BLOCK_BOTTOM || tbl == part::BLOCK_MIDDLE) { border_top = image::get_texture(storybox_top_border_path); @@ -668,7 +668,7 @@ void part_ui::render_story_box() .set_foreground_color(storybox_font_color) .set_maximum_width(max_width) .set_maximum_height(max_height, true); - sdl::ttexture txttxt = t.render_as_texture(); + sdl::timage txttxt = t.render_as_texture(); if(txttxt.null()) { ERR_NG << "storyscreen text area rendering resulted in a null texture" << std::endl; diff --git a/src/storyscreen/render.hpp b/src/storyscreen/render.hpp index 95a3019e158b..600cf563bd69 100644 --- a/src/storyscreen/render.hpp +++ b/src/storyscreen/render.hpp @@ -84,7 +84,7 @@ class part_ui SDL_Rect base_rect_; #ifdef SDL_GPU - std::vector< sdl::ttexture > background_images_; + std::vector< sdl::timage > background_images_; std::vector< std::pair > background_positions_; #else surface background_; diff --git a/src/text.cpp b/src/text.cpp index 55f9d3bc5f8d..09380c6bc4ed 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -163,7 +163,7 @@ surface ttext::render() const } #ifdef SDL_GPU -sdl::ttexture ttext::render_as_texture() const +sdl::timage ttext::render_as_texture() const { rerender(); return texture_; @@ -700,7 +700,7 @@ void ttext::rerender(const bool force) const surface_buffer_, width, height, 32, stride, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000)); #ifdef SDL_GPU - texture_ = sdl::ttexture(surface_); + texture_ = sdl::timage(surface_); #endif cairo_destroy(cr); cairo_surface_destroy(cairo_surface); diff --git a/src/text.hpp b/src/text.hpp index d0aad57cb3fc..6358b88310a3 100644 --- a/src/text.hpp +++ b/src/text.hpp @@ -88,7 +88,7 @@ class ttext * Before rendering it tests whether a redraw is needed and if so it first * redraws the texture before returning it. */ - sdl::ttexture render_as_texture() const; + sdl::timage render_as_texture() const; #endif /** Returns the width needed for the text. */ @@ -232,7 +232,7 @@ class ttext mutable sdl::ttexture texture_; #else #ifdef SDL_GPU - mutable sdl::ttexture texture_; + mutable sdl::timage texture_; #endif #endif diff --git a/src/unit_drawer.cpp b/src/unit_drawer.cpp index 910fc79cc051..91cf224dfcaf 100644 --- a/src/unit_drawer.cpp +++ b/src/unit_drawer.cpp @@ -181,8 +181,8 @@ void unit_drawer::redraw_unit (const unit & u) const draw_bars = sdl::rects_overlap(unit_rect, disp.map_outside_area()); } #ifdef SDL_GPU - sdl::ttexture ellipse_front; - sdl::ttexture ellipse_back; + sdl::timage ellipse_front; + sdl::timage ellipse_back; #else surface ellipse_front(NULL); surface ellipse_back(NULL); @@ -333,7 +333,7 @@ void unit_drawer::redraw_unit (const unit & u) const for(std::vector::const_iterator ov = u.overlays().begin(); ov != u.overlays().end(); ++ov) { #ifdef SDL_GPU - const sdl::ttexture ov_img(image::get_texture(*ov, image::SCALED_TO_ZOOM)); + const sdl::timage ov_img(image::get_texture(*ov, image::SCALED_TO_ZOOM)); if(!ov_img.null()) { disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xsrc, ysrc +adjusted_params.y, ov_img); @@ -422,7 +422,7 @@ void unit_drawer::draw_bar(const std::string& image, int xpos, int ypos, bot.h = surf->w - bot.y; #ifdef SDL_GPU - sdl::ttexture img(surf); + sdl::timage img(surf); img.set_clip(top); disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xpos, ypos, surf); img.set_clip(bot); @@ -440,7 +440,7 @@ void unit_drawer::draw_bar(const std::string& image, int xpos, int ypos, SDL_Rect filled_area = sdl::create_rect(0, 0, bar_loc.w, height-unfilled); sdl::fill_rect(filled_surf,&filled_area,SDL_MapRGBA(bar_surf->format,col.r,col.g,col.b, r_alpha)); #ifdef SDL_GPU - disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xpos + bar_loc.x, ypos + bar_loc.y + unfilled, sdl::ttexture(filled_surf)); + disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xpos + bar_loc.x, ypos + bar_loc.y + unfilled, sdl::timage(filled_surf)); #else disp.drawing_buffer_add(display::LAYER_UNIT_BAR, loc, xpos + bar_loc.x, ypos + bar_loc.y + unfilled, filled_surf); #endif diff --git a/src/video.cpp b/src/video.cpp index 815157fbb2a6..32f8ae567386 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -388,7 +388,7 @@ void CVideo::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, SDL_Rec sdl_blit(surf,srcrect,target,&dst); } #ifdef SDL_GPU -void CVideo::draw_texture(sdl::ttexture &texture, int x, int y) +void CVideo::draw_texture(sdl::timage &texture, int x, int y) { texture.draw(*render_target, x, y); } diff --git a/src/video.hpp b/src/video.hpp index 6c9bfb1b1b33..e33cc3c0a0f6 100644 --- a/src/video.hpp +++ b/src/video.hpp @@ -28,7 +28,7 @@ struct surface; #ifdef SDL_GPU namespace sdl { -struct ttexture; +struct timage; } #endif @@ -82,7 +82,7 @@ class CVideo : private boost::noncopyable { //blits a surface with black as alpha void blit_surface(int x, int y, surface surf, SDL_Rect* srcrect=NULL, SDL_Rect* clip_rect=NULL); #ifdef SDL_GPU - void draw_texture(sdl::ttexture &texture, int x, int y); + void draw_texture(sdl::timage &texture, int x, int y); #endif void flip();