summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2023-01-10 20:53:17 +0000
committerCaolán McNamara <caolanm@redhat.com>2023-01-12 08:49:06 +0000
commit1e96a295024b6a200afff2065786885ea3b131b4 (patch)
tree0b97de14547d68470b22d879b2d2ef3ecab4a16c /vcl
parent0f348ba55db9eabe990b5bbeb42d1d94b3b70e79 (diff)
this is never a X11SalBitmap anymore
Change-Id: I9f645128709bce93be1c8548614b5e72e6667844 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/145292 Tested-by: Caolán McNamara <caolanm@redhat.com> Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/inc/headless/BitmapHelper.hxx4
-rw-r--r--vcl/inc/headless/CairoCommon.hxx2
-rw-r--r--vcl/unx/generic/window/salframe.cxx61
3 files changed, 41 insertions, 26 deletions
diff --git a/vcl/inc/headless/BitmapHelper.hxx b/vcl/inc/headless/BitmapHelper.hxx
index 0aed5e3693fc..dbd7e86675e3 100644
--- a/vcl/inc/headless/BitmapHelper.hxx
+++ b/vcl/inc/headless/BitmapHelper.hxx
@@ -23,7 +23,7 @@
#include <headless/svpbmp.hxx>
#include <basegfx/utils/systemdependentdata.hxx>
-class BitmapHelper : public SurfaceHelper
+class VCL_DLLPUBLIC BitmapHelper : public SurfaceHelper
{
private:
#ifdef HAVE_CAIRO_FORMAT_RGB24_888
@@ -37,7 +37,7 @@ public:
unsigned char* getBits(sal_Int32& rStride);
};
-class MaskHelper : public SurfaceHelper
+class VCL_DLLPUBLIC MaskHelper : public SurfaceHelper
{
private:
std::unique_ptr<unsigned char[]> pAlphaBits;
diff --git a/vcl/inc/headless/CairoCommon.hxx b/vcl/inc/headless/CairoCommon.hxx
index 4cbe1af538ba..cd011b2a9eab 100644
--- a/vcl/inc/headless/CairoCommon.hxx
+++ b/vcl/inc/headless/CairoCommon.hxx
@@ -234,7 +234,7 @@ private:
sal_Int32 nWidth) const;
};
-class SurfaceHelper
+class VCL_DLLPUBLIC SurfaceHelper
{
private:
cairo_surface_t* pSurface;
diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx
index bdf22ca0dc33..325cb8853fe6 100644
--- a/vcl/unx/generic/window/salframe.cxx
+++ b/vcl/unx/generic/window/salframe.cxx
@@ -38,11 +38,12 @@
#include <X11/keysym.h>
#include <X11/extensions/shape.h>
+#include <headless/BitmapHelper.hxx>
+#include <headless/svpbmp.hxx>
#include <unx/saldisp.hxx>
#include <unx/salgdi.h>
#include <unx/salframe.h>
#include <unx/wmadaptor.hxx>
-#include <unx/salbmp.h>
#include <unx/i18n_ic.hxx>
#include <unx/i18n_keysym.hxx>
#include <opengl/zone.hxx>
@@ -307,11 +308,12 @@ static bool lcl_SelectAppIconPixmap( SalDisplay const *pDisplay, SalX11Screen nX
if( aIcon.IsEmpty() )
return false;
- X11SalBitmap *pBitmap = dynamic_cast < X11SalBitmap * >
+ SvpSalBitmap* pBitmap = dynamic_cast<SvpSalBitmap*>
(aIcon.ImplGetBitmapSalBitmap().get());
- if (!pBitmap) // FIXME: opengl , TODO SKIA
+ if (!pBitmap) // FIXME: TODO SKIA
return false;
+ // Note: can't find a working environment where this seems to matter anymore,
icon_pixmap = XCreatePixmap( pDisplay->GetDisplay(),
pDisplay->GetRootWindow( nXScreen ),
iconSize, iconSize,
@@ -319,39 +321,52 @@ static bool lcl_SelectAppIconPixmap( SalDisplay const *pDisplay, SalX11Screen nX
nXScreen.getXScreen() )
);
- SalTwoRect aRect(0, 0, iconSize, iconSize, 0, 0, iconSize, iconSize);
+ {
+ cairo_surface_t* pSurface = cairo_xlib_surface_create(pDisplay->GetDisplay(), icon_pixmap,
+ pDisplay->GetColormap(nXScreen).GetVisual().visual,
+ iconSize, iconSize);
+
+ cairo_t* cr = cairo_create(pSurface);
+
+ BitmapHelper aBitmapHelper(*pBitmap);
+ cairo_surface_t* source = aBitmapHelper.getSurface(iconSize, iconSize);
- pBitmap->ImplDraw( icon_pixmap,
- nXScreen,
- DefaultDepth( pDisplay->GetDisplay(),
- nXScreen.getXScreen() ),
- aRect,
- DefaultGC( pDisplay->GetDisplay(),
- nXScreen.getXScreen() ) );
+ cairo_rectangle(cr, 0, 0, iconSize, iconSize);
+ cairo_set_source_surface(cr, source, 0, 0);
+ cairo_paint(cr);
+
+ cairo_destroy(cr);
+ cairo_surface_destroy(pSurface);
+ }
icon_mask = None;
if( aIcon.IsAlpha() )
{
icon_mask = XCreatePixmap( pDisplay->GetDisplay(),
- pDisplay->GetRootWindow( pDisplay->GetDefaultXScreen() ),
+ pDisplay->GetRootWindow(nXScreen),
iconSize, iconSize, 1);
- XGCValues aValues;
- aValues.foreground = 0xffffffff;
- aValues.background = 0;
- aValues.function = GXcopy;
- GC aMonoGC = XCreateGC( pDisplay->GetDisplay(), icon_mask,
- GCFunction|GCForeground|GCBackground, &aValues );
-
Bitmap aMask = aIcon.GetAlphaMask();
- aMask.Invert();
- X11SalBitmap *pMask = static_cast < X11SalBitmap * >
+ SvpSalBitmap* pMask = static_cast<SvpSalBitmap*>
(aMask.ImplGetSalBitmap().get());
- pMask->ImplDraw(icon_mask, nXScreen, 1, aRect, aMonoGC);
- XFreeGC( pDisplay->GetDisplay(), aMonoGC );
+ cairo_surface_t* pSurface = cairo_xlib_surface_create_for_bitmap(pDisplay->GetDisplay(), icon_mask,
+ ScreenOfDisplay(pDisplay->GetDisplay(), nXScreen.getXScreen()),
+ iconSize, iconSize);
+
+ cairo_t* cr = cairo_create(pSurface);
+
+ MaskHelper aMaskHelper(*pMask);
+ cairo_surface_t* source = aMaskHelper.getSurface(iconSize, iconSize);
+
+ cairo_rectangle(cr, 0, 0, iconSize, iconSize);
+ cairo_set_source_surface(cr, source, 0, 0);
+ cairo_paint(cr);
+
+ cairo_destroy(cr);
+ cairo_surface_destroy(pSurface);
}
return true;