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
d1d84095
Unverified
Commit
d1d84095
authored
Apr 30, 2021
by
Roman Sedaikin
Committed by
GitHub
Apr 30, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #99 from JetBrains/more-debug-info
Added OS/JRE info in debug output.
parents
9b6b8109
2b84d3b6
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
44 additions
and
17 deletions
+44
-17
App.kt
...kijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
+2
-2
OsArch.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/OsArch.kt
+13
-1
ContextHandler.kt
...Main/kotlin/org/jetbrains/skiko/context/ContextHandler.kt
+9
-1
Direct3DContextHandler.kt
...lin/org/jetbrains/skiko/context/Direct3DContextHandler.kt
+4
-4
MetalContextHandler.kt
...kotlin/org/jetbrains/skiko/context/MetalContextHandler.kt
+4
-4
OpenGLContextHandler.kt
...otlin/org/jetbrains/skiko/context/OpenGLContextHandler.kt
+4
-4
SoftwareContextHandler.kt
...lin/org/jetbrains/skiko/context/SoftwareContextHandler.kt
+8
-1
No files found.
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
View file @
d1d84095
...
...
@@ -98,8 +98,8 @@ class Renderer(
// Alpha layers test
val
rectW
=
100f
val
rectH
=
100f
val
left
=
(
width
-
rectW
)
/
2f
val
top
=
(
height
-
rectH
)
/
2f
val
left
=
(
width
/
layer
.
contentScale
-
rectW
)
/
2f
val
top
=
(
height
/
layer
.
contentScale
-
rectH
)
/
2f
val
pictureRecorder
=
PictureRecorder
()
val
pictureCanvas
=
pictureRecorder
.
beginRecording
(
Rect
.
makeLTRB
(
left
,
top
,
left
+
rectW
,
top
+
rectH
)
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/OsArch.kt
View file @
d1d84095
...
...
@@ -36,4 +36,16 @@ val hostArch by lazy {
val
hostId
by
lazy
{
"${hostOs.id}-${hostArch.id}"
}
\ No newline at end of file
}
internal
val
hostFullName
by
lazy
{
"${System.getProperty("
os
.
name
")}, ${System.getProperty("
os
.
version
")}, ${hostArch.toString().toLowerCase()}"
}
internal
val
javaVendor
by
lazy
{
"${System.getProperty("
java
.
vendor
")} ${System.getProperty("
java
.
version
")}"
}
internal
val
javaLocation
by
lazy
{
"${System.getProperty("
java
.
home
")}"
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/ContextHandler.kt
View file @
d1d84095
...
...
@@ -9,6 +9,9 @@ import org.jetbrains.skiko.GraphicsApi
import
org.jetbrains.skiko.OS
import
org.jetbrains.skiko.SkiaLayer
import
org.jetbrains.skiko.hostOs
import
org.jetbrains.skiko.hostFullName
import
org.jetbrains.skiko.javaLocation
import
org.jetbrains.skiko.javaVendor
internal
fun
createContextHandler
(
layer
:
SkiaLayer
,
renderApi
:
GraphicsApi
):
ContextHandler
{
return
when
(
renderApi
)
{
...
...
@@ -52,7 +55,12 @@ internal abstract class ContextHandler(val layer: SkiaLayer) {
renderTarget
?.
close
()
}
open
fun
hardwareInfo
():
String
=
""
protected
open
fun
rendererInfo
():
String
{
return
"${layer.renderApi} rendering info:\n"
+
"OS: $hostFullName\n"
+
"Java: $javaVendor\n"
+
"Java location: $javaLocation\n"
}
protected
open
fun
destroyContext
()
=
Unit
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/Direct3DContextHandler.kt
View file @
d1d84095
...
...
@@ -26,7 +26,7 @@ internal class Direct3DContextHandler(layer: SkiaLayer) : ContextHandler(layer)
}
context
=
directXRedrawer
.
makeContext
(
device
)
if
(
System
.
getProperty
(
"skiko.hardwareInfo.enabled"
)
==
"true"
)
{
println
(
hardware
Info
())
println
(
renderer
Info
())
}
}
}
catch
(
e
:
Exception
)
{
...
...
@@ -108,9 +108,9 @@ internal class Direct3DContextHandler(layer: SkiaLayer) : ContextHandler(layer)
}
}
override
fun
hardware
Info
():
String
{
return
"DIRECT3D (dx12) hardware info:\n"
+
protected
override
fun
renderer
Info
():
String
{
return
super
.
rendererInfo
()
+
"Video card: ${directXRedrawer.getAdapterName(device)}\n"
+
"Total
memory
: ${directXRedrawer.getAdapterMemorySize(device) / 1024 / 1024} MB\n"
"Total
VRAM
: ${directXRedrawer.getAdapterMemorySize(device) / 1024 / 1024} MB\n"
}
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/MetalContextHandler.kt
View file @
d1d84095
...
...
@@ -17,7 +17,7 @@ internal class MetalContextHandler(layer: SkiaLayer) : ContextHandler(layer) {
if
(
context
==
null
)
{
context
=
metalRedrawer
.
makeContext
()
if
(
System
.
getProperty
(
"skiko.hardwareInfo.enabled"
)
==
"true"
)
{
println
(
hardware
Info
())
println
(
renderer
Info
())
}
}
}
catch
(
e
:
Exception
)
{
...
...
@@ -57,9 +57,9 @@ internal class MetalContextHandler(layer: SkiaLayer) : ContextHandler(layer) {
context
?.
close
()
}
override
fun
hardware
Info
():
String
{
return
"METAL hardware info:\n"
+
override
fun
renderer
Info
():
String
{
return
super
.
rendererInfo
()
+
"Video card: ${metalRedrawer.getAdapterName()}\n"
+
"Total
memory
: ${metalRedrawer.getAdapterMemorySize() / 1024 / 1024} MB\n"
"Total
VRAM
: ${metalRedrawer.getAdapterMemorySize() / 1024 / 1024} MB\n"
}
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/OpenGLContextHandler.kt
View file @
d1d84095
...
...
@@ -16,7 +16,7 @@ internal class OpenGLContextHandler(layer: SkiaLayer) : ContextHandler(layer) {
if
(
context
==
null
)
{
context
=
makeGLContext
()
if
(
System
.
getProperty
(
"skiko.hardwareInfo.enabled"
)
==
"true"
)
{
println
(
hardware
Info
())
println
(
renderer
Info
())
}
}
}
catch
(
e
:
Exception
)
{
...
...
@@ -66,11 +66,11 @@ internal class OpenGLContextHandler(layer: SkiaLayer) : ContextHandler(layer) {
canvas
=
surface
!!
.
canvas
}
override
fun
hardware
Info
():
String
{
override
fun
renderer
Info
():
String
{
val
gl
=
OpenGLApi
.
instance
return
"OPENGL hardware info:\n"
+
return
super
.
rendererInfo
()
+
"Vendor: ${gl.glGetString(gl.GL_VENDOR)}\n"
+
"Model: ${gl.glGetString(gl.GL_RENDERER)}\n"
+
"Total
memory
: ${gl.glGetIntegerv(gl.GL_TOTAL_MEMORY) / 1024} MB\n"
"Total
VRAM
: ${gl.glGetIntegerv(gl.GL_TOTAL_MEMORY) / 1024} MB\n"
}
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/context/SoftwareContextHandler.kt
View file @
d1d84095
...
...
@@ -29,10 +29,17 @@ internal class SoftwareContextHandler(layer: SkiaLayer) : ContextHandler(layer)
var
image
:
BufferedImage
?
=
null
var
imageData
:
ByteArray
?
=
null
var
raster
:
WritableRaster
?
=
null
var
isInited
=
false
override
fun
initContext
():
Boolean
{
// Raster does not need context
return
true
if
(!
isInited
)
{
if
(
System
.
getProperty
(
"skiko.hardwareInfo.enabled"
)
==
"true"
)
{
println
(
rendererInfo
())
}
isInited
=
true
}
return
isInited
}
override
fun
initCanvas
()
{
...
...
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