~cosme/ubuntu/precise/freeimage/freeimage-3.15.1

« back to all changes in this revision

Viewing changes to Source/FreeImage/PluginEXR.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Cosme Domínguez Díaz
  • Date: 2010-07-20 13:42:15 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100720134215-xt1454zaedv3b604
Tags: 3.13.1-0ubuntu1
* New upstream release. Closes: (LP: #607800)
 - Updated debian/freeimage-get-orig-source script.
 - Removing no longer necessary debian/patches/* and
   the patch system in debian/rules.
 - Updated debian/rules to work with the new Makefiles.
 - Drop from -O3 to -O2 and use lzma compression saves
   ~10 MB of free space. 
* lintian stuff
 - fixed debhelper-but-no-misc-depends
 - fixed ldconfig-symlink-missing-for-shlib

Show diffs side-by-side

added added

removed removed

Lines of Context:
279
279
 
280
280
                        // allocate a new dib
281
281
                        dib = FreeImage_AllocateT(image_type, width, height);
282
 
                        if(!dib) THROW (Iex::NullExc, "Not enough memory");
 
282
                        if(!dib) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
283
283
 
284
284
                        BYTE *bits = FreeImage_GetBits(dib);                    // pointer to our pixel buffer
285
285
                        size_t bytespp = sizeof(float) * components;    // size of our pixel in bytes
357
357
                                file.readPixels(dataWindow.min.y, dataWindow.max.y);
358
358
                        }
359
359
 
360
 
                        // check for unused alpha channels
361
 
                        if(components == 4) {
362
 
                                BOOL bIsAlpha = FALSE;
363
 
                                for(unsigned y = 0; y < FreeImage_GetHeight(dib); y++) {
364
 
                                        FIRGBAF *pixel = (FIRGBAF*)FreeImage_GetScanLine(dib, y);
365
 
                                        for(unsigned x = 0; x < FreeImage_GetWidth(dib); x++) {
366
 
                                                if((pixel->alpha != 1) && (pixel->alpha != 0)) {
367
 
                                                        bIsAlpha = TRUE;
368
 
                                                        break;
369
 
                                                }
370
 
                                        }
371
 
                                        if(bIsAlpha) break;
372
 
                                }
373
 
                                if(!bIsAlpha) {
374
 
                                        FIBITMAP *rgbf = FreeImage_ConvertToRGBF(dib);
375
 
                                        FreeImage_Unload(dib);
376
 
                                        dib = rgbf;
377
 
                                }
378
 
                        }
379
 
 
380
360
                        // lastly, flip dib lines
381
361
                        FreeImage_FlipVertical(dib);
382
362
 
564
544
                if(pixelType == Imf::HALF) {
565
545
                        // convert from float to half
566
546
                        halfData = new half[width * height * components];
567
 
                        if(!halfData) THROW (Iex::NullExc, "Not enough memory");
 
547
                        if(!halfData) THROW (Iex::NullExc, FI_MSG_ERROR_MEMORY);
568
548
                        for(int y = 0; y < height; y++) {
569
549
                                float *src_bits = (float*)FreeImage_GetScanLine(dib, height - 1 - y);
570
550
                                half *dst_bits = halfData + y * width * components;