/****************************************************************************
**
-** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
+** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
+** 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.
+**
** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** 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.
**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
+** 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$
QT_BEGIN_NAMESPACE
+#if !defined(QT_MAX_CACHED_GLYPH_SIZE)
+# define QT_MAX_CACHED_GLYPH_SIZE 64
+#endif
+
/*******************************************************************************
*
* class QVectorPath
}
if (pen.style() > Qt::SolidLine) {
- if (pen.isCosmetic()) {
+ if (qt_pen_is_cosmetic(pen, state()->renderHints)){
d->activeStroker->setClipRect(d->exDeviceRect);
} else {
QRectF clipRect = state()->matrix.inverted().mapRect(QRectF(d->exDeviceRect));
flags |= QVectorPath::CurvedShapeMask;
// ### Perspective Xforms are currently not supported...
- if (!pen.isCosmetic()) {
+ if (!qt_pen_is_cosmetic(pen, state()->renderHints)) {
// We include cosmetic pens in this case to avoid having to
// change the current transform. Normal transformed,
// non-cosmetic pens will be transformed as part of fill
qreal pts[64];
int count2 = count<<1;
-#ifdef Q_WS_MAC
- for (int i=0; i<count2; i+=2) {
- pts[i] = ((int *) lines)[i+1];
- pts[i+1] = ((int *) lines)[i];
- }
-#else
for (int i=0; i<count2; ++i)
pts[i] = ((int *) lines)[i];
-#endif
QVectorPath path(pts, count, qpaintengineex_line_types_16, QVectorPath::LinesHint);
stroke(path, state()->pen);
}
} else {
for (int i=0; i<pointCount; ++i) {
- qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + 1/63., points[i].y() };
+ qreal pts[] = { points[i].x(), points[i].y(), points[i].x() + qreal(1/63.), points[i].y() };
QVectorPath path(pts, 2, 0);
stroke(path, pen);
}
int count = pointCount<<1;
QVarLengthArray<qreal> pts(count);
-#ifdef Q_WS_MAC
- for (int i=0; i<count; i+=2) {
- pts[i] = ((int *) points)[i+1];
- pts[i+1] = ((int *) points)[i];
- }
-#else
for (int i=0; i<count; ++i)
pts[i] = ((int *) points)[i];
-#endif
QVectorPath path(pts.data(), pointCount, 0, QVectorPath::polygonFlags(mode));
void QPaintEngineEx::drawStaticTextItem(QStaticTextItem *staticTextItem)
{
QPainterPath path;
-#ifndef Q_WS_MAC
path.setFillRule(Qt::WindingFill);
-#endif
if (staticTextItem->numGlyphs == 0)
return;
changedHints = true;
}
- fill(qtVectorPathForPath(path), staticTextItem->color);
+ fill(qtVectorPathForPath(path), s->pen.brush());
if (changedHints) {
s->renderHints = oldHints;
}
}
-bool QPaintEngineEx::supportsTransformations(qreal pixelSize, const QTransform &m) const
+bool QPaintEngineEx::supportsTransformations(QFontEngine *fontEngine, const QTransform &m) const
{
- Q_UNUSED(pixelSize);
+ Q_UNUSED(fontEngine);
if (!m.isAffine())
return true;
return false;
}
+bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const
+{
+ qreal pixelSize = fontEngine->fontDef.pixelSize;
+ return (pixelSize * pixelSize * qAbs(m.determinant())) <
+ QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE;
+}
+
QT_END_NAMESPACE