Skip to content

Commit

Permalink
Additional rendering fixes for notch
Browse files Browse the repository at this point in the history
  • Loading branch information
hrydgard committed Mar 31, 2020
1 parent 7dfe895 commit f01a4a3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
4 changes: 3 additions & 1 deletion UI/ControlMappingScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -648,6 +648,8 @@ extern int display_yres;
void TouchTestScreen::render() {
UIDialogScreenWithBackground::render();
UIContext *ui_context = screenManager()->getUIContext();
Bounds bounds = ui_context->GetLayoutBounds();

ui_context->BeginNoTex();
for (int i = 0; i < MAX_TOUCH_POINTS; i++) {
if (touches_[i].id != -1) {
Expand Down Expand Up @@ -685,7 +687,7 @@ void TouchTestScreen::render() {
g_dpi_scale_x, g_dpi_scale_y,
g_dpi_scale_real_x, g_dpi_scale_real_y);

ui_context->DrawTextShadow(buffer, 20.0f, dp_yres / 2.0f, 0xFFFFFFFF, ALIGN_VCENTER | FLAG_DYNAMIC_ASCII);
ui_context->DrawTextShadow(buffer, bounds.x + 20.0f, dp_yres / 2.0f, 0xFFFFFFFF, ALIGN_VCENTER | FLAG_DYNAMIC_ASCII);
ui_context->Flush();
}

Expand Down
13 changes: 7 additions & 6 deletions UI/GPUDriverTestScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ void GPUDriverTestScreen::DiscardTest() {

UIContext &dc = *screenManager()->getUIContext();
Draw::DrawContext *draw = dc.GetDrawContext();
const Bounds &bounds = dc.GetBounds();

static const char * const writeModeNames[] = { "Stencil+Depth", "Stencil", "Depth" };
Pipeline *writePipelines[] = { discardWriteDepthStencil_, discardWriteStencil_, discardWriteDepth_ };
Expand Down Expand Up @@ -263,14 +262,16 @@ void GPUDriverTestScreen::DiscardTest() {

// If everything is OK, both the background and the text should be OK.

Bounds layoutBounds = dc.GetLayoutBounds();

dc.Begin();
dc.SetFontScale(1.0f, 1.0f);
std::string apiName = screenManager()->getDrawContext()->GetInfoString(InfoField::APINAME);
std::string vendor = screenManager()->getDrawContext()->GetInfoString(InfoField::VENDORSTRING);
std::string driver = screenManager()->getDrawContext()->GetInfoString(InfoField::DRIVER);
dc.DrawText(apiName.c_str(), bounds.centerX(), 20, 0xFFFFFFFF, ALIGN_CENTER);
dc.DrawText(vendor.c_str(), bounds.centerX(), 60, 0xFFFFFFFF, ALIGN_CENTER);
dc.DrawText(driver.c_str(), bounds.centerX(), 100, 0xFFFFFFFF, ALIGN_CENTER);
dc.DrawText(apiName.c_str(), layoutBounds.centerX(), 20, 0xFFFFFFFF, ALIGN_CENTER);
dc.DrawText(vendor.c_str(), layoutBounds.centerX(), 60, 0xFFFFFFFF, ALIGN_CENTER);
dc.DrawText(driver.c_str(), layoutBounds.centerX(), 100, 0xFFFFFFFF, ALIGN_CENTER);
dc.Flush();

float testW = 170.f;
Expand All @@ -279,9 +280,9 @@ void GPUDriverTestScreen::DiscardTest() {

float y = 150;
for (int j = 0; j < numWriteModes; j++, y += 120.f + padding) {
float x = (dc.GetBounds().w - (float)numTests * testW - (float)(numTests - 1) * padding) / 2.0f;
float x = layoutBounds.x + (layoutBounds.w - (float)numTests * testW - (float)(numTests - 1) * padding) / 2.0f;
dc.Begin();
dc.DrawText(writeModeNames[j], padding, y + 40, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
dc.DrawText(writeModeNames[j], layoutBounds.x + padding, y + 40, 0xFFFFFFFF, FLAG_DYNAMIC_ASCII);
dc.Flush();
for (int i = 0; i < numTests; i++, x += testW + padding) {
if (!validCombinations[j][i])
Expand Down
4 changes: 2 additions & 2 deletions UI/MiscScreens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ void CreditsScreen::render() {

UIContext &dc = *screenManager()->getUIContext();
dc.Begin();
const Bounds &bounds = dc.GetBounds();
const Bounds &bounds = dc.GetLayoutBounds();

const int numItems = ARRAY_SIZE(credits);
int itemHeight = 36;
Expand All @@ -758,7 +758,7 @@ void CreditsScreen::render() {

if (alpha > 0.0f) {
dc.SetFontScale(ease(alpha), ease(alpha));
dc.DrawText(credits[i], dc.GetBounds().centerX(), y, textColor, ALIGN_HCENTER);
dc.DrawText(credits[i], bounds.centerX(), y, textColor, ALIGN_HCENTER);
dc.SetFontScale(1.0f, 1.0f);
}
y += itemHeight;
Expand Down

1 comment on commit f01a4a3

@hrydgard
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.