Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
linphone-desktop
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
linphone-desktop
Commits
3a0dbaf9
Commit
3a0dbaf9
authored
Jun 23, 2017
by
Ronan Abhamon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(ImageProvider): set size on request
parent
56890720
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
2 deletions
+10
-2
ImageProvider.cpp
src/app/providers/ImageProvider.cpp
+10
-2
No files found.
src/app/providers/ImageProvider.cpp
View file @
3a0dbaf9
...
@@ -247,7 +247,7 @@ ImageProvider::ImageProvider () : QQuickImageProvider(
...
@@ -247,7 +247,7 @@ ImageProvider::ImageProvider () : QQuickImageProvider(
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
QImage
ImageProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
,
const
QSize
&
)
{
QImage
ImageProvider
::
requestImage
(
const
QString
&
id
,
QSize
*
size
,
const
QSize
&
requestedSize
)
{
const
QString
path
=
QStringLiteral
(
":/assets/images/%1"
).
arg
(
id
);
const
QString
path
=
QStringLiteral
(
":/assets/images/%1"
).
arg
(
id
);
qInfo
()
<<
QStringLiteral
(
"Image `%1` requested."
).
arg
(
path
);
qInfo
()
<<
QStringLiteral
(
"Image `%1` requested."
).
arg
(
path
);
...
@@ -281,7 +281,13 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
...
@@ -281,7 +281,13 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
// 3. Create en empty image.
// 3. Create en empty image.
const
QRectF
viewBox
=
renderer
.
viewBoxF
();
const
QRectF
viewBox
=
renderer
.
viewBoxF
();
QImage
image
(
static_cast
<
int
>
(
viewBox
.
width
()),
static_cast
<
int
>
(
viewBox
.
height
()),
QImage
::
Format_ARGB32
);
const
int
width
=
requestedSize
.
width
();
const
int
height
=
requestedSize
.
height
();
QImage
image
(
width
>
0
?
width
:
static_cast
<
int
>
(
viewBox
.
width
()),
height
>
0
?
height
:
static_cast
<
int
>
(
viewBox
.
height
()),
QImage
::
Format_ARGB32
);
if
(
Q_UNLIKELY
(
image
.
isNull
()))
{
if
(
Q_UNLIKELY
(
image
.
isNull
()))
{
qWarning
()
<<
QStringLiteral
(
"Unable to create image of size `(%1, %2)` from path: `%3`."
)
qWarning
()
<<
QStringLiteral
(
"Unable to create image of size `(%1, %2)` from path: `%3`."
)
.
arg
(
viewBox
.
width
()).
arg
(
viewBox
.
height
()).
arg
(
path
);
.
arg
(
viewBox
.
width
()).
arg
(
viewBox
.
height
()).
arg
(
path
);
...
@@ -289,6 +295,8 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
...
@@ -289,6 +295,8 @@ QImage ImageProvider::requestImage (const QString &id, QSize *, const QSize &) {
}
}
image
.
fill
(
0x00000000
);
image
.
fill
(
0x00000000
);
*
size
=
image
.
size
();
// 4. Paint!
// 4. Paint!
QPainter
painter
(
&
image
);
QPainter
painter
(
&
image
);
renderer
.
render
(
&
painter
);
renderer
.
render
(
&
painter
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment