[Libreoffice-commits] core.git: basebmp/source
tsahi glik
tsahi.glik at cloudon.com
Tue Oct 8 12:57:46 PDT 2013
basebmp/source/bitmapdevice.cxx | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
New commits:
commit 91caa3dbe222498bd17b02ab6390187d7553d1d1
Author: tsahi glik <tsahi.glik at cloudon.com>
Date: Mon Oct 7 10:38:24 2013 -0700
Hanlde TopDown -> BottomUp conversion in basebmp DirectCopy logic
Change-Id: Ic6b94e8f01c0151741626f8b50d69597cc401852
Reviewed-on: https://gerrit.libreoffice.org/6155
Reviewed-by: Tor Lillqvist <tml at collabora.com>
Tested-by: Tor Lillqvist <tml at collabora.com>
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 0c8db66..84f5e3c 100644
--- a/basebmp/source/bitmapdevice.cxx
+++ b/basebmp/source/bitmapdevice.cxx
@@ -749,21 +749,33 @@ namespace
char* srcBuf = (char*)rSrcBitmap->getBuffer().get();
sal_Int32 dstStride = getScanlineStride();
sal_Int32 srcStride = rSrcBitmap->getScanlineStride();
- int bytesPerPixel = (bitsPerPixel[getScanlineFormat()] + 7) >> 3; // round up to bytes
+ sal_Int32 bytesPerPixel = (bitsPerPixel[getScanlineFormat()] + 7) >> 3; // round up to bytes
+ bool dstTopDown = isTopDown();
+ bool srcTopDown = rSrcBitmap->isTopDown();
if (dstBuf == srcBuf && nSrcY < nDestY) // reverse copy order to avoid overlapping
{
- dstBuf += dstStride * (getBufferSize().getY() - 1);
- srcBuf += srcStride * (getBufferSize().getY() - 1);
nSrcY = getBufferSize().getY() - nSrcY - nSrcHeight;
nDestY = getBufferSize().getY() - nDestY - nSrcHeight;
+ srcTopDown = !srcTopDown;
+ dstTopDown = !dstTopDown;
+ }
+
+ if (!dstTopDown)
+ {
+ dstBuf += dstStride * (getBufferSize().getY() - 1);
dstStride = -dstStride;
+ }
+
+ if (!srcTopDown)
+ {
+ srcBuf += srcStride * (rSrcBitmap->getBufferSize().getY() - 1);
srcStride = -srcStride;
}
char* dstline = dstBuf + dstStride * nDestY + nDestX * bytesPerPixel;
char* srcline = srcBuf + srcStride * nSrcY + nSrcX * bytesPerPixel;
- int lineBytes = nSrcWidth * bytesPerPixel;
+ sal_Int32 lineBytes = nSrcWidth * bytesPerPixel;
for(; 0 < nSrcHeight; nSrcHeight--)
{
@@ -1916,6 +1928,8 @@ inline sal_uInt32 nextPow2( sal_uInt32 x )
}
+
+
namespace
{
BitmapDeviceSharedPtr createBitmapDeviceImplInner( const basegfx::B2IVector& rSize,
More information about the Libreoffice-commits
mailing list