-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Draw onto a Skia Canvas in a Frame Processor #1345
Conversation
example/src/CameraPage.tsx
Outdated
@@ -26,6 +26,7 @@ import { examplePlugin } from './frame-processors/ExamplePlugin'; | |||
import type { Routes } from './Routes'; | |||
import type { NativeStackScreenProps } from '@react-navigation/native-stack'; | |||
import { useIsFocused } from '@react-navigation/core'; | |||
import { SkCanvas, useDrawCallback } from '@shopify/react-native-skia'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <1371> reported by reviewdog 🐶
This import is never used as a value and must use 'import type' because 'importsNotUsedAsValues' is set to 'error'.
example/src/CameraPage.tsx
Outdated
@@ -26,6 +26,7 @@ | |||
import type { Routes } from './Routes'; | |||
import type { NativeStackScreenProps } from '@react-navigation/native-stack'; | |||
import { useIsFocused } from '@react-navigation/core'; | |||
import { SkCanvas, useDrawCallback } from '@shopify/react-native-skia'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <6133> reported by reviewdog 🐶
'useDrawCallback' is declared but its value is never read.
example/src/CameraPage.tsx
Outdated
@@ -197,10 +198,10 @@ | |||
console.log('re-rendering camera page without active camera'); | |||
} | |||
|
|||
const frameProcessor = useFrameProcessor((frame) => { | |||
const frameProcessor = useFrameProcessor((frame, canvas: SkCanvas) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <2345> reported by reviewdog 🐶
Argument of type '(frame: any, canvas: SkCanvas) => void' is not assignable to parameter of type 'FrameProcessor'.
example/src/CameraPage.tsx
Outdated
@@ -197,10 +198,10 @@ | |||
console.log('re-rendering camera page without active camera'); | |||
} | |||
|
|||
const frameProcessor = useFrameProcessor((frame) => { | |||
const frameProcessor = useFrameProcessor((frame, canvas: SkCanvas) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <7006> reported by reviewdog 🐶
Parameter 'frame' implicitly has an 'any' type.
example/src/CameraPage.tsx
Outdated
@@ -197,10 +198,10 @@ | |||
console.log('re-rendering camera page without active camera'); | |||
} | |||
|
|||
const frameProcessor = useFrameProcessor((frame) => { | |||
const frameProcessor = useFrameProcessor((frame, canvas: SkCanvas) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <6133> reported by reviewdog 🐶
'canvas' is declared but its value is never read.
|
example/src/CameraPage.tsx
Outdated
@@ -26,6 +26,7 @@ import { examplePlugin } from './frame-processors/ExamplePlugin'; | |||
import type { Routes } from './Routes'; | |||
import type { NativeStackScreenProps } from '@react-navigation/native-stack'; | |||
import { useIsFocused } from '@react-navigation/core'; | |||
import { SkCanvas, useDrawCallback } from '@shopify/react-native-skia'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <6192> reported by reviewdog 🐶
All imports in import declaration are unused.
example/src/CameraPage.tsx
Outdated
@@ -26,6 +26,7 @@ import { examplePlugin } from './frame-processors/ExamplePlugin'; | |||
import type { Routes } from './Routes'; | |||
import type { NativeStackScreenProps } from '@react-navigation/native-stack'; | |||
import { useIsFocused } from '@react-navigation/core'; | |||
import { PaintStyle, SkCanvas, useDrawCallback } from '@shopify/react-native-skia'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <6192> reported by reviewdog 🐶
All imports in import declaration are unused.
example/src/CameraPage.tsx
Outdated
const shaderToUse = useSharedValue(noShader); | ||
|
||
const frameProcessor = useFrameProcessor( | ||
(frame) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[tsc] <6133> reported by reviewdog 🐶
'frame' is declared but its value is never read.
* feat: Draw into offscren texture * Clear with black * Create all the weird Metal shit (still doesn't work) * Try to load `PassThrough.metallib` as bundle / library * Revert "Try to load `PassThrough.metallib` as bundle / library" This reverts commit 4c05f66. * Revert "Create all the weird Metal shit" This reverts commit a272ec9. * Revert "Clear with black" This reverts commit e35844e. * pod install * feat: Use Skia to draw off-screen Texture onto CAMetalLayer * Draw Debug FPS on screen * Fix MTLTextureUsageRenderTarget * Clean up/Refactor a bit * Set `_hasNewFrame` to false * Lock before checking _hasNewFrame * Remove `_hasNewFrame` * Create `SkContext` eagerly * flush -> flushAndSubmit * Put `SkSurface::MakeFromCAMetalLayer` under lock as well * Render `RCTFPSGraph` to show FPS * Update label on main queue * Render FPS Graph in CameraView * Update CameraView.swift * Update SkiaMetalCanvasProvider.h * Don't redraw if no new frame is available * Create separate Skia Contexts for the two Threads
This reverts commit 749612c.
"Write-back Frame Processors" aka "Skia Frame Processors" aka "Draw onto Frame" (#1376)