tree: dd9aac6d5268eb4da39deadf1d8781dd39e8a394 [path history] [tgz]
  1. data/
  2. meta/
  3. BUILD.gn
  4. main.cc
  5. png_helper.cc
  6. png_helper.h
  7. README.md
  8. sysmem_helper.cc
  9. sysmem_helper.h
  10. view_provider.cc
  11. view_provider.h
src/ui/examples/simplest_sysmem/README.md

Simplest Sysmem Example

This component contains 3 examples that demonstrates how to render a simple image using sysmem buffer allocation and Flatland API in C++.

  • --png: Loads the smiley.png file from package data, and renders it on screen. This uses RGBA pixel format.
  • --rect: Renders a fuchsia rectangle on screen using Flatland's CreateFilledRect API.
  • --block: Generates 4 BGRA32 formatted colored blocks on screen.

NOTE: Currently ffx session add does not support passing arguments for .cm components (https://fxbug.dev/42178074). Until the support is added in ffx session plugin, to change the input arg, you will need to modify simplest_sysmem.cml.

Usage

$ fx set terminal.x64 --with //src/ui/examples/simplest_sysmem
$ fx build
# Start package server (ex: fx serve)
# Start the emulator (ex: ffx emu)
# Login (don't forget the password you set)
$ ffx session add fuchsia-pkg://fuchsia.com/simplest_sysmem#meta/simplest_sysmem.cm

# Note: If you are modifying the example, you don't have to restart the emulator, iterate with:
$ ffx session restart
# Login again with the password you previously set
ffx session add fuchsia-pkg://fuchsia.com/simplest_sysmem#meta/simplest_sysmem.cm