Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Toggle main menu visibility
Loading...
Searching...
No Matches
qimagescale_p.h
Go to the documentation of this file.
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
{
49
#
if
QT_CONFIG
(
qtgui_threadpool
)
50
int
segments = (qsizetype(isi->sh) * isi->sw) / (1<<16);
51
segments = std::min(segments, dh);
52
QThreadPool *threadPool = QGuiApplicationPrivate::qtGuiThreadPool();
53
if
(segments > 1 && threadPool && !threadPool->contains(QThread::currentThread())) {
54
QLatch latch(segments);
55
int
y = 0;
56
for
(
int
i = 0; i < segments; ++i) {
57
int
yn = (dh - y) / (segments - i);
58
threadPool->start([&, y, yn]() {
59
scaleSection(y, y + yn);
60
latch.countDown();
61
});
62
y += yn;
63
}
64
latch.wait();
65
return
;
66
}
67
#
else
68
Q_UNUSED(isi);
69
#
endif
70
scaleSection(0, dh);
71
}
72
}
73
74
QT_END_NAMESPACE
75
76
#
endif
QImageScale
Definition
qimagescale.cpp:65
QImageScale::multithread_pixels_function
void multithread_pixels_function(QImageScaleInfo *isi, int dh, const T &scaleSection)
Definition
qimagescale_p.h:47
QT_BEGIN_NAMESPACE
Combined button and popup list for selecting options.
Definition
qsequentialanimationgroup.cpp:47
QImageScale::QImageScaleInfo
Definition
qimagescale_p.h:36
QImageScale::QImageScaleInfo::ypoints
const unsigned int ** ypoints
Definition
qimagescale_p.h:38
QImageScale::QImageScaleInfo::xpoints
int * xpoints
Definition
qimagescale_p.h:37
QImageScale::QImageScaleInfo::xup_yup
int xup_yup
Definition
qimagescale_p.h:41
QImageScale::QImageScaleInfo::sw
int sw
Definition
qimagescale_p.h:43
QImageScale::QImageScaleInfo::yapoints
int * yapoints
Definition
qimagescale_p.h:40
QImageScale::QImageScaleInfo::sh
int sh
Definition
qimagescale_p.h:42
QImageScale::QImageScaleInfo::xapoints
int * xapoints
Definition
qimagescale_p.h:39
qtbase
src
gui
painting
qimagescale_p.h
Generated on
for Qt by
1.18.0