From 65244f197906ba31a10f795290e00725e7c60abe Mon Sep 17 00:00:00 2001 From: falkTX Date: Mon, 25 Jul 2022 17:25:37 +0100 Subject: [PATCH] Remove hacks for GlueTheGiant, will need to be handled differently --- src/custom/asset.cpp | 16 ---------------- src/custom/dep.cpp | 30 ++++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/src/custom/asset.cpp b/src/custom/asset.cpp index 83dacf5..40ee4f2 100644 --- a/src/custom/asset.cpp +++ b/src/custom/asset.cpp @@ -56,22 +56,6 @@ std::string system(std::string filename) { // get plugin resource std::string plugin(plugin::Plugin* plugin, std::string filename) { DISTRHO_SAFE_ASSERT_RETURN(plugin != nullptr, {}); - // always use dark scheme - if (plugin->slug == "GlueTheGiant") - { - if (filename == "res/BusDepot.svg" - || filename == "res/BusRoute.svg" - || filename == "res/EnterBus.svg" - || filename == "res/ExitBus.svg" - || filename == "res/GigBus.svg" - || filename == "res/MetroCityBus.svg" - || filename == "res/MiniBus.svg" - || filename == "res/Road.svg" - || filename == "res/SchoolBus.svg") - { - filename = filename.substr(0, filename.size()-4) + "_Night.svg"; - } - } return system::join(plugin->path, filename); } diff --git a/src/custom/dep.cpp b/src/custom/dep.cpp index b084cca..6b66328 100644 --- a/src/custom/dep.cpp +++ b/src/custom/dep.cpp @@ -762,10 +762,7 @@ bool invertPaintForLightMode(NSVGshape* const shape, NSVGpaint& paint) paint.gradient->stops[i].color = invertColor(paint.gradient->stops[i].color); return true; case NSVG_PAINT_COLOR: - paint.color = (paint.color & 0xff000000) - | (0xff0000 - (paint.color & 0xff0000)) - | (0xff00 - (paint.color & 0xff00)) - | (0xff - (paint.color & 0xff)); + paint.color = invertColor(paint.color); return true; default: return false; @@ -893,6 +890,31 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con goto postparse; } +#if 0 + // Special case for GlueTheGiant + if (std::strstr(filename, "/GlueTheGiant/res/") != nullptr) + { + printf("special hack for glue\n"); + if (std::strncmp(filename + (filenamelen - 13), "/BusDepot.svg", 13) == 0 || + std::strncmp(filename + (filenamelen - 13), "/BusRoute.svg", 13) == 0 || + std::strncmp(filename + (filenamelen - 13), "/EnterBus.svg", 13) == 0 || + std::strncmp(filename + (filenamelen - 12), "/ExitBus.svg", 12) == 0 || + std::strncmp(filename + (filenamelen - 11), "/GigBus.svg", 11) == 0 || + std::strncmp(filename + (filenamelen - 17), "/MetroCityBus.svg", 17) == 0 || + std::strncmp(filename + (filenamelen - 12), "/MiniBus.svg", 12) == 0 || + std::strncmp(filename + (filenamelen - 9), "/Road.svg", 9) == 0 || + std::strncmp(filename + (filenamelen - 14), "/SchoolBus.svg", 14) == 0) + { + const std::string nightfilename = std::string(filename).substr(0, filenamelen-4) + "_Night.svg"; + hasDarkMode = true; + shapesOrig = shapesMOD = nullptr; + handleMOD = nsvgParseFromFile(nightfilename.c_str(), units, dpi); + printf("special hack for glue: %s -> %s\n", filename, nightfilename.c_str()); + goto postparse; + } + } +#endif + for (size_t i = 0; i < sizeof(svgFilesToInvertForDarkMode)/sizeof(svgFilesToInvertForDarkMode[0]); ++i) { const char* const svgFileToInvert = svgFilesToInvertForDarkMode[i].filename;