1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX
21 #define INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX
23 #include <sal/config.h>
26 #include <basegfx/utils/systemdependentdata.hxx>
28 class VCL_DLLPUBLIC SvpSalBitmap final
: public SalBitmap
, public basegfx::SystemDependentDataHolder
// MM02
30 std::unique_ptr
<BitmapBuffer
> mpDIB
;
33 virtual ~SvpSalBitmap() override
;
36 virtual bool Create(const Size
& rSize
,
37 vcl::PixelFormat ePixelFormat
,
38 const BitmapPalette
& rPalette
) override
;
39 virtual bool Create( const SalBitmap
& rSalBmp
) override
;
40 virtual bool Create( const SalBitmap
& rSalBmp
,
41 SalGraphics
* pGraphics
) override
;
42 virtual bool Create(const SalBitmap
& rSalBmp
,
43 vcl::PixelFormat eNewPixelFormat
) override
;
44 virtual bool Create( const css::uno::Reference
< css::rendering::XBitmapCanvas
>& rBitmapCanvas
,
46 bool bMask
= false ) override
;
47 void Create(std::unique_ptr
<BitmapBuffer
> pBuf
);
48 const BitmapBuffer
* GetBuffer() const
52 virtual void Destroy() final override
;
53 virtual Size
GetSize() const override
;
54 virtual sal_uInt16
GetBitCount() const override
;
56 virtual BitmapBuffer
* AcquireBuffer( BitmapAccessMode nMode
) override
;
57 virtual void ReleaseBuffer( BitmapBuffer
* pBuffer
, BitmapAccessMode nMode
) override
;
58 virtual bool GetSystemData( BitmapSystemData
& rData
) override
;
60 virtual bool ScalingSupported() const override
;
61 virtual bool Scale( const double& rScaleX
, const double& rScaleY
, BmpScaleFlag nScaleFlag
) override
;
62 virtual bool Replace( const Color
& rSearchColor
, const Color
& rReplaceColor
, sal_uInt8 nTol
) override
;
64 // MM02 exclusive management op's for SystemDependentData at WinSalBitmap
66 std::shared_ptr
<T
> getSystemDependentData() const
68 return std::static_pointer_cast
<T
>(basegfx::SystemDependentDataHolder::getSystemDependentData(typeid(T
).hash_code()));
71 template<class T
, class... Args
>
72 std::shared_ptr
<T
> addOrReplaceSystemDependentData(basegfx::SystemDependentDataManager
& manager
, Args
&&... args
) const
74 std::shared_ptr
<T
> r
= std::make_shared
<T
>(manager
, std::forward
<Args
>(args
)...);
76 // tdf#129845 only add to buffer if a relevant buffer time is estimated
77 if(r
->calculateCombinedHoldCyclesInSeconds() > 0)
79 basegfx::SystemDependentData_SharedPtr
r2(r
);
80 const_cast< SvpSalBitmap
* >(this)->basegfx::SystemDependentDataHolder::addOrReplaceSystemDependentData(r2
);
87 #endif // INCLUDED_VCL_INC_HEADLESS_SVPBMP_HXX
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */