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

@@ -151,8 +151,7 @@ void DrawRoadVehEngine(int left, int right, int preferred_x, int y, EngineID eng
VehicleSpriteSeq seq;
GetRoadVehIcon(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));
@@ -174,8 +173,7 @@ void GetRoadVehSpriteSize(EngineID engine, uint &width, uint &height, int &xoffs
VehicleSpriteSeq seq;
GetRoadVehIcon(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);