Update Viewer docs for Android and iOS.

Change-Id: I4208221f982ce79b6c8af9aaa05644b0f1f94a5e
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/268680
Reviewed-by: Tyler Denniston <tdenniston@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
This commit is contained in:
Jim Van Verth 2020-02-04 16:47:01 -05:00 committed by Skia Commit-Bot
parent da88847531
commit 6c9b1fd666

View File

@ -20,38 +20,53 @@ To load resources in the desktop Viewers, use the `--resourcePath` option:
<skia-path>/out/Release/viewer --resourcePath <skia-path>/resources
Similarly, `--skps <skp-file-path>` will load any `.skp` files in that directory for display within the Viewer.
Similarly, `--skps <skp-file-path>` will load any `.skp` files in that directory
for display within the Viewer.
Other useful command-line options: using `--match <pattern>` will load only SKPs or slides matching that name; using `--slide <name>` will launch at that slide; and you can start up with a particular rendering method by using `--backend`, i.e., `--backend sw`, `--backend gl`, or `--backend vk`.
Other useful command-line options: using `--match <pattern>` will load only SKPs or slides
matching that name; using `--slide <name>` will launch at that slide; and you can start up
with a particular rendering method by using `--backend`, i.e., `--backend sw`, `--backend gl`,
`--backend vk`, or `--backend mtl`.
The desktop Viewers are controlled using the keyboard and mouse: left (&#x2190;) and right (&#x2192;) arrows to move from slide to slide; up (&#x2191;) and down (&#x2193;) arrows to zoom in and out; clicking and dragging will translate. Other display options and a slide picker can be found in the Tools UI, which can be toggled by hitting the spacebar.
The desktop Viewers are controlled using the keyboard and mouse: left (←) and right
(→) arrows to move from slide to slide; up (↑) and down (↓) arrows to
zoom in and out; clicking and dragging will translate. Other display options and a slide
picker can be found in the Tools UI, which can be toggled by hitting the spacebar.
Key | Action
-----------------------------|-------------
&#x2190; &#x2192; | Move between the slides
&#x2191; &#x2193; | Zoom in / out
d | Change render methods among raster, OpenGL and Vulkan
s | Display rendering times and graph
Space | Toggle display of Tools UI
Key | Action
-------|-------------
← → | Move between the slides
↑ ↓ | Zoom in / out
d | Change render methods among raster, OpenGL and Vulkan
s | Display rendering times and graph
Space | Toggle display of Tools UI
Android
-------
To build Viewer as an Android App, you will need the
[Android SDK](https://developer.android.com/studio/#command-tools) installed and your `ANDROID_HOME` environment variable set.
To build Viewer as an Android App, first follow the
[Android build instructions](https://skia.org/user/build#android) to set up the
Android NDK and a ninja out directory. In addition, you will need the
[Android SDK](https://developer.android.com/studio/#command-tools) installed and your
`ANDROID_HOME` environment variable set.
mkdir ~/android-sdk
( cd ~/android-sdk; unzip ~/Downloads/sdk-tools-*.zip )
yes | ~/android-sdk/tools/bin/sdkmanager --licenses
export ANDROID_HOME=~/android-sdk # Or wherever you installed the Android SDK.
If you are not using the NDK included with the Android SDK (at ~/android-sdk/ndk-bundle
in this example) you'll need to set the environmental variable `ANDROID_NDK_HOME`, e.g.,
export ANDROID_NDK_HOME=/tmp/ndk
The Viewer APK must be built by gradle which can be invoked on the command line
with the following script:
platform_tools/android/bin/android_build_app -C <out_dir> viewer
where `<out_dir>` is the ninja out directory for android (e.g., `out/arm64`)
that you want to use to build the app. Upon completion of the script the APK
where `<out_dir>` is the ninja out directory (e.g., `out/arm64`)
that you created. Upon completion of the script the APK
can be found at `<out_dir>/viewer.apk`
To load resources in the Android Viewer place them in
@ -63,8 +78,21 @@ display options are available in the UI.
iOS
---
The viewer is not yet fully supported on iOS, but can be used to display
individual slides on a device by launching via `ios-deploy` with the `--match`
or `--slide` command-line options. The viewer will automatically bundle the
`resources` directory in the top-level Skia directory, and will bundle an
`skps` directory if also placed in the Skia directory.
Viewer on iOS is built using the regular GN process, e.g.
bin/gn gen out/Release --args='target_os="ios" is_debug=false'
ninja -C out/Release viewer
Like other iOS apps it can be deployed either by using something like
[ios-deploy](https://github.com/ios-control/ios-deploy)
or by building within Xcode and launching via the IDE. See the
[iOS build instructions](https://skia.org/user/build#ios) for more information
on managing provisioning profiles for signing and deployment.
Viewer will
automatically bundle the `resources` directory in the top-level Skia directory,
and will bundle an `skps` directory if also placed in the Skia directory.
On iOS the Viewer provides basic touch functionality: you can view slides,
swipe between them, pinch-zoom to scale, and translate via panning. There is not
yet support for display options or selecting from a list of slides.