| 1 |
// Copyright (C) 2018 The Qt Company Ltd. |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
| 3 |
|
| 4 |
#ifndef QTESSELATOR_P_H |
| 5 |
#define QTESSELATOR_P_H |
| 6 |
|
| 7 |
#include <QPoint> |
| 8 |
#include <QRect> |
| 9 |
|
| 10 |
QT_BEGIN_NAMESPACE |
| 11 |
|
| 12 |
class QTessellatorPrivate; |
| 13 |
|
| 14 |
typedef int Q27Dot5; |
| 15 |
#define Q27Dot5ToDouble(i) ((i)/32.) |
| 16 |
#define FloatToQ27Dot5(i) (int)((i) * 32) |
| 17 |
#define IntToQ27Dot5(i) ((i) << 5) |
| 18 |
#define Q27Dot5ToXFixed(i) ((i) << 11) |
| 19 |
#define Q27Dot5Factor 32 |
| 20 |
|
| 21 |
class QTessellator { |
| 22 |
public: |
| 23 |
QTessellator(); |
| 24 |
virtual ~QTessellator(); |
| 25 |
|
| 26 |
QRectF tessellate(const QPointF *points, int nPoints); |
| 27 |
void tessellateConvex(const QPointF *points, int nPoints); |
| 28 |
void tessellateRect(const QPointF &a, const QPointF &b, qreal width); |
| 29 |
|
| 30 |
void setWinding(bool w); |
| 31 |
|
| 32 |
struct Vertex { |
| 33 |
Q27Dot5 x; |
| 34 |
Q27Dot5 y; |
| 35 |
}; |
| 36 |
struct Trapezoid { |
| 37 |
Q27Dot5 top; |
| 38 |
Q27Dot5 bottom; |
| 39 |
const Vertex *topLeft; |
| 40 |
const Vertex *bottomLeft; |
| 41 |
const Vertex *topRight; |
| 42 |
const Vertex *bottomRight; |
| 43 |
}; |
| 44 |
virtual void addTrap(const Trapezoid &trap) = 0; |
| 45 |
|
| 46 |
private: |
| 47 |
friend class QTessellatorPrivate; |
| 48 |
QTessellatorPrivate *d; |
| 49 |
}; |
| 50 |
|
| 51 |
QT_END_NAMESPACE |
| 52 |
|
| 53 |
#endif |