mirror of https://github.com/OpenTTD/OpenTTD.git
Codechange: Use GetCurrentRect() where feasible. (#11460)
This commit is contained in:
parent
17ceed0241
commit
e2e0753916
|
@ -1490,8 +1490,9 @@ public:
|
||||||
void Draw(const Window *w) override
|
void Draw(const Window *w) override
|
||||||
{
|
{
|
||||||
/* Draw brown-red toolbar bg. */
|
/* Draw brown-red toolbar bg. */
|
||||||
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_VERY_DARK_RED);
|
const Rect r = this->GetCurrentRect();
|
||||||
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, PC_DARK_RED, FILLRECT_CHECKER);
|
GfxFillRect(r, PC_VERY_DARK_RED);
|
||||||
|
GfxFillRect(r, PC_DARK_RED, FILLRECT_CHECKER);
|
||||||
|
|
||||||
this->NWidgetContainer::Draw(w);
|
this->NWidgetContainer::Draw(w);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2093,7 +2093,7 @@ NWidgetCore *NWidgetMatrix::GetWidgetFromPos(int x, int y)
|
||||||
/* virtual */ void NWidgetMatrix::Draw(const Window *w)
|
/* virtual */ void NWidgetMatrix::Draw(const Window *w)
|
||||||
{
|
{
|
||||||
/* Fill the background. */
|
/* Fill the background. */
|
||||||
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1, _colour_gradient[this->colour & 0xF][5]);
|
GfxFillRect(this->GetCurrentRect(), _colour_gradient[this->colour & 0xF][5]);
|
||||||
|
|
||||||
/* Set up a clipping area for the previews. */
|
/* Set up a clipping area for the previews. */
|
||||||
bool rtl = _current_text_dir == TD_RTL;
|
bool rtl = _current_text_dir == TD_RTL;
|
||||||
|
@ -2419,8 +2419,7 @@ void NWidgetViewport::Draw(const Window *w)
|
||||||
|
|
||||||
/* Optionally shade the viewport. */
|
/* Optionally shade the viewport. */
|
||||||
if (this->disp_flags & (ND_SHADE_GREY | ND_SHADE_DIMMED)) {
|
if (this->disp_flags & (ND_SHADE_GREY | ND_SHADE_DIMMED)) {
|
||||||
GfxFillRect(this->pos_x, this->pos_y, this->pos_x + this->current_x - 1, this->pos_y + this->current_y - 1,
|
GfxFillRect(this->GetCurrentRect(), (this->disp_flags & ND_SHADE_DIMMED) ? PALETTE_TO_TRANSPARENT : PALETTE_NEWSPAPER, FILLRECT_RECOLOUR);
|
||||||
(this->disp_flags & ND_SHADE_DIMMED) ? PALETTE_TO_TRANSPARENT : PALETTE_NEWSPAPER, FILLRECT_RECOLOUR);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawOutline(w, this);
|
DrawOutline(w, this);
|
||||||
|
|
Loading…
Reference in New Issue