From ce1fe7935a908262e3c1ffe941acb85ecd5e9f06 Mon Sep 17 00:00:00 2001 From: cristy Date: Wed, 16 May 2012 15:58:37 +0000 Subject: [PATCH] --- MagickCore/cache-private.h | 9 ----- MagickCore/cache.c | 70 ++++++++++++++++++------------------- MagickCore/cache.h | 13 ++++++- MagickCore/thread-private.h | 3 +- 4 files changed, 49 insertions(+), 46 deletions(-) diff --git a/MagickCore/cache-private.h b/MagickCore/cache-private.h index fac96c083..685594f84 100644 --- a/MagickCore/cache-private.h +++ b/MagickCore/cache-private.h @@ -28,15 +28,6 @@ extern "C" { #include "MagickCore/thread-private.h" #include "MagickCore/semaphore.h" -typedef enum -{ - UndefinedCache, - MemoryCache, - MapCache, - DiskCache, - PingCache -} CacheType; - typedef void *Cache; diff --git a/MagickCore/cache.c b/MagickCore/cache.c index 017722a43..050d1880e 100644 --- a/MagickCore/cache.c +++ b/MagickCore/cache.c @@ -1977,6 +1977,41 @@ static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone, % % % % % % ++ G e t I m a g e P i x e l C a c h e T y p e % +% % +% % +% % +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% +% GetImagePixelCacheType() returns the pixel cache type: UndefinedCache, +% DiskCache, MemoryCache, MapCache, or PingCache. +% +% The format of the GetImagePixelCacheType() method is: +% +% const CacheType GetImagePixelCacheType(const Image *image) +% +% A description of each parameter follows: +% +% o image: the image. +% +*/ +MagickExport const CacheType GetImagePixelCacheType(const Image *image) +{ + CacheInfo + *cache_info; + + assert(image != (Image *) NULL); + assert(image->signature == MagickSignature); + assert(image->cache != (Cache) NULL); + cache_info=(CacheInfo *) image->cache; + return(cache_info->type); +} + +/* +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% % +% % +% % % G e t O n e A u t h e n t i c P i x e l % % % % % @@ -3644,41 +3679,6 @@ MagickPrivate const Quantum *GetVirtualPixelsNexus(const Cache cache, % % % % % % -+ I s P i x e l C a c h e I n C o r e % -% % -% % -% % -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% -% IsPixelCacheInCore() returns MagickTrue if the pixel cache is memory based -% otherwise MagickFalse. -% -% The format of the IsPixelCacheInCore() method is: -% -% MagickBooleanType IsPixelCacheInCore(const Image *image) -% -% A description of each parameter follows: -% -% o image: the image. -% -*/ -MagickExport MagickBooleanType IsPixelCacheInCore(const Image *image) -{ - CacheInfo - *cache_info; - - assert(image != (Image *) NULL); - assert(image->signature == MagickSignature); - assert(image->cache != (Cache) NULL); - cache_info=(CacheInfo *) image->cache; - return(cache_info->type == DiskCache ? MagickFalse : MagickTrue); -} - -/* -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -% % -% % -% % + O p e n P i x e l C a c h e % % % % % diff --git a/MagickCore/cache.h b/MagickCore/cache.h index 52fb4dc8d..b1aa78ead 100644 --- a/MagickCore/cache.h +++ b/MagickCore/cache.h @@ -24,6 +24,18 @@ extern "C" { #include "MagickCore/blob.h" +typedef enum +{ + UndefinedCache, + MemoryCache, + MapCache, + DiskCache, + PingCache +} CacheType; + +extern MagickExport const CacheType + GetImagePixelCacheType(const Image *); + extern MagickExport const Quantum *GetVirtualPixels(const Image *,const ssize_t,const ssize_t,const size_t, const size_t,ExceptionInfo *) magick_hot_spot, @@ -39,7 +51,6 @@ extern MagickExport MagickBooleanType ExceptionInfo *), GetOneVirtualPixelInfo(const Image *,const VirtualPixelMethod, const ssize_t,const ssize_t,PixelInfo *,ExceptionInfo *), - IsPixelCacheInCore(const Image *), PersistPixelCache(Image *,const char *,const MagickBooleanType, MagickOffsetType *,ExceptionInfo *), SyncAuthenticPixels(Image *,ExceptionInfo *) magick_hot_spot; diff --git a/MagickCore/thread-private.h b/MagickCore/thread-private.h index dbe384838..7a109d4be 100644 --- a/MagickCore/thread-private.h +++ b/MagickCore/thread-private.h @@ -34,7 +34,8 @@ extern "C" { if (((((columns) > WorkloadThreshold()) || \ ((rows) > WorkloadThreshold()))) && ((MagickSizeType) \ ((columns)*(rows)) > (WorkloadThreshold()*WorkloadThreshold())) && \ - (IsPixelCacheInCore(image) != MagickFalse) && (expression)) \ + ((GetImagePixelCacheType(image) == MemoryCache) || \ + (GetImagePixelCacheType(image) == MapCache)) && (expression)) \ num_threads(GetMagickResourceLimit(ThreadResource)) #if (__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR > 10)) -- 2.40.0