diff --git a/package/cpp/api/JsiSkImageFactory.h b/package/cpp/api/JsiSkImageFactory.h index fe0290fbf6..14e0da7dbe 100644 --- a/package/cpp/api/JsiSkImageFactory.h +++ b/package/cpp/api/JsiSkImageFactory.h @@ -29,11 +29,11 @@ class JsiSkImageFactory : public JsiSkHostObject { JSI_HOST_FUNCTION(MakeImageFromNativeBuffer) { jsi::BigInt pointer = arguments[0].asBigInt(runtime); - const uintptr_t platformBufferPointer = pointer.asUint64(runtime); - void *rawPointer = reinterpret_cast(platformBufferPointer); + const uintptr_t nativeBufferPointer = pointer.asUint64(runtime); + void *rawPointer = reinterpret_cast(nativeBufferPointer); auto image = getContext()->makeImageFromNativeBuffer(rawPointer); if (image == nullptr) { - throw std::runtime_error("Failed to convert PlatformBuffer to SkImage!"); + throw std::runtime_error("Failed to convert NativeBuffer to SkImage!"); } return jsi::Object::createFromHostObject( runtime, std::make_shared(getContext(), std::move(image))); diff --git a/package/cpp/rnskia/RNSkPlatformContext.h b/package/cpp/rnskia/RNSkPlatformContext.h index a39b4aaa0e..133ac5d801 100644 --- a/package/cpp/rnskia/RNSkPlatformContext.h +++ b/package/cpp/rnskia/RNSkPlatformContext.h @@ -137,7 +137,7 @@ class RNSkPlatformContext { * Creates an image from a native buffer. * - On iOS, this is a `CVPixelBufferRef` * - On Android, this is a `AHardwareBuffer*` - * @param buffer The native platform buffer. + * @param buffer The native buffer. * @return sk_sp */ virtual sk_sp makeImageFromNativeBuffer(void *buffer) = 0; diff --git a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm index e9de2f349e..1c29c4d765 100644 --- a/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +++ b/package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm @@ -75,7 +75,7 @@ if (image == nullptr) { throw std::runtime_error( "Failed to convert image to BGRA_8888 colortype! Only BGRA_8888 " - "PlatformBuffers are supported."); + "NativeBuffers are supported."); } } diff --git a/package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm b/package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm index 5a752bc862..dc8bd26c24 100644 --- a/package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +++ b/package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm @@ -130,8 +130,8 @@ } default: [[unlikely]] { - throw std::runtime_error("Failed to convert PlatformBuffer to SkImage - " - "PlatformBuffer has unsupported PixelFormat! " + + throw std::runtime_error("Failed to convert NativeBuffer to SkImage - " + "NativeBuffer has unsupported PixelFormat! " + std::to_string(static_cast(format))); } } diff --git a/package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx b/package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx index 977335a12d..9f10d97152 100644 --- a/package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx +++ b/package/src/renderer/__tests__/e2e/NativeBuffer.spec.tsx @@ -9,7 +9,7 @@ const shouldNativeBufferTestRun = () => { if (surface.OS !== "ios" && surface.OS !== "android") { return false; } - // Skip test on Fabric (it runs on API Level 21 which doesn't support platform buffers) + // Skip test on Fabric (it runs on API Level 21 which doesn't support native buffers) if (surface.arch === "fabric" && surface.OS === "android") { return false; } @@ -42,7 +42,7 @@ for (let j = 0; j < rgbaPixels.length; j += 4) { } describe("Native Buffers", () => { - it("On non supported platforms MakeImageFromPlatformBuffer() should throw", async () => { + it("On non supported platforms MakeImageFromNativeBuffer() should throw", async () => { const { Skia: Sk } = setupSkia(); if (!shouldNativeBufferTestRun()) { return; diff --git a/package/src/skia/types/Image/ImageFactory.ts b/package/src/skia/types/Image/ImageFactory.ts index 2e6fe1643b..d8dc0b82d0 100644 --- a/package/src/skia/types/Image/ImageFactory.ts +++ b/package/src/skia/types/Image/ImageFactory.ts @@ -54,7 +54,7 @@ export interface ImageFactory { /** * Return an Image backed by a given native buffer. - * The platform buffer must be a valid owning reference. + * The native buffer must be a valid owning reference. * * For instance, this API is used by * [react-native-vision-camera](https://github.com/mrousavy/react-native-vision-camera) @@ -62,9 +62,9 @@ export interface ImageFactory { * * - On Android; This is an `AHardwareBuffer*` * - On iOS, this is a `CVPixelBufferRef` - * @param nativeBuffer A strong `uintptr_t` pointer to the native platform buffer + * @param nativeBuffer A strong `uintptr_t` pointer to the native buffer * @throws Throws an error if the Image could not be created, for example when the given - * platform buffer is invalid. + * native buffer is invalid. */ MakeImageFromNativeBuffer: (nativeBuffer: NativeBuffer) => SkImage; diff --git a/package/src/skia/types/NativeBuffer/NativeBufferFactory.ts b/package/src/skia/types/NativeBuffer/NativeBufferFactory.ts index bca4714c2a..acd9e83448 100644 --- a/package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +++ b/package/src/skia/types/NativeBuffer/NativeBufferFactory.ts @@ -32,7 +32,7 @@ export interface NativeBufferFactory { */ MakeFromImage: (image: SkImage) => NativeBuffer; /** - * Release a platform buffer that was created with `MakeFromImage`. + * Release a native buffer that was created with `MakeFromImage`. */ - Release: (platformBuffer: NativeBuffer) => void; + Release: (nativeBuffer: NativeBuffer) => void; } diff --git a/package/src/skia/web/JsiSkNativeBufferFactory.ts b/package/src/skia/web/JsiSkNativeBufferFactory.ts index 0cbc816a23..6d8633ca87 100644 --- a/package/src/skia/web/JsiSkNativeBufferFactory.ts +++ b/package/src/skia/web/JsiSkNativeBufferFactory.ts @@ -29,7 +29,7 @@ export class JsiSkNativeBufferFactory return canvas; } - Release(_platformBuffer: NativeBuffer) { + Release(_nativeBuffer: NativeBuffer) { // it's a noop on Web } }