summaryrefslogtreecommitdiff
path: root/toolkit
diff options
context:
space:
mode:
authorArmin Le Grand <armin.le.grand@me.com>2020-04-10 18:07:41 +0200
committerArmin Le Grand <Armin.Le.Grand@me.com>2020-04-10 20:37:52 +0200
commitae743c6fae4543282f8930dc78175cc510fabbb3 (patch)
treeeb44065aece45c9fd86b50df495c3746192fb0be /toolkit
parent25468bba15a149edc1e53a7518070c64d4c967e9 (diff)
Make BitmapPrimitive2D vcl-independent
as preparation to have drawinglayer module independent from vcl in the future Change-Id: Iaa01370f27b51cba5114a54f37d1ec73d0719918 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92048 Tested-by: Jenkins Reviewed-by: Armin Le Grand <Armin.Le.Grand@me.com>
Diffstat (limited to 'toolkit')
-rw-r--r--toolkit/inc/awt/vclxbitmap.hxx11
-rw-r--r--toolkit/source/awt/vclxbitmap.cxx7
-rw-r--r--toolkit/source/helper/vclunohelper.cxx5
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 );