/src/qtbase/src/gui/painting/qimagescale_p.h
Line | Count | Source |
1 | | // Copyright (C) 2019 The Qt Company Ltd. |
2 | | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | | // Qt-Security score:significant reason:default |
4 | | #ifndef QIMAGESCALE_P_H |
5 | | #define QIMAGESCALE_P_H |
6 | | |
7 | | // |
8 | | // W A R N I N G |
9 | | // ------------- |
10 | | // |
11 | | // This file is not part of the Qt API. It exists purely as an |
12 | | // implementation detail. This header file may change from version to |
13 | | // version without notice, or even be removed. |
14 | | // |
15 | | // We mean it. |
16 | | // |
17 | | |
18 | | #include <qimage.h> |
19 | | #include <private/qtguiglobal_p.h> |
20 | | |
21 | | #if QT_CONFIG(qtgui_threadpool) |
22 | | #include <qthreadpool.h> |
23 | | #include <private/qguiapplication_p.h> |
24 | | #include <private/qlatch_p.h> |
25 | | #include <private/qthreadpool_p.h> |
26 | | #endif |
27 | | |
28 | | QT_BEGIN_NAMESPACE |
29 | | |
30 | | /* |
31 | | This version accepts only supported formats. |
32 | | */ |
33 | | QImage qSmoothScaleImage(const QImage &img, int w, int h); |
34 | | |
35 | | namespace QImageScale { |
36 | | struct QImageScaleInfo { |
37 | | int *xpoints{nullptr}; |
38 | | const unsigned int **ypoints{nullptr}; |
39 | | int *xapoints{nullptr}; |
40 | | int *yapoints{nullptr}; |
41 | | int xup_yup{0}; |
42 | | int sh = 0; |
43 | | int sw = 0; |
44 | | }; |
45 | | |
46 | | template<typename T> |
47 | | void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection) |
48 | 0 | { |
49 | 0 | #if QT_CONFIG(qtgui_threadpool) |
50 | 0 | int segments = (qsizetype(isi->sh) * isi->sw) / (1<<16); |
51 | 0 | segments = std::min(segments, dh); |
52 | 0 | QThreadPool *threadPool = QGuiApplicationPrivate::qtGuiThreadPool(); |
53 | 0 | if (segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) { |
54 | 0 | QLatch latch(segments); |
55 | 0 | int y = 0; |
56 | 0 | for (int i = 0; i < segments; ++i) { |
57 | 0 | int yn = (dh - y) / (segments - i); |
58 | 0 | threadPool->start([&, y, yn]() { |
59 | 0 | scaleSection(y, y + yn); |
60 | 0 | latch.countDown(); |
61 | 0 | }); Unexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_up_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_up_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_up_x_down_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_up_x_down_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_down_x_up_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_down_x_up_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_down_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_down_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_up_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_up_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_up_x_down_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_up_x_down_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_down_x_up_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_down_x_up_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_down_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_down_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: qimagescale.cpp:QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() constUnexecuted instantiation: QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)::{lambda()#1}::operator()() const |
62 | 0 | y += yn; |
63 | 0 | } |
64 | 0 | latch.wait(); |
65 | 0 | return; |
66 | 0 | } |
67 | | #else |
68 | | Q_UNUSED(isi); |
69 | | #endif |
70 | 0 | scaleSection(0, dh); |
71 | 0 | } Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_up_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_up_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_up_x_down_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_up_x_down_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_down_x_up_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_down_x_up_y(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgba64_down_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgba64_down_xy(QImageScale::QImageScaleInfo*, QRgba64*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_up_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_up_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_up_x_down_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_up_x_down_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_down_x_up_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_down_x_up_y(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleRgbaFP_down_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleRgbaFP_down_xy(QImageScale::QImageScaleInfo*, QRgbaFloat<float>*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_up_x_down_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_down_x_up_y(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: qimagescale.cpp:void QImageScale::multithread_pixels_function<qt_qimageScaleAARGB_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGB_down_xy(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::$_0 const&) Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_up_x_down_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_x_up_y_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy_sse4<false>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&)Unexecuted instantiation: void QImageScale::multithread_pixels_function<qt_qimageScaleAARGBA_down_xy_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1}>(QImageScale::QImageScaleInfo*, int, qt_qimageScaleAARGBA_down_xy_sse4<true>(QImageScale::QImageScaleInfo*, unsigned int*, int, int, int, int)::{lambda(int, int)#1} const&) |
72 | | } |
73 | | |
74 | | QT_END_NAMESPACE |
75 | | |
76 | | #endif |