return(clEnv);
}
-static inline void copyPixels(const Image *source,Image *destination,
- ExceptionInfo *exception)
+static Image *cloneImage(const Image* image,ExceptionInfo *exception)
{
- RectangleInfo
- geometry;
-
- OffsetInfo
- offset;
-
- /* The pixels only need to be copied when a channel mask has been set */
- if (((source->channel_mask & RedChannel) != 0) &&
- ((source->channel_mask & GreenChannel) != 0) &&
- ((source->channel_mask & BlueChannel) != 0) &&
- ((source->channel_mask & AlphaChannel) != 0))
- return;
-
- geometry.width=source->columns;
- geometry.height=source->rows;
- geometry.x=geometry.y=offset.x=offset.y=0;
- CopyImagePixels(destination,source,&geometry,&offset,exception);
+ Image
+ *clone;
+
+ if (((image->channel_mask & RedChannel) != 0) &&
+ ((image->channel_mask & GreenChannel) != 0) &&
+ ((image->channel_mask & BlueChannel) != 0) &&
+ ((image->channel_mask & AlphaChannel) != 0))
+ clone=CloneImage(image,image->columns,image->rows,MagickTrue,exception);
+ else
+ {
+ clone=CloneImage(image,0,0,MagickTrue,exception);
+ if (clone != (Image *) NULL)
+ SyncImagePixelCache(clone,exception);
+ }
+ return(clone);
}
/* pad the global workgroup size to the next multiple of
queue=AcquireOpenCLCommandQueue(device);
if (queue == (cl_command_queue) NULL)
goto cleanup;
- filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
- exception);
+ filteredImage=cloneImage(image,exception);
if (filteredImage == (Image *) NULL)
goto cleanup;
if (filteredImage->number_channels != image->number_channels)
goto cleanup;
- copyPixels(image,filteredImage,exception);
imageBuffer=GetAuthenticOpenCLBuffer(image,device,exception);
if (imageBuffer == (cl_mem) NULL)
goto cleanup;
device=RequestOpenCLDevice(clEnv);
queue=AcquireOpenCLCommandQueue(device);
- filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
- exception);
+ filteredImage=cloneImage(image,exception);
if (filteredImage == (Image *) NULL)
goto cleanup;
if (filteredImage->number_channels != image->number_channels)
goto cleanup;
- copyPixels(image,filteredImage,exception);
imageBuffer=GetAuthenticOpenCLBuffer(image,device,exception);
if (imageBuffer == (cl_mem) NULL)
goto cleanup;
device=RequestOpenCLDevice(clEnv);
queue=AcquireOpenCLCommandQueue(device);
- filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
- exception);
+ filteredImage=cloneImage(image,exception);
if (filteredImage == (Image *) NULL)
goto cleanup;
if (filteredImage->number_channels != image->number_channels)
goto cleanup;
- copyPixels(image,filteredImage,exception);
imageBuffer=GetAuthenticOpenCLBuffer(image,device,exception);
if (imageBuffer == (cl_mem) NULL)
goto cleanup;
device=RequestOpenCLDevice(clEnv);
queue=AcquireOpenCLCommandQueue(device);
- filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
- exception);
+ filteredImage=cloneImage(image,exception);
if (filteredImage == (Image *) NULL)
goto cleanup;
if (filteredImage->number_channels != image->number_channels)
goto cleanup;
- copyPixels(image,filteredImage,exception);
imageBuffer=GetAuthenticOpenCLBuffer(image,device,exception);
if (imageBuffer == (cl_mem) NULL)
goto cleanup;
device=RequestOpenCLDevice(clEnv);
queue=AcquireOpenCLCommandQueue(device);
- filteredImage=CloneImage(image,image->columns,image->rows,MagickTrue,
- exception);
+ filteredImage=cloneImage(image,exception);
if (filteredImage == (Image *) NULL)
goto cleanup;
if (filteredImage->number_channels != image->number_channels)
goto cleanup;
- copyPixels(image,filteredImage,exception);
imageBuffer=GetAuthenticOpenCLBuffer(image,device,exception);
if (imageBuffer == (cl_mem) NULL)
goto cleanup;