ooo-build r14328 - in trunk: . patches/test
- From: thorstenb svn gnome org
- To: svn-commits-list gnome org
- Subject: ooo-build r14328 - in trunk: . patches/test
- Date: Thu, 16 Oct 2008 23:23:21 +0000 (UTC)
Author: thorstenb
Date: Thu Oct 16 23:23:21 2008
New Revision: 14328
URL: http://svn.gnome.org/viewvc/ooo-build?rev=14328&view=rev
Log:
* patches/test/opengl-canvas.diff: work-in-progress, basic output
working, joined parts of transogl-fix-presenter-view.diff to clean
up various parts in slideshow that relied on XBitmapCanvas to
retrieve canvas sizes.
Modified:
trunk/ChangeLog
trunk/patches/test/opengl-canvas.diff
Modified: trunk/patches/test/opengl-canvas.diff
==============================================================================
--- trunk/patches/test/opengl-canvas.diff (original)
+++ trunk/patches/test/opengl-canvas.diff Thu Oct 16 23:23:21 2008
@@ -5,28 +5,47 @@
---
- canvas/prj/build.lst | 1
- canvas/source/opengl/exports.dxp | 3
- canvas/source/opengl/exports.map | 8
- canvas/source/opengl/makefile.mk | 65 ++
- canvas/source/opengl/ogl_bitmapcanvashelper.cxx | 107 +++
- canvas/source/opengl/ogl_bitmapcanvashelper.hxx | 106 +++
- canvas/source/opengl/ogl_canvasbitmap.cxx | 62 ++
- canvas/source/opengl/ogl_canvasbitmap.hxx | 81 +++
- canvas/source/opengl/ogl_canvascustomsprite.cxx | 123 ++++
- canvas/source/opengl/ogl_canvascustomsprite.hxx | 97 +++
- canvas/source/opengl/ogl_canvasfont.cxx | 88 +++
- canvas/source/opengl/ogl_canvasfont.hxx | 72 ++
- canvas/source/opengl/ogl_canvashelper.cxx | 705 +++++++++++++++++++++++
- canvas/source/opengl/ogl_canvashelper.hxx | 227 +++++++
- canvas/source/opengl/ogl_spritecanvas.cxx | 204 +++++++
- canvas/source/opengl/ogl_spritecanvas.hxx | 125 ++++
- canvas/source/opengl/ogl_spritedevicehelper.cxx | 220 +++++++
- canvas/source/opengl/ogl_spritedevicehelper.hxx | 102 +++
- canvas/source/opengl/ogl_textlayout.cxx | 222 +++++++
- canvas/source/opengl/ogl_textlayout.hxx | 83 +++
- offapi/com/sun/star/rendering/XSpriteCanvas.idl | 13
- 21 files changed, 2707 insertions(+), 7 deletions(-)
+ canvas/prj/build.lst | 1
+ canvas/prj/d.lst | 2
+ canvas/source/cairo/cairo_canvashelper.hxx | 1
+ canvas/source/directx/dx_bitmapcanvashelper.hxx | 1
+ canvas/source/null/null_canvashelper.hxx | 1
+ canvas/source/opengl/exports.dxp | 3
+ canvas/source/opengl/exports.map | 8
+ canvas/source/opengl/makefile.mk | 65 ++
+ canvas/source/opengl/ogl_bitmapcanvashelper.cxx | 107 +++
+ canvas/source/opengl/ogl_bitmapcanvashelper.hxx | 106 +++
+ canvas/source/opengl/ogl_canvasbitmap.cxx | 62 ++
+ canvas/source/opengl/ogl_canvasbitmap.hxx | 81 ++
+ canvas/source/opengl/ogl_canvascustomsprite.cxx | 151 ++++
+ canvas/source/opengl/ogl_canvascustomsprite.hxx | 100 +++
+ canvas/source/opengl/ogl_canvasfont.cxx | 88 ++
+ canvas/source/opengl/ogl_canvasfont.hxx | 72 ++
+ canvas/source/opengl/ogl_canvashelper.cxx | 707 ++++++++++++++++++++
+ canvas/source/opengl/ogl_canvashelper.hxx | 227 ++++++
+ canvas/source/opengl/ogl_spritecanvas.cxx | 202 ++++++
+ canvas/source/opengl/ogl_spritecanvas.hxx | 126 ++++
+ canvas/source/opengl/ogl_spritedevicehelper.cxx | 529 +++++++++++++++
+ canvas/source/opengl/ogl_spritedevicehelper.hxx | 119 +++
+ canvas/source/opengl/ogl_textlayout.cxx | 222 ++++++
+ canvas/source/opengl/ogl_textlayout.hxx | 83 ++
+ canvas/source/opengl/ogl_tools.hxx | 35 +
+ canvas/source/vcl/canvashelper.hxx | 1
+ cppcanvas/inc/cppcanvas/spritecanvas.hxx | 4
+ cppcanvas/source/wrapper/implspritecanvas.cxx | 4
+ cppcanvas/source/wrapper/implspritecanvas.hxx | 4
+ .../com/sun/star/presentation/XSlideShowView.idl | 10
+ offapi/com/sun/star/rendering/XSpriteCanvas.idl | 13
+ .../registry/data/org/openoffice/Office/Canvas.xcu | 1
+ scp2/source/canvas/makefile.mk | 1
+ scp2/source/canvas/openglcanvas.scp | 28 +
+ scp2/util/makefile.mk | 4
+ sd/source/ui/slideshow/slideshowviewimpl.cxx | 13
+ sd/source/ui/slideshow/slideshowviewimpl.hxx | 1
+ sdext/source/presenter/PresenterSlideShowView.cxx | 48 +
+ sdext/source/presenter/PresenterSlideShowView.hxx | 7
+ slideshow/source/engine/waitsymbol.cxx | 13
+ 40 files changed, 3206 insertions(+), 45 deletions(-)
create mode 100644 canvas/source/opengl/exports.dxp
create mode 100644 canvas/source/opengl/exports.map
create mode 100644 canvas/source/opengl/makefile.mk
@@ -46,6 +65,8 @@
create mode 100644 canvas/source/opengl/ogl_spritedevicehelper.hxx
create mode 100644 canvas/source/opengl/ogl_textlayout.cxx
create mode 100644 canvas/source/opengl/ogl_textlayout.hxx
+ create mode 100644 canvas/source/opengl/ogl_tools.hxx
+ create mode 100644 scp2/source/canvas/openglcanvas.scp
diff --git canvas/prj/build.lst canvas/prj/build.lst
@@ -60,6 +81,61 @@
cv canvas\source\null nmake - all cv_null cv_tools cv_inc NULL
cv canvas\source\java nmake - all cv_java cv_inc NULL
cv canvas\source\factory nmake - all cv_factory cv_inc NULL
+diff --git canvas/prj/d.lst canvas/prj/d.lst
+index 986253a..dbffabf 100644
+--- canvas/prj/d.lst
++++ canvas/prj/d.lst
+@@ -1,5 +1,6 @@
+ ..\%__SRC%\bin\canvasto*.dll %_DEST%\bin%_EXT%\canvasto*.dll
+ ..\%__SRC%\bin\cairocan*.dll %_DEST%\bin%_EXT%\cairocan*.dll
++..\%__SRC%\bin\oglcanvas*.dll %_DEST%\bin%_EXT%\oglcanvas*.dll
+ ..\%__SRC%\bin\directx*.dll %_DEST%\bin%_EXT%\directx*.dll
+ ..\%__SRC%\bin\gdiplus*.dll %_DEST%\bin%_EXT%\gdiplus*.dll
+ ..\%__SRC%\bin\vclcanva*.dll %_DEST%\bin%_EXT%\vclcanva*.dll
+@@ -9,6 +10,7 @@
+ ..\%__SRC%\lib\icanvastools.lib %_DEST%\lib%_EXT%\icanvastools.lib
+ ..\%__SRC%\lib\libcanvastools*.so %_DEST%\lib%_EXT%\
+ ..\%__SRC%\lib\cairocanvas.uno.so %_DEST%\lib%_EXT%\cairocanvas.uno.so
++..\%__SRC%\lib\oglcanvas.uno.so %_DEST%\lib%_EXT%\oglcanvas.uno.so
+ ..\%__SRC%\lib\vclcanvas.uno.so %_DEST%\lib%_EXT%\vclcanvas.uno.so
+ ..\%__SRC%\lib\nullcanvas.uno.so %_DEST%\lib%_EXT%\nullcanvas.uno.so
+ ..\%__SRC%\lib\simplecanvas.uno.so %_DEST%\lib%_EXT%\simplecanvas.uno.so
+diff --git canvas/source/cairo/cairo_canvashelper.hxx canvas/source/cairo/cairo_canvashelper.hxx
+index 3bbcf6c..a1f6a12 100644
+--- canvas/source/cairo/cairo_canvashelper.hxx
++++ canvas/source/cairo/cairo_canvashelper.hxx
+@@ -32,6 +32,7 @@
+ #define _CAIROCANVAS_CANVASHELPER_HXX_
+
+ #include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/XIntegerBitmap.hpp>
+
+ #include <basegfx/vector/b2isize.hxx>
+diff --git canvas/source/directx/dx_bitmapcanvashelper.hxx canvas/source/directx/dx_bitmapcanvashelper.hxx
+index 0d9c0b7..cd47368 100755
+--- canvas/source/directx/dx_bitmapcanvashelper.hxx
++++ canvas/source/directx/dx_bitmapcanvashelper.hxx
+@@ -32,6 +32,7 @@
+ #define _DXCANVAS_BITMAPCANVASHELPER_HXX_
+
+ #include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+
+ #include <basegfx/vector/b2isize.hxx>
+ #include <basegfx/vector/b2dsize.hxx>
+diff --git canvas/source/null/null_canvashelper.hxx canvas/source/null/null_canvashelper.hxx
+index 30c8ab6..5923814 100644
+--- canvas/source/null/null_canvashelper.hxx
++++ canvas/source/null/null_canvashelper.hxx
+@@ -32,6 +32,7 @@
+ #define _NULLCANVAS_CANVASHELPER_HXX_
+
+ #include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/XIntegerBitmap.hpp>
+
+ #include <basegfx/vector/b2isize.hxx>
diff --git canvas/source/opengl/exports.dxp canvas/source/opengl/exports.dxp
new file mode 100644
index 0000000..9630d7e
@@ -85,7 +161,7 @@
+};
diff --git canvas/source/opengl/makefile.mk canvas/source/opengl/makefile.mk
new file mode 100644
-index 0000000..fe31daf
+index 0000000..38aa412
--- /dev/null
+++ canvas/source/opengl/makefile.mk
@@ -0,0 +1,65 @@
@@ -132,7 +208,7 @@
+
+
+SHL1TARGET=$(TARGET).uno
-+SHL1STDLIBS= $(TKLIB) $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB)
++SHL1STDLIBS= $(VCLLIB) $(TKLIB) $(CPPULIB) $(SALLIB) $(COMPHELPERLIB) $(CPPUHELPERLIB) $(BASEGFXLIB) $(CANVASTOOLSLIB)
+
+.IF "$(GUI)"=="UNX"
+ SHL1STDLIBS += -lGL -lGLU -lX11
@@ -536,10 +612,10 @@
+#endif
diff --git canvas/source/opengl/ogl_canvascustomsprite.cxx canvas/source/opengl/ogl_canvascustomsprite.cxx
new file mode 100644
-index 0000000..4d722df
+index 0000000..d791791
--- /dev/null
+++ canvas/source/opengl/ogl_canvascustomsprite.cxx
-@@ -0,0 +1,123 @@
+@@ -0,0 +1,151 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -559,6 +635,7 @@
+#include "precompiled_canvas.hxx"
+
+#include "ogl_canvascustomsprite.hxx"
++#include "ogl_tools.hxx"
+
+#include <canvas/debug.hxx>
+#include <canvas/verbosetrace.hxx>
@@ -571,6 +648,10 @@
+#include <basegfx/point/b2dpoint.hxx>
+#include <basegfx/tools/canvastools.hxx>
+
++#include <GL/gl.h>
++#include <GL/glu.h>
++#include <GL/glext.h>
++
+
+using namespace ::com::sun::star;
+
@@ -662,13 +743,36 @@
+ {
+ return this;
+ }
++
++ bool CanvasCustomSprite::renderSprite() const
++ {
++ TransformationPreserver aPreserver;
++
++ // translate sprite to output position
++ glTranslated(maPosition.getX(), maPosition.getY(), 0);
++
++ // apply sprite content transformation matrix
++ double aGLTransform[] =
++ {
++ maTransformation.m00, maTransformation.m10, 0, 0,
++ maTransformation.m01, maTransformation.m11, 0, 0,
++ maTransformation.m02, maTransformation.m12, 1, 0,
++ 0, 0, 0, 1
++ };
++ glMultMatrixd(aGLTransform);
++
++ if( !maCanvasHelper.renderRecordedActions() )
++ return false;
++
++ return true;
++ }
+}
diff --git canvas/source/opengl/ogl_canvascustomsprite.hxx canvas/source/opengl/ogl_canvascustomsprite.hxx
new file mode 100644
-index 0000000..87e14af
+index 0000000..7d71803
--- /dev/null
+++ canvas/source/opengl/ogl_canvascustomsprite.hxx
-@@ -0,0 +1,97 @@
+@@ -0,0 +1,100 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -749,7 +853,10 @@
+ // XCustomSprite
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XCanvas > SAL_CALL getContentCanvas() throw (::com::sun::star::uno::RuntimeException);
+
-+ double getPriority() const;
++ double getPriority() const { return mfPriority; }
++
++ /// Render sprite content at sprite position
++ bool renderSprite() const;
+
+ private:
+ /** MUST hold here, too, since CanvasHelper only contains a
@@ -940,10 +1047,10 @@
+#endif
diff --git canvas/source/opengl/ogl_canvashelper.cxx canvas/source/opengl/ogl_canvashelper.cxx
new file mode 100644
-index 0000000..168ae2d
+index 0000000..f37605e
--- /dev/null
+++ canvas/source/opengl/ogl_canvashelper.cxx
-@@ -0,0 +1,705 @@
+@@ -0,0 +1,707 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -979,6 +1086,7 @@
+#include "ogl_canvasfont.hxx"
+#include "ogl_canvasbitmap.hxx"
+#include "ogl_spritecanvas.hxx"
++#include "ogl_tools.hxx"
+
+#include <GL/gl.h>
+#include <GL/glu.h>
@@ -1035,15 +1143,6 @@
+
+ namespace
+ {
-+ struct TransformationPreserver
-+ {
-+ TransformationPreserver()
-+ { glPushAttrib(GL_TRANSFORM_BIT); }
-+
-+ ~TransformationPreserver()
-+ { glPopAttrib(); }
-+ };
-+
+ void renderPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPoly )
+ {
+ for( sal_uInt32 i=0; i<rPolyPoly.count(); i++ )
@@ -1070,7 +1169,7 @@
+ {
+ rTransform.get(0,0), rTransform.get(1,0), 0, 0,
+ rTransform.get(0,1), rTransform.get(1,1), 0, 0,
-+ rTransform.get(0,2), rTransform.get(1,2), 0, 0,
++ rTransform.get(0,2), rTransform.get(1,2), 1, 0,
+ 0, 0, 0, 1
+ };
+ glMultMatrixd(aGLTransform);
@@ -1190,6 +1289,9 @@
+ glGenTextures(1, &nTexture);
+ glBindTexture(GL_TEXTURE_2D, nTexture);
+
++ // TODO(E3): handle limited texture sizes -
++ // glGetIntegerv(GL_MAX_TEXTURE_SIZE)
++
+ gluBuild2DMipmaps(GL_TEXTURE_2D,
+ 4,
+ rPixelSize.Width,
@@ -1223,6 +1325,7 @@
+ {
+ mpDevice = rSrc.mpDevice;
+ mpRecordedActions = rSrc.mpRecordedActions;
++ return *this;
+ }
+
+ void CanvasHelper::disposing()
@@ -1640,6 +1743,7 @@
+ std::vector<Action>::const_iterator aCurr(mpRecordedActions->begin());
+ const std::vector<Action>::const_iterator aEnd(mpRecordedActions->end());
+ while( aCurr != aEnd )
++ {
+ if( !aCurr->maFunction( *this,
+ aCurr->maTransform,
+ aCurr->meSrcBlendMode,
@@ -1647,6 +1751,11 @@
+ aCurr->maARGBColor,
+ aCurr->maPolyPoly ) )
+ return false;
++
++ ++aCurr;
++ }
++
++ return true;
+ }
+}
diff --git canvas/source/opengl/ogl_canvashelper.hxx canvas/source/opengl/ogl_canvashelper.hxx
@@ -1884,10 +1993,10 @@
+#endif
diff --git canvas/source/opengl/ogl_spritecanvas.cxx canvas/source/opengl/ogl_spritecanvas.cxx
new file mode 100644
-index 0000000..55d0429
+index 0000000..5624d60
--- /dev/null
+++ canvas/source/opengl/ogl_spritecanvas.cxx
-@@ -0,0 +1,204 @@
+@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -1940,8 +2049,7 @@
+ SpriteCanvas::SpriteCanvas( const uno::Sequence< uno::Any >& aArguments,
+ const uno::Reference< uno::XComponentContext >& rxContext ) :
+ maArguments(aArguments),
-+ mxComponentContext( rxContext ),
-+ maActiveSprites()
++ mxComponentContext( rxContext )
+ {
+ }
+
@@ -1974,9 +2082,13 @@
+ "Parent window not VCL window, or canvas out-of-process!")),
+ NULL);
+
++ awt::Rectangle aRect;
++ maArguments[2] >>= aRect;
++
+ // setup helper
+ maDeviceHelper.init( *pParentWindow,
-+ *this );
++ *this,
++ aRect );
+ maCanvasHelper.init( *this );
+ maArguments.realloc(0);
+ }
@@ -2036,28 +2148,16 @@
+ }
+
+ uno::Reference< rendering::XSprite > SAL_CALL SpriteCanvas::createClonedSprite(
-+ const uno::Reference< rendering::XSprite >& original ) throw (lang::IllegalArgumentException,
-+ uno::RuntimeException)
++ const uno::Reference< rendering::XSprite >& /*original*/ ) throw (lang::IllegalArgumentException,
++ uno::RuntimeException)
+ {
+ return uno::Reference< rendering::XSprite >();
+ }
+
-+ sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool /*bUpdateAll*/ ) throw (uno::RuntimeException)
++ sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) throw (uno::RuntimeException)
+ {
+ ::osl::MutexGuard aGuard( m_aMutex );
-+
-+ // avoid repaints on hidden window (hidden: not mapped to
-+ // screen). Return failure, since the screen really has _not_
-+ // been updated (caller should try again later)
-+ if( mbIsVisible )
-+ {
-+ glClearColor(0,0,0,0);
-+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
-+ }
-+ else
-+ {
-+ return mbIsVisible;
-+ }
++ return maDeviceHelper.showBuffer(mbIsVisible, bUpdateAll);
+ }
+
+ ::rtl::OUString SAL_CALL SpriteCanvas::getServiceName( ) throw (uno::RuntimeException)
@@ -2065,14 +2165,21 @@
+ return ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( SPRITECANVAS_SERVICE_NAME ) );
+ }
+
-+ void SpriteCanvas::show( const uno::Reference< rendering::XSprite >& xSprite )
++ void SpriteCanvas::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
+ {
-+ maActiveSprites.insert(xSprite);
++ ::osl::MutexGuard aGuard( m_aMutex );
++ maDeviceHelper.show(xSprite);
+ }
+
-+ void SpriteCanvas::hide( const uno::Reference< rendering::XSprite >& xSprite )
++ void SpriteCanvas::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
+ {
-+ maActiveSprites.erase(xSprite);
++ ::osl::MutexGuard aGuard( m_aMutex );
++ maDeviceHelper.hide(xSprite);
++ }
++
++ bool SpriteCanvas::renderRecordedActions() const
++ {
++ return maCanvasHelper.renderRecordedActions();
+ }
+
+ static uno::Reference<uno::XInterface> initCanvas( SpriteCanvas* pCanvas )
@@ -2094,10 +2201,10 @@
+COMPHELPER_SERVICEDECL_EXPORTS1(oglcanvas::oglSpriteCanvasDecl);
diff --git canvas/source/opengl/ogl_spritecanvas.hxx canvas/source/opengl/ogl_spritecanvas.hxx
new file mode 100644
-index 0000000..8ac8dca
+index 0000000..ea14bc7
--- /dev/null
+++ canvas/source/opengl/ogl_spritecanvas.hxx
-@@ -0,0 +1,125 @@
+@@ -0,0 +1,126 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -2138,11 +2245,11 @@
+#include "ogl_spritedevicehelper.hxx"
+#include "ogl_canvashelper.hxx"
+
-+#include <set>
-+
+
+namespace oglcanvas
+{
++ class CanvasCustomSprite;
++
+ typedef ::cppu::WeakComponentImplHelper8< ::com::sun::star::rendering::XSpriteCanvas,
+ ::com::sun::star::rendering::XGraphicDevice,
+ ::com::sun::star::rendering::XParametricPolyPolygon2DFactory,
@@ -2208,15 +2315,16 @@
+ // XServiceName
+ virtual ::rtl::OUString SAL_CALL getServiceName( ) throw (::com::sun::star::uno::RuntimeException);
+
-+ void show( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& );
-+ void hide( const ::com::sun::star::uno::Reference< ::com::sun::star::rendering::XSprite >& );
++ void show( const ::rtl::Reference< CanvasCustomSprite >& );
++ void hide( const ::rtl::Reference< CanvasCustomSprite >& );
++
++ /** Write out recorded actions
++ */
++ bool renderRecordedActions() const;
+
+ private:
+ ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > maArguments;
+ ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > mxComponentContext;
-+ std::set<
-+ ::com::sun::star::uno::Reference<
-+ ::com::sun::star::rendering::XSprite > > maActiveSprites;
+ };
+
+ typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef;
@@ -2225,10 +2333,10 @@
+#endif
diff --git canvas/source/opengl/ogl_spritedevicehelper.cxx canvas/source/opengl/ogl_spritedevicehelper.cxx
new file mode 100644
-index 0000000..c10adfc
+index 0000000..d0fdf07
--- /dev/null
+++ canvas/source/opengl/ogl_spritedevicehelper.cxx
-@@ -0,0 +1,220 @@
+@@ -0,0 +1,529 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -2249,6 +2357,8 @@
+
+#include "ogl_spritedevicehelper.hxx"
+#include "ogl_spritecanvas.hxx"
++#include "ogl_canvasbitmap.hxx"
++#include "ogl_canvascustomsprite.hxx"
+
+#include <canvas/verbosetrace.hxx>
+#include <basegfx/tools/canvastools.hxx>
@@ -2257,41 +2367,237 @@
+#include <osl/mutex.hxx>
+#include <rtl/instance.hxx>
+#include <com/sun/star/uno/Reference.hxx>
++#include <com/sun/star/lang/NoSupportException.hpp>
+#include <com/sun/star/rendering/XColorSpace.hpp>
+#include <com/sun/star/rendering/XIntegerBitmapColorSpace.hpp>
+
++#include <vcl/sysdata.hxx>
++#include <vcl/syschild.hxx>
++#include <vcl/canvastools.hxx>
++#include <toolkit/helper/vclunohelper.hxx>
++
+#include <GL/gl.h>
++#include <GL/glu.h>
+#include <GL/glext.h>
+
++namespace unx
++{
++ #include <X11/keysym.h>
++ #include <X11/X.h>
++ #include <GL/glx.h>
++ #include <GL/glxext.h>
++}
++
+
+using namespace ::com::sun::star;
+
++static bool lcl_bErrorTriggered=false;
++static int lcl_XErrorHandler( unx::Display*, unx::XErrorEvent* )
++{
++ lcl_bErrorTriggered = true;
++ return 0;
++}
++
+namespace oglcanvas
+{
+ SpriteDeviceHelper::SpriteDeviceHelper() :
+ mpDevice(NULL),
-+ mpSpriteCanvas(NULL)
++ mpSpriteCanvas(NULL),
++ maActiveSprites(),
++ mpChildWindow(),
++ mpDisplay(NULL),
++ mpGLContext(NULL)
+ {}
+
-+ void SpriteDeviceHelper::init( Window& /*rWindow*/,
-+ SpriteCanvas& rSpriteCanvas )
++ void SpriteDeviceHelper::init( Window& rWindow,
++ SpriteCanvas& rSpriteCanvas,
++ const awt::Rectangle& rViewArea )
+ {
+ mpSpriteCanvas = &rSpriteCanvas;
+
-+ // check for GL_ARB_imaging extension
-+ glEnable(GL_POINT_SMOOTH);
-+ glEnable(GL_LINE_SMOOTH);
-+ glEnable(GL_POLYGON_SMOOTH);
-+ glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
-+ glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
-+ glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
-+ glShadeModel(GL_FLAT);
++ rSpriteCanvas.setWindow(
++ uno::Reference<awt::XWindow2>(
++ VCLUnoHelper::GetInterface(&rWindow),
++ uno::UNO_QUERY_THROW) );
++
++ // init OpenGL
++ const SystemEnvData* sysData(rWindow.GetSystemData());
++ unx::Display* pDisplay=reinterpret_cast<unx::Display*>(sysData->pDisplay);
++ mpDisplay=pDisplay;
++ if( !unx::glXQueryExtension(pDisplay, NULL, NULL) )
++ return;
++
++ unx::Window xWindow = sysData->aWindow;
++ unx::XWindowAttributes xAttr;
++ unx::XGetWindowAttributes( pDisplay, xWindow, &xAttr );
++ int nScreen = XScreenNumberOfScreen( xAttr.screen );
+
-+ if( mpDevice )
-+ {
-+ glClearColor(0,0,0,0);
-+ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
++ // select appropriate visual
++ static int attrList3[] =
++ {
++ GLX_RGBA,//only TrueColor or DirectColor
++ //single buffered
++ GLX_RED_SIZE,4,//use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,//use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,//use the maximum blue bits, with a minimum of 4 bits
++ GLX_DEPTH_SIZE,0,//no depth buffer
++ None
++ };
++ static int attrList2[] =
++ {
++ GLX_RGBA,//only TrueColor or DirectColor
++ /// single buffered
++ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
++ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
++ None
++ };
++ static int attrList1[] =
++ {
++ GLX_RGBA,//only TrueColor or DirectColor
++ GLX_DOUBLEBUFFER,/// only double buffer
++ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
++ GLX_DEPTH_SIZE,0,/// no depth buffer
++ None
++ };
++ static int attrList0[] =
++ {
++ GLX_RGBA,//only TrueColor or DirectColor
++ GLX_DOUBLEBUFFER,/// only double buffer
++ GLX_RED_SIZE,4,/// use the maximum red bits, with a minimum of 4 bits
++ GLX_GREEN_SIZE,4,/// use the maximum green bits, with a minimum of 4 bits
++ GLX_BLUE_SIZE,4,/// use the maximum blue bits, with a minimum of 4 bits
++ GLX_DEPTH_SIZE,1,/// use the maximum depth bits, making sure there is a depth buffer
++ None
++ };
++ static int* attrTable[] =
++ {
++ attrList0,
++ attrList1,
++ attrList2,
++ attrList3,
++ NULL
++ };
++ int** pAttributeTable = attrTable;
++
++ unx::Window childXWindow=0;
++ unx::XVisualInfo* vi=NULL;
++ while( *pAttributeTable )
++ {
++ // try to find a visual for the current set of attributes
++ vi = unx::glXChooseVisual( pDisplay,
++ nScreen,
++ *pAttributeTable );
++ if( vi )
++ {
++ SystemWindowData winData;
++ winData.nSize = sizeof(winData);
++ OSL_TRACE("using VisualID %08X for OpenGL canvas", vi->visualid);
++ winData.pVisual = (void*)(vi->visual);
++ mpChildWindow.reset( new SystemChildWindow(&rWindow, 0, &winData, FALSE) );
++ if( mpChildWindow->GetSystemData() )
++ break;
++ else
++ mpChildWindow.reset();
++ }
++
++ ++pAttributeTable;
+ }
++
++ // tweak SysChild window to act as an input-transparent
++ // overlay
++ if( mpChildWindow )
++ {
++ childXWindow=mpChildWindow->GetSystemData()->aWindow;
++ mpChildWindow->SetMouseTransparent( TRUE );
++ mpChildWindow->SetParentClipMode( PARENTCLIPMODE_NOCLIP );
++ mpChildWindow->EnableEraseBackground( FALSE );
++ mpChildWindow->SetControlForeground();
++ mpChildWindow->SetControlBackground();
++ mpChildWindow->EnablePaint(FALSE);
++
++ unx::GLXContext pContext =
++ glXCreateContext(pDisplay,
++ vi,
++ 0,
++ GL_TRUE);
++ mpGLContext = pContext;
++
++ if( !glXMakeCurrent( pDisplay,
++ childXWindow,
++ pContext) )
++ {
++ glXDestroyContext(pDisplay,
++ pContext);
++ throw lang::NoSupportException(
++ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
++ "Could not select OpenGL context!") ),NULL);
++ }
++
++ const GLubyte* extensions=glGetString( GL_EXTENSIONS );
++ if( gluCheckExtension((const GLubyte*)"GLX_SGI_swap_control", extensions) )
++ {
++ // try to enable vsync
++ typedef GLint (*glXSwapIntervalProc)(GLint);
++ glXSwapIntervalProc glXSwapInterval =
++ (glXSwapIntervalProc) unx::glXGetProcAddress((const GLubyte*)"glXSwapIntervalSGI");
++ if( glXSwapInterval )
++ {
++ int (*oldHandler)(unx::Display*, unx::XErrorEvent*);
++
++ // synchronize on global mutex - no other ogl
++ // canvas instance permitted to enter here
++ {
++ ::osl::MutexGuard aGuard( *::osl::Mutex::getGlobalMutex() );
++
++ // replace error handler temporarily
++ oldHandler = unx::XSetErrorHandler( lcl_XErrorHandler );
++
++ lcl_bErrorTriggered = false;
++
++ // Note: if this fails, so be it. Buggy
++ // drivers will then not have vsync.
++ glXSwapInterval(1);
++
++ // sync so that we possibly get an XError
++ unx::glXWaitGL();
++ XSync(pDisplay, false);
++
++ unx::XSetErrorHandler( oldHandler );
++ }
++ }
++ }
++
++ // need the backside for mirror effects
++ glDisable(GL_CULL_FACE);
++
++ // no perspective, we're 2D
++ glMatrixMode(GL_PROJECTION);
++ glLoadIdentity();
++
++ // misc preferences
++ glEnable(GL_POINT_SMOOTH);
++ glEnable(GL_LINE_SMOOTH);
++ glEnable(GL_POLYGON_SMOOTH);
++ glHint(GL_POINT_SMOOTH_HINT,GL_NICEST);
++ glHint(GL_LINE_SMOOTH_HINT,GL_NICEST);
++ glHint(GL_POLYGON_SMOOTH_HINT,GL_NICEST);
++ glShadeModel(GL_FLAT);
++
++ glXMakeCurrent(pDisplay, None, NULL);
++ }
++
++ if( !mpGLContext )
++ throw lang::NoSupportException(
++ ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM(
++ "Could not create OpenGL context!") ),NULL);
++
++ notifySizeUpdate(rViewArea);
++ mpChildWindow->Show();
++ // TODO(E3): check for GL_ARB_imaging extension
+ }
+
+ void SpriteDeviceHelper::disposing()
@@ -2299,16 +2605,42 @@
+ // release all references
+ mpSpriteCanvas = NULL;
+ mpDevice = NULL;
++
++ if( mpGLContext )
++ glXDestroyContext(reinterpret_cast<unx::Display*>(mpDisplay),
++ reinterpret_cast<unx::GLXContext>(mpGLContext));
++
++ mpDisplay = NULL;
++ mpGLContext = NULL;
++ mpChildWindow.reset();
+ }
+
+ geometry::RealSize2D SpriteDeviceHelper::getPhysicalResolution()
+ {
-+ return geometry::RealSize2D( 75, 75 );
++ if( !mpChildWindow )
++ return ::canvas::tools::createInfiniteSize2D(); // we're disposed
++
++ // Map a one-by-one millimeter box to pixel
++ const MapMode aOldMapMode( mpChildWindow->GetMapMode() );
++ mpChildWindow->SetMapMode( MapMode(MAP_MM) );
++ const Size aPixelSize( mpChildWindow->LogicToPixel(Size(1,1)) );
++ mpChildWindow->SetMapMode( aOldMapMode );
++
++ return ::vcl::unotools::size2DFromSize( aPixelSize );
+ }
+
+ geometry::RealSize2D SpriteDeviceHelper::getPhysicalSize()
+ {
-+ return geometry::RealSize2D( 210, 280 );
++ if( !mpChildWindow )
++ return ::canvas::tools::createInfiniteSize2D(); // we're disposed
++
++ // Map the pixel dimensions of the output window to millimeter
++ const MapMode aOldMapMode( mpChildWindow->GetMapMode() );
++ mpChildWindow->SetMapMode( MapMode(MAP_MM) );
++ const Size aLogSize( mpChildWindow->PixelToLogic(mpChildWindow->GetOutputSizePixel()) );
++ mpChildWindow->SetMapMode( aOldMapMode );
++
++ return ::vcl::unotools::size2DFromSize( aLogSize );
+ }
+
+ uno::Reference< rendering::XLinePolyPolygon2D > SpriteDeviceHelper::createCompatibleLinePolyPolygon(
@@ -2339,14 +2671,16 @@
+
+ uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleBitmap(
+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& /*size*/ )
++ const geometry::IntegerSize2D& size )
+ {
+ // disposed?
+ if( !mpSpriteCanvas )
+ return uno::Reference< rendering::XBitmap >(); // we're disposed
+
-+ // TODO
-+ return uno::Reference< rendering::XBitmap >();
++ return uno::Reference< rendering::XBitmap >(
++ new CanvasBitmap( size,
++ mpSpriteCanvas,
++ false ) );
+ }
+
+ uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileBitmap(
@@ -2358,14 +2692,16 @@
+
+ uno::Reference< rendering::XBitmap > SpriteDeviceHelper::createCompatibleAlphaBitmap(
+ const uno::Reference< rendering::XGraphicDevice >& /*rDevice*/,
-+ const geometry::IntegerSize2D& /*size*/ )
++ const geometry::IntegerSize2D& size )
+ {
+ // disposed?
+ if( !mpSpriteCanvas )
+ return uno::Reference< rendering::XBitmap >(); // we're disposed
+
-+ // TODO
-+ return uno::Reference< rendering::XBitmap >();
++ return uno::Reference< rendering::XBitmap >(
++ new CanvasBitmap( size,
++ mpSpriteCanvas,
++ true ) );
+ }
+
+ uno::Reference< rendering::XVolatileBitmap > SpriteDeviceHelper::createVolatileAlphaBitmap(
@@ -2400,13 +2736,82 @@
+ // _always_ will have exactly one backbuffer
+ }
+
-+ ::sal_Bool SpriteDeviceHelper::showBuffer( bool bIsVisible, ::sal_Bool bUpdateAll )
++ namespace
+ {
-+ // forward to sprite canvas helper
-+ if( !bIsVisible || !mpSpriteCanvas )
++ /** Functor providing a StrictWeakOrdering for XSprites (over
++ priority)
++ */
++ struct SpriteComparator
++ {
++ bool operator()( const ::rtl::Reference<CanvasCustomSprite>& rLHS,
++ const ::rtl::Reference<CanvasCustomSprite>& rRHS ) const
++ {
++ 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;
++ }
++ };
++ }
++
++ ::sal_Bool SpriteDeviceHelper::showBuffer( bool bIsVisible, ::sal_Bool /*bUpdateAll*/ )
++ {
++ // hidden or disposed?
++ if( !bIsVisible || !mpChildWindow || !mpSpriteCanvas )
++ return false;
++
++ const unx::Window aXWindow=mpChildWindow->GetSystemData()->aWindow;
++ if( !glXMakeCurrent( reinterpret_cast<unx::Display*>(mpDisplay),
++ aXWindow,
++ reinterpret_cast<unx::GLXContext>(mpGLContext)) )
++ {
++ OSL_TRACE("SpriteDeviceHelper::showBuffer(): cannot activate GL context");
+ return false;
++ }
++
++ const Size& rOutputSize=mpChildWindow->GetSizePixel();
++
++ // use whole window
++ glViewport( 0,0,
++ (GLsizei)rOutputSize.Width(),
++ (GLsizei)rOutputSize.Height() );
++
++ // model coordinate system is already in device pixel
++ glMatrixMode(GL_MODELVIEW);
++ glLoadIdentity();
++ glTranslated(-1.0, 1.0, 0.0);
++ glScaled( 2.0 / rOutputSize.Width(),
++ -2.0 / rOutputSize.Height(),
++ 1.0 );
++
++ // clear to black
++ glClearColor(0,0,0,0);
++ glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
++
++ // render the actual spritecanvas content
++ mpSpriteCanvas->renderRecordedActions();
++
++ // render all sprites (in order of priority) on top of that
++ std::vector< ::rtl::Reference<CanvasCustomSprite> > aSprites;
++ std::copy(maActiveSprites.begin(),
++ maActiveSprites.end(),
++ std::back_insert_iterator<
++ std::vector< ::rtl::Reference< CanvasCustomSprite > > >(aSprites));
++ std::sort(aSprites.begin(),
++ aSprites.end(),
++ SpriteComparator());
++ std::for_each(aSprites.begin(),
++ aSprites.end(),
++ boost::mem_fn(&CanvasCustomSprite::renderSprite));
++ // switch buffer, sync etc.
++ unx::glXSwapBuffers(reinterpret_cast<unx::Display*>(mpDisplay),
++ aXWindow);
++ mpChildWindow->Show();
++ unx::glXWaitGL();
++ XSync( reinterpret_cast<unx::Display*>(mpDisplay), false );
+
-+ return mpSpriteCanvas->updateScreen( bUpdateAll );
++ return true;
+ }
+
+ ::sal_Bool SpriteDeviceHelper::switchBuffer( bool bIsVisible, ::sal_Bool bUpdateAll )
@@ -2438,9 +2843,11 @@
+ uno::UNO_QUERY);
+ }
+
-+ void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& /*rBounds*/ )
++ void SpriteDeviceHelper::notifySizeUpdate( const awt::Rectangle& rBounds )
+ {
-+ // TODO
++ if( mpChildWindow )
++ mpChildWindow->SetPosSizePixel(
++ 0,0,rBounds.Width, rBounds.Height);
+ }
+
+ void SpriteDeviceHelper::dumpScreenContent() const
@@ -2448,13 +2855,23 @@
+ OSL_TRACE( "%s\n",
+ BOOST_CURRENT_FUNCTION );
+ }
++
++ void SpriteDeviceHelper::show( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
++ {
++ maActiveSprites.insert(xSprite);
++ }
++
++ void SpriteDeviceHelper::hide( const ::rtl::Reference< CanvasCustomSprite >& xSprite )
++ {
++ maActiveSprites.erase(xSprite);
++ }
+}
diff --git canvas/source/opengl/ogl_spritedevicehelper.hxx canvas/source/opengl/ogl_spritedevicehelper.hxx
new file mode 100644
-index 0000000..3683dbc
+index 0000000..9d9febf
--- /dev/null
+++ canvas/source/opengl/ogl_spritedevicehelper.hxx
-@@ -0,0 +1,102 @@
+@@ -0,0 +1,119 @@
+/*************************************************************************
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
@@ -2473,10 +2890,16 @@
+#ifndef OGL_SPRITEDEVICEHELPER_HXX
+#define OGL_SPRITEDEVICEHELPER_HXX
+
++#include <rtl/ref.hxx>
+#include <com/sun/star/rendering/XGraphicDevice.hpp>
+#include <boost/utility.hpp>
++#include <boost/shared_ptr.hpp>
++
++#include <set>
++
+
+class Window;
++class SystemChildWindow;
+namespace basegfx{ class B2IVector; }
+namespace com { namespace sun { namespace star { namespace awt {
+ struct Rectangle;
@@ -2485,14 +2908,16 @@
+namespace oglcanvas
+{
+ class SpriteCanvas;
++ class CanvasCustomSprite;
+
+ class SpriteDeviceHelper : private ::boost::noncopyable
+ {
+ public:
+ SpriteDeviceHelper();
+
-+ void init( Window& rWindow,
-+ SpriteCanvas& rSpriteCanvas );
++ void init( Window& rWindow,
++ SpriteCanvas& rSpriteCanvas,
++ const ::com::sun::star::awt::Rectangle& rViewArea );
+
+ /// Dispose all internal references
+ void disposing();
@@ -2540,6 +2965,9 @@
+ */
+ void dumpScreenContent() const;
+
++ void show( const ::rtl::Reference< CanvasCustomSprite >& );
++ void hide( const ::rtl::Reference< CanvasCustomSprite >& );
++
+ private:
+ void resize( const ::basegfx::B2IVector& rNewSize );
+
@@ -2549,10 +2977,16 @@
+ potential circular references for canvas. Needed to
+ create bitmaps
+ */
-+ com::sun::star::rendering::XGraphicDevice* mpDevice;
++ com::sun::star::rendering::XGraphicDevice* mpDevice;
+
+ /// Pointer to sprite canvas (owner of this helper), needed to create bitmaps
-+ SpriteCanvas* mpSpriteCanvas;
++ SpriteCanvas* mpSpriteCanvas;
++
++ std::set< ::rtl::Reference< CanvasCustomSprite > > maActiveSprites;
++
++ boost::shared_ptr<SystemChildWindow> mpChildWindow;
++ void* mpDisplay;
++ void* mpGLContext;
+ };
+}
+
@@ -2874,6 +3308,161 @@
+}
+
+#endif
+diff --git canvas/source/opengl/ogl_tools.hxx canvas/source/opengl/ogl_tools.hxx
+new file mode 100644
+index 0000000..db58e5c
+--- /dev/null
++++ canvas/source/opengl/ogl_tools.hxx
+@@ -0,0 +1,35 @@
++/*************************************************************************
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * Author:
++ * Thorsten Behrens <tbehrens novell com>
++ *
++ * Copyright (C) 2008, Novell Inc.
++ * Parts copyright 2005 by Sun Microsystems, Inc.
++ *
++ * The Contents of this file are made available subject to
++ * the terms of GNU Lesser General Public License Version 2.1.
++ *
++ ************************************************************************/
++
++#ifndef OGL_CANVAS_TOOLS_HXX
++#define OGL_CANVAS_TOOLS_HXX
++
++#include <sal/config.h>
++#include <GL/gl.h>
++
++
++namespace oglcanvas
++{
++ struct TransformationPreserver
++ {
++ TransformationPreserver()
++ { glPushAttrib(GL_TRANSFORM_BIT); }
++
++ ~TransformationPreserver()
++ { glPopAttrib(); }
++ };
++}
++
++#endif
+diff --git canvas/source/vcl/canvashelper.hxx canvas/source/vcl/canvashelper.hxx
+index 30d9677..923d02d 100644
+--- canvas/source/vcl/canvashelper.hxx
++++ canvas/source/vcl/canvashelper.hxx
+@@ -32,6 +32,7 @@
+ #define _VCLCANVAS_CANVASHELPER_HXX_
+
+ #include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/rendering/XBitmapCanvas.hpp>
+ #include <com/sun/star/rendering/XIntegerBitmap.hpp>
+
+ #include <vcl/outdev.hxx>
+diff --git cppcanvas/inc/cppcanvas/spritecanvas.hxx cppcanvas/inc/cppcanvas/spritecanvas.hxx
+index 287b1a4..9263b54 100644
+--- cppcanvas/inc/cppcanvas/spritecanvas.hxx
++++ cppcanvas/inc/cppcanvas/spritecanvas.hxx
+@@ -38,7 +38,7 @@
+ #include <boost/shared_ptr.hpp>
+
+
+-#include <cppcanvas/bitmapcanvas.hxx>
++#include <cppcanvas/canvas.hxx>
+ #include <cppcanvas/sprite.hxx>
+ #include <cppcanvas/customsprite.hxx>
+
+@@ -59,7 +59,7 @@ namespace cppcanvas
+
+ /** SpriteCanvas interface
+ */
+- class SpriteCanvas : public virtual BitmapCanvas
++ class SpriteCanvas : public virtual Canvas
+ {
+ public:
+ virtual bool updateScreen( bool bUpdateAll ) const = 0;
+diff --git cppcanvas/source/wrapper/implspritecanvas.cxx cppcanvas/source/wrapper/implspritecanvas.cxx
+index 1f66544..3402665 100644
+--- cppcanvas/source/wrapper/implspritecanvas.cxx
++++ cppcanvas/source/wrapper/implspritecanvas.cxx
+@@ -64,8 +64,6 @@ namespace cppcanvas
+ ImplSpriteCanvas::ImplSpriteCanvas( const uno::Reference< rendering::XSpriteCanvas >& rCanvas ) :
+ ImplCanvas( uno::Reference< rendering::XCanvas >(rCanvas,
+ uno::UNO_QUERY) ),
+- ImplBitmapCanvas( uno::Reference< rendering::XBitmapCanvas >(rCanvas,
+- uno::UNO_QUERY) ),
+ mxSpriteCanvas( rCanvas ),
+ mpTransformArbiter( new TransformationArbiter() )
+ {
+@@ -74,10 +72,8 @@ namespace cppcanvas
+
+ ImplSpriteCanvas::ImplSpriteCanvas(const ImplSpriteCanvas& rOrig) :
+ Canvas(),
+- BitmapCanvas(),
+ SpriteCanvas(),
+ ImplCanvas( rOrig ),
+- ImplBitmapCanvas( rOrig ),
+ mxSpriteCanvas( rOrig.getUNOSpriteCanvas() ),
+ mpTransformArbiter( new TransformationArbiter() )
+ {
+diff --git cppcanvas/source/wrapper/implspritecanvas.hxx cppcanvas/source/wrapper/implspritecanvas.hxx
+index b43e2a9..3909c10 100644
+--- cppcanvas/source/wrapper/implspritecanvas.hxx
++++ cppcanvas/source/wrapper/implspritecanvas.hxx
+@@ -44,14 +44,14 @@
+
+ #include <cppcanvas/spritecanvas.hxx>
+
+-#include <implbitmapcanvas.hxx>
++#include <implcanvas.hxx>
+
+
+ namespace cppcanvas
+ {
+ namespace internal
+ {
+- class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplBitmapCanvas
++ class ImplSpriteCanvas : public virtual SpriteCanvas, protected virtual ImplCanvas
+ {
+ public:
+ ImplSpriteCanvas( const ::com::sun::star::uno::Reference<
+diff --git offapi/com/sun/star/presentation/XSlideShowView.idl offapi/com/sun/star/presentation/XSlideShowView.idl
+index a9a3723..935a013 100644
+--- offapi/com/sun/star/presentation/XSlideShowView.idl
++++ offapi/com/sun/star/presentation/XSlideShowView.idl
+@@ -37,9 +37,6 @@
+ #ifndef __com_sun_star_rendering_XSpriteCanvas_idl__
+ #include <com/sun/star/rendering/XSpriteCanvas.idl>
+ #endif
+-#ifndef __com_sun_star_geometry_RealRectangle2D_idl__
+-#include <com/sun/star/geometry/RealRectangle2D.idl>
+-#endif
+ #ifndef __com_sun_star_util_XModifyListener_idl__
+ #include <com/sun/star/util/XModifyListener.idl>
+ #endif
+@@ -52,6 +49,9 @@
+ #ifndef __com_sun_star_awt_XMouseMotionListener_idl__
+ #include <com/sun/star/awt/XMouseMotionListener.idl>
+ #endif
++#ifndef __com_sun_star_awt_Rectangle_idl__
++#include <com/sun/star/awt/Rectangle.idl>
++#endif
+
+ module com { module sun { module star { module presentation {
+
+@@ -179,6 +179,10 @@ interface XSlideShowView : ::com::sun::star::uno::XInterface
+ */
+ void setMouseCursor( [in] short nPointerShape );
+
++ /** Get rectangle defining area inside of canvas device which
++ this slideshow view uses.
++ */
++ ::com::sun::star::awt::Rectangle getCanvasArea();
+ };
+
+ }; }; }; };
diff --git offapi/com/sun/star/rendering/XSpriteCanvas.idl offapi/com/sun/star/rendering/XSpriteCanvas.idl
index b3717b2..85a3ca8 100644
--- offapi/com/sun/star/rendering/XSpriteCanvas.idl
@@ -2920,3 +3509,279 @@
@param original
The original sprite to copy the content from. This sprite must
+diff --git officecfg/registry/data/org/openoffice/Office/Canvas.xcu officecfg/registry/data/org/openoffice/Office/Canvas.xcu
+index 40a757d..4bafc24 100755
+--- officecfg/registry/data/org/openoffice/Office/Canvas.xcu
++++ officecfg/registry/data/org/openoffice/Office/Canvas.xcu
+@@ -37,6 +37,7 @@
+ <prop oor:name="PreferredImplementations" oor:type="oor:string-list">
+ <value oor:separator=",">com.sun.star.comp.rendering.SpriteCanvas.DX9,
+ com.sun.star.comp.rendering.SpriteCanvas.DX5,
++ com.sun.star.comp.rendering.SpriteCanvas.OGL,
+ com.sun.star.comp.rendering.SpriteCanvas.Cairo,
+ com.sun.star.comp.rendering.SpriteCanvas.GL,
+ com.sun.star.comp.rendering.SpriteCanvas.Java,
+diff --git scp2/source/canvas/makefile.mk scp2/source/canvas/makefile.mk
+index 9bfc24d..6cc5c6e 100644
+--- scp2/source/canvas/makefile.mk
++++ scp2/source/canvas/makefile.mk
+@@ -51,6 +51,7 @@ SCPDEFS+=-DSYSTEM_AGG
+ .ENDIF
+
+ PARFILES= canvascommons.par \
++ openglcanvas.par \
+ vclcanvas.par
+
+ .IF "$(ENABLE_CAIRO)" == "TRUE"
+diff --git scp2/source/canvas/openglcanvas.scp scp2/source/canvas/openglcanvas.scp
+new file mode 100644
+index 0000000..4ea2d47
+--- /dev/null
++++ scp2/source/canvas/openglcanvas.scp
+@@ -0,0 +1,28 @@
++/*************************************************************************
++ *
++ * OpenOffice.org - a multi-platform office productivity suite
++ *
++ * Author:
++ * Thorsten Behrens <tbehrens novell com>
++ *
++ * Copyright (C) 2008, Novell Inc.
++ * Parts copyright 2005 by Sun Microsystems, Inc.
++ *
++ * The Contents of this file are made available subject to
++ * the terms of GNU Lesser General Public License Version 2.1.
++ *
++ ************************************************************************/
++
++#include "macros.inc"
++
++File gid_File_Lib_OpenGLCanvas
++ TXT_FILE_BODY;
++ Styles = (PACKED,UNO_COMPONENT);
++ RegistryID = gid_Starregistry_Services_Rdb;
++ Dir = gid_Dir_Program;
++ #ifdef UNX
++ Name = STRING(CONCAT2(oglcanvas.uno,UNXSUFFIX));
++ #else
++ Name = "oglcanvas.uno.dll";
++ #endif
++End
+diff --git scp2/util/makefile.mk scp2/util/makefile.mk
+index 57652db..9dec807 100644
+--- scp2/util/makefile.mk
++++ scp2/util/makefile.mk
+@@ -167,8 +167,8 @@ SCP1FILES += \
+ file_crashrep_dynamic.par
+ .ENDIF
+
+-SCP1FILES += \
+- vclcanvas.par
++SCP1FILES += vclcanvas.par \
++ openglcanvas.par
+
+ .IF "$(ENABLE_CAIRO)" == "TRUE"
+ SCP1FILES += cairocanvas.par
+diff --git sd/source/ui/slideshow/slideshowviewimpl.cxx sd/source/ui/slideshow/slideshowviewimpl.cxx
+index e20921c..f3532bb 100644
+--- sd/source/ui/slideshow/slideshowviewimpl.cxx
++++ sd/source/ui/slideshow/slideshowviewimpl.cxx
+@@ -57,7 +57,6 @@ using ::comphelper::ImplementationReference;
+
+ using ::rtl::OUString;
+ using namespace ::com::sun::star;
+-using namespace ::com::sun::star;
+
+ namespace sd
+ {
+@@ -487,6 +486,18 @@ void SAL_CALL SlideShowView::setMouseCursor( sal_Int16 nPointerShape ) throw (Ru
+ mxWindowPeer->setPointer( mxPointer );
+ }
+
++awt::Rectangle SAL_CALL SlideShowView::getCanvasArea( ) throw (RuntimeException)
++{
++ awt::Rectangle aRectangle;
++
++ if( mxWindow.is() )
++ return mxWindow->getPosSize();
++
++ aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
++
++ return aRectangle;
++}
++
+ void SlideShowView::updateimpl( ::osl::ClearableMutexGuard& rGuard, SlideshowImpl* pSlideShow )
+ {
+ if( pSlideShow )
+diff --git sd/source/ui/slideshow/slideshowviewimpl.hxx sd/source/ui/slideshow/slideshowviewimpl.hxx
+index 4e8f3cc..b68d4e0 100644
+--- sd/source/ui/slideshow/slideshowviewimpl.hxx
++++ sd/source/ui/slideshow/slideshowviewimpl.hxx
+@@ -236,6 +236,7 @@ public:
+ virtual void SAL_CALL addMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeMouseMotionListener( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XMouseMotionListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setMouseCursor( sal_Int16 nPointerShape ) throw (::com::sun::star::uno::RuntimeException);
++ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( ) throw (::com::sun::star::uno::RuntimeException);
+
+ // XWindowListener methods
+ virtual void SAL_CALL windowResized( const ::com::sun::star::awt::WindowEvent& e ) throw (::com::sun::star::uno::RuntimeException);
+diff --git sdext/source/presenter/PresenterSlideShowView.cxx sdext/source/presenter/PresenterSlideShowView.cxx
+index 1da7db7..68417a8 100644
+--- sdext/source/presenter/PresenterSlideShowView.cxx
++++ sdext/source/presenter/PresenterSlideShowView.cxx
+@@ -79,6 +79,8 @@ PresenterSlideShowView::PresenterSlideShowView (
+ mxPointer(),
+ mxWindow(),
+ mxViewWindow(),
++ mxTopPane(),
++ mxPresenterHelper(),
+ mxBackgroundPolygon1(),
+ mxBackgroundPolygon2(),
+ mbIsViewAdded(false),
+@@ -111,6 +113,13 @@ void PresenterSlideShowView::LateInit (void)
+ if (xSlideShowComponent.is())
+ xSlideShowComponent->addEventListener(static_cast<awt::XWindowListener*>(this));
+
++ Reference<lang::XMultiComponentFactory> xFactory (
++ mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
++ mxPresenterHelper.set (xFactory->createInstanceWithContext(
++ OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
++ mxComponentContext),
++ UNO_QUERY_THROW);
++
+ // Use view id and controller to retrieve window and canvas from
+ // configuration controller.
+ Reference<XControllerManager> xCM (mxController, UNO_QUERY_THROW);
+@@ -118,6 +127,8 @@ void PresenterSlideShowView::LateInit (void)
+
+ if (xCC.is())
+ {
++ mxTopPane.set(xCC->getResource(mxViewId->getAnchor()->getAnchor()), UNO_QUERY);
++
+ Reference<XPane> xPane (xCC->getResource(mxViewId->getAnchor()), UNO_QUERY_THROW);
+
+ mxWindow = xPane->getWindow();
+@@ -139,8 +150,8 @@ void PresenterSlideShowView::LateInit (void)
+ // Create a window for the actual slide show view. It is places
+ // centered and with maximal size inside the pane.
+ mxViewWindow = CreateViewWindow(mxWindow);
+- mxViewCanvas = CreateViewCanvas(mxViewWindow,
+- Reference<XPane>(xCC->getResource(mxViewId->getAnchor()->getAnchor()), UNO_QUERY));
++
++ mxViewCanvas = CreateViewCanvas(mxViewWindow);
+
+ if (mxViewWindow.is())
+ {
+@@ -540,6 +551,19 @@ void SAL_CALL PresenterSlideShowView::setMouseCursor(::sal_Int16 nPointerShape)
+
+
+
++awt::Rectangle SAL_CALL PresenterSlideShowView::getCanvasArea( ) throw (RuntimeException)
++{
++ if( mxViewWindow.is() && mxTopPane.is() )
++ return mxPresenterHelper->getWindowExtentsRelative( mxViewWindow, mxTopPane->getWindow() );
++
++ awt::Rectangle aRectangle;
++
++ aRectangle.X = aRectangle.Y = aRectangle.Width = aRectangle.Height = 0;
++
++ return aRectangle;
++}
++
++
+
+ //----- lang::XEventListener --------------------------------------------------
+
+@@ -973,22 +997,14 @@ Reference<awt::XWindow> PresenterSlideShowView::CreateViewWindow (
+
+
+ Reference<rendering::XCanvas> PresenterSlideShowView::CreateViewCanvas (
+- const Reference<awt::XWindow>& rxViewWindow,
+- const Reference<XPane>& rxParentPane) const
++ const Reference<awt::XWindow>& rxViewWindow) const
+ {
+ // Create a canvas for the view window.
+- Reference<lang::XMultiComponentFactory> xFactory (
+- mxComponentContext->getServiceManager(), UNO_QUERY_THROW);
+- Reference<drawing::XPresenterHelper> xPresenterHelper(
+- xFactory->createInstanceWithContext(
+- OUString::createFromAscii("com.sun.star.comp.Draw.PresenterHelper"),
+- mxComponentContext),
+- UNO_QUERY_THROW);
+- return xPresenterHelper->createSharedCanvas(
+- Reference<rendering::XSpriteCanvas>(rxParentPane->getCanvas(), UNO_QUERY),
+- rxParentPane->getWindow(),
+- rxParentPane->getCanvas(),
+- rxParentPane->getWindow(),
++ return mxPresenterHelper->createSharedCanvas(
++ Reference<rendering::XSpriteCanvas>(mxTopPane->getCanvas(), UNO_QUERY),
++ mxTopPane->getWindow(),
++ mxTopPane->getCanvas(),
++ mxTopPane->getWindow(),
+ rxViewWindow);
+ }
+
+diff --git sdext/source/presenter/PresenterSlideShowView.hxx sdext/source/presenter/PresenterSlideShowView.hxx
+index 0270752..145a6d3 100644
+--- sdext/source/presenter/PresenterSlideShowView.hxx
++++ sdext/source/presenter/PresenterSlideShowView.hxx
+@@ -149,6 +149,8 @@ public:
+ virtual void SAL_CALL setMouseCursor(::sal_Int16 nPointerShape)
+ throw (css::uno::RuntimeException);
+
++ virtual ::com::sun::star::awt::Rectangle SAL_CALL getCanvasArea( )
++ throw (::com::sun::star::uno::RuntimeException);
+
+ // lang::XEventListener
+ virtual void SAL_CALL disposing (const css::lang::EventObject& rEvent)
+@@ -236,6 +238,8 @@ private:
+ css::uno::Reference<css::awt::XPointer> mxPointer;
+ css::uno::Reference<css::awt::XWindow> mxWindow;
+ css::uno::Reference<css::awt::XWindow> mxViewWindow;
++ css::uno::Reference<css::drawing::framework::XPane> mxTopPane;
++ css::uno::Reference<css::drawing::XPresenterHelper> mxPresenterHelper;
+ css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon1;
+ css::uno::Reference<css::rendering::XPolyPolygon2D> mxBackgroundPolygon2;
+ bool mbIsViewAdded;
+@@ -267,8 +271,7 @@ private:
+ css::uno::Reference<css::awt::XWindow> CreateViewWindow (
+ const css::uno::Reference<css::awt::XWindow>& rxParentWindow) const;
+ css::uno::Reference<css::rendering::XCanvas> CreateViewCanvas (
+- const css::uno::Reference<css::awt::XWindow>& rxWindow,
+- const css::uno::Reference<css::drawing::framework::XPane>& rxParentPane) const;
++ const css::uno::Reference<css::awt::XWindow>& rxWindow) const;
+
+ void Resize (void);
+
+diff --git slideshow/source/engine/waitsymbol.cxx slideshow/source/engine/waitsymbol.cxx
+index 4dafb23..ecd8442 100644
+--- slideshow/source/engine/waitsymbol.cxx
++++ slideshow/source/engine/waitsymbol.cxx
+@@ -41,6 +41,7 @@
+ #include <basegfx/vector/b2dvector.hxx>
+
+ #include <com/sun/star/rendering/XCanvas.hpp>
++#include <com/sun/star/presentation/XSlideShowView.hpp>
+
+ #include "waitsymbol.hxx"
+ #include "eventmultiplexer.hxx"
+@@ -115,13 +116,13 @@ void WaitSymbol::setVisible( const bool bVisible )
+ basegfx::B2DPoint WaitSymbol::calcSpritePos(
+ UnoViewSharedPtr const & rView ) const
+ {
+- const uno::Reference<rendering::XBitmap> xBitmap( rView->getCanvas()->getUNOCanvas(),
+- uno::UNO_QUERY_THROW );
+- const geometry::IntegerSize2D realSize( xBitmap->getSize() );
++ const awt::Rectangle aViewArea( rView->getUnoView()->getCanvasArea() );
+ return basegfx::B2DPoint(
+- std::min<sal_Int32>( realSize.Width, LEFT_BORDER_SPACE ),
+- std::max<sal_Int32>( 0, realSize.Height - mxBitmap->getSize().Height
+- - LOWER_BORDER_SPACE ) );
++ aViewArea.X + std::min<sal_Int32>( aViewArea.Width, LEFT_BORDER_SPACE ),
++ aViewArea.X + std::max<sal_Int32>( 0,
++ aViewArea.Height
++ - mxBitmap->getSize().Height
++ - LOWER_BORDER_SPACE ) );
+ }
+
+ void WaitSymbol::viewAdded( const UnoViewSharedPtr& rView )
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]