- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/tiff/ReaderWriterTIFF.cpp
r12946 r13041 348 348 unsigned short *ptr1 = (unsigned short *)ptr; 349 349 unsigned short *data1 = (unsigned short *)data; 350 350 351 351 while (n--) 352 352 { … … 359 359 float *ptr1 = (float *)ptr; 360 360 float *data1 = (float *)data; 361 361 362 362 while (n--) 363 363 { … … 405 405 unsigned short *green1 = (unsigned short *)green; 406 406 unsigned short *blue1 = (unsigned short *)blue; 407 407 408 408 while (n--) 409 409 { … … 420 420 float *green1 = (float *)green; 421 421 float *blue1 = (float *)blue; 422 422 423 423 while (n--) 424 424 { … … 453 453 unsigned short *blue1 = (unsigned short *)blue; 454 454 unsigned short *alpha1 = (unsigned short *)alpha; 455 455 456 456 while (n--) 457 457 { … … 469 469 float *blue1 = (float *)blue; 470 470 float *alpha1 = (float *)alpha; 471 471 472 472 while (n--) 473 473 { … … 596 596 return NULL; 597 597 } 598 598 599 599 if (TIFFGetField(in, TIFFTAG_IMAGEWIDTH, &w) != 1 || 600 600 TIFFGetField(in, TIFFTAG_IMAGELENGTH, &h) != 1 || … … 606 606 } 607 607 608 608 609 609 TIFFGetField(in, TIFFTAG_DATATYPE, &dataType); 610 610 OSG_INFO<<"TIFFTAG_DATATYPE="<<dataType<<std::endl; … … 621 621 // so set format to 3. 622 622 if (photometric == PHOTOMETRIC_PALETTE) 623 format = 3; 623 format = 3; 624 624 else 625 625 format = samplesperpixel * bitspersample / 8; 626 627 626 627 628 628 int bytespersample = bitspersample / 8; 629 629 int bytesperpixel = bytespersample * samplesperpixel; 630 630 631 631 OSG_INFO<<"format="<<format<<std::endl; 632 632 OSG_INFO<<"bytespersample="<<bytespersample<<std::endl; 633 633 OSG_INFO<<"bytesperpixel="<<bytesperpixel<<std::endl; 634 634 635 635 buffer = new unsigned char [w*h*format]; 636 636 … … 768 768 { 769 769 public: 770 770 771 771 ReaderWriterTIFF() 772 772 { … … 774 774 supportsExtension("tif","Tiff image format"); 775 775 } 776 776 777 777 virtual const char* className() const { return "TIFF Image Reader"; } 778 778 virtual bool acceptsExtension(const std::string& extension) const 779 { 779 { 780 780 if( osgDB::equalCaseInsensitive(extension,"tiff")) return true; 781 781 if( osgDB::equalCaseInsensitive(extension,"tif") ) return true; … … 793 793 imageData = simage_tiff_load(fin, width_ret, height_ret, numComponents_ret, bitspersample_ret); 794 794 795 if (imageData==NULL) 795 if (imageData==NULL) 796 796 { 797 797 char err_msg[256]; 798 simage_tiff_error( err_msg, sizeof(err_msg)); 798 simage_tiff_error( err_msg, sizeof(err_msg)); 799 799 OSG_WARN << err_msg << std::endl; 800 800 return ReadResult::FILE_NOT_HANDLED; … … 814 814 815 815 816 unsigned int dataType = 817 bitspersample_ret == 8 ? GL_UNSIGNED_BYTE : 816 unsigned int dataType = 817 bitspersample_ret == 8 ? GL_UNSIGNED_BYTE : 818 818 bitspersample_ret == 16 ? GL_UNSIGNED_SHORT : 819 819 bitspersample_ret == 32 ? GL_FLOAT : (GLenum)-1; … … 848 848 libtiffStreamMapProc, //Custom map function 849 849 libtiffStreamUnmapProc); //Custom unmap function 850 850 851 851 if(image == NULL) 852 852 { … … 898 898 TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL,samplesPerPixel); 899 899 TIFFSetField(image, TIFFTAG_PHOTOMETRIC, photometric); 900 TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS); 900 TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_PACKBITS); 901 901 TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB); 902 902 TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG); 903 903 904 //uint32 rowsperstrip = TIFFDefaultStripSize(image, -1); 904 //uint32 rowsperstrip = TIFFDefaultStripSize(image, -1); 905 905 //TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, rowsperstrip); 906 906 907 907 // Write the information to the file 908 908 for(int i = 0; i < img.t(); ++i) {
