aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCameron Cawley2019-09-12 21:02:52 +0100
committerPeter Kohaut2019-09-12 22:02:52 +0200
commitc786b139dbfdff69dbd0275848157c1fddee10f9 (patch)
tree3ad6e8698b20c1b75b3459037e25d6977b8acb9e
parentdebe25907419990337ae1f631fa04c8615fb68a4 (diff)
downloadscummvm-rg350-c786b139dbfdff69dbd0275848157c1fddee10f9.tar.gz
scummvm-rg350-c786b139dbfdff69dbd0275848157c1fddee10f9.tar.bz2
scummvm-rg350-c786b139dbfdff69dbd0275848157c1fddee10f9.zip
BLADERUNNER: Remove use of unaligned memory access (#1839)
-rw-r--r--engines/bladerunner/bladerunner.cpp2
-rw-r--r--engines/bladerunner/dialogue_menu.cpp2
-rw-r--r--engines/bladerunner/slice_renderer.cpp2
-rw-r--r--engines/bladerunner/ui/esper.cpp12
4 files changed, 9 insertions, 9 deletions
diff --git a/engines/bladerunner/bladerunner.cpp b/engines/bladerunner/bladerunner.cpp
index e83c8114a1..d763f7cadb 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 b7183f31d0..1ef19dd680 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 d21fca6193..376aa1ec7d 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 ef72049a4c..2290cdb121 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));
}
}