diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/viewer/StatsLayer.cpp | 15 | ||||
-rw-r--r-- | tools/viewer/Viewer.cpp | 15 |
2 files changed, 15 insertions, 15 deletions
diff --git a/tools/viewer/StatsLayer.cpp b/tools/viewer/StatsLayer.cpp index 75226fd7db..50faf9cdd4 100644 --- a/tools/viewer/StatsLayer.cpp +++ b/tools/viewer/StatsLayer.cpp @@ -60,6 +60,13 @@ void StatsLayer::onPaint(SkCanvas* canvas) { fTimers[i].fTimes[fCurrentMeasurement] = 0; } +#ifdef SK_BUILD_FOR_ANDROID + // Scale up the stats overlay on Android devices + static constexpr SkScalar kScale = 1.5; +#else + static constexpr SkScalar kScale = 1; +#endif + // Now draw everything static const float kPixelPerMS = 2.0f; static const int kDisplayWidth = 192; @@ -77,6 +84,14 @@ void StatsLayer::onPaint(SkCanvas* canvas) { SkPaint paint; canvas->save(); + // Scale the canvas while keeping the right edge in place. + canvas->concat(SkMatrix::MakeRectToRect(SkRect::Make(canvasSize), + SkRect::MakeXYWH(canvasSize.width() * (1 - kScale), + 0, + canvasSize.width() * kScale, + canvasSize.height() * kScale), + SkMatrix::kFill_ScaleToFit)); + paint.setColor(SK_ColorBLACK); canvas->drawRect(rect, paint); // draw the 16ms line diff --git a/tools/viewer/Viewer.cpp b/tools/viewer/Viewer.cpp index b4da7dba64..c47c62fd39 100644 --- a/tools/viewer/Viewer.cpp +++ b/tools/viewer/Viewer.cpp @@ -1144,9 +1144,6 @@ void Viewer::onPaint(SkCanvas* canvas) { fCommands.drawHelp(canvas); this->drawImGui(); - - // Update the FPS - this->updateUIState(); } SkPoint Viewer::mapEvent(float x, float y) { @@ -1811,24 +1808,12 @@ void Viewer::updateUIState() { softkeyState[kOptions].append(Json::Value(softkey.c_str())); } - // FPS state - Json::Value fpsState(Json::objectValue); - fpsState[kName] = kFpsStateName; - double animTime = fStatsLayer.getLastTime(fAnimateTimer); - double paintTime = fStatsLayer.getLastTime(fPaintTimer); - double flushTime = fStatsLayer.getLastTime(fFlushTimer); - fpsState[kValue] = SkStringPrintf("%8.3lf ms\n\nA %8.3lf\nP %8.3lf\nF%8.3lf", - animTime + paintTime + flushTime, - animTime, paintTime, flushTime).c_str(); - fpsState[kOptions] = Json::Value(Json::arrayValue); - Json::Value state(Json::arrayValue); state.append(slideState); state.append(backendState); state.append(msaaState); state.append(prState); state.append(softkeyState); - state.append(fpsState); fWindow->setUIState(state.toStyledString().c_str()); } |