From eb1c174f26472478e00aa1ca6486fcb3ce330e83 Mon Sep 17 00:00:00 2001 From: Cédric Bosdonnat Date: Wed, 13 Jun 2012 19:11:53 +0200 Subject: moved createBaseProcessor2DFromOutputDevice to drawinglayer module Change-Id: Ia1c30f93eb20f88d989987265b1ddbc964deb390 --- drawinglayer/Library_drawinglayer.mk | 1 + drawinglayer/Package_inc.mk | 1 + .../processor2d/processorfromoutputdevice.hxx | 66 +++++++++++++ .../processor2d/processorfromoutputdevice.cxx | 105 +++++++++++++++++++++ 4 files changed, 173 insertions(+) create mode 100644 drawinglayer/inc/drawinglayer/processor2d/processorfromoutputdevice.hxx create mode 100644 drawinglayer/source/processor2d/processorfromoutputdevice.cxx (limited to 'drawinglayer') 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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + +#ifndef _PROCESSOR_FROM_OUTPUTDEVICE_HXX +#define _PROCESSOR_FROM_OUTPUTDEVICE_HXX + +#include +#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 + * + * for a copy of the LGPLv3 License. + * + ************************************************************************/ + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +////////////////////////////////////////////////////////////////////////////// + +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: */ -- cgit From fd174268bdea92d966feffbb312c0c3d19de3c5f Mon Sep 17 00:00:00 2001 From: Rafael Dominguez Date: Thu, 28 Jun 2012 09:47:41 -0430 Subject: Remove avmedia dependency from drawinglayer. Change-Id: If5c6bacd77783cc58da7fc31043bb9dd5bc4403d --- drawinglayer/Library_drawinglayer.mk | 5 ++--- .../inc/drawinglayer/primitive2d/mediaprimitive2d.hxx | 6 +++++- drawinglayer/source/primitive2d/mediaprimitive2d.cxx | 14 ++++++-------- 3 files changed, 13 insertions(+), 12 deletions(-) (limited to 'drawinglayer') diff --git a/drawinglayer/Library_drawinglayer.mk b/drawinglayer/Library_drawinglayer.mk index 8995f52ede8d..54f6df81e717 100644 --- a/drawinglayer/Library_drawinglayer.mk +++ b/drawinglayer/Library_drawinglayer.mk @@ -34,7 +34,7 @@ $(eval $(call gb_Library_set_include,drawinglayer,\ )) $(eval $(call gb_Library_add_defs,drawinglayer,\ - -DDRAWINGLAYER_DLLIMPLEMENTATION \ + -DDRAWINGLAYER_DLLIMPLEMENTATION \ )) $(eval $(call gb_Library_use_api,drawinglayer,\ @@ -43,7 +43,6 @@ $(eval $(call gb_Library_use_api,drawinglayer,\ )) $(eval $(call gb_Library_use_libraries,drawinglayer,\ - avmedia \ basegfx \ canvastools \ comphelper \ @@ -158,7 +157,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/processorfromoutputdevice \ drawinglayer/source/processor2d/textaspolygonextractor2d \ drawinglayer/source/processor2d/vclhelperbitmaprender \ drawinglayer/source/processor2d/vclhelperbitmaptransform \ diff --git a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx index bc9dcb9a495e..a0309334d54b 100644 --- a/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx +++ b/drawinglayer/inc/drawinglayer/primitive2d/mediaprimitive2d.hxx @@ -34,6 +34,7 @@ #include #include #include +#include ////////////////////////////////////////////////////////////////////////////// @@ -65,6 +66,8 @@ namespace drawinglayer /// discrete border (in 'pixels') sal_uInt32 mnDiscreteBorder; + const Graphic maSnapshot; + protected: /// local decomposition virtual Primitive2DSequence create2DDecomposition(const geometry::ViewInformation2D& rViewInformation) const; @@ -75,7 +78,8 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, - sal_uInt32 nDiscreteBorder); + sal_uInt32 nDiscreteBorder, + const Graphic &rSnapshot); /// data read access const basegfx::B2DHomMatrix& getTransform() const { return maTransform; } diff --git a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx index 9c59997347de..68daf6e9c678 100644 --- a/drawinglayer/source/primitive2d/mediaprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/mediaprimitive2d.cxx @@ -30,7 +30,6 @@ #include #include #include -#include #include #include #include @@ -57,12 +56,9 @@ namespace drawinglayer getBackgroundColor())); xRetval[0] = xRefBackground; - // try to get graphic snapshot - const Graphic aGraphic(avmedia::MediaWindow::grabFrame(getURL(), true)); - - if(GRAPHIC_BITMAP == aGraphic.GetType() || GRAPHIC_GDIMETAFILE == aGraphic.GetType()) + if(GRAPHIC_BITMAP == maSnapshot.GetType() || GRAPHIC_GDIMETAFILE == maSnapshot.GetType()) { - const GraphicObject aGraphicObject(aGraphic); + const GraphicObject aGraphicObject(maSnapshot); const GraphicAttr aGraphicAttr; xRetval.realloc(2); xRetval[0] = xRefBackground; @@ -110,12 +106,14 @@ namespace drawinglayer const basegfx::B2DHomMatrix& rTransform, const rtl::OUString& rURL, const basegfx::BColor& rBackgroundColor, - sal_uInt32 nDiscreteBorder) + sal_uInt32 nDiscreteBorder, + const Graphic &rSnapshot) : BufferedDecompositionPrimitive2D(), maTransform(rTransform), maURL(rURL), maBackgroundColor(rBackgroundColor), - mnDiscreteBorder(nDiscreteBorder) + mnDiscreteBorder(nDiscreteBorder), + maSnapshot(rSnapshot) { } -- cgit