00001 /* 00002 Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization 00003 dedicated to making software imaging solutions freely available. 00004 00005 You may not use this file except in compliance with the License. 00006 obtain a copy of the License at 00007 00008 http://www.imagemagick.org/script/license.php 00009 00010 Unless required by applicable law or agreed to in writing, software 00011 distributed under the License is distributed on an "AS IS" BASIS, 00012 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 See the License for the specific language governing permissions and 00014 limitations under the License. 00015 00016 MagickCore image resampling private methods. 00017 */ 00018 #ifndef _MAGICKCORE_RESAMPLE_PRIVATE_H 00019 #define _MAGICKCORE_RESAMPLE_PRIVATE_H 00020 00021 #if defined(__cplusplus) || defined(c_plusplus) 00022 extern "C" { 00023 #endif 00024 00025 #include "magick/thread-private.h" 00026 00027 static inline ResampleFilter **DestroyResampleFilterThreadSet( 00028 ResampleFilter **filter) 00029 { 00030 register long 00031 i; 00032 00033 assert(filter != (ResampleFilter **) NULL); 00034 for (i=0; i < (long) GetOpenMPMaximumThreads(); i++) 00035 if (filter[i] != (ResampleFilter *) NULL) 00036 filter[i]=DestroyResampleFilter(filter[i]); 00037 filter=(ResampleFilter **) RelinquishAlignedMemory(filter); 00038 return(filter); 00039 } 00040 00041 static inline ResampleFilter **AcquireResampleFilterThreadSet( 00042 const Image *image,const MagickBooleanType interpolate, 00043 ExceptionInfo *exception) 00044 { 00045 register long 00046 i; 00047 00048 ResampleFilter 00049 **filter; 00050 00051 unsigned long 00052 number_threads; 00053 00054 number_threads=GetOpenMPMaximumThreads(); 00055 filter=(ResampleFilter **) AcquireAlignedMemory(number_threads, 00056 sizeof(*filter)); 00057 if (filter == (ResampleFilter **) NULL) 00058 return((ResampleFilter **) NULL); 00059 (void) ResetMagickMemory(filter,0,number_threads*sizeof(*filter)); 00060 for (i=0; i < (long) number_threads; i++) 00061 { 00062 filter[i]=AcquireResampleFilter(image,exception); 00063 if (filter[i] == (ResampleFilter *) NULL) 00064 return(DestroyResampleFilterThreadSet(filter)); 00065 if (interpolate != MagickFalse) 00066 SetResampleFilter(filter[i],PointFilter,1.0); 00067 } 00068 return(filter); 00069 } 00070 00071 #if defined(__cplusplus) || defined(c_plusplus) 00072 } 00073 #endif 00074 00075 #endif
1.6.1