diff options
Diffstat (limited to 'toolkit')
-rw-r--r-- | toolkit/inc/awt/vclxbitmap.hxx | 11 | ||||
-rw-r--r-- | toolkit/source/awt/vclxbitmap.cxx | 7 | ||||
-rw-r--r-- | toolkit/source/helper/vclunohelper.cxx | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/toolkit/inc/awt/vclxbitmap.hxx b/toolkit/inc/awt/vclxbitmap.hxx index 38ba3642678a..abf40aa9e9f0 100644 --- a/toolkit/inc/awt/vclxbitmap.hxx +++ b/toolkit/inc/awt/vclxbitmap.hxx @@ -23,6 +23,7 @@ #include <com/sun/star/awt/XDisplayBitmap.hpp> #include <com/sun/star/lang/XTypeProvider.hpp> #include <com/sun/star/lang/XUnoTunnel.hpp> +#include <com/sun/star/util/XAccounting.hpp> #include <comphelper/servicehelper.hxx> #include <cppuhelper/implbase.hxx> #include <osl/mutex.hxx> @@ -34,7 +35,8 @@ class VCLXBitmap final : public cppu::WeakImplHelper< css::awt::XBitmap, css::awt::XDisplayBitmap, - css::lang::XUnoTunnel> + css::lang::XUnoTunnel, + css::util::XAccounting> { ::osl::Mutex maMutex; BitmapEx maBitmap; @@ -43,6 +45,10 @@ class VCLXBitmap final : public cppu::WeakImplHelper< public: + // linine constructors + VCLXBitmap() : maMutex(), maBitmap() {} + VCLXBitmap(const BitmapEx& rBitmapEx) : maMutex(), maBitmap(rBitmapEx) {} + void SetBitmap( const BitmapEx& rBmp ) { maBitmap = rBmp; } const BitmapEx& GetBitmap() const { return maBitmap; } @@ -53,6 +59,9 @@ public: css::awt::Size SAL_CALL getSize() override; css::uno::Sequence< sal_Int8 > SAL_CALL getDIB() override; css::uno::Sequence< sal_Int8 > SAL_CALL getMaskDIB() override; + + // XAccounting + sal_Int64 SAL_CALL estimateUsage() override; }; diff --git a/toolkit/source/awt/vclxbitmap.cxx b/toolkit/source/awt/vclxbitmap.cxx index 9bc045c2d1a1..4b08ebd40a7f 100644 --- a/toolkit/source/awt/vclxbitmap.cxx +++ b/toolkit/source/awt/vclxbitmap.cxx @@ -55,4 +55,11 @@ css::uno::Sequence< sal_Int8 > VCLXBitmap::getMaskDIB() return vcl::bitmap::GetMaskDIB(maBitmap); } +sal_Int64 SAL_CALL VCLXBitmap::estimateUsage() +{ + ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); + + return maBitmap.GetSizeBytes(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/toolkit/source/helper/vclunohelper.cxx b/toolkit/source/helper/vclunohelper.cxx index 696ed16e1140..e1f0bf38d1ec 100644 --- a/toolkit/source/helper/vclunohelper.cxx +++ b/toolkit/source/helper/vclunohelper.cxx @@ -101,6 +101,11 @@ css::uno::Reference< css::awt::XBitmap> VCLUnoHelper::CreateBitmap( const Bitmap return xBmp; } +css::uno::Reference< css::awt::XBitmap> VCLUnoHelper::CreateVCLXBitmap( const BitmapEx& rBitmap ) +{ + return css::uno::Reference< css::awt::XBitmap >(new VCLXBitmap(rBitmap)); +} + VclPtr< vcl::Window > VCLUnoHelper::GetWindow( const css::uno::Reference< css::awt::XWindow>& rxWindow ) { VCLXWindow* pVCLXWindow = comphelper::getUnoTunnelImplementation<VCLXWindow>( rxWindow ); |