RageSurface and RageSurfaceFormat copy ctors

This commit is contained in:
Glenn Maynard
2004-07-14 20:00:00 +00:00
parent c2f3a60ebb
commit 2fe0d2021e
2 changed files with 21 additions and 0 deletions
+19
View File
@@ -43,6 +43,13 @@ RageSurfaceFormat::RageSurfaceFormat()
palette = NULL;
}
RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy )
{
memcpy( this, &cpy, sizeof(RageSurfaceFormat) );
if( palette )
palette = new RageSurfacePalette( *palette );
}
RageSurfaceFormat::~RageSurfaceFormat()
{
delete palette;
@@ -102,6 +109,18 @@ RageSurface::RageSurface()
pixels = NULL;
}
RageSurface::RageSurface( const RageSurface &cpy )
{
format = &fmt;
w = cpy.w;
h = cpy.h;
pitch = cpy.pitch;
flags = cpy.flags;
pixels = new uint8_t[ pitch*h ];
memcpy( pixels, cpy.pixels, pitch*h );
}
RageSurface::~RageSurface()
{
delete [] pixels;
+2
View File
@@ -27,6 +27,7 @@ struct RageSurfacePalette
struct RageSurfaceFormat
{
RageSurfaceFormat();
RageSurfaceFormat( const RageSurfaceFormat &cpy );
~RageSurfaceFormat();
int32_t BytesPerPixel;
@@ -59,6 +60,7 @@ struct RageSurface
int32_t flags;
RageSurface();
RageSurface( const RageSurface &cpy );
~RageSurface();
};