diff options
Diffstat (limited to 'graphics/scaler')
| -rw-r--r-- | graphics/scaler/thumbnail_intern.cpp | 19 | 
1 files changed, 10 insertions, 9 deletions
diff --git a/graphics/scaler/thumbnail_intern.cpp b/graphics/scaler/thumbnail_intern.cpp index 347a25ec37..675328db6d 100644 --- a/graphics/scaler/thumbnail_intern.cpp +++ b/graphics/scaler/thumbnail_intern.cpp @@ -77,13 +77,13 @@ void createThumbnail_4(const uint8 *src, uint32 srcPitch, uint8 *dstPtr, uint32  static void scaleThumbnail(Graphics::Surface &in, Graphics::Surface &out) {  	while (in.w / out.w >= 4 || in.h / out.h >= 4) { -		createThumbnail_4<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); +		createThumbnail_4<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h);  		in.w /= 4;  		in.h /= 4;  	}  	while (in.w / out.w >= 2 || in.h / out.h >= 2) { -		createThumbnail_2<565>((const uint8 *)in.pixels, in.pitch, (uint8 *)in.pixels, in.pitch, in.w, in.h); +		createThumbnail_2<565>((const uint8 *)in.getBasePtr(0, 0), in.pitch, (uint8 *)in.getBasePtr(0, 0), in.pitch, in.w, in.h);  		in.w /= 2;  		in.h /= 2;  	} @@ -172,7 +172,7 @@ static bool grabScreen565(Graphics::Surface *surf) {  		return false;  	assert(screen->format.bytesPerPixel == 1 || screen->format.bytesPerPixel == 2); -	assert(screen->pixels != 0); +	assert(screen->getBasePtr(0, 0) != 0);  	Graphics::PixelFormat screenFormat = g_system->getScreenFormat(); @@ -190,15 +190,16 @@ static bool grabScreen565(Graphics::Surface *surf) {  			byte r = 0, g = 0, b = 0;  			if (screenFormat.bytesPerPixel == 1) { -				r = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3]; -				g = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 1]; -				b = palette[((uint8 *)screen->pixels)[y * screen->pitch + x] * 3 + 2]; +				uint8 pixel = *(uint8 *)screen->getBasePtr(x, y); +				r = palette[pixel * 3 + 0]; +				g = palette[pixel * 3 + 1]; +				b = palette[pixel * 3 + 2];  			} else if (screenFormat.bytesPerPixel == 2) {  				uint16 col = READ_UINT16(screen->getBasePtr(x, y));  				screenFormat.colorToRGB(col, r, g, b);  			} -			((uint16 *)surf->pixels)[y * surf->w + x] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); +			*((uint16 *)surf->getBasePtr(x, y)) = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b);  		}  	} @@ -246,7 +247,7 @@ bool createThumbnail(Graphics::Surface *surf, const uint8 *pixels, int w, int h,  			g = palette[pixels[y * w + x] * 3 + 1];  			b = palette[pixels[y * w + x] * 3 + 2]; -			((uint16 *)screen.pixels)[y * screen.w + x] = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b); +			*((uint16 *)screen.getBasePtr(y, x)) = Graphics::RGBToColor<Graphics::ColorMasks<565> >(r, g, b);  		}  	} @@ -272,7 +273,7 @@ bool createScreenShot(Graphics::Surface &surf) {  				byte r = 0, g = 0, b = 0, a = 0;  				uint32 col = READ_UINT32(screen->getBasePtr(x, y));  				screenFormat.colorToARGB(col, a, r, g, b); -				((uint32 *)surf.pixels)[y * surf.w + x] = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b); +				*((uint32 *)surf.getBasePtr(x, y)) = Graphics::ARGBToColor<Graphics::ColorMasks<8888> >(a, r, g, b);  			}  		}  		g_system->unlockScreen();  | 
