Update PgsParser.java

Fix "subtitles rendered with border and no fill color" problem:
https://github.com/moneytoo/Player/issues/413

because '0' means it's an index to the palette table, not an RGBA value of 0
This commit is contained in:
Simon Hung 2024-01-20 01:06:01 +08:00 committed by Ian Baker
parent 0352db9a37
commit d2f677bc4c

View file

@ -248,7 +248,7 @@ public final class PgsParser implements SubtitleParser {
(switchBits & 0x40) == 0
? (switchBits & 0x3F)
: (((switchBits & 0x3F) << 8) | bitmapData.readUnsignedByte());
int color = (switchBits & 0x80) == 0 ? 0 : colors[bitmapData.readUnsignedByte()];
int color = (switchBits & 0x80) == 0 ? colors[0] : colors[bitmapData.readUnsignedByte()];
Arrays.fill(
argbBitmapData, argbBitmapDataIndex, argbBitmapDataIndex + runLength, color);
argbBitmapDataIndex += runLength;