summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@collabora.com>2019-10-12 17:46:11 +0200
committerLuboš Luňák <l.lunak@collabora.com>2019-11-27 09:55:05 +0100
commit1e9fae677579b59ddbc4cd69e201b95f51b8c742 (patch)
tree3bcbc86dae348397d10f0557bbceca88a0b86469
parentmove opengl vcl files to opengl/ (diff)
downloadcore-1e9fae677579b59ddbc4cd69e201b95f51b8c742.tar.gz
core-1e9fae677579b59ddbc4cd69e201b95f51b8c742.zip
initial empty Skia VCL implementation
This mostly duplicates OpenGL cases. Pretty much all implementation methods are empty. Change-Id: I333506f56dcc46c3e9405fe8194c172de17c54fd
-rw-r--r--RepositoryExternal.mk1
-rw-r--r--include/vcl/skia/SkiaHelper.hxx26
-rw-r--r--vcl/Library_vcl.mk4
-rw-r--r--vcl/Library_vclplug_gen.mk4
-rw-r--r--vcl/inc/skia/gdiimpl.hxx185
-rw-r--r--vcl/inc/skia/salbmp.hxx66
-rw-r--r--vcl/inc/skia/x11/cairotextrender.hxx27
-rw-r--r--vcl/inc/skia/x11/gdiimpl.hxx36
-rw-r--r--vcl/inc/skia/x11/salvd.hxx46
-rw-r--r--vcl/inc/unx/salgdi.h6
-rw-r--r--vcl/skia/SkiaHelper.cxx72
-rw-r--r--vcl/skia/gdiimpl.cxx304
-rw-r--r--vcl/skia/salbmp.cxx107
-rw-r--r--vcl/skia/x11/cairotextrender.cxx87
-rw-r--r--vcl/skia/x11/gdiimpl.cxx28
-rw-r--r--vcl/skia/x11/salvd.cxx86
-rw-r--r--vcl/source/app/svapp.cxx1
-rw-r--r--vcl/source/gdi/bitmap3.cxx1
-rw-r--r--vcl/source/outdev/bitmap.cxx2
-rw-r--r--vcl/unx/generic/app/saldisp.cxx1
-rw-r--r--vcl/unx/generic/gdi/salbmp.cxx6
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx17
-rw-r--r--vcl/unx/generic/gdi/salvd.cxx6
23 files changed, 1113 insertions, 6 deletions
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index ec7095f99798..b2a4ef548163 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -116,6 +116,7 @@ define gb_LinkTarget__use_skia
$(call gb_LinkTarget_set_include,$(1),\
-I$(call gb_UnpackedTarball_get_dir,skia)/include/core \
-I$(call gb_UnpackedTarball_get_dir,skia)/include/config \
+ -I$(call gb_UnpackedTarball_get_dir,skia) \
$$(INCLUDE) \
)
$(call gb_LinkTarget_use_libraries,$(1),skia)
diff --git a/include/vcl/skia/SkiaHelper.hxx b/include/vcl/skia/SkiaHelper.hxx
new file mode 100644
index 000000000000..77e9fab5797a
--- /dev/null
+++ b/include/vcl/skia/SkiaHelper.hxx
@@ -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_SKIA_SKIAHELPER_HXX
+#define INCLUDED_VCL_SKIA_SKIAHELPER_HXX
+
+#include <vcl/dllapi.h>
+
+// All member functions static and VCL_DLLPUBLIC. Basically a glorified namespace.
+struct VCL_DLLPUBLIC SkiaHelper
+{
+ SkiaHelper() = delete; // Should not be instantiated
+
+public:
+ static bool isVCLSkiaEnabled();
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk
index 38bce206f72f..d08bc424020a 100644
--- a/vcl/Library_vcl.mk
+++ b/vcl/Library_vcl.mk
@@ -106,6 +106,7 @@ $(eval $(call gb_Library_use_externals,vcl,\
icuuc \
lcms2 \
mdds_headers \
+ skia \
))
ifeq ($(DISABLE_GUI),)
@@ -581,6 +582,9 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\
vcl/opengl/LineRenderUtils \
vcl/source/opengl/OpenGLContext \
vcl/source/opengl/OpenGLHelper \
+ vcl/skia/SkiaHelper \
+ vcl/skia/salbmp \
+ vcl/skia/gdiimpl \
))
# runtime dependency
diff --git a/vcl/Library_vclplug_gen.mk b/vcl/Library_vclplug_gen.mk
index f729c3d20ad5..a4dd1ae75373 100644
--- a/vcl/Library_vclplug_gen.mk
+++ b/vcl/Library_vclplug_gen.mk
@@ -60,6 +60,7 @@ $(eval $(call gb_Library_use_externals,vclplug_gen,\
icuuc \
valgrind \
Xrender \
+ skia \
))
$(eval $(call gb_Library_add_libs,vclplug_gen,\
@@ -107,6 +108,9 @@ $(eval $(call gb_Library_add_exception_objects,vclplug_gen,\
vcl/opengl/x11/cairotextrender \
vcl/opengl/x11/gdiimpl \
vcl/opengl/x11/salvd \
+ vcl/skia/x11/cairotextrender \
+ vcl/skia/x11/gdiimpl \
+ vcl/skia/x11/salvd \
))
# ultimately we want to split the x11 dependencies out
diff --git a/vcl/inc/skia/gdiimpl.hxx b/vcl/inc/skia/gdiimpl.hxx
new file mode 100644
index 000000000000..d550159522b9
--- /dev/null
+++ b/vcl/inc/skia/gdiimpl.hxx
@@ -0,0 +1,185 @@
+/* -*- 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_SKIA_GDIIMPL_HXX
+#define INCLUDED_VCL_SKIA_GDIIMPL_HXX
+
+#include <vcl/dllapi.h>
+
+#include "salgdiimpl.hxx"
+#include "salgeom.hxx"
+
+class VCL_DLLPUBLIC SkiaSalGraphicsImpl : public SalGraphicsImpl
+{
+public:
+ SkiaSalGraphicsImpl(SalGraphics& pParent, SalGeometryProvider* pProvider);
+ virtual ~SkiaSalGraphicsImpl() override;
+
+ virtual void Init() override;
+
+ virtual void DeInit() override;
+
+ virtual void freeResources() override;
+
+ const vcl::Region& getClipRegion() const;
+ virtual bool setClipRegion(const vcl::Region&) override;
+
+ //
+ // get the depth of the device
+ virtual sal_uInt16 GetBitCount() const override;
+
+ // get the width of the device
+ virtual long GetGraphicsWidth() const override;
+
+ // set the clip region to empty
+ virtual void ResetClipRegion() override;
+
+ // set the line color to transparent (= don't draw lines)
+
+ virtual void SetLineColor() override;
+
+ // set the line color to a specific color
+ virtual void SetLineColor(Color nColor) override;
+
+ // set the fill color to transparent (= don't fill)
+ virtual void SetFillColor() override;
+
+ // set the fill color to a specific color, shapes will be
+ // filled accordingly
+ virtual void SetFillColor(Color nColor) override;
+
+ // enable/disable XOR drawing
+ virtual void SetXORMode(bool bSet, bool bInvertOnly) override;
+
+ // set line color for raster operations
+ virtual void SetROPLineColor(SalROPColor nROPColor) override;
+
+ // set fill color for raster operations
+ virtual void SetROPFillColor(SalROPColor nROPColor) override;
+
+ // draw --> LineColor and FillColor and RasterOp and ClipRegion
+ virtual void drawPixel(long nX, long nY) override;
+ virtual void drawPixel(long nX, long nY, Color nColor) override;
+
+ virtual void drawLine(long nX1, long nY1, long nX2, long nY2) override;
+
+ virtual void drawRect(long nX, long nY, long nWidth, long nHeight) override;
+
+ virtual void drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
+
+ virtual void drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry) override;
+
+ virtual void drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ PCONSTSALPOINT* pPtAry) override;
+
+ virtual bool drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
+ const basegfx::B2DPolyPolygon&, double fTransparency) override;
+
+ virtual bool drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
+ const basegfx::B2DPolygon&, double fTransparency,
+ const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin,
+ css::drawing::LineCap, double fMiterMinimumAngle,
+ bool bPixelSnapHairline) override;
+
+ virtual bool drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
+ const PolyFlags* pFlgAry) override;
+
+ virtual bool drawPolygonBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
+ const PolyFlags* pFlgAry) override;
+
+ virtual bool drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ const SalPoint* const* pPtAry,
+ const PolyFlags* const* pFlgAry) override;
+
+ // CopyArea --> No RasterOp, but ClipRegion
+ virtual void copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
+ long nSrcHeight, bool bWindowInvalidate) override;
+
+ virtual bool blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap) override;
+
+ virtual bool blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
+ const SalBitmap& rMaskBitmap,
+ const SalBitmap& rAlphaBitmap) override;
+
+ virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap) override;
+
+ virtual void drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ const SalBitmap& rMaskBitmap) override;
+
+ virtual void drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ Color nMaskColor) override;
+
+ virtual std::shared_ptr<SalBitmap> getBitmap(long nX, long nY, long nWidth,
+ long nHeight) override;
+
+ virtual Color getPixel(long nX, long nY) override;
+
+ // invert --> ClipRegion (only Windows or VirDevs)
+ virtual void invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override;
+
+ virtual void invert(sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags) override;
+
+ virtual bool drawEPS(long nX, long nY, long nWidth, long nHeight, void* pPtr,
+ sal_uInt32 nSize) override;
+
+ /** Render bitmap with alpha channel
+
+ @param rSourceBitmap
+ Source bitmap to blit
+
+ @param rAlphaBitmap
+ Alpha channel to use for blitting
+
+ @return true, if the operation succeeded, and false
+ otherwise. In this case, clients should try to emulate alpha
+ compositing themselves
+ */
+ virtual bool drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
+ const SalBitmap& rAlphaBitmap) override;
+
+ /** draw transformed bitmap (maybe with alpha) where Null, X, Y define the coordinate system */
+ virtual bool drawTransformedBitmap(const basegfx::B2DPoint& rNull, const basegfx::B2DPoint& rX,
+ const basegfx::B2DPoint& rY, const SalBitmap& rSourceBitmap,
+ const SalBitmap* pAlphaBitmap) override;
+
+ /** Render solid rectangle with given transparency
+
+ @param nX Top left coordinate of rectangle
+
+ @param nY Bottom right coordinate of rectangle
+
+ @param nWidth Width of rectangle
+
+ @param nHeight Height of rectangle
+
+ @param nTransparency Transparency value (0-255) to use. 0 blits and opaque, 255 a
+ fully transparent rectangle
+
+ @returns true if successfully drawn, false if not able to draw rectangle
+ */
+ virtual bool drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
+ sal_uInt8 nTransparency) override;
+
+ virtual bool drawGradient(const tools::PolyPolygon& rPolygon,
+ const Gradient& rGradient) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/salbmp.hxx b/vcl/inc/skia/salbmp.hxx
new file mode 100644
index 000000000000..04f159b34af2
--- /dev/null
+++ b/vcl/inc/skia/salbmp.hxx
@@ -0,0 +1,66 @@
+/* -*- 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_SKIA_SALBMP_H
+#define INCLUDED_VCL_INC_SKIA_SALBMP_H
+
+#include <salbmp.hxx>
+
+#include <SkBitmap.h>
+
+class VCL_PLUGIN_PUBLIC SkiaSalBitmap : public SalBitmap
+{
+public:
+ SkiaSalBitmap();
+ virtual ~SkiaSalBitmap() override;
+
+public:
+ // SalBitmap methods
+ virtual bool Create(const Size& rSize, sal_uInt16 nBitCount,
+ const BitmapPalette& rPal) override;
+ virtual bool Create(const SalBitmap& rSalBmp) override;
+ virtual bool Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics) override;
+ virtual bool Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount) override;
+ virtual bool Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
+ Size& rSize, bool bMask = false) override;
+
+ virtual void Destroy() final override;
+
+ virtual Size GetSize() const override;
+ virtual sal_uInt16 GetBitCount() const override;
+
+ virtual BitmapBuffer* AcquireBuffer(BitmapAccessMode nMode) override;
+ virtual void ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode) override;
+
+ virtual bool GetSystemData(BitmapSystemData& rData) override;
+
+ virtual bool ScalingSupported() const override;
+ virtual bool Scale(const double& rScaleX, const double& rScaleY,
+ BmpScaleFlag nScaleFlag) override;
+ virtual bool Replace(const Color& rSearchColor, const Color& rReplaceColor,
+ sal_uInt8 nTol) override;
+ virtual bool ConvertToGreyscale() override;
+
+private:
+ SkBitmap mBitmap;
+};
+
+#endif // INCLUDED_VCL_INC_OPENGL_SALBMP_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/x11/cairotextrender.hxx b/vcl/inc/skia/x11/cairotextrender.hxx
new file mode 100644
index 000000000000..766f94d484a1
--- /dev/null
+++ b/vcl/inc/skia/x11/cairotextrender.hxx
@@ -0,0 +1,27 @@
+/* -*- 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_SKIA_X11_CAIROTEXTRENDER_HXX
+#define INCLUDED_VCL_SKIA_X11_CAIROTEXTRENDER_HXX
+
+#include <unx/x11/x11cairotextrender.hxx>
+
+class SkiaX11CairoTextRender : public X11CairoTextRender
+{
+public:
+ explicit SkiaX11CairoTextRender(X11SalGraphics& rParent);
+
+ virtual cairo_t* getCairoContext() override;
+ virtual void getSurfaceOffset(double& nDX, double& nDY) override;
+ virtual void releaseCairoContext(cairo_t* cr) override;
+};
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/x11/gdiimpl.hxx b/vcl/inc/skia/x11/gdiimpl.hxx
new file mode 100644
index 000000000000..d7cbdfecfef0
--- /dev/null
+++ b/vcl/inc/skia/x11/gdiimpl.hxx
@@ -0,0 +1,36 @@
+/* -*- 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_SKIA_X11_GDIIMPL_HXX
+#define INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
+
+#include <vcl/dllapi.h>
+
+#include <unx/salgdi.h>
+#include <unx/x11/x11gdiimpl.h>
+#include <skia/gdiimpl.hxx>
+
+class VCL_PLUGIN_PUBLIC X11SkiaSalGraphicsImpl : public SkiaSalGraphicsImpl, public X11GraphicsImpl
+{
+private:
+ // X11SalGraphics& mrX11Parent; TODO SKIA
+
+public:
+ X11SkiaSalGraphicsImpl(X11SalGraphics& rParent);
+ virtual ~X11SkiaSalGraphicsImpl() override;
+
+public:
+ virtual void copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics) override;
+
+ virtual void Init() override;
+};
+
+#endif // INCLUDED_VCL_INC_SKIA_X11_GDIIMPL_HXX
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/skia/x11/salvd.hxx b/vcl/inc/skia/x11/salvd.hxx
new file mode 100644
index 000000000000..8ff75175dc70
--- /dev/null
+++ b/vcl/inc/skia/x11/salvd.hxx
@@ -0,0 +1,46 @@
+/* -*- 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_SKIA_X11_SALVD_H
+#define INCLUDED_VCL_INC_SKIA_X11_SALVD_H
+
+#include <salvd.hxx>
+
+class X11SkiaSalVirtualDevice : public SalVirtualDevice
+{
+ SalDisplay* mpDisplay;
+ std::unique_ptr<X11SalGraphics> mpGraphics;
+ bool mbGraphics; // is Graphics used
+ SalX11Screen mnXScreen;
+ int mnWidth;
+ int mnHeight;
+
+public:
+ X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, long nDX, long nDY,
+ const SystemGraphicsData* pData,
+ std::unique_ptr<X11SalGraphics> pNewGraphics);
+ virtual ~X11SkiaSalVirtualDevice() override;
+
+ // SalGeometryProvider
+ virtual long GetWidth() const override { return mnWidth; }
+ virtual long GetHeight() const override { return mnHeight; }
+
+ SalDisplay* GetDisplay() const { return mpDisplay; }
+ const SalX11Screen& GetXScreenNumber() const { return mnXScreen; }
+
+ virtual SalGraphics* AcquireGraphics() override;
+ virtual void ReleaseGraphics(SalGraphics* pGraphics) override;
+
+ // Set new size, without saving the old contents
+ virtual bool SetSize(long nNewDX, long nNewDY) override;
+};
+
+#endif // INCLUDED_VCL_INC_SKIA_X11_SALVD_H
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h
index 11996ef88210..b6a477d20713 100644
--- a/vcl/inc/unx/salgdi.h
+++ b/vcl/inc/unx/salgdi.h
@@ -34,6 +34,9 @@
#include <vclpluginapi.h>
#include <ControlCacheKey.hxx>
+#include "saltype.h"
+#include "saldisp.hxx"
+
#include <memory>
/* From <X11/Intrinsic.h> */
@@ -50,6 +53,7 @@ class X11SalVirtualDevice;
class X11SalGraphicsImpl;
class X11OpenGLSalGraphicsImpl;
class X11OpenGLSalVirtualDevice;
+class X11SkiaSalVirtualDevice;
class FreetypeFont;
class ImplLayoutArgs;
class PhysicalFontCollection;
@@ -74,6 +78,7 @@ public:
void Init( SalFrame *pFrame, Drawable aDrawable, SalX11Screen nXScreen );
void Init( X11SalVirtualDevice *pVirtualDevice, SalColormap* pColormap = nullptr, bool bDeleteColormap = false );
void Init( X11OpenGLSalVirtualDevice *pVirtualDevice );
+ void Init( X11SkiaSalVirtualDevice *pVirtualDevice );
void DeInit();
virtual SalGraphicsImpl* GetImpl() const override;
@@ -310,6 +315,7 @@ protected:
bool bWindow_ : 1; // is Window
bool bVirDev_ : 1; // is VirDev
bool const m_bOpenGL : 1;
+ bool const m_bSkia : 1;
private:
std::unique_ptr<SalGraphicsImpl> mxImpl;
diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx
new file mode 100644
index 000000000000..1d2cf20d9c0b
--- /dev/null
+++ b/vcl/skia/SkiaHelper.cxx
@@ -0,0 +1,72 @@
+/* -*- 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/.
+ */
+
+#include <vcl/skia/SkiaHelper.hxx>
+
+#include <vcl/svapp.hxx>
+
+bool SkiaHelper::isVCLSkiaEnabled()
+{
+ /**
+ * The !bSet part should only be called once! Changing the results in the same
+ * run will mix Skia and normal rendering.
+ */
+
+ static bool bSet = false;
+ static bool bEnable = false;
+ static bool bForceSkia = false;
+
+ // No hardware rendering, so no Skia
+ // TODO SKIA
+ if (Application::IsBitmapRendering())
+ return false;
+
+ if (bSet)
+ {
+ return bForceSkia || bEnable;
+ }
+
+ /*
+ * There are a number of cases that these environment variables cover:
+ * * SAL_FORCESKIA forces Skia independent of any other option
+ * * SAL_DISABLESKIA avoids the use of Skia if SAL_FORCESKIA is not set
+ */
+
+ bSet = true;
+ bForceSkia = !!getenv(
+ "SAL_FORCESKIA"); // TODO SKIA || officecfg::Office::Common::VCL::ForceOpenGL::get();
+
+ bool bRet = false;
+ bool bSupportsVCLSkia = true; // TODO SKIA supportsVCLOpenGL();
+ // TODO SKIA always call supportsVCLOpenGL to de-zombie the glxtest child process on X11
+ if (bForceSkia)
+ {
+ bRet = true;
+ }
+ else if (bSupportsVCLSkia)
+ {
+ static bool bEnableSkiaEnv = !!getenv("SAL_ENABLESKIA");
+
+ bEnable = bEnableSkiaEnv;
+
+ // TODO SKIA if (officecfg::Office::Common::VCL::UseOpenGL::get())
+
+ // Force disable in safe mode
+ if (Application::IsSafeModeEnabled())
+ bEnable = false;
+
+ bRet = bEnable;
+ }
+
+ // TODO SKIA CrashReporter::AddKeyValue("UseOpenGL", OUString::boolean(bRet));
+
+ return bRet;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx
new file mode 100644
index 000000000000..5a5d479a4097
--- /dev/null
+++ b/vcl/skia/gdiimpl.cxx
@@ -0,0 +1,304 @@
+/* -*- 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 .
+ */
+
+#include <skia/gdiimpl.hxx>
+
+SkiaSalGraphicsImpl::SkiaSalGraphicsImpl(SalGraphics& rParent, SalGeometryProvider* pProvider)
+{
+ (void)rParent;
+ (void)pProvider;
+}
+
+SkiaSalGraphicsImpl::~SkiaSalGraphicsImpl() {}
+
+void SkiaSalGraphicsImpl::Init() {}
+
+void SkiaSalGraphicsImpl::DeInit() {}
+
+void SkiaSalGraphicsImpl::freeResources() {}
+
+const vcl::Region& SkiaSalGraphicsImpl::getClipRegion() const
+{
+ static const vcl::Region reg;
+ return reg;
+}
+
+bool SkiaSalGraphicsImpl::setClipRegion(const vcl::Region&) { return false; }
+
+sal_uInt16 SkiaSalGraphicsImpl::GetBitCount() const { return 0; }
+
+long SkiaSalGraphicsImpl::GetGraphicsWidth() const { return 0; }
+
+void SkiaSalGraphicsImpl::ResetClipRegion() {}
+
+void SkiaSalGraphicsImpl::SetLineColor() {}
+
+void SkiaSalGraphicsImpl::SetLineColor(Color nColor) { (void)nColor; }
+
+void SkiaSalGraphicsImpl::SetFillColor() {}
+
+void SkiaSalGraphicsImpl::SetFillColor(Color nColor) { (void)nColor; }
+
+void SkiaSalGraphicsImpl::SetXORMode(bool bSet, bool bInvertOnly)
+{
+ (void)bSet;
+ (void)bInvertOnly;
+}
+
+void SkiaSalGraphicsImpl::SetROPLineColor(SalROPColor nROPColor) { (void)nROPColor; }
+
+void SkiaSalGraphicsImpl::SetROPFillColor(SalROPColor nROPColor) { (void)nROPColor; }
+
+void SkiaSalGraphicsImpl::drawPixel(long nX, long nY)
+{
+ (void)nX;
+ (void)nY;
+}
+
+void SkiaSalGraphicsImpl::drawPixel(long nX, long nY, Color nColor)
+{
+ (void)nX;
+ (void)nY;
+ (void)nColor;
+}
+
+void SkiaSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2)
+{
+ (void)nX1;
+ (void)nY1;
+ (void)nX2;
+ (void)nY2;
+}
+
+void SkiaSalGraphicsImpl::drawRect(long nX, long nY, long nWidth, long nHeight)
+{
+ (void)nX;
+ (void)nY;
+ (void)nWidth;
+ (void)nHeight;
+}
+
+void SkiaSalGraphicsImpl::drawPolyLine(sal_uInt32 nPoints, const SalPoint* pPtAry)
+{
+ (void)nPoints;
+ (void)pPtAry;
+}
+
+void SkiaSalGraphicsImpl::drawPolygon(sal_uInt32 nPoints, const SalPoint* pPtAry)
+{
+ (void)nPoints;
+ (void)pPtAry;
+}
+
+void SkiaSalGraphicsImpl::drawPolyPolygon(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ PCONSTSALPOINT* pPtAry)
+{
+ (void)nPoly;
+ (void)pPoints;
+ (void)pPtAry;
+}
+
+bool SkiaSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DHomMatrix& rObjectToDevice,
+ const basegfx::B2DPolyPolygon&, double fTransparency)
+{
+ (void)rObjectToDevice;
+ (void)fTransparency;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
+ const basegfx::B2DPolygon&, double fTransparency,
+ const basegfx::B2DVector& rLineWidths, basegfx::B2DLineJoin,
+ css::drawing::LineCap, double fMiterMinimumAngle,
+ bool bPixelSnapHairline)
+{
+ (void)rObjectToDevice;
+ (void)fTransparency;
+ (void)rLineWidths;
+ (void)fMiterMinimumAngle;
+ (void)bPixelSnapHairline;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawPolyLineBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
+ const PolyFlags* pFlgAry)
+{
+ (void)nPoints;
+ (void)pPtAry;
+ (void)pFlgAry;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawPolygonBezier(sal_uInt32 nPoints, const SalPoint* pPtAry,
+ const PolyFlags* pFlgAry)
+{
+ (void)nPoints;
+ (void)pPtAry;
+ (void)pFlgAry;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawPolyPolygonBezier(sal_uInt32 nPoly, const sal_uInt32* pPoints,
+ const SalPoint* const* pPtAry,
+ const PolyFlags* const* pFlgAry)
+{
+ (void)nPoly;
+ (void)pPoints;
+ (void)pPtAry;
+ (void)pFlgAry;
+ return false;
+}
+
+void SkiaSalGraphicsImpl::copyArea(long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth,
+ long nSrcHeight, bool bWindowInvalidate)
+{
+ (void)nDestX;
+ (void)nDestY;
+ (void)nSrcX;
+ (void)nSrcY;
+ (void)nSrcWidth;
+ (void)nSrcHeight;
+ (void)bWindowInvalidate;
+}
+
+bool SkiaSalGraphicsImpl::blendBitmap(const SalTwoRect&, const SalBitmap& rBitmap)
+{
+ (void)rBitmap;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::blendAlphaBitmap(const SalTwoRect&, const SalBitmap& rSrcBitmap,
+ const SalBitmap& rMaskBitmap,
+ const SalBitmap& rAlphaBitmap)
+{
+ (void)rSrcBitmap;
+ (void)rMaskBitmap;
+ (void)rAlphaBitmap;
+ return false;
+}
+
+void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap)
+{
+ (void)rPosAry;
+ (void)rSalBitmap;
+}
+
+void SkiaSalGraphicsImpl::drawBitmap(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ const SalBitmap& rMaskBitmap)
+{
+ (void)rPosAry;
+ (void)rSalBitmap;
+ (void)rMaskBitmap;
+}
+
+void SkiaSalGraphicsImpl::drawMask(const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap,
+ Color nMaskColor)
+{
+ (void)rPosAry;
+ (void)rSalBitmap;
+ (void)nMaskColor;
+}
+
+std::shared_ptr<SalBitmap> SkiaSalGraphicsImpl::getBitmap(long nX, long nY, long nWidth,
+ long nHeight)
+{
+ (void)nX;
+ (void)nY;
+ (void)nWidth;
+ (void)nHeight;
+ return nullptr;
+}
+
+Color SkiaSalGraphicsImpl::getPixel(long nX, long nY)
+{
+ (void)nX;
+ (void)nY;
+ return COL_BLACK;
+}
+
+void SkiaSalGraphicsImpl::invert(long nX, long nY, long nWidth, long nHeight, SalInvert nFlags)
+{
+ (void)nX;
+ (void)nY;
+ (void)nWidth;
+ (void)nHeight;
+ (void)nFlags;
+}
+
+void SkiaSalGraphicsImpl::invert(sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags)
+{
+ (void)nPoints;
+ (void)pPtAry;
+ (void)nFlags;
+}
+
+bool SkiaSalGraphicsImpl::drawEPS(long nX, long nY, long nWidth, long nHeight, void* pPtr,
+ sal_uInt32 nSize)
+{
+ (void)nX;
+ (void)nY;
+ (void)nWidth;
+ (void)nHeight;
+ (void)pPtr;
+ (void)nSize;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawAlphaBitmap(const SalTwoRect&, const SalBitmap& rSourceBitmap,
+ const SalBitmap& rAlphaBitmap)
+{
+ (void)rSourceBitmap;
+ (void)rAlphaBitmap;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawTransformedBitmap(const basegfx::B2DPoint& rNull,
+ const basegfx::B2DPoint& rX,
+ const basegfx::B2DPoint& rY,
+ const SalBitmap& rSourceBitmap,
+ const SalBitmap* pAlphaBitmap)
+{
+ (void)rNull;
+ (void)rX;
+ (void)rY;
+ (void)rSourceBitmap;
+ (void)pAlphaBitmap;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawAlphaRect(long nX, long nY, long nWidth, long nHeight,
+ sal_uInt8 nTransparency)
+{
+ (void)nX;
+ (void)nY;
+ (void)nWidth;
+ (void)nHeight;
+ (void)nTransparency;
+ return false;
+}
+
+bool SkiaSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolygon,
+ const Gradient& rGradient)
+{
+ (void)rPolygon;
+ (void)rGradient;
+ return false;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/salbmp.cxx b/vcl/skia/salbmp.cxx
new file mode 100644
index 000000000000..e2e60cf0743b
--- /dev/null
+++ b/vcl/skia/salbmp.cxx
@@ -0,0 +1,107 @@
+/* -*- 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 .
+ */
+
+#include <skia/salbmp.hxx>
+
+SkiaSalBitmap::SkiaSalBitmap() {}
+
+SkiaSalBitmap::~SkiaSalBitmap() {}
+
+bool SkiaSalBitmap::Create(const Size& rSize, sal_uInt16 nBitCount, const BitmapPalette& rPal)
+{
+ (void)rSize;
+ (void)nBitCount;
+ (void)rPal;
+ return false;
+}
+
+bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp)
+{
+ (void)rSalBmp;
+ return false;
+}
+
+bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, SalGraphics* pGraphics)
+{
+ (void)rSalBmp;
+ (void)pGraphics;
+ return false;
+}
+
+bool SkiaSalBitmap::Create(const SalBitmap& rSalBmp, sal_uInt16 nNewBitCount)
+{
+ (void)rSalBmp;
+ (void)nNewBitCount;
+ return false;
+}
+
+bool SkiaSalBitmap::Create(const css::uno::Reference<css::rendering::XBitmapCanvas>& rBitmapCanvas,
+ Size& rSize, bool bMask)
+{
+ (void)rBitmapCanvas;
+ (void)rSize;
+ (void)bMask;
+ return false;
+}
+
+void SkiaSalBitmap::Destroy() {}
+
+Size SkiaSalBitmap::GetSize() const { return Size(); }
+
+sal_uInt16 SkiaSalBitmap::GetBitCount() const { return 0; }
+
+BitmapBuffer* SkiaSalBitmap::AcquireBuffer(BitmapAccessMode nMode)
+{
+ (void)nMode;
+ return nullptr;
+}
+
+void SkiaSalBitmap::ReleaseBuffer(BitmapBuffer* pBuffer, BitmapAccessMode nMode)
+{
+ (void)pBuffer;
+ (void)nMode;
+}
+
+bool SkiaSalBitmap::GetSystemData(BitmapSystemData& rData)
+{
+ (void)rData;
+ return false;
+}
+
+bool SkiaSalBitmap::ScalingSupported() const { return false; }
+
+bool SkiaSalBitmap::Scale(const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag)
+{
+ (void)rScaleX;
+ (void)rScaleY;
+ (void)nScaleFlag;
+ return false;
+}
+
+bool SkiaSalBitmap::Replace(const Color& rSearchColor, const Color& rReplaceColor, sal_uInt8 nTol)
+{
+ (void)rSearchColor;
+ (void)rReplaceColor;
+ (void)nTol;
+ return false;
+}
+
+bool SkiaSalBitmap::ConvertToGreyscale() { return false; }
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/x11/cairotextrender.cxx b/vcl/skia/x11/cairotextrender.cxx
new file mode 100644
index 000000000000..8c25d6c5ce3a
--- /dev/null
+++ b/vcl/skia/x11/cairotextrender.cxx
@@ -0,0 +1,87 @@
+/* -*- 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/.
+ */
+
+#include <skia/x11/cairotextrender.hxx>
+
+#include <salbmp.hxx>
+#include <skia/gdiimpl.hxx>
+
+#include <cairo.h>
+
+SkiaX11CairoTextRender::SkiaX11CairoTextRender(X11SalGraphics& rParent)
+ : X11CairoTextRender(rParent)
+{
+}
+
+cairo_t* SkiaX11CairoTextRender::getCairoContext()
+{
+ cairo_surface_t* surface = nullptr;
+ SkiaSalGraphicsImpl* pImpl = dynamic_cast<SkiaSalGraphicsImpl*>(mrParent.GetImpl());
+ if (pImpl)
+ {
+ tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect();
+ if (aClipRect.GetWidth() == 0 || aClipRect.GetHeight() == 0)
+ {
+ aClipRect.setWidth(GetWidth());
+ aClipRect.setHeight(GetHeight());
+ }
+ surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, aClipRect.GetWidth(),
+ aClipRect.GetHeight());
+ }
+ if (!surface)
+ return nullptr;
+ cairo_t* cr = cairo_create(surface);
+ // TODO SKIA
+ cairo_surface_destroy(surface);
+ return cr;
+}
+
+void SkiaX11CairoTextRender::getSurfaceOffset(double& nDX, double& nDY)
+{
+ SkiaSalGraphicsImpl* pImpl = dynamic_cast<SkiaSalGraphicsImpl*>(mrParent.GetImpl());
+ if (pImpl)
+ {
+ tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect();
+ nDX = -aClipRect.Left();
+ nDY = -aClipRect.Top();
+ }
+}
+
+void SkiaX11CairoTextRender::releaseCairoContext(cairo_t* cr)
+{
+ SkiaSalGraphicsImpl* pImpl = dynamic_cast<SkiaSalGraphicsImpl*>(mrParent.GetImpl());
+ if (!pImpl)
+ {
+ cairo_destroy(cr);
+ return;
+ }
+
+ cairo_surface_t* pSurface = cairo_get_target(cr);
+ int nWidth = cairo_image_surface_get_width(pSurface);
+ int nHeight = cairo_image_surface_get_height(pSurface);
+ cairo_surface_flush(pSurface);
+ unsigned char* pSrc = cairo_image_surface_get_data(pSurface);
+
+ tools::Rectangle aClipRect = pImpl->getClipRegion().GetBoundRect();
+
+ SalTwoRect aRect(0, 0, nWidth, nHeight, aClipRect.Left(), aClipRect.Top(), nWidth, nHeight);
+
+ // Cairo surface data is ARGB with premultiplied alpha and is Y-inverted
+ // TODO SKIA
+ // SkiaTexture aTexture( nWidth, nHeight, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, pSrc );
+ // pImpl->PreDraw();
+ // pImpl->DrawAlphaTexture( aTexture, aRect, true, true );
+ // pImpl->PostDraw();
+ // abort();
+ (void)pSrc;
+
+ cairo_destroy(cr);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/x11/gdiimpl.cxx b/vcl/skia/x11/gdiimpl.cxx
new file mode 100644
index 000000000000..491786d98729
--- /dev/null
+++ b/vcl/skia/x11/gdiimpl.cxx
@@ -0,0 +1,28 @@
+/* -*- 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/.
+ */
+
+#include <skia/x11/gdiimpl.hxx>
+
+X11SkiaSalGraphicsImpl::X11SkiaSalGraphicsImpl(X11SalGraphics& rParent)
+ : SkiaSalGraphicsImpl(rParent, rParent.GetGeometryProvider())
+// , mrX11Parent(rParent) TODO SKIA
+{
+}
+
+X11SkiaSalGraphicsImpl::~X11SkiaSalGraphicsImpl() {}
+
+void X11SkiaSalGraphicsImpl::Init() {}
+
+void X11SkiaSalGraphicsImpl::copyBits(const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics)
+{
+ (void)rPosAry;
+ (void)pSrcGraphics;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/skia/x11/salvd.cxx b/vcl/skia/x11/salvd.cxx
new file mode 100644
index 000000000000..a4db9c75dfe3
--- /dev/null
+++ b/vcl/skia/x11/salvd.cxx
@@ -0,0 +1,86 @@
+/* -*- 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/.
+ */
+
+#include <vcl/sysdata.hxx>
+
+#include <unx/salunx.h>
+#include <unx/saldisp.hxx>
+#include <unx/salgdi.h>
+#include <unx/salvd.h>
+
+#include <skia/x11/salvd.hxx>
+
+void X11SalGraphics::Init(X11SkiaSalVirtualDevice* pDevice)
+{
+ SalDisplay* pDisplay = pDevice->GetDisplay();
+
+ m_nXScreen = pDevice->GetXScreenNumber();
+ m_pColormap = &pDisplay->GetColormap(m_nXScreen);
+
+ m_pVDev = pDevice;
+ m_pFrame = nullptr;
+
+ bWindow_ = pDisplay->IsDisplay();
+ bVirDev_ = true;
+
+ mxImpl->Init();
+}
+
+X11SkiaSalVirtualDevice::X11SkiaSalVirtualDevice(SalGraphics const* pGraphics, long nDX, long nDY,
+ const SystemGraphicsData* pData,
+ std::unique_ptr<X11SalGraphics> pNewGraphics)
+ : mpGraphics(std::move(pNewGraphics))
+ , mbGraphics(false)
+ , mnXScreen(0)
+{
+ assert(mpGraphics);
+
+ // TODO Check where a VirtualDevice is created from SystemGraphicsData
+ assert(pData == nullptr);
+ (void)pData;
+
+ mpDisplay = vcl_sal::getSalDisplay(GetGenericUnixSalData());
+ mnXScreen = pGraphics ? static_cast<X11SalGraphics const*>(pGraphics)->GetScreenNumber()
+ : vcl_sal::getSalDisplay(GetGenericUnixSalData())->GetDefaultXScreen();
+ mnWidth = nDX;
+ mnHeight = nDY;
+ mpGraphics->Init(this);
+}
+
+X11SkiaSalVirtualDevice::~X11SkiaSalVirtualDevice() {}
+
+SalGraphics* X11SkiaSalVirtualDevice::AcquireGraphics()
+{
+ if (mbGraphics)
+ return nullptr;
+
+ if (mpGraphics)
+ mbGraphics = true;
+
+ return mpGraphics.get();
+}
+
+void X11SkiaSalVirtualDevice::ReleaseGraphics(SalGraphics*) { mbGraphics = false; }
+
+bool X11SkiaSalVirtualDevice::SetSize(long nDX, long nDY)
+{
+ if (!nDX)
+ nDX = 1;
+ if (!nDY)
+ nDY = 1;
+
+ mnWidth = nDX;
+ mnHeight = nDY;
+ if (mpGraphics)
+ mpGraphics->Init(this);
+
+ return true;
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx
index c4c3be9699e3..3dcfc82ec00a 100644
--- a/vcl/source/app/svapp.cxx
+++ b/vcl/source/app/svapp.cxx
@@ -1147,6 +1147,7 @@ OUString Application::GetHWOSConfInfo()
aDetails.append( "; " );
aDetails.append( VclResId(SV_APP_UIRENDER) );
+// TODO SKIA
#if HAVE_FEATURE_OPENGL
if ( OpenGLWrapper::isVCLOpenGLEnabled() )
aDetails.append( VclResId(SV_APP_GL) );
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index e35636044f3f..3cf09f40e529 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -834,6 +834,7 @@ bool Bitmap::Scale( const Size& rNewSize, BmpScaleFlag nScaleFlag )
bool Bitmap::HasFastScale()
{
+// TODO SKIA
#if HAVE_FEATURE_OPENGL
return OpenGLHelper::isVCLOpenGLEnabled();
#else
diff --git a/vcl/source/outdev/bitmap.cxx b/vcl/source/outdev/bitmap.cxx
index 5db64d06dc40..de677fcdce66 100644
--- a/vcl/source/outdev/bitmap.cxx
+++ b/vcl/source/outdev/bitmap.cxx
@@ -29,6 +29,7 @@
#if HAVE_FEATURE_OPENGL
#include <vcl/opengl/OpenGLHelper.hxx>
#endif
+#include <vcl/skia/SkiaHelper.hxx>
#include <vcl/outdev.hxx>
#include <vcl/virdev.hxx>
#include <vcl/image.hxx>
@@ -689,6 +690,7 @@ void OutputDevice::DrawDeviceAlphaBitmap( const Bitmap& rBmp, const AlphaMask& r
#if HAVE_FEATURE_OPENGL
assert(!OpenGLHelper::isVCLOpenGLEnabled());
#endif
+ assert(!SkiaHelper::isVCLSkiaEnabled());
tools::Rectangle aBmpRect(Point(), rBmp.GetSizePixel());
if (!aBmpRect.Intersection(tools::Rectangle(rSrcPtPixel, rSrcSizePixel)).IsEmpty())
{
diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx
index 8756fc2299e3..4ffea9b58364 100644
--- a/vcl/unx/generic/app/saldisp.cxx
+++ b/vcl/unx/generic/app/saldisp.cxx
@@ -211,6 +211,7 @@ bool SalDisplay::BestVisual( Display *pDisplay,
if( nVID && sal_GetVisualInfo( pDisplay, nVID, rVI ) )
return rVI.visualid == nDefVID;
+// TODO SKIA
bool bUseOpenGL = OpenGLHelper::isVCLOpenGLEnabled();
if (bUseOpenGL && BestOpenGLVisual(pDisplay, nScreen, rVI))
return rVI.visualid == nDefVID;
diff --git a/vcl/unx/generic/gdi/salbmp.cxx b/vcl/unx/generic/gdi/salbmp.cxx
index a81eb608ec21..9891447935e7 100644
--- a/vcl/unx/generic/gdi/salbmp.cxx
+++ b/vcl/unx/generic/gdi/salbmp.cxx
@@ -42,6 +42,8 @@
#include <o3tl/safeint.hxx>
#include <opengl/salbmp.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <skia/salbmp.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
#if defined HAVE_VALGRIND_HEADERS
#include <valgrind/valgrind.h>
@@ -52,7 +54,9 @@
std::shared_ptr<SalBitmap> X11SalInstance::CreateSalBitmap()
{
- if (OpenGLHelper::isVCLOpenGLEnabled())
+ if (SkiaHelper::isVCLSkiaEnabled())
+ return std::make_shared<SkiaSalBitmap>();
+ else if (OpenGLHelper::isVCLOpenGLEnabled())
return std::make_shared<OpenGLSalBitmap>();
else
return std::make_shared<X11SalBitmap>();
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index 5c1999661783..4f7be8f147b6 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -45,14 +45,17 @@
#include <salvd.hxx>
#include "gdiimpl.hxx"
#include <opengl/x11/gdiimpl.hxx>
+#include <skia/x11/gdiimpl.hxx>
#include <unx/x11/x11cairotextrender.hxx>
#include <opengl/x11/cairotextrender.hxx>
+#include <skia/x11/cairotextrender.hxx>
#include <unx/x11/xrender_peer.hxx>
#include "cairo_xlib_cairo.hxx"
#include <cairo-xlib.h>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
X11SalGraphics::X11SalGraphics():
m_pFrame(nullptr),
@@ -72,9 +75,15 @@ X11SalGraphics::X11SalGraphics():
hBrush_(None),
bWindow_(false),
bVirDev_(false),
- m_bOpenGL(OpenGLHelper::isVCLOpenGLEnabled())
+ m_bOpenGL(OpenGLHelper::isVCLOpenGLEnabled()),
+ m_bSkia(SkiaHelper::isVCLSkiaEnabled())
{
- if (m_bOpenGL)
+ if (m_bSkia)
+ {
+ mxImpl.reset(new X11SkiaSalGraphicsImpl(*this));
+ mxTextRenderImpl.reset(new SkiaX11CairoTextRender(*this));
+ }
+ else if (m_bOpenGL)
{
mxImpl.reset(new X11OpenGLSalGraphicsImpl(*this));
mxTextRenderImpl.reset(new OpenGLX11CairoTextRender(*this));
@@ -582,7 +591,7 @@ bool X11SalGraphics::drawPolyPolygon(
// enable by setting to something
static const char* pUseCairoForPolygons(getenv("SAL_ENABLE_USE_CAIRO_FOR_POLYGONS"));
- if (!m_bOpenGL && nullptr != pUseCairoForPolygons && SupportsCairo())
+ if (!m_bOpenGL && !m_bSkia && nullptr != pUseCairoForPolygons && SupportsCairo())
{
// snap to raster if requested
const bool bSnapPoints(!getAntiAliasB2DDraw());
@@ -702,7 +711,7 @@ bool X11SalGraphics::drawPolyLine(
// disable by setting to something
static const char* pUseCairoForFatLines(getenv("SAL_DISABLE_USE_CAIRO_FOR_FATLINES"));
- if (!m_bOpenGL && nullptr == pUseCairoForFatLines && SupportsCairo())
+ if (!m_bOpenGL && !m_bSkia && nullptr == pUseCairoForFatLines && SupportsCairo())
{
cairo_t* cr = getCairoContext();
clipRegion(cr);
diff --git a/vcl/unx/generic/gdi/salvd.cxx b/vcl/unx/generic/gdi/salvd.cxx
index 156e2e342483..780fdde4453a 100644
--- a/vcl/unx/generic/gdi/salvd.cxx
+++ b/vcl/unx/generic/gdi/salvd.cxx
@@ -29,14 +29,18 @@
#include <unx/x11/xlimits.hxx>
#include <vcl/opengl/OpenGLHelper.hxx>
+#include <vcl/skia/SkiaHelper.hxx>
#include <opengl/x11/salvd.hxx>
+#include <skia/x11/salvd.hxx>
std::unique_ptr<SalVirtualDevice> X11SalInstance::CreateX11VirtualDevice(SalGraphics const * pGraphics,
long &nDX, long &nDY, DeviceFormat eFormat, const SystemGraphicsData *pData,
std::unique_ptr<X11SalGraphics> pNewGraphics)
{
assert(pNewGraphics);
- if (OpenGLHelper::isVCLOpenGLEnabled())
+ if (SkiaHelper::isVCLSkiaEnabled())
+ return std::unique_ptr<SalVirtualDevice>(new X11SkiaSalVirtualDevice( pGraphics, nDX, nDY, pData, std::move(pNewGraphics) ));
+ else if (OpenGLHelper::isVCLOpenGLEnabled())
return std::unique_ptr<SalVirtualDevice>(new X11OpenGLSalVirtualDevice( pGraphics, nDX, nDY, pData, std::move(pNewGraphics) ));
else
return std::unique_ptr<SalVirtualDevice>(new X11SalVirtualDevice(pGraphics, nDX, nDY, eFormat, pData, std::move(pNewGraphics)));