From 59fbd4742b96ecba23c505e9b7bd2f90775834f0 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Tue, 13 Jun 2017 05:40:21 +1100 Subject: [PATCH] GUI2/Canvas: made use of CVideo::render_copy --- src/gui/core/canvas.cpp | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/gui/core/canvas.cpp b/src/gui/core/canvas.cpp index 85418920f589..6fd4d202c93a 100644 --- a/src/gui/core/canvas.cpp +++ b/src/gui/core/canvas.cpp @@ -1052,7 +1052,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"; @@ -1180,6 +1180,8 @@ void image_shape::draw( surf = image_; } + const bool flip_v = vertical_mirror_(local_variables); + #ifdef SW_RENDERING_LEGACY_MODE /* HACK: not sure why, but SW rendering has some problems with copying the surface to the texture and * corrupts certain semi-transparent pixels. This is a hacky workaround. @@ -1198,11 +1200,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) @@ -1306,7 +1304,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")); @@ -1394,7 +1392,7 @@ void text_shape::draw( */ texture txt(surf); - SDL_RenderCopy(renderer, txt, nullptr, &dst); + CVideo::get_singleton().render_copy(txt, nullptr, &dst); } /***** ***** ***** ***** ***** CANVAS ***** ***** ***** ***** *****/ @@ -1484,7 +1482,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)