Skip to content

Commit

Permalink
UI: Fix issue where on some DPI/resolution combinations, a line of un…
Browse files Browse the repository at this point in the history
…cleared data would be visible at the bottom and right parts of the window.
  • Loading branch information
hrydgard committed Mar 6, 2017
1 parent 5d58446 commit 12d839d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ext/native/ui/ui_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,19 @@ Bounds UIContext::GetScissorBounds() {
void UIContext::ActivateTopScissor() {
Bounds bounds;
if (scissorStack_.size()) {
float scale = pixel_in_dps;
bounds = scissorStack_.back();
int x = floorf(scale * bounds.x);
int y = floorf(scale * bounds.y);
int w = ceilf(scale * bounds.w);
int h = ceilf(scale * bounds.h);
draw_->SetScissorRect(x, y, w, h);
}
else {
bounds = bounds_;
// Avoid rounding errors
draw_->SetScissorRect(0, 0, pixel_xres, pixel_yres);
}
float scale = pixel_in_dps;
int x = scale * bounds.x;
int y = scale * bounds.y;
int w = scale * bounds.w;
int h = scale * bounds.h;
draw_->SetScissorRect(x, y, w, h);
}

void UIContext::SetFontScale(float scaleX, float scaleY) {
Expand Down

0 comments on commit 12d839d

Please sign in to comment.