@shopify/react-native-skia 0.1.192 → 0.1.194
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/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +104 -103
- 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/base/JsiDomDrawingNode.h +3 -1
- 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/RNSkMetalCanvasProvider.mm +1 -2
- 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
@@ -0,0 +1,385 @@
|
|
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 SkImageGanesh_DEFINED
|
9
|
+
#define SkImageGanesh_DEFINED
|
10
|
+
|
11
|
+
#include "include/core/SkImage.h"
|
12
|
+
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/gpu/GpuTypes.h"
|
14
|
+
#include "include/gpu/GrTypes.h"
|
15
|
+
#include "include/private/base/SkAPI.h"
|
16
|
+
|
17
|
+
#include <functional>
|
18
|
+
#include <utility>
|
19
|
+
|
20
|
+
class GrBackendFormat;
|
21
|
+
class GrBackendTexture;
|
22
|
+
class GrContextThreadSafeProxy;
|
23
|
+
class GrDirectContext;
|
24
|
+
class GrRecordingContext;
|
25
|
+
class GrYUVABackendTextureInfo;
|
26
|
+
class GrYUVABackendTextures;
|
27
|
+
class SkColorSpace;
|
28
|
+
class SkData;
|
29
|
+
class SkPixmap;
|
30
|
+
class SkPromiseImageTexture;
|
31
|
+
class SkYUVAPixmaps;
|
32
|
+
enum SkAlphaType : int;
|
33
|
+
enum SkColorType : int;
|
34
|
+
enum class SkTextureCompressionType;
|
35
|
+
struct SkISize;
|
36
|
+
|
37
|
+
/**
|
38
|
+
* All factories in this file refer to the Ganesh GPU backend when they say GPU.
|
39
|
+
*/
|
40
|
+
|
41
|
+
namespace SkImages {
|
42
|
+
/** Defines a callback function, taking one parameter of type GrBackendTexture with
|
43
|
+
no return value. Function is called when backend texture is to be released.
|
44
|
+
*/
|
45
|
+
using BackendTextureReleaseProc = std::function<void(GrBackendTexture)>;
|
46
|
+
/** User function called when supplied texture may be deleted. */
|
47
|
+
using TextureReleaseProc = void (*)(ReleaseContext);
|
48
|
+
|
49
|
+
/** Creates GPU-backed SkImage from backendTexture associated with context.
|
50
|
+
Skia will assume ownership of the resource and will release it when no longer needed.
|
51
|
+
A non-null SkImage is returned if format of backendTexture is recognized and supported.
|
52
|
+
Recognized formats vary by GPU backend.
|
53
|
+
@param context GPU context
|
54
|
+
@param backendTexture texture residing on GPU
|
55
|
+
@param textureOrigin origin of backendTexture
|
56
|
+
@param colorType color type of the resulting image
|
57
|
+
@param alphaType alpha type of the resulting image
|
58
|
+
@param colorSpace range of colors; may be nullptr
|
59
|
+
@return created SkImage, or nullptr
|
60
|
+
*/
|
61
|
+
SK_API sk_sp<SkImage> AdoptTextureFrom(GrRecordingContext* context,
|
62
|
+
const GrBackendTexture& backendTexture,
|
63
|
+
GrSurfaceOrigin textureOrigin,
|
64
|
+
SkColorType colorType);
|
65
|
+
SK_API sk_sp<SkImage> AdoptTextureFrom(GrRecordingContext* context,
|
66
|
+
const GrBackendTexture& backendTexture,
|
67
|
+
GrSurfaceOrigin textureOrigin,
|
68
|
+
SkColorType colorType,
|
69
|
+
SkAlphaType alphaType);
|
70
|
+
SK_API sk_sp<SkImage> AdoptTextureFrom(GrRecordingContext* context,
|
71
|
+
const GrBackendTexture& backendTexture,
|
72
|
+
GrSurfaceOrigin textureOrigin,
|
73
|
+
SkColorType colorType,
|
74
|
+
SkAlphaType alphaType,
|
75
|
+
sk_sp<SkColorSpace> colorSpace);
|
76
|
+
|
77
|
+
/** Creates GPU-backed SkImage from the provided GPU texture associated with context.
|
78
|
+
GPU texture must stay valid and unchanged until textureReleaseProc is called by Skia.
|
79
|
+
Skia will call textureReleaseProc with the passed-in releaseContext when SkImage
|
80
|
+
is deleted or no longer refers to the texture.
|
81
|
+
A non-null SkImage is returned if format of backendTexture is recognized and supported.
|
82
|
+
Recognized formats vary by GPU backend.
|
83
|
+
@note When using a DDL recording context, textureReleaseProc will be called on the
|
84
|
+
GPU thread after the DDL is played back on the direct context.
|
85
|
+
@param context GPU context
|
86
|
+
@param backendTexture texture residing on GPU
|
87
|
+
@param colorSpace This describes the color space of this image's contents, as
|
88
|
+
seen after sampling. In general, if the format of the backend
|
89
|
+
texture is SRGB, some linear colorSpace should be supplied
|
90
|
+
(e.g., SkColorSpace::MakeSRGBLinear()). If the format of the
|
91
|
+
backend texture is linear, then the colorSpace should include
|
92
|
+
a description of the transfer function as
|
93
|
+
well (e.g., SkColorSpace::MakeSRGB()).
|
94
|
+
@param textureReleaseProc function called when texture can be released
|
95
|
+
@param releaseContext state passed to textureReleaseProc
|
96
|
+
@return created SkImage, or nullptr
|
97
|
+
*/
|
98
|
+
SK_API sk_sp<SkImage> BorrowTextureFrom(GrRecordingContext* context,
|
99
|
+
const GrBackendTexture& backendTexture,
|
100
|
+
GrSurfaceOrigin origin,
|
101
|
+
SkColorType colorType,
|
102
|
+
SkAlphaType alphaType,
|
103
|
+
sk_sp<SkColorSpace> colorSpace,
|
104
|
+
TextureReleaseProc textureReleaseProc = nullptr,
|
105
|
+
ReleaseContext releaseContext = nullptr);
|
106
|
+
|
107
|
+
/** Creates a GPU-backed SkImage from pixmap. It is uploaded to GPU backend using context.
|
108
|
+
Created SkImage is available to other GPU contexts, and is available across thread
|
109
|
+
boundaries. All contexts must be in the same GPU share group, or otherwise
|
110
|
+
share resources.
|
111
|
+
When SkImage is no longer referenced, context releases texture memory
|
112
|
+
asynchronously.
|
113
|
+
SkColorSpace of SkImage is determined by pixmap.colorSpace().
|
114
|
+
SkImage is returned referring to GPU backend if context is not nullptr,
|
115
|
+
format of data is recognized and supported, and if context supports moving
|
116
|
+
resources between contexts. Otherwise, pixmap pixel data is copied and SkImage
|
117
|
+
as returned in raster format if possible; nullptr may be returned.
|
118
|
+
Recognized GPU formats vary by platform and GPU backend.
|
119
|
+
@param context GPU context
|
120
|
+
@param pixmap SkImageInfo, pixel address, and row bytes
|
121
|
+
@param buildMips create SkImage as mip map if true
|
122
|
+
@param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
|
123
|
+
@return created SkImage, or nullptr
|
124
|
+
*/
|
125
|
+
SK_API sk_sp<SkImage> CrossContextTextureFromPixmap(GrDirectContext* context,
|
126
|
+
const SkPixmap& pixmap,
|
127
|
+
bool buildMips,
|
128
|
+
bool limitToMaxTextureSize = false);
|
129
|
+
|
130
|
+
/** Creates a GPU-backed SkImage from a GPU backend texture. The backend texture must stay
|
131
|
+
valid and unchanged until textureReleaseProc is called. The textureReleaseProc is
|
132
|
+
called when the SkImage is deleted or no longer refers to the texture and will be
|
133
|
+
passed the releaseContext.
|
134
|
+
An SkImage is returned if the format of backendTexture is recognized and supported.
|
135
|
+
Recognized formats vary by GPU backend.
|
136
|
+
@note When using a DDL recording context, textureReleaseProc will be called on the
|
137
|
+
GPU thread after the DDL is played back on the direct context.
|
138
|
+
@param context the GPU context
|
139
|
+
@param backendTexture a texture already allocated by the GPU
|
140
|
+
@param alphaType This characterizes the nature of the alpha values in the
|
141
|
+
backend texture. For opaque compressed formats (e.g., ETC1)
|
142
|
+
this should usually be set to kOpaq
|
143
|
+
ue_SkAlphaType.
|
144
|
+
@param colorSpace This describes the color space of this image's contents, as
|
145
|
+
seen after sampling. In general, if the format of the backend
|
146
|
+
texture is SRGB, some linear colorSpace should be supplied
|
147
|
+
(e.g., SkColorSpace::MakeSRGBLinear()). If the format of the
|
148
|
+
backend texture is linear, then the colorSpace should include
|
149
|
+
a description of the transfer function as
|
150
|
+
well (e.g., SkColorSpace::MakeSRGB()).
|
151
|
+
@param textureReleaseProc function called when the backend texture can be released
|
152
|
+
@param releaseContext state passed to textureReleaseProc
|
153
|
+
@return created SkImage, or nullptr
|
154
|
+
*/
|
155
|
+
SK_API sk_sp<SkImage> TextureFromCompressedTexture(GrRecordingContext* context,
|
156
|
+
const GrBackendTexture& backendTexture,
|
157
|
+
GrSurfaceOrigin origin,
|
158
|
+
SkAlphaType alphaType,
|
159
|
+
sk_sp<SkColorSpace> colorSpace,
|
160
|
+
TextureReleaseProc textureReleaseProc = nullptr,
|
161
|
+
ReleaseContext releaseContext = nullptr);
|
162
|
+
|
163
|
+
/** Creates a GPU-backed SkImage from compressed data.
|
164
|
+
This method will return an SkImage representing the compressed data.
|
165
|
+
If the GPU doesn't support the specified compression method, the data
|
166
|
+
will be decompressed and then wrapped in a GPU-backed image.
|
167
|
+
Note: one can query the supported compression formats via
|
168
|
+
GrRecordingContext::compressedBackendFormat.
|
169
|
+
@param context GPU context
|
170
|
+
@param data compressed data to store in SkImage
|
171
|
+
@param width width of full SkImage
|
172
|
+
@param height height of full SkImage
|
173
|
+
@param type type of compression used
|
174
|
+
@param mipmapped does 'data' contain data for all the mipmap levels?
|
175
|
+
@param isProtected do the contents of 'data' require DRM protection (on Vulkan)?
|
176
|
+
@return created SkImage, or nullptr
|
177
|
+
*/
|
178
|
+
SK_API sk_sp<SkImage> TextureFromCompressedTextureData(GrDirectContext* direct,
|
179
|
+
sk_sp<SkData> data,
|
180
|
+
int width,
|
181
|
+
int height,
|
182
|
+
SkTextureCompressionType type,
|
183
|
+
GrMipmapped mipmapped = GrMipmapped::kNo,
|
184
|
+
GrProtected isProtected = GrProtected::kNo);
|
185
|
+
|
186
|
+
/** Returns SkImage backed by GPU texture associated with context. Returned SkImage is
|
187
|
+
compatible with SkSurface created with dstColorSpace. The returned SkImage respects
|
188
|
+
mipmapped setting; if mipmapped equals skgpu::Mipmapped::kYes, the backing texture
|
189
|
+
allocates mip map levels.
|
190
|
+
The mipmapped parameter is effectively treated as kNo if MIP maps are not supported by the
|
191
|
+
GPU.
|
192
|
+
Returns original SkImage if the image is already texture-backed, the context matches, and
|
193
|
+
mipmapped is compatible with the backing GPU texture. skgpu::Budgeted is ignored in this
|
194
|
+
case.
|
195
|
+
Returns nullptr if context is nullptr, or if SkImage was created with another
|
196
|
+
GrDirectContext.
|
197
|
+
@param GrDirectContext the GrDirectContext in play, if it exists
|
198
|
+
@param SkImage a non-null pointer to an SkImage.
|
199
|
+
@param skgpu::Mipmapped Whether created SkImage texture must allocate mip map levels.
|
200
|
+
Defaults to no.
|
201
|
+
@param skgpu::Budgeted Whether to count a newly created texture for the returned image
|
202
|
+
counts against the context's budget. Defaults to yes.
|
203
|
+
@return created SkImage, or nullptr
|
204
|
+
*/
|
205
|
+
SK_API sk_sp<SkImage> TextureFromImage(GrDirectContext*,
|
206
|
+
const SkImage*,
|
207
|
+
skgpu::Mipmapped = skgpu::Mipmapped::kNo,
|
208
|
+
skgpu::Budgeted = skgpu::Budgeted::kYes);
|
209
|
+
inline sk_sp<SkImage> TextureFromImage(GrDirectContext* ctx,
|
210
|
+
sk_sp<const SkImage> img,
|
211
|
+
skgpu::Mipmapped m = skgpu::Mipmapped::kNo,
|
212
|
+
skgpu::Budgeted b = skgpu::Budgeted::kYes) {
|
213
|
+
return TextureFromImage(ctx, img.get(), m, b);
|
214
|
+
}
|
215
|
+
|
216
|
+
/** Creates a GPU-backed SkImage from SkYUVAPixmaps.
|
217
|
+
The image will remain planar with each plane converted to a texture using the passed
|
218
|
+
GrRecordingContext.
|
219
|
+
SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB.
|
220
|
+
The SkColorSpace of the resulting RGB values is specified by imageColorSpace. This will
|
221
|
+
be the SkColorSpace reported by the image and when drawn the RGB values will be converted
|
222
|
+
from this space into the destination space (if the destination is tagged).
|
223
|
+
Currently, this is only supported using the GPU backend and will fail if context is nullptr.
|
224
|
+
SkYUVAPixmaps does not need to remain valid after this returns.
|
225
|
+
@param context GPU context
|
226
|
+
@param pixmaps The planes as pixmaps with supported SkYUVAInfo that
|
227
|
+
specifies conversion to RGB.
|
228
|
+
@param buildMips create internal YUVA textures as mip map if kYes. This is
|
229
|
+
silently ignored if the context does not support mip maps.
|
230
|
+
@param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary
|
231
|
+
@param imageColorSpace range of colors of the resulting image; may be nullptr
|
232
|
+
@return created SkImage, or nullptr
|
233
|
+
*/
|
234
|
+
SK_API sk_sp<SkImage> TextureFromYUVAPixmaps(GrRecordingContext* context,
|
235
|
+
const SkYUVAPixmaps& pixmaps,
|
236
|
+
GrMipmapped buildMips,
|
237
|
+
bool limitToMaxTextureSize,
|
238
|
+
sk_sp<SkColorSpace> imageColorSpace);
|
239
|
+
SK_API sk_sp<SkImage> TextureFromYUVAPixmaps(GrRecordingContext* context,
|
240
|
+
const SkYUVAPixmaps& pixmaps,
|
241
|
+
GrMipmapped buildMips = GrMipmapped::kNo,
|
242
|
+
bool limitToMaxTextureSize = false);
|
243
|
+
|
244
|
+
/** Creates a GPU-backed SkImage from YUV[A] planar textures. This requires that the textures
|
245
|
+
* stay valid for the lifetime of the image. The ReleaseContext can be used to know when it is
|
246
|
+
* safe to either delete or overwrite the textures. If ReleaseProc is provided it is also called
|
247
|
+
* before return on failure.
|
248
|
+
@param context GPU context
|
249
|
+
@param yuvaTextures A set of textures containing YUVA data and a description of the
|
250
|
+
data and transformation to RGBA.
|
251
|
+
@param imageColorSpace range of colors of the resulting image after conversion to RGB;
|
252
|
+
may be nullptr
|
253
|
+
@param textureReleaseProc called when the backend textures can be released
|
254
|
+
@param releaseContext state passed to textureReleaseProc
|
255
|
+
@return created SkImage, or nullptr
|
256
|
+
*/
|
257
|
+
SK_API sk_sp<SkImage> TextureFromYUVATextures(GrRecordingContext* context,
|
258
|
+
const GrYUVABackendTextures& yuvaTextures,
|
259
|
+
sk_sp<SkColorSpace> imageColorSpace,
|
260
|
+
TextureReleaseProc textureReleaseProc = nullptr,
|
261
|
+
ReleaseContext releaseContext = nullptr);
|
262
|
+
SK_API sk_sp<SkImage> TextureFromYUVATextures(GrRecordingContext* context,
|
263
|
+
const GrYUVABackendTextures& yuvaTextures);
|
264
|
+
|
265
|
+
using PromiseImageTextureContext = void*;
|
266
|
+
using PromiseImageTextureFulfillProc = sk_sp<SkPromiseImageTexture> (*)(PromiseImageTextureContext);
|
267
|
+
using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext);
|
268
|
+
|
269
|
+
/** Create a new GPU-backed SkImage that is very similar to an SkImage created by BorrowTextureFrom.
|
270
|
+
The difference is that the caller need not have created the texture nor populated it with the
|
271
|
+
image pixel data. Moreover, the SkImage may be created on a thread as the creation of the
|
272
|
+
image does not require access to the backend API or GrDirectContext. Instead of passing a
|
273
|
+
GrBackendTexture the client supplies a description of the texture consisting of
|
274
|
+
GrBackendFormat, width, height, and GrMipmapped state. The resulting SkImage can be drawn
|
275
|
+
to a SkDeferredDisplayListRecorder or directly to a GPU-backed SkSurface.
|
276
|
+
When the actual texture is required to perform a backend API draw, textureFulfillProc will
|
277
|
+
be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match
|
278
|
+
those set during the SkImage creation, and it must refer to a valid existing texture in the
|
279
|
+
backend API context/device, and be populated with the image pixel data. The texture cannot
|
280
|
+
be deleted until textureReleaseProc is called.
|
281
|
+
There is at most one call to each of textureFulfillProc and textureReleaseProc.
|
282
|
+
textureReleaseProc is always called even if image creation fails or if the
|
283
|
+
image is never fulfilled (e.g. it is never drawn or all draws are clipped out)
|
284
|
+
@param gpuContextProxy the thread-safe proxy of the gpu context. required.
|
285
|
+
@param backendFormat format of promised gpu texture
|
286
|
+
@param dimensions width & height of promised gpu texture
|
287
|
+
@param mipmapped mip mapped state of promised gpu texture
|
288
|
+
@param origin surface origin of promised gpu texture
|
289
|
+
@param colorType color type of promised gpu texture
|
290
|
+
@param alphaType alpha type of promised gpu texture
|
291
|
+
@param colorSpace range of colors; may be nullptr
|
292
|
+
@param textureFulfillProc function called to get actual gpu texture
|
293
|
+
@param textureReleaseProc function called when texture can be deleted
|
294
|
+
@param textureContext state passed to textureFulfillProc and textureReleaseProc
|
295
|
+
@return created SkImage, or nullptr
|
296
|
+
*/
|
297
|
+
SK_API sk_sp<SkImage> PromiseTextureFrom(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
298
|
+
const GrBackendFormat& backendFormat,
|
299
|
+
SkISize dimensions,
|
300
|
+
GrMipmapped mipmapped,
|
301
|
+
GrSurfaceOrigin origin,
|
302
|
+
SkColorType colorType,
|
303
|
+
SkAlphaType alphaType,
|
304
|
+
sk_sp<SkColorSpace> colorSpace,
|
305
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
306
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
307
|
+
PromiseImageTextureContext textureContext);
|
308
|
+
|
309
|
+
/** This is similar to 'PromiseTextureFrom' but it creates a GPU-backed SkImage from YUV[A] data.
|
310
|
+
The source data may be planar (i.e. spread across multiple textures). In
|
311
|
+
the extreme Y, U, V, and A are all in different planes and thus the image is specified by
|
312
|
+
four textures. 'backendTextureInfo' describes the planar arrangement, texture formats,
|
313
|
+
conversion to RGB, and origin of the textures. Separate 'textureFulfillProc' and
|
314
|
+
'textureReleaseProc' calls are made for each texture. Each texture has its own
|
315
|
+
PromiseImageTextureContext. If 'backendTextureInfo' is not valid then no release proc
|
316
|
+
calls are made. Otherwise, the calls will be made even on failure. 'textureContexts' has one
|
317
|
+
entry for each of the up to four textures, as indicated by 'backendTextureInfo'.
|
318
|
+
Currently the mip mapped property of 'backendTextureInfo' is ignored. However, in the
|
319
|
+
near future it will be required that if it is kYes then textureFulfillProc must return
|
320
|
+
a mip mapped texture for each plane in order to successfully draw the image.
|
321
|
+
@param gpuContextProxy the thread-safe proxy of the gpu context. required.
|
322
|
+
@param backendTextureInfo info about the promised yuva gpu texture
|
323
|
+
@param imageColorSpace range of colors; may be nullptr
|
324
|
+
@param textureFulfillProc function called to get actual gpu texture
|
325
|
+
@param textureReleaseProc function called when texture can be deleted
|
326
|
+
@param textureContexts state passed to textureFulfillProc and textureReleaseProc
|
327
|
+
@return created SkImage, or nullptr
|
328
|
+
*/
|
329
|
+
SK_API sk_sp<SkImage> PromiseTextureFromYUVA(sk_sp<GrContextThreadSafeProxy> gpuContextProxy,
|
330
|
+
const GrYUVABackendTextureInfo& backendTextureInfo,
|
331
|
+
sk_sp<SkColorSpace> imageColorSpace,
|
332
|
+
PromiseImageTextureFulfillProc textureFulfillProc,
|
333
|
+
PromiseImageTextureReleaseProc textureReleaseProc,
|
334
|
+
PromiseImageTextureContext textureContexts[]);
|
335
|
+
|
336
|
+
/** Retrieves the existing backend texture. If SkImage is not a Ganesh-backend texture image
|
337
|
+
or otherwise does not have such a texture, false is returned. Otherwise, outTexture will
|
338
|
+
be set to the image's texture.
|
339
|
+
|
340
|
+
If flushPendingGrContextIO is true, completes deferred I/O operations.
|
341
|
+
If origin in not nullptr, copies location of content drawn into SkImage.
|
342
|
+
@param outTexture Will be set to the underlying texture of the image if non-null.
|
343
|
+
@param flushPendingGrContextIO flag to flush outstanding requests
|
344
|
+
@param origin Will be set to the origin orientation of the image if non-null.
|
345
|
+
@return false if a Ganesh backend texture cannot be retrieved.
|
346
|
+
*/
|
347
|
+
SK_API bool GetBackendTextureFromImage(const SkImage* img,
|
348
|
+
GrBackendTexture* outTexture,
|
349
|
+
bool flushPendingGrContextIO,
|
350
|
+
GrSurfaceOrigin* origin = nullptr);
|
351
|
+
inline bool GetBackendTextureFromImage(sk_sp<const SkImage> img,
|
352
|
+
GrBackendTexture* outTexture,
|
353
|
+
bool flushPendingGrContextIO,
|
354
|
+
GrSurfaceOrigin* origin = nullptr) {
|
355
|
+
return GetBackendTextureFromImage(img.get(), outTexture, flushPendingGrContextIO, origin);
|
356
|
+
}
|
357
|
+
|
358
|
+
/** Extracts the backendTexture from an existing SkImage.
|
359
|
+
If the image is not already GPU-backed, the raster data will be uploaded as a texture
|
360
|
+
and returned.
|
361
|
+
If this is the only reference to the image, the old image's texture will be
|
362
|
+
moved out of the passed in image.
|
363
|
+
If the image is shared (has a refcount > 1), the texture will be copied and then returned.
|
364
|
+
@param context GPU context
|
365
|
+
@param image image, either CPU-backed or GPU-backed
|
366
|
+
@param backendTexture Will be set to the underlying texture of the image.
|
367
|
+
@param backendTextureReleaseProc Called when the texture is released
|
368
|
+
@return false if image cannot be uploaded.
|
369
|
+
*/
|
370
|
+
SK_API bool MakeBackendTextureFromImage(GrDirectContext* context,
|
371
|
+
sk_sp<SkImage> image,
|
372
|
+
GrBackendTexture* backendTexture,
|
373
|
+
BackendTextureReleaseProc* backendTextureReleaseProc);
|
374
|
+
// Legacy name
|
375
|
+
inline bool GetBackendTextureFromImage(GrDirectContext* context,
|
376
|
+
sk_sp<SkImage> image,
|
377
|
+
GrBackendTexture* backendTexture,
|
378
|
+
BackendTextureReleaseProc* backendTextureReleaseProc) {
|
379
|
+
return MakeBackendTextureFromImage(context, std::move(image), backendTexture,
|
380
|
+
backendTextureReleaseProc);
|
381
|
+
}
|
382
|
+
|
383
|
+
} // namespace SkImages
|
384
|
+
|
385
|
+
#endif
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
#include "include/core/SkString.h"
|
12
12
|
#include "include/gpu/gl/GrGLFunctions.h"
|
13
|
-
#include "include/private/SkTArray.h"
|
13
|
+
#include "include/private/base/SkTArray.h"
|
14
14
|
|
15
15
|
#include <utility>
|
16
16
|
|
@@ -66,13 +66,13 @@ public:
|
|
66
66
|
*/
|
67
67
|
void add(const char[]);
|
68
68
|
|
69
|
-
void reset() { fStrings.
|
69
|
+
void reset() { fStrings.clear(); }
|
70
70
|
|
71
71
|
void dumpJSON(SkJSONWriter*) const;
|
72
72
|
|
73
73
|
private:
|
74
74
|
bool fInitialized = false;
|
75
|
-
|
75
|
+
skia_private::TArray<SkString> fStrings;
|
76
76
|
};
|
77
77
|
|
78
78
|
#endif
|
@@ -304,9 +304,6 @@ public:
|
|
304
304
|
GrGLFunction<GrGLVertexAttribPointerFn> fVertexAttribPointer;
|
305
305
|
GrGLFunction<GrGLViewportFn> fViewport;
|
306
306
|
|
307
|
-
/* NV_framebuffer_mixed_samples */
|
308
|
-
GrGLFunction<GrGLCoverageModulationFn> fCoverageModulation;
|
309
|
-
|
310
307
|
/* ARB_sync */
|
311
308
|
GrGLFunction<GrGLFenceSyncFn> fFenceSync;
|
312
309
|
GrGLFunction<GrGLIsSyncFn> fIsSync;
|
@@ -10,6 +10,7 @@
|
|
10
10
|
#define GrGLTypes_DEFINED
|
11
11
|
|
12
12
|
#include "include/core/SkRefCnt.h"
|
13
|
+
#include "include/gpu/GpuTypes.h"
|
13
14
|
#include "include/gpu/gl/GrGLConfig.h"
|
14
15
|
|
15
16
|
/**
|
@@ -198,7 +199,7 @@ struct GrGLFramebufferInfo {
|
|
198
199
|
struct GrGLSurfaceInfo {
|
199
200
|
uint32_t fSampleCount = 1;
|
200
201
|
uint32_t fLevelCount = 0;
|
201
|
-
|
202
|
+
skgpu::Protected fProtected = skgpu::Protected::kNo;
|
202
203
|
|
203
204
|
GrGLenum fTarget = 0;
|
204
205
|
GrGLenum fFormat = 0;
|
@@ -8,29 +8,71 @@
|
|
8
8
|
#ifndef skgpu_graphite_BackendTexture_DEFINED
|
9
9
|
#define skgpu_graphite_BackendTexture_DEFINED
|
10
10
|
|
11
|
+
#include "include/core/SkRefCnt.h"
|
11
12
|
#include "include/core/SkSize.h"
|
12
13
|
#include "include/gpu/graphite/GraphiteTypes.h"
|
13
14
|
#include "include/gpu/graphite/TextureInfo.h"
|
14
15
|
|
16
|
+
#ifdef SK_DAWN
|
17
|
+
#include "include/gpu/graphite/dawn/DawnTypes.h"
|
18
|
+
#endif
|
19
|
+
|
15
20
|
#ifdef SK_METAL
|
16
|
-
#include "include/gpu/graphite/mtl/
|
21
|
+
#include "include/gpu/graphite/mtl/MtlGraphiteTypes.h"
|
17
22
|
#endif
|
18
23
|
|
19
24
|
#ifdef SK_VULKAN
|
20
25
|
#include "include/private/gpu/vk/SkiaVulkan.h"
|
21
26
|
#endif
|
22
27
|
|
28
|
+
namespace skgpu {
|
29
|
+
class MutableTextureState;
|
30
|
+
class MutableTextureStateRef;
|
31
|
+
}
|
32
|
+
|
23
33
|
namespace skgpu::graphite {
|
24
34
|
|
25
|
-
class BackendTexture {
|
35
|
+
class SK_API BackendTexture {
|
26
36
|
public:
|
27
|
-
BackendTexture()
|
37
|
+
BackendTexture();
|
38
|
+
#ifdef SK_DAWN
|
39
|
+
// Create a BackendTexture from a WGPUTexture. Texture info will be
|
40
|
+
// queried from the texture. Comparing to WGPUTextureView,
|
41
|
+
// SkImage::readPixels(), SkSurface::readPixels() and
|
42
|
+
// SkSurface::writePixels() are implemented by direct buffer copy. They
|
43
|
+
// should be more efficient. For WGPUTextureView, those methods will use
|
44
|
+
// create an intermediate WGPUTexture, and use it to transfer pixels.
|
45
|
+
// Note:
|
46
|
+
// - for better performance, using WGPUTexture IS RECOMMENDED.
|
47
|
+
// - The BackendTexture will not call retain or release on the passed in
|
48
|
+
// WGPUTexture. Thus the client must keep the WGPUTexture valid until
|
49
|
+
// they are no longer using the BackendTexture.
|
50
|
+
BackendTexture(WGPUTexture texture);
|
51
|
+
// Create a BackendTexture from a WGPUTextureView. Texture dimensions and
|
52
|
+
// info have to be provided.
|
53
|
+
// Note:
|
54
|
+
// - this method is for importing WGPUTextureView from wgpu::SwapChain only.
|
55
|
+
// - The BackendTexture will not call retain or release on the passed in
|
56
|
+
// WGPUTextureView. Thus the client must keep the WGPUTextureView valid
|
57
|
+
// until they are no longer using the BackendTexture.
|
58
|
+
BackendTexture(SkISize dimensions,
|
59
|
+
const DawnTextureInfo& info,
|
60
|
+
WGPUTextureView textureView);
|
61
|
+
#endif
|
28
62
|
#ifdef SK_METAL
|
29
63
|
// The BackendTexture will not call retain or release on the passed in MtlHandle. Thus the
|
30
64
|
// client must keep the MtlHandle valid until they are no longer using the BackendTexture.
|
31
65
|
BackendTexture(SkISize dimensions, MtlHandle mtlTexture);
|
32
66
|
#endif
|
33
67
|
|
68
|
+
#ifdef SK_VULKAN
|
69
|
+
BackendTexture(SkISize dimensions,
|
70
|
+
const VulkanTextureInfo&,
|
71
|
+
VkImageLayout,
|
72
|
+
uint32_t queueFamilyIndex,
|
73
|
+
VkImage);
|
74
|
+
#endif
|
75
|
+
|
34
76
|
BackendTexture(const BackendTexture&);
|
35
77
|
|
36
78
|
~BackendTexture();
|
@@ -47,15 +89,42 @@ public:
|
|
47
89
|
|
48
90
|
const TextureInfo& info() const { return fInfo; }
|
49
91
|
|
92
|
+
// If the client changes any of the mutable backend of the GrBackendTexture they should call
|
93
|
+
// this function to inform Skia that those values have changed. The backend API specific state
|
94
|
+
// that can be set from this function are:
|
95
|
+
//
|
96
|
+
// Vulkan: VkImageLayout and QueueFamilyIndex
|
97
|
+
void setMutableState(const skgpu::MutableTextureState&);
|
98
|
+
|
99
|
+
#ifdef SK_DAWN
|
100
|
+
WGPUTexture getDawnTexturePtr() const;
|
101
|
+
WGPUTextureView getDawnTextureViewPtr() const;
|
102
|
+
#endif
|
50
103
|
#ifdef SK_METAL
|
51
104
|
MtlHandle getMtlTexture() const;
|
52
105
|
#endif
|
53
106
|
|
107
|
+
#ifdef SK_VULKAN
|
108
|
+
VkImage getVkImage() const;
|
109
|
+
VkImageLayout getVkImageLayout() const;
|
110
|
+
uint32_t getVkQueueFamilyIndex() const;
|
111
|
+
#endif
|
112
|
+
|
54
113
|
private:
|
114
|
+
sk_sp<MutableTextureStateRef> mutableState() const;
|
115
|
+
|
55
116
|
SkISize fDimensions;
|
56
117
|
TextureInfo fInfo;
|
57
118
|
|
119
|
+
sk_sp<MutableTextureStateRef> fMutableState;
|
120
|
+
|
58
121
|
union {
|
122
|
+
#ifdef SK_DAWN
|
123
|
+
struct {
|
124
|
+
WGPUTexture fDawnTexture;
|
125
|
+
WGPUTextureView fDawnTextureView;
|
126
|
+
};
|
127
|
+
#endif
|
59
128
|
#ifdef SK_METAL
|
60
129
|
MtlHandle fMtlTexture;
|
61
130
|
#endif
|