diff options
author | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-06-13 19:11:53 +0200 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat.ooo@free.fr> | 2012-06-13 19:11:53 +0200 |
commit | eb1c174f26472478e00aa1ca6486fcb3ce330e83 (patch) | |
tree | 9063acb1716bc5743cc21f89ebdd7c25b64085fc /drawinglayer | |
parent | 8b1f29815022100e853d6c646838e52f83b4d548 (diff) |
moved createBaseProcessor2DFromOutputDevice to drawinglayer module
Change-Id: Ia1c30f93eb20f88d989987265b1ddbc964deb390
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/Library_drawinglayer.mk | 1 | ||||
-rw-r--r-- | drawinglayer/Package_inc.mk | 1 | ||||
-rw-r--r-- | drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx | 66 | ||||
-rw-r--r-- | drawinglayer/source/processor2d/processorfromoutputdevice.cxx | 105 |
4 files changed, 173 insertions, 0 deletions
diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index b59bd12adca8..8995f52ede8d 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -158,6 +158,7 @@ $(eval $(call gb_Library_add_exception_objects,drawinglayer,\ drawinglayer/source/processor2d/helperwrongspellrenderer \ drawinglayer/source/processor2d/hittestprocessor2d \ drawinglayer/source/processor2d/linegeometryextractor2d \ + drawinglayer/source/processor2d/processorfromoutputdevice \ drawinglayer/source/processor2d/textaspolygonextractor2d \ drawinglayer/source/processor2d/vclhelperbitmaprender \ drawinglayer/source/processor2d/vclhelperbitmaptransform \ diff --git a/drawinglayer/Package_inc.mk b/drawinglayer/Package_inc.mk index 246a91f309cd..4cc1d34c530d 100644 --- a/drawinglayer/Package_inc.mk +++ b/drawinglayer/Package_inc.mk @@ -123,6 +123,7 @@ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/ $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/canvasprocessor.hxx,drawinglayer/processor2d/canvasprocessor.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/contourextractor2d.hxx,drawinglayer/processor2d/contourextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/hittestprocessor2d.hxx,drawinglayer/processor2d/hittestprocessor2d.hxx)) +$(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/processorfromoutputdevice.hxx,drawinglayer/processor2d/processorfromoutputdevice.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/linegeometryextractor2d.hxx,drawinglayer/processor2d/linegeometryextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/textaspolygonextractor2d.hxx,drawinglayer/processor2d/textaspolygonextractor2d.hxx)) $(eval $(call gb_Package_add_file,drawinglayer_inc,inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx,drawinglayer/processor2d/vclmetafileprocessor2d.hxx)) diff --git a/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx b/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx new file mode 100644 index 000000000000..d7f208d381b8 --- /dev/null +++ b/drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PROCESSOR_FROM_OUTPUTDEVICE_HXX +#define _PROCESSOR_FROM_OUTPUTDEVICE_HXX + +#include <drawinglayer/geometry/viewinformation2d.hxx> +#include "drawinglayer/drawinglayerdllapi.h" + +////////////////////////////////////////////////////////////////////////////// +// predeclarations + +class OutputDevice; + +namespace drawinglayer { namespace processor2d { + class BaseProcessor2D; +}} + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + // create a mating VCL-Provessor for given OutputDevice. This includes + // looking for MetaFile-recording. The returned renderer changes owner, + // deletion is duty of the caller + DRAWINGLAYER_DLLPUBLIC drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( + OutputDevice& rTargetOutDev, + const drawinglayer::geometry::ViewInformation2D& rViewInformation2D); + + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// + +#endif //_PROCESSOR_FROM_OUTPUTDEVICE_HXX + +// eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/drawinglayer/source/processor2d/processorfromoutputdevice.cxx b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx new file mode 100644 index 000000000000..dcbaf25a31b7 --- /dev/null +++ b/drawinglayer/source/processor2d/processorfromoutputdevice.cxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * This file is part of OpenOffice.org. + * + * OpenOffice.org is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License version 3 + * only, as published by the Free Software Foundation. + * + * OpenOffice.org is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License version 3 for more details + * (a copy is included in the LICENSE file that accompanied this code). + * + * You should have received a copy of the GNU Lesser General Public License + * version 3 along with OpenOffice.org. If not, see + * <http://www.openoffice.org/license.html> + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include <vcl/outdev.hxx> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/range/b2drange.hxx> +#include <vcl/gdimtf.hxx> +#include <basegfx/tools/canvastools.hxx> +#include <drawinglayer/processor2d/processorfromoutputdevice.hxx> +#include <drawinglayer/processor2d/vclmetafileprocessor2d.hxx> +#include <drawinglayer/processor2d/vclpixelprocessor2d.hxx> +#include <drawinglayer/processor2d/canvasprocessor.hxx> +#include <vcl/window.hxx> + +////////////////////////////////////////////////////////////////////////////// + +using namespace com::sun::star; + +////////////////////////////////////////////////////////////////////////////// + +namespace drawinglayer +{ + namespace processor2d + { + drawinglayer::processor2d::BaseProcessor2D* createBaseProcessor2DFromOutputDevice( + 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 drawinglayer::processor2d::VclMetafileProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { +#ifdef WIN32 + // for a first AA incarnation VCL-PixelRenderer will be okay since + // simple (and fast) GDIPlus support over VCL will be used. + // Leaving the code below as a hint for what to do when we will + // use canvas renderers in the future + + //static SvtOptionsDrawinglayer aSvtOptionsDrawinglayer; + + //if(false && aSvtOptionsDrawinglayer.IsAntiAliasing()) + //{ + // // for WIN32 AA, create cairo canvas processor + // return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev); + //} + //else + //{ + // create Pixel Vcl-Processor + return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + //} +#else + static bool bTryTestCanvas(false); + + if(bTryTestCanvas) + { + // create test-cancas-Processor + return new drawinglayer::processor2d::canvasProcessor2D(rViewInformation2D, rTargetOutDev); + } + else + { + // create Pixel Vcl-Processor + return new drawinglayer::processor2d::VclPixelProcessor2D(rViewInformation2D, rTargetOutDev); + } +#endif + } + } + } // end of namespace processor2d +} // end of namespace drawinglayer + +////////////////////////////////////////////////////////////////////////////// +// eof + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |