diff --git a/Makefile b/Makefile index 61934ac..13ba5c9 100644 --- a/Makefile +++ b/Makefile @@ -25,6 +25,7 @@ else endif endif endif + ifneq ($(PLATFORM),"Emscripten") # try and add conda environment ifdef CONDA_PREFIX @@ -81,39 +82,37 @@ LIBGW_INCLUDE= shared: LIBGW_INCLUDE=-I./libgw CPPFLAGS += -I./lib/libBigWig -I./include -I. $(LIBGW_INCLUDE) -I./src LDLIBS += -lskia -lm -ljpeg -lpng -lpthread + ifeq ($(PLATFORM),"Linux") # set platform flags and libs - ifeq (${XDG_SESSION_TYPE},"wayland") # wayland is untested! - LDLIBS += -lwayland-client - else - LDLIBS += -lX11 - endif - CPPFLAGS += -I/usr/local/include CXXFLAGS += -D LINUX -D __STDC_FORMAT_MACROS - LDFLAGS += -L/usr/local/lib - # If installed from conda, glfw3 is named glfw, therefore if glfw3 is installed by another means use this: -# LDLIBS += -lGL -lfreetype -lfontconfig -luuid -lzlib -licu -ldl $(shell pkg-config --static --libs x11 xrandr xi xxf86vm glfw3) -# LDLIBS += -lEGL -lGLESv2 -lfreetype -lfontconfig -luuid -lz -lcurl -licu -ldl -lglfw #$(shell pkg-config --static --libs x11 xrandr xi xxf86vm glfw3) - ifeq ($(USE_GL),"1") - LDLIBS += -lGL - else - LDLIBS += -lEGL -lGLESv2 + LDLIBS += -lX11 + ifeq ($(USE_WAYLAND),1) + LDLIBS += -lwayland-client -lwayland-egl + endif + LDLIBS += -lGL -lEGL + ifneq ($(USE_GL),1) + LDLIBS += -lGLESv2 endif LDLIBS += -lhts -lfreetype -luuid -lz -lcurl -licu -ldl -lglfw -lsvg -lfontconfig + else ifeq ($(PLATFORM),"Darwin") CPPFLAGS += -I/usr/local/include CXXFLAGS += -D OSX -stdlib=libc++ -arch x86_64 -fvisibility=hidden -mmacosx-version-min=11 -Wno-deprecated-declarations LDFLAGS += -undefined dynamic_lookup -framework OpenGL -framework AppKit -framework ApplicationServices -mmacosx-version-min=10.15 -L/usr/local/lib LDLIBS += -lhts -lglfw -lzlib -lcurl -licu -ldl -lsvg -lfontconfig + else ifeq ($(PLATFORM),"Arm64") CPPFLAGS += -I/usr/local/include CXXFLAGS += -D OSX -stdlib=libc++ -arch arm64 -fvisibility=hidden -mmacosx-version-min=11 -Wno-deprecated-declarations LDFLAGS += -undefined dynamic_lookup -framework OpenGL -framework AppKit -framework ApplicationServices -mmacosx-version-min=10.15 -L/usr/local/lib LDLIBS += -lhts -lglfw -lzlib -lcurl -licu -ldl -lsvg -lfontconfig + else ifeq ($(PLATFORM),"Windows") CXXFLAGS += -D WIN32 CPPFLAGS += $(shell pkgconf -cflags skia) $(shell ncursesw6-config --cflags) LDLIBS += $(shell pkgconf -libs skia) LDLIBS += -lhts -lharfbuzz-subset -lglfw3 -lcurl -lsvg -lfontconfig + else ifeq ($(PLATFORM),"Emscripten") CPPFLAGS += -v --use-port=contrib.glfw3 -sUSE_ZLIB=1 -sUSE_FREETYPE=1 -sUSE_ICU=1 -I/usr/local/include CFLAGS += -fPIC @@ -128,6 +127,7 @@ OBJECTS += $(patsubst %.c, %.o, $(wildcard ./include/*.c)) debug: LDFLAGS += -fsanitize=address -fsanitize=undefined + $(TARGET): $(OBJECTS) # line 131 $(CXX) $(CXXFLAGS) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $@ diff --git a/src/plot_manager.cpp b/src/plot_manager.cpp index 91beb54..4c97d2c 100644 --- a/src/plot_manager.cpp +++ b/src/plot_manager.cpp @@ -243,6 +243,7 @@ namespace Manager { } bool opengl_es_loader = false; glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); + glfwWindowHint(GLFW_SCALE_TO_MONITOR, GLFW_TRUE); #ifndef __APPLE__ // linux, windows, termux #ifdef USE_GL @@ -255,7 +256,7 @@ namespace Manager { glfwWindowHint(GLFW_CLIENT_API, GLFW_OPENGL_ES_API); glfwWindowHint(GLFW_CONTEXT_CREATION_API, GLFW_EGL_CONTEXT_API); glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, (major_v == -1) ? 2 : major_v); - glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, (minor_v == -1) ? 0 : major_v); + glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, (minor_v == -1) ? 0 : minor_v); opengl_es_loader = true; #endif @@ -348,6 +349,15 @@ namespace Manager { std::cerr << "OpenGL renderer: " << rend << std::endl; std::cerr << "OpenGL version: " << ver << std::endl; std::cerr << "OpenGL vendor: " << ven << std::endl; + float xscale; + float yscale; + int windX, windY; + glfwGetWindowContentScale(window, &xscale, &yscale); + glfwGetFramebufferSize(window, &fb_width, &fb_height); + glfwGetWindowSize(window, &windX, &windY); + std::cerr << "Content x-scale=" << xscale << " y-scale=" << yscale << std::endl; + std::cerr << "Window width=" << windX << " height=" << windY << std::endl; + std::cerr << "Framebuffer width=" << width << " height=" << height << std::endl; } if (rasterSurfacePtr == nullptr) { @@ -1773,12 +1783,12 @@ namespace Manager { if (!cl.skipDrawingReads) { if (opts.threads == 1) { - std::chrono::high_resolution_clock::time_point initial = std::chrono::high_resolution_clock::now(); +// std::chrono::high_resolution_clock::time_point initial = std::chrono::high_resolution_clock::now(); HGW::iterDraw(cl, bams[cl.bamIdx], headers[cl.bamIdx], indexes[cl.bamIdx], ®ions[cl.regionIdx], (bool) opts.max_coverage, filters, opts, canvas, trackY, yScaling, fonts, refSpace, pointSlop, textDrop, pH, monitorScale); - std::cerr << " time runDrawNoBufferOnCanvas " << (std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - initial).count()) << std::endl; +// std::cerr << " time runDrawNoBufferOnCanvas " << (std::chrono::duration_cast(std::chrono::high_resolution_clock::now() - initial).count()) << std::endl; } else { HGW::iterDrawParallel(cl, bams[cl.bamIdx], headers[cl.bamIdx], indexes[cl.bamIdx], opts.threads, ®ions[cl.regionIdx], (bool) opts.max_coverage,