summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2020-02-10 11:37:26 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-02-12 11:57:19 +0100
commit7435040a18eb866be0fa77e71c6b4c626f1ae897 (patch)
tree7de6c3e1f02d3bb67cb41a197ed2124861213151 /canvas
parented3d1f3e1368f81e928cc1ecc4c127a3d540d96e (diff)
move some canvas/ headers inside the module
Change-Id: Iaa00cff88ad756b7e084cc68fe744d387328180b Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88360 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/IwyuFilter_canvas.yaml8
-rw-r--r--canvas/Library_cairocanvas.mk5
-rw-r--r--canvas/Library_canvasfactory.mk5
-rw-r--r--canvas/Library_canvastools.mk5
-rw-r--r--canvas/Library_directx9canvas.mk5
-rw-r--r--canvas/Library_gdipluscanvas.mk5
-rw-r--r--canvas/Library_oglcanvas.mk5
-rw-r--r--canvas/Library_simplecanvas.mk5
-rw-r--r--canvas/Library_vclcanvas.mk5
-rw-r--r--canvas/StaticLibrary_directxcanvas.mk5
-rw-r--r--canvas/inc/base/basemutexhelper.hxx63
-rw-r--r--canvas/inc/base/bitmapcanvasbase.hxx125
-rw-r--r--canvas/inc/base/bufferedgraphicdevicebase.hxx258
-rw-r--r--canvas/inc/base/cachedprimitivebase.hxx104
-rw-r--r--canvas/inc/base/canvasbase.hxx451
-rw-r--r--canvas/inc/base/canvascustomspritebase.hxx264
-rw-r--r--canvas/inc/base/canvascustomspritehelper.hxx217
-rw-r--r--canvas/inc/base/disambiguationhelper.hxx79
-rw-r--r--canvas/inc/base/graphicdevicebase.hxx348
-rw-r--r--canvas/inc/base/integerbitmapbase.hxx109
-rw-r--r--canvas/inc/base/sprite.hxx110
-rw-r--r--canvas/inc/base/spritecanvasbase.hxx190
-rw-r--r--canvas/inc/base/spritesurface.hxx67
-rw-r--r--canvas/inc/parametricpolypolygon.hxx152
-rw-r--r--canvas/inc/propertysethelper.hxx143
-rw-r--r--canvas/inc/rendering/icolorbuffer.hxx77
-rw-r--r--canvas/inc/rendering/irendermodule.hxx133
-rw-r--r--canvas/inc/rendering/isurface.hxx69
-rw-r--r--canvas/inc/rendering/isurfaceproxy.hxx98
-rw-r--r--canvas/inc/rendering/isurfaceproxymanager.hxx66
-rw-r--r--canvas/inc/spriteredrawmanager.hxx406
-rw-r--r--canvas/inc/vclwrapper.hxx150
-rw-r--r--canvas/inc/verifyinput.hxx575
-rw-r--r--canvas/source/cairo/cairo_cachedbitmap.hxx2
-rw-r--r--canvas/source/cairo/cairo_canvas.hxx8
-rw-r--r--canvas/source/cairo/cairo_canvasbitmap.hxx6
-rw-r--r--canvas/source/cairo/cairo_canvascustomsprite.hxx4
-rw-r--r--canvas/source/cairo/cairo_canvasfont.hxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper.cxx2
-rw-r--r--canvas/source/cairo/cairo_canvashelper_text.cxx2
-rw-r--r--canvas/source/cairo/cairo_sprite.hxx2
-rw-r--r--canvas/source/cairo/cairo_spritecanvas.hxx8
-rw-r--r--canvas/source/cairo/cairo_spritecanvashelper.hxx2
-rw-r--r--canvas/source/cairo/cairo_spritehelper.hxx2
-rw-r--r--canvas/source/directx/dx_9rm.cxx6
-rw-r--r--canvas/source/directx/dx_canvas.hxx10
-rw-r--r--canvas/source/directx/dx_canvasbitmap.hxx6
-rw-r--r--canvas/source/directx/dx_canvascustomsprite.hxx4
-rw-r--r--canvas/source/directx/dx_canvashelper_texturefill.cxx2
-rw-r--r--canvas/source/directx/dx_devicehelper.hxx2
-rw-r--r--canvas/source/directx/dx_impltools.cxx2
-rw-r--r--canvas/source/directx/dx_rendermodule.hxx2
-rw-r--r--canvas/source/directx/dx_sprite.hxx2
-rw-r--r--canvas/source/directx/dx_spritecanvas.hxx8
-rw-r--r--canvas/source/directx/dx_spritecanvashelper.hxx6
-rw-r--r--canvas/source/directx/dx_spritedevicehelper.hxx2
-rw-r--r--canvas/source/directx/dx_spritehelper.hxx2
-rw-r--r--canvas/source/directx/dx_surfacebitmap.cxx2
-rw-r--r--canvas/source/directx/dx_surfacebitmap.hxx4
-rw-r--r--canvas/source/opengl/ogl_canvasbitmap.hxx6
-rw-r--r--canvas/source/opengl/ogl_canvascustomsprite.cxx2
-rw-r--r--canvas/source/opengl/ogl_canvascustomsprite.hxx2
-rw-r--r--canvas/source/opengl/ogl_spritecanvas.hxx6
-rw-r--r--canvas/source/tools/cachedprimitivebase.cxx2
-rw-r--r--canvas/source/tools/canvascustomspritehelper.cxx2
-rw-r--r--canvas/source/tools/page.hxx6
-rw-r--r--canvas/source/tools/pagemanager.hxx2
-rw-r--r--canvas/source/tools/parametricpolypolygon.cxx2
-rw-r--r--canvas/source/tools/propertysethelper.cxx2
-rw-r--r--canvas/source/tools/spriteredrawmanager.cxx2
-rw-r--r--canvas/source/tools/surface.hxx2
-rw-r--r--canvas/source/tools/surfaceproxy.hxx4
-rw-r--r--canvas/source/tools/surfaceproxymanager.cxx4
-rw-r--r--canvas/source/tools/verifyinput.cxx2
-rw-r--r--canvas/source/vcl/bitmapbackbuffer.hxx2
-rw-r--r--canvas/source/vcl/cachedbitmap.hxx2
-rw-r--r--canvas/source/vcl/canvas.hxx8
-rw-r--r--canvas/source/vcl/canvasbitmap.hxx6
-rw-r--r--canvas/source/vcl/canvascustomsprite.hxx6
-rw-r--r--canvas/source/vcl/canvasfont.hxx2
-rw-r--r--canvas/source/vcl/canvashelper_texturefill.cxx2
-rw-r--r--canvas/source/vcl/sprite.hxx2
-rw-r--r--canvas/source/vcl/spritecanvas.hxx8
-rw-r--r--canvas/source/vcl/spritecanvashelper.hxx2
-rw-r--r--canvas/source/vcl/spritehelper.hxx6
85 files changed, 4403 insertions, 96 deletions
diff --git a/canvas/IwyuFilter_canvas.yaml b/canvas/IwyuFilter_canvas.yaml
index 25b2157683a7..d6ac656ed485 100644
--- a/canvas/IwyuFilter_canvas.yaml
+++ b/canvas/IwyuFilter_canvas.yaml
@@ -1,6 +1,14 @@
---
assumeFilename: canvas/source/cairo/cairo_canvas.cxx
blacklist:
+ canvas/inc/parametricpolypolygon.hxx:
+ # base class has to be a complete type
+ - com/sun/star/lang/XServiceInfo.hpp
+ - com/sun/star/rendering/XParametricPolyPolygon2D.hpp
+ canvas/inc/base/cachedprimitivebase.hxx:
+ # base class has to be a complete type
+ - com/sun/star/rendering/XCachedPrimitive.hpp
+ - com/sun/star/lang/XServiceInfo.hpp
canvas/source/cairo/cairo_cachedbitmap.cxx:
# Actually in use
- com/sun/star/rendering/XCanvas.hpp
diff --git a/canvas/Library_cairocanvas.mk b/canvas/Library_cairocanvas.mk
index 782638018b29..9acc74fad625 100644
--- a/canvas/Library_cairocanvas.mk
+++ b/canvas/Library_cairocanvas.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,cairocanvas))
+$(eval $(call gb_Library_set_include,cairocanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,cairocanvas,canvas/source/cairo/cairocanvas))
$(eval $(call gb_Library_use_sdk_api,cairocanvas))
diff --git a/canvas/Library_canvasfactory.mk b/canvas/Library_canvasfactory.mk
index 17e3565bfe65..81a38c4f69b3 100644
--- a/canvas/Library_canvasfactory.mk
+++ b/canvas/Library_canvasfactory.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,canvasfactory))
+$(eval $(call gb_Library_set_include,canvasfactory,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,canvasfactory,canvas/source/factory/canvasfactory))
$(eval $(call gb_Library_use_external,canvasfactory,boost_headers))
diff --git a/canvas/Library_canvastools.mk b/canvas/Library_canvastools.mk
index a87e53fd1043..90d67dfc543a 100644
--- a/canvas/Library_canvastools.mk
+++ b/canvas/Library_canvastools.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,canvastools))
+$(eval $(call gb_Library_set_include,canvastools,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_use_sdk_api,canvastools))
$(eval $(call gb_Library_add_defs,canvastools,\
diff --git a/canvas/Library_directx9canvas.mk b/canvas/Library_directx9canvas.mk
index 2503c139fd2d..738999f8246e 100644
--- a/canvas/Library_directx9canvas.mk
+++ b/canvas/Library_directx9canvas.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,directx9canvas))
+$(eval $(call gb_Library_set_include,directx9canvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,directx9canvas,canvas/source/directx/directx9canvas))
$(eval $(call gb_Library_use_sdk_api,directx9canvas))
diff --git a/canvas/Library_gdipluscanvas.mk b/canvas/Library_gdipluscanvas.mk
index 4a23f6b060f6..80adf6f44d18 100644
--- a/canvas/Library_gdipluscanvas.mk
+++ b/canvas/Library_gdipluscanvas.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,gdipluscanvas))
+$(eval $(call gb_Library_set_include,gdipluscanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,gdipluscanvas,canvas/source/directx/gdipluscanvas))
$(eval $(call gb_Library_use_external,gdipluscanvas,boost_headers))
diff --git a/canvas/Library_oglcanvas.mk b/canvas/Library_oglcanvas.mk
index 979ff6b5d1ea..20dbb7a80bed 100644
--- a/canvas/Library_oglcanvas.mk
+++ b/canvas/Library_oglcanvas.mk
@@ -9,6 +9,11 @@
$(eval $(call gb_Library_Library,oglcanvas))
+$(eval $(call gb_Library_set_include,oglcanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,oglcanvas,canvas/source/opengl/oglcanvas))
$(eval $(call gb_Library_use_sdk_api,oglcanvas))
diff --git a/canvas/Library_simplecanvas.mk b/canvas/Library_simplecanvas.mk
index db4898c72070..4e9006b35de5 100644
--- a/canvas/Library_simplecanvas.mk
+++ b/canvas/Library_simplecanvas.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,simplecanvas))
+$(eval $(call gb_Library_set_include,simplecanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,simplecanvas,canvas/source/simplecanvas/simplecanvas))
$(eval $(call gb_Library_use_external,simplecanvas,boost_headers))
diff --git a/canvas/Library_vclcanvas.mk b/canvas/Library_vclcanvas.mk
index 6ff19eba6130..40e5de9eb61d 100644
--- a/canvas/Library_vclcanvas.mk
+++ b/canvas/Library_vclcanvas.mk
@@ -19,6 +19,11 @@
$(eval $(call gb_Library_Library,vclcanvas))
+$(eval $(call gb_Library_set_include,vclcanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_Library_set_componentfile,vclcanvas,canvas/source/vcl/vclcanvas))
$(eval $(call gb_Library_use_externals,vclcanvas,\
diff --git a/canvas/StaticLibrary_directxcanvas.mk b/canvas/StaticLibrary_directxcanvas.mk
index 8b14d0bbbe9d..c7f475248a5e 100644
--- a/canvas/StaticLibrary_directxcanvas.mk
+++ b/canvas/StaticLibrary_directxcanvas.mk
@@ -10,6 +10,11 @@
$(eval $(call gb_StaticLibrary_StaticLibrary,directxcanvas))
+$(eval $(call gb_StaticLibrary_set_include,directxcanvas,\
+ $$(INCLUDE) \
+ -I$(SRCDIR)/canvas/inc \
+))
+
$(eval $(call gb_StaticLibrary_use_external,directxcanvas,boost_headers))
$(eval $(call gb_StaticLibrary_use_api,directxcanvas,\
diff --git a/canvas/inc/base/basemutexhelper.hxx b/canvas/inc/base/basemutexhelper.hxx
new file mode 100644
index 000000000000..eba03cd9ae01
--- /dev/null
+++ b/canvas/inc/base/basemutexhelper.hxx
@@ -0,0 +1,63 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <sal/config.h>
+
+#include <osl/mutex.hxx>
+
+/* Definition of the BaseMutexHelper class */
+
+namespace canvas
+{
+ /** Base class, initializing its own baseclass with m_aMutex.
+
+ This is necessary to make the CanvasBase, GraphicDeviceBase,
+ etc. classes freely combinable - letting them perform this
+ initialization would prohibit deriving e.g. CanvasBase from
+ GraphicDeviceBase.
+ */
+ template< class Base > class BaseMutexHelper : public Base
+ {
+ protected:
+ /** Construct BaseMutexHelper
+
+ This method is the whole purpose of this template:
+ initializing a base class with the provided m_aMutex
+ member (the WeakComponentImplHelper templates need that,
+ as they require the lifetime of the mutex to extend
+ theirs).
+ */
+ BaseMutexHelper() :
+ Base( m_aMutex )
+ {
+ }
+
+ virtual void disposeThis() {}
+
+ mutable osl::Mutex m_aMutex;
+
+ private:
+ virtual void SAL_CALL disposing() override
+ { disposeThis(); }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/bitmapcanvasbase.hxx b/canvas/inc/base/bitmapcanvasbase.hxx
new file mode 100644
index 000000000000..efbf58f55902
--- /dev/null
+++ b/canvas/inc/base/bitmapcanvasbase.hxx
@@ -0,0 +1,125 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <base/canvasbase.hxx>
+#include <com/sun/star/geometry/IntegerSize2D.hpp>
+
+namespace com::sun::star::rendering { class XBitmapCanvas; }
+
+namespace canvas
+{
+ /** Helper template to handle XBitmapCanvas method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XBitmapCanvas part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XBitmapCanvas should be among them (why
+ else would you use this template, then?). Base class must have
+ a Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ BaseMutex-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=css::uno::XInterface > class BitmapCanvasBase :
+ public CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType;
+
+ // XBitmap
+ virtual css::geometry::IntegerSize2D SAL_CALL getSize( ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getSize();
+ }
+
+ virtual sal_Bool SAL_CALL hasAlpha( ) override
+ {
+ return true;
+ }
+
+ virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL getScaledBitmap( const css::geometry::RealSize2D& newSize,
+ sal_Bool beFast ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast );
+ }
+
+ };
+
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase = css::uno::XInterface > class BitmapCanvasBase2 :
+ public BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ {
+ typedef BitmapCanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase >
+ BaseType;
+
+ public:
+ // XBitmapCanvas
+ virtual void SAL_CALL copyRect( const css::uno::Reference< css::rendering::XBitmapCanvas >& sourceCanvas,
+ const css::geometry::RealRectangle2D& sourceRect,
+ const css::rendering::ViewState& sourceViewState,
+ const css::rendering::RenderState& sourceRenderState,
+ const css::geometry::RealRectangle2D& destRect,
+ const css::rendering::ViewState& destViewState,
+ const css::rendering::RenderState& destRenderState ) override
+ {
+ tools::verifyArgs(sourceCanvas, sourceRect, sourceViewState, sourceRenderState,
+ destRect, destViewState, destRenderState,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ BaseType::BaseType::mbSurfaceDirty = true;
+ }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/bufferedgraphicdevicebase.hxx b/canvas/inc/base/bufferedgraphicdevicebase.hxx
new file mode 100644
index 000000000000..067d37a984f0
--- /dev/null
+++ b/canvas/inc/base/bufferedgraphicdevicebase.hxx
@@ -0,0 +1,258 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/awt/XWindow2.hpp>
+
+#include <canvas/canvastools.hxx>
+#include <base/graphicdevicebase.hxx>
+
+namespace com::sun::star::awt { class XTopWindow; }
+
+
+/* Definition of BufferedGraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations
+ on windows.
+
+ Use this base class if your target device is a
+ window. Additionally to GraphicDeviceBase, this template
+ provides an implementation of the awt::XWindowListener
+ interface, to receive notifications about state changes of the
+ associated window.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ BaseMutex-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase = css::uno::XInterface > class BufferedGraphicDeviceBase :
+ public GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase >
+ {
+ public:
+ typedef GraphicDeviceBase< Base, DeviceHelper, Mutex, UnambiguousBase > BaseType;
+ typedef Mutex MutexType;
+
+ BufferedGraphicDeviceBase() :
+ mxWindow(),
+ maBounds(),
+ mbIsVisible( false ),
+ mbIsTopLevel( false )
+ {
+ BaseType::maPropHelper.addProperties(
+ PropertySetHelper::MakeMap("Window",
+ [this] () { return this->getXWindow(); }));
+ }
+
+ // XGraphicDevice
+ virtual css::uno::Reference< css::rendering::XBufferController > SAL_CALL getBufferController( ) override
+ {
+ return this;
+ }
+
+ // XBufferController
+ virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) override
+ {
+ tools::verifyRange( nBuffers, sal_Int32(1) );
+
+ return 1;
+ }
+
+ virtual void SAL_CALL destroyBuffers( ) override
+ {
+ }
+
+ virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.showBuffer( mbIsVisible, bUpdateAll );
+ }
+
+ virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maDeviceHelper.switchBuffer( mbIsVisible, bUpdateAll );
+ }
+
+
+ /** Set corresponding canvas window
+
+ Use this method to set the window this canvas displays
+ on. Comes in handy when the canvas needs to adapt size or
+ output position to the changing window.
+
+ Whenever the bounds of the window change, <code>void
+ notifySizeUpdate( const awt::Rectangle& rBounds )</code>
+ is called, with rBounds the window bound rect relative to
+ the frame window.
+ */
+ void setWindow( const css::uno::Reference< css::awt::XWindow2 >& rWindow )
+ {
+ if( mxWindow.is() )
+ mxWindow->removeWindowListener( this );
+
+ mxWindow = rWindow;
+
+ if( mxWindow.is() )
+ {
+ mbIsVisible = mxWindow->isVisible();
+ mbIsTopLevel =
+ css::uno::Reference< css::awt::XTopWindow >(
+ mxWindow,
+ css::uno::UNO_QUERY ).is();
+
+ maBounds = transformBounds( mxWindow->getPosSize() );
+ mxWindow->addWindowListener( this );
+ }
+ }
+
+ css::uno::Any getXWindow() const
+ {
+ return css::uno::makeAny(mxWindow);
+ }
+
+ virtual void disposeThis() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( mxWindow.is() )
+ {
+ mxWindow->removeWindowListener(this);
+ mxWindow.clear();
+ }
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ css::awt::Rectangle transformBounds( const css::awt::Rectangle& rBounds )
+ {
+ // notifySizeUpdate's bounds are relative to the toplevel
+ // window
+ if( !mbIsTopLevel )
+ return tools::getAbsoluteWindowRect(
+ rBounds,
+ mxWindow );
+ else
+ return css::awt::Rectangle( 0,0,rBounds.Width,rBounds.Height );
+ }
+
+ void boundsChanged( const css::awt::WindowEvent& e )
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ const css::awt::Rectangle& rNewBounds(
+ transformBounds( css::awt::Rectangle( e.X,
+ e.Y,
+ e.Width,
+ e.Height )));
+
+ if( rNewBounds.X != maBounds.X ||
+ rNewBounds.Y != maBounds.Y ||
+ rNewBounds.Width != maBounds.Width ||
+ rNewBounds.Height != maBounds.Height )
+ {
+ maBounds = rNewBounds;
+ BaseType::maDeviceHelper.notifySizeUpdate( maBounds );
+ }
+ }
+
+ // XWindowListener
+ virtual void disposeEventSource( const css::lang::EventObject& Source ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ if( Source.Source == mxWindow )
+ mxWindow.clear();
+
+ BaseType::disposeEventSource(Source);
+ }
+
+ virtual void SAL_CALL windowResized( const css::awt::WindowEvent& e ) override
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowMoved( const css::awt::WindowEvent& e ) override
+ {
+ boundsChanged( e );
+ }
+
+ virtual void SAL_CALL windowShown( const css::lang::EventObject& ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = true;
+ }
+
+ virtual void SAL_CALL windowHidden( const css::lang::EventObject& ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ mbIsVisible = false;
+ }
+
+ protected:
+ css::uno::Reference< css::awt::XWindow2 > mxWindow;
+
+ /// Current bounds of the owning Window
+ css::awt::Rectangle maBounds;
+
+ /// True, if the window this canvas is contained in, is visible
+ bool mbIsVisible;
+
+ private:
+ /// True, if the window this canvas is contained in, is a toplevel window
+ bool mbIsTopLevel;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/cachedprimitivebase.hxx b/canvas/inc/base/cachedprimitivebase.hxx
new file mode 100644
index 000000000000..ffdee6ee26f7
--- /dev/null
+++ b/canvas/inc/base/cachedprimitivebase.hxx
@@ -0,0 +1,104 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XCachedPrimitive.hpp>
+#include <com/sun/star/rendering/ViewState.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com::sun::star::rendering { class XCanvas; }
+
+/* Definition of CachedPrimitiveBase class */
+
+namespace canvas
+{
+ typedef cppu::WeakComponentImplHelper< css::rendering::XCachedPrimitive,
+ css::lang::XServiceInfo > CachedPrimitiveBase_Base;
+
+ /** Base class, providing common functionality for implementers of
+ the XCachedPrimitive interface.
+ */
+ class CANVASTOOLS_DLLPUBLIC CachedPrimitiveBase:
+ public cppu::BaseMutex, public CachedPrimitiveBase_Base
+ {
+ public:
+
+ /** Create an XCachedPrimitive for given target canvas
+
+ @param rUsedViewState
+ The viewstate the original object was rendered with
+
+ @param rTarget
+ The target canvas the repaint should happen on.
+ */
+ CachedPrimitiveBase( const css::rendering::ViewState& rUsedViewState,
+ const css::uno::Reference< css::rendering::XCanvas >& rTarget );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing() override;
+
+ // XCachedPrimitive
+ virtual ::sal_Int8 SAL_CALL redraw( const css::rendering::ViewState& aState ) override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ protected:
+ virtual ~CachedPrimitiveBase() override; // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ private:
+ CachedPrimitiveBase( const CachedPrimitiveBase& ) = delete;
+ CachedPrimitiveBase& operator=( const CachedPrimitiveBase& ) = delete;
+
+ /** Actually perform the requested redraw.
+
+ Clients must override this method, instead of the public
+ redraw() one.
+
+ @param rNewState
+ The viewstate to redraw with
+
+ @param rOldState
+ The viewstate this cache object was created with.
+
+ @param rTargetCanvas
+ Target canvas to render to.
+
+ @param bSameViewTransform
+ When true, rNewState and rOldState have the same transformation.
+ */
+ virtual ::sal_Int8 doRedraw( const css::rendering::ViewState& rNewState,
+ const css::rendering::ViewState& rOldState,
+ const css::uno::Reference< css::rendering::XCanvas >& rTargetCanvas,
+ bool bSameViewTransform ) = 0;
+
+ css::rendering::ViewState maUsedViewState;
+ css::uno::Reference< css::rendering::XCanvas > mxTarget;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/canvasbase.hxx b/canvas/inc/base/canvasbase.hxx
new file mode 100644
index 000000000000..323460a10946
--- /dev/null
+++ b/canvas/inc/base/canvasbase.hxx
@@ -0,0 +1,451 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/Sequence.hxx>
+#include <com/sun/star/rendering/TextDirection.hpp>
+#include <osl/diagnose.h>
+#include <osl/mutex.hxx>
+#include <verifyinput.hxx>
+
+namespace com::sun::star::beans { struct PropertyValue; }
+namespace com::sun::star::geometry { class XMapping2D; }
+namespace com::sun::star::rendering { class XBitmap; }
+namespace com::sun::star::rendering { class XCachedPrimitive; }
+namespace com::sun::star::rendering { class XCanvasFont; }
+namespace com::sun::star::rendering { class XGraphicDevice; }
+namespace com::sun::star::rendering { class XPolyPolygon2D; }
+namespace com::sun::star::rendering { class XTextLayout; }
+namespace com::sun::star::rendering { struct FontInfo; }
+namespace com::sun::star::rendering { struct StringContext; }
+
+
+namespace canvas
+{
+ /** Helper template to handle XCanvas method forwarding to CanvasHelper
+
+ Use this helper to handle the XCanvas part of your
+ implementation. In theory, we could have provided CanvasHelper
+ and CanvasBase as a single template, but that would duplicate
+ a lot of code now residing in CanvasHelper only.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XCanvas. The
+ problem with UNO partial interface implementation actually is,
+ that you cannot do it the plain way, since deriving from a
+ common base subclass always introduces the whole set of pure
+ virtuals, that your baseclass helper just overridden) and your
+ implementation class. You then only have to implement the
+ functionality <em>besides</em> XCanvas.
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper < css::rendering::XSpriteCanvas,
+ css::lang::XInitialization,
+ css::lang::XServiceInfo,
+ css::lang::XServiceName > CanvasBase_Base;
+ typedef ::canvas::internal::CanvasBase< CanvasBase_Base, CanvasHelper > ExampleCanvas_Base;
+
+ class ExampleCanvas : public ExampleCanvas_Base,
+ public SpriteSurface,
+ public RepaintTarget
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably the
+ WeakComponentImplHelper template with the appropriate
+ interfaces. At least XCanvas should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelper template has). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XCanvas API calls. Furthermore,
+ every time the canvas API semantically changes the content of
+ the canvas, CanvasHelper::modifying() will get called
+ (<em>before</em> the actual modification takes place).
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ BaseMutex-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=css::uno::XInterface > class CanvasBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+
+ /** Create CanvasBase
+ */
+ CanvasBase() :
+ maCanvasHelper(),
+ mbSurfaceDirty( true )
+ {
+ }
+
+ virtual void disposeThis() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maCanvasHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas
+ virtual void SAL_CALL clear() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ maCanvasHelper.clear();
+ }
+
+ virtual void SAL_CALL drawPoint(const css::geometry::RealPoint2D& aPoint,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState) override
+ {
+ tools::verifyArgs(aPoint, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+ }
+
+ virtual void SAL_CALL drawLine(const css::geometry::RealPoint2D& aStartPoint,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState) override
+ {
+ tools::verifyArgs(aStartPoint, aEndPoint, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ maCanvasHelper.drawLine( this, aStartPoint, aEndPoint, viewState, renderState );
+ }
+
+ virtual void SAL_CALL drawBezier( const css::geometry::RealBezierSegment2D& aBezierSegment,
+ const css::geometry::RealPoint2D& aEndPoint,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState ) override
+ {
+ tools::verifyArgs(aBezierSegment, aEndPoint, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ maCanvasHelper.drawBezier( this, aBezierSegment, aEndPoint, viewState, renderState );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawPolyPolygon(const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.drawPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ strokePolyPolygon(const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::rendering::StrokeAttributes& strokeAttributes) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.strokePolyPolygon( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ strokeTexturedPolyPolygon( const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::uno::Sequence< css::rendering::Texture >& textures,
+ const css::rendering::StrokeAttributes& strokeAttributes ) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.strokeTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, strokeAttributes );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ strokeTextureMappedPolyPolygon( const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::uno::Sequence< css::rendering::Texture >& textures,
+ const css::uno::Reference< css::geometry::XMapping2D >& xMapping,
+ const css::rendering::StrokeAttributes& strokeAttributes ) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.strokeTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping, strokeAttributes );
+ }
+
+ virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL
+ queryStrokeShapes( const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::rendering::StrokeAttributes& strokeAttributes ) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, strokeAttributes,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.queryStrokeShapes( this, xPolyPolygon, viewState, renderState, strokeAttributes );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ fillPolyPolygon(const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.fillPolyPolygon( this, xPolyPolygon, viewState, renderState );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ fillTexturedPolyPolygon(const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::uno::Sequence< css::rendering::Texture >& textures) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.fillTexturedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ fillTextureMappedPolyPolygon( const css::uno::Reference< css::rendering::XPolyPolygon2D >& xPolyPolygon,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ const css::uno::Sequence< css::rendering::Texture >& textures,
+ const css::uno::Reference< css::geometry::XMapping2D >& xMapping ) override
+ {
+ tools::verifyArgs(xPolyPolygon, viewState, renderState, textures, xMapping,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.fillTextureMappedPolyPolygon( this, xPolyPolygon, viewState, renderState, textures, xMapping );
+ }
+
+
+ virtual css::uno::Reference< css::rendering::XCanvasFont > SAL_CALL
+ createFont( const css::rendering::FontRequest& fontRequest,
+ const css::uno::Sequence< css::beans::PropertyValue >& extraFontProperties,
+ const css::geometry::Matrix2D& fontMatrix ) override
+ {
+ tools::verifyArgs(fontRequest,
+ // dummy, to keep argPos in sync
+ fontRequest,
+ fontMatrix,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.createFont( this, fontRequest, extraFontProperties, fontMatrix );
+ }
+
+
+ virtual css::uno::Sequence< css::rendering::FontInfo > SAL_CALL
+ queryAvailableFonts( const css::rendering::FontInfo& aFilter,
+ const css::uno::Sequence< css::beans::PropertyValue >& aFontProperties ) override
+ {
+ tools::verifyArgs(aFilter,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.queryAvailableFonts( this, aFilter, aFontProperties );
+ }
+
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawText(const css::rendering::StringContext& text,
+ const css::uno::Reference< css::rendering::XCanvasFont >& xFont,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState,
+ sal_Int8 textDirection) override
+ {
+ tools::verifyArgs(xFont, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+ tools::verifyRange( textDirection,
+ css::rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
+ css::rendering::TextDirection::STRONG_RIGHT_TO_LEFT );
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.drawText( this, text, xFont, viewState, renderState, textDirection );
+ }
+
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawTextLayout(const css::uno::Reference< css::rendering::XTextLayout >& laidOutText,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState) override
+ {
+ tools::verifyArgs(laidOutText, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.drawTextLayout( this, laidOutText, viewState, renderState );
+ }
+
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState ) override
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.drawBitmap( this, xBitmap, viewState, renderState );
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmapModulated( const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState ) override
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ mbSurfaceDirty = true;
+
+ return maCanvasHelper.drawBitmapModulated( this, xBitmap, viewState, renderState );
+ }
+
+ virtual css::uno::Reference< css::rendering::XGraphicDevice > SAL_CALL
+ getDevice() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maCanvasHelper.getDevice();
+ }
+
+ protected:
+ ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ CanvasHelper maCanvasHelper;
+ mutable bool mbSurfaceDirty;
+
+ private:
+ CanvasBase( const CanvasBase& ) = delete;
+ CanvasBase& operator=( const CanvasBase& ) = delete;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/canvascustomspritebase.hxx b/canvas/inc/base/canvascustomspritebase.hxx
new file mode 100644
index 000000000000..936ed220dbd6
--- /dev/null
+++ b/canvas/inc/base/canvascustomspritebase.hxx
@@ -0,0 +1,264 @@
+/* -*- 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_CANVAS_BASE_CANVASCUSTOMSPRITEBASE_HXX
+#define INCLUDED_CANVAS_BASE_CANVASCUSTOMSPRITEBASE_HXX
+
+#include <com/sun/star/rendering/XCanvas.hpp>
+
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <base/integerbitmapbase.hxx>
+#include <base/bitmapcanvasbase.hxx>
+
+namespace com::sun::star::rendering { class XPolyPolygon2D; }
+
+namespace canvas
+{
+ /** Helper template to handle XCustomSprite method forwarding to
+ CanvasCustomSpriteHelper
+
+ Use this helper to handle the XCustomSprite part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XCustomSprite and Sprite should be among
+ them (why else would you use this template, then?). Base class
+ must have a Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl SpriteHelper
+ Sprite helper implementation for the backend in question
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ BaseMutex-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasCustomSpriteHelper for further contractual
+ requirements towards the SpriteHelper type, and some examples.
+ */
+ template< class Base,
+ class SpriteHelper,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase = css::uno::XInterface > class CanvasCustomSpriteBase :
+ public IntegerBitmapBase< BitmapCanvasBase2<Base, CanvasHelper, Mutex, UnambiguousBase> >
+ {
+ public:
+ typedef IntegerBitmapBase< BitmapCanvasBase2<Base, CanvasHelper, Mutex, UnambiguousBase> > BaseType;
+
+ CanvasCustomSpriteBase() :
+ maSpriteHelper()
+ {
+ }
+
+ /** Object is being disposed.
+
+ Called from the cppu helper base, to notify disposal of
+ this object. Already releases all internal references.
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ virtual void disposeThis() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XCanvas: selectively override base's methods here, for opacity tracking
+ virtual void SAL_CALL clear() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clearingContent( this );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::clear();
+ }
+
+ virtual css::uno::Reference< css::rendering::XCachedPrimitive > SAL_CALL
+ drawBitmap( const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState ) override
+ {
+ tools::verifyArgs(xBitmap, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.checkDrawBitmap( this, xBitmap, viewState, renderState );
+
+ // and forward to base class, which handles the actual rendering
+ return BaseType::drawBitmap( xBitmap,
+ viewState,
+ renderState );
+ }
+
+ // TODO(F3): If somebody uses the XIntegerBitmap methods to
+ // clear pixel (setting alpha != 1.0 there), or a compositing
+ // mode results in similar alpha, maSpriteHelper might
+ // erroneously report fully opaque sprites. Effectively, all
+ // render methods must be overridden here; or better,
+ // functionality provided at the baseclass.
+
+ // XSprite
+ virtual void SAL_CALL setAlpha( double alpha ) override
+ {
+ tools::verifyRange( alpha, 0.0, 1.0 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setAlpha( this, alpha );
+ }
+
+ virtual void SAL_CALL move( const css::geometry::RealPoint2D& aNewPos,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState ) override
+ {
+ tools::verifyArgs(aNewPos, viewState, renderState,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.move( this, aNewPos, viewState, renderState );
+ }
+
+ virtual void SAL_CALL transform( const css::geometry::AffineMatrix2D& aTransformation ) override
+ {
+ tools::verifyArgs(aTransformation,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.transform( this, aTransformation );
+ }
+
+ virtual void SAL_CALL clip( const css::uno::Reference< css::rendering::XPolyPolygon2D >& aClip ) override
+ {
+ // NULL xClip explicitly allowed here (to clear clipping)
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.clip( this, aClip );
+ }
+
+ virtual void SAL_CALL setPriority( double nPriority ) override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.setPriority( this, nPriority );
+ }
+
+ virtual void SAL_CALL show() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.show( this );
+ }
+
+ virtual void SAL_CALL hide() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maSpriteHelper.hide( this );
+ }
+
+ // XCustomSprite
+ virtual css::uno::Reference< css::rendering::XCanvas > SAL_CALL
+ getContentCanvas() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return this;
+ }
+
+ // Sprite
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.isAreaUpdateOpaque( rUpdateArea );
+ }
+
+ virtual bool isContentChanged() const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::mbSurfaceDirty;
+ }
+
+ virtual ::basegfx::B2DPoint getPosPixel() const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPosPixel();
+ }
+
+ virtual ::basegfx::B2DVector getSizePixel() const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getSizePixel();
+ }
+
+ virtual ::basegfx::B2DRange getUpdateArea() const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getUpdateArea();
+ }
+
+ virtual double getPriority() const override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return maSpriteHelper.getPriority();
+ }
+
+ protected:
+ SpriteHelper maSpriteHelper;
+ };
+}
+
+#endif // INCLUDED_CANVAS_BASE_CANVASCUSTOMSPRITEBASE_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/canvascustomspritehelper.hxx b/canvas/inc/base/canvascustomspritehelper.hxx
new file mode 100644
index 000000000000..32fcf6452a99
--- /dev/null
+++ b/canvas/inc/base/canvascustomspritehelper.hxx
@@ -0,0 +1,217 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <basegfx/matrix/b2dhommatrix.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/polygon/b2dpolypolygon.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <base/spritesurface.hxx>
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com::sun::star::geometry { struct AffineMatrix2D; }
+namespace com::sun::star::geometry { struct RealPoint2D; }
+namespace com::sun::star::geometry { struct RealSize2D; }
+namespace com::sun::star::rendering { class XBitmap; }
+namespace com::sun::star::rendering { class XPolyPolygon2D; }
+namespace com::sun::star::rendering { struct RenderState; }
+namespace com::sun::star::rendering { struct ViewState; }
+
+
+namespace canvas
+{
+ /* Definition of CanvasCustomSpriteHelper class */
+
+ /** Base class for an XSprite helper implementation - to be used
+ in concert with CanvasCustomSpriteBase
+ */
+ class CANVASTOOLS_DLLPUBLIC CanvasCustomSpriteHelper
+ {
+ public:
+ CanvasCustomSpriteHelper();
+ virtual ~CanvasCustomSpriteHelper() {}
+
+ /** Init helper
+
+ @param rSpriteSize
+ Requested size of the sprite, as passed to the
+ XSpriteCanvas::createCustomSprite() method
+
+ @param rOwningSpriteCanvas
+ The XSpriteCanvas this sprite is displayed on
+ */
+ void init( const css::geometry::RealSize2D& rSpriteSize,
+ const SpriteSurface::Reference& rOwningSpriteCanvas );
+
+ /** Object is being disposed, release all internal references
+
+ @derive when overriding this method in derived classes,
+ <em>always</em> call the base class' method!
+ */
+ void disposing();
+
+ // XCanvas
+ /// need to call this method for XCanvas::clear(), for opacity tracking
+ void clearingContent( const Sprite::Reference& rSprite );
+
+ /// need to call this method for XCanvas::drawBitmap(), for opacity tracking
+ void checkDrawBitmap( const Sprite::Reference& rSprite,
+ const css::uno::Reference< css::rendering::XBitmap >& xBitmap,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState );
+
+ // XSprite
+ void setAlpha( const Sprite::Reference& rSprite,
+ double alpha );
+ void move( const Sprite::Reference& rSprite,
+ const css::geometry::RealPoint2D& aNewPos,
+ const css::rendering::ViewState& viewState,
+ const css::rendering::RenderState& renderState );
+ void transform( const Sprite::Reference& rSprite,
+ const css::geometry::AffineMatrix2D& aTransformation );
+ void clip( const Sprite::Reference& rSprite,
+ const css::uno::Reference< css::rendering::XPolyPolygon2D >& aClip );
+ void setPriority( const Sprite::Reference& rSprite,
+ double nPriority );
+ void show( const Sprite::Reference& rSprite );
+ void hide( const Sprite::Reference& rSprite );
+
+ // Sprite
+ bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const;
+ const ::basegfx::B2DPoint& getPosPixel() const { return maPosition; }
+ const ::basegfx::B2DVector& getSizePixel() const { return maSize; }
+ ::basegfx::B2DRange getUpdateArea() const;
+ double getPriority() const { return mfPriority; }
+
+ // redraw must be implemented by derived - non sensible default implementation
+ // void redraw( const Sprite::Reference& rSprite,
+ // const ::basegfx::B2DPoint& rPos ) const;
+
+
+ // Helper methods for derived classes
+
+
+ /// Calc sprite update area from given raw sprite bounds
+ ::basegfx::B2DRange getUpdateArea( const ::basegfx::B2DRange& rUntransformedSpriteBounds ) const;
+
+ /** Returns true, if sprite content bitmap is fully opaque.
+
+ This does not take clipping or transformation into
+ account, but only denotes that the sprite bitmap's alpha
+ channel is all 1.0
+ */
+ bool isContentFullyOpaque() const { return mbIsContentFullyOpaque; }
+
+ /// Returns true, if transformation has changed since last transformUpdated() call
+ bool hasTransformChanged() const { return mbTransformDirty; }
+
+ /// Retrieve current alpha value
+ double getAlpha() const { return mfAlpha; }
+
+ /// Retrieve current clip
+ const css::uno::Reference<
+ css::rendering::XPolyPolygon2D >& getClip() const { return mxClipPoly; }
+
+ const ::basegfx::B2DHomMatrix& getTransformation() const { return maTransform; }
+
+ /// Retrieve current activation state
+ bool isActive() const { return mbActive; }
+
+ protected:
+ /** Notifies that caller is again in sync with current transformation
+
+ const, but modifies state visible to derived
+ classes. beware of passing this information to the
+ outside!
+ */
+ void transformUpdated() const { mbTransformDirty=false; }
+
+ private:
+ CanvasCustomSpriteHelper( const CanvasCustomSpriteHelper& ) = delete;
+ CanvasCustomSpriteHelper& operator=( const CanvasCustomSpriteHelper& ) = delete;
+
+ /** Called to convert an API polygon to a basegfx polygon
+
+ @derive Needs to be provided by backend-specific code
+ */
+ virtual ::basegfx::B2DPolyPolygon polyPolygonFromXPolyPolygon2D(
+ css::uno::Reference< css::rendering::XPolyPolygon2D >& xPoly ) const = 0;
+
+ /** Update clip information from current state
+
+ This method recomputes the maCurrClipBounds and
+ mbIsCurrClipRectangle members from the current clip and
+ transformation. IFF the clip changed from rectangular to
+ rectangular again, this method issues a sequence of
+ optimized SpriteSurface::updateSprite() calls.
+
+ @return true, if SpriteSurface::updateSprite() was already
+ called within this method.
+ */
+ bool updateClipState( const Sprite::Reference& rSprite );
+
+
+ /// Owning sprite canvas
+ SpriteSurface::Reference mpSpriteCanvas;
+
+ /** Currently active clip area.
+
+ This member is either empty, denoting that the current
+ clip shows the full sprite content, or contains a
+ rectangular subarea of the sprite, outside of which
+ the sprite content is fully clipped.
+
+ @see mbIsCurrClipRectangle
+ */
+ ::basegfx::B2DRange maCurrClipBounds;
+
+ // sprite state
+ ::basegfx::B2DPoint maPosition;
+ ::basegfx::B2DVector maSize;
+ ::basegfx::B2DHomMatrix maTransform;
+ css::uno::Reference< css::rendering::XPolyPolygon2D > mxClipPoly;
+ double mfPriority;
+ double mfAlpha;
+ bool mbActive; // true, if not hidden
+
+ /** If true, denotes that the current sprite clip is a true
+ rectangle, i.e. maCurrClipBounds <em>exactly</em>
+ describes the visible area of the sprite.
+
+ @see maCurrClipBounds
+ */
+ bool mbIsCurrClipRectangle;
+
+ /** Redraw speedup.
+
+ When true, this flag denotes that the current sprite
+ content is fully opaque, thus, that blits to the screen do
+ neither have to take alpha into account, nor prepare any
+ background for the sprite area.
+ */
+ mutable bool mbIsContentFullyOpaque;
+
+ /// True, iff maTransform has changed
+ mutable bool mbTransformDirty;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/disambiguationhelper.hxx b/canvas/inc/base/disambiguationhelper.hxx
new file mode 100644
index 000000000000..06e6f9af0431
--- /dev/null
+++ b/canvas/inc/base/disambiguationhelper.hxx
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/lang/EventObject.hpp>
+#include <osl/mutex.hxx>
+
+
+/* Definition of the DisambiguationHelper class */
+
+namespace canvas
+{
+ /** Base class, initializing its own baseclass with m_aMutex.
+
+ This is necessary to make the CanvasBase, GraphicDeviceBase,
+ etc. classes freely combinable - letting them perform this
+ initialization would prohibit deriving e.g. CanvasBase from
+ GraphicDeviceBase.
+
+ On top of that, disambiguates XEventListener::disposing and
+ WeakComponentImplHelper::disposing.
+
+ Having two virtual methods with the same name, and not
+ overriding them in every derived class, will hide one of
+ them. Later trying to override the same method, will generate
+ a new vtable slot, and lead to very hard to spot errors.
+ */
+ template< class Base > class DisambiguationHelper : public Base
+ {
+ protected:
+ /** Construct DisambiguationHelper
+
+ This method is the whole purpose of this template:
+ initializing a base class with the provided m_aMutex
+ member (the WeakComponentImplHelper templates need that,
+ as they require the lifetime of the mutex to extend
+ theirs).
+ */
+ DisambiguationHelper() :
+ Base( m_aMutex )
+ {
+ }
+
+ virtual void disposeThis()
+ {}
+ /// @throws css::uno::RuntimeException
+ virtual void disposeEventSource( const css::lang::EventObject& )
+ {}
+
+ mutable ::osl::Mutex m_aMutex;
+
+ private:
+ virtual void SAL_CALL disposing() override
+ { disposeThis(); }
+
+ virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override
+ { disposeEventSource(Source); }
+
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/graphicdevicebase.hxx b/canvas/inc/base/graphicdevicebase.hxx
new file mode 100644
index 000000000000..3a7c49834447
--- /dev/null
+++ b/canvas/inc/base/graphicdevicebase.hxx
@@ -0,0 +1,348 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/rendering/XBufferController.hpp>
+#include <com/sun/star/rendering/XLinePolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp>
+#include <com/sun/star/rendering/XBitmap.hpp>
+#include <com/sun/star/rendering/XVolatileBitmap.hpp>
+
+#include <rtl/ref.hxx>
+
+#include <parametricpolypolygon.hxx>
+#include <propertysethelper.hxx>
+#include <verifyinput.hxx>
+
+namespace com::sun::star::beans { class XPropertySetInfo; }
+namespace com::sun::star::lang { class XMultiServiceFactory; }
+namespace com::sun::star::rendering { class XColorSpace; }
+
+
+/* Definition of GraphicDeviceBase class */
+
+namespace canvas
+{
+ /** Helper template base class for XGraphicDevice implementations.
+
+ This base class provides partial implementations of the
+ XGraphicDevice-related interface, such as XColorSpace.
+
+ This template basically interposes itself between the full
+ interface you implement (i.e. not restricted to XGraphicDevice
+ etc.). The problem with UNO partial interface implementation
+ actually is, that you cannot do it the plain way, since
+ deriving from a common base subclass always introduces the
+ whole set of pure virtuals, that your baseclass helper just
+ overridden) and your implementation class. You then only have
+ to implement the functionality <em>besides</em>
+ XGraphicDevice. If you want to support the optional debug
+ XUpdatable interface, also add that to the base classes
+ (client code will call the corresponding update() method,
+ whenever a burst of animations is over).
+
+ <pre>
+ Example:
+ typedef ::cppu::WeakComponentImplHelper < css::rendering::XGraphicDevice,
+ css::rendering::XColorSpace,
+ css::rendering::XPropertySet,
+ css::lang::XServiceInfo,
+ css::lang::XServiceName > GraphicDeviceBase_Base;
+ typedef ::canvas::internal::GraphicDeviceBase< GraphicDeviceBase, DeviceHelper > ExampleDevice_Base;
+
+ class ExampleDevice : public ExampleDevice_Base
+ {
+ };
+ </pre>
+
+ @tpl Base
+ Base class to use, most probably the
+ WeakComponentImplHelper template with the appropriate
+ interfaces. At least XGraphicDevice should be among them (why else
+ would you use this template, then?). Base class must have an
+ Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelper template has). As the very least,
+ the base class must be derived from uno::XInterface, as some
+ error reporting mechanisms rely on that.
+
+ @tpl DeviceHelper
+ Device helper implementation for the backend in question. This
+ object will be held as a member of this template class, and
+ basically gets forwarded all XGraphicDevice API calls that
+ could not be handled generically.
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ DisambiguationHelper-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+ */
+ template< class Base,
+ class DeviceHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase=css::uno::XInterface > class GraphicDeviceBase :
+ public Base
+ {
+ public:
+ typedef Base BaseType;
+ typedef Mutex MutexType;
+ typedef UnambiguousBase UnambiguousBaseType;
+
+ typedef ::rtl::Reference< GraphicDeviceBase > Reference;
+
+ GraphicDeviceBase() :
+ maDeviceHelper(),
+ maPropHelper(),
+ mbDumpScreenContent(false)
+ {
+ maPropHelper.initProperties( PropertySetHelper::MakeMap
+ ("HardwareAcceleration",
+ [this] () { return this->maDeviceHelper.isAccelerated(); } )
+ ("DeviceHandle",
+ [this] () { return this->maDeviceHelper.getDeviceHandle(); } )
+ ("SurfaceHandle",
+ [this] () { return this->maDeviceHelper.getSurfaceHandle(); } )
+ ("DumpScreenContent",
+ [this] () { return this->getDumpScreenContent(); },
+ [this] (css::uno::Any const& rAny) { this->setDumpScreenContent(rAny); }));
+ }
+
+ virtual void disposeThis() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ maDeviceHelper.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XGraphicDevice
+ virtual css::uno::Reference< css::rendering::XBufferController > SAL_CALL getBufferController( ) override
+ {
+ return css::uno::Reference< css::rendering::XBufferController >();
+ }
+
+ virtual css::uno::Reference< css::rendering::XColorSpace > SAL_CALL getDeviceColorSpace( ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getColorSpace();
+ }
+
+ virtual css::geometry::RealSize2D SAL_CALL getPhysicalResolution() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalResolution();
+ }
+
+ virtual css::geometry::RealSize2D SAL_CALL getPhysicalSize() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.getPhysicalSize();
+ }
+
+ virtual css::uno::Reference< css::rendering::XLinePolyPolygon2D > SAL_CALL createCompatibleLinePolyPolygon( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealPoint2D > >& points ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleLinePolyPolygon( this, points );
+ }
+
+ virtual css::uno::Reference< css::rendering::XBezierPolyPolygon2D > SAL_CALL createCompatibleBezierPolyPolygon( const css::uno::Sequence< css::uno::Sequence< css::geometry::RealBezierSegment2D > >& points ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBezierPolyPolygon( this, points );
+ }
+
+ virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL createCompatibleBitmap( const css::geometry::IntegerSize2D& size ) override
+ {
+ tools::verifyBitmapSize(size,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleBitmap( this, size );
+ }
+
+ virtual css::uno::Reference< css::rendering::XVolatileBitmap > SAL_CALL createVolatileBitmap( const css::geometry::IntegerSize2D& size ) override
+ {
+ tools::verifyBitmapSize(size,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileBitmap( this, size );
+ }
+
+ virtual css::uno::Reference< css::rendering::XBitmap > SAL_CALL createCompatibleAlphaBitmap( const css::geometry::IntegerSize2D& size ) override
+ {
+ tools::verifyBitmapSize(size,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createCompatibleAlphaBitmap( this, size );
+ }
+
+ virtual css::uno::Reference< css::rendering::XVolatileBitmap > SAL_CALL createVolatileAlphaBitmap( const css::geometry::IntegerSize2D& size ) override
+ {
+ tools::verifyBitmapSize(size,
+ OSL_THIS_FUNC,
+ static_cast< UnambiguousBaseType* >(this));
+
+ MutexType aGuard( BaseType::m_aMutex );
+
+ return maDeviceHelper.createVolatileAlphaBitmap( this, size );
+ }
+
+ virtual css::uno::Reference< css::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) override
+ {
+ return this;
+ }
+
+ virtual sal_Bool SAL_CALL hasFullScreenMode( ) override
+ {
+ return false;
+ }
+
+ virtual sal_Bool SAL_CALL enterFullScreenMode( sal_Bool ) override
+ {
+ return false;
+ }
+
+ // XMultiServiceFactory
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override
+ {
+ return css::uno::Reference< css::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ css::uno::Sequence< css::uno::Any >()));
+ }
+
+ virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( const OUString& aServiceSpecifier, const css::uno::Sequence< css::uno::Any >& Arguments ) override
+ {
+ return css::uno::Reference< css::rendering::XParametricPolyPolygon2D >(
+ ParametricPolyPolygon::create(this,
+ aServiceSpecifier,
+ Arguments));
+ }
+
+ virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override
+ {
+ return ParametricPolyPolygon::getAvailableServiceNames();
+ }
+
+
+ // XUpdatable
+ virtual void SAL_CALL update() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+
+ if( mbDumpScreenContent )
+ maDeviceHelper.dumpScreenContent();
+ }
+
+
+ // XPropertySet
+ virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertySetInfo();
+ }
+
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName,
+ const css::uno::Any& aValue ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.setPropertyValue( aPropertyName, aValue );
+ }
+
+ virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& aPropertyName ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ return maPropHelper.getPropertyValue( aPropertyName );
+ }
+
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addPropertyChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& ,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& ) override
+ {
+ }
+
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener ) override
+ {
+ MutexType aGuard( BaseType::m_aMutex );
+ maPropHelper.addVetoableChangeListener( aPropertyName,
+ xListener );
+ }
+
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& ,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& ) override
+ {
+ }
+
+ protected:
+ ~GraphicDeviceBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves.
+
+ css::uno::Any getDumpScreenContent() const
+ {
+ return css::uno::makeAny( mbDumpScreenContent );
+ }
+
+ void setDumpScreenContent( const css::uno::Any& rAny )
+ {
+ // TODO(Q1): this was mbDumpScreenContent =
+ // rAny.get<bool>(), only that gcc3.3 wouldn't eat it
+ rAny >>= mbDumpScreenContent;
+ }
+
+ DeviceHelper maDeviceHelper;
+ PropertySetHelper maPropHelper;
+ bool mbDumpScreenContent;
+
+ private:
+ GraphicDeviceBase( const GraphicDeviceBase& ) = delete;
+ GraphicDeviceBase& operator=( const GraphicDeviceBase& ) = delete;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/integerbitmapbase.hxx b/canvas/inc/base/integerbitmapbase.hxx
new file mode 100644
index 000000000000..aca2551f2322
--- /dev/null
+++ b/canvas/inc/base/integerbitmapbase.hxx
@@ -0,0 +1,109 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/rendering/IntegerBitmapLayout.hpp>
+#include <verifyinput.hxx>
+#include <osl/diagnose.h>
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Either BitmapCanvasBase (just XBitmap) or BitmapCanvasBase2 (XBitmap and
+ XBitmapCanvas).
+ */
+ template< class Base > class IntegerBitmapBase :
+ public Base
+ {
+ public:
+ // XIntegerBitmap
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout,
+ const css::geometry::IntegerRectangle2D& rect ) override
+ {
+ tools::verifyArgs(rect,
+ OSL_THIS_FUNC,
+ static_cast< typename Base::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, Base::getSize() );
+
+ typename Base::MutexType aGuard( Base::m_aMutex );
+
+ return Base::maCanvasHelper.getData( bitmapLayout,
+ rect );
+ }
+
+ virtual void SAL_CALL setData( const css::uno::Sequence< sal_Int8 >&,
+ const css::rendering::IntegerBitmapLayout& bitmapLayout,
+ const css::geometry::IntegerRectangle2D& rect ) override
+ {
+ tools::verifyArgs(bitmapLayout, rect,
+ OSL_THIS_FUNC,
+ static_cast< typename Base::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(rect, Base::getSize() );
+
+ typename Base::MutexType aGuard( Base::m_aMutex );
+
+ Base::mbSurfaceDirty = true;
+ }
+
+ virtual void SAL_CALL setPixel( const css::uno::Sequence< sal_Int8 >&,
+ const css::rendering::IntegerBitmapLayout& bitmapLayout,
+ const css::geometry::IntegerPoint2D& pos ) override
+ {
+ tools::verifyArgs(bitmapLayout, pos,
+ OSL_THIS_FUNC,
+ static_cast< typename Base::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, Base::getSize() );
+
+ typename Base::MutexType aGuard( Base::m_aMutex );
+
+ Base::mbSurfaceDirty = true;
+ }
+
+ virtual css::uno::Sequence< sal_Int8 > SAL_CALL getPixel( css::rendering::IntegerBitmapLayout& bitmapLayout,
+ const css::geometry::IntegerPoint2D& pos ) override
+ {
+ tools::verifyArgs(pos,
+ OSL_THIS_FUNC,
+ static_cast< typename Base::UnambiguousBaseType* >(this));
+ tools::verifyIndexRange(pos, Base::getSize() );
+
+ typename Base::MutexType aGuard( Base::m_aMutex );
+
+ return Base::maCanvasHelper.getPixel( bitmapLayout,
+ pos );
+ }
+
+ virtual css::rendering::IntegerBitmapLayout SAL_CALL getMemoryLayout( ) override
+ {
+ typename Base::MutexType aGuard( Base::m_aMutex );
+
+ return Base::maCanvasHelper.getMemoryLayout();
+ }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/sprite.hxx b/canvas/inc/base/sprite.hxx
new file mode 100644
index 000000000000..8a89c945429d
--- /dev/null
+++ b/canvas/inc/base/sprite.hxx
@@ -0,0 +1,110 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <basegfx/point/b2dpoint.hxx>
+
+namespace basegfx
+{
+ class B2DVector;
+ class B2DRange;
+}
+
+namespace canvas
+{
+ /* Definition of Sprite interface (as we mix with UNO here, has to
+ be XInterface - reference holders to a Sprite must be able to
+ control lifetime of reference target)
+ */
+
+ /** Helper interface to connect SpriteCanvas with various
+ sprite implementations.
+
+ This interface should be implemented from every sprite class,
+ as it provides essential repaint and update area facilitates.
+
+ @derive typically, each canvas implementation will derive
+ another interface from this one, that adds rendering
+ functionality (which, of course, is impossible here in a
+ generic way)
+ */
+ class Sprite : public css::lang::XComponent
+ {
+ public:
+ typedef ::rtl::Reference< Sprite > Reference;
+
+ /** Query whether sprite update will fully cover the given area.
+
+ Use this method to determine whether any background
+ content (regardless of static or sprite) needs an update
+ before rendering this sprite.
+
+ @return true, if sprite redraw will fully overwrite given
+ area (and thus, the background need not be redrawn
+ beforehand).
+ */
+ virtual bool isAreaUpdateOpaque( const ::basegfx::B2DRange& rUpdateArea ) const = 0;
+
+ /** Query whether content has changed
+ */
+ virtual bool isContentChanged() const = 0;
+
+ /** Query position of the left, top pixel of the sprite
+ */
+ virtual ::basegfx::B2DPoint getPosPixel() const = 0;
+
+ /** Query size of the sprite in pixel.
+ */
+ virtual ::basegfx::B2DVector getSizePixel() const = 0;
+
+ /** Get area that is currently covered by the sprite
+
+ This area is already adapted to clipping, alpha and
+ transformation state of this sprite.
+ */
+ virtual ::basegfx::B2DRange getUpdateArea() const = 0;
+
+ /** Query sprite priority
+ */
+ virtual double getPriority() const = 0;
+
+ protected:
+ ~Sprite() {}
+ };
+
+ /** Functor providing a StrictWeakOrdering for sprite references
+ */
+ struct SpriteWeakOrder
+ {
+ bool operator()( const Sprite::Reference& rLHS,
+ const Sprite::Reference& rRHS )
+ {
+ const double nPrioL( rLHS->getPriority() );
+ const double nPrioR( rRHS->getPriority() );
+
+ // if prios are equal, tie-break on ptr value
+ return nPrioL == nPrioR ? rLHS.get() < rRHS.get() : nPrioL < nPrioR;
+ }
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/spritecanvasbase.hxx b/canvas/inc/base/spritecanvasbase.hxx
new file mode 100644
index 000000000000..041a6d3be7dc
--- /dev/null
+++ b/canvas/inc/base/spritecanvasbase.hxx
@@ -0,0 +1,190 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <rtl/ref.hxx>
+#include <com/sun/star/rendering/InterpolationMode.hpp>
+#include <base/integerbitmapbase.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <spriteredrawmanager.hxx>
+
+namespace com::sun::star::rendering { class XAnimation; }
+namespace com::sun::star::rendering { class XAnimatedSprite; }
+namespace com::sun::star::rendering { class XCustomSprite; }
+namespace com::sun::star::rendering { class XSprite; }
+
+
+namespace canvas
+{
+ /** Helper template to handle XIntegerBitmap method forwarding to
+ BitmapCanvasHelper
+
+ Use this helper to handle the XIntegerBitmap part of your
+ implementation.
+
+ @tpl Base
+ Base class to use, most probably one of the
+ WeakComponentImplHelperN templates with the appropriate
+ interfaces. At least XSpriteCanvas and SpriteSurface should be
+ among them (why else would you use this template, then?). Base
+ class must have a Base( const Mutex& ) constructor (like the
+ WeakComponentImplHelperN templates have).
+
+ @tpl CanvasHelper
+ Canvas helper implementation for the backend in question
+
+ @tpl Mutex
+ Lock strategy to use. Defaults to using the
+ BaseMutex-provided lock. Every time one of the methods is
+ entered, an object of type Mutex is created with m_aMutex as
+ the sole parameter, and destroyed again when the method scope
+ is left.
+
+ @tpl UnambiguousBase
+ Optional unambiguous base class for XInterface of Base. It's
+ sometimes necessary to specify this parameter, e.g. if Base
+ derives from multiple UNO interface (were each provides its
+ own version of XInterface, making the conversion ambiguous)
+
+ @see CanvasBase for further contractual requirements towards
+ the CanvasHelper type, and some examples.
+ */
+ template< class Base,
+ class CanvasHelper,
+ class Mutex=::osl::MutexGuard,
+ class UnambiguousBase = css::uno::XInterface > class SpriteCanvasBase :
+ public IntegerBitmapBase< BitmapCanvasBase<Base, CanvasHelper, Mutex, UnambiguousBase> >
+ {
+ public:
+ typedef IntegerBitmapBase< BitmapCanvasBase<Base, CanvasHelper, Mutex, UnambiguousBase> > BaseType;
+ typedef ::rtl::Reference< SpriteCanvasBase > Reference;
+
+ SpriteCanvasBase() :
+ maRedrawManager()
+ {
+ }
+
+ virtual void disposeThis() override
+ {
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.disposing();
+
+ // pass on to base class
+ BaseType::disposeThis();
+ }
+
+ // XSpriteCanvas
+ virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const css::uno::Reference< css::rendering::XAnimation >& animation ) override
+ {
+ tools::verifyArgs(animation,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromAnimation(animation);
+ }
+
+ virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromBitmaps( const css::uno::Sequence< css::uno::Reference< css::rendering::XBitmap > >& animationBitmaps,
+ sal_Int8 interpolationMode ) override
+ {
+ tools::verifyArgs(animationBitmaps,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+ tools::verifyRange( interpolationMode,
+ css::rendering::InterpolationMode::NEAREST_NEIGHBOR,
+ css::rendering::InterpolationMode::BEZIERSPLINE4 );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createSpriteFromBitmaps(animationBitmaps, interpolationMode);
+ }
+
+ virtual css::uno::Reference< css::rendering::XCustomSprite > SAL_CALL createCustomSprite( const css::geometry::RealSize2D& spriteSize ) override
+ {
+ tools::verifySpriteSize(spriteSize,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createCustomSprite(spriteSize);
+ }
+
+ virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite( const css::uno::Reference< css::rendering::XSprite >& original ) override
+ {
+ tools::verifyArgs(original,
+ OSL_THIS_FUNC,
+ static_cast< typename BaseType::UnambiguousBaseType* >(this));
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ return BaseType::maCanvasHelper.createClonedSprite(original);
+ }
+
+ // SpriteSurface
+ virtual void showSprite( const Sprite::Reference& rSprite ) override
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.showSprite( rSprite );
+ }
+
+ virtual void hideSprite( const Sprite::Reference& rSprite ) override
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.hideSprite( rSprite );
+ }
+
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) override
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.moveSprite( rSprite, rOldPos, rNewPos, rSpriteSize );
+ }
+
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) override
+ {
+ OSL_ASSERT( rSprite.is() );
+
+ typename BaseType::MutexType aGuard( BaseType::m_aMutex );
+
+ maRedrawManager.updateSprite( rSprite, rPos, rUpdateArea );
+ }
+
+ protected:
+ SpriteRedrawManager maRedrawManager;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/base/spritesurface.hxx b/canvas/inc/base/spritesurface.hxx
new file mode 100644
index 000000000000..e49c82699c84
--- /dev/null
+++ b/canvas/inc/base/spritesurface.hxx
@@ -0,0 +1,67 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <base/sprite.hxx>
+
+namespace canvas
+{
+ /* Definition of the SpriteSurface interface */
+
+ /** Canvas surface containing sprites
+
+ Every canvas surface that contains sprites must implement this
+ interface, when employing the canvas base framework. The
+ methods provided here are used from the individual sprites to
+ notify the canvas about necessary screen updates.
+ */
+ class SpriteSurface : public css::uno::XInterface
+ {
+ public:
+ typedef ::rtl::Reference< SpriteSurface > Reference;
+
+ /// Sprites should call this from XSprite::show()
+ virtual void showSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::hide()
+ virtual void hideSprite( const Sprite::Reference& rSprite ) = 0;
+
+ /// Sprites should call this from XSprite::move()
+ virtual void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) = 0;
+
+ /** Sprites should call this when some part of the content has
+ changed.
+
+ That includes show/hide, i.e. for show, both showSprite()
+ and updateSprite() must be called.
+ */
+ virtual void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) = 0;
+
+ protected:
+ ~SpriteSurface() {}
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/parametricpolypolygon.hxx b/canvas/inc/parametricpolypolygon.hxx
new file mode 100644
index 000000000000..28be8b8155c8
--- /dev/null
+++ b/canvas/inc/parametricpolypolygon.hxx
@@ -0,0 +1,152 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/rendering/XParametricPolyPolygon2D.hpp>
+#include <cppuhelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <basegfx/polygon/b2dpolygon.hxx>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com::sun::star::rendering { class XGraphicDevice; }
+
+
+/* Definition of ParametricPolyPolygon class */
+
+namespace canvas
+{
+ typedef cppu::WeakComponentImplHelper< css::rendering::XParametricPolyPolygon2D,
+ css::lang::XServiceInfo > ParametricPolyPolygon_Base;
+
+ class CANVASTOOLS_DLLPUBLIC ParametricPolyPolygon final : public ::cppu::BaseMutex,
+ public ParametricPolyPolygon_Base
+ {
+ public:
+ enum class GradientType
+ {
+ Linear,
+ Elliptical,
+ Rectangular
+ };
+
+ /** Structure of defining values for the ParametricPolyPolygon
+
+ This is used to copy the state of the
+ ParametricPolyPolygon atomically.
+ */
+ struct Values
+ {
+ Values( const ::basegfx::B2DPolygon& rGradientPoly,
+ const css::uno::Sequence< css::uno::Sequence< double > >& rColors,
+ const css::uno::Sequence< double >& rStops,
+ double nAspectRatio,
+ GradientType eType ) :
+ maGradientPoly( rGradientPoly ),
+ mnAspectRatio( nAspectRatio ),
+ maColors( rColors ),
+ maStops( rStops ),
+ meType( eType )
+ {
+ }
+
+ /// Polygonal gradient shape (ignored for linear and axial gradient)
+ const ::basegfx::B2DPolygon maGradientPoly;
+
+ /// Aspect ratio of gradient, affects scaling of innermost gradient polygon
+ const double mnAspectRatio;
+
+ /// Gradient colors
+ const css::uno::Sequence< css::uno::Sequence< double > > maColors;
+
+ /// Gradient color stops
+ const css::uno::Sequence< double > maStops;
+
+ /// Type of gradient to render (as e.g. linear grads are not represented by maGradientPoly)
+ const GradientType meType;
+ };
+
+ static css::uno::Sequence< OUString > getAvailableServiceNames();
+ static ParametricPolyPolygon* create(
+ const css::uno::Reference< css::rendering::XGraphicDevice >& rDevice,
+ const OUString& rServiceName,
+ const css::uno::Sequence< css::uno::Any >& rArgs );
+
+ /// Dispose all internal references
+ virtual void SAL_CALL disposing() override;
+
+ // XParametricPolyPolygon2D
+ virtual css::uno::Reference< css::rendering::XPolyPolygon2D > SAL_CALL getOutline( double t ) override;
+ virtual css::uno::Sequence< double > SAL_CALL getColor( double t ) override;
+ virtual css::uno::Sequence< double > SAL_CALL getPointColor( const css::geometry::RealPoint2D& point ) override;
+ virtual css::uno::Reference< css::rendering::XColorSpace > SAL_CALL getColorSpace() override;
+
+ // XServiceInfo
+ virtual OUString SAL_CALL getImplementationName( ) override;
+ virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override;
+ virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override;
+
+ /// Query all defining values of this object atomically
+ Values getValues() const;
+
+ private:
+ virtual ~ParametricPolyPolygon() override; // we're a ref-counted UNO class. _We_ destroy ourselves.
+ ParametricPolyPolygon(const ParametricPolyPolygon&) = delete;
+ ParametricPolyPolygon& operator=( const ParametricPolyPolygon& ) = delete;
+
+ static ParametricPolyPolygon* createLinearHorizontalGradient( const css::uno::Reference<
+ css::rendering::XGraphicDevice >& rDevice,
+ const css::uno::Sequence< css::uno::Sequence< double > >& colors,
+ const css::uno::Sequence< double >& stops );
+ static ParametricPolyPolygon* createEllipticalGradient( const css::uno::Reference<
+ css::rendering::XGraphicDevice >& rDevice,
+ const css::uno::Sequence< css::uno::Sequence< double > >& colors,
+ const css::uno::Sequence< double >& stops,
+ double fAspect );
+ static ParametricPolyPolygon* createRectangularGradient( const css::uno::Reference<
+ css::rendering::XGraphicDevice >& rDevice,
+ const css::uno::Sequence< css::uno::Sequence< double > >& colors,
+ const css::uno::Sequence< double >& stops,
+ double fAspect );
+
+ /// Private, because objects can only be created from the static factories
+ ParametricPolyPolygon( const css::uno::Reference<
+ css::rendering::XGraphicDevice >& rDevice,
+ const ::basegfx::B2DPolygon& rGradientPoly,
+ GradientType eType,
+ const css::uno::Sequence< css::uno::Sequence< double > >& colors,
+ const css::uno::Sequence< double >& stops,
+ double nAspectRatio );
+ ParametricPolyPolygon( const css::uno::Reference<
+ css::rendering::XGraphicDevice >& rDevice,
+ GradientType eType,
+ const css::uno::Sequence< css::uno::Sequence< double > >& colors,
+ const css::uno::Sequence< double >& stops );
+
+ css::uno::Reference<
+ css::rendering::XGraphicDevice > mxDevice;
+
+ /// All defining values of this object
+ const Values maValues;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/propertysethelper.hxx b/canvas/inc/propertysethelper.hxx
new file mode 100644
index 000000000000..e1a37498bb37
--- /dev/null
+++ b/canvas/inc/propertysethelper.hxx
@@ -0,0 +1,143 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <canvas/canvastools.hxx>
+
+#include <functional>
+#include <vector>
+#include <memory>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com::sun::star::beans { class XPropertyChangeListener; }
+namespace com::sun::star::beans { class XPropertySetInfo; }
+namespace com::sun::star::beans { class XVetoableChangeListener; }
+
+namespace canvas
+{
+ /** Really simplistic XPropertySet helper for properties.
+
+ This class provides easy access to properties, referenced via
+ ASCII strings. The name/property modification callbacks pairs
+ are passed into this class via a vector. Each time a property
+ is set or queried, the corresponding getter or setter callback
+ is called.
+
+ Use this class as a delegate for the corresponding
+ XPropertySet methods, and take care of UNO XInterface and lock
+ handling by yourself.
+
+ The core responsibility of this class is the name/value
+ mapping for property sets.
+ */
+ class CANVASTOOLS_DLLPUBLIC PropertySetHelper
+ {
+ public:
+ typedef std::function<css::uno::Any ()> GetterType;
+ typedef std::function<void (const css::uno::Any&)> SetterType;
+ struct Callbacks
+ {
+ GetterType getter;
+ SetterType setter;
+ };
+ typedef tools::ValueMap< Callbacks > MapType;
+ typedef std::vector< MapType::MapEntry > InputMap;
+
+ class MakeMap : public InputMap
+ {
+ public:
+ MakeMap(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ push_back(aEntry);
+ }
+ MakeMap(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ push_back(aEntry);
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter,
+ const SetterType& setter)
+ {
+ MapType::MapEntry aEntry={name, {getter, setter}};
+ push_back(aEntry);
+ return *this;
+ }
+ MakeMap& operator()(const char* name,
+ const GetterType& getter)
+ {
+ MapType::MapEntry aEntry={name, {getter, SetterType()}};
+ push_back(aEntry);
+ return *this;
+ }
+ };
+
+ /** Create helper with zero properties
+ */
+ PropertySetHelper();
+
+ /** Init helper with new name/value map
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer.
+ */
+ void initProperties( const InputMap& rMap );
+
+ /** Add given properties to helper
+
+ @param rMap
+ Vector of name/function pointers. Each name is offered as
+ a property, and reading/writing to this property is passed
+ on to the given function pointer. These name/function
+ pairs are added to the already existing ones.
+ */
+ void addProperties( const InputMap& rMap );
+
+ /** Checks whether the given string corresponds to a valid
+ property name.
+
+ @return true, if the given name maps to a known property.
+ */
+ bool isPropertyName( const OUString& aPropertyName ) const;
+
+ // XPropertySet implementation
+ css::uno::Reference< css::beans::XPropertySetInfo > getPropertySetInfo() const;
+ void setPropertyValue( const OUString& aPropertyName,
+ const css::uno::Any& aValue );
+ css::uno::Any getPropertyValue( const OUString& PropertyName ) const;
+ void addPropertyChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener );
+ void addVetoableChangeListener( const OUString& aPropertyName,
+ const css::uno::Reference< css::beans::XVetoableChangeListener >& xListener );
+
+ private:
+ std::unique_ptr<MapType> mpMap;
+ InputMap maMapEntries;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/rendering/icolorbuffer.hxx b/canvas/inc/rendering/icolorbuffer.hxx
new file mode 100644
index 000000000000..7d851131eec8
--- /dev/null
+++ b/canvas/inc/rendering/icolorbuffer.hxx
@@ -0,0 +1,77 @@
+/* -*- 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_CANVAS_RENDERING_ICOLORBUFFER_HXX
+#define INCLUDED_CANVAS_RENDERING_ICOLORBUFFER_HXX
+
+#include <sal/types.h>
+
+namespace canvas
+{
+ /** Interface for a raw memory pixel container
+
+ Use this interface to represent a surface of raw pixel (e.g. a
+ bitmap) to the canvas rendering framework.
+ */
+ struct IColorBuffer
+ {
+ /// The underlying pixel format for this buffer
+ enum class Format
+ {
+ // 32-bit ARGB pixel format with alpha, 8 bits per channel.
+ A8R8G8B8,
+
+ // 32-bit RGB pixel format, 8 bits per channel.
+ X8R8G8B8
+ };
+
+ virtual ~IColorBuffer() {}
+
+ /** Get a pointer to the raw memory bits of the pixel
+ */
+ virtual sal_uInt8* lock() const = 0;
+
+ /** unlock previous locked buffer
+ */
+ virtual void unlock() const = 0;
+
+ /** Get width in pixel
+ */
+ virtual sal_uInt32 getWidth() const = 0;
+
+ /** Get height in pixel
+ */
+ virtual sal_uInt32 getHeight() const = 0;
+
+ /** Offset, in bytes, between consecutive scan lines of the bitmap.
+ If the stride is positive, the bitmap is top-down.
+ If the stride is negative, the bitmap is bottom-up.
+ The returned value is only valid while the buffer is locked.
+ */
+ virtual sal_uInt32 getStride() const = 0;
+
+ /** Get format of the color buffer
+ */
+ virtual Format getFormat() const = 0;
+ };
+}
+
+#endif // INCLUDED_CANVAS_RENDERING_ICOLORBUFFER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/rendering/irendermodule.hxx b/canvas/inc/rendering/irendermodule.hxx
new file mode 100644
index 000000000000..527eedc9fd94
--- /dev/null
+++ b/canvas/inc/rendering/irendermodule.hxx
@@ -0,0 +1,133 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <memory>
+
+namespace basegfx
+{
+ class B2IVector;
+}
+
+namespace canvas
+{
+ struct ISurface;
+
+ struct Vertex
+ {
+ float r,g,b,a;
+ float u,v;
+ float x,y,z;
+ };
+
+ /** Output module interface for backend render implementations.
+
+ Implement this interface for each operating system- or
+ library-specific rendering backend, which needs coupling with
+ the canvas rendering framework (which can be shared between
+ all backend implementations).
+ */
+ struct IRenderModule
+ {
+ /** Type of primitive passed to the render module via
+ pushVertex()
+ */
+ enum class PrimitiveType
+ {
+ Unknown,
+ Triangle,
+ Quad
+ };
+
+ virtual ~IRenderModule() {}
+
+ /// Lock rendermodule against concurrent access
+ virtual void lock() const = 0;
+
+ /// Unlock rendermodule for concurrent access
+ virtual void unlock() const = 0;
+
+ /** Maximal size of VRAM pages available
+
+ This is typically the maximum texture size of the
+ hardware, or some arbitrary limit if the backend is
+ software.
+ */
+ virtual ::basegfx::B2IVector getPageSize() = 0;
+
+ /** Create a (possibly hardware-accelerated) surface
+
+ @return a pointer to a surface, which is an abstraction of
+ a piece of (possibly hardware-accelerated) texture memory.
+ */
+ virtual std::shared_ptr<ISurface> createSurface( const ::basegfx::B2IVector& surfaceSize ) = 0;
+
+ /** Begin rendering the given primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void beginPrimitive( PrimitiveType eType ) = 0;
+
+ /** Finish rendering a primitive.
+
+ Each beginPrimitive() call must be matched with an
+ endPrimitive() call.
+ */
+ virtual void endPrimitive() = 0;
+
+ /** Add given vertex to current primitive
+
+ After issuing a beginPrimitive(), each pushVertex() adds a
+ vertex to the active primitive.
+ */
+ virtual void pushVertex( const Vertex& vertex ) = 0;
+
+ /** Query error status
+
+ @returns true, if an error occurred during primitive
+ construction.
+ */
+ virtual bool isError() = 0;
+ };
+
+ /// Little RAII wrapper for guarding access to IRenderModule interface
+ class RenderModuleGuard
+ {
+ public:
+ explicit RenderModuleGuard( const std::shared_ptr<IRenderModule>& rRenderModule ) :
+ mpRenderModule( rRenderModule )
+ {
+ mpRenderModule->lock();
+ }
+
+ ~RenderModuleGuard()
+ {
+ mpRenderModule->unlock();
+ }
+
+ RenderModuleGuard(const RenderModuleGuard&) = delete;
+ RenderModuleGuard& operator=( const RenderModuleGuard& ) = delete;
+ private:
+ const std::shared_ptr<IRenderModule> mpRenderModule;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/rendering/isurface.hxx b/canvas/inc/rendering/isurface.hxx
new file mode 100644
index 000000000000..f3d3beaf0b1b
--- /dev/null
+++ b/canvas/inc/rendering/isurface.hxx
@@ -0,0 +1,69 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+namespace basegfx
+{
+ class B2IRange;
+ class B2IPoint;
+}
+
+namespace canvas
+{
+ struct IColorBuffer;
+
+ struct ISurface
+ {
+ virtual ~ISurface() {}
+
+ /** Select texture behind this interface to be the current one
+ for primitive output.
+ */
+ virtual bool selectTexture() = 0;
+
+ /** Tells whether the surface is valid or not
+ */
+ virtual bool isValid() = 0;
+
+ /** Update surface content from given IColorBuffer
+
+ This method updates the given subarea of the surface from
+ the given color buffer bits.
+
+ @param rDestPos
+ Position in the surface, where the subset update should
+ have its left, top edge
+
+ @param rSourceRect
+ Size and position of the rectangular subset update in the
+ source color buffer
+
+ @param rSource
+ Source bits to use for the update
+
+ @return true, if the update was successful
+ */
+ virtual bool update( const ::basegfx::B2IPoint& rDestPos,
+ const ::basegfx::B2IRange& rSourceRect,
+ IColorBuffer& rSource ) = 0;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/rendering/isurfaceproxy.hxx b/canvas/inc/rendering/isurfaceproxy.hxx
new file mode 100644
index 000000000000..ebe8abc10fe1
--- /dev/null
+++ b/canvas/inc/rendering/isurfaceproxy.hxx
@@ -0,0 +1,98 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+namespace basegfx
+{
+ class B2DRange;
+ class B2DPoint;
+ class B2DPolyPolygon;
+ class B2DHomMatrix;
+}
+
+namespace canvas
+{
+ struct ISurfaceProxy
+ {
+ virtual ~ISurfaceProxy() {}
+
+ /** Notify the proxy that the color buffer has changed
+ */
+ virtual void setColorBufferDirty() = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rArea
+ Subset of the surface to render. Coordinate system are
+ surface area pixel, given area will be clipped to the
+ surface bounds.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rArea,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+
+ /** Render the surface content to screen.
+
+ @param fAlpha
+ Overall alpha for content
+
+ @param rPos
+ Output position
+
+ @param rClipPoly
+ Clip polygon for the surface. The clip polygon is also
+ subject to the output transformation.
+
+ @param rTransform
+ Output transformation (does not affect output position)
+ */
+ virtual bool draw( double fAlpha,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DPolyPolygon& rClipPoly,
+ const ::basegfx::B2DHomMatrix& rTransform ) = 0;
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/rendering/isurfaceproxymanager.hxx b/canvas/inc/rendering/isurfaceproxymanager.hxx
new file mode 100644
index 000000000000..71b12b29e729
--- /dev/null
+++ b/canvas/inc/rendering/isurfaceproxymanager.hxx
@@ -0,0 +1,66 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <canvas/canvastoolsdllapi.h>
+#include <memory>
+
+namespace canvas
+{
+ struct ISurfaceProxy;
+ struct IColorBuffer;
+ struct IRenderModule;
+
+ /** Manager interface, which handles surface proxy objects.
+
+ Typically, each canvas instantiation has one
+ SurfaceProxyManager object, to handle their surfaces. Surfaces
+ itself are opaque objects, which encapsulate a framebuffer to
+ render upon, plus an optional (possibly accelerated) texture.
+ */
+ struct ISurfaceProxyManager
+ {
+ virtual ~ISurfaceProxyManager() {}
+
+ /** Create a surface proxy for a color buffer.
+
+ The whole idea is build around the concept that you create
+ some arbitrary buffer which contains the image data and
+ tell the texture manager about it. From there on you can
+ draw into this image using any kind of graphics api you
+ want. In the technical sense we allocate some space in
+ local videomemory or AGP memory which will be filled on
+ demand, which means if there exists any rendering
+ operation that needs to read from this memory location.
+ This method creates a logical hardware surface object
+ which uses the given color buffer as the image source.
+ Internally this texture may even be distributed to several
+ real hardware surfaces.
+ */
+ virtual std::shared_ptr< ISurfaceProxy > createSurfaceProxy(
+ const std::shared_ptr<IColorBuffer>& pBuffer ) const = 0;
+ };
+
+ /** Create a surface proxy for the given render module.
+ */
+ CANVASTOOLS_DLLPUBLIC std::shared_ptr<ISurfaceProxyManager> createSurfaceProxyManager( const std::shared_ptr<IRenderModule>& rRenderModule );
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/spriteredrawmanager.hxx b/canvas/inc/spriteredrawmanager.hxx
new file mode 100644
index 000000000000..87c692f6d7dc
--- /dev/null
+++ b/canvas/inc/spriteredrawmanager.hxx
@@ -0,0 +1,406 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <basegfx/range/b2dconnectedranges.hxx>
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/vector/b2dvector.hxx>
+#include <basegfx/range/b2drange.hxx>
+#include <basegfx/range/b2drectangle.hxx>
+
+#include <vector>
+#include <algorithm>
+
+#include "base/sprite.hxx"
+#include <canvas/canvastoolsdllapi.h>
+
+/* Definition of SpriteRedrawManager class */
+
+namespace canvas
+{
+ /** This class manages smooth SpriteCanvas updates
+
+ Use this class to handle the ::canvas::SpriteSurface methods,
+ that track and process sprite update events. Recorded update
+ events are later grouped by connected areas (i.e. all sprites
+ that somehow overlap over a rectangular area are grouped
+ together); the forEachSpriteArea() method calls the passed
+ functor for each of those connected areas.
+
+ Note that, although this class generally works with IEEE
+ doubles, the calculation of connected areas happens in the
+ integer domain - it is generally expected that repaints can
+ only be divided at pixel boundaries, without causing visible
+ artifacts. Therefore, sprites that touch the same pixel (but
+ don't necessarily have the same floating point coordinates
+ there) will reside in a common sprite area and handled
+ together in the forEachSpriteArea functor call.
+ */
+ class CANVASTOOLS_DLLPUBLIC SpriteRedrawManager
+ {
+ public:
+ /** Data container for the connected components list
+ */
+ class SpriteInfo
+ {
+ public:
+ /** Create sprite info
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( false )
+ {
+ }
+
+ /** Create sprite info, specify move type
+
+ @param rRef
+ Sprite this info represents (might be the NULL ref)
+
+ @param rTrueUpdateArea
+ True (un-rounded) update area this sprite has recorded
+
+ @param bNeedsUpdate
+ When false, this sprite is not a member of the change
+ record list. Thus, it only needs redraw if within the
+ update area of other, changed sprites.
+
+ @param bIsPureMove
+ When true, this sprite is _only_ moved, no other
+ changes happened.
+
+ @internal
+ */
+ SpriteInfo( const Sprite::Reference& rRef,
+ const ::basegfx::B2DRange& rTrueUpdateArea,
+ bool bNeedsUpdate,
+ bool bIsPureMove ) :
+ mpSprite( rRef ),
+ maTrueUpdateArea( rTrueUpdateArea ),
+ mbNeedsUpdate( bNeedsUpdate ),
+ mbIsPureMove( bIsPureMove )
+ {
+ }
+
+ const Sprite::Reference& getSprite() const { return mpSprite; }
+
+ // #i61843# need to return by value here, to be used safely from bind
+ const ::basegfx::B2DRange& getUpdateArea() const { return maTrueUpdateArea; }
+ bool needsUpdate() const { return mbNeedsUpdate; }
+ bool isPureMove() const { return mbIsPureMove; }
+
+ private:
+ Sprite::Reference mpSprite;
+ ::basegfx::B2DRange maTrueUpdateArea;
+ bool mbNeedsUpdate;
+ bool mbIsPureMove;
+ };
+
+
+ /** Helper struct for SpriteTracer template
+
+ This struct stores change information to a sprite's visual
+ appearance (move, content updated, and the like).
+ */
+ struct SpriteChangeRecord
+ {
+ enum class ChangeType { move, update };
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize ) :
+ meChangeType( ChangeType::move ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rOldPos ),
+ maUpdateArea( rNewPos.getX(),
+ rNewPos.getY(),
+ rNewPos.getX() + rSpriteSize.getX(),
+ rNewPos.getY() + rSpriteSize.getY() )
+ {
+ }
+
+ SpriteChangeRecord( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea ) :
+ meChangeType( ChangeType::update ),
+ mpAffectedSprite( rSprite ),
+ maOldPos( rPos ),
+ maUpdateArea( rUpdateArea )
+ {
+ }
+
+ const Sprite::Reference& getSprite() const { return mpAffectedSprite; }
+
+ ChangeType meChangeType;
+ Sprite::Reference mpAffectedSprite;
+ ::basegfx::B2DPoint maOldPos;
+ ::basegfx::B2DRange maUpdateArea;
+ };
+
+ typedef ::std::vector< SpriteChangeRecord > VectorOfChangeRecords;
+ typedef ::basegfx::B2DConnectedRanges< SpriteInfo > SpriteConnectedRanges;
+ typedef SpriteConnectedRanges::ComponentType AreaComponent;
+ typedef SpriteConnectedRanges::ConnectedComponents UpdateArea;
+ typedef ::std::vector< Sprite::Reference > VectorOfSprites;
+
+ SpriteRedrawManager();
+ SpriteRedrawManager(const SpriteRedrawManager&) = delete;
+ SpriteRedrawManager& operator=( const SpriteRedrawManager& ) = delete;
+
+ /** Must be called when user of this object gets
+ disposed. Frees all internal references.
+ */
+ void disposing();
+
+ /** Functor, to be used from forEachSpriteArea
+ */
+ template< typename Functor > struct AreaUpdateCaller
+ {
+ AreaUpdateCaller( Functor& rFunc,
+ const SpriteRedrawManager& rManager ) :
+ mrFunc( rFunc ),
+ mrManager( rManager )
+ {
+ }
+
+ void operator()( const UpdateArea& rUpdateArea )
+ {
+ mrManager.handleArea( mrFunc, rUpdateArea );
+ }
+
+ Functor& mrFunc;
+ const SpriteRedrawManager& mrManager;
+ };
+
+ /** Call given functor for each sprite area that needs an
+ update.
+
+ This method calls the given functor for each update area
+ (calculated from the sprite change records).
+
+ @tpl Functor
+ Must provide the following four methods:
+ <pre>
+ void backgroundPaint( ::basegfx::B2DRange aUpdateRect );
+ void scrollUpdate( ::basegfx::B2DRange& o_rMoveStart,
+ ::basegfx::B2DRange& o_rMoveEnd,
+ UpdateArea aUpdateArea );
+ void opaqueUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ void genericUpdate( const ::basegfx::B2DRange& rTotalArea,
+ const ::std::vector< ::canvas::Sprite::Reference >& rSortedUpdateSprites );
+ </pre>
+ The backgroundPaint() method is called to simply repaint
+ background content, the scrollUpdate() method is used to
+ scroll a given area, and paint background in the uncovered
+ areas, the opaqueUpdate() method is called when a sprite
+ can be painted in the given area without taking background
+ content into account, and finally, genericUpdate() is
+ called for complex updates, where first the background and
+ then all sprites consecutively have to be repainted.
+ */
+ template< typename Functor > void forEachSpriteArea( Functor& rFunc ) const
+ {
+ SpriteConnectedRanges aUpdateAreas;
+
+ setupUpdateAreas( aUpdateAreas );
+
+ aUpdateAreas.forEachAggregate(
+ AreaUpdateCaller< Functor >( rFunc, *this ) );
+ }
+
+ /** Call given functor for each active sprite.
+
+ This method calls the given functor for each active
+ sprite, in the order of sprite priority.
+
+ @tpl Functor
+ Must provide a Functor::operator( Sprite::Reference& )
+ method.
+ */
+ template< typename Functor > void forEachSprite( const Functor& rFunc ) const
+ {
+ ::std::for_each( maSprites.begin(),
+ maSprites.end(),
+ rFunc );
+ }
+
+ /// Clear sprite change records (typically directly after a screen update)
+ void clearChangeRecords();
+
+ // SpriteSurface interface, is delegated to e.g. from SpriteCanvas
+ void showSprite( const Sprite::Reference& rSprite );
+ void hideSprite( const Sprite::Reference& rSprite );
+ void moveSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rOldPos,
+ const ::basegfx::B2DPoint& rNewPos,
+ const ::basegfx::B2DVector& rSpriteSize );
+ void updateSprite( const Sprite::Reference& rSprite,
+ const ::basegfx::B2DPoint& rPos,
+ const ::basegfx::B2DRange& rUpdateArea );
+
+ /** Internal, handles each distinct component for forEachAggregate()
+
+ The reason why this must be public is that it needs to be
+ accessible from the AreaUpdateCaller functor.
+
+ @internal
+ */
+ template< typename Functor > void handleArea( Functor& rFunc,
+ const UpdateArea& rUpdateArea ) const
+ {
+ // check whether this area contains changed sprites at all
+ // (if not, just ignore it)
+ if( areSpritesChanged( rUpdateArea ) )
+ {
+ // at least one of the sprites actually needs an
+ // update - process whole area.
+
+ // check whether this area could be handled special
+ // (background paint, direct update, scroll, etc.)
+ ::basegfx::B2DRange aMoveStart;
+ ::basegfx::B2DRange aMoveEnd;
+ if( rUpdateArea.maComponentList.empty() )
+ {
+ rFunc.backgroundPaint( rUpdateArea.maTotalBounds );
+ }
+ else
+ {
+ // cache number of sprites in this area (it's a
+ // list, and both isAreaUpdateScroll() and
+ // isAreaUpdateOpaque() need it).
+ const ::std::size_t nNumSprites(
+ rUpdateArea.maComponentList.size() );
+
+ if( isAreaUpdateScroll( aMoveStart,
+ aMoveEnd,
+ rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.scrollUpdate( aMoveStart,
+ aMoveEnd,
+ rUpdateArea );
+ }
+ else
+ {
+ // potentially, more than a single sprite
+ // involved. Have to sort component lists for
+ // sprite prio.
+ VectorOfSprites aSortedUpdateSprites;
+ for (auto const& elem : rUpdateArea.maComponentList)
+ {
+ const Sprite::Reference& rSprite( elem.second.getSprite() );
+ if( rSprite.is() )
+ aSortedUpdateSprites.push_back( rSprite );
+ }
+
+ ::std::sort( aSortedUpdateSprites.begin(),
+ aSortedUpdateSprites.end(),
+ SpriteWeakOrder() );
+
+ if( isAreaUpdateOpaque( rUpdateArea,
+ nNumSprites ) )
+ {
+ rFunc.opaqueUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ else
+ {
+ rFunc.genericUpdate( rUpdateArea.maTotalBounds,
+ aSortedUpdateSprites );
+ }
+ }
+ }
+ }
+ }
+
+ private:
+ /** Central method of this class. Calculates the set of
+ disjunct components that need an update.
+ */
+ void setupUpdateAreas( SpriteConnectedRanges& rUpdateAreas ) const;
+
+ bool areSpritesChanged( const UpdateArea& rUpdateArea ) const;
+
+ bool isAreaUpdateNotOpaque( const ::basegfx::B2DRectangle& rUpdateRect,
+ const AreaComponent& rComponent ) const;
+
+ bool isAreaUpdateOpaque( const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+ /** Check whether given update area can be handled by a simple
+ scroll
+
+ @param o_rMoveStart
+ Start rect of the move
+
+ @param o_rMoveEnd
+ End rect of the move. The content must be moved from start
+ to end rect
+
+ @param rUpdateArea
+ Area to check for scroll update optimization
+ */
+ bool isAreaUpdateScroll( ::basegfx::B2DRectangle& o_rMoveStart,
+ ::basegfx::B2DRectangle& o_rMoveEnd,
+ const UpdateArea& rUpdateArea,
+ ::std::size_t nNumSprites ) const;
+
+
+ VectorOfSprites maSprites; // list of active
+ // sprite
+ // objects. this
+ // list is only
+ // used for full
+ // repaints,
+ // otherwise, we
+ // rely on the
+ // active sprites
+ // itself to notify
+ // us.
+
+ VectorOfChangeRecords maChangeRecords; // vector of
+ // sprites
+ // changes
+ // since last
+ // updateScreen()
+ // call
+ };
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/vclwrapper.hxx b/canvas/inc/vclwrapper.hxx
new file mode 100644
index 000000000000..a77b2757f8bf
--- /dev/null
+++ b/canvas/inc/vclwrapper.hxx
@@ -0,0 +1,150 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <vcl/svapp.hxx>
+
+namespace canvas
+{
+ namespace vcltools
+ {
+ /** This helper template wraps VCL objects, and protects
+ object deletion with the Solar mutex. All other operations
+ are unprotected, this must be handled by client code.
+
+ The reason for this template is the fact that VCL objects
+ hold by value in uno::Reference-handled classes are
+ deleted without having the chance to get inbetween and
+ lock the solar mutex.
+
+ This template handles that problem transparently, the only
+ inconvenience is the fact that object member access now
+ has to be performed via operator->, since . is not
+ overloadable.
+
+ Otherwise, the template preserves the value semantics of
+ the wrapped object, that is, copy operations are performed
+ not by copying pointers, but by copying the underlying
+ object. This includes constness, i.e. on a const
+ VCLObject, only const methods of the wrapped object can be
+ called. Simply imagine this to be a value object of type
+ "template argument", with the only peculiarity that
+ member/method access is performed by operator-> instead of
+ the non-existing "operator.".
+ */
+ template< class Wrappee_ > class VCLObject
+ {
+ public:
+ typedef Wrappee_ Wrappee;
+
+ VCLObject() :
+ mpWrappee( new Wrappee() )
+ {
+ }
+
+ // no explicit here. VCLObjects should be freely
+ // constructible with Wrappees, and AFAIK there is no other
+ // implicit conversion path that could cause harm here
+ VCLObject( std::unique_ptr<Wrappee> pWrappee ) :
+ mpWrappee( pWrappee )
+ {
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const VCLObject& rOrig )
+ {
+ if( rOrig.mpWrappee )
+ mpWrappee = new Wrappee( *rOrig.mpWrappee );
+ else
+ mpWrappee = nullptr;
+ }
+
+ VCLObject(VCLObject&& rOrig) noexcept
+ : mpWrappee(std::move(rOrig.mpWrappee))
+ {
+ }
+
+ // This object has value semantics, thus, forward copy
+ // to wrappee
+ VCLObject( const Wrappee& rOrig ) :
+ mpWrappee( new Wrappee( rOrig ) )
+ {
+ }
+
+ // This object has value semantics, thus, forward
+ // assignment to wrappee
+ VCLObject& operator=( const VCLObject& rhs )
+ {
+ if (this != &rhs)
+ {
+ if( mpWrappee )
+ {
+ if( rhs.mpWrappee )
+ *mpWrappee = *rhs.mpWrappee;
+ }
+ else
+ {
+ if( rhs.mpWrappee )
+ mpWrappee = new Wrappee( *rhs.mpWrappee );
+ }
+ }
+ return *this;
+ }
+
+ VCLObject& operator=(VCLObject&& rhs) noexcept
+ {
+ std::swap(mpWrappee, rhs.mpWrappee);
+
+ return *this;
+ }
+
+ ~VCLObject()
+ {
+ // This here is the whole purpose of the template:
+ // protecting object deletion with the solar mutex
+ SolarMutexGuard aGuard;
+
+ mpWrappee.reset();
+ }
+
+ Wrappee* operator->() { return mpWrappee.get(); }
+ const Wrappee* operator->() const { return mpWrappee.get(); }
+
+ Wrappee& operator*() { return *mpWrappee; }
+ const Wrappee& operator*() const { return *mpWrappee; }
+
+ Wrappee& get() { return *mpWrappee; }
+ const Wrappee& get() const { return *mpWrappee; }
+
+ void swap( VCLObject& rOther )
+ {
+ ::std::swap( mpWrappee, rOther.mpWrappee );
+ }
+
+ private:
+
+ std::unique_ptr<Wrappee> mpWrappee;
+ };
+
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/inc/verifyinput.hxx b/canvas/inc/verifyinput.hxx
new file mode 100644
index 000000000000..91a59d7fc25a
--- /dev/null
+++ b/canvas/inc/verifyinput.hxx
@@ -0,0 +1,575 @@
+/* -*- 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 .
+ */
+
+#pragma once
+
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <canvas/canvastoolsdllapi.h>
+
+namespace com { namespace sun { namespace star { namespace geometry
+{
+ struct RealPoint2D;
+ struct RealSize2D;
+ struct RealBezierSegment2D;
+ struct RealRectangle2D;
+ struct AffineMatrix2D;
+ struct Matrix2D;
+ struct IntegerPoint2D;
+ struct IntegerSize2D;
+ struct IntegerRectangle2D;
+} } } }
+
+namespace com { namespace sun { namespace star { namespace rendering
+{
+ struct RenderState;
+ struct StrokeAttributes;
+ struct Texture;
+ struct ViewState;
+ struct IntegerBitmapLayout;
+ struct FontRequest;
+} } } }
+
+namespace com::sun::star::uno { template <class E> class Sequence; }
+
+namespace canvas
+{
+ namespace tools
+ {
+
+ // Input checking facilities
+
+
+ // This header provides methods to check all common
+ // css::rendering::* method input parameters against
+ // compliance to the API specification.
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::geometry::AffineMatrix2D& rMatrix,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given transformation contains valid floating point
+ values.
+
+ @param rMatrix
+ Matrix to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::geometry::Matrix2D& rMatrix,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given point contains valid floating point
+ values.
+
+ @param rPoint
+ Point to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::geometry::RealPoint2D& rPoint,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given bezier segment contains valid
+ floating point values.
+
+ @param rSegment
+ Segment to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::geometry::RealBezierSegment2D& rSegment,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Verify that the given rectangle contains valid floating
+ point values.
+
+ @param rRect
+ Rect to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::geometry::RealRectangle2D& rRect,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for view state validity.
+
+ @param viewState
+ Viewstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::ViewState& viewState,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for render state validity.
+
+ @param renderState
+ Renderstate to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @param nMinColorComponents
+ Minimal number of color components available in
+ RenderState::DeviceColor
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::RenderState& renderState,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos,
+ sal_Int32 nMinColorComponents=0 );
+
+ /** Basic check for stroke attributes validity.
+
+ @param strokeAttributes
+ Attributes to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::StrokeAttributes& strokeAttributes,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for texture validity.
+
+ @param texture
+ Texture to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::Texture& texture,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for bitmap layout validity.
+
+ @param bitmapLayout
+ Bitmap layout to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::IntegerBitmapLayout& bitmapLayout,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Basic check for font request validity.
+
+ @param fontRequest
+ Font request to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyInput( const css::rendering::FontRequest& fontRequest,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos );
+
+ /** Templatized check for uno::Reference validity.
+
+ @param rRef
+ Reference to check against non-NILness
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ template< class Interface > void verifyInput(
+ const css::uno::Reference< Interface >& rRef,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ if( !rRef.is() )
+ {
+#if OSL_DEBUG_LEVEL > 0
+ throw css::lang::IllegalArgumentException(
+ OUString::createFromAscii(pStr) + ": reference is NULL",
+ xIf,
+ nArgPos );
+#else
+ (void)pStr; (void)xIf; (void)nArgPos;
+ throw css::lang::IllegalArgumentException();
+#endif
+ }
+ }
+
+ /** Templatized check for content-of-sequence validity.
+
+ @param rSequence
+ Sequence of things to check
+
+ @param xIf
+ The interface that should be reported as the one
+ generating the exception.
+
+ @param nArgPos
+ Argument position on the call site (i.e. the position of
+ the argument, checked here, on the UNO interface
+ method. Counting starts at 0).
+
+ @throws a lang::IllegalArgumentException, if anything is wrong
+ */
+ template< typename SequenceContent > void verifyInput(
+ const css::uno::Sequence< SequenceContent >& rSequence,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf,
+ ::sal_Int16 nArgPos )
+ {
+ const SequenceContent* pCurr = rSequence.getConstArray();
+ const SequenceContent* pEnd = pCurr + rSequence.getLength();
+ while( pCurr != pEnd )
+ verifyInput( *pCurr++, pStr, xIf, nArgPos );
+ }
+
+ /// Catch-all, to handle cases that DON'T need input checking (i.e. the Integer geometry ones)
+ template< typename T > void verifyInput( const T& /*rDummy*/,
+ const char* /*pStr*/,
+ const css::uno::Reference< css::uno::XInterface >& /*xIf*/,
+ ::sal_Int16 /*nArgPos*/ )
+ {
+ }
+
+ // TODO(Q2): Employ some template arglist magic here, to avoid
+ // this duplication of code...
+
+ template< typename Arg0 > void verifyArgs( const Arg0& rArg0,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ }
+
+ template< typename Arg0,
+ typename Arg1 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ }
+
+ template< typename Arg0,
+ typename Arg1,
+ typename Arg2,
+ typename Arg3,
+ typename Arg4,
+ typename Arg5,
+ typename Arg6 > void verifyArgs( const Arg0& rArg0,
+ const Arg1& rArg1,
+ const Arg2& rArg2,
+ const Arg3& rArg3,
+ const Arg4& rArg4,
+ const Arg5& rArg5,
+ const Arg6& rArg6,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf )
+ {
+ verifyInput( rArg0, pStr, xIf, 0 );
+ verifyInput( rArg1, pStr, xIf, 1 );
+ verifyInput( rArg2, pStr, xIf, 2 );
+ verifyInput( rArg3, pStr, xIf, 3 );
+ verifyInput( rArg4, pStr, xIf, 4 );
+ verifyInput( rArg5, pStr, xIf, 5 );
+ verifyInput( rArg6, pStr, xIf, 6 );
+ }
+
+
+ /** Range checker, which throws css::lang::IllegalArgument exception, when
+ range is violated
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType lowerBound, NumType upperBound )
+ {
+ if( arg < lowerBound ||
+ arg > upperBound )
+ {
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws css::lang::IllegalArgument exception, when
+ range is violated
+
+ The checked range is half open, i.e. only bound by the specified value.
+
+ @param arg
+ Arg to check
+
+ @param bound
+ Bound to check against
+
+ @param bLowerBound
+ When true, given bound is the lower bound. When false,
+ given bound is the upper bound.
+ */
+ template< typename NumType > inline void verifyRange( NumType arg, NumType bound, bool bLowerBound=true )
+ {
+ if( (bLowerBound && arg < bound) ||
+ (!bLowerBound && arg > bound) )
+ {
+ throw css::lang::IllegalArgumentException();
+ }
+ }
+
+ /** Range checker, which throws css::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param rect
+ Rect to verify
+
+ @param size
+ Given rectangle must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const css::geometry::IntegerRectangle2D& rect,
+ const css::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws css::lang::IndexOutOfBounds exception, when
+ index range is violated
+
+ @param pos
+ Position to verify
+
+ @param size
+ Given position must be within ((0,0), (size.Width, size.Height))
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyIndexRange( const css::geometry::IntegerPoint2D& pos,
+ const css::geometry::IntegerSize2D& size );
+
+ /** Range checker, which throws css::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifyBitmapSize( const css::geometry::IntegerSize2D& size,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf );
+
+ /** Range checker, which throws css::lang::IndexOutOfBounds exception, when
+ the size is negative or null
+
+ @param size
+ Size to verify
+ */
+ CANVASTOOLS_DLLPUBLIC void verifySpriteSize( const css::geometry::RealSize2D& size,
+ const char* pStr,
+ const css::uno::Reference< css::uno::XInterface >& xIf );
+ }
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/canvas/source/cairo/cairo_cachedbitmap.hxx b/canvas/source/cairo/cairo_cachedbitmap.hxx
index e3dd9856bc17..bc406638dd57 100644
--- a/canvas/source/cairo/cairo_cachedbitmap.hxx
+++ b/canvas/source/cairo/cairo_cachedbitmap.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CACHEDBITMAP_HXX
#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_CACHEDBITMAP_HXX
-#include <canvas/base/cachedprimitivebase.hxx>
+#include <base/cachedprimitivebase.hxx>
#include <com/sun/star/rendering/RenderState.hpp>
#include <vcl/cairo.hxx>
diff --git a/canvas/source/cairo/cairo_canvas.hxx b/canvas/source/cairo/cairo_canvas.hxx
index 934b9edccd63..b576da8542fc 100644
--- a/canvas/source/cairo/cairo_canvas.hxx
+++ b/canvas/source/cairo/cairo_canvas.hxx
@@ -31,10 +31,10 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
-#include <canvas/base/graphicdevicebase.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <base/graphicdevicebase.hxx>
+#include <base/integerbitmapbase.hxx>
#include "cairo_canvashelper.hxx"
#include "cairo_devicehelper.hxx"
diff --git a/canvas/source/cairo/cairo_canvasbitmap.hxx b/canvas/source/cairo/cairo_canvasbitmap.hxx
index 2c6f788d078a..54cda90789fb 100644
--- a/canvas/source/cairo/cairo_canvasbitmap.hxx
+++ b/canvas/source/cairo/cairo_canvasbitmap.hxx
@@ -28,9 +28,9 @@
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <comphelper/uno3.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/integerbitmapbase.hxx>
#include "cairo_canvashelper.hxx"
#include "cairo_repainttarget.hxx"
diff --git a/canvas/source/cairo/cairo_canvascustomsprite.hxx b/canvas/source/cairo/cairo_canvascustomsprite.hxx
index 16ff0c105c7c..300f016464d8 100644
--- a/canvas/source/cairo/cairo_canvascustomsprite.hxx
+++ b/canvas/source/cairo/cairo_canvascustomsprite.hxx
@@ -30,8 +30,8 @@
#include <basegfx/point/b2dpoint.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/canvascustomspritebase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/canvascustomspritebase.hxx>
#include <vcl/cairo.hxx>
diff --git a/canvas/source/cairo/cairo_canvasfont.hxx b/canvas/source/cairo/cairo_canvasfont.hxx
index f35f6f455d11..59fca1286c3f 100644
--- a/canvas/source/cairo/cairo_canvasfont.hxx
+++ b/canvas/source/cairo/cairo_canvasfont.hxx
@@ -30,7 +30,7 @@
#include <vcl/font.hxx>
-#include <canvas/vclwrapper.hxx>
+#include <vclwrapper.hxx>
#include "cairo_surfaceprovider.hxx"
diff --git a/canvas/source/cairo/cairo_canvashelper.cxx b/canvas/source/cairo/cairo_canvashelper.cxx
index d3c36b47649e..b53c6eed2904 100644
--- a/canvas/source/cairo/cairo_canvashelper.cxx
+++ b/canvas/source/cairo/cairo_canvashelper.cxx
@@ -50,7 +50,7 @@
#include <vcl/virdev.hxx>
#include <canvas/canvastools.hxx>
-#include <canvas/parametricpolypolygon.hxx>
+#include <parametricpolypolygon.hxx>
#include <cairo.h>
#include "cairo_cachedbitmap.hxx"
diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx
index 386c922f4397..e86d6aadc132 100644
--- a/canvas/source/cairo/cairo_canvashelper_text.cxx
+++ b/canvas/source/cairo/cairo_canvashelper_text.cxx
@@ -28,7 +28,7 @@
#include <vcl/virdev.hxx>
#include <canvas/canvastools.hxx>
-#include <canvas/verifyinput.hxx>
+#include <verifyinput.hxx>
#include <cairo.h>
#include "cairo_canvasfont.hxx"
diff --git a/canvas/source/cairo/cairo_sprite.hxx b/canvas/source/cairo/cairo_sprite.hxx
index e5ea93d0ce05..446b2a59ea7c 100644
--- a/canvas/source/cairo/cairo_sprite.hxx
+++ b/canvas/source/cairo/cairo_sprite.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITE_HXX
#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITE_HXX
-#include <canvas/base/sprite.hxx>
+#include <base/sprite.hxx>
#include <vcl/cairo.hxx>
diff --git a/canvas/source/cairo/cairo_spritecanvas.hxx b/canvas/source/cairo/cairo_spritecanvas.hxx
index 1ea4d14f233e..42765643fabe 100644
--- a/canvas/source/cairo/cairo_spritecanvas.hxx
+++ b/canvas/source/cairo/cairo_spritecanvas.hxx
@@ -33,10 +33,10 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/spritecanvasbase.hxx>
-#include <canvas/base/spritesurface.hxx>
-#include <canvas/base/disambiguationhelper.hxx>
-#include <canvas/base/bufferedgraphicdevicebase.hxx>
+#include <base/spritecanvasbase.hxx>
+#include <base/spritesurface.hxx>
+#include <base/disambiguationhelper.hxx>
+#include <base/bufferedgraphicdevicebase.hxx>
#include "cairo_spritedevicehelper.hxx"
#include "cairo_repainttarget.hxx"
diff --git a/canvas/source/cairo/cairo_spritecanvashelper.hxx b/canvas/source/cairo/cairo_spritecanvashelper.hxx
index e8ebb515bb4c..6d659afd00c2 100644
--- a/canvas/source/cairo/cairo_spritecanvashelper.hxx
+++ b/canvas/source/cairo/cairo_spritecanvashelper.hxx
@@ -24,7 +24,7 @@
#include <com/sun/star/rendering/XAnimation.hpp>
#include <com/sun/star/rendering/XCustomSprite.hpp>
-#include <canvas/spriteredrawmanager.hxx>
+#include <spriteredrawmanager.hxx>
#include <vcl/cairo.hxx>
#include "cairo_canvashelper.hxx"
diff --git a/canvas/source/cairo/cairo_spritehelper.hxx b/canvas/source/cairo/cairo_spritehelper.hxx
index ceacd3e3168e..84bf77dbc90f 100644
--- a/canvas/source/cairo/cairo_spritehelper.hxx
+++ b/canvas/source/cairo/cairo_spritehelper.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEHELPER_HXX
#define INCLUDED_CANVAS_SOURCE_CAIRO_CAIRO_SPRITEHELPER_HXX
-#include <canvas/base/canvascustomspritehelper.hxx>
+#include <base/canvascustomspritehelper.hxx>
#include <basegfx/point/b2dpoint.hxx>
diff --git a/canvas/source/directx/dx_9rm.cxx b/canvas/source/directx/dx_9rm.cxx
index 511e90e9d6e2..834deb89eb2b 100644
--- a/canvas/source/directx/dx_9rm.cxx
+++ b/canvas/source/directx/dx_9rm.cxx
@@ -38,9 +38,9 @@
#include <canvas/elapsedtime.hxx>
#include <canvas/canvastools.hxx>
-#include <canvas/rendering/icolorbuffer.hxx>
-#include <canvas/rendering/irendermodule.hxx>
-#include <canvas/rendering/isurface.hxx>
+#include <rendering/icolorbuffer.hxx>
+#include <rendering/irendermodule.hxx>
+#include <rendering/isurface.hxx>
#include "dx_config.hxx"
#include "dx_impltools.hxx"
diff --git a/canvas/source/directx/dx_canvas.hxx b/canvas/source/directx/dx_canvas.hxx
index 210723ca2a4b..4db2b16a5d25 100644
--- a/canvas/source/directx/dx_canvas.hxx
+++ b/canvas/source/directx/dx_canvas.hxx
@@ -34,11 +34,11 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/graphicdevicebase.hxx>
-#include <canvas/base/canvasbase.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
+#include <base/integerbitmapbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/graphicdevicebase.hxx>
+#include <base/canvasbase.hxx>
+#include <base/bitmapcanvasbase.hxx>
#include "dx_bitmapprovider.hxx"
#include "dx_canvashelper.hxx"
diff --git a/canvas/source/directx/dx_canvasbitmap.hxx b/canvas/source/directx/dx_canvasbitmap.hxx
index d7031aaa4eb2..756791d1526d 100644
--- a/canvas/source/directx/dx_canvasbitmap.hxx
+++ b/canvas/source/directx/dx_canvasbitmap.hxx
@@ -26,9 +26,9 @@
#include <com/sun/star/beans/XFastPropertySet.hpp>
#include <basegfx/vector/b2isize.hxx>
#include <cppuhelper/compbase.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <base/integerbitmapbase.hxx>
#include "dx_bitmapprovider.hxx"
#include "dx_bitmapcanvashelper.hxx"
diff --git a/canvas/source/directx/dx_canvascustomsprite.hxx b/canvas/source/directx/dx_canvascustomsprite.hxx
index 1772741a3fdf..53886f636db3 100644
--- a/canvas/source/directx/dx_canvascustomsprite.hxx
+++ b/canvas/source/directx/dx_canvascustomsprite.hxx
@@ -33,8 +33,8 @@
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/canvascustomspritebase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/canvascustomspritebase.hxx>
#include "dx_sprite.hxx"
#include "dx_surfacebitmap.hxx"
diff --git a/canvas/source/directx/dx_canvashelper_texturefill.cxx b/canvas/source/directx/dx_canvashelper_texturefill.cxx
index 504987c64f9a..f60dffb3b870 100644
--- a/canvas/source/directx/dx_canvashelper_texturefill.cxx
+++ b/canvas/source/directx/dx_canvashelper_texturefill.cxx
@@ -36,7 +36,7 @@
#include <rtl/math.hxx>
#include <tools/diagnose_ex.h>
-#include <canvas/parametricpolypolygon.hxx>
+#include <parametricpolypolygon.hxx>
#include "dx_canvashelper.hxx"
#include "dx_impltools.hxx"
diff --git a/canvas/source/directx/dx_devicehelper.hxx b/canvas/source/directx/dx_devicehelper.hxx
index 51d46f29af97..ac52c127a0d5 100644
--- a/canvas/source/directx/dx_devicehelper.hxx
+++ b/canvas/source/directx/dx_devicehelper.hxx
@@ -27,7 +27,7 @@
#include "dx_rendermodule.hxx"
#include "dx_bitmap.hxx"
-#include <canvas/rendering/isurfaceproxymanager.hxx>
+#include <rendering/isurfaceproxymanager.hxx>
#include <vcl/vclptr.hxx>
class OutputDevice;
diff --git a/canvas/source/directx/dx_impltools.cxx b/canvas/source/directx/dx_impltools.cxx
index 6d7f54e4713b..18113ee34394 100644
--- a/canvas/source/directx/dx_impltools.cxx
+++ b/canvas/source/directx/dx_impltools.cxx
@@ -38,7 +38,7 @@
#include <tools/diagnose_ex.h>
#include <canvas/canvastools.hxx>
-#include <canvas/verifyinput.hxx>
+#include <verifyinput.hxx>
#include "dx_canvas.hxx"
#include "dx_canvasbitmap.hxx"
diff --git a/canvas/source/directx/dx_rendermodule.hxx b/canvas/source/directx/dx_rendermodule.hxx
index b4863953a4c3..0ab154182543 100644
--- a/canvas/source/directx/dx_rendermodule.hxx
+++ b/canvas/source/directx/dx_rendermodule.hxx
@@ -22,7 +22,7 @@
#include <basegfx/vector/b2ivector.hxx>
#include <basegfx/range/b2irectangle.hxx>
-#include <canvas/rendering/irendermodule.hxx>
+#include <rendering/irendermodule.hxx>
#include <memory>
#include "dx_winstuff.hxx"
diff --git a/canvas/source/directx/dx_sprite.hxx b/canvas/source/directx/dx_sprite.hxx
index 680a75f7decf..82c43fbde8b9 100644
--- a/canvas/source/directx/dx_sprite.hxx
+++ b/canvas/source/directx/dx_sprite.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITE_HXX
#define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SPRITE_HXX
-#include <canvas/base/sprite.hxx>
+#include <base/sprite.hxx>
namespace dxcanvas
{
diff --git a/canvas/source/directx/dx_spritecanvas.hxx b/canvas/source/directx/dx_spritecanvas.hxx
index bef5f5c15f73..22832bccef89 100644
--- a/canvas/source/directx/dx_spritecanvas.hxx
+++ b/canvas/source/directx/dx_spritecanvas.hxx
@@ -36,10 +36,10 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/spritecanvasbase.hxx>
-#include <canvas/base/spritesurface.hxx>
-#include <canvas/base/disambiguationhelper.hxx>
-#include <canvas/base/bufferedgraphicdevicebase.hxx>
+#include <base/spritecanvasbase.hxx>
+#include <base/spritesurface.hxx>
+#include <base/disambiguationhelper.hxx>
+#include <base/bufferedgraphicdevicebase.hxx>
#include "dx_bitmapprovider.hxx"
#include "dx_spritecanvashelper.hxx"
diff --git a/canvas/source/directx/dx_spritecanvashelper.hxx b/canvas/source/directx/dx_spritecanvashelper.hxx
index 5137d6f9f208..9e99489cd75a 100644
--- a/canvas/source/directx/dx_spritecanvashelper.hxx
+++ b/canvas/source/directx/dx_spritecanvashelper.hxx
@@ -23,9 +23,9 @@
#include <com/sun/star/rendering/XSpriteCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-#include <canvas/spriteredrawmanager.hxx>
-#include <canvas/rendering/isurfaceproxy.hxx>
-#include <canvas/rendering/isurfaceproxymanager.hxx>
+#include <spriteredrawmanager.hxx>
+#include <rendering/isurfaceproxy.hxx>
+#include <rendering/isurfaceproxymanager.hxx>
#include "dx_bitmapcanvashelper.hxx"
#include "dx_impltools.hxx"
diff --git a/canvas/source/directx/dx_spritedevicehelper.hxx b/canvas/source/directx/dx_spritedevicehelper.hxx
index 88848d4bf0ce..1e77a66fca97 100644
--- a/canvas/source/directx/dx_spritedevicehelper.hxx
+++ b/canvas/source/directx/dx_spritedevicehelper.hxx
@@ -28,7 +28,7 @@
#include "dx_surfacebitmap.hxx"
#include "dx_devicehelper.hxx"
-#include <canvas/rendering/isurfaceproxymanager.hxx>
+#include <rendering/isurfaceproxymanager.hxx>
namespace dxcanvas
diff --git a/canvas/source/directx/dx_spritehelper.hxx b/canvas/source/directx/dx_spritehelper.hxx
index c1fb66e01794..bc559c60127b 100644
--- a/canvas/source/directx/dx_spritehelper.hxx
+++ b/canvas/source/directx/dx_spritehelper.hxx
@@ -22,7 +22,7 @@
#include <com/sun/star/rendering/XCustomSprite.hpp>
-#include <canvas/base/canvascustomspritehelper.hxx>
+#include <base/canvascustomspritehelper.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2isize.hxx>
diff --git a/canvas/source/directx/dx_surfacebitmap.cxx b/canvas/source/directx/dx_surfacebitmap.cxx
index 7ca1596bcc96..52c83de26829 100644
--- a/canvas/source/directx/dx_surfacebitmap.cxx
+++ b/canvas/source/directx/dx_surfacebitmap.cxx
@@ -27,7 +27,7 @@
#include <basegfx/matrix/b2dhommatrix.hxx>
#include <basegfx/range/b2irange.hxx>
#include <tools/diagnose_ex.h>
-#include <canvas/rendering/icolorbuffer.hxx>
+#include <rendering/icolorbuffer.hxx>
#include "dx_graphicsprovider.hxx"
#include "dx_impltools.hxx"
diff --git a/canvas/source/directx/dx_surfacebitmap.hxx b/canvas/source/directx/dx_surfacebitmap.hxx
index 87d6dcbfe647..75cd630c6b6a 100644
--- a/canvas/source/directx/dx_surfacebitmap.hxx
+++ b/canvas/source/directx/dx_surfacebitmap.hxx
@@ -20,8 +20,8 @@
#ifndef INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SURFACEBITMAP_HXX
#define INCLUDED_CANVAS_SOURCE_DIRECTX_DX_SURFACEBITMAP_HXX
-#include <canvas/rendering/isurfaceproxy.hxx>
-#include <canvas/rendering/isurfaceproxymanager.hxx>
+#include <rendering/isurfaceproxy.hxx>
+#include <rendering/isurfaceproxymanager.hxx>
#include "dx_ibitmap.hxx"
#include "dx_canvasfont.hxx"
#include "dx_gdiplususer.hxx"
diff --git a/canvas/source/opengl/ogl_canvasbitmap.hxx b/canvas/source/opengl/ogl_canvasbitmap.hxx
index fa7b8de20af6..72ac619c5b60 100644
--- a/canvas/source/opengl/ogl_canvasbitmap.hxx
+++ b/canvas/source/opengl/ogl_canvasbitmap.hxx
@@ -15,9 +15,9 @@
#include <com/sun/star/rendering/XBitmapCanvas.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-#include <canvas/base/integerbitmapbase.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
+#include <base/integerbitmapbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/bitmapcanvasbase.hxx>
#include "ogl_bitmapcanvashelper.hxx"
#include "ogl_spritecanvas.hxx"
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.cxx b/canvas/source/opengl/ogl_canvascustomsprite.cxx
index bfcc3c95f84f..c7ca59b28291 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.cxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.cxx
@@ -16,7 +16,7 @@
#include <basegfx/polygon/b2dpolygontriangulator.hxx>
#include <basegfx/utils/canvastools.hxx>
#include <canvas/canvastools.hxx>
-#include <canvas/verifyinput.hxx>
+#include <verifyinput.hxx>
#include <tools/diagnose_ex.h>
#include "ogl_canvascustomsprite.hxx"
diff --git a/canvas/source/opengl/ogl_canvascustomsprite.hxx b/canvas/source/opengl/ogl_canvascustomsprite.hxx
index 2f603af40d11..0f0a7693c00b 100644
--- a/canvas/source/opengl/ogl_canvascustomsprite.hxx
+++ b/canvas/source/opengl/ogl_canvascustomsprite.hxx
@@ -17,7 +17,7 @@
#include <basegfx/point/b2dpoint.hxx>
-#include <canvas/base/basemutexhelper.hxx>
+#include <base/basemutexhelper.hxx>
#include "ogl_spritecanvas.hxx"
#include "ogl_canvashelper.hxx"
diff --git a/canvas/source/opengl/ogl_spritecanvas.hxx b/canvas/source/opengl/ogl_spritecanvas.hxx
index d7635cda6ca5..245575b863e7 100644
--- a/canvas/source/opengl/ogl_spritecanvas.hxx
+++ b/canvas/source/opengl/ogl_spritecanvas.hxx
@@ -24,9 +24,9 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/canvasbase.hxx>
-#include <canvas/base/disambiguationhelper.hxx>
-#include <canvas/base/bufferedgraphicdevicebase.hxx>
+#include <base/canvasbase.hxx>
+#include <base/disambiguationhelper.hxx>
+#include <base/bufferedgraphicdevicebase.hxx>
#include "ogl_spritedevicehelper.hxx"
#include "ogl_canvashelper.hxx"
diff --git a/canvas/source/tools/cachedprimitivebase.cxx b/canvas/source/tools/cachedprimitivebase.cxx
index dac4dd08768d..056796fcde98 100644
--- a/canvas/source/tools/cachedprimitivebase.cxx
+++ b/canvas/source/tools/cachedprimitivebase.cxx
@@ -24,7 +24,7 @@
#include <com/sun/star/rendering/RepaintResult.hpp>
#include <cppuhelper/supportsservice.hxx>
-#include <canvas/base/cachedprimitivebase.hxx>
+#include <base/cachedprimitivebase.hxx>
using namespace ::com::sun::star;
diff --git a/canvas/source/tools/canvascustomspritehelper.cxx b/canvas/source/tools/canvascustomspritehelper.cxx
index 52134658b41f..e98ecf4b27ed 100644
--- a/canvas/source/tools/canvascustomspritehelper.cxx
+++ b/canvas/source/tools/canvascustomspritehelper.cxx
@@ -32,7 +32,7 @@
#include <rtl/math.hxx>
#include <tools/diagnose_ex.h>
-#include <canvas/base/canvascustomspritehelper.hxx>
+#include <base/canvascustomspritehelper.hxx>
#include <canvas/canvastools.hxx>
using namespace ::com::sun::star;
diff --git a/canvas/source/tools/page.hxx b/canvas/source/tools/page.hxx
index 800a294a9433..cfb3cbd9d4bd 100644
--- a/canvas/source/tools/page.hxx
+++ b/canvas/source/tools/page.hxx
@@ -22,9 +22,9 @@
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/range/b2irectangle.hxx>
-#include <canvas/rendering/icolorbuffer.hxx>
-#include <canvas/rendering/irendermodule.hxx>
-#include <canvas/rendering/isurface.hxx>
+#include <rendering/icolorbuffer.hxx>
+#include <rendering/irendermodule.hxx>
+#include <rendering/isurface.hxx>
#include <memory>
#include <vector>
diff --git a/canvas/source/tools/pagemanager.hxx b/canvas/source/tools/pagemanager.hxx
index a811a10f3a62..761c84c33cf6 100644
--- a/canvas/source/tools/pagemanager.hxx
+++ b/canvas/source/tools/pagemanager.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_CANVAS_SOURCE_TOOLS_PAGEMANAGER_HXX
#include <basegfx/vector/b2isize.hxx>
-#include <canvas/rendering/irendermodule.hxx>
+#include <rendering/irendermodule.hxx>
#include "page.hxx"
diff --git a/canvas/source/tools/parametricpolypolygon.cxx b/canvas/source/tools/parametricpolypolygon.cxx
index 1da3960a2f06..5bbd50576f2e 100644
--- a/canvas/source/tools/parametricpolypolygon.cxx
+++ b/canvas/source/tools/parametricpolypolygon.cxx
@@ -26,7 +26,7 @@
#include <com/sun/star/rendering/XGraphicDevice.hpp>
-#include <canvas/parametricpolypolygon.hxx>
+#include <parametricpolypolygon.hxx>
using namespace ::com::sun::star;
diff --git a/canvas/source/tools/propertysethelper.cxx b/canvas/source/tools/propertysethelper.cxx
index d44f4cea12ad..e7880fe4bd83 100644
--- a/canvas/source/tools/propertysethelper.cxx
+++ b/canvas/source/tools/propertysethelper.cxx
@@ -19,7 +19,7 @@
#include <sal/config.h>
-#include <canvas/propertysethelper.hxx>
+#include <propertysethelper.hxx>
#include <com/sun/star/beans/PropertyVetoException.hpp>
#include <com/sun/star/beans/UnknownPropertyException.hpp>
diff --git a/canvas/source/tools/spriteredrawmanager.cxx b/canvas/source/tools/spriteredrawmanager.cxx
index 1307acea0372..110eb5540e73 100644
--- a/canvas/source/tools/spriteredrawmanager.cxx
+++ b/canvas/source/tools/spriteredrawmanager.cxx
@@ -26,7 +26,7 @@
#include <tools/diagnose_ex.h>
#include <sal/log.hxx>
-#include <canvas/spriteredrawmanager.hxx>
+#include <spriteredrawmanager.hxx>
#include <boost/range/adaptor/reversed.hpp>
namespace canvas
diff --git a/canvas/source/tools/surface.hxx b/canvas/source/tools/surface.hxx
index 66d4fe3120c4..e791e6b5050d 100644
--- a/canvas/source/tools/surface.hxx
+++ b/canvas/source/tools/surface.hxx
@@ -26,7 +26,7 @@
#include <basegfx/range/b2drectangle.hxx>
#include <basegfx/vector/b2isize.hxx>
#include <basegfx/matrix/b2dhommatrix.hxx>
-#include <canvas/rendering/icolorbuffer.hxx>
+#include <rendering/icolorbuffer.hxx>
#include "pagemanager.hxx"
diff --git a/canvas/source/tools/surfaceproxy.hxx b/canvas/source/tools/surfaceproxy.hxx
index 09cd36d7f6b0..fb9308a61bc5 100644
--- a/canvas/source/tools/surfaceproxy.hxx
+++ b/canvas/source/tools/surfaceproxy.hxx
@@ -20,8 +20,8 @@
#ifndef INCLUDED_CANVAS_SOURCE_TOOLS_SURFACEPROXY_HXX
#define INCLUDED_CANVAS_SOURCE_TOOLS_SURFACEPROXY_HXX
-#include <canvas/rendering/isurfaceproxy.hxx>
-#include <canvas/rendering/icolorbuffer.hxx>
+#include <rendering/isurfaceproxy.hxx>
+#include <rendering/icolorbuffer.hxx>
#include "pagemanager.hxx"
#include "surface.hxx"
diff --git a/canvas/source/tools/surfaceproxymanager.cxx b/canvas/source/tools/surfaceproxymanager.cxx
index 87aa953cf213..b60c5ecb485b 100644
--- a/canvas/source/tools/surfaceproxymanager.cxx
+++ b/canvas/source/tools/surfaceproxymanager.cxx
@@ -19,8 +19,8 @@
#include <sal/config.h>
-#include <canvas/rendering/isurfaceproxy.hxx>
-#include <canvas/rendering/isurfaceproxymanager.hxx>
+#include <rendering/isurfaceproxy.hxx>
+#include <rendering/isurfaceproxymanager.hxx>
#include "surfaceproxy.hxx"
diff --git a/canvas/source/tools/verifyinput.cxx b/canvas/source/tools/verifyinput.cxx
index 052d8bbfb723..16fc3f8d6a10 100644
--- a/canvas/source/tools/verifyinput.cxx
+++ b/canvas/source/tools/verifyinput.cxx
@@ -41,7 +41,7 @@
#include <com/sun/star/rendering/ViewState.hpp>
#include <com/sun/star/util/Endianness.hpp>
-#include <canvas/verifyinput.hxx>
+#include <verifyinput.hxx>
using namespace ::com::sun::star;
diff --git a/canvas/source/vcl/bitmapbackbuffer.hxx b/canvas/source/vcl/bitmapbackbuffer.hxx
index 6f147b79756c..fd2e45f5143a 100644
--- a/canvas/source/vcl/bitmapbackbuffer.hxx
+++ b/canvas/source/vcl/bitmapbackbuffer.hxx
@@ -23,7 +23,7 @@
#include <vcl/virdev.hxx>
#include <vcl/bitmapex.hxx>
-#include <canvas/vclwrapper.hxx>
+#include <vclwrapper.hxx>
#include "outdevprovider.hxx"
#include <memory>
diff --git a/canvas/source/vcl/cachedbitmap.hxx b/canvas/source/vcl/cachedbitmap.hxx
index c96e24bb31b7..f76b2c3fc59e 100644
--- a/canvas/source/vcl/cachedbitmap.hxx
+++ b/canvas/source/vcl/cachedbitmap.hxx
@@ -21,7 +21,7 @@
#define INCLUDED_CANVAS_SOURCE_VCL_CACHEDBITMAP_HXX
#include <com/sun/star/rendering/RenderState.hpp>
-#include <canvas/base/cachedprimitivebase.hxx>
+#include <base/cachedprimitivebase.hxx>
#include <vcl/GraphicObject.hxx>
#include <memory>
diff --git a/canvas/source/vcl/canvas.hxx b/canvas/source/vcl/canvas.hxx
index db9e7c4b9f8c..6a3c66b00d75 100644
--- a/canvas/source/vcl/canvas.hxx
+++ b/canvas/source/vcl/canvas.hxx
@@ -31,10 +31,10 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
-#include <canvas/base/graphicdevicebase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <base/integerbitmapbase.hxx>
+#include <base/graphicdevicebase.hxx>
#include "canvashelper.hxx"
#include "impltools.hxx"
diff --git a/canvas/source/vcl/canvasbitmap.hxx b/canvas/source/vcl/canvasbitmap.hxx
index 934044b59beb..ee8ae6b45f41 100644
--- a/canvas/source/vcl/canvasbitmap.hxx
+++ b/canvas/source/vcl/canvasbitmap.hxx
@@ -29,9 +29,9 @@
#include <vcl/bitmapex.hxx>
-#include <canvas/base/bitmapcanvasbase.hxx>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/integerbitmapbase.hxx>
+#include <base/bitmapcanvasbase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/integerbitmapbase.hxx>
#include "canvasbitmaphelper.hxx"
#include "impltools.hxx"
diff --git a/canvas/source/vcl/canvascustomsprite.hxx b/canvas/source/vcl/canvascustomsprite.hxx
index 91de9c253cd0..675699a333e2 100644
--- a/canvas/source/vcl/canvascustomsprite.hxx
+++ b/canvas/source/vcl/canvascustomsprite.hxx
@@ -28,9 +28,9 @@
#include <com/sun/star/rendering/XCustomSprite.hpp>
#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-#include <canvas/base/basemutexhelper.hxx>
-#include <canvas/base/spritesurface.hxx>
-#include <canvas/base/canvascustomspritebase.hxx>
+#include <base/basemutexhelper.hxx>
+#include <base/spritesurface.hxx>
+#include <base/canvascustomspritebase.hxx>
#include "sprite.hxx"
#include "canvashelper.hxx"
diff --git a/canvas/source/vcl/canvasfont.hxx b/canvas/source/vcl/canvasfont.hxx
index 70d546171a41..f9cd2d6d29f3 100644
--- a/canvas/source/vcl/canvasfont.hxx
+++ b/canvas/source/vcl/canvasfont.hxx
@@ -31,7 +31,7 @@
#include <vcl/font.hxx>
-#include <canvas/vclwrapper.hxx>
+#include <vclwrapper.hxx>
#include "outdevprovider.hxx"
diff --git a/canvas/source/vcl/canvashelper_texturefill.cxx b/canvas/source/vcl/canvashelper_texturefill.cxx
index bd17a8883d21..646cef28aac6 100644
--- a/canvas/source/vcl/canvashelper_texturefill.cxx
+++ b/canvas/source/vcl/canvashelper_texturefill.cxx
@@ -40,7 +40,7 @@
#include <vcl/virdev.hxx>
#include <canvas/canvastools.hxx>
-#include <canvas/parametricpolypolygon.hxx>
+#include <parametricpolypolygon.hxx>
#include "canvashelper.hxx"
#include "impltools.hxx"
diff --git a/canvas/source/vcl/sprite.hxx b/canvas/source/vcl/sprite.hxx
index c7de3575169b..3d29041d9916 100644
--- a/canvas/source/vcl/sprite.hxx
+++ b/canvas/source/vcl/sprite.hxx
@@ -20,7 +20,7 @@
#ifndef INCLUDED_CANVAS_SOURCE_VCL_SPRITE_HXX
#define INCLUDED_CANVAS_SOURCE_VCL_SPRITE_HXX
-#include <canvas/base/sprite.hxx>
+#include <base/sprite.hxx>
class OutputDevice;
diff --git a/canvas/source/vcl/spritecanvas.hxx b/canvas/source/vcl/spritecanvas.hxx
index 7681835df2a4..fcca957dbc5c 100644
--- a/canvas/source/vcl/spritecanvas.hxx
+++ b/canvas/source/vcl/spritecanvas.hxx
@@ -35,10 +35,10 @@
#include <cppuhelper/compbase.hxx>
#include <comphelper/uno3.hxx>
-#include <canvas/base/spritecanvasbase.hxx>
-#include <canvas/base/spritesurface.hxx>
-#include <canvas/base/disambiguationhelper.hxx>
-#include <canvas/base/bufferedgraphicdevicebase.hxx>
+#include <base/spritecanvasbase.hxx>
+#include <base/spritesurface.hxx>
+#include <base/disambiguationhelper.hxx>
+#include <base/bufferedgraphicdevicebase.hxx>
#include "spritecanvashelper.hxx"
#include "impltools.hxx"
diff --git a/canvas/source/vcl/spritecanvashelper.hxx b/canvas/source/vcl/spritecanvashelper.hxx
index f32c5f955fdf..b7553e367c5d 100644
--- a/canvas/source/vcl/spritecanvashelper.hxx
+++ b/canvas/source/vcl/spritecanvashelper.hxx
@@ -27,7 +27,7 @@
#include <vcl/vclptr.hxx>
#include <vcl/virdev.hxx>
-#include <canvas/spriteredrawmanager.hxx>
+#include <spriteredrawmanager.hxx>
#include <canvas/elapsedtime.hxx>
#include "canvashelper.hxx"
diff --git a/canvas/source/vcl/spritehelper.hxx b/canvas/source/vcl/spritehelper.hxx
index d25bdc4166f3..1599fe40717e 100644
--- a/canvas/source/vcl/spritehelper.hxx
+++ b/canvas/source/vcl/spritehelper.hxx
@@ -22,9 +22,9 @@
#include <vcl/bitmapex.hxx>
-#include <canvas/base/canvascustomspritehelper.hxx>
-#include <canvas/base/spritesurface.hxx>
-#include <canvas/vclwrapper.hxx>
+#include <base/canvascustomspritehelper.hxx>
+#include <base/spritesurface.hxx>
+#include <vclwrapper.hxx>
#include "backbuffer.hxx"