Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #10242: Allow a space for text shadow when clipping WWT_EMPTY/WWT_TEXT. #10243

Merged
merged 1 commit into from
Dec 15, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2839,9 +2839,10 @@ void NWidgetLeaf::Draw(const Window *w)
{
if (this->current_x == 0 || this->current_y == 0) return;

/* Setup a clipping rectangle... */
/* Setup a clipping rectangle... for WWT_EMPTY or WWT_TEXT, an extra scaled pixel is allowed vertically in case text shadow encroaches. */
int extra_y = (this->type == WWT_EMPTY || this->type == WWT_TEXT) ? ScaleGUITrad(1) : 0;
DrawPixelInfo new_dpi;
if (!FillDrawPixelInfo(&new_dpi, this->pos_x, this->pos_y, this->current_x, this->current_y)) return;
if (!FillDrawPixelInfo(&new_dpi, this->pos_x, this->pos_y, this->current_x, this->current_y + extra_y)) return;
/* ...but keep coordinates relative to the window. */
new_dpi.left += this->pos_x;
new_dpi.top += this->pos_y;
Expand Down