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++

Change KisPainter::setFlow() to use qreal as well

Dmitry Kazakovde8893aa3a26
diff --git a/benchmarks/kis_painter_benchmark.cpp b/benchmarks/kis_painter_benchmark.cpp
index 07ea184390..eaf8308d99 100644
--- a/benchmarks/kis_painter_benchmark.cpp
+++ b/benchmarks/kis_painter_benchmark.cpp
@@ -399,7 +399,7 @@ void benchmarkMassiveBltFixedImpl(int numDabs, int size, qreal spacing, int idea
KisPainter painter(dst);
Q_FOREACH (const KisRenderedDab &dab, devices) {
painter.setOpacityF(dab.opacity);
- painter.setFlow(255 * dab.flow);
+ painter.setFlow(dab.flow);
painter.bltFixed(dab.offset, dab.device, dab.device->bounds());
}
painter.end();
diff --git a/libs/image/kis_painter.cc b/libs/image/kis_painter.cc
index f24d316e8a..4b56191d28 100644
--- a/libs/image/kis_painter.cc
+++ b/libs/image/kis_painter.cc
@@ -2675,14 +2675,14 @@ KisPainter::StrokeStyle KisPainter::strokeStyle() const
return d->strokeStyle;
}
-void KisPainter::setFlow(quint8 flow)
+void KisPainter::setFlow(qreal flow)
{
- d->paramInfo.flow = float(flow) / 255.0f;
+ d->paramInfo.flow = flow;
}
-quint8 KisPainter::flow() const
+qreal KisPainter::flow() const
{
- return quint8(d->paramInfo.flow * 255.0f);
+ return d->paramInfo.flow;
}
void KisPainter::setOpacityUpdateAverage(qreal opacity)
diff --git a/libs/image/kis_painter.h b/libs/image/kis_painter.h
index 21fc4f15f0..f9a90a4fa6 100644
--- a/libs/image/kis_painter.h
+++ b/libs/image/kis_painter.h
@@ -753,9 +753,9 @@ public:
/// Returns the current brush stroke style
StrokeStyle strokeStyle() const;
- void setFlow(quint8 flow);
+ void setFlow(qreal flow);
- quint8 flow() const;
+ qreal flow() const;
/**
* Sets the opacity of the painting and recalculates the
diff --git a/plugins/paintops/libpaintop/KisFlowOpacityOption.cpp b/plugins/paintops/libpaintop/KisFlowOpacityOption.cpp
index 13774ec7a0..bfb6aa12b5 100644
--- a/plugins/paintops/libpaintop/KisFlowOpacityOption.cpp
+++ b/plugins/paintops/libpaintop/KisFlowOpacityOption.cpp
@@ -34,7 +34,7 @@ void KisFlowOpacityOption2::apply(KisPainter* painter, const KisPaintInformation
apply(info, &opacity, &flow);
painter->setOpacityUpdateAverage(opacity);
- painter->setFlow(qRound(OPACITY_OPAQUE_U8 * flow));
+ painter->setFlow(flow);
}
void KisFlowOpacityOption2::apply(const KisPaintInformation &info, qreal *opacity, qreal *flow)