Skip to content

Commit

Permalink
timage::width/height returns scaled and clipped dimensions.
Browse files Browse the repository at this point in the history
Instead of just scaled.
  • Loading branch information
lipk committed Jul 21, 2014
1 parent a190cdd commit 56b873b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions src/sdl/image.cpp
Expand Up @@ -134,8 +134,8 @@ timage &timage::operator =(const timage &texture)

void timage::draw(GPU_Target &target, const int x, const int y)
{
GPU_BlitTransform(image_, clip_, &target, x + width()/2,
y + height()/2, *rotation_, *hscale_, *vscale_);
GPU_BlitTransform(image_, clip_, &target, x + width()/2, y + height()/2,
*rotation_, *hscale_, *vscale_);
}

void timage::set_rotation(float rotation)
Expand Down Expand Up @@ -185,14 +185,14 @@ bool timage::smooth_scaling() const
return image_->filter_mode == GPU_FILTER_LINEAR;
}

Uint16 timage::width() const
int timage::width() const
{
return image_->w * *hscale_;
return clip_->w * *hscale_;
}

Uint16 timage::height() const
int timage::height() const
{
return image_->h * *vscale_;
return clip_->h * *vscale_;
}

Uint16 timage::base_width() const
Expand Down
8 changes: 4 additions & 4 deletions src/sdl/image.hpp
Expand Up @@ -136,14 +136,14 @@ class timage
bool smooth_scaling() const;

/**
* Returns the width of the texture after scaling applied.
* Returns the width of the texture after scaling and clipping applied.
*/
Uint16 width() const;
int width() const;

/**
* Returns the height of the texture after scaling applied.
* Returns the height of the texture after scaling and clipping applied.
*/
Uint16 height() const;
int height() const;

/**
* Returns the width of the texture before scaling.
Expand Down

0 comments on commit 56b873b

Please sign in to comment.