[Scummvm-git-logs] scummvm master -> ff24083fd442a039deab5bfbc00e7074c570d0f2
sev-
noreply at scummvm.org
Wed May 1 20:44:19 UTC 2024
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:
ff24083fd4 GRAPHICS: Make convertTo() work with incomplete palettes
Commit: ff24083fd442a039deab5bfbc00e7074c570d0f2
https://github.com/scummvm/scummvm/commit/ff24083fd442a039deab5bfbc00e7074c570d0f2
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2024-05-01T22:42:03+02:00
Commit Message:
GRAPHICS: Make convertTo() work with incomplete palettes
We we always assuming that the provided palette is 256 bytes long,
up to the point that we hardcoded this value and skipped this parameter
almost everywhere.
This changes the default parameter to 256 and allows the lesser values
be passed.
Changed paths:
graphics/surface.cpp
graphics/surface.h
diff --git a/graphics/surface.cpp b/graphics/surface.cpp
index b3946b7c026..d2eb754999f 100644
--- a/graphics/surface.cpp
+++ b/graphics/surface.cpp
@@ -565,7 +565,7 @@ Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *
assert(srcPalette);
uint32 map[256];
- convertPaletteToMap(map, srcPalette, 256, dstFormat);
+ convertPaletteToMap(map, srcPalette, srcPaletteCount, dstFormat);
crossBlitMap(dst, src, surface->pitch, pitch, w, h, dstFormat.bytesPerPixel, map);
} else {
// Converting from high color to high color
diff --git a/graphics/surface.h b/graphics/surface.h
index 6993495fbbb..3eb5280e4d5 100644
--- a/graphics/surface.h
+++ b/graphics/surface.h
@@ -388,7 +388,7 @@ public:
* @param dstaletteCount The color count in the for the dstPalette.
* @param method The dithering method if destination format has a bpp of 1. Default is Floyd-Steinberg.
*/
- Graphics::Surface *convertTo(const PixelFormat &dstFormat, const byte *srcPalette = 0, int srcPaletteCount = 0, const byte *dstPalette = 0, int dstPaletteCount = 0, DitherMethod method = kDitherFloyd) const;
+ Graphics::Surface *convertTo(const PixelFormat &dstFormat, const byte *srcPalette = 0, int srcPaletteCount = 256, const byte *dstPalette = 0, int dstPaletteCount = 0, DitherMethod method = kDitherFloyd) const;
protected:
void ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method, const PixelFormat &dstFormat) const;
More information about the Scummvm-git-logs
mailing list