@shopify/react-native-skia 2.0.0-next.1 → 2.0.0-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +11 -1
- package/android/cpp/jni/JniPlatformContext.cpp +1 -0
- package/{ios/RNSkia-iOS → apple}/MetalContext.h +0 -5
- package/{ios/RNSkia-iOS → apple}/MetalWindowContext.mm +4 -0
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.h → apple/RNSkApplePlatformContext.h} +7 -3
- package/{ios/RNSkia-iOS/RNSkiOSPlatformContext.mm → apple/RNSkApplePlatformContext.mm} +19 -19
- package/{ios/RNSkia-iOS/RNSkiOSVideo.h → apple/RNSkAppleVideo.h} +3 -3
- package/{ios/RNSkia-iOS/RNSkiOSVideo.mm → apple/RNSkAppleVideo.mm} +14 -14
- package/{ios/RNSkia-iOS/RNSkiOSView.h → apple/RNSkAppleView.h} +4 -4
- package/{ios/RNSkia-iOS/RNSkiOSView.mm → apple/RNSkAppleView.mm} +4 -4
- package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.mm +6 -1
- package/{ios/RNSkia-iOS → apple}/SkiaManager.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureView.mm +2 -2
- package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.mm +6 -2
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.h +12 -4
- package/{ios/RNSkia-iOS → apple}/SkiaUIView.mm +11 -7
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.h +4 -0
- package/{ios/RNSkia-iOS → apple}/ViewScreenshotService.mm +4 -0
- package/cpp/api/JsiSkContourMeasure.h +1 -1
- package/cpp/api/JsiSkHostObjects.h +21 -10
- package/cpp/api/JsiSkParagraph.h +17 -27
- package/cpp/api/JsiSkPathEffect.h +1 -1
- package/cpp/api/JsiSkPictureFactory.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +43 -8
- package/cpp/api/JsiSkVertices.h +14 -3
- package/cpp/api/recorder/Drawings.h +4 -3
- package/cpp/rnskia/DawnContext.h +1 -1
- package/cpp/skia/include/codec/SkCodec.h +7 -2
- package/cpp/skia/include/config/SkUserConfig.h +11 -0
- package/cpp/skia/include/core/SkCanvas.h +11 -7
- package/cpp/skia/include/core/SkColor.h +10 -0
- package/cpp/skia/include/core/SkColorSpace.h +184 -2
- package/cpp/skia/include/core/SkColorType.h +114 -32
- package/cpp/skia/include/core/SkFontScanner.h +5 -8
- package/cpp/skia/include/core/SkFontStyle.h +1 -1
- package/cpp/skia/include/core/SkMaskFilter.h +0 -8
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPath.h +1 -1
- package/cpp/skia/include/core/SkRRect.h +3 -1
- package/cpp/skia/include/core/SkShader.h +3 -3
- package/cpp/skia/include/core/SkString.h +8 -8
- package/cpp/skia/include/core/SkSurface.h +14 -0
- package/cpp/skia/include/core/SkTypeface.h +24 -7
- package/cpp/skia/include/effects/SkGradientShader.h +6 -1
- package/cpp/skia/include/effects/SkRuntimeEffect.h +1 -0
- package/cpp/skia/include/encode/SkPngEncoder.h +14 -0
- package/cpp/skia/include/gpu/GpuTypes.h +9 -0
- package/cpp/skia/include/gpu/ganesh/GrContextOptions.h +135 -133
- package/cpp/skia/include/gpu/ganesh/GrDirectContext.h +5 -0
- package/cpp/skia/include/gpu/ganesh/GrDriverBugWorkarounds.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTypes.h +14 -9
- package/cpp/skia/include/gpu/graphite/Context.h +25 -2
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +23 -5
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +20 -1
- package/cpp/skia/include/gpu/graphite/Image.h +1 -0
- package/cpp/skia/include/gpu/graphite/LogPriority.h +36 -0
- package/cpp/skia/include/gpu/graphite/PrecompileContext.h +52 -0
- package/cpp/skia/include/gpu/graphite/Recorder.h +6 -0
- package/cpp/skia/include/gpu/graphite/Recording.h +3 -1
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypes.h +4 -36
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteTypesUtils.h +48 -0
- package/cpp/skia/include/gpu/graphite/precompile/Precompile.h +3 -2
- package/cpp/skia/include/pathops/SkPathOps.h +9 -1
- package/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +3 -0
- package/cpp/skia/include/private/SkPathRef.h +15 -21
- package/cpp/skia/include/private/base/SkAttributes.h +16 -10
- package/cpp/skia/include/private/base/SkMutex.h +8 -0
- package/cpp/skia/include/private/base/SkTArray.h +1 -1
- package/cpp/skia/include/private/base/SkTDArray.h +1 -1
- package/cpp/skia/include/private/base/SkTemplates.h +24 -11
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/sksl/SkSLDebugTrace.h +0 -3
- package/cpp/skia/modules/skcms/src/Transform_inl.h +20 -20
- package/cpp/skia/modules/skcms/src/skcms_Transform.h +4 -3
- package/cpp/skia/modules/skcms/src/skcms_public.h +19 -15
- package/cpp/skia/modules/skresources/include/SkResources.h +3 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +2 -0
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -0
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +4 -0
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/src/core/SkLRUCache.h +19 -13
- package/cpp/skia/src/core/SkTHash.h +50 -4
- package/cpp/skia/src/gpu/ganesh/gl/GrGLDefines.h +1 -0
- package/lib/commonjs/__tests__/setup.d.ts +18 -0
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/headless/index.d.ts +1 -0
- package/lib/commonjs/headless/index.js +12 -0
- package/lib/commonjs/headless/index.js.map +1 -1
- package/lib/commonjs/mock/index.js +1 -2
- package/lib/commonjs/mock/index.js.map +1 -1
- package/lib/commonjs/renderer/Canvas.js +3 -1
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/web/Host.d.ts +4 -6
- package/lib/commonjs/skia/web/Host.js +23 -10
- package/lib/commonjs/skia/web/Host.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkCanvas.js +15 -15
- package/lib/commonjs/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFont.js +3 -3
- package/lib/commonjs/skia/web/JsiSkFont.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js +1 -1
- package/lib/commonjs/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImage.js +6 -6
- package/lib/commonjs/skia/web/JsiSkImage.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js +9 -9
- package/lib/commonjs/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPaint.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPath.js +4 -4
- package/lib/commonjs/skia/web/JsiSkPath.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js +3 -3
- package/lib/commonjs/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/commonjs/skia/web/JsiSkPathFactory.js +2 -2
- package/lib/commonjs/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js +1 -1
- package/lib/commonjs/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/commonjs/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js +1 -1
- package/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/commonjs/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/commonjs/skia/web/JsiSkia.js +4 -3
- package/lib/commonjs/skia/web/JsiSkia.js.map +1 -1
- package/lib/commonjs/skia/web/JsiVideo.js +2 -1
- package/lib/commonjs/skia/web/JsiVideo.js.map +1 -1
- package/lib/commonjs/sksg/HostConfig.js +3 -1
- package/lib/commonjs/sksg/HostConfig.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Core.d.ts +1 -5
- package/lib/commonjs/sksg/Recorder/Core.js +12 -4
- package/lib/commonjs/sksg/Recorder/Core.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/Player.js +4 -5
- package/lib/commonjs/sksg/Recorder/Player.js.map +1 -1
- package/lib/commonjs/sksg/Recorder/commands/Box.js +2 -4
- package/lib/commonjs/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/commonjs/specs/NativeSkiaModule.web.js +10 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/__tests__/setup.d.ts +18 -0
- package/lib/module/external/reanimated/useAnimatedImageValue.js +4 -3
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/headless/index.d.ts +1 -0
- package/lib/module/headless/index.js +1 -0
- package/lib/module/headless/index.js.map +1 -1
- package/lib/module/mock/index.js +1 -2
- package/lib/module/mock/index.js.map +1 -1
- package/lib/module/renderer/Canvas.js +3 -1
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/web/Host.d.ts +4 -6
- package/lib/module/skia/web/Host.js +21 -8
- package/lib/module/skia/web/Host.js.map +1 -1
- package/lib/module/skia/web/JsiSkCanvas.js +15 -15
- package/lib/module/skia/web/JsiSkCanvas.js.map +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkColorFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkFont.js +4 -4
- package/lib/module/skia/web/JsiSkFont.js.map +1 -1
- package/lib/module/skia/web/JsiSkFontMgr.js +2 -2
- package/lib/module/skia/web/JsiSkFontMgr.js.map +1 -1
- package/lib/module/skia/web/JsiSkImage.js +6 -6
- package/lib/module/skia/web/JsiSkImage.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFactory.js +4 -4
- package/lib/module/skia/web/JsiSkImageFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkImageFilterFactory.js +10 -10
- package/lib/module/skia/web/JsiSkImageFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js +1 -1
- package/lib/module/skia/web/JsiSkMaskFilterFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPaint.js +3 -3
- package/lib/module/skia/web/JsiSkPaint.js.map +1 -1
- package/lib/module/skia/web/JsiSkPath.js +4 -4
- package/lib/module/skia/web/JsiSkPath.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathEffectFactory.js +4 -4
- package/lib/module/skia/web/JsiSkPathEffectFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/module/skia/web/JsiSkPathFactory.js +3 -3
- package/lib/module/skia/web/JsiSkPathFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkPicture.js +1 -1
- package/lib/module/skia/web/JsiSkPicture.js.map +1 -1
- package/lib/module/skia/web/JsiSkShaderFactory.js +5 -5
- package/lib/module/skia/web/JsiSkShaderFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js +2 -2
- package/lib/module/skia/web/JsiSkTypefaceFontProvider.js.map +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js +1 -1
- package/lib/module/skia/web/JsiSkVerticesFactory.js.map +1 -1
- package/lib/module/skia/web/JsiSkia.js +4 -3
- package/lib/module/skia/web/JsiSkia.js.map +1 -1
- package/lib/module/skia/web/JsiVideo.js +2 -1
- package/lib/module/skia/web/JsiVideo.js.map +1 -1
- package/lib/module/sksg/HostConfig.js +3 -1
- package/lib/module/sksg/HostConfig.js.map +1 -1
- package/lib/module/sksg/Recorder/Core.d.ts +1 -5
- package/lib/module/sksg/Recorder/Core.js +10 -2
- package/lib/module/sksg/Recorder/Core.js.map +1 -1
- package/lib/module/sksg/Recorder/Player.js +5 -6
- package/lib/module/sksg/Recorder/Player.js.map +1 -1
- package/lib/module/sksg/Recorder/commands/Box.js +3 -5
- package/lib/module/sksg/Recorder/commands/Box.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +2 -0
- package/lib/module/specs/NativeSkiaModule.web.js +10 -1
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/lib/commonjs/mock/index.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/index.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/commonjs/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/commonjs/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/commonjs/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/commonjs/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/lib/module/headless/index.d.ts +1 -0
- package/lib/typescript/lib/module/mock/index.d.ts +5 -5
- package/lib/typescript/lib/module/skia/Skia.d.ts +1 -1
- package/lib/typescript/lib/module/skia/Skia.web.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/Host.d.ts +3 -5
- package/lib/typescript/lib/module/skia/web/JsiSkFont.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkFontMgr.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkImageFilterFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkPathEffectFactory.d.ts +2 -2
- package/lib/typescript/lib/module/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkTypefaceFontProvider.d.ts +1 -1
- package/lib/typescript/lib/module/skia/web/JsiSkia.d.ts +3 -3
- package/lib/typescript/lib/module/skia/web/JsiVideo.d.ts +1 -1
- package/lib/typescript/lib/module/sksg/Recorder/Core.d.ts +1 -1
- package/lib/typescript/src/__tests__/setup.d.ts +18 -0
- package/lib/typescript/src/headless/index.d.ts +1 -0
- package/lib/typescript/src/skia/web/Host.d.ts +4 -6
- package/lib/typescript/src/skia/web/JsiSkPathFactory.d.ts +1 -1
- package/lib/typescript/src/sksg/Recorder/Core.d.ts +1 -5
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +2 -0
- package/package.json +6 -5
- package/react-native-skia.podspec +3 -3
- package/src/__tests__/setup.ts +67 -1
- package/src/external/reanimated/useAnimatedImageValue.ts +4 -3
- package/src/headless/index.ts +2 -1
- package/src/mock/index.ts +1 -2
- package/src/renderer/Canvas.tsx +2 -1
- package/src/renderer/__tests__/e2e/Matrix4.spec.tsx +1 -2
- package/src/renderer/__tests__/e2e/Paths.spec.tsx +13 -11
- package/src/skia/__tests__/Enums.spec.ts +24 -2
- package/src/skia/__tests__/Path.spec.ts +2 -2
- package/src/skia/web/Host.ts +29 -11
- package/src/skia/web/JsiSkCanvas.ts +17 -17
- package/src/skia/web/JsiSkColorFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkFont.ts +5 -5
- package/src/skia/web/JsiSkFontMgr.ts +3 -3
- package/src/skia/web/JsiSkImage.ts +14 -10
- package/src/skia/web/JsiSkImageFactory.ts +5 -5
- package/src/skia/web/JsiSkImageFilterFactory.ts +12 -22
- package/src/skia/web/JsiSkMaskFilterFactory.ts +1 -1
- package/src/skia/web/JsiSkPaint.ts +3 -3
- package/src/skia/web/JsiSkPath.ts +4 -4
- package/src/skia/web/JsiSkPathEffectFactory.ts +6 -6
- package/src/skia/web/JsiSkPathFactory.ts +4 -9
- package/src/skia/web/JsiSkPicture.ts +3 -3
- package/src/skia/web/JsiSkShaderFactory.ts +5 -5
- package/src/skia/web/JsiSkTypefaceFontProvider.ts +3 -3
- package/src/skia/web/JsiSkVerticesFactory.ts +1 -1
- package/src/skia/web/JsiSkia.ts +7 -4
- package/src/skia/web/JsiVideo.ts +2 -1
- package/src/sksg/HostConfig.ts +1 -1
- package/src/sksg/Recorder/Core.ts +5 -7
- package/src/sksg/Recorder/Player.ts +5 -6
- package/src/sksg/Recorder/commands/Box.ts +3 -5
- package/src/specs/NativeSkiaModule.web.ts +12 -2
- package/ios/Rnskia.xcodeproj/project.pbxproj +0 -281
- package/ios/Rnskia.xcworkspace/contents.xcworkspacedata +0 -7
- package/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/commonjs/skia/types/Image/ColorType.web.js +0 -43
- package/lib/commonjs/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/module/skia/types/Image/ColorType.web.d.ts +0 -19
- package/lib/module/skia/types/Image/ColorType.web.js +0 -37
- package/lib/module/skia/types/Image/ColorType.web.js.map +0 -1
- package/lib/typescript/lib/commonjs/skia/types/Image/ColorType.web.d.ts +0 -2
- package/lib/typescript/lib/module/skia/types/Image/ColorType.web.d.ts +0 -1
- package/lib/typescript/src/skia/types/Image/ColorType.web.d.ts +0 -19
- package/src/skia/types/Image/ColorType.web.ts +0 -19
- /package/{ios/RNSkia-iOS → apple}/MetalContext.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/MetalWindowContext.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/RNSkMetalCanvasProvider.h +0 -0
- /package/{ios → apple}/RNSkiaModule.h +0 -0
- /package/{ios → apple}/RNSkiaModule.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaCVPixelBufferUtils.mm +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaManager.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureView.h +0 -0
- /package/{ios/RNSkia-iOS → apple}/SkiaPictureViewManager.h +0 -0
package/android/build.gradle
CHANGED
@@ -19,7 +19,7 @@ import java.nio.file.Paths
|
|
19
19
|
// the minimum React Native version supported.
|
20
20
|
def DEFAULT_COMPILE_SDK_VERSION = 28
|
21
21
|
def DEFAULT_BUILD_TOOLS_VERSION = '28.0.3'
|
22
|
-
def DEFAULT_MIN_SDK_VERSION =
|
22
|
+
def DEFAULT_MIN_SDK_VERSION = 21
|
23
23
|
def DEFAULT_TARGET_SDK_VERSION = 28
|
24
24
|
|
25
25
|
def safeExtGet(prop, fallback) {
|
@@ -132,6 +132,16 @@ android {
|
|
132
132
|
|
133
133
|
compileSdkVersion safeExtGet('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
134
134
|
buildToolsVersion safeExtGet('buildToolsVersion', DEFAULT_BUILD_TOOLS_VERSION)
|
135
|
+
|
136
|
+
// Used to override the NDK path/version on internal CI or by allowing
|
137
|
+
// users to customize the NDK path/version from their root project.
|
138
|
+
if (rootProject.hasProperty("ndkPath")) {
|
139
|
+
ndkPath rootProject.ext.ndkPath
|
140
|
+
}
|
141
|
+
if (rootProject.hasProperty("ndkVersion")) {
|
142
|
+
ndkVersion rootProject.ext.ndkVersion
|
143
|
+
}
|
144
|
+
|
135
145
|
defaultConfig {
|
136
146
|
minSdkVersion safeExtGet('minSdkVersion', DEFAULT_MIN_SDK_VERSION)
|
137
147
|
targetSdkVersion safeExtGet('targetSdkVersion', DEFAULT_TARGET_SDK_VERSION)
|
@@ -14,10 +14,6 @@
|
|
14
14
|
#import <include/gpu/ganesh/mtl/GrMtlDirectContext.h>
|
15
15
|
#import <include/gpu/ganesh/mtl/SkSurfaceMetal.h>
|
16
16
|
|
17
|
-
// namespace RNSkia {
|
18
|
-
// class RNSkiOSPlatformContext;
|
19
|
-
// }
|
20
|
-
|
21
17
|
class MetalSharedContext {
|
22
18
|
public:
|
23
19
|
static MetalSharedContext &getInstance() {
|
@@ -126,7 +122,6 @@ public:
|
|
126
122
|
GrDirectContext *getDirectContext() { return _directContext.get(); }
|
127
123
|
|
128
124
|
private:
|
129
|
-
// friend class RNSkia::RNSkiOSPlatformContext;
|
130
125
|
id<MTLCommandQueue> _commandQueue = nullptr;
|
131
126
|
sk_sp<GrDirectContext> _directContext = nullptr;
|
132
127
|
|
@@ -15,7 +15,11 @@ MetalWindowContext::MetalWindowContext(GrDirectContext *directContext,
|
|
15
15
|
_layer.framebufferOnly = NO;
|
16
16
|
_layer.device = device;
|
17
17
|
_layer.opaque = false;
|
18
|
+
#if !TARGET_OS_OSX
|
18
19
|
_layer.contentsScale = [UIScreen mainScreen].scale;
|
20
|
+
#else
|
21
|
+
_layer.contentsScale = [NSScreen mainScreen].backingScaleFactor;
|
22
|
+
#endif // !TARGET_OS_OSX
|
19
23
|
_layer.pixelFormat = MTLPixelFormatBGRA8Unorm;
|
20
24
|
_layer.contentsGravity = kCAGravityBottomLeft;
|
21
25
|
_layer.drawableSize = CGSizeMake(width, height);
|
@@ -18,19 +18,23 @@ class CallInvoker;
|
|
18
18
|
|
19
19
|
namespace RNSkia {
|
20
20
|
|
21
|
-
class
|
21
|
+
class RNSkApplePlatformContext : public RNSkPlatformContext {
|
22
22
|
public:
|
23
|
-
|
23
|
+
RNSkApplePlatformContext(
|
24
24
|
RCTBridge *bridge,
|
25
25
|
std::shared_ptr<facebook::react::CallInvoker> jsCallInvoker)
|
26
|
+
#if !TARGET_OS_OSX
|
26
27
|
: RNSkPlatformContext(jsCallInvoker, [[UIScreen mainScreen] scale]) {
|
28
|
+
#else
|
29
|
+
: RNSkPlatformContext(jsCallInvoker, [[NSScreen mainScreen] backingScaleFactor]) {
|
30
|
+
#endif // !TARGET_OS_OSX
|
27
31
|
|
28
32
|
// Create screenshot manager
|
29
33
|
_screenshotService =
|
30
34
|
[[ViewScreenshotService alloc] initWithUiManager:bridge.uiManager];
|
31
35
|
}
|
32
36
|
|
33
|
-
~
|
37
|
+
~RNSkApplePlatformContext() = default;
|
34
38
|
|
35
39
|
void runOnMainThread(std::function<void()>) override;
|
36
40
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
#import "
|
1
|
+
#import "RNSkApplePlatformContext.h"
|
2
2
|
|
3
3
|
#import <CoreMedia/CMSampleBuffer.h>
|
4
4
|
#include <Metal/Metal.h>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
#else
|
12
12
|
#include "MetalContext.h"
|
13
13
|
#endif
|
14
|
-
#include "
|
14
|
+
#include "RNSkAppleVideo.h"
|
15
15
|
|
16
16
|
#pragma clang diagnostic push
|
17
17
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
@@ -26,7 +26,7 @@
|
|
26
26
|
|
27
27
|
namespace RNSkia {
|
28
28
|
|
29
|
-
void
|
29
|
+
void RNSkApplePlatformContext::performStreamOperation(
|
30
30
|
const std::string &sourceUri,
|
31
31
|
const std::function<void(std::unique_ptr<SkStreamAsset>)> &op) {
|
32
32
|
|
@@ -64,14 +64,14 @@ void RNSkiOSPlatformContext::performStreamOperation(
|
|
64
64
|
std::thread(loader).detach();
|
65
65
|
}
|
66
66
|
|
67
|
-
void
|
67
|
+
void RNSkApplePlatformContext::releaseNativeBuffer(uint64_t pointer) {
|
68
68
|
CVPixelBufferRef pixelBuffer = reinterpret_cast<CVPixelBufferRef>(pointer);
|
69
69
|
if (pixelBuffer) {
|
70
70
|
CFRelease(pixelBuffer);
|
71
71
|
}
|
72
72
|
}
|
73
73
|
|
74
|
-
uint64_t
|
74
|
+
uint64_t RNSkApplePlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
|
75
75
|
// 0. If Image is not in BGRA, convert to BGRA as only BGRA is supported.
|
76
76
|
if (image->colorType() != kBGRA_8888_SkColorType) {
|
77
77
|
#if defined(SK_GRAPHITE)
|
@@ -156,7 +156,7 @@ uint64_t RNSkiOSPlatformContext::makeNativeBuffer(sk_sp<SkImage> image) {
|
|
156
156
|
return reinterpret_cast<uint64_t>(pixelBuffer);
|
157
157
|
}
|
158
158
|
|
159
|
-
const TextureInfo
|
159
|
+
const TextureInfo RNSkApplePlatformContext::getTexture(sk_sp<SkImage> image) {
|
160
160
|
GrBackendTexture texture;
|
161
161
|
TextureInfo result;
|
162
162
|
if (!SkImages::GetBackendTextureFromImage(image, &texture, true)) {
|
@@ -173,7 +173,7 @@ const TextureInfo RNSkiOSPlatformContext::getTexture(sk_sp<SkImage> image) {
|
|
173
173
|
return result;
|
174
174
|
}
|
175
175
|
|
176
|
-
const TextureInfo
|
176
|
+
const TextureInfo RNSkApplePlatformContext::getTexture(sk_sp<SkSurface> surface) {
|
177
177
|
GrBackendTexture texture = SkSurfaces::GetBackendTexture(
|
178
178
|
surface.get(), SkSurfaces::BackendHandleAccess::kFlushRead);
|
179
179
|
TextureInfo result;
|
@@ -189,12 +189,12 @@ const TextureInfo RNSkiOSPlatformContext::getTexture(sk_sp<SkSurface> surface) {
|
|
189
189
|
}
|
190
190
|
|
191
191
|
std::shared_ptr<RNSkVideo>
|
192
|
-
|
193
|
-
return std::make_shared<
|
192
|
+
RNSkApplePlatformContext::createVideo(const std::string &url) {
|
193
|
+
return std::make_shared<RNSkAppleVideo>(url, this);
|
194
194
|
}
|
195
195
|
|
196
196
|
std::shared_ptr<WindowContext>
|
197
|
-
|
197
|
+
RNSkApplePlatformContext::makeContextFromNativeSurface(void *surface, int width,
|
198
198
|
int height) {
|
199
199
|
#if defined(SK_GRAPHITE)
|
200
200
|
return DawnContext::getInstance().MakeWindow(surface, width, height);
|
@@ -204,11 +204,11 @@ RNSkiOSPlatformContext::makeContextFromNativeSurface(void *surface, int width,
|
|
204
204
|
#endif
|
205
205
|
}
|
206
206
|
|
207
|
-
void
|
207
|
+
void RNSkApplePlatformContext::raiseError(const std::exception &err) {
|
208
208
|
RCTFatal(RCTErrorWithMessage([NSString stringWithUTF8String:err.what()]));
|
209
209
|
}
|
210
210
|
|
211
|
-
sk_sp<SkSurface>
|
211
|
+
sk_sp<SkSurface> RNSkApplePlatformContext::makeOffscreenSurface(int width,
|
212
212
|
int height) {
|
213
213
|
#if defined(SK_GRAPHITE)
|
214
214
|
return DawnContext::getInstance().MakeOffscreen(width, height);
|
@@ -217,7 +217,7 @@ sk_sp<SkSurface> RNSkiOSPlatformContext::makeOffscreenSurface(int width,
|
|
217
217
|
#endif
|
218
218
|
}
|
219
219
|
|
220
|
-
sk_sp<SkImage>
|
220
|
+
sk_sp<SkImage> RNSkApplePlatformContext::makeImageFromNativeBuffer(void *buffer) {
|
221
221
|
#if defined(SK_GRAPHITE)
|
222
222
|
return DawnContext::getInstance().MakeImageFromBuffer(buffer);
|
223
223
|
#else
|
@@ -225,7 +225,7 @@ sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeBuffer(void *buffer) {
|
|
225
225
|
#endif
|
226
226
|
}
|
227
227
|
|
228
|
-
sk_sp<SkImage>
|
228
|
+
sk_sp<SkImage> RNSkApplePlatformContext::makeImageFromNativeTexture(
|
229
229
|
const TextureInfo &texInfo, int width, int height, bool mipMapped) {
|
230
230
|
id<MTLTexture> mtlTexture = (__bridge id<MTLTexture>)(texInfo.mtlTexture);
|
231
231
|
|
@@ -246,7 +246,7 @@ sk_sp<SkImage> RNSkiOSPlatformContext::makeImageFromNativeTexture(
|
|
246
246
|
kPremul_SkAlphaType, nullptr);
|
247
247
|
}
|
248
248
|
|
249
|
-
SkColorType
|
249
|
+
SkColorType RNSkApplePlatformContext::mtlPixelFormatToSkColorType(
|
250
250
|
MTLPixelFormat pixelFormat) {
|
251
251
|
switch (pixelFormat) {
|
252
252
|
case MTLPixelFormatRGBA8Unorm:
|
@@ -279,23 +279,23 @@ SkColorType RNSkiOSPlatformContext::mtlPixelFormatToSkColorType(
|
|
279
279
|
}
|
280
280
|
|
281
281
|
#if !defined(SK_GRAPHITE)
|
282
|
-
GrDirectContext *
|
282
|
+
GrDirectContext *RNSkApplePlatformContext::getDirectContext() {
|
283
283
|
return MetalContext::getInstance().getDirectContext();
|
284
284
|
}
|
285
285
|
#endif
|
286
286
|
|
287
|
-
sk_sp<SkFontMgr>
|
287
|
+
sk_sp<SkFontMgr> RNSkApplePlatformContext::createFontMgr() {
|
288
288
|
return SkFontMgr_New_CoreText(nullptr);
|
289
289
|
}
|
290
290
|
|
291
|
-
void
|
291
|
+
void RNSkApplePlatformContext::runOnMainThread(std::function<void()> func) {
|
292
292
|
dispatch_async(dispatch_get_main_queue(), ^{
|
293
293
|
func();
|
294
294
|
});
|
295
295
|
}
|
296
296
|
|
297
297
|
sk_sp<SkImage>
|
298
|
-
|
298
|
+
RNSkApplePlatformContext::takeScreenshotFromViewTag(size_t viewTag) {
|
299
299
|
return [_screenshotService
|
300
300
|
screenshotOfViewWithTag:[NSNumber numberWithLong:viewTag]];
|
301
301
|
}
|
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
namespace RNSkia {
|
20
20
|
|
21
|
-
class
|
21
|
+
class RNSkAppleVideo : public RNSkVideo {
|
22
22
|
private:
|
23
23
|
std::string _url;
|
24
24
|
AVPlayer *_player = nullptr;
|
@@ -35,8 +35,8 @@ private:
|
|
35
35
|
NSDictionary *getOutputSettings();
|
36
36
|
|
37
37
|
public:
|
38
|
-
|
39
|
-
~
|
38
|
+
RNSkAppleVideo(std::string url, RNSkPlatformContext *context);
|
39
|
+
~RNSkAppleVideo();
|
40
40
|
sk_sp<SkImage> nextImage(double *timeStamp = nullptr) override;
|
41
41
|
double duration() override;
|
42
42
|
double framerate() override;
|
@@ -8,24 +8,24 @@
|
|
8
8
|
|
9
9
|
#pragma clang diagnostic pop
|
10
10
|
|
11
|
-
#include "
|
11
|
+
#include "RNSkAppleVideo.h"
|
12
12
|
#include <AVFoundation/AVFoundation.h>
|
13
13
|
#include <CoreVideo/CoreVideo.h>
|
14
14
|
|
15
15
|
namespace RNSkia {
|
16
16
|
|
17
|
-
|
17
|
+
RNSkAppleVideo::RNSkAppleVideo(std::string url, RNSkPlatformContext *context)
|
18
18
|
: _url(std::move(url)), _context(context) {
|
19
19
|
setupPlayer();
|
20
20
|
}
|
21
21
|
|
22
|
-
|
22
|
+
RNSkAppleVideo::~RNSkAppleVideo() {
|
23
23
|
if (_player) {
|
24
24
|
[_player pause];
|
25
25
|
}
|
26
26
|
}
|
27
27
|
|
28
|
-
void
|
28
|
+
void RNSkAppleVideo::setupPlayer() {
|
29
29
|
NSURL *videoURL = [NSURL URLWithString:@(_url.c_str())];
|
30
30
|
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:videoURL];
|
31
31
|
_player = [AVPlayer playerWithPlayerItem:playerItem];
|
@@ -53,7 +53,7 @@ void RNSkiOSVideo::setupPlayer() {
|
|
53
53
|
play();
|
54
54
|
}
|
55
55
|
|
56
|
-
sk_sp<SkImage>
|
56
|
+
sk_sp<SkImage> RNSkAppleVideo::nextImage(double *timeStamp) {
|
57
57
|
CMTime currentTime = [_player currentTime];
|
58
58
|
CVPixelBufferRef pixelBuffer =
|
59
59
|
[_videoOutput copyPixelBufferForItemTime:currentTime
|
@@ -73,14 +73,14 @@ sk_sp<SkImage> RNSkiOSVideo::nextImage(double *timeStamp) {
|
|
73
73
|
return skImage;
|
74
74
|
}
|
75
75
|
|
76
|
-
NSDictionary *
|
76
|
+
NSDictionary *RNSkAppleVideo::getOutputSettings() {
|
77
77
|
return @{
|
78
78
|
(id)kCVPixelBufferPixelFormatTypeKey : @(kCVPixelFormatType_32BGRA),
|
79
79
|
(id)kCVPixelBufferMetalCompatibilityKey : @YES
|
80
80
|
};
|
81
81
|
}
|
82
82
|
|
83
|
-
float
|
83
|
+
float RNSkAppleVideo::getRotationInDegrees() {
|
84
84
|
CGFloat rotationAngle = 0.0;
|
85
85
|
auto transform = _preferredTransform;
|
86
86
|
// Determine the rotation angle in radians
|
@@ -97,7 +97,7 @@ float RNSkiOSVideo::getRotationInDegrees() {
|
|
97
97
|
return rotationAngle;
|
98
98
|
}
|
99
99
|
|
100
|
-
void
|
100
|
+
void RNSkAppleVideo::seek(double timeInMilliseconds) {
|
101
101
|
CMTime seekTime =
|
102
102
|
CMTimeMakeWithSeconds(timeInMilliseconds / 1000.0, NSEC_PER_SEC);
|
103
103
|
[_player seekToTime:seekTime
|
@@ -110,28 +110,28 @@ void RNSkiOSVideo::seek(double timeInMilliseconds) {
|
|
110
110
|
}];
|
111
111
|
}
|
112
112
|
|
113
|
-
void
|
113
|
+
void RNSkAppleVideo::play() {
|
114
114
|
if (_player) {
|
115
115
|
[_player play];
|
116
116
|
_isPlaying = true;
|
117
117
|
}
|
118
118
|
}
|
119
119
|
|
120
|
-
void
|
120
|
+
void RNSkAppleVideo::pause() {
|
121
121
|
if (_player) {
|
122
122
|
[_player pause];
|
123
123
|
_isPlaying = false;
|
124
124
|
}
|
125
125
|
}
|
126
126
|
|
127
|
-
double
|
127
|
+
double RNSkAppleVideo::duration() { return _duration; }
|
128
128
|
|
129
|
-
double
|
129
|
+
double RNSkAppleVideo::framerate() { return _framerate; }
|
130
130
|
|
131
|
-
SkISize
|
131
|
+
SkISize RNSkAppleVideo::getSize() {
|
132
132
|
return SkISize::Make(_videoWidth, _videoHeight);
|
133
133
|
}
|
134
134
|
|
135
|
-
void
|
135
|
+
void RNSkAppleVideo::setVolume(float volume) { _player.volume = volume; }
|
136
136
|
|
137
137
|
} // namespace RNSkia
|
@@ -4,18 +4,18 @@
|
|
4
4
|
|
5
5
|
#import "RNSkMetalCanvasProvider.h"
|
6
6
|
#import "RNSkView.h"
|
7
|
-
#import "
|
7
|
+
#import "RNSkApplePlatformContext.h"
|
8
8
|
|
9
|
-
class
|
9
|
+
class RNSkBaseAppleView {
|
10
10
|
public:
|
11
11
|
virtual CALayer *getLayer() = 0;
|
12
12
|
virtual void setSize(int width, int height) = 0;
|
13
13
|
virtual std::shared_ptr<RNSkia::RNSkView> getDrawView() = 0;
|
14
14
|
};
|
15
15
|
|
16
|
-
template <class T> class
|
16
|
+
template <class T> class RNSkAppleView : public RNSkBaseAppleView, public T {
|
17
17
|
public:
|
18
|
-
|
18
|
+
RNSkAppleView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
|
19
19
|
: T(context,
|
20
20
|
std::make_shared<RNSkMetalCanvasProvider>(
|
21
21
|
std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
|
@@ -2,18 +2,18 @@
|
|
2
2
|
|
3
3
|
#import "RNSkMetalCanvasProvider.h"
|
4
4
|
#import "RNSkView.h"
|
5
|
-
#import "
|
5
|
+
#import "RNSkApplePlatformContext.h"
|
6
6
|
|
7
|
-
class
|
7
|
+
class RNSkBaseAppleView {
|
8
8
|
public:
|
9
9
|
virtual CALayer *getLayer() = 0;
|
10
10
|
virtual void setSize(int width, int height) = 0;
|
11
11
|
virtual std::shared_ptr<RNSkia::RNSkView> getDrawView() = 0;
|
12
12
|
};
|
13
13
|
|
14
|
-
template <class T> class
|
14
|
+
template <class T> class RNSkAppleView : public RNSkBaseAppleView, public T {
|
15
15
|
public:
|
16
|
-
|
16
|
+
RNSkAppleView(std::shared_ptr<RNSkia::RNSkPlatformContext> context)
|
17
17
|
: T(context,
|
18
18
|
std::make_shared<RNSkMetalCanvasProvider>(
|
19
19
|
std::bind(&RNSkia::RNSkView::requestRedraw, this), context)) {}
|
@@ -63,8 +63,13 @@ bool RNSkMetalCanvasProvider::renderToCanvas(
|
|
63
63
|
// NOTE: UIApplication.sharedApplication.applicationState can only be
|
64
64
|
// accessed from the main thread so we need to check here.
|
65
65
|
if ([[NSThread currentThread] isMainThread]) {
|
66
|
+
#if !TARGET_OS_OSX
|
66
67
|
auto state = UIApplication.sharedApplication.applicationState;
|
67
|
-
|
68
|
+
bool appIsBackgrounded = (state == UIApplicationStateBackground);
|
69
|
+
#else
|
70
|
+
bool appIsBackgrounded = !NSApplication.sharedApplication.isActive;
|
71
|
+
#endif // !TARGET_OS_OSX
|
72
|
+
if (appIsBackgrounded) {
|
68
73
|
// Request a redraw in the next run loop callback
|
69
74
|
_requestRedraw();
|
70
75
|
// and don't draw now since it might cause errors in the metal renderer if
|
@@ -6,7 +6,7 @@
|
|
6
6
|
#import <React/RCTBridge.h>
|
7
7
|
#import <React/RCTUIManager.h>
|
8
8
|
|
9
|
-
#import "
|
9
|
+
#import "RNSkApplePlatformContext.h"
|
10
10
|
|
11
11
|
static __weak SkiaManager *sharedInstance = nil;
|
12
12
|
|
@@ -41,7 +41,7 @@ static __weak SkiaManager *sharedInstance = nil;
|
|
41
41
|
// Create the RNSkiaManager (cross platform)
|
42
42
|
_skManager = std::make_shared<RNSkia::RNSkManager>(
|
43
43
|
jsRuntime, jsInvoker,
|
44
|
-
std::make_shared<RNSkia::
|
44
|
+
std::make_shared<RNSkia::RNSkApplePlatformContext>(bridge, jsInvoker));
|
45
45
|
}
|
46
46
|
}
|
47
47
|
return self;
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#ifdef RCT_NEW_ARCH_ENABLED
|
2
2
|
#import "SkiaPictureView.h"
|
3
3
|
|
4
|
-
#import "
|
4
|
+
#import "RNSkAppleView.h"
|
5
5
|
#import "RNSkPictureView.h"
|
6
6
|
#import "RNSkPlatformContext.h"
|
7
7
|
|
@@ -28,7 +28,7 @@ using namespace facebook::react;
|
|
28
28
|
auto skManager = [SkiaManager latestActiveSkManager].get();
|
29
29
|
[self initCommon:skManager
|
30
30
|
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
31
|
-
return std::make_shared<
|
31
|
+
return std::make_shared<RNSkAppleView<RNSkia::RNSkPictureView>>(
|
32
32
|
context);
|
33
33
|
}];
|
34
34
|
static const auto defaultProps =
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#include "SkiaPictureViewManager.h"
|
3
3
|
#include <React/RCTBridge+Private.h>
|
4
4
|
|
5
|
-
#include "
|
5
|
+
#include "RNSkAppleView.h"
|
6
6
|
#include "RNSkPictureView.h"
|
7
7
|
#include "RNSkPlatformContext.h"
|
8
8
|
|
@@ -37,13 +37,17 @@ RCT_CUSTOM_VIEW_PROPERTY(opaque, BOOL, SkiaUIView) {
|
|
37
37
|
[(SkiaUIView *)view setOpaque:opaque];
|
38
38
|
}
|
39
39
|
|
40
|
+
#if !TARGET_OS_OSX
|
40
41
|
- (UIView *)view {
|
42
|
+
#else
|
43
|
+
- (RCTUIView *)view {
|
44
|
+
#endif // !TARGET_OS_OSX
|
41
45
|
auto skManager = [[self skiaManager] skManager];
|
42
46
|
// Pass SkManager as a raw pointer to avoid circular dependenciesr
|
43
47
|
return [[SkiaUIView alloc]
|
44
48
|
initWithManager:skManager.get()
|
45
49
|
factory:[](std::shared_ptr<RNSkia::RNSkPlatformContext> context) {
|
46
|
-
return std::make_shared<
|
50
|
+
return std::make_shared<RNSkAppleView<RNSkia::RNSkPictureView>>(
|
47
51
|
context);
|
48
52
|
}];
|
49
53
|
}
|
@@ -4,10 +4,14 @@
|
|
4
4
|
#import <string>
|
5
5
|
|
6
6
|
#import <CoreFoundation/CoreFoundation.h>
|
7
|
+
#if !TARGET_OS_OSX
|
7
8
|
#import <UIKit/UIKit.h>
|
9
|
+
#else
|
10
|
+
#import <React/RCTUIKit.h>
|
11
|
+
#endif // !TARGET_OS_OSX
|
8
12
|
|
9
13
|
#import "RNSkManager.h"
|
10
|
-
#import "
|
14
|
+
#import "RNSkAppleView.h"
|
11
15
|
#import "SkiaManager.h"
|
12
16
|
|
13
17
|
#if RCT_NEW_ARCH_ENABLED
|
@@ -18,17 +22,21 @@
|
|
18
22
|
#if RCT_NEW_ARCH_ENABLED
|
19
23
|
RCTViewComponentView
|
20
24
|
#else
|
25
|
+
#if !TARGET_OS_OSX
|
21
26
|
UIView
|
27
|
+
#else
|
28
|
+
RCTUIView
|
29
|
+
#endif // !TARGET_OS_OSX
|
22
30
|
#endif // RCT_NEW_ARCH_ENABLED
|
23
31
|
|
24
32
|
- (instancetype)
|
25
33
|
initWithManager:(RNSkia::RNSkManager *)manager
|
26
|
-
factory:(std::function<std::shared_ptr<
|
34
|
+
factory:(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
27
35
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
|
28
36
|
- (void)initCommon:(RNSkia::RNSkManager *)manager
|
29
|
-
factory:(std::function<std::shared_ptr<
|
37
|
+
factory:(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
30
38
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory;
|
31
|
-
- (std::shared_ptr<
|
39
|
+
- (std::shared_ptr<RNSkBaseAppleView>)impl;
|
32
40
|
|
33
41
|
- (void)setDebugMode:(bool)debugMode;
|
34
42
|
- (void)setOpaque:(bool)opaque;
|
@@ -9,9 +9,9 @@
|
|
9
9
|
#import "RNSkManager.h"
|
10
10
|
|
11
11
|
@implementation SkiaUIView {
|
12
|
-
std::shared_ptr<
|
12
|
+
std::shared_ptr<RNSkBaseAppleView> _impl;
|
13
13
|
RNSkia::RNSkManager *_manager;
|
14
|
-
std::function<std::shared_ptr<
|
14
|
+
std::function<std::shared_ptr<RNSkBaseAppleView>(
|
15
15
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>
|
16
16
|
_factory;
|
17
17
|
bool _debugMode;
|
@@ -23,7 +23,7 @@
|
|
23
23
|
|
24
24
|
- (instancetype)initWithManager:(RNSkia::RNSkManager *)manager
|
25
25
|
factory:
|
26
|
-
(std::function<std::shared_ptr<
|
26
|
+
(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
27
27
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)
|
28
28
|
factory {
|
29
29
|
self = [super init];
|
@@ -40,7 +40,7 @@
|
|
40
40
|
}
|
41
41
|
|
42
42
|
- (void)initCommon:(RNSkia::RNSkManager *)manager
|
43
|
-
factory:(std::function<std::shared_ptr<
|
43
|
+
factory:(std::function<std::shared_ptr<RNSkBaseAppleView>(
|
44
44
|
std::shared_ptr<RNSkia::RNSkPlatformContext>)>)factory {
|
45
45
|
_manager = manager;
|
46
46
|
_nativeId = 0;
|
@@ -55,8 +55,12 @@
|
|
55
55
|
|
56
56
|
#pragma mark Lifecycle
|
57
57
|
|
58
|
-
|
59
|
-
|
58
|
+
#if !TARGET_OS_OSX
|
59
|
+
- (void)willMoveToSuperview:(UIView *)newSuperView {
|
60
|
+
#else
|
61
|
+
- (void)viewWillMoveToSuperview:(NSView *)newSuperView {
|
62
|
+
#endif // !TARGET_OS_OSX
|
63
|
+
if (newSuperView != nullptr) {
|
60
64
|
// Create implementation view when the parent view is set
|
61
65
|
if (_impl == nullptr && _manager != nullptr) {
|
62
66
|
_impl = _factory(_manager->getPlatformContext());
|
@@ -161,7 +165,7 @@
|
|
161
165
|
|
162
166
|
#pragma mark External API
|
163
167
|
|
164
|
-
- (std::shared_ptr<
|
168
|
+
- (std::shared_ptr<RNSkBaseAppleView>)impl {
|
165
169
|
return _impl;
|
166
170
|
}
|
167
171
|
|
@@ -20,6 +20,7 @@
|
|
20
20
|
}
|
21
21
|
|
22
22
|
- (sk_sp<SkImage>)screenshotOfViewWithTag:(NSNumber *)viewTag {
|
23
|
+
#if !TARGET_OS_OSX
|
23
24
|
// Find view corresponding to the tag
|
24
25
|
auto view = [_uiManager viewForReactTag:viewTag];
|
25
26
|
if (view == NULL) {
|
@@ -80,6 +81,9 @@
|
|
80
81
|
|
81
82
|
// ... and then create the SkImage itself!
|
82
83
|
return SkImages::RasterFromData(info, skData, bytesPerRow);
|
84
|
+
#else
|
85
|
+
return nullptr;
|
86
|
+
#endif // !TARGET_OS_OSX
|
83
87
|
}
|
84
88
|
|
85
89
|
@end
|
@@ -34,7 +34,7 @@ public:
|
|
34
34
|
SkPoint tangent;
|
35
35
|
auto result = getObject()->getPosTan(dist, &position, &tangent);
|
36
36
|
if (!result) {
|
37
|
-
throw jsi::JSError(runtime, "
|
37
|
+
throw jsi::JSError(runtime, "getPosTan() failed");
|
38
38
|
}
|
39
39
|
auto posTan = jsi::Array(runtime, 2);
|
40
40
|
auto pos = jsi::Object::createFromHostObject(
|