summaryrefslogtreecommitdiffstats
path: root/minui/graphics.cpp (unfollow)
Commit message (Collapse)AuthorFilesLines
2021-01-21minui: remove libadf since it is no longer supportedMarissa Wall1-7/+1
Libadf is being removed since there are no android common kernels that support adf. Remove support from miniui. Test: Compiles and boots Bug: 150467766 Change-Id: Ic66ea7a012b0466810ddeb8f884150b50c8ae769
2020-02-28minui: remove libadf since it is no longer supportedMarissa Wall1-7/+1
Libadf is being removed since there are no android common kernels that support adf. Remove support from miniui. Test: Compiles and boots Bug: 150467766 Change-Id: Ic66ea7a012b0466810ddeb8f884150b50c8ae769
2019-12-13minui: add ARGB_8888 formatAdrian Salido1-1/+3
Minui currently really only supports composing in 2 different formats (see gr_color()) with ALPHA always as MSB. However, some devices interpret PixelFormat as either Big Endian (i.e. ARGB has alpha at MSB) or Little Endian (i.e. BGRA has alpha at MSB). This change attempts to give multiple options to specify the same format depending on device interpretation, while keeping just 2 different composition formats supported by minui. * ARGB + BGRA: Pixels have (A)lpha at MSB and (B)lue at LSB * RGBX + ABGR: Pixels have (A)lpha at MSB and (R)ed at LSB With this in mind, limiting the use of png_set_bgr() to happen only for (ARGB/BGRA) combination while leaving (RGBX/ABGR) unchanged. Bug: 143480444 Test: Boot device with TARGET_RECOVERY_PIXEL_FORMAT := <<all>> Change-Id: Ia0f94ccbc564b8def7c9416483712ff1abbbf49a
2018-10-23minui: Move GRSurface into a class.Tao Bao1-29/+30
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
2018-09-06minui: Track the name change to minui related properties.Tao Bao1-3/+3
These properties need to be exposed to both of charger and recovery. This CL tracks the name change. Bug: 113567255 Test: Build along with other CLs in the topic (for Makefile and sepolicy changes). Boot into charger mode. Test: Boot into recovery. Run graphics test. Change-Id: I4d90778c1767c9bd7e00830a34ee2d4875ce0b83
2018-08-02minui: Use runtime properties instead of build time vars.Tao Bao1-11/+28
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
2018-08-01minui: Clean up the use of `rotation`.Tao Bao1-22/+45
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
2018-06-13minui: Add constness to GRSurface* in gr_get_{width,height}.Tao Bao1-14/+18
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
2018-06-06minui: Handle the failures from the drm backend in gr_initTianjie Xu1-0/+4
In a charger mode manual test, we encounter failures from the MinuiBackendDrm when calling DrmEnableCrtc and Flip. To make the minui more robust, we should fall back to another backend if drm's SetCrtc fails. And check the value of gr_draw before dereferencing. Bug: 80249440 Test: boot to recovery Change-Id: Ibd1ca1fb1115fe1132684586c54eccd8fb4c3ad9
2018-06-01Let gr_init proceed even if we failed to load a font fileTianjie Xu1-3/+12
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
2018-03-30Remove the obsolete mkfont.c and font_10x18.hTianjie Xu1-32/+5
The font_10x18.h is used as a fall back for fonts if the $(recovery_font) under bootable/recovery/fonts failed to reload. This font looks very small on the screen and we haven't used it in a while. Plus, fonts in header doesn't have many benefits if we support only ascii characters. So we decide to remove this header along with the mkfont.c that generates the header. For reference, here's the steps to use mkfont: 1. Generate a picture of fonts with apps on host 2. Open the pic with GIMP 3. Export the pic as '.c' file, and rename it into '.h' file 4. Compile the generated '.h' file with mkfont.c Bug: 76420958 Test: build and check the recovery menu on angler Change-Id: I6c108aa43a07bf4994115ef764275bd84df725e1
2017-09-28graphics: add rotation logicLuke Song1-208/+251
Bug: 65556996 Bug: 63541890 Test: Tried 4 rotations, viewed logs and graphics test Change-Id: I2a6c18c28df03f0461663f63bf16db32c45211ec
2017-02-11minui: Move graphics_{adf,drm,fbdev} into classes.Tao Bao1-40/+38
This CL defines minui_backend as an interface, and expresses the three backends (adf, drm and fbdev) as subclasses to the interface. Test: 'Run graphics test' on N9, Pixel C and N5X. Change-Id: I0e23951c7b2e2ff918957a8d9fc8b0085b6e5952
2017-02-03minui: Minor clean up to graphics.cpp.Tao Bao1-62/+1
Remove unneeded header includes. Remove the dead code in gr_test() (already commented out). Similar tests have been covered by the "Run graphics test" from recovery menu. Test: mmma -j32 bootable/recovery Change-Id: If977c1b780602f5c5054469a3dae4fd85f34ab1a
2017-01-17minui: Export minui/minui.h.Tao Bao1-3/+3
For libminui static and shared libraries. Test: build Change-Id: Ib30dc5e2ef4a3c8b3ca3a0cec68cb65e229a0c16
2016-11-16Remove unnecessary uses of reinterpret_cast.Rahul Chaudhry1-1/+1
Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: I66f8f6026ed732a504504ade93ff196dc8b727ca
2016-11-16Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.Rahul Chaudhry1-3/+3
static_cast is preferable to reinterpret_cast when casting from void* pointers returned by malloc/calloc/realloc/mmap calls. Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: Iaffd537784aa857108f6981fdfd82d0496eb5592 Merged-In: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-11-16Have gr_init_font alloc memory for the fontDamien Bargiacchi1-7/+15
Change-Id: I8ccf369d52011bc5d07d8e041fe558ce734a78fc (cherry picked from commit d00f5eb63a8e4690f9bef1e943d539d052444d9b)
2016-11-15Support use of custom fonts in miniuiDamien Bargiacchi1-47/+55
Bug: 29547343 Change-Id: I398160c85daac90ffab2fa9bb2e96795b9e9885a (cherry picked from commit 35fff61b1c0d736d090a1cd1bb4e99141cc88ad8)
2016-11-09Use static_cast to cast pointers returned by malloc/calloc/realloc/mmap.Rahul Chaudhry1-4/+4
static_cast is preferable to reinterpret_cast when casting from void* pointers returned by malloc/calloc/realloc/mmap calls. Discovered while looking at compiler warnings (b/26936282). Test: WITH_TIDY=1 WITH_STATIC_ANALYZER=1 mma Change-Id: I151642d5a60c94f312d0611576ad0143c249ba3d
2016-09-09Have gr_init_font alloc memory for the fontDamien Bargiacchi1-7/+15
Change-Id: I8ccf369d52011bc5d07d8e041fe558ce734a78fc
2016-08-19Support use of custom fonts in miniuiDamien Bargiacchi1-47/+55
Bug: 29547343 Change-Id: I398160c85daac90ffab2fa9bb2e96795b9e9885a
2015-07-02Add drm support to minuiStéphane Marchesin1-0/+5
Bug: 22231636 Change-Id: I103c8e906b7dd9862b7bb89d8642268e9a3006b4 Signed-off-by: Stéphane Marchesin <marcheu@chromium.org>
2015-04-15Don't use typedefs that hide *s.Elliott Hughes1-1/+1
gr_surface was causing confusion for no good reason. Change-Id: If7120187f9a00dd16297877fc49352185a4d4ea6
2015-04-14Move the menu header out of the menu.Elliott Hughes1-1/+1
This makes it easier for us to deal with arbitrary information at the top, and means that headers added by specific commands don't overwrite the default ones. Add the fingerprint back, but broken up so it fits even on sprout's display. Change-Id: Id71da79ab1aa455a611d72756a3100a97ceb4c1c
2015-04-10Switch minui over to C++.Elliott Hughes1-6/+6
Change-Id: I59e08a304ae514a3fdb6fab58721f11670bc1b01
2015-03-24Remove support for Cupcake kernels.Elliott Hughes1-17/+0
Change-Id: I7376b9d3c1e11d19e164072d6e9d09c1183114a0
2015-03-24Fix recovery image text rendering.Elliott Hughes1-23/+19
Previously most devices would lose the character before a line wrap. The log's text rendering was starting at offset 4 but none of the arithmetic was taking this into account. It just happened to work on the Nexus 9's 1536-pixel wide display (1536/18=85.3) but not on a device such as the Nexus 5 (1080/18=60). The only active part of this change is the change from 4 to 0 in the gr_text call. The rest is just a few bits of trivial cleanup while I was working out what was going on. Change-Id: I9279ae323c77bc8b6ea87dc0fe009aaaec6bfa0e
2015-02-12Fix Droid and animation color in recovery modeTony Kuo1-0/+7
[Problem] Droid and animation color in recovery mode are incorrect [Modify] - Add support for flipping (zero copy) with RECOVERY_ABGR. - Decodes PNG files to BGRA directly, and other fills, text and alpha blending are also done directly in BGRA (i.e. blits can still bypass conversion) - Remove the BGRA workaround added previous for single buffer mode (f766396) Bug:19216535 Change-Id: Ie864419fc6da776ff58b2d02e130f203c194500f Signed-off-by: Tony Kuo <tony.kuo@mediatek.com>
2015-01-30Add missing includes.Elliott Hughes1-0/+1
Change-Id: I06ea08400efa511e627be37a4fd70fbdfadea2e6
2014-04-26recovery: minui: add adf backendGreg Hackmann1-4/+14
Change-Id: I1ad97b5b62bddbcb1104fa0b4e54415b793a4194 Signed-off-by: Greg Hackmann <ghackmann@google.com>
2014-03-17refactor image resource loading code in minuiDoug Zongker1-1/+1
Reduce the number of copies of libpng boilerplate. Rename res_create_* functions to be more clear. Make explicit the use of the framebuffer pixel format for images, and handle more combinations of input and output (eg, loading a grayscale image for display rather than use as a text alpha channel). Change-Id: I3d41c800a8f4c22b2f0167967ce6ee4d6b2b8846
2014-03-11separate fbdev-specific code out from minuiDoug Zongker1-151/+15
Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9
2014-03-11remove pixelflinger from recoveryDoug Zongker1-197/+302
Recovery now draws directly to the framebuffer by rolling its own graphics code, rather than depending on libpixelflinger. The recovery UI is modified slightly to eliminate operations that are slow with the software implementation: when the text display / menu is turned on, it now appears on a black background instead of a dimmed version of the recovery icon. There's probably substantial room for optimization of the graphics operations. Bug: 12131110 Change-Id: Iab6520e0a7aaec39e2ce39377c10aef82ae0c595 Conflicts: minui/resources.c
2014-03-11separate fbdev-specific code out from minuiDoug Zongker1-151/+15
Isolate the code that interacts with fbdev, in preparation for adding a new backend. Change-Id: I19105e9da1ca6408cebc110f7e2bb5abfb481ee9
2014-03-11remove pixelflinger from recoveryDoug Zongker1-197/+302
Recovery now draws directly to the framebuffer by rolling its own graphics code, rather than depending on libpixelflinger. The recovery UI is modified slightly to eliminate operations that are slow with the software implementation: when the text display / menu is turned on, it now appears on a black background instead of a dimmed version of the recovery icon. There's probably substantial room for optimization of the graphics operations. Bug: 12131110 Change-Id: Iab6520e0a7aaec39e2ce39377c10aef82ae0c595
2014-02-06recovery: fix building with pointer-to-int errors turned onColin Cross1-1/+1
Use intptr_t/uintptr_t to cast between pointer and int to allow building with -Werror=pointer-to-int-cast and Werror=int-to-pointer-cast turned on. Cast to char* instead of unsigned int for pointer arithmetic. Change-Id: Ia862306fdcca53866b330e8cf726f3d62f2248a0
2013-07-09recovery: move log output to stdoutDoug Zongker1-2/+2
Recovery currently has a random mix of messages printed to stdout and messages printed to stderr, which can make logs hard to read. Move everything to stdout. Change-Id: Ie33bd4a9e1272e731302569cdec918e0534c48a6
2013-03-07more font improvements and cleanupDoug Zongker1-12/+32
Get rid of the notion of a font's "ascent"; the reference point for drawing is the top-left corner of the character box rather than the baseline. Add some more space between the menu entries and make the highlight bar around the text. Replace the default font.png with two images; the build system will include one or the other based on the resolutions of the device. Restore the original compiled-in bitmap font, to fall back on when font.png can't be found (eg, in the charger binary). Add support for bold text (when a font.png image is used). Change-Id: I6d211a486a3636f20208502b1cd2aeae8b9f5b02
2013-03-05recovery: change font for menus to be an imageDoug Zongker1-24/+15
Instead of representing the font used for menus and log messages in the recovery binary, load it from a resource PNG image. This allows different devices to substitute their own font images. Change-Id: Ib36b86db3d01298aa7ae2b62a26ca29e6ef18014
2012-12-19add optional overscan compensation to recovery graphicsDoug Zongker1-4/+25
If your screen is a TV, it may not actually be displaying the edges of the framebuffer. Allow specifying an overscan percentage, and move each edge of the framebuffer in by that percent of the width/height. (The gr_* layer just lies to the caller about the size of the framebuffer, telling the caller it's smaller than it really is, and offsets all drawing commands to match.) Change-Id: I11bb2feb39ae522bd3e957a14ebdecf3609e0fdc
2012-09-04minor recovery fixesDoug Zongker1-1/+4
- protect against missing/malformed bitmaps: fail to display them but don't crash. - don't draw animation overlays until the overlay offset is computed. - logging cleanup Change-Id: Ieb1c155cfbb11e643000bdb5d1a57900c8757739
2012-08-23add simple text to recovery UIDoug Zongker1-0/+16
- recovery takes a --locale argument, which will be passed by the main system - the locale is saved in cache, in case the --locale argument is missing (eg, when recovery is started from fastboot) - we include images that have prerendered text for many locales - we split the background states into four (installing update, erasing, no command, error) so that appropriate text can be shown. Change-Id: I731b8108e83d5ccc09a4aacfc1dbf7e86b397aaf
2012-07-20minui: fix screen update issueDevin Kim1-2/+4
yres_virtual value is set incorrectly, causing serveral images to be skipped. Change this value according to the number of buffers to fix this issue. from: codeaurora.org minui: Display the battery charging image correctly commit: 581a4dead6b96579a13ff22e2454c1f329731679 Change-Id: I10f5d1c6cc37705f0287c7dd517082de2e11d264 Signed-off-by: Iliyan Malchev <malchev@google.com>
2012-07-12graphics: add support for "single buffering"Octavian Purdila1-2/+10
When we don't have enough video memory for double buffering we fallback to "single buffering". Change-Id: I8bfab6d8cd6b54f0cc6c67edc41a4c37d8fbd4ba Signed-off-by: Octavian Purdila <octavian.purdila@intel.com> Signed-off-by: Andrew Boie <andrew.p.boie@intel.com>
2011-09-27fix problem where the screen is sometimes all black in recoveryDoug Zongker1-0/+3
Change-Id: Ifa0b59e43eaf0bea9435aa4d96c5b0fc4f10fbfe
2011-08-30minui: graphics: add interface for framebuffer blank/unblankDima Zavin1-0/+10
Change-Id: I5c3ee61cbf6fadae50f10b9f2e73caceaa5048a7 Signed-off-by: Dima Zavin <dima@android.com>
2011-08-30minui: graphics: add ability to query font sizeDima Zavin1-0/+6
Change-Id: I5e8f477b7b205794f2975f12e6b6010c177f6052 Signed-off-by: Dima Zavin <dima@android.com>
2011-06-24Get the correct line_length.Michael Ward1-2/+37
Set the BPP and other fields and write it back, so the line_length comes back correctly. Change-Id: I85e4e8223c79b9394ae1fb609b3026de62027ab8
2011-06-23Graphics can handle stride != xres, and BGRA support.Michael Ward1-10/+13
Change-Id: Ifee94ac08028e62a40241a089ac7c36346fea3a3
2011-01-14option to allow recovery to use 24-bit graphics in UIDoug Zongker1-10/+18
Add "RECOVERY_24_BIT := true" to the device's BoardConfig.mk to use 24-bit framebuffers in the recovery ui. Change-Id: Iaede138bf7870becf237f12f1c0e49c9ff82d007
2010-11-01clear recovery framebuffers on allocation; display icon right after ui_initDoug Zongker1-1/+2
Make ui_init() clear the framebuffer memory it maps in so the user isn't treated to a visible flash of random bits on recovery startup. Call ui_set_background() (to show the installing icon) right after ui_init() to display something while device_recovery_start() is working (which can take a second or two on some devices). Bug: 3145331 Change-Id: I11e7859fab5847370ea4f4932c3fb1558af26c5d
2009-11-13eclair snapshotJean-Baptiste Queru1-0/+1
2009-06-06Force the fb into 16 bpp mode in case the hw has some other default.Rebecca Schultz Zavin1-0/+1
Signed-off-by: Rebecca Schultz Zavin <rebecca@android.com>
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-0/+312
2009-03-04auto import from //depot/cupcake/@135843The Android Open Source Project1-312/+0
2009-02-11auto import from //branches/cupcake/...@130745The Android Open Source Project1-16/+33
2008-12-18Code drop from //branches/cupcake/...@124589The Android Open Source Project1-33/+24