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
40668d6a
Unverified
Commit
40668d6a
authored
Sep 22, 2021
by
Nikolay Igotti
Committed by
GitHub
Sep 22, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make native sources Android-friendly. (#209)
parent
93367672
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
70 additions
and
9 deletions
+70
-9
Drawable.cc
skiko/src/jvmMain/cpp/common/Drawable.cc
+1
-1
TextLine.hh
skiko/src/jvmMain/cpp/common/TextLine.hh
+1
-0
awt_jni.cc
skiko/src/jvmMain/cpp/common/awt_jni.cc
+47
-1
Library.cc
skiko/src/jvmMain/cpp/common/impl/Library.cc
+3
-3
interop.cc
skiko/src/jvmMain/cpp/common/interop.cc
+2
-2
interop.hh
skiko/src/jvmMain/cpp/common/interop.hh
+7
-0
jawt.cc
skiko/src/jvmMain/cpp/common/jawt.cc
+5
-1
openglapi.cc
skiko/src/jvmMain/cpp/common/openglapi.cc
+2
-0
render.cc
skiko/src/jvmMain/cpp/common/render.cc
+1
-1
TextLineRunHandler.hh
skiko/src/jvmMain/cpp/common/shaper/TextLineRunHandler.hh
+1
-0
No files found.
skiko/src/jvmMain/cpp/common/Drawable.cc
View file @
40668d6a
...
...
@@ -10,7 +10,7 @@ public:
~
SkijaDrawableImpl
()
{
JNIEnv
*
env
;
if
(
fJavaVM
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
JNI_VERSION_1_8
)
==
JNI_OK
)
if
(
fJavaVM
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
SKIKO_JNI_VERSION
)
==
JNI_OK
)
env
->
DeleteWeakGlobalRef
(
fObject
);
}
...
...
skiko/src/jvmMain/cpp/common/TextLine.hh
View file @
40668d6a
#include "SkCanvas.h"
#include "SkFont.h"
#include "SkFontMetrics.h"
#include "SkPoint.h"
#include "SkRefCnt.h"
#include "SkTextBlob.h"
...
...
skiko/src/jvmMain/cpp/common/awt_jni.cc
View file @
40668d6a
#include <cstdint>
#include <jni.h>
#ifdef SK_BUILD_FOR_ANDROID
#include <stdlib.h>
#else
#include <jawt_md.h>
#include "jni_helpers.h"
#endif
#ifndef SK_BUILD_FOR_ANDROID
extern
"C"
jboolean
Skiko_GetAWT
(
JNIEnv
*
env
,
JAWT
*
awt
);
#endif
extern
"C"
{
JNIEXPORT
jlong
JNICALL
Java_org_jetbrains_skiko_AWTKt_getAWT
(
JNIEnv
*
env
,
jobject
obj
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
0
;
#else
JAWT
*
awt
=
new
JAWT
();
awt
->
version
=
(
jint
)
JAWT_VERSION_9
;
jboolean
result
=
Skiko_GetAWT
(
env
,
awt
);
...
...
@@ -20,51 +30,87 @@ extern "C"
{
return
toJavaPointer
(
awt
);
}
#endif
}
JNIEXPORT
jlong
JNICALL
Java_org_jetbrains_skiko_AWTKt_getDrawingSurface
(
JNIEnv
*
env
,
jobject
obj
,
jlong
awtPtr
,
jobject
layer
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
0
;
#else
JAWT
*
awt
=
fromJavaPointer
<
JAWT
*>
(
awtPtr
);
JAWT_DrawingSurface
*
ds
=
awt
->
GetDrawingSurface
(
env
,
layer
);
return
toJavaPointer
(
ds
);
#endif
}
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skiko_AWTKt_freeDrawingSurface
(
JNIEnv
*
env
,
jobject
obj
,
jlong
awtPtr
,
jlong
drawingSurfacePtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
;
#else
JAWT
*
awt
=
fromJavaPointer
<
JAWT
*>
(
awtPtr
);
JAWT_DrawingSurface
*
ds
=
fromJavaPointer
<
JAWT_DrawingSurface
*>
(
drawingSurfacePtr
);
awt
->
FreeDrawingSurface
(
ds
);
#endif
}
JNIEXPORT
jint
JNICALL
Java_org_jetbrains_skiko_AWTKt_lockDrawingSurface
(
JNIEnv
*
env
,
jobject
obj
,
jlong
drawingSurfacePtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
0
;
#else
JAWT_DrawingSurface
*
ds
=
fromJavaPointer
<
JAWT_DrawingSurface
*>
(
drawingSurfacePtr
);
return
(
ds
->
Lock
(
ds
)
&
JAWT_LOCK_ERROR
)
!=
0
;
#endif
}
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skiko_AWTKt_unlockDrawingSurface
(
JNIEnv
*
env
,
jobject
obj
,
jlong
drawingSurfacePtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
;
#else
JAWT_DrawingSurface
*
ds
=
fromJavaPointer
<
JAWT_DrawingSurface
*>
(
drawingSurfacePtr
);
ds
->
Unlock
(
ds
);
#endif
}
JNIEXPORT
jlong
JNICALL
Java_org_jetbrains_skiko_AWTKt_getDrawingSurfaceInfo
(
JNIEnv
*
env
,
jobject
obj
,
jlong
drawingSurfacePtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
0
;
#else
JAWT_DrawingSurface
*
ds
=
fromJavaPointer
<
JAWT_DrawingSurface
*>
(
drawingSurfacePtr
);
JAWT_DrawingSurfaceInfo
*
dsi
=
ds
->
GetDrawingSurfaceInfo
(
ds
);
return
toJavaPointer
(
dsi
);
#endif
}
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skiko_AWTKt_freeDrawingSurfaceInfo
(
JNIEnv
*
env
,
jobject
obj
,
jlong
drawingSurfacePtr
,
jlong
drawingSurfaceInfoPtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
;
#else
JAWT_DrawingSurface
*
ds
=
fromJavaPointer
<
JAWT_DrawingSurface
*>
(
drawingSurfacePtr
);
JAWT_DrawingSurfaceInfo
*
dsi
=
fromJavaPointer
<
JAWT_DrawingSurfaceInfo
*>
(
drawingSurfaceInfoPtr
);
ds
->
FreeDrawingSurfaceInfo
(
dsi
);
#endif
}
JNIEXPORT
jlong
JNICALL
Java_org_jetbrains_skiko_AWTKt_getPlatformInfo
(
JNIEnv
*
env
,
jobject
obj
,
jlong
drawingSurfaceInfoPtr
)
{
#ifdef SK_BUILD_FOR_ANDROID
abort
();
return
0
;
#else
JAWT_DrawingSurfaceInfo
*
dsi
=
fromJavaPointer
<
JAWT_DrawingSurfaceInfo
*>
(
drawingSurfaceInfoPtr
);
return
toJavaPointer
(
dsi
->
platformInfo
);
#endif
}
}
\ No newline at end of file
skiko/src/jvmMain/cpp/common/impl/Library.cc
View file @
40668d6a
...
...
@@ -7,10 +7,10 @@
JNIEXPORT
jint
JNICALL
JNI_OnLoad
(
JavaVM
*
vm
,
void
*
reserved
)
{
JNIEnv
*
env
;
if
(
vm
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
JNI_VERSION_1_8
)
!=
JNI_OK
)
if
(
vm
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
SKIKO_JNI_VERSION
)
!=
JNI_OK
)
return
JNI_ERR
;
return
JNI_VERSION_1_8
;
return
SKIKO_JNI_VERSION
;
}
extern
"C"
JNIEXPORT
void
JNICALL
Java_org_jetbrains_skia_impl_Library__1nAfterLoad
...
...
@@ -26,7 +26,7 @@ extern "C" JNIEXPORT void JNICALL Java_org_jetbrains_skia_impl_Library__1nAfterL
JNIEXPORT
void
JNICALL
JNI_OnUnload
(
JavaVM
*
vm
,
void
*
reserved
)
{
JNIEnv
*
env
;
if
(
vm
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
JNI_VERSION_1_8
)
!=
JNI_OK
)
if
(
vm
->
GetEnv
(
reinterpret_cast
<
void
**>
(
&
env
),
SKIKO_JNI_VERSION
)
!=
JNI_OK
)
return
;
skija
::
svg
::
onUnload
(
env
);
...
...
skiko/src/jvmMain/cpp/common/interop.cc
View file @
40668d6a
...
...
@@ -532,7 +532,7 @@ namespace skija {
bool
onFilter
(
jobject
obj
,
SkPaint
&
paint
)
{
JNIEnv
*
env
;
_vm
->
AttachCurrentThread
(
(
void
**
)
&
env
,
NULL
);
_vm
->
AttachCurrentThread
(
AS_JNI_ENV_PTR
(
&
env
)
,
NULL
);
jboolean
result
=
env
->
CallBooleanMethod
(
obj
,
onFilterId
,
reinterpret_cast
<
jlong
>
(
&
paint
));
_vm
->
DetachCurrentThread
();
return
result
;
...
...
@@ -544,7 +544,7 @@ namespace skija {
void
detach
(
jobject
obj
)
{
JNIEnv
*
env
;
_vm
->
AttachCurrentThread
(
(
void
**
)
&
env
,
NULL
);
_vm
->
AttachCurrentThread
(
AS_JNI_ENV_PTR
(
&
env
)
,
NULL
);
env
->
DeleteGlobalRef
(
obj
);
_vm
->
DetachCurrentThread
();
}
...
...
skiko/src/jvmMain/cpp/common/interop.hh
View file @
40668d6a
...
...
@@ -360,3 +360,10 @@ inline T jlongToPtr(jlong ptr) {
void
deleteJBytes
(
void
*
addr
,
void
*
);
#ifdef SK_BUILD_FOR_ANDROID
#define SKIKO_JNI_VERSION JNI_VERSION_1_6
#define AS_JNI_ENV_PTR(env) (env)
#else
#define SKIKO_JNI_VERSION JNI_VERSION_1_8
#define AS_JNI_ENV_PTR(env) ((void**)(env))
#endif
\ No newline at end of file
skiko/src/jvmMain/cpp/common/jawt.cc
View file @
40668d6a
#ifndef SK_BUILD_FOR_ANDROID
#include <jawt.h>
#include <jawt_md.h>
#include <stdlib.h>
#if SK_BUILD_FOR_WIN
...
...
@@ -97,3 +99,5 @@ extern "C" jboolean Skiko_GetAWT(JNIEnv *env, JAWT *awt) {
#endif
return
func
(
env
,
awt
);
}
#endif
\ No newline at end of file
skiko/src/jvmMain/cpp/common/openglapi.cc
View file @
40668d6a
...
...
@@ -4,6 +4,8 @@
#endif
#if SK_BUILD_FOR_MAC
#import <OpenGL/gl3.h>
#elif SK_BUILD_FOR_ANDROID
#include <GLES/gl.h>
#else
#include <GL/gl.h>
#endif
...
...
skiko/src/jvmMain/cpp/common/render.cc
View file @
40668d6a
#include <jni.h>
#if SK_BUILD_FOR_LINUX
#include <stdint.h>
#include <stdint.h>
#endif
#include "jni_helpers.h"
...
...
skiko/src/jvmMain/cpp/common/shaper/TextLineRunHandler.hh
View file @
40668d6a
...
...
@@ -4,6 +4,7 @@
#include "../TextLine.hh"
#include "SkShaper.h"
#include "SkTextBlob.h"
#include "unicode/ubrk.h"
class
TextLineRunHandler
:
public
SkShaper
::
RunHandler
{
public
:
...
...
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