projects
/
supertux.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Added const some member function qualifiers in Controller
[supertux.git]
/
src
/
video
/
surface.cpp
diff --git
a/src/video/surface.cpp
b/src/video/surface.cpp
index
6df0cf1
..
2214293
100644
(file)
--- a/
src/video/surface.cpp
+++ b/
src/video/surface.cpp
@@
-21,7
+21,7
@@
#include <SDL.h>
#include "video/texture.hpp"
#include <SDL.h>
#include "video/texture.hpp"
-#include "video/video_system
s
.hpp"
+#include "video/video_system.hpp"
SurfacePtr
Surface::create(const std::string& file)
SurfacePtr
Surface::create(const std::string& file)
@@
-36,25
+36,23
@@
Surface::create(const std::string& file, const Rect& rect)
}
Surface::Surface(const std::string& file) :
}
Surface::Surface(const std::string& file) :
- texture(
texture_manager
->get(file)),
+ texture(
TextureManager::current()
->get(file)),
surface_data(),
surface_data(),
- rect(0, 0,
+ rect(0, 0,
Size(texture->get_image_width(),
texture->get_image_height())),
flipx(false)
{
Size(texture->get_image_width(),
texture->get_image_height())),
flipx(false)
{
- texture->ref();
- surface_data = VideoSystem::new_surface_data(*this);
+ surface_data = VideoSystem::current()->new_surface_data(*this);
}
Surface::Surface(const std::string& file, const Rect& rect_) :
}
Surface::Surface(const std::string& file, const Rect& rect_) :
- texture(
texture_manager
->get(file, rect_)),
+ texture(
TextureManager::current()
->get(file, rect_)),
surface_data(),
rect(0, 0, Size(rect_.get_width(), rect_.get_height())),
flipx(false)
{
surface_data(),
rect(0, 0, Size(rect_.get_width(), rect_.get_height())),
flipx(false)
{
- texture->ref();
- surface_data = VideoSystem::new_surface_data(*this);
+ surface_data = VideoSystem::current()->new_surface_data(*this);
}
Surface::Surface(const Surface& rhs) :
}
Surface::Surface(const Surface& rhs) :
@@
-63,24
+61,19
@@
Surface::Surface(const Surface& rhs) :
rect(rhs.rect),
flipx(false)
{
rect(rhs.rect),
flipx(false)
{
- texture->ref();
- surface_data = VideoSystem::new_surface_data(*this);
+ surface_data = VideoSystem::current()->new_surface_data(*this);
}
}
-const Surface&
-Surface::operator=(const Surface& rhs)
+Surface::~Surface()
{
{
- rhs.texture->ref();
- texture->unref();
- texture = rhs.texture;
- rect = rhs.rect;
- return *this;
+ VideoSystem::current()->free_surface_data(surface_data);
}
}
-Surface::~Surface()
+SurfacePtr
+Surface::clone() const
{
{
-
VideoSystem::free_surface_data(surface_data
);
-
texture->unref()
;
+
SurfacePtr surface(new Surface(*this)
);
+
return surface
;
}
/** flip the surface horizontally */
}
/** flip the surface horizontally */
@@
-94,13
+87,13
@@
bool Surface::get_flipx() const
return flipx;
}
return flipx;
}
-Texture
*
+Texture
Ptr
Surface::get_texture() const
{
return texture;
}
Surface::get_texture() const
{
return texture;
}
-SurfaceData*
+SurfaceData*
Surface::get_surface_data() const
{
return surface_data;
Surface::get_surface_data() const
{
return surface_data;
@@
-118,13
+111,13
@@
Surface::get_y() const
return rect.top;
}
return rect.top;
}
-int
+int
Surface::get_width() const
{
return rect.get_width();
}
Surface::get_width() const
{
return rect.get_width();
}
-int
+int
Surface::get_height() const
{
return rect.get_height();
Surface::get_height() const
{
return rect.get_height();
@@
-133,13
+126,13
@@
Surface::get_height() const
Vector
Surface::get_position() const
{
Vector
Surface::get_position() const
{
- return Vector(get_x(), get_y());
+ return Vector(get_x(), get_y());
}
Vector
Surface::get_size() const
{
}
Vector
Surface::get_size() const
{
- return Vector(get_width(), get_height());
+ return Vector(get_width(), get_height());
}
/* EOF */
}
/* EOF */