Move ttexture::draw calls into CVideo::draw_texture.
This commit is contained in:
parent
ab9835efca
commit
aeb1f5ea84
3 changed files with 22 additions and 5 deletions
|
@ -474,7 +474,7 @@ void part_ui::render_title_box()
|
|||
sdl::fill_rect(*target, box, titleshadow_r, titleshadow_g, titleshadow_b,
|
||||
titleshadow_a);
|
||||
|
||||
txttxt.draw(*target, titlebox_x, titlebox_y);
|
||||
video_.draw_texture(txttxt, titlebox_x, titlebox_y);
|
||||
#else
|
||||
const std::string& titletxt = p_.title();
|
||||
if(titletxt.empty()) {
|
||||
|
@ -556,7 +556,6 @@ void part_ui::render_story_box_borders(SDL_Rect& update_area)
|
|||
if(has_background_) {
|
||||
sdl::ttexture border_top;
|
||||
sdl::ttexture border_bottom;
|
||||
GPU_Target *target = get_render_target();
|
||||
|
||||
if(tbl == part::BLOCK_BOTTOM || tbl == part::BLOCK_MIDDLE) {
|
||||
border_top = image::get_texture(storybox_top_border_path);
|
||||
|
@ -576,14 +575,16 @@ void part_ui::render_story_box_borders(SDL_Rect& update_area)
|
|||
const float xscale = float(screen_area().w) / border_top.width();
|
||||
border_top.set_hscale(xscale);
|
||||
//TODO: blurring
|
||||
border_top.draw(*target, 0, update_area.y - border_top.height());
|
||||
video_.draw_texture(border_top, 0,
|
||||
update_area.y - border_top.height());
|
||||
}
|
||||
|
||||
if(border_bottom.null() != true) {
|
||||
const float xscale = float(screen_area().w) / border_bottom.width();
|
||||
border_bottom.set_hscale(xscale);
|
||||
//TODO: blurring
|
||||
border_bottom.draw(*target, 0, update_area.y + update_area.h);
|
||||
video_.draw_texture(border_bottom, 0,
|
||||
update_area.y - border_top.height());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -734,7 +735,7 @@ void part_ui::render_story_box()
|
|||
{
|
||||
dstrect.y = fix_text_y + scan.y + storybox_padding;
|
||||
txttxt.set_clip(scan);
|
||||
txttxt.draw(*target, dstrect.x, dstrect.y);
|
||||
video_.draw_texture(txttxt, dstrect.x, dstrect.y);
|
||||
video_.flip();
|
||||
++scan.y;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ struct event {
|
|||
bool in;
|
||||
event(const SDL_Rect& rect, bool i) : x(i ? rect.x : rect.x + rect.w), y(rect.y), w(rect.w), h(rect.h), in(i) { }
|
||||
};
|
||||
#ifndef SDL_GPU
|
||||
bool operator<(const event& a, const event& b) {
|
||||
if (a.x != b.x) return a.x < b.x;
|
||||
if (a.in != b.in) return a.in;
|
||||
|
@ -105,6 +106,7 @@ bool operator<(const event& a, const event& b) {
|
|||
bool operator==(const event& a, const event& b) {
|
||||
return a.x == b.x && a.y == b.y && a.w == b.w && a.h == b.h && a.in == b.in;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct segment {
|
||||
int x, count;
|
||||
|
@ -117,6 +119,7 @@ std::vector<SDL_Rect> update_rects;
|
|||
std::vector<event> events;
|
||||
std::map<int, segment> segments;
|
||||
|
||||
#ifndef SDL_GPU
|
||||
static void calc_rects()
|
||||
{
|
||||
events.clear();
|
||||
|
@ -209,16 +212,19 @@ static void calc_rects()
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
bool update_all = false;
|
||||
}
|
||||
|
||||
#ifndef SDL_GPU
|
||||
static void clear_updates()
|
||||
{
|
||||
update_all = false;
|
||||
update_rects.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -382,6 +388,11 @@ void CVideo::blit_surface(int x, int y, surface surf, SDL_Rect* srcrect, SDL_Rec
|
|||
sdl_blit(surf,srcrect,target,&dst);
|
||||
}
|
||||
|
||||
void CVideo::draw_texture(sdl::ttexture &texture, int x, int y)
|
||||
{
|
||||
texture.draw(*render_target, x, y);
|
||||
}
|
||||
|
||||
void CVideo::make_fake()
|
||||
{
|
||||
fake_screen_ = true;
|
||||
|
|
|
@ -25,6 +25,10 @@
|
|||
#endif
|
||||
|
||||
struct surface;
|
||||
namespace sdl
|
||||
{
|
||||
struct ttexture;
|
||||
}
|
||||
|
||||
//possible flags when setting video modes
|
||||
#define FULL_SCREEN SDL_FULLSCREEN
|
||||
|
@ -75,6 +79,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);
|
||||
void draw_texture(sdl::ttexture &texture, int x, int y);
|
||||
void flip();
|
||||
|
||||
surface& getSurface();
|
||||
|
|
Loading…
Add table
Reference in a new issue