--- a/gfxconversion/mifconv/src/mifconv_util.cpp Fri Feb 19 23:21:59 2010 +0200
+++ b/gfxconversion/mifconv/src/mifconv_util.cpp Mon Mar 15 12:42:44 2010 +0200
@@ -37,6 +37,41 @@
MifConvString MifConvUtil::iDebugFile = "";
MifConvString MifConvUtil::iTempDirectory = "";
+int MifConvUtil::ByteWidth(int aPixelWidth,int aBitsPerPixel)
+ {
+ int wordWidth = 0;
+
+ switch (aBitsPerPixel)
+ {
+ case 1:
+ wordWidth = (aPixelWidth + 31) / 32;
+ break;
+ case 2:
+ wordWidth = (aPixelWidth + 15) / 16;
+ break;
+ case 4:
+ wordWidth = (aPixelWidth + 7) / 8;
+ break;
+ case 8:
+ wordWidth = (aPixelWidth + 3) / 4;
+ break;
+ case 12:
+ case 16:
+ wordWidth = (aPixelWidth + 1) / 2;
+ break;
+ case 24:
+ wordWidth = (((aPixelWidth * 3) + 11) / 12) * 3;
+ break;
+ case 32:
+ wordWidth = aPixelWidth;
+ break;
+ default:
+ break;
+ };
+
+ return wordWidth * 4;
+ }
+
/**
*
*/
@@ -353,6 +388,12 @@
{
fixedname[0] = (char) toupper( fixedname[0] );
}
+
+ // Replace spaces (if any) with "_" in source filename.
+ size_t found;
+ while ((found = fixedname.rfind(" ")) != string::npos) {
+ fixedname.replace (found,1,"_");
+ }
}
return fixedname;
}