From: Cristy Date: Sat, 29 Dec 2018 13:18:13 +0000 (-0500) Subject: https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=34906 X-Git-Tag: 7.0.8-22~3 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3bc82898feb8c5da7b44f922a975df2e1e0e84dc;p=imagemagick https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=34906 --- diff --git a/MagickCore/cache.c b/MagickCore/cache.c index cd6853502..d73d4dd78 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -4997,12 +4997,15 @@ static inline MagickBooleanType AcquireCacheNexusPixels( static inline void PrefetchPixelCacheNexusPixels(const NexusInfo *nexus_info, const MapMode mode) { + if (nexus_info->length < CACHE_LINE_SIZE) + return; if (mode == ReadMode) { - MagickCachePrefetch((unsigned char *) nexus_info->pixels,0,1); + MagickCachePrefetch((unsigned char *) nexus_info->pixels+CACHE_LINE_SIZE, + 0,1); return; } - MagickCachePrefetch((unsigned char *) nexus_info->pixels,1,1); + MagickCachePrefetch((unsigned char *) nexus_info->pixels+CACHE_LINE_SIZE,1,1); } static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info, @@ -5021,6 +5024,7 @@ static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info, assert(cache_info->signature == MagickCoreSignature); if (cache_info->type == UndefinedCache) return((Quantum *) NULL); + (void) memset(&nexus_info->region,0,sizeof(nexus_info->region)); if (((cache_info->type == MemoryCache) || (cache_info->type == MapCache)) && (buffered == MagickFalse)) { @@ -5062,26 +5066,17 @@ static Quantum *SetPixelCacheNexusPixels(const CacheInfo *cache_info, cache_info->number_channels*sizeof(*nexus_info->pixels); if (cache_info->metacontent_extent != 0) length+=number_pixels*cache_info->metacontent_extent; + status=MagickTrue; if (nexus_info->cache == (Quantum *) NULL) - { - status=AcquireCacheNexusPixels(cache_info,length,nexus_info,exception); - if (status == MagickFalse) - { - (void) memset(&nexus_info->region,0,sizeof(nexus_info->region)); - return((Quantum *) NULL); - } - } + status=AcquireCacheNexusPixels(cache_info,length,nexus_info,exception); else if (nexus_info->length < length) { RelinquishCacheNexusPixels(nexus_info); status=AcquireCacheNexusPixels(cache_info,length,nexus_info,exception); - if (status == MagickFalse) - { - (void) memset(&nexus_info->region,0,sizeof(nexus_info->region)); - return((Quantum *) NULL); - } } + if (status == MagickFalse) + return((Quantum *) NULL); nexus_info->pixels=nexus_info->cache; nexus_info->metacontent=(void *) NULL; if (cache_info->metacontent_extent != 0) diff --git a/MagickCore/geometry.c b/MagickCore/geometry.c index 1b3d49fb6..a32600d14 100644 --- a/MagickCore/geometry.c +++ b/MagickCore/geometry.c @@ -1132,15 +1132,43 @@ MagickExport MagickStatusType ParseGeometry(const char *geometry, geometry_info->sigma=2.0; } if (((flags & SigmaValue) == 0) && ((flags & XiValue) != 0) && - ((flags & PsiValue) == 0)) + ((flags & XiNegative) != 0)) { - /* - Support negative height values (e.g. 30x-20). - */ - geometry_info->sigma=geometry_info->xi; - geometry_info->xi=0.0; - flags|=SigmaValue; - flags&=(~XiValue); + if ((flags & PsiValue) == 0) + { + /* + Support negative height values (e.g. 30x-20). + */ + geometry_info->sigma=geometry_info->xi; + geometry_info->xi=0.0; + flags|=SigmaValue; + flags&=(~XiValue); + } + else + if ((flags & ChiValue) == 0) + { + /* + Support negative height values (e.g. 30x-20+10). + */ + geometry_info->sigma=geometry_info->xi; + geometry_info->xi=geometry_info->psi; + flags|=SigmaValue; + flags|=XiValue; + flags&=(~PsiValue); + } + else + { + /* + Support negative height values (e.g. 30x-20+10+10). + */ + geometry_info->sigma=geometry_info->xi; + geometry_info->xi=geometry_info->psi; + geometry_info->psi=geometry_info->chi; + flags|=SigmaValue; + flags|=XiValue; + flags|=PsiValue; + flags&=(~ChiValue); + } } if ((flags & PercentValue) != 0) {