Show
Ignore:
Timestamp:
03/21/12 18:36:20 (2 years ago)
Author:
robert
Message:

Ran script to remove trailing spaces and tabs

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/src/osgPlugins/imageio/ReaderWriterImageIO_IOS.cpp

    r12683 r13041  
    9999     source_ref = CGImageSourceCreateWithData(the_cf_data, NULL); 
    100100     */ 
    101      
     101 
    102102    CGDataProviderSequentialCallbacks provider_callbacks = 
    103103    { 
     
    108108        MyProviderReleaseInfoCallback 
    109109    }; 
    110      
     110 
    111111    CGDataProviderRef data_provider = CGDataProviderCreateSequential(&fin, &provider_callbacks); 
    112      
     112 
    113113    // If we had a way of hinting at what the data type is, we could 
    114114    // pass this hint in the second parameter. 
    115115    source_ref = CGImageSourceCreateWithDataProvider(data_provider, NULL); 
    116      
     116 
    117117    CGDataProviderRelease(data_provider); 
    118      
    119      
     118 
     119 
    120120    if(!source_ref) 
    121121    { 
    122122        return NULL; 
    123123    } 
    124      
     124 
    125125    image_ref = CGImageSourceCreateImageAtIndex(source_ref, 0, NULL); 
    126      
     126 
    127127    /* Don't need the SourceRef any more (error or not) */ 
    128128    CFRelease(source_ref); 
    129      
     129 
    130130    return image_ref; 
    131131} 
     
    134134{ 
    135135    NSString*  nstr = nil; 
    136      
     136 
    137137    if (!text.empty()) 
    138138    { 
     
    140140        //nstr = [NSString stringWithUTF8String:text.c_str()];// encoding:nsse] 
    141141    } 
    142      
     142 
    143143    if (nstr == nil) 
    144144    { 
    145145        nstr = @""; 
    146146    } 
    147      
     147 
    148148    return nstr; 
    149149} 
     
    167167    //std::string strName = osgDB::getStrippedName(file); 
    168168    //std::string strFile = strPath + "/" + strName; 
    169      
    170     //NSString* path = [NSString stringWithCString:strName.c_str() encoding:NSUTF8StringEncoding];  
    171     //NSString* ext = [NSString stringWithCString:strExt.c_str() encoding:NSUTF8StringEncoding];  
    172      
     169 
     170    //NSString* path = [NSString stringWithCString:strName.c_str() encoding:NSUTF8StringEncoding]; 
     171    //NSString* ext = [NSString stringWithCString:strExt.c_str() encoding:NSUTF8StringEncoding]; 
     172 
    173173    //CGImageRef textureImage = [UIImage imageNamed:path].CGImage; 
    174174    //CGImageRef textureImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:path ofType:ext]].CGImage; 
     
    187187        return NULL; 
    188188    } 
    189          
    190     size_t texWidth = CGImageGetWidth(textureImage);     
     189 
     190    size_t texWidth = CGImageGetWidth(textureImage); 
    191191    size_t texHeight = CGImageGetHeight(textureImage); 
    192192    GLubyte *textureData = (GLubyte *)malloc(texWidth * texHeight * 4); 
     
    205205    } 
    206206 
    207     CGContextRef textureContext = CGBitmapContextCreate(textureData,  
     207    CGContextRef textureContext = CGBitmapContextCreate(textureData, 
    208208                                                        texWidth, texHeight, 
    209209                                                        8, texWidth * 4, 
     
    217217        return NULL; 
    218218    } 
    219      
     219 
    220220    //copy into texturedata 
    221221    CGContextDrawImage(textureContext, 
     
    223223                       textureImage); 
    224224    CGContextRelease(textureContext); 
    225      
     225 
    226226    //create the osg image 
    227227    int s = texWidth; 
     
    234234                    textureData, 
    235235                    osg::Image::USE_MALLOC_FREE); 
    236      
     236 
    237237    //flip vertical 
    238238    image->flipVertical(); 
    239      
    240     //  
     239 
     240    // 
    241241    // Reverse the premultiplied alpha for avoiding unexpected darker edges 
    242242    // by Tatsuhiro Nishioka (based on SDL's workaround on the similar issue) 
    243243    // http://bugzilla.libsdl.org/show_bug.cgi?id=868 
    244     //  
     244    // 
    245245    int i, j; 
    246246    GLubyte *pixels = (GLubyte *)image->data(); 
    247247    for (i = image->t() * image->s(); i--; ) { 
    248          
     248 
    249249        GLubyte alpha = pixels[3]; 
    250250        if (alpha && (alpha < 255)) { 
     
    269269    } 
    270270 
    271     size_t texWidth = CGImageGetWidth(textureImage);     
     271    size_t texWidth = CGImageGetWidth(textureImage); 
    272272    size_t texHeight = CGImageGetHeight(textureImage); 
    273273 
     
    278278        return NULL; 
    279279    } 
    280      
     280 
    281281    CGColorSpaceRef csref = CGColorSpaceCreateDeviceRGB(); 
    282282    if (!csref) { 
     
    287287    } 
    288288 
    289     CGContextRef textureContext = CGBitmapContextCreate(textureData,  
     289    CGContextRef textureContext = CGBitmapContextCreate(textureData, 
    290290                                                        texWidth, texHeight, 
    291291                                                        8, texWidth * 4, 
     
    299299        return NULL; 
    300300    } 
    301      
     301 
    302302    //copy into texturedata 
    303303    CGContextDrawImage(textureContext, 
    304304                       CGRectMake(0.0f, 0.0f, (float)texWidth, (float)texHeight), 
    305305                       textureImage); 
    306     CGContextFlush(textureContext);     
     306    CGContextFlush(textureContext); 
    307307    CGContextRelease(textureContext); 
    308      
    309      
     308 
     309 
    310310    //create the osg image 
    311311    int s = texWidth; 
     
    318318                    textureData, 
    319319                    osg::Image::USE_MALLOC_FREE); 
    320      
     320 
    321321    //flip vertical 
    322322    image->flipVertical(); 
    323      
    324     //  
     323 
     324    // 
    325325    // Reverse the premultiplied alpha for avoiding unexpected darker edges 
    326326    // by Tatsuhiro Nishioka (based on SDL's workaround on the similar issue) 
    327327    // http://bugzilla.libsdl.org/show_bug.cgi?id=868 
    328     //  
    329      
    330      
     328    // 
     329 
     330 
    331331    int i, j; 
    332332    GLubyte *pixels = (GLubyte *)image->data(); 
    333333    for (i = image->t() * image->s(); i--; ) { 
    334          
     334 
    335335        GLubyte alpha = pixels[3]; 
    336336        if (alpha && (alpha < 255)) { 
     
    352352    ReaderWriterImageIO() 
    353353    { 
    354          
    355         supportsExtension("jpg",   "jpg image file");  
     354 
     355        supportsExtension("jpg",   "jpg image file"); 
    356356        supportsExtension("jpeg",  "jpeg image file"); 
    357357        supportsExtension("jpe",   "jpe image file"); 
    358358        supportsExtension("jp2",   "jp2 image file"); 
    359         supportsExtension("tiff",  "tiff image file");  
    360         supportsExtension("tif",   "tif image file");                
     359        supportsExtension("tiff",  "tiff image file"); 
     360        supportsExtension("tif",   "tif image file"); 
    361361        supportsExtension("gif",   "gif image file"); 
    362362        supportsExtension("png",   "png image file"); 
     
    371371        supportsExtension("targa", "targa image file"); 
    372372        supportsExtension("psd",   "psd image file"); 
    373          
     373 
    374374        supportsExtension("pdf",   "pdf image file"); 
    375375        supportsExtension("eps",   "eps image file"); 
     
    378378        supportsExtension("epsi",  "epsi image file"); 
    379379        supportsExtension("ps",    "postscript image file"); 
    380          
     380 
    381381        supportsExtension("dng",   "dng image file"); 
    382382        supportsExtension("cr2",   "cr2 image file"); 
     
    400400        supportsExtension("cur",   "cur image file"); 
    401401        supportsExtension("xbm",   "xbm image file"); 
    402          
     402 
    403403        supportsExtension("raw",   "raw image file"); 
    404404    } 
    405      
     405 
    406406    virtual const char* className() const { return "Mac OS X ImageIO based Image Reader/Writer"; } 
    407      
    408      
     407 
     408 
    409409    virtual bool acceptsExtension(const std::string& extension) const 
    410410    { 
     
    419419        // http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html 
    420420        return 
    421          osgDB::equalCaseInsensitive(extension,"jpg") ||  
     421         osgDB::equalCaseInsensitive(extension,"jpg") || 
    422422         osgDB::equalCaseInsensitive(extension,"jpeg") || 
    423423         osgDB::equalCaseInsensitive(extension,"jpe") || 
    424424         osgDB::equalCaseInsensitive(extension,"jp2") || 
    425          osgDB::equalCaseInsensitive(extension,"tiff") ||  
    426          osgDB::equalCaseInsensitive(extension,"tif") ||                
     425         osgDB::equalCaseInsensitive(extension,"tiff") || 
     426         osgDB::equalCaseInsensitive(extension,"tif") || 
    427427         osgDB::equalCaseInsensitive(extension,"gif") || 
    428428         osgDB::equalCaseInsensitive(extension,"png") || 
     
    437437         osgDB::equalCaseInsensitive(extension,"targa") || 
    438438         osgDB::equalCaseInsensitive(extension,"psd") || 
    439           
     439 
    440440         osgDB::equalCaseInsensitive(extension,"pdf") || 
    441441         osgDB::equalCaseInsensitive(extension,"eps") || 
     
    444444         osgDB::equalCaseInsensitive(extension,"epsi") || 
    445445         osgDB::equalCaseInsensitive(extension,"ps") || 
    446           
     446 
    447447         osgDB::equalCaseInsensitive(extension,"dng") || 
    448448         osgDB::equalCaseInsensitive(extension,"cr2") || 
     
    466466         osgDB::equalCaseInsensitive(extension,"cur") || 
    467467         osgDB::equalCaseInsensitive(extension,"xbm") || 
    468           
     468 
    469469         osgDB::equalCaseInsensitive(extension,"raw"); 
    470470    } 
    471      
    472      
    473      
     471 
     472 
     473 
    474474    ReadResult readImageStream(std::istream& fin) const 
    475475    { 
     
    477477        CGImageRef cg_image_ref = CreateCGImageFromDataStream(fin); 
    478478        if (NULL == cg_image_ref) return ReadResult::FILE_NOT_FOUND; 
    479          
     479 
    480480        // Create an osg::Image from the CGImageRef. 
    481481        osg::Image* osg_image = CreateOSGImageFromCGImage(cg_image_ref); 
    482          
     482 
    483483        CFRelease(cg_image_ref); 
    484484        return osg_image; 
    485485    } 
    486      
     486 
    487487    virtual ReadResult readImage(std::istream& fin, const osgDB::ReaderWriter::Options* the_options = NULL) const 
    488488    { 
     
    490490        return read_result; 
    491491    } 
    492      
     492 
    493493    ReadResult readImageFile(const std::string& file_name) const 
    494494    { 
    495495        //osg::notify(osg::INFO) << "imageio readImageFile: " << file_name << std::endl; 
    496          
     496 
    497497        // Create an osg::Image from the CGImageRef. 
    498498        osg::Image* osg_image = ReadCoreGraphicsImageFromFile(file_name); 
     
    512512        ReadResult read_result = readImageFile(full_file_name); 
    513513#else 
    514         // Only here to help test istream backend. The file version is better because  
     514        // Only here to help test istream backend. The file version is better because 
    515515        // the filenname.extension could potentially be used by ImageIO to hint what the format type is. 
    516516        std::ifstream istream(full_file_name.c_str(), std::ios::in | std::ios::binary); 
     
    531531        WriteResult ret_val = WriteResult::ERROR_IN_WRITING_FILE; 
    532532 
    533         return WriteResult::FILE_SAVED;     
     533        return WriteResult::FILE_SAVED; 
    534534    } 
    535535 
     
    543543    { 
    544544        WriteResult ret_val = WriteResult::ERROR_IN_WRITING_FILE; 
    545          
     545 
    546546        return WriteResult::FILE_SAVED; 
    547547    } 
     
    558558        return writeImageFile(osg_image, full_file_name, the_options); 
    559559#else 
    560         // Only here to help test ostream backend. The file version is better because  
     560        // Only here to help test ostream backend. The file version is better because 
    561561        // the filenname.extension could potentially be used by ImageIO to hint what the format type is. 
    562562        std::ofstream fout(file_name.c_str(), std::ios::out | std::ios::binary); 
    563563        if(!fout) return WriteResult::ERROR_IN_WRITING_FILE; 
    564564        return writeImage(osg_image, fout, the_options); 
    565 #endif         
     565#endif 
    566566    } 
    567567