pixman: restore XP hacks

This commit is contained in:
roytam1 2022-03-23 01:36:36 +08:00
commit 40f0327a83
3 changed files with 16 additions and 3 deletions

View file

@ -67,6 +67,9 @@ LOCAL_INCLUDES += [
if CONFIG['MOZ_USE_PTHREADS']:
DEFINES['HAVE_PTHREADS'] = True
if CONFIG['_MSC_VER']:
DEFINES['PIXMAN_USE_XP_DLL_TLS_WORKAROUND'] = True
DEFINES['PACKAGE'] = 'mozpixman'
DEFINES['_USE_MATH_DEFINES'] = True

View file

@ -139,10 +139,12 @@
# define PIXMAN_GET_THREAD_LOCAL(name) \
(&name)
#elif defined(__MINGW32__)
#elif defined(__MINGW32__) || defined(PIXMAN_USE_XP_DLL_TLS_WORKAROUND)
# define _NO_W32_PSEUDO_MODIFIERS
# include <windows.h>
#undef IN
#undef OUT
# define PIXMAN_DEFINE_THREAD_LOCAL(type, name) \
static volatile int tls_ ## name ## _initialized = 0; \

View file

@ -90,7 +90,15 @@ _pixman_implementation_lookup_composite (pixman_implementation_t *toplevel,
/* Check cache for fast paths */
cache = PIXMAN_GET_THREAD_LOCAL (fast_path_cache);
for (i = 0; i < N_CACHED_FAST_PATHS; ++i)
/* Bug 1324130 - For compatibility with Windows XP, we have to use Tls
* functions for the per-thread fast-path cache instead of the safer
* __declspec(thread) mechanism. If the Tls functions fail to set up
* the storage for some reason, cache will end up null here. As a
* temporary workaround, just check that cache is not null before
* using it. The implementation lookup will still function without the
* fast-path cache, however, it will incur a slow linear search.
*/
if (cache) for (i = 0; i < N_CACHED_FAST_PATHS; ++i)
{
const pixman_fast_path_t *info = &(cache->cache[i].fast_path);
@ -162,7 +170,7 @@ _pixman_implementation_lookup_composite (pixman_implementation_t *toplevel,
return;
update_cache:
if (i)
if (cache && i)
{
while (i--)
cache->cache[i + 1] = cache->cache[i];