Cache sprite sequence bounds for vehicles

This commit is contained in:
Jonathan G Rennison
2018-01-19 19:13:01 +00:00
parent 5b226adc75
commit d730cfd51d
12 changed files with 71 additions and 41 deletions

View File

@@ -94,8 +94,7 @@ void DrawShipEngine(int left, int right, int preferred_x, int y, EngineID engine
VehicleSpriteSeq seq;
GetShipIcon(engine, image_type, &seq);
Rect rect;
seq.GetBounds(&rect);
Rect16 rect = seq.GetBounds();
preferred_x = Clamp(preferred_x,
left - UnScaleGUI(rect.left),
right - UnScaleGUI(rect.right));
@@ -117,8 +116,7 @@ void GetShipSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs, i
VehicleSpriteSeq seq;
GetShipIcon(engine, image_type, &seq);
Rect rect;
seq.GetBounds(&rect);
Rect16 rect = seq.GetBounds();
width = UnScaleGUI(rect.right - rect.left + 1);
height = UnScaleGUI(rect.bottom - rect.top + 1);