diff options
author | Armin Le Grand <alg@apache.org> | 2013-01-30 12:10:59 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2013-06-17 09:23:26 +0100 |
commit | d1310b7628a68fe13284818ba4a5d38eaef742c4 (patch) | |
tree | ce32baf72bb637d5dcd68eab7c263a542d1c82ef /drawinglayer | |
parent | a074ee056a8b73fc14724522a5c0d1c34850c529 (diff) |
Related: #i121532# unified processor2d usages from other modules
(cherry picked from commit f371f92c89d296207ef9a219518ba8caa481bcfe)
Conflicts:
drawinglayer/Library_drawinglayer.mk
drawinglayer/Package_inc.mk
drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
drawinglayer/inc/drawinglayer/processor2d/vclpixelprocessor2d.hxx
drawinglayer/inc/drawinglayer/processor2d/vclprocessor2d.hxx
drawinglayer/inc/drawinglayer/processor3d/defaultprocessor3d.hxx
drawinglayer/inc/drawinglayer/processor3d/zbufferprocessor3d.hxx
drawinglayer/source/processor2d/processor2dtools.cxx
svx/Package_inc.mk
svx/source/sdr/contact/objectcontactofobjlistpainter.cxx
svx/source/sdr/contact/objectcontactofpageview.cxx
svx/source/sdr/overlay/overlaymanager.cxx
svx/source/sdr/overlay/overlayprimitive2dsequenceobject.cxx
svx/source/svdraw/svdedxv.cxx
sw/source/core/doc/notxtfrm.cxx
Change-Id: Iea4a79133f4375cb0625b187eeb3d727b50ff0fe
Related: #i121532# missing defaultprocessor3d.hxx breaks build
Revision 1440387 changed defaultprocessor3d.hxx to be no longer "delivered".
It is needed in svx by being included indirectly via cutfindprocessor3d.hxx.
Fixing the build breaker by "delivering" the missing header file again.
(cherry picked from commit 3bd3ea81c8d54109950b435225c3aac011d56c3d)
Conflicts:
drawinglayer/Package_inc.mk
Change-Id: If0dcea79cfff4cf20a1ca1af3d0a34f86eb2e24e
Related: #i121532# removed include to no longer existing file
(cherry picked from commit a4c602d9b5b17e220dbaa4dec2cef91d39945154)
Conflicts:
sw/source/core/doc/notxtfrm.cxx
Change-Id: I7dc2f99684fa285225dfdcfc7add553695b8412e
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/Library_drawinglayer.mk | 1 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/processor2dtools.cxx | 63 | ||||
-rw-r--r-- | drawinglayer/source/tools/converters.cxx | 80 |
3 files changed, 107 insertions, 37 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 308a948dab64..4694cf1c1b28 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -134,6 +134,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/primitive3d/textureprimitive3d \ drawinglayer/source/primitive3d/transformprimitive3d \ drawinglayer/source/processor2d/baseprocessor2d \ + drawinglayer/source/processor2d/processor2dtools \ drawinglayer/source/processor2d/contourextractor2d \ drawinglayer/source/processor2d/getdigitlanguage \ drawinglayer/source/processor2d/helperwrongspellrenderer \ diff --git a/drawinglayer/source/processor2d/processor2dtools.cxx b/drawinglayer/source/processor2d/processor2dtools.cxx new file mode 100644 index 000000000000..041b311d6596 --- /dev/null +++ b/drawinglayer/source/processor2d/processor2dtools.cxx @@ -0,0 +1,63 @@ +/* + * 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 <drawinglayer/processor2d/processor2dtools.hxx> +#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> +#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + BaseProcessor2D* createPixelProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) + { + // create Pixel Vcl-Processor + return new VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + } + + BaseProcessor2D* createProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D) + { + const GDIMetaFile* pMetaFile = rTargetOutDev.GetConnectMetaFile(); + const bool bOutputToRecordingMetaFile(pMetaFile && pMetaFile->IsRecord() && !pMetaFile->IsPause()); + + if(bOutputToRecordingMetaFile) + { + // create MetaFile Vcl-Processor and process + return new VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { + // create Pixel Vcl-Processor + return createPixelProcessor2DFromOutputDevice( + rTargetOutDev, + rViewInformation2D); + } + } + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// diff --git a/drawinglayer/source/tools/converters.cxx b/drawinglayer/source/tools/converters.cxx index 1bbbe43b6359..75712014a02b 100644 --- a/drawinglayer/source/tools/converters.cxx +++ b/drawinglayer/source/tools/converters.cxx @@ -19,10 +19,10 @@ #include <drawinglayer/tools/converters.hxx> #include <drawinglayer/geometry/viewinformation2d.hxx> -#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> #include <drawinglayer/primitive2d/modifiedcolorprimitive2d.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <drawinglayer/primitive2d/transformprimitive2d.hxx> +#include <drawinglayer/processor2d/processor2dtools.hxx> #include <vcl/virdev.hxx> #ifdef DBG_UTIL @@ -36,7 +36,7 @@ namespace drawinglayer { namespace tools { - BitmapEx DRAWINGLAYER_DLLPUBLIC convertToBitmapEx( + BitmapEx convertToBitmapEx( const drawinglayer::primitive2d::Primitive2DSequence& rSeq, const geometry::ViewInformation2D& rViewInformation2D, sal_uInt32 nDiscreteWidth, @@ -81,42 +81,48 @@ namespace drawinglayer maContent.SetBackground(Wallpaper(Color(COL_WHITE))); maContent.Erase(); - // create processor - processor2d::VclPixelProcessor2D aContentProcessor(aViewInformation2D, maContent); + // create pixel processor + processor2d::BaseProcessor2D* pContentProcessor = processor2d::createPixelProcessor2DFromOutputDevice( + maContent, + aViewInformation2D); - // render content - aContentProcessor.process(aSequence); - - // get content - maContent.EnableMapMode(false); - const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); - - // prepare for mask creation - maContent.SetMapMode(aMapModePixel); - maContent.SetAntialiasing(true); - - // set alpha to all white (fully transparent) - maContent.Erase(); - - // embed primitives to paint them black - const primitive2d::Primitive2DReference xRef( - new primitive2d::ModifiedColorPrimitive2D( - aSequence, - basegfx::BColorModifier( - basegfx::BColor(0.0, 0.0, 0.0), - 0.5, - basegfx::BCOLORMODIFYMODE_REPLACE))); - const primitive2d::Primitive2DSequence xSeq(&xRef, 1); - - // render - aContentProcessor.process(xSeq); - - // get alpha cahannel from vdev - maContent.EnableMapMode(false); - const AlphaMask aAlphaMask(maContent.GetBitmap(aEmptyPoint, aSizePixel)); - - // create BitmapEx result - aRetval = BitmapEx(aContent, aAlphaMask); + if(pContentProcessor) + { + // render content + pContentProcessor->process(aSequence); + + // get content + maContent.EnableMapMode(false); + const Bitmap aContent(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + + // prepare for mask creation + maContent.SetMapMode(aMapModePixel); + maContent.SetAntialiasing(true); + + // set alpha to all white (fully transparent) + maContent.Erase(); + + // embed primitives to paint them black + const primitive2d::Primitive2DReference xRef( + new primitive2d::ModifiedColorPrimitive2D( + aSequence, + basegfx::BColorModifier( + basegfx::BColor(0.0, 0.0, 0.0), + 0.5, + basegfx::BCOLORMODIFYMODE_REPLACE))); + const primitive2d::Primitive2DSequence xSeq(&xRef, 1); + + // render + pContentProcessor->process(xSeq); + delete pContentProcessor; + + // get alpha cahannel from vdev + maContent.EnableMapMode(false); + const AlphaMask aAlphaMask(maContent.GetBitmap(aEmptyPoint, aSizePixel)); + + // create BitmapEx result + aRetval = BitmapEx(aContent, aAlphaMask); + } } #ifdef DBG_UTIL |