summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorpasqualm <pasqual.milvaques@gmail.com>2015-12-18 01:03:05 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-12-23 16:24:00 +0000
commitc9c979a5adc137df89e50809e0f810464f60894c (patch)
tree541bad0ea0d33d80bb93a8beec1711e33d990a75 /vcl
parent2a27d83ad8b2cab3af86624f58c183f78c2a67b8 (diff)
tdf#90319: make image flipping work in writer for png
Flipping of images was not working if it was only horizontal or vertical, if both options were selected flipping was treated as a 180º rotation and that make it work. Problem only affected png files because this kind of files are treated different from jpg's. Change-Id: Ia0e4a2b16a714cce0b7fb00d6f0a25fb3552d3b8 Reviewed-on: https://gerrit.libreoffice.org/20782 Reviewed-by: Jacobo Aragunde Pérez <jaragunde@igalia.com> Tested-by: Jacobo Aragunde Pérez <jaragunde@igalia.com> (cherry picked from commit 3119440a80282692640378fde5e37974ab63f096) Reviewed-on: https://gerrit.libreoffice.org/20805 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/outdev/bitmap.cxx47
1 files changed, 40 insertions, 7 deletions
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 6225e79356d7..4c125c3768db 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -693,7 +693,10 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r
Rectangle aBmpRect(Point(), rBmp.GetSizePixel());
if (!aBmpRect.Intersection(Rectangle(rSrcPtPixel, rSrcSizePixel)).IsEmpty())
{
- DrawDeviceAlphaBitmapSlowPath(rBmp, rAlpha, aDstRect, aBmpRect, aOutSz, aOutPt);
+ Point auxOutPt(LogicToPixel(rDestPt));
+ Size auxOutSz(LogicToPixel(rDestSize));
+
+ DrawDeviceAlphaBitmapSlowPath(rBmp, rAlpha, aDstRect, aBmpRect, auxOutSz, auxOutPt);
}
}
}
@@ -993,6 +996,7 @@ void OutputDevice::DrawDeviceAlphaBitmapSlowPath(const Bitmap& rBitmap, const Al
else
{
LinearScaleContext aLinearContext(aDstRect, aBmpRect, aOutSize, nOffX, nOffY);
+
if (aLinearContext.blendBitmap( Bitmap::ScopedWriteAccess(aBmp).get(), pBitmapReadAccess.get(), pAlphaReadAccess.get(),
nDstWidth, nDstHeight))
{
@@ -1175,6 +1179,7 @@ void OutputDevice::DrawTransformedBitmapEx(
if ( mnDrawMode & DrawModeFlags::NoBitmap )
return;
+
// decompose matrix to check rotation and shear
basegfx::B2DVector aScale, aTranslate;
double fRotate, fShearX;
@@ -1501,13 +1506,21 @@ Bitmap OutputDevice::BlendBitmap(
for( nY = 0, nOutY = nOffY; nY < nDstHeight; nY++, nOutY++ )
{
- const long nMapY = pMapY[ nY ];
+ long nMapY = pMapY[ nY ];
+ if (bVMirr)
+ {
+ nMapY = aBmpRect.Bottom() - nMapY;
+ }
const long nModY = ( nOutY & 0x0FL ) << 4L;
int nOutX;
for( nX = 0, nOutX = nOffX; nX < nDstWidth; nX++, nOutX++ )
{
- const long nMapX = pMapX[ nX ];
+ long nMapX = pMapX[ nX ];
+ if (bHMirr)
+ {
+ nMapX = aBmpRect.Right() - nMapX;
+ }
const sal_uLong nD = nVCLDitherLut[ nModY | ( nOutX & 0x0FL ) ];
aDstCol = pB->GetColor( nY, nX );
@@ -1548,13 +1561,22 @@ Bitmap OutputDevice::BlendBitmap(
{
for( nY = 0; nY < nDstHeight; nY++ )
{
- const long nMapY = pMapY[ nY ];
+ long nMapY = pMapY[ nY ];
+ if ( bVMirr )
+ {
+ nMapY = aBmpRect.Bottom() - nMapY;
+ }
Scanline pPScan = pP->GetScanline( nMapY );
Scanline pAScan = pA->GetScanline( nMapY );
for( nX = 0; nX < nDstWidth; nX++ )
{
- const long nMapX = pMapX[ nX ];
+ long nMapX = pMapX[ nX ];
+
+ if ( bHMirr )
+ {
+ nMapX = aBmpRect.Right() - nMapX;
+ }
aDstCol = pB->GetPixel( nY, nX );
pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetPaletteColor( pPScan[ nMapX ] ),
pAScan[ nMapX ] ) );
@@ -1565,14 +1587,25 @@ Bitmap OutputDevice::BlendBitmap(
default:
{
+
for( nY = 0; nY < nDstHeight; nY++ )
{
- const long nMapY = pMapY[ nY ];
+ long nMapY = pMapY[ nY ];
+
+ if ( bVMirr )
+ {
+ nMapY = aBmpRect.Bottom() - nMapY;
+ }
Scanline pAScan = pA->GetScanline( nMapY );
for( nX = 0; nX < nDstWidth; nX++ )
{
- const long nMapX = pMapX[ nX ];
+ long nMapX = pMapX[ nX ];
+
+ if ( bHMirr )
+ {
+ nMapX = aBmpRect.Right() - nMapX;
+ }
aDstCol = pB->GetPixel( nY, nX );
pB->SetPixel( nY, nX, aDstCol.Merge( pP->GetColor( nMapY, nMapX ),
pAScan[ nMapX ] ) );