From 9d4741370cf1aabb6ef4075d4fa70ac68aafe252 Mon Sep 17 00:00:00 2001 From: Brian Osman Date: Sat, 17 Apr 2021 17:41:11 +0000 Subject: [PATCH] Revert "Fix sk_app macOS raster window build conditions." This reverts commit 163ba10ddefab50ef11411f17af7e8325cff98c1. Reason for revert: Mac linker errors Original change's description: > Fix sk_app macOS raster window build conditions. > > The "raster" window on macOS is actually backed by GL. Fix the build > rules and code conditions to reflect this. This allows for some sk_app > applications to run on macOS with skia_use_gl=false. > > Change-Id: I5d7b37c4172079e163690faa4e55a622a6d4f844 > Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397256 > Commit-Queue: Ben Wagner > Reviewed-by: Brian Osman TBR=bungeman@google.com,brianosman@google.com Change-Id: Ie5fa24138e4387784c21559f28528a4c4d335626 No-Presubmit: true No-Tree-Checks: true No-Try: true Reviewed-on: https://skia-review.googlesource.com/c/skia/+/397737 Reviewed-by: Brian Osman Commit-Queue: Brian Osman --- BUILD.gn | 8 +++----- modules/skplaintexteditor/app/editor_application.cpp | 11 +---------- tools/sk_app/mac/WindowContextFactory_mac.h | 6 +----- tools/sk_app/mac/Window_mac.mm | 7 ++++--- 4 files changed, 9 insertions(+), 23 deletions(-) diff --git a/BUILD.gn b/BUILD.gn index c86f0b057b..7b03e0f61f 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -2557,6 +2557,7 @@ if (skia_enable_tools) { ] } else if (is_mac) { sources += [ + "tools/sk_app/mac/RasterWindowContext_mac.mm", "tools/sk_app/mac/WindowContextFactory_mac.h", "tools/sk_app/mac/Window_mac.h", "tools/sk_app/mac/Window_mac.mm", @@ -2591,10 +2592,7 @@ if (skia_enable_tools) { sources += [ "tools/sk_app/win/ANGLEWindowContext_win.cpp" ] } } else if (is_mac) { - sources += [ - "tools/sk_app/mac/GLWindowContext_mac.mm", - "tools/sk_app/mac/RasterWindowContext_mac.mm", - ] + sources += [ "tools/sk_app/mac/GLWindowContext_mac.mm" ] } else if (is_ios) { sources += [ "tools/sk_app/ios/GLWindowContext_ios.mm" ] } @@ -2865,7 +2863,7 @@ if (skia_enable_tools) { ] } - if (skia_use_icu && skia_use_harfbuzz) { + if (skia_use_gl && skia_use_icu && skia_use_harfbuzz) { test_app("editor") { is_shared_library = is_android deps = [ "modules/skplaintexteditor:editor_app" ] diff --git a/modules/skplaintexteditor/app/editor_application.cpp b/modules/skplaintexteditor/app/editor_application.cpp index 7ee67e1bf4..cf37eb60ba 100644 --- a/modules/skplaintexteditor/app/editor_application.cpp +++ b/modules/skplaintexteditor/app/editor_application.cpp @@ -366,17 +366,8 @@ struct EditorLayer : public sk_app::Window::Layer { } }; -#ifdef SK_VULKAN -static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kVulkan_BackendType; -#elif SK_METAL -static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kMetal_BackendType; -#elif SK_GL +//static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kRaster_BackendType; static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kNativeGL_BackendType; -#elif SK_DAWN -static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kDawn_BackendType; -#else -static constexpr sk_app::Window::BackendType kBackendType = sk_app::Window::kRaster_BackendType; -#endif struct EditorApplication : public sk_app::Application { std::unique_ptr fWindow; diff --git a/tools/sk_app/mac/WindowContextFactory_mac.h b/tools/sk_app/mac/WindowContextFactory_mac.h index e772030b95..acf860ae4b 100644 --- a/tools/sk_app/mac/WindowContextFactory_mac.h +++ b/tools/sk_app/mac/WindowContextFactory_mac.h @@ -35,22 +35,18 @@ struct MacWindowInfo { NSView* fMainView; }; -#ifdef SK_VULKAN inline std::unique_ptr MakeVulkanForMac(const MacWindowInfo&, const DisplayParams&) { // No Vulkan support on Mac. return nullptr; } -#endif -#ifdef SK_GL -std::unique_ptr MakeRasterForMac(const MacWindowInfo&, const DisplayParams&); std::unique_ptr MakeGLForMac(const MacWindowInfo&, const DisplayParams&); -#endif #ifdef SK_DAWN std::unique_ptr MakeDawnMTLForMac(const MacWindowInfo&, const DisplayParams&); #endif +std::unique_ptr MakeRasterForMac(const MacWindowInfo&, const DisplayParams&); #ifdef SK_METAL std::unique_ptr MakeMetalForMac(const MacWindowInfo&, const DisplayParams&); #endif diff --git a/tools/sk_app/mac/Window_mac.mm b/tools/sk_app/mac/Window_mac.mm index 4cdee9c2b6..63ef3f8d8b 100644 --- a/tools/sk_app/mac/Window_mac.mm +++ b/tools/sk_app/mac/Window_mac.mm @@ -139,14 +139,15 @@ bool Window_mac::attach(BackendType attachType) { #endif #ifdef SK_GL case kNativeGL_BackendType: + default: fWindowContext = MakeGLForMac(info, fRequestedDisplayParams); break; +#else + default: +#endif case kRaster_BackendType: fWindowContext = MakeRasterForMac(info, fRequestedDisplayParams); break; -#endif - default: - SkASSERT_RELEASE(false); } this->onBackendCreated();