X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fvideo%2Fsurface.hpp;h=d90494bfd4576de151cac46f28880a3eec39e1b2;hb=472d0ad804844d28811c86f03da74b6d6be53f1b;hp=e1b7cd425f9d474005f6ff5fb22d7b84f92afafb;hpb=20efd7620620892d92b1c7df124c3a0c8df22a82;p=supertux.git diff --git a/src/video/surface.hpp b/src/video/surface.hpp index e1b7cd425..d90494bfd 100644 --- a/src/video/surface.hpp +++ b/src/video/surface.hpp @@ -26,6 +26,7 @@ #include #include "math/vector.hpp" #include "texture.hpp" +#include "video_systems.hpp" /** * A rectangular image. @@ -36,6 +37,7 @@ class Surface { private: Texture* texture; + void *surface_data; int x; int y; int w; @@ -51,6 +53,7 @@ public: texture->ref(); w = texture->get_image_width(); h = texture->get_image_height(); + surface_data = new_surface_data(*this); } Surface(const std::string& file, int x, int y, int w, int h) : @@ -59,6 +62,7 @@ public: flipx(false) { texture->ref(); + surface_data = new_surface_data(*this); } Surface(const Surface& other) : @@ -68,10 +72,12 @@ public: flipx(false) { texture->ref(); + surface_data = new_surface_data(*this); } ~Surface() { + free_surface_data(surface_data); texture->unref(); } @@ -103,6 +109,11 @@ public: return texture; } + void *get_surface_data() const + { + return surface_data; + } + int get_x() const { return x; @@ -131,30 +142,6 @@ public: */ Vector get_size() const { return Vector(get_width(), get_height()); } - - float get_uv_left() const - { - return (float) (x + (flipx ? w : 0)) / texture->get_texture_width(); - } - - float get_uv_top() const - { - return (float) y / texture->get_texture_height(); - } - - float get_uv_right() const - { - return (float) (x + (flipx ? 0 : w)) / texture->get_texture_width(); - } - - float get_uv_bottom() const - { - return (float) (y + h) / texture->get_texture_height(); - } - - //void draw_part(float src_x, float src_y, float dst_x, float dst_y, - // float width, float height, float alpha, - // DrawingEffect effect) const; }; #endif