summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpasqualm <pasqual.milvaques@gmail.com>2016-02-29 00:09:02 +0100
committerJacobo Aragunde Pérez <jaragunde@igalia.com>2016-04-06 09:25:42 +0000
commit1e3d634e413abf2b4c2a6c70a87586d8c598054c (patch)
treebb9a75a92d236c5f481a4d83658d2bdc3af5b54e
parent97a0893f1db495830e81a9ff4d073adaa8078d74 (diff)
tdf#90319: make image flipping work when aLinearContext(...) code path chosen
Image flipping can be processed following different code paths in bitmap.cxx. Has been verified that it was broken in Linux Mint (with cinnamon) because there a buggy code path was chosen which was not fixed in commit 3119440a80282692640378fde5e37974ab63f096 in master. This commit solves the problem for this code path Change-Id: I22257e70761ca5469c0424b5f9925681cfd4e2e3 Reviewed-on: https://gerrit.libreoffice.org/22753 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Jacobo Aragunde Pérez <jaragunde@igalia.com>
-rw-r--r--vcl/source/outdev/bitmap.cxx19
1 files changed, 5 insertions, 14 deletions
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index b6e86e3bf699..e0e953f45c85 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -728,37 +728,28 @@ struct LinearScaleContext
const long nSrcWidth = aBitmapRect.GetWidth();
const long nSrcHeight = aBitmapRect.GetHeight();
- const bool bHMirr = aOutSize.Width() < 0;
- const bool bVMirr = aOutSize.Height() < 0;
-
generateSimpleMap(
nSrcWidth, aDstRect.GetWidth(), aBitmapRect.Left(),
- aOutSize.Width(), nOffX, bHMirr, mpMapX.get(), mpMapXOffset.get());
+ aOutSize.Width(), nOffX, mpMapX.get(), mpMapXOffset.get());
generateSimpleMap(
nSrcHeight, aDstRect.GetHeight(), aBitmapRect.Top(),
- aOutSize.Height(), nOffY, bVMirr, mpMapY.get(), mpMapYOffset.get());
+ aOutSize.Height(), nOffY, mpMapY.get(), mpMapYOffset.get());
}
private:
static void generateSimpleMap(long nSrcDimension, long nDstDimension, long nDstLocation,
- long nOutDimention, long nOffset, bool bMirror, long* pMap, long* pMapOffset)
+ long nOutDimention, long nOffset, long* pMap, long* pMapOffset)
{
- long nMirrorOffset = 0;
- if (bMirror)
- nMirrorOffset = (nDstLocation << 1) + nSrcDimension - 1L;
-
- const double fReverseScale = (nOutDimention > 1L) ? (nSrcDimension - 1L) / double(nOutDimention - 1L) : 0.0;
+ const double fReverseScale = (std::abs(nOutDimention) > 1L) ? (nSrcDimension - 1L) / double(std::abs(nOutDimention) - 1L) : 0.0;
long nSampleRange = std::max(0L, nSrcDimension - 2L);
for (long i = 0L; i < nDstDimension; i++)
{
- double fTemp = ((nOffset + i) * fReverseScale);
- if (bMirror)
- fTemp = nMirrorOffset - fTemp - 1L;
+ double fTemp = std::abs((nOffset + i) * fReverseScale);
pMap[i] = MinMax(nDstLocation + long(fTemp), 0, nSampleRange);
pMapOffset[i] = (long) ((fTemp - pMap[i]) * 128.0);