summaryrefslogtreecommitdiffstats
path: root/src/gui/painting
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-12-16 15:21:35 +0100
committerOswald Buddenhagen <oswald.buddenhagen@qt.io>2016-12-16 16:38:33 +0100
commitb13150336174083962d90922761fd96f07e173b4 (patch)
tree1655e9009efba21b008d7d2f810aacbde3e2c2d8 /src/gui/painting
parentff19ebcc2d9c9668af24fe8add9f70c160776367 (diff)
parent9bfe3ab71e5291445e66be96d6cd1f63934a2d83 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: configure configure.pri examples/widgets/painting/fontsampler/mainwindow.cpp examples/widgets/painting/fontsampler/mainwindow.h mkspecs/features/moc.prf src/corelib/global/qglobal.h src/gui/text/qtextdocument.cpp Change-Id: Ica65512e00871695190a14ccea5c275b0165f787
Diffstat (limited to 'src/gui/painting')
-rw-r--r--src/gui/painting/QIMAGETRANSFORM_LICENSE.txt60
-rw-r--r--src/gui/painting/qdatabuffer_p.h12
-rw-r--r--src/gui/painting/qdrawhelper.cpp7
-rw-r--r--src/gui/painting/qemulationpaintengine_p.h48
-rw-r--r--src/gui/painting/qpaintengine_raster_p.h2
-rw-r--r--src/gui/painting/qpdfwriter.h12
-rw-r--r--src/gui/painting/qstroker_p.h8
-rw-r--r--src/gui/painting/qt_attribution.json43
8 files changed, 137 insertions, 55 deletions
diff --git a/src/gui/painting/QIMAGETRANSFORM_LICENSE.txt b/src/gui/painting/QIMAGETRANSFORM_LICENSE.txt
new file mode 100644
index 0000000000..67c910826a
--- /dev/null
+++ b/src/gui/painting/QIMAGETRANSFORM_LICENSE.txt
@@ -0,0 +1,60 @@
+qimagetransform.cpp was contributed by Daniel M. Duley based on code from Imlib2.
+
+Copyright (C) 2004, 2005 Daniel M. Duley
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+ notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+
+Imlib2 License
+
+Copyright (C) 2000 Carsten Haitzler and various contributors (see
+AUTHORS)
+
+Permission is hereby granted, free of charge, to any person obtaining a
+copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies of the Software and its Copyright notices. In addition
+publicly documented acknowledgment must be given that this software has
+been used if no source code of this software is made available publicly.
+This includes acknowledgments in either Copyright notices, Manuals,
+Publicity and Marketing documents or any documentation provided with any
+product containing this software. This License does not apply to any
+software that links to the libraries provided by this software
+(statically or dynamically), but only to the software provided.
+
+Please see the COPYING.PLAIN for a plain-english explanation of this
+notice and it's intent.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+DEALINGS IN THE SOFTWARE.
diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h
index 77b5be0c4c..7cac2ac358 100644
--- a/src/gui/painting/qdatabuffer_p.h
+++ b/src/gui/painting/qdatabuffer_p.h
@@ -65,10 +65,12 @@ public:
QDataBuffer(int res)
{
capacity = res;
- if (res)
+ if (res) {
buffer = (Type*) malloc(capacity * sizeof(Type));
- else
+ Q_CHECK_PTR(buffer);
+ } else {
buffer = 0;
+ }
siz = 0;
}
@@ -115,14 +117,16 @@ public:
while (capacity < size)
capacity *= 2;
buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
+ Q_CHECK_PTR(buffer);
}
}
inline void shrink(int size) {
capacity = size;
- if (size)
+ if (size) {
buffer = (Type*) realloc(buffer, capacity * sizeof(Type));
- else {
+ Q_CHECK_PTR(buffer);
+ } else {
free(buffer);
buffer = 0;
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 08f96bd654..772291b22b 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -844,6 +844,7 @@ template <QPixelLayout::BPP bpp> static
uint QT_FASTCALL fetchPixel(const uchar *, int)
{
Q_UNREACHABLE();
+ return 0;
}
template <>
@@ -1581,7 +1582,7 @@ static const uint *QT_FASTCALL fetchTransformed(uint *buffer, const Operator *,
if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
Q_ASSERT(layout->bpp == bpp);
// When templated 'fetch' should be inlined at compile time:
- const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
+ const FetchPixelFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : FetchPixelFunc(fetchPixel<bpp>);
uint *const end = buffer + length;
uint *b = buffer;
@@ -2532,8 +2533,8 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
if (bpp != QPixelLayout::BPPNone) // Like this to not ICE on GCC 5.3.1
Q_ASSERT(layout->bpp == bpp);
// When templated 'fetch' should be inlined at compile time:
- const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : fetchPixels<bpp>;
- const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : fetchPixel<bpp>;
+ const FetchPixelsFunc fetch = (bpp == QPixelLayout::BPPNone) ? qFetchPixels[layout->bpp] : FetchPixelsFunc(fetchPixels<bpp>);
+ const FetchPixelFunc fetch1 = (bpp == QPixelLayout::BPPNone) ? qFetchPixel[layout->bpp] : FetchPixelFunc(fetchPixel<bpp>);
int image_width = data->texture.width;
int image_height = data->texture.height;
diff --git a/src/gui/painting/qemulationpaintengine_p.h b/src/gui/painting/qemulationpaintengine_p.h
index 457cc06d63..a2eb9b008c 100644
--- a/src/gui/painting/qemulationpaintengine_p.h
+++ b/src/gui/painting/qemulationpaintengine_p.h
@@ -62,37 +62,37 @@ class QEmulationPaintEngine : public QPaintEngineEx
public:
QEmulationPaintEngine(QPaintEngineEx *engine);
- virtual bool begin(QPaintDevice *pdev);
- virtual bool end();
+ bool begin(QPaintDevice *pdev) override;
+ bool end() override;
- virtual Type type() const;
- virtual QPainterState *createState(QPainterState *orig) const;
+ Type type() const override;
+ QPainterState *createState(QPainterState *orig) const override;
- virtual void fill(const QVectorPath &path, const QBrush &brush);
- virtual void stroke(const QVectorPath &path, const QPen &pen);
- virtual void clip(const QVectorPath &path, Qt::ClipOperation op);
+ void fill(const QVectorPath &path, const QBrush &brush) override;
+ void stroke(const QVectorPath &path, const QPen &pen) override;
+ void clip(const QVectorPath &path, Qt::ClipOperation op) override;
- virtual void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr);
- virtual void drawTextItem(const QPointF &p, const QTextItem &textItem);
- virtual void drawStaticTextItem(QStaticTextItem *item);
- virtual void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s);
- virtual void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags);
+ void drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) override;
+ void drawTextItem(const QPointF &p, const QTextItem &textItem) override;
+ void drawStaticTextItem(QStaticTextItem *item) override;
+ void drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, const QPointF &s) override;
+ void drawImage(const QRectF &r, const QImage &pm, const QRectF &sr, Qt::ImageConversionFlags flags) override;
- virtual void clipEnabledChanged();
- virtual void penChanged();
- virtual void brushChanged();
- virtual void brushOriginChanged();
- virtual void opacityChanged();
- virtual void compositionModeChanged();
- virtual void renderHintsChanged();
- virtual void transformChanged();
+ void clipEnabledChanged() override;
+ void penChanged() override;
+ void brushChanged() override;
+ void brushOriginChanged() override;
+ void opacityChanged() override;
+ void compositionModeChanged() override;
+ void renderHintsChanged() override;
+ void transformChanged() override;
- virtual void setState(QPainterState *s);
+ void setState(QPainterState *s) override;
- virtual void beginNativePainting();
- virtual void endNativePainting();
+ void beginNativePainting() override;
+ void endNativePainting() override;
- virtual uint flags() const {return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate;}
+ uint flags() const override { return QPaintEngineEx::IsEmulationEngine | QPaintEngineEx::DoNotEmulate; }
inline QPainterState *state() { return (QPainterState *)QPaintEngine::state; }
inline const QPainterState *state() const { return (const QPainterState *)QPaintEngine::state; }
diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h
index 8cde88fa82..59213220a6 100644
--- a/src/gui/painting/qpaintengine_raster_p.h
+++ b/src/gui/painting/qpaintengine_raster_p.h
@@ -287,7 +287,7 @@ public:
void rasterize(QT_FT_Outline *outline, ProcessSpans callback, void *userData, QRasterBuffer *rasterBuffer);
void updateMatrixData(QSpanData *spanData, const QBrush &brush, const QTransform &brushMatrix);
- void systemStateChanged();
+ void systemStateChanged() override;
void drawImage(const QPointF &pt, const QImage &img, SrcOverBlendFunc func,
const QRect &clip, int alpha, const QRect &sr = QRect());
diff --git a/src/gui/painting/qpdfwriter.h b/src/gui/painting/qpdfwriter.h
index baad274818..17c73dd480 100644
--- a/src/gui/painting/qpdfwriter.h
+++ b/src/gui/painting/qpdfwriter.h
@@ -67,7 +67,7 @@ public:
QString creator() const;
void setCreator(const QString &creator);
- bool newPage();
+ bool newPage() override;
void setResolution(int resolution);
int resolution() const;
@@ -83,14 +83,14 @@ public:
using QPagedPaintDevice::setPageSize;
#endif
- void setPageSize(PageSize size);
- void setPageSizeMM(const QSizeF &size);
+ void setPageSize(PageSize size) override;
+ void setPageSizeMM(const QSizeF &size) override;
- void setMargins(const Margins &m);
+ void setMargins(const Margins &m) override;
protected:
- QPaintEngine *paintEngine() const;
- int metric(PaintDeviceMetric id) const;
+ QPaintEngine *paintEngine() const override;
+ int metric(PaintDeviceMetric id) const override;
private:
Q_DISABLE_COPY(QPdfWriter)
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index ededb5d80b..1a7c184e1a 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -234,7 +234,7 @@ protected:
static Qt::PenJoinStyle joinForJoinMode(LineJoinMode mode);
static LineJoinMode joinModeForJoin(Qt::PenJoinStyle joinStyle);
- virtual void processCurrentSubpath();
+ void processCurrentSubpath() override;
qfixed m_strokeWidth;
qfixed m_miterLimit;
@@ -265,14 +265,14 @@ public:
void setDashOffset(qreal offset) { m_dashOffset = offset; }
qreal dashOffset() const { return m_dashOffset; }
- virtual void begin(void *data);
- virtual void end();
+ void begin(void *data) override;
+ void end() override;
inline void setStrokeWidth(qreal width) { m_stroke_width = width; }
inline void setMiterLimit(qreal limit) { m_miter_limit = limit; }
protected:
- virtual void processCurrentSubpath();
+ void processCurrentSubpath() override;
QStroker *m_stroker;
QVector<qfixed> m_dashPattern;
diff --git a/src/gui/painting/qt_attribution.json b/src/gui/painting/qt_attribution.json
index f635cf98ac..06a62d9d66 100644
--- a/src/gui/painting/qt_attribution.json
+++ b/src/gui/painting/qt_attribution.json
@@ -1,14 +1,31 @@
-{
- "Id": "grayraster",
- "Name": "Anti-aliasing rasterizer from FreeType 2",
- "QDocModule": "qtgui",
- "QtUsage": "Used in Qt GUI.",
- "Path": "qgrayraster.c",
+[
+ {
+ "Id": "grayraster",
+ "Name": "Anti-aliasing rasterizer from FreeType 2",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Qt GUI.",
+ "Path": "qgrayraster.c",
- "Description": "FreeType is a freely available software library to render fonts.",
- "Homepage": "http://www.freetype.org",
- "License": "Freetype Project License or GNU General Public License v2.0 only",
- "LicenseId": "FTL or GPL-2.0",
- "LicenseFile": "../../3rdparty/freetype/docs/LICENSE.TXT",
- "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
-}
+ "Description": "FreeType is a freely available software library to render fonts.",
+ "Homepage": "http://www.freetype.org",
+ "License": "Freetype Project License or GNU General Public License v2.0 only",
+ "LicenseId": "FTL or GPL-2.0",
+ "LicenseFile": "../../3rdparty/freetype/docs/LICENSE.TXT",
+ "Copyright": "Copyright 2006-2015 by David Turner, Robert Wilhelm, and Werner Lemberg."
+ },
+ {
+ "Id": "smooth-scaling-algorithm",
+ "Name": "Smooth Scaling Algorithm",
+ "QDocModule": "qtgui",
+ "QtUsage": "Used in Qt Gui (QImage::transformed() functions).",
+ "Files": "qimagescale.cpp",
+
+ "Description": "Normal smoothscale method, based on Imlib2's smoothscale.",
+ "LicenseId": "BSD-2-Clause AND Imlib2",
+ "License": "BSD 2-clause \"Simplified\" License and Imlib2 License",
+ "LicenseFile": "QIMAGETRANSFORM_LICENSE.txt",
+ "Copyright": "Copyright (C) 2004, 2005 Daniel M. Duley.
+ (C) Carsten Haitzler and various contributors.
+ (C) Willem Monsuwe <willem@stack.nl>"
+ }
+]