RageSurface and RageSurfaceFormat copy ctors
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user