Commit e3f78b79 authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Merge branch 'master' into krita-testing-wolthera

parents 273dd04a ebc8a43c
......@@ -48,7 +48,7 @@ else()
URL_MD5 8fdec6d657bc370bd3183d8fe8e9c47a
PATCH_COMMAND ${PATCH_COMMAND} -p1 -i ${CMAKE_CURRENT_SOURCE_DIR}/qt-no-motion-compression.diff
INSTALL_DIR ${EXTPREFIX_qt}
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -nomake examples -no-sql-sqlite -no-openssl -no-qml-debug -no-mtdev -no-journald -no-syslog -no-nis -no-cups -no-tslib -no-directfb -no-linuxfb -no-libproxy -no-pch -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-harfbuzz -qt-freetype -qt-xcb -qt-xkbcommon-x11 -optimized-qmake -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview
CONFIGURE_COMMAND <SOURCE_DIR>/configure -prefix ${EXTPREFIX_qt} -opensource -confirm-license -nomake examples -no-sql-sqlite -no-openssl -no-qml-debug -no-mtdev -no-journald -no-syslog -no-nis -no-cups -no-tslib -no-directfb -no-linuxfb -no-libproxy -no-pch -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-harfbuzz -qt-freetype -qt-xcb -qt-xkbcommon-x11 -optimized-qmake -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtenginio -skip qtgraphicaleffects -skip qtlocation -skip qtmultimedia -skip qtwayland -skip qtwebchannel -skip qtwebengine -skip qtwebsockets -skip qtwebview -skip qtandroidextras -skip qtserialport
BUILD_COMMAND make
INSTALL_COMMAND make install
......
......@@ -425,9 +425,6 @@ macro_log_feature(TIFF_FOUND "tiff" "TIFF Library and Utilities" "http://www.rem
macro_optional_find_package(JPEG)
macro_log_feature(JPEG_FOUND "jpeg" "Free library for JPEG image compression. Note: libjpeg8 is NOT supported." "http://www.libjpeg-turbo.org" FALSE "" "Required by the Krita JPEG filter")
macro_optional_find_package(OpenJPEG)
macro_log_feature(OPENJPEG_FOUND "openjpeg" "Free library for JPEG 2000 image compression" "http://www.openjpeg.org" FALSE "" "Required by the Krita JPEG 2000 filter")
set(LIBRAW_MIN_VERSION "0.16")
macro_optional_find_package(LibRaw ${LIBRAW_MIN_VERSION})
macro_log_feature(LIBRAW_FOUND "LibRaw" "Library to decode RAW images" "http://www.libraw.org" FALSE "" "Required to build the raw import plugin")
......
......@@ -53,7 +53,6 @@ Krita depends on:
* libraw
* opencolorio
* openexr
* openjpeg
* png
* poppler-qt5
* pthreads
......
......@@ -254,14 +254,16 @@ const QBitArray& KisPaintLayer::channelLockFlags() const
QRect KisPaintLayer::extent() const
{
QRect rect = temporaryTarget() ? temporaryTarget()->extent() : QRect();
KisPaintDeviceSP t = temporaryTarget();
QRect rect = t ? t->extent() : QRect();
if (onionSkinEnabled()) rect |= KisOnionSkinCompositor::instance()->calculateExtent(m_d->paintDevice);
return rect | KisLayer::extent();
}
QRect KisPaintLayer::exactBounds() const
{
QRect rect = temporaryTarget() ? temporaryTarget()->exactBounds() : QRect();
KisPaintDeviceSP t = temporaryTarget();
QRect rect = t ? t->extent() : QRect();
if (onionSkinEnabled()) rect |= KisOnionSkinCompositor::instance()->calculateExtent(m_d->paintDevice);
return rect | KisLayer::exactBounds();
}
......@@ -276,7 +278,7 @@ void KisPaintLayer::setAlphaLocked(bool lock)
{
if(m_d->paintChannelFlags.isEmpty())
m_d->paintChannelFlags = colorSpace()->channelFlags(true, true);
if(lock)
m_d->paintChannelFlags &= colorSpace()->channelFlags(true, false);
else
......
......@@ -894,6 +894,13 @@ void KisMainWindow::slotSaveCompleted()
}
}
bool KisMainWindow::hackIsSaving() const
{
StdLockableWrapper<QMutex> wrapper(&d->savingEntryMutex);
std::unique_lock<StdLockableWrapper<QMutex>> l(wrapper, std::try_to_lock);
return !l.owns_lock();
}
bool KisMainWindow::saveDocument(KisDocument *document, bool saveas, bool silent, int specialOutputFlag)
{
if (!document) {
......@@ -1808,7 +1815,10 @@ void KisMainWindow::slotProgress(int value)
{
qApp->processEvents();
if (!d->progressMutex.tryLock()) return;
StdLockableWrapper<QMutex> wrapper(&d->progressMutex);
std::unique_lock<StdLockableWrapper<QMutex>> l(wrapper, std::try_to_lock);
if (!l.owns_lock()) return;
dbgUI << "KisMainWindow::slotProgress" << value;
if (value <= -1 || value >= 100) {
......@@ -1823,7 +1833,6 @@ void KisMainWindow::slotProgress(int value)
d->progressCancel = 0;
}
d->firstTime = true;
d->progressMutex.unlock();
return;
}
if (d->firstTime || !d->progress) {
......@@ -1866,8 +1875,6 @@ void KisMainWindow::slotProgress(int value)
d->progress->setValue(value);
}
qApp->processEvents();
d->progressMutex.unlock();
}
void KisMainWindow::slotProgressCanceled()
......
......@@ -142,6 +142,17 @@ public:
QStringList showOpenFileDialog();
/**
* Shows if the main window is saving anything right now. If the
* user presses Ctrl+W too fast, then the document can be close
* before the saving is completed. I'm not sure if it is fixable
* in any way without avoiding using porcessEvents()
* everywhere (DK)
*
* Don't use it unless you have no option.
*/
bool hackIsSaving() const;
Q_SIGNALS:
/**
......
......@@ -269,6 +269,16 @@ void KisPart::removeView(KisView *view)
{
if (!view) return;
/**
* HACK ALERT: we check here explicitly if the document (or main
* window), is saving the stuff. If we close the
* document *before* the saving is completed, a crash
* will happen.
*/
if (view->mainWindow()->hackIsSaving()) {
return;
}
emit sigViewRemoved(view);
QPointer<KisDocument> doc = view->document();
......
......@@ -27,12 +27,13 @@
struct KisStabilizedEventsSampler::Private
{
Private(int _sampleTime) : sampleTime(_sampleTime) {}
Private(int _sampleTime) : sampleTime(_sampleTime), elapsedTimeOverride(0) {}
std::function<void(const KisPaintInformation &)> paintLine;
QElapsedTimer lastPaintTime;
QList<KisPaintInformation> realEvents;
int sampleTime;
int elapsedTimeOverride;
KisPaintInformation lastPaintInformation;
};
......@@ -70,6 +71,14 @@ void KisStabilizedEventsSampler::addEvent(const KisPaintInformation &pi)
m_d->realEvents.append(pi);
}
void KisStabilizedEventsSampler::addFinishingEvent(int numSamples)
{
clear();
m_d->elapsedTimeOverride = numSamples;
m_d->realEvents.append(m_d->lastPaintInformation);
}
void KisStabilizedEventsSampler::processAllEvents()
{
const int elapsed = m_d->lastPaintTime.restart();
......@@ -93,9 +102,11 @@ const KisPaintInformation& KisStabilizedEventsSampler::iterator::dereference() c
std::pair<KisStabilizedEventsSampler::iterator, KisStabilizedEventsSampler::iterator>
KisStabilizedEventsSampler::range() const
{
const int elapsed = m_d->lastPaintTime.restart() / m_d->sampleTime;
const int elapsed = (m_d->lastPaintTime.restart() + m_d->elapsedTimeOverride) / m_d->sampleTime;
const qreal alpha = qreal(m_d->realEvents.size()) / elapsed;
m_d->elapsedTimeOverride = 0;
return std::make_pair(iterator(this, 0, alpha),
iterator(this, elapsed, alpha));
}
......
......@@ -40,6 +40,7 @@ public:
void clear();
void addEvent(const KisPaintInformation &pi);
void addFinishingEvent(int numSamples);
void processAllEvents();
public:
......
......@@ -26,6 +26,8 @@
#include <QPainter>
#include <QRect>
#include <QThreadPool>
#include <QApplication>
#include <QDesktopWidget>
#include <kis_icon.h>
#include <KoPointerEvent.h>
......@@ -323,6 +325,7 @@ void KisToolFreehand::beginAlternateAction(KoPointerEvent *event, AlternateActio
m_initialGestureGlobalPoint = QCursor::pos();
m_lastDocumentPoint = event->point;
m_lastPaintOpSize = currentPaintOpPreset()->settings()->paintOpSize();
}
void KisToolFreehand::continueAlternateAction(KoPointerEvent *event, AlternateAction action)
......@@ -339,19 +342,30 @@ void KisToolFreehand::continueAlternateAction(KoPointerEvent *event, AlternateAc
QPointF offset = actualWidgetPosition - lastWidgetPosition;
/**
* view pixels != widget pixels, but we do this anyway, we only
* need to scale the gesture down, not rotate or anything
*/
QPointF scaledOffset = canvas()->viewConverter()->viewToDocument(offset);
KisCanvas2 *canvas2 = dynamic_cast<KisCanvas2 *>(canvas());
QRect screenRect = QApplication::desktop()->screenGeometry();
qreal scaleX = 0;
qreal scaleY = 0;
canvas2->coordinatesConverter()->imageScale(&scaleX, &scaleY);
if (qRound(scaledOffset.x()) != 0) {
// we have no centralized knowledge of the maximum brush size!
const qreal maxBrushSize = 1000.0;
const qreal effectiveMaxDragSize = 0.5 * screenRect.width();
const qreal effectiveMaxBrushSize = qMin(maxBrushSize, effectiveMaxDragSize / scaleX);
const qreal scaleCoeff = effectiveMaxBrushSize / effectiveMaxDragSize;
const qreal sizeDiff = scaleCoeff * offset.x() ;
if (qAbs(sizeDiff) > 0.01) {
KisPaintOpSettingsSP settings = currentPaintOpPreset()->settings();
const qreal newSize = settings->paintOpSize() + scaledOffset.x();
const qreal newSize = qBound(0.01, m_lastPaintOpSize + sizeDiff, maxBrushSize);
settings->setPaintOpSize(newSize);
requestUpdateOutline(m_initialGestureDocPoint, 0);
m_lastDocumentPoint = event->point;
m_lastPaintOpSize = newSize;
}
}
......
......@@ -124,6 +124,7 @@ private:
QPointF m_initialGestureDocPoint;
QPointF m_lastDocumentPoint;
qreal m_lastPaintOpSize;
QPoint m_initialGestureGlobalPoint;
bool m_paintopBasedPickingInAction;
......
......@@ -680,7 +680,6 @@ void KisToolFreehandHelper::stabilizerPollAndPaint()
m_d->stabilizerDeque.dequeue();
m_d->stabilizerDeque.enqueue(sampledInfo);
emit requestExplicitUpdateOutline();
} else if (m_d->stabilizerDeque.head().pos() != m_d->previousPaintInformation.pos()) {
......@@ -699,21 +698,17 @@ void KisToolFreehandHelper::stabilizerPollAndPaint()
void KisToolFreehandHelper::stabilizerEnd()
{
// FIXME: Ugly hack, this is no a "distance" in any way
int sampleSize = m_d->smoothingOptions->smoothnessDistance();
assert(sampleSize > 0);
// Stop the timer
m_d->stabilizerPollTimer.stop();
// Finish the line
for (int i = sampleSize; i > 0; i--) {
if (m_d->smoothingOptions->finishStabilizedCurve()) {
// In each iteration we add the latest paint info and delete the oldest
// After `sampleSize` iterations the deque will be filled with the latest
// value and we will have reached the end point.
if (m_d->smoothingOptions->finishStabilizedCurve()) {
stabilizerPollAndPaint();
}
m_d->stabilizedSampler.addFinishingEvent(m_d->stabilizerDeque.size());
stabilizerPollAndPaint();
}
}
......
......@@ -272,13 +272,17 @@ void KisPainterBasedStrokeStrategy::cancelStrokeCallback()
KisIndirectPaintingSupport *indirect =
dynamic_cast<KisIndirectPaintingSupport*>(node.data());
if(indirect && indirect->hasTemporaryTarget()) {
delete m_transaction;
deletePainters();
QRegion region = indirect->temporaryTarget()->region();
indirect->setTemporaryTarget(0);
node->setDirty(region);
if (indirect) {
KisPaintDeviceSP t = indirect->temporaryTarget();
if (t) {
delete m_transaction;
deletePainters();
QRegion region = t->region();
indirect->setTemporaryTarget(0);
node->setDirty(region);
}
} else {
m_transaction->revert();
delete m_transaction;
......
......@@ -34,7 +34,7 @@ const QVector<char> opLevel2 = {'*', '/'};
const QStringList supportedFuncs = {"", "cos", "sin", "tan", "acos", "asin", "atan", "exp", "ln", "log10", "abs"};
const QRegExp funcExpr("(-)?([a-zA-Z]*)?\\((.+)\\)");
const QRegExp funcExpr("(-)?([a-zA-Z]*[0-9]*)?\\((.+)\\)");
const QRegExp numberExpr("(-)?([0-9]+\\.?[0-9]*(e[0-9]*)?)");
const QRegExp funcExprInteger("(-)?\\((.+)\\)");
......
......@@ -52,7 +52,10 @@ void KisSimpleMathParserTest::testDoubleComputation()
"cos(1)^3.0*2",
"cos(1)*2 + sin(3)/2",
"cos(acos(-1)+1*3^2.0)*2 + sin(3)/2",
"cos(acos(-1)+1*3^2.0)^2 + sin(3)/2"};
"cos(acos(-1)+1*3^2.0)^2 + sin(3)/2",
"log10(100)",
"exp(10)",
"ln(10)"};
QVector<double> expected = {1,
2 + 3.4,
......@@ -75,7 +78,10 @@ void KisSimpleMathParserTest::testDoubleComputation()
qPow(qCos(1.0/180*qAcos(-1)),3.0)*2,
qCos(1.0/180*qAcos(-1))*2 + qSin(3.0/180*qAcos(-1))/2,
qCos((qAcos(-1.0)*180/qAcos(-1)+1*qPow(3,2.0))/180*qAcos(-1))*2 + qSin(3.0/180*qAcos(-1))/2,
qPow(qCos((qAcos(-1.0)*180/qAcos(-1)+1*qPow(3,2.0))/180*qAcos(-1)),2) + qSin(3.0/180*qAcos(-1))/2};
qPow(qCos((qAcos(-1.0)*180/qAcos(-1)+1*qPow(3,2.0))/180*qAcos(-1)),2) + qSin(3.0/180*qAcos(-1))/2,
qLn(100)/qLn(10),
qExp(10),
qLn(10)};
for (int i = 0; i < expected.size(); i++) {
......
......@@ -116,8 +116,6 @@ cmake3 --build . --config RelWithDebInfo --target ext_vc
cmake3 --build . --config RelWithDebInfo --target ext_tiff
cmake3 --build . --config RelWithDebInfo --target ext_jpeg
cmake3 --build . --config RelWithDebInfo --target ext_libraw
# XXX: this builds, but cmake3 never manages to find the library
#cmake3 --build . --config RelWithDebInfo --target ext_openjpeg
cmake3 --build . --config RelWithDebInfo --target ext_kcrash
cmake3 --build . --config RelWithDebInfo --target ext_poppler
cmake3 --build . --config RelWithDebInfo --target ext_gsl
......
......@@ -72,7 +72,6 @@ parts:
- libjpeg-dev
- liblcms2-dev
- libopenexr-dev
- libopenjpeg-dev
- libpng12-dev
- libpoppler-qt4-dev
- libtiff5-dev
......
......@@ -14,6 +14,5 @@ cmake --build . --config RelWithDebInfo --target ext_png
cmake --build . --config RelWithDebInfo --target ext_tiff
cmake --build . --config RelWithDebInfo --target ext_vc
cmake --build . --config RelWithDebInfo --target ext_libraw
cmake --build . --config RelWithDebInfo --target ext_openjpeg
cmake --build . --config RelWithDebInfo --target ext_kwindowsystem
cmake --build . --config RelWithDebInfo --target ext_gsl
......@@ -20,7 +20,6 @@ cmake --build . --config RelWithDebInfo --target ext_tiff
cmake --build . --config RelWithDebInfo --target ext_gsl
cmake --build . --config RelWithDebInfo --target ext_vc
cmake --build . --config RelWithDebInfo --target ext_libraw
rem cmake --build . --config RelWithDebInfo --target ext_openjpeg
rem cmake --build . --config RelWithDebInfo --target ext_freetype
cmake --build . --config RelWithDebInfo --target ext_ocio
cmake --build . --config RelWithDebInfo --target ext_openexr
......
......@@ -15,7 +15,7 @@ export PATH=$BUILDROOT/mxe/usr/bin:$BUILDROOT/mxe/usr/x86_64-w64-mingw32.shared/
# Use i686-w64-mingw32.shared for 32 bits builds
# note: vc is 1.2, so we either need zagge's branch, or you need to build Vc 0.75
# yourself. Make sure you use -DBUILD_TESTING=OFF for Vc
make MXE_TARGETS=x86_64-w64-mingw32.shared gcc boost curl eigen exiv2 expat fftw fontconfig freetype gettext ilmbase openexr jpeg lcms libpng libraw opencolorio openjpeg qt5 qtscript tiff vc zlib gsl
make MXE_TARGETS=x86_64-w64-mingw32.shared gcc boost curl eigen exiv2 expat fftw fontconfig freetype gettext ilmbase openexr jpeg lcms libpng libraw opencolorio qt5 qtscript tiff vc zlib gsl
cd $BUILDROOT
git clone git://anongit.kde.org/krita.git
......
......@@ -422,131 +422,103 @@ QVector <double> LcmsColorProfileContainer::getEstimatedTRC() const
void LcmsColorProfileContainer::LinearizeFloatValue(QVector <double> & Value) const
{
QVector <double> TRCtriplet(3);
TRCtriplet[0] = Value[0];
TRCtriplet[1] = Value[1];
TRCtriplet[2] = Value[2];
if (d->hasColorants) {
if (cmsIsToneCurveLinear(d->redTRC)) {
TRCtriplet[0] = Value[0];
} else {
TRCtriplet[0] = cmsEvalToneCurveFloat(d->redTRC, Value[0]);
if (!cmsIsToneCurveLinear(d->redTRC)) {
Value[0] = cmsEvalToneCurveFloat(d->redTRC, Value[0]);
}
if (cmsIsToneCurveLinear(d->greenTRC)) {
TRCtriplet[1] = Value[1];
} else {
TRCtriplet[1] = cmsEvalToneCurveFloat(d->greenTRC, Value[1]);
if (!cmsIsToneCurveLinear(d->greenTRC)) {
Value[1] = cmsEvalToneCurveFloat(d->greenTRC, Value[1]);
}
if (cmsIsToneCurveLinear(d->blueTRC)) {
TRCtriplet[2] = Value[2];
} else {
TRCtriplet[2] = cmsEvalToneCurveFloat(d->blueTRC, Value[2]);
if (!cmsIsToneCurveLinear(d->blueTRC)) {
Value[2] = cmsEvalToneCurveFloat(d->blueTRC, Value[2]);
}
} else {
if (cmsIsTag(d->profile, cmsSigGrayTRCTag)) {
TRCtriplet.fill(cmsEvalToneCurveFloat(d->grayTRC, Value[0]));
Value[0] = cmsEvalToneCurveFloat(d->grayTRC, Value[0]);
}
}
Value[0] = TRCtriplet[0];
Value[1] = TRCtriplet[1];
Value[2] = TRCtriplet[2];
}
void LcmsColorProfileContainer::DelinearizeFloatValue(QVector <double> & Value) const
{
QVector <double> TRCtriplet(3);
TRCtriplet[0] = Value[0];
TRCtriplet[1] = Value[1];
TRCtriplet[2] = Value[2];
if (cmsIsTag(d->profile, cmsSigRedTRCTag)) {
if (cmsIsToneCurveLinear(d->redTRC)) {
TRCtriplet[0] = Value[0];
} else {
TRCtriplet[0] = cmsEvalToneCurveFloat(d->redTRCReverse, Value[0]);
if (d->hasColorants) {
if (!cmsIsToneCurveLinear(d->redTRC)) {
Value[0] = cmsEvalToneCurveFloat(d->redTRCReverse, Value[0]);
}
if (cmsIsToneCurveLinear(d->greenTRC)) {
TRCtriplet[1] = Value[1];
} else {
TRCtriplet[1] = cmsEvalToneCurveFloat(d->greenTRCReverse, Value[1]);
if (!cmsIsToneCurveLinear(d->greenTRC)) {
Value[1] = cmsEvalToneCurveFloat(d->greenTRCReverse, Value[1]);
}
if (cmsIsToneCurveLinear(d->blueTRC)) {
TRCtriplet[2] = Value[2];
} else {
TRCtriplet[2] = cmsEvalToneCurveFloat(d->blueTRCReverse, Value[2]);
if (!cmsIsToneCurveLinear(d->blueTRC)) {
Value[2] = cmsEvalToneCurveFloat(d->blueTRCReverse, Value[2]);
}
} else {
if (cmsIsTag(d->profile, cmsSigGrayTRCTag)) {
TRCtriplet.fill(cmsEvalToneCurveFloat(d->grayTRCReverse, Value[0]));
Value[0] = cmsEvalToneCurveFloat(d->grayTRCReverse, Value[0]);
}
}
Value[0] = TRCtriplet[0];
Value[1] = TRCtriplet[1];
Value[2] = TRCtriplet[2];
}
void LcmsColorProfileContainer::LinearizeFloatValueFast(QVector <double> & Value) const
{
//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.
QVector <quint16> TRCtriplet(3);
TRCtriplet[0] = Value[0]*65535;
TRCtriplet[1] = Value[1]*65535;
TRCtriplet[2] = Value[2]*65535;
const qreal scale = 65535.0;
const qreal invScale = 1.0 / scale;
if (d->hasColorants) {
//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.
QVector <quint16> TRCtriplet(3);
TRCtriplet[0] = Value[0] * scale;
TRCtriplet[1] = Value[1] * scale;
TRCtriplet[2] = Value[2] * scale;
if (!cmsIsToneCurveLinear(d->redTRC) && Value[0]<1.0) {
TRCtriplet[0] = cmsEvalToneCurve16(d->redTRC, TRCtriplet[0]);
Value[0] = TRCtriplet[0]/65535.0;
Value[0] = TRCtriplet[0] * invScale;
}
if (!cmsIsToneCurveLinear(d->greenTRC) && Value[1]<1.0) {
TRCtriplet[1] = cmsEvalToneCurve16(d->greenTRC, TRCtriplet[1]);
Value[1] = TRCtriplet[1]/65535.0;
Value[1] = TRCtriplet[1] * invScale;
}
if (!cmsIsToneCurveLinear(d->blueTRC) && Value[2]<1.0) {
TRCtriplet[2] = cmsEvalToneCurve16(d->blueTRC, TRCtriplet[2]);
Value[2] = TRCtriplet[2]/65535.0;
Value[2] = TRCtriplet[2] * invScale;
}
} else {
if (cmsIsTag(d->profile, cmsSigGrayTRCTag) && Value[0]<1.0) {
TRCtriplet[0] = (cmsEvalToneCurve16(d->grayTRC, Value[0]*65535));
Value.fill(TRCtriplet[0]/65535.0);
quint16 newValue = cmsEvalToneCurve16(d->grayTRC, Value[0] * scale);
Value[0] = newValue * invScale;
}
}
}
void LcmsColorProfileContainer::DelinearizeFloatValueFast(QVector <double> & Value) const
{
//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.
QVector <quint16> TRCtriplet(3);
TRCtriplet[0] = Value[0]*65535;
TRCtriplet[1] = Value[1]*65535;
TRCtriplet[2] = Value[2]*65535;
const qreal scale = 65535.0;
const qreal invScale = 1.0 / scale;
if (d->hasColorants) {
//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.
QVector <quint16> TRCtriplet(3);
TRCtriplet[0] = Value[0] * scale;
TRCtriplet[1] = Value[1] * scale;
TRCtriplet[2] = Value[2] * scale;
if (!cmsIsToneCurveLinear(d->redTRC) && Value[0]<1.0) {
TRCtriplet[0] = cmsEvalToneCurve16(d->redTRCReverse, TRCtriplet[0]);
Value[0] = TRCtriplet[0]/65535.0;
Value[0] = TRCtriplet[0] * invScale;
}
if (!cmsIsToneCurveLinear(d->greenTRC) && Value[1]<1.0) {
TRCtriplet[1] = cmsEvalToneCurve16(d->greenTRCReverse, TRCtriplet[1]);
Value[1] = TRCtriplet[1]/65535.0;
Value[1] = TRCtriplet[1] * invScale;
}
if (!cmsIsToneCurveLinear(d->blueTRC) && Value[2]<1.0) {
TRCtriplet[2] = cmsEvalToneCurve16(d->blueTRCReverse, TRCtriplet[2]);
Value[2] = TRCtriplet[2]/65535.0;
Value[2] = TRCtriplet[2] * invScale;
}
} else {
if (cmsIsTag(d->profile, cmsSigGrayTRCTag) && Value[0]<1.0) {
TRCtriplet[0] = (cmsEvalToneCurve16(d->grayTRCReverse, Value[0]*65535));
Value.fill(TRCtriplet[0]/65535.0);
quint16 newValue = cmsEvalToneCurve16(d->grayTRCReverse, Value[0] * scale);
Value[0] = newValue * invScale;
}
}
}
......
......@@ -17,6 +17,9 @@
#include "kis_shade_selector_line_combo_box.h"
#include <QApplication>
#include <QDesktopWidget>
#include <QGridLayout>
#include <QPainter>
......@@ -26,6 +29,8 @@
#include "kis_shade_selector_line_combo_box_popup.h"
#include "kis_color_selector_base_proxy.h"
#include "kis_global.h"
KisShadeSelectorLineComboBox::KisShadeSelectorLineComboBox(QWidget *parent) :
QComboBox(parent),
......@@ -57,10 +62,16 @@ void KisShadeSelectorLineComboBox::hidePopup()
void KisShadeSelectorLineComboBox::showPopup()
{
// only show if this is not the popup
QComboBox::showPopup();
m_popup->move(mapToGlobal(QPoint(0,-300)));
m_popup->show();
const int widgetMargin = 20;
const QRect fitRect = kisGrowRect(QApplication::desktop()->screenGeometry(), -widgetMargin);
QRect popupRect = m_popup->rect();
popupRect.moveTo(mapToGlobal(QPoint()));
popupRect = kisEnsureInRect(popupRect, fitRect);
m_popup->move(popupRect.topLeft());
m_popup->setConfiguration(m_currentLine->toString());
}
......
......@@ -19,7 +19,6 @@
#ifndef __KIS_WAVELET_KERNEL_H
#define __KIS_WAVELET_KERNEL_H
#include "kritaimage_export.h"
#include "kis_types.h"
#include <Eigen/Core>
......@@ -27,7 +26,7 @@ using namespace Eigen;
class QRect;
class KRITAIMAGE_EXPORT KisWaveletKernel
class KisWaveletKernel
{
public:
static Matrix<qreal, Dynamic, Dynamic>
......
......@@ -22,6 +22,8 @@
#include <QFile>
#include <KisImportExportManager.h>
#include <kis_file_name_requester.h>
#include "kis_aspect_ratio_locker.h"
#include "kis_signals_blocker.h"
#include "ui_wdgsprayshapeoptions.h"
......@@ -37,7 +39,8 @@ public:
};
KisSprayShapeOption::KisSprayShapeOption()
: KisPaintOpOption(KisPaintOpOption::GENERAL, true)
: KisPaintOpOption(KisPaintOpOption::GENERAL, true),
m_sizeRatioLocker(new KisAspectRatioLocker(this))
{
setObjectName("KisSprayShapeOption");
......@@ -47,9 +50,6 @@ KisSprayShapeOption::KisSprayShapeOption()
m_maxSize = 1000;
m_options = new KisShapeOptionsWidget();
m_useAspect = m_options->aspectButton->keepAspectRatio();
computeAspect();