diff options
author | Armin Le Grand <alg@apache.org> | 2013-01-23 13:27:50 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-14 16:00:13 +0100 |
commit | 9bb96049addebd8907854730713d8a3f5f033e34 (patch) | |
tree | 35d257ff64e579fbcd19767c744e1672704fda79 /drawinglayer/source | |
parent | 39fee18a1142850107b49cf0823cfdb85743aa49 (diff) |
Resolves: #i121534# Reintegrating changes for rotated bitmap support
(cherry picked from commit b2cc0de3fc9adee90787ca760e86869f9255b380)
Conflicts:
canvas/source/vcl/spritecanvashelper.cxx
drawinglayer/Library_drawinglayer.mk
drawinglayer/source/processor2d/vclhelperbitmaprender.cxx
drawinglayer/source/processor2d/vclhelperbitmaprender.hxx
drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx
drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx
drawinglayer/source/processor2d/vclprocessor2d.cxx
officecfg/registry/schema/org/openoffice/Office/Draw.xcs
svx/source/svdraw/svdograf.cxx
vcl/aqua/source/gdi/salgdi.cxx
vcl/inc/aqua/salgdi.h
vcl/inc/os2/salgdi.h
vcl/inc/salgdi.hxx
vcl/inc/unx/pspgraphics.h
vcl/inc/vcl/bitmapex.hxx
vcl/inc/vcl/outdev.hxx
vcl/inc/vcl/salbtype.hxx
vcl/os2/source/gdi/salgdi2.cxx
vcl/source/gdi/bitmapex.cxx
vcl/source/gdi/outdev2.cxx
vcl/source/gdi/salgdilayout.cxx
vcl/source/gdi/salmisc.cxx
vcl/unx/generic/gdi/pspgraphics.cxx
vcl/unx/generic/gdi/salgdi2.cxx
vcl/unx/headless/svpgdi.cxx
vcl/unx/headless/svpgdi.hxx
vcl/unx/headless/svppspgraphics.cxx
vcl/unx/headless/svppspgraphics.hxx
vcl/win/source/gdi/salbmp.cxx
vcl/win/source/gdi/salgdi.cxx
vcl/win/source/gdi/salgdi3.cxx
vcl/win/source/gdi/salgdi_gdiplus.cxx
vcl/win/source/gdi/winlayout.cxx
Change-Id: I871d1d107b019758f3913e5eb63bc9bc0ba403fd
Do not name unused arguments to prevent compiler warnings.
(cherry picked from commit f3118889a0cd941f193e9b6557c0792015d77a34)
Change-Id: I482d1f96d695c7bf9912ec464bb39e7fdd14adef
Related: #i121534# fix graphite-enabled windows build
(cherry picked from commit c90a6ca92b1239d01a2892e15488e4a183a88b1a)
Conflicts:
vcl/win/source/gdi/winlayout.cxx
Change-Id: I95fd41ad6f7187f34ba9474674a471fb4fc65314
Diffstat (limited to 'drawinglayer/source')
5 files changed, 16 insertions, 684 deletions
diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx deleted file mode 100644 index 4e67fa7ba41b..000000000000 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.cxx +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vclhelperbitmaprender.hxx> -#include <basegfx/vector/b2dvector.hxx> -#include <basegfx/matrix/b2dhommatrix.hxx> -#include <basegfx/range/b2drange.hxx> -#include <vcl/outdev.hxx> -#include <vclhelperbitmaptransform.hxx> -#include <basegfx/matrix/b2dhommatrixtools.hxx> -#include <vcl/gdimtf.hxx> - -////////////////////////////////////////////////////////////////////////////// -// support for different kinds of bitmap rendering using vcl - -namespace drawinglayer -{ - void RenderBitmapPrimitive2D_BitmapEx( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform) - { - // only translate and scale, use vcl's DrawBitmapEx(). - BitmapEx aContent(rBitmapEx); - - // prepare dest coor. Necessary to expand since vcl's DrawBitmapEx draws one pix less - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - aOutlineRange.transform(rTransform); - // prepare dest coordinates - const Point aPoint( - basegfx::fround(aOutlineRange.getMinX()), - basegfx::fround(aOutlineRange.getMinY())); - const Size aSize( - basegfx::fround(aOutlineRange.getWidth()), - basegfx::fround(aOutlineRange.getHeight())); - - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - rTransform.decompose(aScale, aTranslate, fRotate, fShearX); - - // Check mirroring. - sal_uInt32 nMirrorFlags(BMP_MIRROR_NONE); - - if(basegfx::fTools::less(aScale.getX(), 0.0)) - { - nMirrorFlags |= BMP_MIRROR_HORZ; - } - - if(basegfx::fTools::less(aScale.getY(), 0.0)) - { - nMirrorFlags |= BMP_MIRROR_VERT; - } - - if(BMP_MIRROR_NONE != nMirrorFlags) - { - aContent.Mirror(nMirrorFlags); - } - - // draw bitmap - if(aSize == aContent.GetSizePixel()) - { - rOutDev.DrawBitmapEx(aPoint, aContent); - } - else - { - rOutDev.DrawBitmapEx(aPoint, aSize, aContent); - } - } - - void RenderBitmapPrimitive2D_self( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform) - { - // process self with free transformation (containing shear and rotate). Get dest rect in pixels. - basegfx::B2DRange aOutlineRange(0.0, 0.0, 1.0, 1.0); - aOutlineRange.transform(rTransform); - const Rectangle aDestRectLogic( - basegfx::fround(aOutlineRange.getMinX()), - basegfx::fround(aOutlineRange.getMinY()), - basegfx::fround(aOutlineRange.getMaxX()), - basegfx::fround(aOutlineRange.getMaxY())); - const Rectangle aDestRectPixel(rOutDev.LogicToPixel(aDestRectLogic)); - - // #i96708# check if Metafile is recorded - const GDIMetaFile* pMetaFile = rOutDev.GetConnectMetaFile(); - const bool bRecordToMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); - - // intersect with output pixel size, but only - // when not recording to metafile - const Rectangle aOutputRectPixel(Point(), rOutDev.GetOutputSizePixel()); - Rectangle aCroppedRectPixel(bRecordToMetaFile ? aDestRectPixel : aDestRectPixel.GetIntersection(aOutputRectPixel)); - - if(!aCroppedRectPixel.IsEmpty()) - { - // as maximum for destination, orientate at aOutputRectPixel, but - // take a rotation of 45 degrees (sqrt(2)) as maximum expansion into account - const Size aSourceSizePixel(rBitmapEx.GetSizePixel()); - const double fMaximumArea( - - // #i121153# With Metafile, aOutputRectPixel may be empty and a virtual - // maximum quadratic size has to be used - bRecordToMetaFile ? 500000.0 : - - (double)aOutputRectPixel.getWidth() * - (double)aOutputRectPixel.getHeight() * - 1.4142136); // 1.4142136 taken as sqrt(2.0) - - // test if discrete view size (pixel) maybe too big and limit it - const double fArea(aCroppedRectPixel.getWidth() * aCroppedRectPixel.getHeight()); - const bool bNeedToReduce(fArea > fMaximumArea); - double fReduceFactor(1.0); - const Size aDestSizePixel(aCroppedRectPixel.GetSize()); - - if(bNeedToReduce) - { - fReduceFactor = sqrt(fMaximumArea / fArea); - aCroppedRectPixel.setWidth(basegfx::fround(aCroppedRectPixel.getWidth() * fReduceFactor)); - aCroppedRectPixel.setHeight(basegfx::fround(aCroppedRectPixel.getHeight() * fReduceFactor)); - } - - // build transform from pixel in aDestination to pixel in rBitmapEx - // from relative in aCroppedRectPixel to relative in aDestRectPixel - // No need to take bNeedToReduce into account, TopLeft is unchanged - basegfx::B2DHomMatrix aTransform(basegfx::tools::createTranslateB2DHomMatrix( - aCroppedRectPixel.Left() - aDestRectPixel.Left(), - aCroppedRectPixel.Top() - aDestRectPixel.Top())); - - // from relative in aDestRectPixel to absolute Logic. Here it - // is essential to adapt to reduce factor (if used) - double fAdaptedDRPWidth((double)aDestRectPixel.getWidth()); - double fAdaptedDRPHeight((double)aDestRectPixel.getHeight()); - - if(bNeedToReduce) - { - fAdaptedDRPWidth *= fReduceFactor; - fAdaptedDRPHeight *= fReduceFactor; - } - - aTransform = basegfx::tools::createScaleTranslateB2DHomMatrix( - aDestRectLogic.getWidth() / fAdaptedDRPWidth, aDestRectLogic.getHeight() / fAdaptedDRPHeight, - aDestRectLogic.Left(), aDestRectLogic.Top()) - * aTransform; - - // from absolute in Logic to unified object coordinates (0.0 .. 1.0 in x and y) - basegfx::B2DHomMatrix aInvBitmapTransform(rTransform); - aInvBitmapTransform.invert(); - aTransform = aInvBitmapTransform * aTransform; - - // from unit object coordinates to rBitmapEx pixel coordintes - aTransform.scale(aSourceSizePixel.getWidth() - 1L, aSourceSizePixel.getHeight() - 1L); - - // create bitmap using source, destination and linear back-transformation - BitmapEx aDestination = impTransformBitmapEx(rBitmapEx, aCroppedRectPixel, aTransform); - - // paint - if(bNeedToReduce) - { - // paint in target size - if(bRecordToMetaFile) - { - rOutDev.DrawBitmapEx( - rOutDev.PixelToLogic(aCroppedRectPixel.TopLeft()), - rOutDev.PixelToLogic(aDestSizePixel), - aDestination); - } - else - { - const bool bWasEnabled(rOutDev.IsMapModeEnabled()); - rOutDev.EnableMapMode(false); - - rOutDev.DrawBitmapEx( - aCroppedRectPixel.TopLeft(), - aDestSizePixel, - aDestination); - - rOutDev.EnableMapMode(bWasEnabled); - } - } - else - { - if(bRecordToMetaFile) - { - rOutDev.DrawBitmapEx( - rOutDev.PixelToLogic(aCroppedRectPixel.TopLeft()), - aDestination); - } - else - { - const bool bWasEnabled(rOutDev.IsMapModeEnabled()); - rOutDev.EnableMapMode(false); - - rOutDev.DrawBitmapEx( - aCroppedRectPixel.TopLeft(), - aDestination); - - rOutDev.EnableMapMode(bWasEnabled); - } - } - } - } -} // end of namespace drawinglayer - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx b/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx deleted file mode 100644 index 3130742745e9..000000000000 --- a/drawinglayer/source/processor2d/vclhelperbitmaprender.hxx +++ /dev/null @@ -1,53 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX -#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX - -#include <sal/types.h> - -////////////////////////////////////////////////////////////////////////////// -// predefines - -class OutputDevice; -class BitmapEx; -namespace basegfx { class B2DHomMatrix; } - -////////////////////////////////////////////////////////////////////////////// -// support methods for vcl direct gradient renderering - -namespace drawinglayer -{ - void RenderBitmapPrimitive2D_BitmapEx( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform); - - void RenderBitmapPrimitive2D_self( - OutputDevice& rOutDev, - const BitmapEx& rBitmapEx, - const basegfx::B2DHomMatrix& rTransform); - -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPRENDER_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx b/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx deleted file mode 100644 index 76ea68df68ae..000000000000 --- a/drawinglayer/source/processor2d/vclhelperbitmaptransform.cxx +++ /dev/null @@ -1,328 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <vclhelperbitmaptransform.hxx> -#include <vcl/bmpacc.hxx> -#include <basegfx/point/b2dpoint.hxx> -#include <basegfx/color/bcolormodifier.hxx> - -////////////////////////////////////////////////////////////////////////////// -// support for rendering Bitmap and BitmapEx contents - -namespace drawinglayer -{ - namespace - { - void impSmoothPoint(BitmapColor& rValue, const basegfx::B2DPoint& rSource, sal_Int32 nIntX, sal_Int32 nIntY, BitmapReadAccess& rRead) - { - double fDeltaX(rSource.getX() - nIntX); - double fDeltaY(rSource.getY() - nIntY); - sal_Int32 nIndX(0L); - sal_Int32 nIndY(0L); - - if(fDeltaX > 0.0 && nIntX + 1L < rRead.Width()) - { - nIndX++; - } - else if(fDeltaX < 0.0 && nIntX >= 1L) - { - fDeltaX = -fDeltaX; - nIndX--; - } - - if(fDeltaY > 0.0 && nIntY + 1L < rRead.Height()) - { - nIndY++; - } - else if(fDeltaY < 0.0 && nIntY >= 1L) - { - fDeltaY = -fDeltaY; - nIndY--; - } - - if(nIndX || nIndY) - { - const double fColorToReal(1.0 / 255.0); - double fR(rValue.GetRed() * fColorToReal); - double fG(rValue.GetGreen() * fColorToReal); - double fB(rValue.GetBlue() * fColorToReal); - double fRBottom(0.0), fGBottom(0.0), fBBottom(0.0); - - if(nIndX) - { - const double fMulA(fDeltaX * fColorToReal); - double fMulB(1.0 - fDeltaX); - const BitmapColor aTopPartner(rRead.GetColor(nIntY, nIntX + nIndX)); - - fR = (fR * fMulB) + (aTopPartner.GetRed() * fMulA); - fG = (fG * fMulB) + (aTopPartner.GetGreen() * fMulA); - fB = (fB * fMulB) + (aTopPartner.GetBlue() * fMulA); - - if(nIndY) - { - fMulB *= fColorToReal; - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - const BitmapColor aBottomPartner(rRead.GetColor(nIntY + nIndY, nIntX + nIndX)); - - fRBottom = (aBottom.GetRed() * fMulB) + (aBottomPartner.GetRed() * fMulA); - fGBottom = (aBottom.GetGreen() * fMulB) + (aBottomPartner.GetGreen() * fMulA); - fBBottom = (aBottom.GetBlue() * fMulB) + (aBottomPartner.GetBlue() * fMulA); - } - } - - if(nIndY) - { - if(!nIndX) - { - const BitmapColor aBottom(rRead.GetColor(nIntY + nIndY, nIntX)); - - fRBottom = aBottom.GetRed() * fColorToReal; - fGBottom = aBottom.GetGreen() * fColorToReal; - fBBottom = aBottom.GetBlue() * fColorToReal; - } - - const double fMulB(1.0 - fDeltaY); - - fR = (fR * fMulB) + (fRBottom * fDeltaY); - fG = (fG * fMulB) + (fGBottom * fDeltaY); - fB = (fB * fMulB) + (fBBottom * fDeltaY); - } - - rValue.SetRed((sal_uInt8)(fR * 255.0)); - rValue.SetGreen((sal_uInt8)(fG * 255.0)); - rValue.SetBlue((sal_uInt8)(fB * 255.0)); - } - } - - Bitmap impTransformBitmap( - const Bitmap& rSource, - const Size aDestinationSize, - const basegfx::B2DHomMatrix& rTransform, - bool bSmooth) - { - Bitmap aDestination(aDestinationSize, 24); - BitmapWriteAccess* pWrite = aDestination.AcquireWriteAccess(); - - if(pWrite) - { - const Size aContentSizePixel(rSource.GetSizePixel()); - BitmapReadAccess* pRead = (const_cast< Bitmap& >(rSource)).AcquireReadAccess(); - - if(pRead) - { - const Size aDestinationSizePixel(aDestination.GetSizePixel()); - bool bWorkWithIndex(rSource.GetBitCount() <= 8); - BitmapColor aOutside(BitmapColor(0xff, 0xff, 0xff)); - - for(sal_Int32 y(0L); y < aDestinationSizePixel.getHeight(); y++) - { - for(sal_Int32 x(0L); x < aDestinationSizePixel.getWidth(); x++) - { - const basegfx::B2DPoint aSourceCoor(rTransform * basegfx::B2DPoint(x, y)); - const sal_Int32 nIntX(basegfx::fround(aSourceCoor.getX())); - - if(nIntX >= 0L && nIntX < aContentSizePixel.getWidth()) - { - const sal_Int32 nIntY(basegfx::fround(aSourceCoor.getY())); - - if(nIntY >= 0L && nIntY < aContentSizePixel.getHeight()) - { - // inside pixel - BitmapColor aValue; - - if(bWorkWithIndex) - { - aValue = pRead->GetPaletteColor(pRead->GetPixelIndex(nIntY, nIntX)); - } - else - { - aValue = pRead->GetPixel(nIntY, nIntX); - } - - if(bSmooth) - { - impSmoothPoint(aValue, aSourceCoor, nIntX, nIntY, *pRead); - } - - pWrite->SetPixel(y, x, aValue); - continue; - } - } - - // here are outside pixels. Complete mask - if(bWorkWithIndex) - { - pWrite->SetPixel(y, x, aOutside); - } - } - } - - delete pRead; - } - - delete pWrite; - } - - rSource.AdaptBitCount(aDestination); - - return aDestination; - } - } // end of anonymous namespace -} // end of namespace drawinglayer - -namespace drawinglayer -{ - BitmapEx impTransformBitmapEx( - const BitmapEx& rSource, - const Rectangle& rCroppedRectPixel, - const basegfx::B2DHomMatrix& rTransform) - { - // force destination to 24 bit, we want to smooth output - const Size aDestinationSize(rCroppedRectPixel.GetSize()); - static bool bDoSmoothAtAll(true); - const Bitmap aDestination(impTransformBitmap(rSource.GetBitmap(), aDestinationSize, rTransform, bDoSmoothAtAll)); - - // create mask - if(rSource.IsTransparent()) - { - if(rSource.IsAlpha()) - { - const Bitmap aAlpha(impTransformBitmap(rSource.GetAlpha().GetBitmap(), aDestinationSize, rTransform, bDoSmoothAtAll)); - return BitmapEx(aDestination, AlphaMask(aAlpha)); - } - else - { - const Bitmap aMask(impTransformBitmap(rSource.GetMask(), aDestinationSize, rTransform, false)); - return BitmapEx(aDestination, aMask); - } - } - - return BitmapEx(aDestination); - } - - BitmapEx impModifyBitmapEx( - const basegfx::BColorModifierStack& rBColorModifierStack, - const BitmapEx& rSource) - { - Bitmap aChangedBitmap(rSource.GetBitmap()); - bool bDone(false); - - for(sal_uInt32 a(rBColorModifierStack.count()); a && !bDone; ) - { - const basegfx::BColorModifier& rModifier = rBColorModifierStack.getBColorModifier(--a); - - switch(rModifier.getMode()) - { - case basegfx::BCOLORMODIFYMODE_REPLACE : - { - // complete replace - if(rSource.IsTransparent()) - { - // clear bitmap with dest color - if(aChangedBitmap.GetBitCount() <= 8) - { - // do NOT use erase; for e.g. 8bit Bitmaps, the nearest color to the given - // erase color is determined and used -> this may be different from what is - // wanted here. Better create a new bitmap with the needed color explicitly - BitmapReadAccess* pReadAccess = aChangedBitmap.AcquireReadAccess(); - OSL_ENSURE(pReadAccess, "Got no Bitmap ReadAccess ?!?"); - - if(pReadAccess) - { - BitmapPalette aNewPalette(pReadAccess->GetPalette()); - aNewPalette[0] = BitmapColor(Color(rModifier.getBColor())); - aChangedBitmap = Bitmap( - aChangedBitmap.GetSizePixel(), - aChangedBitmap.GetBitCount(), - &aNewPalette); - delete pReadAccess; - } - } - else - { - aChangedBitmap.Erase(Color(rModifier.getBColor())); - } - } - else - { - // erase bitmap, caller will know to paint direct - aChangedBitmap.SetEmpty(); - } - - bDone = true; - break; - } - - default : // BCOLORMODIFYMODE_INTERPOLATE, BCOLORMODIFYMODE_GRAY, BCOLORMODIFYMODE_BLACKANDWHITE - { - BitmapWriteAccess* pContent = aChangedBitmap.AcquireWriteAccess(); - - if(pContent) - { - const double fConvertColor(1.0 / 255.0); - - for(sal_uInt32 y(0L); y < (sal_uInt32)pContent->Height(); y++) - { - for(sal_uInt32 x(0L); x < (sal_uInt32)pContent->Width(); x++) - { - const BitmapColor aBMCol(pContent->GetColor(y, x)); - const basegfx::BColor aBSource( - (double)aBMCol.GetRed() * fConvertColor, - (double)aBMCol.GetGreen() * fConvertColor, - (double)aBMCol.GetBlue() * fConvertColor); - const basegfx::BColor aBDest(rModifier.getModifiedColor(aBSource)); - - pContent->SetPixel(y, x, BitmapColor(Color(aBDest))); - } - } - - delete pContent; - } - - break; - } - } - } - - if(aChangedBitmap.IsEmpty()) - { - return BitmapEx(); - } - else - { - if(rSource.IsTransparent()) - { - if(rSource.IsAlpha()) - { - return BitmapEx(aChangedBitmap, rSource.GetAlpha()); - } - else - { - return BitmapEx(aChangedBitmap, rSource.GetMask()); - } - } - else - { - return BitmapEx(aChangedBitmap); - } - } - } -} // end of namespace drawinglayer - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx b/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx deleted file mode 100644 index 5a25eb8edb6b..000000000000 --- a/drawinglayer/source/processor2d/vclhelperbitmaptransform.hxx +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#ifndef INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX -#define INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX - -#include <vcl/bitmapex.hxx> - -////////////////////////////////////////////////////////////////////////////// -// predefines - -namespace basegfx { - class B2DHomMatrix; - class BColorModifierStack; -} - -////////////////////////////////////////////////////////////////////////////// -// support methods for vcl direct gradient renderering - -namespace drawinglayer -{ - BitmapEx impTransformBitmapEx( - const BitmapEx& rSource, - const Rectangle& rCroppedRectPixel, - const basegfx::B2DHomMatrix& rTransform); - - BitmapEx impModifyBitmapEx( - const basegfx::BColorModifierStack& rBColorModifierStack, - const BitmapEx& rSource); -} // end of namespace drawinglayer - -////////////////////////////////////////////////////////////////////////////// - -#endif // INCLUDED_DRAWINGLAYER_PROCESSOR2D_VCLHELPERBITMAPTRANSFORM_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 759454a98400..02b80cc5a851 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -25,9 +25,7 @@ #include <vcl/outdev.hxx> #include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/bitmapprimitive2d.hxx> -#include <vclhelperbitmaptransform.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> -#include <vclhelperbitmaprender.hxx> #include <drawinglayer/attribute/sdrfillgraphicattribute.hxx> #include <drawinglayer/primitive2d/fillgraphicprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> @@ -436,7 +434,7 @@ namespace drawinglayer if(maBColorModifierStack.count()) { - aBitmapEx = impModifyBitmapEx(maBColorModifierStack, aBitmapEx); + aBitmapEx = aBitmapEx.ModifyBitmapEx(maBColorModifierStack); if(aBitmapEx.IsEmpty()) { @@ -453,36 +451,24 @@ namespace drawinglayer } } - { - static bool bForceUseOfOwnTransformer(false); - - // decompose matrix to check for shear, rotate and mirroring - basegfx::B2DVector aScale, aTranslate; - double fRotate, fShearX; - aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX); + // decompose matrix to check for shear, rotate and mirroring + basegfx::B2DVector aScale, aTranslate; + double fRotate, fShearX; - // #i121387# when mirrored and rotated, avoid the GraphicManager output which has low quality - const bool bRotated(!basegfx::fTools::equalZero(fRotate)); - const bool bSheared(!basegfx::fTools::equalZero(fShearX)); - //const bool bMirrored(aScale.getX() < 0.0 || aScale.getY() < 0.0); - // const bool bMirroredAndRotated(bRotated && bMirrored); + aLocalTransform.decompose(aScale, aTranslate, fRotate, fShearX); - if(!bForceUseOfOwnTransformer && !bRotated && !bSheared) // && !bMirrored) - { - RenderBitmapPrimitive2D_BitmapEx(*mpOutputDevice, aBitmapEx, aLocalTransform); - } - else - { - if(!aBitmapEx.IsTransparent() && (bSheared || bRotated)) - { - // parts will be uncovered, extend aBitmapEx with a mask bitmap - const Bitmap aContent(aBitmapEx.GetBitmap()); - aBitmapEx = BitmapEx(aContent, Bitmap(aContent.GetSizePixel(), 1)); - } + const bool bRotated(!basegfx::fTools::equalZero(fRotate)); + const bool bSheared(!basegfx::fTools::equalZero(fShearX)); - RenderBitmapPrimitive2D_self(*mpOutputDevice, aBitmapEx, aLocalTransform); - } + if(!aBitmapEx.IsTransparent() && (bSheared || bRotated)) + { + // parts will be uncovered, extend aBitmapEx with a mask bitmap + const Bitmap aContent(aBitmapEx.GetBitmap()); + aBitmapEx = BitmapEx(aContent, Bitmap(aContent.GetSizePixel(), 1)); } + + // draw using OutputDevice'sDrawTransformedBitmapEx + mpOutputDevice->DrawTransformedBitmapEx(aLocalTransform, aBitmapEx); } void VclProcessor2D::RenderFillGraphicPrimitive2D(const primitive2d::FillGraphicPrimitive2D& rFillBitmapCandidate) @@ -563,7 +549,7 @@ namespace drawinglayer if(maBColorModifierStack.count()) { // when color modifier, apply to bitmap - aBitmapEx = impModifyBitmapEx(maBColorModifierStack, aBitmapEx); + aBitmapEx = aBitmapEx.ModifyBitmapEx(maBColorModifierStack); // impModifyBitmapEx uses empty bitmap as sign to return that // the content will be completely replaced to mono color, use shortcut |