]> granicus.if.org Git - imagemagick/blobdiff - MagickWand/wand-view.c
...
[imagemagick] / MagickWand / wand-view.c
index 24b6595b8248e2bc460f301f2136b33de1600177..a4ff6e52010540b91578eeaceeee3d86d1cc2618 100644 (file)
 %                        MagickWand Wand View Methods                         %
 %                                                                             %
 %                              Software Design                                %
-%                                John Cristy                                  %
+%                                   Cristy                                    %
 %                                March 2003                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2017 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -65,7 +65,7 @@ struct _WandView
     id;
 
   char
-    name[MaxTextExtent],
+    name[MagickPathExtent],
     *description;
 
   RectangleInfo
@@ -80,9 +80,6 @@ struct _WandView
   CacheView
     *view;
 
-  size_t
-    number_threads;
-
   PixelWand
     ***pixel_wands;
 
@@ -127,7 +124,7 @@ WandExport WandView *CloneWandView(const WandView *wand_view)
     i;
 
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   if (wand_view->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name);
   clone_view=(WandView *) AcquireMagickMemory(sizeof(*clone_view));
@@ -136,23 +133,22 @@ WandExport WandView *CloneWandView(const WandView *wand_view)
       wand_view->name);
   (void) ResetMagickMemory(clone_view,0,sizeof(*clone_view));
   clone_view->id=AcquireWandId();
-  (void) FormatLocaleString(clone_view->name,MaxTextExtent,"%s-%.20g",
+  (void) FormatLocaleString(clone_view->name,MagickPathExtent,"%s-%.20g",
     WandViewId,(double) clone_view->id);
   clone_view->description=ConstantString(wand_view->description);
   clone_view->image=CloneImage(wand_view->image,0,0,MagickTrue,
     wand_view->exception);
   clone_view->view=CloneCacheView(wand_view->view);
   clone_view->extent=wand_view->extent;
-  clone_view->number_threads=wand_view->number_threads;
   clone_view->exception=AcquireExceptionInfo();
   InheritException(clone_view->exception,wand_view->exception);
-  for (i=0; i < (ssize_t) wand_view->number_threads; i++)
+  for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
     clone_view->pixel_wands[i]=ClonePixelWands((const PixelWand **)
       wand_view->pixel_wands[i],wand_view->extent.width);
   clone_view->debug=wand_view->debug;
   if (clone_view->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_view->name);
-  clone_view->signature=WandSignature;
+  clone_view->signature=MagickWandSignature;
   return(clone_view);
 }
 \f
@@ -180,13 +176,13 @@ WandExport WandView *CloneWandView(const WandView *wand_view)
 */
 
 static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands,
-  const size_t number_wands,const size_t number_threads)
+  const size_t number_wands)
 {
   register ssize_t
     i;
 
   assert(pixel_wands != (PixelWand ***) NULL);
-  for (i=0; i < (ssize_t) number_threads; i++)
+  for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++)
     if (pixel_wands[i] != (PixelWand **) NULL)
       pixel_wands[i]=DestroyPixelWands(pixel_wands[i],number_wands);
   pixel_wands=(PixelWand ***) RelinquishMagickMemory(pixel_wands);
@@ -196,13 +192,13 @@ static PixelWand ***DestroyPixelsThreadSet(PixelWand ***pixel_wands,
 WandExport WandView *DestroyWandView(WandView *wand_view)
 {
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   wand_view->pixel_wands=DestroyPixelsThreadSet(wand_view->pixel_wands,
-    wand_view->extent.width,wand_view->number_threads);
+    wand_view->extent.width);
   wand_view->image=DestroyImage(wand_view->image);
   wand_view->view=DestroyCacheView(wand_view->view);
   wand_view->exception=DestroyExceptionInfo(wand_view->exception);
-  wand_view->signature=(~WandSignature);
+  wand_view->signature=(~MagickWandSignature);
   RelinquishWandId(wand_view->id);
   wand_view=(WandView *) RelinquishMagickMemory(wand_view);
   return(wand_view);
@@ -273,11 +269,16 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source,
   MagickOffsetType
     progress;
 
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  size_t
+    height;
+#endif
+
   ssize_t
     y;
 
   assert(source != (WandView *) NULL);
-  assert(source->signature == WandSignature);
+  assert(source->signature == MagickWandSignature);
   if (transfer == (DuplexTransferWandViewMethod) NULL)
     return(MagickFalse);
   source_image=source->wand->images;
@@ -289,7 +290,9 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source,
   status=MagickTrue;
   progress=0;
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
+  height=source->extent.height-source->extent.y;
+  #pragma omp parallel for schedule(static,4) shared(progress,status) \
+    magick_threads(source_image,destination_image,height,1)
 #endif
   for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
   {
@@ -300,14 +303,14 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source,
       sync;
 
     register const Quantum
-      *restrict duplex_pixels,
-      *restrict pixels;
+      *magick_restrict duplex_pixels,
+      *magick_restrict pixels;
 
     register ssize_t
       x;
 
     register Quantum
-      *restrict destination_pixels;
+      *magick_restrict destination_pixels;
 
     if (status == MagickFalse)
       continue;
@@ -370,7 +373,7 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source,
           proceed;
 
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp critical (MagickWand_DuplexTransferWandViewIterator)
+        #pragma omp critical (MagickWand_DuplexTransferWandViewIterator)
 #endif
         proceed=SetImageProgress(source_image,source->description,progress++,
           source->extent.height);
@@ -397,7 +400,7 @@ WandExport MagickBooleanType DuplexTransferWandViewIterator(WandView *source,
 %
 %  The format of the GetWandViewException method is:
 %
-%      char *GetWandViewException(const PixelWand *wand_view,
+%      char *GetWandViewException(const WandView *wand_view,
 %        ExceptionType *severity)
 %
 %  A description of each parameter follows:
@@ -414,12 +417,12 @@ WandExport char *GetWandViewException(const WandView *wand_view,
     *description;
 
   assert(wand_view != (const WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   if (wand_view->debug != MagickFalse)
     (void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand_view->name);
   assert(severity != (ExceptionType *) NULL);
   *severity=wand_view->exception->severity;
-  description=(char *) AcquireQuantumMemory(2UL*MaxTextExtent,
+  description=(char *) AcquireQuantumMemory(2UL*MagickPathExtent,
     sizeof(*description));
   if (description == (char *) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
@@ -428,14 +431,14 @@ WandExport char *GetWandViewException(const WandView *wand_view,
   if (wand_view->exception->reason != (char *) NULL)
     (void) CopyMagickString(description,GetLocaleExceptionMessage(
       wand_view->exception->severity,wand_view->exception->reason),
-        MaxTextExtent);
+        MagickPathExtent);
   if (wand_view->exception->description != (char *) NULL)
     {
-      (void) ConcatenateMagickString(description," (",MaxTextExtent);
+      (void) ConcatenateMagickString(description," (",MagickPathExtent);
       (void) ConcatenateMagickString(description,GetLocaleExceptionMessage(
         wand_view->exception->severity,wand_view->exception->description),
-        MaxTextExtent);
-      (void) ConcatenateMagickString(description,")",MaxTextExtent);
+        MagickPathExtent);
+      (void) ConcatenateMagickString(description,")",MagickPathExtent);
     }
   return(description);
 }
@@ -465,7 +468,7 @@ WandExport char *GetWandViewException(const WandView *wand_view,
 WandExport RectangleInfo GetWandViewExtent(const WandView *wand_view)
 {
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   return(wand_view->extent);
 }
 \f
@@ -524,18 +527,25 @@ WandExport MagickBooleanType GetWandViewIterator(WandView *source,
   MagickOffsetType
     progress;
 
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  size_t
+    height;
+#endif
+
   ssize_t
     y;
 
   assert(source != (WandView *) NULL);
-  assert(source->signature == WandSignature);
+  assert(source->signature == MagickWandSignature);
   if (get == (GetWandViewMethod) NULL)
     return(MagickFalse);
   source_image=source->wand->images;
   status=MagickTrue;
   progress=0;
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
+  height=source->extent.height-source->extent.y;
+  #pragma omp parallel for schedule(static,4) shared(progress,status) \
+    magick_threads(source_image,source_image,height,1)
 #endif
   for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
   {
@@ -570,7 +580,7 @@ WandExport MagickBooleanType GetWandViewIterator(WandView *source,
           proceed;
 
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp critical (MagickWand_GetWandViewIterator)
+        #pragma omp critical (MagickWand_GetWandViewIterator)
 #endif
         proceed=SetImageProgress(source_image,source->description,progress++,
           source->extent.height);
@@ -609,7 +619,7 @@ WandExport PixelWand **GetWandViewPixels(const WandView *wand_view)
     id = GetOpenMPThreadId();
 
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   return(wand_view->pixel_wands[id]);
 }
 \f
@@ -638,7 +648,7 @@ WandExport PixelWand **GetWandViewPixels(const WandView *wand_view)
 WandExport MagickWand *GetWandViewWand(const WandView *wand_view)
 {
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   return(wand_view->wand);
 }
 \f
@@ -672,7 +682,7 @@ WandExport MagickBooleanType IsWandView(const WandView *wand_view)
 
   if (wand_view == (const WandView *) NULL)
     return(MagickFalse);
-  if (wand_view->signature != WandSignature)
+  if (wand_view->signature != MagickWandSignature)
     return(MagickFalse);
   length=strlen(WandViewId);
   if (LocaleNCompare(wand_view->name,WandViewId,length) != 0)
@@ -704,8 +714,7 @@ WandExport MagickBooleanType IsWandView(const WandView *wand_view)
 %
 */
 
-static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands,
-  const size_t number_threads)
+static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands)
 {
   PixelWand
     ***pixel_wands;
@@ -713,6 +722,10 @@ static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands,
   register ssize_t
     i;
 
+  size_t
+    number_threads;
+
+  number_threads=GetOpenMPMaximumThreads();
   pixel_wands=(PixelWand ***) AcquireQuantumMemory(number_threads,
     sizeof(*pixel_wands));
   if (pixel_wands == (PixelWand ***) NULL)
@@ -722,40 +735,42 @@ static PixelWand ***AcquirePixelsThreadSet(const size_t number_wands,
   {
     pixel_wands[i]=NewPixelWands(number_wands);
     if (pixel_wands[i] == (PixelWand **) NULL)
-      return(DestroyPixelsThreadSet(pixel_wands,number_wands,number_threads));
+      return(DestroyPixelsThreadSet(pixel_wands,number_wands));
   }
   return(pixel_wands);
 }
 
 WandExport WandView *NewWandView(MagickWand *wand)
 {
+  ExceptionInfo
+    *exception;
+
   WandView
     *wand_view;
 
   assert(wand != (MagickWand *) NULL);
-  assert(wand->signature == WandSignature);
+  assert(wand->signature == MagickWandSignature);
   wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view));
   if (wand_view == (WandView *) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
       GetExceptionMessage(errno));
   (void) ResetMagickMemory(wand_view,0,sizeof(*wand_view));
   wand_view->id=AcquireWandId();
-  (void) FormatLocaleString(wand_view->name,MaxTextExtent,"%s-%.20g",
+  (void) FormatLocaleString(wand_view->name,MagickPathExtent,"%s-%.20g",
     WandViewId,(double) wand_view->id);
   wand_view->description=ConstantString("WandView");
   wand_view->wand=wand;
-  wand_view->view=AcquireCacheView(wand_view->wand->images);
+  exception=AcquireExceptionInfo();
+  wand_view->view=AcquireVirtualCacheView(wand_view->wand->images,exception);
   wand_view->extent.width=wand->images->columns;
   wand_view->extent.height=wand->images->rows;
-  wand_view->number_threads=GetOpenMPMaximumThreads();
-  wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
-    wand_view->number_threads);
-  wand_view->exception=AcquireExceptionInfo();
+  wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width);
+  wand_view->exception=exception;
   if (wand_view->pixel_wands == (PixelWand ***) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
       GetExceptionMessage(errno));
   wand_view->debug=IsEventLogging();
-  wand_view->signature=WandSignature;
+  wand_view->signature=MagickWandSignature;
   return(wand_view);
 }
 \f
@@ -789,35 +804,37 @@ WandExport WandView *NewWandView(MagickWand *wand)
 WandExport WandView *NewWandViewExtent(MagickWand *wand,const ssize_t x,
   const ssize_t y,const size_t width,const size_t height)
 {
+  ExceptionInfo
+    *exception;
+
   WandView
     *wand_view;
 
   assert(wand != (MagickWand *) NULL);
-  assert(wand->signature == WandSignature);
+  assert(wand->signature == MagickWandSignature);
   wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view));
   if (wand_view == (WandView *) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
       GetExceptionMessage(errno));
   (void) ResetMagickMemory(wand_view,0,sizeof(*wand_view));
   wand_view->id=AcquireWandId();
-  (void) FormatLocaleString(wand_view->name,MaxTextExtent,"%s-%.20g",
+  (void) FormatLocaleString(wand_view->name,MagickPathExtent,"%s-%.20g",
     WandViewId,(double) wand_view->id);
   wand_view->description=ConstantString("WandView");
-  wand_view->view=AcquireCacheView(wand_view->wand->images);
+  exception=AcquireExceptionInfo();
+  wand_view->view=AcquireVirtualCacheView(wand_view->wand->images,exception);
   wand_view->wand=wand;
   wand_view->extent.width=width;
   wand_view->extent.height=height;
   wand_view->extent.x=x;
   wand_view->extent.y=y;
-  wand_view->number_threads=GetOpenMPMaximumThreads();
-  wand_view->exception=AcquireExceptionInfo();
-  wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
-    wand_view->number_threads);
+  wand_view->exception=exception;
+  wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width);
   if (wand_view->pixel_wands == (PixelWand ***) NULL)
     ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
       GetExceptionMessage(errno));
   wand_view->debug=IsEventLogging();
-  wand_view->signature=WandSignature;
+  wand_view->signature=MagickWandSignature;
   return(wand_view);
 }
 \f
@@ -849,7 +866,7 @@ MagickExport void SetWandViewDescription(WandView *wand_view,
   const char *description)
 {
   assert(wand_view != (WandView *) NULL);
-  assert(wand_view->signature == WandSignature);
+  assert(wand_view->signature == MagickWandSignature);
   wand_view->description=ConstantString(description);
 }
 \f
@@ -909,11 +926,16 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination,
   MagickOffsetType
     progress;
 
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  size_t
+    height;
+#endif
+
   ssize_t
     y;
 
   assert(destination != (WandView *) NULL);
-  assert(destination->signature == WandSignature);
+  assert(destination->signature == MagickWandSignature);
   if (set == (SetWandViewMethod) NULL)
     return(MagickFalse);
   destination_image=destination->wand->images;
@@ -924,7 +946,9 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination,
   status=MagickTrue;
   progress=0;
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(destination->number_threads)
+  height=destination->extent.height-destination->extent.y;
+  #pragma omp parallel for schedule(static,4) shared(progress,status) \
+    magick_threads(destination_image,destination_image,height,1)
 #endif
   for (y=destination->extent.y; y < (ssize_t) destination->extent.height; y++)
   {
@@ -938,7 +962,7 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination,
       x;
 
     register Quantum
-      *restrict pixels;
+      *magick_restrict pixels;
 
     if (status == MagickFalse)
       continue;
@@ -966,7 +990,7 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination,
           proceed;
 
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp critical (MagickWand_SetWandViewIterator)
+        #pragma omp critical (MagickWand_SetWandViewIterator)
 #endif
         proceed=SetImageProgress(destination_image,destination->description,
           progress++,destination->extent.height);
@@ -982,41 +1006,6 @@ WandExport MagickBooleanType SetWandViewIterator(WandView *destination,
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%   S e t W a n d V i e w T h r e a d s                                       %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  SetWandViewThreads() sets the number of threads in a thread team.
-%
-%  The format of the SetWandViewDescription method is:
-%
-%      void SetWandViewThreads(WandView *image_view,
-%        const size_t number_threads)
-%
-%  A description of each parameter follows:
-%
-%    o image_view: the image view.
-%
-%    o number_threads: the number of threads in a thread team.
-%
-*/
-MagickExport void SetWandViewThreads(WandView *image_view,
-  const size_t number_threads)
-{
-  assert(image_view != (WandView *) NULL);
-  assert(image_view->signature == MagickSignature);
-  image_view->number_threads=number_threads;
-  if (number_threads > GetOpenMPMaximumThreads())
-    image_view->number_threads=GetOpenMPMaximumThreads();
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 %   T r a n s f e r W a n d V i e w I t e r a t o r                           %
 %                                                                             %
 %                                                                             %
@@ -1073,11 +1062,16 @@ WandExport MagickBooleanType TransferWandViewIterator(WandView *source,
   MagickOffsetType
     progress;
 
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  size_t
+    height;
+#endif
+
   ssize_t
     y;
 
   assert(source != (WandView *) NULL);
-  assert(source->signature == WandSignature);
+  assert(source->signature == MagickWandSignature);
   if (transfer == (TransferWandViewMethod) NULL)
     return(MagickFalse);
   source_image=source->wand->images;
@@ -1089,7 +1083,9 @@ WandExport MagickBooleanType TransferWandViewIterator(WandView *source,
   status=MagickTrue;
   progress=0;
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
+  height=source->extent.height-source->extent.y;
+  #pragma omp parallel for schedule(static,4) shared(progress,status) \
+    magick_threads(source_image,destination_image,height,1)
 #endif
   for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
   {
@@ -1100,13 +1096,13 @@ WandExport MagickBooleanType TransferWandViewIterator(WandView *source,
       sync;
 
     register const Quantum
-      *restrict pixels;
+      *magick_restrict pixels;
 
     register ssize_t
       x;
 
     register Quantum
-      *restrict destination_pixels;
+      *magick_restrict destination_pixels;
 
     if (status == MagickFalse)
       continue;
@@ -1156,7 +1152,7 @@ WandExport MagickBooleanType TransferWandViewIterator(WandView *source,
           proceed;
 
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp critical (MagickWand_TransferWandViewIterator)
+        #pragma omp critical (MagickWand_TransferWandViewIterator)
 #endif
         proceed=SetImageProgress(source_image,source->description,progress++,
           source->extent.height);
@@ -1222,11 +1218,16 @@ WandExport MagickBooleanType UpdateWandViewIterator(WandView *source,
   MagickOffsetType
     progress;
 
+#if defined(MAGICKCORE_OPENMP_SUPPORT)
+  size_t
+    height;
+#endif
+
   ssize_t
     y;
 
   assert(source != (WandView *) NULL);
-  assert(source->signature == WandSignature);
+  assert(source->signature == MagickWandSignature);
   if (update == (UpdateWandViewMethod) NULL)
     return(MagickFalse);
   source_image=source->wand->images;
@@ -1236,7 +1237,9 @@ WandExport MagickBooleanType UpdateWandViewIterator(WandView *source,
   status=MagickTrue;
   progress=0;
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp parallel for schedule(static,1) shared(progress,status) num_threads(source->number_threads)
+  height=source->extent.height-source->extent.y;
+  #pragma omp parallel for schedule(static,4) shared(progress,status) \
+    magick_threads(source_image,source_image,height,1)
 #endif
   for (y=source->extent.y; y < (ssize_t) source->extent.height; y++)
   {
@@ -1250,7 +1253,7 @@ WandExport MagickBooleanType UpdateWandViewIterator(WandView *source,
       x;
 
     register Quantum
-      *restrict pixels;
+      *magick_restrict pixels;
 
     if (status == MagickFalse)
       continue;
@@ -1282,7 +1285,7 @@ WandExport MagickBooleanType UpdateWandViewIterator(WandView *source,
           proceed;
 
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
-  #pragma omp critical (MagickWand_UpdateWandViewIterator)
+        #pragma omp critical (MagickWand_UpdateWandViewIterator)
 #endif
         proceed=SetImageProgress(source_image,source->description,progress++,
           source->extent.height);