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
98358124
Commit
98358124
authored
Feb 01, 2021
by
Igor Demin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move skiko.renderApi to SkikoProperties
parent
4d028657
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
47 additions
and
21 deletions
+47
-21
SkijaInjectSample (software).run.xml
.run/SkijaInjectSample (software).run.xml
+25
-0
PlatformOperations.kt
.../jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
+1
-1
SkikoProperties.kt
...src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt
+18
-0
ContextHandler.kt
...Main/kotlin/org/jetbrains/skiko/context/ContextHandler.kt
+3
-20
No files found.
.run/SkijaInjectSample (software).run.xml
0 → 100644
View file @
98358124
<component
name=
"ProjectRunConfigurationManager"
>
<configuration
default=
"false"
name=
"SkijaInjectSample (software)"
type=
"GradleRunConfiguration"
factoryName=
"Gradle"
>
<ExternalSystemSettings>
<option
name=
"executionName"
/>
<option
name=
"externalProjectPath"
value=
"$PROJECT_DIR$/samples/SkijaInjectSample"
/>
<option
name=
"externalSystemIdString"
value=
"GRADLE"
/>
<option
name=
"scriptParameters"
value=
"-Dskiko.renderApi=SOFTWARE"
/>
<option
name=
"taskDescriptions"
>
<list
/>
</option>
<option
name=
"taskNames"
>
<list>
<option
value=
"run"
/>
</list>
</option>
<option
name=
"vmOptions"
value=
""
/>
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>
true
</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>
true
</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>
false
</DebugAllEnabled>
<method
v=
"2"
>
<option
name=
"Gradle.BeforeRunTask"
enabled=
"false"
tasks=
"publishToMavenLocal"
externalProjectPath=
"$PROJECT_DIR$/skiko"
vmOptions=
""
scriptParameters=
""
/>
</method>
</configuration>
</component>
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
View file @
98358124
package
org.jetbrains.skiko
import
org.jetbrains.skiko.
context
.renderApi
import
org.jetbrains.skiko.
SkikoProperties
.renderApi
import
org.jetbrains.skiko.redrawer.LinuxOpenGLRedrawer
import
org.jetbrains.skiko.redrawer.MacOsOpenGLRedrawer
import
org.jetbrains.skiko.redrawer.RasterRedrawer
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkikoProperties.kt
View file @
98358124
...
...
@@ -8,6 +8,24 @@ internal object SkikoProperties {
val
fpsCount
:
Int
by
property
(
"skiko.fps.count"
,
default
=
300
)
val
fpsProbability
:
Double
by
property
(
"skiko.fps.probability"
,
default
=
0.97
)
val
renderApi
:
GraphicsApi
by
lazy
{
val
environment
=
System
.
getenv
(
"SKIKO_RENDER_API"
)
val
property
=
System
.
getProperty
(
"skiko.renderApi"
)
if
(
environment
!=
null
)
{
parseRenderApi
(
environment
)
}
else
{
parseRenderApi
(
property
)
}
}
private
fun
parseRenderApi
(
text
:
String
?):
GraphicsApi
{
when
(
text
)
{
"SOFTWARE"
->
return
GraphicsApi
.
SOFTWARE
"OPENGL"
->
return
GraphicsApi
.
OPENGL
else
->
return
GraphicsApi
.
OPENGL
}
}
private
fun
property
(
name
:
String
,
default
:
Boolean
)
=
lazy
{
System
.
getProperty
(
name
)
?.
toBoolean
()
?:
default
}
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/ContextHandler.kt
View file @
98358124
...
...
@@ -7,29 +7,12 @@ import org.jetbrains.skija.Picture
import
org.jetbrains.skija.Surface
import
org.jetbrains.skiko.GraphicsApi
import
org.jetbrains.skiko.HardwareLayer
import
org.jetbrains.skiko.hostOs
import
org.jetbrains.skiko.OS
internal
val
renderApi
:
GraphicsApi
by
lazy
{
val
environment
=
System
.
getenv
(
"SKIKO_RENDER_API"
)
val
property
=
System
.
getProperty
(
"skiko.renderApi"
)
if
(
environment
!=
null
)
{
parseRenderApi
(
environment
)
}
else
{
parseRenderApi
(
property
)
}
}
private
fun
parseRenderApi
(
text
:
String
?):
GraphicsApi
{
when
(
text
)
{
"SOFTWARE"
->
return
GraphicsApi
.
SOFTWARE
"OPENGL"
->
return
GraphicsApi
.
OPENGL
else
->
return
GraphicsApi
.
OPENGL
}
}
import
org.jetbrains.skiko.SkikoProperties
import
org.jetbrains.skiko.hostOs
internal
fun
createContextHandler
(
layer
:
HardwareLayer
):
ContextHandler
{
return
when
(
renderApi
)
{
return
when
(
SkikoProperties
.
renderApi
)
{
GraphicsApi
.
SOFTWARE
->
SoftwareContextHandler
(
layer
)
GraphicsApi
.
OPENGL
->
OpenGLContextHandler
(
layer
)
else
->
TODO
(
"Unsupported yet"
)
...
...
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