@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
@@ -54,20 +54,21 @@ public:
|
|
54
54
|
|
55
55
|
/**
|
56
56
|
* Returns the underlying object exposed by this host object. This object
|
57
|
-
* should be wrapped in a shared pointer of some kind
|
57
|
+
* should be wrapped in a shared pointer of some kind.
|
58
|
+
* Throws if the object has been disposed.
|
58
59
|
* @return Underlying object
|
59
60
|
*/
|
60
|
-
T getObject() { return
|
61
|
-
const T getObject() const { return
|
61
|
+
T getObject() { return validateObject(); }
|
62
|
+
const T getObject() const { return validateObject(); }
|
62
63
|
|
63
64
|
/**
|
64
|
-
Updates the inner object with a new version of the object.
|
65
|
+
* Updates the inner object with a new version of the object.
|
65
66
|
*/
|
66
67
|
void setObject(T object) { _object = object; }
|
67
68
|
|
68
69
|
/**
|
69
|
-
Dispose function that can be exposed to JS by using the JSI_API_TYPENAME
|
70
|
-
macro
|
70
|
+
* Dispose function that can be exposed to JS by using the JSI_API_TYPENAME
|
71
|
+
* macro.
|
71
72
|
*/
|
72
73
|
JSI_HOST_FUNCTION(dispose) {
|
73
74
|
safeDispose();
|
@@ -76,12 +77,22 @@ public:
|
|
76
77
|
|
77
78
|
protected:
|
78
79
|
/**
|
79
|
-
Override to implement
|
80
|
-
|
80
|
+
* Override to implement disposal of allocated resources like smart pointers.
|
81
|
+
* This method will only be called once for each instance of this class.
|
81
82
|
*/
|
82
83
|
virtual void releaseResources() = 0;
|
83
84
|
|
84
85
|
private:
|
86
|
+
/**
|
87
|
+
* Validates that _object was not disposed and returns it.
|
88
|
+
*/
|
89
|
+
T validateObject() const {
|
90
|
+
if (_isDisposed) {
|
91
|
+
throw std::runtime_error("Attempted to access a disposed object.");
|
92
|
+
}
|
93
|
+
return _object;
|
94
|
+
}
|
95
|
+
|
85
96
|
void safeDispose() {
|
86
97
|
if (!_isDisposed) {
|
87
98
|
_isDisposed = true;
|
@@ -90,12 +101,12 @@ private:
|
|
90
101
|
}
|
91
102
|
|
92
103
|
/**
|
93
|
-
* Wrapped object
|
104
|
+
* Wrapped object.
|
94
105
|
*/
|
95
106
|
T _object;
|
96
107
|
|
97
108
|
/**
|
98
|
-
Resource disposed flag
|
109
|
+
* Resource disposed flag.
|
99
110
|
*/
|
100
111
|
std::atomic<bool> _isDisposed = {false};
|
101
112
|
};
|
package/cpp/api/JsiSkParagraph.h
CHANGED
@@ -24,19 +24,19 @@
|
|
24
24
|
namespace RNSkia {
|
25
25
|
|
26
26
|
namespace jsi = facebook::jsi;
|
27
|
-
|
28
27
|
namespace para = skia::textlayout;
|
29
28
|
|
30
29
|
/**
|
31
|
-
Implementation of the Paragraph object in JSI
|
30
|
+
* Implementation of the Paragraph object in JSI
|
32
31
|
*/
|
33
|
-
class JsiSkParagraph
|
32
|
+
class JsiSkParagraph
|
33
|
+
: public JsiSkWrappingSharedPtrHostObject<para::Paragraph> {
|
34
34
|
public:
|
35
35
|
EXPORT_JSI_API_TYPENAME(JsiSkParagraph, Paragraph)
|
36
36
|
|
37
37
|
JSI_HOST_FUNCTION(layout) {
|
38
38
|
auto width = getArgumentAsNumber(runtime, arguments, count, 0);
|
39
|
-
|
39
|
+
getObject()->layout(width);
|
40
40
|
return jsi::Value::undefined();
|
41
41
|
}
|
42
42
|
|
@@ -45,34 +45,34 @@ public:
|
|
45
45
|
getArgumentAsHostObject<JsiSkCanvas>(runtime, arguments, count, 0);
|
46
46
|
auto x = getArgumentAsNumber(runtime, arguments, count, 1);
|
47
47
|
auto y = getArgumentAsNumber(runtime, arguments, count, 2);
|
48
|
-
|
48
|
+
getObject()->paint(jsiCanvas->getCanvas(), x, y);
|
49
49
|
return jsi::Value::undefined();
|
50
50
|
}
|
51
51
|
|
52
52
|
JSI_HOST_FUNCTION(getHeight) {
|
53
|
-
return static_cast<double>(
|
53
|
+
return static_cast<double>(getObject()->getHeight());
|
54
54
|
}
|
55
55
|
|
56
56
|
JSI_HOST_FUNCTION(getMaxWidth) {
|
57
|
-
return static_cast<double>(
|
57
|
+
return static_cast<double>(getObject()->getMaxWidth());
|
58
58
|
}
|
59
59
|
|
60
60
|
JSI_HOST_FUNCTION(getMaxIntrinsicWidth) {
|
61
|
-
return static_cast<double>(
|
61
|
+
return static_cast<double>(getObject()->getMaxIntrinsicWidth());
|
62
62
|
}
|
63
63
|
|
64
64
|
JSI_HOST_FUNCTION(getMinIntrinsicWidth) {
|
65
|
-
return static_cast<double>(
|
65
|
+
return static_cast<double>(getObject()->getMinIntrinsicWidth());
|
66
66
|
}
|
67
67
|
|
68
68
|
JSI_HOST_FUNCTION(getLongestLine) {
|
69
|
-
return static_cast<double>(
|
69
|
+
return static_cast<double>(getObject()->getLongestLine());
|
70
70
|
}
|
71
71
|
|
72
72
|
JSI_HOST_FUNCTION(getGlyphPositionAtCoordinate) {
|
73
73
|
auto dx = getArgumentAsNumber(runtime, arguments, count, 0);
|
74
74
|
auto dy = getArgumentAsNumber(runtime, arguments, count, 1);
|
75
|
-
auto result =
|
75
|
+
auto result = getObject()->getGlyphPositionAtCoordinate(dx, dy);
|
76
76
|
return result.position;
|
77
77
|
}
|
78
78
|
|
@@ -80,8 +80,8 @@ public:
|
|
80
80
|
auto start = getArgumentAsNumber(runtime, arguments, count, 0);
|
81
81
|
auto end = getArgumentAsNumber(runtime, arguments, count, 1);
|
82
82
|
auto result =
|
83
|
-
|
84
|
-
|
83
|
+
getObject()->getRectsForRange(start, end, para::RectHeightStyle::kTight,
|
84
|
+
para::RectWidthStyle::kTight);
|
85
85
|
auto returnValue = jsi::Array(runtime, result.size());
|
86
86
|
for (size_t i = 0; i < result.size(); ++i) {
|
87
87
|
returnValue.setValueAtIndex(
|
@@ -93,7 +93,7 @@ public:
|
|
93
93
|
|
94
94
|
JSI_HOST_FUNCTION(getLineMetrics) {
|
95
95
|
std::vector<para::LineMetrics> metrics;
|
96
|
-
|
96
|
+
getObject()->getLineMetrics(metrics);
|
97
97
|
auto returnValue = jsi::Array(runtime, metrics.size());
|
98
98
|
auto height = 0;
|
99
99
|
for (size_t i = 0; i < metrics.size(); ++i) {
|
@@ -110,7 +110,7 @@ public:
|
|
110
110
|
|
111
111
|
JSI_HOST_FUNCTION(getRectsForPlaceholders) {
|
112
112
|
std::vector<para::TextBox> placeholderInfos =
|
113
|
-
|
113
|
+
getObject()->getRectsForPlaceholders();
|
114
114
|
auto returnValue = jsi::Array(runtime, placeholderInfos.size());
|
115
115
|
for (size_t i = 0; i < placeholderInfos.size(); ++i) {
|
116
116
|
auto obj = jsi::Object(runtime);
|
@@ -124,12 +124,6 @@ public:
|
|
124
124
|
return returnValue;
|
125
125
|
}
|
126
126
|
|
127
|
-
JSI_HOST_FUNCTION(dispose) {
|
128
|
-
_paragraph = nullptr;
|
129
|
-
|
130
|
-
return jsi::Value::undefined();
|
131
|
-
}
|
132
|
-
|
133
127
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkParagraph, layout),
|
134
128
|
JSI_EXPORT_FUNC(JsiSkParagraph, paint),
|
135
129
|
JSI_EXPORT_FUNC(JsiSkParagraph, getMaxWidth),
|
@@ -146,12 +140,8 @@ public:
|
|
146
140
|
|
147
141
|
explicit JsiSkParagraph(std::shared_ptr<RNSkPlatformContext> context,
|
148
142
|
para::ParagraphBuilder *paragraphBuilder)
|
149
|
-
:
|
150
|
-
|
151
|
-
}
|
152
|
-
|
153
|
-
public:
|
154
|
-
std::unique_ptr<para::Paragraph> _paragraph;
|
143
|
+
: JsiSkWrappingSharedPtrHostObject<para::Paragraph>(
|
144
|
+
std::move(context), std::move(paragraphBuilder->Build())) {}
|
155
145
|
};
|
156
146
|
|
157
147
|
} // namespace RNSkia
|
@@ -26,7 +26,7 @@ public:
|
|
26
26
|
std::move(pathEffect)) {}
|
27
27
|
|
28
28
|
EXPORT_JSI_API_TYPENAME(JsiSkPathEffect, PathEffect)
|
29
|
-
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(
|
29
|
+
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPathEffect, dispose))
|
30
30
|
};
|
31
31
|
|
32
32
|
} // namespace RNSkia
|
@@ -45,7 +45,7 @@ public:
|
|
45
45
|
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureFactory, MakePicture))
|
46
46
|
|
47
47
|
explicit JsiSkPictureFactory(std::shared_ptr<RNSkPlatformContext> context)
|
48
|
-
: JsiSkHostObject(context) {}
|
48
|
+
: JsiSkHostObject(std::move(context)) {}
|
49
49
|
};
|
50
50
|
|
51
51
|
} // namespace RNSkia
|
@@ -84,14 +84,22 @@ public:
|
|
84
84
|
SkPoint pts[] = {p1, p2};
|
85
85
|
|
86
86
|
std::vector<SkColor> colors = getColors(runtime, arguments[2]);
|
87
|
+
auto colorsSize = colors.size();
|
88
|
+
if (colorsSize < 2) {
|
89
|
+
throw std::invalid_argument("colors must have at least 2 colors");
|
90
|
+
}
|
87
91
|
std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
|
92
|
+
if (!positions.empty() && positions.size() != colorsSize) {
|
93
|
+
throw std::invalid_argument(
|
94
|
+
"positions must be empty or have the same size as colors");
|
95
|
+
}
|
88
96
|
auto tileMode = getTileMode(arguments, 4, count);
|
89
97
|
auto flag = getFlag(arguments, 6, count);
|
90
98
|
auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
|
91
99
|
|
92
100
|
sk_sp<SkShader> gradient = SkGradientShader::MakeLinear(
|
93
|
-
pts, colors.data(), positions.
|
94
|
-
tileMode, flag, localMatrix);
|
101
|
+
pts, colors.data(), !positions.empty() ? positions.data() : nullptr,
|
102
|
+
static_cast<int>(colorsSize), tileMode, flag, localMatrix);
|
95
103
|
return jsi::Object::createFromHostObject(
|
96
104
|
runtime,
|
97
105
|
std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
@@ -103,14 +111,23 @@ public:
|
|
103
111
|
auto r = arguments[1].asNumber();
|
104
112
|
|
105
113
|
std::vector<SkColor> colors = getColors(runtime, arguments[2]);
|
114
|
+
auto colorsSize = colors.size();
|
115
|
+
if (colorsSize < 2) {
|
116
|
+
throw std::invalid_argument("colors must have at least 2 colors");
|
117
|
+
}
|
106
118
|
std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
|
119
|
+
if (!positions.empty() && positions.size() != colorsSize) {
|
120
|
+
throw std::invalid_argument(
|
121
|
+
"positions must be empty or the same size as colors");
|
122
|
+
}
|
107
123
|
auto tileMode = getTileMode(arguments, 4, count);
|
108
124
|
auto flag = getFlag(arguments, 6, count);
|
109
125
|
auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
|
110
126
|
|
111
127
|
sk_sp<SkShader> gradient = SkGradientShader::MakeRadial(
|
112
|
-
center, r, colors.data(),
|
113
|
-
|
128
|
+
center, r, colors.data(),
|
129
|
+
!positions.empty() ? positions.data() : nullptr,
|
130
|
+
static_cast<int>(colorsSize), tileMode, flag, localMatrix);
|
114
131
|
return jsi::Object::createFromHostObject(
|
115
132
|
runtime,
|
116
133
|
std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
@@ -120,7 +137,15 @@ public:
|
|
120
137
|
auto x = arguments[0].asNumber();
|
121
138
|
auto y = arguments[1].asNumber();
|
122
139
|
std::vector<SkColor> colors = getColors(runtime, arguments[2]);
|
140
|
+
auto colorsSize = colors.size();
|
141
|
+
if (colorsSize < 2) {
|
142
|
+
throw std::invalid_argument("colors must have at least 2 colors");
|
143
|
+
}
|
123
144
|
std::vector<SkScalar> positions = getPositions(runtime, arguments[3]);
|
145
|
+
if (!positions.empty() && positions.size() != colorsSize) {
|
146
|
+
throw std::invalid_argument(
|
147
|
+
"positions must be empty or the same size as colors");
|
148
|
+
}
|
124
149
|
auto tileMode = getTileMode(arguments, 4, count);
|
125
150
|
auto localMatrix = getLocalMatrix(runtime, arguments, 5, count);
|
126
151
|
auto flag = getFlag(arguments, 6, count);
|
@@ -130,8 +155,9 @@ public:
|
|
130
155
|
? 360
|
131
156
|
: arguments[8].asNumber();
|
132
157
|
sk_sp<SkShader> gradient = SkGradientShader::MakeSweep(
|
133
|
-
x, y, colors.data(), positions.
|
134
|
-
tileMode, startAngle, endAngle, flag,
|
158
|
+
x, y, colors.data(), !positions.empty() ? positions.data() : nullptr,
|
159
|
+
static_cast<int>(colorsSize), tileMode, startAngle, endAngle, flag,
|
160
|
+
localMatrix);
|
135
161
|
return jsi::Object::createFromHostObject(
|
136
162
|
runtime,
|
137
163
|
std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
@@ -147,14 +173,23 @@ public:
|
|
147
173
|
auto endRadius = arguments[3].asNumber();
|
148
174
|
|
149
175
|
std::vector<SkColor> colors = getColors(runtime, arguments[4]);
|
176
|
+
auto colorsSize = colors.size();
|
177
|
+
if (colorsSize < 2) {
|
178
|
+
throw std::invalid_argument("colors must have at least 2 colors");
|
179
|
+
}
|
150
180
|
std::vector<SkScalar> positions = getPositions(runtime, arguments[5]);
|
181
|
+
if (!positions.empty() && positions.size() != colorsSize) {
|
182
|
+
throw std::invalid_argument(
|
183
|
+
"positions must be empty or the same size as colors");
|
184
|
+
}
|
151
185
|
auto tileMode = getTileMode(arguments, 6, count);
|
152
186
|
auto localMatrix = getLocalMatrix(runtime, arguments, 7, count);
|
153
187
|
auto flag = getFlag(arguments, 8, count);
|
154
188
|
|
155
189
|
sk_sp<SkShader> gradient = SkGradientShader::MakeTwoPointConical(
|
156
|
-
start, startRadius, end, endRadius, colors.data(),
|
157
|
-
|
190
|
+
start, startRadius, end, endRadius, colors.data(),
|
191
|
+
!positions.empty() ? positions.data() : nullptr,
|
192
|
+
static_cast<int>(colorsSize), tileMode, flag, localMatrix);
|
158
193
|
|
159
194
|
return jsi::Object::createFromHostObject(
|
160
195
|
runtime,
|
package/cpp/api/JsiSkVertices.h
CHANGED
@@ -70,6 +70,10 @@ public:
|
|
70
70
|
if (count >= 3 && !arguments[2].isNull() && !arguments[2].isUndefined()) {
|
71
71
|
auto jsiTexs = arguments[2].asObject(runtime).asArray(runtime);
|
72
72
|
auto texsSize = jsiTexs.size(runtime);
|
73
|
+
if (texsSize != positionsSize) {
|
74
|
+
throw jsi::JSError(runtime, "The number of texture coordinates must "
|
75
|
+
"match the number of positions");
|
76
|
+
}
|
73
77
|
texs.reserve(texsSize);
|
74
78
|
for (int i = 0; i < texsSize; i++) {
|
75
79
|
auto point = JsiSkPoint::fromValue(
|
@@ -81,6 +85,11 @@ public:
|
|
81
85
|
if (count >= 4 && !arguments[3].isNull() && !arguments[3].isUndefined()) {
|
82
86
|
auto jsiColors = arguments[3].asObject(runtime).asArray(runtime);
|
83
87
|
auto colorsSize = jsiColors.size(runtime);
|
88
|
+
if (colorsSize != positionsSize) {
|
89
|
+
throw jsi::JSError(
|
90
|
+
runtime,
|
91
|
+
"The number of colors must match the number of positions");
|
92
|
+
}
|
84
93
|
colors.reserve(colorsSize);
|
85
94
|
for (int i = 0; i < colorsSize; i++) {
|
86
95
|
SkColor color = JsiSkColor::fromValue(
|
@@ -132,9 +141,11 @@ public:
|
|
132
141
|
// builder.indices());
|
133
142
|
// }
|
134
143
|
// auto vertices = builder.detach();
|
135
|
-
auto vertices =
|
136
|
-
mode, positionsSize, positions.data(),
|
137
|
-
|
144
|
+
auto vertices =
|
145
|
+
SkVertices::MakeCopy(mode, positionsSize, positions.data(),
|
146
|
+
texs.size() > 0 ? texs.data() : nullptr,
|
147
|
+
colors.size() > 0 ? colors.data() : nullptr,
|
148
|
+
indicesSize, indices.data());
|
138
149
|
return jsi::Object::createFromHostObject(
|
139
150
|
runtime,
|
140
151
|
std::make_shared<JsiSkVertices>(context, std::move(vertices)));
|
@@ -874,9 +874,10 @@ public:
|
|
874
874
|
}
|
875
875
|
|
876
876
|
void draw(DrawingCtx *ctx) {
|
877
|
-
if (props.paragraph
|
878
|
-
props.paragraph->
|
879
|
-
|
877
|
+
if (props.paragraph) {
|
878
|
+
auto paragraph = props.paragraph->getObject();
|
879
|
+
paragraph->layout(props.width);
|
880
|
+
paragraph->paint(ctx->canvas, props.x, props.y);
|
880
881
|
}
|
881
882
|
}
|
882
883
|
};
|
package/cpp/rnskia/DawnContext.h
CHANGED
@@ -51,7 +51,7 @@ async_callback(void *c,
|
|
51
51
|
class DawnContext {
|
52
52
|
public:
|
53
53
|
// TODO: remove
|
54
|
-
friend class
|
54
|
+
friend class RNSkApplePlatformContext;
|
55
55
|
|
56
56
|
DawnContext(const DawnContext &) = delete;
|
57
57
|
DawnContext &operator=(const DawnContext &) = delete;
|
@@ -412,6 +412,9 @@ public:
|
|
412
412
|
* If a scanline decode is in progress, scanline mode will end, requiring the client to call
|
413
413
|
* startScanlineDecode() in order to return to decoding scanlines.
|
414
414
|
*
|
415
|
+
* For certain codecs, reading into a smaller bitmap than the original dimensions may not
|
416
|
+
* produce correct results (e.g. animated webp).
|
417
|
+
*
|
415
418
|
* @return Result kSuccess, or another value explaining the type of failure.
|
416
419
|
*/
|
417
420
|
Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*);
|
@@ -812,6 +815,7 @@ protected:
|
|
812
815
|
}
|
813
816
|
|
814
817
|
virtual bool onGetGainmapCodec(SkGainmapInfo*, std::unique_ptr<SkCodec>*) { return false; }
|
818
|
+
virtual bool onGetGainmapInfo(SkGainmapInfo*) { return false; }
|
815
819
|
|
816
820
|
// TODO(issues.skia.org/363544350): This API only works for JPEG images. Remove this API once
|
817
821
|
// it is no longer used.
|
@@ -1053,8 +1057,9 @@ private:
|
|
1053
1057
|
friend class PNGCodecGM; // for fillIncompleteImage
|
1054
1058
|
friend class SkSampledCodec;
|
1055
1059
|
friend class SkIcoCodec;
|
1056
|
-
friend class
|
1057
|
-
friend class
|
1060
|
+
friend class SkPngCodec; // for onGetGainmapCodec
|
1061
|
+
friend class SkAndroidCodec; // for handleFrameIndex
|
1062
|
+
friend class SkCodecPriv; // for fEncodedInfo
|
1058
1063
|
};
|
1059
1064
|
|
1060
1065
|
namespace SkCodecs {
|
@@ -74,6 +74,12 @@
|
|
74
74
|
*/
|
75
75
|
//#define SK_R32_SHIFT 16
|
76
76
|
|
77
|
+
/* This controls how much space should be pre-allocated in an SkCanvas object
|
78
|
+
to store the SkMatrix and clip via calls to SkCanvas::save() (and balanced with
|
79
|
+
SkCanvas::restore()).
|
80
|
+
*/
|
81
|
+
//#define SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT 32
|
82
|
+
|
77
83
|
/* Determines whether to build code that supports the Ganesh GPU backend. Some classes
|
78
84
|
that are not GPU-specific, such as SkShader subclasses, have optional code
|
79
85
|
that is used allows them to interact with this GPU backend. If you'd like to
|
@@ -95,6 +101,11 @@
|
|
95
101
|
//#define SK_HISTOGRAM_MEMORY_KB(name, sample)
|
96
102
|
//#define SK_HISTOGRAM_CUSTOM_MICROSECONDS_TIMES(name, sampleUSec, minUSec, maxUSec, bucketCount)
|
97
103
|
|
104
|
+
/*
|
105
|
+
* Skia can provide extensive logging of Graphite Pipeline lifetimes.
|
106
|
+
*/
|
107
|
+
//#define SK_PIPELINE_LIFETIME_LOGGING
|
108
|
+
|
98
109
|
// To use smaller but slower mipmap builder
|
99
110
|
//#define SK_USE_DRAWING_MIPMAP_DOWNSAMPLER
|
100
111
|
|
@@ -34,6 +34,7 @@
|
|
34
34
|
#include "include/private/base/SkDeque.h"
|
35
35
|
#include "include/private/base/SkTArray.h"
|
36
36
|
|
37
|
+
#include <cstddef>
|
37
38
|
#include <cstdint>
|
38
39
|
#include <cstring>
|
39
40
|
#include <memory>
|
@@ -2502,15 +2503,18 @@ private:
|
|
2502
2503
|
void reset(SkDevice* device);
|
2503
2504
|
};
|
2504
2505
|
|
2505
|
-
|
2506
|
-
static constexpr int
|
2507
|
-
|
2506
|
+
#if defined(SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT)
|
2507
|
+
static constexpr int kMCRecCount = SK_CANVAS_SAVE_RESTORE_PREALLOC_COUNT;
|
2508
|
+
#else
|
2509
|
+
static constexpr int kMCRecCount = 32; // common depth for save/restores
|
2510
|
+
#endif
|
2508
2511
|
|
2509
|
-
|
2512
|
+
// This stack allocation of memory will be used to house the first kMCRecCount
|
2513
|
+
// layers without need to call malloc.
|
2514
|
+
alignas(MCRec) std::byte fMCRecStorage[sizeof(MCRec) * kMCRecCount];
|
2510
2515
|
|
2511
|
-
SkDeque fMCStack;
|
2512
|
-
// points to top of stack
|
2513
|
-
MCRec* fMCRec;
|
2516
|
+
SkDeque fMCStack; // uses the stack memory
|
2517
|
+
MCRec* fMCRec; // points to top of stack for convenience
|
2514
2518
|
|
2515
2519
|
// Installed via init()
|
2516
2520
|
sk_sp<SkDevice> fRootDevice;
|
@@ -12,6 +12,7 @@
|
|
12
12
|
#include "include/core/SkScalar.h"
|
13
13
|
#include "include/core/SkTypes.h"
|
14
14
|
#include "include/private/base/SkCPUTypes.h"
|
15
|
+
#include "include/private/base/SkTPin.h"
|
15
16
|
|
16
17
|
#include <array>
|
17
18
|
#include <cstdint>
|
@@ -415,6 +416,15 @@ struct SkRGBA4f {
|
|
415
416
|
SkRGBA4f makeOpaque() const {
|
416
417
|
return { fR, fG, fB, 1.0f };
|
417
418
|
}
|
419
|
+
|
420
|
+
/**
|
421
|
+
Returns a copy of the SkRGBA4f but with the alpha component pinned to [0, 1].
|
422
|
+
|
423
|
+
@return color with pinned alpha
|
424
|
+
*/
|
425
|
+
SkRGBA4f pinAlpha() const {
|
426
|
+
return { fR, fG, fB, SkTPin(fA, 0.f, 1.f) };
|
427
|
+
}
|
418
428
|
};
|
419
429
|
|
420
430
|
/** \struct SkColor4f
|