Removed render_input code from storyscreen parts

This isn't needed anymore. The calculating of the actual loc to draw the floating images is now handled by
the Store Viewer dialog itself.
This commit is contained in:
Charles Dang 2017-05-03 19:25:49 +11:00
parent efb0fe05e9
commit 71740c8216
2 changed files with 2 additions and 46 deletions

View file

@ -28,7 +28,6 @@
#include "game_events/pump.hpp"
#include "image.hpp"
#include "serialization/string_utils.hpp"
#include "sdl/utils.hpp"
#include "variable.hpp"
namespace storyscreen {
@ -63,35 +62,6 @@ void floating_image::assign(const floating_image& fi)
autoscaled_ = fi.autoscaled_; centered_ = fi.centered_;
}
floating_image::render_input floating_image::get_render_input(double xscale, double yscale, SDL_Rect& dst_rect) const
{
render_input ri = {
{0,0,0,0},
file_.empty() ? nullptr : image::get_image(file_)
};
if(!ri.image.null()) {
if(autoscaled_) {
ri.image = scale_surface(
ri.image,
static_cast<int>(ri.image->w * xscale),
static_cast<int>(ri.image->h * yscale)
);
}
ri.rect.x = static_cast<int>(x_*xscale) + dst_rect.x;
ri.rect.y = static_cast<int>(y_*yscale) + dst_rect.y;
ri.rect.w = ri.image->w;
ri.rect.h = ri.image->h;
if(centered_) {
ri.rect.x -= ri.rect.w / 2;
ri.rect.y -= ri.rect.h / 2;
}
}
return ri;
}
background_layer::background_layer()
: scale_horizontally_(true)
, scale_vertically_(true)

View file

@ -24,8 +24,6 @@
#include <utility>
#include <vector>
#include "sdl/surface.hpp"
class config;
class vconfig;
class display;
@ -39,12 +37,6 @@ namespace storyscreen {
class floating_image
{
public:
struct render_input
{
SDL_Rect rect; /**< Corrected rectangle for rendering surf. */
surface image; /**< Surface, scaled if required. */
};
/**
* WML-based constructor.
* @param cfg Object corresponding to a [image] block's contents from
@ -69,7 +61,7 @@ public:
/**
* Returns the referential X coordinate of the image.
* The actual (corrected) value is determined at render time - see get_render_input().
* The actual (corrected) value is determined at render time.
*/
int ref_x() const {
return x_;
@ -77,7 +69,7 @@ public:
/**
* Returns the referential Y coordinate of the image.
* The actual (corrected) value is determined at render time - see get_render_input().
* The actual (corrected) value is determined at render time.
*/
int ref_y() const {
return y_;
@ -100,12 +92,6 @@ public:
*/
int display_delay() const { return delay_; }
/**
* Gets a render_input object for use by the rendering code after applying
* any geometric transformations required.
*/
render_input get_render_input(double xscale, double yscale, SDL_Rect& dst_rect) const;
private:
std::string file_;
int x_, y_; // referential (non corrected) x,y