Skip to content

Commit

Permalink
Add clone() function to timage.
Browse files Browse the repository at this point in the history
  • Loading branch information
lipk committed Jul 17, 2014
1 parent 2e278b3 commit c3014d8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/sdl/image.cpp
Expand Up @@ -287,6 +287,21 @@ bool timage::null() const
return image_ == NULL;
}

timage timage::clone() const
{
timage res;
res.image_ = GPU_CopyImage(image_);
res.set_alpha(alpha());
res.set_clip(clip());
res.set_color_mod(red_mod(), green_mod(), blue_mod());
res.set_wrap(hwrap(), vwrap());
res.set_rotation(rotation());
res.set_scale(hscale(), vscale());
res.set_smooth_scaling(smooth_scaling());

return res;
}

}

#endif
2 changes: 2 additions & 0 deletions src/sdl/image.hpp
Expand Up @@ -243,6 +243,8 @@ class timage
*/
bool null() const;

timage clone() const;

private:
/** The texture itself. */
GPU_Image *image_;
Expand Down

0 comments on commit c3014d8

Please sign in to comment.