Skip to content

Commit

Permalink
Removed render_input code from storyscreen parts
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Vultraz committed May 3, 2017
1 parent efb0fe0 commit 71740c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 46 deletions.
30 changes: 0 additions & 30 deletions src/storyscreen/part.cpp
Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down
18 changes: 2 additions & 16 deletions src/storyscreen/part.hpp
Expand Up @@ -24,8 +24,6 @@
#include <utility>
#include <vector>

#include "sdl/surface.hpp"

class config;
class vconfig;
class display;
Expand All @@ -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
Expand All @@ -69,15 +61,15 @@ class floating_image

/**
* 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_;
}

/**
* 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_;
Expand All @@ -100,12 +92,6 @@ class floating_image
*/
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
Expand Down

0 comments on commit 71740c8

Please sign in to comment.