@shopify/react-native-skia 0.1.196 → 0.1.199
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/CMakeLists.txt +32 -31
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.cpp +4 -2
- package/android/cpp/rnskia-android/SkiaOpenGLRenderer.h +3 -0
- package/cpp/api/JsiSkImage.h +1 -1
- package/cpp/api/JsiSkShaderFactory.h +4 -4
- package/cpp/api/JsiSkSurface.h +0 -1
- package/cpp/api/JsiSkSurfaceFactory.h +2 -1
- package/cpp/rnskia/RNSkView.h +20 -40
- package/cpp/rnskia/dom/nodes/JsiShaderNodes.h +2 -2
- package/cpp/rnskia/values/RNSkReadonlyValue.h +6 -7
- package/cpp/skia/include/android/SkCanvasAndroid.h +20 -0
- package/cpp/skia/include/android/SkHeifDecoder.h +43 -0
- package/cpp/skia/include/android/SkSurfaceAndroid.h +50 -0
- package/cpp/skia/include/codec/SkAvifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkBmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkCodec.h +25 -1
- package/cpp/skia/include/codec/SkGifDecoder.h +43 -0
- package/cpp/skia/include/codec/SkIcoDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegDecoder.h +43 -0
- package/cpp/skia/include/codec/SkJpegxlDecoder.h +43 -0
- package/cpp/skia/include/codec/SkPngDecoder.h +43 -0
- package/cpp/skia/include/codec/SkRawDecoder.h +49 -0
- package/cpp/skia/include/codec/SkWbmpDecoder.h +43 -0
- package/cpp/skia/include/codec/SkWebpDecoder.h +43 -0
- package/cpp/skia/include/core/SkBBHFactory.h +5 -1
- package/cpp/skia/include/core/SkBlender.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +4 -23
- package/cpp/skia/include/core/SkColorFilter.h +14 -1
- package/cpp/skia/include/core/SkColorTable.h +59 -0
- package/cpp/skia/include/core/SkContourMeasure.h +3 -0
- package/cpp/skia/include/core/SkDeferredDisplayList.h +8 -104
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +8 -91
- package/cpp/skia/include/core/SkDrawable.h +5 -2
- package/cpp/skia/include/core/SkGraphics.h +7 -19
- package/cpp/skia/include/core/SkImage.h +157 -249
- package/cpp/skia/include/core/SkImageGenerator.h +0 -31
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPathMeasure.h +3 -3
- package/cpp/skia/include/core/SkPictureRecorder.h +1 -1
- package/cpp/skia/include/core/SkPoint.h +5 -563
- package/cpp/skia/include/core/SkPoint3.h +1 -0
- package/cpp/skia/include/core/SkPromiseImageTexture.h +4 -30
- package/cpp/skia/include/core/SkRect.h +8 -8
- package/cpp/skia/include/core/SkSamplingOptions.h +4 -2
- package/cpp/skia/include/core/SkScalar.h +1 -1
- package/cpp/skia/include/core/SkSerialProcs.h +5 -1
- package/cpp/skia/include/core/SkShader.h +14 -21
- package/cpp/skia/include/core/SkString.h +2 -0
- package/cpp/skia/include/core/SkSurface.h +169 -701
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +8 -256
- package/cpp/skia/include/core/SkTiledImageUtils.h +97 -0
- package/cpp/skia/include/core/SkTypes.h +4 -2
- package/cpp/skia/include/core/SkYUVAPixmaps.h +0 -5
- package/cpp/skia/include/effects/SkGradientShader.h +10 -1
- package/cpp/skia/include/effects/SkImageFilters.h +62 -37
- package/cpp/skia/include/effects/SkPerlinNoiseShader.h +28 -29
- package/cpp/skia/include/effects/SkRuntimeEffect.h +17 -12
- package/cpp/skia/include/gpu/GrBackendSurface.h +12 -39
- package/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +6 -0
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +3 -3
- package/cpp/skia/include/gpu/GrDirectContext.h +103 -3
- package/cpp/skia/include/gpu/GrRecordingContext.h +10 -19
- package/cpp/skia/include/gpu/MutableTextureState.h +4 -0
- package/cpp/skia/include/gpu/ganesh/GrExternalTextureGenerator.h +54 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +20 -76
- package/cpp/skia/include/gpu/ganesh/SkSurfaceGanesh.h +217 -0
- package/cpp/skia/include/gpu/ganesh/mtl/SkSurfaceMetal.h +73 -0
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +13 -2
- package/cpp/skia/include/gpu/graphite/BackendSemaphore.h +78 -0
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +1 -0
- package/cpp/skia/include/gpu/graphite/Image.h +277 -0
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +1 -1
- package/cpp/skia/include/gpu/graphite/Recording.h +1 -4
- package/cpp/skia/include/gpu/graphite/Surface.h +81 -0
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +5 -7
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +2 -2
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +23 -8
- package/cpp/skia/include/ports/SkTypeface_fontations.h +21 -0
- package/cpp/skia/include/private/SkGainmapInfo.h +2 -0
- package/cpp/skia/include/private/SkGainmapShader.h +1 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +19 -1
- package/cpp/skia/include/private/SkPathRef.h +13 -15
- package/cpp/skia/include/private/SkXmp.h +53 -0
- package/cpp/skia/include/private/base/SkFeatures.h +0 -4
- package/cpp/skia/include/private/base/SkFloatingPoint.h +11 -5
- package/cpp/skia/include/private/base/SkPoint_impl.h +569 -0
- package/cpp/skia/include/private/base/SkSpan_impl.h +3 -7
- package/cpp/skia/include/private/base/SkTArray.h +11 -11
- package/cpp/skia/include/private/chromium/GrDeferredDisplayList.h +120 -0
- package/cpp/skia/include/private/chromium/GrDeferredDisplayListRecorder.h +98 -0
- package/cpp/skia/include/private/chromium/GrPromiseImageTexture.h +43 -0
- package/cpp/skia/include/private/chromium/GrSurfaceCharacterization.h +215 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +6 -6
- package/cpp/skia/include/private/chromium/SkImageChromium.h +104 -0
- package/cpp/skia/include/private/chromium/Slug.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +7 -3
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +2 -0
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +10 -2
- package/cpp/skia/include/{gpu → private/gpu}/ganesh/GrTextureGenerator.h +2 -13
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +7 -0
- package/cpp/skia/include/private/gpu/graphite/MtlGraphiteTypesPriv.h +19 -6
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +13 -0
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +0 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +14 -1
- package/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +999 -79
- package/cpp/skia/modules/skcms/src/Transform_inl.h +36 -236
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +2 -0
- package/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +16 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +6 -2
- package/cpp/skia/modules/skresources/include/SkResources.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGCircle.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGClipPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGDefs.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGEllipse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFe.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeBlend.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeComposite.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeFlood.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeLighting.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeOffset.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilter.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGImage.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLine.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGMask.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPath.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPattern.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGPoly.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRect.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGRenderContext.h +3 -3
- package/cpp/skia/modules/svg/include/SkSVGSVG.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGShape.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGStop.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGText.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGTypes.h +21 -21
- package/cpp/skia/modules/svg/include/SkSVGUse.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGValue.h +2 -2
- package/cpp/skia/{include/private → src/core}/SkChecksum.h +32 -17
- package/cpp/skia/src/core/SkTHash.h +1 -1
- package/ios/RNSkia-iOS/RNSkMetalCanvasProvider.mm +3 -1
- package/ios/RNSkia-iOS/SkiaMetalRenderer.mm +3 -1
- package/lib/commonjs/renderer/Canvas.js +24 -13
- package/lib/commonjs/renderer/Canvas.js.map +1 -1
- package/lib/commonjs/skia/core/Data.d.ts +2 -2
- package/lib/commonjs/skia/core/Data.js.map +1 -1
- package/lib/commonjs/skia/core/RRect.js +5 -1
- package/lib/commonjs/skia/core/RRect.js.map +1 -1
- package/lib/commonjs/skia/core/Rect.js +32 -6
- package/lib/commonjs/skia/core/Rect.js.map +1 -1
- package/lib/commonjs/skia/types/Color.js.map +1 -1
- package/lib/commonjs/skia/types/JsiInstance.d.ts +2 -4
- package/lib/commonjs/skia/types/JsiInstance.js.map +1 -1
- package/lib/module/renderer/Canvas.js +25 -14
- package/lib/module/renderer/Canvas.js.map +1 -1
- package/lib/module/skia/core/Data.d.ts +2 -2
- package/lib/module/skia/core/Data.js.map +1 -1
- package/lib/module/skia/core/RRect.js +5 -1
- package/lib/module/skia/core/RRect.js.map +1 -1
- package/lib/module/skia/core/Rect.js +32 -6
- package/lib/module/skia/core/Rect.js.map +1 -1
- package/lib/module/skia/types/Color.js.map +1 -1
- package/lib/module/skia/types/JsiInstance.d.ts +2 -4
- package/lib/module/skia/types/JsiInstance.js.map +1 -1
- package/lib/typescript/src/skia/core/Data.d.ts +2 -2
- package/lib/typescript/src/skia/types/JsiInstance.d.ts +2 -4
- package/libs/android/arm64-v8a/libskia.a +0 -0
- package/libs/android/arm64-v8a/libskottie.a +0 -0
- package/libs/android/arm64-v8a/libsksg.a +0 -0
- package/libs/android/arm64-v8a/libsvg.a +0 -0
- package/libs/android/armeabi-v7a/libskia.a +0 -0
- package/libs/android/armeabi-v7a/libskottie.a +0 -0
- package/libs/android/armeabi-v7a/libsksg.a +0 -0
- package/libs/android/armeabi-v7a/libsvg.a +0 -0
- package/libs/android/x86/libskia.a +0 -0
- package/libs/android/x86/libskottie.a +0 -0
- package/libs/android/x86/libsksg.a +0 -0
- package/libs/android/x86/libsvg.a +0 -0
- package/libs/android/x86_64/libskia.a +0 -0
- package/libs/android/x86_64/libskottie.a +0 -0
- package/libs/android/x86_64/libsksg.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libsksg.xcframework/Info.plist +5 -5
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libsvg.xcframework/Info.plist +5 -5
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +3 -4
- package/src/renderer/Canvas.tsx +25 -19
- package/src/skia/core/Data.ts +3 -3
- package/src/skia/core/RRect.tsx +4 -2
- package/src/skia/core/Rect.ts +29 -12
- package/src/skia/types/Color.ts +1 -1
- package/src/skia/types/JsiInstance.ts +2 -5
- package/cpp/skia/include/effects/SkTableColorFilter.h +0 -29
- package/cpp/skia/include/private/SkOpts_spi.h +0 -23
- package/cpp/skia/include/private/SkSpinlock.h +0 -57
- package/cpp/skia/include/private/chromium/GrSlug.h +0 -16
- package/scripts/install-npm.js +0 -33
package/android/CMakeLists.txt
CHANGED
|
@@ -47,21 +47,21 @@ add_library(
|
|
|
47
47
|
"${PROJECT_SOURCE_DIR}/cpp/rnskia-android/RNSkOpenGLCanvasProvider.cpp"
|
|
48
48
|
"${PROJECT_SOURCE_DIR}/cpp/rnskia-android/SkiaOpenGLRenderer.cpp"
|
|
49
49
|
|
|
50
|
-
"${PROJECT_SOURCE_DIR}
|
|
51
|
-
"${PROJECT_SOURCE_DIR}
|
|
52
|
-
"${PROJECT_SOURCE_DIR}
|
|
53
|
-
"${PROJECT_SOURCE_DIR}
|
|
54
|
-
"${PROJECT_SOURCE_DIR}
|
|
50
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiHostObject.cpp"
|
|
51
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiValue.cpp"
|
|
52
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeLifecycleMonitor.cpp"
|
|
53
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/RuntimeAwareCache.cpp"
|
|
54
|
+
"${PROJECT_SOURCE_DIR}/../cpp/jsi/JsiPromises.cpp"
|
|
55
55
|
|
|
56
|
-
"${PROJECT_SOURCE_DIR}
|
|
57
|
-
"${PROJECT_SOURCE_DIR}
|
|
58
|
-
"${PROJECT_SOURCE_DIR}
|
|
59
|
-
"${PROJECT_SOURCE_DIR}
|
|
56
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkManager.cpp"
|
|
57
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkJsView.cpp"
|
|
58
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDomView.cpp"
|
|
59
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/RNSkDispatchQueue.cpp"
|
|
60
60
|
|
|
61
|
-
"${PROJECT_SOURCE_DIR}
|
|
62
|
-
"${PROJECT_SOURCE_DIR}
|
|
61
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/dom/base/DrawingContext.cpp"
|
|
62
|
+
"${PROJECT_SOURCE_DIR}/../cpp/rnskia/dom/base/ConcatablePaint.cpp"
|
|
63
63
|
|
|
64
|
-
"${PROJECT_SOURCE_DIR}
|
|
64
|
+
"${PROJECT_SOURCE_DIR}/../cpp/api/third_party/CSSColorParser.cpp"
|
|
65
65
|
|
|
66
66
|
)
|
|
67
67
|
|
|
@@ -75,27 +75,28 @@ target_include_directories(
|
|
|
75
75
|
"${NODE_MODULES_DIR}/react-native/ReactCommon/react/nativemodule/core"
|
|
76
76
|
"${NODE_MODULES_DIR}/react-native/ReactAndroid/src/main/java/com/facebook/react/turbomodule/core/jni"
|
|
77
77
|
|
|
78
|
-
cpp/skia/include/config/
|
|
79
|
-
cpp/skia/include/core/
|
|
80
|
-
cpp/skia/include/effects/
|
|
81
|
-
cpp/skia/include/utils/
|
|
82
|
-
cpp/skia/include/pathops/
|
|
83
|
-
cpp/skia/modules/
|
|
84
|
-
#cpp/skia/modules/skparagraph/include/
|
|
85
|
-
cpp/skia/include/
|
|
86
|
-
cpp/skia
|
|
87
|
-
|
|
88
|
-
cpp/api
|
|
89
|
-
cpp/jsi
|
|
90
78
|
cpp/jni/include
|
|
91
79
|
cpp/rnskia-android
|
|
92
|
-
|
|
93
|
-
cpp/
|
|
94
|
-
cpp/
|
|
95
|
-
cpp/
|
|
96
|
-
cpp/
|
|
97
|
-
cpp/
|
|
98
|
-
cpp/
|
|
80
|
+
|
|
81
|
+
../cpp/skia/include/config/
|
|
82
|
+
../cpp/skia/include/core/
|
|
83
|
+
../cpp/skia/include/effects/
|
|
84
|
+
../cpp/skia/include/utils/
|
|
85
|
+
../cpp/skia/include/pathops/
|
|
86
|
+
../cpp/skia/modules/
|
|
87
|
+
#cpp/skia/modules/skparagraph/include/
|
|
88
|
+
../cpp/skia/include/
|
|
89
|
+
../cpp/skia
|
|
90
|
+
|
|
91
|
+
../cpp/api
|
|
92
|
+
../cpp/jsi
|
|
93
|
+
../cpp/rnskia
|
|
94
|
+
../cpp/rnskia/values
|
|
95
|
+
../cpp/rnskia/dom
|
|
96
|
+
../cpp/rnskia/dom/base
|
|
97
|
+
../cpp/rnskia/dom/nodes
|
|
98
|
+
../cpp/rnskia/dom/props
|
|
99
|
+
../cpp/utils
|
|
99
100
|
|
|
100
101
|
${libfbjni_include_DIRS}
|
|
101
102
|
)
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
#include <android/native_window.h>
|
|
5
5
|
#include <android/native_window_jni.h>
|
|
6
6
|
|
|
7
|
+
#pragma clang diagnostic push
|
|
8
|
+
|
|
7
9
|
#define STENCIL_BUFFER_SIZE 8
|
|
8
10
|
|
|
9
11
|
namespace RNSkia {
|
|
@@ -102,7 +104,7 @@ sk_sp<SkSurface> MakeOffscreenGLSurface(int width, int height) {
|
|
|
102
104
|
};
|
|
103
105
|
auto ctx = new OffscreenRenderContext({eglDisplay, eglSurface});
|
|
104
106
|
|
|
105
|
-
auto surface =
|
|
107
|
+
auto surface = SkSurfaces::WrapBackendRenderTarget(
|
|
106
108
|
grContext.get(), renderTarget, kBottomLeft_GrSurfaceOrigin,
|
|
107
109
|
kRGBA_8888_SkColorType, nullptr, nullptr,
|
|
108
110
|
[](void *addr) {
|
|
@@ -170,7 +172,7 @@ bool SkiaOpenGLRenderer::run(const std::function<void(SkCanvas *)> &cb,
|
|
|
170
172
|
|
|
171
173
|
SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
|
|
172
174
|
|
|
173
|
-
sk_sp<SkSurface> renderTarget(
|
|
175
|
+
sk_sp<SkSurface> renderTarget(SkSurfaces::WrapBackendRenderTarget(
|
|
174
176
|
getThreadDrawingContext()->skContext.get(), backendRT,
|
|
175
177
|
kBottomLeft_GrSurfaceOrigin, colorType, nullptr, &props));
|
|
176
178
|
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
#include "SkColorSpace.h"
|
|
21
21
|
#include "SkPicture.h"
|
|
22
22
|
#include "SkSurface.h"
|
|
23
|
+
|
|
24
|
+
#include "include/gpu/GrBackendSurface.h"
|
|
23
25
|
#include "include/gpu/GrDirectContext.h"
|
|
26
|
+
#include "include/gpu/ganesh/SkSurfaceGanesh.h"
|
|
24
27
|
#include "include/gpu/gl/GrGLInterface.h"
|
|
25
28
|
|
|
26
29
|
#pragma clang diagnostic pop
|
package/cpp/api/JsiSkImage.h
CHANGED
|
@@ -169,8 +169,8 @@ public:
|
|
|
169
169
|
auto tileW = arguments[4].asNumber();
|
|
170
170
|
auto tileH = arguments[5].asNumber();
|
|
171
171
|
SkISize size = SkISize::Make(tileW, tileH);
|
|
172
|
-
sk_sp<SkShader> gradient =
|
|
173
|
-
baseFreqX, baseFreqY, octaves, seed, &size);
|
|
172
|
+
sk_sp<SkShader> gradient =
|
|
173
|
+
SkShaders::MakeTurbulence(baseFreqX, baseFreqY, octaves, seed, &size);
|
|
174
174
|
return jsi::Object::createFromHostObject(
|
|
175
175
|
runtime,
|
|
176
176
|
std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
|
@@ -184,8 +184,8 @@ public:
|
|
|
184
184
|
auto tileW = arguments[4].asNumber();
|
|
185
185
|
auto tileH = arguments[5].asNumber();
|
|
186
186
|
SkISize size = SkISize::Make(tileW, tileH);
|
|
187
|
-
sk_sp<SkShader> gradient =
|
|
188
|
-
baseFreqX, baseFreqY, octaves, seed, &size);
|
|
187
|
+
sk_sp<SkShader> gradient =
|
|
188
|
+
SkShaders::MakeFractalNoise(baseFreqX, baseFreqY, octaves, seed, &size);
|
|
189
189
|
return jsi::Object::createFromHostObject(
|
|
190
190
|
runtime,
|
|
191
191
|
std::make_shared<JsiSkShader>(getContext(), std::move(gradient)));
|
package/cpp/api/JsiSkSurface.h
CHANGED
|
@@ -25,7 +25,8 @@ public:
|
|
|
25
25
|
JSI_HOST_FUNCTION(Make) {
|
|
26
26
|
auto width = static_cast<int>(arguments[0].asNumber());
|
|
27
27
|
auto height = static_cast<int>(arguments[1].asNumber());
|
|
28
|
-
auto
|
|
28
|
+
auto imageInfo = SkImageInfo::MakeN32Premul(width, height);
|
|
29
|
+
auto surface = SkSurfaces::Raster(imageInfo);
|
|
29
30
|
if (surface == nullptr) {
|
|
30
31
|
return jsi::Value::null();
|
|
31
32
|
}
|
package/cpp/rnskia/RNSkView.h
CHANGED
|
@@ -343,46 +343,26 @@ private:
|
|
|
343
343
|
}
|
|
344
344
|
auto onSizeObj = onSize.asObject(*runtime);
|
|
345
345
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
} else {
|
|
367
|
-
auto wVal = onSizeObj.getProperty(*runtime, "width");
|
|
368
|
-
auto hVal = onSizeObj.getProperty(*runtime, "height");
|
|
369
|
-
|
|
370
|
-
if (!wVal.isNumber() || !hVal.isNumber()) {
|
|
371
|
-
throw jsi::JSError(*runtime,
|
|
372
|
-
"Expected onSize property to be a mutable "
|
|
373
|
-
"Skia value of type SkSize.");
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
auto w = wVal.asNumber();
|
|
378
|
-
auto h = hVal.asNumber();
|
|
379
|
-
|
|
380
|
-
if (w != width || h != height) {
|
|
381
|
-
// Update
|
|
382
|
-
onSizeObj.setProperty(*runtime, "width", width);
|
|
383
|
-
onSizeObj.setProperty(*runtime, "height", height);
|
|
384
|
-
self->_onSize->set_current(*runtime, onSize);
|
|
385
|
-
}
|
|
346
|
+
auto wVal = onSizeObj.getProperty(*runtime, "width");
|
|
347
|
+
auto hVal = onSizeObj.getProperty(*runtime, "height");
|
|
348
|
+
|
|
349
|
+
if (!wVal.isNumber() || !hVal.isNumber()) {
|
|
350
|
+
throw jsi::JSError(*runtime,
|
|
351
|
+
"Expected onSize property to be a mutable "
|
|
352
|
+
"Skia value of type SkSize.");
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
auto w = wVal.asNumber();
|
|
357
|
+
auto h = hVal.asNumber();
|
|
358
|
+
|
|
359
|
+
if (w != width || h != height) {
|
|
360
|
+
// Update
|
|
361
|
+
auto newValue = jsi::Object(*runtime);
|
|
362
|
+
newValue.setProperty(*runtime, "width", width);
|
|
363
|
+
newValue.setProperty(*runtime, "height", height);
|
|
364
|
+
self->_onSize->set_current(*runtime,
|
|
365
|
+
jsi::Value(*runtime, newValue));
|
|
386
366
|
}
|
|
387
367
|
}
|
|
388
368
|
});
|
|
@@ -256,7 +256,7 @@ public:
|
|
|
256
256
|
SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
|
|
257
257
|
_tileHeightProp->value().getAsNumber());
|
|
258
258
|
|
|
259
|
-
context->getShaders()->push(
|
|
259
|
+
context->getShaders()->push(SkShaders::MakeTurbulence(
|
|
260
260
|
_freqXProp->value().getAsNumber(), _freqYProp->value().getAsNumber(),
|
|
261
261
|
_octavesProp->value().getAsNumber(), _seedProp->value().getAsNumber(),
|
|
262
262
|
&size));
|
|
@@ -274,7 +274,7 @@ public:
|
|
|
274
274
|
SkISize size = SkISize::Make(_tileWidthProp->value().getAsNumber(),
|
|
275
275
|
_tileHeightProp->value().getAsNumber());
|
|
276
276
|
|
|
277
|
-
context->getShaders()->push(
|
|
277
|
+
context->getShaders()->push(SkShaders::MakeFractalNoise(
|
|
278
278
|
_freqXProp->value().getAsNumber(), _freqYProp->value().getAsNumber(),
|
|
279
279
|
_octavesProp->value().getAsNumber(), _seedProp->value().getAsNumber(),
|
|
280
280
|
&size));
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#include <jsi/jsi.h>
|
|
12
12
|
|
|
13
13
|
#include "JsiSkHostObjects.h"
|
|
14
|
-
#include "
|
|
14
|
+
#include "JsiValue.h"
|
|
15
15
|
#include "RNSkPlatformContext.h"
|
|
16
16
|
|
|
17
17
|
namespace RNSkia {
|
|
@@ -29,8 +29,7 @@ public:
|
|
|
29
29
|
explicit RNSkReadonlyValue(
|
|
30
30
|
std::shared_ptr<RNSkPlatformContext> platformContext)
|
|
31
31
|
: JsiSkHostObject(platformContext),
|
|
32
|
-
_valueHolder(std::make_shared<RNJsi::
|
|
33
|
-
*platformContext->getJsRuntime())) {}
|
|
32
|
+
_valueHolder(std::make_shared<RNJsi::JsiValue>()) {}
|
|
34
33
|
|
|
35
34
|
virtual ~RNSkReadonlyValue() { invalidate(); }
|
|
36
35
|
|
|
@@ -107,7 +106,7 @@ public:
|
|
|
107
106
|
@param value Next value
|
|
108
107
|
*/
|
|
109
108
|
virtual void update(jsi::Runtime &runtime, const jsi::Value &value) {
|
|
110
|
-
auto equal = _valueHolder->
|
|
109
|
+
auto equal = _valueHolder->operator==(RNJsi::JsiValue(runtime, value));
|
|
111
110
|
if (!equal) {
|
|
112
111
|
_valueHolder->setCurrent(runtime, value);
|
|
113
112
|
notifyListeners(runtime);
|
|
@@ -127,14 +126,14 @@ public:
|
|
|
127
126
|
Returns the current value as a jsi::Value
|
|
128
127
|
*/
|
|
129
128
|
jsi::Value getCurrent(jsi::Runtime &runtime) {
|
|
130
|
-
return _valueHolder->
|
|
129
|
+
return _valueHolder->getAsJsiValue(runtime);
|
|
131
130
|
}
|
|
132
131
|
|
|
133
132
|
/**
|
|
134
133
|
Returns the underlying current value wrapper. This can be used to query the
|
|
135
134
|
holder for data type and get pointers to elements in the holder.
|
|
136
135
|
*/
|
|
137
|
-
std::shared_ptr<RNJsi::
|
|
136
|
+
std::shared_ptr<RNJsi::JsiValue> getCurrent() { return _valueHolder; }
|
|
138
137
|
|
|
139
138
|
protected:
|
|
140
139
|
/**
|
|
@@ -158,7 +157,7 @@ protected:
|
|
|
158
157
|
}
|
|
159
158
|
|
|
160
159
|
private:
|
|
161
|
-
std::shared_ptr<RNJsi::
|
|
160
|
+
std::shared_ptr<RNJsi::JsiValue> _valueHolder;
|
|
162
161
|
|
|
163
162
|
long _listenerId = 0;
|
|
164
163
|
std::unordered_map<long, std::function<void(jsi::Runtime &)>> _listeners;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkCanvasAndroid_DEFINED
|
|
9
|
+
#define SkCanvasAndroid_DEFINED
|
|
10
|
+
|
|
11
|
+
class SkCanvas;
|
|
12
|
+
struct SkIRect;
|
|
13
|
+
class GrBackendRenderTarget;
|
|
14
|
+
|
|
15
|
+
namespace skgpu::ganesh {
|
|
16
|
+
SkIRect TopLayerBounds(const SkCanvas*);
|
|
17
|
+
GrBackendRenderTarget TopLayerBackendRenderTarget(const SkCanvas*);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef SkHeifDecoder_DEFINED
|
|
8
|
+
#define SkHeifDecoder_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/codec/SkCodec.h"
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkData;
|
|
14
|
+
class SkStream;
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace SkHeifDecoder {
|
|
19
|
+
|
|
20
|
+
/** Returns true if this data claims to be a HEIF image. */
|
|
21
|
+
SK_API bool IsHeif(const void*, size_t);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attempts to decode the given bytes as a HEIF.
|
|
25
|
+
*
|
|
26
|
+
* If the bytes are not a HEIF, returns nullptr.
|
|
27
|
+
*
|
|
28
|
+
* DecodeContext is treated as a SkCodec::SelectionPolicy*
|
|
29
|
+
*/
|
|
30
|
+
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
|
|
31
|
+
SkCodec::Result*,
|
|
32
|
+
SkCodecs::DecodeContext = nullptr);
|
|
33
|
+
SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
|
|
34
|
+
SkCodec::Result*,
|
|
35
|
+
SkCodecs::DecodeContext = nullptr);
|
|
36
|
+
|
|
37
|
+
inline SkCodecs::Decoder Decoder() {
|
|
38
|
+
return { "heif", IsHeif, Decode };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace SkHeifDecoder
|
|
42
|
+
|
|
43
|
+
#endif // SkHeifDecoder_DEFINED
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
#ifndef SkSurfaceAndroid_DEFINED
|
|
9
|
+
#define SkSurfaceAndroid_DEFINED
|
|
10
|
+
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
#include "include/core/SkSurface.h"
|
|
13
|
+
#include "include/gpu/GrTypes.h"
|
|
14
|
+
|
|
15
|
+
class SkColorSpace;
|
|
16
|
+
class GrDirectContext;
|
|
17
|
+
class SkPixmap;
|
|
18
|
+
struct AHardwareBuffer;
|
|
19
|
+
|
|
20
|
+
namespace SkSurfaces {
|
|
21
|
+
|
|
22
|
+
/** Private; only to be used by Android Framework.
|
|
23
|
+
Creates SkSurface from Android hardware buffer.
|
|
24
|
+
Returned SkSurface takes a reference on the buffer. The ref on the buffer will be released
|
|
25
|
+
when the SkSurface is destroyed and there is no pending work on the GPU involving the
|
|
26
|
+
buffer.
|
|
27
|
+
|
|
28
|
+
Currently this is only supported for buffers that can be textured as well as rendered to.
|
|
29
|
+
In other words that must have both AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT and
|
|
30
|
+
AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE usage bits.
|
|
31
|
+
|
|
32
|
+
@param context GPU context
|
|
33
|
+
@param hardwareBuffer AHardwareBuffer Android hardware buffer
|
|
34
|
+
@param colorSpace range of colors; may be nullptr
|
|
35
|
+
@param surfaceProps LCD striping orientation and setting for device independent
|
|
36
|
+
fonts; may be nullptr
|
|
37
|
+
@param fromWindow Whether or not the AHardwareBuffer is part of an Android Window.
|
|
38
|
+
Currently only used with Vulkan backend.
|
|
39
|
+
@return created SkSurface, or nullptr
|
|
40
|
+
*/
|
|
41
|
+
SK_API sk_sp<SkSurface> WrapAndroidHardwareBuffer(GrDirectContext* context,
|
|
42
|
+
AHardwareBuffer* hardwareBuffer,
|
|
43
|
+
GrSurfaceOrigin origin,
|
|
44
|
+
sk_sp<SkColorSpace> colorSpace,
|
|
45
|
+
const SkSurfaceProps* surfaceProps,
|
|
46
|
+
bool fromWindow = false);
|
|
47
|
+
|
|
48
|
+
} // namespace SkSurfaces
|
|
49
|
+
|
|
50
|
+
#endif
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef SkAvifDecoder_DEFINED
|
|
8
|
+
#define SkAvifDecoder_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/codec/SkCodec.h"
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkData;
|
|
14
|
+
class SkStream;
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace SkAvifDecoder {
|
|
19
|
+
|
|
20
|
+
/** Returns true if this data claims to be a AVIF image. */
|
|
21
|
+
SK_API bool IsAvif(const void*, size_t);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attempts to decode the given bytes as a AVIF.
|
|
25
|
+
*
|
|
26
|
+
* If the bytes are not a AVIF, returns nullptr.
|
|
27
|
+
*
|
|
28
|
+
* DecodeContext is ignored
|
|
29
|
+
*/
|
|
30
|
+
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
|
|
31
|
+
SkCodec::Result*,
|
|
32
|
+
SkCodecs::DecodeContext = nullptr);
|
|
33
|
+
SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
|
|
34
|
+
SkCodec::Result*,
|
|
35
|
+
SkCodecs::DecodeContext = nullptr);
|
|
36
|
+
|
|
37
|
+
inline SkCodecs::Decoder Decoder() {
|
|
38
|
+
return { "avif", IsAvif, Decode };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace SkAvifDecoder
|
|
42
|
+
|
|
43
|
+
#endif // SkAvifDecoder_DEFINED
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef SkBmpDecoder_DEFINED
|
|
8
|
+
#define SkBmpDecoder_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/codec/SkCodec.h"
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkData;
|
|
14
|
+
class SkStream;
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace SkBmpDecoder {
|
|
19
|
+
|
|
20
|
+
/** Returns true if this data claims to be a BMP image. */
|
|
21
|
+
SK_API bool IsBmp(const void*, size_t);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attempts to decode the given bytes as a BMP.
|
|
25
|
+
*
|
|
26
|
+
* If the bytes are not a BMP, returns nullptr.
|
|
27
|
+
*
|
|
28
|
+
* DecodeContext is ignored
|
|
29
|
+
*/
|
|
30
|
+
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
|
|
31
|
+
SkCodec::Result*,
|
|
32
|
+
SkCodecs::DecodeContext = nullptr);
|
|
33
|
+
SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
|
|
34
|
+
SkCodec::Result*,
|
|
35
|
+
SkCodecs::DecodeContext = nullptr);
|
|
36
|
+
|
|
37
|
+
inline SkCodecs::Decoder Decoder() {
|
|
38
|
+
return { "bmp", IsBmp, Decode };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace SkBmpDecoder
|
|
42
|
+
|
|
43
|
+
#endif // SkBmpDecoder_DEFINED
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
#include <cstddef>
|
|
24
24
|
#include <functional>
|
|
25
25
|
#include <memory>
|
|
26
|
+
#include <string>
|
|
26
27
|
#include <tuple>
|
|
27
28
|
#include <vector>
|
|
28
29
|
|
|
@@ -41,7 +42,6 @@ enum class Blend;
|
|
|
41
42
|
enum class DisposalMethod;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
|
|
45
45
|
namespace DM {
|
|
46
46
|
class CodecSrc;
|
|
47
47
|
} // namespace DM
|
|
@@ -1012,4 +1012,28 @@ private:
|
|
|
1012
1012
|
friend class SkIcoCodec;
|
|
1013
1013
|
friend class SkAndroidCodec; // for fEncodedInfo
|
|
1014
1014
|
};
|
|
1015
|
+
|
|
1016
|
+
namespace SkCodecs {
|
|
1017
|
+
|
|
1018
|
+
using DecodeContext = void*;
|
|
1019
|
+
using IsFormatCallback = bool (*)(const void* data, size_t len);
|
|
1020
|
+
using MakeFromStreamCallback = std::unique_ptr<SkCodec> (*)(std::unique_ptr<SkStream>,
|
|
1021
|
+
SkCodec::Result*,
|
|
1022
|
+
DecodeContext);
|
|
1023
|
+
|
|
1024
|
+
struct Decoder {
|
|
1025
|
+
// By convention, we use all lowercase letters and go with the primary filename extension.
|
|
1026
|
+
// For example "png", "jpg", "ico", "webp", etc
|
|
1027
|
+
std::string id;
|
|
1028
|
+
IsFormatCallback isFormat;
|
|
1029
|
+
MakeFromStreamCallback makeFromStream;
|
|
1030
|
+
};
|
|
1031
|
+
|
|
1032
|
+
// Add the decoder to the end of a linked list of decoders, which will be used to identify calls to
|
|
1033
|
+
// SkCodec::MakeFromStream. If a decoder with the same id already exists, this new decoder
|
|
1034
|
+
// will replace the existing one (in the same position). This is not thread-safe, so make sure all
|
|
1035
|
+
// initialization is done before the first call.
|
|
1036
|
+
void Register(Decoder d);
|
|
1037
|
+
}
|
|
1038
|
+
|
|
1015
1039
|
#endif // SkCodec_DEFINED
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef SkGifDecoder_DEFINED
|
|
8
|
+
#define SkGifDecoder_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/codec/SkCodec.h"
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkData;
|
|
14
|
+
class SkStream;
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace SkGifDecoder {
|
|
19
|
+
|
|
20
|
+
/** Returns true if this data claims to be a GIF image. */
|
|
21
|
+
SK_API bool IsGif(const void*, size_t);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attempts to decode the given bytes as a GIF.
|
|
25
|
+
*
|
|
26
|
+
* If the bytes are not a GIF, returns nullptr.
|
|
27
|
+
*
|
|
28
|
+
* DecodeContext is ignored
|
|
29
|
+
*/
|
|
30
|
+
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
|
|
31
|
+
SkCodec::Result*,
|
|
32
|
+
SkCodecs::DecodeContext = nullptr);
|
|
33
|
+
SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
|
|
34
|
+
SkCodec::Result*,
|
|
35
|
+
SkCodecs::DecodeContext = nullptr);
|
|
36
|
+
|
|
37
|
+
inline SkCodecs::Decoder Decoder() {
|
|
38
|
+
return { "gif", IsGif, Decode };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace SkGifDecoder
|
|
42
|
+
|
|
43
|
+
#endif // SkGifDecoder_DEFINED
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Google LLC
|
|
3
|
+
*
|
|
4
|
+
* Use of this source code is governed by a BSD-style license that can be
|
|
5
|
+
* found in the LICENSE file.
|
|
6
|
+
*/
|
|
7
|
+
#ifndef SkIcoDecoder_DEFINED
|
|
8
|
+
#define SkIcoDecoder_DEFINED
|
|
9
|
+
|
|
10
|
+
#include "include/codec/SkCodec.h"
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
|
12
|
+
|
|
13
|
+
class SkData;
|
|
14
|
+
class SkStream;
|
|
15
|
+
|
|
16
|
+
#include <memory>
|
|
17
|
+
|
|
18
|
+
namespace SkIcoDecoder {
|
|
19
|
+
|
|
20
|
+
/** Returns true if this data claims to be a ICO image. */
|
|
21
|
+
SK_API bool IsIco(const void*, size_t);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Attempts to decode the given bytes as a ICO.
|
|
25
|
+
*
|
|
26
|
+
* If the bytes are not a ICO, returns nullptr.
|
|
27
|
+
*
|
|
28
|
+
* DecodeContext is ignored
|
|
29
|
+
*/
|
|
30
|
+
SK_API std::unique_ptr<SkCodec> Decode(std::unique_ptr<SkStream>,
|
|
31
|
+
SkCodec::Result*,
|
|
32
|
+
SkCodecs::DecodeContext = nullptr);
|
|
33
|
+
SK_API std::unique_ptr<SkCodec> Decode(sk_sp<SkData>,
|
|
34
|
+
SkCodec::Result*,
|
|
35
|
+
SkCodecs::DecodeContext = nullptr);
|
|
36
|
+
|
|
37
|
+
inline SkCodecs::Decoder Decoder() {
|
|
38
|
+
return { "ico", IsIco, Decode };
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
} // namespace SkIcoDecoder
|
|
42
|
+
|
|
43
|
+
#endif // SkIcoDecoder_DEFINED
|