RageSurface and RageSurfaceFormat copy ctors
This commit is contained in:
@@ -43,6 +43,13 @@ RageSurfaceFormat::RageSurfaceFormat()
|
|||||||
palette = NULL;
|
palette = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RageSurfaceFormat::RageSurfaceFormat( const RageSurfaceFormat &cpy )
|
||||||
|
{
|
||||||
|
memcpy( this, &cpy, sizeof(RageSurfaceFormat) );
|
||||||
|
if( palette )
|
||||||
|
palette = new RageSurfacePalette( *palette );
|
||||||
|
}
|
||||||
|
|
||||||
RageSurfaceFormat::~RageSurfaceFormat()
|
RageSurfaceFormat::~RageSurfaceFormat()
|
||||||
{
|
{
|
||||||
delete palette;
|
delete palette;
|
||||||
@@ -102,6 +109,18 @@ RageSurface::RageSurface()
|
|||||||
pixels = NULL;
|
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()
|
RageSurface::~RageSurface()
|
||||||
{
|
{
|
||||||
delete [] pixels;
|
delete [] pixels;
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ struct RageSurfacePalette
|
|||||||
struct RageSurfaceFormat
|
struct RageSurfaceFormat
|
||||||
{
|
{
|
||||||
RageSurfaceFormat();
|
RageSurfaceFormat();
|
||||||
|
RageSurfaceFormat( const RageSurfaceFormat &cpy );
|
||||||
~RageSurfaceFormat();
|
~RageSurfaceFormat();
|
||||||
|
|
||||||
int32_t BytesPerPixel;
|
int32_t BytesPerPixel;
|
||||||
@@ -59,6 +60,7 @@ struct RageSurface
|
|||||||
int32_t flags;
|
int32_t flags;
|
||||||
|
|
||||||
RageSurface();
|
RageSurface();
|
||||||
|
RageSurface( const RageSurface &cpy );
|
||||||
~RageSurface();
|
~RageSurface();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user