~ubuntu-branches/ubuntu/trusty/graphicsmagick/trusty-proposed

« back to all changes in this revision

Viewing changes to magick/transform.c

  • Committer: Package Import Robot
  • Author(s): Daniel Kobras
  • Date: 2012-06-11 20:49:01 UTC
  • mfrom: (11.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20120611204901-uv199xjsz0g20vl6
Tags: 1.3.15-1
* New upstream release 1.3.15. Closes: #672982
  + Fixes crash in psiconv. Closes: #611260
* debian/control: Change (Build-)Depends from libpng12-dev to
  libpng-dev. Closes: #662359
* debian/control: Add (Build-)Depends on libjbig-dev. Closes: #669947
* debian/libgraphicsmagick3.symbols: Add symbols from new upstream
  release.
* PerlMagick/MANIFEST, PerlMagick/typemap: Add build fix for Perl 5.16,
  cherry-picked from upstream VCS. Closes: #676265

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
    Extract chop image.
139
139
  */
140
140
#if defined(HAVE_OPENMP)  && !defined(DisableSlowOpenMP)
141
 
#  pragma omp parallel for schedule(dynamic,4) shared(row_count, status)
 
141
#  if defined(TUNE_OPENMP)
 
142
#    pragma omp parallel for schedule(runtime) shared(row_count, status)
 
143
#  else
 
144
#    pragma omp parallel for schedule(static,4) shared(row_count, status)
 
145
#  endif
142
146
#endif
143
147
  for (y=0; y < (long) clone_info.y; y++)
144
148
    {
160
164
      MagickBool
161
165
        thread_status;
162
166
 
 
167
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
 
168
#  pragma omp critical (GM_ChopImage)
 
169
#endif
163
170
      thread_status=status;
164
171
      if (thread_status == MagickFail)
165
172
        continue;
206
213
    Extract chop image.
207
214
  */
208
215
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
209
 
#  pragma omp parallel for schedule(dynamic,4) shared(row_count, status)
 
216
#  if defined(TUNE_OPENMP)
 
217
#    pragma omp parallel for schedule(runtime) shared(row_count, status)
 
218
#  else
 
219
#    pragma omp parallel for schedule(static,4) shared(row_count, status)
 
220
#  endif
210
221
#endif
211
222
  for (y=0; y < (long) (image->rows-(clone_info.y+clone_info.height)); y++)
212
223
    {
228
239
      MagickBool
229
240
        thread_status;
230
241
 
 
242
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
 
243
#  pragma omp critical (GM_ChopImage)
 
244
#endif
231
245
      thread_status=status;
232
246
      if (thread_status == MagickFail)
233
247
        continue;
317
331
  register const Image
318
332
    *next;
319
333
 
 
334
  register long
 
335
    i;
 
336
  
 
337
  MagickBool
 
338
    found_transparency=False;
 
339
 
320
340
  /*
321
341
    Coalesce the image sequence.
322
342
  */
352
372
      }
353
373
      case BackgroundDispose:
354
374
      {
 
375
        /*
 
376
          Fill image with transparent color, if one exists.
 
377
        */
355
378
        coalesce_image->next=CloneImage(coalesce_image,0,0,True,exception);
356
 
        if (coalesce_image->next != (Image *) NULL)
357
 
          (void) SetImage(coalesce_image->next,OpaqueOpacity);
 
379
        if (coalesce_image->next != (Image *) NULL) {
 
380
          for (i = 0; i < (long) coalesce_image->colors; i++) {
 
381
            if (coalesce_image->colormap[i].opacity == TransparentOpacity) {
 
382
              found_transparency = True;
 
383
              (void) SetImageColor(coalesce_image->next,&coalesce_image->colormap[i]);
 
384
              break;
 
385
            }
 
386
          }
 
387
          if (!found_transparency)
 
388
            (void) SetImage(coalesce_image->next,OpaqueOpacity);
 
389
        }
358
390
        break;
359
391
      }
360
392
      case PreviousDispose:
376
408
    (void) CompositeImage(coalesce_image,next->matte ? OverCompositeOp :
377
409
      CopyCompositeOp,next,next->page.x,next->page.y);
378
410
  }
 
411
 
379
412
  while (coalesce_image->previous != (Image *) NULL)
380
413
    coalesce_image=coalesce_image->previous;
381
414
  return(coalesce_image);
504
537
  if ((geometry->width == 0) || (geometry->height == 0))
505
538
    (void) memset(&crop_image->page,0,sizeof(RectangleInfo));
506
539
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
507
 
#  pragma omp parallel for schedule(dynamic,4) shared(row_count, status)
 
540
#  if defined(TUNE_OPENMP)
 
541
#    pragma omp parallel for schedule(runtime) shared(row_count, status)
 
542
#  else
 
543
#    pragma omp parallel for schedule(static,4) shared(row_count, status)
 
544
#  endif
508
545
#endif
509
546
  for (y=0; y < (long) crop_image->rows; y++)
510
547
    {
523
560
      MagickBool
524
561
        thread_status;
525
562
 
 
563
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
 
564
#  pragma omp critical (GM_CropImage)
 
565
#endif
526
566
      thread_status=status;
527
567
      if (thread_status == MagickFail)
528
568
        continue;
775
815
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
776
816
%
777
817
%  Use ExtentImage() to change the image dimensions as specified by geometry
778
 
%  width and hight.  The existing image content is composited at the position
 
818
%  width and height.  The existing image content is composited at the position
779
819
%  specified by geometry x and y using the image compose method.  Existing
780
820
%  image content which falls outside the bounds of the new image dimensions
781
821
%  is discarded.
964
1004
    Flip each row.
965
1005
  */
966
1006
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
967
 
#  pragma omp parallel for schedule(dynamic,4) shared(row_count, status)
 
1007
#  if defined(TUNE_OPENMP)
 
1008
#    pragma omp parallel for schedule(runtime) shared(row_count, status)
 
1009
#  else
 
1010
#    pragma omp parallel for schedule(static,4) shared(row_count, status)
 
1011
#  endif
968
1012
#endif
969
1013
  for (y=0; y < (long) flip_image->rows; y++)
970
1014
    {
983
1027
      MagickBool
984
1028
        thread_status;
985
1029
 
 
1030
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
 
1031
#  pragma omp critical (GM_FlipImage)
 
1032
#endif
986
1033
      thread_status=status;
987
1034
      if (thread_status == MagickFail)
988
1035
        continue;
1083
1130
    Flop each row.
1084
1131
  */
1085
1132
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
1086
 
#  pragma omp parallel for schedule(dynamic,4) shared(row_count, status)
 
1133
#  if defined(TUNE_OPENMP)
 
1134
#    pragma omp parallel for schedule(runtime) shared(row_count, status)
 
1135
#  else
 
1136
#    pragma omp parallel for schedule(static,4) shared(row_count, status)
 
1137
#  endif
1087
1138
#endif
1088
1139
  for (y=0; y < (long) flop_image->rows; y++)
1089
1140
    {
1105
1156
      MagickBool
1106
1157
        thread_status;
1107
1158
 
 
1159
#if defined(HAVE_OPENMP) && !defined(DisableSlowOpenMP)
 
1160
#  pragma omp critical (GM_FlopImage)
 
1161
#endif
1108
1162
      thread_status=status;
1109
1163
      if (thread_status == MagickFail)
1110
1164
        continue;
1195
1249
    *next;
1196
1250
 
1197
1251
  unsigned int
1198
 
    scene,
 
1252
    scene;
 
1253
 
 
1254
  MagickBool
 
1255
    matte;
 
1256
 
 
1257
  MagickPassFail
1199
1258
    status;
1200
1259
 
 
1260
  assert(image != (Image *) NULL);
 
1261
  assert(image->signature == MagickSignature);
 
1262
  assert(exception != (ExceptionInfo *) NULL);
 
1263
  assert(exception->signature == MagickSignature);
 
1264
 
1201
1265
  /*
1202
1266
    Determine mosaic bounding box.
1203
1267
  */
1204
 
  assert(image != (Image *) NULL);
1205
 
  assert(image->signature == MagickSignature);
1206
 
  assert(exception != (ExceptionInfo *) NULL);
1207
 
  assert(exception->signature == MagickSignature);
1208
 
  if (image->next == (Image *) NULL)
1209
 
    ThrowImageException3(ImageError,ImageSequenceIsRequired,
1210
 
      UnableToCreateImageMosaic);
1211
1268
  page.width=image->columns;
1212
1269
  page.height=image->rows;
1213
1270
  page.x=0;
1225
1282
    if (next->page.height > page.height)
1226
1283
      page.height=next->page.height;
1227
1284
  }
 
1285
 
1228
1286
  /*
1229
 
    Allocate mosaic image.
 
1287
    Allocate canvas image.
1230
1288
  */
1231
1289
  mosaic_image=AllocateImage((ImageInfo *) NULL);
1232
1290
  if (mosaic_image == (Image *) NULL)
1233
1291
    return((Image *) NULL);
1234
1292
  mosaic_image->columns=page.width;
1235
1293
  mosaic_image->rows=page.height;
 
1294
 
 
1295
  /*
 
1296
    Canvas image supports transparency if any subordinate image uses
 
1297
    transparency.
 
1298
  */
 
1299
  matte=MagickTrue;
 
1300
  for (next=image; next != (Image *) NULL; next=next->next)
 
1301
    matte &= next->matte;
 
1302
  mosaic_image->matte=matte;
 
1303
 
 
1304
  /*
 
1305
    Canvas color is copied from background color of first image in
 
1306
    list.  Default canvas color is 'white' but opaque 'black' or
 
1307
    'transparent' is often best for composition.
 
1308
  */
 
1309
  mosaic_image->background_color=image->background_color;
1236
1310
  (void) SetImage(mosaic_image,OpaqueOpacity);
 
1311
 
1237
1312
  /*
1238
 
    Initialize colormap.
 
1313
    Composite mosaic.
1239
1314
  */
1240
1315
  scene=0;
1241
1316
  for (next=image; next != (Image *) NULL; next=next->next)
1242
1317
  {
1243
 
    (void) CompositeImage(mosaic_image,CopyCompositeOp,next,next->page.x,
 
1318
    (void) CompositeImage(mosaic_image,next->compose,next,next->page.x,
1244
1319
      next->page.y);
1245
1320
    status=MagickMonitorFormatted(scene++,GetImageListLength(image),
1246
1321
                                  exception,MosaicImageText,image->filename);
1247
 
    if (status == False)
 
1322
    if (status == MagickFail)
1248
1323
      break;
1249
1324
  }
1250
1325
  return(mosaic_image);