2017-01-09 16:55:03 +00:00
|
|
|
//
|
|
|
|
// Copyright (C) 2017 James Turner zakalawe@mac.com
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License as
|
|
|
|
// published by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful, but
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
// General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
#include "fgcanvaselement.h"
|
|
|
|
|
|
|
|
#include "localprop.h"
|
|
|
|
#include "fgcanvaspaintcontext.h"
|
|
|
|
#include "fgcanvasgroup.h"
|
2017-01-09 16:55:03 +00:00
|
|
|
#include "canvasitem.h"
|
2017-11-03 13:56:43 +00:00
|
|
|
#include "canvasconnection.h"
|
2016-12-03 14:14:06 +00:00
|
|
|
|
|
|
|
#include <QDebug>
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QRegularExpression>
|
|
|
|
#include <QRegularExpressionMatch>
|
2017-01-09 16:55:03 +00:00
|
|
|
#include <QMatrix4x4>
|
2016-12-03 14:14:06 +00:00
|
|
|
|
|
|
|
QTransform qTransformFromCanvas(LocalProp* prop)
|
|
|
|
{
|
|
|
|
float m[6] = { 1.0, 0.0, 0.0, 1.0, 0.0, 0.0 }; // identity matrix
|
|
|
|
for (int i =0; i< 6; ++i) {
|
|
|
|
LocalProp* mProp = prop->getOrCreateChildWithNameAndIndex(NameIndexTuple("m", i));
|
|
|
|
if (!mProp->value().isNull()) {
|
|
|
|
m[i] = mProp->value().toFloat();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return QTransform(m[0], m[1], 0.0,
|
|
|
|
m[2], m[3], 0.0,
|
|
|
|
m[4], m[5], 1.0);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FGCanvasElement::isStyleProperty(QByteArray name)
|
|
|
|
{
|
|
|
|
if ((name == "font") || (name == "line-height") || (name == "alignment")
|
2016-12-18 23:52:16 +00:00
|
|
|
|| (name == "character-size") || (name == "fill") || (name == "background"))
|
2016-12-03 14:14:06 +00:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
LocalProp *FGCanvasElement::property() const
|
|
|
|
{
|
|
|
|
return const_cast<LocalProp*>(_propertyRoot);
|
|
|
|
}
|
|
|
|
|
2016-12-22 17:15:50 +00:00
|
|
|
void FGCanvasElement::setHighlighted(bool hilighted)
|
|
|
|
{
|
|
|
|
_highlighted = hilighted;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FGCanvasElement::isHighlighted() const
|
|
|
|
{
|
|
|
|
return _highlighted;
|
|
|
|
}
|
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
CanvasItem *FGCanvasElement::createQuickItem(QQuickItem *parent)
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
CanvasItem *FGCanvasElement::quickItem() const
|
|
|
|
{
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
FGCanvasElement::FGCanvasElement(FGCanvasGroup* pr, LocalProp* prop) :
|
|
|
|
QObject(pr),
|
|
|
|
_propertyRoot(prop),
|
|
|
|
_parent(pr)
|
|
|
|
{
|
|
|
|
connect(prop->getOrCreateWithPath("visible"), &LocalProp::valueChanged,
|
2017-11-03 13:56:43 +00:00
|
|
|
[this](QVariant val) {
|
|
|
|
_visible = val.toBool();
|
|
|
|
requestPolish();
|
|
|
|
});
|
2016-12-03 14:14:06 +00:00
|
|
|
connect(prop, &LocalProp::childAdded, this, &FGCanvasElement::onChildAdded);
|
|
|
|
connect(prop, &LocalProp::childRemoved, this, &FGCanvasElement::onChildRemoved);
|
|
|
|
|
|
|
|
if (pr) {
|
|
|
|
pr->markChildZIndicesDirty();
|
|
|
|
}
|
2017-11-02 17:20:42 +00:00
|
|
|
|
|
|
|
requestPolish();
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
|
|
|
|
2017-11-02 17:20:42 +00:00
|
|
|
|
|
|
|
void FGCanvasElement::requestPolish()
|
|
|
|
{
|
|
|
|
_polishRequired = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::polish()
|
2016-12-03 14:14:06 +00:00
|
|
|
{
|
2017-11-03 13:56:43 +00:00
|
|
|
bool vis = isVisible();
|
|
|
|
auto qq = quickItem();
|
|
|
|
if (qq && (qq->isVisible() != vis)) {
|
|
|
|
qq->setVisible(vis);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!vis) {
|
2016-12-03 14:14:06 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-12-18 23:52:16 +00:00
|
|
|
if (_clipDirty) {
|
|
|
|
_clipDirty = false;
|
2017-11-07 15:20:42 +00:00
|
|
|
if (qq) {
|
|
|
|
if (_hasClip) {
|
|
|
|
qq->setGlobalClip(_clipRect);
|
|
|
|
} else {
|
|
|
|
qq->clearClip();
|
|
|
|
}
|
|
|
|
}
|
2016-12-18 23:52:16 +00:00
|
|
|
}
|
|
|
|
|
2017-11-03 13:56:43 +00:00
|
|
|
if (qq) {
|
|
|
|
qq->setTransform(combinedTransform());
|
2017-11-02 17:20:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (_styleDirty) {
|
|
|
|
_fillColor = parseColorValue(getCascadedStyle("fill"));
|
|
|
|
_styleDirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
doPolish();
|
|
|
|
_polishRequired = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::paint(FGCanvasPaintContext *context) const
|
|
|
|
{
|
|
|
|
if (!isVisible()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
QPainter* p = context->painter();
|
2016-12-18 23:52:16 +00:00
|
|
|
p->save();
|
2016-12-22 16:59:48 +00:00
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
|
|
|
|
if (_hasClip)
|
|
|
|
{
|
2017-04-24 11:24:58 +00:00
|
|
|
// clip is defined in the global coordinate system
|
2017-02-17 05:38:40 +00:00
|
|
|
#if 0
|
2016-12-22 16:59:48 +00:00
|
|
|
p->save();
|
2017-01-09 16:55:03 +00:00
|
|
|
p->setTransform(context->globalCoordinateTransform());
|
2016-12-22 16:59:48 +00:00
|
|
|
p->setPen(Qt::yellow);
|
|
|
|
p->setBrush(QBrush(Qt::yellow, Qt::DiagCrossPattern));
|
|
|
|
p->drawRect(_clipRect);
|
|
|
|
p->restore();
|
|
|
|
#endif
|
2017-01-09 16:55:03 +00:00
|
|
|
|
|
|
|
QTransform t = p->transform();
|
|
|
|
p->setTransform(context->globalCoordinateTransform());
|
|
|
|
p->setClipRect(_clipRect);
|
|
|
|
p->setClipping(true);
|
|
|
|
p->setTransform(t);
|
2016-12-22 16:59:48 +00:00
|
|
|
}
|
|
|
|
|
2017-01-09 16:55:03 +00:00
|
|
|
QTransform combined = combinedTransform();
|
|
|
|
p->setTransform(combined, true /* combine */);
|
2016-12-03 14:14:06 +00:00
|
|
|
|
|
|
|
if (!_fillColor.isValid()) {
|
2016-12-18 23:52:16 +00:00
|
|
|
p->setBrush(Qt::NoBrush);
|
2016-12-03 14:14:06 +00:00
|
|
|
} else {
|
2016-12-18 23:52:16 +00:00
|
|
|
p->setBrush(_fillColor);
|
|
|
|
}
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
doPaint(context);
|
|
|
|
|
2016-12-18 23:52:16 +00:00
|
|
|
if (_hasClip) {
|
|
|
|
p->setClipping(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
p->restore();
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::doPaint(FGCanvasPaintContext* context) const
|
|
|
|
{
|
|
|
|
Q_UNUSED(context);
|
|
|
|
}
|
|
|
|
|
2017-11-02 17:20:42 +00:00
|
|
|
void FGCanvasElement::doPolish()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
QTransform FGCanvasElement::combinedTransform() const
|
|
|
|
{
|
|
|
|
if (_transformsDirty) {
|
|
|
|
_combinedTransform.reset();
|
|
|
|
|
|
|
|
for (LocalProp* tfProp : _propertyRoot->childrenWithName("tf")) {
|
|
|
|
_combinedTransform *= qTransformFromCanvas(tfProp);
|
|
|
|
}
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
QPointF offset(_propertyRoot->value("center-offset-x", 0.0).toFloat(),
|
|
|
|
_propertyRoot->value("center-offset-y", 0.0).toFloat());
|
|
|
|
|
|
|
|
_combinedTransform.translate(offset.x(), offset.y());
|
|
|
|
#endif
|
|
|
|
_transformsDirty = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
return _combinedTransform;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FGCanvasElement::isVisible() const
|
|
|
|
{
|
|
|
|
return _visible;
|
|
|
|
}
|
|
|
|
|
|
|
|
int FGCanvasElement::zIndex() const
|
|
|
|
{
|
|
|
|
return _zIndex;
|
|
|
|
}
|
|
|
|
|
|
|
|
const FGCanvasGroup *FGCanvasElement::parentGroup() const
|
|
|
|
{
|
|
|
|
return _parent;
|
|
|
|
}
|
|
|
|
|
2017-11-03 13:56:43 +00:00
|
|
|
CanvasConnection *FGCanvasElement::connection() const
|
|
|
|
{
|
|
|
|
if (_parent)
|
|
|
|
return _parent->connection();
|
|
|
|
return qobject_cast<CanvasConnection*>(parent());
|
|
|
|
}
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
bool FGCanvasElement::onChildAdded(LocalProp *prop)
|
|
|
|
{
|
|
|
|
const QByteArray nm = prop->name();
|
|
|
|
if (nm == "tf") {
|
|
|
|
connect(prop, &LocalProp::childAdded, this, &FGCanvasElement::onChildAdded);
|
|
|
|
return true;
|
|
|
|
} else if (nm == "visible") {
|
|
|
|
return true;
|
|
|
|
} else if (nm == "tf-rot-index") {
|
2017-11-04 10:47:14 +00:00
|
|
|
// ignored, this is noise from the Nasal SVG parser
|
2016-12-03 14:14:06 +00:00
|
|
|
return true;
|
|
|
|
} else if (nm.startsWith("center-offset-")) {
|
2017-11-04 10:47:14 +00:00
|
|
|
// ignored, this is noise from the Nasal SVG parser
|
2016-12-03 14:14:06 +00:00
|
|
|
return true;
|
|
|
|
} else if (nm == "center") {
|
|
|
|
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::onCenterChanged);
|
|
|
|
return true;
|
|
|
|
} else if (nm == "m") {
|
|
|
|
if ((prop->parent()->name() == "tf") && (prop->parent()->parent() == _propertyRoot)) {
|
|
|
|
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::markTransformsDirty);
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
qWarning() << "saw confusing 'm' property" << prop->path();
|
|
|
|
}
|
|
|
|
} else if (nm == "m-geo") {
|
|
|
|
// ignore for now, we do geo projection server-side
|
|
|
|
return true;
|
|
|
|
} else if (nm == "id") {
|
|
|
|
connect(prop, &LocalProp::valueChanged, [this](QVariant value) { _svgElementId = value.toByteArray(); });
|
|
|
|
return true;
|
|
|
|
} else if (prop->name() == "update") {
|
|
|
|
// disable updates optionally?
|
|
|
|
return true;
|
2016-12-18 23:52:16 +00:00
|
|
|
} else if (nm == "clip") {
|
|
|
|
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::markClipDirty);
|
|
|
|
return true;
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (isStyleProperty(nm)) {
|
|
|
|
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::markStyleDirty);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (prop->name() == "layer-type") {
|
|
|
|
connect(prop, &LocalProp::valueChanged, [this](QVariant value)
|
|
|
|
{qDebug() << "layer-type:" << value.toByteArray() << "on" << _propertyRoot->path(); });
|
|
|
|
return true;
|
|
|
|
} else if (prop->name() == "z-index") {
|
|
|
|
connect(prop, &LocalProp::valueChanged, this, &FGCanvasElement::markZIndexDirty);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool FGCanvasElement::onChildRemoved(LocalProp *prop)
|
|
|
|
{
|
|
|
|
const QByteArray nm = prop->name();
|
|
|
|
if ((nm == "tf") || (nm == "m")) {
|
|
|
|
markTransformsDirty();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
QColor FGCanvasElement::fillColor() const
|
|
|
|
{
|
|
|
|
return _fillColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::onCenterChanged(QVariant value)
|
|
|
|
{
|
|
|
|
LocalProp* senderProp = static_cast<LocalProp*>(sender());
|
|
|
|
int centerTerm = senderProp->index();
|
|
|
|
|
|
|
|
if (centerTerm == 0) {
|
|
|
|
_center.setX(value.toFloat());
|
|
|
|
} else {
|
|
|
|
_center.setY(value.toFloat());
|
|
|
|
}
|
2017-11-02 17:20:42 +00:00
|
|
|
|
|
|
|
requestPolish();
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::markTransformsDirty()
|
|
|
|
{
|
|
|
|
_transformsDirty = true;
|
2017-11-02 17:20:42 +00:00
|
|
|
requestPolish();
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
|
|
|
|
2016-12-18 23:52:16 +00:00
|
|
|
void FGCanvasElement::markClipDirty()
|
|
|
|
{
|
|
|
|
_clipDirty = true;
|
2017-11-07 15:20:42 +00:00
|
|
|
parseCSSClip(_propertyRoot->value("clip", QVariant()).toByteArray());
|
2017-11-02 17:20:42 +00:00
|
|
|
requestPolish();
|
2016-12-18 23:52:16 +00:00
|
|
|
}
|
|
|
|
|
2016-12-22 16:59:48 +00:00
|
|
|
float FGCanvasElement::parseCSSValue(QByteArray value) const
|
|
|
|
{
|
|
|
|
value = value.trimmed();
|
|
|
|
// deal with %, px suffixes
|
|
|
|
if (value.indexOf('%') >= 0) {
|
|
|
|
qWarning() << Q_FUNC_INFO << "extend parsing to deal with:" << value;
|
|
|
|
}
|
|
|
|
if (value.endsWith("px")) {
|
|
|
|
value.truncate(value.length() - 2);
|
|
|
|
}
|
|
|
|
bool ok = false;
|
|
|
|
float v = value.toFloat(&ok);
|
|
|
|
if (!ok) {
|
|
|
|
qWarning() << "failed to parse:" << value;
|
|
|
|
}
|
|
|
|
return v;
|
|
|
|
}
|
|
|
|
|
2016-12-03 14:14:06 +00:00
|
|
|
QColor FGCanvasElement::parseColorValue(QVariant value) const
|
|
|
|
{
|
|
|
|
QString colorString = value.toString();
|
|
|
|
if (colorString.isEmpty() || colorString == "none") {
|
|
|
|
return QColor(); // return an invalid color
|
|
|
|
}
|
|
|
|
|
|
|
|
int alpha = 255;
|
|
|
|
int red = 0;
|
|
|
|
int green = 0;
|
|
|
|
int blue = 0;
|
|
|
|
bool good = false;
|
|
|
|
|
|
|
|
if (colorString.startsWith('#')) {
|
|
|
|
// web style
|
|
|
|
if (colorString.length() == 9) {
|
|
|
|
QRegularExpression re("#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})");
|
|
|
|
QRegularExpressionMatch match = re.match(colorString);
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
red = match.captured(1).toInt(nullptr, 16);
|
|
|
|
green = match.captured(2).toInt(nullptr, 16);
|
|
|
|
blue = match.captured(3).toInt(nullptr, 16);
|
|
|
|
alpha = match.captured(4).toInt(nullptr, 16);
|
|
|
|
good = true;
|
|
|
|
}
|
|
|
|
} else if (colorString.length() == 7) {
|
|
|
|
// long form, RGB
|
|
|
|
QRegularExpression re("#([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})");
|
|
|
|
QRegularExpressionMatch match = re.match(colorString);
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
red = match.captured(1).toInt(nullptr, 16);
|
|
|
|
green = match.captured(2).toInt(nullptr, 16);
|
|
|
|
blue = match.captured(3).toInt(nullptr, 16);
|
|
|
|
good = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else if (colorString.startsWith("rgb")) {
|
|
|
|
// try rgb(ddd, ddd, ddd) syntax
|
|
|
|
QRegularExpression re("rgb\\((\\d*),(\\d*),(\\d*)\\)");
|
|
|
|
QRegularExpressionMatch match = re.match(value.toString());
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
red = match.captured(1).toInt();
|
|
|
|
green = match.captured(2).toInt();
|
|
|
|
blue = match.captured(3).toInt();
|
|
|
|
good = true;
|
|
|
|
}
|
|
|
|
|
|
|
|
QRegularExpression re2("rgba\\((\\d*),(\\d*),(\\d*),(\\d*)\\)");
|
|
|
|
match = re2.match(value.toString());
|
|
|
|
if (match.hasMatch()) {
|
|
|
|
red = match.captured(1).toInt();
|
|
|
|
green = match.captured(2).toInt();
|
|
|
|
blue = match.captured(3).toInt();
|
|
|
|
alpha = match.captured(4).toInt() * 255;
|
|
|
|
good = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (good) {
|
|
|
|
return QColor(red, green, blue, alpha);
|
|
|
|
}
|
|
|
|
|
|
|
|
qWarning() << _propertyRoot->path() << "failed to parse color:" << colorString;
|
|
|
|
return Qt::magenta; // default horrible colour
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::markStyleDirty()
|
|
|
|
{
|
|
|
|
_styleDirty = true;
|
2017-11-02 17:20:42 +00:00
|
|
|
requestPolish();
|
2016-12-03 14:14:06 +00:00
|
|
|
// group will cascade
|
|
|
|
}
|
|
|
|
|
|
|
|
QVariant FGCanvasElement::getCascadedStyle(const char *name, QVariant defaultValue) const
|
|
|
|
{
|
|
|
|
LocalProp* style = _propertyRoot->childWithNameAndIndex(NameIndexTuple(name, 0));
|
|
|
|
if (style) {
|
|
|
|
return style->value();
|
|
|
|
}
|
|
|
|
|
|
|
|
if (_parent) {
|
|
|
|
return _parent->getCascadedStyle(name);
|
|
|
|
}
|
|
|
|
|
|
|
|
return defaultValue;
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::markZIndexDirty(QVariant value)
|
|
|
|
{
|
|
|
|
_zIndex = value.toInt();
|
|
|
|
_parent->markChildZIndicesDirty();
|
|
|
|
}
|
|
|
|
|
|
|
|
void FGCanvasElement::onVisibleChanged(QVariant value)
|
|
|
|
{
|
|
|
|
_visible = value.toBool();
|
2017-11-02 17:20:42 +00:00
|
|
|
requestPolish();
|
2016-12-03 14:14:06 +00:00
|
|
|
}
|
2016-12-22 16:59:48 +00:00
|
|
|
|
2017-11-02 17:20:42 +00:00
|
|
|
void FGCanvasElement::parseCSSClip(QByteArray value)
|
2016-12-22 16:59:48 +00:00
|
|
|
{
|
|
|
|
if (value.isEmpty()) {
|
|
|
|
_hasClip = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://www.w3.org/wiki/CSS/Properties/clip for the stupid order here
|
|
|
|
if (value.startsWith("rect(")) {
|
|
|
|
int closingParen = value.indexOf(')');
|
|
|
|
value = value.mid(5, closingParen - 5); // trim front portion
|
|
|
|
}
|
|
|
|
|
|
|
|
QByteArrayList clipRectDesc = value.split(',');
|
|
|
|
const int parts = clipRectDesc.size();
|
|
|
|
if (parts != 4) {
|
|
|
|
qWarning() << "implement parsing for non-standard clip" << value;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
const float top = parseCSSValue(clipRectDesc.at(0));
|
|
|
|
const float right = parseCSSValue(clipRectDesc.at(1));
|
|
|
|
const float bottom = parseCSSValue(clipRectDesc.at(2));
|
|
|
|
const float left = parseCSSValue(clipRectDesc.at(3));
|
|
|
|
|
|
|
|
_clipRect = QRectF(left, top, right - left, bottom - top);
|
|
|
|
qDebug() << "final clip rect:" << _clipRect << "from" << value;
|
|
|
|
_hasClip = true;
|
2017-11-02 17:20:42 +00:00
|
|
|
|
|
|
|
requestPolish();
|
2016-12-22 16:59:48 +00:00
|
|
|
}
|