Merge branch 'master' into jgrpp

# Conflicts:
#	src/core/geometry_type.hpp
#	src/error_gui.cpp
#	src/rail_gui.cpp
#	src/tree_gui.cpp
#	src/vehicle_gui.cpp
#	src/widgets/dropdown.cpp
This commit is contained in:
Jonathan G Rennison
2022-12-03 23:40:22 +00:00
33 changed files with 174 additions and 147 deletions

View File

@@ -1398,7 +1398,7 @@ public:
switch (GB(widget, 0, 16)) {
case WID_BRAS_PLATFORM_DIR_X:
/* Set up a clipping area for the '/' station preview */
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.Width(), r.Height())) {
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
int x = ScaleGUITrad(31) + 1;
@@ -1412,7 +1412,7 @@ public:
case WID_BRAS_PLATFORM_DIR_Y:
/* Set up a clipping area for the '\' station preview */
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.Width(), r.Height())) {
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
int x = ScaleGUITrad(31) + 1;
@@ -1449,7 +1449,7 @@ public:
}
/* Set up a clipping area for the station preview. */
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.right - r.left + 1, r.bottom - r.top + 1)) {
if (FillDrawPixelInfo(&tmp_dpi, r.left, r.top, r.Width(), r.Height())) {
DrawPixelInfo *old_dpi = _cur_dpi;
_cur_dpi = &tmp_dpi;
int x = ScaleGUITrad(31) + 1;
@@ -1822,15 +1822,13 @@ private:
* @param widget_index index of this widget in the window
* @param image the sprite to draw
*/
void DrawSignalSprite(byte widget_index, PalSpriteID image) const
void DrawSignalSprite(const Rect &r, int widget_index, PalSpriteID image) const
{
Point offset;
Dimension sprite_size = GetSpriteSize(image.sprite, &offset);
const NWidgetBase *widget = this->GetWidget<NWidgetBase>(widget_index);
int x = widget->pos_x - offset.x +
(widget->current_x - sprite_size.width + offset.x) / 2; // centered
int y = widget->pos_y - sig_sprite_bottom_offset + WD_IMGBTN_TOP +
(widget->current_y - WD_IMGBTN_TOP - WD_IMGBTN_BOTTOM + sig_sprite_size.height) / 2; // aligned to bottom
int x = CenterBounds(r.left, r.right, sprite_size.width - offset.x);
int y = r.top - sig_sprite_bottom_offset + WD_IMGBTN_TOP +
(r.bottom - r.top - WD_IMGBTN_TOP - WD_IMGBTN_BOTTOM + sig_sprite_size.height) / 2; // aligned to bottom
DrawSprite(image.sprite, image.pal,
x + this->IsWidgetLowered(widget_index),
@@ -2005,7 +2003,7 @@ public:
sprite = GetRailTypeInfo(_cur_railtype)->gui_sprites.signals[type][var][this->IsWidgetLowered(widget)];
}
this->DrawSignalSprite(widget, sprite);
this->DrawSignalSprite(r, widget, sprite);
}
}