Commit Graph

21 Commits

Author SHA1 Message Date
that
b240f4a6a3 gui: fix font scaling for zip themes
All fonts were extracted to /tmp/extract.bin which was deleted after
the initial load, so reloading for scaling failed.

- extract fonts to /tmp with original name and don't delete them
- minor code cleanup

Change-Id: If8a0f657a7ef4c418fd5cc8550a24de44a38f303
2016-03-17 21:59:26 +01:00
Ethan Yonker
fbb4353a24 Update minuitwrp graphics in line with latest minui
Note: events.cpp is still old code renamed to cpp to make it
easier to call functions like gr_fb_width().

I had to modify AOSP fbdev code to provide a separate memory
surface for drawing to as drawing directly to the framebuffer
resulted in rendering taking about 5 times longer.

I also modified AOSP adf code to provide a separate memory surface
for drawing for the same performance reasons. The Nexus 9 supports
adf graphics.

Overlay graphics work on at least one device. Overlay provides a
separate memory buffer already so performance is good.

I do not have a drm device yet that I know of. I made some attempt
to update the drm code to determine the correct pixel format based
on the drm graphics format, but what is available in pixel flinger
and what is available in drm do not line up all that well. Reports
are that the Pixel C is using drm graphics, but performance is
slow, likely due to the use of a mmap instead of a memory buffyer.

Change-Id: Ibd45bccca6ac2cb826037aa9b2aa5065cf683eed
2016-01-27 10:53:13 -06:00
Ethan Yonker
74db157b94 Multiple Language Support
This is similar to https://gerrit.omnirom.org/#/c/14014

A lot of the features built in the older patch set have been split
out into separate patches, most of which have already been merged.
The remaining functionality here should all be directly related to
language selection and loading. We always load English as a base
before loading other languages over the top of the base. The idea
is that if another language is missing a translation, then we will
still display the English.

Maybe still to do: read the /cache/recovery/last_locale file and
load a language based on that. For me, this file contains just:
en_US
We probably won't bother with region specific translations so we
would have to look at either trimming off the _US or using some
other method like perhaps a symlink or a combination of the two.

Thanks to _that for twmsg.cpp class

Change-Id: I9647a22e47883a3ddd2de1da51f64aab7c328f74
2015-12-19 08:31:01 -06:00
Ethan Yonker
d0514ba806 Fix a bunch of warnings
Mostly adding __unused where needed.

Change-Id: Ia4f675b9b360782728c361ed1699db0cc277c3a5
2015-10-24 17:36:24 -05:00
Ethan Yonker
88037f476f Remove support for non-TTF fonts
This patch set removes support in TWRP for the old .dat file
format as well as support for the AOSP style fonts in header
files. We need TTF for scaling.

Note that the old AOSP style header font is still supported in
minui which is not used by TWRP.

Change-Id: I6124a3333d479f1fc668138f7e32c4be9b519552
2015-10-15 09:23:39 -05:00
that
5267a21667 gui: move retainaspect handling to the resource ctors
LoadResources should only decide on the resource type,
everything else is handled by the resources themselves.

Change-Id: I30f68293960c23560979f650efc4393992cf5824
2015-06-01 03:03:28 +02:00
that
b2e8f672f3 gui: support string resources
storing strings in a map (for fast lookup) in resource manager

To define a string resource in <resources>:
<string name="foo">Hello</string>

To use a string, e.g.:
<text>%@foo%</text>

Not yet done: language-specific resources (should be solved not only for
strings, but for all kinds of resources - e.g. for localized images)

Change-Id: I3ba5cf5298c09e0d28a83973e9662f179271b33f
2015-03-11 07:38:37 -05:00
that
0f425069dc gui: allow specifying resource type in element name
e.g. '<image ...>' instead of '<resource type="image" ...>'

Change-Id: I5ce04ae0845351c8a4640d12e36f1aaf32e1ebc9
2015-03-11 07:31:40 -05:00
that
74ac6060cc gui: type safe resources part 2
- separate collections for fonts, images, animations
- no more ugly casts
- fix crash if main ui.xml did not define any resources but include did
- don't stop loading resources if one "type" attribute is missing

Change-Id: I70c1c9ca66ca65d9fba1ba3eded34f3d8a07488e
2015-03-11 07:21:37 -05:00
that
f6ed8fc1f5 gui: make resources type safe
- add string, int, color and resource loading helpers
- use typed resource classes, and some cleanup in loading code
- remove abstract GetResource() to enforce type safe access
- add height and width query methods to resources and use them
- minor cleanup
- simplify LoadPlacement

Change-Id: I9b81785109a80b3806ad6b50cba4d893b87b0db1
2015-02-15 20:36:40 +01:00
Ethan Yonker
63e414fc8a Scale the GUI to fit the screen
With this patch set, if needed, we scale the images during early
boot. TTF support is needed to properly scale the font. No font
scaling is done on the old style fixed width font used in the
console.

Special thanks to _that for figuring out the scaling and blending
function calls to make this possible.

Change-Id: If2f79bef16d6db2e1298bfc3d00c9bcca2bee37a
2015-02-10 14:11:50 -06:00
Dees Troy
3454ade92d Use /twres instead of /res for theme resources
AOSP and other ROM trees now do a rm -rf of the res folder during
the ramdisk creation process that removes the TWRP resources.
Using /twres instead of /res works around this issue making TWRP
more compatible with AOSP and other build trees.

Change-Id: I0d4c7e06ca381ac5aa0069b6f2b8c47f7dec49e7
2015-01-22 15:21:27 -06:00
that
f74ac8740c gui: clean up error handling in resource manager
Change-Id: Ib94e661ab0c608deb2d119168709c85a9a44b2fa
2015-01-18 12:00:02 +01:00
Ethan Yonker
619a721a30 Improve resource error logging
Actually display the name of the item or the filename of the item
that we were unable to load in the log to make it easier to
determine what went wrong.

Change-Id: I027b35aab286e4d0f1957bcfb28ed40d81f9bbb2
2014-12-12 17:10:20 +01:00
bigbiff
85939e5a1b Thanks to _that, return null if vector is empty
Change-Id: Idc44455dd0c971c876ae283528c4367a82e145bd
2014-11-15 21:07:22 -05:00
Vojtech Bocek
76ee903d84 Add support for TrueType fonts
* Keeps original font system in place
* Uses the same API as original font system:
   - You can render only one line at a time
   - You can only use one font and color for one gr_text* call
* Caches all rendered text, with a string cache limited to 400
  entries, then it trucates to 250, which results in memory
  usage hovering around 5-10MB

Change-Id: I36107b9dcd8d57bae4486fce8b8f64e49ef3d906
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2014-10-14 15:06:56 +02:00
Ethan Yonker
780cd39e42 Allow ui.xml to include additional xml files to read
Use common portrait and landscape xml files based on resolution
defined by the device.

Change-Id: Iec528f9d846d49857ff98de1ac201e25dbb60339
2014-07-28 08:50:59 -05:00
Matt Mower
fb1c4ffaaf Whitespace and minor code cleanup
This is by no means comprehensive, but is quite a bit better already.

Change-Id: Ibc8654a5dfb0eec39cbd0b64bdb52bb4fbfe2f7e
2014-06-04 09:13:37 -05:00
Vojtech Bocek
fafb0c541b Unify indentation and little clean-up in TWRP files
Signed-off-by: Vojtech Bocek <vbocek@gmail.com>
2013-08-24 07:56:48 -05:00
Dees_Troy
2673cec07a Move all AOSP code out of recovery binary
Improves license compatibility between GPL and Apache

Change-Id: I2b165aa575bb6213af6b07936f99610c113443f0
2013-04-04 18:57:34 +00:00
Dees_Troy
51a0e82eb2 TWRP-ify AOSP code
Pull in most TWRP sources
Stub out partition management code
Make it compile -- probably will not boot
Kind of a mess but have to start somewhere
2012-09-05 15:24:31 -04:00