Use EGL instead of GLX, and remove duplicate font names

This commit is contained in:
Yousef Khadadeh 2025-11-15 17:03:14 +03:00
parent 5e8016b504
commit e4efb2e78d
5 changed files with 32 additions and 14 deletions

View file

@ -286,7 +286,7 @@ if((NOT EMSCRIPTEN) AND (NOT APPLE))
endif()
endif()
target_link_libraries(infinipaint SDL3::SDL3 zstd::libzstd_static)
target_link_libraries(infinipaint zstd::libzstd_static)
if(EMSCRIPTEN)
add_subdirectory(deps/datachannel-wasm EXCLUDE_FROM_ALL)
@ -298,10 +298,9 @@ endif()
if(NO_CONAN_BUILD)
target_link_libraries(infinipaint ${SKIA_SVG_LIB} ${SKIA_RESOURCES_LIB} ${SKIA_LIB} ${SKIA_UNICODE_CORE_LIB} ${SKIA_UNICODE_ICU_LIB} ${SKIA_UNICODE_CORE_LIB} ${SKIA_PARAGRAPH_LIB} ${SKIA_SHAPER_LIB})
target_include_directories(infinipaint PRIVATE ${SKIA_INCLUDE})
target_link_libraries(infinipaint ICU::uc Fontconfig::Fontconfig Freetype::Freetype PNG::PNG ZLIB::ZLIB)
target_link_libraries(infinipaint SDL3::SDL3 ICU::uc Fontconfig::Fontconfig Freetype::Freetype PNG::PNG ZLIB::ZLIB)
else()
target_link_libraries(infinipaint skia::skia)
target_link_libraries(infinipaint icu::icu)
target_link_libraries(infinipaint skia::skia sdl::sdl icu::icu)
endif()
if(NOT EMSCRIPTEN)
@ -309,7 +308,7 @@ if(NOT EMSCRIPTEN)
endif()
if((NOT (GRAPHICS_BACKEND STREQUAL "Vulkan")) AND (NOT EMSCRIPTEN) AND LINUX)
target_link_libraries(infinipaint OpenGL::GLX)
target_link_libraries(infinipaint OpenGL::EGL)
endif()
if(GRAPHICS_BACKEND STREQUAL "Vulkan")

View file

@ -81,6 +81,7 @@ class ConanSkia(ConanFile):
"use_fontconfig" : [True, False],
"use_fonthost_mac" : [True, False],
"use_perfetto" : [True, False],
"use_egl": [True, False],
# backend toggles
"enable_ganesh" : [True, False],
"enable_graphite" : [True, False],
@ -162,6 +163,7 @@ class ConanSkia(ConanFile):
"use_wuffs" : True,
"use_libavif" : False,
"use_libjxl_decode" : False,
"use_egl": False,
# backend toggles
"enable_ganesh" : True,
"enable_graphite" : False,
@ -268,6 +270,10 @@ class ConanSkia(ConanFile):
if self.options.use_x11 == None:
enabled = (os == "Linux")
self.options.use_x11 = enabled
if self.options.use_egl == None:
enabled = (os == "Linux")
self.options.use_egl = enabled
if self.options.use_fontconfig == None:
enabled = (os == "Linux")
@ -647,6 +653,16 @@ class ConanSkia(ConanFile):
args += f"skia_canvaskit_legacy_draw_vertices_blend_mode = false\n"
args += f"skia_canvaskit_profile_build = false\n"
if self.settings.os == "Linux" and self.options.use_egl == True:
args += f"skia_use_egl = true\n"
else:
args += f"skia_use_egl = false\n"
if self.settings.os == "Linux" and self.options.use_x11 == True:
args += f"skia_use_x11 = true\n"
else:
args += f"skia_use_x11 = false\n"
cflags = []
ldflags = []
asmflags = []

View file

@ -47,6 +47,8 @@ class CompressorRecipe(ConanFile):
"use_system_libpng": False,
"use_system_libwebp": False,
"use_system_zlib": False,
"use_x11": False,
"use_egl": True,
"enable_svg": True,
"enable_skottie": False,
"enable_bentleyottmann": True # for some reason, setting this to False results in an error when creating the project
@ -56,6 +58,7 @@ class CompressorRecipe(ConanFile):
if self.settings.os == "Linux":
self.requires("sdl/3.2.26", options = {
"wayland": False,
"x11": True,
"pulseaudio": False,
"alsa": False,
"sndio": False,

View file

@ -63,7 +63,7 @@ modules:
buildsystem: simple
build-commands:
- python3 tools/git-sync-deps
- bin/gn gen out/Static --args='is_official_build=true skia_use_system_expat=false skia_use_system_freetype2=true skia_use_system_harfbuzz=true skia_use_system_icu=true skia_use_system_libjpeg_turbo=false skia_use_system_libpng=true skia_use_system_libwebp=false skia_use_system_zlib=true'
- bin/gn gen out/Static --args='is_official_build=true skia_use_system_expat=false skia_use_system_freetype2=true skia_use_system_harfbuzz=true skia_use_system_icu=true skia_use_system_libjpeg_turbo=false skia_use_system_libpng=true skia_use_system_libwebp=false skia_use_system_zlib=true skia_use_egl=true skia_use_x11=false'
- ninja -C out/Static skia svg skunicode_core skunicode_icu skparagraph skresources skshaper
- mkdir /app/Skia
- mv out /app/Skia

View file

@ -10,15 +10,15 @@
bool GUIStuff::FontPicker::update(UpdateInputData& io, std::string* fontName, GUIManager* gui) {
if(sortedFontList.empty()) {
auto icu = SkUnicodes::ICU::Make();
std::set<std::string> sortedFontSet;
for(int i = 0; i < io.textFontMgrLocal->countFamilies(); i++) {
SkString familyNameSkString;
io.textFontMgrLocal->getFamilyName(i, &familyNameSkString);
if(familyNameSkString.isEmpty())
continue;
std::string familyName(familyNameSkString.c_str(), familyNameSkString.size());
sortedFontList.emplace_back(familyName);
std::transform(familyName.begin(), familyName.end(), familyName.begin(), ::tolower);
sortedFontListLowercase.emplace_back(familyName);
sortedFontSet.emplace(familyName);
}
for(int i = 0; i < io.textFontMgrFallback->countFamilies(); i++) {
SkString familyNameSkString;
@ -26,12 +26,12 @@ bool GUIStuff::FontPicker::update(UpdateInputData& io, std::string* fontName, GU
if(familyNameSkString.isEmpty())
continue;
std::string familyName(familyNameSkString.c_str(), familyNameSkString.size());
sortedFontList.emplace_back(familyName);
std::transform(familyName.begin(), familyName.end(), familyName.begin(), ::tolower);
sortedFontListLowercase.emplace_back(familyName);
sortedFontSet.emplace(familyName);
}
std::sort(sortedFontList.begin(), sortedFontList.end());
std::sort(sortedFontListLowercase.begin(), sortedFontListLowercase.end());
sortedFontList = std::vector<std::string>(sortedFontSet.begin(), sortedFontSet.end());
sortedFontListLowercase = sortedFontList;
for(std::string& s : sortedFontListLowercase)
std::transform(s.begin(), s.end(), s.begin(), ::tolower);
}
if(!fontName)