[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] [pingus] 2 new revisions pushed by address@hidden on 2011-1
From: |
pingus |
Subject: |
[Pingus-CVS] [pingus] 2 new revisions pushed by address@hidden on 2011-10-11 19:03 GMT |
Date: |
Tue, 11 Oct 2011 19:08:22 +0000 |
2 new revisions:
Revision: 43aa44932e54
Author: Ingo Ruhnke <address@hidden>
Date: Tue Oct 11 12:00:47 2011
Log: Minor cleanup
http://code.google.com/p/pingus/source/detail?r=43aa44932e54
Revision: 6f96d1738ba7
Author: Ingo Ruhnke <address@hidden>
Date: Tue Oct 11 12:03:30 2011
Log: Added missing destructor in OpenGLFramebufferSurfaceImpl, fixed
memory...
http://code.google.com/p/pingus/source/detail?r=6f96d1738ba7
==============================================================================
Revision: 43aa44932e54
Author: Ingo Ruhnke <address@hidden>
Date: Tue Oct 11 12:00:47 2011
Log: Minor cleanup
http://code.google.com/p/pingus/source/detail?r=43aa44932e54
Modified:
/src/engine/display/surface.cpp
=======================================
--- /src/engine/display/surface.cpp Tue Sep 27 17:24:10 2011
+++ /src/engine/display/surface.cpp Tue Oct 11 12:00:47 2011
@@ -28,23 +28,27 @@
public:
SDL_Surface* surface;
- SurfaceImpl()
- : surface(0)
- {}
+ SurfaceImpl() :
+ surface()
+ {
+ }
SurfaceImpl(SDL_Surface* surface_) :
surface(surface_)
- {}
+ {
+ }
~SurfaceImpl()
{
if (surface)
+ {
SDL_FreeSurface(surface);
+ }
}
private:
SurfaceImpl(const SurfaceImpl&);
- SurfaceImpl & operator=(const SurfaceImpl&);
+ SurfaceImpl& operator=(const SurfaceImpl&);
};
Surface::Surface() :
@@ -282,8 +286,7 @@
Surface
Surface::scale(int w, int h)
{
- return Surface(std::shared_ptr<SurfaceImpl>
- (new SurfaceImpl(Blitter::scale_surface(impl->surface, w,
h))));
+ return
Surface(std::make_shared<SurfaceImpl>(Blitter::scale_surface(impl->surface,
w, h)));
}
Surface
==============================================================================
Revision: 6f96d1738ba7
Author: Ingo Ruhnke <address@hidden>
Date: Tue Oct 11 12:03:30 2011
Log: Added missing destructor in OpenGLFramebufferSurfaceImpl, fixed
memory leak in OpenGL renderer
Fixes issue 90
http://code.google.com/p/pingus/source/detail?r=6f96d1738ba7
Modified:
/src/engine/display/opengl/opengl_framebuffer_surface_impl.cpp
/src/engine/display/opengl/opengl_framebuffer_surface_impl.hpp
=======================================
--- /src/engine/display/opengl/opengl_framebuffer_surface_impl.cpp Sun Aug
28 14:17:09 2011
+++ /src/engine/display/opengl/opengl_framebuffer_surface_impl.cpp Tue Oct
11 12:03:30 2011
@@ -31,23 +31,23 @@
} // namespace
OpenGLFramebufferSurfaceImpl::OpenGLFramebufferSurfaceImpl(SDL_Surface*
src) :
- handle(),
- size(src->w, src->h),
- texture_size()
-{
- glGenTextures(1, &handle);
-
- texture_size.width = next_power_of_two(src->w);
- texture_size.height = next_power_of_two(src->h);
+ m_handle(),
+ m_size(src->w, src->h),
+ m_texture_size()
+{
+ glGenTextures(1, &m_handle);
+
+ m_texture_size.width = next_power_of_two(src->w);
+ m_texture_size.height = next_power_of_two(src->h);
// Convert the src surface to a format usable for upload to OpenGL
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
SDL_Surface* convert = SDL_CreateRGBSurface(SDL_SWSURFACE,
- texture_size.width,
texture_size.height, 32,
+ m_texture_size.width,
m_texture_size.height, 32,
0xff000000, 0x00ff0000,
0x0000ff00, 0x000000ff);
#else
SDL_Surface* convert = SDL_CreateRGBSurface(SDL_SWSURFACE,
- texture_size.width,
texture_size.height, 32,
+ m_texture_size.width,
m_texture_size.height, 32,
0x000000ff, 0x0000ff00,
0x00ff0000, 0xff000000);
#endif
SDL_SetAlpha(src, 0, 0);
@@ -61,7 +61,7 @@
else
assert(!"OpenGLFramebufferSurfaceImpl: Unsupported surface format");
- glBindTexture(GL_TEXTURE_2D, handle);
+ glBindTexture(GL_TEXTURE_2D, m_handle);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_UNPACK_ROW_LENGTH,
convert->pitch/convert->format->BytesPerPixel);
@@ -71,8 +71,8 @@
// Upload the surface to a texture
SDL_LockSurface(convert);
- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, texture_size.width,
texture_size.height, 0
- , sdl_format, GL_UNSIGNED_BYTE, convert->pixels);
+ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, m_texture_size.width,
m_texture_size.height, 0,
+ sdl_format, GL_UNSIGNED_BYTE, convert->pixels);
SDL_UnlockSurface(convert);
SDL_FreeSurface(convert);
@@ -81,10 +81,9 @@
glBindTexture(GL_TEXTURE_2D, 0);
}
-Surface
-OpenGLFramebufferSurfaceImpl::to_surface() const
-{
- return Surface();
+OpenGLFramebufferSurfaceImpl::~OpenGLFramebufferSurfaceImpl()
+{
+ glDeleteTextures(1, &m_handle);
}
/* EOF */
=======================================
--- /src/engine/display/opengl/opengl_framebuffer_surface_impl.hpp Thu Sep
8 19:58:25 2011
+++ /src/engine/display/opengl/opengl_framebuffer_surface_impl.hpp Tue Oct
11 12:03:30 2011
@@ -24,21 +24,24 @@
class OpenGLFramebufferSurfaceImpl : public FramebufferSurfaceImpl
{
private:
- GLuint handle;
- Size size;
- Size texture_size;
+ GLuint m_handle;
+ Size m_size;
+ Size m_texture_size;
public:
OpenGLFramebufferSurfaceImpl(SDL_Surface* src);
-
- int get_width() const { return size.width; }
- int get_height() const { return size.height; }
-
- GLuint get_handle() const { return handle; }
- Size get_texture_size() const { return texture_size; }
- Size get_size() const { return size; }
-
- Surface to_surface() const;
+ ~OpenGLFramebufferSurfaceImpl();
+
+ int get_width() const { return m_size.width; }
+ int get_height() const { return m_size.height; }
+
+ GLuint get_handle() const { return m_handle; }
+ Size get_texture_size() const { return m_texture_size; }
+ Size get_size() const { return m_size; }
+
+private:
+ OpenGLFramebufferSurfaceImpl(const OpenGLFramebufferSurfaceImpl&);
+ OpenGLFramebufferSurfaceImpl& operator=(const
OpenGLFramebufferSurfaceImpl&);
};
#endif
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] [pingus] 2 new revisions pushed by address@hidden on 2011-10-11 19:03 GMT,
pingus <=