From 296ac24e3bed9ce081599384a530a579d4ed9416 Mon Sep 17 00:00:00 2001 From: Glenn Maynard Date: Tue, 31 Aug 2004 01:36:40 +0000 Subject: [PATCH] const fixes --- stepmania/src/RageSurfaceUtils.cpp | 14 +++++++------- stepmania/src/RageSurfaceUtils.h | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/stepmania/src/RageSurfaceUtils.cpp b/stepmania/src/RageSurfaceUtils.cpp index a224bc4fe5..e60f61c408 100644 --- a/stepmania/src/RageSurfaceUtils.cpp +++ b/stepmania/src/RageSurfaceUtils.cpp @@ -659,7 +659,7 @@ void RageSurfaceUtils::Blit( const RageSurface *src, RageSurface *dst, int width if( height < dst->h ) { /* Duplicate the last row. */ - char *srcp = (char *) dst->pixels; + uint8_t *srcp = dst->pixels; srcp += dst->pitch * (height-1); memcpy( srcp + dst->pitch, srcp, dst->pitch ); } @@ -673,7 +673,7 @@ struct SurfaceHeader }; /* Save and load RageSurfaces to disk, in a very fast, nonportable way. */ -bool RageSurfaceUtils::SaveSurface( RageSurface *img, CString file ) +bool RageSurfaceUtils::SaveSurface( const RageSurface *img, CString file ) { RageFile f; if( !f.Open( file, RageFile::WRITE ) ) @@ -753,7 +753,7 @@ RageSurface *RageSurfaceUtils::LoadSurface( CString file ) * * This gives us a generic way to handle arbitrary 8-bit texture formats. */ -RageSurface *RageSurfaceUtils::Palettize( RageSurface *src_surf, int GrayBits, int AlphaBits ) +RageSurface *RageSurfaceUtils::Palettize( const RageSurface *src_surf, int GrayBits, int AlphaBits ) { AlphaBits = min( AlphaBits, 8-src_surf->format->Aloss ); @@ -801,8 +801,8 @@ RageSurface *RageSurfaceUtils::Palettize( RageSurface *src_surf, int GrayBits, i dst_surf->fmt.palette->colors[index] = c; } - const char *src = (const char *) src_surf->pixels; - const char *dst = (const char *) dst_surf->pixels; + const uint8_t *src = src_surf->pixels; + uint8_t *dst = dst_surf->pixels; int height = src_surf->h; int width = src_surf->w; @@ -816,7 +816,7 @@ RageSurface *RageSurfaceUtils::Palettize( RageSurface *src_surf, int GrayBits, i int x = 0; while( x++ < width ) { - unsigned int pixel = decodepixel((uint8_t *) src, src_surf->format->BytesPerPixel); + unsigned int pixel = decodepixel( src, src_surf->format->BytesPerPixel ); uint8_t colors[4]; GetRGBAV(pixel, src_surf, colors); @@ -831,7 +831,7 @@ RageSurface *RageSurfaceUtils::Palettize( RageSurface *src_surf, int GrayBits, i (colors[3] >> Aloss) << Ashift; /* Store it. */ - *((uint8_t *) dst) = uint8_t(pixel); + *dst = uint8_t(pixel); src += src_surf->format->BytesPerPixel; dst += dst_surf->format->BytesPerPixel; diff --git a/stepmania/src/RageSurfaceUtils.h b/stepmania/src/RageSurfaceUtils.h index 9ef3a658cb..a587400d1e 100644 --- a/stepmania/src/RageSurfaceUtils.h +++ b/stepmania/src/RageSurfaceUtils.h @@ -49,10 +49,10 @@ namespace RageSurfaceUtils void Blit( const RageSurface *src, RageSurface *dst, int width, int height ); - bool SaveSurface( RageSurface *img, CString file ); + bool SaveSurface( const RageSurface *img, CString file ); RageSurface *LoadSurface( CString file ); - RageSurface *Palettize( RageSurface *src_surf, int GrayBits, int AlphaBits ); + RageSurface *Palettize( const RageSurface *src_surf, int GrayBits, int AlphaBits ); RageSurface *MakeDummySurface( int height, int width );