summaryrefslogtreecommitdiff
path: root/canvas
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2021-01-18 18:27:19 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2021-05-17 12:56:51 +0200
commit9090dc1f3b27195f5defd35586ac79357992be21 (patch)
treed39f4b624ae337d5c9ce76eba8521b76e53afa05 /canvas
parentc8cf2e0e088b74afa52564945a9c005b3b86bf7e (diff)
split OutputDevice from Window
as part of a longer-term goal of doing our widget rendering only inside a top-level render- context. I moved all of the OutputDevice-related code that existed in vcl::Window into a new subclass of OutputDevice called WindowOutputDevice. Notes for further work (*) not sure why we are getting an 1x1 surface in SvpSalGraphics::releaseCairoContext, but to fix it I clamp the size there (*) might have to dump VCLXDevice, and move it's code down into VCLXWindow and VCLXVirtualDevice (*) can we remove use of VCLXDevice in other places, in favour of just talking to the VCL code? Change-Id: I105946377f5322677d6f7d0c1c23847178a720b6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113204 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'canvas')
-rw-r--r--canvas/source/cairo/cairo_canvas.cxx2
-rw-r--r--canvas/source/cairo/cairo_spritecanvas.cxx2
-rw-r--r--canvas/source/cairo/cairo_spritedevicehelper.cxx2
-rw-r--r--canvas/source/directx/dx_canvas.cxx1
-rw-r--r--canvas/source/vcl/canvas.cxx1
-rw-r--r--canvas/source/vcl/outdevholder.hxx1
-rw-r--r--canvas/source/vcl/spritecanvashelper.cxx4
-rw-r--r--canvas/source/vcl/windowoutdevholder.hxx4
-rw-r--r--canvas/workben/canvasdemo.cxx4
9 files changed, 12 insertions, 9 deletions
diff --git a/canvas/source/cairo/cairo_canvas.cxx b/canvas/source/cairo/cairo_canvas.cxx
index 10edc0681843..5b727905673a 100644
--- a/canvas/source/cairo/cairo_canvas.cxx
+++ b/canvas/source/cairo/cairo_canvas.cxx
@@ -26,6 +26,7 @@
#include <tools/diagnose_ex.h>
#include <vcl/sysdata.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <vcl/window.hxx>
#include <cppuhelper/supportsservice.hxx>
#include "cairo_canvas.hxx"
@@ -68,7 +69,6 @@ namespace cairocanvas
sal_Int64 nPtr = 0;
maArguments[0] >>= nPtr;
OutputDevice* pOutDev = reinterpret_cast<OutputDevice*>(nPtr);
-
ENSURE_ARG_OR_THROW( pOutDev != nullptr,
"Canvas::initialize: invalid OutDev pointer" );
diff --git a/canvas/source/cairo/cairo_spritecanvas.cxx b/canvas/source/cairo/cairo_spritecanvas.cxx
index 91ac7c376b4d..562157f52c60 100644
--- a/canvas/source/cairo/cairo_spritecanvas.cxx
+++ b/canvas/source/cairo/cairo_spritecanvas.cxx
@@ -77,7 +77,7 @@ namespace cairocanvas
throw lang::NoSupportException(
"Parent window not VCL window, or canvas out-of-process!", nullptr);
- bool bHasCairo = pParentWindow->SupportsCairo();
+ bool bHasCairo = pParentWindow->GetOutDev()->SupportsCairo();
ENSURE_ARG_OR_THROW(bHasCairo,
"CairoSpriteCanvas::SpriteCanvas: No Cairo capability");
diff --git a/canvas/source/cairo/cairo_spritedevicehelper.cxx b/canvas/source/cairo/cairo_spritedevicehelper.cxx
index 825d6f343b43..f2d018937be2 100644
--- a/canvas/source/cairo/cairo_spritedevicehelper.cxx
+++ b/canvas/source/cairo/cairo_spritedevicehelper.cxx
@@ -46,7 +46,7 @@ namespace cairocanvas
bool bFullscreen )
{
DeviceHelper::init(rSpriteCanvas,
- rOutputWindow);
+ *rOutputWindow.GetOutDev());
mpSpriteCanvas = &rSpriteCanvas;
mbFullScreen = bFullscreen;
diff --git a/canvas/source/directx/dx_canvas.cxx b/canvas/source/directx/dx_canvas.cxx
index 3d5bda00288b..7f29813c953b 100644
--- a/canvas/source/directx/dx_canvas.cxx
+++ b/canvas/source/directx/dx_canvas.cxx
@@ -39,6 +39,7 @@
#include <tools/diagnose_ex.h>
#include <vcl/sysdata.hxx>
#include <vcl/skia/SkiaHelper.hxx>
+#include <vcl/window.hxx>
#include <canvas/canvastools.hxx>
diff --git a/canvas/source/vcl/canvas.cxx b/canvas/source/vcl/canvas.cxx
index e9ebf85b3b3a..2ad0a61fc9fd 100644
--- a/canvas/source/vcl/canvas.cxx
+++ b/canvas/source/vcl/canvas.cxx
@@ -25,6 +25,7 @@
#include <sal/log.hxx>
#include <tools/diagnose_ex.h>
#include <vcl/outdev.hxx>
+#include <vcl/window.hxx>
#include "outdevholder.hxx"
diff --git a/canvas/source/vcl/outdevholder.hxx b/canvas/source/vcl/outdevholder.hxx
index 78f3badf8bb6..28dfd4317fe0 100644
--- a/canvas/source/vcl/outdevholder.hxx
+++ b/canvas/source/vcl/outdevholder.hxx
@@ -35,6 +35,7 @@ public:
explicit OutDevHolder(OutputDevice& rOutDev)
: mrOutDev(rOutDev)
{
+ assert(&rOutDev);
}
private:
diff --git a/canvas/source/vcl/spritecanvashelper.cxx b/canvas/source/vcl/spritecanvashelper.cxx
index 0c1a454c3260..1796c8ac7ffe 100644
--- a/canvas/source/vcl/spritecanvashelper.cxx
+++ b/canvas/source/vcl/spritecanvashelper.cxx
@@ -220,7 +220,7 @@ namespace vclcanvas
vcl::Window* pTargetWindow = nullptr;
if( rOutDev.GetOutDevType() == OUTDEV_WINDOW )
{
- pTargetWindow = &static_cast<vcl::Window&>(rOutDev); // TODO(Q3): Evil downcast.
+ pTargetWindow = rOutDev.GetOwnerWindow(); // TODO(Q3): Evil downcast.
// we're double-buffered, thus no need for paint area-limiting
// clips. besides that, will interfere with animations (as for
@@ -309,7 +309,7 @@ namespace vclcanvas
if( pTargetWindow )
{
// commit to screen
- pTargetWindow->Flush();
+ pTargetWindow->GetOutDev()->Flush();
}
return true;
diff --git a/canvas/source/vcl/windowoutdevholder.hxx b/canvas/source/vcl/windowoutdevholder.hxx
index d9d69e9a37c9..87138a8a9106 100644
--- a/canvas/source/vcl/windowoutdevholder.hxx
+++ b/canvas/source/vcl/windowoutdevholder.hxx
@@ -36,8 +36,8 @@ namespace vclcanvas
explicit WindowOutDevHolder( const css::uno::Reference< css::awt::XWindow>& xWin );
private:
- virtual OutputDevice& getOutDev() override { return mrOutputWindow; }
- virtual const OutputDevice& getOutDev() const override { return mrOutputWindow; }
+ virtual OutputDevice& getOutDev() override { return *mrOutputWindow.GetOutDev(); }
+ virtual const OutputDevice& getOutDev() const override { return *mrOutputWindow.GetOutDev(); }
// TODO(Q2): Lifetime issue. Though WindowGraphicDeviceBase
// now listens to the window component, I still consider
diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx
index e19e1f45f2af..9d48b84132d6 100644
--- a/canvas/workben/canvasdemo.cxx
+++ b/canvas/workben/canvasdemo.cxx
@@ -536,7 +536,7 @@ void TestWindow::Paint(vcl::RenderContext&, const tools::Rectangle&)
{
try
{
- uno::Reference< rendering::XCanvas > xVDevCanvas( GetCanvas(),
+ uno::Reference< rendering::XCanvas > xVDevCanvas( GetOutDev()->GetCanvas(),
uno::UNO_SET_THROW );
uno::Reference< rendering::XGraphicDevice > xVDevDevice( xVDevCanvas->getDevice(),
uno::UNO_SET_THROW );
@@ -551,7 +551,7 @@ void TestWindow::Paint(vcl::RenderContext&, const tools::Rectangle&)
aVDevRenderer.drawArcs();
aVDevRenderer.drawPolygons();
- uno::Reference< rendering::XCanvas > xCanvas( GetSpriteCanvas(),
+ uno::Reference< rendering::XCanvas > xCanvas( GetOutDev()->GetSpriteCanvas(),
uno::UNO_QUERY_THROW );
uno::Reference< rendering::XGraphicDevice > xDevice( xCanvas->getDevice(),
uno::UNO_SET_THROW );