configure.ac | 2 +- cui/source/options/optgdlg.cxx | 8 ++++++++ vcl/osx/salframeview.mm | 10 ++++------ vcl/osx/salgdiutils.cxx | 7 +------ vcl/osx/salnativewidgets.cxx | 5 ++--- vcl/quartz/salgdi.cxx | 19 +++++++++---------- vcl/skia/SkiaHelper.cxx | 15 ++++++++++++++- 7 files changed, 39 insertions(+), 27 deletions(-)
New commits: commit 9f9550a67dd2b8269fdbecc44f890fc99d00c2e2 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Jun 5 17:10:12 2025 +0200 Commit: Noel Grandin <noelgran...@gmail.com> CommitDate: Fri Jun 13 08:29:20 2025 +0200 make skia mandatory on macOS, disable aqua backend This is necessary, since the Aqua backend does not work with my upcoming "merged color and alpha" patch Change-Id: I944cca74cf668bd40c70f3e6b3d36eefd943272d Reviewed-on: https://gerrit.libreoffice.org/c/core/+/186250 Reviewed-by: Patrick Luby <guibomac...@gmail.com> Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> Tested-by: Jenkins diff --git a/configure.ac b/configure.ac index 2ba5f74527aa..65d31a0bac67 100644 --- a/configure.ac +++ b/configure.ac @@ -3424,7 +3424,7 @@ if test "$enable_dynamic_loading" = yes; then BUILD_TYPE="$BUILD_TYPE DYNLOADING" else DISABLE_DYNLOADING='TRUE' - if test $_os != iOS -a $_os != Android; then + if test $_os != iOS -a $_os != Darwin -a $_os != Android; then enable_database_connectivity=no enable_nss=no enable_odk=no diff --git a/cui/source/options/optgdlg.cxx b/cui/source/options/optgdlg.cxx index 92afa68ccfa4..01eac2d2cd46 100644 --- a/cui/source/options/optgdlg.cxx +++ b/cui/source/options/optgdlg.cxx @@ -629,7 +629,11 @@ void OfaViewTabPage::UpdateSkiaStatus() m_xSkiaStatusEnabled->set_visible(bEnabled); m_xSkiaStatusDisabled->set_visible(!bEnabled); +#ifdef MACOSX + m_xUseSkia->set_sensitive(false); // macOS can __only__ render via skia +#else m_xUseSkia->set_sensitive(!officecfg::Office::Common::VCL::UseSkia::isReadOnly()); +#endif m_xUseSkiaImg->set_visible(officecfg::Office::Common::VCL::UseSkia::isReadOnly()); m_xForceSkiaRaster->set_sensitive(m_xUseSkia->get_active() && !officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly()); m_xForceSkiaRasterImg->set_visible(officecfg::Office::Common::VCL::ForceSkiaRaster::isReadOnly()); @@ -820,7 +824,11 @@ void OfaViewTabPage::Reset( const SfxItemSet* ) m_xUseAntiAliase->save_state(); } +#ifdef MACOSX + m_xUseSkia->set_active(true); // macOS can __only__ render via skia +#else m_xUseSkia->set_active(officecfg::Office::Common::VCL::UseSkia::get()); +#endif m_xForceSkiaRaster->set_active(officecfg::Office::Common::VCL::ForceSkiaRaster::get()); m_xUseSkia->save_state(); m_xForceSkiaRaster->save_state(); diff --git a/vcl/osx/salframeview.mm b/vcl/osx/salframeview.mm index 7dd9b64d12ca..e4f474b8f050 100644 --- a/vcl/osx/salframeview.mm +++ b/vcl/osx/salframeview.mm @@ -776,7 +776,6 @@ static NSString* getCurrentSelection() updateMenuBarVisibility( mpFrame ); -#if HAVE_FEATURE_SKIA // Related: tdf#128186 Let vcl use the CAMetalLayer's hidden property // to skip the fix for tdf#152703 in external/skia/macosmetal.patch.1 // and create a new CAMetalLayer when the window resizes. When using @@ -784,7 +783,8 @@ static NSString* getCurrentSelection() // of native full screen mode causes the Skia/Metal surface to be // drawn at the wrong window position which results in a noticeable // flicker. - if( SkiaHelper::isVCLSkiaEnabled() && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster ) + assert( SkiaHelper::isVCLSkiaEnabled() && "macos requires skia" ); + if( SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster ) { if( [mpFrame->getNSView() wantsLayer] ) { @@ -793,7 +793,6 @@ static NSString* getCurrentSelection() [pLayer setHidden: YES]; } } -#endif } } @@ -817,7 +816,6 @@ static NSString* getCurrentSelection() (void)pNotification; SolarMutexGuard aGuard; -#if HAVE_FEATURE_SKIA // Related: tdf#128186 Let vcl use the CAMetalLayer's hidden property // to skip the fix for tdf#152703 in external/skia/macosmetal.patch.1 // and create a new CAMetalLayer when the window resizes. When using @@ -825,7 +823,8 @@ static NSString* getCurrentSelection() // of native full screen mode causes the Skia/Metal surface to be // drawn at the wrong window position which results in a noticeable // flicker. - if( AquaSalFrame::isAlive( mpFrame ) && SkiaHelper::isVCLSkiaEnabled() && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster ) + assert( SkiaHelper::isVCLSkiaEnabled() && "macos requires skia" ); + if( AquaSalFrame::isAlive( mpFrame ) && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster ) { if( [mpFrame->getNSView() wantsLayer] ) { @@ -834,7 +833,6 @@ static NSString* getCurrentSelection() [pLayer setHidden: YES]; } } -#endif } -(void)windowDidExitFullScreen: (NSNotification*)pNotification diff --git a/vcl/osx/salgdiutils.cxx b/vcl/osx/salgdiutils.cxx index ecc886be0243..d8fe79f8d455 100644 --- a/vcl/osx/salgdiutils.cxx +++ b/vcl/osx/salgdiutils.cxx @@ -319,8 +319,7 @@ void AquaSalGraphics::UpdateWindow( NSRect& rRect ) CGImageRef img = nullptr; CGPoint aImageOrigin = CGPointMake(0, 0); bool bImageFlipped = false; -#if HAVE_FEATURE_SKIA - if (SkiaHelper::isVCLSkiaEnabled()) + assert(SkiaHelper::isVCLSkiaEnabled() && "macos requires skia"); { // tdf#159175 no CGLayer is needed for an NSWindow when using Skia // Get a CGImageRef directly from the Skia/Raster surface and draw @@ -331,10 +330,6 @@ void AquaSalGraphics::UpdateWindow( NSRect& rRect ) if (pBackend) img = pBackend->createCGImageFromRasterSurface(rRect, aImageOrigin, bImageFlipped); } - else -#else - (void)rRect; -#endif if (maShared.maLayer.isSet()) { maShared.applyXorContext(); diff --git a/vcl/osx/salnativewidgets.cxx b/vcl/osx/salnativewidgets.cxx index 44c8877c7695..499fc3e6f55b 100644 --- a/vcl/osx/salnativewidgets.cxx +++ b/vcl/osx/salnativewidgets.cxx @@ -723,11 +723,10 @@ bool AquaGraphicsBackendBase::performDrawNativeControl(ControlType nType, [pBox release]; -#if HAVE_FEATURE_SKIA // tdf#164428 Skia/Metal needs flush after drawing progress bar - if (SkiaHelper::isVCLSkiaEnabled() && SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster) + assert(SkiaHelper::isVCLSkiaEnabled() && "macos requires skia"); + if (SkiaHelper::renderMethodToUse() != SkiaHelper::RenderRaster) mpFrame->mbForceFlushProgressBar = true; -#endif bOK = true; } diff --git a/vcl/quartz/salgdi.cxx b/vcl/quartz/salgdi.cxx index 92ddc95b296c..5c1fc31faedb 100644 --- a/vcl/quartz/salgdi.cxx +++ b/vcl/quartz/salgdi.cxx @@ -60,9 +60,10 @@ #include <config_features.h> #include <vcl/skia/SkiaHelper.hxx> -#if HAVE_FEATURE_SKIA -#include <skia/osx/gdiimpl.hxx> +#if !HAVE_FEATURE_SKIA +static_assert(false, "skia is required on macOS"); #endif +#include <skia/osx/gdiimpl.hxx> #include <quartz/SystemFontList.hxx> #include <quartz/CoreTextFont.hxx> @@ -134,7 +135,6 @@ AquaSalGraphics::AquaSalGraphics(bool bPrinter) { SAL_INFO( "vcl.quartz", "AquaSalGraphics::AquaSalGraphics() this=" << this ); -#if HAVE_FEATURE_SKIA // tdf#146842 Do not use Skia for printing // Skia does not work with a native print graphics contexts. I am not sure // why but from what I can see, the Skia implementation drawing to a bitmap @@ -142,14 +142,13 @@ AquaSalGraphics::AquaSalGraphics(bool bPrinter) // is CGPDFContext so even if this bug could be solved by blitting the // Skia bitmap buffer, the printed PDF would not have selectable text so // always disable Skia for print graphics contexts. - if(!bPrinter && SkiaHelper::isVCLSkiaEnabled()) - mpBackend.reset(new AquaSkiaSalGraphicsImpl(*this, maShared)); - else + if(bPrinter) mpBackend.reset(new AquaGraphicsBackend(maShared)); -#else - (void)bPrinter; - mpBackend.reset(new AquaGraphicsBackend(maShared)); -#endif + else + { + assert(SkiaHelper::isVCLSkiaEnabled() && "skia is required on macOS"); + mpBackend.reset(new AquaSkiaSalGraphicsImpl(*this, maShared)); + } for (int i = 0; i < MAX_FALLBACK; ++i) mpFont[i] = nullptr; diff --git a/vcl/skia/SkiaHelper.cxx b/vcl/skia/SkiaHelper.cxx index 941836d06e42..7dcd5c41bc5a 100644 --- a/vcl/skia/SkiaHelper.cxx +++ b/vcl/skia/SkiaHelper.cxx @@ -424,8 +424,17 @@ static bool initVCLSkiaEnabled() * * SAL_DISABLESKIA avoids the use of Skia regardless of any option */ + bool bSalDisableSkia = getenv("SAL_DISABLESKIA") != nullptr; +#ifdef MACOSX + if (bSalDisableSkia) + { + SAL_WARN("vcl", "macOS requires Skia, so ignoring SAL_DISABLESKIA"); + bSalDisableSkia = false; + } +#endif + bool bRet = false; - if (supportsVCLSkia() && getenv("SAL_DISABLESKIA") == nullptr) + if (supportsVCLSkia() && !bSalDisableSkia) { const bool bForceSkia = getenv("SAL_FORCESKIA") != nullptr || officecfg::Office::Common::VCL::ForceSkia::get(); @@ -434,8 +443,12 @@ static bool initVCLSkiaEnabled() // If not forced, don't enable in safe mode if (!bRet && !Application::IsSafeModeEnabled()) { +#ifdef MACOSX + bRet = true; // macOS can __only__ render via skia +#else bRet = getenv("SAL_ENABLESKIA") != nullptr || officecfg::Office::Common::VCL::UseSkia::get(); +#endif } if (bRet)