1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
/*
* SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com>
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "KisStrokeCompatibilityInfo.h"
#include <kis_resources_snapshot.h>
#include "kis_paintop_preset.h"
#include "kis_node.h"
namespace {
inline KoResourceSignature lazySignature(KoResourceSP resource) {
return resource ? resource->signature() : KoResourceSignature();
}
} // namespace
KisStrokeCompatibilityInfo::KisStrokeCompatibilityInfo()
{
}
KisStrokeCompatibilityInfo::KisStrokeCompatibilityInfo(KisResourcesSnapshot &resourcesSnapshot)
: currentFgColor(resourcesSnapshot.currentFgColor())
, currentBgColor(resourcesSnapshot.currentBgColor())
, currentPattern(lazySignature(resourcesSnapshot.currentPattern()))
, currentGradient(lazySignature(resourcesSnapshot.currentGradient()))
, currentPreset(lazySignature(resourcesSnapshot.currentPaintOpPreset()))
, currentGeneratorXml(resourcesSnapshot.currentGenerator() ? resourcesSnapshot.currentGenerator()->toXML() : "")
, currentNode(resourcesSnapshot.currentNode() ? resourcesSnapshot.currentNode()->uuid() : QUuid())
, opacity(resourcesSnapshot.opacity())
, compositeOpId(resourcesSnapshot.compositeOpId())
, channelLockFlags(resourcesSnapshot.channelLockFlags())
{
}
bool operator==(const KisStrokeCompatibilityInfo &lhs, const KisStrokeCompatibilityInfo &rhs)
{
return
lhs.currentFgColor == rhs.currentFgColor &&
lhs.currentBgColor == rhs.currentBgColor &&
lhs.currentPattern == rhs.currentPattern &&
lhs.currentGradient == rhs.currentGradient &&
lhs.currentPreset == rhs.currentPreset &&
lhs.currentGeneratorXml == rhs.currentGeneratorXml &&
lhs.currentNode == rhs.currentNode &&
qFuzzyCompare(lhs.opacity, rhs.opacity) &&
lhs.compositeOpId == rhs.compositeOpId &&
lhs.channelLockFlags == rhs.channelLockFlags;
}
|