diff --git a/example/src/Tests/Screens/Snapshot6.tsx b/example/src/Tests/Screens/Snapshot6.tsx deleted file mode 100644 index 2b4253672e..0000000000 --- a/example/src/Tests/Screens/Snapshot6.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import type { SkImage } from "@shopify/react-native-skia"; -import { Skia, Canvas, Image } from "@shopify/react-native-skia"; -import React, { useEffect } from "react"; -import { View } from "react-native"; -import { runOnUI, useSharedValue } from "react-native-reanimated"; - -const size = 50; -const jsSurface = Skia.Surface.MakeOffscreen(size, size)!; -const jsCanvas = jsSurface.getCanvas(); -jsCanvas.drawColor(Skia.Color("cyan")); -const jsImage = jsSurface.makeImageSnapshot(); -const nonTexImage = jsImage.makeNonTextureImage(); - -export const Snapshot6 = () => { - const image = useSharedValue(null); - useEffect(() => { - runOnUI(() => { - image.value = jsImage.makeTextureImage(); - if (!image.value) { - throw new Error("Failed to create texture image"); - } - })(); - }, [image]); - return ( - - - - - - - ); -}; diff --git a/example/src/Tests/Screens/index.ts b/example/src/Tests/Screens/index.ts index 7e2fc78554..0816422599 100644 --- a/example/src/Tests/Screens/index.ts +++ b/example/src/Tests/Screens/index.ts @@ -5,7 +5,6 @@ import { Snapshot2 } from "./Snapshot2"; import { Snapshot3 } from "./Snapshot3"; import { Snapshot4 } from "./Snapshot4"; import { Snapshot5 } from "./Snapshot5"; -import { Snapshot6 } from "./Snapshot6"; export const Screens: Record = { Snapshot1, @@ -13,5 +12,4 @@ export const Screens: Record = { Snapshot3, Snapshot4, Snapshot5, - Snapshot6, }; diff --git a/fabricexample/src/Tests/Screens/Snapshot6.tsx b/fabricexample/src/Tests/Screens/Snapshot6.tsx deleted file mode 100644 index 2b4253672e..0000000000 --- a/fabricexample/src/Tests/Screens/Snapshot6.tsx +++ /dev/null @@ -1,46 +0,0 @@ -import type { SkImage } from "@shopify/react-native-skia"; -import { Skia, Canvas, Image } from "@shopify/react-native-skia"; -import React, { useEffect } from "react"; -import { View } from "react-native"; -import { runOnUI, useSharedValue } from "react-native-reanimated"; - -const size = 50; -const jsSurface = Skia.Surface.MakeOffscreen(size, size)!; -const jsCanvas = jsSurface.getCanvas(); -jsCanvas.drawColor(Skia.Color("cyan")); -const jsImage = jsSurface.makeImageSnapshot(); -const nonTexImage = jsImage.makeNonTextureImage(); - -export const Snapshot6 = () => { - const image = useSharedValue(null); - useEffect(() => { - runOnUI(() => { - image.value = jsImage.makeTextureImage(); - if (!image.value) { - throw new Error("Failed to create texture image"); - } - })(); - }, [image]); - return ( - - - - - - - ); -}; diff --git a/fabricexample/src/Tests/Screens/index.ts b/fabricexample/src/Tests/Screens/index.ts index 7e2fc78554..0816422599 100644 --- a/fabricexample/src/Tests/Screens/index.ts +++ b/fabricexample/src/Tests/Screens/index.ts @@ -5,7 +5,6 @@ import { Snapshot2 } from "./Snapshot2"; import { Snapshot3 } from "./Snapshot3"; import { Snapshot4 } from "./Snapshot4"; import { Snapshot5 } from "./Snapshot5"; -import { Snapshot6 } from "./Snapshot6"; export const Screens: Record = { Snapshot1, @@ -13,5 +12,4 @@ export const Screens: Record = { Snapshot3, Snapshot4, Snapshot5, - Snapshot6, }; diff --git a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h index 3d41851212..eecf9dc39f 100644 --- a/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h +++ b/package/android/cpp/rnskia-android/RNSkAndroidPlatformContext.h @@ -123,10 +123,6 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext { #endif } - GrDirectContext *getSkiaContext() override { - return ThreadContextHolder::ThreadSkiaOpenGLContext.directContext.get(); - } - sk_sp createFontMgr() override { return SkFontMgr_New_Android(nullptr); } diff --git a/package/cpp/api/JsiSkImage.h b/package/cpp/api/JsiSkImage.h index 1eb3046281..d12fd846fe 100644 --- a/package/cpp/api/JsiSkImage.h +++ b/package/cpp/api/JsiSkImage.h @@ -21,8 +21,6 @@ #include "include/encode/SkJpegEncoder.h" #include "include/encode/SkPngEncoder.h" #include "include/encode/SkWebpEncoder.h" -#include "include/gpu/GrBackendSurface.h" -#include "include/gpu/ganesh/SkImageGanesh.h" #pragma clang diagnostic pop @@ -188,28 +186,6 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject { runtime, std::make_shared(getContext(), std::move(image))); } - JSI_HOST_FUNCTION(makeTextureImage) { - auto image = getObject(); - // Retrieve the backend texture from the input image - GrBackendTexture backendTexture; - if (!SkImages::GetBackendTextureFromImage(image, &backendTexture, false)) { - return jsi::Value::null(); - } - - // Adopt the backend texture in the target direct context - sk_sp adoptedImage = SkImages::AdoptTextureFrom( - getContext()->getSkiaContext(), backendTexture, - GrSurfaceOrigin::kTopLeft_GrSurfaceOrigin, image->colorType()); - - // Check if the adoption was successful - if (!adoptedImage) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), std::move(adoptedImage))); - } - EXPORT_JSI_API_TYPENAME(JsiSkImage, Image) JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width), @@ -221,7 +197,6 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject { JSI_EXPORT_FUNC(JsiSkImage, encodeToBase64), JSI_EXPORT_FUNC(JsiSkImage, readPixels), JSI_EXPORT_FUNC(JsiSkImage, makeNonTextureImage), - JSI_EXPORT_FUNC(JsiSkImage, makeTextureImage), JSI_EXPORT_FUNC(JsiSkImage, dispose)) JsiSkImage(std::shared_ptr context, diff --git a/package/cpp/rnskia/RNSkPlatformContext.h b/package/cpp/rnskia/RNSkPlatformContext.h index 67e9cc9444..133ac5d801 100644 --- a/package/cpp/rnskia/RNSkPlatformContext.h +++ b/package/cpp/rnskia/RNSkPlatformContext.h @@ -146,8 +146,6 @@ class RNSkPlatformContext { virtual uint64_t makeNativeBuffer(sk_sp image) = 0; - virtual GrRecordingContext *getSkiaContext() = 0; - /** * Return the Platform specific font manager */ diff --git a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h index daff557af4..b3bbc32ed6 100644 --- a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h +++ b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h @@ -65,8 +65,6 @@ class RNSkiOSPlatformContext : public RNSkPlatformContext { void releaseNativeBuffer(uint64_t pointer) override; - GrRecordingContext *getSkiaContext() override; - virtual void performStreamOperation( const std::string &sourceUri, const std::function)> &op) override; diff --git a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm index 78715ca1cc..1c29c4d765 100644 --- a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +++ b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm @@ -152,10 +152,6 @@ return SkiaMetalSurfaceFactory::makeOffscreenSurface(width, height); } -GrRecordingContext *RNSkiOSPlatformContext::getSkiaContext() { - return ThreadContextHolder::ThreadSkiaMetalContext.skContext.get(); -} - sk_sp RNSkiOSPlatformContext::makeImageFromNativeBuffer(void *buffer) { CVPixelBufferRef sampleBuffer = (CVPixelBufferRef)buffer; return SkiaMetalSurfaceFactory::makeTextureFromCVPixelBuffer(sampleBuffer); diff --git a/package/src/__tests__/snapshots/screens/snapshot6-android.png b/package/src/__tests__/snapshots/screens/snapshot6-android.png deleted file mode 100644 index f0b1f5ed76..0000000000 Binary files a/package/src/__tests__/snapshots/screens/snapshot6-android.png and /dev/null differ diff --git a/package/src/__tests__/snapshots/screens/snapshot6-ios.png b/package/src/__tests__/snapshots/screens/snapshot6-ios.png deleted file mode 100644 index 06083ba714..0000000000 Binary files a/package/src/__tests__/snapshots/screens/snapshot6-ios.png and /dev/null differ diff --git a/package/src/renderer/__tests__/e2e/Snapshot.spec.tsx b/package/src/renderer/__tests__/e2e/Snapshot.spec.tsx index 9d5cca2242..9dc4ca962c 100644 --- a/package/src/renderer/__tests__/e2e/Snapshot.spec.tsx +++ b/package/src/renderer/__tests__/e2e/Snapshot.spec.tsx @@ -26,7 +26,4 @@ describe("Snapshot", () => { // itRunsE2eOnly("should respect ScrollView offset and padding", async () => { // await testSnapshot("Snapshot5"); // }); - itRunsE2eOnly("test makeImageTexture()", async () => { - await testSnapshot("Snapshot6"); - }); }); diff --git a/package/src/skia/types/Image/Image.ts b/package/src/skia/types/Image/Image.ts index 77363457a9..2179999cb0 100644 --- a/package/src/skia/types/Image/Image.ts +++ b/package/src/skia/types/Image/Image.ts @@ -130,10 +130,4 @@ export interface SkImage extends SkJSIInstance<"Image"> { * bitmap, or if encoded in a stream. */ makeNonTextureImage(): SkImage; - - /* - * Transfer the texture its original Skia context to the current Skia context - * Each thread has its own Skia context - */ - makeTextureImage(): SkImage; } diff --git a/package/src/skia/web/JsiSkImage.ts b/package/src/skia/web/JsiSkImage.ts index 18bdb36124..650c719914 100644 --- a/package/src/skia/web/JsiSkImage.ts +++ b/package/src/skia/web/JsiSkImage.ts @@ -152,10 +152,6 @@ export class JsiSkImage extends HostObject implements SkImage { this.ref.delete(); }; - makeTextureImage(): SkImage { - throw new Error("makeTextureImage() is not implemented on Web"); - } - makeNonTextureImage(): SkImage { // if the image is already a non-texture image, this is a no-op const partialInfo = this.ref.getImageInfo();