From 2fe0d2021eea3c99ef2666ea879ed941f94aceb3 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Wed, 14 Jul 2004 20:00:00 +0000 Subject: [PATCH] RageSurface and RageSurfaceFormat copy ctors --- stepmania/src/RageSurface.cpp | 19 +++++++++++++++++++ stepmania/src/RageSurface.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/stepmania/src/RageSurface.cpp b/stepmania/src/RageSurface.cpp index e1302d6ca5..a33afad3d4 100644 --- a/stepmania/src/RageSurface.cpp +++ b/stepmania/src/RageSurface.cpp @@ -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; diff --git a/stepmania/src/RageSurface.h b/stepmania/src/RageSurface.h index b30159cdaa..51f445270e 100644 --- a/stepmania/src/RageSurface.h +++ b/stepmania/src/RageSurface.h @@ -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(); };