From 297229700c3fc6ab9ab61d8ea6eda0944b188102 Mon Sep 17 00:00:00 2001 From: krcroft Date: Tue, 14 Apr 2020 17:40:18 -0700 Subject: [PATCH] Make use of indexed reads and writes --- src/hardware/hardware.cpp | 54 +++++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/src/hardware/hardware.cpp b/src/hardware/hardware.cpp index 0f8ffbbd..ae0990bf 100644 --- a/src/hardware/hardware.cpp +++ b/src/hardware/hardware.cpp @@ -385,7 +385,7 @@ void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, #endif for (i=0;i> 1)*pitch); else @@ -396,21 +396,21 @@ void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, if (flags & CAPTURE_FLAG_DBLW) { for (Bitu x=0;x(srcLine)[x]); + for (Bitu x = 0; x < countWidth; x++) { + const Bitu pixel = host_readw_at(srcLine, x); doubleRow[x*6+0] = doubleRow[x*6+3] = ((pixel& 0x001f) * 0x21) >> 2; doubleRow[x*6+1] = doubleRow[x*6+4] = ((pixel& 0x03e0) * 0x21) >> 7; doubleRow[x*6+2] = doubleRow[x*6+5] = ((pixel& 0x7c00) * 0x21) >> 12; } } else { - for (Bitu x=0;x(srcLine)[x]); + for (Bitu x = 0; x < countWidth; x++) { + const Bitu pixel = host_readw_at(srcLine, x); doubleRow[x*3+0] = ((pixel& 0x001f) * 0x21) >> 2; doubleRow[x*3+1] = ((pixel& 0x03e0) * 0x21) >> 7; doubleRow[x*3+2] = ((pixel& 0x7c00) * 0x21) >> 12; @@ -420,15 +420,15 @@ void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, break; case 16: if (flags & CAPTURE_FLAG_DBLW) { - for (Bitu x=0;x(srcLine)[x]); + for (Bitu x = 0; x < countWidth; x++) { + const Bitu pixel = host_readw_at(srcLine, x); doubleRow[x*6+0] = doubleRow[x*6+3] = ((pixel& 0x001f) * 0x21) >> 2; doubleRow[x*6+1] = doubleRow[x*6+4] = ((pixel& 0x07e0) * 0x41) >> 9; doubleRow[x*6+2] = doubleRow[x*6+5] = ((pixel& 0xf800) * 0x21) >> 13; } } else { - for (Bitu x=0;x(srcLine)[x]); + for (Bitu x = 0; x < countWidth; x++) { + const Bitu pixel = host_readw_at(srcLine, x); doubleRow[x*3+0] = ((pixel& 0x001f) * 0x21) >> 2; doubleRow[x*3+1] = ((pixel& 0x07e0) * 0x41) >> 9; doubleRow[x*3+2] = ((pixel& 0xf800) * 0x21) >> 13; @@ -439,15 +439,15 @@ void CAPTURE_AddImage(Bitu width, Bitu height, Bitu bpp, Bitu pitch, Bitu flags, case 32: if (flags & CAPTURE_FLAG_DBLW) { for (Bitu x=0;x> 1; if (flags & CAPTURE_FLAG_DBLH) @@ -533,19 +533,23 @@ skip_shot: switch ( bpp) { case 8: for (x=0;x