Merge remote-tracking branch 'origin/dev' into 5.5
Needed due to license header patch. Change-Id: Id7e30490132a7c487687a0a376419e9f9b97ea41
This commit is contained in:
commit
393fc2d4f5
@ -1,3 +0,0 @@
|
||||
SOURCES = floatmath.cpp
|
||||
CONFIG -= x11 qt
|
||||
|
@ -3,7 +3,7 @@
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the config.tests of the Qt Toolkit.
|
||||
** This file is part of the Qt Toolkit
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
@ -31,20 +31,12 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#define GST_USE_UNSTABLE_API
|
||||
|
||||
int main(int argc, char **argv)
|
||||
#include <gst/gst.h>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
float c = ceilf(1.3f);
|
||||
float f = floorf(1.7f);
|
||||
float s = sinf(3.8);
|
||||
float t = cosf(7.3);
|
||||
float u = sqrtf(8.4);
|
||||
float l = logf(9.2);
|
||||
|
||||
if (c == 1.0f && f == 2.0f && s == 3.0f && t == 4.0f && u == 5.0f && l == 6.0f)
|
||||
return 0;
|
||||
else
|
||||
return 1;
|
||||
gst_is_initialized();
|
||||
return 0;
|
||||
}
|
||||
|
22
config.tests/unix/gstreamer/gstreamer.pro
Normal file
22
config.tests/unix/gstreamer/gstreamer.pro
Normal file
@ -0,0 +1,22 @@
|
||||
SOURCES += gstreamer.cpp
|
||||
|
||||
CONFIG += link_pkgconfig
|
||||
|
||||
gst-0.10 {
|
||||
PKGCONFIG_PRIVATE += \
|
||||
gstreamer-0.10 \
|
||||
gstreamer-base-0.10 \
|
||||
gstreamer-audio-0.10 \
|
||||
gstreamer-video-0.10 \
|
||||
gstreamer-pbutils-0.10
|
||||
} else:gst-1.0 {
|
||||
PKGCONFIG_PRIVATE += \
|
||||
gstreamer-1.0 \
|
||||
gstreamer-base-1.0 \
|
||||
gstreamer-audio-1.0 \
|
||||
gstreamer-video-1.0 \
|
||||
gstreamer-pbutils-1.0
|
||||
}
|
||||
|
||||
CONFIG -= qt
|
||||
|
80
configure
vendored
80
configure
vendored
@ -644,6 +644,8 @@ CFG_QNX_IMF=auto
|
||||
CFG_LGMON=auto
|
||||
CFG_SYSTEM_PROXIES=no
|
||||
CFG_ANDROID_STYLE_ASSETS=yes
|
||||
CFG_GSTREAMER=auto
|
||||
CFG_GSTREAMER_VERSION=""
|
||||
|
||||
# Target architecture
|
||||
CFG_ARCH=
|
||||
@ -968,7 +970,17 @@ while [ "$#" -gt 0 ]; do
|
||||
shift;
|
||||
VAL=$1
|
||||
fi
|
||||
;;
|
||||
;;
|
||||
-gstreamer)
|
||||
VAR=gstreamer
|
||||
# this option may or may not be followed by an argument
|
||||
if [ -z "$2" ] || echo "$2" | grep '^-' >/dev/null 2>&1; then
|
||||
VAL=yes
|
||||
else
|
||||
shift;
|
||||
VAL=$1
|
||||
fi
|
||||
;;
|
||||
-hostprefix)
|
||||
VAR=`echo $1 | sed 's,^-\(.*\),\1,'`
|
||||
# this option may or may not be followed by an argument
|
||||
@ -1896,6 +1908,15 @@ while [ "$#" -gt 0 ]; do
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
gstreamer)
|
||||
if [ "$VAL" = "auto" ] || [ "$VAL" = "yes" ] ||
|
||||
[ "$VAL" = "0.10" ] || [ "$VAL" = "1.0" ] ||
|
||||
[ "$VAL" = "no" ]; then
|
||||
CFG_GSTREAMER="$VAL"
|
||||
else
|
||||
UNKNOWN_OPT=yes
|
||||
fi
|
||||
;;
|
||||
gtkstyle)
|
||||
if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
|
||||
CFG_QGTKSTYLE="$VAL"
|
||||
@ -2612,6 +2633,12 @@ Additional options:
|
||||
-no-libinput ........ Do not support libinput.
|
||||
* -libinput ........... Enable libinput support.
|
||||
|
||||
-no-gstreamer ....... Do not support GStreamer.
|
||||
+ -gstreamer <version> Enable GStreamer support
|
||||
With no parameter, this will attempt to auto-detect GStreamer 0.10 and
|
||||
1.0. GStreamer 0.10 is used by default when available.
|
||||
Use 0.10 or 1.0 for <version> to override auto-detection.
|
||||
|
||||
* -no-system-proxies .. Do not use system network proxies by default.
|
||||
-system-proxies ..... Use system network proxies by default.
|
||||
|
||||
@ -4234,13 +4261,6 @@ if [ "$CFG_CXX11" != "no" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# detect availability of float math.h functions
|
||||
if compileTest unix/floatmath "floatmath"; then
|
||||
CFG_USE_FLOATMATH=yes
|
||||
else
|
||||
CFG_USE_FLOATMATH=no
|
||||
fi
|
||||
|
||||
# detect sse2 support
|
||||
if [ "${CFG_SSE2}" = "auto" ]; then
|
||||
if compileTest common/sse2 "sse2"; then
|
||||
@ -5852,6 +5872,42 @@ if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then
|
||||
CFG_AUDIO_BACKEND=yes
|
||||
fi
|
||||
|
||||
# detect GStreamer support
|
||||
if [ "$CFG_GSTREAMER" = "auto" ] || [ "$CFG_GSTREAMER" = "yes" ]; then
|
||||
if compileTest unix/gstreamer "GStreamer 0.10" -config gst-0.10; then
|
||||
CFG_GSTREAMER=yes
|
||||
CFG_GSTREAMER_VERSION=0.10
|
||||
elif compileTest unix/gstreamer "GStreamer 1.0" -config gst-1.0; then
|
||||
CFG_GSTREAMER=yes
|
||||
CFG_GSTREAMER_VERSION=1.0
|
||||
else
|
||||
if [ "$CFG_GSTREAMER" = "yes" ]; then
|
||||
echo "GStreamer support cannot be enabled due to functionality tests!"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
exit 1
|
||||
fi
|
||||
CFG_GSTREAMER=no
|
||||
fi
|
||||
elif [ "$CFG_GSTREAMER" = "0.10" ]; then
|
||||
if compileTest unix/gstreamer "GStreamer 0.10" -config gst-0.10; then
|
||||
CFG_GSTREAMER=yes
|
||||
CFG_GSTREAMER_VERSION=0.10
|
||||
else
|
||||
echo "The GStreamer 0.10 functionality test failed!"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
exit 1
|
||||
fi
|
||||
elif [ "$CFG_GSTREAMER" = "1.0" ]; then
|
||||
if compileTest unix/gstreamer "GStreamer 1.0" -config gst-1.0; then
|
||||
CFG_GSTREAMER=yes
|
||||
CFG_GSTREAMER_VERSION=1.0
|
||||
else
|
||||
echo "The GStreamer 1.0 functionality test failed!"
|
||||
echo " Turn on verbose messaging (-v) to $0 to see the final report."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then
|
||||
echo "Warning: largefile support cannot be disabled for win32."
|
||||
CFG_LARGEFILE="yes"
|
||||
@ -6124,6 +6180,9 @@ if [ "$CFG_PULSEAUDIO" = "yes" ]; then
|
||||
QT_CONFIG="$QT_CONFIG pulseaudio"
|
||||
fi
|
||||
|
||||
[ "$CFG_GSTREAMER_VERSION" = "0.10" ] && QT_CONFIG="$QT_CONFIG gstreamer-0.10"
|
||||
[ "$CFG_GSTREAMER_VERSION" = "1.0" ] && QT_CONFIG="$QT_CONFIG gstreamer-1.0"
|
||||
|
||||
if [ "$CFG_COREWLAN" = "yes" ]; then
|
||||
QT_CONFIG="$QT_CONFIG corewlan"
|
||||
fi
|
||||
@ -6432,10 +6491,6 @@ fi
|
||||
# Add QPA to config.h
|
||||
QCONFIG_FLAGS="$QCONFIG_FLAGS"
|
||||
|
||||
if [ "${CFG_USE_FLOATMATH}" = "yes" ]; then
|
||||
QCONFIG_FLAGS="${QCONFIG_FLAGS} QT_USE_MATH_H_FLOATS"
|
||||
fi
|
||||
|
||||
# Add turned on SQL drivers
|
||||
for DRIVER in $CFG_SQL_AVAILABLE; do
|
||||
eval "VAL=\$CFG_SQL_$DRIVER"
|
||||
@ -6892,6 +6947,7 @@ report_support " Evdev .................." "$CFG_EVDEV"
|
||||
report_support " FontConfig ............." "$CFG_FONTCONFIG"
|
||||
report_support " FreeType ..............." "$CFG_FREETYPE" system "system library" yes "bundled copy"
|
||||
report_support " Glib ..................." "$CFG_GLIB"
|
||||
report_support " GStreamer .............." "$CFG_GSTREAMER" yes "$CFG_GSTREAMER_VERSION"
|
||||
report_support " GTK theme .............." "$CFG_QGTKSTYLE"
|
||||
report_support " HarfBuzz ..............." "$CFG_HARFBUZZ" system "system library" qt "bundled copy"
|
||||
report_support " Iconv .................." "$CFG_ICONV"
|
||||
|
@ -41,8 +41,7 @@
|
||||
#include "renderthread.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
//! [0]
|
||||
RenderThread::RenderThread(QObject *parent)
|
||||
@ -207,9 +206,9 @@ uint RenderThread::rgbFromWaveLength(double wave)
|
||||
else if (wave < 420.0)
|
||||
s = 0.3 + 0.7 * (wave - 380.0) / (420.0 - 380.0);
|
||||
|
||||
r = pow(r * s, 0.8);
|
||||
g = pow(g * s, 0.8);
|
||||
b = pow(b * s, 0.8);
|
||||
r = std::pow(r * s, 0.8);
|
||||
g = std::pow(g * s, 0.8);
|
||||
b = std::pow(b * s, 0.8);
|
||||
return qRgb(int(r * 255), int(g * 255), int(b * 255));
|
||||
}
|
||||
//! [10]
|
||||
|
@ -38,7 +38,7 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
#include "imagescaling.h"
|
||||
#include "math.h"
|
||||
#include <qmath.h>
|
||||
|
||||
const int imageSize = 100;
|
||||
|
||||
@ -110,7 +110,7 @@ void Images::open()
|
||||
qDeleteAll(labels);
|
||||
labels.clear();
|
||||
|
||||
int dim = sqrt(qreal(files.count())) + 1;
|
||||
int dim = qSqrt(qreal(files.count())) + 1;
|
||||
for (int i = 0; i < dim; ++i) {
|
||||
for (int j = 0; j < dim; ++j) {
|
||||
QLabel *imageLabel = new QLabel;
|
||||
|
@ -39,6 +39,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtCore/qmath.h>
|
||||
#include <QtCore/qstate.h>
|
||||
|
||||
class Pixmap : public QObject, public QGraphicsPixmapItem
|
||||
@ -181,13 +182,13 @@ int main(int argc, char **argv)
|
||||
Pixmap *item = items.at(i);
|
||||
// Ellipse
|
||||
ellipseState->assignProperty(item, "pos",
|
||||
QPointF(cos((i / 63.0) * 6.28) * 250,
|
||||
sin((i / 63.0) * 6.28) * 250));
|
||||
QPointF(qCos((i / 63.0) * 6.28) * 250,
|
||||
qSin((i / 63.0) * 6.28) * 250));
|
||||
|
||||
// Figure 8
|
||||
figure8State->assignProperty(item, "pos",
|
||||
QPointF(sin((i / 63.0) * 6.28) * 250,
|
||||
sin(((i * 2)/63.0) * 6.28) * 250));
|
||||
QPointF(qSin((i / 63.0) * 6.28) * 250,
|
||||
qSin(((i * 2)/63.0) * 6.28) * 250));
|
||||
|
||||
// Random
|
||||
randomState->assignProperty(item, "pos",
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "blurpicker.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
#include "blureffect.h"
|
||||
|
||||
@ -76,8 +77,8 @@ void BlurPicker::setIndex(qreal index)
|
||||
for (int i = 0; i < m_icons.count(); ++i) {
|
||||
QGraphicsItem *icon = m_icons[i];
|
||||
qreal a = ((i + m_index) * 2 * M_PI) / m_icons.count();
|
||||
qreal xs = 170 * sin(a);
|
||||
qreal ys = 100 * cos(a);
|
||||
qreal xs = 170 * qSin(a);
|
||||
qreal ys = 100 * qCos(a);
|
||||
QPointF pos(xs, ys);
|
||||
pos = QTransform().rotate(-20).map(pos);
|
||||
pos -= QPointF(40, 40);
|
||||
|
@ -41,6 +41,7 @@
|
||||
#include "lighting.h"
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <QtCore/qmath.h>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
@ -110,8 +111,8 @@ void Lighting::setupScene()
|
||||
void Lighting::animate()
|
||||
{
|
||||
angle += (M_PI / 30);
|
||||
qreal xs = 200 * sin(angle) - 40 + 25;
|
||||
qreal ys = 200 * cos(angle) - 40 + 25;
|
||||
qreal xs = 200 * qSin(angle) - 40 + 25;
|
||||
qreal ys = 200 * qCos(angle) - 40 + 25;
|
||||
m_lightSource->setPos(xs, ys);
|
||||
|
||||
for (int i = 0; i < m_items.size(); ++i) {
|
||||
@ -125,7 +126,7 @@ void Lighting::animate()
|
||||
|
||||
qreal dx = delta.x();
|
||||
qreal dy = delta.y();
|
||||
qreal dd = sqrt(dx * dx + dy * dy);
|
||||
qreal dd = qSqrt(dx * dx + dy * dy);
|
||||
QColor color = effect->color();
|
||||
color.setAlphaF(qBound(0.4, 1 - dd / 200.0, 0.7));
|
||||
effect->setColor(color);
|
||||
|
@ -242,7 +242,7 @@ void ItemBase::keyPressEvent(QKeyEvent *event)
|
||||
void ItemBase::wheelEvent(QGraphicsSceneWheelEvent *event)
|
||||
{
|
||||
prepareGeometryChange();
|
||||
m_size = int(m_size * exp(-event->delta() / 600.0));
|
||||
m_size = int(m_size * qExp(-event->delta() / 600.0));
|
||||
if (m_size > MAX_ITEM_SIZE)
|
||||
m_size = MAX_ITEM_SIZE;
|
||||
else if (m_size < MIN_ITEM_SIZE)
|
||||
@ -404,10 +404,10 @@ void CircleItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *option
|
||||
{
|
||||
int dt = m_startTime.msecsTo(QTime::currentTime());
|
||||
|
||||
qreal r0 = 0.5 * m_size * (1.0 - exp(-0.001 * ((dt + 3800) % 4000)));
|
||||
qreal r1 = 0.5 * m_size * (1.0 - exp(-0.001 * ((dt + 0) % 4000)));
|
||||
qreal r2 = 0.5 * m_size * (1.0 - exp(-0.001 * ((dt + 1800) % 4000)));
|
||||
qreal r3 = 0.5 * m_size * (1.0 - exp(-0.001 * ((dt + 2000) % 4000)));
|
||||
qreal r0 = 0.5 * m_size * (1.0 - qExp(-0.001 * ((dt + 3800) % 4000)));
|
||||
qreal r1 = 0.5 * m_size * (1.0 - qExp(-0.001 * ((dt + 0) % 4000)));
|
||||
qreal r2 = 0.5 * m_size * (1.0 - qExp(-0.001 * ((dt + 1800) % 4000)));
|
||||
qreal r3 = 0.5 * m_size * (1.0 - qExp(-0.001 * ((dt + 2000) % 4000)));
|
||||
|
||||
if (r0 > r1)
|
||||
r0 = 0.0;
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "scene.h"
|
||||
#include <QtGui/qmatrix4x4.h>
|
||||
#include <QtGui/qvector3d.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "3rdparty/fbm.h"
|
||||
|
||||
@ -856,7 +857,7 @@ void Scene::renderCubemaps()
|
||||
|
||||
float angle = 2.0f * PI * i / m_cubemaps.size();
|
||||
|
||||
center = m_trackBalls[1].rotation().rotatedVector(QVector3D(cos(angle), sin(angle), 0.0f));
|
||||
center = m_trackBalls[1].rotation().rotatedVector(QVector3D(std::cos(angle), std::sin(angle), 0.0f));
|
||||
|
||||
for (int face = 0; face < 6; ++face) {
|
||||
m_cubemaps[i]->begin(face);
|
||||
@ -910,7 +911,7 @@ void Scene::drawBackground(QPainter *painter, const QRectF &)
|
||||
|
||||
QMatrix4x4 view;
|
||||
view.rotate(m_trackBalls[2].rotation());
|
||||
view(2, 3) -= 2.0f * exp(m_distExp / 1200.0f);
|
||||
view(2, 3) -= 2.0f * std::exp(m_distExp / 1200.0f);
|
||||
renderBoxes(view);
|
||||
|
||||
defaultStates();
|
||||
|
@ -33,6 +33,7 @@
|
||||
|
||||
#include "trackball.h"
|
||||
#include "scene.h"
|
||||
#include <cmath>
|
||||
|
||||
//============================================================================//
|
||||
// TrackBall //
|
||||
@ -94,19 +95,19 @@ void TrackBall::move(const QPointF& p, const QQuaternion &transformation)
|
||||
QVector3D lastPos3D = QVector3D(m_lastPos.x(), m_lastPos.y(), 0.0f);
|
||||
float sqrZ = 1 - QVector3D::dotProduct(lastPos3D, lastPos3D);
|
||||
if (sqrZ > 0)
|
||||
lastPos3D.setZ(sqrt(sqrZ));
|
||||
lastPos3D.setZ(std::sqrt(sqrZ));
|
||||
else
|
||||
lastPos3D.normalize();
|
||||
|
||||
QVector3D currentPos3D = QVector3D(p.x(), p.y(), 0.0f);
|
||||
sqrZ = 1 - QVector3D::dotProduct(currentPos3D, currentPos3D);
|
||||
if (sqrZ > 0)
|
||||
currentPos3D.setZ(sqrt(sqrZ));
|
||||
currentPos3D.setZ(std::sqrt(sqrZ));
|
||||
else
|
||||
currentPos3D.normalize();
|
||||
|
||||
m_axis = QVector3D::crossProduct(lastPos3D, currentPos3D);
|
||||
float angle = 180 / PI * asin(sqrt(QVector3D::dotProduct(m_axis, m_axis)));
|
||||
float angle = 180 / PI * std::asin(std::sqrt(QVector3D::dotProduct(m_axis, m_axis)));
|
||||
|
||||
m_angularVelocity = angle / msecs;
|
||||
m_axis.normalize();
|
||||
|
@ -38,8 +38,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include <QtWidgets>
|
||||
#include <cmath>
|
||||
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.1415927
|
||||
@ -109,13 +109,13 @@ QModelIndex PieView::indexAt(const QPoint &point) const
|
||||
double cy = totalSize / 2 - wy; // positive cy for items above the center
|
||||
|
||||
// Determine the distance from the center point of the pie chart.
|
||||
double d = pow(pow(cx, 2) + pow(cy, 2), 0.5);
|
||||
double d = std::sqrt(std::pow(cx, 2) + std::pow(cy, 2));
|
||||
|
||||
if (d == 0 || d > pieSize / 2)
|
||||
return QModelIndex();
|
||||
|
||||
// Determine the angle of the point.
|
||||
double angle = (180 / M_PI) * acos(cx / d);
|
||||
double angle = (180 / M_PI) * std::acos(cx / d);
|
||||
if (cy < 0)
|
||||
angle = 360 - angle;
|
||||
|
||||
|
@ -39,7 +39,7 @@
|
||||
****************************************************************************/
|
||||
|
||||
#include <QtWidgets>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "starrating.h"
|
||||
|
||||
@ -53,8 +53,8 @@ StarRating::StarRating(int starCount, int maxStarCount)
|
||||
|
||||
starPolygon << QPointF(1.0, 0.5);
|
||||
for (int i = 1; i < 5; ++i)
|
||||
starPolygon << QPointF(0.5 + 0.5 * cos(0.8 * i * 3.14),
|
||||
0.5 + 0.5 * sin(0.8 * i * 3.14));
|
||||
starPolygon << QPointF(0.5 + 0.5 * std::cos(0.8 * i * 3.14),
|
||||
0.5 + 0.5 * std::sin(0.8 * i * 3.14));
|
||||
|
||||
diamondPolygon << QPointF(0.4, 0.5) << QPointF(0.5, 0.4)
|
||||
<< QPointF(0.6, 0.5) << QPointF(0.5, 0.6)
|
||||
|
@ -43,6 +43,7 @@
|
||||
|
||||
#include <QDir>
|
||||
#include <qmath.h>
|
||||
#include <cmath>
|
||||
|
||||
static QString sizeToString(qint64 size)
|
||||
{
|
||||
@ -51,11 +52,11 @@ static QString sizeToString(qint64 size)
|
||||
if (size <= 0)
|
||||
return StorageModel::tr("0 b");
|
||||
|
||||
double power = log((double)size)/log(1024.0);
|
||||
double power = std::log((double)size)/std::log(1024.0);
|
||||
int intPower = (int)power;
|
||||
intPower = intPower >= 8 ? 8 - 1 : intPower;
|
||||
|
||||
double normSize = size / pow(1024.0, intPower);
|
||||
double normSize = size / std::pow(1024.0, intPower);
|
||||
//: this should expand to "1.23 GB"
|
||||
return StorageModel::tr("%1 %2").arg(normSize, 0, 'f', intPower > 0 ? 2 : 0).arg(strings[intPower]);
|
||||
}
|
||||
|
@ -43,7 +43,7 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
//! [0]
|
||||
const float Pi = 3.14159f;
|
||||
@ -123,8 +123,8 @@ Window::Window()
|
||||
QPainterPath starPath;
|
||||
starPath.moveTo(90, 50);
|
||||
for (int i = 1; i < 5; ++i) {
|
||||
starPath.lineTo(50 + 40 * cos(0.8 * i * Pi),
|
||||
50 + 40 * sin(0.8 * i * Pi));
|
||||
starPath.lineTo(50 + 40 * std::cos(0.8 * i * Pi),
|
||||
50 + 40 * std::sin(0.8 * i * Pi));
|
||||
}
|
||||
starPath.closeSubpath();
|
||||
//! [9]
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "basictoolsplugin.h"
|
||||
@ -139,8 +139,8 @@ QPainterPath BasicToolsPlugin::generateShape(const QString &shape,
|
||||
} else if (shape == tr("Star")) {
|
||||
path.moveTo(90, 50);
|
||||
for (int i = 1; i < 5; ++i) {
|
||||
path.lineTo(50 + 40 * cos(0.8 * i * Pi),
|
||||
50 + 40 * sin(0.8 * i * Pi));
|
||||
path.lineTo(50 + 40 * std::cos(0.8 * i * Pi),
|
||||
50 + 40 * std::sin(0.8 * i * Pi));
|
||||
}
|
||||
path.closeSubpath();
|
||||
} else if (shape == tr("Text...")) {
|
||||
|
@ -40,7 +40,7 @@
|
||||
|
||||
#include <QtWidgets>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "button.h"
|
||||
#include "calculator.h"
|
||||
@ -164,9 +164,9 @@ void Calculator::unaryOperatorClicked()
|
||||
abortOperation();
|
||||
return;
|
||||
}
|
||||
result = sqrt(operand);
|
||||
result = std::sqrt(operand);
|
||||
} else if (clickedOperator == tr("x\302\262")) {
|
||||
result = pow(operand, 2.0);
|
||||
result = std::pow(operand, 2.0);
|
||||
} else if (clickedOperator == tr("1/x")) {
|
||||
if (operand == 0.0) {
|
||||
abortOperation();
|
||||
|
@ -257,7 +257,7 @@ while (i.hasNext()) {
|
||||
QMutableListIterator<double> i(list);
|
||||
while (i.hasNext()) {
|
||||
double val = i.next();
|
||||
i.setValue(sqrt(val));
|
||||
i.setValue(std::sqrt(val));
|
||||
}
|
||||
//! [23]
|
||||
|
||||
@ -266,7 +266,7 @@ while (i.hasNext()) {
|
||||
QMutableLinkedListIterator<double> i(list);
|
||||
while (i.hasNext()) {
|
||||
double val = i.next();
|
||||
i.setValue(sqrt(val));
|
||||
i.setValue(std::sqrt(val));
|
||||
}
|
||||
//! [24]
|
||||
|
||||
@ -275,7 +275,7 @@ while (i.hasNext()) {
|
||||
QMutableVectorIterator<double> i(list);
|
||||
while (i.hasNext()) {
|
||||
double val = i.next();
|
||||
i.setValue(sqrt(val));
|
||||
i.setValue(std::sqrt(val));
|
||||
}
|
||||
//! [25]
|
||||
|
||||
|
@ -105,7 +105,7 @@ MyWidget::mouseMoveEvent(QMouseEvent *event)
|
||||
|
||||
|
||||
//! [8]
|
||||
double trueLength = sqrt(pow(x(), 2) + pow(y(), 2));
|
||||
double trueLength = std::sqrt(std::pow(x(), 2) + std::pow(y(), 2));
|
||||
//! [8]
|
||||
|
||||
|
||||
|
@ -297,6 +297,9 @@
|
||||
#ifndef QT_NO_DESKTOPSERVICES
|
||||
# define QT_NO_DESKTOPSERVICES
|
||||
#endif
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
# define QT_NO_MIMETYPE
|
||||
#endif
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
# define QT_NO_SYSTEMTRAYICON
|
||||
#endif
|
||||
|
@ -187,6 +187,9 @@
|
||||
#ifndef QT_NO_DESKTOPSERVICES
|
||||
# define QT_NO_DESKTOPSERVICES
|
||||
#endif
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
# define QT_NO_MIMETYPE
|
||||
#endif
|
||||
#ifndef QT_NO_SYSTEMTRAYICON
|
||||
# define QT_NO_SYSTEMTRAYICON
|
||||
#endif
|
||||
|
@ -879,6 +879,12 @@ Section: Utilities
|
||||
Requires:
|
||||
Name: QDesktopServices
|
||||
|
||||
Feature: MIMETYPE
|
||||
Description: Describes types of file or data, represented by a MIME type string.
|
||||
Section: Utilities
|
||||
Requires:
|
||||
Name: QMimeType
|
||||
|
||||
Feature: SYSTEMTRAYICON
|
||||
Description: Provides an icon for an application in the system tray.
|
||||
Section: Utilities
|
||||
|
@ -35,7 +35,7 @@
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
# define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
#if !defined(_XOPEN_SOURCE) && !defined(__QNXNTO__)
|
||||
#if !defined(_XOPEN_SOURCE) && !defined(__QNXNTO__) && !defined(ANDROID)
|
||||
# define _XOPEN_SOURCE 500
|
||||
#endif
|
||||
|
||||
|
@ -38,153 +38,98 @@
|
||||
#pragma qt_class(QtMath)
|
||||
#endif
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
#include <QtCore/qcompilerdetection.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
|
||||
#define QT_SINE_TABLE_SIZE 256
|
||||
|
||||
extern Q_CORE_EXPORT const qreal qt_sine_table[QT_SINE_TABLE_SIZE];
|
||||
|
||||
inline int qCeil(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return int(ceilf(float(v)));
|
||||
else
|
||||
#endif
|
||||
return int(ceil(v));
|
||||
using std::ceil;
|
||||
return int(ceil(v));
|
||||
}
|
||||
|
||||
inline int qFloor(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return int(floorf(float(v)));
|
||||
else
|
||||
#endif
|
||||
return int(floor(v));
|
||||
using std::floor;
|
||||
return int(floor(v));
|
||||
}
|
||||
|
||||
inline qreal qFabs(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if(sizeof(qreal) == sizeof(float))
|
||||
return fabsf(float(v));
|
||||
else
|
||||
#endif
|
||||
return fabs(v);
|
||||
using std::fabs;
|
||||
return fabs(v);
|
||||
}
|
||||
|
||||
inline qreal qSin(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return sinf(float(v));
|
||||
else
|
||||
#endif
|
||||
return sin(v);
|
||||
using std::sin;
|
||||
return sin(v);
|
||||
}
|
||||
|
||||
inline qreal qCos(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return cosf(float(v));
|
||||
else
|
||||
#endif
|
||||
return cos(v);
|
||||
using std::cos;
|
||||
return cos(v);
|
||||
}
|
||||
|
||||
inline qreal qTan(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return tanf(float(v));
|
||||
else
|
||||
#endif
|
||||
return tan(v);
|
||||
using std::tan;
|
||||
return tan(v);
|
||||
}
|
||||
|
||||
inline qreal qAcos(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return acosf(float(v));
|
||||
else
|
||||
#endif
|
||||
return acos(v);
|
||||
using std::acos;
|
||||
return acos(v);
|
||||
}
|
||||
|
||||
inline qreal qAsin(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return asinf(float(v));
|
||||
else
|
||||
#endif
|
||||
return asin(v);
|
||||
using std::asin;
|
||||
return asin(v);
|
||||
}
|
||||
|
||||
inline qreal qAtan(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return atanf(float(v));
|
||||
else
|
||||
#endif
|
||||
return atan(v);
|
||||
using std::atan;
|
||||
return atan(v);
|
||||
}
|
||||
|
||||
inline qreal qAtan2(qreal y, qreal x)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return atan2f(float(y), float(x));
|
||||
else
|
||||
#endif
|
||||
return atan2(y, x);
|
||||
using std::atan2;
|
||||
return atan2(y, x);
|
||||
}
|
||||
|
||||
inline qreal qSqrt(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return sqrtf(float(v));
|
||||
else
|
||||
#endif
|
||||
return sqrt(v);
|
||||
using std::sqrt;
|
||||
return sqrt(v);
|
||||
}
|
||||
|
||||
inline qreal qLn(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return logf(float(v));
|
||||
else
|
||||
#endif
|
||||
return log(v);
|
||||
using std::log;
|
||||
return log(v);
|
||||
}
|
||||
|
||||
inline qreal qExp(qreal v)
|
||||
{
|
||||
// only one signature
|
||||
// exists, exp(double)
|
||||
using std::exp;
|
||||
return exp(v);
|
||||
}
|
||||
|
||||
inline qreal qPow(qreal x, qreal y)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return powf(float(x), float(y));
|
||||
else
|
||||
#endif
|
||||
return pow(x, y);
|
||||
using std::pow;
|
||||
return pow(x, y);
|
||||
}
|
||||
|
||||
#ifndef M_E
|
||||
|
@ -20,6 +20,6 @@ SOURCES += \
|
||||
mimetypes/qmimeglobpattern.cpp \
|
||||
mimetypes/qmimeprovider.cpp
|
||||
|
||||
RESOURCES += \
|
||||
mimetypes/mimetypes.qrc
|
||||
|
||||
!contains(DEFINES, QT_NO_MIMETYPE) {
|
||||
RESOURCES += mimetypes/mimetypes.qrc
|
||||
}
|
||||
|
@ -33,8 +33,9 @@
|
||||
|
||||
#include <qplatformdefs.h> // always first
|
||||
|
||||
#include "qmimedatabase.h"
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimedatabase.h"
|
||||
#include "qmimedatabase_p.h"
|
||||
|
||||
#include "qmimeprovider_p.h"
|
||||
@ -597,3 +598,5 @@ QList<QMimeType> QMimeDatabase::allMimeTypes() const
|
||||
*/
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -35,6 +35,9 @@
|
||||
#define QMIMEDATABASE_H
|
||||
|
||||
#include <QtCore/qmimetype.h>
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qstringlist.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -81,4 +84,6 @@ private:
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QMIMEDATABASE_H
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEDATABASE_H
|
||||
|
@ -45,13 +45,16 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
#include "qmimetype.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimetype_p.h"
|
||||
#include "qmimeglobpattern_p.h"
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qmutex.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QIODevice;
|
||||
@ -90,4 +93,5 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QMIMEDATABASE_P_H
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEDATABASE_P_H
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include "qmimeglobpattern_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QStringList>
|
||||
#include <QDebug>
|
||||
@ -234,3 +236,5 @@ void QMimeAllGlobPatterns::clear()
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -45,6 +45,10 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qstringlist.h>
|
||||
#include <QtCore/qhash.h>
|
||||
|
||||
@ -146,4 +150,5 @@ public:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEGLOBPATTERN_P_H
|
||||
|
@ -36,6 +36,8 @@
|
||||
|
||||
#include "qmimemagicrule_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/QList>
|
||||
#include <QtCore/QDebug>
|
||||
#include <qendian.h>
|
||||
@ -377,3 +379,5 @@ bool QMimeMagicRule::matches(const QByteArray &data) const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -45,6 +45,10 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qscopedpointer.h>
|
||||
#include <QtCore/qlist.h>
|
||||
@ -89,4 +93,5 @@ Q_DECLARE_TYPEINFO(QMimeMagicRule, Q_MOVABLE_TYPE);
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEMAGICRULE_H
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include "qmimemagicrulematcher_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimetype_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -98,3 +100,4 @@ unsigned QMimeMagicRuleMatcher::priority() const
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -45,12 +45,14 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include "qmimemagicrule_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qbytearray.h>
|
||||
#include <QtCore/qlist.h>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
#include "qmimemagicrule_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
class QMimeMagicRuleMatcher
|
||||
@ -78,4 +80,5 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEMAGICRULEMATCHER_P_H
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include "qmimeprovider_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimetypeparser_p.h"
|
||||
#include <qstandardpaths.h>
|
||||
#include "qmimemagicrulematcher_p.h"
|
||||
@ -866,3 +868,5 @@ void QMimeXMLProvider::addMagicMatcher(const QMimeMagicRuleMatcher &matcher)
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -45,8 +45,11 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include "qmimedatabase_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qdatetime.h>
|
||||
#include <QtCore/qset.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -168,4 +171,5 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMEPROVIDER_P_H
|
||||
|
@ -33,6 +33,8 @@
|
||||
|
||||
#include "qmimetype.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimetype_p.h"
|
||||
#include "qmimedatabase_p.h"
|
||||
#include "qmimeprovider_p.h"
|
||||
@ -449,3 +451,5 @@ QDebug operator<<(QDebug debug, const QMimeType &mime)
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -34,6 +34,10 @@
|
||||
#ifndef QMIMETYPE_H
|
||||
#define QMIMETYPE_H
|
||||
|
||||
#include <QtCore/qglobal.h>
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qshareddata.h>
|
||||
#include <QtCore/qstring.h>
|
||||
|
||||
@ -108,4 +112,6 @@ Q_CORE_EXPORT QDebug operator<<(QDebug debug, const QMimeType &mime);
|
||||
#endif
|
||||
|
||||
QT_END_NAMESPACE
|
||||
#endif // QMIMETYPE_H
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMETYPE_H
|
||||
|
@ -47,6 +47,8 @@
|
||||
|
||||
#include "qmimetype.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include <QtCore/qhash.h>
|
||||
#include <QtCore/qstringlist.h>
|
||||
|
||||
@ -112,4 +114,5 @@ QT_END_NAMESPACE
|
||||
QT_END_NAMESPACE
|
||||
#endif
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // QMIMETYPE_P_H
|
||||
|
@ -35,6 +35,8 @@
|
||||
|
||||
#include "qmimetypeparser_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimetype_p.h"
|
||||
#include "qmimemagicrulematcher_p.h"
|
||||
|
||||
@ -341,3 +343,5 @@ bool QMimeTypeParserBase::parse(QIODevice *dev, const QString &fileName, QString
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
@ -47,6 +47,9 @@
|
||||
//
|
||||
|
||||
#include "qmimedatabase_p.h"
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
#include "qmimeprovider_p.h"
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
@ -118,4 +121,5 @@ private:
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
#endif // MIMETYPEPARSER_P_H
|
||||
|
@ -657,7 +657,7 @@ struct BezierEase : public QEasingCurveFunction
|
||||
|
||||
qreal static inline _acos(qreal x)
|
||||
{
|
||||
return sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
|
||||
return std::sqrt(1-x)*(1.5707963267948966192313216916398f + x*(-0.213300989f + x*(0.077980478f + x*-0.02164095f)));
|
||||
}
|
||||
|
||||
qreal static inline _cos(qreal x) //super fast _cos
|
||||
@ -704,8 +704,8 @@ struct BezierEase : public QEasingCurveFunction
|
||||
//We use approximations instead
|
||||
|
||||
const qreal x_squared = x * x;
|
||||
const qreal x_plus_one_sqrt = sqrt(1.0 + x);
|
||||
const qreal one_minus_x_sqrt = sqrt(1.0 - x);
|
||||
const qreal x_plus_one_sqrt = qSqrt(1.0 + x);
|
||||
const qreal one_minus_x_sqrt = qSqrt(1.0 - x);
|
||||
|
||||
//cos(acos(x) / 3)
|
||||
//s1 = _cos(_acos(x) / 3);
|
||||
@ -743,7 +743,7 @@ struct BezierEase : public QEasingCurveFunction
|
||||
const qreal D = 0.25 * q_squared + p_cubic / 27.0;
|
||||
|
||||
if (D >= 0) {
|
||||
const qreal D_sqrt = sqrt(D);
|
||||
const qreal D_sqrt = qSqrt(D);
|
||||
qreal u = _cbrt( -q * 0.5 + D_sqrt);
|
||||
qreal v = _cbrt( -q * 0.5 - D_sqrt);
|
||||
qreal z1 = u + v;
|
||||
@ -758,13 +758,13 @@ struct BezierEase : public QEasingCurveFunction
|
||||
}
|
||||
|
||||
//casus irreducibilis
|
||||
const qreal p_minus_sqrt = sqrt(-p);
|
||||
const qreal p_minus_sqrt = qSqrt(-p);
|
||||
|
||||
//const qreal f = sqrt(4.0 / 3.0 * -p);
|
||||
const qreal f = sqrt(4.0 / 3.0) * p_minus_sqrt;
|
||||
const qreal f = qSqrt(4.0 / 3.0) * p_minus_sqrt;
|
||||
|
||||
//const qreal sqrtP = sqrt(27.0 / -p_cubic);
|
||||
const qreal sqrtP = -3.0*sqrt(3.0) / (p_minus_sqrt * p);
|
||||
const qreal sqrtP = -3.0*qSqrt(3.0) / (p_minus_sqrt * p);
|
||||
|
||||
|
||||
const qreal g = -q * 0.5 * sqrtP;
|
||||
|
@ -2078,11 +2078,16 @@ void QWindowPrivate::deliverUpdateRequest()
|
||||
Calling this function multiple times will result in a single event
|
||||
being delivered to the window.
|
||||
|
||||
Subclasses of QWindow should reimplement QWindow::event(), intercept
|
||||
the event and call the application's rendering code, then call the
|
||||
base class implementation.
|
||||
*/
|
||||
Subclasses of QWindow should reimplement event(), intercept the event and
|
||||
call the application's rendering code, then call the base class
|
||||
implementation.
|
||||
|
||||
\note The subclass' reimplementation of event() must invoke the base class
|
||||
implementation, unless it is absolutely sure that the event does not need to
|
||||
be handled by the base class. For example, the default implementation of
|
||||
this function relies on QEvent::Timer events. Filtering them away would
|
||||
therefore break the delivery of the update events.
|
||||
*/
|
||||
void QWindow::requestUpdate()
|
||||
{
|
||||
Q_D(QWindow);
|
||||
|
@ -1125,8 +1125,8 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
|
||||
c = -1.0f;
|
||||
} else {
|
||||
float a = angle * M_PI / 180.0f;
|
||||
c = cosf(a);
|
||||
s = sinf(a);
|
||||
c = std::cos(a);
|
||||
s = std::sin(a);
|
||||
}
|
||||
if (x == 0.0f) {
|
||||
if (y == 0.0f) {
|
||||
@ -1186,7 +1186,7 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
|
||||
double(y) * double(y) +
|
||||
double(z) * double(z);
|
||||
if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
|
||||
len = sqrt(len);
|
||||
len = std::sqrt(len);
|
||||
x = float(double(x) / len);
|
||||
y = float(double(y) / len);
|
||||
z = float(double(z) / len);
|
||||
@ -1234,8 +1234,8 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
|
||||
c = -1.0f;
|
||||
} else {
|
||||
float a = angle * M_PI / 180.0f;
|
||||
c = cosf(a);
|
||||
s = sinf(a);
|
||||
c = std::cos(a);
|
||||
s = std::sin(a);
|
||||
}
|
||||
if (x == 0.0f) {
|
||||
if (y == 0.0f) {
|
||||
@ -1282,7 +1282,7 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
|
||||
double(y) * double(y) +
|
||||
double(z) * double(z);
|
||||
if (!qFuzzyCompare(len, 1.0) && !qFuzzyIsNull(len)) {
|
||||
len = sqrt(len);
|
||||
len = std::sqrt(len);
|
||||
x = float(double(x) / len);
|
||||
y = float(double(y) / len);
|
||||
z = float(double(z) / len);
|
||||
@ -1487,10 +1487,10 @@ void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearP
|
||||
// Construct the projection.
|
||||
QMatrix4x4 m(1);
|
||||
float radians = (verticalAngle / 2.0f) * M_PI / 180.0f;
|
||||
float sine = sinf(radians);
|
||||
float sine = std::sin(radians);
|
||||
if (sine == 0.0f)
|
||||
return;
|
||||
float cotan = cosf(radians) / sine;
|
||||
float cotan = std::cos(radians) / sine;
|
||||
float clip = farPlane - nearPlane;
|
||||
m.m[0][0] = cotan / aspectRatio;
|
||||
m.m[1][0] = 0.0f;
|
||||
|
@ -219,7 +219,7 @@ QT_BEGIN_NAMESPACE
|
||||
*/
|
||||
float QQuaternion::length() const
|
||||
{
|
||||
return qSqrt(xp * xp + yp * yp + zp * zp + wp * wp);
|
||||
return std::sqrt(xp * xp + yp * yp + zp * zp + wp * wp);
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -252,7 +252,7 @@ QQuaternion QQuaternion::normalized() const
|
||||
if (qFuzzyIsNull(len - 1.0f))
|
||||
return *this;
|
||||
else if (!qFuzzyIsNull(len))
|
||||
return *this / qSqrt(len);
|
||||
return *this / std::sqrt(len);
|
||||
else
|
||||
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
|
||||
}
|
||||
@ -273,7 +273,7 @@ void QQuaternion::normalize()
|
||||
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
|
||||
return;
|
||||
|
||||
len = qSqrt(len);
|
||||
len = std::sqrt(len);
|
||||
|
||||
xp /= len;
|
||||
yp /= len;
|
||||
@ -386,8 +386,8 @@ QQuaternion QQuaternion::fromAxisAndAngle(const QVector3D& axis, float angle)
|
||||
// We normalize the result just in case the values are close
|
||||
// to zero, as suggested in the above FAQ.
|
||||
float a = (angle / 2.0f) * M_PI / 180.0f;
|
||||
float s = sinf(a);
|
||||
float c = cosf(a);
|
||||
float s = std::sin(a);
|
||||
float c = std::cos(a);
|
||||
QVector3D ax = axis.normalized();
|
||||
return QQuaternion(c, ax.x() * s, ax.y() * s, ax.z() * s).normalized();
|
||||
}
|
||||
@ -415,12 +415,12 @@ void QQuaternion::toAxisAndAngle(float *x, float *y, float *z, float *angle) con
|
||||
*y = yp;
|
||||
*z = zp;
|
||||
if (!qFuzzyIsNull(length - 1.0f)) {
|
||||
length = sqrtf(length);
|
||||
length = std::sqrt(length);
|
||||
*x /= length;
|
||||
*y /= length;
|
||||
*z /= length;
|
||||
}
|
||||
*angle = 2.0f * acosf(wp);
|
||||
*angle = 2.0f * std::acos(wp);
|
||||
} else {
|
||||
// angle is 0 (mod 2*pi), so any axis will fit
|
||||
*x = *y = *z = *angle = 0.0f;
|
||||
@ -438,15 +438,15 @@ void QQuaternion::toAxisAndAngle(float *x, float *y, float *z, float *angle) con
|
||||
QQuaternion QQuaternion::fromAxisAndAngle
|
||||
(float x, float y, float z, float angle)
|
||||
{
|
||||
float length = qSqrt(x * x + y * y + z * z);
|
||||
float length = std::sqrt(x * x + y * y + z * z);
|
||||
if (!qFuzzyIsNull(length - 1.0f) && !qFuzzyIsNull(length)) {
|
||||
x /= length;
|
||||
y /= length;
|
||||
z /= length;
|
||||
}
|
||||
float a = (angle / 2.0f) * M_PI / 180.0f;
|
||||
float s = sinf(a);
|
||||
float c = cosf(a);
|
||||
float s = std::sin(a);
|
||||
float c = std::cos(a);
|
||||
return QQuaternion(c, x * s, y * s, z * s).normalized();
|
||||
}
|
||||
|
||||
@ -515,20 +515,20 @@ void QQuaternion::toEulerAngles(float *pitch, float *yaw, float *roll) const
|
||||
zw /= lengthSquared;
|
||||
}
|
||||
|
||||
*pitch = asinf(-2.0f * (yz - xw));
|
||||
*pitch = std::asin(-2.0f * (yz - xw));
|
||||
if (*pitch < M_PI_2) {
|
||||
if (*pitch > -M_PI_2) {
|
||||
*yaw = atan2f(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
|
||||
*roll = atan2f(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
|
||||
*yaw = std::atan2(2.0f * (xz + yw), 1.0f - 2.0f * (xx + yy));
|
||||
*roll = std::atan2(2.0f * (xy + zw), 1.0f - 2.0f * (xx + zz));
|
||||
} else {
|
||||
// not a unique solution
|
||||
*roll = 0.0f;
|
||||
*yaw = -atan2f(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
|
||||
*yaw = -std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
|
||||
}
|
||||
} else {
|
||||
// not a unique solution
|
||||
*roll = 0.0f;
|
||||
*yaw = atan2f(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
|
||||
*yaw = std::atan2(-2.0f * (xy - zw), 1.0f - 2.0f * (yy + zz));
|
||||
}
|
||||
|
||||
*pitch = qRadiansToDegrees(*pitch);
|
||||
@ -558,12 +558,12 @@ QQuaternion QQuaternion::fromEulerAngles(float pitch, float yaw, float roll)
|
||||
yaw *= 0.5f;
|
||||
roll *= 0.5f;
|
||||
|
||||
const float c1 = cosf(yaw);
|
||||
const float s1 = sinf(yaw);
|
||||
const float c2 = cosf(roll);
|
||||
const float s2 = sinf(roll);
|
||||
const float c3 = cosf(pitch);
|
||||
const float s3 = sinf(pitch);
|
||||
const float c1 = std::cos(yaw);
|
||||
const float s1 = std::sin(yaw);
|
||||
const float c2 = std::cos(roll);
|
||||
const float s2 = std::sin(roll);
|
||||
const float c3 = std::cos(pitch);
|
||||
const float s3 = std::sin(pitch);
|
||||
const float c1c2 = c1 * c2;
|
||||
const float s1s2 = s1 * s2;
|
||||
|
||||
@ -635,7 +635,7 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3)
|
||||
|
||||
const float trace = rot3x3(0, 0) + rot3x3(1, 1) + rot3x3(2, 2);
|
||||
if (trace > 0.00000001f) {
|
||||
const float s = 2.0f * sqrtf(trace + 1.0f);
|
||||
const float s = 2.0f * std::sqrt(trace + 1.0f);
|
||||
scalar = 0.25f * s;
|
||||
axis[0] = (rot3x3(2, 1) - rot3x3(1, 2)) / s;
|
||||
axis[1] = (rot3x3(0, 2) - rot3x3(2, 0)) / s;
|
||||
@ -650,7 +650,7 @@ QQuaternion QQuaternion::fromRotationMatrix(const QMatrix3x3 &rot3x3)
|
||||
int j = s_next[i];
|
||||
int k = s_next[j];
|
||||
|
||||
const float s = 2.0f * sqrtf(rot3x3(i, i) - rot3x3(j, j) - rot3x3(k, k) + 1.0f);
|
||||
const float s = 2.0f * std::sqrt(rot3x3(i, i) - rot3x3(j, j) - rot3x3(k, k) + 1.0f);
|
||||
axis[i] = 0.25f * s;
|
||||
scalar = (rot3x3(k, j) - rot3x3(j, k)) / s;
|
||||
axis[j] = (rot3x3(j, i) + rot3x3(i, j)) / s;
|
||||
@ -792,11 +792,11 @@ QQuaternion QQuaternion::slerp
|
||||
float factor1 = 1.0f - t;
|
||||
float factor2 = t;
|
||||
if ((1.0f - dot) > 0.0000001) {
|
||||
float angle = acosf(dot);
|
||||
float sinOfAngle = sinf(angle);
|
||||
float angle = std::acos(dot);
|
||||
float sinOfAngle = std::sin(angle);
|
||||
if (sinOfAngle > 0.0000001) {
|
||||
factor1 = sinf((1.0f - t) * angle) / sinOfAngle;
|
||||
factor2 = sinf(t * angle) / sinOfAngle;
|
||||
factor1 = std::sin((1.0f - t) * angle) / sinOfAngle;
|
||||
factor2 = std::sin(t * angle) / sinOfAngle;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -189,7 +189,7 @@ float QVector2D::length() const
|
||||
// Need some extra precision if the length is very small.
|
||||
double len = double(xp) * double(xp) +
|
||||
double(yp) * double(yp);
|
||||
return float(sqrt(len));
|
||||
return float(std::sqrt(len));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -220,7 +220,7 @@ QVector2D QVector2D::normalized() const
|
||||
if (qFuzzyIsNull(len - 1.0f)) {
|
||||
return *this;
|
||||
} else if (!qFuzzyIsNull(len)) {
|
||||
double sqrtLen = sqrt(len);
|
||||
double sqrtLen = std::sqrt(len);
|
||||
return QVector2D(float(double(xp) / sqrtLen), float(double(yp) / sqrtLen));
|
||||
} else {
|
||||
return QVector2D();
|
||||
@ -241,7 +241,7 @@ void QVector2D::normalize()
|
||||
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
|
||||
return;
|
||||
|
||||
len = sqrt(len);
|
||||
len = std::sqrt(len);
|
||||
|
||||
xp = float(double(xp) / len);
|
||||
yp = float(double(yp) / len);
|
||||
|
@ -235,7 +235,7 @@ QVector3D QVector3D::normalized() const
|
||||
if (qFuzzyIsNull(len - 1.0f)) {
|
||||
return *this;
|
||||
} else if (!qFuzzyIsNull(len)) {
|
||||
double sqrtLen = sqrt(len);
|
||||
double sqrtLen = std::sqrt(len);
|
||||
return QVector3D(float(double(xp) / sqrtLen),
|
||||
float(double(yp) / sqrtLen),
|
||||
float(double(zp) / sqrtLen));
|
||||
@ -259,7 +259,7 @@ void QVector3D::normalize()
|
||||
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
|
||||
return;
|
||||
|
||||
len = sqrt(len);
|
||||
len = std::sqrt(len);
|
||||
|
||||
xp = float(double(xp) / len);
|
||||
yp = float(double(yp) / len);
|
||||
@ -679,7 +679,7 @@ float QVector3D::length() const
|
||||
double len = double(xp) * double(xp) +
|
||||
double(yp) * double(yp) +
|
||||
double(zp) * double(zp);
|
||||
return float(sqrt(len));
|
||||
return float(std::sqrt(len));
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -256,7 +256,7 @@ float QVector4D::length() const
|
||||
double(yp) * double(yp) +
|
||||
double(zp) * double(zp) +
|
||||
double(wp) * double(wp);
|
||||
return float(sqrt(len));
|
||||
return float(std::sqrt(len));
|
||||
}
|
||||
|
||||
/*!
|
||||
@ -289,7 +289,7 @@ QVector4D QVector4D::normalized() const
|
||||
if (qFuzzyIsNull(len - 1.0f)) {
|
||||
return *this;
|
||||
} else if (!qFuzzyIsNull(len)) {
|
||||
double sqrtLen = sqrt(len);
|
||||
double sqrtLen = std::sqrt(len);
|
||||
return QVector4D(float(double(xp) / sqrtLen),
|
||||
float(double(yp) / sqrtLen),
|
||||
float(double(zp) / sqrtLen),
|
||||
@ -315,7 +315,7 @@ void QVector4D::normalize()
|
||||
if (qFuzzyIsNull(len - 1.0f) || qFuzzyIsNull(len))
|
||||
return;
|
||||
|
||||
len = sqrt(len);
|
||||
len = std::sqrt(len);
|
||||
|
||||
xp = float(double(xp) / len);
|
||||
yp = float(double(yp) / len);
|
||||
|
@ -462,8 +462,8 @@ void QOpenGL2PaintEngineExPrivate::updateMatrix()
|
||||
// anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
|
||||
if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
|
||||
// 0.50 needs to rounded down to 0.0 for consistency with raster engine:
|
||||
dx = ceilf(dx - 0.5f);
|
||||
dy = ceilf(dy - 0.5f);
|
||||
dx = std::ceil(dx - 0.5f);
|
||||
dy = std::ceil(dy - 0.5f);
|
||||
}
|
||||
pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
|
||||
pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
|
||||
|
@ -134,11 +134,11 @@ inline void QTriangulatingStroker::normalVector(float x1, float y1, float x2, fl
|
||||
float pw;
|
||||
|
||||
if (dx == 0)
|
||||
pw = m_width / qAbs(dy);
|
||||
pw = m_width / std::abs(dy);
|
||||
else if (dy == 0)
|
||||
pw = m_width / qAbs(dx);
|
||||
pw = m_width / std::abs(dx);
|
||||
else
|
||||
pw = m_width / sqrt(dx*dx + dy*dy);
|
||||
pw = m_width / std::sqrt(dx*dx + dy*dy);
|
||||
|
||||
*nx = -dy * pw;
|
||||
*ny = dx * pw;
|
||||
|
@ -49,8 +49,6 @@
|
||||
#include <private/qopenglextensions_p.h>
|
||||
#include <private/qrbtree_p.h>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
//#define Q_TRIANGULATOR_DEBUG
|
||||
@ -1700,8 +1698,8 @@ void QTriangulator<T>::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *)
|
||||
QPodPoint q = vertices.at(splits.at(i).vertex);
|
||||
QPodPoint u = vertices.at(edges.at(splits.at(i).edge).from) - q;
|
||||
QPodPoint v = vertices.at(edges.at(splits.at(i).edge).to) - q;
|
||||
qreal uLen = sqrt(qreal(qDot(u, u)));
|
||||
qreal vLen = sqrt(qreal(qDot(v, v)));
|
||||
qreal uLen = qSqrt(qDot(u, u));
|
||||
qreal vLen = qSqrt(qDot(v, v));
|
||||
if (uLen) {
|
||||
u.x *= 2 * halfPointSize / uLen;
|
||||
u.y *= 2 * halfPointSize / uLen;
|
||||
@ -1719,7 +1717,7 @@ void QTriangulator<T>::ComplexToSimple::DebugDialog::paintEvent(QPaintEvent *)
|
||||
template <typename T>
|
||||
void QTriangulator<T>::ComplexToSimple::DebugDialog::wheelEvent(QWheelEvent *event)
|
||||
{
|
||||
qreal scale = exp(-0.001 * event->delta());
|
||||
qreal scale = qExp(-0.001 * event->delta());
|
||||
QPointF center = m_window.center();
|
||||
QPointF delta = scale * (m_window.bottomRight() - center);
|
||||
m_window = QRectF(center - delta, center + delta);
|
||||
|
@ -1684,7 +1684,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
|
||||
b++;
|
||||
fx += fdx;
|
||||
}
|
||||
} else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x
|
||||
} else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
|
||||
int y1 = (fy >> 16);
|
||||
int y2;
|
||||
fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
|
||||
@ -1843,7 +1843,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
|
||||
}
|
||||
}
|
||||
} else { //rotation
|
||||
if (fabs(data->m11) > 8 || fabs(data->m22) > 8) {
|
||||
if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
|
||||
//if we are zooming more than 8 times, we use 8bit precision for the position.
|
||||
while (b < end) {
|
||||
int x1 = (fx >> 16);
|
||||
@ -2196,7 +2196,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
|
||||
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
|
||||
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
|
||||
|
||||
if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x
|
||||
if ((fdx < 0 && fdx > -(fixed_scale / 8)) || std::abs(data->m22) < (1./8.)) { // scale up more than 8x
|
||||
int disty = (fy & 0x0000ffff) >> 8;
|
||||
for (int i = 0; i < len; ++i) {
|
||||
uint tl = buf1[i * 2 + 0];
|
||||
@ -2255,7 +2255,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
|
||||
layout->convertToARGB32PM(buf1, buf1, len * 2, layout, clut);
|
||||
layout->convertToARGB32PM(buf2, buf2, len * 2, layout, clut);
|
||||
|
||||
if (fabs(data->m11) > 8 || fabs(data->m22) > 8) {
|
||||
if (std::abs(data->m11) > 8 || std::abs(data->m22) > 8) {
|
||||
//if we are zooming more than 8 times, we use 8bit precision for the position.
|
||||
for (int i = 0; i < len; ++i) {
|
||||
uint tl = buf1[i * 2 + 0];
|
||||
|
@ -45,14 +45,13 @@
|
||||
// We mean it.
|
||||
//
|
||||
|
||||
#include <math.h>
|
||||
#include <qmath.h>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static const qreal Q_PI = qreal(3.14159265358979323846); // pi
|
||||
static const qreal Q_2PI = qreal(6.28318530717958647693); // 2*pi
|
||||
static const qreal Q_PI2 = qreal(1.57079632679489661923); // pi/2
|
||||
static const qreal Q_PI = qreal(M_PI); // pi
|
||||
static const qreal Q_2PI = qreal(2 * M_PI); // 2*pi
|
||||
static const qreal Q_PI2 = qreal(M_PI_2); // pi/2
|
||||
static const qreal Q_MM_PER_INCH = 25.4;
|
||||
|
||||
inline int qIntSqrtInt(int v)
|
||||
|
@ -712,20 +712,10 @@ static inline bool q26Dot6Compare(qreal p1, qreal p2)
|
||||
return int((p2 - p1) * 64.) == 0;
|
||||
}
|
||||
|
||||
static inline qreal qFloorF(qreal v)
|
||||
{
|
||||
#ifdef QT_USE_MATH_H_FLOATS
|
||||
if (sizeof(qreal) == sizeof(float))
|
||||
return floorf(v);
|
||||
else
|
||||
#endif
|
||||
return floor(v);
|
||||
}
|
||||
|
||||
static inline QPointF snapTo26Dot6Grid(const QPointF &p)
|
||||
{
|
||||
return QPointF(qFloorF(p.x() * 64) * (1 / qreal(64)),
|
||||
qFloorF(p.y() * 64) * (1 / qreal(64)));
|
||||
return QPointF(std::floor(p.x() * 64) * (1 / qreal(64)),
|
||||
std::floor(p.y() * 64) * (1 / qreal(64)));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -832,7 +822,7 @@ void QRasterizer::rasterizeLine(const QPointF &a, const QPointF &b, qreal width,
|
||||
return;
|
||||
|
||||
// adjust width which is given relative to |b - a|
|
||||
width *= sqrt(w0 / w);
|
||||
width *= qSqrt(w0 / w);
|
||||
}
|
||||
|
||||
QSpanBuffer buffer(d->blend, d->data, d->clipRect);
|
||||
|
@ -509,8 +509,8 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
|
||||
bits[i] = exteriorColor;
|
||||
|
||||
const qreal angleStep = qreal(15 * 3.141592653589793238 / 180);
|
||||
const QPoint rotation(qRound(cos(angleStep) * 0x4000),
|
||||
qRound(sin(angleStep) * 0x4000)); // 2:14 signed
|
||||
const QPoint rotation(qRound(qCos(angleStep) * 0x4000),
|
||||
qRound(qSin(angleStep) * 0x4000)); // 2:14 signed
|
||||
|
||||
const quint32 *indices = pathIndices.data();
|
||||
QVarLengthArray<QPoint> normals;
|
||||
@ -544,7 +544,7 @@ static void makeDistanceField(QDistanceFieldData *data, const QPainterPath &path
|
||||
QPoint n(to.y() - from.y(), from.x() - to.x());
|
||||
if (n.x() == 0 && n.y() == 0)
|
||||
continue;
|
||||
int scale = qRound((offs << 16) / sqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
|
||||
int scale = qRound((offs << 16) / qSqrt(qreal(n.x() * n.x() + n.y() * n.y()))); // 8:16
|
||||
n.rx() = n.x() * scale >> 8;
|
||||
n.ry() = n.y() * scale >> 8;
|
||||
normals.append(n);
|
||||
|
@ -2640,7 +2640,7 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
|
||||
QFontDef req = d->request;
|
||||
|
||||
if (req.pixelSize == -1) {
|
||||
req.pixelSize = floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
|
||||
req.pixelSize = std::floor(((req.pointSize * d->dpi) / 72) * 100 + 0.5) / 100;
|
||||
req.pixelSize = qRound(req.pixelSize);
|
||||
}
|
||||
if (req.pointSize < 0)
|
||||
|
@ -193,7 +193,7 @@ namespace {
|
||||
// does not return int
|
||||
static inline qreal qround(qreal f)
|
||||
{
|
||||
return floor(f + 0.5);
|
||||
return std::floor(f + qreal(0.5));
|
||||
}
|
||||
|
||||
}
|
||||
@ -355,7 +355,7 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
|
||||
qreal maxBoxSize = box.q_maximumSize;
|
||||
|
||||
if (snapToPixelGrid)
|
||||
maxBoxSize = qMax(box.q_minimumSize, floor(maxBoxSize));
|
||||
maxBoxSize = qMax(box.q_minimumSize, std::floor(maxBoxSize));
|
||||
|
||||
qreal avail = sumCurrentAvailable * factors[i] / sumFactors;
|
||||
if (sizes[i] + avail >= maxBoxSize) {
|
||||
|
@ -40,7 +40,7 @@
|
||||
#include "private/qlocale_p.h"
|
||||
|
||||
#include <limits.h>
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
@ -384,7 +384,7 @@ static int numDigits(qlonglong n)
|
||||
{
|
||||
if (n == 0)
|
||||
return 1;
|
||||
return (int)log10(double(n)) + 1;
|
||||
return (int)std::log10(double(n)) + 1;
|
||||
}
|
||||
|
||||
static qlonglong pow10(int exp)
|
||||
|
@ -405,9 +405,6 @@ bool QLocalSocket::waitForReadyRead(int msecs)
|
||||
{
|
||||
Q_D(QLocalSocket);
|
||||
|
||||
if (bytesAvailable() > 0)
|
||||
return true;
|
||||
|
||||
if (d->state != QLocalSocket::ConnectedState)
|
||||
return false;
|
||||
|
||||
|
@ -49,49 +49,18 @@ QT_BEGIN_NAMESPACE
|
||||
extern int q_X509Callback(int ok, X509_STORE_CTX *ctx);
|
||||
extern QString getErrorsFromOpenSsl();
|
||||
|
||||
// Default DH params
|
||||
// 1024-bit MODP Group with 160-bit Prime Order Subgroup
|
||||
// From RFC 5114
|
||||
static unsigned const char dh1024_p[]={
|
||||
0xB1,0x0B,0x8F,0x96,0xA0,0x80,0xE0,0x1D,0xDE,0x92,0xDE,0x5E,
|
||||
0xAE,0x5D,0x54,0xEC,0x52,0xC9,0x9F,0xBC,0xFB,0x06,0xA3,0xC6,
|
||||
0x9A,0x6A,0x9D,0xCA,0x52,0xD2,0x3B,0x61,0x60,0x73,0xE2,0x86,
|
||||
0x75,0xA2,0x3D,0x18,0x98,0x38,0xEF,0x1E,0x2E,0xE6,0x52,0xC0,
|
||||
0x13,0xEC,0xB4,0xAE,0xA9,0x06,0x11,0x23,0x24,0x97,0x5C,0x3C,
|
||||
0xD4,0x9B,0x83,0xBF,0xAC,0xCB,0xDD,0x7D,0x90,0xC4,0xBD,0x70,
|
||||
0x98,0x48,0x8E,0x9C,0x21,0x9A,0x73,0x72,0x4E,0xFF,0xD6,0xFA,
|
||||
0xE5,0x64,0x47,0x38,0xFA,0xA3,0x1A,0x4F,0xF5,0x5B,0xCC,0xC0,
|
||||
0xA1,0x51,0xAF,0x5F,0x0D,0xC8,0xB4,0xBD,0x45,0xBF,0x37,0xDF,
|
||||
0x36,0x5C,0x1A,0x65,0xE6,0x8C,0xFD,0xA7,0x6D,0x4D,0xA7,0x08,
|
||||
0xDF,0x1F,0xB2,0xBC,0x2E,0x4A,0x43,0x71
|
||||
};
|
||||
|
||||
static unsigned const char dh1024_g[]={
|
||||
0xA4,0xD1,0xCB,0xD5,0xC3,0xFD,0x34,0x12,0x67,0x65,0xA4,0x42,
|
||||
0xEF,0xB9,0x99,0x05,0xF8,0x10,0x4D,0xD2,0x58,0xAC,0x50,0x7F,
|
||||
0xD6,0x40,0x6C,0xFF,0x14,0x26,0x6D,0x31,0x26,0x6F,0xEA,0x1E,
|
||||
0x5C,0x41,0x56,0x4B,0x77,0x7E,0x69,0x0F,0x55,0x04,0xF2,0x13,
|
||||
0x16,0x02,0x17,0xB4,0xB0,0x1B,0x88,0x6A,0x5E,0x91,0x54,0x7F,
|
||||
0x9E,0x27,0x49,0xF4,0xD7,0xFB,0xD7,0xD3,0xB9,0xA9,0x2E,0xE1,
|
||||
0x90,0x9D,0x0D,0x22,0x63,0xF8,0x0A,0x76,0xA6,0xA2,0x4C,0x08,
|
||||
0x7A,0x09,0x1F,0x53,0x1D,0xBF,0x0A,0x01,0x69,0xB6,0xA2,0x8A,
|
||||
0xD6,0x62,0xA4,0xD1,0x8E,0x73,0xAF,0xA3,0x2D,0x77,0x9D,0x59,
|
||||
0x18,0xD0,0x8B,0xC8,0x85,0x8F,0x4D,0xCE,0xF9,0x7C,0x2A,0x24,
|
||||
0x85,0x5E,0x6E,0xEB,0x22,0xB3,0xB2,0xE5
|
||||
};
|
||||
|
||||
static DH *get_dh1024()
|
||||
{
|
||||
DH *dh = q_DH_new();
|
||||
if (!dh)
|
||||
return 0;
|
||||
// Default DH params
|
||||
// 1024-bit MODP Group
|
||||
// From RFC 2409
|
||||
QByteArray params = QByteArray::fromBase64(
|
||||
QByteArrayLiteral("MIGHAoGBAP//////////yQ/aoiFowjTExmKLgNwc0SkCTgiKZ8x0Agu+pjsTmyJR" \
|
||||
"Sgh5jjQE3e+VGbPNOkMbMCsKbfJfFDdP4TVtbVHCReSFtXZiXn7G9ExC6aY37WsL" \
|
||||
"/1y29Aa37e44a/taiZ+lrp8kEXxLH+ZJKGZR7OZTgf//////////AgEC"));
|
||||
|
||||
dh->p = q_BN_bin2bn(dh1024_p, sizeof(dh1024_p), 0);
|
||||
dh->g = q_BN_bin2bn(dh1024_g, sizeof(dh1024_g), 0);
|
||||
if (!dh->p || !dh->g) {
|
||||
q_DH_free(dh);
|
||||
return 0;
|
||||
}
|
||||
const char *ptr = params.constData();
|
||||
DH *dh = q_d2i_DHparams(NULL, (unsigned char **)(&ptr), params.length());
|
||||
|
||||
return dh;
|
||||
}
|
||||
|
@ -399,6 +399,7 @@ DEFINEFUNC3(void, SSL_get0_next_proto_negotiated, const SSL *s, s,
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
|
||||
DEFINEFUNC(DH *, DH_new, DUMMYARG, DUMMYARG, return 0, return)
|
||||
DEFINEFUNC(void, DH_free, DH *dh, dh, return, DUMMYARG)
|
||||
DEFINEFUNC3(DH *, d2i_DHparams, DH**a, a, unsigned char **pp, pp, long length, length, return 0, return);
|
||||
DEFINEFUNC3(BIGNUM *, BN_bin2bn, const unsigned char *s, s, int len, len, BIGNUM *ret, ret, return 0, return)
|
||||
#ifndef OPENSSL_NO_EC
|
||||
DEFINEFUNC(EC_KEY *, EC_KEY_dup, const EC_KEY *ec, ec, return 0, return)
|
||||
@ -946,6 +947,7 @@ bool q_resolveOpenSslSymbols()
|
||||
#endif // OPENSSL_VERSION_NUMBER >= 0x1000100fL ...
|
||||
RESOLVEFUNC(DH_new)
|
||||
RESOLVEFUNC(DH_free)
|
||||
RESOLVEFUNC(d2i_DHparams)
|
||||
RESOLVEFUNC(BN_bin2bn)
|
||||
#ifndef OPENSSL_NO_EC
|
||||
RESOLVEFUNC(EC_KEY_dup)
|
||||
|
@ -440,6 +440,8 @@ STACK_OF(X509) *q_X509_STORE_CTX_get_chain(X509_STORE_CTX *ctx);
|
||||
// Diffie-Hellman support
|
||||
DH *q_DH_new();
|
||||
void q_DH_free(DH *dh);
|
||||
DH *q_d2i_DHparams(DH **a, unsigned char **pp, long length);
|
||||
|
||||
BIGNUM *q_BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret);
|
||||
#define q_SSL_CTX_set_tmp_dh(ctx, dh) q_SSL_CTX_ctrl((ctx), SSL_CTRL_SET_TMP_DH, 0, (char *)dh)
|
||||
|
||||
|
@ -400,8 +400,8 @@ void QGL2PaintEngineExPrivate::updateMatrix()
|
||||
// anti-aliased text rendering. In such cases, we snap the translate to the pixel grid.
|
||||
if (snapToPixelGrid && transform.type() == QTransform::TxTranslate) {
|
||||
// 0.50 needs to rounded down to 0.0 for consistency with raster engine:
|
||||
dx = ceilf(dx - 0.5f);
|
||||
dy = ceilf(dy - 0.5f);
|
||||
dx = std::ceil(dx - 0.5f);
|
||||
dy = std::ceil(dy - 0.5f);
|
||||
}
|
||||
pmvMatrix[0][0] = (wfactor * transform.m11()) - transform.m13();
|
||||
pmvMatrix[1][0] = (wfactor * transform.m21()) - transform.m23();
|
||||
|
@ -39,9 +39,11 @@
|
||||
|
||||
#include <private/qimage_p.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
|
||||
static float SYNTHETIC_ITALIC_SKEW = tanf(14 * acosf(0) / 90);
|
||||
static float SYNTHETIC_ITALIC_SKEW = std::tan(14.f * std::acos(0.f) / 90.f);
|
||||
|
||||
bool QCoreTextFontEngine::ct_getSfntTable(void *user_data, uint tag, uchar *buffer, uint *length)
|
||||
{
|
||||
|
@ -654,11 +654,11 @@ QCoreGraphicsPaintEngine::updateState(const QPaintEngineState &state)
|
||||
d->cosmeticPenSize = 1.0;
|
||||
} else {
|
||||
d->cosmeticPen = QCoreGraphicsPaintEnginePrivate::CosmeticSetPenWidth;
|
||||
static const float sqrt2 = sqrt(2);
|
||||
static const float sqrt2 = std::sqrt(2.0f);
|
||||
qreal width = d->current.pen.widthF();
|
||||
if (!width)
|
||||
width = 1;
|
||||
d->cosmeticPenSize = sqrt(pow(d->pixelSize.y(), 2) + pow(d->pixelSize.x(), 2)) / sqrt2 * width;
|
||||
d->cosmeticPenSize = std::sqrt(std::pow(d->pixelSize.y(), 2) + std::pow(d->pixelSize.x(), 2)) / sqrt2 * width;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,40 +1,32 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -1,40 +1,32 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -1,40 +1,32 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -1,40 +1,32 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -1,40 +1,32 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2015 Digia Plc and/or its subsidiary(-ies).
|
||||
** Contact: http://www.qt-project.org/legal
|
||||
** Copyright (C) 2015 The Qt Company Ltd.
|
||||
** Contact: http://www.qt.io/licensing/
|
||||
**
|
||||
** This file is part of the plugins of the Qt Toolkit.
|
||||
**
|
||||
** $QT_BEGIN_LICENSE:LGPL$
|
||||
** $QT_BEGIN_LICENSE:LGPL21$
|
||||
** Commercial License Usage
|
||||
** Licensees holding valid commercial Qt licenses may use this file in
|
||||
** accordance with the commercial license agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Digia. For licensing terms and
|
||||
** conditions see http://qt.digia.com/licensing. For further information
|
||||
** use the contact form at http://qt.digia.com/contact-us.
|
||||
** a written agreement between you and The Qt Company. For licensing terms
|
||||
** and conditions see http://www.qt.io/terms-conditions. For further
|
||||
** information use the contact form at http://www.qt.io/contact-us.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
** Alternatively, 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.
|
||||
** General Public License version 2.1 or version 3 as published by the Free
|
||||
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
||||
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
||||
** following information to ensure the GNU Lesser General Public License
|
||||
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
||||
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** In addition, as a special exception, Digia gives you certain additional
|
||||
** rights. These rights are described in the Digia Qt LGPL Exception
|
||||
** As a special exception, The Qt Company gives you certain additional
|
||||
** rights. These rights are described in The Qt Company 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.
|
||||
**
|
||||
**
|
||||
** $QT_END_LICENSE$
|
||||
**
|
||||
****************************************************************************/
|
||||
|
@ -455,10 +455,10 @@ bool QWindowsTabletSupport::translateTabletPacketEvent()
|
||||
// X Tilt = arctan(X / Z)
|
||||
// Y Tilt = arctan(Y / Z)
|
||||
const double radAzim = (packet.pkOrientation.orAzimuth / 10.0) * (M_PI / 180);
|
||||
const double tanAlt = tan((abs(packet.pkOrientation.orAltitude / 10.0)) * (M_PI / 180));
|
||||
const double tanAlt = std::tan((std::abs(packet.pkOrientation.orAltitude / 10.0)) * (M_PI / 180));
|
||||
|
||||
const double degX = atan(sin(radAzim) / tanAlt);
|
||||
const double degY = atan(cos(radAzim) / tanAlt);
|
||||
const double degX = std::atan(std::sin(radAzim) / tanAlt);
|
||||
const double degY = std::atan(std::cos(radAzim) / tanAlt);
|
||||
tiltX = int(degX * (180 / M_PI));
|
||||
tiltY = int(-degY * (180 / M_PI));
|
||||
rotation = 360.0 - (packet.pkOrientation.orTwist / 10.0);
|
||||
|
@ -57,13 +57,7 @@ QXcbEglIntegration::~QXcbEglIntegration()
|
||||
bool QXcbEglIntegration::initialize(QXcbConnection *connection)
|
||||
{
|
||||
m_connection = connection;
|
||||
|
||||
#ifdef USE_XCB_XLIB
|
||||
Display *dpy = (Display *)m_connection->xlib_display();
|
||||
#else
|
||||
EGLNativeDisplayType dpy = EGL_DEFAULT_DISPLAY;
|
||||
#endif
|
||||
m_egl_display = eglGetDisplay(dpy);
|
||||
m_egl_display = eglGetDisplay(reinterpret_cast<EGLNativeDisplayType>(xlib_display()));
|
||||
|
||||
EGLint major, minor;
|
||||
bool success = eglInitialize(m_egl_display, &major, &minor);
|
||||
@ -101,4 +95,13 @@ QPlatformOffscreenSurface *QXcbEglIntegration::createPlatformOffscreenSurface(QO
|
||||
return new QEGLPbuffer(eglDisplay(), surface->requestedFormat(), surface);
|
||||
}
|
||||
|
||||
void *QXcbEglIntegration::xlib_display() const
|
||||
{
|
||||
#ifdef XCB_USE_XLIB
|
||||
return m_connection->xlib_display();
|
||||
#else
|
||||
return EGL_DEFAULT_DISPLAY;
|
||||
#endif
|
||||
}
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -65,7 +65,7 @@ public:
|
||||
bool supportsThreadedOpenGL() const Q_DECL_OVERRIDE { return true; }
|
||||
|
||||
EGLDisplay eglDisplay() const { return m_egl_display; }
|
||||
void *xlib_display() const { return m_connection->xlib_display(); }
|
||||
void *xlib_display() const;
|
||||
private:
|
||||
QXcbConnection *m_connection;
|
||||
EGLDisplay m_egl_display;
|
||||
|
@ -61,6 +61,7 @@ void QXcbEglWindow::resolveFormat()
|
||||
|
||||
void *QXcbEglWindow::createVisual()
|
||||
{
|
||||
#ifdef XCB_USE_XLIB
|
||||
Display *xdpy = static_cast<Display *>(m_glIntegration->xlib_display());
|
||||
VisualID id = QXlibEglIntegration::getCompatibleVisualId(xdpy, m_glIntegration->eglDisplay(), m_config);
|
||||
|
||||
@ -72,6 +73,9 @@ void *QXcbEglWindow::createVisual()
|
||||
int matchingCount = 0;
|
||||
visualInfo = XGetVisualInfo(xdpy, VisualIDMask, &visualInfoTemplate, &matchingCount);
|
||||
return visualInfo;
|
||||
#else
|
||||
return QXcbWindow::createVisual();
|
||||
#endif
|
||||
}
|
||||
|
||||
void QXcbEglWindow::create()
|
||||
|
@ -9,10 +9,7 @@ include(../gl_integrations_plugin_base.pri)
|
||||
|
||||
CONFIG += egl
|
||||
|
||||
DEFINES += SUPPORT_X11
|
||||
#should be removed from sources
|
||||
DEFINES += XCB_USE_EGL XCB_USE_XLIB
|
||||
|
||||
contains(QT_CONFIG, xcb-xlib): DEFINES += XCB_USE_XLIB
|
||||
|
||||
HEADERS += \
|
||||
qxcbeglcontext.h \
|
||||
|
@ -438,6 +438,7 @@ QPrint::ColorMode QPpdPrintDevice::defaultColorMode() const
|
||||
return QPrint::GrayScale;
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
void QPpdPrintDevice::loadMimeTypes() const
|
||||
{
|
||||
// TODO No CUPS api? Need to manually load CUPS mime.types file?
|
||||
@ -453,6 +454,7 @@ void QPpdPrintDevice::loadMimeTypes() const
|
||||
m_mimeTypes.append(db.mimeTypeForName(QStringLiteral("text/plain")));
|
||||
m_haveMimeTypes = true;
|
||||
}
|
||||
#endif
|
||||
|
||||
void QPpdPrintDevice::loadPrinter()
|
||||
{
|
||||
|
@ -95,7 +95,9 @@ protected:
|
||||
void loadOutputBins() const Q_DECL_OVERRIDE;
|
||||
void loadDuplexModes() const Q_DECL_OVERRIDE;
|
||||
void loadColorModes() const Q_DECL_OVERRIDE;
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
void loadMimeTypes() const Q_DECL_OVERRIDE;
|
||||
#endif
|
||||
|
||||
private:
|
||||
void loadPrinter();
|
||||
|
@ -359,6 +359,7 @@ QList<QPrint::ColorMode> QPlatformPrintDevice::supportedColorModes() const
|
||||
return m_colorModes.toList();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
void QPlatformPrintDevice::loadMimeTypes() const
|
||||
{
|
||||
}
|
||||
@ -369,6 +370,7 @@ QList<QMimeType> QPlatformPrintDevice::supportedMimeTypes() const
|
||||
loadMimeTypes();
|
||||
return m_mimeTypes.toList();
|
||||
}
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
||||
QPageSize QPlatformPrintDevice::createPageSize(const QString &key, const QSize &size, const QString &localizedName)
|
||||
{
|
||||
|
@ -114,7 +114,9 @@ public:
|
||||
virtual QPrint::ColorMode defaultColorMode() const;
|
||||
virtual QList<QPrint::ColorMode> supportedColorModes() const;
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
virtual QList<QMimeType> supportedMimeTypes() const;
|
||||
#endif
|
||||
|
||||
static QPageSize createPageSize(const QString &key, const QSize &size, const QString &localizedName);
|
||||
static QPageSize createPageSize(int windowsId, const QSize &size, const QString &localizedName);
|
||||
@ -126,7 +128,9 @@ protected:
|
||||
virtual void loadOutputBins() const;
|
||||
virtual void loadDuplexModes() const;
|
||||
virtual void loadColorModes() const;
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
virtual void loadMimeTypes() const;
|
||||
#endif
|
||||
|
||||
QPageSize supportedPageSizeMatch(const QPageSize &pageSize) const;
|
||||
|
||||
@ -163,8 +167,10 @@ protected:
|
||||
mutable bool m_haveColorModes;
|
||||
mutable QVector<QPrint::ColorMode> m_colorModes;
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
mutable bool m_haveMimeTypes;
|
||||
mutable QVector<QMimeType> m_mimeTypes;
|
||||
#endif
|
||||
};
|
||||
|
||||
QT_END_NAMESPACE
|
||||
|
@ -237,10 +237,12 @@ QList<QPrint::ColorMode> QPrintDevice::supportedColorModes() const
|
||||
return isValid() ? d->supportedColorModes() : QList<QPrint::ColorMode>();
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
QList<QMimeType> QPrintDevice::supportedMimeTypes() const
|
||||
{
|
||||
return isValid() ? d->supportedMimeTypes() : QList<QMimeType>();
|
||||
}
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
||||
#endif // QT_NO_PRINTER
|
||||
|
||||
|
@ -123,7 +123,9 @@ public:
|
||||
QPrint::ColorMode defaultColorMode() const;
|
||||
QList<QPrint::ColorMode> supportedColorModes() const;
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
QList<QMimeType> supportedMimeTypes() const;
|
||||
#endif
|
||||
|
||||
private:
|
||||
friend class QPlatformPrinterSupport;
|
||||
|
@ -1516,6 +1516,7 @@ void Generator::initialize(const Config &config)
|
||||
if (config.getBool(QString("HTML.nosubdirs")))
|
||||
resetUseOutputSubdirs();
|
||||
|
||||
outFileNames_.clear();
|
||||
outputFormats = config.getOutputFormats();
|
||||
redirectDocumentationToDevNull_ = config.getBool(CONFIG_REDIRECTDOCUMENTATIONTODEVNULL);
|
||||
if (!outputFormats.isEmpty()) {
|
||||
|
@ -1516,6 +1516,8 @@ void QFileDialog::setFilter(QDir::Filters filters)
|
||||
d->showHiddenAction->setChecked((filters & QDir::Hidden));
|
||||
}
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
|
||||
static QString nameFilterForMime(const QString &mimeType)
|
||||
{
|
||||
QMimeDatabase db;
|
||||
@ -1585,6 +1587,8 @@ void QFileDialog::selectMimeTypeFilter(const QString &filter)
|
||||
selectNameFilter(text);
|
||||
}
|
||||
|
||||
#endif // QT_NO_MIMETYPE
|
||||
|
||||
/*!
|
||||
\property QFileDialog::viewMode
|
||||
\brief the way files and directories are displayed in the dialog
|
||||
@ -2843,9 +2847,12 @@ void QFileDialogPrivate::createWidgets()
|
||||
if (!options->sidebarUrls().isEmpty())
|
||||
q->setSidebarUrls(options->sidebarUrls());
|
||||
q->setDirectoryUrl(options->initialDirectory());
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
if (!options->mimeTypeFilters().isEmpty())
|
||||
q->setMimeTypeFilters(options->mimeTypeFilters());
|
||||
else if (!options->nameFilters().isEmpty())
|
||||
else
|
||||
#endif
|
||||
if (!options->nameFilters().isEmpty())
|
||||
q->setNameFilters(options->nameFilters());
|
||||
q->selectNameFilter(options->initiallySelectedNameFilter());
|
||||
q->setDefaultSuffix(options->defaultSuffix());
|
||||
|
@ -119,9 +119,11 @@ public:
|
||||
void selectNameFilter(const QString &filter);
|
||||
QString selectedNameFilter() const;
|
||||
|
||||
#ifndef QT_NO_MIMETYPE
|
||||
void setMimeTypeFilters(const QStringList &filters);
|
||||
QStringList mimeTypeFilters() const;
|
||||
void selectMimeTypeFilter(const QString &filter);
|
||||
#endif
|
||||
|
||||
QDir::Filters filter() const;
|
||||
void setFilter(QDir::Filters filters);
|
||||
|
@ -292,11 +292,21 @@ bool QWidgetWindow::event(QEvent *event)
|
||||
case QEvent::WindowBlocked:
|
||||
qt_button_down = 0;
|
||||
break;
|
||||
|
||||
case QEvent::UpdateRequest:
|
||||
// This is not the same as an UpdateRequest for a QWidget. That just
|
||||
// syncs the backing store while here we also must mark as dirty.
|
||||
m_widget->repaint();
|
||||
return true;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return m_widget->event(event) || QWindow::event(event);
|
||||
if (m_widget->event(event) && event->type() != QEvent::Timer)
|
||||
return true;
|
||||
|
||||
return QWindow::event(event);
|
||||
}
|
||||
|
||||
QPointer<QWidget> qt_last_mouse_receiver = 0;
|
||||
|
@ -136,9 +136,9 @@ void QDial::initStyleOption(QStyleOptionSlider *option) const
|
||||
int QDialPrivate::valueFromPoint(const QPoint &p) const
|
||||
{
|
||||
Q_Q(const QDial);
|
||||
double yy = (double)q->height()/2.0 - p.y();
|
||||
double xx = (double)p.x() - q->width()/2.0;
|
||||
double a = (xx || yy) ? qAtan2(yy, xx) : 0;
|
||||
double yy = q->height()/2.0 - p.y();
|
||||
double xx = p.x() - q->width()/2.0;
|
||||
double a = (xx || yy) ? std::atan2(yy, xx) : 0;
|
||||
|
||||
if (a < Q_PI / -2)
|
||||
a = a + Q_PI * 2;
|
||||
|
@ -91,6 +91,7 @@ private slots:
|
||||
void modalWindowModallity();
|
||||
void modalWindowPosition();
|
||||
void windowsTransientChildren();
|
||||
void requestUpdate();
|
||||
void initTestCase();
|
||||
void cleanup();
|
||||
|
||||
@ -1666,6 +1667,25 @@ void tst_QWindow::windowsTransientChildren()
|
||||
QVERIFY(isNativeWindowVisible(&child)); // Real children should be visible.
|
||||
}
|
||||
|
||||
void tst_QWindow::requestUpdate()
|
||||
{
|
||||
QRect geometry(m_availableTopLeft + QPoint(80, 80), m_testWindowSize);
|
||||
|
||||
Window window;
|
||||
window.setGeometry(geometry);
|
||||
window.show();
|
||||
QCoreApplication::processEvents();
|
||||
QTRY_VERIFY(window.isExposed());
|
||||
|
||||
QVERIFY(window.received(QEvent::UpdateRequest) == 0);
|
||||
|
||||
window.requestUpdate();
|
||||
QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 1);
|
||||
|
||||
window.requestUpdate();
|
||||
QTRY_VERIFY(window.received(QEvent::UpdateRequest) == 2);
|
||||
}
|
||||
|
||||
#include <tst_qwindow.moc>
|
||||
QTEST_MAIN(tst_QWindow)
|
||||
|
||||
|
@ -55,6 +55,7 @@ private slots:
|
||||
void reparentToAlreadyCreated();
|
||||
void reparentToNotYetCreated();
|
||||
void asViewport();
|
||||
void requestUpdate();
|
||||
};
|
||||
|
||||
void tst_QOpenGLWidget::create()
|
||||
@ -305,6 +306,29 @@ void tst_QOpenGLWidget::asViewport()
|
||||
QVERIFY(view->paintCount() == 0);
|
||||
}
|
||||
|
||||
class PaintCountWidget : public QOpenGLWidget
|
||||
{
|
||||
public:
|
||||
PaintCountWidget() : m_count(0) { }
|
||||
void reset() { m_count = 0; }
|
||||
void paintGL() Q_DECL_OVERRIDE { ++m_count; }
|
||||
int m_count;
|
||||
};
|
||||
|
||||
void tst_QOpenGLWidget::requestUpdate()
|
||||
{
|
||||
PaintCountWidget w;
|
||||
w.resize(640, 480);
|
||||
w.show();
|
||||
QTest::qWaitForWindowExposed(&w);
|
||||
|
||||
w.reset();
|
||||
QCOMPARE(w.m_count, 0);
|
||||
|
||||
w.windowHandle()->requestUpdate();
|
||||
QTRY_VERIFY(w.m_count > 0);
|
||||
}
|
||||
|
||||
QTEST_MAIN(tst_QOpenGLWidget)
|
||||
|
||||
#include "tst_qopenglwidget.moc"
|
||||
|
Loading…
Reference in New Issue
Block a user