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_UNX_SALBMP_H
21 #define INCLUDED_VCL_INC_UNX_SALBMP_H
24 #include <X11/Xutil.h>
26 #include <vcl/salgtype.hxx>
27 #include <unx/saldisp.hxx>
29 #include <vclpluginapi.h>
36 class ImplSalBitmapCache
;
39 class VCLPLUG_GEN_PUBLIC X11SalBitmap
: public SalBitmap
43 static std::unique_ptr
<BitmapBuffer
>
47 const BitmapPalette
& rPal
50 static std::unique_ptr
<BitmapBuffer
>
53 SalX11Screen nXScreen
,
64 static ImplSalBitmapCache
* mpCache
;
65 static sal_uIntPtr mnCacheInstCount
;
67 static void ImplCreateCache();
68 static void ImplDestroyCache();
69 void ImplRemovedFromCache();
73 std::unique_ptr
<BitmapBuffer
> mpDIB
;
74 mutable std::unique_ptr
<ImplSalDDB
> mpDDB
;
79 SAL_DLLPRIVATE
bool ImplCreateFromDrawable(
81 SalX11Screen nXScreen
,
89 SAL_DLLPRIVATE XImage
* ImplCreateXImage(
90 SalDisplay
const * pSalDisp
,
91 SalX11Screen nXScreen
,
93 const SalTwoRect
& rTwoRect
96 SAL_DLLPRIVATE ImplSalDDB
* ImplGetDDB(
98 SalX11Screen nXScreen
,
105 SalX11Screen nXScreen
,
107 const SalTwoRect
& rTwoRect
,
114 virtual ~X11SalBitmap() override
;
116 // override pure virtual methods
119 sal_uInt16 nBitCount
,
120 const BitmapPalette
& rPal
123 virtual bool Create( const SalBitmap
& rSalBmp
) override
;
125 const SalBitmap
& rSalBmp
,
126 SalGraphics
* pGraphics
130 const SalBitmap
& rSalBmp
,
131 sal_uInt16 nNewBitCount
135 const css::uno::Reference
< css::rendering::XBitmapCanvas
>& rBitmapCanvas
,
140 virtual void Destroy() override
;
142 virtual Size
GetSize() const override
;
143 virtual sal_uInt16
GetBitCount() const override
;
145 virtual BitmapBuffer
* AcquireBuffer( BitmapAccessMode nMode
) override
;
146 virtual void ReleaseBuffer( BitmapBuffer
* pBuffer
, BitmapAccessMode nMode
) override
;
147 virtual bool GetSystemData( BitmapSystemData
& rData
) override
;
149 virtual bool ScalingSupported() const override
;
150 virtual bool Scale( const double& rScaleX
, const double& rScaleY
, BmpScaleFlag nScaleFlag
) override
;
151 virtual bool Replace( const Color
& rSearchColor
, const Color
& rReplaceColor
, sal_uInt8 nTol
) override
;
160 SalTwoRect maTwoRect
;
162 SalX11Screen mnXScreen
;
164 static void ImplDraw(
165 Drawable aSrcDrawable
,
166 long nSrcDrawableDepth
,
167 Drawable aDstDrawable
,
182 SalX11Screen nXScreen
,
183 const SalTwoRect
& rTwoRect
188 SalX11Screen nXScreen
,
198 Pixmap
ImplGetPixmap() const { return maPixmap
; }
199 long ImplGetWidth() const { return maTwoRect
.mnDestWidth
; }
200 long ImplGetHeight() const { return maTwoRect
.mnDestHeight
; }
201 long ImplGetDepth() const { return mnDepth
; }
202 const SalX11Screen
& ImplGetScreen() const { return mnXScreen
; }
204 bool ImplMatches( SalX11Screen nXScreen
, long nDepth
, const SalTwoRect
& rTwoRect
) const;
208 const SalTwoRect
& rTwoRect
,
216 class ImplSalBitmapCache
219 typedef ::std::list
< ImplBmpObj
* > BmpList_impl
;
221 BmpList_impl maBmpList
;
225 ImplSalBitmapCache();
226 ~ImplSalBitmapCache();
228 void ImplAdd( X11SalBitmap
* pBmp
);
229 void ImplRemove( X11SalBitmap
const * pBmp
);
233 #endif // INCLUDED_VCL_INC_UNX_SALBMP_H
235 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */