mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-25 13:42:37 +00:00
BLADERUNNER: Remove use of unaligned memory access (#1839)
This commit is contained in:
parent
debe259074
commit
c786b139db
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user