mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-30 06:32:42 +00:00
Fix shading ink for sprites with more than 256 colors
When the shading ink is used on RGBA sprites, we can have color palettes with more than 256 colors. In this way the shade will contain entries with indexes >= 256.
This commit is contained in:
parent
24e329ffeb
commit
fd71ceb4c9
@ -724,13 +724,19 @@ public:
|
||||
|
||||
void processPixel(int x, int y) {
|
||||
color_t src = *m_srcAddress;
|
||||
int i = m_rgbmap->mapColor(rgba_getr(src),
|
||||
rgba_getg(src),
|
||||
rgba_getb(src),
|
||||
rgba_geta(src));
|
||||
|
||||
// The color must be an exact match
|
||||
if (src != m_palette->getEntry(i)) {
|
||||
// We cannot use the m_rgbmap->mapColor() function because RgbMaps
|
||||
// are created with findBestfit(), and findBestfit() limits the
|
||||
// returned indexes to [0,255] range (it's mainly used for RGBA ->
|
||||
// Indexed image conversion).
|
||||
int i = m_palette->findExactMatch(rgba_getr(src),
|
||||
rgba_getg(src),
|
||||
rgba_getb(src),
|
||||
rgba_geta(src),
|
||||
-1);
|
||||
|
||||
// If we didn't find the exact match.
|
||||
if (i < 0) {
|
||||
*m_dstAddress = src;
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user