C++ / fmt (pull_request) Failing after 5s
C++ / build (pull_request) Failing after 10s
C++ / clang-tidy (pull_request) Failing after 10s
JS/TS / fmt (pull_request) Successful in 9s
JS/TS / lint (pull_request) Successful in 25s
Python / static (pull_request) Successful in 34s
Rust / build (pull_request) Successful in 51s
Python / verify (pull_request) Failing after 1m25s
Rust / fmt (pull_request) Successful in 39s
Rust / clippy (pull_request) Successful in 59s
105 lines
2.9 KiB
C++
105 lines
2.9 KiB
C++
#include "blobinvertedrect2.hpp"
|
|
#include "blobgroup2.hpp"
|
|
|
|
#include <algorithm>
|
|
|
|
BlobInvertedRect2::BlobInvertedRect2(QQuickItem* parent) : BlobShape2(parent) {}
|
|
|
|
BlobInvertedRect2::~BlobInvertedRect2() {
|
|
if (m_group) m_group->clearInvertedRect(this);
|
|
}
|
|
|
|
void BlobInvertedRect2::setBorderLeft(qreal v) {
|
|
if (qFuzzyCompare(m_borderLeft, v)) return;
|
|
m_borderLeft = v;
|
|
emit borderLeftChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setBorderRight(qreal v) {
|
|
if (qFuzzyCompare(m_borderRight, v)) return;
|
|
m_borderRight = v;
|
|
emit borderRightChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setBorderTop(qreal v) {
|
|
if (qFuzzyCompare(m_borderTop, v)) return;
|
|
m_borderTop = v;
|
|
emit borderTopChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setBorderBottom(qreal v) {
|
|
if (qFuzzyCompare(m_borderBottom, v)) return;
|
|
m_borderBottom = v;
|
|
emit borderBottomChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setOuterRadius(qreal v) {
|
|
if (qFuzzyCompare(m_outerRadius, v)) return;
|
|
m_outerRadius = v;
|
|
emit outerRadiusChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setOuterTopLeftRadius(qreal v) {
|
|
if (qFuzzyCompare(m_outerTopLeftRadius, v)) return;
|
|
m_outerTopLeftRadius = v;
|
|
emit outerTopLeftRadiusChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setOuterTopRightRadius(qreal v) {
|
|
if (qFuzzyCompare(m_outerTopRightRadius, v)) return;
|
|
m_outerTopRightRadius = v;
|
|
emit outerTopRightRadiusChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setOuterBottomLeftRadius(qreal v) {
|
|
if (qFuzzyCompare(m_outerBottomLeftRadius, v)) return;
|
|
m_outerBottomLeftRadius = v;
|
|
emit outerBottomLeftRadiusChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::setOuterBottomRightRadius(qreal v) {
|
|
if (qFuzzyCompare(m_outerBottomRightRadius, v)) return;
|
|
m_outerBottomRightRadius = v;
|
|
emit outerBottomRightRadiusChanged();
|
|
if (m_group) m_group->markDirty();
|
|
}
|
|
|
|
void BlobInvertedRect2::outerCornerRadii(float out[4]) const {
|
|
const auto maxR = static_cast<float>(std::min(width(), height())) * 0.5f;
|
|
const auto base = std::min(static_cast<float>(m_outerRadius), maxR);
|
|
out[0] = std::min(
|
|
m_outerTopRightRadius >= 0 ? static_cast<float>(m_outerTopRightRadius)
|
|
: base,
|
|
maxR);
|
|
out[1] = std::min(
|
|
m_outerBottomRightRadius >= 0
|
|
? static_cast<float>(m_outerBottomRightRadius)
|
|
: base,
|
|
maxR);
|
|
out[2] = std::min(
|
|
m_outerBottomLeftRadius >= 0
|
|
? static_cast<float>(m_outerBottomLeftRadius)
|
|
: base,
|
|
maxR);
|
|
out[3] = std::min(
|
|
m_outerTopLeftRadius >= 0 ? static_cast<float>(m_outerTopLeftRadius)
|
|
: base,
|
|
maxR);
|
|
}
|
|
|
|
void BlobInvertedRect2::registerWithGroup() {
|
|
if (m_group) m_group->setInvertedRect(this);
|
|
}
|
|
|
|
void BlobInvertedRect2::unregisterFromGroup() {
|
|
if (m_group) m_group->clearInvertedRect(this);
|
|
}
|