@shopify/react-native-skia 0.1.218 → 0.1.219
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/shopify/reactnative/skia/PlatformContext.java +9 -10
- package/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +5 -1
- package/cpp/rnskia/RNSkView.h +1 -1
- package/cpp/rnskia/dom/nodes/JsiImageNode.h +1 -6
- package/package.json +1 -1
- /package/cpp/rnskia/dom/props/{ImageProps.h → SkImageProps.h} +0 -0
@@ -1,7 +1,5 @@
|
|
1
1
|
package com.shopify.reactnative.skia;
|
2
2
|
|
3
|
-
import android.app.Application;
|
4
|
-
import android.graphics.Bitmap;
|
5
3
|
import android.os.Handler;
|
6
4
|
import android.os.Looper;
|
7
5
|
import android.util.Log;
|
@@ -10,7 +8,6 @@ import android.view.Choreographer;
|
|
10
8
|
import com.facebook.jni.HybridData;
|
11
9
|
import com.facebook.proguard.annotations.DoNotStrip;
|
12
10
|
import com.facebook.react.bridge.ReactContext;
|
13
|
-
import com.facebook.react.turbomodule.core.CallInvokerHolderImpl;
|
14
11
|
|
15
12
|
import java.io.BufferedInputStream;
|
16
13
|
import java.io.ByteArrayOutputStream;
|
@@ -21,8 +18,6 @@ import java.net.URI;
|
|
21
18
|
import java.net.URISyntaxException;
|
22
19
|
import java.net.URL;
|
23
20
|
import java.net.URLConnection;
|
24
|
-
import java.util.concurrent.ExecutorService;
|
25
|
-
import java.util.concurrent.Executors;
|
26
21
|
|
27
22
|
public class PlatformContext {
|
28
23
|
@DoNotStrip
|
@@ -35,6 +30,9 @@ public class PlatformContext {
|
|
35
30
|
|
36
31
|
private final String TAG = "PlatformContext";
|
37
32
|
|
33
|
+
private final Handler mainHandler = new Handler(Looper.getMainLooper());
|
34
|
+
|
35
|
+
|
38
36
|
public PlatformContext(ReactContext reactContext) {
|
39
37
|
mContext = reactContext;
|
40
38
|
mHybridData = initHybrid(reactContext.getResources().getDisplayMetrics().density);
|
@@ -66,9 +64,10 @@ public class PlatformContext {
|
|
66
64
|
Choreographer.getInstance().postFrameCallback(frameCallback);
|
67
65
|
}
|
68
66
|
|
67
|
+
|
69
68
|
@DoNotStrip
|
70
69
|
public void notifyTaskReadyOnMainThread() {
|
71
|
-
|
70
|
+
mainHandler.post(new Runnable() {
|
72
71
|
@Override
|
73
72
|
public void run() {
|
74
73
|
notifyTaskReady();
|
@@ -83,7 +82,7 @@ public class PlatformContext {
|
|
83
82
|
|
84
83
|
@DoNotStrip
|
85
84
|
public void raise(final String message) {
|
86
|
-
|
85
|
+
mainHandler.post(new Runnable() {
|
87
86
|
@Override
|
88
87
|
public void run() {
|
89
88
|
mContext.handleException(new Exception(message));
|
@@ -97,7 +96,7 @@ public class PlatformContext {
|
|
97
96
|
return;
|
98
97
|
}
|
99
98
|
_drawLoopActive = true;
|
100
|
-
|
99
|
+
mainHandler.post(new Runnable() {
|
101
100
|
@Override
|
102
101
|
public void run() {
|
103
102
|
postFrameLoop();
|
@@ -169,7 +168,7 @@ public class PlatformContext {
|
|
169
168
|
Log.i(TAG, "Resume");
|
170
169
|
if(_drawLoopActive) {
|
171
170
|
// Restart draw loop
|
172
|
-
|
171
|
+
mainHandler.post(new Runnable() {
|
173
172
|
@Override
|
174
173
|
public void run() {
|
175
174
|
postFrameLoop();
|
@@ -188,4 +187,4 @@ public class PlatformContext {
|
|
188
187
|
private native HybridData initHybrid(float pixelDensity);
|
189
188
|
private native void notifyDrawLoop();
|
190
189
|
private native void notifyTaskReady();
|
191
|
-
}
|
190
|
+
}
|
@@ -157,9 +157,13 @@ public abstract class SkiaBaseView extends ReactViewGroup implements TextureView
|
|
157
157
|
return false;
|
158
158
|
}
|
159
159
|
|
160
|
+
//private long _prevTimestamp = 0;
|
160
161
|
@Override
|
161
162
|
public void onSurfaceTextureUpdated(SurfaceTexture surface) {
|
162
|
-
|
163
|
+
// long timestamp = surface.getTimestamp();
|
164
|
+
// long frameDuration = (timestamp - _prevTimestamp)/1000000;
|
165
|
+
// Log.i(tag, "onSurfaceTextureUpdated "+frameDuration+"ms");
|
166
|
+
// _prevTimestamp = timestamp;
|
163
167
|
}
|
164
168
|
|
165
169
|
protected abstract void surfaceAvailable(Object surface, int width, int height);
|
package/cpp/rnskia/RNSkView.h
CHANGED
package/package.json
CHANGED
File without changes
|