mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-21 01:05:59 +00:00
BLADERUNNER: Performance fixes
Pixel format functions and CLIP functions are too slow in debug builds, replacing them with static code makes debug builds faster.
This commit is contained in:
parent
a7e30d0e7f
commit
4355c42044
@ -329,6 +329,18 @@ static inline const Graphics::PixelFormat gameDataPixelFormat() {
|
||||
return Graphics::PixelFormat(2, 5, 5, 5, 1, 10, 5, 0, 15);
|
||||
}
|
||||
|
||||
static inline void getGameDataColor(uint16 color, uint8 &a, uint8 &r, uint8 &g, uint8 &b) {
|
||||
// gameDataPixelFormat().colorToARGB(vqaColor, a, r, g, b);
|
||||
// using pixel format functions is too slow on some ports because of runtime checks
|
||||
uint8 r5 = (color >> 10) & 0x1F;
|
||||
uint8 g5 = (color >> 5) & 0x1F;
|
||||
uint8 b5 = (color ) & 0x1F;
|
||||
a = color >> 15;
|
||||
r = (r5 << 3) | (r5 >> 2);
|
||||
g = (g5 << 3) | (g5 >> 2);
|
||||
b = (b5 << 3) | (b5 >> 2);
|
||||
}
|
||||
|
||||
static inline const Graphics::PixelFormat screenPixelFormat() {
|
||||
return ((BladeRunnerEngine*)g_engine)->_screenPixelFormat;
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ void Font::drawChar(Graphics::Surface *dst, uint32 chr, int x, int y, uint32 col
|
||||
int endX = width + x - 1;
|
||||
while (currentX <= endX && currentX < dst->w) {
|
||||
uint8 a, r, g, b;
|
||||
gameDataPixelFormat().colorToARGB(*srcPtr, a, r, g, b);
|
||||
getGameDataColor(*srcPtr, a, r, g, b);
|
||||
if (!a) { // Alpha is inversed
|
||||
uint32 outColor = color;
|
||||
if (_useFontColor) {
|
||||
|
@ -111,7 +111,7 @@ void Shape::draw(Graphics::Surface &surface, int x, int y) const {
|
||||
src_p += 2;
|
||||
|
||||
uint8 a, r, g, b;
|
||||
gameDataPixelFormat().colorToARGB(shpColor, a, r, g, b);
|
||||
getGameDataColor(shpColor, a, r, g, b);
|
||||
|
||||
if (!a) {
|
||||
// Ignore the alpha in the output as it is inversed in the input
|
||||
|
@ -834,10 +834,12 @@ void VQADecoder::VQAVideoTrack::VPTRWriteBlock(Graphics::Surface *surface, unsig
|
||||
src_p += 2;
|
||||
|
||||
uint8 a, r, g, b;
|
||||
gameDataPixelFormat().colorToARGB(vqaColor, a, r, g, b);
|
||||
getGameDataColor(vqaColor, a, r, g, b);
|
||||
|
||||
if (!(alpha && a)) {
|
||||
void* dstPtr = surface->getBasePtr(CLIP(dst_x + x, (uint32)0, (uint32)(surface->w - 1)), CLIP(dst_y + y, (uint32)0, (uint32)(surface->h - 1)));
|
||||
// clip is too slow and it is not needed
|
||||
// void* dstPtr = surface->getBasePtr(CLIP(dst_x + x, (uint32)0, (uint32)(surface->w - 1)), CLIP(dst_y + y, (uint32)0, (uint32)(surface->h - 1)));
|
||||
void* dstPtr = surface->getBasePtr(dst_x + x, dst_y + y);
|
||||
// Ignore the alpha in the output as it is inversed in the input
|
||||
drawPixel(*surface, dstPtr, surface->format.RGBToColor(r, g, b));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user