Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
libkmahjongg
Commits
ffaa4b43
Commit
ffaa4b43
authored
Dec 31, 2021
by
Albert Astals Cid
Browse files
Make the code hidpi aware
CCBUGS: 443824
parent
10fdcc41
Pipeline
#132398
skipped
Changes
1
Pipelines
4
Hide whitespace changes
Inline
Side-by-side
src/kmahjonggtileset.cpp
View file @
ffaa4b43
...
...
@@ -13,6 +13,7 @@
// Qt
#include
<QFile>
#include
<QGuiApplication>
#include
<QImage>
#include
<QMap>
#include
<QPainter>
...
...
@@ -322,6 +323,9 @@ QString KMahjonggTileset::pixmapCacheNameFromElementId(const QString & elementid
QPixmap
KMahjonggTileset
::
renderElement
(
short
width
,
short
height
,
const
QString
&
elementid
)
{
//qCDebug(LIBKMAHJONGG_LOG) << "render element" << elementid << width << height;
const
qreal
dpr
=
qApp
->
devicePixelRatio
();
width
=
width
*
dpr
;
height
=
height
*
dpr
;
QImage
qiRend
(
QSize
(
width
,
height
),
QImage
::
Format_ARGB32_Premultiplied
);
qiRend
.
fill
(
0
);
...
...
@@ -329,6 +333,7 @@ QPixmap KMahjonggTileset::renderElement(short width, short height, const QString
QPainter
p
(
&
qiRend
);
d
->
svg
.
render
(
&
p
,
elementid
);
}
qiRend
.
setDevicePixelRatio
(
dpr
);
return
QPixmap
::
fromImage
(
qiRend
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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