Coverage Report

Created: 2025-08-12 07:37

/src/imagemagick/MagickCore/cache-view.c
Line
Count
Source (jump to first uncovered line)
1
/*
2
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3
%                                                                             %
4
%                                                                             %
5
%                                                                             %
6
%                      CCCC   AAA    CCCC  H   H  EEEEE                       %
7
%                     C      A   A  C      H   H  E                           %
8
%                     C      AAAAA  C      HHHHH  EEE                         %
9
%                     C      A   A  C      H   H  E                           %
10
%                      CCCC  A   A   CCCC  H   H  EEEEE                       %
11
%                                                                             %
12
%                        V   V  IIIII  EEEEE  W   W                           %
13
%                        V   V    I    E      W   W                           %
14
%                        V   V    I    EEE    W W W                           %
15
%                         V V     I    E      WW WW                           %
16
%                          V    IIIII  EEEEE  W   W                           %
17
%                                                                             %
18
%                                                                             %
19
%                        MagickCore Cache View Methods                        %
20
%                                                                             %
21
%                              Software Design                                %
22
%                                   Cristy                                    %
23
%                               February 2000                                 %
24
%                                                                             %
25
%                                                                             %
26
%  Copyright @ 1999 ImageMagick Studio LLC, a non-profit organization         %
27
%  dedicated to making software imaging solutions freely available.           %
28
%                                                                             %
29
%  You may not use this file except in compliance with the License.  You may  %
30
%  obtain a copy of the License at                                            %
31
%                                                                             %
32
%    https://imagemagick.org/script/license.php                               %
33
%                                                                             %
34
%  Unless required by applicable law or agreed to in writing, software        %
35
%  distributed under the License is distributed on an "AS IS" BASIS,          %
36
%  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
37
%  See the License for the specific language governing permissions and        %
38
%  limitations under the License.                                             %
39
%                                                                             %
40
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
41
%
42
%
43
%
44
*/
45

46
/*
47
  Include declarations.
48
*/
49
#include "MagickCore/studio.h"
50
#include "MagickCore/cache.h"
51
#include "MagickCore/cache-private.h"
52
#include "MagickCore/cache-view.h"
53
#include "MagickCore/memory_.h"
54
#include "MagickCore/memory-private.h"
55
#include "MagickCore/exception.h"
56
#include "MagickCore/exception-private.h"
57
#include "MagickCore/pixel-accessor.h"
58
#include "MagickCore/resource_.h"
59
#include "MagickCore/string_.h"
60
#include "MagickCore/thread-private.h"
61

62
/*
63
  Typedef declarations.
64
*/
65
struct _CacheView
66
{
67
  Image
68
    *image;
69
70
  VirtualPixelMethod
71
    virtual_pixel_method;
72
73
  size_t
74
    number_threads;
75
76
  NexusInfo
77
    **nexus_info;
78
79
  MagickBooleanType
80
    debug;
81
82
  size_t
83
    signature;
84
};
85

86
/*
87
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
88
%                                                                             %
89
%                                                                             %
90
%                                                                             %
91
%   A c q u i r e A u t h e n t i c C a c h e V i e w                         %
92
%                                                                             %
93
%                                                                             %
94
%                                                                             %
95
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
96
%
97
%  AcquireAuthenticCacheView() acquires an authentic view into the pixel cache.
98
%  It always succeeds but may return a warning or informational exception.
99
%
100
%  The format of the AcquireAuthenticCacheView method is:
101
%
102
%      CacheView *AcquireAuthenticCacheView(const Image *image,
103
%        ExceptionInfo *exception)
104
%
105
%  A description of each parameter follows:
106
%
107
%    o image: the image.
108
%
109
%    o exception: return any errors or warnings in this structure.
110
%
111
*/
112
MagickExport CacheView *AcquireAuthenticCacheView(const Image *image,
113
  ExceptionInfo *exception)
114
2.60M
{
115
2.60M
  CacheView
116
2.60M
    *magick_restrict cache_view;
117
118
2.60M
  cache_view=AcquireVirtualCacheView(image,exception);
119
2.60M
  return(cache_view);
120
2.60M
}
121

122
/*
123
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
124
%                                                                             %
125
%                                                                             %
126
%                                                                             %
127
%   A c q u i r e V i r t u a l C a c h e V i e w                             %
128
%                                                                             %
129
%                                                                             %
130
%                                                                             %
131
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
132
%
133
%  AcquireVirtualCacheView() acquires a virtual view into the pixel cache,
134
%  using the VirtualPixelMethod that is defined within the given image itself.
135
%  It always succeeds but may return a warning or informational exception.
136
%
137
%  The format of the AcquireVirtualCacheView method is:
138
%
139
%      CacheView *AcquireVirtualCacheView(const Image *image,
140
%        ExceptionInfo *exception)
141
%
142
%  A description of each parameter follows:
143
%
144
%    o image: the image.
145
%
146
%    o exception: return any errors or warnings in this structure.
147
%
148
*/
149
MagickExport CacheView *AcquireVirtualCacheView(const Image *image,
150
  ExceptionInfo *magick_unused(exception))
151
3.21M
{
152
3.21M
  CacheView
153
3.21M
    *magick_restrict cache_view;
154
155
3.21M
  magick_unreferenced(exception);
156
3.21M
  assert(image != (Image *) NULL);
157
3.21M
  assert(image->signature == MagickCoreSignature);
158
3.21M
  if (IsEventLogging() != MagickFalse)
159
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
160
#if defined(MAGICKCORE_OPENCL_SUPPORT)
161
  SyncAuthenticOpenCLBuffer(image);
162
#endif
163
3.21M
  cache_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
164
3.21M
    sizeof(*cache_view)));
165
3.21M
  if (cache_view == (CacheView *) NULL)
166
3.21M
    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
167
3.21M
  (void) memset(cache_view,0,sizeof(*cache_view));
168
3.21M
  cache_view->image=ReferenceImage((Image *) image);
169
3.21M
  cache_view->number_threads=GetOpenMPMaximumThreads();
170
3.21M
  if (GetMagickResourceLimit(ThreadResource) > cache_view->number_threads)
171
0
    cache_view->number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
172
3.21M
  if (cache_view->number_threads == 0)
173
0
    cache_view->number_threads=1;
174
3.21M
  cache_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
175
3.21M
  cache_view->virtual_pixel_method=GetImageVirtualPixelMethod(image);
176
3.21M
  cache_view->debug=(GetLogEventMask() & CacheEvent) != 0 ? MagickTrue :
177
3.21M
    MagickFalse;
178
3.21M
  cache_view->signature=MagickCoreSignature;
179
3.21M
  return(cache_view);
180
3.21M
}
181

182
/*
183
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
184
%                                                                             %
185
%                                                                             %
186
%                                                                             %
187
%   C l o n e C a c h e V i e w                                               %
188
%                                                                             %
189
%                                                                             %
190
%                                                                             %
191
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
192
%
193
%  CloneCacheView()  makes an exact copy of the specified cache view.
194
%
195
%  The format of the CloneCacheView method is:
196
%
197
%      CacheView *CloneCacheView(const CacheView *cache_view)
198
%
199
%  A description of each parameter follows:
200
%
201
%    o cache_view: the cache view.
202
%
203
*/
204
MagickExport CacheView *CloneCacheView(const CacheView *cache_view)
205
0
{
206
0
  CacheView
207
0
    *magick_restrict clone_view;
208
209
0
  assert(cache_view != (CacheView *) NULL);
210
0
  assert(cache_view->signature == MagickCoreSignature);
211
0
  if (IsEventLogging() != MagickFalse)
212
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
213
0
      cache_view->image->filename);
214
0
  clone_view=(CacheView *) MagickAssumeAligned(AcquireAlignedMemory(1,
215
0
    sizeof(*clone_view)));
216
0
  if (clone_view == (CacheView *) NULL)
217
0
    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
218
0
  (void) memset(clone_view,0,sizeof(*clone_view));
219
0
  clone_view->image=ReferenceImage(cache_view->image);
220
0
  clone_view->number_threads=cache_view->number_threads;
221
0
  clone_view->nexus_info=AcquirePixelCacheNexus(cache_view->number_threads);
222
0
  clone_view->virtual_pixel_method=cache_view->virtual_pixel_method;
223
0
  clone_view->debug=cache_view->debug;
224
0
  clone_view->signature=MagickCoreSignature;
225
0
  return(clone_view);
226
0
}
227

228
/*
229
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
230
%                                                                             %
231
%                                                                             %
232
%                                                                             %
233
%   D e s t r o y C a c h e V i e w                                           %
234
%                                                                             %
235
%                                                                             %
236
%                                                                             %
237
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
238
%
239
%  DestroyCacheView() destroys the specified view returned by a previous call
240
%  to AcquireCacheView().
241
%
242
%  The format of the DestroyCacheView method is:
243
%
244
%      CacheView *DestroyCacheView(CacheView *cache_view)
245
%
246
%  A description of each parameter follows:
247
%
248
%    o cache_view: the cache view.
249
%
250
*/
251
MagickExport CacheView *DestroyCacheView(CacheView *cache_view)
252
3.21M
{
253
3.21M
  assert(cache_view != (CacheView *) NULL);
254
3.21M
  assert(cache_view->signature == MagickCoreSignature);
255
3.21M
  if (IsEventLogging() != MagickFalse)
256
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
257
0
      cache_view->image->filename);
258
3.21M
  if (cache_view->nexus_info != (NexusInfo **) NULL)
259
3.21M
    cache_view->nexus_info=DestroyPixelCacheNexus(cache_view->nexus_info,
260
3.21M
      cache_view->number_threads);
261
3.21M
  cache_view->image=DestroyImage(cache_view->image);
262
3.21M
  cache_view->signature=(~MagickCoreSignature);
263
3.21M
  cache_view=(CacheView *) RelinquishAlignedMemory(cache_view);
264
3.21M
  return(cache_view);
265
3.21M
}
266

267
/*
268
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
269
%                                                                             %
270
%                                                                             %
271
%                                                                             %
272
%   G e t C a c h e V i e w A u t h e n t i c P i x e l s                     %
273
%                                                                             %
274
%                                                                             %
275
%                                                                             %
276
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
277
%
278
%  GetCacheViewAuthenticPixels() gets pixels from the in-memory or disk pixel
279
%  cache as defined by the geometry parameters.   A pointer to the pixels is
280
%  returned if the pixels are transferred, otherwise a NULL is returned.
281
%
282
%  The format of the GetCacheViewAuthenticPixels method is:
283
%
284
%      Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
285
%        const ssize_t x,const ssize_t y,const size_t columns,
286
%        const size_t rows,ExceptionInfo *exception)
287
%
288
%  A description of each parameter follows:
289
%
290
%    o cache_view: the cache view.
291
%
292
%    o x,y,columns,rows:  These values define the perimeter of a region of
293
%      pixels.
294
%
295
%    o exception: return any errors or warnings in this structure.
296
%
297
*/
298
MagickExport Quantum *GetCacheViewAuthenticPixels(CacheView *cache_view,
299
  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
300
  ExceptionInfo *exception)
301
322M
{
302
322M
  const int
303
322M
    id = GetOpenMPThreadId();
304
305
322M
  Quantum
306
322M
    *magick_restrict pixels;
307
308
322M
  assert(cache_view != (CacheView *) NULL);
309
322M
  assert(cache_view->signature == MagickCoreSignature);
310
322M
  assert(id < (int) cache_view->number_threads);
311
322M
  pixels=GetAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
312
322M
    cache_view->nexus_info[id],exception);
313
322M
  return(pixels);
314
322M
}
315

316
/*
317
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318
%                                                                             %
319
%                                                                             %
320
%                                                                             %
321
%   G e t C a c h e V i e w A u t h e n t i c M e t a c o n t e n t           %
322
%                                                                             %
323
%                                                                             %
324
%                                                                             %
325
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
326
%
327
%  GetCacheViewAuthenticMetacontent() returns the meta-content corresponding
328
%  with the last call to SetCacheViewIndexes() or
329
%  GetCacheViewAuthenticMetacontent().  The meta-content are authentic and can
330
%  be updated.
331
%
332
%  The format of the GetCacheViewAuthenticMetacontent() method is:
333
%
334
%      void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
335
%
336
%  A description of each parameter follows:
337
%
338
%    o cache_view: the cache view.
339
%
340
*/
341
MagickExport void *GetCacheViewAuthenticMetacontent(CacheView *cache_view)
342
0
{
343
0
  const int
344
0
    id = GetOpenMPThreadId();
345
346
0
  assert(cache_view != (CacheView *) NULL);
347
0
  assert(cache_view->signature == MagickCoreSignature);
348
0
  assert(cache_view->image->cache != (Cache) NULL);
349
0
  assert(id < (int) cache_view->number_threads);
350
0
  return(cache_view->nexus_info[id]->metacontent);
351
0
}
352

353
/*
354
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
355
%                                                                             %
356
%                                                                             %
357
%                                                                             %
358
%   G e t C a c h e V i e w A u t h e n t i c P i x e l Q u e u e             %
359
%                                                                             %
360
%                                                                             %
361
%                                                                             %
362
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
363
%
364
%  GetCacheViewAuthenticPixelQueue() returns the pixels associated with the
365
%  last call to QueueCacheViewAuthenticPixels() or
366
%  GetCacheViewAuthenticPixels().  The pixels are authentic and therefore can be
367
%  updated.
368
%
369
%  The format of the GetCacheViewAuthenticPixelQueue() method is:
370
%
371
%      Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
372
%
373
%  A description of each parameter follows:
374
%
375
%    o cache_view: the cache view.
376
%
377
*/
378
MagickExport Quantum *GetCacheViewAuthenticPixelQueue(CacheView *cache_view)
379
0
{
380
0
  const int
381
0
    id = GetOpenMPThreadId();
382
383
0
  assert(cache_view != (CacheView *) NULL);
384
0
  assert(cache_view->signature == MagickCoreSignature);
385
0
  assert(cache_view->image->cache != (Cache) NULL);
386
0
  assert(id < (int) cache_view->number_threads);
387
0
  return(cache_view->nexus_info[id]->pixels);
388
0
}
389

390
/*
391
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
392
%                                                                             %
393
%                                                                             %
394
%                                                                             %
395
%   G e t C a c h e V i e w C o l o r s p a c e                               %
396
%                                                                             %
397
%                                                                             %
398
%                                                                             %
399
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
400
%
401
%  GetCacheViewColorspace() returns the image colorspace associated with the
402
%  specified view.
403
%
404
%  The format of the GetCacheViewColorspace method is:
405
%
406
%      ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
407
%
408
%  A description of each parameter follows:
409
%
410
%    o cache_view: the cache view.
411
%
412
*/
413
MagickExport ColorspaceType GetCacheViewColorspace(const CacheView *cache_view)
414
0
{
415
0
  assert(cache_view != (CacheView *) NULL);
416
0
  assert(cache_view->signature == MagickCoreSignature);
417
0
  if (IsEventLogging() != MagickFalse)
418
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
419
0
      cache_view->image->filename);
420
0
  return(GetPixelCacheColorspace(cache_view->image->cache));
421
0
}
422

423
/*
424
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
425
%                                                                             %
426
%                                                                             %
427
%                                                                             %
428
+   G e t C a c h e V i e w E x t e n t                                       %
429
%                                                                             %
430
%                                                                             %
431
%                                                                             %
432
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
433
%
434
%  GetCacheViewExtent() returns the extent of the pixels associated with the
435
%  last call to QueueCacheViewAuthenticPixels() or
436
%  GetCacheViewAuthenticPixels().
437
%
438
%  The format of the GetCacheViewExtent() method is:
439
%
440
%      MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
441
%
442
%  A description of each parameter follows:
443
%
444
%    o cache_view: the cache view.
445
%
446
*/
447
MagickExport MagickSizeType GetCacheViewExtent(const CacheView *cache_view)
448
0
{
449
0
  const int
450
0
    id = GetOpenMPThreadId();
451
452
0
  MagickSizeType
453
0
    extent;
454
455
0
  assert(cache_view != (CacheView *) NULL);
456
0
  assert(cache_view->signature == MagickCoreSignature);
457
0
  if (IsEventLogging() != MagickFalse)
458
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
459
0
      cache_view->image->filename);
460
0
  assert(cache_view->image->cache != (Cache) NULL);
461
0
  assert(id < (int) cache_view->number_threads);
462
0
  extent=GetPixelCacheNexusExtent(cache_view->image->cache,
463
0
    cache_view->nexus_info[id]);
464
0
  return(extent);
465
0
}
466

467
/*
468
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
469
%                                                                             %
470
%                                                                             %
471
%                                                                             %
472
%   G e t C a c h e V i e w I m a g e                                         %
473
%                                                                             %
474
%                                                                             %
475
%                                                                             %
476
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
477
%
478
%  GetCacheViewImage() returns the image associated with the specified view.
479
%
480
%  The format of the GetCacheViewImage method is:
481
%
482
%      const Image *GetCacheViewImage(const CacheView *cache_view)
483
%
484
%  A description of each parameter follows:
485
%
486
%    o cache_view: the cache view.
487
%
488
*/
489
MagickExport const Image *GetCacheViewImage(const CacheView *cache_view)
490
0
{
491
0
  assert(cache_view != (CacheView *) NULL);
492
0
  assert(cache_view->signature == MagickCoreSignature);
493
0
  if (IsEventLogging() != MagickFalse)
494
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
495
0
      cache_view->image->filename);
496
0
  return(cache_view->image);
497
0
}
498

499
/*
500
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
501
%                                                                             %
502
%                                                                             %
503
%                                                                             %
504
%   G e t C a c h e V i e w S t o r a g e C l a s s                           %
505
%                                                                             %
506
%                                                                             %
507
%                                                                             %
508
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
509
%
510
%  GetCacheViewStorageClass() returns the image storage class associated with
511
%  the specified view.
512
%
513
%  The format of the GetCacheViewStorageClass method is:
514
%
515
%      ClassType GetCacheViewStorageClass(const CacheView *cache_view)
516
%
517
%  A description of each parameter follows:
518
%
519
%    o cache_view: the cache view.
520
%
521
*/
522
MagickExport ClassType GetCacheViewStorageClass(const CacheView *cache_view)
523
0
{
524
0
  assert(cache_view != (CacheView *) NULL);
525
0
  assert(cache_view->signature == MagickCoreSignature);
526
0
  if (IsEventLogging() != MagickFalse)
527
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
528
0
      cache_view->image->filename);
529
0
  return(GetPixelCacheStorageClass(cache_view->image->cache));
530
0
}
531

532
/*
533
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
534
%                                                                             %
535
%                                                                             %
536
%                                                                             %
537
%   G e t C a c h e V i e w V i r t u a l M e t a c o n t e n t               %
538
%                                                                             %
539
%                                                                             %
540
%                                                                             %
541
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
542
%
543
%  GetCacheViewVirtualMetacontent() returns the meta-content corresponding
544
%  with the last call to GetCacheViewVirtualMetacontent().  The meta-content
545
%  is virtual and therefore cannot be updated.
546
%
547
%  The format of the GetCacheViewVirtualMetacontent() method is:
548
%
549
%      const void *GetCacheViewVirtualMetacontent(
550
%        const CacheView *cache_view)
551
%
552
%  A description of each parameter follows:
553
%
554
%    o cache_view: the cache view.
555
%
556
*/
557
MagickExport const void *GetCacheViewVirtualMetacontent(
558
  const CacheView *cache_view)
559
0
{
560
0
  const int
561
0
    id = GetOpenMPThreadId();
562
563
0
  const void
564
0
    *magick_restrict metacontent;
565
566
0
  assert(cache_view != (const CacheView *) NULL);
567
0
  assert(cache_view->signature == MagickCoreSignature);
568
0
  assert(cache_view->image->cache != (Cache) NULL);
569
0
  assert(id < (int) cache_view->number_threads);
570
0
  metacontent=GetVirtualMetacontentFromNexus(cache_view->image->cache,
571
0
    cache_view->nexus_info[id]);
572
0
  return(metacontent);
573
0
}
574

575
/*
576
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
577
%                                                                             %
578
%                                                                             %
579
%                                                                             %
580
%   G e t C a c h e V i e w V i r t u a l P i x e l Q u e u e                 %
581
%                                                                             %
582
%                                                                             %
583
%                                                                             %
584
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
585
%
586
%  GetCacheViewVirtualPixelQueue() returns the pixels associated with
587
%  the last call to GetCacheViewVirtualPixels().  The pixels are virtual
588
%  and therefore cannot be updated.
589
%
590
%  The format of the GetCacheViewVirtualPixelQueue() method is:
591
%
592
%      const Quantum *GetCacheViewVirtualPixelQueue(
593
%        const CacheView *cache_view)
594
%
595
%  A description of each parameter follows:
596
%
597
%    o cache_view: the cache view.
598
%
599
*/
600
MagickExport const Quantum *GetCacheViewVirtualPixelQueue(
601
  const CacheView *cache_view)
602
0
{
603
0
  const int
604
0
    id = GetOpenMPThreadId();
605
606
0
  const Quantum
607
0
    *magick_restrict pixels;
608
609
0
  assert(cache_view != (const CacheView *) NULL);
610
0
  assert(cache_view->signature == MagickCoreSignature);
611
0
  assert(cache_view->image->cache != (Cache) NULL);
612
0
  assert(id < (int) cache_view->number_threads);
613
0
  pixels=GetVirtualPixelsNexus(cache_view->image->cache,
614
0
    cache_view->nexus_info[id]);
615
0
  return(pixels);
616
0
}
617

618
/*
619
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
620
%                                                                             %
621
%                                                                             %
622
%                                                                             %
623
%   G e t C a c h e V i e w V i r t u a l P i x e l s                         %
624
%                                                                             %
625
%                                                                             %
626
%                                                                             %
627
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
628
%
629
%  GetCacheViewVirtualPixels() gets virtual pixels from the in-memory or
630
%  disk pixel cache as defined by the geometry parameters.   A pointer to the
631
%  pixels is returned if the pixels are transferred, otherwise a NULL is
632
%  returned.
633
%
634
%  The format of the GetCacheViewVirtualPixels method is:
635
%
636
%      const Quantum *GetCacheViewVirtualPixels(
637
%        const CacheView *cache_view,const ssize_t x,const ssize_t y,
638
%        const size_t columns,const size_t rows,ExceptionInfo *exception)
639
%
640
%  A description of each parameter follows:
641
%
642
%    o cache_view: the cache view.
643
%
644
%    o x,y,columns,rows:  These values define the perimeter of a region of
645
%      pixels.
646
%
647
%    o exception: return any errors or warnings in this structure.
648
%
649
*/
650
MagickExport const Quantum *GetCacheViewVirtualPixels(
651
  const CacheView *cache_view,const ssize_t x,const ssize_t y,
652
  const size_t columns,const size_t rows,ExceptionInfo *exception)
653
108M
{
654
108M
  const int
655
108M
    id = GetOpenMPThreadId();
656
657
108M
  const Quantum
658
108M
    *magick_restrict pixels;
659
660
108M
  assert(cache_view != (CacheView *) NULL);
661
108M
  assert(cache_view->signature == MagickCoreSignature);
662
108M
  assert(id < (int) cache_view->number_threads);
663
108M
  pixels=GetVirtualPixelCacheNexus(cache_view->image,
664
108M
    cache_view->virtual_pixel_method,x,y,columns,rows,
665
108M
    cache_view->nexus_info[id],exception);
666
108M
  return(pixels);
667
108M
}
668

669
/*
670
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
671
%                                                                             %
672
%                                                                             %
673
%                                                                             %
674
%   G e t O n e C a c h e V i e w A u t h e n t i c P i x e l                 %
675
%                                                                             %
676
%                                                                             %
677
%                                                                             %
678
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
679
%
680
%  GetOneCacheViewAuthenticPixel() returns a single pixel at the specified (x,y)
681
%  location.  The image background color is returned if an error occurs.
682
%
683
%  The format of the GetOneCacheViewAuthenticPixel method is:
684
%
685
%      MagickBooleanType GetOneCacheViewAuthenticPixel(
686
%        const CacheView *cache_view,const ssize_t x,const ssize_t y,
687
%        Quantum *pixel,ExceptionInfo *exception)
688
%
689
%  A description of each parameter follows:
690
%
691
%    o cache_view: the cache view.
692
%
693
%    o x,y:  These values define the offset of the pixel.
694
%
695
%    o pixel: return a pixel at the specified (x,y) location.
696
%
697
%    o exception: return any errors or warnings in this structure.
698
%
699
*/
700
MagickExport MagickBooleanType GetOneCacheViewAuthenticPixel(
701
  const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
702
  ExceptionInfo *exception)
703
0
{
704
0
  const int
705
0
    id = GetOpenMPThreadId();
706
707
0
  Quantum
708
0
    *magick_restrict q;
709
710
0
  ssize_t
711
0
    i;
712
713
0
  assert(cache_view != (CacheView *) NULL);
714
0
  assert(cache_view->signature == MagickCoreSignature);
715
0
  assert(id < (int) cache_view->number_threads);
716
0
  (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
717
0
  q=GetAuthenticPixelCacheNexus(cache_view->image,x,y,1,1,
718
0
    cache_view->nexus_info[id],exception);
719
0
  if (q == (const Quantum *) NULL)
720
0
    {
721
0
      PixelInfo
722
0
        background_color;
723
724
0
      background_color=cache_view->image->background_color;
725
0
      pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
726
0
      pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
727
0
      pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
728
0
      pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
729
0
      pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
730
0
      return(MagickFalse);
731
0
    }
732
0
  for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
733
0
  {
734
0
    PixelChannel channel = GetPixelChannelChannel(cache_view->image,i);
735
0
    pixel[channel]=q[i];
736
0
  }
737
0
  return(MagickTrue);
738
0
}
739

740
/*
741
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
742
%                                                                             %
743
%                                                                             %
744
%                                                                             %
745
%   G e t O n e C a c h e V i e w V i r t u a l P i x e l                     %
746
%                                                                             %
747
%                                                                             %
748
%                                                                             %
749
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
750
%
751
%  GetOneCacheViewVirtualPixel() returns a single pixel at the specified (x,y)
752
%  location.  The image background color is returned if an error occurs.  If
753
%  you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
754
%
755
%  The format of the GetOneCacheViewVirtualPixel method is:
756
%
757
%      MagickBooleanType GetOneCacheViewVirtualPixel(
758
%        const CacheView *cache_view,const ssize_t x,const ssize_t y,
759
%        Quantum *pixel,ExceptionInfo *exception)
760
%
761
%  A description of each parameter follows:
762
%
763
%    o cache_view: the cache view.
764
%
765
%    o x,y:  These values define the offset of the pixel.
766
%
767
%    o pixel: return a pixel at the specified (x,y) location.
768
%
769
%    o exception: return any errors or warnings in this structure.
770
%
771
*/
772
MagickExport MagickBooleanType GetOneCacheViewVirtualPixel(
773
  const CacheView *cache_view,const ssize_t x,const ssize_t y,Quantum *pixel,
774
  ExceptionInfo *exception)
775
0
{
776
0
  const int
777
0
    id = GetOpenMPThreadId();
778
779
0
  const Quantum
780
0
    *magick_restrict p;
781
782
0
  ssize_t
783
0
    i;
784
785
0
  assert(cache_view != (CacheView *) NULL);
786
0
  assert(cache_view->signature == MagickCoreSignature);
787
0
  assert(id < (int) cache_view->number_threads);
788
0
  (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
789
0
  p=GetVirtualPixelCacheNexus(cache_view->image,
790
0
    cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
791
0
    exception);
792
0
  if (p == (const Quantum *) NULL)
793
0
    {
794
0
      PixelInfo
795
0
        background_color;
796
797
0
      background_color=cache_view->image->background_color;
798
0
      pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
799
0
      pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
800
0
      pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
801
0
      pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
802
0
      pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
803
0
      return(MagickFalse);
804
0
    }
805
0
  for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
806
0
  {
807
0
    PixelChannel channel = GetPixelChannelChannel(cache_view->image,i);
808
0
    pixel[channel]=p[i];
809
0
  }
810
0
  return(MagickTrue);
811
0
}
812

813
/*
814
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
815
%                                                                             %
816
%                                                                             %
817
%                                                                             %
818
%   G e t O n e C a c h e V i e w V i r t u a l P i x e l I n f o             %
819
%                                                                             %
820
%                                                                             %
821
%                                                                             %
822
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
823
%
824
%  GetOneCacheViewVirtualPixelInfo() returns a single pixel at the specified
825
%  (x,y) location.  The image background color is returned if an error occurs.
826
%  If you plan to modify the pixel, use GetOneCacheViewAuthenticPixel() instead.
827
%
828
%  The format of the GetOneCacheViewVirtualPixelInfo method is:
829
%
830
%      MagickBooleanType GetOneCacheViewVirtualPixelInfo(
831
%        const CacheView *cache_view,const ssize_t x,const ssize_t y,
832
%        PixelInfo *pixel,ExceptionInfo *exception)
833
%
834
%  A description of each parameter follows:
835
%
836
%    o cache_view: the cache view.
837
%
838
%    o x,y:  These values define the offset of the pixel.
839
%
840
%    o pixel: return a pixel at the specified (x,y) location.
841
%
842
%    o exception: return any errors or warnings in this structure.
843
%
844
*/
845
MagickExport MagickBooleanType GetOneCacheViewVirtualPixelInfo(
846
  const CacheView *cache_view,const ssize_t x,const ssize_t y,PixelInfo *pixel,
847
  ExceptionInfo *exception)
848
2.88k
{
849
2.88k
  const int
850
2.88k
    id = GetOpenMPThreadId();
851
852
2.88k
  const Quantum
853
2.88k
    *magick_restrict p;
854
855
2.88k
  assert(cache_view != (CacheView *) NULL);
856
2.88k
  assert(cache_view->signature == MagickCoreSignature);
857
2.88k
  assert(id < (int) cache_view->number_threads);
858
2.88k
  GetPixelInfo(cache_view->image,pixel);
859
2.88k
  p=GetVirtualPixelCacheNexus(cache_view->image,
860
2.88k
    cache_view->virtual_pixel_method,x,y,1,1,cache_view->nexus_info[id],
861
2.88k
    exception);
862
2.88k
  if (p == (const Quantum *) NULL)
863
301
    return(MagickFalse);
864
2.58k
  GetPixelInfoPixel(cache_view->image,p,pixel);
865
2.58k
  return(MagickTrue);
866
2.88k
}
867

868
/*
869
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
870
%                                                                             %
871
%                                                                             %
872
%                                                                             %
873
%   G e t O n e C a c h e V i e w V i r t u a l P i x e l                     %
874
%                                                                             %
875
%                                                                             %
876
%                                                                             %
877
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
878
%
879
%  GetOneCacheViewVirtualMethodPixel() returns a single virtual pixel at
880
%  the specified (x,y) location.  The image background color is returned if an
881
%  error occurs.  If you plan to modify the pixel, use
882
%  GetOneCacheViewAuthenticPixel() instead.
883
%
884
%  The format of the GetOneCacheViewVirtualPixel method is:
885
%
886
%      MagickBooleanType GetOneCacheViewVirtualMethodPixel(
887
%        const CacheView *cache_view,
888
%        const VirtualPixelMethod virtual_pixel_method,const ssize_t x,
889
%        const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
890
%
891
%  A description of each parameter follows:
892
%
893
%    o cache_view: the cache view.
894
%
895
%    o virtual_pixel_method: the virtual pixel method.
896
%
897
%    o x,y:  These values define the offset of the pixel.
898
%
899
%    o pixel: return a pixel at the specified (x,y) location.
900
%
901
%    o exception: return any errors or warnings in this structure.
902
%
903
*/
904
MagickExport MagickBooleanType GetOneCacheViewVirtualMethodPixel(
905
  const CacheView *cache_view,const VirtualPixelMethod virtual_pixel_method,
906
  const ssize_t x,const ssize_t y,Quantum *pixel,ExceptionInfo *exception)
907
0
{
908
0
  const int
909
0
    id = GetOpenMPThreadId();
910
911
0
  const Quantum
912
0
    *magick_restrict p;
913
914
0
  ssize_t
915
0
    i;
916
917
0
  assert(cache_view != (CacheView *) NULL);
918
0
  assert(cache_view->signature == MagickCoreSignature);
919
0
  assert(id < (int) cache_view->number_threads);
920
0
  (void) memset(pixel,0,MaxPixelChannels*sizeof(*pixel));
921
0
  p=GetVirtualPixelCacheNexus(cache_view->image,virtual_pixel_method,x,y,1,1,
922
0
    cache_view->nexus_info[id],exception);
923
0
  if (p == (const Quantum *) NULL)
924
0
    {
925
0
      PixelInfo
926
0
        background_color;
927
928
0
      background_color=cache_view->image->background_color;
929
0
      pixel[RedPixelChannel]=ClampToQuantum(background_color.red);
930
0
      pixel[GreenPixelChannel]=ClampToQuantum(background_color.green);
931
0
      pixel[BluePixelChannel]=ClampToQuantum(background_color.blue);
932
0
      pixel[BlackPixelChannel]=ClampToQuantum(background_color.black);
933
0
      pixel[AlphaPixelChannel]=ClampToQuantum(background_color.alpha);
934
0
      return(MagickFalse);
935
0
    }
936
0
  for (i=0; i < (ssize_t) GetPixelChannels(cache_view->image); i++)
937
0
  {
938
0
    PixelChannel channel = GetPixelChannelChannel(cache_view->image,i);
939
0
    pixel[channel]=p[i];
940
0
  }
941
0
  return(MagickTrue);
942
0
}
943

944
/*
945
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
946
%                                                                             %
947
%                                                                             %
948
%                                                                             %
949
%   Q u e u e C a c h e V i e w A u t h e n t i c P i x e l s                 %
950
%                                                                             %
951
%                                                                             %
952
%                                                                             %
953
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
954
%
955
%  QueueCacheViewAuthenticPixels() queues authentic pixels from the in-memory or
956
%  disk pixel cache as defined by the geometry parameters.   A pointer to the
957
%  pixels is returned if the pixels are transferred, otherwise a NULL is
958
%  returned.
959
%
960
%  The format of the QueueCacheViewAuthenticPixels method is:
961
%
962
%      Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
963
%        const ssize_t x,const ssize_t y,const size_t columns,
964
%        const size_t rows,ExceptionInfo *exception)
965
%
966
%  A description of each parameter follows:
967
%
968
%    o cache_view: the cache view.
969
%
970
%    o x,y,columns,rows:  These values define the perimeter of a region of
971
%      pixels.
972
%
973
%    o exception: return any errors or warnings in this structure.
974
%
975
*/
976
MagickExport Quantum *QueueCacheViewAuthenticPixels(CacheView *cache_view,
977
  const ssize_t x,const ssize_t y,const size_t columns,const size_t rows,
978
  ExceptionInfo *exception)
979
33.8M
{
980
33.8M
  const int
981
33.8M
    id = GetOpenMPThreadId();
982
983
33.8M
  Quantum
984
33.8M
    *magick_restrict pixels;
985
986
33.8M
  assert(cache_view != (CacheView *) NULL);
987
33.8M
  assert(cache_view->signature == MagickCoreSignature);
988
33.8M
  assert(id < (int) cache_view->number_threads);
989
33.8M
  pixels=QueueAuthenticPixelCacheNexus(cache_view->image,x,y,columns,rows,
990
33.8M
    MagickFalse,cache_view->nexus_info[id],exception);
991
33.8M
  return(pixels);
992
33.8M
}
993

994
/*
995
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
996
%                                                                             %
997
%                                                                             %
998
%                                                                             %
999
%   S e t C a c h e V i e w S t o r a g e C l a s s                           %
1000
%                                                                             %
1001
%                                                                             %
1002
%                                                                             %
1003
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1004
%
1005
%  SetCacheViewStorageClass() sets the image storage class associated with
1006
%  the specified view.
1007
%
1008
%  The format of the SetCacheViewStorageClass method is:
1009
%
1010
%      MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
1011
%        const ClassType storage_class,ExceptionInfo *exception)
1012
%
1013
%  A description of each parameter follows:
1014
%
1015
%    o cache_view: the cache view.
1016
%
1017
%    o storage_class: the image storage class: PseudoClass or DirectClass.
1018
%
1019
%    o exception: return any errors or warnings in this structure.
1020
%
1021
*/
1022
MagickExport MagickBooleanType SetCacheViewStorageClass(CacheView *cache_view,
1023
  const ClassType storage_class,ExceptionInfo *exception)
1024
0
{
1025
0
  assert(cache_view != (CacheView *) NULL);
1026
0
  assert(cache_view->signature == MagickCoreSignature);
1027
0
  if (IsEventLogging() != MagickFalse)
1028
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1029
0
      cache_view->image->filename);
1030
0
  return(SetImageStorageClass(cache_view->image,storage_class,exception));
1031
0
}
1032

1033
/*
1034
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1035
%                                                                             %
1036
%                                                                             %
1037
%                                                                             %
1038
%   S e t C a c h e V i e w V i r t u a l P i x e l M e t h o d               %
1039
%                                                                             %
1040
%                                                                             %
1041
%                                                                             %
1042
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1043
%
1044
%  SetCacheViewVirtualPixelMethod() sets the virtual pixel method associated
1045
%  with the specified cache view.
1046
%
1047
%  The format of the SetCacheViewVirtualPixelMethod method is:
1048
%
1049
%      MagickBooleanType SetCacheViewVirtualPixelMethod(CacheView *cache_view,
1050
%        const VirtualPixelMethod virtual_pixel_method)
1051
%
1052
%  A description of each parameter follows:
1053
%
1054
%    o cache_view: the cache view.
1055
%
1056
%    o virtual_pixel_method: the virtual pixel method.
1057
%
1058
*/
1059
MagickExport MagickBooleanType SetCacheViewVirtualPixelMethod(
1060
  CacheView *magick_restrict cache_view,
1061
  const VirtualPixelMethod virtual_pixel_method)
1062
1.31k
{
1063
1.31k
  assert(cache_view != (CacheView *) NULL);
1064
1.31k
  assert(cache_view->signature == MagickCoreSignature);
1065
1.31k
  if (IsEventLogging() != MagickFalse)
1066
0
    (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
1067
0
      cache_view->image->filename);
1068
1.31k
  cache_view->virtual_pixel_method=virtual_pixel_method;
1069
1.31k
  return(MagickTrue);
1070
1.31k
}
1071

1072
/*
1073
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1074
%                                                                             %
1075
%                                                                             %
1076
%                                                                             %
1077
%   S y n c C a c h e V i e w A u t h e n t i c P i x e l s                   %
1078
%                                                                             %
1079
%                                                                             %
1080
%                                                                             %
1081
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1082
%
1083
%  SyncCacheViewAuthenticPixels() saves the cache view pixels to the in-memory
1084
%  or disk cache.  It returns MagickTrue if the pixel region is flushed,
1085
%  otherwise MagickFalse.
1086
%
1087
%  The format of the SyncCacheViewAuthenticPixels method is:
1088
%
1089
%      MagickBooleanType SyncCacheViewAuthenticPixels(CacheView *cache_view,
1090
%        ExceptionInfo *exception)
1091
%
1092
%  A description of each parameter follows:
1093
%
1094
%    o cache_view: the cache view.
1095
%
1096
%    o exception: return any errors or warnings in this structure.
1097
%
1098
*/
1099
MagickExport MagickBooleanType SyncCacheViewAuthenticPixels(
1100
  CacheView *magick_restrict cache_view,ExceptionInfo *exception)
1101
359M
{
1102
359M
  const int
1103
359M
    id = GetOpenMPThreadId();
1104
1105
359M
  MagickBooleanType
1106
359M
    status;
1107
1108
359M
  assert(cache_view != (CacheView *) NULL);
1109
359M
  assert(cache_view->signature == MagickCoreSignature);
1110
359M
  assert(id < (int) cache_view->number_threads);
1111
359M
  status=SyncAuthenticPixelCacheNexus(cache_view->image,
1112
359M
    cache_view->nexus_info[id],exception);
1113
359M
  return(status);
1114
359M
}