source: trunk/src/gui/painting/qstroker_p.h@ 986

Last change on this file since 986 was 846, checked in by Dmitry A. Kuminov, 15 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 11.8 KB
RevLine 
[2]1/****************************************************************************
2**
[846]3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
[561]4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
[2]6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
[561]24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
[2]27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
[561]36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
[2]38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QSTROKER_P_H
43#define QSTROKER_P_H
44
45//
46// W A R N I N G
47// -------------
48//
49// This file is not part of the Qt API. It exists purely as an
50// implementation detail. This header file may change from version to
51// version without notice, or even be removed.
52//
53// We mean it.
54//
55
56#include "QtGui/qpainterpath.h"
57#include "private/qdatabuffer_p.h"
58#include "private/qnumeric_p.h"
59
60QT_BEGIN_NAMESPACE
61
62// #define QFIXED_IS_26_6
63
64#if defined QFIXED_IS_26_6
65typedef int qfixed;
66#define qt_real_to_fixed(real) qfixed(real * 64)
67#define qt_int_to_fixed(real) qfixed(int(real) << 6)
68#define qt_fixed_to_real(fixed) qreal(fixed / qreal(64))
69#define qt_fixed_to_int(fixed) int(fixed >> 6)
70struct qfixed2d
71{
72 qfixed x;
73 qfixed y;
74
75 bool operator==(const qfixed2d &other) const { return x == other.x && y == other.y; }
76};
77#elif defined QFIXED_IS_32_32
78typedef qint64 qfixed;
79#define qt_real_to_fixed(real) qfixed(real * double(qint64(1) << 32))
80#define qt_fixed_to_real(fixed) qreal(fixed / double(qint64(1) << 32))
81struct qfixed2d
82{
83 qfixed x;
84 qfixed y;
85
86 bool operator==(const qfixed2d &other) const { return x == other.x && y == other.y; }
87};
88#elif defined QFIXED_IS_16_16
89typedef int qfixed;
90#define qt_real_to_fixed(real) qfixed(real * qreal(1 << 16))
91#define qt_fixed_to_real(fixed) qreal(fixed / qreal(1 << 16))
92struct qfixed2d
93{
94 qfixed x;
95 qfixed y;
96
97 bool operator==(const qfixed2d &other) const { return x == other.x && y == other.y; }
98};
99#else
100typedef qreal qfixed;
101#define qt_real_to_fixed(real) qfixed(real)
102#define qt_fixed_to_real(fixed) fixed
103struct qfixed2d
104{
105 qfixed x;
106 qfixed y;
107
108 bool operator==(const qfixed2d &other) const { return qFuzzyCompare(x, other.x)
109 && qFuzzyCompare(y, other.y); }
110};
111#endif
112
113#define QT_PATH_KAPPA 0.5522847498
114
115QPointF qt_curves_for_arc(const QRectF &rect, qreal startAngle, qreal sweepLength,
116 QPointF *controlPoints, int *point_count);
117
118qreal qt_t_for_arc_angle(qreal angle);
119
120typedef void (*qStrokerMoveToHook)(qfixed x, qfixed y, void *data);
121typedef void (*qStrokerLineToHook)(qfixed x, qfixed y, void *data);
122typedef void (*qStrokerCubicToHook)(qfixed c1x, qfixed c1y,
123 qfixed c2x, qfixed c2y,
124 qfixed ex, qfixed ey,
125 void *data);
126
[846]127// qtransform.cpp
128Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
129