Guard against weird renderer bug (#9720)

This commit is contained in:
Kara
2022-07-14 08:38:21 -07:00
committed by GitHub
parent ccefd0caf0
commit a480b2e2fd

View File

@@ -112,7 +112,14 @@ public sealed class EntityPainter
var (x, y, width, height) = GetRsiFrame(rsi, image, entity, layer, dir);
image.Mutate(o => o.Crop(new Rectangle(x, y, width, height)));
var rect = new Rectangle(x, y, width, height);
if (!new Rectangle(Point.Empty, image.Size()).Contains(rect))
{
Console.WriteLine($"Invalid layer {rsi!.Path}/{layer.RsiState.Name}.png for entity {_sEntityManager.ToPrettyString(entity.Sprite.Owner)} at ({entity.X}, {entity.Y})");
return;
}
image.Mutate(o => o.Crop(rect));
var colorMix = entity.Sprite.Color * layer.Color;
var imageColor = Color.FromRgba(colorMix.RByte, colorMix.GByte, colorMix.BByte, colorMix.AByte);