From f93b33f24879b7375ae7bced4f6244ebed174b86 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 9 Nov 2021 11:07:18 -0300 Subject: [PATCH] Migrate to Skia m96 API --- CMakeLists.txt | 14 ++++++++++++-- laf | 2 +- src/app/app.cpp | 4 +++- src/app/ui/skin/skin_theme.cpp | 2 ++ src/app/ui/tabs.cpp | 2 ++ src/app/widget_loader.cpp | 5 ++++- src/ui/overlay.cpp | 1 + third_party/CMakeLists.txt | 12 ++++++++++++ third_party/harfbuzz | 2 +- third_party/libwebp | 2 +- 10 files changed, 39 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 317e982ab..3119661d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -277,8 +277,18 @@ include_directories(${FREETYPE_INCLUDE_DIRS}) if(USE_SHARED_HARFBUZZ) find_package(HarfBuzz) else() - set(HARFBUZZ_LIBRARIES harfbuzz) - set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_DIR}/src) + if(LAF_BACKEND STREQUAL "skia") + # Use the Skia harfbuzz (it's a modified version with C++11 + # mutexes). + add_definitions(-DHAVE_CONFIG_OVERRIDE_H=1) + set(HARFBUZZ_LIBRARIES ${SKIA_HARFBUZZ_LIBRARY}) + set(HARFBUZZ_INCLUDE_DIRS + ${SKIA_DIR}/third_party/harfbuzz + ${SKIA_DIR}/third_party/externals/harfbuzz/src) + else() + set(HARFBUZZ_LIBRARIES harfbuzz) + set(HARFBUZZ_INCLUDE_DIRS ${HARFBUZZ_DIR}/src) + endif() endif() include_directories(${HARFBUZZ_INCLUDE_DIRS}) diff --git a/laf b/laf index 6eefcb859..aa613ed84 160000 --- a/laf +++ b/laf @@ -1 +1 @@ -Subproject commit 6eefcb859bfbf00a3d993d7bac6a44af93e00bd9 +Subproject commit aa613ed84cc9d896e4aef8beea836376a39e8875 diff --git a/src/app/app.cpp b/src/app/app.cpp index 5a6e31174..a84b1084b 100644 --- a/src/app/app.cpp +++ b/src/app/app.cpp @@ -391,8 +391,10 @@ void App::run() rf.includeDataDir(fmt::format("icons/ase{0}.png", size).c_str()); if (rf.findFirst()) { os::SurfaceRef surf = os::instance()->loadRgbaSurface(rf.filename().c_str()); - if (surf) + if (surf) { + surf->setImmutable(); icons.push_back(surf); + } } } diff --git a/src/app/ui/skin/skin_theme.cpp b/src/app/ui/skin/skin_theme.cpp index d42a93927..94b17b2bc 100644 --- a/src/app/ui/skin/skin_theme.cpp +++ b/src/app/ui/skin/skin_theme.cpp @@ -340,6 +340,7 @@ void SkinTheme::loadSheet() m_sheet = newSheet; if (m_sheet) m_sheet->applyScale(guiscale()); + m_sheet->setImmutable(); // Reset sprite sheet and font of all layer styles (to avoid // dangling pointers to os::Surface or os::Font). @@ -756,6 +757,7 @@ os::SurfaceRef SkinTheme::sliceSheet(os::SurfaceRef sur, const gfx::Rect& bounds os::SurfaceLock lockSrc(m_sheet.get()); os::SurfaceLock lockDst(sur.get()); m_sheet->blitTo(sur.get(), bounds.x, bounds.y, 0, 0, bounds.w, bounds.h); + sur->setImmutable(); } else { ASSERT(!sur); diff --git a/src/app/ui/tabs.cpp b/src/app/ui/tabs.cpp index 26e793b9d..1e693f7a0 100644 --- a/src/app/ui/tabs.cpp +++ b/src/app/ui/tabs.cpp @@ -948,6 +948,8 @@ void Tabs::createFloatingOverlay(Tab* tab) drawTab(&g, g.getClipBounds(), tab, 0, true, true); } + surface->setImmutable(); + m_floatingOverlay = base::make_ref( surface, gfx::Point(), (ui::Overlay::ZOrder)(Overlay::MouseZOrder-1)); diff --git a/src/app/widget_loader.cpp b/src/app/widget_loader.cpp index 54dd57f61..25f0ef84d 100644 --- a/src/app/widget_loader.cpp +++ b/src/app/widget_loader.cpp @@ -500,7 +500,10 @@ Widget* WidgetLoader::convertXmlElementToWidget(const TiXmlElement* elem, Widget try { os::SurfaceRef sur = os::instance()->loadRgbaSurface(rf.filename().c_str()); - widget = new ImageView(sur, 0); + if (sur) { + sur->setImmutable(); + widget = new ImageView(sur, 0); + } } catch (...) { throw base::Exception("Error loading %s file", file); diff --git a/src/ui/overlay.cpp b/src/ui/overlay.cpp index 18be98fb4..729057304 100644 --- a/src/ui/overlay.cpp +++ b/src/ui/overlay.cpp @@ -99,6 +99,7 @@ void Overlay::captureOverlappedArea(os::Surface* screen) os::SurfaceLock lock(m_overlap.get()); screen->blitTo(m_overlap.get(), m_pos.x, m_pos.y, 0, 0, m_overlap->width(), m_overlap->height()); + m_overlap->setImmutable(); m_captured = screen; } diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index cfc5d8924..893bb4879 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -35,6 +35,15 @@ endif() if(WITH_WEBP_SUPPORT) set(WEBP_BUILD_EXTRAS OFF CACHE BOOL "Build extras.") + set(WEBP_BUILD_ANIM_UTILS OFF CACHE BOOL "Build animation utilities.") + set(WEBP_BUILD_CWEBP OFF CACHE BOOL "Build the cwebp command line tool.") + set(WEBP_BUILD_DWEBP OFF CACHE BOOL "Build the dwebp command line tool.") + set(WEBP_BUILD_GIF2WEBP OFF CACHE BOOL "Build the gif2webp conversion tool.") + set(WEBP_BUILD_IMG2WEBP OFF CACHE BOOL "Build the img2webp animation tool.") + set(WEBP_BUILD_VWEBP OFF CACHE BOOL "Build the vwebp viewer tool.") + set(WEBP_BUILD_WEBPINFO OFF CACHE BOOL "Build the webpinfo command line tool.") + set(WEBP_BUILD_WEBPMUX OFF CACHE BOOL "Build the webpmux command line tool.") + add_subdirectory(libwebp) if(NOT USE_SHARED_LIBPNG) @@ -113,7 +122,10 @@ add_subdirectory(json11) set(ENABLE_WERROR OFF CACHE BOOL "Treat warnings as errors - default is ON for Debug, OFF otherwise.") set(ENABLE_TEST OFF CACHE BOOL "Enable unit and regression tests") set(ENABLE_COVERAGE OFF CACHE BOOL "Enable code coverage (GCC only, automatically sets ENABLE_TEST to ON)") +set(ENABLE_LZ4 OFF CACHE BOOL "Enable the use of the system LZ4 library if found") +set(ENABLE_LZO OFF CACHE BOOL "Enable the use of the system LZO library if found") set(ENABLE_LZMA OFF CACHE BOOL "Enable the use of the system LZMA library if found") +set(ENABLE_ZSTD OFF CACHE BOOL "Enable the use of the system zstd library if found") set(ENABLE_CNG OFF CACHE BOOL "Enable the use of CNG(Crypto Next Generation)") set(ENABLE_BZip2 OFF CACHE BOOL "Enable the use of the system BZip2 library if found") set(ENABLE_LIBXML2 OFF CACHE BOOL "Enable the use of the system libxml2 library if found") diff --git a/third_party/harfbuzz b/third_party/harfbuzz index 2040a2998..a52c6df38 160000 --- a/third_party/harfbuzz +++ b/third_party/harfbuzz @@ -1 +1 @@ -Subproject commit 2040a29984a1d47bc9dd309995bfc1d8d51238d3 +Subproject commit a52c6df38a38c4e36ff991dfb4b7d92e48a44553 diff --git a/third_party/libwebp b/third_party/libwebp index 69776e383..9ce5843db 160000 --- a/third_party/libwebp +++ b/third_party/libwebp @@ -1 +1 @@ -Subproject commit 69776e3832fba9969cf9da2513330f500f94e101 +Subproject commit 9ce5843dbabcfd3f7c39ec7ceba9cbeb213cbfdf