tests: Remove `qtessellator' autotests
This autotest is not needed anymore since qtessellator was
removed by 78169e6b06
Change-Id: I438e5bf2fd44da73461bb6fc311a6dce5573e467
Reviewed-on: http://codereview.qt.nokia.com/3496
Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
This commit is contained in:
parent
b48e8b2103
commit
17f3451daa
@ -166,7 +166,6 @@ SUBDIRS=\
|
||||
qtableview \
|
||||
qtablewidget \
|
||||
qtcpsocket \
|
||||
qtessellator \
|
||||
qtextblock \
|
||||
qtextcodec \
|
||||
qtextcursor \
|
||||
|
1
tests/auto/qtessellator/.gitignore
vendored
1
tests/auto/qtessellator/.gitignore
vendored
@ -1 +0,0 @@
|
||||
tst_qtessellator
|
@ -1,110 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
/**
|
||||
These are just defines we need to compile this across platforms
|
||||
**/
|
||||
/*
|
||||
*
|
||||
* Copyright © 2000 SuSE, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software and its
|
||||
* documentation for any purpose is hereby granted without fee, provided that
|
||||
* the above copyright notice appear in all copies and that both that
|
||||
* copyright notice and this permission notice appear in supporting
|
||||
* documentation, and that the name of SuSE not be used in advertising or
|
||||
* publicity pertaining to distribution of the software without specific,
|
||||
* written prior permission. SuSE makes no representations about the
|
||||
* suitability of this software for any purpose. It is provided "as is"
|
||||
* without express or implied warranty.
|
||||
*
|
||||
* SuSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL SuSE
|
||||
* BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
||||
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* Author: Keith Packard, SuSE, Inc.
|
||||
*/
|
||||
|
||||
#ifndef _XRENDER_FAKE_H_
|
||||
#define _XRENDER_FAKE_H_
|
||||
|
||||
#ifndef _XRENDER_H_
|
||||
typedef double XDouble;
|
||||
|
||||
typedef struct _XPointDouble {
|
||||
XDouble x, y;
|
||||
} XPointDouble;
|
||||
|
||||
#define XDoubleToFixed(f) ((XFixed) ((f) * 65536))
|
||||
#define XFixedToDouble(f) (((XDouble) (f)) / 65536)
|
||||
|
||||
typedef int XFixed;
|
||||
|
||||
typedef struct _XPointFixed {
|
||||
XFixed x, y;
|
||||
} XPointFixed;
|
||||
|
||||
typedef struct _XLineFixed {
|
||||
XPointFixed p1, p2;
|
||||
} XLineFixed;
|
||||
|
||||
typedef struct _XTriangle {
|
||||
XPointFixed p1, p2, p3;
|
||||
} XTriangle;
|
||||
|
||||
typedef struct _XTrapezoid {
|
||||
XFixed top, bottom;
|
||||
XLineFixed left, right;
|
||||
} XTrapezoid;
|
||||
|
||||
typedef struct _XSpanFix {
|
||||
XFixed left, right, y;
|
||||
} XSpanFix;
|
||||
|
||||
typedef struct _XTrap {
|
||||
XSpanFix top, bottom;
|
||||
} XTrap;
|
||||
|
||||
#endif
|
||||
|
||||
#endif /* _XRENDER_H_ */
|
@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "arc.h"
|
||||
|
||||
#include "dataparser.h"
|
||||
#include <QString>
|
||||
|
||||
FullData arcData()
|
||||
{
|
||||
return parseFile(":/arc.data");
|
||||
}
|
File diff suppressed because one or more lines are too long
@ -1,48 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef ARC_H
|
||||
#define ARC_H
|
||||
|
||||
#include "sample_data.h"
|
||||
|
||||
FullData arcData();
|
||||
|
||||
#endif
|
@ -1,6 +0,0 @@
|
||||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/">
|
||||
<file>simple.data</file>
|
||||
<file>arc.data</file>
|
||||
</qresource>
|
||||
</RCC>
|
@ -1,165 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "dataparser.h"
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include <QtDebug>
|
||||
|
||||
static QList<qreal> parseNumbersList(QByteArray::const_iterator &itr)
|
||||
{
|
||||
QList<qreal> points;
|
||||
QByteArray temp;
|
||||
while ((*itr) == ' ')
|
||||
++itr;
|
||||
while (((*itr) >= '0' && (*itr) <= '9') ||
|
||||
(*itr) == '-' || (*itr) == '+') {
|
||||
temp = QByteArray();
|
||||
|
||||
if ((*itr) == '-')
|
||||
temp += *itr++;
|
||||
else if ((*itr) == '+')
|
||||
temp += *itr++;
|
||||
while ((*itr) >= '0' && (*itr) <= '9')
|
||||
temp += *itr++;
|
||||
if ((*itr) == '.')
|
||||
temp += *itr++;
|
||||
while ((*itr) >= '0' && (*itr) <= '9')
|
||||
temp += *itr++;
|
||||
if (( *itr) == 'e') {
|
||||
temp += *itr++;
|
||||
if ((*itr) == '-' ||
|
||||
(*itr) == '+')
|
||||
temp += *itr++;
|
||||
}
|
||||
while ((*itr) >= '0' && (*itr) <= '9')
|
||||
temp += *itr++;
|
||||
while ((*itr) == ' ')
|
||||
++itr;
|
||||
if ((*itr) == ',')
|
||||
++itr;
|
||||
points.append(temp.toDouble());
|
||||
//eat the rest of space
|
||||
while ((*itr) == ' ')
|
||||
++itr;
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
|
||||
static QList<QPointF> parsePoints(const QByteArray &line)
|
||||
{
|
||||
QList<QPointF> res;
|
||||
|
||||
QByteArray::const_iterator it = line.constBegin();
|
||||
if (*it == ',')
|
||||
++it;
|
||||
|
||||
QList<qreal> nums = parseNumbersList(it);
|
||||
QList<qreal>::const_iterator nitr;
|
||||
for (nitr = nums.begin(); nitr != nums.end(); ++nitr) {
|
||||
qreal x = *nitr;
|
||||
++nitr;
|
||||
if (nitr == nums.end()) {
|
||||
qWarning() << "parsePoints: Even number of co-ordinates required, odd number found: skipping last point";
|
||||
break;
|
||||
}
|
||||
qreal y = *nitr;
|
||||
res.append(QPointF(x, y));
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QList< QVector<QPointF> > parseData(const QByteArray &contents)
|
||||
{
|
||||
QList<QByteArray> lines = contents.split('\n');
|
||||
QList<QByteArray>::const_iterator itr;
|
||||
|
||||
QList< QVector<QPointF> > res;
|
||||
QVector<QPointF> current;
|
||||
|
||||
for (itr = lines.begin(); itr != lines.end(); ++itr) {
|
||||
QByteArray line = (*itr).trimmed();
|
||||
if (line.isEmpty() || line.startsWith('/')) {
|
||||
if (!current.isEmpty()) {
|
||||
res.append(current);
|
||||
current = QVector<QPointF>();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
QList<QPointF> lst = parsePoints(line);
|
||||
current << lst.toVector();
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
QList< QVector<QPointF> > parseFile(const QString &fileName)
|
||||
{
|
||||
QList< QVector<QPointF> > res;
|
||||
QFile file(fileName);
|
||||
|
||||
if (!file.open(QIODevice::ReadOnly)) {
|
||||
qDebug()<<"couldn't open "<<fileName;
|
||||
return res;
|
||||
}
|
||||
|
||||
QVector<QPointF> current;
|
||||
|
||||
while (!file.atEnd()) {
|
||||
QByteArray line = file.readLine().trimmed();
|
||||
if (line.isEmpty() || line.startsWith('/')) {
|
||||
if (!current.isEmpty()) {
|
||||
res.append(current);
|
||||
current = QVector<QPointF>();
|
||||
}
|
||||
continue;
|
||||
} else {
|
||||
QList<QPointF> lst = parsePoints(line);
|
||||
current << lst.toVector();
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef DATAPARSER_H
|
||||
#define DATAPARSER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
|
||||
QList< QVector<QPointF> > parseData(const QByteArray &contents);
|
||||
QList< QVector<QPointF> > parseFile(const QString &fileName);
|
||||
|
||||
#endif
|
@ -1,435 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "oldtessellator.h"
|
||||
#include <QPointF>
|
||||
#include <QVector>
|
||||
#include <QList>
|
||||
#include <QVariant>
|
||||
#include <QVarLengthArray>
|
||||
#include <qdebug.h>
|
||||
|
||||
#include "limits.h"
|
||||
#include "utils.h"
|
||||
|
||||
#include "qnum.h"
|
||||
#include "XrenderFake.h"
|
||||
|
||||
/*
|
||||
* Polygon tesselator - can probably be optimized a bit more
|
||||
*/
|
||||
|
||||
//#define QT_DEBUG_TESSELATOR
|
||||
#define FloatToXFixed(i) (int)((i) * 65536)
|
||||
#define IntToXFixed(i) ((i) << 16)
|
||||
|
||||
//inline int qrealToXFixed(qreal f)
|
||||
//{ return f << 8; }
|
||||
|
||||
struct QEdge {
|
||||
inline QEdge()
|
||||
{}
|
||||
inline QEdge(const QPointF &pt1,
|
||||
const QPointF &pt2)
|
||||
{
|
||||
p1.x = XDoubleToFixed(pt1.x());
|
||||
p1.y = XDoubleToFixed(pt1.y());
|
||||
p2.x = XDoubleToFixed(pt2.x());
|
||||
p2.y = XDoubleToFixed(pt2.y());
|
||||
m = (pt1.x() - pt2.x()) ? (pt1.y() - pt2.y()) / (pt1.x() - pt2.x()) : 0;
|
||||
im = m ? 1/m : 0;
|
||||
b = pt1.y() - m * pt1.x();
|
||||
vertical = p1.x == p2.x;
|
||||
horizontal = p1.y == p2.y;
|
||||
}
|
||||
|
||||
QPointF pf1, pf2;
|
||||
XPointFixed p1, p2;
|
||||
qreal m;
|
||||
qreal im;
|
||||
qreal b;
|
||||
qreal intersection;
|
||||
signed short winding;
|
||||
bool vertical;
|
||||
bool horizontal;
|
||||
};
|
||||
|
||||
struct QVrtx {
|
||||
typedef QList<QEdge> Edges;
|
||||
XPointFixed coords;
|
||||
Edges startingEdges;
|
||||
Edges endingEdges;
|
||||
Edges intersectingEdges;
|
||||
};
|
||||
|
||||
struct QIntersectionPoint {
|
||||
qreal x;
|
||||
const QEdge *edge;
|
||||
};
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_TYPEINFO(QEdge, Q_PRIMITIVE_TYPE);
|
||||
Q_DECLARE_TYPEINFO(QVrtx, Q_PRIMITIVE_TYPE);
|
||||
Q_DECLARE_TYPEINFO(QIntersectionPoint, Q_PRIMITIVE_TYPE);
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
// used by the edge point sort algorithm
|
||||
static qreal currentY = 0.f;
|
||||
|
||||
static inline bool compareEdges(const QEdge *e1, const QEdge *e2)
|
||||
{
|
||||
return e1->p1.y < e2->p1.y;
|
||||
}
|
||||
|
||||
static inline bool isEqual(const XPointFixed &p1, const XPointFixed &p2)
|
||||
{
|
||||
return ((p1.x == p2.x) && (p1.y == p2.y));
|
||||
}
|
||||
|
||||
static inline bool compareIntersections(const QIntersectionPoint &i1, const QIntersectionPoint &i2)
|
||||
{
|
||||
if (qAbs(i1.x - i2.x) > 0.01) { // x != other.x in 99% of the cases
|
||||
return i1.x < i2.x;
|
||||
} else {
|
||||
qreal x1 = (i1.edge->p1.x != i1.edge->p2.x) ?
|
||||
((currentY+1 - i1.edge->b)*i1.edge->m) : XFixedToDouble(i1.edge->p1.x);
|
||||
qreal x2 = (i2.edge->p1.x != i2.edge->p2.x) ?
|
||||
((currentY+1 - i2.edge->b)*i2.edge->m) : XFixedToDouble(i2.edge->p1.x);
|
||||
// qDebug() << ">>>" << currentY << i1.edge << i2.edge << x1 << x2;
|
||||
return x1 < x2;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QT_USE_FIXED_POINT
|
||||
inline int qrealToXFixed(qreal f)
|
||||
{ return f.value() << 8; }
|
||||
#else
|
||||
#define qrealToXFixed FloatToXFixed
|
||||
#endif
|
||||
|
||||
static XTrapezoid QT_FASTCALL toXTrapezoid(XFixed y1, XFixed y2, const QEdge &left, const QEdge &right)
|
||||
{
|
||||
XTrapezoid trap;
|
||||
trap.top = y1;
|
||||
trap.bottom = y2;
|
||||
trap.left.p1.y = left.p1.y;
|
||||
trap.left.p2.y = left.p2.y;
|
||||
trap.right.p1.y = right.p1.y;
|
||||
trap.right.p2.y = right.p2.y;
|
||||
trap.left.p1.x = left.p1.x;
|
||||
trap.left.p2.x = left.p2.x;
|
||||
trap.right.p1.x = right.p1.x;
|
||||
trap.right.p2.x = right.p2.x;
|
||||
return trap;
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG_TESSELATOR
|
||||
static void dump_edges(const QList<const QEdge *> &et)
|
||||
{
|
||||
for (int x = 0; x < et.size(); ++x) {
|
||||
qDebug() << "edge#" << x << et.at(x) << "("
|
||||
<< XFixedToDouble(et.at(x)->p1.x)
|
||||
<< XFixedToDouble(et.at(x)->p1.y)
|
||||
<< ") ("
|
||||
<< XFixedToDouble(et.at(x)->p2.x)
|
||||
<< XFixedToDouble(et.at(x)->p2.y)
|
||||
<< ") b: " << et.at(x)->b << "m:" << et.at(x)->m;
|
||||
}
|
||||
}
|
||||
|
||||
static void dump_trap(const XTrapezoid &t)
|
||||
{
|
||||
qDebug() << "trap# t=" << t.top/65536.0 << "b=" << t.bottom/65536.0 << "h="
|
||||
<< XFixedToDouble(t.bottom - t.top) << "\tleft p1: ("
|
||||
<< XFixedToDouble(t.left.p1.x) << ","<< XFixedToDouble(t.left.p1.y)
|
||||
<< ")" << "\tleft p2: (" << XFixedToDouble(t.left.p2.x) << ","
|
||||
<< XFixedToDouble(t.left.p2.y) << ")" << "\n\t\t\t\tright p1:("
|
||||
<< XFixedToDouble(t.right.p1.x) << "," << XFixedToDouble(t.right.p1.y) << ")"
|
||||
<< "\tright p2:(" << XFixedToDouble(t.right.p2.x) << ","
|
||||
<< XFixedToDouble(t.right.p2.y) << ")";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
typedef int Q27Dot5;
|
||||
#define Q27Dot5ToDouble(i) (i/32.)
|
||||
#define FloatToQ27Dot5(i) (int)((i) * 32)
|
||||
#define IntToQ27Dot5(i) ((i) << 5)
|
||||
#define Q27Dot5ToXFixed(i) ((i) << 11)
|
||||
#define Q27Dot5Factor 32
|
||||
|
||||
void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pgSize,
|
||||
bool winding)
|
||||
{
|
||||
QVector<QEdge> edges;
|
||||
edges.reserve(128);
|
||||
qreal ymin(INT_MAX/256);
|
||||
qreal ymax(INT_MIN/256);
|
||||
|
||||
//painter.begin(pg, pgSize);
|
||||
if (pg[0] != pg[pgSize-1])
|
||||
qWarning() << Q_FUNC_INFO << "Malformed polygon (first and last points must be identical)";
|
||||
// generate edge table
|
||||
// qDebug() << "POINTS:";
|
||||
for (int x = 0; x < pgSize-1; ++x) {
|
||||
QEdge edge;
|
||||
QPointF p1(Q27Dot5ToDouble(FloatToQ27Dot5(pg[x].x())),
|
||||
Q27Dot5ToDouble(FloatToQ27Dot5(pg[x].y())));
|
||||
QPointF p2(Q27Dot5ToDouble(FloatToQ27Dot5(pg[x+1].x())),
|
||||
Q27Dot5ToDouble(FloatToQ27Dot5(pg[x+1].y())));
|
||||
|
||||
// qDebug() << " "
|
||||
// << p1;
|
||||
edge.winding = p1.y() > p2.y() ? 1 : -1;
|
||||
if (edge.winding > 0)
|
||||
qSwap(p1, p2);
|
||||
edge.p1.x = XDoubleToFixed(p1.x());
|
||||
edge.p1.y = XDoubleToFixed(p1.y());
|
||||
edge.p2.x = XDoubleToFixed(p2.x());
|
||||
edge.p2.y = XDoubleToFixed(p2.y());
|
||||
|
||||
edge.m = (p1.y() - p2.y()) / (p1.x() - p2.x()); // line derivative
|
||||
edge.b = p1.y() - edge.m * p1.x(); // intersection with y axis
|
||||
edge.m = edge.m != 0.0 ? 1.0 / edge.m : 0.0; // inverted derivative
|
||||
edges.append(edge);
|
||||
ymin = qMin(ymin, qreal(XFixedToDouble(edge.p1.y)));
|
||||
ymax = qMax(ymax, qreal(XFixedToDouble(edge.p2.y)));
|
||||
}
|
||||
|
||||
QList<const QEdge *> et; // edge list
|
||||
for (int i = 0; i < edges.size(); ++i)
|
||||
et.append(&edges.at(i));
|
||||
|
||||
// sort edge table by min y value
|
||||
qSort(et.begin(), et.end(), compareEdges);
|
||||
|
||||
// eliminate shared edges
|
||||
for (int i = 0; i < et.size(); ++i) {
|
||||
for (int k = i+1; k < et.size(); ++k) {
|
||||
const QEdge *edgeI = et.at(i);
|
||||
const QEdge *edgeK = et.at(k);
|
||||
if (edgeK->p1.y > edgeI->p1.y)
|
||||
break;
|
||||
if (edgeI->winding != edgeK->winding &&
|
||||
isEqual(edgeI->p1, edgeK->p1) && isEqual(edgeI->p2, edgeK->p2)
|
||||
) {
|
||||
et.removeAt(k);
|
||||
et.removeAt(i);
|
||||
--i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ymax <= ymin)
|
||||
return;
|
||||
QList<const QEdge *> aet; // edges that intersects the current scanline
|
||||
|
||||
// if (ymin < 0)
|
||||
// ymin = 0;
|
||||
// if (paintEventClipRegion) // don't scan more lines than we have to
|
||||
// ymax = paintEventClipRegion->boundingRect().height();
|
||||
|
||||
#ifdef QT_DEBUG_TESSELATOR
|
||||
qDebug("==> ymin = %f, ymax = %f", ymin, ymax);
|
||||
#endif // QT_DEBUG_TESSELATOR
|
||||
|
||||
currentY = ymin; // used by the less than op
|
||||
for (qreal y = ymin; y < ymax;) {
|
||||
// fill active edge table with edges that intersect the current line
|
||||
for (int i = 0; i < et.size(); ++i) {
|
||||
const QEdge *edge = et.at(i);
|
||||
if (edge->p1.y > XDoubleToFixed(y))
|
||||
break;
|
||||
aet.append(edge);
|
||||
et.removeAt(i);
|
||||
--i;
|
||||
}
|
||||
|
||||
// remove processed edges from active edge table
|
||||
for (int i = 0; i < aet.size(); ++i) {
|
||||
if (aet.at(i)->p2.y <= XDoubleToFixed(y)) {
|
||||
aet.removeAt(i);
|
||||
--i;
|
||||
}
|
||||
}
|
||||
if (aet.size()%2 != 0) {
|
||||
#ifndef QT_NO_DEBUG
|
||||
qWarning("QX11PaintEngine: aet out of sync - this should not happen.");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
// done?
|
||||
if (!aet.size()) {
|
||||
if (!et.size()) {
|
||||
break;
|
||||
} else {
|
||||
y = currentY = XFixedToDouble(et.at(0)->p1.y);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// calculate the next y where we have to start a new set of trapezoids
|
||||
qreal next_y(INT_MAX/256);
|
||||
for (int i = 0; i < aet.size(); ++i) {
|
||||
const QEdge *edge = aet.at(i);
|
||||
if (XFixedToDouble(edge->p2.y) < next_y)
|
||||
next_y = XFixedToDouble(edge->p2.y);
|
||||
}
|
||||
|
||||
if (et.size() && next_y > XFixedToDouble(et.at(0)->p1.y))
|
||||
next_y = XFixedToDouble(et.at(0)->p1.y);
|
||||
|
||||
int aetSize = aet.size();
|
||||
for (int i = 0; i < aetSize; ++i) {
|
||||
for (int k = i+1; k < aetSize; ++k) {
|
||||
const QEdge *edgeI = aet.at(i);
|
||||
const QEdge *edgeK = aet.at(k);
|
||||
qreal m1 = edgeI->m;
|
||||
qreal b1 = edgeI->b;
|
||||
qreal m2 = edgeK->m;
|
||||
qreal b2 = edgeK->b;
|
||||
|
||||
if (qAbs(m1 - m2) < 0.001)
|
||||
continue;
|
||||
|
||||
// ### intersect is not calculated correctly when optimized with -O2 (gcc)
|
||||
volatile qreal intersect = 0;
|
||||
if (!qIsFinite(b1))
|
||||
intersect = (1.f / m2) * XFixedToDouble(edgeI->p1.x) + b2;
|
||||
else if (!qIsFinite(b2))
|
||||
intersect = (1.f / m1) * XFixedToDouble(edgeK->p1.x) + b1;
|
||||
else
|
||||
intersect = (b1*m1 - b2*m2) / (m1 - m2);
|
||||
|
||||
if (intersect > y && intersect < next_y)
|
||||
next_y = intersect;
|
||||
}
|
||||
}
|
||||
|
||||
XFixed yf, next_yf;
|
||||
yf = qrealToXFixed(y);
|
||||
next_yf = qrealToXFixed(next_y);
|
||||
|
||||
if (yf == next_yf) {
|
||||
y = currentY = next_y;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG_TESSELATOR
|
||||
qDebug("###> y = %f, next_y = %f, %d active edges", y, next_y, aet.size());
|
||||
qDebug("===> edges");
|
||||
dump_edges(et);
|
||||
qDebug("===> active edges");
|
||||
dump_edges(aet);
|
||||
#endif
|
||||
// calc intersection points
|
||||
QVarLengthArray<QIntersectionPoint> isects(aet.size()+1);
|
||||
for (int i = 0; i < isects.size()-1; ++i) {
|
||||
const QEdge *edge = aet.at(i);
|
||||
isects[i].x = (edge->p1.x != edge->p2.x) ?
|
||||
((y - edge->b)*edge->m) : XFixedToDouble(edge->p1.x);
|
||||
isects[i].edge = edge;
|
||||
}
|
||||
|
||||
if (isects.size()%2 != 1)
|
||||
qFatal("%s: number of intersection points must be odd", Q_FUNC_INFO);
|
||||
|
||||
// sort intersection points
|
||||
qSort(&isects[0], &isects[isects.size()-1], compareIntersections);
|
||||
// qDebug() << "INTERSECTION_POINTS:";
|
||||
// for (int i = 0; i < isects.size(); ++i)
|
||||
// qDebug() << isects[i].edge << isects[i].x;
|
||||
|
||||
if (winding) {
|
||||
// winding fill rule
|
||||
for (int i = 0; i < isects.size()-1;) {
|
||||
int winding = 0;
|
||||
const QEdge *left = isects[i].edge;
|
||||
const QEdge *right = 0;
|
||||
winding += isects[i].edge->winding;
|
||||
for (++i; i < isects.size()-1 && winding != 0; ++i) {
|
||||
winding += isects[i].edge->winding;
|
||||
right = isects[i].edge;
|
||||
}
|
||||
if (!left || !right)
|
||||
break;
|
||||
//painter.addTrapezoid(&toXTrapezoid(yf, next_yf, *left, *right));
|
||||
traps->append(toXTrapezoid(yf, next_yf, *left, *right));
|
||||
}
|
||||
} else {
|
||||
// odd-even fill rule
|
||||
for (int i = 0; i < isects.size()-2; i += 2) {
|
||||
//painter.addTrapezoid(&toXTrapezoid(yf, next_yf, *isects[i].edge, *isects[i+1].edge));
|
||||
traps->append(toXTrapezoid(yf, next_yf, *isects[i].edge, *isects[i+1].edge));
|
||||
}
|
||||
}
|
||||
y = currentY = next_y;
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG_TESSELATOR
|
||||
qDebug("==> number of trapezoids: %d - edge table size: %d\n", traps->size(), et.size());
|
||||
|
||||
for (int i = 0; i < traps->size(); ++i)
|
||||
dump_trap(traps->at(i));
|
||||
#endif
|
||||
|
||||
// optimize by unifying trapezoids that share left/right lines
|
||||
// and have a common top/bottom edge
|
||||
// for (int i = 0; i < tps.size(); ++i) {
|
||||
// for (int k = i+1; k < tps.size(); ++k) {
|
||||
// if (i != k && tps.at(i).right == tps.at(k).right
|
||||
// && tps.at(i).left == tps.at(k).left
|
||||
// && (tps.at(i).top == tps.at(k).bottom
|
||||
// || tps.at(i).bottom == tps.at(k).top))
|
||||
// {
|
||||
// tps[i].bottom = tps.at(k).bottom;
|
||||
// tps.removeAt(k);
|
||||
// i = 0;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//static int i = 0;
|
||||
//QImage img = painter.end();
|
||||
//img.save(QString("res%1.png").arg(i++), "PNG");
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef NEWTESSELATOR_H
|
||||
#define NEWTESSELATOR_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
#include "XrenderFake.h"
|
||||
|
||||
void old_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *pg, int pgSize,
|
||||
bool winding);
|
||||
|
||||
|
||||
#endif
|
@ -1,145 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef QNUM_H
|
||||
#define QNUM_H
|
||||
|
||||
//
|
||||
// W A R N I N G
|
||||
// -------------
|
||||
//
|
||||
// This file is not part of the Qt API. It exists purely as an
|
||||
// implementation detail. This header file may change from version to
|
||||
// version without notice, or even be removed.
|
||||
//
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "QtCore/qglobal.h"
|
||||
|
||||
static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 };
|
||||
static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f };
|
||||
static inline double qtInf()
|
||||
{
|
||||
return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes : qt_le_inf_bytes);
|
||||
}
|
||||
#define Q_INFINITY (::qtInf())
|
||||
|
||||
// Signaling NAN
|
||||
static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 };
|
||||
static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f };
|
||||
static inline double qtSnan()
|
||||
{
|
||||
return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes);
|
||||
}
|
||||
#define Q_SNAN (::qtSnan())
|
||||
|
||||
// Quiet NAN
|
||||
static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 };
|
||||
static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff };
|
||||
static inline double qtQnan()
|
||||
{
|
||||
return *reinterpret_cast<const double *>(QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes : qt_le_qnan_bytes);
|
||||
}
|
||||
#define Q_QNAN (::qtQnan())
|
||||
|
||||
static inline bool qIsInf(double d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0;
|
||||
} else {
|
||||
return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool qIsNaN(double d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0;
|
||||
} else {
|
||||
return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool qIsFinite(double d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0;
|
||||
} else {
|
||||
return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool qIsInf(float d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) == 0x7f && ch[1] == 0x80;
|
||||
} else {
|
||||
return (ch[3] & 0x7f) == 0x7f && ch[2] == 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool qIsNaN(float d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) == 0x7f && ch[1] > 0x80;
|
||||
} else {
|
||||
return (ch[3] & 0x7f) == 0x7f && ch[2] > 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool qIsFinite(float d)
|
||||
{
|
||||
uchar *ch = (uchar *)&d;
|
||||
if (QSysInfo::ByteOrder == QSysInfo::BigEndian) {
|
||||
return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0x80) != 0x80;
|
||||
} else {
|
||||
return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0x80) != 0x80;
|
||||
}
|
||||
}
|
||||
|
||||
#endif // QNUMERIC_P_H
|
@ -1,10 +0,0 @@
|
||||
load(qttest_p4)
|
||||
|
||||
QT += gui-private
|
||||
|
||||
SOURCES += tst_tessellator.cpp testtessellator.cpp oldtessellator.cpp utils.cpp simple.cpp dataparser.cpp arc.cpp
|
||||
HEADERS += oldtessellator.h testtessellator.h utils.h XRenderFake.h simple.h qnum.h dataparser.h arc.h
|
||||
|
||||
RESOURCES += datafiles.qrc
|
||||
|
||||
|
@ -1,51 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef SAMPLE_DATA_H
|
||||
#define SAMPLE_DATA_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
#include <QList>
|
||||
|
||||
typedef QVector<QPointF> SampleData;
|
||||
typedef QList< SampleData > FullData;
|
||||
|
||||
#endif
|
@ -1,49 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "simple.h"
|
||||
|
||||
#include "dataparser.h"
|
||||
#include <QString>
|
||||
|
||||
FullData simpleData()
|
||||
{
|
||||
return parseFile(":/simple.data");
|
||||
}
|
@ -1,195 +0,0 @@
|
||||
16.000000,6.000000, 16.000000,18.000000, 16.000000,1.000000, 16.000000,14.000000, 10.000000,17.000000, 16.000000,6.000000,
|
||||
|
||||
10,10,16,18,18,14,21,18,25,18,25,11,15,7,15,12,13,12,10,10
|
||||
|
||||
10,10,20,10,20,20,10,20,10,10
|
||||
|
||||
0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0
|
||||
|
||||
0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0,0,0,0,10,12,10,12,0,0,0,4,2,4,6,10,6,10,2,4,2,0,0
|
||||
|
||||
10,11,22,10,12,4,16,14,20,4,10,11
|
||||
|
||||
10,11,22,10,12,4,16,14,20,4,10,11,10,11,22,10,12,4,16,14,20,4,10,11
|
||||
|
||||
0,0,10,10,10,0,0,10,0,0
|
||||
|
||||
0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15
|
||||
|
||||
0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15,0,15,15,15,15,0,5,0,5,20,10,20,10,5,0,5,0,15
|
||||
|
||||
0,10,10,10,10,0,0,0,10,10,0,10,10,0,10,5,0,5,5,0,5,10,0,10
|
||||
|
||||
10,16,19,8,8,8,4,4,17,14,1,1,10,16
|
||||
|
||||
19,1,13,4,15,19,5,4,8,15,15,7,0,7,15,8,9,1,19,1
|
||||
|
||||
15,9,18,3,14,11,4,12,10,14,7,16,15,9
|
||||
|
||||
16,10,4,14,12,15,17,10,14,19,13,11,16,10
|
||||
|
||||
5,19,12,8,12,12,7,19,9,14,3,18,5,19
|
||||
|
||||
3,14,11,2,1,15,3,13,10,3,15,11,3,14
|
||||
|
||||
8,6,8,1,12,2,0,4,4,15,10,9,8,6
|
||||
|
||||
15,16,0,3,16,16,19,5,10,9,15,4,15,16
|
||||
|
||||
3,19,17,14,9,8,16,6,16,7,17,6,3,19
|
||||
|
||||
0,13,0,4,5,5,7,10,4,10,0,8,0,13
|
||||
|
||||
4,18,5,17,19,2,0,4,8,8,10,12,4,18
|
||||
|
||||
13,12,15,19,11,5,0,14,19,15,11,11,13,12
|
||||
|
||||
7,11,18,8,9,7,17,7,3,7,12,1,7,11
|
||||
|
||||
10,10,7,8,13,14,7,9,8,9,6,17,10,10
|
||||
|
||||
13,16,7,13,19,5,8,18,1,11,7,6,13,16
|
||||
|
||||
9,6,16,11,7,10,14,12,17,2,15,13,9,6
|
||||
|
||||
9,11,17,17,2,14,19,15,1 12,16,15,9,11
|
||||
|
||||
1,8,7,17,0,19,12,7,5,14,13,6,1,8
|
||||
|
||||
11,7,13,6,8,6,7,11,7,16,13,6,11,7
|
||||
|
||||
1,1,18,1,1,14,2,14,14,3,18,1,1,1
|
||||
|
||||
1495,174,1965,1194,622,795,1892,1044,1618,1608,1464,1758,1495,174
|
||||
|
||||
12.437167782336,18.332947529852,6.037403680384,0.577168781310,17.369421254843,3.538437001407,1.208027666435,3.512877216563,6.647234912962,10.036138510332,13.422909136862,2.474576039240,12.437167782336,18.332947529852
|
||||
|
||||
5.591339580715,19.434930747375, 10.417904593050,11.852347580716, 18.050480354577,3.041639151052, 5.511732324958,17.206167224795, 4.091005269438,17.285228203982, 14.422692870721,17.285191211849, 5.591339580715,19.434930747375
|
||||
|
||||
9.662125930190,13.671313980594, 18.663120605052,13.914435822517, 4.666417893022,0.991358347237, 5.612019170076,9.671168159693, 14.484839309007,1.828807275742, 14.513027202338,18.705772804096, 9.662125930190,13.671313980594
|
||||
|
||||
85,54,64,169,73,28,77,104,122,113,7,90,85,54
|
||||
|
||||
8,9,13,2,16,8,6,16,15,18,18,1,8,9
|
||||
|
||||
1,19,1,19,16,4,12,4,17,10,9,18,1,19
|
||||
|
||||
7,5,4,1,17,16,4,1,18,9,19,18,7,5
|
||||
|
||||
5,2,10,7,2,15,10,7,19,7,4,18,5,2
|
||||
|
||||
193.344000,167.079000,193.927000,223.478000,192.927000,224.489000,191.461000,224.489000,190.462000,223.517000,190.144000,214.550000,189.758000,207.495000,189.303000,202.313000,189.303000,202.314000,188.432000,196.134000,187.401000,191.208000,186.180000,187.421000,185.546000,186.021000,184.895000,184.970000,184.121000,184.112000,183.389000,183.504000,182.740000,183.226000,181.868000,183.160000,181.868000,183.160000,174.478000,183.160000,175.478000,182.160000,175.478000,365.969000,175.506000,372.881000,175.590000,378.848000,175.930000,387.984000,176.507000,393.460000,176.506000,393.454000,177.006000,395.653000,177.567000,397.365000,178.244000,398.733000,178.559000,399.226000,178.834000,399.548000,179.193000,399.834000,179.499000,400.046000,179.699000,400.114000,180.048000,400.119000,180.048000,400.119000,181.868000,400.119000,182.868000,401.119000,182.868000,407.673000,181.868000,408.673000,159.625000,408.673000,158.625000,407.673000,158.625000,401.119000,159.625000,400.119000,161.481000,400.119000,161.858000,400.113000,162.068000,400.029000,162.391000,399.766000,162.784000,399.401000,163.092000,398.979000,163.431000,398.358000,164.137000,396.643000,164.715000,394.484000,165.207000,391.744000,165.207000,391.744000,165.679000,386.379000,165.959000,377.809000,166.051000,365.969000,166.051000,182.160000,167.051000,183.160000,160.744000,183.160000,159.690000,183.204000,158.850000,183.365000,158.032000,183.688000,157.329000,184.077000,156.837000,184.522000,156.371000,185.190000,156.377000,185.181000,155.135000,188.005000,154.052000,192.134000,153.069000,197.733000,152.247000,204.835000,151.685000,213.407000,151.378000,223.505000,150.378000,224.489000,148.912000,224.489000,147.912000,223.478000,148.531000,167.079000,149.531000,166.090000,192.344000,166.090000,193.344000,167.079000,192.344000,168.090000,149.531000,168.090000,150.531000,167.100000,149.912000,223.500000,148.912000,222.489000,150.378000,222.489000,149.378000,223.472000,149.691000,213.305000,150.264000,204.608000,151.091000,197.438000,152.142000,191.648000,153.353000,187.164000,154.663000,184.149000,154.669000,184.139000,155.353000,183.276000,156.247000,182.469000,157.167000,181.884000,158.209000,181.511000,159.466000,181.255000,160.744000,181.160000,160.744000,181.160000,167.051000,181.160000,168.051000,182.160000,168.051000,365.969000,167.953000,377.887000,167.663000,386.600000,167.185000,392.042000,167.185000,392.043000,166.641000,394.941000,165.969000,397.395000,165.212000,399.268000,164.738000,400.056000,164.180000,400.787000,163.652000,401.319000,163.002000,401.697000,162.185000,401.997000,161.481000,402.119000,161.481000,402.119000,159.625000,402.119000,160.625000,401.119000,160.625000,407.673000,159.625000,406.673000,181.868000,406.673000,180.868000,407.673000,180.868000,401.119000,181.868000,402.119000,180.048000,402.119000,179.401000,402.020000,178.647000,401.777000,178.044000,401.471000,177.539000,401.029000,176.994000,400.418000,176.533000,399.769000,175.791000,398.232000,175.109000,396.207000,174.543000,393.839000,174.542000,393.833000,174.221000,391.520000,173.956000,388.260000,173.599000,378.945000,173.478000,365.969000,173.478000,182.160000,174.478000,181.160000,181.868000,181.160000,183.093000,181.365000,184.400000,181.902000,185.484000,182.650000,186.386000,183.691000,187.271000,185.083000,188.032000,186.667000,188.032000,186.667000,189.288000,190.589000,190.384000,195.766000,191.290000,202.082000,191.290000,202.083000,191.748000,207.310000,192.140000,214.448000,192.461000,223.460000,191.461000,222.489000,192.927000,222.489000,191.927000,223.499000,191.344000,167.100000,192.344000,168.090000,193.344000,167.079000
|
||||
|
||||
13.000000,7.000000, 8.000000,15.000000, 16.000000,2.000000, 17.000000,13.000000, 5.000000,10.000000, 19.000000,17.000000, 13.000000,7.000000
|
||||
|
||||
10.000000,6.000000, 16.000000,4.000000, 0.000000,10.000000, 14.000000,10.000000, 9.000000,5.000000, 5.000000,15.000000, 10.000000,6.000000
|
||||
|
||||
2.000000,18.000000, 14.000000,11.000000, 2.000000,14.000000, 5.000000,19.000000, 14.000000,19.000000, 2.000000,1.000000, 2.000000,18.000000
|
||||
|
||||
18.000000,14.000000, 18.000000,6.000000, 18.000000,18.000000, 3.000000,9.000000, 19.000000,10.000000, 3.000000,19.000000, 18.000000,14.000000
|
||||
|
||||
0.000000,14.000000, 5.000000,11.000000, 19.000000,5.000000, 0.000000,16.000000, 12.000000,13.000000, 0.000000,14.000000, 0.000000,14.000000
|
||||
|
||||
6.000000,9.000000, 4.000000,7.000000, 11.000000,14.000000, 4.000000,10.000000, 11.000000,8.000000, 9.000000,15.000000, 6.000000,9.000000
|
||||
|
||||
15.000000,4.000000, 15.000000,3.000000, 11.000000,13.000000, 12.000000,4.000000, 19.000000,5.000000, 6.000000,9.000000, 15.000000,4.000000
|
||||
|
||||
4.000000,2.000000, 11.000000,8.000000, 19.000000,19.000000, 1.000000,18.000000, 19.000000,0.000000, 15.000000,15.000000, 4.000000,2.000000
|
||||
|
||||
7.000000,14.000000, 18.000000,6.000000, 8.000000,2.000000, 14.000000,14.000000, 4.000000,8.000000, 9.000000,11.000000, 7.000000,14.000000
|
||||
|
||||
16.000000,8.000000, 15.000000,9.000000, 9.000000,17.000000, 9.000000,16.000000, 4.000000,3.000000, 8.000000,16.000000, 16.000000,8.000000
|
||||
|
||||
11.000000,10.000000, 12.000000,10.000000, 11.000000,2.000000, 7.000000,4.000000, 5.000000,13.000000, 11.000000,10.000000, 11.000000,10.000000
|
||||
|
||||
17.000000,1.000000, 2.000000,15.000000, 17.000000,17.000000, 7.000000,7.000000, 16.000000,19.000000, 3.000000,18.000000, 7.000000,0.000000, 7.000000,0.000000, 6.000000,4.000000, 2.000000,1.000000, 4.000000,2.000000, 7.000000,16.000000, 11.000000,16.000000, 7.000000,3.000000, 11.000000,16.000000, 5.000000,9.000000, 18.000000,8.000000, 4.000000,15.000000, 5.000000,11.000000, 17.000000,1.000000
|
||||
|
||||
10.000000,8.000000, 12.000000,3.000000, 10.000000,8.000000, 10.000000,19.000000, 2.000000,8.000000, 16.000000,11.000000, 10.000000,8.000000
|
||||
|
||||
10.000000,10.000000, 13.000000,11.000000, 18.000000,2.000000, 13.000000,11.000000, 11.000000,10.000000, 10.000000,14.000000, 10.000000,10.000000
|
||||
|
||||
8.000000,13.000000, 8.000000,7.000000, 12.000000,19.000000, 8.000000,8.000000, 8.000000,7.000000, 8.000000,2.000000, 8.000000,13.000000
|
||||
|
||||
//1.000000,7.000000, 12.000000,16.000000, 3.000000,4.000000, 16.000000,18.000000, 11.000000,3.000000, 16.000000,18.000000, 2.000000,4.000000, 11.000000,4.000000, 11.000000,16.000000, 1.000000,7.000000
|
||||
|
||||
1.000000,0.000000, 18.000000,13.000000, 0.000000,4.000000, 4.000000,6.000000, 16.000000,15.000000, 4.000000,3.000000, 4.000000,16.000000, 1.000000,0.000000
|
||||
|
||||
17.000000,17.000000, 7.000000,12.000000, 1.000000,17.000000, 8.000000,17.000000, 15.000000,15.000000, 17.000000,12.000000, 12.000000,15.000000, 5.000000,11.000000, 9.000000,13.000000, 15.000000,18.000000, 7.000000,8.000000, 17.000000,17.000000
|
||||
|
||||
//4.000000,0.000000, 15.000000,2.000000, 1.000000,2.000000, 17.000000,9.000000, 11.000000,4.000000, 3.000000,2.000000, 4.000000,8.000000, 6.000000,12.000000, 18.000000,15.000000, 15.000000,2.000000, 4.000000,0.000000
|
||||
|
||||
5.000000,14.000000, 7.000000,15.000000, 9.000000,15.000000, 5.000000,16.000000, 12.000000,2.000000, 7.000000,12.000000, 5.000000,11.000000, 10.000000,9.000000, 5.000000,4.000000, 11.000000,18.000000, 9.000000,8.000000, 5.000000,14.000000
|
||||
|
||||
//1.000000,19.000000, 6.000000,5.000000, 12.000000,6.000000, 8.000000,5.000000, 6.000000,1.000000, 8.000000,5.000000, 2.000000,5.000000, 1.000000,19.000000,
|
||||
|
||||
3.000000,18.000000, 0.000000,2.000000, 13.000000,0.000000, 1.000000,0.000000, 19.000000,19.000000, 2.000000,1.000000, 17.000000,0.000000, 3.000000,18.000000,
|
||||
|
||||
12.000000,10.000000, 4.000000,19.000000, 10.000000,0.000000, 6.000000,19.000000, 4.000000,16.000000, 4.000000,19.000000, 0.000000,15.000000, 4.000000,16.000000, 11.000000,5.000000, 12.000000,10.000000,
|
||||
|
||||
0.000000,2.000000, 9.000000,11.000000, 13.000000,8.000000, 8.000000,7.000000, 10.000000,15.000000, 16.000000,1.000000, 9.000000,11.000000, 8.000000,14.000000, 10.000000,11.000000, 0.000000,2.000000
|
||||
|
||||
13.000000,11.000000, 5.000000,7.000000, 15.000000,15.000000, 0.000000,3.000000, 16.000000,17.000000, 3.000000,9.000000, 6.000000,6.000000, 5.000000,7.000000, 3.000000,6.000000, 13.000000,11.000000,
|
||||
|
||||
6.000000,6.000000, 2.000000,5.000000, 15.000000,6.000000, 14.000000,8.000000, 10.000000,11.000000, 18.000000,3.000000, 10.000000,11.000000, 15.000000,1.000000, 15.000000,19.000000, 6.000000,6.000000,
|
||||
|
||||
15.000000,15.000000, 14.000000,14.000000, 1.000000,19.000000, 19.000000,12.000000, 1.000000,19.000000, 16.000000,18.000000, 2.000000,17.000000, 14.000000,19.000000, 2.000000,14.000000, 15.000000,15.000000,
|
||||
|
||||
17.000000,1.000000, 2.000000,14.000000, 19.000000,11.000000, 18.000000,11.000000, 4.000000,16.000000, 10.000000,11.000000, 8.000000,16.000000, 12.000000,12.000000, 11.000000,14.000000, 17.000000,1.000000,
|
||||
|
||||
17.000000,4.000000, 18.000000,9.000000, 10.000000,1.000000, 18.000000,9.000000, 4.000000,12.000000, 14.000000,17.000000, 4.000000,1.000000, 5.000000,17.000000, 4.000000,3.000000, 17.000000,4.000000,
|
||||
|
||||
6.000000,12.000000, 13.000000,1.000000, 10.000000,15.000000, 0.000000,1.000000, 12.000000,12.000000, 1.000000,2.000000, 14.000000,2.000000, 9.000000,10.000000, 10.000000,9.000000, 6.000000,12.000000,
|
||||
|
||||
10.000000,2.000000, 1.000000,19.000000, 18.000000,10.000000, 5.000000,11.000000, 13.000000,3.000000, 16.000000,12.000000, 13.000000,2.000000, 19.000000,4.000000, 12.000000,16.000000, 10.000000,2.000000,
|
||||
|
||||
15.000000,18.000000, 9.000000,4.000000, 17.000000,19.000000, 8.000000,2.000000, 12.000000,14.000000, 16.000000,4.000000, 17.000000,11.000000, 1.000000,13.000000, 16.000000,8.000000, 15.000000,18.000000,
|
||||
|
||||
0.000000,1.000000, 3.000000,5.000000, 6.000000,18.000000, 8.000000,10.000000, 2.000000,9.000000, 12.000000,13.000000, 17.000000,0.000000, 3.000000,10.000000, 16.000000,1.000000, 0.000000,1.000000,
|
||||
|
||||
2.000000,5.000000, 5.000000,12.000000, 11.000000,2.000000, 1.000000,19.000000, 6.000000,5.000000, 17.000000,1.000000, 8.000000,0.000000, 14.000000,10.000000, 2.000000,5.000000
|
||||
|
||||
12.000000,17.000000, 14.000000,7.000000, 12.000000,17.000000, 15.000000,9.000000, 3.000000,8.000000, 15.000000,2.000000, 13.000000,13.000000, 12.000000,17.000000,
|
||||
|
||||
16.000000,9.000000, 12.000000,17.000000, 9.000000,7.000000, 6.000000,14.000000, 10.000000,10.000000, 0.000000,18.000000, 19.000000,9.000000, 2.000000,11.000000, 16.000000,9.000000,
|
||||
|
||||
2.000000,11.000000, 8.000000,4.000000, 5.000000,15.000000, 19.000000,7.000000, 1.000000,4.000000, 11.000000,15.000000, 6.000000,0.000000, 10.000000,13.000000, 15.000000,0.000000, 5.000000,7.000000, 2.000000,11.000000,
|
||||
|
||||
14.000000,16.000000, 13.000000,3.000000, 13.000000,7.000000, 13.000000,4.000000, 4.000000,19.000000, 18.000000,3.000000, 3.000000,6.000000, 14.000000,16.000000
|
||||
|
||||
1.000000,10.000000, 16.000000,11.000000, 5.000000,12.000000, 14.000000,12.000000, 1.000000,10.000000,
|
||||
|
||||
3.000000,14.000000, 18.000000,13.000000, 0.000000,13.000000, 17.000000,15.000000, 3.000000,14.000000
|
||||
|
||||
113.978891,188.283650, 114.049102,188.354061, 114.028390,188.311950, 140.621311,218.434785, 113.925508,188.451788, 114.028390,188.311950, 114.038094,188.325206, 107.079712,223.213808, 113.978891,188.283650
|
||||
|
||||
149.124266,243.836328, 149.130825,243.837775, 140.462458,289.372639, 149.124266,243.836328, 174.003258,285.357827, 149.081172,244.062877, 80.895955,240.414297, 149.081172,244.062877, 149.124266,243.836328,
|
||||
|
||||
29.389873,51.154090, 34.288345,59.861919, 29.364091,51.189091, 29.379701,51.200590, 15.480095,51.026265, 27.327001,60.472279, 29.361537,51.172254, 29.379701,51.200590, 29.389873,51.154090,
|
||||
|
||||
23.402194,41.096844, 23.406381,41.132628, 34.465476,40.926093, 32.678424,45.608817, 23.389763,41.132654, 23.414672,41.106110, 21.719863,48.560185, 23.402194,41.096844,
|
||||
|
||||
30.951431,53.763363, 30.939362,53.811917, 41.512607,48.598876, 25.528987,61.504482, 30.925582,53.773491, 30.940776,53.812269, 28.790798,63.563660, 30.921651,53.782489, 30.951431,53.763363,
|
||||
|
||||
40.932299,70.331769, 33.882179,80.568702, 40.952469,70.382541, 33.906555,80.507737, 38.158710,83.200483, 40.932299,70.331769
|
||||
|
||||
37.291393,64.307940, 47.917795,74.087993, 37.307928,64.317812, 51.927660,71.285431, 34.739208,76.059738, 37.291393,64.307940
|
||||
|
||||
97.604218,162.191009, 81.519079,186.128039, 97.652864,162.308413, 81.609840,186.099213, 67.592573,182.092187, 91.591892,192.217346, 97.604218,162.191009
|
||||
|
||||
135.877528,222.962402, 135.792476,222.983126, 195.753543,234.556614, 135.814790,223.162055, 135.936349,222.995801, 135.947907,223.011493, 127.815883,264.424834, 135.877528,222.962402,
|
||||
|
||||
140.157057,229.713961, 140.069413,229.735364, 201.872134,241.630761, 140.092507,229.919758, 140.217696,229.748350, 140.229617,229.764516, 131.871019,272.449909, 140.157057,229.713961
|
||||
|
||||
193.086469,312.646765, 108.189184,287.648923, 193.023897,312.936441, 237.949462,362.828686, 192.949279,312.891753, 266.364944,345.116804, 192.999843,312.928266, 192.913653,312.765449, 193.086469,312.646765
|
||||
|
||||
247.422415,396.899455, 247.217314,397.163923, 247.574394,397.118778, 142.852727,414.776640, 288.712650,464.492402, 247.228121,397.184104, 135.733401,392.254819, 233.734466,471.311838, 247.203092,397.051434, 247.355072,397.270757, 247.422415,396.899455,
|
||||
|
||||
330.399757,524.281800, 330.600976,524.476466, 323.970137,422.844875, 330.540537,524.358965, 406.928779,607.813936, 330.568526,524.395792, 359.346715,616.206998, 330.399757,524.281800,
|
||||
|
||||
304.198844,484.203463, 173.561956,487.759775, 436.078782,489.984415, 374.610016,561.755629, 304.198844,484.203463, 354.969812,566.668108, 304.118093,484.657714, 304.198844,484.203463,
|
||||
|
||||
216.327573,348.779345, 182.153126,401.142486, 216.158855,348.851925, 194.442338,411.748517, 216.134810,348.912273, 216.267739,349.105035, 216.327573,348.779345,
|
||||
|
||||
40.510823,69.635522, 40.490212,69.696716, 38.684855,81.300842, 40.530783,69.685790, 47.264190,81.490170, 40.497275,69.699095, 37.801306,82.350057, 37.762746,82.375070, 40.472263,69.660535, 40.510823,69.635522
|
||||
|
||||
/
|
@ -1,48 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef SIMPLEDATA_H
|
||||
#define SIMPLEDATA_H
|
||||
|
||||
#include "sample_data.h"
|
||||
|
||||
FullData simpleData();
|
||||
|
||||
#endif
|
@ -1,116 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "testtessellator.h"
|
||||
#include <private/qtessellator_p.h>
|
||||
|
||||
#include "math.h"
|
||||
#include <QtCore/QDebug>
|
||||
|
||||
class TestTessellator : public QTessellator
|
||||
{
|
||||
public:
|
||||
QVector<XTrapezoid> *traps;
|
||||
void addTrap(const Trapezoid &trap);
|
||||
};
|
||||
|
||||
void TestTessellator::addTrap(const Trapezoid &trap)
|
||||
{
|
||||
XTrapezoid xtrap;
|
||||
xtrap.top = Q27Dot5ToXFixed(trap.top);
|
||||
xtrap.bottom = Q27Dot5ToXFixed(trap.bottom);
|
||||
xtrap.left.p1.x = Q27Dot5ToXFixed(trap.topLeft->x);
|
||||
xtrap.left.p1.y = Q27Dot5ToXFixed(trap.topLeft->y);
|
||||
xtrap.left.p2.x = Q27Dot5ToXFixed(trap.bottomLeft->x);
|
||||
xtrap.left.p2.y = Q27Dot5ToXFixed(trap.bottomLeft->y);
|
||||
xtrap.right.p1.x = Q27Dot5ToXFixed(trap.topRight->x);
|
||||
xtrap.right.p1.y = Q27Dot5ToXFixed(trap.topRight->y);
|
||||
xtrap.right.p2.x = Q27Dot5ToXFixed(trap.bottomRight->x);
|
||||
xtrap.right.p2.y = Q27Dot5ToXFixed(trap.bottomRight->y);
|
||||
traps->append(xtrap);
|
||||
}
|
||||
|
||||
|
||||
void test_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding)
|
||||
{
|
||||
TestTessellator t;
|
||||
t.traps = traps;
|
||||
t.setWinding(winding);
|
||||
t.tessellate(points, nPoints);
|
||||
}
|
||||
|
||||
|
||||
void test_tessellate_polygon_convex(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding)
|
||||
{
|
||||
TestTessellator t;
|
||||
t.traps = traps;
|
||||
t.setWinding(winding);
|
||||
t.tessellateConvex(points, nPoints);
|
||||
}
|
||||
|
||||
|
||||
void test_tessellate_polygon_rect(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding)
|
||||
{
|
||||
// 5 points per rect
|
||||
if (nPoints % 5 != 0)
|
||||
qWarning() << Q_FUNC_INFO << "multiples of 5 points expected";
|
||||
|
||||
TestTessellator t;
|
||||
t.traps = traps;
|
||||
t.setWinding(winding);
|
||||
for (int i = 0; i < nPoints / 5; ++i) {
|
||||
QPointF rectA = points[5*i];
|
||||
QPointF rectB = points[5*i+1];
|
||||
QPointF rectC = points[5*i+2];
|
||||
QPointF rectD = points[5*i+3];
|
||||
|
||||
QPointF a = (rectA + rectD) * 0.5;
|
||||
QPointF b = (rectB + rectC) * 0.5;
|
||||
|
||||
QPointF delta = rectA - rectD;
|
||||
|
||||
qreal width = sqrt(delta.x() * delta.x() + delta.y() * delta.y());
|
||||
|
||||
t.tessellateRect(a, b, width);
|
||||
}
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef TESTTESSELLATOR_H
|
||||
#define TESTTESSELLATOR_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
#include "XrenderFake.h"
|
||||
|
||||
typedef void (*tessellate_function)(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding);
|
||||
|
||||
void test_tesselate_polygon(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding);
|
||||
|
||||
void test_tessellate_polygon_convex(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding);
|
||||
|
||||
void test_tessellate_polygon_rect(QVector<XTrapezoid> *traps, const QPointF *points, int nPoints,
|
||||
bool winding);
|
||||
#endif
|
@ -1,378 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include <QtTest/QtTest>
|
||||
#include <QCoreApplication>
|
||||
#include <QVector>
|
||||
#include <qdebug.h>
|
||||
#include <qpolygon.h>
|
||||
#include <qmatrix.h>
|
||||
|
||||
#include "oldtessellator.h"
|
||||
#include "testtessellator.h"
|
||||
#include "utils.h"
|
||||
#include "simple.h"
|
||||
#include "arc.h"
|
||||
|
||||
#include "math.h"
|
||||
|
||||
//TESTED_CLASS=
|
||||
//TESTED_FILES=
|
||||
|
||||
class tst_QTessellator : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
tst_QTessellator() {
|
||||
}
|
||||
|
||||
private slots:
|
||||
void testStandardSet();
|
||||
void testRandom();
|
||||
void testArc();
|
||||
void testRects();
|
||||
void testConvexRects();
|
||||
void testConvex();
|
||||
};
|
||||
|
||||
|
||||
QPointF creatPoint()
|
||||
{
|
||||
qreal x = int(20.0 * (rand() / (RAND_MAX + 1.0)));
|
||||
qreal y = int(20.0 * (rand() / (RAND_MAX + 1.0)));
|
||||
return QPointF(x, y);
|
||||
}
|
||||
|
||||
bool test(const QPointF *pg, int pgSize, bool winding, tessellate_function tessellate = test_tesselate_polygon, qreal maxDiff = 0.005)
|
||||
{
|
||||
QVector<XTrapezoid> traps;
|
||||
qreal area1 = 0;
|
||||
qreal area2 = 0;
|
||||
|
||||
old_tesselate_polygon(&traps, pg, pgSize, winding);
|
||||
area1 = compute_area_for_x(traps);
|
||||
|
||||
traps.clear();
|
||||
|
||||
tessellate(&traps, pg, pgSize, winding);
|
||||
area2 = compute_area_for_x(traps);
|
||||
|
||||
bool result = (qAbs(area2 - area1) < maxDiff);
|
||||
if (!result && area1)
|
||||
result = (qAbs(area1 - area2)/area1 < maxDiff);
|
||||
|
||||
if (!result)
|
||||
qDebug() << area1 << area2;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
void simplifyTestFailure(QVector<QPointF> failure, bool winding)
|
||||
{
|
||||
int i = 1;
|
||||
while (i < failure.size() - 1) {
|
||||
QVector<QPointF> t = failure;
|
||||
t.remove(i);
|
||||
if (test(t.data(), t.size(), winding)) {
|
||||
++i;
|
||||
continue;
|
||||
}
|
||||
failure = t;
|
||||
i = 1;
|
||||
}
|
||||
|
||||
for (int x = 0; x < failure.size(); ++x) {
|
||||
fprintf(stderr, "%lf,%lf, ", failure[x].x(), failure[x].y());
|
||||
}
|
||||
fprintf(stderr, "\n\n");
|
||||
}
|
||||
|
||||
void tst_QTessellator::testStandardSet()
|
||||
{
|
||||
QVector<FullData> sampleSet;
|
||||
sampleSet.append(simpleData());
|
||||
|
||||
foreach(FullData data, sampleSet) {
|
||||
for (int i = 0; i < data.size(); ++i) {
|
||||
if (!test(data[i].data(), data[i].size(), false)) {
|
||||
simplifyTestFailure(data[i], false);
|
||||
QCOMPARE(true, false);
|
||||
}
|
||||
if (!test(data[i].data(), data[i].size(), true)) {
|
||||
simplifyTestFailure(data[i], true);
|
||||
QCOMPARE(true, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void fillRandomVec(QVector<QPointF> &vec)
|
||||
{
|
||||
int size = vec.size(); --size;
|
||||
for (int i = 0; i < size; ++i) {
|
||||
vec[i] = creatPoint();
|
||||
}
|
||||
vec[size] = vec[0];
|
||||
}
|
||||
|
||||
void tst_QTessellator::testRandom()
|
||||
{
|
||||
int failures = 0;
|
||||
for (int i = 5; i < 12; ++i) {
|
||||
QVector<QPointF> vec(i);
|
||||
#ifdef QT_ARCH_ARM
|
||||
int k = 200;
|
||||
#else
|
||||
int k = 5000;
|
||||
#endif
|
||||
while (--k) {
|
||||
fillRandomVec(vec);
|
||||
if (!test(vec.data(), vec.size(), false)) {
|
||||
simplifyTestFailure(vec, false);
|
||||
++failures;
|
||||
}
|
||||
if (!test(vec.data(), vec.size(), true)) {
|
||||
simplifyTestFailure(vec, true);
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
}
|
||||
QVERIFY(failures == 0);
|
||||
}
|
||||
|
||||
|
||||
// we need a higher threshold for failure here than in the above tests, as this basically draws
|
||||
// a very thin outline, where the discretization in the new tesselator shows
|
||||
bool test_arc(const QPolygonF &poly, bool winding)
|
||||
{
|
||||
QVector<XTrapezoid> traps;
|
||||
qreal area1 = 0;
|
||||
qreal area2 = 0;
|
||||
|
||||
old_tesselate_polygon(&traps, poly.data(), poly.size(), winding);
|
||||
area1 = compute_area_for_x(traps);
|
||||
|
||||
traps.clear();
|
||||
|
||||
test_tesselate_polygon(&traps, poly.data(), poly.size(), winding);
|
||||
area2 = compute_area_for_x(traps);
|
||||
|
||||
bool result = (area2 - area1 < .02);
|
||||
if (!result && area1)
|
||||
result = (qAbs(area1 - area2)/area1 < .02);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void tst_QTessellator::testArc()
|
||||
{
|
||||
FullData arc = arcData();
|
||||
|
||||
QMatrix mat;
|
||||
#ifdef QT_ARCH_ARM
|
||||
const int stop = 5;
|
||||
#else
|
||||
const int stop = 1000;
|
||||
#endif
|
||||
for (int i = 0; i < stop; ++i) {
|
||||
mat.rotate(qreal(.01));
|
||||
mat.scale(qreal(.99), qreal(.99));
|
||||
QPolygonF poly = arc.at(0);
|
||||
QPolygonF vec = poly * mat;
|
||||
QVERIFY(test_arc(vec, true));
|
||||
QVERIFY(test_arc(vec, false));
|
||||
}
|
||||
}
|
||||
|
||||
static bool isConvex(const QVector<QPointF> &v)
|
||||
{
|
||||
int nPoints = v.size() - 1;
|
||||
|
||||
qreal lastCross = 0;
|
||||
for (int i = 0; i < nPoints; ++i) {
|
||||
QPointF a = v[i];
|
||||
QPointF b = v[(i + 1) % nPoints];
|
||||
|
||||
QPointF d1 = b - a;
|
||||
|
||||
for (int j = 0; j < nPoints; ++j) {
|
||||
if (j == i || j == i + 1)
|
||||
continue;
|
||||
|
||||
QPointF p = v[j];
|
||||
QPointF d2 = p - a;
|
||||
|
||||
qreal cross = d1.x() * d2.y() - d1.y() * d2.x();
|
||||
|
||||
if (!qFuzzyCompare(cross + 1, 1)
|
||||
&& !qFuzzyCompare(cross + 1, 1)
|
||||
&& (lastCross > 0) != (cross > 0))
|
||||
return false;
|
||||
|
||||
lastCross = cross;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static void fillRectVec(QVector<QPointF> &v)
|
||||
{
|
||||
int numRects = v.size() / 5;
|
||||
|
||||
int first = 0;
|
||||
v[first++] = QPointF(0, 0);
|
||||
v[first++] = QPointF(10, 0);
|
||||
v[first++] = QPointF(10, 10);
|
||||
v[first++] = QPointF(0, 10);
|
||||
v[first++] = QPointF(0, 0);
|
||||
|
||||
v[first++] = QPointF(0, 0);
|
||||
v[first++] = QPointF(2, 2);
|
||||
v[first++] = QPointF(4, 0);
|
||||
v[first++] = QPointF(2, -2);
|
||||
v[first++] = QPointF(0, 0);
|
||||
|
||||
v[first++] = QPointF(0, 0);
|
||||
v[first++] = QPointF(4, 4);
|
||||
v[first++] = QPointF(6, 2);
|
||||
v[first++] = QPointF(2, -2);
|
||||
v[first++] = QPointF(0, 0);
|
||||
|
||||
for (int i = first / 5; i < numRects; ++i) {
|
||||
QPointF a = creatPoint();
|
||||
QPointF b = creatPoint();
|
||||
|
||||
QPointF delta = a - b;
|
||||
QPointF perp(delta.y(), -delta.x());
|
||||
|
||||
perp *= ((int)(20.0 * rand() / (RAND_MAX + 1.0))) / 20.0;
|
||||
|
||||
int j = 5 * i;
|
||||
v[j++] = a + perp;
|
||||
v[j++] = a - perp;
|
||||
v[j++] = b - perp;
|
||||
v[j++] = b + perp;
|
||||
v[j++] = a + perp;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef QT_ARCH_ARM
|
||||
const int numRects = 500;
|
||||
#else
|
||||
const int numRects = 5000;
|
||||
#endif
|
||||
|
||||
void tst_QTessellator::testConvexRects()
|
||||
{
|
||||
return;
|
||||
int failures = 0;
|
||||
QVector<QPointF> vec(numRects * 5);
|
||||
fillRectVec(vec);
|
||||
for (int rect = 0; rect < numRects; ++rect) {
|
||||
QVector<QPointF> v(5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
v[i] = vec[5 * rect + i];
|
||||
if (!test(v.data(), v.size(), false, test_tessellate_polygon_convex)) {
|
||||
simplifyTestFailure(v, false);
|
||||
++failures;
|
||||
}
|
||||
if (!test(v.data(), v.size(), true, test_tessellate_polygon_convex)) {
|
||||
simplifyTestFailure(v, true);
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
QVERIFY(failures == 0);
|
||||
}
|
||||
|
||||
void tst_QTessellator::testConvex()
|
||||
{
|
||||
int failures = 0;
|
||||
for (int i = 4; i < 10; ++i) {
|
||||
QVector<QPointF> vec(i);
|
||||
int k = 5000;
|
||||
while (k--) {
|
||||
fillRandomVec(vec);
|
||||
if (!isConvex(vec))
|
||||
continue;
|
||||
if (!test(vec.data(), vec.size(), false, test_tessellate_polygon_convex)) {
|
||||
simplifyTestFailure(vec, false);
|
||||
++failures;
|
||||
}
|
||||
if (!test(vec.data(), vec.size(), true, test_tessellate_polygon_convex)) {
|
||||
simplifyTestFailure(vec, true);
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
}
|
||||
QVERIFY(failures == 0);
|
||||
}
|
||||
|
||||
|
||||
void tst_QTessellator::testRects()
|
||||
{
|
||||
int failures = 0;
|
||||
QVector<QPointF> vec(numRects * 5);
|
||||
fillRectVec(vec);
|
||||
for (int rect = 0; rect < numRects; ++rect) {
|
||||
QVector<QPointF> v(5);
|
||||
for (int i = 0; i < 5; ++i)
|
||||
v[i] = vec[5 * rect + i];
|
||||
if (!test(v.data(), v.size(), false, test_tessellate_polygon_rect, qreal(0.05))) {
|
||||
simplifyTestFailure(v, false);
|
||||
++failures;
|
||||
}
|
||||
if (!test(v.data(), v.size(), true, test_tessellate_polygon_rect, qreal(0.05))) {
|
||||
simplifyTestFailure(v, true);
|
||||
++failures;
|
||||
}
|
||||
}
|
||||
QVERIFY(failures == 0);
|
||||
}
|
||||
|
||||
|
||||
QTEST_MAIN(tst_QTessellator)
|
||||
#include "tst_tessellator.moc"
|
@ -1,93 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "utils.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <qglobal.h>
|
||||
|
||||
#include "qnum.h"
|
||||
|
||||
#define FloatToXFixed(i) (int)((i) * 65536)
|
||||
#define IntToXFixed(i) ((i) << 16)
|
||||
|
||||
static double compute_x_at(XFixed y, XPointFixed p1, XPointFixed p2)
|
||||
{
|
||||
double d = XFixedToDouble(p2.x - p1.x);
|
||||
return
|
||||
XFixedToDouble(p1.x) + d*XFixedToDouble(y - p1.y)/XFixedToDouble(p2.y - p1.y);
|
||||
}
|
||||
|
||||
double compute_area(XTrapezoid *trap)
|
||||
{
|
||||
double x1 = compute_x_at(trap->top, trap->left.p1, trap->left.p2);
|
||||
double x2 = compute_x_at(trap->top, trap->right.p1, trap->right.p2);
|
||||
double x3 = compute_x_at(trap->bottom, trap->left.p1, trap->left.p2);
|
||||
double x4 = compute_x_at(trap->bottom, trap->right.p1, trap->right.p2);
|
||||
|
||||
double top = XFixedToDouble(trap->top);
|
||||
double bottom = XFixedToDouble(trap->bottom);
|
||||
double h = bottom - top;
|
||||
|
||||
double top_base = x2 - x1;
|
||||
double bottom_base = x4 - x3;
|
||||
|
||||
if ((top_base < 0 && bottom_base > 0)
|
||||
|| (top_base > 0 && bottom_base < 0)) {
|
||||
double y0 = top_base*h/(top_base - bottom_base) + top;
|
||||
double area = qAbs(top_base * (y0 - top) / 2.);
|
||||
area += qAbs(bottom_base * (bottom - y0) /2.);
|
||||
return area;
|
||||
}
|
||||
|
||||
|
||||
return 0.5 * h * qAbs(top_base + bottom_base);
|
||||
}
|
||||
|
||||
double compute_area_for_x(const QVector<XTrapezoid> &traps)
|
||||
{
|
||||
double area = 0;
|
||||
|
||||
for (int i = 0; i < traps.size(); ++i) {
|
||||
XTrapezoid trap = traps[i];
|
||||
area += compute_area(&trap);
|
||||
}
|
||||
return area;
|
||||
}
|
@ -1,56 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
||||
** All rights reserved.
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** This file is part of the test suite of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** GNU Lesser General Public License Usage
|
||||
** This file may be used under the terms of the GNU Lesser General Public
|
||||
** License version 2.1 as published by the Free Software Foundation and
|
||||
** appearing in the file LICENSE.LGPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU Lesser
|
||||
** General Public License version 2.1 requirements will be met:
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Nokia gives you certain additional
|
||||
** rights. These rights are described in the Nokia Qt LGPL Exception
|
||||
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
||||
**
|
||||
** GNU General Public License Usage
|
||||
** Alternatively, this file may be used under the terms of the GNU General
|
||||
** Public License version 3.0 as published by the Free Software Foundation
|
||||
** and appearing in the file LICENSE.GPL included in the packaging of this
|
||||
** file. Please review the following information to ensure the GNU General
|
||||
** Public License version 3.0 requirements will be met:
|
||||
** http://www.gnu.org/copyleft/gpl.html.
|
||||
**
|
||||
** Other Usage
|
||||
** Alternatively, this file may be used in accordance with the terms and
|
||||
** conditions contained in a signed written agreement between you and Nokia.
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
#ifndef UTILS_H
|
||||
#define UTILS_H
|
||||
|
||||
#include <QVector>
|
||||
#include <QPointF>
|
||||
#include <QDebug>
|
||||
#include "XrenderFake.h"
|
||||
|
||||
double compute_area(XTrapezoid *trap);
|
||||
double compute_area_for_x(const QVector<XTrapezoid> &traps);
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
Q_DECLARE_TYPEINFO(XTrapezoid, Q_PRIMITIVE_TYPE);
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user