mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-11 11:45:21 +00:00
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.
This commit is contained in:
parent
5642e2cead
commit
ff24083fd4
@ -565,7 +565,7 @@ Graphics::Surface *Surface::convertTo(const PixelFormat &dstFormat, const byte *
|
|||||||
assert(srcPalette);
|
assert(srcPalette);
|
||||||
uint32 map[256];
|
uint32 map[256];
|
||||||
|
|
||||||
convertPaletteToMap(map, srcPalette, 256, dstFormat);
|
convertPaletteToMap(map, srcPalette, srcPaletteCount, dstFormat);
|
||||||
crossBlitMap(dst, src, surface->pitch, pitch, w, h, dstFormat.bytesPerPixel, map);
|
crossBlitMap(dst, src, surface->pitch, pitch, w, h, dstFormat.bytesPerPixel, map);
|
||||||
} else {
|
} else {
|
||||||
// Converting from high color to high color
|
// Converting from high color to high color
|
||||||
|
@ -388,7 +388,7 @@ public:
|
|||||||
* @param dstaletteCount The color count in the for the dstPalette.
|
* @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.
|
* @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:
|
protected:
|
||||||
void ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method, const PixelFormat &dstFormat) const;
|
void ditherFloyd(const byte *srcPalette, int srcPaletteCount, Surface *dstSurf, const byte *dstPalette, int dstPaletteCount, DitherMethod method, const PixelFormat &dstFormat) const;
|
||||||
|
Loading…
Reference in New Issue
Block a user