Kaydet (Commit) 1e3d634e authored tarafından pasqualm's avatar pasqualm Kaydeden (comit) Jacobo Aragunde Pérez

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 3119440a in master.
This commit solves the problem for this code path

Change-Id: I22257e70761ca5469c0424b5f9925681cfd4e2e3
Reviewed-on: https://gerrit.libreoffice.org/22753Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJacobo Aragunde Pérez <jaragunde@igalia.com>
üst 97a0893f
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment