summaryrefslogtreecommitdiffstats
path: root/minui/include (follow)
Commit message (Collapse)AuthorAgeFilesLines
* minui: GRSurface::Create() computes data_size on its own.Tao Bao2018-11-271-9/+16
| | | | | | | | | | | | | GRSurface::Create() doesn't need to rely on caller specifying the buffer size, as it can compute that info based on the given args. This CL also uses `size_t` for all the parameters in GRSurface::Create(). Test: Run recovery_unit_test on marlin. Test: Build and boot into blueline recovery. `Run graphics test`. Test: Build and boot into blueline charger mode. Change-Id: Idec9381079196abf13553a475006fefcfca10950
* minui: GRSurface manages data with std::unique_ptr.Tao Bao2018-11-071-3/+11
| | | | | | Test: Run recovery_unit_test on marlin. Test: `Run graphics test` on taimen. Change-Id: I34bd862049900b0030f2840a92a7fa3e02fa2c10
* minui: Add GRSurface::Clone().Tao Bao2018-11-011-0/+4
| | | | | | | Clone() allows duplicating the image that's stored in the GRSurface. Test: Run recovery_unit_test. Change-Id: Ia50d507c6200f2de5f17143775de805247a60e1f
* minui: Remove the default and copy ctors for GRSurface.Tao Bao2018-11-011-1/+4
| | | | | | | | | | | | As well as all the derived classes. Instances must be created with Create(). A default copy ctor would mess up the ownership of the mapped or allocated buffer in these classes, so that has been explicitly removed. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Test: `Run graphics test` on blueline. Change-Id: I69ce001a9ec9e3ac851edb6ec4d3fa11f4aaea08
* minui: Add a protected GRSurface ctor.Tao Bao2018-10-311-4/+9
| | | | | | | | | This prepares for the removal of the default and copy ctors, by making GRSurface::Create() as the only way to get GRSurface instances. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0c34c3f3967e252deb020907c83acbac8a8f36b9
* minui: Move GRSurface into a class.Tao Bao2018-10-231-8/+26
| | | | | | | | | | | | | | | | | | | | | | This CL adds GRSurface::Create() and dtor for managing the allocated memory in GRSurface class. It also adds GRSurface::data() that hides the underlying implementation, with both of const and non-const overloads. This allows `const GRSurface&` to be more useful - previously it only ensured a const member variable of `data`, instead of a read-only buffer it points to. It also marks the parameters in gr_texticon() and gr_blit() as const, as they're incoming source that shouldn't be altered. It corrects the type of gr_draw, which is the sink to be painted on (an earlier attempt was made in [1], but didn't get the full picture correctly). [1] https://android-review.googlesource.com/c/platform/bootable/recovery/+/704757/ Test: mmma -j bootable/recovery Test: recovery_unit_test on marlin Test: Run graphics test on marlin (fbdev). Test: Run graphics test on blueline (drm). Change-Id: I7904df084cd6c08fa04a9da97d01b4b1a6e3a20c
* minui: Use runtime properties instead of build time vars.Tao Bao2018-08-021-0/+10
| | | | | | | | | | | | | | | This CL removes the use of the following build time macros, and uses the runtime property values instead. - TARGET_RECOVERY_PIXEL_FORMAT - TARGET_RECOVERY_OVERSCAN_PERCENT - TARGET_RECOVERY_DEFAULT_ROTATION Bug: 110380063 Test: Set up taimen with `TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT`. Build and check recovery UI. Test: Set up taimen with `TARGET_RECOVERY_PIXEL_FORMAT := ABGR_8888`. Build and check recovery UI. Change-Id: I4439556a03fde4805a18011ef72eff1373f31d47
* minui: Clean up the use of `rotation`.Tao Bao2018-08-011-5/+5
| | | | | | | | | | | | | | | This CL uses scoped enum for GRRotation. It also refactors the previous comparisions to improve readability -- it was hard to tell the meaning of `if (rotation % 2)` unless by checking the exact values. It also temporarily adds STRINGFY to expand the macro of DEFAULT_ROTATION. This will be removed once minui is changed from reading build time vars to runtime properties. Test: Build and boot into recovery image on marlin. Test: Set `TARGET_RECOVERY_DEFAULT_ROTATION := ROTATION_LEFT` and check the display under recovery with `Run graphics test`. Change-Id: Ieb08b1cd13c284f8dcf906cb2a1430c6bae2835b
* minui: Add constness to GRSurface* in gr_get_{width,height}.Tao Bao2018-06-131-6/+13
| | | | | | | | | Also free gr_font in gr_exit(), as it's owned by minui. Test: mmma -j bootable/recovery system/core/healthd Test: recovery_unit_test on marlin Test: Boot into recovery. Run graphics test. Change-Id: I00457bb97ed3dc95ef5aad493827fb5a62a258dc
* Let gr_init proceed even if we failed to load a font fileTianjie Xu2018-06-011-1/+3
| | | | | | | | | | Some users of minui don't need to draw texts; and we should let them still be able to use the library without providing a font file. Also add check for null pointers in gr_measure() and gr_font_size(). Bug: 80535212 Test: boot into recovery without a font file, and the buttons still work Change-Id: I848e4410f2ce09ea0ab433573e6827b7e9b2c575
* tests: Add tests for ScreenRecoveryUI.Tao Bao2018-05-091-0/+3
| | | | | | | | | | | | In order to support that, this CL adds Paths::set_resource_dir() to override the default resource dir ("/res/images/") that's only available under recovery. Note that since there're external modules depending on libminui, it adds a separate function of res_set_resource_dir(), instead of requiring the dependency on libotautil for everyone. Test: mmma -j bootable/recovery Test: Run recovery_unit_test on marlin. Change-Id: I0a7dcf4476808bea9e634eaffc9676f6cbaf92b7
* Expose PngHandler via resources.h.Tao Bao2018-04-141-0/+84
| | | | | | | | | | | | As a private header for testing purpose. PngHandler additionally loads a given filename if the one with '/res/images' prefix is not available. It also provides color_type/bit_depth that are parsed from the PNG file. This allows reusing the same code for the ResourcesTest (renamed from ResourceTest). Test: Run recovery_manual_test on marlin. Change-Id: I3f939d79a1cb1b83a899847dbe2d51bde15d16d8
* graphics: add rotation logicLuke Song2017-09-281-13/+23
| | | | | | | Bug: 65556996 Bug: 63541890 Test: Tried 4 rotations, viewed logs and graphics test Change-Id: I2a6c18c28df03f0461663f63bf16db32c45211ec
* Add a new option in recovery menu to test the background textsTianjie Xu2017-09-271-0/+4
| | | | | | | | | | | | Add a new option "Run locale test" to check the background text images (i.e. texts for "erasing", "error", "no_command" and "installing" with different locales.) Use volume up/down button to cycle through all the locales embedded in the png file, and power button to go back to recovery main menu. Test: Run locale test with bullhead. Change-Id: Ib16e119f372110cdb5e611ef497b0f9b9b418f51
* ui: Move the support for touch inputs into RecoveryUI.Tao Bao2017-08-021-1/+2
| | | | | | | | | | | | | | | | | | | - Added detection for EV_ABS events in minui/events.cpp, if it's allowed; - Added listening and processing touch inputs in ui.cpp; - Fixed an issue in recognizing swipe with multi-touch protocol A; - Changed the logic in RecoveryUI::ProcessKey() to be swipe-aware. It now allows turning on text mode with <power> + <swipe-up>. The last change also fixed an issue on devices with protocol A: prior to this CL, user may accidentally toggle the text mode during an OTA. Because it was considered as a single-button device, a long tap that sent BTN_TOUCH event would turn on text mode. Test: Allow detecting touch inputs. Swiping (up, down, enter) works on angler, angelfish, dorado respectively. Bug: 36169090 Change-Id: I4bc882b99114ce4ab414f8bdb8f4f7a525b8a8fd
* Add the missing sr-Latn into png files and rename the png locale headerTianjie Xu2017-03-251-1/+2
| | | | | | | | | | | Switch the locale header in the png files from Locale.toString() to Locale.toLanguageTag(). For example, en_US --> en-us and sr__#Latn --> sr-Latn. Also clean up recovery a bit to expect the new locale format. Bug: 35215015 Test: sr-Latn shows correctly under graphic tests && recovery tests pass Change-Id: Ic62bab7756cdc6e5f98f26076f7c2dd046f811db
* minui: Move callback functions to std::function.Tao Bao2017-01-231-6/+5
| | | | | | | Also make minor clean up to the header includes. Test: mmma bootable/recovery system/core/healthd system/extra/slideshow Change-Id: I3bfcf2c0e203c26a98ee08f1f8036c68356a69fd
* minui: Export minui/minui.h.Tao Bao2017-01-171-0/+135
For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16