gfxconversion/mifconv/src/mifconv_util.cpp
branchRCL_3
changeset 9 1f6339ced17d
parent 0 f453ebb75370
child 21 3c7c70c864cb
equal deleted inserted replaced
4:23f0e6a5b752 9:1f6339ced17d
    35 
    35 
    36 MifConvUtil::MifConvDebugMode MifConvUtil::iDebugMode = DebugMode_Unknown;
    36 MifConvUtil::MifConvDebugMode MifConvUtil::iDebugMode = DebugMode_Unknown;
    37 MifConvString MifConvUtil::iDebugFile = "";
    37 MifConvString MifConvUtil::iDebugFile = "";
    38 MifConvString MifConvUtil::iTempDirectory = "";
    38 MifConvString MifConvUtil::iTempDirectory = "";
    39 
    39 
       
    40 int MifConvUtil::ByteWidth(int aPixelWidth,int aBitsPerPixel)
       
    41     {
       
    42     int wordWidth = 0;
       
    43 
       
    44     switch (aBitsPerPixel)
       
    45         {
       
    46     case 1:
       
    47         wordWidth = (aPixelWidth + 31) / 32;
       
    48         break;
       
    49     case 2:
       
    50         wordWidth = (aPixelWidth + 15) / 16;
       
    51         break;
       
    52     case 4:
       
    53         wordWidth = (aPixelWidth + 7) / 8;
       
    54         break;
       
    55     case 8:
       
    56         wordWidth = (aPixelWidth + 3) / 4;
       
    57         break;
       
    58     case 12:
       
    59     case 16:
       
    60         wordWidth = (aPixelWidth + 1) / 2;
       
    61         break;
       
    62     case 24:
       
    63         wordWidth = (((aPixelWidth * 3) + 11) / 12) * 3;
       
    64         break;
       
    65     case 32:
       
    66         wordWidth = aPixelWidth;
       
    67         break;
       
    68     default:
       
    69         break;
       
    70         };
       
    71 
       
    72     return wordWidth * 4;
       
    73     }
       
    74 
    40 /**
    75 /**
    41  *
    76  *
    42  */
    77  */
    43 MifConvString MifConvUtil::FileExtension( const MifConvString& fileName )
    78 MifConvString MifConvUtil::FileExtension( const MifConvString& fileName )
    44 {	
    79 {	
   351         fixedname = ToLower(splitted[0]);
   386         fixedname = ToLower(splitted[0]);
   352         if( fixedname.length() > 0 )
   387         if( fixedname.length() > 0 )
   353         {
   388         {
   354             fixedname[0] = (char) toupper( fixedname[0] );
   389             fixedname[0] = (char) toupper( fixedname[0] );
   355         }
   390         }
       
   391         
       
   392         // Replace spaces (if any) with "_" in source filename.
       
   393         size_t found;
       
   394         while ((found = fixedname.rfind(" ")) != string::npos) {
       
   395             fixedname.replace (found,1,"_");
       
   396         }  
   356     }
   397     }
   357     return fixedname;
   398     return fixedname;
   358 }
   399 }
   359 
   400 
   360 /**
   401 /**