[Scummvm-git-logs] scummvm master -> c786b139dbfdff69dbd0275848157c1fddee10f9

peterkohaut peterkohaut at users.noreply.github.com
Thu Sep 12 22:02:56 CEST 2019


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c786b139db BLADERUNNER: Remove use of unaligned memory access (#1839)


Commit: c786b139dbfdff69dbd0275848157c1fddee10f9
    https://github.com/scummvm/scummvm/commit/c786b139dbfdff69dbd0275848157c1fddee10f9
Author: Cameron Cawley (ccawley2011 at gmail.com)
Date: 2019-09-12T22:02:52+02:00

Commit Message:
BLADERUNNER: Remove use of unaligned memory access (#1839)

Changed paths:
    engines/bladerunner/bladerunner.cpp
    engines/bladerunner/dialogue_menu.cpp
    engines/bladerunner/slice_renderer.cpp
    engines/bladerunner/ui/esper.cpp


diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index e83c811..d763f7c 100644
--- a/engines/bladerunner/bladerunner.cpp
+++ b/engines/bladerunner/bladerunner.cpp
@@ -2272,7 +2272,7 @@ Graphics::Surface BladeRunnerEngine::generateThumbnail() const {
 		for (int x = 0; x < thumbnail.w; ++x) {
 			uint8 r, g, b;
 
-			uint32  srcPixel = *(const uint32 *)_surfaceFront.getBasePtr(CLIP(x * 8, 0, _surfaceFront.w - 1), CLIP(y * 8, 0, _surfaceFront.h - 1));
+			uint32  srcPixel = READ_UINT32(_surfaceFront.getBasePtr(CLIP(x * 8, 0, _surfaceFront.w - 1), CLIP(y * 8, 0, _surfaceFront.h - 1)));
 			void   *dstPixel = thumbnail.getBasePtr(CLIP(x, 0, thumbnail.w - 1), CLIP(y, 0, thumbnail.h - 1));
 
 			// Throw away alpha channel as it is not needed
diff --git a/engines/bladerunner/dialogue_menu.cpp b/engines/bladerunner/dialogue_menu.cpp
index b7183f3..1ef19dd 100644
--- a/engines/bladerunner/dialogue_menu.cpp
+++ b/engines/bladerunner/dialogue_menu.cpp
@@ -554,7 +554,7 @@ void DialogueMenu::darkenRect(Graphics::Surface &s, int x1, int y1, int x2, int
 			for (int x = x1; x != x2; ++x) {
 				void *p = s.getBasePtr(CLIP(x, 0, s.w - 1), CLIP(y, 0, s.h - 1));
 				uint8 r, g, b;
-				s.format.colorToRGB(*(uint32*)p, r, g, b);
+				s.format.colorToRGB(READ_UINT32(p), r, g, b);
 				r /= 4;
 				g /= 4;
 				b /= 4;
diff --git a/engines/bladerunner/slice_renderer.cpp b/engines/bladerunner/slice_renderer.cpp
index d21fca6..376aa1e 100644
--- a/engines/bladerunner/slice_renderer.cpp
+++ b/engines/bladerunner/slice_renderer.cpp
@@ -731,7 +731,7 @@ void SliceRenderer::drawShadowPolygon(int transparency, Graphics::Surface &surfa
 				int index = (x & 3) + ((y & 3) << 2);
 				if (transparency - ditheringFactor[index] <= 0) {
 					uint8 r, g, b;
-					surface.format.colorToRGB(*(uint32*)pixel, r, g, b);
+					surface.format.colorToRGB(READ_UINT32(pixel), r, g, b);
 					r *= 0.75f;
 					g *= 0.75f;
 					b *= 0.75f;
diff --git a/engines/bladerunner/ui/esper.cpp b/engines/bladerunner/ui/esper.cpp
index ef72049..2290cdb 100644
--- a/engines/bladerunner/ui/esper.cpp
+++ b/engines/bladerunner/ui/esper.cpp
@@ -1149,7 +1149,7 @@ void ESPER::flashViewport() {
 		for (int x = 0; x < _surfaceViewport.w; ++x) {
 			uint8 r, g, b;
 			void *ptr = _surfaceViewport.getBasePtr(x, y);
-			_surfaceViewport.format.colorToRGB(*(uint32*)ptr, r, g, b);
+			_surfaceViewport.format.colorToRGB(READ_UINT32(ptr), r, g, b);
 			b *= 2;
 			drawPixel(_surfaceViewport, ptr, _surfaceViewport.format.RGBToColor(r, g, b));
 		}
@@ -1181,7 +1181,7 @@ void ESPER::copyImageScale(Graphics::Surface &src, Common::Rect srcRect, Graphic
 				dstY = CLIP(dstY, 0, dst.h - 1);
 
 				uint8 r, g, b;
-				src.format.colorToRGB(*(uint32*)src.getBasePtr(srcX, srcY), r, g, b);
+				src.format.colorToRGB(READ_UINT32(src.getBasePtr(srcX, srcY)), r, g, b);
 				if (_flash) {
 					// add blue-ish tint
 					b *= 2;
@@ -1224,7 +1224,7 @@ void ESPER::copyImageScale(Graphics::Surface &src, Common::Rect srcRect, Graphic
 				dstY = CLIP(dstY, 0, dst.h - 1);
 
 				uint8 r, g, b;
-				src.format.colorToRGB(*(uint32*)src.getBasePtr(srcX, srcY), r, g, b);
+				src.format.colorToRGB(READ_UINT32(src.getBasePtr(srcX, srcY)), r, g, b);
 				if (_flash) {
 					// add blue-ish tint
 					b *= 2;
@@ -1289,7 +1289,7 @@ void ESPER::copyImageBlur(Graphics::Surface &src, Common::Rect srcRect, Graphics
 						dstY = CLIP(dstY, 0, dst.h - 1);
 
 						uint8 r, g, b;
-						src.format.colorToRGB(*(uint32*)src.getBasePtr(srcX, srcY), r, g, b);
+						src.format.colorToRGB(READ_UINT32(src.getBasePtr(srcX, srcY)), r, g, b);
 						if (_flash) {
 							// add blue-ish tint
 							b *= 2;
@@ -1359,7 +1359,7 @@ void ESPER::copyImageBlur(Graphics::Surface &src, Common::Rect srcRect, Graphics
 						dstY = CLIP(dstY, 0, dst.h - 1);
 
 						uint8 r, g, b;
-						src.format.colorToRGB(*(uint32*)src.getBasePtr(srcX, srcY), r, g, b);
+						src.format.colorToRGB(READ_UINT32(src.getBasePtr(srcX, srcY)), r, g, b);
 						if (_flash) {
 							// add blue-ish tint
 							b *= 2;
@@ -1389,7 +1389,7 @@ void ESPER::copyImageBlit(Graphics::Surface &src, Common::Rect srcRect, Graphics
 	for (int y = 0; y < dstRect.height(); ++y) {
 		for (int x = 0; x < dstRect.width(); ++x) {
 			uint8 r, g, b;
-			src.format.colorToRGB(*(uint32*)src.getBasePtr(CLIP(srcRect.left + x, 0, src.w - 1), CLIP(srcRect.top + y, 0, src.h - 1)), r, g, b);
+			src.format.colorToRGB(READ_UINT32(src.getBasePtr(CLIP(srcRect.left + x, 0, src.w - 1), CLIP(srcRect.top + y, 0, src.h - 1))), r, g, b);
 			drawPixel(dst, dst.getBasePtr(CLIP(dstRect.left + x, 0, dst.w - 1), CLIP(dstRect.top + y, 0, dst.h - 1)), dst.format.RGBToColor(r, g, b));
 		}
 	}





More information about the Scummvm-git-logs mailing list