tree: 5c25d851e04852ef2e4e4e73fe0dc06d51cb2f37 [path history] [tgz]
  1. BUILD.gn
  2. DEPS
  3. README.md
  4. android/
  5. bitmap_request.cc
  6. bitmap_request.h
  7. compositor_status.h
  8. player_compositor_delegate.cc
  9. player_compositor_delegate.h
  10. player_compositor_delegate_unittest.cc
components/paint_preview/player/README.md

Paint Preview Player

The player displays a paint preview that has been previously recorded. Currently, the player is only fully implemented for Android. However, there are a few platform-independent base classes (PlayerCompositorDelegate , CompositorStatus , BitmapRequest ) than can be used to extend the playback support for other platforms.

PlayerCompositorDelegate uses the StartCompositorService API. Alternatively, playback support for other platforms can be provided by using StartCompositorService directly for more flexibility.

The remainder of this doc describes the Android-specific implementation.

TL;DR

Want to use the player? Construct a PlayerManager and use PlayerManager#getView to display it.

Design

As mentioned in the main README , a paint preview can have multiple frames in a nested structure. Consequently, the player is desinged in a nested structure as well, to facilitate the display of mulitple nested frames.

  • android/java/src/.../player/: This directory contains per-player classes. In another word, these classes are aware that the player might have multiple frames and are not involved in the logic for displaying a single frame.
  • android/java/src/.../player/frame: This directory contains per-frame classes. These are responsible for displaying a single frame.

Important classes

  • PlayerManager: Entry point for using the player. When created it initializes the compositor and populates a hierarchy of player frames based on the paint preview.
  • PlayerCompositorDelegateImpl : Communicates with the paint preview compositor. It requests bitmaps from the comopsitor and provides them to palyer frames.
  • PlayerFrameMediator : Handles the business logic for a single frame in the player, i.e. maintaining a viewport, updating its sub-frame visibilities, requesting bitmaps from the compositor delegate, etc.
  • PlayerFrameView : The View that displays a single frame.