summaryrefslogtreecommitdiff
path: root/src/cache/ftccache.h
Commit message (Collapse)AuthorAgeFilesLines
* [cache] Revise the hash table accounting.ftc_resizeAlexei Podtelezhnikov2023-05-091-6/+6
| | | | | | | | | | | Instead of counting entries relative to the middle of the hash table, this switches to the absolute counter with the full index range mask. As a result, some calculations become a bit simpler. * src/cache/ftccache.h (FTC_NODE_TOP_FOR_HASH): Revised. * src/cache/ftccache.c (ftc_get_top_node_for_hash): Ditto. (ftc_cache_resize, ftc_cache_init, FTC_Cache_Clear, FTC_Cache_RemoveFaceID): Updated accordingly.
* Update all copyright notices.Werner Lemberg2023-01-171-1/+1
|
* Whitespace.Werner Lemberg2022-04-011-1/+1
|
* Update all copyright notices.Werner Lemberg2022-01-111-1/+1
|
* [cache] Minor clean-ups.Alexei Podtelezhnikov2021-09-181-1/+1
| | | | | | * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Remove parantheses. * src/cache/ftccache.c (FTC_Cache_Lookup): Ditto. (FTC_Cache_RemoveFaceID): Remove unnecessary variable.
* Update all copyright notices.Werner Lemberg2021-01-171-1/+1
|
* [build] Fix multi and C++ builds.David Turner2020-07-061-1/+1
| | | | | | | | | | | | | | | | | | The following builds were failing due to previous changes: make multi make multi CC="c++" * include/freetype/config/ftconfig.h: Remove `FT_END_HEADER'. * include/freetype/config/ftheader.h (FT_BEGIN_HEADER, FT_END_HEADER): Protect against redefinition. * src/cache/ftccache.h, src/cache/ftcmru.h, src/pcf/pcfutil.h, src/psaux/pserror.h, src/psaux/psft.h, src/psaux/psstack.h, src/sfnt/woff2tags.h: Include `compiler-macros.h'. * src/sfnt/woff2tags.c: Include `woff2tags.h'.
* Update all copyright notices.Werner Lemberg2020-01-191-1/+1
|
* Update all copyright notices.Werner Lemberg2019-02-231-1/+1
|
* Update copyright years.Werner Lemberg2019-01-221-1/+1
|
* [GSoC] src/*.*: Convert block comments to `light' style.Werner Lemberg2018-06-031-32/+32
| | | | | | | | | | | This monster commit was created by applying Nikhil's scripts `docconverter.py' and `markify.py' to all C header and source files, followed up by minor manual clean-up. No change in functionality, of course. I used commit f7419907bc6044b9b7057f9789866426c804ba82 from https://github.com/nikramakrishnan/freetype-docs.git.
* Update copyright year.Werner Lemberg2018-01-021-1/+1
|
* Update copyright year.Werner Lemberg2017-01-041-1/+1
|
* Replace `foo == NULL' and `foo != NULL' with `!foo' and `foo', resp.Werner Lemberg2016-12-261-3/+3
| | | | Other minor formatting.
* Minor clang++ fixes.Werner Lemberg2016-05-211-1/+1
| | | | | | | | | * src/base/ftobjs.c (FT_Add_Module), src/psaux/psobjs.c (ps_parser_load_field), src/type1/t1load.c (parse_subrs): Add initializer. * src/cache/ftccache.h (FTC_CACHE_TRYLOOP_END): Avoid implicit conversion from NULL to boolean.
* Update copyright year.Werner Lemberg2016-01-131-1/+1
|
* Don't use macro names that start with `_[A-Z]' [3/3].Werner Lemberg2016-01-121-7/+7
| | | | | | | | | Such macro names are reserved for both C and C++. * src/cache/ftccache.h: s/_FTC_FACE_ID_HASH/FTC_FACE_ID_HASH/. Update all callers. (FTC_CACHE_LOOKUP_CMP): Replace `_XXX' with `XXX_'. * src/cache/ftcmru.c (FTC_MRULIST_LOOKUP_CMP): Ditto.
* Don't use macro names that contain `__' [2/2].Werner Lemberg2016-01-121-6/+6
| | | | | | Such macro names are reserved for both C and C++. * src/cache/*: s/__/_/.
* Don't use macro names that contain `__' [1/2].Werner Lemberg2016-01-121-3/+3
| | | | | | Such macro names are reserved for both C and C++. */*: Replace macros of the form `__XXX_H__' with `XXX_H_'.
* [cache] Replace `FT_PtrDist' with `FT_Offset'.Werner Lemberg2015-02-231-8/+8
| | | | | | | | | | | | * src/cache/ftccache.h (FTC_NodeRec): `FT_Offset' (a.k.a. `size_t') is a better choice for `hash' to hold a pointer than `FT_PtrDist' (a.k.a. `ptrdiff_t'), especially since the latter is signed, causing zillions of signedness warnings. [Note that `hash' was of type `FT_UInt32' before the change to `FT_PtrDist.] Update all users. * src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c, src/cache/ftcglyph.c, src/cache/ftcglyph.h: Updated.
* Run `src/tools/update-copyright'.Werner Lemberg2015-01-171-1/+1
|
* */* [FT_CONFIG_OPTION_OLD_INTERNALS]: Remove macro and guarded code.Werner Lemberg2013-05-101-6/+0
|
* */*: Use FT_ERR_EQ, FT_ERR_NEQ, and FT_ERR where appropriate.Werner Lemberg2013-03-141-1/+1
| | | | | FT_Err_XXX and friends are no longer directly used in the source code.
* */*: Use FT_Err_Ok only.Werner Lemberg2013-03-141-3/+2
| | | | This is a purely mechanical conversion.
* Cleanup/formatting.Werner Lemberg2011-01-131-13/+14
|
* [cache] Fix Savannah bug #31923, patch drafted by Harsha.suzuki toshiya2011-01-091-0/+24
| | | | | | | | | | | | | | | When a node comparator changes the cached nodes during the search of a node matching with queried properties, the pointers obtained before the functon should be updated to prevent the dereference to freed or reallocated nodes. To minimize the rescan of the linked list, the update is executed when the comparator notifies the change of cached nodes. This change depends previous change: 38b272ffbbdaae276d636aec4ef84af407d16181 * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Rescan the top node if the cached nodes are changed. * src/cache/ftccache.c (FTC_Cache_Lookup): Ditto.
* [cache] Notice if a cache query induced the node list change.suzuki toshiya2011-01-091-3/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some node comparators (comparing the cache node content and the properties specified by the query) can flush the cache node to prevent the cache inflation. The change may invalidate the pointers to the node obtained before the node comparison, so the change should be noticed to the caller. The problem caused by the cache node changing is reported by Harsha, see Savannah bug #31923. * src/cache/ftccache.h (FTC_Node_CompareFunc): Add new argument `FT_Bool* list_changed' to indicate the change of the cached nodes to the caller. (FTC_CACHE_LOOKUP_CMP): Watch the change of the cached nodes by `_list_changed'. (FTC_CACHE_TRYLOOP_END): Take new macro argument `_list_changed' and update it when FTC_Manager_FlushN() flushes any nodes. * src/cache/ftccback.h (ftc_snode_compare): Updated to fit with new FTC_Node_CompareFunc type. (ftc_gnode_compare): Ditto. * src/cache/ftcbasic.c: Include FT_INTERNAL_OBJECTS_H to use TRUE/FALSE macros. (ftc_basic_gnode_compare_faceid): New argument `FT_Bool* list_changed' to indicate the change of the cache nodes, anyway, it is always FALSE. * src/cache/ftccmap.c: Include FT_INTERNAL_OBJECTS_H to use TRUE/FALSE macros. (ftc_cmap_node_compare): New argument `FT_Bool* list_changed' to indicate the change of the cache nodes, anyway, it is always FALSE. (ftc_cmap_node_remove_faceid): Ditto. * src/cache/ftccache.c (FTC_Cache_NewNode): Pass a NULL pointer to FTC_CACHE_TRYLOOP_END(), because the result is not needed. (FTC_Cache_Lookup): Watch the change of the cache nodes by `list_changed'. (FTC_Cache_RemoveFaceID): Ditto. * src/cache/ftcglyph.c: Include FT_INTERNAL_OBJECTS_H to use TRUE/FALSE macros. (ftc_gnode_compare): New argument `FT_Bool* list_changed' to indicate the change of the cache nodes, anyway, it is always FALSE. (FTC_GNode_Compare): New argument `FT_Bool* list_changed' to be passed to ftc_gnode_compare(). * src/cache/ftcglyph.h (FTC_GNode_Compare): Ditto. * src/cache/ftcsbits.c (ftc_snode_compare): New argument `FT_Bool* list_changed' to indicate the change of the cache nodes, anyway. It is updated by FTC_CACHE_TRYLOOP(). (FTC_SNode_Compare): New argument `FT_Bool* list_changed' to be passed to ftc_snode_compare(). * src/cache/ftcsbits.h (FTC_SNode_Compare): Ditto.
* [cache] Deduplicate the code to get the top node by a hash.suzuki toshiya2011-01-091-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | There are several duplicated codes getting the top node from a cache by a given hash, like: idx = hash & cache->mask; if ( idx < cache->p ) idx = hash & ( cache->mask * 2 + 1 ); pnode = cache->buckets + idx; To deduplicate them, a cpp-macro to do same work FTC_NODE__TOP_FOR_HASH( cache, hash ) is introduced. For non-inlined config, non-ftc_get_top_node_for_hash() is also introduced. * src/cache/ftccache.h (FTC_NODE__TOP_FOR_HASH): Declare and implement inlined version. (FTC_CACHE_LOOKUP_CMP): Use FTC_NODE__TOP_FOR_HASH(). * src/cache/ftccache.c (ftc_get_top_node_for_hash): Non- inlined version. (ftc_node_hash_unlink): Use FTC_NODE__TOP_FOR_HASH(). (ftc_node_hash_link): Ditto. (FTC_Cache_Lookup): Ditto.
* Revert a change of `_idx' type in FTC_CACHE_LOOKUP_CMP().suzuki toshiya2010-10-251-1/+1
| | | | | | * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Revert the type of `_idx' from FT_PtrDist (by previous change) to original FT_UFast, to match with FT_CacheRec.
* [cache] Change the hash types to FT_PtrDist.suzuki toshiya2010-10-251-5/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On LLP64 platforms (e.g. Win64), FT_ULong (32-bit) variables are inappropriate to calculate hash values from the memory address (64-bit). The hash variables are extended from FT_ULong to FT_PtrDist and new hashing macro functions are introduced. The hash values on 16-bit memory platforms are changed, but ILP32 and LP64 are not changed. The hash value in the cache subsystem is not reverted to the memory address, so using signed type FT_PtrDist is safe. * src/cache/ftccache.h (_FTC_FACE_ID_HASH): New hash function to replace FTC_FACE_ID_HASH() for portability. * src/cache/ftcmanag.h (FTC_SCALER_HASH): Replace FTC_FACE_ID_HASH() by _FTC_FACE_ID_HASH(). * src/cache/ftccmap.c (FTC_CMAP_HASH): Ditto. * src/cache/ftccache.h (FTC_NodeRec): The type of the member `hash' is changed from FT_UInt32 to FT_PtrDist. * src/cache/ftccache.h (FTC_Cache_Lookup): The type of the argument `hash' is changed from FT_UInt32 to FT_PtrDist. (FTC_Cache_NewNode): Ditto. * src/cache/ftccache.c (ftc_cache_add): Ditto. (FTC_Cache_Lookup): Ditto. (FTC_Cache_NewNode): Ditto. * src/cache/ftcglyph.h (FTC_GCache_Lookup): Ditto. * src/cache/ftcglyph.c (FTC_GCache_Lookup): Ditto. * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): The type of the internal variable `hash' is changed to FT_PtrDist from FT_UInt32. (FTC_ImageCache_LookupScaler): Ditto. (FTC_SBitCache_Lookup): Ditto. (FTC_SBitCache_LookupScaler): Ditto. * src/cache/ftccmap.c (FTC_CMapCache_Lookup): Ditto. * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP): Ditto. Also the type of the internal variable `_idx' is changed to FT_PtrDist from FT_UInt32 for better pointer calculation.
* */*: Use module specific error names where appropriate.Werner Lemberg2010-06-241-3/+3
|
* cache: Fix some data types mismatching with their sources.suzuki toshiya2009-08-011-2/+2
|
* cache: Fix some data types mismatching with their sources.suzuki toshiya2009-08-011-1/+1
|
* Fix Redhat bugzilla #513582 and Savannah bug #26849.Werner Lemberg2009-07-291-3/+2
| | | | | * src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP) <FTC_INLINE>: Fix aliasing bug.
* * src/cache/ftccache.c (ftc_node_mru_link, ftc_node_mru_unlink),Werner Lemberg2007-05-161-2/+3
| | | | | | | src/cache/ftccache.h (FTC_CACHE_LOOKUP_CMP), src/cache/ftcglyph.h (FTC_GCACHE_LOOKUP_CMP), src/pshinter/pshmod.c (ps_hinter_init), src/sfnt/ttmtx.c (tt_face_load_hmtx, tt_face_load_hhea, tt_face_get_metrics): Fix type-punning issues.
* Normalize quotation to `...'.Werner Lemberg2006-03-241-1/+1
|
* * src/cache/ftccache.c, (ftc_node_mru_up, FTC_Cache_Lookup)Werner Lemberg2006-03-221-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [!FTC_INLINE]: Compile conditionally. * src/cache/ftccache.h: Updated. * src/cache/ftcglyph.c (FTC_GNode_Init, FTC_GNode_UnselectFamily, FTC_GNode_Done, FTC_GNode_Compare, FTC_Family_Init, FTC_GCache_New): s/FT_EXPORT/FT_LOCAL/. (FTC_GCache_Init, FTC_GCache_Done): Commented out. (FTC_GCache_Lookup) [!FTC_INLINE]: Compile conditionally. s/FT_EXPORT/FT_LOCAL/. * src/cache/ftcglyph.h: Updated. * src/cache/ftcimage.c (FTC_INode_Free, FTC_INode_New): s/FT_EXPORT/FT_LOCAL/. (FTC_INode_Weight): Commented out. * src/cache/ftcimage.h: Updated. * src/cache/ftmanag.c (FTC_Manager_Compress, FTC_Manager_RegisterCache, FTC_Manager_FlushN): s/FT_EXPORT/FT_LOCAL/. * src/cache/ftmanag.h: Updated. * src/cache/ftcsbits.c (FTC_SNode_Free, FTC_SNode_New, FTC_SNode_Compare): s/FT_EXPORT/FT_LOCAL/. (FTC_SNode_Weight): Commented out. * src/cache/ftcsbits.h: Updated.
* * src/cache/ftccache.c, src/cache/ftccache.h (FTC_Node_Destroy):Werner Lemberg2006-03-221-15/+2
| | | | | | | | Remove, unused. * src/cache/ftccmap.h: Remove, unused. * src/cache/rules.mk (CACHE_DRV_H): Remove ftccmap.h.
* * include/freetype/cache/ftccache.h,David Turner2006-03-201-7/+7
| | | | | | | | | | | | | | | | | | | | | | include/freetype/cache/ftccmap.h, include/freetype/cache/ftcglyph.h include/freetype/cache/ftcimage.h include/freetype/cache/ftcmanag.h include/freetype/cache/ftcmru.h include/freetype/cache/ftcsbits.h: removing these header files from the public include directory. * include/freetype/config/ftheader.h: changing the definition of FT_CACHE_INTERNAL_XXX_H macros to redirect to FT_CACHE_H instead * src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccache.h, src/cache/ftccback.h, src/cache/ftccmap.c, src/cache/ftcglyph.c, src/cache/ftcglyph.h, src/cache/ftcimage.c, src/cache/ftcimage.h, src/cache/ftcmanag.c, src/cache/ftcmanag.h, src/cache/ftcmru.c, src/cache/ftcmru.h, src/cache/ftcsbits.c, src/cache/ftcsbits.h: modifications to prevent using the FT_CACHE_INTERNAL_XXX_H macros, and grab the headers in 'src/cache' instead (see below).
* * src/cache/ftccache.h, src/cache/ftcglyph.h, src/cache/ftcimage.h,David Turner2006-03-201-0/+326
src/cache/ftcsbits.h, src/cache/ftcmanag.h, src/cache/ftccmap.h, src/cache/ftcmru.h: copying the cache's internal header files which were located in 'include/freetype/cache' to the 'src/cache' directory instead. Note that these files are not used by FreeType clients, all cache public APIs have been already moved to include/freetype/ftcache.h, and the FT_CACHE_INTERNAL_XXXX_H macros all resolve to it. the move is to allow us to modify the internals without intereference from rogue clients. Note that there are no known client that accesses the cache internals at the moment.