Commit graph

81 commits

Author SHA1 Message Date
Thomas Martitz
281d1fadb3 Do not include kernel.h in system.h.
system.h doesn't need it on its own and this change makes it less
dependant on Rockbox internals.

Change-Id: I4e1e4108a52a7b599627a829204eb82b392fc6d6
2014-01-05 19:35:23 +01:00
Bertrik Sikken
d023bf0f5d Fix checks on buflib allocated handles (0 is not a valid handle value)
Change-Id: I8fdc5a59a5062f40a431cd49971390e21631b8ec
2012-06-10 17:15:47 +02:00
Michael Sevakis
da6cebb6b0 Use buflib for the allocation of voice PCM resources.
Buffers are not allocated and thread is not created until the first
call where voice is required.

Adds a different callback (sync_callback) to buflib so that other
sorts of synchonization are possible, such as briefly locking-out the
PCM callback for a buffer move. It's sort of a messy addition but it
is needed so voice decoding won't have to be stopped when its buffer
is moved.

Change-Id: I4d4d8c35eed5dd15fb7ee7df9323af3d036e92b3
2012-05-02 17:22:28 -04:00
Bertrik Sikken
cb972abc48 Another round of making local functions static
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31384 a1c6a512-1295-4272-9138-f99709370657
2011-12-20 20:35:28 +00:00
Boris Gjenero
694502a965 Fix FS#12423 : Rockbox access to /.rockbox/fonts after usb_enable(true). This fixes entry into USB mode on the Archos Recorder V2 and possibly also other targets using a USB to IDE bridge chip. Fred Bauer found this removes the need for a workaround in glyph_cache_save(). I'm including his patch which removes the workaround.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31155 a1c6a512-1295-4272-9138-f99709370657
2011-12-06 00:58:01 +00:00
Frank Gevaerts
6e664f49b1 Guard font functions against invalid font ids. These arguably should never be passed, but this prevents freezes. Fixes FS#12400
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31075 a1c6a512-1295-4272-9138-f99709370657
2011-11-27 15:36:03 +00:00
Frank Gevaerts
dfd5d0684a Actually make glyph_cache_save static instead of just claiming it should be
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31074 a1c6a512-1295-4272-9138-f99709370657
2011-11-27 15:28:16 +00:00
Frank Gevaerts
e5a3c26c1d glyph_cache_save should be static
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31073 a1c6a512-1295-4272-9138-f99709370657
2011-11-27 15:24:53 +00:00
Fred Bauer
95a828bcdb Fix parameter order in font_load_in_memory(). FS#12395.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31033 a1c6a512-1295-4272-9138-f99709370657
2011-11-20 17:49:47 +00:00
Fred Bauer
ea7a89606c FS#12293 Global default glyph setting in System > Limits > Glyphs To Cache. Defaults to 250. This saves a lot of RAM while still allowing non-English users to have adequate glyph coverage.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31031 a1c6a512-1295-4272-9138-f99709370657
2011-11-19 23:34:26 +00:00
Jonathan Gordon
f19f3efb07 Redo r30826 (and hopefully not reintroduce font issues) which cleans up the font API. FONT_UI is deprecated, use screens[screen].getuifont() instead (and .setuifont() to set it after a font has been loaded)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30932 a1c6a512-1295-4272-9138-f99709370657
2011-11-08 10:09:33 +00:00
Bertrik Sikken
e71750b7a3 Make local functions and variables static where possible
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30897 a1c6a512-1295-4272-9138-f99709370657
2011-11-03 23:32:49 +00:00
Fred Bauer
e299eb3ea3 Add functions font_set_ui() and font_get_ui(). The font returned by FONT_UI used to be fixed at zero but since buflib-fonts (r30589) can be different, depending on the order of loads and unloads. Fixes broken behavoir in virtual keyboard (FS#12336), lyrics player (FS#12306), and hopefully, FS#12337
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30826 a1c6a512-1295-4272-9138-f99709370657
2011-10-22 17:13:33 +00:00
Dominik Riebeling
c032b9d083 Add empty font_lock() for bootloaders to fix builds.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30817 a1c6a512-1295-4272-9138-f99709370657
2011-10-21 20:15:26 +00:00
Fred Bauer
04a015dde0 Provide font_lock(). Font_get_bits() or ..width() may have to read glyph cache misses from disk so provide a means to lock the buflib memory during the wait.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30814 a1c6a512-1295-4272-9138-f99709370657
2011-10-21 18:05:52 +00:00
Fred Bauer
8c9017211e Faster cached font loading. FS#12333
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30769 a1c6a512-1295-4272-9138-f99709370657
2011-10-17 13:17:04 +00:00
Fred Bauer
100974162d FS:12299 Font glyph cache is no longer saved. Each font will now have its own glyph cache file with the extension '.gc' Includes a temporary fix that delays saving the file to prevent the creation of multiple gc files with same name. Mostly JD Gordon's code.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30760 a1c6a512-1295-4272-9138-f99709370657
2011-10-16 13:18:46 +00:00
Fred Bauer
08979ba835 Fix yellow
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30753 a1c6a512-1295-4272-9138-f99709370657
2011-10-14 20:42:14 +00:00
Fred Bauer
de3e2e7efc Remove font_reset() which tried to fetch font *pfs from uninitiaized buflib_allocations. Change handle locking to track number of locks applied. Remove some duplicated code from internal_load_font()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30752 a1c6a512-1295-4272-9138-f99709370657
2011-10-14 20:35:52 +00:00
Fred Bauer
ee7de145f1 Don't make font available via buflib_allocations[] until fully loaded
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30750 a1c6a512-1295-4272-9138-f99709370657
2011-10-14 14:04:27 +00:00
Thomas Martitz
5783505b99 Add two macros for char*-based pointer arithmetic and use it in font.c
This fixes errornous pointer addition (+ on a short*), which crashed in some situation.
Fixes FS#12317 and should hopefully get the clips booting again.

Thanks to Jonathan Gordon for spotting the bad pointer arithmetic.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30724 a1c6a512-1295-4272-9138-f99709370657
2011-10-07 19:29:18 +00:00
Björn Stenberg
725ed0ad3f Only alloc if necessary. Patch by Jonathan Gordon.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30716 a1c6a512-1295-4272-9138-f99709370657
2011-10-05 11:44:22 +00:00
Thomas Martitz
1125c39ea8 Don't leak file descriptor.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30619 a1c6a512-1295-4272-9138-f99709370657
2011-09-29 05:42:20 +00:00
Fred Bauer
205ef12b9d font_load(): Reduce font memory allocation to the font's file size if less than MAX_FONT_SIZE
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30618 a1c6a512-1295-4272-9138-f99709370657
2011-09-29 03:15:27 +00:00
Fred Bauer
117ebdb28c Do not move NULL pointers in buflibmove_callback(). Fixes some skin crashes when changing themes.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30610 a1c6a512-1295-4272-9138-f99709370657
2011-09-27 01:02:34 +00:00
Fred Bauer
01b36e889c glyph_bytes() should pad to an even number
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30606 a1c6a512-1295-4272-9138-f99709370657
2011-09-26 18:13:34 +00:00
Thomas Martitz
586288cba1 Fix typos. Should have test compiled at least once :\
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30604 a1c6a512-1295-4272-9138-f99709370657
2011-09-25 20:19:54 +00:00
Thomas Martitz
6af8a579c7 Fonts/buflib: The lru cache base poitner needs to be updated as well in the move callback.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30603 a1c6a512-1295-4272-9138-f99709370657
2011-09-25 20:18:45 +00:00
Jonathan Gordon
83cfbf4e51 Allow fonts to use smaller buffers than the default size. use font_load_ex() to speficiy the buffer size. If the font is already loaded with a smaller buffer it will be reloaded to use the new size. Also fix an issue where handles would get lost if fonts fail to load in skins
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30592 a1c6a512-1295-4272-9138-f99709370657
2011-09-24 14:52:16 +00:00
Jonathan Gordon
aa0f4a4bbe FS#12273 - use buflib for font storage. thanks to the testers :)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30589 a1c6a512-1295-4272-9138-f99709370657
2011-09-24 13:19:34 +00:00
Thomas Martitz
9edd6d4ee9 Anti-Aliased Fonts support.
This enables Rockbox to render anti-aliased fonts using an alpha blending method.
The input font bitmaps are 4bit, i.e. 4x larger, but the metadata size stays the same.

A tool, convttf, for converting ttf fonts directly to the Rockbox fnt format is provided.
It has a useful help output, but the parameter that works best is -c1 or -c2 (2 for larger font sizes).

Flyspray: FS#8961
Author: Initial work by Jonas Hurrelmann, further work by Fred Bauer, Andrew Mahone, Teruaki Kawashima and myself.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29523 a1c6a512-1295-4272-9138-f99709370657
2011-03-05 18:36:51 +00:00
Michael Sparmann
751303c2ac iPod Classic CE-ATA Support (Part 1 of 4: Cacheline align some statically allocated sector buffers)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29444 a1c6a512-1295-4272-9138-f99709370657
2011-02-27 22:44:30 +00:00
Andree Buschmann
5d849a963e Clean up multiple definitions of RAM size. Remove -DMEM (make) and MEM (code), use the already defined MEMORYSIZE instead.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29189 a1c6a512-1295-4272-9138-f99709370657
2011-02-02 17:43:32 +00:00
Thomas Martitz
2c2416094f Get rid of get_user_file_path and do the path handling in wrappers for open() and friends.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28752 a1c6a512-1295-4272-9138-f99709370657
2010-12-06 22:26:31 +00:00
Fred Bauer
cf8f526d16 change get_glyph_size() to font_glyphs_to_bufsize(). fixes a bug when font glyph buffer < font header
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27911 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 18:25:23 +00:00
Fred Bauer
aaa864ea03 close file when cached font load fails
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27910 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 16:48:53 +00:00
Fred Bauer
edb28753b0 limit font_cache preloading to cache capacity
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27909 a1c6a512-1295-4272-9138-f99709370657
2010-08-27 15:10:30 +00:00
Jonathan Gordon
faaf431d32 Accept FS#11567 by Fred Bauer - better memory management for the skin fonts
%Fl now takes an optional 3rd param which is the number of glyphs to cache (default to 256). the smaller the number, the less ram will be used (i.e using 15 for a font which only shown numbers is a good idea)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27882 a1c6a512-1295-4272-9138-f99709370657
2010-08-25 14:11:38 +00:00
Frank Gevaerts
1994df6844 Read glyph cache in disk order to speed up loading - FS#11168 by Fred Bauer
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27864 a1c6a512-1295-4272-9138-f99709370657
2010-08-23 18:17:54 +00:00
Thomas Martitz
9c0b2479f7 Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox).
This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local.

On the DAPs it's a no-op, returing /.rockbox directly.

Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
2010-08-01 16:15:27 +00:00
Jonathan Gordon
6281d8e214 revert r27027,27028, 27071 - need to find a correct way to close font fd's. 27027 caused data aborts, 27028 caused multifont issues after returning from usb
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27072 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 02:57:04 +00:00
Jonathan Gordon
0a776db62a redo r27027 to hopefully fix data aborts when loading a theme
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27071 a1c6a512-1295-4272-9138-f99709370657
2010-06-23 02:03:51 +00:00
Michael Sparmann
36eeecf69b Allow UI fonts to be unloaded (needed for FS#11428)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27027 a1c6a512-1295-4272-9138-f99709370657
2010-06-21 20:18:52 +00:00
Thomas Martitz
0a1d7c28b7 Make open() posix compliant api-wise. A few calls (those with O_CREAT) need the additional optional mode parameter so add it. Impact for the core is almost zero, as open() is a wrapper macro for the real open function which doesn't take the variable parameter.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25844 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 17:35:13 +00:00
Thomas Martitz
c61e89c0ed Make creat() posix compliant API-wise. Shouldn't affect the core as it's wrapped via a static inline.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25843 a1c6a512-1295-4272-9138-f99709370657
2010-05-06 17:35:04 +00:00
Teruaki Kawashima
3e4b5c69db font.c: correct checking cache_fd. remove some trailing spaces.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24920 a1c6a512-1295-4272-9138-f99709370657
2010-02-26 07:16:32 +00:00
Jonathan Gordon
f85103e8f2 remote multifont fixes. it shoud be working again (blame AlexP! he made me break it last week!)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24812 a1c6a512-1295-4272-9138-f99709370657
2010-02-21 19:10:09 +00:00
Jonathan Gordon
1c2aa35371 FS#10984 - multifont! 2 major additions:
1) seperate UI font for the remote and main displays
2) allow individual skins to load additional fonts for use in the skin (Uo to 7 extra in this first version) see CustomWPS for info on how to load a font in the skins.

Code should always use FONT_UI+screen_number to get the correct user font


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24644 a1c6a512-1295-4272-9138-f99709370657
2010-02-14 06:26:16 +00:00
Andree Buschmann
05778b501d Fix further tabs
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24156 a1c6a512-1295-4272-9138-f99709370657
2010-01-03 10:50:34 +00:00
Nils Wallménius
66776bc479 fix typo causing red
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23970 a1c6a512-1295-4272-9138-f99709370657
2009-12-13 11:19:06 +00:00