@shopify/react-native-skia 0.1.192 → 0.1.193
Sign up to get free protection for your applications and to get access to all the features.
- package/android/CMakeLists.txt +1 -1
- package/android/build.gradle +1 -0
- package/android/cpp/jni/JniPlatformContext.cpp +1 -1
- package/cpp/api/JsiSkImage.h +25 -4
- package/cpp/api/JsiSkImageFactory.h +2 -2
- package/cpp/api/JsiSkPath.h +8 -6
- package/cpp/rnskia/dom/base/Declaration.h +5 -7
- package/cpp/rnskia/dom/nodes/JsiBlurMaskNode.h +1 -0
- package/cpp/rnskia/dom/nodes/JsiPathNode.h +2 -2
- package/cpp/rnskia/dom/props/BoxShadowProps.h +2 -0
- package/cpp/skia/include/android/SkAndroidFrameworkUtils.h +2 -8
- package/cpp/skia/include/android/SkImageAndroid.h +101 -0
- package/cpp/skia/include/codec/SkAndroidCodec.h +26 -8
- package/cpp/skia/include/codec/SkCodec.h +31 -17
- package/cpp/skia/include/codec/SkEncodedImageFormat.h +36 -0
- package/cpp/skia/include/codec/SkPixmapUtils.h +31 -0
- package/cpp/skia/include/config/SkUserConfig.h +61 -29
- package/cpp/skia/include/core/SkBitmap.h +25 -25
- package/cpp/skia/include/core/SkBlurTypes.h +0 -2
- package/cpp/skia/include/core/SkCanvas.h +32 -15
- package/cpp/skia/include/core/SkCapabilities.h +2 -2
- package/cpp/skia/include/core/SkColor.h +2 -0
- package/cpp/skia/include/core/SkColorPriv.h +19 -4
- package/cpp/skia/include/core/SkColorSpace.h +14 -17
- package/cpp/skia/include/core/SkColorType.h +1 -0
- package/cpp/skia/include/core/SkContourMeasure.h +1 -1
- package/cpp/skia/include/core/SkCoverageMode.h +0 -2
- package/cpp/skia/include/core/SkCubicMap.h +2 -0
- package/cpp/skia/include/core/SkData.h +5 -2
- package/cpp/skia/include/core/SkDataTable.h +6 -2
- package/cpp/skia/include/core/SkDeferredDisplayList.h +11 -10
- package/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +9 -8
- package/cpp/skia/include/core/SkDrawable.h +10 -2
- package/cpp/skia/include/core/SkEncodedImageFormat.h +3 -30
- package/cpp/skia/include/core/SkFlattenable.h +4 -2
- package/cpp/skia/include/core/SkFont.h +1 -0
- package/cpp/skia/include/core/SkFontMetrics.h +1 -0
- package/cpp/skia/include/core/SkFontMgr.h +20 -29
- package/cpp/skia/include/core/SkFontStyle.h +4 -1
- package/cpp/skia/include/core/SkGraphics.h +21 -18
- package/cpp/skia/include/core/SkICC.h +3 -13
- package/cpp/skia/include/core/SkImage.h +395 -717
- package/cpp/skia/include/core/SkImageGenerator.h +19 -74
- package/cpp/skia/include/core/SkImageInfo.h +7 -5
- package/cpp/skia/include/core/SkM44.h +11 -0
- package/cpp/skia/include/core/SkMaskFilter.h +6 -3
- package/cpp/skia/include/core/SkMatrix.h +14 -4
- package/cpp/skia/include/core/SkMesh.h +52 -18
- package/cpp/skia/include/core/SkMilestone.h +1 -1
- package/cpp/skia/include/core/SkPaint.h +11 -34
- package/cpp/skia/include/core/SkPath.h +23 -4
- package/cpp/skia/include/core/SkPathBuilder.h +13 -5
- package/cpp/skia/include/core/SkPathMeasure.h +1 -1
- package/cpp/skia/include/core/SkPathTypes.h +0 -2
- package/cpp/skia/include/core/SkPathUtils.h +42 -0
- package/cpp/skia/include/core/SkPicture.h +3 -2
- package/cpp/skia/include/core/SkPictureRecorder.h +2 -0
- package/cpp/skia/include/core/SkPixelRef.h +4 -8
- package/cpp/skia/include/core/SkPixmap.h +12 -20
- package/cpp/skia/include/core/SkPoint.h +4 -2
- package/cpp/skia/include/core/SkPromiseImageTexture.h +2 -2
- package/cpp/skia/include/core/SkRRect.h +5 -1
- package/cpp/skia/include/core/SkRect.h +6 -3
- package/cpp/skia/include/core/SkRefCnt.h +9 -14
- package/cpp/skia/include/core/SkRegion.h +1 -1
- package/cpp/skia/include/core/SkScalar.h +2 -4
- package/cpp/skia/include/core/SkSerialProcs.h +18 -10
- package/cpp/skia/include/core/SkShader.h +1 -64
- package/cpp/skia/include/core/SkSize.h +2 -0
- package/cpp/skia/include/core/SkSpan.h +4 -112
- package/cpp/skia/include/core/SkStream.h +11 -12
- package/cpp/skia/include/core/SkString.h +9 -25
- package/cpp/skia/include/core/SkStrokeRec.h +1 -1
- package/cpp/skia/include/core/SkSurface.h +83 -61
- package/cpp/skia/include/core/SkSurfaceCharacterization.h +3 -3
- package/cpp/skia/include/core/SkSurfaceProps.h +9 -1
- package/cpp/skia/include/core/SkTextBlob.h +2 -2
- package/cpp/skia/include/core/SkTextureCompressionType.h +30 -0
- package/cpp/skia/include/core/SkTime.h +1 -1
- package/cpp/skia/include/core/SkTypeface.h +9 -2
- package/cpp/skia/include/core/SkTypes.h +37 -466
- package/cpp/skia/include/core/SkVertices.h +2 -0
- package/cpp/skia/include/core/SkYUVAInfo.h +4 -0
- package/cpp/skia/include/core/SkYUVAPixmaps.h +7 -1
- package/cpp/skia/include/docs/SkPDFDocument.h +12 -1
- package/cpp/skia/include/effects/SkColorMatrix.h +2 -1
- package/cpp/skia/include/effects/SkGradientShader.h +65 -14
- package/cpp/skia/include/effects/SkImageFilters.h +0 -11
- package/cpp/skia/include/effects/SkRuntimeEffect.h +41 -11
- package/cpp/skia/include/encode/SkEncoder.h +7 -3
- package/cpp/skia/include/encode/SkICC.h +36 -0
- package/cpp/skia/include/encode/SkJpegEncoder.h +102 -71
- package/cpp/skia/include/encode/SkPngEncoder.h +89 -71
- package/cpp/skia/include/encode/SkWebpEncoder.h +65 -38
- package/cpp/skia/include/gpu/GpuTypes.h +23 -1
- package/cpp/skia/include/gpu/GrBackendSurface.h +9 -7
- package/cpp/skia/include/gpu/GrContextOptions.h +28 -9
- package/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +6 -4
- package/cpp/skia/include/gpu/GrDirectContext.h +84 -63
- package/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +2 -1
- package/cpp/skia/include/gpu/GrRecordingContext.h +9 -5
- package/cpp/skia/include/gpu/GrTypes.h +18 -18
- package/cpp/skia/include/gpu/d3d/GrD3DTypes.h +4 -4
- package/cpp/skia/include/gpu/dawn/GrDawnTypes.h +3 -3
- package/cpp/skia/include/gpu/ganesh/GrTextureGenerator.h +77 -0
- package/cpp/skia/include/gpu/ganesh/SkImageGanesh.h +385 -0
- package/cpp/skia/include/gpu/gl/GrGLExtensions.h +3 -3
- package/cpp/skia/include/gpu/gl/GrGLFunctions.h +1 -1
- package/cpp/skia/include/gpu/gl/GrGLInterface.h +0 -3
- package/cpp/skia/include/gpu/gl/GrGLTypes.h +2 -1
- package/cpp/skia/include/gpu/graphite/BackendTexture.h +72 -3
- package/cpp/skia/include/gpu/graphite/Context.h +85 -32
- package/cpp/skia/include/gpu/graphite/ContextOptions.h +15 -11
- package/cpp/skia/include/gpu/graphite/GraphiteTypes.h +55 -5
- package/cpp/skia/include/gpu/graphite/ImageProvider.h +6 -4
- package/cpp/skia/include/gpu/graphite/Recorder.h +41 -11
- package/cpp/skia/include/gpu/graphite/Recording.h +50 -3
- package/cpp/skia/include/gpu/graphite/TextureInfo.h +47 -8
- package/cpp/skia/include/gpu/graphite/YUVABackendTextures.h +139 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnTypes.h +40 -0
- package/cpp/skia/include/gpu/graphite/dawn/DawnUtils.h +28 -0
- package/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +1 -1
- package/cpp/skia/include/gpu/graphite/mtl/{MtlTypes.h → MtlGraphiteTypes.h} +7 -6
- package/cpp/skia/include/gpu/graphite/mtl/MtlGraphiteUtils.h +27 -0
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +4 -9
- package/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteUtils.h +28 -0
- package/cpp/skia/include/gpu/mock/GrMockTypes.h +17 -13
- package/cpp/skia/include/gpu/mtl/GrMtlTypes.h +2 -2
- package/cpp/skia/include/gpu/vk/GrVkBackendContext.h +1 -1
- package/cpp/skia/include/gpu/vk/GrVkTypes.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanExtensions.h +3 -3
- package/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +5 -7
- package/cpp/skia/include/pathops/SkPathOps.h +3 -3
- package/cpp/skia/include/ports/SkFontMgr_data.h +22 -0
- package/cpp/skia/include/ports/SkFontMgr_indirect.h +14 -14
- package/cpp/skia/include/ports/SkRemotableFontMgr.h +2 -2
- package/cpp/skia/include/ports/SkTypeface_win.h +2 -1
- package/cpp/skia/include/private/SkChecksum.h +32 -7
- package/cpp/skia/include/private/SkColorData.h +1 -26
- package/cpp/skia/include/private/SkGainmapInfo.h +97 -0
- package/cpp/skia/include/private/SkGainmapShader.h +53 -0
- package/cpp/skia/include/private/SkIDChangeListener.h +4 -3
- package/cpp/skia/include/private/SkJpegGainmapEncoder.h +71 -0
- package/cpp/skia/include/private/SkJpegMetadataDecoder.h +61 -0
- package/cpp/skia/include/private/SkOpts_spi.h +3 -1
- package/cpp/skia/include/private/SkPathRef.h +64 -47
- package/cpp/skia/include/private/SkSLDefines.h +5 -5
- package/cpp/skia/include/private/SkSLSampleUsage.h +0 -4
- package/cpp/skia/include/private/SkSpinlock.h +1 -1
- package/cpp/skia/include/private/SkWeakRefCnt.h +3 -0
- package/cpp/skia/include/private/{SingleOwner.h → base/SingleOwner.h} +8 -5
- package/cpp/skia/include/private/base/SkAPI.h +52 -0
- package/cpp/skia/include/private/base/SkAlign.h +39 -0
- package/cpp/skia/include/private/base/SkAlignedStorage.h +32 -0
- package/cpp/skia/include/private/base/SkAssert.h +92 -0
- package/cpp/skia/include/private/base/SkAttributes.h +102 -0
- package/cpp/skia/include/private/base/SkCPUTypes.h +25 -0
- package/cpp/skia/include/private/base/SkContainers.h +46 -0
- package/cpp/skia/include/private/base/SkDebug.h +27 -0
- package/cpp/skia/include/private/{SkDeque.h → base/SkDeque.h} +3 -1
- package/cpp/skia/include/private/base/SkFeatures.h +151 -0
- package/cpp/skia/include/private/{SkFixed.h → base/SkFixed.h} +9 -7
- package/cpp/skia/include/private/{SkFloatBits.h → base/SkFloatBits.h} +2 -3
- package/cpp/skia/include/private/{SkFloatingPoint.h → base/SkFloatingPoint.h} +18 -9
- package/cpp/skia/include/private/base/SkLoadUserConfig.h +63 -0
- package/cpp/skia/include/private/{SkMacros.h → base/SkMacros.h} +17 -2
- package/cpp/skia/include/private/{SkMalloc.h → base/SkMalloc.h} +4 -7
- package/cpp/skia/include/{core → private/base}/SkMath.h +25 -2
- package/cpp/skia/include/private/{SkMutex.h → base/SkMutex.h} +5 -5
- package/cpp/skia/include/private/{SkNoncopyable.h → base/SkNoncopyable.h} +2 -2
- package/cpp/skia/include/private/{SkOnce.h → base/SkOnce.h} +3 -1
- package/cpp/skia/include/private/base/SkPathEnums.h +25 -0
- package/cpp/skia/include/private/{SkSafe32.h → base/SkSafe32.h} +16 -1
- package/cpp/skia/include/private/{SkSemaphore.h → base/SkSemaphore.h} +4 -3
- package/cpp/skia/include/private/base/SkSpan_impl.h +129 -0
- package/cpp/skia/include/private/base/SkTArray.h +694 -0
- package/cpp/skia/include/private/{SkTDArray.h → base/SkTDArray.h} +17 -54
- package/cpp/skia/include/private/{SkTFitsIn.h → base/SkTFitsIn.h} +14 -8
- package/cpp/skia/include/private/{SkTLogic.h → base/SkTLogic.h} +1 -1
- package/cpp/skia/include/private/{SkTemplates.h → base/SkTemplates.h} +63 -88
- package/cpp/skia/include/private/{SkThreadID.h → base/SkThreadID.h} +5 -2
- package/cpp/skia/include/private/{SkTo.h → base/SkTo.h} +13 -2
- package/cpp/skia/include/private/base/SkTypeTraits.h +33 -0
- package/cpp/skia/include/private/chromium/GrVkSecondaryCBDrawContext.h +130 -0
- package/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +5 -9
- package/cpp/skia/include/private/chromium/SkDiscardableMemory.h +70 -0
- package/cpp/skia/include/private/chromium/Slug.h +0 -9
- package/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +2 -1
- package/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +3 -2
- package/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +1 -1
- package/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +17 -23
- package/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +2 -2
- package/cpp/skia/include/private/gpu/graphite/DawnTypesPriv.h +38 -0
- package/cpp/skia/include/private/gpu/graphite/{MtlTypesPriv.h → MtlGraphiteTypesPriv.h} +5 -5
- package/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +1 -9
- package/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +4 -0
- package/cpp/skia/include/utils/SkCamera.h +1 -1
- package/cpp/skia/include/utils/SkCustomTypeface.h +7 -1
- package/cpp/skia/include/utils/SkNWayCanvas.h +6 -6
- package/cpp/skia/include/utils/SkOrderedFontMgr.h +7 -6
- package/cpp/skia/include/utils/SkPaintFilterCanvas.h +2 -2
- package/cpp/skia/include/utils/SkParsePath.h +1 -1
- package/cpp/skia/modules/skcms/skcms.h +14 -0
- package/cpp/skia/modules/skcms/src/Transform_inl.h +19 -0
- package/cpp/skia/modules/skparagraph/include/FontCollection.h +2 -2
- package/cpp/skia/modules/skparagraph/include/Paragraph.h +72 -2
- package/cpp/skia/modules/skparagraph/include/ParagraphCache.h +1 -11
- package/cpp/skia/modules/skparagraph/include/ParagraphPainter.h +63 -0
- package/cpp/skia/modules/skparagraph/include/TextStyle.h +27 -4
- package/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +13 -13
- package/cpp/skia/modules/skresources/include/SkResources.h +18 -4
- package/cpp/skia/modules/svg/include/SkSVGAttribute.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGContainer.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGDOM.h +1 -1
- package/cpp/skia/modules/svg/include/SkSVGFilterContext.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGGradient.h +2 -2
- package/cpp/skia/modules/svg/include/SkSVGIDMapper.h +2 -2
- 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/SkSVGTypes.h +22 -21
- package/cpp/skia/modules/svg/include/SkSVGValue.h +1 -1
- package/cpp/skia/{include/private → src/core}/SkTHash.h +41 -37
- package/ios/RNSkia-iOS/ViewScreenshotService.mm +1 -1
- 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/libskshaper.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/libskshaper.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/libskshaper.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/libskshaper.a +0 -0
- package/libs/android/x86_64/libsvg.a +0 -0
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- 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/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/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 +1 -1
- package/react-native-skia.podspec +1 -1
- package/scripts/install-npm.js +11 -1
- package/cpp/skia/include/core/SkImageEncoder.h +0 -71
- package/cpp/skia/include/gpu/GrConfig.h +0 -53
- package/cpp/skia/include/gpu/graphite/CombinationBuilder.h +0 -195
- package/cpp/skia/include/private/SkHalf.h +0 -38
- package/cpp/skia/include/private/SkImageInfoPriv.h +0 -199
- package/cpp/skia/include/private/SkSLIRNode.h +0 -64
- package/cpp/skia/include/private/SkSLLayout.h +0 -144
- package/cpp/skia/include/private/SkSLModifiers.h +0 -178
- package/cpp/skia/include/private/SkSLProgramElement.h +0 -77
- package/cpp/skia/include/private/SkSLProgramKind.h +0 -35
- package/cpp/skia/include/private/SkSLStatement.h +0 -86
- package/cpp/skia/include/private/SkSLString.h +0 -41
- package/cpp/skia/include/private/SkSLSymbol.h +0 -94
- package/cpp/skia/include/private/SkSafe_math.h +0 -52
- package/cpp/skia/include/private/SkStringView.h +0 -51
- package/cpp/skia/include/private/SkTArray.h +0 -655
- package/cpp/skia/include/private/SkUniquePaintParamsID.h +0 -35
- package/cpp/skia/include/private/SkVx.h +0 -1026
- package/cpp/skia/include/sksl/DSL.h +0 -37
- package/cpp/skia/include/sksl/DSLBlock.h +0 -58
- package/cpp/skia/include/sksl/DSLCase.h +0 -62
- package/cpp/skia/include/sksl/DSLCore.h +0 -492
- package/cpp/skia/include/sksl/DSLExpression.h +0 -241
- package/cpp/skia/include/sksl/DSLFunction.h +0 -113
- package/cpp/skia/include/sksl/DSLLayout.h +0 -92
- package/cpp/skia/include/sksl/DSLModifiers.h +0 -69
- package/cpp/skia/include/sksl/DSLStatement.h +0 -82
- package/cpp/skia/include/sksl/DSLSymbols.h +0 -61
- package/cpp/skia/include/sksl/DSLType.h +0 -271
- package/cpp/skia/include/sksl/DSLVar.h +0 -231
- package/cpp/skia/include/sksl/SkSLErrorReporter.h +0 -65
- package/cpp/skia/include/sksl/SkSLOperator.h +0 -154
- package/cpp/skia/include/sksl/SkSLPosition.h +0 -104
- package/cpp/skia/include/utils/SkRandom.h +0 -169
- package/cpp/skia/src/core/SkLRUCache.h +0 -126
- package/cpp/skia/src/core/SkTInternalLList.h +0 -302
- /package/cpp/skia/include/{core → codec}/SkPngChunkReader.h +0 -0
- /package/cpp/skia/include/private/{SkTPin.h → base/SkTPin.h} +0 -0
- /package/cpp/skia/include/private/{SkThreadAnnotations.h → base/SkThreadAnnotations.h} +0 -0
package/android/CMakeLists.txt
CHANGED
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.4.1)
|
|
3
3
|
|
4
4
|
set (CMAKE_VERBOSE_MAKEFILE ON)
|
5
5
|
set (CMAKE_CXX_STANDARD 17)
|
6
|
-
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
|
6
|
+
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSK_GL -DSK_GANESH -DSK_BUILD_FOR_ANDROID -DFOLLY_NO_CONFIG=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -DFOLLY_HAVE_MEMRCHR=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_MOBILE=1 -DON_ANDROID -DONANDROID")
|
7
7
|
|
8
8
|
set (PACKAGE_NAME "rnskia")
|
9
9
|
set (SKIA_LIB "skia")
|
package/android/build.gradle
CHANGED
@@ -101,7 +101,7 @@ sk_sp<SkImage> JniPlatformContext::takeScreenshotFromViewTag(size_t tag) {
|
|
101
101
|
// Create pixmap from pixels and make a copy of it so that
|
102
102
|
// the SkImage owns its own pixels
|
103
103
|
SkPixmap pm(skInfo, pixels, bmi.stride);
|
104
|
-
auto skImage =
|
104
|
+
auto skImage = SkImages::RasterFromPixmapCopy(pm);
|
105
105
|
|
106
106
|
// Unlock pixels
|
107
107
|
AndroidBitmap_unlockPixels(env, bitmap);
|
package/cpp/api/JsiSkImage.h
CHANGED
@@ -14,7 +14,9 @@
|
|
14
14
|
#include "SkBase64.h"
|
15
15
|
#include "SkImage.h"
|
16
16
|
#include "SkStream.h"
|
17
|
-
#include
|
17
|
+
#include "codec/SkEncodedImageFormat.h"
|
18
|
+
#include "include/encode/SkJpegEncoder.h"
|
19
|
+
#include "include/encode/SkPngEncoder.h"
|
18
20
|
|
19
21
|
#pragma clang diagnostic pop
|
20
22
|
|
@@ -70,7 +72,15 @@ public:
|
|
70
72
|
auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
|
71
73
|
|
72
74
|
// Get data
|
73
|
-
|
75
|
+
sk_sp<SkData> data;
|
76
|
+
if (format == SkEncodedImageFormat::kJPEG) {
|
77
|
+
SkJpegEncoder::Options options;
|
78
|
+
options.fQuality = quality;
|
79
|
+
data = SkJpegEncoder::Encode(nullptr, getObject().get(), options);
|
80
|
+
} else {
|
81
|
+
SkPngEncoder::Options options;
|
82
|
+
data = SkPngEncoder::Encode(nullptr, getObject().get(), options);
|
83
|
+
}
|
74
84
|
auto arrayCtor =
|
75
85
|
runtime.global().getPropertyAsFunction(runtime, "Uint8Array");
|
76
86
|
size_t size = data->size();
|
@@ -95,8 +105,19 @@ public:
|
|
95
105
|
: SkEncodedImageFormat::kPNG;
|
96
106
|
|
97
107
|
auto quality = count == 2 ? arguments[1].asNumber() : 100.0;
|
98
|
-
|
99
|
-
|
108
|
+
auto image = getObject();
|
109
|
+
if (image->isTextureBacked()) {
|
110
|
+
image = image->makeNonTextureImage();
|
111
|
+
}
|
112
|
+
sk_sp<SkData> data;
|
113
|
+
if (format == SkEncodedImageFormat::kJPEG) {
|
114
|
+
SkJpegEncoder::Options options;
|
115
|
+
options.fQuality = quality;
|
116
|
+
data = SkJpegEncoder::Encode(nullptr, image.get(), options);
|
117
|
+
} else {
|
118
|
+
SkPngEncoder::Options options;
|
119
|
+
data = SkPngEncoder::Encode(nullptr, image.get(), options);
|
120
|
+
}
|
100
121
|
auto len = SkBase64::Encode(data->bytes(), data->size(), nullptr);
|
101
122
|
auto buffer = std::string(len, 0);
|
102
123
|
SkBase64::Encode(data->bytes(), data->size(),
|
@@ -18,7 +18,7 @@ class JsiSkImageFactory : public JsiSkHostObject {
|
|
18
18
|
public:
|
19
19
|
JSI_HOST_FUNCTION(MakeImageFromEncoded) {
|
20
20
|
auto data = JsiSkData::fromValue(runtime, arguments[0]);
|
21
|
-
auto image =
|
21
|
+
auto image = SkImages::DeferredFromEncodedData(data);
|
22
22
|
if (image == nullptr) {
|
23
23
|
return jsi::Value::null();
|
24
24
|
}
|
@@ -30,7 +30,7 @@ public:
|
|
30
30
|
auto imageInfo = JsiSkImageInfo::fromValue(runtime, arguments[0]);
|
31
31
|
auto pixelData = JsiSkData::fromValue(runtime, arguments[1]);
|
32
32
|
auto bytesPerRow = arguments[2].asNumber();
|
33
|
-
auto image =
|
33
|
+
auto image = SkImages::RasterFromData(*imageInfo, pixelData, bytesPerRow);
|
34
34
|
if (image == nullptr) {
|
35
35
|
return jsi::Value::null();
|
36
36
|
}
|
package/cpp/api/JsiSkPath.h
CHANGED
@@ -7,6 +7,7 @@
|
|
7
7
|
#include <jsi/jsi.h>
|
8
8
|
|
9
9
|
#include "JsiSkHostObjects.h"
|
10
|
+
#include "JsiSkMatrix.h"
|
10
11
|
#include "JsiSkPoint.h"
|
11
12
|
#include "JsiSkRRect.h"
|
12
13
|
#include "JsiSkRect.h"
|
@@ -20,13 +21,12 @@
|
|
20
21
|
#include "SkPathEffect.h"
|
21
22
|
#include "SkPathOps.h"
|
22
23
|
#include "SkPathTypes.h"
|
24
|
+
#include "SkPathUtils.h"
|
23
25
|
#include "SkString.h"
|
24
26
|
#include "SkStrokeRec.h"
|
25
27
|
#include "SkTextUtils.h"
|
26
28
|
#include "SkTrimPathEffect.h"
|
27
29
|
|
28
|
-
#include "JsiSkMatrix.h"
|
29
|
-
|
30
30
|
#pragma clang diagnostic pop
|
31
31
|
|
32
32
|
namespace RNSkia {
|
@@ -284,8 +284,11 @@ public:
|
|
284
284
|
|
285
285
|
auto jsiPrecision = opts.getProperty(runtime, "precision");
|
286
286
|
auto precision = jsiPrecision.isUndefined() ? 1 : jsiPrecision.asNumber();
|
287
|
-
auto result =
|
288
|
-
|
287
|
+
auto result =
|
288
|
+
skpathutils::FillPathWithPaint(path, p, &path, nullptr, precision);
|
289
|
+
if (result) {
|
290
|
+
getObject()->swap(path);
|
291
|
+
}
|
289
292
|
return result ? thisValue.getObject(runtime) : jsi::Value::null();
|
290
293
|
}
|
291
294
|
|
@@ -320,8 +323,7 @@ public:
|
|
320
323
|
|
321
324
|
JSI_HOST_FUNCTION(toSVGString) {
|
322
325
|
SkPath path = *getObject();
|
323
|
-
|
324
|
-
SkParsePath::ToSVGString(path, &s);
|
326
|
+
auto s = SkParsePath::ToSVGString(path);
|
325
327
|
return jsi::String::createFromUtf8(runtime, s.c_str());
|
326
328
|
}
|
327
329
|
|
@@ -24,17 +24,15 @@ public:
|
|
24
24
|
void push(T el) { _elements.push(el); }
|
25
25
|
|
26
26
|
// Clears and returns all elements
|
27
|
-
std::vector<T> popAll() {
|
28
|
-
|
29
|
-
// Pops the number of items up to limit
|
30
|
-
std::vector<T> popMultiple(size_t limit) {
|
31
|
-
auto size = std::min(limit, _elements.size());
|
27
|
+
std::vector<T> popAll() {
|
28
|
+
auto size = _elements.size();
|
32
29
|
std::vector<T> tmp;
|
33
30
|
tmp.reserve(size);
|
34
31
|
for (size_t i = 0; i < size; ++i) {
|
35
32
|
tmp.push_back(_elements.top());
|
36
33
|
_elements.pop();
|
37
34
|
}
|
35
|
+
std::reverse(std::begin(tmp), std::end(tmp));
|
38
36
|
return tmp;
|
39
37
|
}
|
40
38
|
|
@@ -50,7 +48,7 @@ public:
|
|
50
48
|
// Clears and returns through reducer function in reversed order
|
51
49
|
T popAsOne(std::function<T(T inner, T outer)> composer) {
|
52
50
|
auto tmp = popAll();
|
53
|
-
|
51
|
+
std::reverse(std::begin(tmp), std::end(tmp));
|
54
52
|
return std::accumulate(std::begin(tmp), std::end(tmp),
|
55
53
|
static_cast<T>(nullptr), [=](T inner, T outer) {
|
56
54
|
if (inner == nullptr) {
|
@@ -63,7 +61,7 @@ public:
|
|
63
61
|
// Returns the size of the elements
|
64
62
|
size_t size() { return _elements.size(); }
|
65
63
|
|
66
|
-
|
64
|
+
private:
|
67
65
|
std::stack<T> _elements;
|
68
66
|
};
|
69
67
|
|
@@ -108,8 +108,8 @@ protected:
|
|
108
108
|
// _path is const so we can't mutate it directly, let's replace the
|
109
109
|
// path like this:
|
110
110
|
auto p = std::make_shared<SkPath>(*_path.get());
|
111
|
-
if (!
|
112
|
-
|
111
|
+
if (!skpathutils::FillPathWithPaint(*_path.get(), strokePaint,
|
112
|
+
p.get(), nullptr, precision)) {
|
113
113
|
_path = nullptr;
|
114
114
|
} else {
|
115
115
|
_path = std::const_pointer_cast<const SkPath>(p);
|
@@ -27,7 +27,7 @@ class SkShader;
|
|
27
27
|
class SkAndroidFrameworkUtils {
|
28
28
|
public:
|
29
29
|
|
30
|
-
#if
|
30
|
+
#if defined(SK_GANESH)
|
31
31
|
/**
|
32
32
|
* clipWithStencil draws the current clip into a stencil buffer with reference value and mask
|
33
33
|
* set to 0x1. This function works only on a GPU canvas.
|
@@ -37,7 +37,7 @@ public:
|
|
37
37
|
* @return true on success or false if clip is empty or not a GPU canvas.
|
38
38
|
*/
|
39
39
|
static bool clipWithStencil(SkCanvas* canvas);
|
40
|
-
#endif //
|
40
|
+
#endif //defined(SK_GANESH)
|
41
41
|
|
42
42
|
static void SafetyNetLog(const char*);
|
43
43
|
|
@@ -58,12 +58,6 @@ public:
|
|
58
58
|
*/
|
59
59
|
static SkCanvas* getBaseWrappedCanvas(SkCanvas* canvas);
|
60
60
|
|
61
|
-
/**
|
62
|
-
* Skia will change the order in which local matrices concatenate. In order to not break Android
|
63
|
-
* apps targeting older API levels we offer this function to use the legacy concatenation order.
|
64
|
-
*/
|
65
|
-
static void UseLegacyLocalMatrixConcatenation();
|
66
|
-
|
67
61
|
/**
|
68
62
|
* If the shader represents a linear gradient ShaderAsALinearGradient
|
69
63
|
* returns true and if info is not null, ShaderAsALinearGradient populates
|
@@ -0,0 +1,101 @@
|
|
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 SkImageAndroid_DEFINED
|
9
|
+
#define SkImageAndroid_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkImage.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/gpu/GrTypes.h"
|
14
|
+
|
15
|
+
class SkColorSpace;
|
16
|
+
class GrDirectContext;
|
17
|
+
class SkPixmap;
|
18
|
+
struct AHardwareBuffer;
|
19
|
+
|
20
|
+
namespace SkImages {
|
21
|
+
|
22
|
+
/** (See Skia bug 7447)
|
23
|
+
Creates SkImage from Android hardware buffer.
|
24
|
+
Returned SkImage takes a reference on the buffer.
|
25
|
+
Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
|
26
|
+
@param hardwareBuffer AHardwareBuffer Android hardware buffer
|
27
|
+
@param colorSpace range of colors; may be nullptr
|
28
|
+
@return created SkImage, or nullptr
|
29
|
+
*/
|
30
|
+
SK_API sk_sp<SkImage> DeferredFromAHardwareBuffer(AHardwareBuffer* hardwareBuffer,
|
31
|
+
SkAlphaType alphaType = kPremul_SkAlphaType);
|
32
|
+
SK_API sk_sp<SkImage> DeferredFromAHardwareBuffer(
|
33
|
+
AHardwareBuffer* hardwareBuffer,
|
34
|
+
SkAlphaType alphaType,
|
35
|
+
sk_sp<SkColorSpace> colorSpace,
|
36
|
+
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
|
37
|
+
|
38
|
+
/** Creates SkImage from Android hardware buffer and uploads the data from the SkPixmap to it.
|
39
|
+
Returned SkImage takes a reference on the buffer.
|
40
|
+
Only available on Android, when __ANDROID_API__ is defined to be 26 or greater.
|
41
|
+
@param context GPU context
|
42
|
+
@param pixmap SkPixmap that contains data to be uploaded to the AHardwareBuffer
|
43
|
+
@param hardwareBuffer AHardwareBuffer Android hardware buffer
|
44
|
+
@param surfaceOrigin surface origin for resulting image
|
45
|
+
@return created SkImage, or nullptr
|
46
|
+
*/
|
47
|
+
SK_API sk_sp<SkImage> TextureFromAHardwareBufferWithData(
|
48
|
+
GrDirectContext* context,
|
49
|
+
const SkPixmap& pixmap,
|
50
|
+
AHardwareBuffer* hardwareBuffer,
|
51
|
+
GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin);
|
52
|
+
|
53
|
+
/**
|
54
|
+
* Like SkImagePriv::SkMakeImageFromRasterBitmap, except this can be pinned using
|
55
|
+
* skgpu::ganesh::PinAsTexture and CopyPixelMode is never.
|
56
|
+
*/
|
57
|
+
SK_API sk_sp<SkImage> PinnableRasterFromBitmap(const SkBitmap&);
|
58
|
+
|
59
|
+
} // namespace SkImages
|
60
|
+
|
61
|
+
// TODO(kjlubick) remove this after Android has been ported.
|
62
|
+
namespace sk_image_factory {
|
63
|
+
inline sk_sp<SkImage> MakePinnableFromRasterBitmap(const SkBitmap& b) {
|
64
|
+
return SkImages::PinnableRasterFromBitmap(b);
|
65
|
+
}
|
66
|
+
} // namespace sk_image_factory
|
67
|
+
|
68
|
+
namespace skgpu::ganesh {
|
69
|
+
/**
|
70
|
+
* Will attempt to upload and lock the contents of the image as a texture, so that subsequent
|
71
|
+
* draws to a gpu-target will come from that texture (and not by looking at the original image
|
72
|
+
* src). In particular this is intended to use the texture even if the image's original content
|
73
|
+
* changes subsequent to this call (i.e. the src is mutable!).
|
74
|
+
*
|
75
|
+
* Only compatible with SkImages created from SkImages::PinnableRasterFromBitmap.
|
76
|
+
*
|
77
|
+
* All successful calls must be balanced by an equal number of calls to UnpinTexture().
|
78
|
+
*
|
79
|
+
* Once in this "pinned" state, the image has all of the same thread restrictions that exist
|
80
|
+
* for a natively created gpu image (e.g. SkImage::MakeFromTexture)
|
81
|
+
* - all drawing, pinning, unpinning must happen in the same thread as the GrContext.
|
82
|
+
*
|
83
|
+
* @return true if the image was successfully uploaded and locked into a texture
|
84
|
+
*/
|
85
|
+
bool PinAsTexture(GrRecordingContext*, SkImage*);
|
86
|
+
|
87
|
+
/**
|
88
|
+
* The balancing call to a successful invocation of PinAsTexture. When a balanced
|
89
|
+
* number of calls have been made, then the "pinned" texture is free to be purged, etc. This
|
90
|
+
* also means that a subsequent "pin" call will look at the original content again, and if
|
91
|
+
* its uniqueID/generationID has changed, then a newer texture will be uploaded/pinned.
|
92
|
+
*
|
93
|
+
* Only compatible with SkImages created from SkImages::PinnableRasterFromBitmap.
|
94
|
+
*
|
95
|
+
* The context passed to unpin must match the one passed to pin.
|
96
|
+
*/
|
97
|
+
void UnpinTexture(GrRecordingContext*, SkImage*);
|
98
|
+
|
99
|
+
} // namespace skgpu::ganesh
|
100
|
+
|
101
|
+
#endif
|
@@ -9,24 +9,27 @@
|
|
9
9
|
#define SkAndroidCodec_DEFINED
|
10
10
|
|
11
11
|
#include "include/codec/SkCodec.h"
|
12
|
-
#include "include/core/SkAlphaType.h"
|
13
12
|
#include "include/core/SkColorSpace.h"
|
14
|
-
#include "include/core/SkColorType.h"
|
15
|
-
#include "include/core/SkEncodedImageFormat.h"
|
16
13
|
#include "include/core/SkImageInfo.h"
|
17
14
|
#include "include/core/SkRefCnt.h"
|
18
15
|
#include "include/core/SkSize.h"
|
19
16
|
#include "include/core/SkTypes.h"
|
20
17
|
#include "include/private/SkEncodedInfo.h"
|
21
|
-
#include "include/private/SkNoncopyable.h"
|
18
|
+
#include "include/private/base/SkNoncopyable.h"
|
22
19
|
#include "modules/skcms/skcms.h"
|
23
20
|
|
21
|
+
// TODO(kjlubick, bungeman) Replace these includes with forward declares
|
22
|
+
#include "include/codec/SkEncodedImageFormat.h" // IWYU pragma: keep
|
23
|
+
#include "include/core/SkAlphaType.h" // IWYU pragma: keep
|
24
|
+
#include "include/core/SkColorType.h" // IWYU pragma: keep
|
25
|
+
|
24
26
|
#include <cstddef>
|
25
27
|
#include <memory>
|
26
28
|
|
27
29
|
class SkData;
|
28
30
|
class SkPngChunkReader;
|
29
31
|
class SkStream;
|
32
|
+
struct SkGainmapInfo;
|
30
33
|
struct SkIRect;
|
31
34
|
|
32
35
|
/**
|
@@ -118,10 +121,8 @@ public:
|
|
118
121
|
/**
|
119
122
|
* @param outputColorType Color type that the client will decode to.
|
120
123
|
* @param prefColorSpace Preferred color space to decode to.
|
121
|
-
* This may not return |prefColorSpace| for
|
122
|
-
*
|
123
|
-
* linear sRGB, transfer function must be parametric.
|
124
|
-
* (2) Codec Limitations: F16 requires a linear color space.
|
124
|
+
* This may not return |prefColorSpace| for
|
125
|
+
* specific color types.
|
125
126
|
*
|
126
127
|
* Returns the appropriate color space to decode to.
|
127
128
|
*/
|
@@ -262,6 +263,23 @@ public:
|
|
262
263
|
|
263
264
|
SkCodec* codec() const { return fCodec.get(); }
|
264
265
|
|
266
|
+
/**
|
267
|
+
* Retrieve the gainmap for an image.
|
268
|
+
*
|
269
|
+
* @param outInfo On success, this is populated with the parameters for
|
270
|
+
* rendering this gainmap. This parameter must be non-nullptr.
|
271
|
+
*
|
272
|
+
* @param outGainmapImageStream On success, this is populated with a stream from which the
|
273
|
+
* gainmap image may be decoded. This parameter is optional, and
|
274
|
+
* may be set to nullptr.
|
275
|
+
*
|
276
|
+
* @return If this has a gainmap image and that gainmap image was
|
277
|
+
* successfully extracted then return true. Otherwise return
|
278
|
+
* false.
|
279
|
+
*/
|
280
|
+
bool getAndroidGainmap(SkGainmapInfo* outInfo,
|
281
|
+
std::unique_ptr<SkStream>* outGainmapImageStream);
|
282
|
+
|
265
283
|
protected:
|
266
284
|
SkAndroidCodec(SkCodec*);
|
267
285
|
|
@@ -8,10 +8,7 @@
|
|
8
8
|
#ifndef SkCodec_DEFINED
|
9
9
|
#define SkCodec_DEFINED
|
10
10
|
|
11
|
-
#include "include/codec/SkCodecAnimation.h"
|
12
11
|
#include "include/codec/SkEncodedOrigin.h"
|
13
|
-
#include "include/core/SkAlphaType.h"
|
14
|
-
#include "include/core/SkEncodedImageFormat.h"
|
15
12
|
#include "include/core/SkImageInfo.h"
|
16
13
|
#include "include/core/SkPixmap.h"
|
17
14
|
#include "include/core/SkRect.h"
|
@@ -20,21 +17,30 @@
|
|
20
17
|
#include "include/core/SkTypes.h"
|
21
18
|
#include "include/core/SkYUVAPixmaps.h"
|
22
19
|
#include "include/private/SkEncodedInfo.h"
|
23
|
-
#include "include/private/SkNoncopyable.h"
|
20
|
+
#include "include/private/base/SkNoncopyable.h"
|
24
21
|
#include "modules/skcms/skcms.h"
|
25
22
|
|
26
23
|
#include <cstddef>
|
24
|
+
#include <functional>
|
27
25
|
#include <memory>
|
28
26
|
#include <tuple>
|
29
27
|
#include <vector>
|
30
28
|
|
31
|
-
class SkAndroidCodec;
|
32
29
|
class SkData;
|
33
30
|
class SkFrameHolder;
|
34
31
|
class SkImage;
|
35
32
|
class SkPngChunkReader;
|
36
33
|
class SkSampler;
|
37
34
|
class SkStream;
|
35
|
+
struct SkGainmapInfo;
|
36
|
+
enum SkAlphaType : int;
|
37
|
+
enum class SkEncodedImageFormat;
|
38
|
+
|
39
|
+
namespace SkCodecAnimation {
|
40
|
+
enum class Blend;
|
41
|
+
enum class DisposalMethod;
|
42
|
+
}
|
43
|
+
|
38
44
|
|
39
45
|
namespace DM {
|
40
46
|
class CodecSrc;
|
@@ -767,6 +773,8 @@ protected:
|
|
767
773
|
return fSrcXformFormat;
|
768
774
|
}
|
769
775
|
|
776
|
+
virtual bool onGetGainmapInfo(SkGainmapInfo*, std::unique_ptr<SkStream>*) { return false; }
|
777
|
+
|
770
778
|
virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const {
|
771
779
|
// By default, scaling is not supported.
|
772
780
|
return this->dimensions();
|
@@ -887,8 +895,8 @@ private:
|
|
887
895
|
const SkEncodedInfo fEncodedInfo;
|
888
896
|
XformFormat fSrcXformFormat;
|
889
897
|
std::unique_ptr<SkStream> fStream;
|
890
|
-
bool
|
891
|
-
const SkEncodedOrigin
|
898
|
+
bool fNeedsRewind = false;
|
899
|
+
const SkEncodedOrigin fOrigin;
|
892
900
|
|
893
901
|
SkImageInfo fDstInfo;
|
894
902
|
Options fOptions;
|
@@ -904,13 +912,13 @@ private:
|
|
904
912
|
skcms_AlphaFormat fDstXformAlphaFormat;
|
905
913
|
|
906
914
|
// Only meaningful during scanline decodes.
|
907
|
-
int
|
915
|
+
int fCurrScanline = -1;
|
908
916
|
|
909
|
-
bool
|
917
|
+
bool fStartedIncrementalDecode = false;
|
910
918
|
|
911
919
|
// Allows SkAndroidCodec to call handleFrameIndex (potentially decoding a prior frame and
|
912
|
-
// clearing to transparent) without SkCodec calling it, too.
|
913
|
-
bool
|
920
|
+
// clearing to transparent) without SkCodec itself calling it, too.
|
921
|
+
bool fUsingCallbackForHandleFrameIndex = false;
|
914
922
|
|
915
923
|
bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha, bool srcIsOpaque);
|
916
924
|
|
@@ -934,17 +942,23 @@ private:
|
|
934
942
|
return nullptr;
|
935
943
|
}
|
936
944
|
|
945
|
+
// Callback for decoding a prior frame. The `Options::fFrameIndex` is ignored,
|
946
|
+
// being replaced by frameIndex. This allows opts to actually be a subclass of
|
947
|
+
// SkCodec::Options which SkCodec itself does not know how to copy or modify,
|
948
|
+
// but just passes through to the caller (where it can be reinterpret_cast'd).
|
949
|
+
using GetPixelsCallback = std::function<Result(const SkImageInfo&, void* pixels,
|
950
|
+
size_t rowBytes, const Options& opts,
|
951
|
+
int frameIndex)>;
|
952
|
+
|
937
953
|
/**
|
938
954
|
* Check for a valid Options.fFrameIndex, and decode prior frames if necessary.
|
939
955
|
*
|
940
|
-
*
|
941
|
-
*
|
942
|
-
*
|
943
|
-
* handleFrameIndex, it will immediately return kSuccess, since SkAndroidCodec already handled
|
944
|
-
* it.
|
956
|
+
* If GetPixelsCallback is not null, it will be used to decode a prior frame instead
|
957
|
+
* of using this SkCodec directly. It may also be used recursively, if that in turn
|
958
|
+
* depends on a prior frame. This is used by SkAndroidCodec.
|
945
959
|
*/
|
946
960
|
Result handleFrameIndex(const SkImageInfo&, void* pixels, size_t rowBytes, const Options&,
|
947
|
-
|
961
|
+
GetPixelsCallback = nullptr);
|
948
962
|
|
949
963
|
// Methods for scanline decoding.
|
950
964
|
virtual Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/,
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright 2015 Google Inc.
|
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 SkEncodedImageFormat_DEFINED
|
9
|
+
#define SkEncodedImageFormat_DEFINED
|
10
|
+
|
11
|
+
#include <stdint.h>
|
12
|
+
|
13
|
+
/**
|
14
|
+
* Enum describing format of encoded data.
|
15
|
+
*/
|
16
|
+
enum class SkEncodedImageFormat {
|
17
|
+
#ifdef SK_BUILD_FOR_GOOGLE3
|
18
|
+
kUnknown,
|
19
|
+
#endif
|
20
|
+
kBMP,
|
21
|
+
kGIF,
|
22
|
+
kICO,
|
23
|
+
kJPEG,
|
24
|
+
kPNG,
|
25
|
+
kWBMP,
|
26
|
+
kWEBP,
|
27
|
+
kPKM,
|
28
|
+
kKTX,
|
29
|
+
kASTC,
|
30
|
+
kDNG,
|
31
|
+
kHEIF,
|
32
|
+
kAVIF,
|
33
|
+
kJPEGXL,
|
34
|
+
};
|
35
|
+
|
36
|
+
#endif // SkEncodedImageFormat_DEFINED
|
@@ -0,0 +1,31 @@
|
|
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 SkPixmapUtils_DEFINED
|
9
|
+
#define SkPixmapUtils_DEFINED
|
10
|
+
|
11
|
+
#include "include/codec/SkEncodedOrigin.h"
|
12
|
+
#include "include/core/SkImageInfo.h"
|
13
|
+
#include "include/private/base/SkAPI.h"
|
14
|
+
|
15
|
+
class SkPixmap;
|
16
|
+
|
17
|
+
namespace SkPixmapUtils {
|
18
|
+
/**
|
19
|
+
* Copy the pixels in src into dst, applying the orientation transformations specified
|
20
|
+
* by origin. If the inputs are invalid, this returns false and no copy is made.
|
21
|
+
*/
|
22
|
+
SK_API bool Orient(const SkPixmap& dst, const SkPixmap& src, SkEncodedOrigin origin);
|
23
|
+
|
24
|
+
/**
|
25
|
+
* Return a copy of the provided ImageInfo with the width and height swapped.
|
26
|
+
*/
|
27
|
+
SK_API SkImageInfo SwapWidthHeight(const SkImageInfo& info);
|
28
|
+
|
29
|
+
} // namespace SkPixmapUtils
|
30
|
+
|
31
|
+
#endif // SkPixmapUtils_DEFINED
|