From e9bb166fe793679ff7988b8cc75cdc75dc364295 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Wed, 11 Dec 2024 14:15:42 +0100 Subject: [PATCH] =?UTF-8?q?fix(=F0=9F=A4=96):=20fix=20vulkan/angle=20suppo?= =?UTF-8?q?rt=20(#2801)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These seem to mostly affect samsung devices. --- .../reactnative/skia/SkiaBaseView.java | 13 -------- .../reactnative/skia/SkiaTextureView.java | 33 ++----------------- 2 files changed, 2 insertions(+), 44 deletions(-) diff --git a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java index 8f465e0d2c..fe73f33170 100644 --- a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java +++ b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaBaseView.java @@ -32,20 +32,7 @@ public void setOpaque(boolean value) { } } - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - if (getMeasuredWidth() == 0) { - if (mView instanceof SkiaTextureView) { - ((SkiaTextureView) mView).createSurfaceTexture(); - } - } - } - void dropInstance() { - if (mView instanceof SkiaTextureView) { - ((SkiaTextureView)mView).isDropped = true; - } unregisterView(); } diff --git a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java index e423f4666b..d776590baa 100644 --- a/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java +++ b/packages/skia/android/src/main/java/com/shopify/reactnative/skia/SkiaTextureView.java @@ -15,9 +15,6 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT SkiaViewAPI mApi; boolean mDebug; - boolean pristine = true; - - public boolean isDropped = false; public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) { super(context); @@ -27,22 +24,6 @@ public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) { setSurfaceTextureListener(this); } - public void createSurfaceTexture() { - if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) { - Log.i(tag, "Create SurfaceTexture"); - SurfaceTexture surfaceTexture = new SurfaceTexture(false); - setSurfaceTexture(surfaceTexture); - onSurfaceTextureAvailable(surfaceTexture, getWidth(), getHeight()); - } - } - - private void reCreateSurfaceTexture() { - boolean surfaceIsAlreadyAvailable = getSurfaceTexture() != null; - if (surfaceIsAlreadyAvailable) { - createSurfaceTexture(); - } - } - @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { super.onLayout(changed, left, top, right, bottom); @@ -57,23 +38,13 @@ public void onSurfaceTextureAvailable(@NonNull SurfaceTexture surfaceTexture, in @Override public void onSurfaceTextureSizeChanged(@NonNull SurfaceTexture surfaceTexture, int width, int height) { Log.i(tag, "onSurfaceTextureSizeChanged: " + width + "x" + height); - if (isDropped) { - return; - } - mApi.onSurfaceTextureCreated(surfaceTexture, width, height); + mApi.onSurfaceTextureChanged(surfaceTexture, width, height); } @Override public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surfaceTexture) { mApi.onSurfaceDestroyed(); - // Because of React Native Screens (which dettach the view), we always keep the surface alive. - // If not, Texture view will recreate the texture surface by itself and - // we will lose the fast first time to frame. - // We only delete the surface when the view is dropped (destroySurface invoked by SkiaBaseViewManager); - if (!isDropped) { - reCreateSurfaceTexture(); - } - return false; + return true; } private long _prevTimestamp = 0;