Rename ttexture to timage.

This commit is contained in:
Boldizsár Lipka 2014-07-10 05:57:46 +02:00
parent 0acb2e1529
commit 7d3535645f
18 changed files with 124 additions and 124 deletions

View file

@ -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<sdl::ttexture> display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type)
std::vector<sdl::timage> display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type)
#else
std::vector<surface> display::get_fog_shroud_images(const map_location& loc, image::TYPE image_type)
#endif
@ -1031,14 +1031,14 @@ std::vector<surface> display::get_fog_shroud_images(const map_location& loc, ima
// now get the surfaces
#ifdef SDL_GPU
std::vector<sdl::ttexture> res;
std::vector<sdl::timage> res;
#else
std::vector<surface> 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<surface> display::get_fog_shroud_images(const map_location& loc, ima
// TODO: proper SDL_gpu implementation
#ifdef SDL_GPU
std::vector<sdl::ttexture> display::get_terrain_images(
std::vector<sdl::timage> display::get_terrain_images(
const map_location &loc,
const std::string& timeid,
image::TYPE image_type,
@ -1066,7 +1066,7 @@ std::vector<surface> display::get_terrain_images(const map_location &loc,
#endif
{
#ifdef SDL_GPU
std::vector<sdl::ttexture> res;
std::vector<sdl::timage> res;
#else
std::vector<surface> res;
#endif
@ -1143,7 +1143,7 @@ std::vector<surface> 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<surface> 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<sdl::ttexture> &imgs)
const std::vector<sdl::timage> &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<int>(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);

View file

@ -439,11 +439,11 @@ public:
* 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 @@ protected:
enum TERRAIN_TYPE { BACKGROUND, FOREGROUND};
#ifdef SDL_GPU
std::vector<sdl::ttexture> get_terrain_images(const map_location &loc,
std::vector<sdl::timage> get_terrain_images(const map_location &loc,
const std::string& timeid,
image::TYPE type,
TERRAIN_TYPE terrain_type);
std::vector<sdl::ttexture> get_fog_shroud_images(const map_location& loc, image::TYPE image_type);
std::vector<sdl::timage> get_fog_shroud_images(const map_location& loc, image::TYPE image_type);
#else
std::vector<surface> get_terrain_images(const map_location &loc,
const std::string& timeid,
@ -798,10 +798,10 @@ protected:
std::set<map_location> invalidated_;
std::set<map_location> 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 @@ private:
#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 @@ protected:
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<sdl::ttexture>& images)
const std::vector<sdl::timage>& images)
: x_(x), y_(y), images_(images), key_(loc, layer)
{}
#else
@ -994,7 +994,7 @@ protected:
int x() const { return x_; }
int y() const { return y_; }
#ifdef SDL_GPU
std::vector<sdl::ttexture> &images() { return images_; }
std::vector<sdl::timage> &images() { return images_; }
#else
const std::vector<surface> &surf() const { return surf_; }
const SDL_Rect &clip() const { return clip_; }
@ -1006,7 +1006,7 @@ protected:
int x_; /**< x screen coordinate to render at. */
int y_; /**< y screen coordinate to render at. */
#ifdef SDL_GPU
std::vector<sdl::ttexture> images_;
std::vector<sdl::timage> images_;
#else
std::vector<surface> surf_; /**< surface(s) to render. */
SDL_Rect clip_; /**<
@ -1024,11 +1024,11 @@ public:
#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<sdl::ttexture> &imgs);
const std::vector<sdl::timage> &imgs);
#else
/**
* Add an item to the drawing buffer. You need to update screen on affected area

View file

@ -60,7 +60,7 @@ std::map<map_location,fixed_t> 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<sdl::ttexture> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_);
std::vector<sdl::timage> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_);
#else
std::vector<surface> 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<sdl::ttexture> footstepImages = footsteps_images(loc, route_, dc_);
std::vector<sdl::timage> footstepImages = footsteps_images(loc, route_, dc_);
#else
std::vector<surface> 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<sdl::ttexture> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_)
std::vector<sdl::timage> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_)
#else
std::vector<surface> footsteps_images(const map_location& loc, const pathfind::marked_route & route_, const display_context * dc_)
#endif
{
#ifdef SDL_GPU
std::vector<sdl::ttexture> res;
std::vector<sdl::timage> res;
#else
std::vector<surface> res;
#endif
@ -618,7 +618,7 @@ std::vector<surface> 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

View file

@ -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;

View file

@ -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<surface> image_cache;
#ifdef SDL_GPU
typedef cache_type<sdl::ttexture> texture_cache;
typedef cache_type<sdl::timage> texture_cache;
#endif
typedef cache_type<bool> 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.

View file

@ -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;

View file

@ -77,7 +77,7 @@ private:
CVideo &screen_;
SDL_Rect textarea_;
#ifdef SDL_GPU
sdl::ttexture logo_image_;
sdl::timage logo_image_;
#else
surface logo_surface_;
#endif

View file

@ -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;
}

View file

@ -29,7 +29,7 @@ struct surface;
namespace sdl
{
class ttexture
class timage
{
public:
/**
@ -38,36 +38,36 @@ public:
* @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

View file

@ -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()) {

View file

@ -44,7 +44,7 @@ public:
{
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

View file

@ -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;

View file

@ -84,7 +84,7 @@ private:
SDL_Rect base_rect_;
#ifdef SDL_GPU
std::vector< sdl::ttexture > background_images_;
std::vector< sdl::timage > background_images_;
std::vector< std::pair<int, int> > background_positions_;
#else
surface background_;

View file

@ -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);

View file

@ -88,7 +88,7 @@ public:
* 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 @@ private:
mutable sdl::ttexture texture_;
#else
#ifdef SDL_GPU
mutable sdl::ttexture texture_;
mutable sdl::timage texture_;
#endif
#endif

View file

@ -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<std::string>::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

View file

@ -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);
}

View file

@ -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();