Skip to content

Commit

Permalink
GUI2/Canvas: made use of CVideo::render_copy
Browse files Browse the repository at this point in the history
  • Loading branch information
Vultraz committed Aug 12, 2017
1 parent 23b0fdb commit 8dc4be6
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/gui/core/canvas.cpp
Expand Up @@ -1054,7 +1054,7 @@ void image_shape::dimension_validation(unsigned value, const std::string& name,
void image_shape::draw(
const int /*canvas_w*/,
const int /*canvas_h*/,
SDL_Renderer* renderer,
SDL_Renderer* /*renderer*/,
wfl::map_formula_callable& variables)
{
DBG_GUI_D << "Image: draw.\n";
Expand Down Expand Up @@ -1179,6 +1179,8 @@ void image_shape::draw(
surf = image_;
}

const bool flip_v = vertical_mirror_(local_variables);

dst_clip.w = w ? w : surf->w;
dst_clip.h = h ? h : surf->h;

Expand All @@ -1190,11 +1192,7 @@ void image_shape::draw(
*/
texture txt(surf);

if(vertical_mirror_(local_variables)) {
SDL_RenderCopyEx(renderer, txt, nullptr, &dst_clip, 0, nullptr, SDL_FLIP_VERTICAL);
} else {
SDL_RenderCopy(renderer, txt, nullptr, &dst_clip);
}
CVideo::get_singleton().render_copy(txt, nullptr, &dst_clip, false, flip_v);
}

image_shape::resize_mode image_shape::get_resize_mode(const std::string& resize_mode)
Expand Down Expand Up @@ -1298,7 +1296,7 @@ text_shape::text_shape(const config& cfg)
void text_shape::draw(
const int canvas_w,
const int canvas_h,
SDL_Renderer* renderer,
SDL_Renderer* /*renderer*/,
wfl::map_formula_callable& variables)
{
assert(variables.has_key("text"));
Expand Down Expand Up @@ -1386,7 +1384,7 @@ void text_shape::draw(
*/
texture txt(surf);

SDL_RenderCopy(renderer, txt, nullptr, &dst);
CVideo::get_singleton().render_copy(txt, nullptr, &dst);
}

/***** ***** ***** ***** ***** CANVAS ***** ***** ***** ***** *****/
Expand Down Expand Up @@ -1493,7 +1491,7 @@ void canvas::render()
#endif

// Copy the entire texture to the full viewport.
SDL_RenderCopy(renderer_, texture_, nullptr, nullptr);
CVideo::get_singleton().render_copy(texture_);
}

void canvas::parse_cfg(const config& cfg)
Expand Down

0 comments on commit 8dc4be6

Please sign in to comment.