Skip to content

Commit

Permalink
Revert "feat(🌠): Image.makeImageTexture() (#2417)" (#2422)
Browse files Browse the repository at this point in the history
This reverts commit e254d82.
  • Loading branch information
wcandillon committed May 10, 2024
1 parent e254d82 commit bc8da74
Show file tree
Hide file tree
Showing 14 changed files with 0 additions and 146 deletions.
46 changes: 0 additions & 46 deletions example/src/Tests/Screens/Snapshot6.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions example/src/Tests/Screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import { Snapshot2 } from "./Snapshot2";
import { Snapshot3 } from "./Snapshot3";
import { Snapshot4 } from "./Snapshot4";
import { Snapshot5 } from "./Snapshot5";
import { Snapshot6 } from "./Snapshot6";

export const Screens: Record<string, FC> = {
Snapshot1,
Snapshot2,
Snapshot3,
Snapshot4,
Snapshot5,
Snapshot6,
};
46 changes: 0 additions & 46 deletions fabricexample/src/Tests/Screens/Snapshot6.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions fabricexample/src/Tests/Screens/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ import { Snapshot2 } from "./Snapshot2";
import { Snapshot3 } from "./Snapshot3";
import { Snapshot4 } from "./Snapshot4";
import { Snapshot5 } from "./Snapshot5";
import { Snapshot6 } from "./Snapshot6";

export const Screens: Record<string, FC> = {
Snapshot1,
Snapshot2,
Snapshot3,
Snapshot4,
Snapshot5,
Snapshot6,
};
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,6 @@ class RNSkAndroidPlatformContext : public RNSkPlatformContext {
#endif
}

GrDirectContext *getSkiaContext() override {
return ThreadContextHolder::ThreadSkiaOpenGLContext.directContext.get();
}

sk_sp<SkFontMgr> createFontMgr() override {
return SkFontMgr_New_Android(nullptr);
}
Expand Down
25 changes: 0 additions & 25 deletions package/cpp/api/JsiSkImage.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -188,28 +186,6 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject<SkImage> {
runtime, std::make_shared<JsiSkImage>(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<SkImage> 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<JsiSkImage>(getContext(), std::move(adoptedImage)));
}

EXPORT_JSI_API_TYPENAME(JsiSkImage, Image)

JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width),
Expand All @@ -221,7 +197,6 @@ class JsiSkImage : public JsiSkWrappingSkPtrHostObject<SkImage> {
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<RNSkPlatformContext> context,
Expand Down
2 changes: 0 additions & 2 deletions package/cpp/rnskia/RNSkPlatformContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,8 +146,6 @@ class RNSkPlatformContext {

virtual uint64_t makeNativeBuffer(sk_sp<SkImage> image) = 0;

virtual GrRecordingContext *getSkiaContext() = 0;

/**
* Return the Platform specific font manager
*/
Expand Down
2 changes: 0 additions & 2 deletions package/ios/RNSkia-iOS/RNSkiOSPlatformContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<void(std::unique_ptr<SkStreamAsset>)> &op) override;
Expand Down
4 changes: 0 additions & 4 deletions package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@
return SkiaMetalSurfaceFactory::makeOffscreenSurface(width, height);
}

GrRecordingContext *RNSkiOSPlatformContext::getSkiaContext() {
return ThreadContextHolder::ThreadSkiaMetalContext.skContext.get();
}

sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeBuffer(void *buffer) {
CVPixelBufferRef sampleBuffer = (CVPixelBufferRef)buffer;
return SkiaMetalSurfaceFactory::makeTextureFromCVPixelBuffer(sampleBuffer);
Expand Down
Binary file not shown.
Binary file not shown.
3 changes: 0 additions & 3 deletions package/src/renderer/__tests__/e2e/Snapshot.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,4 @@ describe("Snapshot", () => {
// itRunsE2eOnly("should respect ScrollView offset and padding", async () => {
// await testSnapshot("Snapshot5");
// });
itRunsE2eOnly("test makeImageTexture()", async () => {
await testSnapshot("Snapshot6");
});
});
6 changes: 0 additions & 6 deletions package/src/skia/types/Image/Image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
4 changes: 0 additions & 4 deletions package/src/skia/web/JsiSkImage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,10 +152,6 @@ export class JsiSkImage extends HostObject<Image, "Image"> 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();
Expand Down

0 comments on commit bc8da74

Please sign in to comment.