pyuno/zipcore/python.cxx | 54 ++++++++++++++++---------------------------- vcl/source/gdi/dibtools.cxx | 39 +++++++++++++++---------------- 2 files changed, 39 insertions(+), 54 deletions(-)
New commits: commit fc89249eddd42c5020307757a1e31a87b6302ec1 Author: Jürgen Schmidt <j...@apache.org> Date: Thu Aug 29 11:38:06 2013 +0000 #122864# merge fix from AOO401 branch diff --git a/pyuno/zipcore/python.cxx b/pyuno/zipcore/python.cxx index 04e4ec7..2fb708e 100644 --- a/pyuno/zipcore/python.cxx +++ b/pyuno/zipcore/python.cxx @@ -93,51 +93,46 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { exit(EXIT_FAILURE); } } + wchar_t bootstrap[MY_LENGTH(L"vnd.sun.star.pathname:") + MAX_PATH] = L"vnd.sun.star.pathname:"; //TODO: overflow wchar_t * bootstrapEnd = tools::buildPath( bootstrap + MY_LENGTH(L"vnd.sun.star.pathname:"), path, pathEnd, MY_STRING(L"fundamental.ini")); - if (bootstrapEnd == NULL || - (tools::buildPath(path, path, pathEnd, MY_STRING(L"..\\basis-link")) - == NULL)) + if (bootstrapEnd == NULL) { exit(EXIT_FAILURE); } - pathEnd = tools::resolveLink(path); - wchar_t path1[MAX_PATH]; - wchar_t * path1End = tools::buildPath( - path1, path, pathEnd, MY_STRING(L"\\program")); - if (path1End == NULL) { - exit(EXIT_FAILURE); - } + wchar_t pythonpath2[MAX_PATH]; wchar_t * pythonpath2End = tools::buildPath( pythonpath2, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib")); if (pythonpath2End == NULL) { exit(EXIT_FAILURE); } + wchar_t pythonpath3[MAX_PATH]; wchar_t * pythonpath3End = tools::buildPath( pythonpath3, path, pathEnd, MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\lib\\site-packages")); + L"python-core-" MY_PYVERSION L"\\lib\\site-packages")); if (pythonpath3End == NULL) { exit(EXIT_FAILURE); } + #ifdef __MINGW32__ wchar_t pythonpath4[MAX_PATH]; wchar_t * pythonpath4End = tools::buildPath( pythonpath4, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); if (pythonpath4End == NULL) { exit(EXIT_FAILURE); } wchar_t pythonpath5[MAX_PATH]; wchar_t * pythonpath5End = tools::buildPath( pythonpath5, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); + MY_STRING(L"python-core-" MY_PYVERSION L"\\lib\\lib-dynload")); if (pythonpath5End == NULL) { exit(EXIT_FAILURE); } @@ -145,7 +140,7 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { wchar_t pythonhome[MAX_PATH]; wchar_t * pythonhomeEnd = tools::buildPath( pythonhome, path, pathEnd, - MY_STRING(L"\\program\\python-core-" MY_PYVERSION)); + MY_STRING(L"python-core-" MY_PYVERSION)); if (pythonhomeEnd == NULL) { exit(EXIT_FAILURE); } @@ -154,26 +149,15 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { pythonexe, path, pathEnd, #ifdef __MINGW32__ MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.bin")); + L"python-core-" MY_PYVERSION L"\\bin\\python.bin")); #else MY_STRING( - L"\\program\\python-core-" MY_PYVERSION L"\\bin\\python.exe")); + L"python-core-" MY_PYVERSION L"\\bin\\python.exe")); #endif if (pythonexeEnd == NULL) { exit(EXIT_FAILURE); } - if (tools::buildPath(path, path, pathEnd, MY_STRING(L"\\ure-link")) == NULL) - { - exit(EXIT_FAILURE); - } - pathEnd = tools::resolveLink(path); - if (pathEnd == NULL) { - exit(EXIT_FAILURE); - } - pathEnd = tools::buildPath(path, path, pathEnd, MY_STRING(L"\\bin")); - if (pathEnd == NULL) { - exit(EXIT_FAILURE); - } + std::size_t clSize = MY_LENGTH(L"\"") + 4 * (pythonexeEnd - pythonexe) + MY_LENGTH(L"\"\0"); //TODO: overflow // 4 * len: each char preceded by backslash, each trailing backslash @@ -221,9 +205,11 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { } } wchar_t * value = new wchar_t[ - (pathEnd - path) + MY_LENGTH(L";") + (path1End - path1) + - (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow - wsprintfW(value, L"%s;%s%s%s", path, path1, n == 0 ? L"" : L";", orig); + (pathEnd - path) + MY_LENGTH(L";") + + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow + + wsprintfW(value, L"%s%s%s", path, n == 0 ? L"" : L";", orig); + if (!SetEnvironmentVariableW(L"PATH", value)) { exit(EXIT_FAILURE); } @@ -258,11 +244,11 @@ int wmain(int argc, wchar_t ** argv, wchar_t **) { n == 0 ? L"" : L";", orig); #else value = new wchar_t[ - (path1End - path1) + MY_LENGTH(L";") + (pythonpath2End - pythonpath2) + + (pythonpath2End - pythonpath2) + MY_LENGTH(L";") + (pythonpath3End - pythonpath3) + (n == 0 ? 0 : MY_LENGTH(L";") + (n - 1)) + 1]; //TODO: overflow wsprintfW( - value, L"%s;%s;%s%s%s", path1, pythonpath2, pythonpath3, + value, L"%s;%s%s%s", pythonpath2, pythonpath3, n == 0 ? L"" : L";", orig); #endif if (!SetEnvironmentVariableW(L"PYTHONPATH", value)) { commit 95212768770c2206b18e9fb929a79fae24f4a6d8 Author: Armin Le Grand <a...@apache.org> Date: Thu Aug 29 11:25:32 2013 +0000 i122920 Corrected some minor aspects of DIB clipboard exchange format diff --git a/vcl/source/gdi/dibtools.cxx b/vcl/source/gdi/dibtools.cxx index 8e2c0e5..bdfce54 100755 --- a/vcl/source/gdi/dibtools.cxx +++ b/vcl/source/gdi/dibtools.cxx @@ -388,12 +388,12 @@ void ImplDecodeRLE( sal_uInt8* pBuffer, DIBV5Header& rHeader, BitmapWriteAccess& while ( !bEndDecoding && ( nY >= 0L ) ); } -bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown) +bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& rAcc, BitmapWriteAccess* pAccAlpha, bool bTopDown, bool& rAlphaUsed) { const sal_uLong nAlignedWidth = AlignedWidth4Bytes(rHeader.nWidth * rHeader.nBitCount); - sal_uInt32 nRMask(0); - sal_uInt32 nGMask(0); - sal_uInt32 nBMask(0); + sal_uInt32 nRMask(( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL); + sal_uInt32 nGMask(( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL); + sal_uInt32 nBMask(( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL); bool bNative(false); bool bTCMask(!pAccAlpha && ((16 == rHeader.nBitCount) || (32 == rHeader.nBitCount))); bool bRLE((RLE_8 == rHeader.nCompression && 8 == rHeader.nBitCount) || (RLE_4 == rHeader.nCompression && 4 == rHeader.nBitCount)); @@ -430,21 +430,12 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r else { // Read color mask - if(bTCMask) + if(bTCMask && BITFIELDS == rHeader.nCompression) { - if(BITFIELDS == rHeader.nCompression) - { - rIStm.SeekRel( -12L ); - rIStm >> nRMask; - rIStm >> nGMask; - rIStm >> nBMask; - } - else - { - nRMask = ( rHeader.nBitCount == 16 ) ? 0x00007c00UL : 0x00ff0000UL; - nGMask = ( rHeader.nBitCount == 16 ) ? 0x000003e0UL : 0x0000ff00UL; - nBMask = ( rHeader.nBitCount == 16 ) ? 0x0000001fUL : 0x000000ffUL; - } + rIStm.SeekRel( -12L ); + rIStm >> nRMask; + rIStm >> nGMask; + rIStm >> nBMask; } if(bRLE) @@ -601,6 +592,7 @@ bool ImplReadDIBBits(SvStream& rIStm, DIBV5Header& rHeader, BitmapWriteAccess& r aMask.GetColorAndAlphaFor32Bit( aColor, aAlpha, (sal_uInt8*) pTmp32++ ); rAcc.SetPixel( nY, nX, aColor ); pAccAlpha->SetPixelIndex(nY, nX, sal_uInt8(0xff) - aAlpha); + rAlphaUsed |= bool(0xff != aAlpha); } } } @@ -725,6 +717,8 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon } // read bits + bool bAlphaUsed(false); + if(!pIStm->GetError()) { if(nOffset) @@ -732,7 +726,7 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon pIStm->SeekRel(nOffset - (pIStm->Tell() - nStmPos)); } - bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown); + bRet = ImplReadDIBBits(*pIStm, aHeader, *pAcc, pAccAlpha, bTopDown, bAlphaUsed); if(bRet && aHeader.nXPelsPerMeter && aHeader.nYPelsPerMeter) { @@ -758,6 +752,11 @@ bool ImplReadDIBBody( SvStream& rIStm, Bitmap& rBmp, Bitmap* pBmpAlpha, sal_uLon if(bAlphaPossible) { aNewBmpAlpha.ReleaseAccess(pAccAlpha); + + if(!bAlphaUsed) + { + bAlphaPossible = false; + } } if(bRet) @@ -1240,7 +1239,7 @@ bool ImplWriteDIBBody(const Bitmap& rBitmap, SvStream& rOStm, BitmapReadAccess& if(pAccAlpha) // only write DIBV5 when asked to do so { aHeader.nV5CSType = 0x57696E20; // LCS_WINDOWS_COLOR_SPACE - aHeader.nV5Intent = 0x00000008; // LCS_GM_ABS_COLORIMETRIC + aHeader.nV5Intent = 0x00000004; // LCS_GM_IMAGES rOStm << aHeader.nV5RedMask; rOStm << aHeader.nV5GreenMask;
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits