summaryrefslogtreecommitdiff
path: root/basebmp
diff options
context:
space:
mode:
authortsahi glik <tsahi.glik@cloudon.com>2013-10-07 10:38:24 -0700
committerTor Lillqvist <tml@collabora.com>2013-10-08 19:57:25 +0000
commit91caa3dbe222498bd17b02ab6390187d7553d1d1 (patch)
treed3f71fd3dcb9e06dac58c4b9cd18574541f91b65 /basebmp
parent3786609a153b7fa38393eb646557d241af2d3060 (diff)
Hanlde TopDown -> BottomUp conversion in basebmp DirectCopy logic
Change-Id: Ic6b94e8f01c0151741626f8b50d69597cc401852 Reviewed-on: https://gerrit.libreoffice.org/6155 Reviewed-by: Tor Lillqvist <tml@collabora.com> Tested-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'basebmp')
-rw-r--r--basebmp/source/bitmapdevice.cxx22
1 files changed, 18 insertions, 4 deletions
diff --git a/basebmp/source/bitmapdevice.cxx b/basebmp/source/bitmapdevice.cxx
index 0c8db660d15d..84f5e3c9dff8 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,