summaryrefslogtreecommitdiffstats
path: root/vcl/inc/unx/x11
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:06:44 +0000
commited5640d8b587fbcfed7dd7967f3de04b37a76f26 (patch)
tree7a5f7c6c9d02226d7471cb3cc8fbbf631b415303 /vcl/inc/unx/x11
parentInitial commit. (diff)
downloadlibreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.tar.xz
libreoffice-ed5640d8b587fbcfed7dd7967f3de04b37a76f26.zip
Adding upstream version 4:7.4.7.upstream/4%7.4.7upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vcl/inc/unx/x11')
-rw-r--r--vcl/inc/unx/x11/x11cairotextrender.hxx41
-rw-r--r--vcl/inc/unx/x11/x11gdiimpl.h26
-rw-r--r--vcl/inc/unx/x11/x11sys.hxx44
-rw-r--r--vcl/inc/unx/x11/xlimits.hxx17
-rw-r--r--vcl/inc/unx/x11/xrender_peer.hxx165
5 files changed, 293 insertions, 0 deletions
diff --git a/vcl/inc/unx/x11/x11cairotextrender.hxx b/vcl/inc/unx/x11/x11cairotextrender.hxx
new file mode 100644
index 000000000..1da78384d
--- /dev/null
+++ b/vcl/inc/unx/x11/x11cairotextrender.hxx
@@ -0,0 +1,41 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX
+#define INCLUDED_VCL_UNX_GENERIC_GDI_X11CAIROTEXTRENDER_HXX
+
+#include <unx/cairotextrender.hxx>
+#include <unx/salgdi.h>
+
+class X11CairoTextRender final : public CairoTextRender
+{
+ X11SalGraphics& mrParent;
+
+public:
+ explicit X11CairoTextRender(X11SalGraphics& rParent);
+
+ virtual cairo_t* getCairoContext() override;
+ virtual void getSurfaceOffset(double& nDX, double& nDY) override;
+ virtual void clipRegion(cairo_t* cr) override;
+ virtual void releaseCairoContext(cairo_t* cr) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11/x11gdiimpl.h b/vcl/inc/unx/x11/x11gdiimpl.h
new file mode 100644
index 000000000..43e4c6bda
--- /dev/null
+++ b/vcl/inc/unx/x11/x11gdiimpl.h
@@ -0,0 +1,26 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#ifndef INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX
+#define INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX
+
+#include <ControlCacheKey.hxx>
+
+class ControlCacheKey;
+
+class X11GraphicsImpl
+{
+public:
+ virtual ~X11GraphicsImpl(){};
+ virtual void Flush(){};
+};
+
+#endif // INCLUDED_VCL_INC_UNX_X11_X11GDIIMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11/x11sys.hxx b/vcl/inc/unx/x11/x11sys.hxx
new file mode 100644
index 000000000..dcbe45928
--- /dev/null
+++ b/vcl/inc/unx/x11/x11sys.hxx
@@ -0,0 +1,44 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
+#define INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
+
+#include <unx/gensys.h>
+#include <vclpluginapi.h>
+
+class X11SalSystem final : public SalGenericSystem
+{
+public:
+ X11SalSystem() {}
+ virtual ~X11SalSystem() override;
+
+ // override pure virtual methods
+ virtual unsigned int GetDisplayScreenCount() override;
+ virtual bool IsUnifiedDisplay() override;
+ virtual unsigned int GetDisplayBuiltInScreen() override;
+ virtual tools::Rectangle GetDisplayScreenPosSizePixel( unsigned int nScreen ) override;
+ virtual int ShowNativeDialog( const OUString& rTitle,
+ const OUString& rMessage,
+ const std::vector< OUString >& rButtons ) override;
+};
+
+#endif // INCLUDED_VCL_INC_UNX_X11_X11SYS_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11/xlimits.hxx b/vcl/inc/unx/x11/xlimits.hxx
new file mode 100644
index 000000000..85a00b17b
--- /dev/null
+++ b/vcl/inc/unx/x11/xlimits.hxx
@@ -0,0 +1,17 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#pragma once
+
+#include <X11/Xlib.h>
+#include <vclpluginapi.h>
+
+Pixmap limitXCreatePixmap(Display *display, Drawable d, unsigned int width, unsigned int height, unsigned int depth);
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/x11/xrender_peer.hxx b/vcl/inc/unx/x11/xrender_peer.hxx
new file mode 100644
index 000000000..e1006f88e
--- /dev/null
+++ b/vcl/inc/unx/x11/xrender_peer.hxx
@@ -0,0 +1,165 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * This file incorporates work covered by the following license notice:
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed
+ * with this work for additional information regarding copyright
+ * ownership. The ASF licenses this file to you under the Apache
+ * License, Version 2.0 (the "License"); you may not use this file
+ * except in compliance with the License. You may obtain a copy of
+ * the License at http://www.apache.org/licenses/LICENSE-2.0 .
+ */
+
+#ifndef INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX
+#define INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX
+
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+struct _XTrap; // on some older systems this is not declared within Xrender.h
+#include <X11/extensions/Xrender.h>
+
+#include <tools/color.hxx>
+
+
+class XRenderPeer
+{
+public:
+ static XRenderPeer& GetInstance();
+
+private:
+ XRenderPeer();
+ void InitRenderLib();
+
+ Display* mpDisplay;
+ XRenderPictFormat* mpStandardFormatA8;
+
+public:
+ XRenderPictFormat* GetStandardFormatA8() const;
+ XRenderPictFormat* FindStandardFormat(int nFormat) const;
+
+ // the methods below are thin wrappers for the XRENDER API
+ XRenderPictFormat* FindVisualFormat( Visual const * ) const;
+ Picture CreatePicture( Drawable, const XRenderPictFormat*,
+ unsigned long nDrawable, const XRenderPictureAttributes* ) const;
+ void ChangePicture( Picture, unsigned long nValueMask,
+ const XRenderPictureAttributes* ) const;
+ void SetPictureClipRegion( Picture, Region ) const;
+ void CompositePicture( int nOp, Picture aSrc, Picture aMask, Picture aDst,
+ int nXSrc, int nYSrc,
+ int nXDst, int nYDst, unsigned nWidth, unsigned nHeight ) const;
+ void FreePicture( Picture ) const;
+
+ void FillRectangle( int nOp, Picture aDst, const XRenderColor*,
+ int nX, int nY, unsigned nW, unsigned nH ) const;
+ void CompositeTrapezoids( int nOp, Picture aSrc, Picture aDst,
+ const XRenderPictFormat*, int nXSrc, int nYSrc,
+ const XTrapezoid*, int nCount ) const;
+ void CompositeTriangles( int nOp, Picture aSrc, Picture aDst,
+ const XRenderPictFormat*, int nXSrc, int nYSrc,
+ const XTriangle*, int nCount ) const;
+};
+
+inline XRenderPictFormat* XRenderPeer::GetStandardFormatA8() const
+{
+ return mpStandardFormatA8;
+}
+
+inline XRenderPictFormat* XRenderPeer::FindStandardFormat(int nFormat) const
+{
+ return XRenderFindStandardFormat(mpDisplay, nFormat);
+}
+
+inline XRenderPictFormat* XRenderPeer::FindVisualFormat( Visual const * pVisual ) const
+{
+ return XRenderFindVisualFormat ( mpDisplay, pVisual );
+}
+
+inline Picture XRenderPeer::CreatePicture( Drawable aDrawable,
+ const XRenderPictFormat* pVisFormat, unsigned long nValueMask,
+ const XRenderPictureAttributes* pRenderAttr ) const
+{
+ return XRenderCreatePicture( mpDisplay, aDrawable, pVisFormat,
+ nValueMask, pRenderAttr );
+}
+
+inline void XRenderPeer::ChangePicture( Picture aPicture,
+ unsigned long nValueMask, const XRenderPictureAttributes* pRenderAttr ) const
+{
+ XRenderChangePicture( mpDisplay, aPicture, nValueMask, pRenderAttr );
+}
+
+inline void XRenderPeer::SetPictureClipRegion( Picture aPicture,
+ Region aXlibRegion ) const
+{
+ XRenderSetPictureClipRegion( mpDisplay, aPicture, aXlibRegion );
+}
+
+inline void XRenderPeer::CompositePicture( int nXRenderOp,
+ Picture aSrcPic, Picture aMaskPic, Picture aDstPic,
+ int nSrcX, int nSrcY, int nDstX, int nDstY,
+ unsigned nWidth, unsigned nHeight ) const
+{
+ XRenderComposite( mpDisplay, nXRenderOp, aSrcPic, aMaskPic, aDstPic,
+ nSrcX, nSrcY, 0/*nMaskX*/, 0/*nMaskY*/, nDstX, nDstY, nWidth, nHeight );
+}
+
+inline void XRenderPeer::FreePicture( Picture aPicture ) const
+{
+ XRenderFreePicture( mpDisplay, aPicture );
+}
+
+inline void XRenderPeer::FillRectangle( int a, Picture b, const XRenderColor* c,
+ int d, int e, unsigned int f, unsigned int g) const
+{
+ XRenderFillRectangle( mpDisplay, a, b, c, d, e, f, g );
+}
+
+inline void XRenderPeer::CompositeTrapezoids( int nOp,
+ Picture aSrc, Picture aDst, const XRenderPictFormat* pXRPF,
+ int nXSrc, int nYSrc, const XTrapezoid* pXT, int nCount ) const
+{
+ XRenderCompositeTrapezoids( mpDisplay, nOp, aSrc, aDst, pXRPF,
+ nXSrc, nYSrc, pXT, nCount );
+}
+
+inline void XRenderPeer::CompositeTriangles( int nOp,
+ Picture aSrc, Picture aDst, const XRenderPictFormat* pXRPF,
+ int nXSrc, int nYSrc, const XTriangle* pXT, int nCount ) const
+{
+ XRenderCompositeTriangles( mpDisplay, nOp, aSrc, aDst, pXRPF,
+ nXSrc, nYSrc, pXT, nCount );
+}
+
+inline XRenderColor GetXRenderColor( Color rColor, double fTransparency )
+{
+ XRenderColor aRetVal;
+ // convert the Color
+ aRetVal.red = rColor.GetRed(); aRetVal.red |= (aRetVal.red << 8);
+ aRetVal.green = rColor.GetGreen(); aRetVal.green |= (aRetVal.green << 8);
+ aRetVal.blue = rColor.GetBlue(); aRetVal.blue |= (aRetVal.blue << 8);
+
+ // handle transparency
+ aRetVal.alpha = 0xFFFF; // default to opaque
+ if( fTransparency != 0 )
+ {
+ const double fAlpha = 1.0 - fTransparency;
+ aRetVal.alpha = static_cast<sal_uInt16>(fAlpha * 0xFFFF + 0.5);
+ // xrender wants pre-multiplied colors
+ aRetVal.red = static_cast<sal_uInt16>(fAlpha * aRetVal.red + 0.5);
+ aRetVal.green = static_cast<sal_uInt16>(fAlpha * aRetVal.green + 0.5);
+ aRetVal.blue = static_cast<sal_uInt16>(fAlpha * aRetVal.blue + 0.5);
+ }
+
+ return aRetVal;
+}
+
+#endif // INCLUDED_VCL_UNX_X11_XRENDER_PEER_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */