Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nheko
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nheko Reborn
nheko
Commits
dcdf00dc
Commit
dcdf00dc
authored
3 years ago
by
Loren Burkholder
Browse files
Options
Downloads
Patches
Plain Diff
Finish fixing rounded avatars
parent
350fc593
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/JdenticonProvider.cpp
+27
-7
27 additions, 7 deletions
src/JdenticonProvider.cpp
with
27 additions
and
7 deletions
src/JdenticonProvider.cpp
+
27
−
7
View file @
dcdf00dc
...
...
@@ -19,6 +19,25 @@
#include
"Utils.h"
#include
"jdenticoninterface.h"
static
QPixmap
clipRadius
(
QPixmap
img
,
double
radius
)
{
QPixmap
out
(
img
.
size
());
out
.
fill
(
Qt
::
transparent
);
QPainter
painter
(
&
out
);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
painter
.
setRenderHint
(
QPainter
::
SmoothPixmapTransform
,
true
);
QPainterPath
ppath
;
ppath
.
addRoundedRect
(
img
.
rect
(),
radius
,
radius
,
Qt
::
SizeMode
::
RelativeSize
);
painter
.
setClipPath
(
ppath
);
painter
.
drawPixmap
(
img
.
rect
(),
img
);
return
out
;
}
JdenticonResponse
::
JdenticonResponse
(
const
QString
&
key
,
bool
crop
,
double
radius
,
...
...
@@ -37,19 +56,20 @@ void
JdenticonResponse
::
run
()
{
m_pixmap
.
fill
(
Qt
::
transparent
);
QPainter
painter
{
&
m_pixmap
};
QPainter
painter
;
painter
.
begin
(
&
m_pixmap
);
painter
.
setRenderHint
(
QPainter
::
Antialiasing
,
true
);
painter
.
setRenderHint
(
QPainter
::
SmoothPixmapTransform
,
true
);
QPainterPath
ppath
;
ppath
.
addRoundedRect
(
m_pixmap
.
rect
(),
m_radius
,
m_radius
);
painter
.
setClipPath
(
ppath
);
QSvgRenderer
renderer
{
jdenticonInterface_
->
generate
(
m_key
,
m_requestedSize
.
width
()).
toUtf8
()};
renderer
.
render
(
&
painter
);
painter
.
end
();
m_pixmap
=
clipRadius
(
m_pixmap
,
m_radius
);
emit
finished
();
}
...
...
@@ -64,7 +84,7 @@ getJdenticonInterface()
bool
plugins
=
pluginsDir
.
cd
(
"plugins"
);
if
(
plugins
)
{
for
(
QString
fileName
:
pluginsDir
.
entryList
(
QDir
::
Files
))
{
for
(
const
QString
&
fileName
:
pluginsDir
.
entryList
(
QDir
::
Files
))
{
QPluginLoader
pluginLoader
(
pluginsDir
.
absoluteFilePath
(
fileName
));
QObject
*
plugin
=
pluginLoader
.
instance
();
if
(
plugin
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment