include/vcl_canvas/canvas.hxx         |   11 ++++++++++
 include/vcl_canvas/customsprite.hxx   |   16 ++++++++++++++
 include/vcl_canvas/graphicdevice.hxx  |   26 +++++++++++++++++++++++
 include/vcl_canvas/sprite.hxx         |   23 +++++++++++++++++++++
 include/vcl_canvas/spritecanvas.hxx   |   18 ++++++++++++++++
 include/vcl_canvas/updatable.hxx      |   10 +++++++++
 include/vcl_canvas/windowlistener.hxx |   15 +++++++++++++
 vcl/canvas_inc/cairo_spritecanvas.hxx |   37 +++++++++++++++-------------------
 8 files changed, 136 insertions(+), 20 deletions(-)

New commits:
commit a7ba12bd40492c5194cca0d07da103f502ac9f2e
Author:     Shardul Vikram Singh <shardulvi...@gmail.com>
AuthorDate: Sat Jul 19 03:02:15 2025 +0530
Commit:     Shardul Vikram Singh <shardulvi...@gmail.com>
CommitDate: Sat Jul 19 03:02:15 2025 +0530

    Some initial refactoring to simplify canvas

diff --git a/include/vcl_canvas/canvas.hxx b/include/vcl_canvas/canvas.hxx
new file mode 100644
index 000000000000..48f599891a72
--- /dev/null
+++ b/include/vcl_canvas/canvas.hxx
@@ -0,0 +1,11 @@
+#pragma once
+
+namespace vcl_canvas
+{
+class Canvas
+{
+public:
+    virtual void clear() = 0;
+    // NO DRAWING FUNCTIONS NEEDED :)
+};
+}
diff --git a/include/vcl_canvas/customsprite.hxx 
b/include/vcl_canvas/customsprite.hxx
new file mode 100644
index 000000000000..9d589ec47977
--- /dev/null
+++ b/include/vcl_canvas/customsprite.hxx
@@ -0,0 +1,16 @@
+#pragma once
+
+#include "sprite.hxx"
+#include "canvas.hxx"
+#include <memory>
+
+namespace vcl_canvas
+{
+class CustomSprite : public SpriteBase
+{
+public:
+    virtual Canvas getContentCanvas() = 0;
+};
+
+typedef std::shared_ptr<CustomSprite> CustomSpriteSharedPtr;
+}
diff --git a/include/vcl_canvas/graphicdevice.hxx 
b/include/vcl_canvas/graphicdevice.hxx
new file mode 100644
index 000000000000..6e21f88ee661
--- /dev/null
+++ b/include/vcl_canvas/graphicdevice.hxx
@@ -0,0 +1,26 @@
+#pragma once
+
+#include <com/sun/star/rendering/XColorSpace.hpp>
+#include <com/sun/star/geometry/RealSize2D.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>
+namespace vcl_canvas
+{
+class GraphicDevice
+{
+public:
+    virtual ::css::uno::Reference< ::css::rendering::XColorSpace > 
getDeviceColorSpace() = 0;
+    virtual ::css::geometry::RealSize2D getPhysicalResolution() = 0;
+    virtual ::css::geometry::RealSize2D getPhysicalSize() = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XLinePolyPolygon2D > 
createCompatibleLinePolyPolygon( const ::css::uno::Sequence< 
::css::uno::Sequence< ::css::geometry::RealPoint2D > >& points ) = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XBezierPolyPolygon2D > 
createCompatibleBezierPolyPolygon( const ::css::uno::Sequence< 
::css::uno::Sequence< ::css::geometry::RealBezierSegment2D > >& points ) = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XBitmap > 
createCompatibleBitmap( const ::css::geometry::IntegerSize2D& size ) = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XVolatileBitmap > 
createVolatileBitmap( const ::css::geometry::IntegerSize2D& size ) = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XBitmap > 
createCompatibleAlphaBitmap( const ::css::geometry::IntegerSize2D& size ) = 0;
+    virtual ::css::uno::Reference< ::css::rendering::XVolatileBitmap > 
createVolatileAlphaBitmap( const ::css::geometry::IntegerSize2D& size ) = 0;
+    virtual ::sal_Bool hasFullScreenMode() = 0;
+    virtual ::sal_Bool enterFullScreenMode( ::sal_Bool bEnter ) = 0;
+};
+}
diff --git a/include/vcl_canvas/sprite.hxx b/include/vcl_canvas/sprite.hxx
new file mode 100644
index 000000000000..d54aeabb31ce
--- /dev/null
+++ b/include/vcl_canvas/sprite.hxx
@@ -0,0 +1,23 @@
+#pragma once
+
+#include "com/sun/star/geometry/AffineMatrix2D.hdl"
+#include "com/sun/star/geometry/RealPoint2D.hdl"
+#include "com/sun/star/rendering/RenderState.hdl"
+#include "com/sun/star/rendering/ViewState.hdl"
+#include <memory>
+namespace vcl_canvas
+{
+class SpriteBase
+{
+public:
+    virtual void setAlpha( double nAlpha ) = 0;
+    virtual void move( const ::css::geometry::RealPoint2D& aNewPos, const 
::css::rendering::ViewState& aViewState, const ::css::rendering::RenderState& 
aRenderState ) = 0;
+    virtual void transform( const ::css::geometry::AffineMatrix2D& 
aTransformation ) = 0;
+    virtual void clip( const ::css::uno::Reference< 
::css::rendering::XPolyPolygon2D >& aClip ) = 0;
+    virtual void setPriority( double nPriority ) = 0;
+    virtual void show() = 0;
+    virtual void hide() = 0;
+};
+
+typedef std::shared_ptr<SpriteBase> SpriteSharedPtr;
+}
diff --git a/include/vcl_canvas/spritecanvas.hxx 
b/include/vcl_canvas/spritecanvas.hxx
new file mode 100644
index 000000000000..af3e5583d6f2
--- /dev/null
+++ b/include/vcl_canvas/spritecanvas.hxx
@@ -0,0 +1,18 @@
+#pragma once
+
+#include <com/sun/star/rendering/XAnimation.hpp>
+#include <com/sun/star/rendering/XBitmap.hpp>
+#include "canvas.hxx"
+#include "customsprite.hxx"
+namespace vcl_canvas
+{
+
+class SpriteCanvas : public Canvas
+{
+public:
+    virtual CustomSpriteSharedPtr createCustomSprite( const 
::css::geometry::RealSize2D& spriteSize ) = 0;
+    virtual SpriteSharedPtr createClonedSprite( const SpriteBase& original ) = 
0;
+    virtual bool updateScreen( bool bUpdateAll ) = 0;
+};
+
+}
diff --git a/include/vcl_canvas/updatable.hxx b/include/vcl_canvas/updatable.hxx
new file mode 100644
index 000000000000..a69eabe4825f
--- /dev/null
+++ b/include/vcl_canvas/updatable.hxx
@@ -0,0 +1,10 @@
+#pragma once
+
+namespace vcl_canvas
+{
+class Updatable
+{
+public:
+    virtual void update() = 0;
+};
+}
diff --git a/include/vcl_canvas/windowlistener.hxx 
b/include/vcl_canvas/windowlistener.hxx
new file mode 100644
index 000000000000..c1ad70446b02
--- /dev/null
+++ b/include/vcl_canvas/windowlistener.hxx
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <com/sun/star/awt/WindowEvent.hpp>
+
+namespace vcl_canvas
+{
+class WindowListener
+{
+public:
+    virtual void windowResized( const ::css::awt::WindowEvent& e ) = 0;
+    virtual void windowMoved( const ::css::awt::WindowEvent& e ) = 0;
+    virtual void windowShown( const ::css::lang::EventObject& e ) = 0;
+    virtual void windowHidden( const ::css::lang::EventObject& e ) = 0;
+};
+}
diff --git a/vcl/canvas_inc/cairo_spritecanvas.hxx 
b/vcl/canvas_inc/cairo_spritecanvas.hxx
index 0f728f67d5aa..c7ada9453b48 100644
--- a/vcl/canvas_inc/cairo_spritecanvas.hxx
+++ b/vcl/canvas_inc/cairo_spritecanvas.hxx
@@ -19,16 +19,10 @@
 
 #pragma once
 
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/lang/XServiceName.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/awt/XWindowListener.hpp>
-#include <com/sun/star/util/XUpdatable.hpp>
-#include <com/sun/star/rendering/XSpriteCanvas.hpp>
-#include <com/sun/star/rendering/XIntegerBitmap.hpp>
-#include <com/sun/star/rendering/XGraphicDevice.hpp>
-#include <com/sun/star/rendering/XBufferController.hpp>
+#include <vcl_canvas/windowlistener.hxx>
+#include <vcl_canvas/updatable.hxx>
+#include <vcl_canvas/spritecanvas.hxx>
+#include <vcl_canvas/graphicdevice.hxx>
 
 #include <cppuhelper/compbase.hxx>
 #include <comphelper/uno3.hxx>
@@ -45,7 +39,15 @@
 
 namespace vcl_cairocanvas
 {
-    typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
+    class SpriteCanvasBase_Base : public ::vcl_canvas::SpriteCanvas,
+                                  public ::vcl_canvas::GraphicDevice,
+                                  public ::vcl_canvas::WindowListener,
+                                  public ::vcl_canvas::Updatable,
+                                  public ::vcl_canvas::SpriteSurface,
+                                  public SurfaceProvider
+    {
+    };
+    /* typedef ::cppu::WeakComponentImplHelper< css::rendering::XSpriteCanvas,
                                              css::rendering::XIntegerBitmap,
                                              css::rendering::XGraphicDevice,
                                              css::lang::XMultiServiceFactory,
@@ -54,11 +56,11 @@ namespace vcl_cairocanvas
                                              css::util::XUpdatable,
                                              css::beans::XPropertySet,
                                              css::lang::XServiceName,
-                                             css::lang::XServiceInfo >  
WindowGraphicDeviceBase_Base;
-    typedef ::vcl_canvas::BufferedGraphicDeviceBase< 
::vcl_canvas::DisambiguationHelper< WindowGraphicDeviceBase_Base >,
+                                             css::lang::XServiceInfo >  
WindowGraphicDeviceBase_Base; */
+    typedef ::vcl_canvas::BufferedGraphicDeviceBase< 
::vcl_canvas::DisambiguationHelper< SpriteCanvasBase_Base >,
                                                  SpriteDeviceHelper,
                                                  ::osl::MutexGuard,
-                                                 ::cppu::OWeakObject > 
SpriteCanvasBase_Base;
+                                                 ::cppu::OWeakObject > 
SpriteCanvasBase_Base2;
     /** Mixin SpriteSurface
 
         Have to mixin the SpriteSurface before deriving from
@@ -76,13 +78,8 @@ namespace vcl_cairocanvas
         remain a base class that provides implementation, not to
         enforce any specific interface on its derivees.
      */
-    class SpriteCanvasBaseSpriteSurface_Base : public SpriteCanvasBase_Base,
-                                               public 
::vcl_canvas::SpriteSurface,
-                                               public SurfaceProvider
-    {
-    };
 
-    typedef ::vcl_canvas::SpriteCanvasBase< SpriteCanvasBaseSpriteSurface_Base,
+    typedef ::vcl_canvas::SpriteCanvasBase< SpriteCanvasBase_Base,
                                         SpriteCanvasHelper,
                                         ::osl::MutexGuard,
                                         ::cppu::OWeakObject >           
SpriteCanvasBaseT;

Reply via email to