diff --git a/magick/cache.c b/magick/cache.c
index 670bb1e..c628b9f 100644
--- a/magick/cache.c
+++ b/magick/cache.c
@@ -445,7 +445,7 @@
p=GetAuthenticPixelCacheNexus(image,nexus_info->region.x,nexus_info->region.y,
nexus_info->region.width,nexus_info->region.height,image_nexus[0],
exception);
- indexes=GetPixelCacheNexusIndexes(image->cache,image_nexus[0]);
+ indexes=GetPixelCacheNexusIndexes(cache_info,image_nexus[0]);
q=nexus_info->pixels;
nexus_indexes=nexus_info->indexes;
r=GetVirtualPixelsFromNexus(image->clip_mask,MaskVirtualPixelMethod,
@@ -1412,7 +1412,7 @@
cache_info->methods.destroy_pixel_handler(image);
return;
}
- DestroyImagePixelCache(image);
+ image->cache=DestroyPixelCache(image->cache);
}
/*
@@ -1651,6 +1651,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -1659,7 +1662,8 @@
if (cache_info->methods.get_authentic_indexes_from_handler !=
(GetAuthenticIndexesFromHandler) NULL)
return(cache_info->methods.get_authentic_indexes_from_handler(image));
- return(GetAuthenticIndexesFromCache(image));
+ assert(id < (int) cache_info->number_threads);
+ return(GetPixelCacheNexusIndexes(cache_info,cache_info->nexus_info[id]));
}
/*
@@ -1806,6 +1810,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -1814,7 +1821,8 @@
if (cache_info->methods.get_authentic_pixels_from_handler !=
(GetAuthenticPixelsFromHandler) NULL)
return(cache_info->methods.get_authentic_pixels_from_handler(image));
- return(GetAuthenticPixelsFromCache(image));
+ assert(id < (int) cache_info->number_threads);
+ return(GetPixelCacheNexusPixels(cache_info,cache_info->nexus_info[id]));
}
/*
@@ -1870,6 +1878,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -1880,6 +1891,9 @@
return(cache_info->methods.get_authentic_pixels_handler(image,x,y,columns,
rows,exception));
return(GetAuthenticPixelsCache(image,x,y,columns,rows,exception));
+ assert(id < (int) cache_info->number_threads);
+ return(GetAuthenticPixelCacheNexus(image,x,y,columns,rows,
+ cache_info->nexus_info[id],exception));
}
/*
@@ -1970,7 +1984,7 @@
cache_info=(CacheInfo *) image->cache;
assert(cache_info->signature == MagickSignature);
assert(id < (int) cache_info->number_threads);
- return(GetPixelCacheNexusExtent(image->cache,cache_info->nexus_info[id]));
+ return(GetPixelCacheNexusExtent(cache_info,cache_info->nexus_info[id]));
}
/*
@@ -2165,6 +2179,9 @@
CacheInfo
*cache_info;
+ PixelPacket
+ *pixels;
+
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -2175,7 +2192,12 @@
(GetOneAuthenticPixelFromHandler) NULL)
return(cache_info->methods.get_one_authentic_pixel_from_handler(image,x,y,
pixel,exception));
- return(GetOneAuthenticPixelFromCache(image,x,y,pixel,exception));
+ *pixel=image->background_color;
+ pixels=GetAuthenticPixelsCache(image,x,y,1UL,1UL,exception);
+ if (pixels == (PixelPacket *) NULL)
+ return(MagickFalse);
+ *pixel=(*pixels);
+ return(MagickTrue);
}
/*
@@ -2325,6 +2347,9 @@
CacheInfo
*cache_info;
+ const PixelPacket
+ *pixels;
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -2335,8 +2360,12 @@
(GetOneVirtualPixelFromHandler) NULL)
return(cache_info->methods.get_one_virtual_pixel_from_handler(image,
virtual_pixel_method,x,y,pixel,exception));
- return(GetOneVirtualPixelFromCache(image,virtual_pixel_method,x,y,pixel,
- exception));
+ *pixel=image->background_color;
+ pixels=GetVirtualPixelCache(image,virtual_pixel_method,x,y,1UL,1UL,exception);
+ if (pixels == (const PixelPacket *) NULL)
+ return(MagickFalse);
+ *pixel=(*pixels);
+ return(MagickTrue);
}
/*
@@ -2376,6 +2405,9 @@
CacheInfo
*cache_info;
+ const PixelPacket
+ *pixels;
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -2388,6 +2420,13 @@
GetPixelCacheVirtualMethod(image),x,y,pixel,exception));
return(GetOneVirtualPixelFromCache(image,GetPixelCacheVirtualMethod(image),
x,y,pixel,exception));
+ *pixel=image->background_color;
+ pixels=GetVirtualPixelCache(image,GetPixelCacheVirtualMethod(image),x,y,
+ 1UL,1UL,exception);
+ if (pixels == (const PixelPacket *) NULL)
+ return(MagickFalse);
+ *pixel=(*pixels);
+ return(MagickTrue);
}
/*
@@ -2949,6 +2988,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -2957,7 +2999,8 @@
if (cache_info->methods.get_virtual_indexes_from_handler !=
(GetVirtualIndexesFromHandler) NULL)
return(cache_info->methods.get_virtual_indexes_from_handler(image));
- return(GetVirtualIndexesFromCache(image));
+ assert(id < (int) cache_info->number_threads);
+ return(GetVirtualIndexesFromNexus(cache_info,cache_info->nexus_info[id]));
}
/*
@@ -3495,6 +3538,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -3503,7 +3549,8 @@
if (cache_info->methods.get_virtual_pixels_handler !=
(GetVirtualPixelsHandler) NULL)
return(cache_info->methods.get_virtual_pixels_handler(image));
- return(GetVirtualPixelsCache(image));
+ assert(id < (int) cache_info->number_threads);
+ return(GetVirtualPixelsNexus(cache_info,cache_info->nexus_info[id]));
}
/*
@@ -3561,6 +3608,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (const Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -3570,8 +3620,9 @@
(GetVirtualPixelHandler) NULL)
return(cache_info->methods.get_virtual_pixel_handler(image,
GetPixelCacheVirtualMethod(image),x,y,columns,rows,exception));
- return(GetVirtualPixelCache(image,GetPixelCacheVirtualMethod(image),x,y,
- columns,rows,exception));
+ assert(id < (int) cache_info->number_threads);
+ return(GetVirtualPixelsFromNexus(image,GetPixelCacheVirtualMethod(image),x,y,
+ columns,rows,cache_info->nexus_info[id],exception));
}
/*
@@ -4398,6 +4449,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -4407,7 +4461,9 @@
(QueueAuthenticPixelsHandler) NULL)
return(cache_info->methods.queue_authentic_pixels_handler(image,x,y,columns,
rows,exception));
- return(QueueAuthenticPixelsCache(image,x,y,columns,rows,exception));
+ assert(id < (int) cache_info->number_threads);
+ return(QueueAuthenticNexus(image,x,y,columns,rows,cache_info->nexus_info[id],
+ exception));
}
/*
@@ -5124,6 +5180,9 @@
CacheInfo
*cache_info;
+ const int
+ id = GetOpenMPThreadId();
+
assert(image != (Image *) NULL);
assert(image->signature == MagickSignature);
assert(image->cache != (Cache) NULL);
@@ -5132,7 +5191,9 @@
if (cache_info->methods.sync_authentic_pixels_handler !=
(SyncAuthenticPixelsHandler) NULL)
return(cache_info->methods.sync_authentic_pixels_handler(image,exception));
- return(SyncAuthenticPixelsCache(image,exception));
+ assert(id < (int) cache_info->number_threads);
+ return(SyncAuthenticPixelCacheNexus(image,cache_info->nexus_info[id],
+ exception));
}
/*