Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
1005 B
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2022 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */
#include "KisLodAvailabilityData.h"

#include <kis_properties_configuration.h>
#include <kis_paintop_registry.h>

bool KisLodAvailabilityData::read(const KisPropertiesConfiguration *setting)
{
    const QString paintopId = setting->getString("paintop");
    if (paintopId.isEmpty()) {
        return false;
    }

    KisPaintOpFactory *factory = KisPaintOpRegistry::instance()->get(paintopId);
    if (!factory) {
        return false;
    }

    isLodSizeThresholdSupported = factory->lodSizeThresholdSupported();
    isLodUserAllowed = setting->getBool("lodUserAllowed", true);
    lodSizeThreshold = setting->getDouble("lodSizeThreshold", 100.0);

    return true;
}

void KisLodAvailabilityData::write(KisPropertiesConfiguration *setting) const
{
    setting->setProperty("lodUserAllowed", isLodUserAllowed);
    setting->setProperty("lodSizeThreshold", lodSizeThreshold);
}