include/vcl_canvas/graphicdevice.hxx | 3 + include/vcl_canvas/spritecanvas.hxx | 5 +- vcl/Library_vcl.mk | 1 vcl/canvas_inc/base/bitmapcanvasbase.hxx | 4 - vcl/canvas_inc/base/bufferedgraphicdevicebase.hxx | 8 +-- vcl/canvas_inc/base/canvasbase.hxx | 8 +-- vcl/canvas_inc/base/canvascustomspritehelper.hxx | 4 - vcl/canvas_inc/base/disambiguationhelper.hxx | 4 - vcl/canvas_inc/base/graphicdevicebase.hxx | 24 +++++------ vcl/canvas_inc/base/integerbitmapbase.hxx | 4 - vcl/canvas_inc/base/spritecanvasbase.hxx | 19 ++++----- vcl/canvas_inc/base/spritesurface.hxx | 5 +- vcl/canvas_inc/cairo_canvasbitmap.hxx | 8 ++- vcl/canvas_inc/cairo_canvascustomsprite.hxx | 4 - vcl/canvas_inc/cairo_canvashelper.hxx | 11 ++--- vcl/canvas_inc/cairo_spritecanvas.hxx | 39 ++++++------------- vcl/canvas_inc/cairo_spritehelper.hxx | 4 - vcl/canvas_inc/cairo_surfaceprovider.hxx | 5 +- vcl/source/canvas/cairo/cairo_canvasbitmap.cxx | 10 ++-- vcl/source/canvas/cairo/cairo_canvascustomsprite.cxx | 6 +- vcl/source/canvas/cairo/cairo_canvashelper.cxx | 22 +++++++--- vcl/source/canvas/cairo/cairo_devicehelper.cxx | 10 ++-- vcl/source/canvas/cairo/cairo_spritecanvas.cxx | 19 +++++---- vcl/source/canvas/cairo/cairo_spritehelper.cxx | 7 +-- vcl/source/canvas/tools/canvascustomspritehelper.cxx | 4 - 25 files changed, 126 insertions(+), 112 deletions(-)
New commits: commit 0ce36d1c3484fb2393e1a385a836145fb694297b Author: Shardul Vikram Singh <shardulvi...@gmail.com> AuthorDate: Sun Jul 20 01:54:06 2025 +0530 Commit: Shardul Vikram Singh <shardulvi...@gmail.com> CommitDate: Sun Jul 20 01:54:06 2025 +0530 Do more refactoring and fix related issues diff --git a/include/vcl_canvas/graphicdevice.hxx b/include/vcl_canvas/graphicdevice.hxx index 6e21f88ee661..6394895480cc 100644 --- a/include/vcl_canvas/graphicdevice.hxx +++ b/include/vcl_canvas/graphicdevice.hxx @@ -6,6 +6,7 @@ #include <com/sun/star/rendering/XBezierPolyPolygon2D.hpp> #include <com/sun/star/rendering/XBitmap.hpp> #include <com/sun/star/rendering/XVolatileBitmap.hpp> +#include <memory> namespace vcl_canvas { class GraphicDevice @@ -23,4 +24,6 @@ public: virtual ::sal_Bool hasFullScreenMode() = 0; virtual ::sal_Bool enterFullScreenMode( ::sal_Bool bEnter ) = 0; }; + +typedef std::shared_ptr< GraphicDevice > GraphicDeviceSharedPtr; } diff --git a/include/vcl_canvas/spritecanvas.hxx b/include/vcl_canvas/spritecanvas.hxx index d07514beaab9..ac0ca22e8125 100644 --- a/include/vcl_canvas/spritecanvas.hxx +++ b/include/vcl_canvas/spritecanvas.hxx @@ -16,4 +16,6 @@ public: virtual sal_Bool updateScreen( sal_Bool bUpdateAll ) = 0; }; +typedef std::shared_ptr< SpriteCanvas > SpriteCanvasSharedPtr; + } diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 38e378008dc2..b55f90161360 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -113,7 +113,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/canvas/cairo/cairo_cachedbitmap \ - vcl/source/canvas/cairo/cairo_canvas \ vcl/source/canvas/cairo/cairo_canvasbitmap \ vcl/source/canvas/cairo/cairo_canvascustomsprite \ vcl/source/canvas/cairo/cairo_canvasfont \ diff --git a/vcl/canvas_inc/base/bufferedgraphicdevicebase.hxx b/vcl/canvas_inc/base/bufferedgraphicdevicebase.hxx index 9b4670f3f7cb..635cffc513bc 100644 --- a/vcl/canvas_inc/base/bufferedgraphicdevicebase.hxx +++ b/vcl/canvas_inc/base/bufferedgraphicdevicebase.hxx @@ -89,13 +89,13 @@ namespace vcl_canvas } // XGraphicDevice - virtual css::uno::Reference< css::rendering::XBufferController > SAL_CALL getBufferController( ) override + /* virtual css::uno::Reference< css::rendering::XBufferController > SAL_CALL getBufferController( ) override { return this; - } + } */ // XBufferController - virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) override + /* virtual ::sal_Int32 SAL_CALL createBuffers( ::sal_Int32 nBuffers ) override { tools::verifyRange( nBuffers, sal_Int32(1) ); @@ -118,7 +118,7 @@ namespace vcl_canvas MutexType aGuard( BaseType::m_aMutex ); return BaseType::maDeviceHelper.switchBuffer( mbIsVisible, bUpdateAll ); - } + } */ /** Set corresponding canvas window diff --git a/vcl/canvas_inc/base/canvascustomspritehelper.hxx b/vcl/canvas_inc/base/canvascustomspritehelper.hxx index 2e02beae5e54..061fdd87068b 100644 --- a/vcl/canvas_inc/base/canvascustomspritehelper.hxx +++ b/vcl/canvas_inc/base/canvascustomspritehelper.hxx @@ -59,7 +59,7 @@ namespace vcl_canvas The XSpriteCanvas this sprite is displayed on */ void init( const css::geometry::RealSize2D& rSpriteSize, - const SpriteSurface::Reference& rOwningSpriteCanvas ); + const SpriteSurface::SharedPtr& rOwningSpriteCanvas ); /** Object is being disposed, release all internal references @@ -170,7 +170,7 @@ namespace vcl_canvas /// Owning sprite canvas - SpriteSurface::Reference mpSpriteCanvas; + SpriteSurface::SharedPtr mpSpriteCanvas; /** Currently active clip area. diff --git a/vcl/canvas_inc/base/disambiguationhelper.hxx b/vcl/canvas_inc/base/disambiguationhelper.hxx index b0218d0392dd..9af544e0fb6b 100644 --- a/vcl/canvas_inc/base/disambiguationhelper.hxx +++ b/vcl/canvas_inc/base/disambiguationhelper.hxx @@ -67,11 +67,11 @@ namespace vcl_canvas mutable ::osl::Mutex m_aMutex; private: - virtual void SAL_CALL disposing() override + /* virtual void SAL_CALL disposing() override { disposeThis(); } virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override - { disposeEventSource(Source); } + { disposeEventSource(Source); } */ }; } diff --git a/vcl/canvas_inc/base/graphicdevicebase.hxx b/vcl/canvas_inc/base/graphicdevicebase.hxx index 11b2a84de2fa..d89aaa0a6e24 100644 --- a/vcl/canvas_inc/base/graphicdevicebase.hxx +++ b/vcl/canvas_inc/base/graphicdevicebase.hxx @@ -142,10 +142,10 @@ namespace vcl_canvas } // XGraphicDevice - virtual css::uno::Reference< css::rendering::XBufferController > SAL_CALL getBufferController( ) override + /* 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 { @@ -226,10 +226,10 @@ namespace vcl_canvas return maDeviceHelper.createVolatileAlphaBitmap( this, size ); } - virtual css::uno::Reference< css::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) override + /* virtual css::uno::Reference< css::lang::XMultiServiceFactory > SAL_CALL getParametricPolyPolygonFactory( ) override { return this; - } + } */ virtual sal_Bool SAL_CALL hasFullScreenMode( ) override { @@ -242,26 +242,26 @@ namespace vcl_canvas } // XMultiServiceFactory - virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override + /* 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 + /* 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 + /* virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames( ) override { return ParametricPolyPolygon::getAvailableServiceNames(); - } + } */ // XUpdatable @@ -275,7 +275,7 @@ namespace vcl_canvas // XPropertySet - virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override + /* virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override { MutexType aGuard( BaseType::m_aMutex ); return maPropHelper.getPropertySetInfo(); @@ -318,7 +318,7 @@ namespace vcl_canvas 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. diff --git a/vcl/canvas_inc/base/spritesurface.hxx b/vcl/canvas_inc/base/spritesurface.hxx index 44328a5dc6ef..8a6c28fe8a4e 100644 --- a/vcl/canvas_inc/base/spritesurface.hxx +++ b/vcl/canvas_inc/base/spritesurface.hxx @@ -20,6 +20,7 @@ #pragma once #include <base/sprite.hxx> +#include <memory> namespace vcl_canvas { @@ -32,10 +33,10 @@ namespace vcl_canvas methods provided here are used from the individual sprites to notify the canvas about necessary screen updates. */ - class SpriteSurface : public css::uno::XInterface + class SpriteSurface { public: - typedef ::rtl::Reference< SpriteSurface > Reference; + typedef std::shared_ptr< SpriteSurface > SharedPtr; /// Sprites should call this from XSprite::show() virtual void showSprite( const Sprite::Reference& rSprite ) = 0; diff --git a/vcl/canvas_inc/cairo_canvasbitmap.hxx b/vcl/canvas_inc/cairo_canvasbitmap.hxx index ac842c7fffe6..32543c2c966f 100644 --- a/vcl/canvas_inc/cairo_canvasbitmap.hxx +++ b/vcl/canvas_inc/cairo_canvasbitmap.hxx @@ -33,6 +33,8 @@ #include "cairo_canvashelper.hxx" #include "cairo_repainttarget.hxx" +#include "cairo_surfaceprovider.hxx" +#include "vcl_canvas/graphicdevice.hxx" /* Definition of CanvasBitmap class */ @@ -69,8 +71,8 @@ namespace vcl_cairocanvas Reference device, with which bitmap should be compatible */ CanvasBitmap( const ::basegfx::B2ISize& rSize, - SurfaceProviderRef rDevice, - css::rendering::XGraphicDevice* pDevice, + SurfaceProviderSharedPtr rDevice, + vcl_canvas::GraphicDeviceSharedPtr pDevice, bool bHasAlpha ); /// Dispose all internal references @@ -113,7 +115,7 @@ namespace vcl_cairocanvas virtual void SAL_CALL setFastPropertyValue(sal_Int32, const css::uno::Any&) override {} private: - SurfaceProviderRef mpSurfaceProvider; + SurfaceProviderSharedPtr mpSurfaceProvider; ::cairo::SurfaceSharedPtr mpBufferSurface; ::cairo::CairoSharedPtr mpBufferCairo; diff --git a/vcl/canvas_inc/cairo_canvascustomsprite.hxx b/vcl/canvas_inc/cairo_canvascustomsprite.hxx index 8adde88597ee..83677ac7590f 100644 --- a/vcl/canvas_inc/cairo_canvascustomsprite.hxx +++ b/vcl/canvas_inc/cairo_canvascustomsprite.hxx @@ -97,7 +97,7 @@ namespace vcl_cairocanvas Target DX device */ CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rRefDevice ); + const SpriteCanvasSharedPtr& rRefDevice ); virtual void disposeThis() override; @@ -136,7 +136,7 @@ namespace vcl_cairocanvas /** MUST hold here, too, since CanvasHelper only contains a raw pointer (without refcounting) */ - SpriteCanvasRef mpSpriteCanvas; + SpriteCanvasSharedPtr mpSpriteCanvas; ::cairo::SurfaceSharedPtr mpBufferSurface; ::basegfx::B2ISize maSize; }; diff --git a/vcl/canvas_inc/cairo_canvashelper.hxx b/vcl/canvas_inc/cairo_canvashelper.hxx index f9f69a4c33ad..f9cd51bfd99c 100644 --- a/vcl/canvas_inc/cairo_canvashelper.hxx +++ b/vcl/canvas_inc/cairo_canvashelper.hxx @@ -29,6 +29,7 @@ #include <vcl/cairo.hxx> #include "cairo_surfaceprovider.hxx" +#include "vcl_canvas/graphicdevice.hxx" class VirtualDevice; @@ -76,7 +77,7 @@ namespace vcl_cairocanvas */ void init( const ::basegfx::B2ISize& rSizePixel, SurfaceProvider& rSurfaceProvider, - css::rendering::XGraphicDevice* pDevice ); + ::vcl_canvas::GraphicDeviceSharedPtr pDevice ); void setSize( const ::basegfx::B2ISize& rSize ); void setSurface( const ::cairo::SurfaceSharedPtr& pSurface, bool bHasAlpha ); @@ -184,8 +185,8 @@ namespace vcl_cairocanvas const css::uno::Reference< css::rendering::XBitmap >& xBitmap, const css::rendering::ViewState& viewState, const css::rendering::RenderState& renderState ); - css::uno::Reference< css::rendering::XGraphicDevice > - getDevice() { return css::uno::Reference< css::rendering::XGraphicDevice >(mpDevice); } + vcl_canvas::GraphicDevice* + getDevice() { return mpDevice; } // BitmapCanvasHelper functionality // ================================ @@ -238,7 +239,7 @@ namespace vcl_cairocanvas Deliberately not a refcounted reference, because of potential circular references for spritecanvas. */ - css::rendering::XGraphicDevice* mpDevice; + vcl_canvas::GraphicDevice* mpDevice; private: @@ -263,7 +264,7 @@ namespace vcl_cairocanvas Operation aOperation, cairo_t* pCairo, const css::uno::Sequence< css::rendering::Texture >* pTextures, - const SurfaceProviderRef& pDevice, + const SurfaceProviderSharedPtr& pDevice, css::rendering::FillRule eFillrule ); } diff --git a/vcl/canvas_inc/cairo_spritecanvas.hxx b/vcl/canvas_inc/cairo_spritecanvas.hxx index a81678ea73b5..71eab0852aed 100644 --- a/vcl/canvas_inc/cairo_spritecanvas.hxx +++ b/vcl/canvas_inc/cairo_spritecanvas.hxx @@ -19,6 +19,7 @@ #pragma once +#include <memory> #include <vcl_canvas/windowlistener.hxx> #include <vcl_canvas/updatable.hxx> #include <vcl_canvas/spritecanvas.hxx> @@ -59,17 +60,25 @@ namespace vcl_cairocanvas css::beans::XPropertySet, css::lang::XServiceName, css::lang::XServiceInfo > WindowGraphicDeviceBase_Base; */ - typedef ::vcl_canvas::BufferedGraphicDeviceBase< ::vcl_canvas::DisambiguationHelper< SpriteCanvasBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base2; - typedef ::vcl_canvas::SpriteCanvasBase< SpriteCanvasBase_Base, + typedef ::vcl_canvas::SpriteCanvasBase< SpriteCanvasBase_Base2, SpriteCanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBaseT; + /** Product of this component's factory. + + The SpriteCanvas object combines the actual Window canvas with + the XGraphicDevice interface. This is because there's a + one-to-one relation between them, anyway, since each window + can have exactly one canvas and one associated + XGraphicDevice. And to avoid messing around with circular + references, this is implemented as one single object. + */ class SpriteCanvas : public SpriteCanvasBaseT, public RepaintTarget { @@ -127,6 +136,7 @@ namespace vcl_cairocanvas css::uno::Sequence< css::uno::Any > maArguments; }; + typedef std::shared_ptr< SpriteCanvas > SpriteCanvasSharedPtr; typedef ::rtl::Reference< SpriteCanvas > SpriteCanvasRef; } diff --git a/vcl/canvas_inc/cairo_spritehelper.hxx b/vcl/canvas_inc/cairo_spritehelper.hxx index 67070365a23f..d4084c7dc6c5 100644 --- a/vcl/canvas_inc/cairo_spritehelper.hxx +++ b/vcl/canvas_inc/cairo_spritehelper.hxx @@ -63,7 +63,7 @@ namespace vcl_cairocanvas When true, little debug bound rects for sprites are shown */ void init( const css::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas ); + const SpriteCanvasSharedPtr rSpriteCanvas ); void disposing(); @@ -93,7 +93,7 @@ namespace vcl_cairocanvas css::uno::Reference< css::rendering::XPolyPolygon2D >& xPoly ) const override; - SpriteCanvasRef mpSpriteCanvas; + SpriteCanvasSharedPtr mpSpriteCanvas; ::cairo::SurfaceSharedPtr mpBufferSurface; mutable bool mbTextureDirty; // when true, texture needs update }; diff --git a/vcl/canvas_inc/cairo_surfaceprovider.hxx b/vcl/canvas_inc/cairo_surfaceprovider.hxx index 16b5c8b5e2e4..3e7b94d30c78 100644 --- a/vcl/canvas_inc/cairo_surfaceprovider.hxx +++ b/vcl/canvas_inc/cairo_surfaceprovider.hxx @@ -37,7 +37,7 @@ namespace vcl_cairocanvas This interface must be implemented on all canvas implementations that hand out XCachedPrimitives */ - class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider : public css::uno::XInterface + class SAL_LOPLUGIN_ANNOTATE("crosscast") SurfaceProvider { public: virtual ~SurfaceProvider() {} @@ -64,7 +64,8 @@ namespace vcl_cairocanvas virtual OutputDevice* getOutputDevice() = 0; }; - typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef; + // typedef ::rtl::Reference< SurfaceProvider > SurfaceProviderRef; + typedef std::shared_ptr< SurfaceProvider > SurfaceProviderSharedPtr; } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/canvas/cairo/cairo_canvasbitmap.cxx b/vcl/source/canvas/cairo/cairo_canvasbitmap.cxx index c58a66b799c5..0efb3d41bf77 100644 --- a/vcl/source/canvas/cairo/cairo_canvasbitmap.cxx +++ b/vcl/source/canvas/cairo/cairo_canvasbitmap.cxx @@ -29,6 +29,8 @@ #include <cairo.h> #include "cairo_canvasbitmap.hxx" +#include "cairo_surfaceprovider.hxx" +#include "vcl_canvas/graphicdevice.hxx" using namespace ::cairo; using namespace ::com::sun::star; @@ -36,14 +38,14 @@ using namespace ::com::sun::star; namespace vcl_cairocanvas { CanvasBitmap::CanvasBitmap( const ::basegfx::B2ISize& rSize, - SurfaceProviderRef rSurfaceProvider, - rendering::XGraphicDevice* pDevice, + SurfaceProviderSharedPtr rSurfaceProvider, + ::vcl_canvas::GraphicDeviceSharedPtr pDevice, bool bHasAlpha ) : mpSurfaceProvider(std::move( rSurfaceProvider )), maSize(rSize), mbHasAlpha(bHasAlpha) { - ENSURE_OR_THROW( mpSurfaceProvider.is(), + ENSURE_OR_THROW( mpSurfaceProvider, "CanvasBitmap::CanvasBitmap(): Invalid surface or device" ); SAL_INFO( @@ -62,7 +64,7 @@ namespace vcl_cairocanvas void CanvasBitmap::disposeThis() { - mpSurfaceProvider.clear(); + // mpSurfaceProvider.clear(); mpBufferCairo.reset(); mpBufferSurface.reset(); diff --git a/vcl/source/canvas/cairo/cairo_canvascustomsprite.cxx b/vcl/source/canvas/cairo/cairo_canvascustomsprite.cxx index baebf9be88e8..d072fcc45223 100644 --- a/vcl/source/canvas/cairo/cairo_canvascustomsprite.cxx +++ b/vcl/source/canvas/cairo/cairo_canvascustomsprite.cxx @@ -37,7 +37,7 @@ using namespace ::com::sun::star; namespace vcl_cairocanvas { CanvasCustomSprite::CanvasCustomSprite( const css::geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rRefDevice ) : + const SpriteCanvasSharedPtr& rRefDevice ) : mpSpriteCanvas( rRefDevice ), maSize( ::vcl_canvas::tools::roundUp( rSpriteSize.Width ), ::vcl_canvas::tools::roundUp( rSpriteSize.Height ) ) @@ -51,7 +51,7 @@ namespace vcl_cairocanvas maCanvasHelper.init( maSize, *rRefDevice, - rRefDevice.get() ); + rRefDevice ); maCanvasHelper.setSurface( mpBufferSurface, true ); maSpriteHelper.init( rSpriteSize, @@ -66,7 +66,7 @@ namespace vcl_cairocanvas { ::osl::MutexGuard aGuard( m_aMutex ); - mpSpriteCanvas.clear(); + // mpSpriteCanvas.clear(); mpBufferSurface.reset(); // forward to parent diff --git a/vcl/source/canvas/cairo/cairo_canvashelper.cxx b/vcl/source/canvas/cairo/cairo_canvashelper.cxx index 04c1985abea0..e9a66405e50c 100644 --- a/vcl/source/canvas/cairo/cairo_canvashelper.cxx +++ b/vcl/source/canvas/cairo/cairo_canvashelper.cxx @@ -54,6 +54,8 @@ #include "cairo_cachedbitmap.hxx" #include "cairo_canvasbitmap.hxx" +#include "cairo_surfaceprovider.hxx" +#include "vcl_canvas/graphicdevice.hxx" #include "cairo_canvashelper.hxx" using namespace ::cairo; @@ -79,11 +81,11 @@ namespace vcl_cairocanvas void CanvasHelper::init( const ::basegfx::B2ISize& rSizePixel, SurfaceProvider& rSurfaceProvider, - rendering::XGraphicDevice* pDevice ) + vcl_canvas::GraphicDeviceSharedPtr pDevice ) { maSize = rSizePixel; mpSurfaceProvider = &rSurfaceProvider; - mpDevice = pDevice; + mpDevice = pDevice.get(); } void CanvasHelper::setSize( const ::basegfx::B2ISize& rSize ) @@ -330,7 +332,10 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: * * @return created surface or NULL **/ - static SurfaceSharedPtr surfaceFromXBitmap( const uno::Reference< rendering::XBitmap >& xBitmap, const SurfaceProviderRef& rSurfaceProvider, unsigned char*& data, bool& bHasAlpha ) + static SurfaceSharedPtr surfaceFromXBitmap(const uno::Reference<rendering::XBitmap>& xBitmap, + // const SurfaceProviderRef& rSurfaceProvider, + SurfaceProvider* rSurfaceProvider, + unsigned char*& data, bool& bHasAlpha) { bHasAlpha = xBitmap->hasAlpha(); SurfaceSharedPtr pSurface = surfaceFromXBitmap( xBitmap ); @@ -454,7 +459,8 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: static void doOperation( Operation aOperation, cairo_t* pCairo, const uno::Sequence< rendering::Texture >* pTextures, - const SurfaceProviderRef& pDevice, + // const SurfaceProviderRef& pDevice, + SurfaceProvider* pDevice, const basegfx::B2DRange& rBounds ) { switch( aOperation ) @@ -663,7 +669,8 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: Operation aOperation, cairo_t* pCairo, const uno::Sequence< rendering::Texture >* pTextures, - const SurfaceProviderRef& pDevice, + // const SurfaceProviderRef& pDevice, + SurfaceProvider* pDevice, rendering::FillRule eFillrule ) { if( pTextures ) @@ -1288,9 +1295,10 @@ constexpr OUStringLiteral PARAMETRICPOLYPOLYGON_IMPLEMENTATION_NAME = u"Canvas:: if( mpCairo ) { - return uno::Reference< rendering::XBitmap >( new CanvasBitmap( ::basegfx::B2ISize( ::vcl_canvas::tools::roundUp( newSize.Width ), + // DONT_FORGET_TO_REMOVE_THIS_COMMENT + return uno::Reference< rendering::XBitmap >( /* new CanvasBitmap( ::basegfx::B2ISize( ::vcl_canvas::tools::roundUp( newSize.Width ), ::vcl_canvas::tools::roundUp( newSize.Height ) ), - mpSurfaceProvider, mpDevice, false ) ); + mpSurfaceProvider, mpDevice, false ) */ ); } else SAL_INFO( "canvas.cairo", "CanvasHelper called after it was disposed"); diff --git a/vcl/source/canvas/cairo/cairo_devicehelper.cxx b/vcl/source/canvas/cairo/cairo_devicehelper.cxx index aacdb20d5a0e..de1c266a4470 100644 --- a/vcl/source/canvas/cairo/cairo_devicehelper.cxx +++ b/vcl/source/canvas/cairo/cairo_devicehelper.cxx @@ -157,11 +157,12 @@ namespace vcl_cairocanvas return uno::Reference< rendering::XBitmap >(); // we're disposed return uno::Reference< rendering::XBitmap >( - new CanvasBitmap( + // DONT_FORGET_TO_REMOVE_THIS_COMMENT + /* new CanvasBitmap( ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ), SurfaceProviderRef(mpSurfaceProvider), rDevice.get(), - false )); + false ) */); } uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileBitmap( @@ -180,11 +181,12 @@ namespace vcl_cairocanvas return uno::Reference< rendering::XBitmap >(); // we're disposed return uno::Reference< rendering::XBitmap >( - new CanvasBitmap( + // DONT_FORGET_TO_REMOVE_THIS_COMMENT + /* new CanvasBitmap( ::basegfx::unotools::b2ISizeFromIntegerSize2D( size ), SurfaceProviderRef(mpSurfaceProvider), rDevice.get(), - true )); + true ) */); } uno::Reference< rendering::XVolatileBitmap > DeviceHelper::createVolatileAlphaBitmap( diff --git a/vcl/source/canvas/cairo/cairo_spritecanvas.cxx b/vcl/source/canvas/cairo/cairo_spritecanvas.cxx index a4e539d04f7b..3aa987df5ed0 100644 --- a/vcl/source/canvas/cairo/cairo_spritecanvas.cxx +++ b/vcl/source/canvas/cairo/cairo_spritecanvas.cxx @@ -20,6 +20,8 @@ #include <sal/config.h> #include <sal/log.hxx> +#include "com/sun/star/uno/Reference.h" +#include "com/sun/star/uno/XInterface.hdl" #include "toolkit/awt/vclxwindow.hxx" #include <basegfx/range/b2irange.hxx> #include <basegfx/utils/canvastools.hxx> @@ -110,7 +112,7 @@ namespace vcl_cairocanvas SpriteCanvasBaseT::disposeThis(); } */ - sal_Bool SAL_CALL SpriteCanvas::showBuffer( sal_Bool bUpdateAll ) + /* sal_Bool SAL_CALL SpriteCanvas::showBuffer( sal_Bool bUpdateAll ) { return updateScreen( bUpdateAll ); } @@ -118,7 +120,7 @@ namespace vcl_cairocanvas sal_Bool SAL_CALL SpriteCanvas::switchBuffer( sal_Bool bUpdateAll ) { return updateScreen( bUpdateAll ); - } + } */ sal_Bool SAL_CALL SpriteCanvas::updateScreen( sal_Bool bUpdateAll ) { @@ -133,7 +135,7 @@ namespace vcl_cairocanvas mbSurfaceDirty); } - OUString SAL_CALL SpriteCanvas::getServiceName( ) + /* OUString SAL_CALL SpriteCanvas::getServiceName( ) { return u"com.sun.star.rendering.SpriteCanvas.Cairo"_ustr; } @@ -151,7 +153,7 @@ namespace vcl_cairocanvas css::uno::Sequence< OUString > SpriteCanvas::getSupportedServiceNames() { return { getServiceName() }; - } + } */ SurfaceSharedPtr SpriteCanvas::getSurface() { @@ -226,9 +228,10 @@ extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* com_sun_star_comp_rendering_SpriteCanvas_Cairo_get_implementation( css::uno::XComponentContext* context, css::uno::Sequence<css::uno::Any> const& args) { - rtl::Reference<vcl_cairocanvas::SpriteCanvas> p = new vcl_cairocanvas::SpriteCanvas(args, context); + /* rtl::Reference<vcl_cairocanvas::SpriteCanvas> p = new vcl_cairocanvas::SpriteCanvas(args, context); p->initialize(); - return cppu::acquire(p.get()); + return cppu::acquire(p.get()); */ + return css::uno::Reference<css::uno::XInterface>().get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/canvas/cairo/cairo_spritehelper.cxx b/vcl/source/canvas/cairo/cairo_spritehelper.cxx index b20651209fa6..8ba15bf65587 100644 --- a/vcl/source/canvas/cairo/cairo_spritehelper.cxx +++ b/vcl/source/canvas/cairo/cairo_spritehelper.cxx @@ -31,6 +31,7 @@ #include <pixman.h> #include "cairo_spritehelper.hxx" +#include "cairo_surfaceprovider.hxx" using namespace ::cairo; using namespace ::com::sun::star; @@ -42,7 +43,7 @@ namespace vcl_cairocanvas {} void SpriteHelper::init( const geometry::RealSize2D& rSpriteSize, - const SpriteCanvasRef& rSpriteCanvas ) + const SpriteCanvasSharedPtr rSpriteCanvas ) { ENSURE_OR_THROW( rSpriteCanvas, "SpriteHelper::init(): Invalid device, sprite canvas or surface" ); @@ -62,7 +63,7 @@ namespace vcl_cairocanvas void SpriteHelper::disposing() { mpBufferSurface.reset(); - mpSpriteCanvas.clear(); + // mpSpriteCanvas.clear(); // forward to parent CanvasCustomSpriteHelper::disposing(); @@ -129,7 +130,7 @@ namespace vcl_cairocanvas rClip )); doPolyPolygonImplementation( aClipPoly, Clip, pCairo.get(), - nullptr, SurfaceProviderRef(mpSpriteCanvas), + nullptr, SurfaceProviderSharedPtr(mpSpriteCanvas), rClip->getFillRule() ); } diff --git a/vcl/source/canvas/tools/canvascustomspritehelper.cxx b/vcl/source/canvas/tools/canvascustomspritehelper.cxx index 5ca659d44960..9ff6cca8d270 100644 --- a/vcl/source/canvas/tools/canvascustomspritehelper.cxx +++ b/vcl/source/canvas/tools/canvascustomspritehelper.cxx @@ -155,7 +155,7 @@ namespace vcl_canvas } void CanvasCustomSpriteHelper::init( const geometry::RealSize2D& rSpriteSize, - const SpriteSurface::Reference& rOwningSpriteCanvas ) + const SpriteSurface::SharedPtr& rOwningSpriteCanvas ) { ENSURE_OR_THROW( rOwningSpriteCanvas, "CanvasCustomSpriteHelper::init(): Invalid owning sprite canvas" ); @@ -171,7 +171,7 @@ namespace vcl_canvas void CanvasCustomSpriteHelper::disposing() { - mpSpriteCanvas.clear(); + // mpSpriteCanvas.clear(); } void CanvasCustomSpriteHelper::clearingContent( const Sprite::Reference& /*rSprite*/ ) commit 951c22a4c7bd2904106153d995e62b4626dad488 Author: Shardul Vikram Singh <shardulvi...@gmail.com> AuthorDate: Sat Jul 19 15:53:30 2025 +0530 Commit: Shardul Vikram Singh <shardulvi...@gmail.com> CommitDate: Sat Jul 19 15:53:30 2025 +0530 Comment out the unused definitions from vcl_cairocanvas::SpriteCanvas diff --git a/include/vcl_canvas/spritecanvas.hxx b/include/vcl_canvas/spritecanvas.hxx index af3e5583d6f2..d07514beaab9 100644 --- a/include/vcl_canvas/spritecanvas.hxx +++ b/include/vcl_canvas/spritecanvas.hxx @@ -4,6 +4,7 @@ #include <com/sun/star/rendering/XBitmap.hpp> #include "canvas.hxx" #include "customsprite.hxx" +#include "sal/types.h" namespace vcl_canvas { @@ -12,7 +13,7 @@ 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; + virtual sal_Bool updateScreen( sal_Bool bUpdateAll ) = 0; }; } diff --git a/vcl/canvas_inc/base/bitmapcanvasbase.hxx b/vcl/canvas_inc/base/bitmapcanvasbase.hxx index 0ccf87be7a30..a017b1af43ad 100644 --- a/vcl/canvas_inc/base/bitmapcanvasbase.hxx +++ b/vcl/canvas_inc/base/bitmapcanvasbase.hxx @@ -69,7 +69,7 @@ namespace vcl_canvas typedef CanvasBase< Base, CanvasHelper, Mutex, UnambiguousBase > BaseType; // XBitmap - virtual css::geometry::IntegerSize2D SAL_CALL getSize( ) override + /* virtual css::geometry::IntegerSize2D SAL_CALL getSize( ) override { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); @@ -87,7 +87,7 @@ namespace vcl_canvas typename BaseType::MutexType aGuard( BaseType::m_aMutex ); return BaseType::maCanvasHelper.getScaledBitmap( newSize, beFast ); - } + } */ }; diff --git a/vcl/canvas_inc/base/canvasbase.hxx b/vcl/canvas_inc/base/canvasbase.hxx index 48ce5cb0cefa..3521babe695e 100644 --- a/vcl/canvas_inc/base/canvasbase.hxx +++ b/vcl/canvas_inc/base/canvasbase.hxx @@ -120,7 +120,7 @@ namespace vcl_canvas { } - virtual void disposeThis() override + /* virtual void disposeThis() override { MutexType aGuard( BaseType::m_aMutex ); @@ -128,10 +128,10 @@ namespace vcl_canvas // pass on to base class BaseType::disposeThis(); - } + } */ // XCanvas - virtual void SAL_CALL clear() override + /* virtual void SAL_CALL clear() override { MutexType aGuard( BaseType::m_aMutex ); @@ -433,7 +433,7 @@ namespace vcl_canvas MutexType aGuard( BaseType::m_aMutex ); return maCanvasHelper.getDevice(); - } + } */ protected: ~CanvasBase() {} // we're a ref-counted UNO class. _We_ destroy ourselves. diff --git a/vcl/canvas_inc/base/integerbitmapbase.hxx b/vcl/canvas_inc/base/integerbitmapbase.hxx index a90953bf89dd..e58f531f7aee 100644 --- a/vcl/canvas_inc/base/integerbitmapbase.hxx +++ b/vcl/canvas_inc/base/integerbitmapbase.hxx @@ -40,7 +40,7 @@ namespace vcl_canvas { public: // XIntegerBitmap - virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout, + /* virtual css::uno::Sequence< sal_Int8 > SAL_CALL getData( css::rendering::IntegerBitmapLayout& bitmapLayout, const css::geometry::IntegerRectangle2D& rect ) override { tools::verifyArgs(rect, @@ -101,7 +101,7 @@ namespace vcl_canvas typename Base::MutexType aGuard( Base::m_aMutex ); return Base::maCanvasHelper.getMemoryLayout(); - } + } */ }; } diff --git a/vcl/canvas_inc/base/spritecanvasbase.hxx b/vcl/canvas_inc/base/spritecanvasbase.hxx index 0f5e9ab01197..837070f194ff 100644 --- a/vcl/canvas_inc/base/spritecanvasbase.hxx +++ b/vcl/canvas_inc/base/spritecanvasbase.hxx @@ -19,6 +19,7 @@ #pragma once +#include "vcl_canvas/customsprite.hxx" #include <rtl/ref.hxx> #include <com/sun/star/rendering/InterpolationMode.hpp> #include <base/integerbitmapbase.hxx> @@ -81,7 +82,7 @@ namespace vcl_canvas { } - virtual void disposeThis() override + /* virtual void disposeThis() override { typename BaseType::MutexType aGuard( BaseType::m_aMutex ); @@ -89,10 +90,10 @@ namespace vcl_canvas // 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 + /* virtual css::uno::Reference< css::rendering::XAnimatedSprite > SAL_CALL createSpriteFromAnimation( const css::uno::Reference< css::rendering::XAnimation >& animation ) override { tools::verifyArgs(animation, __func__, @@ -101,9 +102,9 @@ namespace vcl_canvas 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, + /* 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, @@ -116,9 +117,9 @@ namespace vcl_canvas 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 + virtual CustomSpriteSharedPtr SAL_CALL createCustomSprite( const css::geometry::RealSize2D& spriteSize ) override { tools::verifySpriteSize(spriteSize, __func__, @@ -129,7 +130,7 @@ namespace vcl_canvas return BaseType::maCanvasHelper.createCustomSprite(spriteSize); } - virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite( const css::uno::Reference< css::rendering::XSprite >& original ) override + /* virtual css::uno::Reference< css::rendering::XSprite > SAL_CALL createClonedSprite( const css::uno::Reference< css::rendering::XSprite >& original ) override { tools::verifyArgs(original, __func__, @@ -138,7 +139,7 @@ namespace vcl_canvas typename BaseType::MutexType aGuard( BaseType::m_aMutex ); return BaseType::maCanvasHelper.createClonedSprite(original); - } + } */ // SpriteSurface virtual void showSprite( const Sprite::Reference& rSprite ) override diff --git a/vcl/canvas_inc/cairo_spritecanvas.hxx b/vcl/canvas_inc/cairo_spritecanvas.hxx index c7ada9453b48..a81678ea73b5 100644 --- a/vcl/canvas_inc/cairo_spritecanvas.hxx +++ b/vcl/canvas_inc/cairo_spritecanvas.hxx @@ -27,6 +27,8 @@ #include <cppuhelper/compbase.hxx> #include <comphelper/uno3.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> + #include <base/spritecanvasbase.hxx> #include <base/spritesurface.hxx> #include <base/disambiguationhelper.hxx> @@ -57,42 +59,17 @@ namespace vcl_cairocanvas css::beans::XPropertySet, css::lang::XServiceName, css::lang::XServiceInfo > WindowGraphicDeviceBase_Base; */ + typedef ::vcl_canvas::BufferedGraphicDeviceBase< ::vcl_canvas::DisambiguationHelper< SpriteCanvasBase_Base >, SpriteDeviceHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBase_Base2; - /** Mixin SpriteSurface - - Have to mixin the SpriteSurface before deriving from - ::canvas::SpriteCanvasBase, as this template should already - implement some of those interface methods. - - The reason why this appears kinda convoluted is the fact that - we cannot specify non-IDL types as WeakComponentImplHelper - template args, and furthermore, don't want to derive - ::canvas::SpriteCanvasBase directly from - ::canvas::SpriteSurface (because derivees of - ::canvas::SpriteCanvasBase have to explicitly forward the - XInterface methods (e.g. via DECLARE_UNO3_AGG_DEFAULTS) - anyway). Basically, ::canvas::CanvasCustomSpriteBase should - remain a base class that provides implementation, not to - enforce any specific interface on its derivees. - */ typedef ::vcl_canvas::SpriteCanvasBase< SpriteCanvasBase_Base, SpriteCanvasHelper, ::osl::MutexGuard, ::cppu::OWeakObject > SpriteCanvasBaseT; - /** Product of this component's factory. - - The SpriteCanvas object combines the actual Window canvas with - the XGraphicDevice interface. This is because there's a - one-to-one relation between them, anyway, since each window - can have exactly one canvas and one associated - XGraphicDevice. And to avoid messing around with circular - references, this is implemented as one single object. - */ class SpriteCanvas : public SpriteCanvasBaseT, public RepaintTarget { @@ -103,29 +80,29 @@ namespace vcl_cairocanvas void initialize(); /// Dispose all internal references - virtual void disposeThis() override; + // virtual void disposeThis() override; // Forwarding the XComponent implementation to the // cppu::ImplHelper templated base // Classname Base doing refcounting Base implementing the XComponent interface // | | | // V V V - DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase ) + // DECLARE_UNO3_XCOMPONENT_AGG_DEFAULTS( SpriteCanvas, WindowGraphicDeviceBase_Base, ::cppu::WeakComponentImplHelperBase ) // XBufferController (partial) - virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override; - virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override; + /* virtual sal_Bool SAL_CALL showBuffer( sal_Bool bUpdateAll ) override; + virtual sal_Bool SAL_CALL switchBuffer( sal_Bool bUpdateAll ) override; */ // XSpriteCanvas (partial) - virtual sal_Bool SAL_CALL updateScreen( sal_Bool bUpdateAll ) override; + virtual sal_Bool updateScreen( sal_Bool bUpdateAll ) override; // XServiceName - virtual OUString SAL_CALL getServiceName( ) override; + // virtual OUString SAL_CALL getServiceName( ) override; // XServiceInfo - virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override; + /* virtual sal_Bool SAL_CALL supportsService(const OUString& sServiceName) override; virtual OUString SAL_CALL getImplementationName() override; - virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; */ // SurfaceProvider virtual ::cairo::SurfaceSharedPtr getSurface() override; diff --git a/vcl/source/canvas/cairo/cairo_spritecanvas.cxx b/vcl/source/canvas/cairo/cairo_spritecanvas.cxx index 8c161cf3af1d..a4e539d04f7b 100644 --- a/vcl/source/canvas/cairo/cairo_spritecanvas.cxx +++ b/vcl/source/canvas/cairo/cairo_spritecanvas.cxx @@ -102,13 +102,13 @@ namespace vcl_cairocanvas maArguments.realloc(0); } - void SpriteCanvas::disposeThis() + /* void SpriteCanvas::disposeThis() { ::osl::MutexGuard aGuard( m_aMutex ); // forward to parent SpriteCanvasBaseT::disposeThis(); - } + } */ sal_Bool SAL_CALL SpriteCanvas::showBuffer( sal_Bool bUpdateAll ) {