diff options
7 files changed, 17 insertions, 90 deletions
diff --git a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java index f82a7b66cd..0c4f736e80 100644 --- a/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java +++ b/platform_tools/android/apps/viewer/src/main/java/org/skia/viewer/StateAdapter.java @@ -36,7 +36,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec private static final String VALUE = "value"; private static final String OPTIONS = "options"; private static final String BACKEND_STATE_NAME = "Backend"; - private static final String FPS_STATE_NAME = "FPS"; private static final String REFRESH_STATE_NAME = "Refresh"; private static final String ON = "ON"; private static final String OFF = "OFF"; @@ -45,11 +44,9 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec private ViewerActivity mViewerActivity; private LinearLayout mLayout; private JSONArray mStateJson; - private TextView mFPSFloatText; public StateAdapter(ViewerActivity viewerActivity) { mViewerActivity = viewerActivity; - mFPSFloatText = (TextView) viewerActivity.findViewById(R.id.fpsFloatText); try { mStateJson = new JSONArray("[{\"name\": \"Please\", " + "\"value\": \"Initialize\", \"options\": []}]"); @@ -72,10 +69,9 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec } // The first list item is the mLayout that contains a list of state items - // The second list item is the toggle for float FPS @Override public int getCount() { - return 2; + return 1; } @Override @@ -99,19 +95,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec } return mLayout; } - case 1: { - View view = LayoutInflater.from(mViewerActivity).inflate(R.layout.fps_toggle, null); - Switch theSwitch = (Switch) view.findViewById(R.id.theSwitch); - theSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){ - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - mFPSFloatText.setVisibility(isChecked ? View.VISIBLE : View.INVISIBLE); - // Quickly set the bool fRefresh in native Viewer app for continuous refresh - mViewerActivity.onStateChanged(REFRESH_STATE_NAME, isChecked ? ON : OFF); - } - }); - return view; - } default: { return null; } @@ -130,12 +113,6 @@ public class StateAdapter extends BaseAdapter implements AdapterView.OnItemSelec nameText.setText(item.getString(NAME)); - if (nameText.getText().equals(FPS_STATE_NAME) && mFPSFloatText != null) { - mFPSFloatText.setText(value); - // Don't show FPS in the drawer. We'll show it in the float text. - itemView.setVisibility(View.GONE); - } - JSONArray options = item.getJSONArray(OPTIONS); if (options.length() == 0) { valueText.setText(value); diff --git a/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml b/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml index b78112dc52..49457c9802 100644 --- a/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml +++ b/platform_tools/android/apps/viewer/src/main/res/layout-xlarge-land/activity_main.xml @@ -35,19 +35,6 @@ android:layout_centerVertical="true" android:layout_centerHorizontal="true" /> </LinearLayout> - - <TextView - android:visibility="invisible" - android:layout_width="100dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:padding="10dp" - android:background="@android:color/holo_blue_dark" - android:textColor="@android:color/white" - android:text=" 100.000ms" - android:id="@+id/fpsFloatText" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" /> </RelativeLayout> </LinearLayout> diff --git a/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml b/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml index 7041d0e8ed..bfb91dff57 100644 --- a/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml +++ b/platform_tools/android/apps/viewer/src/main/res/layout/activity_main.xml @@ -23,19 +23,6 @@ android:layout_centerHorizontal="true" /> </LinearLayout> - <TextView - android:layout_width="100dp" - android:layout_height="wrap_content" - android:layout_margin="10dp" - android:padding="10dp" - android:background="@android:color/holo_blue_dark" - android:textColor="@android:color/white" - android:text=" 100.000ms" - android:id="@+id/fpsFloatText" - android:visibility="invisible" - android:layout_alignParentBottom="true" - android:layout_alignParentEnd="true" /> - </RelativeLayout> <!-- The navigation drawer --> diff --git a/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml b/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml deleted file mode 100644 index 4463629ab7..0000000000 --- a/platform_tools/android/apps/viewer/src/main/res/layout/fps_toggle.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="match_parent" - android:layout_height="wrap_content"> - - <TextView - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="10dp" - android:layout_marginLeft="10dp" - android:layout_marginBottom="0dp" - android:textAppearance="?android:attr/textAppearanceLarge" - android:text="@string/float_fps" /> - - <Switch - android:id="@+id/theSwitch" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginBottom="10dp" - android:layout_marginLeft="10dp" - android:layout_marginTop="0dp" /> -</LinearLayout>
\ No newline at end of file diff --git a/platform_tools/android/apps/viewer/src/main/res/values/strings.xml b/platform_tools/android/apps/viewer/src/main/res/values/strings.xml index 5e218af9e3..84a0af3c02 100644 --- a/platform_tools/android/apps/viewer/src/main/res/values/strings.xml +++ b/platform_tools/android/apps/viewer/src/main/res/values/strings.xml @@ -2,5 +2,4 @@ <resources> <string name="drawer_open">Open navigation drawer</string> <string name="drawer_close">Close navigation drawer</string> - <string name="float_fps">Render time</string> -</resources>
\ No newline at end of file +</resources> 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()); } |