Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
liuqiang
skiko
Commits
69c02ca7
Commit
69c02ca7
authored
Apr 13, 2021
by
Roman Sedaikin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix for white lines glitch on some scaling factors.
parent
9f17aba6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
2 deletions
+21
-2
.gitignore
.gitignore
+1
-0
SkiaLayer.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaLayer.kt
+20
-2
No files found.
.gitignore
View file @
69c02ca7
...
...
@@ -6,4 +6,5 @@ local.properties
run.sh
.idea
deploy.sh
deploy.bat
skiko/src/jvmMain/java
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaLayer.kt
View file @
69c02ca7
...
...
@@ -116,8 +116,14 @@ open class SkiaLayer(
}
override
fun
setBounds
(
x
:
Int
,
y
:
Int
,
width
:
Int
,
height
:
Int
)
{
super
.
setBounds
(
x
,
y
,
width
,
height
)
backedLayer
.
setSize
(
width
,
height
)
var
roundedWidth
=
0
var
roundedHeight
=
0
if
(
isInited
)
{
roundedWidth
=
roundSize
(
width
)
roundedHeight
=
roundSize
(
height
)
}
backedLayer
.
setSize
(
roundedWidth
,
roundedHeight
)
super
.
setBounds
(
x
,
y
,
roundedWidth
,
roundedHeight
)
}
override
fun
paint
(
g
:
Graphics
)
{
...
...
@@ -277,4 +283,16 @@ open class SkiaLayer(
redrawer
=
platformOperations
.
createRedrawer
(
this
,
renderApi
,
properties
)
redrawer
!!
.
redrawImmediately
()
}
private
fun
roundSize
(
value
:
Int
):
Int
{
var
rounded
=
value
*
contentScale
val
diff
=
rounded
-
rounded
.
toInt
()
// We check values close to 0.5 and edit the size to avoid white lines glitch
if
(
diff
>=
0.4f
&&
diff
<=
0.6f
)
{
rounded
=
value
+
1f
}
else
{
rounded
=
value
.
toFloat
()
}
return
rounded
.
toInt
()
}
}
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