Browse Source

Cleanup

Signed-off-by: falkTX <falktx@falktx.com>
tags/22.09
falkTX 2 years ago
parent
commit
39f240f705
Signed by: falkTX <falktx@falktx.com> GPG Key ID: CDBAA37ABC74FBA0
1 changed files with 4 additions and 5 deletions
  1. +4
    -5
      src/custom/dep.cpp

+ 4
- 5
src/custom/dep.cpp View File

@@ -867,6 +867,7 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con

bool hasDarkMode = false;
bool hasLightMode = false;
NSVGimage* handleOrig;
NSVGimage* handleMOD = nullptr;
NSVGshape* shapesOrig;
NSVGshape* shapesMOD;
@@ -991,8 +992,6 @@ NSVGimage* nsvgParseFromFileCardinal(const char* const filename, const char* con
handle->shapes->fill.color = 0xff191919;

postparse:
NSVGimage* handleOrig;

if (handleMOD != nullptr)
{
handleOrig = static_cast<NSVGimage*>(malloc(sizeof(NSVGimage)));
@@ -1066,7 +1065,7 @@ void nsvgDeleteCardinal(NSVGimage* const handle)
nsvgDelete(handle);
}

void switchDarkMode(bool darkMode)
void switchDarkMode(const bool darkMode)
{
if (rack::settings::darkMode == darkMode)
return;
@@ -1084,8 +1083,8 @@ void switchDarkMode(bool darkMode)
for (ExtendedNSVGimage& ext : loadedLightSVGs)
{
if (ext.shapesMOD != nullptr)
ext.handle->shapes = darkMode ? ext.shapesOrig : ext.shapesMOD;
ext.handle->shapes = !darkMode ? ext.shapesMOD : ext.shapesOrig;
else if (ext.handleMOD != nullptr)
std::memcpy(ext.handle, darkMode ? ext.handleOrig : ext.handleMOD, sizeof(NSVGimage));
std::memcpy(ext.handle, !darkMode ? ext.handleMOD : ext.handleOrig, sizeof(NSVGimage));
}
}

Loading…
Cancel
Save