You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by al...@apache.org on 2013/08/28 13:21:45 UTC
svn commit: r1518163 -
/openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
Author: alg
Date: Wed Aug 28 11:21:45 2013
New Revision: 1518163
URL: http://svn.apache.org/r1518163
Log:
adapted to changes from i122923 from r1518160
Modified:
openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
Modified: openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx
URL: http://svn.apache.org/viewvc/openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx?rev=1518163&r1=1518162&r2=1518163&view=diff
==============================================================================
--- openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx (original)
+++ openoffice/branches/alg/sysdepgs/main/vcl/win/source/gdi/salgdi_gdiplus.cxx Wed Aug 28 11:21:45 2013
@@ -278,22 +278,21 @@ Gdiplus::Bitmap* GdiPlusBitmapBufferNode
sal_uInt8* pSrcRGB(pRGB->mpBits);
const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+ const Gdiplus::Rect aAllRect(0, 0, nW, nH);
+ Gdiplus::BitmapData aGdiPlusBitmapData;
+ pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat24bppRGB, &aGdiPlusBitmapData);
+ // copy data to Gdiplus::Bitmap; format is BGR here in both cases, so memcpy is possible
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+ sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
- for(sal_uInt32 x(0); x < nW; x++)
- {
- const sal_uInt8 nB(*pSrcRGB++);
- const sal_uInt8 nG(*pSrcRGB++);
- const sal_uInt8 nR(*pSrcRGB++);
-
- pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nR, nG, nB));
- }
-
- pSrcRGB += nExtraRGB;
+ memcpy(targetPixels, pSrcRGB, nW * 3);
+ pSrcRGB += nW * 3 + nExtraRGB;
}
+
+ pRetval->UnlockBits(&aGdiPlusBitmapData);
}
}
@@ -408,24 +407,30 @@ Gdiplus::Bitmap* GdiPlusBitmapBufferNode
const sal_uInt32 nExtraRGB(pRGB->mnScanlineSize - (nW * 3));
const sal_uInt32 nExtraA(pA->mnScanlineSize - nW);
const bool bTopDown(pRGB->mnFormat & BMP_FORMAT_TOP_DOWN);
+ const Gdiplus::Rect aAllRect(0, 0, nW, nH);
+ Gdiplus::BitmapData aGdiPlusBitmapData;
+ pRetval->LockBits(&aAllRect, Gdiplus::ImageLockModeWrite, PixelFormat32bppARGB, &aGdiPlusBitmapData);
+ // copy data to Gdiplus::Bitmap; format is BGRA; need to mix BGR from Bitmap and
+ // A from alpha, so inner loop is needed (who invented BitmapEx..?)
for(sal_uInt32 y(0); y < nH; y++)
{
const sal_uInt32 nYInsert(bTopDown ? y : nH - y - 1);
+ sal_uInt8* targetPixels = (sal_uInt8*)aGdiPlusBitmapData.Scan0 + (nYInsert * aGdiPlusBitmapData.Stride);
for(sal_uInt32 x(0); x < nW; x++)
{
- const sal_uInt8 nB(*pSrcRGB++);
- const sal_uInt8 nG(*pSrcRGB++);
- const sal_uInt8 nR(*pSrcRGB++);
- const sal_uInt8 nA(0xff - *pSrcA++);
-
- pRetval->SetPixel(x, nYInsert, Gdiplus::Color(nA, nR, nG, nB));
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = *pSrcRGB++;
+ *targetPixels++ = 0xff - *pSrcA++;
}
pSrcRGB += nExtraRGB;
pSrcA += nExtraA;
}
+
+ pRetval->UnlockBits(&aGdiPlusBitmapData);
}
}