~ubuntu-branches/ubuntu/quantal/imagemagick/quantal

« back to all changes in this revision

Viewing changes to coders/pdb.c

  • Committer: Bazaar Package Importer
  • Author(s): Muharem Hrnjadovic
  • Date: 2009-06-04 13:01:13 UTC
  • mfrom: (1.1.5 upstream) (6.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090604130113-my9114jxmafpwew3
Tags: 7:6.5.1.0-1.1ubuntu1
* Merge from debian unstable, remaining changes:
  - (Build-)depend on libltdl7-dev instead of libltdl3-dev (the armel buildds
    currently have both available).
  - Don't build-dep on librsvg, it brings in excessive dependencies

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
%                                 July 1992                                   %
18
18
%                                                                             %
19
19
%                                                                             %
20
 
%  Copyright 1999-2008 ImageMagick Studio LLC, a non-profit organization      %
 
20
%  Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization      %
21
21
%  dedicated to making software imaging solutions freely available.           %
22
22
%                                                                             %
23
23
%  You may not use this file except in compliance with the License.  You may  %
49
49
#include "magick/studio.h"
50
50
#include "magick/blob.h"
51
51
#include "magick/blob-private.h"
 
52
#include "magick/cache.h"
52
53
#include "magick/color-private.h"
53
54
#include "magick/colorspace.h"
54
55
#include "magick/constitute.h"
394
395
      (void) CloseBlob(image);
395
396
      return(GetFirstImageInList(image));
396
397
    }
397
 
  if (SetImageExtent(image,0,0) == MagickFalse)
398
 
    {
399
 
      InheritException(exception,&image->exception);
400
 
      return(DestroyImageList(image));
401
 
    }
402
398
  packets=bits_per_pixel*image->columns/8;
403
399
  pixels=(unsigned char *) AcquireQuantumMemory(packets+256UL,image->rows*
404
400
    sizeof(*pixels));
437
433
      */
438
434
      for (y=0; y < (long) image->rows; y++)
439
435
      {
440
 
        q=SetImagePixels(image,0,y,image->columns,1);
 
436
        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
441
437
        if (q == (PixelPacket *) NULL)
442
438
          break;
443
 
        indexes=GetIndexes(image);
 
439
        indexes=GetAuthenticIndexQueue(image);
444
440
        for (x=0; x < ((long) image->columns-7); x+=8)
445
441
        {
446
442
          for (bit=0; bit < 8; bit++)
451
447
          }
452
448
          p++;
453
449
        }
454
 
        if (SyncImagePixels(image) == MagickFalse)
 
450
        if (SyncAuthenticPixels(image,exception) == MagickFalse)
455
451
          break;
456
452
        status=SetImageProgress(image,LoadImageTag,y,image->rows);
457
453
        if (status == MagickFalse)
466
462
      */
467
463
      for (y=0; y < (long) image->rows; y++)
468
464
      {
469
 
        q=SetImagePixels(image,0,y,image->columns,1);
 
465
        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
470
466
        if (q == (PixelPacket *) NULL)
471
467
          break;
472
 
        indexes=GetIndexes(image);
 
468
        indexes=GetAuthenticIndexQueue(image);
473
469
        for (x=0; x < (long) image->columns; x+=4)
474
470
        {
475
471
          index=ConstrainColormapIndex(image,3UL-((*p >> 6) & 0x03));
486
482
          *q++=image->colormap[(long) index];
487
483
          p++;
488
484
        }
489
 
        if (SyncImagePixels(image) == MagickFalse)
 
485
        if (SyncAuthenticPixels(image,exception) == MagickFalse)
490
486
          break;
491
487
        status=SetImageProgress(image,LoadImageTag,y,image->rows);
492
488
        if (status == MagickFalse)
501
497
      */
502
498
      for (y=0; y < (long) image->rows; y++)
503
499
      {
504
 
        q=SetImagePixels(image,0,y,image->columns,1);
 
500
        q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
505
501
        if (q == (PixelPacket *) NULL)
506
502
          break;
507
 
        indexes=GetIndexes(image);
 
503
        indexes=GetAuthenticIndexQueue(image);
508
504
        for (x=0; x < (long) image->columns; x+=2)
509
505
        {
510
506
          index=ConstrainColormapIndex(image,15UL-((*p >> 4) & 0x0f));
515
511
          *q++=image->colormap[(long) index];
516
512
          p++;
517
513
        }
518
 
        if (SyncImagePixels(image) == MagickFalse)
 
514
        if (SyncAuthenticPixels(image,exception) == MagickFalse)
519
515
          break;
520
516
        status=SetImageProgress(image,LoadImageTag,y,image->rows);
521
517
        if (status == MagickFalse)
704
700
    pdb_info;
705
701
 
706
702
  QuantumInfo
707
 
    quantum_info;
 
703
    *quantum_info;
708
704
 
709
705
  register const PixelPacket
710
706
    *p;
816
812
    sizeof(*scanline));
817
813
  if (scanline == (unsigned char *) NULL)
818
814
    ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
819
 
    if (image->colorspace != RGBColorspace)
 
815
  if (image->colorspace != RGBColorspace)
820
816
    (void) SetImageColorspace(image,RGBColorspace);
821
817
  /*
822
818
    Convert to GRAY raster scanline.
823
819
  */
824
 
  GetQuantumInfo(image_info,&quantum_info);
 
820
  quantum_info=AcquireQuantumInfo(image_info,image);
 
821
  if (quantum_info == (QuantumInfo *) NULL)
 
822
    ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
825
823
  bits=8/(long) bits_per_pixel-1;  /* start at most significant bits */
826
824
  literal=0;
827
825
  repeat=0;
829
827
  buffer[0]=0x00;
830
828
  for (y=0; y < (long) image->rows; y++)
831
829
  {
832
 
    p=AcquireImagePixels(image,0,y,image->columns,1,&image->exception);
 
830
    p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
833
831
    if (p == (const PixelPacket *) NULL)
834
832
      break;
835
 
    (void) ExportQuantumPixels(image,&quantum_info,GrayQuantum,scanline);
 
833
    (void) ExportQuantumPixels(image,(const ViewInfo *) NULL,quantum_info,
 
834
      GrayQuantum,scanline,&image->exception);
836
835
    for (x=0; x < pdb_image.width; x++)
837
836
    {
838
837
      if (x < (long) image->columns)
887
886
  q=EncodeRLE(q,buffer,literal,repeat);
888
887
  scanline=(unsigned char *) RelinquishMagickMemory(scanline);
889
888
  buffer=(unsigned char *) RelinquishMagickMemory(buffer);
 
889
  quantum_info=DestroyQuantumInfo(quantum_info);
890
890
  /*
891
891
    Write the Image record header.
892
892
  */