diff --git a/exponent-view-template/ios/exponent-view-template/Supporting/EXSDKVersions.plist b/exponent-view-template/ios/exponent-view-template/Supporting/EXSDKVersions.plist index 855f820916ae58..17051dd427d425 100644 --- a/exponent-view-template/ios/exponent-view-template/Supporting/EXSDKVersions.plist +++ b/exponent-view-template/ios/exponent-view-template/Supporting/EXSDKVersions.plist @@ -4,7 +4,6 @@ sdkVersions - 46.0.0 47.0.0 48.0.0 diff --git a/exponent-view-template/ios/exponent-view-template/Supporting/sdkVersions.json b/exponent-view-template/ios/exponent-view-template/Supporting/sdkVersions.json index 2cb1bf79bf82bc..b211e29389ce15 100644 --- a/exponent-view-template/ios/exponent-view-template/Supporting/sdkVersions.json +++ b/exponent-view-template/ios/exponent-view-template/Supporting/sdkVersions.json @@ -1 +1 @@ -{"sdkVersions":["46.0.0","47.0.0","48.0.0"]} \ No newline at end of file +{"sdkVersions":["47.0.0","48.0.0"]} \ No newline at end of file diff --git a/ios/Exponent.xcodeproj/project.pbxproj b/ios/Exponent.xcodeproj/project.pbxproj index 14dcf2c03f010c..20074d20f3f48c 100644 --- a/ios/Exponent.xcodeproj/project.pbxproj +++ b/ios/Exponent.xcodeproj/project.pbxproj @@ -2352,7 +2352,6 @@ "${PODS_CONFIGURATION_BUILD_DIR}/StripePayments/Stripe3DS2.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/StripePaymentsUI/StripePaymentsUI.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/StripeUICore/StripeUICore.bundle", - "${PODS_CONFIGURATION_BUILD_DIR}/ABI46_0_0React-Core/ABI46_0_0AccessibilityResources.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/ABI47_0_0React-Core/ABI47_0_0AccessibilityResources.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/ABI48_0_0React-Core/ABI48_0_0AccessibilityResources.bundle", "${PODS_ROOT}/GooglePlaces/Frameworks/GooglePlaces.xcframework/ios-arm64/GooglePlaces.framework/Resources/GooglePlaces.bundle", @@ -2372,7 +2371,6 @@ "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/Stripe3DS2.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripePaymentsUI.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/StripeUICore.bundle", - "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ABI46_0_0AccessibilityResources.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ABI47_0_0AccessibilityResources.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/ABI48_0_0AccessibilityResources.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GooglePlaces.bundle", diff --git a/ios/Exponent/Kernel/Views/EXAppViewController.m b/ios/Exponent/Kernel/Views/EXAppViewController.m index 87db264502667b..ff67a369c098ad 100644 --- a/ios/Exponent/Kernel/Views/EXAppViewController.m +++ b/ios/Exponent/Kernel/Views/EXAppViewController.m @@ -36,9 +36,6 @@ #if defined(INCLUDES_VERSIONED_CODE) && __has_include() #import #endif -#if defined(INCLUDES_VERSIONED_CODE) && __has_include() -#import -#endif #if defined(EX_DETACHED) #import "ExpoKit-Swift.h" @@ -650,9 +647,6 @@ - (void)_overrideAppearanceModuleBehaviour #if defined(INCLUDES_VERSIONED_CODE) && __has_include() ABI47_0_0RCTOverrideAppearancePreference(appearancePreference); #endif -#if defined(INCLUDES_VERSIONED_CODE) && __has_include() - ABI46_0_0RCTOverrideAppearancePreference(appearancePreference); -#endif } diff --git a/ios/Exponent/Supporting/EXSDKVersions.plist b/ios/Exponent/Supporting/EXSDKVersions.plist index 855f820916ae58..17051dd427d425 100644 --- a/ios/Exponent/Supporting/EXSDKVersions.plist +++ b/ios/Exponent/Supporting/EXSDKVersions.plist @@ -4,7 +4,6 @@ sdkVersions - 46.0.0 47.0.0 48.0.0 diff --git a/ios/Exponent/Supporting/sdkVersions.json b/ios/Exponent/Supporting/sdkVersions.json index 2cb1bf79bf82bc..b211e29389ce15 100644 --- a/ios/Exponent/Supporting/sdkVersions.json +++ b/ios/Exponent/Supporting/sdkVersions.json @@ -1 +1 @@ -{"sdkVersions":["46.0.0","47.0.0","48.0.0"]} \ No newline at end of file +{"sdkVersions":["47.0.0","48.0.0"]} \ No newline at end of file diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 732f6240295502..d18f6559c23894 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,646 +1,4 @@ PODS: - - ABI46_0_0EASClient (0.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXAppleAuthentication (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXApplication (4.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXAV (12.0.1): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0React-runtimeexecutor - - ABI46_0_0ReactCommon - - ABI46_0_0EXBackgroundFetch (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXBarCodeScanner (11.4.0): - - ABI46_0_0EXImageLoader - - ABI46_0_0ExpoModulesCore - - ZXingObjC/OneD - - ZXingObjC/PDF417 - - ABI46_0_0EXBattery (6.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXBlur (11.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXBrightness (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXCalendar (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXCamera (12.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXConstants (13.2.2): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXContacts (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXDevice (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXDocumentPicker (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXErrorRecovery (3.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXFileSystem (14.1.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXFirebaseAnalytics (7.1.1): - - ABI46_0_0EXFirebaseCore - - ABI46_0_0ExpoModulesCore - - Firebase/Core (= 9.5.0) - - ABI46_0_0EXFirebaseCore (5.1.1): - - ABI46_0_0ExpoModulesCore - - Firebase/Core (= 9.5.0) - - ABI46_0_0EXFont (10.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXGL (11.4.0): - - ABI46_0_0EXGL_CPP - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXGL_CPP (11.4.0): - - ABI46_0_0React-jsi - - ABI46_0_0EXImageLoader (3.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0React-Core - - ABI46_0_0EXJSONUtils (0.3.0) - - ABI46_0_0EXLocalAuthentication (12.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXLocation (14.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXManifests (0.3.1): - - ABI46_0_0EXJSONUtils - - ABI46_0_0EXMediaLibrary (14.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0React-Core - - ABI46_0_0EXNetwork (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXNotifications (0.16.1): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXPermissions (13.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0Expo (46.0.0-beta.1): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoCellular (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoClipboard (3.1.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoCrypto (11.0.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoHaptics (11.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoImageManipulator (10.4.0): - - ABI46_0_0EXImageLoader - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoImagePicker (13.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoKeepAwake (10.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoKit/Expo (46.0.0): - - ABI46_0_0EASClient - - ABI46_0_0EXAppleAuthentication - - ABI46_0_0EXApplication - - ABI46_0_0EXAV - - ABI46_0_0EXBackgroundFetch - - ABI46_0_0EXBarCodeScanner - - ABI46_0_0EXBattery - - ABI46_0_0EXBlur - - ABI46_0_0EXBrightness - - ABI46_0_0EXCalendar - - ABI46_0_0EXCamera - - ABI46_0_0EXConstants - - ABI46_0_0EXContacts - - ABI46_0_0EXDevice - - ABI46_0_0EXDocumentPicker - - ABI46_0_0EXErrorRecovery - - ABI46_0_0EXFileSystem - - ABI46_0_0EXFirebaseAnalytics - - ABI46_0_0EXFirebaseCore - - ABI46_0_0EXFont - - ABI46_0_0EXGL - - ABI46_0_0EXGL_CPP - - ABI46_0_0EXImageLoader - - ABI46_0_0EXJSONUtils - - ABI46_0_0EXLocalAuthentication - - ABI46_0_0EXLocation - - ABI46_0_0EXManifests - - ABI46_0_0EXMediaLibrary - - ABI46_0_0EXNetwork - - ABI46_0_0EXNotifications - - ABI46_0_0EXPermissions - - ABI46_0_0Expo - - ABI46_0_0ExpoCellular - - ABI46_0_0ExpoClipboard - - ABI46_0_0ExpoCrypto - - ABI46_0_0ExpoHaptics - - ABI46_0_0ExpoImageManipulator - - ABI46_0_0ExpoImagePicker - - ABI46_0_0ExpoKeepAwake - - ABI46_0_0ExpoLinearGradient - - ABI46_0_0ExpoLocalization - - ABI46_0_0ExpoMailComposer - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoModulesProvider - - ABI46_0_0ExpoRandom - - ABI46_0_0ExpoSystemUI - - ABI46_0_0ExpoTrackingTransparency - - ABI46_0_0ExpoWebBrowser - - ABI46_0_0EXPrint - - ABI46_0_0EXScreenCapture - - ABI46_0_0EXScreenOrientation - - ABI46_0_0EXSecureStore - - ABI46_0_0EXSensors - - ABI46_0_0EXSharing - - ABI46_0_0EXSMS - - ABI46_0_0EXSpeech - - ABI46_0_0EXSplashScreen - - ABI46_0_0EXSQLite - - ABI46_0_0EXStoreReview - - ABI46_0_0EXStructuredHeaders - - ABI46_0_0EXTaskManager - - ABI46_0_0EXUpdates - - ABI46_0_0EXUpdatesInterface - - ABI46_0_0EXVideoThumbnails - - ABI46_0_0RCTRequired - - ABI46_0_0RCTTypeSafety - - ABI46_0_0React-Core - - ABI46_0_0React-Core/DevSupport - - ABI46_0_0ReactCommon - - ABI46_0_0UMAppLoader - - Analytics - - AppAuth - - Branch - - EXBranch - - FBAudienceNetwork - - FBSDKCoreKit - - Google-Maps-iOS-Utils - - GoogleMaps - - GoogleSignIn - - JKBigInteger - - lottie-ios - - RCT-Folly - - ABI46_0_0ExpoKit/ExpoOptional (46.0.0): - - ABI46_0_0ExpoKit/Expo - - ABI46_0_0ExpoLinearGradient (11.4.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoLocalization (13.1.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoMailComposer (11.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoModulesCore (0.11.2): - - ABI46_0_0React-Core - - ABI46_0_0ReactCommon/turbomodule/core - - ABI46_0_0ExpoModulesProvider (46): - - ABI46_0_0EASClient - - ABI46_0_0ExpoCellular - - ABI46_0_0ExpoClipboard - - ABI46_0_0ExpoCrypto - - ABI46_0_0ExpoHaptics - - ABI46_0_0ExpoImageManipulator - - ABI46_0_0ExpoImagePicker - - ABI46_0_0ExpoKeepAwake - - ABI46_0_0ExpoLinearGradient - - ABI46_0_0ExpoLocalization - - ABI46_0_0ExpoMailComposer - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoRandom - - ABI46_0_0ExpoSystemUI - - ABI46_0_0ExpoTrackingTransparency - - ABI46_0_0ExpoWebBrowser - - ABI46_0_0EXScreenOrientation - - ABI46_0_0EXUpdates - - ABI46_0_0ExpoRandom (12.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoSystemUI (1.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoTrackingTransparency (2.3.1): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0ExpoWebBrowser (11.0.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXPrint (11.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXScreenCapture (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXScreenOrientation (4.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0React-Core - - ABI46_0_0EXSecureStore (11.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXSensors (11.4.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXSharing (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXSMS (10.2.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXSpeech (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXSplashScreen (0.16.1): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0React-Core - - ABI46_0_0EXSQLite (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXStoreReview (5.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXStructuredHeaders (2.2.1) - - ABI46_0_0EXTaskManager (10.3.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0UMAppLoader - - ABI46_0_0EXUpdates (0.14.2): - - ABI46_0_0EASClient - - ABI46_0_0EXManifests - - ABI46_0_0ExpoModulesCore - - ABI46_0_0EXStructuredHeaders - - ABI46_0_0EXUpdatesInterface - - ABI46_0_0React-Core - - ASN1Decoder (~> 1.8) - - ABI46_0_0EXUpdatesInterface (0.7.0) - - ABI46_0_0EXVideoThumbnails (6.4.0): - - ABI46_0_0ExpoModulesCore - - ABI46_0_0FBLazyVector (0.69.1) - - ABI46_0_0FBReactNativeSpec (0.69.1): - - ABI46_0_0RCTRequired (= 0.69.1) - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0lottie-react-native (5.1.3): - - ABI46_0_0React-Core - - lottie-ios (~> 3.4.0) - - ABI46_0_0RCTRequired (0.69.1) - - ABI46_0_0RCTTypeSafety (0.69.1): - - ABI46_0_0FBLazyVector (= 0.69.1) - - ABI46_0_0RCTRequired (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React (0.69.1): - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-Core/DevSupport (= 0.69.1) - - ABI46_0_0React-Core/RCTWebSocket (= 0.69.1) - - ABI46_0_0React-RCTActionSheet (= 0.69.1) - - ABI46_0_0React-RCTAnimation (= 0.69.1) - - ABI46_0_0React-RCTBlob (= 0.69.1) - - ABI46_0_0React-RCTImage (= 0.69.1) - - ABI46_0_0React-RCTLinking (= 0.69.1) - - ABI46_0_0React-RCTNetwork (= 0.69.1) - - ABI46_0_0React-RCTSettings (= 0.69.1) - - ABI46_0_0React-RCTText (= 0.69.1) - - ABI46_0_0React-RCTVibration (= 0.69.1) - - ABI46_0_0React-bridging (0.69.1): - - ABI46_0_0React-jsi (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-callinvoker (0.69.1) - - ABI46_0_0React-Codegen (0.69.1): - - ABI46_0_0FBReactNativeSpec (= 0.69.1) - - ABI46_0_0RCTRequired (= 0.69.1) - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core (0.69.1): - - ABI46_0_0React-Core/Default (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/CoreModulesHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/Default (0.69.1): - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/DevSupport (0.69.1): - - ABI46_0_0React-Core/Default (= 0.69.1) - - ABI46_0_0React-Core/RCTWebSocket (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-jsinspector (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTActionSheetHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTAnimationHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTBlobHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTImageHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTLinkingHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTNetworkHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTSettingsHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTTextHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTVibrationHeaders (0.69.1): - - ABI46_0_0React-Core/Default - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-Core/RCTWebSocket (0.69.1): - - ABI46_0_0React-Core/Default (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsiexecutor (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0Yoga - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-CoreModules (0.69.1): - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/CoreModulesHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-RCTImage (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-cxxreact (0.69.1): - - ABI46_0_0React-callinvoker (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-jsinspector (= 0.69.1) - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0React-runtimeexecutor (= 0.69.1) - - boost (= 1.76.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-jsi (0.69.1): - - ABI46_0_0React-jsi/Default (= 0.69.1) - - boost (= 1.76.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-jsi/Default (0.69.1): - - boost (= 1.76.0) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-jsiexecutor (0.69.1): - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-jsinspector (0.69.1) - - ABI46_0_0React-logger (0.69.1): - - glog - - ABI46_0_0react-native-netinfo (9.3.0): - - ABI46_0_0React-Core - - ABI46_0_0react-native-pager-view (5.4.24): - - ABI46_0_0React-Core - - ABI46_0_0react-native-safe-area-context (4.3.1): - - ABI46_0_0RCTRequired - - ABI46_0_0RCTTypeSafety - - ABI46_0_0React - - ABI46_0_0ReactCommon/turbomodule/core - - RCT-Folly - - ABI46_0_0react-native-segmented-control (2.4.0): - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia/ABI46_0_0RNSkia (= 0.1.136) - - ABI46_0_0react-native-skia/Api (= 0.1.136) - - ABI46_0_0react-native-skia/Jsi (= 0.1.136) - - ABI46_0_0react-native-skia/SkiaHeaders (= 0.1.136) - - ABI46_0_0react-native-skia/Utils (= 0.1.136) - - ABI46_0_0react-native-skia/ABI46_0_0RNSkia (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia/Api (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia/Jsi (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia/SkiaHeaders (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-skia/Utils (0.1.136): - - ABI46_0_0React - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0react-native-webview (11.22.4): - - ABI46_0_0React-Core - - ABI46_0_0React-perflogger (0.69.1) - - ABI46_0_0React-RCTActionSheet (0.69.1): - - ABI46_0_0React-Core/RCTActionSheetHeaders (= 0.69.1) - - ABI46_0_0React-RCTAnimation (0.69.1): - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTAnimationHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-RCTBlob (0.69.1): - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTBlobHeaders (= 0.69.1) - - ABI46_0_0React-Core/RCTWebSocket (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-RCTNetwork (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-RCTImage (0.69.1): - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTImageHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-RCTNetwork (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-RCTLinking (0.69.1): - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTLinkingHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - ABI46_0_0React-RCTNetwork (0.69.1): - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTNetworkHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-RCTSettings (0.69.1): - - ABI46_0_0RCTTypeSafety (= 0.69.1) - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTSettingsHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-RCTText (0.69.1): - - ABI46_0_0React-Core/RCTTextHeaders (= 0.69.1) - - ABI46_0_0React-RCTVibration (0.69.1): - - ABI46_0_0React-Codegen (= 0.69.1) - - ABI46_0_0React-Core/RCTVibrationHeaders (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0React-runtimeexecutor (0.69.1): - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0ReactCommon (0.69.1): - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0ReactCommon/react_debug_core (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule (= 0.69.1) - - ABI46_0_0ReactCommon/react_debug_core (0.69.1): - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule (0.69.1): - - ABI46_0_0React-bridging (= 0.69.1) - - ABI46_0_0React-callinvoker (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/samples (= 0.69.1) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0ReactCommon/turbomodule/core (0.69.1): - - ABI46_0_0React-bridging (= 0.69.1) - - ABI46_0_0React-callinvoker (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0ReactCommon/turbomodule/samples (0.69.1): - - ABI46_0_0React-bridging (= 0.69.1) - - ABI46_0_0React-callinvoker (= 0.69.1) - - ABI46_0_0React-Core (= 0.69.1) - - ABI46_0_0React-cxxreact (= 0.69.1) - - ABI46_0_0React-jsi (= 0.69.1) - - ABI46_0_0React-logger (= 0.69.1) - - ABI46_0_0React-perflogger (= 0.69.1) - - ABI46_0_0ReactCommon/turbomodule/core (= 0.69.1) - - DoubleConversion - - glog - - RCT-Folly (= 2021.07.22.00) - - ABI46_0_0RNFlashList (1.1.0): - - ABI46_0_0React-Core - - ABI46_0_0RNGestureHandler (2.5.0): - - ABI46_0_0React-Core - - ABI46_0_0RNReanimated (2.9.1): - - ABI46_0_0RCTRequired - - ABI46_0_0RCTTypeSafety - - ABI46_0_0React-callinvoker - - ABI46_0_0React-Core - - ABI46_0_0React-Core/DevSupport - - ABI46_0_0React-Core/RCTWebSocket - - ABI46_0_0React-CoreModules - - ABI46_0_0React-cxxreact - - ABI46_0_0React-jsi - - ABI46_0_0React-jsiexecutor - - ABI46_0_0React-jsinspector - - ABI46_0_0React-RCTActionSheet - - ABI46_0_0React-RCTAnimation - - ABI46_0_0React-RCTBlob - - ABI46_0_0React-RCTImage - - ABI46_0_0React-RCTLinking - - ABI46_0_0React-RCTNetwork - - ABI46_0_0React-RCTSettings - - ABI46_0_0React-RCTText - - ABI46_0_0ReactCommon/turbomodule/core - - DoubleConversion - - FBLazyVector - - FBReactNativeSpec - - glog - - RCT-Folly - - Yoga - - ABI46_0_0RNScreens (3.15.0): - - ABI46_0_0React-Core - - ABI46_0_0React-RCTImage - - ABI46_0_0stripe-react-native (0.13.1): - - ABI46_0_0React-Core - - Stripe (~> 23.3.0) - - StripeApplePay (~> 23.3.0) - - StripeFinancialConnections (~> 23.3.0) - - StripePayments (~> 23.3.0) - - StripePaymentSheet (~> 23.3.0) - - StripePaymentsUI (~> 23.3.0) - - ABI46_0_0UMAppLoader (3.1.0) - - ABI46_0_0Yoga (1.14.0) - ABI47_0_0EASClient (0.4.0): - ABI47_0_0ExpoModulesCore - ABI47_0_0EXAppleAuthentication (5.0.0): @@ -2885,115 +2243,6 @@ PODS: - ZXingObjC/Core DEPENDENCIES: - - ABI46_0_0EASClient (from `./versioned/sdk46/EASClient`) - - ABI46_0_0EXAppleAuthentication (from `./versioned/sdk46/EXAppleAuthentication`) - - ABI46_0_0EXApplication (from `./versioned/sdk46/EXApplication`) - - ABI46_0_0EXAV (from `./versioned/sdk46/EXAV`) - - ABI46_0_0EXBackgroundFetch (from `./versioned/sdk46/EXBackgroundFetch`) - - ABI46_0_0EXBarCodeScanner (from `./versioned/sdk46/EXBarCodeScanner`) - - ABI46_0_0EXBattery (from `./versioned/sdk46/EXBattery`) - - ABI46_0_0EXBlur (from `./versioned/sdk46/EXBlur`) - - ABI46_0_0EXBrightness (from `./versioned/sdk46/EXBrightness`) - - ABI46_0_0EXCalendar (from `./versioned/sdk46/EXCalendar`) - - ABI46_0_0EXCamera (from `./versioned/sdk46/EXCamera`) - - ABI46_0_0EXConstants (from `./versioned/sdk46/EXConstants`) - - ABI46_0_0EXContacts (from `./versioned/sdk46/EXContacts`) - - ABI46_0_0EXDevice (from `./versioned/sdk46/EXDevice`) - - ABI46_0_0EXDocumentPicker (from `./versioned/sdk46/EXDocumentPicker`) - - ABI46_0_0EXErrorRecovery (from `./versioned/sdk46/EXErrorRecovery`) - - ABI46_0_0EXFileSystem (from `./versioned/sdk46/EXFileSystem`) - - ABI46_0_0EXFirebaseAnalytics (from `./versioned/sdk46/EXFirebaseAnalytics`) - - ABI46_0_0EXFirebaseCore (from `./versioned/sdk46/EXFirebaseCore`) - - ABI46_0_0EXFont (from `./versioned/sdk46/EXFont`) - - ABI46_0_0EXGL (from `./versioned/sdk46/EXGL`) - - ABI46_0_0EXGL_CPP (from `./versioned/sdk46/EXGL_CPP`) - - ABI46_0_0EXImageLoader (from `./versioned/sdk46/EXImageLoader`) - - ABI46_0_0EXJSONUtils (from `./versioned/sdk46/EXJSONUtils`) - - ABI46_0_0EXLocalAuthentication (from `./versioned/sdk46/EXLocalAuthentication`) - - ABI46_0_0EXLocation (from `./versioned/sdk46/EXLocation`) - - ABI46_0_0EXManifests (from `./versioned/sdk46/EXManifests`) - - ABI46_0_0EXMediaLibrary (from `./versioned/sdk46/EXMediaLibrary`) - - ABI46_0_0EXNetwork (from `./versioned/sdk46/EXNetwork`) - - ABI46_0_0EXNotifications (from `./versioned/sdk46/EXNotifications`) - - ABI46_0_0EXPermissions (from `./versioned/sdk46/EXPermissions`) - - ABI46_0_0Expo (from `./versioned/sdk46/Expo`) - - ABI46_0_0ExpoCellular (from `./versioned/sdk46/ExpoCellular`) - - ABI46_0_0ExpoClipboard (from `./versioned/sdk46/ExpoClipboard`) - - ABI46_0_0ExpoCrypto (from `./versioned/sdk46/ExpoCrypto`) - - ABI46_0_0ExpoHaptics (from `./versioned/sdk46/ExpoHaptics`) - - ABI46_0_0ExpoImageManipulator (from `./versioned/sdk46/ExpoImageManipulator`) - - ABI46_0_0ExpoImagePicker (from `./versioned/sdk46/ExpoImagePicker`) - - ABI46_0_0ExpoKeepAwake (from `./versioned/sdk46/ExpoKeepAwake`) - - ABI46_0_0ExpoKit/Expo (from `./versioned-react-native/ABI46_0_0/Expo/ExpoKit`) - - ABI46_0_0ExpoKit/ExpoOptional (from `./versioned-react-native/ABI46_0_0/Expo/ExpoKit`) - - ABI46_0_0ExpoLinearGradient (from `./versioned/sdk46/ExpoLinearGradient`) - - ABI46_0_0ExpoLocalization (from `./versioned/sdk46/ExpoLocalization`) - - ABI46_0_0ExpoMailComposer (from `./versioned/sdk46/ExpoMailComposer`) - - ABI46_0_0ExpoModulesCore (from `./versioned/sdk46/ExpoModulesCore`) - - ABI46_0_0ExpoModulesProvider (from `./versioned/sdk46/ExpoModulesProvider`) - - ABI46_0_0ExpoRandom (from `./versioned/sdk46/ExpoRandom`) - - ABI46_0_0ExpoSystemUI (from `./versioned/sdk46/ExpoSystemUI`) - - ABI46_0_0ExpoTrackingTransparency (from `./versioned/sdk46/ExpoTrackingTransparency`) - - ABI46_0_0ExpoWebBrowser (from `./versioned/sdk46/ExpoWebBrowser`) - - ABI46_0_0EXPrint (from `./versioned/sdk46/EXPrint`) - - ABI46_0_0EXScreenCapture (from `./versioned/sdk46/EXScreenCapture`) - - ABI46_0_0EXScreenOrientation (from `./versioned/sdk46/EXScreenOrientation`) - - ABI46_0_0EXSecureStore (from `./versioned/sdk46/EXSecureStore`) - - ABI46_0_0EXSensors (from `./versioned/sdk46/EXSensors`) - - ABI46_0_0EXSharing (from `./versioned/sdk46/EXSharing`) - - ABI46_0_0EXSMS (from `./versioned/sdk46/EXSMS`) - - ABI46_0_0EXSpeech (from `./versioned/sdk46/EXSpeech`) - - ABI46_0_0EXSplashScreen (from `./versioned/sdk46/EXSplashScreen`) - - ABI46_0_0EXSQLite (from `./versioned/sdk46/EXSQLite`) - - ABI46_0_0EXStoreReview (from `./versioned/sdk46/EXStoreReview`) - - ABI46_0_0EXStructuredHeaders (from `./versioned/sdk46/EXStructuredHeaders`) - - ABI46_0_0EXTaskManager (from `./versioned/sdk46/EXTaskManager`) - - ABI46_0_0EXUpdates (from `./versioned/sdk46/EXUpdates`) - - ABI46_0_0EXUpdatesInterface (from `./versioned/sdk46/EXUpdatesInterface`) - - ABI46_0_0EXVideoThumbnails (from `./versioned/sdk46/EXVideoThumbnails`) - - ABI46_0_0FBLazyVector (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/FBLazyVector`) - - ABI46_0_0FBReactNativeSpec (from `./versioned-react-native/ABI46_0_0/ReactNative/React/FBReactNativeSpec`) - - ABI46_0_0lottie-react-native (from `./vendored/sdk46/lottie-react-native`) - - ABI46_0_0RCTRequired (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/RCTRequired`) - - ABI46_0_0RCTTypeSafety (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/TypeSafety`) - - ABI46_0_0React (from `./versioned-react-native/ABI46_0_0/ReactNative/`) - - ABI46_0_0React-bridging (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon`) - - ABI46_0_0React-callinvoker (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/callinvoker`) - - ABI46_0_0React-Codegen (from `versioned-react-native/ABI46_0_0/ReactNative/codegen/ios`) - - ABI46_0_0React-Core (from `./versioned-react-native/ABI46_0_0/ReactNative/`) - - ABI46_0_0React-Core/DevSupport (from `./versioned-react-native/ABI46_0_0/ReactNative/`) - - ABI46_0_0React-Core/RCTWebSocket (from `./versioned-react-native/ABI46_0_0/ReactNative/`) - - ABI46_0_0React-CoreModules (from `./versioned-react-native/ABI46_0_0/ReactNative/React/CoreModules`) - - ABI46_0_0React-cxxreact (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/cxxreact`) - - ABI46_0_0React-jsi (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsi`) - - ABI46_0_0React-jsiexecutor (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsiexecutor`) - - ABI46_0_0React-jsinspector (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsinspector`) - - ABI46_0_0React-logger (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/logger`) - - "ABI46_0_0react-native-netinfo (from `./vendored/sdk46/@react-native-community/netinfo`)" - - ABI46_0_0react-native-pager-view (from `./vendored/sdk46/react-native-pager-view`) - - ABI46_0_0react-native-safe-area-context (from `./vendored/sdk46/react-native-safe-area-context`) - - "ABI46_0_0react-native-segmented-control (from `./vendored/sdk46/@react-native-segmented-control/segmented-control`)" - - "ABI46_0_0react-native-skia (from `./vendored/sdk46/@shopify/react-native-skia`)" - - ABI46_0_0react-native-webview (from `./vendored/sdk46/react-native-webview`) - - ABI46_0_0React-perflogger (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/reactperflogger`) - - ABI46_0_0React-RCTActionSheet (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/ActionSheetIOS`) - - ABI46_0_0React-RCTAnimation (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/NativeAnimation`) - - ABI46_0_0React-RCTBlob (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob`) - - ABI46_0_0React-RCTImage (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Image`) - - ABI46_0_0React-RCTLinking (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/LinkingIOS`) - - ABI46_0_0React-RCTNetwork (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Network`) - - ABI46_0_0React-RCTSettings (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Settings`) - - ABI46_0_0React-RCTText (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Text`) - - ABI46_0_0React-RCTVibration (from `./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Vibration`) - - ABI46_0_0React-runtimeexecutor (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/runtimeexecutor`) - - ABI46_0_0ReactCommon/turbomodule/core (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon`) - - "ABI46_0_0RNFlashList (from `./vendored/sdk46/@shopify/flash-list`)" - - ABI46_0_0RNGestureHandler (from `./vendored/sdk46/react-native-gesture-handler`) - - ABI46_0_0RNReanimated (from `./vendored/sdk46/react-native-reanimated`) - - ABI46_0_0RNScreens (from `./vendored/sdk46/react-native-screens`) - - "ABI46_0_0stripe-react-native (from `./vendored/sdk46/@stripe/stripe-react-native`)" - - ABI46_0_0UMAppLoader (from `./versioned/sdk46/UMAppLoader`) - - ABI46_0_0Yoga (from `./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/yoga`) - ABI47_0_0EASClient (from `./versioned/sdk47/EASClient`) - ABI47_0_0EXAppleAuthentication (from `./versioned/sdk47/EXAppleAuthentication`) - ABI47_0_0EXApplication (from `./versioned/sdk47/EXApplication`) @@ -3403,218 +2652,6 @@ SPEC REPOS: - ZXingObjC EXTERNAL SOURCES: - ABI46_0_0EASClient: - :path: "./versioned/sdk46/EASClient" - ABI46_0_0EXAppleAuthentication: - :path: "./versioned/sdk46/EXAppleAuthentication" - ABI46_0_0EXApplication: - :path: "./versioned/sdk46/EXApplication" - ABI46_0_0EXAV: - :path: "./versioned/sdk46/EXAV" - ABI46_0_0EXBackgroundFetch: - :path: "./versioned/sdk46/EXBackgroundFetch" - ABI46_0_0EXBarCodeScanner: - :path: "./versioned/sdk46/EXBarCodeScanner" - ABI46_0_0EXBattery: - :path: "./versioned/sdk46/EXBattery" - ABI46_0_0EXBlur: - :path: "./versioned/sdk46/EXBlur" - ABI46_0_0EXBrightness: - :path: "./versioned/sdk46/EXBrightness" - ABI46_0_0EXCalendar: - :path: "./versioned/sdk46/EXCalendar" - ABI46_0_0EXCamera: - :path: "./versioned/sdk46/EXCamera" - ABI46_0_0EXConstants: - :path: "./versioned/sdk46/EXConstants" - ABI46_0_0EXContacts: - :path: "./versioned/sdk46/EXContacts" - ABI46_0_0EXDevice: - :path: "./versioned/sdk46/EXDevice" - ABI46_0_0EXDocumentPicker: - :path: "./versioned/sdk46/EXDocumentPicker" - ABI46_0_0EXErrorRecovery: - :path: "./versioned/sdk46/EXErrorRecovery" - ABI46_0_0EXFileSystem: - :path: "./versioned/sdk46/EXFileSystem" - ABI46_0_0EXFirebaseAnalytics: - :path: "./versioned/sdk46/EXFirebaseAnalytics" - ABI46_0_0EXFirebaseCore: - :path: "./versioned/sdk46/EXFirebaseCore" - ABI46_0_0EXFont: - :path: "./versioned/sdk46/EXFont" - ABI46_0_0EXGL: - :path: "./versioned/sdk46/EXGL" - ABI46_0_0EXGL_CPP: - :path: "./versioned/sdk46/EXGL_CPP" - ABI46_0_0EXImageLoader: - :path: "./versioned/sdk46/EXImageLoader" - ABI46_0_0EXJSONUtils: - :path: "./versioned/sdk46/EXJSONUtils" - ABI46_0_0EXLocalAuthentication: - :path: "./versioned/sdk46/EXLocalAuthentication" - ABI46_0_0EXLocation: - :path: "./versioned/sdk46/EXLocation" - ABI46_0_0EXManifests: - :path: "./versioned/sdk46/EXManifests" - ABI46_0_0EXMediaLibrary: - :path: "./versioned/sdk46/EXMediaLibrary" - ABI46_0_0EXNetwork: - :path: "./versioned/sdk46/EXNetwork" - ABI46_0_0EXNotifications: - :path: "./versioned/sdk46/EXNotifications" - ABI46_0_0EXPermissions: - :path: "./versioned/sdk46/EXPermissions" - ABI46_0_0Expo: - :path: "./versioned/sdk46/Expo" - ABI46_0_0ExpoCellular: - :path: "./versioned/sdk46/ExpoCellular" - ABI46_0_0ExpoClipboard: - :path: "./versioned/sdk46/ExpoClipboard" - ABI46_0_0ExpoCrypto: - :path: "./versioned/sdk46/ExpoCrypto" - ABI46_0_0ExpoHaptics: - :path: "./versioned/sdk46/ExpoHaptics" - ABI46_0_0ExpoImageManipulator: - :path: "./versioned/sdk46/ExpoImageManipulator" - ABI46_0_0ExpoImagePicker: - :path: "./versioned/sdk46/ExpoImagePicker" - ABI46_0_0ExpoKeepAwake: - :path: "./versioned/sdk46/ExpoKeepAwake" - ABI46_0_0ExpoKit: - :path: "./versioned-react-native/ABI46_0_0/Expo/ExpoKit" - ABI46_0_0ExpoLinearGradient: - :path: "./versioned/sdk46/ExpoLinearGradient" - ABI46_0_0ExpoLocalization: - :path: "./versioned/sdk46/ExpoLocalization" - ABI46_0_0ExpoMailComposer: - :path: "./versioned/sdk46/ExpoMailComposer" - ABI46_0_0ExpoModulesCore: - :path: "./versioned/sdk46/ExpoModulesCore" - ABI46_0_0ExpoModulesProvider: - :path: "./versioned/sdk46/ExpoModulesProvider" - ABI46_0_0ExpoRandom: - :path: "./versioned/sdk46/ExpoRandom" - ABI46_0_0ExpoSystemUI: - :path: "./versioned/sdk46/ExpoSystemUI" - ABI46_0_0ExpoTrackingTransparency: - :path: "./versioned/sdk46/ExpoTrackingTransparency" - ABI46_0_0ExpoWebBrowser: - :path: "./versioned/sdk46/ExpoWebBrowser" - ABI46_0_0EXPrint: - :path: "./versioned/sdk46/EXPrint" - ABI46_0_0EXScreenCapture: - :path: "./versioned/sdk46/EXScreenCapture" - ABI46_0_0EXScreenOrientation: - :path: "./versioned/sdk46/EXScreenOrientation" - ABI46_0_0EXSecureStore: - :path: "./versioned/sdk46/EXSecureStore" - ABI46_0_0EXSensors: - :path: "./versioned/sdk46/EXSensors" - ABI46_0_0EXSharing: - :path: "./versioned/sdk46/EXSharing" - ABI46_0_0EXSMS: - :path: "./versioned/sdk46/EXSMS" - ABI46_0_0EXSpeech: - :path: "./versioned/sdk46/EXSpeech" - ABI46_0_0EXSplashScreen: - :path: "./versioned/sdk46/EXSplashScreen" - ABI46_0_0EXSQLite: - :path: "./versioned/sdk46/EXSQLite" - ABI46_0_0EXStoreReview: - :path: "./versioned/sdk46/EXStoreReview" - ABI46_0_0EXStructuredHeaders: - :path: "./versioned/sdk46/EXStructuredHeaders" - ABI46_0_0EXTaskManager: - :path: "./versioned/sdk46/EXTaskManager" - ABI46_0_0EXUpdates: - :path: "./versioned/sdk46/EXUpdates" - ABI46_0_0EXUpdatesInterface: - :path: "./versioned/sdk46/EXUpdatesInterface" - ABI46_0_0EXVideoThumbnails: - :path: "./versioned/sdk46/EXVideoThumbnails" - ABI46_0_0FBLazyVector: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/FBLazyVector" - ABI46_0_0FBReactNativeSpec: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/React/FBReactNativeSpec" - ABI46_0_0lottie-react-native: - :path: "./vendored/sdk46/lottie-react-native" - ABI46_0_0RCTRequired: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/RCTRequired" - ABI46_0_0RCTTypeSafety: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/TypeSafety" - ABI46_0_0React: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/" - ABI46_0_0React-bridging: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon" - ABI46_0_0React-callinvoker: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/callinvoker" - ABI46_0_0React-Codegen: - :path: versioned-react-native/ABI46_0_0/ReactNative/codegen/ios - ABI46_0_0React-Core: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/" - ABI46_0_0React-CoreModules: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/React/CoreModules" - ABI46_0_0React-cxxreact: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/cxxreact" - ABI46_0_0React-jsi: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsi" - ABI46_0_0React-jsiexecutor: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsiexecutor" - ABI46_0_0React-jsinspector: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/jsinspector" - ABI46_0_0React-logger: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/logger" - ABI46_0_0react-native-netinfo: - :path: "./vendored/sdk46/@react-native-community/netinfo" - ABI46_0_0react-native-pager-view: - :path: "./vendored/sdk46/react-native-pager-view" - ABI46_0_0react-native-safe-area-context: - :path: "./vendored/sdk46/react-native-safe-area-context" - ABI46_0_0react-native-segmented-control: - :path: "./vendored/sdk46/@react-native-segmented-control/segmented-control" - ABI46_0_0react-native-skia: - :path: "./vendored/sdk46/@shopify/react-native-skia" - ABI46_0_0react-native-webview: - :path: "./vendored/sdk46/react-native-webview" - ABI46_0_0React-perflogger: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/reactperflogger" - ABI46_0_0React-RCTActionSheet: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/ActionSheetIOS" - ABI46_0_0React-RCTAnimation: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/NativeAnimation" - ABI46_0_0React-RCTBlob: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob" - ABI46_0_0React-RCTImage: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Image" - ABI46_0_0React-RCTLinking: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/LinkingIOS" - ABI46_0_0React-RCTNetwork: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Network" - ABI46_0_0React-RCTSettings: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Settings" - ABI46_0_0React-RCTText: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Text" - ABI46_0_0React-RCTVibration: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/Libraries/Vibration" - ABI46_0_0React-runtimeexecutor: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/runtimeexecutor" - ABI46_0_0ReactCommon: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon" - ABI46_0_0RNFlashList: - :path: "./vendored/sdk46/@shopify/flash-list" - ABI46_0_0RNGestureHandler: - :path: "./vendored/sdk46/react-native-gesture-handler" - ABI46_0_0RNReanimated: - :path: "./vendored/sdk46/react-native-reanimated" - ABI46_0_0RNScreens: - :path: "./vendored/sdk46/react-native-screens" - ABI46_0_0stripe-react-native: - :path: "./vendored/sdk46/@stripe/stripe-react-native" - ABI46_0_0UMAppLoader: - :path: "./versioned/sdk46/UMAppLoader" - ABI46_0_0Yoga: - :path: "./versioned-react-native/ABI46_0_0/ReactNative/ReactCommon/yoga" ABI47_0_0EASClient: :path: "./versioned/sdk47/EASClient" ABI47_0_0EXAppleAuthentication: @@ -4292,112 +3329,6 @@ CHECKOUT OPTIONS: :git: https://github.com/googlemaps/google-maps-ios-utils.git SPEC CHECKSUMS: - ABI46_0_0EASClient: c419fef100fbdac83e755c790d6b427594d4263e - ABI46_0_0EXAppleAuthentication: 61c95f030898d57ecbdf1e8fe05d9b43d463b507 - ABI46_0_0EXApplication: bc0b99d9965e76b56375ce7006a84d16a3f784fa - ABI46_0_0EXAV: 609671fc101b9eefe85fe2c216867e7eb04def70 - ABI46_0_0EXBackgroundFetch: 54f12bb20178ebc63320c729d20a69c2906232f9 - ABI46_0_0EXBarCodeScanner: 7ae29d021f64c16f436dc21440a5e2fb5fa48a9a - ABI46_0_0EXBattery: a96519011c94a4915435cd4100235cad4029a69c - ABI46_0_0EXBlur: abbc5b2bdeaf94d8bff00acd47ba73fb3c807f14 - ABI46_0_0EXBrightness: a154528b4f79b820b83b349d9ec4295561cb77bf - ABI46_0_0EXCalendar: bb4d1bda3fb449e30305451c76bb94418e385060 - ABI46_0_0EXCamera: ad4b5895fb65037666a5d2150263d9c25693479d - ABI46_0_0EXConstants: 26d998af85a185e798c2294168e0083aa7cec847 - ABI46_0_0EXContacts: fa8d1d9c651e8a0e97b1c8e4aa105482d180aee2 - ABI46_0_0EXDevice: b474ca9136f899a023bb8e46f9286ff3b7130c68 - ABI46_0_0EXDocumentPicker: e3cdaea0d1a753a27a16a742f11fc13b68abc73d - ABI46_0_0EXErrorRecovery: 57414b3f06d179dcb9103e84a8d29c20a7844157 - ABI46_0_0EXFileSystem: 7c3f65d29dd12cadccd6e46c906758bbdbe864cc - ABI46_0_0EXFirebaseAnalytics: 8d16689cf40fdfa0c625993f2490a61b5786c98f - ABI46_0_0EXFirebaseCore: e2c8e2fe87a94a871e661c7278d67d3aac8732de - ABI46_0_0EXFont: 07cddb696a53caef3fe8d3685d8008cdd76885b3 - ABI46_0_0EXGL: 18dcc889e7caeca13a4883282f3aa068b1f33b43 - ABI46_0_0EXGL_CPP: c00848d40a2f0a746ccb231ea3cc7ea5bedc6dcc - ABI46_0_0EXImageLoader: e52d34e905630f082cc23c41b28dd2408d6aa0e8 - ABI46_0_0EXJSONUtils: 89154664b8ecb4315a47591caaa3ccf12f1f2ca8 - ABI46_0_0EXLocalAuthentication: bd9445fdda9de37a0b1f73df7844de2ce6a76d8b - ABI46_0_0EXLocation: b6f74f69493a35497454f03c429704d88aa07c60 - ABI46_0_0EXManifests: d203159249d1d8ba8dd1ef5725effc651fc8c2c2 - ABI46_0_0EXMediaLibrary: 648e166d5047931d8db1b768540edbacd0515c77 - ABI46_0_0EXNetwork: fe77b0820c214ce55525d0bbd4f347c912e9c2d4 - ABI46_0_0EXNotifications: b5a008cc25ca5204114cb98d4ffabc9c9cd19669 - ABI46_0_0EXPermissions: 1d90bf8168894c4906b24a782497c09296215ad9 - ABI46_0_0Expo: 84dcb14a240c71c2f304708406f5895304fcabc5 - ABI46_0_0ExpoCellular: e0956db7d8e3423c7146f44b76dde0d59fc31534 - ABI46_0_0ExpoClipboard: 70280eacf227752d2372fa94fe53547f30e648ca - ABI46_0_0ExpoCrypto: 496b0140709f210fcfcfa64bd058b13199eb7679 - ABI46_0_0ExpoHaptics: b1b64ba48925fbc2e8530bb314fab910f685f235 - ABI46_0_0ExpoImageManipulator: d9c826732149dfa28c997f524d663d009fa536b6 - ABI46_0_0ExpoImagePicker: 0374ce58edabd479a94717cbc32418faf93bf6b6 - ABI46_0_0ExpoKeepAwake: 2a2af5decb4280b6d025b1b5043cd9370d2ab67f - ABI46_0_0ExpoKit: 3bdffb064a39985976199716717e1d9f5d914ba6 - ABI46_0_0ExpoLinearGradient: 9766a6de9eaad87afb1dfb1391403e70995b946e - ABI46_0_0ExpoLocalization: a0d35d7490ab40a3015b26abbeb1d6da98daef78 - ABI46_0_0ExpoMailComposer: f6dc505417b6989d4fdaae7480f7b6add2deca62 - ABI46_0_0ExpoModulesCore: a7b35037b1cb3a8eedbbd91c366d287b2269f32e - ABI46_0_0ExpoModulesProvider: 21ca8fe647a02cd2f493c5fe08458d8eb3716559 - ABI46_0_0ExpoRandom: 5bb321e80620d5c2f942403d08a906774030894c - ABI46_0_0ExpoSystemUI: 07c019a280376bc0a4ac4261fd6cece813d4b2a3 - ABI46_0_0ExpoTrackingTransparency: 8139dcec2232dada75d10c1214982ccebe329b2b - ABI46_0_0ExpoWebBrowser: 1c0cd4b65cbe1505262cecd66c66293ad2f68f61 - ABI46_0_0EXPrint: e5f14a9f099b7c608b2b26baeeeae5e700eeb3f8 - ABI46_0_0EXScreenCapture: 55dd08cb1ab74008bac9446a79d627f41f44997d - ABI46_0_0EXScreenOrientation: 45860b5e24e2c5436518bc10cf138e7410a24e35 - ABI46_0_0EXSecureStore: d0b96876978eb0cdf3822d4b563bfb518da8106b - ABI46_0_0EXSensors: 63fb33eb2e40833c72213a3bb1af07f91727a71d - ABI46_0_0EXSharing: 11a381e9566a2fe97b7d3590b886946f0ac24b79 - ABI46_0_0EXSMS: c97be99a55c48397f2ec6ca58345b998ec9f8bcc - ABI46_0_0EXSpeech: de718d9b91eba2b96d3a7d31e1e4793af006ee65 - ABI46_0_0EXSplashScreen: 05abce0499540df29d00615a53efcadb7a064760 - ABI46_0_0EXSQLite: 9a39dfc9306273684de6c15bbb46e2b9b1d99334 - ABI46_0_0EXStoreReview: 3dd60d9b77240a936b2361ef5e5460c2ed9d0e75 - ABI46_0_0EXStructuredHeaders: 74a0ebdd4eb750733600cf4a04806824190d94ea - ABI46_0_0EXTaskManager: 3a12e6ab0bda7703e506efd75da1964ebb690d52 - ABI46_0_0EXUpdates: 207d6427fefc5041d12c4b08bebf18f60639cb51 - ABI46_0_0EXUpdatesInterface: 62820958b4eb2741c45369a3a997f60851d4eda5 - ABI46_0_0EXVideoThumbnails: 4fc2a132668c006c73112fa955f9da702f476328 - ABI46_0_0FBLazyVector: 0ce5b1a14996f1a7ba2b18761d61bac0550a1a70 - ABI46_0_0FBReactNativeSpec: f7f147e37e2d8d2c9c1f6353f90b3dfd267601c3 - ABI46_0_0lottie-react-native: adca905870cb918b5e50095dedc403d9e60fde0f - ABI46_0_0RCTRequired: 736812a646562cd807a16ff2abdab8395f146f06 - ABI46_0_0RCTTypeSafety: bb3ebe870703849d2dcd7631b91186056279fd40 - ABI46_0_0React: 73f06af71b9d85e79e538ee432dcca44a6254735 - ABI46_0_0React-bridging: 886cd0101bb862626dc799e69b8bc86d14ce355d - ABI46_0_0React-callinvoker: 9f77dff726b09481458a4c8be8e3ea053cf699b3 - ABI46_0_0React-Codegen: 4ffad14be42cce6b1904935288d82236bdfd4d47 - ABI46_0_0React-Core: 04b7327dfeabb021985c80eddb9dbce60112e179 - ABI46_0_0React-CoreModules: f8b602ee6c319b48a78742fa32654141d30edf3c - ABI46_0_0React-cxxreact: 19d64ef2bb275094a3225ef8b2330f2c4ba4820b - ABI46_0_0React-jsi: d7a578e3e286d5b29d45bb123524a14eb75e8801 - ABI46_0_0React-jsiexecutor: a518ab77fc66e2b717a0c2186a33efbc497c7da2 - ABI46_0_0React-jsinspector: b456c205e72a57245f3c2cb92438c43d130f8fbc - ABI46_0_0React-logger: 72465c6da7faf872634a99e4ecf8db3202f0cad3 - ABI46_0_0react-native-netinfo: 3d67b51d8bf0aadd511995da502bcb44de94a844 - ABI46_0_0react-native-pager-view: 6811eabddc3dd8f24272e66842c8587a3589e894 - ABI46_0_0react-native-safe-area-context: 93911af12fe871df4eb3eba1d9b6acd8ec9525d1 - ABI46_0_0react-native-segmented-control: 88712b954346b6e10d4d463a5e56232154244a71 - ABI46_0_0react-native-skia: 3ad8c10c5fac413576c8ab7fc87a7763fcf73f5a - ABI46_0_0react-native-webview: 6914e1a2f14e0ca64ad70510bf5a645790766577 - ABI46_0_0React-perflogger: 072d224605a449c872a8e089b72e3401603b92ab - ABI46_0_0React-RCTActionSheet: 62f6aaee6fef914858813e3f7aaacda4d48359f2 - ABI46_0_0React-RCTAnimation: 473895b59e815365ded3e974bce211169ae5a041 - ABI46_0_0React-RCTBlob: a89dd1cd14ec85b81f1fd332fdba575d64f37506 - ABI46_0_0React-RCTImage: ca3b28770048fa9da8b2975c49d481d874b1d63c - ABI46_0_0React-RCTLinking: dd08724556f60487bb39d35a06e52323a35410e0 - ABI46_0_0React-RCTNetwork: e8eb1a61f5ec47e99f2e912b92660a538821f3c4 - ABI46_0_0React-RCTSettings: 1066f68de72b6bc03e6861c132f160c457de9d10 - ABI46_0_0React-RCTText: 8d3b22b6fdfac3fadde0b006497d7f9add259acf - ABI46_0_0React-RCTVibration: 3c38a3aa6f6e25c369195444f1b92543f6e7b4b3 - ABI46_0_0React-runtimeexecutor: 45c3ec3d750c61eec589f3a23f642e606be94a70 - ABI46_0_0ReactCommon: baae85ac740f021bf2bbcd9fcdeb5fe5ac916d59 - ABI46_0_0RNFlashList: 6c43b292eae5c8805241097c437b0f970cb66465 - ABI46_0_0RNGestureHandler: 42f00c4ce0ac12c4c51081de65e2ba831dfd5cb7 - ABI46_0_0RNReanimated: c68969af1eae15d09ee5b8b3b61407feb5db9884 - ABI46_0_0RNScreens: f521a4613dc2207aab4fcd72b5bb7cef74104a39 - ABI46_0_0stripe-react-native: 8552dcbc30ff4f9421642865f6f3eade43afd60c - ABI46_0_0UMAppLoader: 271ab738d153f711d91da6b1b7a3a981d668dcfe - ABI46_0_0Yoga: 898c6ba86e91d19b0810efa11e8a6c7e5559a64d ABI47_0_0EASClient: 6736a1df49422a126aa94f9ce746cfa0793b18b1 ABI47_0_0EXAppleAuthentication: 5da563f3926915b1eabb2607c065ceff5983848e ABI47_0_0EXApplication: 6d0e2d2efa44f9758ee48c5ac06915cd7baeec0a diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ABI46_0_0react-native-netinfo.podspec.json b/ios/vendored/sdk46/@react-native-community/netinfo/ABI46_0_0react-native-netinfo.podspec.json deleted file mode 100644 index a5f428c773bedc..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ABI46_0_0react-native-netinfo.podspec.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "ABI46_0_0react-native-netinfo", - "version": "9.3.0", - "summary": "ABI46_0_0React Native Network Info API for iOS & Android", - "license": "MIT", - "authors": "Matt Oakes ", - "homepage": "https://github.com/react-native-netinfo/react-native-netinfo#readme", - "platforms": { - "ios": "9.0", - "tvos": "9.2", - "osx": "10.14" - }, - "source": { - "git": "https://github.com/react-native-community/react-native-netinfo.git", - "tag": "v9.3.0" - }, - "source_files": "ios/**/*.{h,m}", - "dependencies": { - "ABI46_0_0React-Core": [] - } -} diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.h b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.h deleted file mode 100644 index 316c45f7ef6253..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -// Based on the ConnectionType enum described in the W3C Network Information API spec -// (https://wicg.github.io/netinfo/). -static NSString *const ABI46_0_0RNCConnectionTypeUnknown = @"unknown"; -static NSString *const ABI46_0_0RNCConnectionTypeNone = @"none"; -static NSString *const ABI46_0_0RNCConnectionTypeWifi = @"wifi"; -static NSString *const ABI46_0_0RNCConnectionTypeCellular = @"cellular"; -static NSString *const ABI46_0_0RNCConnectionTypeEthernet = @"ethernet"; - -// Based on the EffectiveConnectionType enum described in the W3C Network Information API spec -// (https://wicg.github.io/netinfo/). -static NSString *const ABI46_0_0RNCCellularGeneration2g = @"2g"; -static NSString *const ABI46_0_0RNCCellularGeneration3g = @"3g"; -static NSString *const ABI46_0_0RNCCellularGeneration4g = @"4g"; -static NSString *const ABI46_0_0RNCCellularGeneration5g = @"5g"; - -@interface ABI46_0_0RNCConnectionState : NSObject - -- (instancetype)init; -- (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags; -- (BOOL)isEqualToConnectionState:(ABI46_0_0RNCConnectionState *)otherState; - -@property (nonatomic, strong, readonly) NSString *type; -@property (nullable, nonatomic, strong, readonly) NSString *cellularGeneration; -@property (nonatomic, readonly) BOOL connected; -@property (nonatomic, readonly) BOOL expensive; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.m b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.m deleted file mode 100644 index d21d252531182e..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionState.m +++ /dev/null @@ -1,117 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCConnectionState.h" -#if !TARGET_OS_TV -#import -#endif - -#if TARGET_OS_TV || TARGET_OS_OSX -#include -#endif - -@implementation ABI46_0_0RNCConnectionState - -// Creates a new "blank" state -- (instancetype)init -{ - self = [super init]; - if (self) { - _type = ABI46_0_0RNCConnectionTypeUnknown; - _cellularGeneration = nil; - _expensive = false; - } - return self; -} - -// Creates the state from the given reachability references -- (instancetype)initWithReachabilityFlags:(SCNetworkReachabilityFlags)flags -{ - self = [self init]; - if (self) { - _type = ABI46_0_0RNCConnectionTypeUnknown; - _cellularGeneration = nil; - _expensive = false; - - if ((flags & kSCNetworkReachabilityFlagsReachable) == 0 || - (flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0) { - _type = ABI46_0_0RNCConnectionTypeNone; - } -#if !TARGET_OS_TV && !TARGET_OS_OSX - else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { - _type = ABI46_0_0RNCConnectionTypeCellular; - _expensive = true; - - CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; - if (netinfo) { - if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyGPRS] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyEdge] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMA1x]) { - _cellularGeneration = ABI46_0_0RNCCellularGeneration2g; - } else if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyWCDMA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSDPA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyHSUPA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORev0] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyCDMAEVDORevB] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyeHRPD]) { - _cellularGeneration = ABI46_0_0RNCCellularGeneration3g; - } else if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyLTE]) { - _cellularGeneration = ABI46_0_0RNCCellularGeneration4g; - } else if (@available(iOS 14.1, *)) { - if ([netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyNRNSA] || - [netinfo.currentRadioAccessTechnology isEqualToString:CTRadioAccessTechnologyNR]) { - _cellularGeneration = ABI46_0_0RNCCellularGeneration5g; - } - } - } - } -#endif - else { - _type = ABI46_0_0RNCConnectionTypeWifi; -#if TARGET_OS_TV || TARGET_OS_OSX - struct ifaddrs *interfaces = NULL; - struct ifaddrs *temp_addr = NULL; - int success = 0; - // retrieve the current interfaces - returns 0 on success - success = getifaddrs(&interfaces); - if (success == 0) { - // Loop through linked list of interfaces - temp_addr = interfaces; - while (temp_addr != NULL) { - if (temp_addr->ifa_addr->sa_family == AF_INET) { - // Check if interface is en0 which is the ethernet connection on the Apple TV - NSString* ifname = [NSString stringWithUTF8String:temp_addr->ifa_name]; - if ([ifname isEqualToString:@"en0"]) { - _type = ABI46_0_0RNCConnectionTypeEthernet; - } - } - temp_addr = temp_addr->ifa_next; - } - } - // Free memory - freeifaddrs(interfaces); -#endif - } - } - return self; -} - -// Checks if two states are equal -- (BOOL)isEqualToConnectionState:(ABI46_0_0RNCConnectionState *)otherState -{ - return [self.type isEqualToString:otherState.type] - && [self.cellularGeneration isEqualToString:otherState.cellularGeneration] - && self.expensive == otherState.expensive; -} - -- (BOOL)connected -{ - return ![self.type isEqualToString:ABI46_0_0RNCConnectionTypeNone] && ![self.type isEqualToString:ABI46_0_0RNCConnectionTypeUnknown]; -} - -@end diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.h b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.h deleted file mode 100644 index 6efdb015e6595d..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNCConnectionState.h" - -NS_ASSUME_NONNULL_BEGIN - -@class ABI46_0_0RNCConnectionStateWatcher; - - -@protocol ABI46_0_0RNCConnectionStateWatcherDelegate - -- (void)connectionStateWatcher:(ABI46_0_0RNCConnectionStateWatcher *)connectionStateWatcher didUpdateState:(ABI46_0_0RNCConnectionState *)state; - -@end - -@interface ABI46_0_0RNCConnectionStateWatcher : NSObject - -- (instancetype)initWithDelegate:(id)delegate; -- (ABI46_0_0RNCConnectionState *)currentState; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.m b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.m deleted file mode 100644 index 0a7f8ba53974d8..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCConnectionStateWatcher.m +++ /dev/null @@ -1,135 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCConnectionStateWatcher.h" -#import -#import - -@interface ABI46_0_0RNCConnectionStateWatcher () - -@property (nonatomic) SCNetworkReachabilityRef reachabilityRef; -@property (nullable, weak, nonatomic) id delegate; -@property (nonatomic) SCNetworkReachabilityFlags lastFlags; -@property (nonnull, strong, nonatomic) ABI46_0_0RNCConnectionState *state; - -@end - -@implementation ABI46_0_0RNCConnectionStateWatcher - -#pragma mark - Lifecycle - -- (instancetype)initWithDelegate:(id)delegate -{ - self = [self init]; - if (self) { - _delegate = delegate; - _state = [[ABI46_0_0RNCConnectionState alloc] init]; - _reachabilityRef = [self createReachabilityRef]; - } - return self; -} - -- (void)dealloc -{ - self.delegate = nil; - - if (self.reachabilityRef != nil) { - SCNetworkReachabilityUnscheduleFromRunLoop(self.reachabilityRef, CFRunLoopGetMain(), kCFRunLoopCommonModes); - CFRelease(self.reachabilityRef); - self.reachabilityRef = nil; - } -} - -#pragma mark - Public methods - -- (ABI46_0_0RNCConnectionState *)currentState -{ - return self.state; -} - -#pragma mark - Callback - -typedef void (^ABI46_0_0RNCConnectionStateUpdater)(SCNetworkReachabilityFlags); - -static void ABI46_0_0RNCReachabilityCallback(__unused SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info) -{ - ABI46_0_0RNCConnectionStateUpdater block = (__bridge id)info; - if (block != nil) { - block(flags); - } -} - -static void ABI46_0_0RNCReachabilityContextRelease(const void *info) -{ - Block_release(info); -} - -static const void *ABI46_0_0RNCReachabilityContextRetain(const void *info) -{ - return Block_copy(info); -} - -- (void)update:(SCNetworkReachabilityFlags)flags -{ - self.lastFlags = flags; - self.state = [[ABI46_0_0RNCConnectionState alloc] initWithReachabilityFlags:flags]; -} - -#pragma mark - Setters - -- (void)setState:(ABI46_0_0RNCConnectionState *)state -{ - if (![state isEqualToConnectionState:_state]) { - _state = state; - - [self updateDelegate]; - } -} - -#pragma mark - Utilities - -- (void)updateDelegate -{ - [self.delegate connectionStateWatcher:self didUpdateState:self.state]; -} - -- (SCNetworkReachabilityRef)createReachabilityRef -{ - struct sockaddr_in zeroAddress; - bzero(&zeroAddress, sizeof(zeroAddress)); - zeroAddress.sin_len = sizeof(zeroAddress); - zeroAddress.sin_family = AF_INET; - - SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *) &zeroAddress); - - __weak typeof(self) weakSelf = self; - ABI46_0_0RNCConnectionStateUpdater callback = ^(SCNetworkReachabilityFlags flags) { - __strong __typeof(weakSelf) strongSelf = weakSelf; - if (strongSelf != nil) { - [strongSelf update:flags]; - } - }; - - SCNetworkReachabilityContext context = { - 0, - (__bridge void *)callback, - ABI46_0_0RNCReachabilityContextRetain, - ABI46_0_0RNCReachabilityContextRelease, - NULL - }; - SCNetworkReachabilitySetCallback(reachability, ABI46_0_0RNCReachabilityCallback, &context); - SCNetworkReachabilityScheduleWithRunLoop(reachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); - - // Set the state the first time - SCNetworkReachabilityFlags flags; - SCNetworkReachabilityGetFlags(reachability, &flags); - [self update:flags]; - - return reachability; -} - -@end diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.h b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.h deleted file mode 100644 index 729d5251e2f38a..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCNetInfo : ABI46_0_0RCTEventEmitter - -@end diff --git a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.m b/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.m deleted file mode 100644 index b623e4d684d2ea..00000000000000 --- a/ios/vendored/sdk46/@react-native-community/netinfo/ios/ABI46_0_0RNCNetInfo.m +++ /dev/null @@ -1,268 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCNetInfo.h" -#import "ABI46_0_0RNCConnectionStateWatcher.h" - -#include -#include - -#if !TARGET_OS_TV -#import -#import -#endif -@import SystemConfiguration.CaptiveNetwork; - -#import -#import -#import - -@interface ABI46_0_0RNCNetInfo () - -@property (nonatomic, strong) ABI46_0_0RNCConnectionStateWatcher *connectionStateWatcher; -@property (nonatomic) BOOL isObserving; -@property (nonatomic) NSDictionary *config; - -@end - -@implementation ABI46_0_0RNCNetInfo - -#pragma mark - Module setup - -ABI46_0_0RCT_EXPORT_MODULE() - -// We need ABI46_0_0RNCReachabilityCallback's and module methods to be called on the same thread so that we can have -// guarantees about when we mess with the reachability callbacks. -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -#pragma mark - Lifecycle - -- (NSArray *)supportedEvents -{ - return @[@"netInfo.networkStatusDidChange"]; -} - -- (void)startObserving -{ - self.isObserving = YES; -} - -- (void)stopObserving -{ - self.isObserving = NO; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _connectionStateWatcher = [[ABI46_0_0RNCConnectionStateWatcher alloc] initWithDelegate:self]; - } - return self; -} - -- (void)dealloc -{ - self.connectionStateWatcher = nil; -} - -#pragma mark - ABI46_0_0RNCConnectionStateWatcherDelegate - -- (void)connectionStateWatcher:(ABI46_0_0RNCConnectionStateWatcher *)connectionStateWatcher didUpdateState:(ABI46_0_0RNCConnectionState *)state -{ - if (self.isObserving) { - NSDictionary *dictionary = [self currentDictionaryFromUpdateState:state withInterface:NULL]; - [self sendEventWithName:@"netInfo.networkStatusDidChange" body:dictionary]; - } -} - -#pragma mark - Public API - -ABI46_0_0RCT_EXPORT_METHOD(getCurrentState:(nullable NSString *)requestedInterface resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - ABI46_0_0RNCConnectionState *state = [self.connectionStateWatcher currentState]; - resolve([self currentDictionaryFromUpdateState:state withInterface:requestedInterface]); -} - -ABI46_0_0RCT_EXPORT_METHOD(configure:(NSDictionary *)config) -{ - self.config = config; -} - -#pragma mark - Utilities - -// Converts the state into a dictionary to send over the bridge -- (NSDictionary *)currentDictionaryFromUpdateState:(ABI46_0_0RNCConnectionState *)state withInterface:(nullable NSString *)requestedInterface -{ - NSString *selectedInterface = requestedInterface ?: state.type; - NSMutableDictionary *details = [self detailsFromInterface:selectedInterface withState:state]; - bool connected = [state.type isEqualToString:selectedInterface] && state.connected; - if (connected) { - details[@"isConnectionExpensive"] = @(state.expensive); - } - - return @{ - @"type": selectedInterface, - @"isConnected": @(connected), - @"details": details ?: NSNull.null - }; -} - -- (NSMutableDictionary *)detailsFromInterface:(nonnull NSString *)requestedInterface withState:(ABI46_0_0RNCConnectionState *)state -{ - NSMutableDictionary *details = [NSMutableDictionary new]; - if ([requestedInterface isEqualToString: ABI46_0_0RNCConnectionTypeCellular]) { - details[@"cellularGeneration"] = state.cellularGeneration ?: NSNull.null; - details[@"carrier"] = [self carrier] ?: NSNull.null; - } else if ([requestedInterface isEqualToString: ABI46_0_0RNCConnectionTypeWifi] || [requestedInterface isEqualToString: ABI46_0_0RNCConnectionTypeEthernet]) { - details[@"ipAddress"] = [self ipAddress] ?: NSNull.null; - details[@"subnet"] = [self subnet] ?: NSNull.null; - #if !TARGET_OS_TV && !TARGET_OS_OSX - /* - Without one of the conditions needed to use CNCopyCurrentNetworkInfo, it will leak memory. - Clients should only set the shouldFetchWiFiSSID to true after ensuring requirements are met to get (B)SSID. - */ - if (self.config && self.config[@"shouldFetchWiFiSSID"]) { - details[@"ssid"] = [self ssid] ?: NSNull.null; - details[@"bssid"] = [self bssid] ?: NSNull.null; - } - #endif - } - return details; -} - -- (NSString *)carrier -{ -#if (TARGET_OS_TV || TARGET_OS_OSX) - return nil; -#else - CTTelephonyNetworkInfo *netinfo = [[CTTelephonyNetworkInfo alloc] init]; - CTCarrier *carrier = [netinfo subscriberCellularProvider]; - return carrier.carrierName; -#endif -} - -- (NSString *)ipAddress -{ - NSString *address = @"0.0.0.0"; - struct ifaddrs *interfaces = NULL; - struct ifaddrs *temp_addr = NULL; - int success = 0; - // retrieve the current interfaces - returns 0 on success - success = getifaddrs(&interfaces); - if (success == 0) { - // Loop through linked list of interfaces - temp_addr = interfaces; - while (temp_addr != NULL) { - if (temp_addr->ifa_addr->sa_family == AF_INET) { - NSString* ifname = [NSString stringWithUTF8String:temp_addr->ifa_name]; - if ( - // Check if interface is en0 which is the wifi connection on the iPhone - // and the ethernet connection on the Apple TV - [ifname isEqualToString:@"en0"] || - // Check if interface is en1 which is the wifi connection on the Apple TV - [ifname isEqualToString:@"en1"] - ) { - // Get NSString from C String - char str[INET_ADDRSTRLEN]; - inet_ntop(AF_INET, &((struct sockaddr_in *)temp_addr->ifa_addr)->sin_addr, str, INET_ADDRSTRLEN); - address = [NSString stringWithUTF8String:str]; - } - } - - temp_addr = temp_addr->ifa_next; - } - } - // Free memory - freeifaddrs(interfaces); - return address; -} - -- (NSString *)subnet -{ - NSString *subnet = @"0.0.0.0"; - struct ifaddrs *interfaces = NULL; - struct ifaddrs *temp_addr = NULL; - int success = 0; - // retrieve the current interfaces - returns 0 on success - success = getifaddrs(&interfaces); - if (success == 0) { - // Loop through linked list of interfaces - temp_addr = interfaces; - while (temp_addr != NULL) { - if (temp_addr->ifa_addr->sa_family == AF_INET) { - NSString* ifname = [NSString stringWithUTF8String:temp_addr->ifa_name]; - if ( - // Check if interface is en0 which is the wifi connection on the iPhone - // and the ethernet connection on the Apple TV - [ifname isEqualToString:@"en0"] || - // Check if interface is en1 which is the wifi connection on the Apple TV - [ifname isEqualToString:@"en1"] - ) { - // Get NSString from C String - char str[INET_ADDRSTRLEN]; - inet_ntop(AF_INET, &((struct sockaddr_in *)temp_addr->ifa_netmask)->sin_addr, str, INET_ADDRSTRLEN); - subnet = [NSString stringWithUTF8String:str]; - } - } - - temp_addr = temp_addr->ifa_next; - } - } - // Free memory - freeifaddrs(interfaces); - return subnet; -} - -#if !TARGET_OS_TV && !TARGET_OS_OSX -- (NSString *)ssid -{ - NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces()); - NSDictionary *SSIDInfo; - NSString *SSID = NULL; - for (NSString *interfaceName in interfaceNames) { - // CNCopyCurrentNetworkInfo is deprecated for iOS 13+, need to override & use fetchCurrentWithCompletionHandler - SSIDInfo = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName)); - if (SSIDInfo.count > 0) { - SSID = SSIDInfo[@"SSID"]; - if ([SSID isEqualToString:@"Wi-Fi"] || [SSID isEqualToString:@"WLAN"]){ - SSID = NULL; - } - break; - } - } - return SSID; -} - -- (NSString *)bssid -{ - NSArray *interfaceNames = CFBridgingRelease(CNCopySupportedInterfaces()); - NSDictionary *networkDetails; - NSString *BSSID = NULL; - for (NSString *interfaceName in interfaceNames) { - // CNCopyCurrentNetworkInfo is deprecated for iOS 13+, need to override & use fetchCurrentWithCompletionHandler - networkDetails = CFBridgingRelease(CNCopyCurrentNetworkInfo((__bridge CFStringRef)interfaceName)); - if (networkDetails.count > 0) - { - BSSID = networkDetails[(NSString *) kCNNetworkInfoKeyBSSID]; - break; - } - } - return BSSID; -} -#endif - -@end diff --git a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ABI46_0_0react-native-segmented-control.podspec.json b/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ABI46_0_0react-native-segmented-control.podspec.json deleted file mode 100644 index 0e6301d8d87019..00000000000000 --- a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ABI46_0_0react-native-segmented-control.podspec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ABI46_0_0react-native-segmented-control", - "version": "2.4.0", - "summary": "ABI46_0_0React Native SegmentedControlIOS library", - "license": "MIT", - "authors": "M.Haris Baig", - "homepage": "https://github.com/react-native-segmented-control/segmented-control#readme", - "platforms": { - "ios": "9.0" - }, - "source": { - "git": "https://github.com/react-native-segmented-control/segmented-control.git", - "tag": "2.4.0" - }, - "source_files": "ios/**/*.{h,m}", - "dependencies": { - "ABI46_0_0React-Core": [] - } -} diff --git a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.h b/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.h deleted file mode 100644 index f91871e2352791..00000000000000 --- a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface ABI46_0_0RNCSegmentedControl : UISegmentedControl -@property(nonatomic, assign) NSInteger selectedIndex; -@property(nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChange; - -@end diff --git a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.m b/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.m deleted file mode 100644 index a49fea7079e230..00000000000000 --- a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControl.m +++ /dev/null @@ -1,100 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCSegmentedControl.h" - -#import -#import -#import - -@implementation ABI46_0_0RNCSegmentedControl - -- (instancetype)initWithFrame:(CGRect)frame { - if ((self = [super initWithFrame:frame])) { - _selectedIndex = self.selectedSegmentIndex; - [self addTarget:self - action:@selector(didChange) - forControlEvents:UIControlEventValueChanged]; - } - return self; -} - -- (void)setValues:(NSArray *)values { - [self removeAllSegments]; - for (id segment in values) { - if ([segment isKindOfClass:[NSMutableDictionary class]]){ - UIImage *image = [[ABI46_0_0RCTConvert UIImage:segment] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; - [self insertSegmentWithImage:image - atIndex:self.numberOfSegments - animated:NO]; - } else { - [self insertSegmentWithTitle:(NSString *)segment - atIndex:self.numberOfSegments - animated:NO]; - } - } - super.selectedSegmentIndex = _selectedIndex; -} - -- (void)setSelectedIndex:(NSInteger)selectedIndex { - _selectedIndex = selectedIndex; - super.selectedSegmentIndex = selectedIndex; -} - -- (void)setBackgroundColor:(UIColor *)backgroundColor { -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - [super setBackgroundColor:backgroundColor]; - } -#endif -} - -- (void)setTintColor:(UIColor *)tintColor { - [super setTintColor:tintColor]; -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - [self setSelectedSegmentTintColor:tintColor]; - NSDictionary *attributes = [NSDictionary - dictionaryWithObjectsAndKeys:tintColor, NSForegroundColorAttributeName, - nil]; - NSDictionary *activeAttributes = [NSDictionary - dictionaryWithObjectsAndKeys:UIColor.labelColor, - NSForegroundColorAttributeName, nil]; - [self setTitleTextAttributes:attributes forState:UIControlStateNormal]; - [self setTitleTextAttributes:activeAttributes - forState:UIControlStateSelected]; - } -#endif -} - -- (void)didChange { - _selectedIndex = self.selectedSegmentIndex; - if (_onChange) { - NSString *segmentTitle = [self titleForSegmentAtIndex:_selectedIndex]; - _onChange(@{ - @"value" : (segmentTitle) ? segmentTitle : [self imageForSegmentAtIndex:_selectedIndex], - @"selectedSegmentIndex" : @(_selectedIndex) - }); - } -} - -- (void)setAppearance:(NSString *)appearanceString { -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - if ([appearanceString isEqual:@"dark"]) { - [self setOverrideUserInterfaceStyle:UIUserInterfaceStyleDark]; - } else if ([appearanceString isEqual:@"light"]) { - [self setOverrideUserInterfaceStyle:UIUserInterfaceStyleLight]; - } - } -#endif -} - -@end diff --git a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.h b/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.h deleted file mode 100644 index 9629de6f7bf2e0..00000000000000 --- a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCSegmentedControlManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.m b/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.m deleted file mode 100644 index 4c80c91bc59057..00000000000000 --- a/ios/vendored/sdk46/@react-native-segmented-control/segmented-control/ios/ABI46_0_0RNCSegmentedControlManager.m +++ /dev/null @@ -1,80 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCSegmentedControlManager.h" - -#import "ABI46_0_0RNCSegmentedControl.h" -#import -#import - -@implementation ABI46_0_0RNCSegmentedControlManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view { - return [ABI46_0_0RNCSegmentedControl new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(values, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(momentary, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(appearance, NSString) - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontStyle, NSObject, ABI46_0_0RNCSegmentedControl) { -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - if (json) { - UIColor *color = json[@"color"] ? [ABI46_0_0RCTConvert UIColor:json[@"color"]] - : UIColor.labelColor; - NSInteger fontSize = - json[@"fontSize"] ? [ABI46_0_0RCTConvert NSInteger:json[@"fontSize"]] : 13.0; - UIFont *font = [UIFont systemFontOfSize:fontSize]; - if (json[@"fontFamily"]) { - UIFont *tempFont = [UIFont fontWithName:json[@"fontFamily"] - size:fontSize]; - if (tempFont != nil) { - font = tempFont; - } - } - - NSDictionary *attributes = [NSDictionary - dictionaryWithObjectsAndKeys:font, NSFontAttributeName, color, - NSForegroundColorAttributeName, nil]; - [view setTitleTextAttributes:attributes forState:UIControlStateNormal]; - } - } -#endif -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(activeFontStyle, NSObject, ABI46_0_0RNCSegmentedControl) { -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - if (json) { - UIColor *color = json[@"color"] ? [ABI46_0_0RCTConvert UIColor:json[@"color"]] - : UIColor.labelColor; - NSInteger fontSize = - json[@"fontSize"] ? [ABI46_0_0RCTConvert NSInteger:json[@"fontSize"]] : 13.0; - UIFont *font = [UIFont boldSystemFontOfSize:fontSize]; - if (json[@"fontFamily"]) { - font = [UIFont fontWithName:json[@"fontFamily"] size:fontSize]; - } - NSDictionary *attributes = [NSDictionary - dictionaryWithObjectsAndKeys:font, NSFontAttributeName, color, - NSForegroundColorAttributeName, nil]; - [view setTitleTextAttributes:attributes forState:UIControlStateSelected]; - } - } -#endif -} - -@end diff --git a/ios/vendored/sdk46/@shopify/flash-list/ABI46_0_0RNFlashList.podspec.json b/ios/vendored/sdk46/@shopify/flash-list/ABI46_0_0RNFlashList.podspec.json deleted file mode 100644 index fca8b6b970e72a..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ABI46_0_0RNFlashList.podspec.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "name": "ABI46_0_0RNFlashList", - "version": "1.1.0", - "summary": "FlashList is a more performant FlatList replacement", - "homepage": "https://shopify.github.io/flash-list/", - "license": "MIT", - "authors": "shopify", - "platforms": { - "ios": "11.0", - "tvos": "12.0" - }, - "source": { - "git": "https://github.com/shopify/flash-list.git", - "tag": "v#{s.version}" - }, - "source_files": "ios/Sources/**/*", - "requires_arc": true, - "swift_versions": "5.0", - "dependencies": { - "ABI46_0_0React-Core": [] - }, - "testspecs": [ - { - "name": "Tests", - "test_type": "unit", - "source_files": "ios/Tests/**/*", - "frameworks": "XCTest" - } - ], - "swift_version": "5.0" -} diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutView.swift b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutView.swift deleted file mode 100644 index eccda7f3b558f5..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutView.swift +++ /dev/null @@ -1,218 +0,0 @@ -import Foundation -import UIKit - - -/// Container for all RecyclerListView children. This will automatically remove all gaps and overlaps for GridLayouts with flexible spans. -/// Note: This cannot work for masonry layouts i.e, pinterest like layout -@objc class AutoLayoutView: UIView { - @objc(onBlankAreaEvent) - var onBlankAreaEvent: ABI46_0_0RCTDirectEventBlock? - - @objc func setHorizontal(_ horizontal: Bool) { - self.horizontal = horizontal - } - - @objc func setScrollOffset(_ scrollOffset: Int) { - self.scrollOffset = CGFloat(scrollOffset) - } - - @objc func setWindowSize(_ windowSize: Int) { - self.windowSize = CGFloat(windowSize) - } - - @objc func setRenderAheadOffset(_ renderAheadOffset: Int) { - self.renderAheadOffset = CGFloat(renderAheadOffset) - } - - @objc func setEnableInstrumentation(_ enableInstrumentation: Bool) { - self.enableInstrumentation = enableInstrumentation - } - - @objc func setDisableAutoLayout(_ disableAutoLayout: Bool) { - self.disableAutoLayout = disableAutoLayout - } - - private var horizontal = false - private var scrollOffset: CGFloat = 0 - private var windowSize: CGFloat = 0 - private var renderAheadOffset: CGFloat = 0 - private var enableInstrumentation = false - private var disableAutoLayout = false - - /// Tracks where the last pixel is drawn in the visible window - private var lastMaxBound: CGFloat = 0 - /// Tracks where first pixel is drawn in the visible window - private var lastMinBound: CGFloat = 0 - - override func layoutSubviews() { - fixLayout() - super.layoutSubviews() - - let scrollView = sequence(first: self, next: { $0.superview }).first(where: { $0 is UIScrollView }) - guard enableInstrumentation, let scrollView = scrollView as? UIScrollView else { return } - - let scrollContainerSize = horizontal ? scrollView.frame.width : scrollView.frame.height - let currentScrollOffset = horizontal ? scrollView.contentOffset.x : scrollView.contentOffset.y - let startOffset = horizontal ? frame.minX : frame.minY - let endOffset = horizontal ? frame.maxX : frame.maxY - let distanceFromWindowStart = max(startOffset - currentScrollOffset, 0) - let distanceFromWindowEnd = max(currentScrollOffset + scrollContainerSize - endOffset, 0) - - let (blankOffsetStart, blankOffsetEnd) = computeBlankFromGivenOffset( - currentScrollOffset - startOffset, - filledBoundMin: lastMinBound, - filledBoundMax: lastMaxBound, - renderAheadOffset: renderAheadOffset, - windowSize: windowSize, - distanceFromWindowStart: distanceFromWindowStart, - distanceFromWindowEnd: distanceFromWindowEnd - ) - - onBlankAreaEvent?( - [ - "offsetStart": blankOffsetStart, - "offsetEnd": blankOffsetEnd, - ] - ) - } - - /// Sorts views by index and then invokes clearGaps which does the correction. - /// Performance: Sort is needed. Given relatively low number of views in RecyclerListView render tree this should be a non issue. - private func fixLayout() { - guard - subviews.count > 1, - // Fixing layout during animation can interfere with it. - layer.animationKeys()?.isEmpty ?? true, - !disableAutoLayout - else { return } - let cellContainers = subviews - .compactMap { subview -> CellContainer? in - if let cellContainer = subview as? CellContainer { - return cellContainer - } else { - assertionFailure("CellRendererComponent outer view should always be CellContainer. Learn more here: https://shopify.github.io/flash-list/docs/usage#cellrenderercomponent.") - return nil - } - } - .sorted(by: { $0.index < $1.index }) - clearGaps(for: cellContainers) - } - - /// Checks for overlaps or gaps between adjacent items and then applies a correction. - /// Performance: RecyclerListView renders very small number of views and this is not going to trigger multiple layouts on the iOS side. - private func clearGaps(for cellContainers: [CellContainer]) { - var maxBound: CGFloat = 0 - var minBound: CGFloat = CGFloat(Int.max) - var maxBoundNextCell: CGFloat = 0 - let correctedScrollOffset = scrollOffset - (horizontal ? frame.minX : frame.minY) - - cellContainers.indices.dropLast().forEach { index in - let cellContainer = cellContainers[index] - let cellTop = cellContainer.frame.minY - let cellBottom = cellContainer.frame.maxY - let cellLeft = cellContainer.frame.minX - let cellRight = cellContainer.frame.maxX - - let nextCell = cellContainers[index + 1] - let nextCellTop = nextCell.frame.minY - let nextCellBottom = nextCell.frame.maxY - let nextCellLeft = nextCell.frame.minX - let nextCellRight = nextCell.frame.maxX - - - guard - isWithinBounds( - cellContainer, - scrollOffset: correctedScrollOffset, - renderAheadOffset: renderAheadOffset, - windowSize: windowSize, - isHorizontal: horizontal - ) - else { return } - let isNextCellVisible = isWithinBounds( - nextCell, - scrollOffset: correctedScrollOffset, - renderAheadOffset: renderAheadOffset, - windowSize: windowSize, - isHorizontal: horizontal - ) - - if horizontal { - maxBound = max(maxBound, cellRight) - minBound = min(minBound, cellLeft) - maxBoundNextCell = maxBound - if cellTop < nextCellTop { - if cellBottom != nextCellTop { - nextCell.frame.origin.y = cellBottom - } - if cellLeft != nextCellLeft { - nextCell.frame.origin.x = cellLeft - } - } else { - nextCell.frame.origin.x = maxBound - } - if isNextCellVisible { - maxBoundNextCell = max(maxBound, nextCellRight) - } - } else { - maxBound = max(maxBound, cellBottom) - minBound = min(minBound, cellTop) - maxBoundNextCell = maxBound - if cellLeft < nextCellLeft { - if cellRight != nextCellLeft { - nextCell.frame.origin.x = cellRight - } - if cellTop != nextCellTop { - nextCell.frame.origin.y = cellTop - } - } else { - nextCell.frame.origin.y = maxBound - } - if isNextCellVisible { - maxBoundNextCell = max(maxBound, nextCellBottom) - } - } - } - - lastMaxBound = maxBoundNextCell - lastMinBound = minBound - } - - func computeBlankFromGivenOffset( - _ actualScrollOffset: CGFloat, - filledBoundMin: CGFloat, - filledBoundMax: CGFloat, - renderAheadOffset: CGFloat, - windowSize: CGFloat, - distanceFromWindowStart: CGFloat, - distanceFromWindowEnd: CGFloat - ) -> ( - offsetStart: CGFloat, - offsetEnd: CGFloat - ) { - let blankOffsetStart = filledBoundMin - actualScrollOffset - distanceFromWindowStart - - let blankOffsetEnd = actualScrollOffset + windowSize - renderAheadOffset - filledBoundMax - distanceFromWindowEnd - - return (blankOffsetStart, blankOffsetEnd) - } - - /// It's important to avoid correcting views outside the render window. An item that isn't being recycled might still remain in the view tree. If views outside get considered then gaps between unused items will cause algorithm to fail. - func isWithinBounds( - _ cellContainer: CellContainer, - scrollOffset: CGFloat, - renderAheadOffset: CGFloat, - windowSize: CGFloat, - isHorizontal: Bool - ) -> Bool { - let boundsStart = scrollOffset - renderAheadOffset - let boundsEnd = scrollOffset + windowSize - let cellFrame = cellContainer.frame - - if isHorizontal { - return (cellFrame.minX >= boundsStart || cellFrame.maxX >= boundsStart) && (cellFrame.minX <= boundsEnd || cellFrame.maxX <= boundsEnd) - } else { - return (cellFrame.minY >= boundsStart || cellFrame.maxY >= boundsStart) && (cellFrame.minY <= boundsEnd || cellFrame.maxY <= boundsEnd) - } - } -} diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.m b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.m deleted file mode 100644 index dc5b1705c7af39..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.m +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(AutoLayoutViewManager, ABI46_0_0AutoLayoutViewManager, ABI46_0_0RCTViewManager) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(horizontal, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(scrollOffset, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(windowSize, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(renderAheadOffset, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(enableInstrumentation, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(disableAutoLayout, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onBlankAreaEvent, ABI46_0_0RCTDirectEventBlock) - -@end diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.swift b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.swift deleted file mode 100644 index 589ccb41861e02..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/AutoLayoutViewManager.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -@objc(ABI46_0_0AutoLayoutViewManager) -class AutoLayoutViewManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return AutoLayoutView() - } - - override static func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainer.swift b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainer.swift deleted file mode 100644 index 7f09ce767f7be3..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainer.swift +++ /dev/null @@ -1,9 +0,0 @@ -import Foundation - -@objc class CellContainer: UIView { - var index: Int = -1 - - @objc func setIndex(_ index: Int) { - self.index = index - } -} diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.m b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.m deleted file mode 100644 index d765a346df49cf..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.m +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(CellContainerManager, ABI46_0_0CellContainerManager, ABI46_0_0RCTViewManager) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(index, NSInteger) - -@end diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.swift b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.swift deleted file mode 100644 index 2ce138636e88fa..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/CellContainerManager.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -@objc(ABI46_0_0CellContainerManager) -class CellContainerManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return CellContainer() - } - - override static func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/FlatListPro-Bridging-Header.h b/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/FlatListPro-Bridging-Header.h deleted file mode 100644 index 67a747ae26dea6..00000000000000 --- a/ios/vendored/sdk46/@shopify/flash-list/ios/Sources/FlatListPro-Bridging-Header.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef FlatListPro_Bridging_Header_h -#define FlatListPro_Bridging_Header_h - -#import -#import -#import - -#endif /* FlatListPro_Bridging_Header_h */ diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ABI46_0_0react-native-skia.podspec.json b/ios/vendored/sdk46/@shopify/react-native-skia/ABI46_0_0react-native-skia.podspec.json deleted file mode 100644 index 236d493872e6b8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ABI46_0_0react-native-skia.podspec.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "ABI46_0_0react-native-skia", - "version": "0.1.136", - "summary": "High-performance ABI46_0_0React Native Graphics using Skia", - "description": "@shopify/react-native-skia", - "homepage": "https://github.com/shopify/react-native-skia", - "license": "MIT", - "authors": { - "Your Name": "yourname@email.com" - }, - "platforms": { - "ios": "9.0" - }, - "source": { - "git": "https://github.com/shopify/react-native-skia/react-native-skia.git", - "tag": "0.1.136" - }, - "requires_arc": true, - "pod_target_xcconfig": { - "GCC_PREPROCESSOR_DEFINITIONS": "$(inherited) SK_GL=1 SK_METAL=1", - "CLANG_CXX_LANGUAGE_STANDARD": "c++17", - "HEADER_SEARCH_PATHS": "\"$(PODS_ROOT)/Headers/Private/ABI46_0_0React-bridging/react/bridging\" \"$(PODS_CONFIGURATION_BUILD_DIR)/ABI46_0_0React-bridging/react_bridging.framework/Headers\"" - }, - "frameworks": [ - "GLKit", - "MetalKit" - ], - "ios": {}, - "source_files": [ - "ios/**/*.{h,c,cc,cpp,m,mm,swift}" - ], - "dependencies": { - "ABI46_0_0React": [], - "ABI46_0_0React-callinvoker": [], - "ABI46_0_0React-Core": [] - }, - "subspecs": [ - { - "name": "SkiaHeaders", - "header_mappings_dir": "cpp/skia", - "source_files": "cpp/skia/**/*.{h,cpp}" - }, - { - "name": "Utils", - "header_mappings_dir": "cpp/utils", - "source_files": "cpp/utils/**/*.{h,cpp}" - }, - { - "name": "Jsi", - "header_mappings_dir": "cpp/jsi", - "source_files": "cpp/jsi/**/*.{h,cpp}" - }, - { - "name": "Api", - "header_mappings_dir": "cpp/api", - "source_files": "cpp/api/**/*.{h,cpp}" - }, - { - "name": "ABI46_0_0RNSkia", - "header_mappings_dir": "cpp/rnskia", - "source_files": "cpp/rnskia/**/*.{h,cpp}" - } - ] -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkApi.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkApi.h deleted file mode 100644 index 3779572042c266..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkApi.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include "ABI46_0_0RNSkPlatformContext.h" - -#include "JsiSkHostObjects.h" - -#include "JsiSkRuntimeEffect.h" -#include "JsiSkColorFilter.h" -#include "JsiSkColorFilterFactory.h" -#include "JsiSkFont.h" -#include "JsiSkImage.h" -#include "JsiSkImageFactory.h" -#include "JsiSkImageFilter.h" -#include "JsiSkImageFilterFactory.h" -#include "JsiSkMaskFilter.h" -#include "JsiSkMaskFilterFactory.h" -#include "JsiSkMatrix.h" -#include "JsiSkPaint.h" -#include "JsiSkRSXform.h" -#include "JsiSkPath.h" -#include "JsiSkPathEffect.h" -#include "JsiSkPathEffectFactory.h" -#include "JsiSkPathFactory.h" -#include "JsiSkPoint.h" -#include "JsiSkRRect.h" -#include "JsiSkRect.h" -#include "JsiSkRuntimeEffectFactory.h" -#include "JsiSkShader.h" -#include "JsiSkShaderFactory.h" -#include "JsiSkSVG.h" -#include "JsiSkSVGFactory.h" -#include "JsiSkTypeface.h" -#include "JsiSkVertices.h" -#include "JsiSkTypefaceFactory.h" -#include "JsiSkDataFactory.h" -#include "JsiSkFontMgrFactory.h" -#include "JsiSkSurfaceFactory.h" -#include "JsiSkTextBlobFactory.h" -#include "JsiSkContourMeasureIter.h" -#include "JsiSkPictureRecorder.h" -#include "JsiSkPictureFactory.h" -#include "JsiSkRuntimeShaderBuilder.h" -#include "JsiSkColor.h" - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - class JsiSkApi : public JsiSkHostObject - { - public: - /** - * Constructs the Skia Api object that can be installed into a runtime - * and provide functions for accessing and creating the Skia wrapper objects - * @param context Platform context - */ - JsiSkApi(jsi::Runtime &runtime, std::shared_ptr context) - : JsiSkHostObject(context) - { - - installFunction("Font", JsiSkFont::createCtor(context)); - installFunction("Paint", JsiSkPaint::createCtor(context)); - installFunction("RSXform", JsiSkRSXform::createCtor(context)); - installFunction("Matrix", JsiSkMatrix::createCtor(context)); - installFunction("XYWHRect", JsiSkRect::createCtor(context)); - installFunction("RRectXY", JsiSkRRect::createCtor(context)); - installFunction("Point", JsiSkPoint::createCtor(context)); - installFunction("RuntimeShaderBuilder", JsiSkRuntimeShaderBuilder::createCtor(context)); - installFunction("ContourMeasureIter", JsiSkContourMeasureIter::createCtor(context)); - installFunction("MakeVertices", JsiSkVertices::createCtor(context)); - installFunction("PictureRecorder", JsiSkPictureRecorder::createCtor(context)); - installFunction("Color", JsiSkColor::createCtor()); - - // Static members - installReadonlyProperty("FontMgr", - std::make_shared(context)); - installReadonlyProperty("SVG", - std::make_shared(context)); - installReadonlyProperty("Image", - std::make_shared(context)); - installReadonlyProperty("Typeface", - std::make_shared(context)); - installReadonlyProperty("Data", - std::make_shared(context)); - installReadonlyProperty("ImageFilter", - std::make_shared(context)); - installReadonlyProperty("PathEffect", - std::make_shared(context)); - installReadonlyProperty("Path", - std::make_shared(context)); - installReadonlyProperty("ColorFilter", - std::make_shared(context)); - installReadonlyProperty("MaskFilter", - std::make_shared(context)); - installReadonlyProperty( - "RuntimeEffect", std::make_shared(context)); - installReadonlyProperty("Shader", - std::make_shared(context)); - installReadonlyProperty("TextBlob", std::make_shared(context)); - installReadonlyProperty("Surface", std::make_shared(context)); - installReadonlyProperty("Picture", std::make_shared(context)); - }; - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkCanvas.h deleted file mode 100644 index edb53f51eda836..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkCanvas.h +++ /dev/null @@ -1,540 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "JsiSkFont.h" -#include "JsiSkHostObjects.h" -#include "JsiSkImage.h" -#include "JsiSkMatrix.h" -#include "JsiSkPaint.h" -#include "JsiSkPath.h" -#include "JsiSkPoint.h" -#include "JsiSkRRect.h" -#include "JsiSkSVG.h" -#include "JsiSkVertices.h" -#include "JsiSkTextBlob.h" -#include "JsiSkPicture.h" - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { -using namespace ABI46_0_0facebook; - -class JsiSkCanvas : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(drawPaint) { - auto paint = JsiSkPaint::fromValue(runtime, arguments[0]); - _canvas->drawPaint(*paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawLine) { - SkScalar x1 = arguments[0].asNumber(); - SkScalar y1 = arguments[1].asNumber(); - SkScalar x2 = arguments[2].asNumber(); - SkScalar y2 = arguments[3].asNumber(); - auto paint = JsiSkPaint::fromValue(runtime, arguments[4]); - _canvas->drawLine(x1, y1, x2, y2, *paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawRect) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - _canvas->drawRect(*rect, *paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImage) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto x = arguments[1].asNumber(); - auto y = arguments[2].asNumber(); - std::shared_ptr paint; - if (count == 4) { - paint = JsiSkPaint::fromValue(runtime, arguments[3]); - } - _canvas->drawImage(image, x, y, SkSamplingOptions(), paint.get()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageRect) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto src = JsiSkRect::fromValue(runtime, arguments[1]); - auto dest = JsiSkRect::fromValue(runtime, arguments[2]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[3]); - auto fastSample = count < 5 ? false : arguments[4].getBool(); - _canvas->drawImageRect(image, *src, *dest, SkSamplingOptions(), paint.get(), - fastSample ? SkCanvas::kFast_SrcRectConstraint - : SkCanvas::kStrict_SrcRectConstraint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageCubic) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto x = arguments[1].asNumber(); - auto y = arguments[2].asNumber(); - float B = arguments[3].asNumber(); - float C = arguments[4].asNumber(); - std::shared_ptr paint; - if (count == 6) { - if (!arguments[5].isNull()) { - paint = JsiSkPaint::fromValue(runtime, arguments[5]); - } - } - _canvas->drawImage(image, x, y, SkSamplingOptions({ B, C }), paint.get()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageOptions) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto x = arguments[1].asNumber(); - auto y = arguments[2].asNumber(); - auto fm = (SkFilterMode)arguments[3].asNumber(); - auto mm = (SkMipmapMode)arguments[4].asNumber(); - std::shared_ptr paint; - if (count == 6) { - if (!arguments[5].isNull()) { - paint = JsiSkPaint::fromValue(runtime, arguments[5]); - } - } - _canvas->drawImage(image, x, y, SkSamplingOptions(fm, mm), paint.get()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageNine) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto center = JsiSkRect::fromValue(runtime, arguments[1]); - auto dest = JsiSkRect::fromValue(runtime, arguments[2]); - auto fm = (SkFilterMode)arguments[3].asNumber(); - std::shared_ptr paint; - if (count == 5) { - if (!arguments[4].isNull()) { - paint = JsiSkPaint::fromValue(runtime, arguments[4]); - } - } - _canvas->drawImageNine(image.get(), center->round(), *dest, fm, paint.get()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageRectCubic) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto src = JsiSkRect::fromValue(runtime, arguments[1]); - auto dest = JsiSkRect::fromValue(runtime, arguments[2]); - float B = arguments[3].asNumber(); - float C = arguments[4].asNumber(); - std::shared_ptr paint; - if (count == 6) { - if (!arguments[5].isNull()) { - paint = JsiSkPaint::fromValue(runtime, arguments[5]); - } - } - auto constraint = SkCanvas::kStrict_SrcRectConstraint; // TODO: get from caller - _canvas->drawImageRect(image.get(), *src, *dest, SkSamplingOptions({ B, C }), paint.get(), constraint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawImageRectOptions) { - auto image = JsiSkImage::fromValue(runtime, arguments[0]); - auto src = JsiSkRect::fromValue(runtime, arguments[1]); - auto dest = JsiSkRect::fromValue(runtime, arguments[2]); - auto filter = (SkFilterMode)arguments[3].asNumber(); - auto mipmap = (SkMipmapMode)arguments[4].asNumber(); - std::shared_ptr paint; - if (count == 6) { - if (!arguments[5].isNull()) { - paint = JsiSkPaint::fromValue(runtime, arguments[5]); - } - } - auto constraint = SkCanvas::kStrict_SrcRectConstraint; - _canvas->drawImageRect(image.get(), *src, *dest, {filter, mipmap}, paint.get(), constraint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawCircle) { - SkScalar cx = arguments[0].asNumber(); - SkScalar cy = arguments[1].asNumber(); - SkScalar radius = arguments[2].asNumber(); - - auto paint = JsiSkPaint::fromValue(runtime, arguments[3]); - _canvas->drawCircle(cx, cy, radius, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawArc) { - auto oval = JsiSkRect::fromValue(runtime, arguments[0]); - - SkScalar startAngle = arguments[1].asNumber(); - SkScalar sweepAngle = arguments[2].asNumber(); - bool useCenter = arguments[3].getBool(); - - auto paint = JsiSkPaint::fromValue(runtime, arguments[4]); - _canvas->drawArc(*oval, startAngle, sweepAngle, useCenter, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawRRect) { - auto rect = JsiSkRRect::fromValue(runtime, arguments[0]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - - _canvas->drawRRect(*rect, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawDRRect) { - auto outer = JsiSkRRect::fromValue(runtime, arguments[0]); - auto inner = JsiSkRRect::fromValue(runtime, arguments[1]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[2]); - - _canvas->drawDRRect(*outer, *inner, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawOval) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - - _canvas->drawOval(*rect, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(restoreToCount) { - auto c = arguments[0].asNumber(); - _canvas->restoreToCount(c); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(getSaveCount) { - return static_cast(_canvas->getSaveCount()); - } - - JSI_HOST_FUNCTION(drawPoints) { - auto pointMode = arguments[0].asNumber(); - std::vector points; - - auto jsiPoints = arguments[1].asObject(runtime).asArray(runtime); - auto pointsSize = jsiPoints.size(runtime); - points.reserve(pointsSize); - - for (int i = 0; i < pointsSize; i++) { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime)); - points.push_back(*point.get()); - } - - auto paint = JsiSkPaint::fromValue(runtime, arguments[2]); - - _canvas->drawPoints((SkCanvas::PointMode)pointMode, pointsSize, - points.data(), *paint); - - return jsi::Value::undefined(); - } - - - JSI_HOST_FUNCTION(drawVertices) { - auto vertices = JsiSkVertices::fromValue(runtime, arguments[0]); - auto blendMode = (SkBlendMode)arguments[1].getNumber(); - auto paint = JsiSkPaint::fromValue(runtime, arguments[2]); - _canvas->drawVertices(vertices, blendMode, *paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawPatch) { - std::vector cubics; - std::vector colors; - std::vector texs; - - auto jsiCubics = arguments[0].asObject(runtime).asArray(runtime); - auto cubicsSize = jsiCubics.size(runtime); - cubics.reserve(cubicsSize); - for (int i = 0; i < cubicsSize; i++) { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiCubics.getValueAtIndex(runtime, i).asObject(runtime)); - cubics.push_back(*point.get()); - } - - if (count >= 2 && !arguments[1].isNull() && !arguments[1].isUndefined()) { - auto jsiColors = arguments[1].asObject(runtime).asArray(runtime); - auto colorsSize = jsiColors.size(runtime); - colors.reserve(colorsSize); - for (int i = 0; i < colorsSize; i++) { - SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i)); - colors.push_back(color); - } - } - - if (count >= 3 && !arguments[2].isNull() && !arguments[2].isUndefined()) { - auto jsiTexs = arguments[2].asObject(runtime).asArray(runtime); - auto texsSize = jsiTexs.size(runtime); - texs.reserve(texsSize); - for (int i = 0; i < texsSize; i++) { - auto point = JsiSkPoint::fromValue( - runtime, jsiTexs.getValueAtIndex(runtime, i).asObject(runtime)); - texs.push_back(*point.get()); - } - } - - auto paint = count >= 4 ? JsiSkPaint::fromValue(runtime, arguments[4]) : nullptr; - auto blendMode = static_cast(arguments[3].asNumber()); - _canvas->drawPatch(cubics.data(), colors.data(), texs.data(), blendMode, *paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawPath) { - auto path = JsiSkPath::fromValue(runtime, arguments[0]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - - _canvas->drawPath(*path, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawText) { - auto textVal = arguments[0].asString(runtime).utf8(runtime); - auto text = textVal.c_str(); - SkScalar x = arguments[1].asNumber(); - SkScalar y = arguments[2].asNumber(); - - auto paint = JsiSkPaint::fromValue(runtime, arguments[3]); - auto font = JsiSkFont::fromValue(runtime, arguments[4]); - - _canvas->drawSimpleText(text, strlen(text), SkTextEncoding::kUTF8, x, y, - *font, *paint); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawTextBlob) { - auto blob = JsiSkTextBlob::fromValue(runtime, arguments[0]); - SkScalar x = arguments[1].asNumber(); - SkScalar y = arguments[2].asNumber(); - auto paint = JsiSkPaint::fromValue(runtime, arguments[3]); - _canvas->drawTextBlob(blob, x, y, *paint); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawGlyphs) { - auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime); - auto jsiPositions = arguments[1].asObject(runtime).asArray(runtime); - auto x = arguments[2].asNumber(); - auto y = arguments[3].asNumber(); - auto font = JsiSkFont::fromValue(runtime, arguments[4]); - auto paint = JsiSkPaint::fromValue(runtime, arguments[5]); - SkPoint origin = SkPoint::Make(x, y); - - std::vector positions; - int pointsSize = static_cast(jsiPositions.size(runtime)); - positions.reserve(pointsSize); - for (int i = 0; i < pointsSize; i++) { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiPositions.getValueAtIndex(runtime, i).asObject(runtime)); - positions.push_back(*point.get()); - } - - std::vector glyphs; - int glyphsSize = static_cast(jsiGlyphs.size(runtime)); - glyphs.reserve(glyphsSize); - for (int i = 0; i < glyphsSize; i++) { - glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber()); - } - - _canvas->drawGlyphs( - glyphsSize, - glyphs.data(), - positions.data(), - origin, - *font, - *paint - ); - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawSvg) { - auto svgdom = JsiSkSVG::fromValue(runtime, arguments[0]); - if (count == 3) { - // read size - auto w = arguments[1].asNumber(); - auto h = arguments[2].asNumber(); - svgdom->setContainerSize(SkSize::Make(w, h)); - } else { - auto canvasSize = _canvas->getBaseLayerSize(); - svgdom->setContainerSize(SkSize::Make(canvasSize)); - } - svgdom->render(_canvas); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(clipPath) { - auto path = JsiSkPath::fromValue(runtime, arguments[0]); - auto op = (SkClipOp)arguments[1].asNumber(); - auto doAntiAlias = arguments[2].getBool(); - _canvas->clipPath(*path, op, doAntiAlias); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(clipRect) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]); - auto op = (SkClipOp)arguments[1].asNumber(); - auto doAntiAlias = arguments[2].getBool(); - _canvas->clipRect(*rect, op, doAntiAlias); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(clipRRect) { - auto rrect = JsiSkRRect::fromValue(runtime, arguments[0]); - auto op = (SkClipOp)arguments[1].asNumber(); - auto doAntiAlias = arguments[2].getBool(); - _canvas->clipRRect(*rrect, op, doAntiAlias); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(save) { return jsi::Value(_canvas->save()); } - - JSI_HOST_FUNCTION(saveLayer) { - SkPaint *paint = (count >= 1 && !arguments[0].isUndefined()) ? - JsiSkPaint::fromValue(runtime, arguments[0]).get() : nullptr; - SkRect *bounds = count >= 2 && !arguments[1].isNull() && arguments[1].isUndefined() ? JsiSkRect::fromValue(runtime, arguments[1]).get() : nullptr; - SkImageFilter *backdrop = count >= 3 && !arguments[2].isNull() && !arguments[2].isUndefined() ? JsiSkImageFilter::fromValue(runtime, arguments[2]).get() : nullptr; - SkCanvas::SaveLayerFlags flags = count >= 4 ? arguments[3].asNumber() : 0; - return jsi::Value(_canvas->saveLayer( - SkCanvas::SaveLayerRec(bounds, paint, backdrop, flags))); - } - - JSI_HOST_FUNCTION(restore) { - _canvas->restore(); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(rotate) { - SkScalar degrees = arguments[0].asNumber(); - SkScalar rx = arguments[1].asNumber(); - SkScalar ry = arguments[2].asNumber(); - _canvas->rotate(degrees, rx, ry); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(translate) { - SkScalar dx = arguments[0].asNumber(); - SkScalar dy = arguments[1].asNumber(); - _canvas->translate(dx, dy); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(scale) { - SkScalar sx = arguments[0].asNumber(); - SkScalar sy = arguments[1].asNumber(); - _canvas->scale(sx, sy); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(skew) { - SkScalar sx = arguments[0].asNumber(); - SkScalar sy = arguments[1].asNumber(); - _canvas->skew(sx, sy); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawColor) { - SkColor cl = JsiSkColor::fromValue(runtime, arguments[0]); - if (count == 1) { - _canvas->drawColor(cl); - } else { - auto mode = static_cast(arguments[1].asNumber()); - _canvas->drawColor(cl, mode); - } - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(clear) { - SkColor cl = JsiSkColor::fromValue(runtime, arguments[0]); - _canvas->clear(cl); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(concat) { - auto matrix = JsiSkMatrix::fromValue(runtime, arguments[0]); - _canvas->concat(*matrix.get()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(drawPicture) { - auto picture = JsiSkPicture::fromValue(runtime, arguments[0]); - _canvas->drawPicture(picture); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkCanvas, drawPaint), - JSI_EXPORT_FUNC(JsiSkCanvas, drawLine), - JSI_EXPORT_FUNC(JsiSkCanvas, drawRect), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImage), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageRect), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageCubic), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageOptions), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageNine), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageRectCubic), - JSI_EXPORT_FUNC(JsiSkCanvas, drawImageRectOptions), - JSI_EXPORT_FUNC(JsiSkCanvas, drawCircle), - JSI_EXPORT_FUNC(JsiSkCanvas, drawArc), - JSI_EXPORT_FUNC(JsiSkCanvas, drawRRect), - JSI_EXPORT_FUNC(JsiSkCanvas, drawDRRect), - JSI_EXPORT_FUNC(JsiSkCanvas, drawOval), - JSI_EXPORT_FUNC(JsiSkCanvas, restoreToCount), - JSI_EXPORT_FUNC(JsiSkCanvas, getSaveCount), - JSI_EXPORT_FUNC(JsiSkCanvas, drawPoints), - JSI_EXPORT_FUNC(JsiSkCanvas, drawPatch), - JSI_EXPORT_FUNC(JsiSkCanvas, drawPath), - JSI_EXPORT_FUNC(JsiSkCanvas, drawVertices), - JSI_EXPORT_FUNC(JsiSkCanvas, drawText), - JSI_EXPORT_FUNC(JsiSkCanvas, drawTextBlob), - JSI_EXPORT_FUNC(JsiSkCanvas, drawGlyphs), - JSI_EXPORT_FUNC(JsiSkCanvas, drawSvg), - JSI_EXPORT_FUNC(JsiSkCanvas, clipPath), - JSI_EXPORT_FUNC(JsiSkCanvas, clipRect), - JSI_EXPORT_FUNC(JsiSkCanvas, clipRRect), - JSI_EXPORT_FUNC(JsiSkCanvas, save), - JSI_EXPORT_FUNC(JsiSkCanvas, saveLayer), - JSI_EXPORT_FUNC(JsiSkCanvas, restore), - JSI_EXPORT_FUNC(JsiSkCanvas, rotate), - JSI_EXPORT_FUNC(JsiSkCanvas, translate), - JSI_EXPORT_FUNC(JsiSkCanvas, scale), - JSI_EXPORT_FUNC(JsiSkCanvas, skew), - JSI_EXPORT_FUNC(JsiSkCanvas, drawColor), - JSI_EXPORT_FUNC(JsiSkCanvas, clear), - JSI_EXPORT_FUNC(JsiSkCanvas, concat), - JSI_EXPORT_FUNC(JsiSkCanvas, drawPicture)) - - JsiSkCanvas(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - - JsiSkCanvas(std::shared_ptr context, SkCanvas* canvas): JsiSkCanvas(std::move(context)) { - setCanvas(canvas); - } - - void setCanvas(SkCanvas *canvas) { _canvas = canvas; } - SkCanvas *getCanvas() { return _canvas; } - -private: - SkCanvas *_canvas; -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColor.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColor.h deleted file mode 100644 index a4d4da6706ede8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColor.h +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "third_party/CSSColorParser.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkColor : public JsiHostObject { - public: - - JsiSkColor(): JsiHostObject() {} - - ~JsiSkColor() {} - - static jsi::Object toValue(jsi::Runtime &runtime, SkColor color) { - auto result = runtime - .global() - .getPropertyAsFunction(runtime, "Float32Array") - .callAsConstructor(runtime, 4) - .getObject(runtime); - jsi::ArrayBuffer buffer = result - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - auto bfrPtr = reinterpret_cast(buffer.data(runtime)); - auto color4f = SkColor4f::FromColor(color).array(); - std::copy(color4f.begin(), color4f.end(), bfrPtr); - return result; - } - - static SkColor fromValue(jsi::Runtime &runtime, const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - jsi::ArrayBuffer buffer = object - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - auto bfrPtr = reinterpret_cast(buffer.data(runtime)); - if (bfrPtr[0] > 1 || bfrPtr[1] > 1 || bfrPtr[2] > 1 || bfrPtr[3] > 1) { - return SK_ColorBLACK; - } - return SkColorSetARGB(bfrPtr[3] * 255, bfrPtr[0] * 255, bfrPtr[1] * 255, bfrPtr[2] * 255); - } - - /** - * Creates the function for construction a new instance of the SkColor - * wrapper - * @return A function for creating a new host object wrapper for the SkColor - * class - */ - static const jsi::HostFunctionType - createCtor() { - return JSI_HOST_FUNCTION_LAMBDA { - if (arguments[0].isNumber()) { - return JsiSkColor::toValue(runtime, arguments[0].getNumber()); - } else if(arguments[0].isString()) { - auto text = arguments[0].asString(runtime).utf8(runtime); - auto color = CSSColorParser::parse(text); - if (color.a == -1.0f) { - return JsiSkColor::toValue(runtime, SK_ColorBLACK); - } - return JsiSkColor::toValue(runtime, SkColorSetARGB(color.a * 255, color.r, color.g, color.b)); - } else if (arguments[0].isObject()) { - return arguments[0].getObject(runtime); - } - return jsi::Value::undefined(); - }; - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilter.h deleted file mode 100644 index 810451c72dbbfa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilter.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include "JsiSkHostObjects.h" -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkColorFilter : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkColorFilter(std::shared_ptr context, - sk_sp colorFilter) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(colorFilter)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "ColorFilter"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkColorFilter, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilterFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilterFactory.h deleted file mode 100644 index 7a10910290d1a9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkColorFilterFactory.h +++ /dev/null @@ -1,99 +0,0 @@ -#pragma once - -#include "JsiSkColorFilter.h" -#include "JsiSkHostObjects.h" -#include "JsiSkColor.h" -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkColorFilterFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakeMatrix) { - auto jsiMatrix = arguments[0].asObject(runtime).asArray(runtime); - float matrix[20]; - for (int i = 0; i < 20; i++) { - if (jsiMatrix.size(runtime) > i) { - matrix[i] = jsiMatrix.getValueAtIndex(runtime, i).asNumber(); - } - } - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::Matrix(std::move(matrix)))); - } - - JSI_HOST_FUNCTION(MakeBlend) { - auto color = JsiSkColor::fromValue(runtime, arguments[0]); - SkBlendMode blend = (SkBlendMode)arguments[1].asNumber(); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::Blend(color, blend))); - } - - JSI_HOST_FUNCTION(MakeCompose) { - auto outer = JsiSkColorFilter::fromValue(runtime, arguments[0]); - auto inner = JsiSkColorFilter::fromValue(runtime, arguments[1]); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::Compose(std::move(outer), std::move(inner)))); - } - - JSI_HOST_FUNCTION(MakeLerp) { - auto t = arguments[0].asNumber(); - auto dst = JsiSkColorFilter::fromValue(runtime, arguments[1]); - auto src = JsiSkColorFilter::fromValue(runtime, arguments[2]); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::Lerp(t, std::move(dst), std::move(src)))); - } - - JSI_HOST_FUNCTION(MakeSRGBToLinearGamma) { - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::SRGBToLinearGamma())); - } - - JSI_HOST_FUNCTION(MakeLinearToSRGBGamma) { - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkColorFilters::LinearToSRGBGamma())); - } - - JSI_HOST_FUNCTION(MakeLumaColorFilter) { - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkLumaColorFilter::Make())); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeMatrix), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeBlend), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeCompose), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeLerp), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeSRGBToLinearGamma), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeLinearToSRGBGamma), - JSI_EXPORT_FUNC(JsiSkColorFilterFactory, MakeLumaColorFilter) - ) - - JsiSkColorFilterFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasure.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasure.h deleted file mode 100644 index 7cec7dd535d5f2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasure.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - class JsiSkContourMeasure : public JsiSkWrappingSkPtrHostObject - { - public: - JsiSkContourMeasure(std::shared_ptr context, - const sk_sp contourMeasure) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(contourMeasure)) - { - if (contourMeasure == nullptr) - { - jsi::detail::throwJSError(*context->getJsRuntime(), "Contour measure is null"); - } - }; - - JSI_HOST_FUNCTION(getPosTan) - { - auto dist = arguments[0].asNumber(); - SkPoint position; - SkPoint tangent; - auto result = getObject()->getPosTan(dist, &position, &tangent); - if (!result) - { - jsi::detail::throwJSError(runtime, "getSegment() failed"); - } - auto posTan = jsi::Object(runtime); - posTan.setProperty(runtime, "px", position.x()); - posTan.setProperty(runtime, "py", position.y()); - posTan.setProperty(runtime, "tx", tangent.x()); - posTan.setProperty(runtime, "ty", tangent.y()); - return posTan; - } - - JSI_HOST_FUNCTION(length) - { - return jsi::Value(SkScalarToDouble(getObject()->length())); - } - - JSI_HOST_FUNCTION(isClosed) - { - return jsi::Value(getObject()->isClosed()); - } - - JSI_HOST_FUNCTION(getSegment) - { - auto start = arguments[0].asNumber(); - auto end = arguments[1].asNumber(); - auto startWithMoveTo = arguments[2].getBool(); - SkPath path; - auto result = getObject()->getSegment(start, end, &path, startWithMoveTo); - if (!result) - { - jsi::detail::throwJSError(runtime, "getSegment() failed"); - } - return JsiSkPath::toValue(runtime, getContext(), std::move(path)); - } - - JSI_PROPERTY_GET(__typename__) - { - return jsi::String::createFromUtf8(runtime, "ContourMeasure"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkContourMeasure, __typename__)) - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkContourMeasure, getPosTan), - JSI_EXPORT_FUNC(JsiSkContourMeasure, length), - JSI_EXPORT_FUNC(JsiSkContourMeasure, isClosed), - JSI_EXPORT_FUNC(JsiSkContourMeasure, getSegment)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) - { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - }; -} // namespace ABI46_0_0RNSkia \ No newline at end of file diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasureIter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasureIter.h deleted file mode 100644 index 7bd57e9afcc1a6..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkContourMeasureIter.h +++ /dev/null @@ -1,90 +0,0 @@ -#pragma once - -#include -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkContourMeasure.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - class JsiSkContourMeasureIter : public JsiSkWrappingSharedPtrHostObject - { - public: - JsiSkContourMeasureIter( - std::shared_ptr context, - const SkPath &path, - bool forceClosed, - SkScalar resScale = 1) : JsiSkWrappingSharedPtrHostObject(std::move(context), std::make_shared(path, forceClosed, resScale)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) - { - return jsi::String::createFromUtf8(runtime, "ContourMeasureIter"); - } - - JSI_EXPORT_PROPERTY_GETTERS( - JSI_EXPORT_PROP_GET(JsiSkContourMeasureIter, __typename__), ) - - JSI_HOST_FUNCTION(next) - { - auto next = getObject()->next(); - if (next == nullptr) - { - return jsi::Value::undefined(); - } - auto nextObject = std::make_shared(getContext(), std::move(next)); - - return jsi::Object::createFromHostObject(runtime, std::move(nextObject)); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkContourMeasureIter, next)) - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) - { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - /** - * Creates the function for construction a new instance of the SkContourMeasureIter - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkContourMeasureIter - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) - { - return JSI_HOST_FUNCTION_LAMBDA - { - auto path = JsiSkPath::fromValue(runtime, arguments[0]); - auto forceClosed = arguments[1].getBool(); - auto resScale = arguments[2].asNumber(); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - std::move(context), - *path, - forceClosed, - resScale)); - }; - } - }; -} // namespace ABI46_0_0RNSkia \ No newline at end of file diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkData.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkData.h deleted file mode 100644 index 63f1e579a4c181..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkData.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkData : public JsiSkWrappingSkPtrHostObject { - public: - JsiSkData(std::shared_ptr context, - sk_sp asset) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(asset)){} - - - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Data"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkData, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkDataFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkDataFactory.h deleted file mode 100644 index 3dab219f76098a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkDataFactory.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -#include -#include - -#include -#include - -#include "JsiSkData.h" - - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkDataFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(fromURI) { - auto jsiLocalUri = arguments[0].asString(runtime); - auto localUri = jsiLocalUri.utf8(runtime); - auto context = getContext(); - return ABI46_0_0React::createPromiseAsJSIValue( - runtime, - [context = std::move(context), localUri = std::move(localUri)](jsi::Runtime &runtime, - std::shared_ptr promise) -> void { - // Create a stream operation - this will be run in a - // separate thread - context->performStreamOperation( - localUri, - [&runtime, context = std::move(context), promise = std::move(promise)]( - std::unique_ptr stream) -> void { - // Schedule drawCallback on the Javascript thread - auto result = SkData::MakeFromStream(stream.get(), stream->getLength()); - context->runOnJavascriptThread([&runtime, context = std::move(context), promise = std::move(promise), - result = std::move(result)]() { - promise->resolve(jsi::Object::createFromHostObject( - runtime, - std::make_shared(std::move(context), - std::move(result)))); - }); - }); - }); - }; - - JSI_HOST_FUNCTION(fromBytes) { - auto array = arguments[0].asObject(runtime); - jsi::ArrayBuffer buffer = array - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - - auto data = SkData::MakeWithCopy(buffer.data(runtime), buffer.size(runtime)); - return jsi::Object::createFromHostObject(runtime, - std::make_shared( - getContext(), std::move(data))); - } - - JSI_HOST_FUNCTION(fromBase64) { - auto base64 = arguments[0].asString(runtime); - auto base64Str = base64.utf8(runtime); - auto size = base64Str.size(); - - // Calculate length - size_t len; - auto err = SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size, nullptr, &len); - if(err != SkBase64::Error::kNoError) { - jsi::detail::throwJSError(runtime, "Error decoding base64 string"); - return jsi::Value::undefined(); - } - - // Create data object and decode - auto data = SkData::MakeUninitialized(len); - err = SkBase64::Decode(&base64.utf8(runtime).c_str()[0], size, data->writable_data(), &len); - if(err != SkBase64::Error::kNoError) { - jsi::detail::throwJSError(runtime, "Error decoding base64 string"); - return jsi::Value::undefined(); - } - - return jsi::Object::createFromHostObject(runtime, - std::make_shared( - getContext(), std::move(data))); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkDataFactory, fromURI), - JSI_EXPORT_FUNC(JsiSkDataFactory, fromBytes), - JSI_EXPORT_FUNC(JsiSkDataFactory, fromBase64)) - - JsiSkDataFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFont.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFont.h deleted file mode 100644 index 90f0033c26c259..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFont.h +++ /dev/null @@ -1,354 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include "JsiSkHostObjects.h" -#include - -#include "JsiSkPaint.h" -#include "JsiSkRect.h" -#include "JsiSkTypeface.h" -#include "JsiSkPoint.h" - - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - class JsiSkFont : public JsiSkWrappingSharedPtrHostObject - { - public: - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) - { - return jsi::String::createFromUtf8(runtime, "Font"); - } - - JSI_HOST_FUNCTION(measureText) - { - ABI46_0_0RNSkLogger::warnToJavascriptConsole(runtime, "measureText() is deprecated. Clients should use 'Font.getGlyphWidths' instead (the latter does no shaping)"); - auto textVal = arguments[0].asString(runtime).utf8(runtime); - auto text = textVal.c_str(); - SkRect rect; - std::shared_ptr paint = nullptr; - // Check if a paint argument was provided - if (count == 2) - { - paint = JsiSkPaint::fromValue(runtime, arguments[1]); - } - getObject()->measureText(text, strlen(text), SkTextEncoding::kUTF8, &rect, - paint.get()); - rect.setXYWH(0, 0, rect.width(), rect.height()); - return JsiSkRect::toValue(runtime, getContext(), std::move(rect)); - } - - JSI_HOST_FUNCTION(getGlyphWidths) - { - auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime); - std::vector glyphs; - int glyphsSize = static_cast(jsiGlyphs.size(runtime)); - - std::vector widthPtrs; - widthPtrs.resize(glyphsSize); - - glyphs.reserve(glyphsSize); - for (int i = 0; i < glyphsSize; i++) - { - glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber()); - } - if (count > 1) - { - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast(widthPtrs.data()), nullptr, paint.get()); - } - else - { - getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast(widthPtrs.data()), nullptr, nullptr); - } - auto jsiWidths = jsi::Array(runtime, glyphsSize); - for (int i = 0; i < glyphsSize; i++) - { - jsiWidths.setValueAtIndex(runtime, i, jsi::Value(SkScalarToDouble(static_cast(widthPtrs.data())[i]))); - } - return jsiWidths; - } - - JSI_HOST_FUNCTION(getTextWidth) { - auto str = arguments[0].asString(runtime).utf8(runtime); - auto numGlyphIDs = str.length(); - std::vector glyphs; - glyphs.resize(numGlyphIDs); - int glyphsSize = static_cast(numGlyphIDs); - getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8, - static_cast(glyphs.data()), glyphsSize); - std::vector widthPtrs; - widthPtrs.resize(numGlyphIDs); - if (count > 1) - { - auto paint = JsiSkPaint::fromValue(runtime, arguments[1]); - getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast(widthPtrs.data()), nullptr, paint.get()); - } - else - { - getObject()->getWidthsBounds(glyphs.data(), glyphsSize, static_cast(widthPtrs.data()), nullptr, nullptr); - } - return jsi::Value(std::accumulate(widthPtrs.begin(), widthPtrs.end(), 0)); - } - - JSI_HOST_FUNCTION(getMetrics) - { - SkFontMetrics fm; - getObject()->getMetrics(&fm); - auto metrics = jsi::Object(runtime); - metrics.setProperty(runtime, "ascent", fm.fAscent); - metrics.setProperty(runtime, "descent", fm.fDescent); - metrics.setProperty(runtime, "leading", fm.fLeading); - if (!(fm.fFlags & SkFontMetrics::kBoundsInvalid_Flag)) - { - auto bounds = SkRect::MakeLTRB(fm.fXMin, fm.fTop, fm.fXMax, fm.fBottom); - auto jsiBounds = JsiSkRect::toValue(runtime, getContext(), std::move(bounds)); - metrics.setProperty(runtime, "bounds", std::move(jsiBounds)); - } - return metrics; - } - - JSI_HOST_FUNCTION(getGlyphIDs) - { - auto str = arguments[0].asString(runtime).utf8(runtime); - auto numGlyphIDs = count > 1 && !arguments[1].isNull() && !arguments[1].isUndefined() - ? arguments[1].asNumber() - : str.length(); - std::vector glyphIDs; - glyphIDs.resize(numGlyphIDs); - getObject()->textToGlyphs(str.c_str(), str.length(), SkTextEncoding::kUTF8, - static_cast(glyphIDs.data()), numGlyphIDs); - auto jsiGlyphIDs = jsi::Array(runtime, numGlyphIDs); - for (int i = 0; i < numGlyphIDs; i++) - { - jsiGlyphIDs.setValueAtIndex(runtime, i, jsi::Value(static_cast(glyphIDs[i]))); - } - return jsiGlyphIDs; - } - - JSI_HOST_FUNCTION(getGlyphIntercepts) - { - auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime); - auto jsiPositions = arguments[1].asObject(runtime).asArray(runtime); - auto top = arguments[2].asNumber(); - auto bottom = arguments[3].asNumber(); - std::vector positions; - int pointsSize = static_cast(jsiPositions.size(runtime)); - positions.reserve(pointsSize); - for (int i = 0; i < pointsSize; i++) - { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiPositions.getValueAtIndex(runtime, i).asObject(runtime)); - positions.push_back(*point.get()); - } - - std::vector glyphs; - int glyphsSize = static_cast(jsiGlyphs.size(runtime)); - glyphs.reserve(glyphsSize); - for (int i = 0; i < glyphsSize; i++) - { - glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber()); - } - - if (glyphs.size() > positions.size()) - { - jsi::detail::throwJSError(runtime, "Not enough x,y position pairs for glyphs"); - return jsi::Value::null(); - } - auto sects = getObject()->getIntercepts(glyphs.data(), SkToInt(glyphs.size()), positions.data(), top, bottom); - auto jsiSects = jsi::Array(runtime, sects.size()); - for (int i = 0; i < sects.size(); i++) - { - jsiSects.setValueAtIndex(runtime, i, jsi::Value(static_cast(sects.at(i)))); - } - return jsiSects; - } - - JSI_HOST_FUNCTION(getScaleX) - { - return jsi::Value(SkScalarToDouble(getObject()->getScaleX())); - } - - JSI_HOST_FUNCTION(getSize) - { - return jsi::Value(SkScalarToDouble(getObject()->getSize())); - } - - JSI_HOST_FUNCTION(getSkewX) - { - return jsi::Value(SkScalarToDouble(getObject()->getSkewX())); - } - - JSI_HOST_FUNCTION(isEmbolden) - { - return jsi::Value(getObject()->isEmbolden()); - } - - JSI_HOST_FUNCTION(getTypeface) - { - return JsiSkTypeface::toValue(runtime, getContext(), sk_sp(getObject()->getTypeface())); - } - - JSI_HOST_FUNCTION(setEdging) - { - auto edging = arguments[0].asNumber(); - getObject()->setEdging(static_cast(edging)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(embeddedBitmaps) - { - auto embeddedBitmaps = arguments[0].getBool(); - getObject()->setEmbeddedBitmaps(embeddedBitmaps); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setHinting) - { - auto hinting = arguments[0].asNumber(); - getObject()->setHinting(static_cast(hinting)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setLinearMetrics) - { - auto linearMetrics = arguments[0].getBool(); - getObject()->setLinearMetrics(linearMetrics); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setScaleX) - { - auto scaleX = arguments[0].asNumber(); - getObject()->setScaleX(scaleX); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setSkewX) - { - auto skewX = arguments[0].asNumber(); - getObject()->setSkewX(skewX); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setSize) - { - auto size = arguments[0].asNumber(); - getObject()->setSize(size); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setEmbolden) - { - auto embolden = arguments[0].asNumber(); - getObject()->setEmbolden(embolden); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setSubpixel) - { - auto subpixel = arguments[0].asNumber(); - getObject()->setSubpixel(subpixel); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setTypeface) - { - auto typeface = arguments[0].isNull() ? nullptr : JsiSkTypeface::fromValue(runtime, arguments[0]); - getObject()->setTypeface(typeface); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkFont, getSize), - JSI_EXPORT_FUNC(JsiSkFont, measureText), - JSI_EXPORT_FUNC(JsiSkFont, getMetrics), - JSI_EXPORT_FUNC(JsiSkFont, getGlyphIDs), - JSI_EXPORT_FUNC(JsiSkFont, getGlyphIntercepts), - JSI_EXPORT_FUNC(JsiSkFont, getScaleX), - JSI_EXPORT_FUNC(JsiSkFont, getSkewX), - JSI_EXPORT_FUNC(JsiSkFont, getTypeface), - JSI_EXPORT_FUNC(JsiSkFont, setEdging), - JSI_EXPORT_FUNC(JsiSkFont, embeddedBitmaps), - JSI_EXPORT_FUNC(JsiSkFont, setHinting), - JSI_EXPORT_FUNC(JsiSkFont, setLinearMetrics), - JSI_EXPORT_FUNC(JsiSkFont, setScaleX), - JSI_EXPORT_FUNC(JsiSkFont, setSkewX), - JSI_EXPORT_FUNC(JsiSkFont, setSize), - JSI_EXPORT_FUNC(JsiSkFont, setEmbolden), - JSI_EXPORT_FUNC(JsiSkFont, setSubpixel), - JSI_EXPORT_FUNC(JsiSkFont, setTypeface), - JSI_EXPORT_FUNC(JsiSkFont, getGlyphWidths), - JSI_EXPORT_FUNC(JsiSkFont, getTextWidth)) - - JsiSkFont(std::shared_ptr context, const SkFont &font) - : JsiSkWrappingSharedPtrHostObject(std::move(context), - std::make_shared(font)){} - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) - { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - /** - * Creates the function for construction a new instance of the SkFont - * wrapper - * @param context Platform context - * @return A function for creating a new host object wrapper for the SkFont - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) - { - return JSI_HOST_FUNCTION_LAMBDA - { - // Handle arguments - if (count == 2) - { - auto typeface = JsiSkTypeface::fromValue(runtime, arguments[0]); - auto size = arguments[1].asNumber(); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(std::move(context), SkFont(typeface, size))); - } - else if (count == 1) - { - auto typeface = JsiSkTypeface::fromValue(runtime, arguments[0]); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), SkFont(typeface))); - } - else - { - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), SkFont())); - } - }; - } - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgr.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgr.h deleted file mode 100644 index 6349cea91ebec2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgr.h +++ /dev/null @@ -1,84 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include - -#pragma clang diagnostic pop - - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkFontMgr : public JsiSkWrappingSkPtrHostObject { - public: - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "FontMgr"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkFontMgr, __typename__)) - - JsiSkFontMgr(std::shared_ptr context, - sk_sp fontMgr) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(fontMgr)) {} - - JSI_HOST_FUNCTION(countFamilies) { - auto families = getObject()->countFamilies(); - return jsi::Value(families); - } - - JSI_HOST_FUNCTION(getFamilyName) { - auto i = arguments[0].asNumber(); - SkString familyName; - getObject()->getFamilyName(i, &familyName); - return jsi::String::createFromUtf8(runtime, familyName.c_str()); - } - - JSI_HOST_FUNCTION(matchFamilyStyle) { - auto familyName = arguments[0].asString(runtime).utf8(runtime); - auto fontStyle = SkFontStyle::Normal(); - if (count >= 2) { - auto object = arguments[1].asObject(runtime); - int weight = object.getProperty(runtime, "weight").asNumber(); - int width = object.getProperty(runtime, "width").asNumber(); - SkFontStyle::Slant slant = (SkFontStyle::Slant)object.getProperty(runtime, "slant").asNumber(); - fontStyle = SkFontStyle(width, weight, slant); - } - auto typeface = getObject()->matchFamilyStyle(familyName.c_str(), std::move(fontStyle)); - if (typeface == nullptr) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), sk_sp(std::move(typeface))));; - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkFontMgr, countFamilies), - JSI_EXPORT_FUNC(JsiSkFontMgr, getFamilyName), - JSI_EXPORT_FUNC(JsiSkFontMgr, matchFamilyStyle) - ) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgrFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgrFactory.h deleted file mode 100644 index 5aaee6ddc6dd43..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkFontMgrFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkFontMgr.h" -#include "JsiSkData.h" -#include - - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkFontMgrFactory : public JsiSkHostObject { - public: -// JSI_HOST_FUNCTION(FromData) { -// std::vector> data; -// for (int i = 0; i < count; i++) { -// auto d = JsiSkData::fromValue( -// runtime, arguments[i]); -// data.push_back(d); -// } -// -// auto fontMgr = SkFontMgr_New_Custom_Data(data.data(), data.size()); -// return jsi::Object::createFromHostObject( -// runtime, std::make_shared(getContext(), fontMgr)); -// } - - JSI_HOST_FUNCTION(RefDefault) { - auto fontMgr = SkFontMgr::RefDefault(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(fontMgr))); - } - - JSI_EXPORT_FUNCTIONS( - //JSI_EXPORT_FUNC(JsiSkFontMgrFactory, FromData), - JSI_EXPORT_FUNC(JsiSkFontMgrFactory, RefDefault) - ) - - JsiSkFontMgrFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkHostObjects.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkHostObjects.h deleted file mode 100644 index c4de6d9588d59d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkHostObjects.h +++ /dev/null @@ -1,83 +0,0 @@ -#pragma once - -#include -#include - -#include "ABI46_0_0RNSkPlatformContext.h" -#include - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0RNJsi; - -/** - * Base class for jsi host objects - */ -class JsiSkHostObject : public JsiHostObject { -public: - /** - * Default constructor - * @param context Platform context - */ - JsiSkHostObject(std::shared_ptr context) - : _context(context){}; - -protected: - - /** - * @return A pointer to the platform context - */ - std::shared_ptr getContext() { return _context; } - -private: - std::shared_ptr _context; -}; - -template class JsiSkWrappingHostObject : public JsiSkHostObject { -public: - /** - * Default constructor - * @param context Platform context - */ - JsiSkWrappingHostObject(std::shared_ptr context, - T&& object) - : JsiSkHostObject(std::move(context)), _object(std::move(object)){} - - JsiSkWrappingHostObject(std::shared_ptr context, - const T& object) - : JsiSkHostObject(std::move(context)), _object(object){} - - /** - * Returns the underlying object exposed by this host object. This object - * should be wrapped in a shared pointer of some kind - * @return Underlying object - */ - T& getObject() { return _object; } - const T& getObject() const { return _object; } - - -private: - /** - * Wrapped object - */ - T _object; -}; - -template -class JsiSkWrappingSharedPtrHostObject - : public JsiSkWrappingHostObject> { -public: - JsiSkWrappingSharedPtrHostObject(std::shared_ptr context, - std::shared_ptr object) - : JsiSkWrappingHostObject>(std::move(context), std::move(object)) {} -}; - -template -class JsiSkWrappingSkPtrHostObject : public JsiSkWrappingHostObject> { -public: - JsiSkWrappingSkPtrHostObject(std::shared_ptr context, - sk_sp object) - : JsiSkWrappingHostObject>(std::move(context), std::move(object)) {} -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImage.h deleted file mode 100644 index 252d61173ee0a0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImage.h +++ /dev/null @@ -1,124 +0,0 @@ -#pragma once - -#include -#include - -#include "JsiSkMatrix.h" -#include -#include "JsiSkShader.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include - -#pragma clang diagnostic pop - -#include - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - class JsiSkImage : public JsiSkWrappingSkPtrHostObject - { - public: - // TODO-API: Properties? - JSI_HOST_FUNCTION(width) { return static_cast(getObject()->width()); } - JSI_HOST_FUNCTION(height) - { - return static_cast(getObject()->height()); - } - - JSI_HOST_FUNCTION(makeShaderOptions) - { - auto tmx = (SkTileMode)arguments[0].asNumber(); - auto tmy = (SkTileMode)arguments[1].asNumber(); - auto fm = (SkFilterMode)arguments[2].asNumber(); - auto mm = (SkMipmapMode)arguments[3].asNumber(); - auto m = count > 4 && !arguments[4].isUndefined() ? JsiSkMatrix::fromValue(runtime, arguments[4]).get() - : nullptr; - auto shader = - getObject()->makeShader(tmx, tmy, SkSamplingOptions(fm, mm), m); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(shader))); - } - - JSI_HOST_FUNCTION(makeShaderCubic) - { - auto tmx = (SkTileMode)arguments[0].asNumber(); - auto tmy = (SkTileMode)arguments[1].asNumber(); - auto B = (float)arguments[2].asNumber(); - auto C = (float)arguments[3].asNumber(); - auto m = count > 4 && !arguments[4].isUndefined() ? JsiSkMatrix::fromValue(runtime, arguments[4]).get() - : nullptr; - auto shader = - getObject()->makeShader(tmx, tmy, SkSamplingOptions({B, C}), m); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(shader))); - } - - JSI_HOST_FUNCTION(encodeToBytes) - { - // Get optional parameters - auto format = count >= 1 ? static_cast(arguments[0].asNumber()) : SkEncodedImageFormat::kPNG; - auto quality = count == 2 ? arguments[1].asNumber() : 100.0; - - // Get data - auto data = getObject()->encodeToData(format, quality); - auto arrayCtor = runtime.global().getPropertyAsFunction(runtime, "Uint8Array"); - size_t size = data->size(); - - jsi::Object array = arrayCtor.callAsConstructor(runtime, static_cast(size)).getObject(runtime); - jsi::ArrayBuffer buffer = array - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - - auto bfrPtr = reinterpret_cast(buffer.data(runtime)); - memcpy(bfrPtr, data->bytes(), size); - return array; - } - - JSI_HOST_FUNCTION(encodeToBase64) - { - // Get optional parameters - auto format = count >= 1 ? static_cast(arguments[0].asNumber()) : SkEncodedImageFormat::kPNG; - - auto quality = count == 2 ? arguments[1].asNumber() : 100.0; - - auto data = getObject()->encodeToData(format, quality); - auto len = SkBase64::Encode(data->bytes(), data->size(), nullptr); - auto buffer = std::string(len, 0); - SkBase64::Encode(data->bytes(), data->size(), (void *)&buffer[0]); - return jsi::String::createFromAscii(runtime, buffer); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkImage, width), - JSI_EXPORT_FUNC(JsiSkImage, height), - JSI_EXPORT_FUNC(JsiSkImage, makeShaderOptions), - JSI_EXPORT_FUNC(JsiSkImage, makeShaderCubic), - JSI_EXPORT_FUNC(JsiSkImage, encodeToBytes), - JSI_EXPORT_FUNC(JsiSkImage, encodeToBase64)) - - JsiSkImage(std::shared_ptr context, - const sk_sp image) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(image)){} - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) - { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFactory.h deleted file mode 100644 index a81fc74c58ebc5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFactory.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkImage.h" -#include "JsiSkImageInfo.h" -#include "JsiSkHostObjects.h" -#include "JsiSkData.h" - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkImageFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(MakeImageFromEncoded) { - auto data = JsiSkData::fromValue(runtime, arguments[0]); - auto image = SkImage::MakeFromEncoded(data); - if(image == nullptr) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(image))); - } - - JSI_HOST_FUNCTION(MakeImage) { - auto imageInfo = JsiSkImageInfo::fromValue(runtime, arguments[0]); - auto pixelData = JsiSkData::fromValue(runtime, arguments[1]); - auto bytesPerRow = arguments[2].asNumber(); - auto image = SkImage::MakeRasterData(*imageInfo, pixelData, bytesPerRow); - if(image == nullptr) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(image))); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkImageFactory, MakeImageFromEncoded), - JSI_EXPORT_FUNC(JsiSkImageFactory, MakeImage), - ) - - JsiSkImageFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilter.h deleted file mode 100644 index 3b8632af877f56..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilter.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkImageFilter : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkImageFilter(std::shared_ptr context, - sk_sp imageFilter) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(imageFilter)){} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "ImageFilter"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkImageFilter, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilterFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilterFactory.h deleted file mode 100644 index 1a5a7460ddc76d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageFilterFactory.h +++ /dev/null @@ -1,237 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkImageFilter.h" -#include "JsiSkRuntimeShaderBuilder.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkImageFilterFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakeBlur) { - float sigmaX = arguments[0].asNumber(); - float sigmaY = arguments[1].asNumber(); - int tileMode = arguments[2].asNumber(); - sk_sp imageFilter; - if (!arguments[3].isNull()) { - imageFilter = JsiSkImageFilter::fromValue(runtime, arguments[3]); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), - SkImageFilters::Blur(sigmaX, sigmaY, (SkTileMode)tileMode, - imageFilter))); - } - - JSI_HOST_FUNCTION(MakeColorFilter) { - auto cf = JsiSkColorFilter::fromValue(runtime, arguments[0]); - sk_sp input; - if (!arguments[1].isNull()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[1]); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkImageFilters::ColorFilter(std::move(cf), std::move(input)))); - } - - JSI_HOST_FUNCTION(MakeOffset) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - sk_sp input; - if (!arguments[2].isNull()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[2]); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkImageFilters::Offset(x, y, std::move(input)))); - } - - JSI_HOST_FUNCTION(MakeDisplacementMap) { - auto fXChannelSelector = static_cast(arguments[0].asNumber()); - auto fYChannelSelector = static_cast(arguments[1].asNumber()); - auto scale = arguments[2].asNumber(); - auto in2 = JsiSkImageFilter::fromValue(runtime, arguments[3]); - sk_sp input; - if (!arguments[4].isNull()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[4]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), - SkImageFilters::DisplacementMap(fXChannelSelector, fYChannelSelector, scale, std::move(in2), std::move(input)) - ) - ); - } - - JSI_HOST_FUNCTION(MakeShader) { - auto shader = JsiSkShader::fromValue(runtime, arguments[0]); - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkImageFilters::Shader(std::move(shader)))); - } - - JSI_HOST_FUNCTION(MakeCompose) { - sk_sp outer; - if (!arguments[0].isNull()&& !arguments[0].isUndefined()) { - outer = JsiSkImageFilter::fromValue(runtime, arguments[0]); - } - sk_sp inner; - if (!arguments[1].isNull() && !arguments[1].isUndefined()) { - inner = JsiSkImageFilter::fromValue(runtime, arguments[1]); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkImageFilters::Compose(std::move(outer), std::move(inner)))); - } - - - JSI_HOST_FUNCTION(MakeBlend) { - auto mode = static_cast(arguments[0].asNumber()); - sk_sp background = JsiSkImageFilter::fromValue(runtime, arguments[1]); - sk_sp foreground = nullptr; - - if(count > 2 && !arguments[2].isNull()) { - foreground = JsiSkImageFilter::fromValue(runtime, arguments[2]); - } - - SkImageFilters::CropRect cropRect = {}; - if (count > 3 && !arguments[3].isUndefined()) { - cropRect = *JsiSkRect::fromValue(runtime, arguments[3]); - } - - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkImageFilters::Blend(std::move(mode), std::move(background), std::move(foreground), cropRect))); - } - - JSI_HOST_FUNCTION(MakeDropShadow) { - auto dx = arguments[0].asNumber(); - auto dy = arguments[1].asNumber(); - auto sigmaX = arguments[2].asNumber(); - auto sigmaY = arguments[3].asNumber(); - auto color = JsiSkColor::fromValue(runtime, arguments[4]); - sk_sp input; - if (!arguments[5].isNull() && !arguments[5].isUndefined()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[5]); - } - SkImageFilters::CropRect cropRect = {}; - if (count > 6 && !arguments[6].isUndefined()) { - cropRect = *JsiSkRect::fromValue(runtime, arguments[6]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), SkImageFilters::DropShadow(dx, dy, sigmaX, sigmaY, - color, std::move(input), cropRect))); - } - - JSI_HOST_FUNCTION(MakeDropShadowOnly) { - auto dx = arguments[0].asNumber(); - auto dy = arguments[1].asNumber(); - auto sigmaX = arguments[2].asNumber(); - auto sigmaY = arguments[3].asNumber(); - auto color = JsiSkColor::fromValue(runtime, arguments[4]); - sk_sp input; - if (!arguments[5].isNull() && !arguments[5].isUndefined()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[5]); - } - SkImageFilters::CropRect cropRect = {}; - if (count > 6 && !arguments[6].isUndefined()) { - cropRect = *JsiSkRect::fromValue(runtime, arguments[6]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), SkImageFilters::DropShadowOnly(dx, dy, sigmaX, sigmaY, - color, std::move(input), cropRect))); - } - - JSI_HOST_FUNCTION(MakeErode) { - auto rx = arguments[0].asNumber(); - auto ry = arguments[1].asNumber(); - sk_sp input; - if (!arguments[2].isNull() && !arguments[2].isUndefined()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[2]); - } - SkImageFilters::CropRect cropRect = {}; - if (count > 3 && !arguments[3].isUndefined()) { - cropRect = *JsiSkRect::fromValue(runtime, arguments[3]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), SkImageFilters::Erode(rx, ry, std::move(input), cropRect)) - ); - } - - JSI_HOST_FUNCTION(MakeDilate) { - auto rx = arguments[0].asNumber(); - auto ry = arguments[1].asNumber(); - sk_sp input; - if (!arguments[2].isNull() && !arguments[2].isUndefined()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[2]); - } - SkImageFilters::CropRect cropRect = {}; - if (count > 3 && !arguments[3].isUndefined()) { - cropRect = *JsiSkRect::fromValue(runtime, arguments[3]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), SkImageFilters::Dilate(rx, ry, std::move(input), cropRect))); - } - - JSI_HOST_FUNCTION(MakeRuntimeShader) { - auto rtb = JsiSkRuntimeShaderBuilder::fromValue(runtime, arguments[0]); - - const char* childName = nullptr; - if (!arguments[1].isNull() && !arguments[1].isUndefined()) { - childName = arguments[1].asString(runtime).utf8(runtime).c_str(); - } - - sk_sp input; - if (!arguments[2].isNull() && !arguments[2].isUndefined()) { - input = JsiSkImageFilter::fromValue(runtime, arguments[2]); - } - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), SkImageFilters::RuntimeShader(*rtb, childName, std::move(input))) - ); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeBlur), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeOffset), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeColorFilter), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeShader), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDisplacementMap), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeCompose), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeErode), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDilate), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeBlend), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDropShadow), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeDropShadowOnly), - JSI_EXPORT_FUNC(JsiSkImageFilterFactory, MakeRuntimeShader) - ) - - JsiSkImageFilterFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageInfo.h deleted file mode 100644 index 459f15831f403a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkImageInfo.h +++ /dev/null @@ -1,57 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkImageInfo : public JsiSkWrappingSharedPtrHostObject { - public: - JsiSkImageInfo(std::shared_ptr context, const SkImageInfo &imageInfo) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(imageInfo)){} - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return object - .asHostObject(runtime) - ->getObject(); - } else { - auto width = object.getProperty(runtime, "width").asNumber(); - auto height = object.getProperty(runtime, "height").asNumber(); - auto colorType = static_cast(object.getProperty(runtime, "colorType").asNumber()); - auto alphaType = static_cast(object.getProperty(runtime, "alphaType").asNumber()); - // TODO: color space not supported yet - return std::make_shared(SkImageInfo::Make(width, height, colorType, alphaType)); - } - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkImageInfo &imageInfo) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), imageInfo)); - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilter.h deleted file mode 100644 index 207865d9fdb2ed..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilter.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkMaskFilter : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkMaskFilter(std::shared_ptr context, - sk_sp maskFilter) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(maskFilter)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "MaskFilter"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkMaskFilter, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilterFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilterFactory.h deleted file mode 100644 index 549022de454b84..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMaskFilterFactory.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkColorFilter.h" -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkMaskFilterFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakeBlur) { - int blurStyle = arguments[0].asNumber(); - float sigma = arguments[1].asNumber(); - bool respectCTM = arguments[2].getBool(); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared( - getContext(), - SkMaskFilter::MakeBlur((SkBlurStyle)blurStyle, sigma, respectCTM))); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkMaskFilterFactory, MakeBlur)) - - JsiSkMaskFilterFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMatrix.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMatrix.h deleted file mode 100644 index 738da61bba8163..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkMatrix.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - - -class JsiSkMatrix : public JsiSkWrappingSharedPtrHostObject { -public: - - JsiSkMatrix(std::shared_ptr context, SkMatrix m) - : JsiSkWrappingSharedPtrHostObject( - context, std::make_shared(std::move(m))) {} - - - static SkMatrix getMatrix(jsi::Runtime &runtime, const jsi::Value& value) { - const auto& object = value.asObject(runtime); - const auto& array = object.asArray(runtime); - auto scaleX = array.getValueAtIndex(runtime, 0).asNumber(); - auto skewX = array.getValueAtIndex(runtime, 1).asNumber(); - auto transX = array.getValueAtIndex(runtime, 2).asNumber(); - auto skewY = array.getValueAtIndex(runtime, 3).asNumber(); - auto scaleY = array.getValueAtIndex(runtime, 4).asNumber(); - auto transY = array.getValueAtIndex(runtime, 5).asNumber(); - auto pers0 = array.getValueAtIndex(runtime, 6).asNumber(); - auto pers1 = array.getValueAtIndex(runtime, 7).asNumber(); - auto pers2 = array.getValueAtIndex(runtime, 8).asNumber(); - return SkMatrix::MakeAll( - scaleX, skewX, transX, - skewY, scaleY, transY, - pers0, pers1, pers2 - ); - } - - JSI_HOST_FUNCTION(concat) { - auto m3 = JsiSkMatrix::fromValue(runtime, arguments[0]); - getObject()->preConcat(*m3); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(translate) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - getObject()->preTranslate(x, y); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(scale) { - auto x = arguments[0].asNumber(); - auto y = count > 1 ? arguments[1].asNumber() : 1; - getObject()->preScale(x, y); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(skew) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - getObject()->preSkew(x, y); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(rotate) { - auto a = arguments[0].asNumber(); - getObject()->preRotate(SkRadiansToDegrees(a)); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkMatrix, concat), - JSI_EXPORT_FUNC(JsiSkMatrix, translate), - JSI_EXPORT_FUNC(JsiSkMatrix, scale), - JSI_EXPORT_FUNC(JsiSkMatrix, skew), - JSI_EXPORT_FUNC(JsiSkMatrix, rotate), - ) - - /** - * Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return object - .asHostObject(runtime) - ->getObject(); - } else { - return std::make_shared(JsiSkMatrix::getMatrix(runtime, obj)); - } - } - - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - SkMatrix matrix; - if (count == 1) { - matrix = JsiSkMatrix::getMatrix(runtime, arguments[0]); - } else { - matrix = SkMatrix::I(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), matrix)); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPaint.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPaint.h deleted file mode 100644 index baca8366ea63d3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPaint.h +++ /dev/null @@ -1,199 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { -using namespace ABI46_0_0facebook; - -class JsiSkPaint : public JsiSkWrappingSharedPtrHostObject { -public: - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Paint"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkPaint, __typename__)) - - JSI_HOST_FUNCTION(copy) { - const auto* paint = getObject().get(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), SkPaint(*paint))); - } - - JSI_HOST_FUNCTION(getColor) { - return JsiSkColor::toValue(runtime, getObject()->getColor()); - } - - JSI_HOST_FUNCTION(getStrokeCap) { - return static_cast(getObject()->getStrokeCap()); - } - - JSI_HOST_FUNCTION(getStrokeJoin) { - return static_cast(getObject()->getStrokeJoin()); - } - - JSI_HOST_FUNCTION(getStrokeMiter) { - return static_cast(getObject()->getStrokeMiter()); - } - - JSI_HOST_FUNCTION(getStrokeWidth) { - return static_cast(getObject()->getStrokeWidth()); - } - - JSI_HOST_FUNCTION(setColor) { - SkColor color = JsiSkColor::fromValue(runtime, arguments[0]); - getObject()->setColor(color); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setAlphaf) { - SkScalar alpha = arguments[0].asNumber(); - getObject()->setAlphaf(alpha); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setAntiAlias) { - bool antiAliased = arguments[0].getBool(); - getObject()->setAntiAlias(antiAliased); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setStrokeWidth) { - SkScalar width = arguments[0].asNumber(); - getObject()->setStrokeWidth(width); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setStyle) { - auto style = arguments[0].asNumber(); - getObject()->setStyle(static_cast(style)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setStrokeCap) { - auto cap = arguments[0].asNumber(); - getObject()->setStrokeCap(static_cast(cap)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setStrokeJoin) { - int join = arguments[0].asNumber(); - getObject()->setStrokeJoin(static_cast(join)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setStrokeMiter) { - int limit = arguments[0].asNumber(); - getObject()->setStrokeMiter(limit); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setBlendMode) { - auto blendMode = (SkBlendMode)arguments[0].asNumber(); - getObject()->setBlendMode(blendMode); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setMaskFilter) { - auto maskFilter = arguments[0].isNull() || arguments[0].isUndefined() ? nullptr : JsiSkMaskFilter::fromValue(runtime, arguments[0]); - getObject()->setMaskFilter(std::move(maskFilter)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setImageFilter) { - auto imageFilter = arguments[0].isNull() || arguments[0].isUndefined() ? nullptr : JsiSkImageFilter::fromValue(runtime, arguments[0]); - getObject()->setImageFilter(std::move(imageFilter)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setColorFilter) { - auto colorFilter = arguments[0].isNull() || arguments[0].isUndefined() ? nullptr : JsiSkColorFilter::fromValue(runtime, arguments[0]); - getObject()->setColorFilter(std::move(colorFilter)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setShader) { - auto shader = arguments[0].isNull() || arguments[0].isUndefined() ? nullptr : JsiSkShader::fromValue(runtime, arguments[0]); - getObject()->setShader(std::move(shader)); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setPathEffect) { - auto pathEffect = arguments[0].isNull() || arguments[0].isUndefined() ? nullptr : JsiSkPathEffect::fromValue(runtime, arguments[0]); - getObject()->setPathEffect(std::move(pathEffect)); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPaint, copy), - JSI_EXPORT_FUNC(JsiSkPaint, getColor), - JSI_EXPORT_FUNC(JsiSkPaint, getStrokeCap), - JSI_EXPORT_FUNC(JsiSkPaint, getStrokeJoin), - JSI_EXPORT_FUNC(JsiSkPaint, getStrokeMiter), - JSI_EXPORT_FUNC(JsiSkPaint, getStrokeWidth), - JSI_EXPORT_FUNC(JsiSkPaint, setPathEffect), - JSI_EXPORT_FUNC(JsiSkPaint, setShader), - JSI_EXPORT_FUNC(JsiSkPaint, setColorFilter), - JSI_EXPORT_FUNC(JsiSkPaint, setImageFilter), - JSI_EXPORT_FUNC(JsiSkPaint, setMaskFilter), - JSI_EXPORT_FUNC(JsiSkPaint, setBlendMode), - JSI_EXPORT_FUNC(JsiSkPaint, setStrokeMiter), - JSI_EXPORT_FUNC(JsiSkPaint, setStrokeJoin), - JSI_EXPORT_FUNC(JsiSkPaint, setStrokeCap), - JSI_EXPORT_FUNC(JsiSkPaint, setAntiAlias), - JSI_EXPORT_FUNC(JsiSkPaint, setStrokeWidth), - JSI_EXPORT_FUNC(JsiSkPaint, setStyle), - JSI_EXPORT_FUNC(JsiSkPaint, setColor), - JSI_EXPORT_FUNC(JsiSkPaint, setAlphaf)) - - JsiSkPaint(std::shared_ptr context, SkPaint paint) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(std::move(paint))) {} - - /** -Returns the underlying object from a host object of this type -*/ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - /** - * Creates the function for construction a new instance of the SkPaint - * wrapper - * @param context Platform context - * @return A function for creating a new host object wrapper for the SkPaint - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - auto paint = SkPaint(); - paint.setAntiAlias(true); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), paint)); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPath.h deleted file mode 100644 index fec10f0d90b08c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPath.h +++ /dev/null @@ -1,592 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkPoint.h" -#include "JsiSkRRect.h" -#include "JsiSkRect.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - - -class JsiSkPath : public JsiSkWrappingSharedPtrHostObject { - -public: - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Path"); - } - - JSI_HOST_FUNCTION(addArc) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]).get(); - auto start = arguments[1].asNumber(); - auto sweep = arguments[2].asNumber(); - getObject()->addArc(*rect, start, sweep); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(addOval) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]).get(); - auto direction = SkPathDirection::kCW; - if (count >= 2 && arguments[1].getBool()) { - direction = SkPathDirection::kCCW; - } - unsigned startIndex = count < 3 ? 0 : arguments[2].asNumber(); - auto result = getObject()->addOval(*rect, direction, startIndex); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(addPoly) { - std::vector points; - auto jsiPoints = arguments[0].asObject(runtime).asArray(runtime); - auto close = arguments[1].getBool(); - auto pointsSize = jsiPoints.size(runtime); - points.reserve(pointsSize); - for (int i = 0; i < pointsSize; i++) { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiPoints.getValueAtIndex(runtime, i).asObject(runtime)); - points.push_back(*point.get()); - } - getObject()->addPoly(points.data(), (int)points.size(), close); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(addRect) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]).get(); - auto direction = SkPathDirection::kCW; - if (count >= 2 && arguments[1].getBool()) { - direction = SkPathDirection::kCCW; - } - getObject()->addRect(*rect, direction); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(addRRect) { - auto rrect = JsiSkRRect::fromValue(runtime, arguments[0]).get(); - auto direction = SkPathDirection::kCW; - if (count >= 2 && arguments[1].getBool()) { - direction = SkPathDirection::kCCW; - } - getObject()->addRRect(*rrect, direction); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(arcToOval) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]).get(); - auto start = arguments[1].asNumber(); - auto sweep = arguments[2].asNumber(); - auto forceMoveTo = arguments[3].getBool(); - getObject()->arcTo(*rect, start, sweep, forceMoveTo); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(arcToRotated) { - auto rx = arguments[0].asNumber(); - auto ry = arguments[1].asNumber(); - auto xAxisRotate = arguments[2].asNumber(); - auto useSmallArc = arguments[3].getBool(); - auto arcSize = useSmallArc ? SkPath::ArcSize::kSmall_ArcSize - : SkPath::ArcSize::kLarge_ArcSize; - auto sweep = - arguments[4].getBool() ? SkPathDirection::kCCW : SkPathDirection::kCW; - auto x = arguments[5].asNumber(); - auto y = arguments[6].asNumber(); - getObject()->arcTo(rx, ry, xAxisRotate, arcSize, sweep, x, y); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(rArcTo) { - auto rx = arguments[0].asNumber(); - auto ry = arguments[1].asNumber(); - auto xAxisRotate = arguments[2].asNumber(); - auto useSmallArc = arguments[3].getBool(); - auto arcSize = useSmallArc ? SkPath::ArcSize::kSmall_ArcSize - : SkPath::ArcSize::kLarge_ArcSize; - auto sweep = - arguments[4].getBool() ? SkPathDirection::kCCW : SkPathDirection::kCW; - auto x = arguments[5].asNumber(); - auto y = arguments[6].asNumber(); - getObject()->rArcTo(rx, ry, xAxisRotate, arcSize, sweep, x, y); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(arcToTangent) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - auto r = arguments[4].asNumber(); - getObject()->arcTo(x1, y1, x2, y2, r); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(computeTightBounds) { - auto result = getObject()->computeTightBounds(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(result))); - } - - // TODO-API: Should this be a property? - JSI_HOST_FUNCTION(getBounds) { - auto result = getObject()->getBounds(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(result))); - } - - JSI_HOST_FUNCTION(conicTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - auto w = arguments[4].asNumber(); - getObject()->conicTo(x1, y1, x2, y2, w); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(rConicTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - auto w = arguments[4].asNumber(); - getObject()->rConicTo(x1, y1, x2, y2, w); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(contains) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - return jsi::Value(getObject()->contains(x, y)); - } - - JSI_HOST_FUNCTION(dash) { - SkScalar on = arguments[0].asNumber(); - SkScalar off = arguments[1].asNumber(); - auto phase = arguments[2].asNumber(); - SkScalar intervals[] = {on, off}; - auto pe = SkDashPathEffect::Make(intervals, 2, phase); - if (!pe) { - // TODO: SkDebugf("Invalid args to dash()\n"); - return jsi::Value(false); - } - SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle); - SkPath &path = *getObject(); - // TODO: why we don't need to swap here? In trim() which is the same - // API, we need to swap - if (pe->filterPath(&path, path, &rec, nullptr)) { - return jsi::Value(true); - } - SkDebugf("Could not make dashed path\n"); - return jsi::Value(false); - } - - JSI_HOST_FUNCTION(equals) { - auto p1 = JsiSkPath::fromValue(runtime, arguments[0]).get(); - auto p2 = JsiSkPath::fromValue(runtime, arguments[1]).get(); - return jsi::Value(p1 == p2); - } - - // TODO-API: Property? - JSI_HOST_FUNCTION(getFillType) { - auto fillType = getObject()->getFillType(); - return jsi::Value(static_cast(fillType)); - } - - // TODO-API: Property? - JSI_HOST_FUNCTION(setFillType) { - auto ft = (SkPathFillType)arguments[0].asNumber(); - getObject()->setFillType(ft); - return jsi::Value::undefined(); - } - - // TODO-API: Property? - JSI_HOST_FUNCTION(setIsVolatile) { - auto v = arguments[0].getBool(); - getObject()->setIsVolatile(v); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(isVolatile) { - return jsi::Value(getObject()->isVolatile()); - } - - JSI_HOST_FUNCTION(transform) { - auto m3 = *JsiSkMatrix::fromValue(runtime, arguments[0]); - getObject()->transform(m3); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(stroke) { - auto path = *getObject(); - auto opts = arguments[0].asObject(runtime); - SkPaint p; - p.setStyle(SkPaint::kStroke_Style); - - auto jsiCap = opts.getProperty(runtime, "cap"); - if (!jsiCap.isUndefined()) { - auto cap = (SkPaint::Cap)jsiCap.asNumber(); - p.setStrokeCap(cap); - } - - auto jsiJoin = opts.getProperty(runtime, "join"); - if (!jsiJoin.isUndefined()) { - auto join = (SkPaint::Join)jsiJoin.asNumber(); - p.setStrokeJoin(join); - } - - auto jsiWidth = opts.getProperty(runtime, "width"); - if (!jsiWidth.isUndefined()) { - auto width = jsiWidth.asNumber(); - p.setStrokeWidth(width); - } - - auto jsiMiterLimit = opts.getProperty(runtime, "miter_limit"); - if (!jsiMiterLimit.isUndefined()) { - auto miter_limit = opts.getProperty(runtime, "miter_limit").asNumber(); - p.setStrokeMiter(miter_limit); - } - - auto jsiPrecision = opts.getProperty(runtime, "precision"); - auto precision = jsiPrecision.isUndefined() ? 1 : jsiPrecision.asNumber(); - auto result = p.getFillPath(path, &path, nullptr, precision); - getObject()->swap(path); - return result ? thisValue.getObject(runtime) : jsi::Value::null(); - } - - JSI_HOST_FUNCTION(trim) { - auto start = arguments[0].asNumber(); - auto end = arguments[1].asNumber(); - auto isComplement = arguments[2].getBool(); - auto path = *getObject(); - auto mode = isComplement ? SkTrimPathEffect::Mode::kInverted - : SkTrimPathEffect::Mode::kNormal; - auto pe = SkTrimPathEffect::Make(start, end, mode); - if (!pe) { - // SkDebugf("Invalid args to trim(): startT and stopT must be in - // [0,1]\n"); - return jsi::Value::null(); - } - SkStrokeRec rec(SkStrokeRec::InitStyle::kHairline_InitStyle); - if (pe->filterPath(&path, path, &rec, nullptr)) { - getObject()->swap(path); - return thisValue.getObject(runtime); - } - SkDebugf("Could not trim path\n"); - return jsi::Value::null(); - } - - JSI_HOST_FUNCTION(getPoint) { - auto index = arguments[0].asNumber(); - auto point = getObject()->getPoint(index); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), point)); - } - - JSI_HOST_FUNCTION(toSVGString) { - SkPath path = *getObject(); - SkString s; - SkParsePath::ToSVGString(path, &s); - return jsi::String::createFromUtf8(runtime, s.c_str()); - } - - JSI_HOST_FUNCTION(makeAsWinding) { - SkPath out; - if (AsWinding(*getObject(), &out)) { - getObject()->swap(out); - return thisValue.getObject(runtime); - } - return jsi::Value::null(); - } - - JSI_HOST_FUNCTION(isEmpty) { return jsi::Value(getObject()->isEmpty()); } - - JSI_HOST_FUNCTION(offset) { - SkScalar dx = arguments[0].asNumber(); - SkScalar dy = arguments[1].asNumber(); - getObject()->offset(dx, dy); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(moveTo) { - SkScalar x = arguments[0].asNumber(); - SkScalar y = arguments[1].asNumber(); - getObject()->moveTo(x, y); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(rMoveTo) { - SkScalar x = arguments[0].asNumber(); - SkScalar y = arguments[1].asNumber(); - getObject()->rMoveTo(x, y); - return thisValue.getObject(runtime); - } - JSI_HOST_FUNCTION(lineTo) { - SkScalar x = arguments[0].asNumber(); - SkScalar y = arguments[1].asNumber(); - getObject()->lineTo(x, y); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(rlineTo) { - SkScalar x = arguments[0].asNumber(); - SkScalar y = arguments[1].asNumber(); - getObject()->rLineTo(x, y); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(cubicTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - auto x3 = arguments[4].asNumber(); - auto y3 = arguments[5].asNumber(); - getObject()->cubicTo(x1, y1, x2, y2, x3, y3); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(rCubicTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - auto x3 = arguments[4].asNumber(); - auto y3 = arguments[5].asNumber(); - getObject()->rCubicTo(x1, y1, x2, y2, x3, y3); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(reset) { - getObject()->reset(); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(rewind) { - getObject()->rewind(); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(quadTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - getObject()->quadTo(x1, y1, x2, y2); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(rQuadTo) { - auto x1 = arguments[0].asNumber(); - auto y1 = arguments[1].asNumber(); - auto x2 = arguments[2].asNumber(); - auto y2 = arguments[3].asNumber(); - getObject()->rQuadTo(x1, y1, x2, y2); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(addCircle) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - auto r = arguments[2].asNumber(); - getObject()->addCircle(x, y, r); - return thisValue.getObject(runtime); - } - - JSI_HOST_FUNCTION(getLastPt) { - SkPoint last; - getObject()->getLastPt(&last); - auto point = jsi::Object(runtime); - point.setProperty(runtime, "x", static_cast(last.fX)); - point.setProperty(runtime, "y", static_cast(last.fY)); - return point; - } - - JSI_HOST_FUNCTION(close) { - getObject()->close(); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(simplify) { - SkPath result; - if (Simplify(*getObject(), &result)) { - getObject()->swap(result); - return jsi::Value(true); - } - return jsi::Value(false); - } - - JSI_HOST_FUNCTION(countPoints) { - auto points = getObject()->countPoints(); - return jsi::Value(points); - } - - JSI_HOST_FUNCTION(copy) { - const auto* path = getObject().get(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), SkPath(*path))); - } - - JSI_HOST_FUNCTION(op) { - auto path2 = JsiSkPath::fromValue(runtime, arguments[0]); - int pathOp = arguments[1].asNumber(); - SkPath result; - if (Op(*getObject(), *path2, SkPathOp(pathOp), &result)) { - getObject()->swap(result); - return jsi::Value(true); - } - return jsi::Value(false); - } - - JSI_HOST_FUNCTION(isInterpolatable) { - auto path2 = JsiSkPath::fromValue(runtime, arguments[0]); - return getObject()->isInterpolatable(*path2); - } - - JSI_HOST_FUNCTION(interpolate) { - auto path2 = JsiSkPath::fromValue(runtime, arguments[0]); - auto weight = arguments[1].asNumber(); - SkPath result; - auto succeed = getObject()->interpolate(*path2, weight, &result); - if (!succeed) { - return nullptr; - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(result))); - } - - JSI_HOST_FUNCTION(toCmds) { - auto path = *getObject(); - auto cmds = jsi::Array(runtime, path.countVerbs()); - auto it = SkPath::Iter(path, false); - // { "Move", "Line", "Quad", "Conic", "Cubic", "Close", "Done" }; - const int pointCount[] = { 1 , 1 , 2 , 2 , 3 , 0 , 0 }; - const int cmdCount[] = { 3 , 3 , 5 , 6 , 7 , 1 , 0 }; - SkPoint points[4]; - SkPath::Verb verb; - auto k = 0; - while (SkPath::kDone_Verb != (verb = it.next(points))) { - auto verbVal = static_cast(verb); - auto cmd = jsi::Array(runtime, cmdCount[verbVal]); - auto j = 0; - cmd.setValueAtIndex(runtime, j++, jsi::Value(verbVal)); - for (int i = 0; i < pointCount[verbVal]; ++i) { - cmd.setValueAtIndex(runtime, j++, jsi::Value(static_cast(points[1 + i].fX))); - cmd.setValueAtIndex(runtime, j++, jsi::Value(static_cast(points[1 + i].fY))); - } - if (SkPath::kConic_Verb == verb) { - cmd.setValueAtIndex(runtime, j, jsi::Value(static_cast(it.conicWeight()))); - } - cmds.setValueAtIndex(runtime, k++, cmd); - } - return cmds; - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkPath, __typename__)) - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkPath, addArc), - JSI_EXPORT_FUNC(JsiSkPath, addOval), - JSI_EXPORT_FUNC(JsiSkPath, addPoly), - JSI_EXPORT_FUNC(JsiSkPath, addRect), - JSI_EXPORT_FUNC(JsiSkPath, addRRect), - JSI_EXPORT_FUNC(JsiSkPath, arcToOval), - JSI_EXPORT_FUNC(JsiSkPath, arcToRotated), - JSI_EXPORT_FUNC(JsiSkPath, rArcTo), - JSI_EXPORT_FUNC(JsiSkPath, arcToTangent), - JSI_EXPORT_FUNC(JsiSkPath, computeTightBounds), - JSI_EXPORT_FUNC(JsiSkPath, getBounds), - JSI_EXPORT_FUNC(JsiSkPath, conicTo), - JSI_EXPORT_FUNC(JsiSkPath, rConicTo), - JSI_EXPORT_FUNC(JsiSkPath, contains), - JSI_EXPORT_FUNC(JsiSkPath, dash), - JSI_EXPORT_FUNC(JsiSkPath, equals), - JSI_EXPORT_FUNC(JsiSkPath, getFillType), - JSI_EXPORT_FUNC(JsiSkPath, setFillType), - JSI_EXPORT_FUNC(JsiSkPath, setIsVolatile), - JSI_EXPORT_FUNC(JsiSkPath, isVolatile), - JSI_EXPORT_FUNC(JsiSkPath, transform), - JSI_EXPORT_FUNC(JsiSkPath, stroke), - JSI_EXPORT_FUNC(JsiSkPath, trim), - JSI_EXPORT_FUNC(JsiSkPath, getPoint), - JSI_EXPORT_FUNC(JsiSkPath, toSVGString), - JSI_EXPORT_FUNC(JsiSkPath, makeAsWinding), - JSI_EXPORT_FUNC(JsiSkPath, isEmpty), - JSI_EXPORT_FUNC(JsiSkPath, offset), - JSI_EXPORT_FUNC(JsiSkPath, moveTo), - JSI_EXPORT_FUNC(JsiSkPath, rMoveTo), - JSI_EXPORT_FUNC(JsiSkPath, lineTo), - JSI_EXPORT_FUNC(JsiSkPath, rlineTo), - JSI_EXPORT_FUNC(JsiSkPath, cubicTo), - JSI_EXPORT_FUNC(JsiSkPath, rCubicTo), - JSI_EXPORT_FUNC(JsiSkPath, reset), - JSI_EXPORT_FUNC(JsiSkPath, rewind), - JSI_EXPORT_FUNC(JsiSkPath, quadTo), - JSI_EXPORT_FUNC(JsiSkPath, rQuadTo), - JSI_EXPORT_FUNC(JsiSkPath, addCircle), - JSI_EXPORT_FUNC(JsiSkPath, getLastPt), - JSI_EXPORT_FUNC(JsiSkPath, close), - JSI_EXPORT_FUNC(JsiSkPath, simplify), - JSI_EXPORT_FUNC(JsiSkPath, countPoints), - JSI_EXPORT_FUNC(JsiSkPath, copy), - JSI_EXPORT_FUNC(JsiSkPath, op), - JSI_EXPORT_FUNC(JsiSkPath, isInterpolatable), - JSI_EXPORT_FUNC(JsiSkPath, interpolate), - JSI_EXPORT_FUNC(JsiSkPath, toCmds), - ) - - JsiSkPath(std::shared_ptr context, SkPath path) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(std::move(path))) { - } - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkPath &path) { - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(std::move(context), path) - ); - } - - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - SkPath&& path) { - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(std::move(context), std::move(path)) - ); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffect.h deleted file mode 100644 index 6869ee572948a4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffect.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPathEffect : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkPathEffect(std::shared_ptr context, - sk_sp pathEffect) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(pathEffect)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "PathEffect"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkPathEffect, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffectFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffectFactory.h deleted file mode 100644 index 1e621402dd8519..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathEffectFactory.h +++ /dev/null @@ -1,123 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkPathEffect.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include -#include "include/effects/Sk1DPathEffect.h" -#include "include/effects/Sk2DPathEffect.h" - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPathEffectFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakeCorner) { - int radius = arguments[0].asNumber(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkCornerPathEffect::Make(radius))); - } - - JSI_HOST_FUNCTION(MakeDash) { - auto jsiIntervals = arguments[0].asObject(runtime).asArray(runtime); - auto size = (int)jsiIntervals.size(runtime); - std::vector intervals; - intervals.reserve(size); - for (int i = 0; i < size; i++) { - SkScalar interval = jsiIntervals.getValueAtIndex(runtime, i).asNumber(); - intervals.push_back(interval); - } - int phase = count >= 2 && !arguments[1].isUndefined() && !arguments[1].isNull() ? arguments[1].asNumber() : 0; - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), - SkDashPathEffect::Make(intervals.data(), size, phase))); - } - - JSI_HOST_FUNCTION(MakeDiscrete) { - int segLength = arguments[0].asNumber(); - int dec = arguments[1].asNumber(); - int seedAssist = arguments[2].asNumber(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), - SkDiscretePathEffect::Make(segLength, dec, seedAssist))); - } - - JSI_HOST_FUNCTION(MakeCompose) { - auto outer = JsiSkPathEffect::fromValue(runtime, arguments[0]); - auto inner = JsiSkPathEffect::fromValue(runtime, arguments[1]); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkPathEffect::MakeCompose(std::move(outer), std::move(inner)))); - } - - JSI_HOST_FUNCTION(MakeSum) { - auto outer = JsiSkPathEffect::fromValue(runtime, arguments[0]); - auto inner = JsiSkPathEffect::fromValue(runtime, arguments[1]); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkPathEffect::MakeSum(std::move(outer), std::move(inner)))); - } - - JSI_HOST_FUNCTION(MakePath1D) { - auto path = JsiSkPath::fromValue(runtime, arguments[0]); - auto advance = arguments[1].asNumber(); - auto phase = arguments[2].asNumber(); - auto style = static_cast(arguments[3].asNumber()); - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkPath1DPathEffect::Make(*path, advance, phase, style))); - } - - JSI_HOST_FUNCTION(MakePath2D) { - auto matrix = JsiSkMatrix::fromValue(runtime, arguments[0]); - auto path = JsiSkPath::fromValue(runtime, arguments[1]); - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkPath2DPathEffect::Make(*matrix, *path))); - } - - JSI_HOST_FUNCTION(MakeLine2D) { - auto width = arguments[0].asNumber(); - auto matrix = JsiSkMatrix::fromValue(runtime, arguments[1]); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared( - getContext(), SkLine2DPathEffect::Make(width, *matrix))); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeCorner), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeDash), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeDiscrete), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeCompose), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeSum), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakeLine2D), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakePath1D), - JSI_EXPORT_FUNC(JsiSkPathEffectFactory, MakePath2D), - ) - - JsiSkPathEffectFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathFactory.h deleted file mode 100644 index e2df159a979d4c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPathFactory.h +++ /dev/null @@ -1,172 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkPathEffect.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPathFactory : public JsiSkHostObject { - - static const int MOVE = 0; - static const int LINE = 1; - static const int QUAD = 2; - static const int CONIC = 3; - static const int CUBIC = 4; - static const int CLOSE = 5; - -public: - JSI_HOST_FUNCTION(Make) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), SkPath())); - } - - JSI_HOST_FUNCTION(MakeFromSVGString) { - auto svgString = arguments[0].asString(runtime).utf8(runtime); - SkPath result; - - if (!SkParsePath::FromSVGString(svgString.c_str(), &result)) { - jsi::detail::throwJSError(runtime, "Could not parse Svg path"); - return jsi::Value(nullptr); - } - - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(result))); - } - - JSI_HOST_FUNCTION(MakeFromOp) { - SkPath one = *JsiSkPath::fromValue(runtime, arguments[0]).get(); - SkPath two = *JsiSkPath::fromValue(runtime, arguments[1]).get(); - SkPathOp op = (SkPathOp)arguments[2].asNumber(); - SkPath result; - bool success = Op(one, two, op, &result); - if (!success) { - return jsi::Value(nullptr); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(result))); - } - - JSI_HOST_FUNCTION(MakeFromCmds) { - SkPath path; - auto cmds = arguments[0].asObject(runtime).asArray(runtime); - auto cmdCount = cmds.size(runtime); - for (int i = 0; i < cmdCount; i++) { - auto cmd = cmds.getValueAtIndex(runtime, i).asObject(runtime).asArray(runtime); - if (cmd.size(runtime) < 1) { - ABI46_0_0RNSkLogger::logToConsole("Invalid command found (got an empty array)"); - return jsi::Value::null(); - } - auto verb = static_cast(cmd.getValueAtIndex(runtime, 0).asNumber()); - switch (verb) { - case MOVE: { - if (cmd.size(runtime) < 3) { - ABI46_0_0RNSkLogger::logToConsole( "Invalid move command found"); - return jsi::Value::null(); - } - auto x = cmd.getValueAtIndex(runtime, 1).asNumber(); - auto y = cmd.getValueAtIndex(runtime, 2).asNumber(); - path.moveTo(x, y); - break; - } - case LINE: { - if (cmd.size(runtime) < 3) { - ABI46_0_0RNSkLogger::logToConsole("Invalid line command found"); - return jsi::Value::null(); - } - auto x = cmd.getValueAtIndex(runtime, 1).asNumber(); - auto y = cmd.getValueAtIndex(runtime, 2).asNumber(); - path.lineTo(x, y); - break; - } - case QUAD: { - if (cmd.size(runtime) < 5) { - ABI46_0_0RNSkLogger::logToConsole("Invalid line command found"); - return jsi::Value::null(); - } - auto x1 = cmd.getValueAtIndex(runtime, 1).asNumber(); - auto y1 = cmd.getValueAtIndex(runtime, 2).asNumber(); - auto x2 = cmd.getValueAtIndex(runtime, 3).asNumber(); - auto y2 = cmd.getValueAtIndex(runtime, 4).asNumber(); - path.quadTo(x1, y1, x2, y2); - break; - } - case CONIC: { - if (cmd.size(runtime) < 6) { - ABI46_0_0RNSkLogger::logToConsole("Invalid line command found"); - return jsi::Value::null(); - } - auto x1 = cmd.getValueAtIndex(runtime, 1).asNumber(); - auto y1 = cmd.getValueAtIndex(runtime, 2).asNumber(); - auto x2 = cmd.getValueAtIndex(runtime, 3).asNumber(); - auto y2 = cmd.getValueAtIndex(runtime, 4).asNumber(); - auto w = cmd.getValueAtIndex(runtime, 5).asNumber(); - path.conicTo(x1, y1, x2, y2, w); - break; - } - case CUBIC: { - if (cmd.size(runtime) < 7) { - ABI46_0_0RNSkLogger::logToConsole("Invalid line command found"); - return jsi::Value::null(); - } - auto x1 = cmd.getValueAtIndex(runtime, 1).asNumber(); - auto y1 = cmd.getValueAtIndex(runtime, 2).asNumber(); - auto x2 = cmd.getValueAtIndex(runtime, 3).asNumber(); - auto y2 = cmd.getValueAtIndex(runtime, 4).asNumber(); - auto x3 = cmd.getValueAtIndex(runtime, 5).asNumber(); - auto y3 = cmd.getValueAtIndex(runtime, 6).asNumber(); - path.cubicTo(x1, y1, x2, y2, x3, y3); - break; - } - case CLOSE: { - path.close(); - break; - } - default: { - ABI46_0_0RNSkLogger::logToConsole("Found an unknown command"); - return jsi::Value::null(); - } - } - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(path))); - } - - JSI_HOST_FUNCTION(MakeFromText) { - auto text = arguments[0].asString(runtime).utf8(runtime); - auto x = arguments[1].asNumber(); - auto y = arguments[2].asNumber(); - auto font = JsiSkFont::fromValue(runtime, arguments[3]); - SkPath path; - SkTextUtils::GetPath(text.c_str(), strlen(text.c_str()), - SkTextEncoding::kUTF8, x, y, *font, &path); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(path)));; - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPathFactory, Make), - JSI_EXPORT_FUNC(JsiSkPathFactory, MakeFromSVGString), - JSI_EXPORT_FUNC(JsiSkPathFactory, MakeFromOp), - JSI_EXPORT_FUNC(JsiSkPathFactory, MakeFromCmds), - JSI_EXPORT_FUNC(JsiSkPathFactory, MakeFromText)) - - JsiSkPathFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPicture.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPicture.h deleted file mode 100644 index 094378e1ed91c8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPicture.h +++ /dev/null @@ -1,71 +0,0 @@ - -#pragma once - -#include "JsiSkHostObjects.h" -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPicture : public JsiSkWrappingSkPtrHostObject { -public: - - JsiSkPicture(std::shared_ptr context, const sk_sp picture) - : JsiSkWrappingSkPtrHostObject(context, picture) {}; - - JSI_HOST_FUNCTION(makeShader) { - auto tmx = (SkTileMode)arguments[0].asNumber(); - auto tmy = (SkTileMode)arguments[1].asNumber(); - auto fm = (SkFilterMode)arguments[2].asNumber(); - auto m = count > 3 && !arguments[3].isUndefined() ? - JsiSkMatrix::fromValue(runtime, arguments[3]).get() : nullptr; - - auto tr = count > 4 && !arguments[4].isUndefined() ? - JsiSkRect::fromValue(runtime, arguments[4]).get() : nullptr; - - // Create shader - auto shader = getObject()->makeShader(tmx, tmy, fm, m, tr); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), shader)); - } - - JSI_HOST_FUNCTION(serialize) { - auto data = getObject()->serialize(); - auto arrayCtor = runtime.global().getPropertyAsFunction(runtime, "Uint8Array"); - size_t size = data->size(); - - jsi::Object array = arrayCtor.callAsConstructor(runtime, static_cast(size)).getObject(runtime); - jsi::ArrayBuffer buffer = array - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - - auto bfrPtr = reinterpret_cast(buffer.data(runtime)); - memcpy(bfrPtr, data->bytes(), size); - return array; - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPicture, makeShader), - JSI_EXPORT_FUNC(JsiSkPicture, serialize)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - .get() - ->getObject(); - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureFactory.h deleted file mode 100644 index d4788da6020ae1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureFactory.h +++ /dev/null @@ -1,50 +0,0 @@ - -#pragma once - -#include "JsiSkColorFilter.h" -#include "JsiSkHostObjects.h" -#include "JsiSkData.h" -#include "JsiSkPicture.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPictureFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakePicture) { - if(!arguments[0].isObject()) { - jsi::detail::throwJSError(runtime, "Expected arraybuffer as first parameter"); - } - auto array = arguments[0].asObject(runtime); - jsi::ArrayBuffer buffer = array - .getProperty(runtime, jsi::PropNameID::forAscii(runtime, "buffer")) - .asObject(runtime) - .getArrayBuffer(runtime); - - sk_sp data = SkData::MakeWithCopy(buffer.data(runtime), buffer.size(runtime)); - auto picture = SkPicture::MakeFromData(data.get()); - if(picture != nullptr) { - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), picture)); - } else { - return jsi::Value::undefined(); - } - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureFactory, MakePicture)) - - JsiSkPictureFactory(std::shared_ptr context) - : JsiSkHostObject(context) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureRecorder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureRecorder.h deleted file mode 100644 index 2cb2a2bb4dd845..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPictureRecorder.h +++ /dev/null @@ -1,53 +0,0 @@ - -#pragma once - -#include "JsiSkHostObjects.h" -#include "JsiSkRect.h" -#include "JsiSkPicture.h" -#include "JsiSkCanvas.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPictureRecorder : public JsiSkWrappingSharedPtrHostObject { -public: - - JsiSkPictureRecorder(std::shared_ptr context) - : JsiSkWrappingSharedPtrHostObject( - context, std::make_shared()){}; - - JSI_HOST_FUNCTION(beginRecording) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]); - SkRTreeFactory factory; - auto canvas = getObject()->beginRecording(*rect, &factory); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), canvas)); - } - - JSI_HOST_FUNCTION(finishRecordingAsPicture) { - auto picture = getObject()->finishRecordingAsPicture(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), picture)); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkPictureRecorder, beginRecording), - JSI_EXPORT_FUNC(JsiSkPictureRecorder, finishRecordingAsPicture)) - - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(context)); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPoint.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPoint.h deleted file mode 100644 index df8d24fc003a72..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkPoint.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkPoint : public JsiSkWrappingSharedPtrHostObject { -public: - - JSI_PROPERTY_GET(x) { return static_cast(getObject()->x()); } - - JSI_PROPERTY_GET(y) { return static_cast(getObject()->y()); } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkPoint, x), - JSI_EXPORT_PROP_GET(JsiSkPoint, y)) - - JsiSkPoint(std::shared_ptr context, const SkPoint &point) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(point)){} - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return object - .asHostObject(runtime) - ->getObject(); - } else { - auto x = object.getProperty(runtime, "x").asNumber(); - auto y = object.getProperty(runtime, "y").asNumber(); - return std::make_shared(SkPoint::Make(x, y)); - } - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkPoint &point) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), point)); - } - - /** - * Creates the function for construction a new instance of the SkPoint - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkPoint - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - auto point = - SkPoint::Make(arguments[0].asNumber(), arguments[1].asNumber()); - - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(point))); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRRect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRRect.h deleted file mode 100644 index 2b4b7a240d546a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRRect.h +++ /dev/null @@ -1,93 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkRRect : public JsiSkWrappingSharedPtrHostObject { -public: - JSI_PROPERTY_GET(rx) { - return static_cast(getObject()->getSimpleRadii().x()); - } - JSI_PROPERTY_GET(ry) { - return static_cast(getObject()->getSimpleRadii().y()); - } - JSI_PROPERTY_GET(rect) { - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), getObject()->getBounds())); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkRRect, rx), - JSI_EXPORT_PROP_GET(JsiSkRRect, ry), - JSI_EXPORT_PROP_GET(JsiSkRRect, rect)) - - JsiSkRRect(std::shared_ptr context, const SkRRect &rect) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(rect)){} - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } else { - auto rect = JsiSkRect::fromValue(runtime, object.getProperty(runtime, "rect")); - auto rx = object.getProperty(runtime, "rx").asNumber(); - auto ry = object.getProperty(runtime, "ry").asNumber(); - return std::make_shared(SkRRect::MakeRectXY(*rect, rx, ry)); - } - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkRRect &rect) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), rect)); - } - - /** - * Creates the function for construction a new instance of the SkRect - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkRect - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - // Set up the rect - auto rect = JsiSkRect::fromValue(runtime, arguments[0]).get(); - auto rx = arguments[1].asNumber(); - auto ry = arguments[2].asNumber(); - auto rrect = SkRRect::MakeRectXY(*rect, rx, ry); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(rrect))); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRSXform.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRSXform.h deleted file mode 100644 index 2e5b0c896eb576..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRSXform.h +++ /dev/null @@ -1,105 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkRSXform : public JsiSkWrappingSharedPtrHostObject { - public: - JsiSkRSXform(std::shared_ptr context, const SkRSXform &rsxform) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(rsxform)){} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "RSXform"); - } - - JSI_PROPERTY_GET(scos) { - return jsi::Value(SkScalarToDouble(getObject()->fSCos)); - } - JSI_PROPERTY_GET(ssin) { - return jsi::Value(SkScalarToDouble(getObject()->fSSin)); - } - JSI_PROPERTY_GET(tx) { - return jsi::Value(SkScalarToDouble(getObject()->fTx)); - } - JSI_PROPERTY_GET(ty) { - return jsi::Value(SkScalarToDouble(getObject()->fTy)); - } - - JSI_EXPORT_PROPERTY_GETTERS( - JSI_EXPORT_PROP_GET(JsiSkRSXform, __typename__), - JSI_EXPORT_PROP_GET(JsiSkRSXform, scos), - JSI_EXPORT_PROP_GET(JsiSkRSXform, ssin), - JSI_EXPORT_PROP_GET(JsiSkRSXform, tx), - JSI_EXPORT_PROP_GET(JsiSkRSXform, ty), - ) - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return object - .asHostObject(runtime) - ->getObject(); - } else { - auto scos = object.getArray(runtime).getValueAtIndex(runtime, 0).asNumber(); - auto ssin = object.getArray(runtime).getValueAtIndex(runtime, 1).asNumber(); - auto tx = object.getArray(runtime).getValueAtIndex(runtime, 2).asNumber(); - auto ty = object.getArray(runtime).getValueAtIndex(runtime, 3).asNumber(); - return std::make_shared(SkRSXform::Make(scos, ssin, tx, ty)); - } - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkRSXform &rsxform) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), rsxform)); - } - - /** - * Creates the function for construction a new instance of the SkRSXform - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkRSXform - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - auto rsxform = SkRSXform::Make( - arguments[0].asNumber(), - arguments[1].asNumber(), - arguments[2].asNumber(), - arguments[3].asNumber() - ); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(rsxform))); - }; - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRect.h deleted file mode 100644 index 6f4190c0969116..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRect.h +++ /dev/null @@ -1,119 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkRect : public JsiSkWrappingSharedPtrHostObject { -public: - JSI_PROPERTY_GET(x) { return static_cast(getObject()->x()); } - JSI_PROPERTY_GET(y) { return static_cast(getObject()->y()); } - JSI_PROPERTY_GET(width) { return static_cast(getObject()->width()); } - JSI_PROPERTY_GET(height) { - return static_cast(getObject()->height()); - } - JSI_PROPERTY_GET(left) { return static_cast(getObject()->left()); } - JSI_PROPERTY_GET(top) { return static_cast(getObject()->top()); } - JSI_PROPERTY_GET(right) { return static_cast(getObject()->right()); } - JSI_PROPERTY_GET(bottom) { - return static_cast(getObject()->bottom()); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkRect, x), - JSI_EXPORT_PROP_GET(JsiSkRect, y), - JSI_EXPORT_PROP_GET(JsiSkRect, width), - JSI_EXPORT_PROP_GET(JsiSkRect, height)) - - JSI_HOST_FUNCTION(setXYWH) { - getObject()->setXYWH(arguments[0].asNumber(), arguments[1].asNumber(), - arguments[2].asNumber(), arguments[3].asNumber()); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setLTRB) { - getObject()->setLTRB(arguments[0].asNumber(), arguments[1].asNumber(), - arguments[2].asNumber(), arguments[3].asNumber()); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkRect, setXYWH), - JSI_EXPORT_FUNC(JsiSkRect, setLTRB), ) - - /** - Constructor - */ - JsiSkRect(std::shared_ptr context, const SkRect &rect) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(rect)){} - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - if (object.isHostObject(runtime)) { - return object - .asHostObject(runtime) - ->getObject(); - } else { - auto x = object.getProperty(runtime, "x").asNumber(); - auto y = object.getProperty(runtime, "y").asNumber(); - auto width = object.getProperty(runtime, "width").asNumber(); - auto height = object.getProperty(runtime, "height").asNumber(); - return std::make_shared(SkRect::MakeXYWH(x, y, width, height)); - } - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkRect &rect) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), rect)); - } - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - SkRect&& rect) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(rect))); - } - - /** - * Creates the function for construction a new instance of the SkRect - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkRect - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - // Set up the rect - SkRect rect = - SkRect::MakeXYWH(arguments[0].asNumber(), arguments[1].asNumber(), - arguments[2].asNumber(), arguments[3].asNumber()); - - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(rect))); - }; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffect.h deleted file mode 100644 index f3fb26a5728842..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffect.h +++ /dev/null @@ -1,222 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia -{ - - using namespace ABI46_0_0facebook; - - struct RuntimeEffectUniform - { - int columns; - int rows; - int slot; // the index into the uniforms array that this uniform begins. - bool isInteger; - }; - - class JsiSkRuntimeEffect - : public JsiSkWrappingSkPtrHostObject - { - public: - - static sk_sp fromValue(jsi::Runtime &runtime, const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - return object.asHostObject(runtime)->getObject(); - } - - JSI_HOST_FUNCTION(makeShader) - { - auto uniforms = castUniforms(runtime, arguments[0]); - - auto matrix = count >= 2 && !arguments[1].isUndefined() && !arguments[1].isNull() ? JsiSkMatrix::fromValue(runtime, arguments[1]).get() : nullptr; - - // Create and return shader as host object - auto shader = getObject()->makeShader(std::move(uniforms), nullptr, 0, matrix); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(shader))); - } - - JSI_HOST_FUNCTION(makeShaderWithChildren) - { - auto uniforms = castUniforms(runtime, arguments[0]); - - // Children - std::vector> children; - auto jsiChildren = arguments[1].asObject(runtime).asArray(runtime); - auto jsiChildCount = jsiChildren.size(runtime); - children.reserve(jsiChildCount); - for (int i = 0; i < jsiChildCount; i++) - { - auto shader = jsiChildren.getValueAtIndex(runtime, i) - .asObject(runtime) - .asHostObject(runtime) - ->getObject(); - children.push_back(shader); - } - - auto matrix = count >= 3 && !arguments[2].isUndefined() && !arguments[2].isNull() ? JsiSkMatrix::fromValue(runtime, arguments[2]).get() : nullptr; - - // Create and return shader as host object - auto shader = getObject()->makeShader(std::move(uniforms), children.data(), - children.size(), matrix); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(shader))); - } - - JSI_HOST_FUNCTION(getUniformCount) - { - return static_cast(getObject()->uniforms().size()); - } - - JSI_HOST_FUNCTION(getUniformFloatCount) - { - return static_cast(getObject()->uniformSize() / sizeof(float)); - } - - JSI_HOST_FUNCTION(getUniformName) - { - auto i = static_cast(arguments[0].asNumber()); - if (i < 0 || i >= getObject()->uniforms().size()) { - jsi::detail::throwJSError(runtime, "invalid uniform index"); - } - auto it = getObject()->uniforms().begin() + i; - return jsi::String::createFromAscii(runtime, std::string(it->name)); - } - - JSI_HOST_FUNCTION(getUniform) - { - auto i = static_cast(arguments[0].asNumber()); - if (i < 0 || i >= getObject()->uniforms().size()) { - jsi::detail::throwJSError(runtime, "invalid uniform index"); - } - auto it = getObject()->uniforms().begin() + i; - auto result = jsi::Object(runtime); - RuntimeEffectUniform su = fromUniform(*it); - result.setProperty(runtime, "columns", su.columns); - result.setProperty(runtime, "rows", su.rows); - result.setProperty(runtime, "slot", su.slot); - result.setProperty(runtime, "isInteger", su.isInteger); - return result; - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkRuntimeEffect, makeShader), - JSI_EXPORT_FUNC(JsiSkRuntimeEffect, - makeShaderWithChildren), - JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniformCount), - JSI_EXPORT_FUNC(JsiSkRuntimeEffect, - getUniformFloatCount), - JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniformName), - JSI_EXPORT_FUNC(JsiSkRuntimeEffect, getUniform)) - - JsiSkRuntimeEffect(std::shared_ptr context, - sk_sp rt) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(rt)){} - - private: - sk_sp castUniforms(jsi::Runtime &runtime, const jsi::Value &value) - { - auto jsiUniforms = value.asObject(runtime).asArray(runtime); - auto jsiUniformsSize = jsiUniforms.size(runtime); - - // verify size of input uniforms - if (jsiUniformsSize * sizeof(float) != getObject()->uniformSize()) - { - std::string msg = "Uniforms size differs from effect's uniform size. Received " + - std::to_string(jsiUniformsSize) + - " expected " + - std::to_string(getObject()->uniformSize() / sizeof(float)); - jsi::detail::throwJSError(runtime, msg.c_str()); - } - - auto uniforms = SkData::MakeUninitialized(getObject()->uniformSize()); - - // Convert to skia uniforms - const auto& u = getObject()->uniforms(); - for (std::size_t i = 0; i < u.size(); i++) - { - auto it = getObject()->uniforms().begin() + i; - RuntimeEffectUniform reu = fromUniform(*it); - for (std::size_t j = 0; j < reu.columns * reu.rows; ++j) { - const std::size_t offset = reu.slot + j; - float fValue = jsiUniforms.getValueAtIndex(runtime, offset).asNumber(); - int iValue = static_cast(fValue); - auto value = reu.isInteger ? iValue : fValue; - memcpy(SkTAddOffset(uniforms->writable_data(), offset * sizeof(value)), &value, sizeof(value)); - } - } - return uniforms; - } - - RuntimeEffectUniform fromUniform(const SkRuntimeEffect::Uniform &u) - { - RuntimeEffectUniform su; - su.rows = u.count; // arrayLength - su.columns = 1; - su.isInteger = false; - using Type = SkRuntimeEffect::Uniform::Type; - switch (u.type) - { - case Type::kFloat: - break; - case Type::kFloat2: - su.columns = 2; - break; - case Type::kFloat3: - su.columns = 3; - break; - case Type::kFloat4: - su.columns = 4; - break; - case Type::kFloat2x2: - su.columns = 2; - su.rows *= 2; - break; - case Type::kFloat3x3: - su.columns = 3; - su.rows *= 3; - break; - case Type::kFloat4x4: - su.columns = 4; - su.rows *= 4; - break; - case Type::kInt: - su.isInteger = true; - break; - case Type::kInt2: - su.columns = 2; - su.isInteger = true; - break; - case Type::kInt3: - su.columns = 3; - su.isInteger = true; - break; - case Type::kInt4: - su.columns = 4; - su.isInteger = true; - break; - } - su.slot = (int)(u.offset / sizeof(float)); - return su; - } - - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffectFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffectFactory.h deleted file mode 100644 index 61c183453e9cce..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeEffectFactory.h +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include "JsiSkRuntimeEffect.h" -#include "JsiSkHostObjects.h" - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkRuntimeEffectFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(Make) { - auto sksl = arguments[0].asString(runtime).utf8(runtime); - auto result = SkRuntimeEffect::MakeForShader(SkString(sksl)); - auto effect = result.effect; - auto errorText = result.errorText; - if (!effect) { - jsi::detail::throwJSError( - runtime, - std::string("Error in sksl:\n" + std::string(errorText.c_str())) - .c_str()); - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(effect))); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkRuntimeEffectFactory, Make) - ) - - JsiSkRuntimeEffectFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeShaderBuilder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeShaderBuilder.h deleted file mode 100644 index b27e3d76c26504..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkRuntimeShaderBuilder.h +++ /dev/null @@ -1,88 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include "JsiSkRuntimeEffect.h" -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkRuntimeShaderBuilder : public JsiSkWrappingSharedPtrHostObject { - public: - - /** - Constructor - */ - JsiSkRuntimeShaderBuilder(std::shared_ptr context, const SkRuntimeShaderBuilder &rt) - : JsiSkWrappingSharedPtrHostObject( - std::move(context), std::make_shared(rt)){} - - JSI_HOST_FUNCTION(setUniform) { - auto name = arguments[0].asString(runtime).utf8(runtime); - auto jsiValue = arguments[1].asObject(runtime).asArray(runtime); - auto size = jsiValue.size(runtime); - std::vector value; - value.reserve(size); - for (int i = 0; i < size; i++) { - auto e = jsiValue.getValueAtIndex(runtime, i).asNumber(); - value.push_back(e); - } - getObject()->uniform(name.c_str()).set(value.data(), static_cast(size)); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkRuntimeShaderBuilder, setUniform) - ) - - /** - Returns the underlying object from a host object of this type - */ - static std::shared_ptr fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - const auto& object = obj.asObject(runtime); - return object.asHostObject(runtime)->getObject(); - - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - const SkRuntimeShaderBuilder &rt) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), rt)); - } - - /** - * Creates the function for construction a new instance of the SkRect - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkRect - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - auto rt = JsiSkRuntimeEffect::fromValue(runtime, arguments[0]); - auto rtb = SkRuntimeShaderBuilder(rt); - // Return the newly constructed object - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(rtb))); - }; - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVG.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVG.h deleted file mode 100644 index 2d333b4e427596..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVG.h +++ /dev/null @@ -1,43 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkSVG : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkSVG(std::shared_ptr context, sk_sp svgdom) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(svgdom)){} - - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "SVG"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkSVG, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVGFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVGFactory.h deleted file mode 100644 index 8767bcb1001370..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSVGFactory.h +++ /dev/null @@ -1,48 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkTypeface.h" -#include "JsiSkHostObjects.h" -#include "JsiSkData.h" -#include "JsiSkSVG.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkSVGFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(MakeFromData) { - auto data = JsiSkData::fromValue(runtime, arguments[0]); - auto stream = SkMemoryStream::Make(data); - auto svg_dom = SkSVGDOM::Builder().make(*stream); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(svg_dom))); - } - - JSI_HOST_FUNCTION(MakeFromString) { - auto svgText = arguments[0].asString(runtime).utf8(runtime); - auto stream = SkMemoryStream::MakeDirect(svgText.c_str(), svgText.size()); - auto svg_dom = SkSVGDOM::Builder().make(*stream); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(svg_dom))); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkSVGFactory, MakeFromData), JSI_EXPORT_FUNC(JsiSkSVGFactory, MakeFromString)) - - JsiSkSVGFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShader.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShader.h deleted file mode 100644 index 8d3d7cb39dc4bb..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShader.h +++ /dev/null @@ -1,45 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkShader : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkShader(std::shared_ptr context, - sk_sp shader) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(shader)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Shader"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkShader, __typename__)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShaderFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShaderFactory.h deleted file mode 100644 index 1520674026be80..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkShaderFactory.h +++ /dev/null @@ -1,214 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include "JsiSkColorFilter.h" -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -int getFlag(const jsi::Value* values, int i, size_t size) { - if (i >= size || values[i].isUndefined()) { - return 0; - } - return values[i].asNumber(); -} - -SkMatrix* getLocalMatrix(jsi::Runtime &runtime, const jsi::Value* values, int i, size_t size) { - if (i >= size || values[i].isUndefined()) { - return nullptr; - } - return JsiSkMatrix::fromValue(runtime, values[i]).get(); -} - -SkTileMode getTileMode(const jsi::Value* values, int i, size_t size) { - if (i >= size || values[i].isUndefined()) { - return SkTileMode::kClamp; - } - return static_cast(values[i].asNumber()); -} - -std::vector getColors(jsi::Runtime &runtime, const jsi::Value& value) { - std::vector colors; - if (!value.isNull()) { - auto jsiColors = value.asObject(runtime).asArray(runtime); - auto size = jsiColors.size(runtime); - colors.reserve(size); - for (int i = 0; i < size; i++) { - SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i)); - colors.push_back(color); - } - } - return colors; -} - -std::vector getPositions(jsi::Runtime &runtime, const jsi::Value& value) { - std::vector positions; - if (!value.isNull()) { - auto jsiPositions = value.asObject(runtime).asArray(runtime); - auto size = jsiPositions.size(runtime); - positions.reserve(size); - for (int i = 0; i < size; i++) { - SkScalar position = jsiPositions.getValueAtIndex(runtime, i).asNumber(); - positions.push_back(position); - } - } - return positions; -} - -class JsiSkShaderFactory : public JsiSkHostObject { -public: - JSI_HOST_FUNCTION(MakeLinearGradient) { - auto p1 = - *JsiSkPoint::fromValue(runtime, arguments[0].asObject(runtime)).get(); - auto p2 = - *JsiSkPoint::fromValue(runtime, arguments[1].asObject(runtime)).get(); - SkPoint pts[] = {p1, p2}; - - std::vector colors = getColors(runtime, arguments[2]); - std::vector positions = getPositions(runtime, arguments[3]); - auto tileMode = getTileMode(arguments, 4, count); - auto flag = getFlag(arguments, 6, count); - auto localMatrix = getLocalMatrix(runtime, arguments, 5, count); - - sk_sp gradient = SkGradientShader::MakeLinear(pts, colors.data(), positions.data(), - static_cast(colors.size()), tileMode, flag, localMatrix); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeRadialGradient) { - auto center = - *JsiSkPoint::fromValue(runtime, arguments[0].asObject(runtime)).get(); - auto r = arguments[1].asNumber(); - - std::vector colors = getColors(runtime, arguments[2]); - std::vector positions = getPositions(runtime, arguments[3]); - auto tileMode = getTileMode(arguments, 4, count); - auto flag = getFlag(arguments, 6, count); - auto localMatrix = getLocalMatrix(runtime, arguments, 5, count); - - sk_sp gradient = SkGradientShader::MakeRadial(center, r, colors.data(), - positions.data(), static_cast(colors.size()), tileMode, - flag, localMatrix); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeSweepGradient) { - auto x = arguments[0].asNumber(); - auto y = arguments[1].asNumber(); - std::vector colors = getColors(runtime, arguments[2]); - std::vector positions = getPositions(runtime, arguments[3]); - auto tileMode = getTileMode(arguments, 4, count); - auto localMatrix = getLocalMatrix(runtime, arguments, 5, count); - auto flag = getFlag(arguments, 6, count); - auto startAngle = - (count < 8 || arguments[7].isUndefined()) ? 0 : arguments[7].asNumber(); - auto endAngle = (count < 9 || arguments[8].isUndefined()) - ? 360 - : arguments[8].asNumber(); - sk_sp gradient = SkGradientShader::MakeSweep( - x, y, colors.data(), positions.data(), static_cast(colors.size()), tileMode, startAngle, - endAngle, flag, localMatrix); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeTwoPointConicalGradient) { - auto start = - *JsiSkPoint::fromValue(runtime, arguments[0].asObject(runtime)).get(); - auto startRadius = arguments[1].asNumber(); - - auto end = - *JsiSkPoint::fromValue(runtime, arguments[2].asObject(runtime)).get(); - auto endRadius = arguments[3].asNumber(); - - std::vector colors = getColors(runtime, arguments[4]); - std::vector positions = getPositions(runtime, arguments[5]); - auto tileMode = getTileMode(arguments, 6, count); - auto localMatrix = getLocalMatrix(runtime, arguments, 7, count); - auto flag = getFlag(arguments, 8, count); - - sk_sp gradient = SkGradientShader::MakeTwoPointConical( - start, startRadius, end, endRadius, colors.data(), positions.data(), - static_cast(colors.size()), tileMode, flag, localMatrix); - - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeTurbulence) { - auto baseFreqX = arguments[0].asNumber(); - auto baseFreqY = arguments[1].asNumber(); - auto octaves = arguments[2].asNumber(); - auto seed = arguments[3].asNumber(); - auto tileW = arguments[4].asNumber(); - auto tileH = arguments[5].asNumber(); - SkISize size = SkISize::Make(tileW, tileH); - sk_sp gradient = SkPerlinNoiseShader::MakeTurbulence( - baseFreqX, baseFreqY, octaves, seed, &size); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeFractalNoise) { - auto baseFreqX = arguments[0].asNumber(); - auto baseFreqY = arguments[1].asNumber(); - auto octaves = arguments[2].asNumber(); - auto seed = arguments[3].asNumber(); - auto tileW = arguments[4].asNumber(); - auto tileH = arguments[5].asNumber(); - SkISize size = SkISize::Make(tileW, tileH); - sk_sp gradient = SkPerlinNoiseShader::MakeFractalNoise( - baseFreqX, baseFreqY, octaves, seed, &size); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeBlend) { - auto blendMode = (SkBlendMode)arguments[0].asNumber(); - auto one = JsiSkShader::fromValue(runtime, arguments[1]); - auto two = JsiSkShader::fromValue(runtime, arguments[2]); - sk_sp gradient = SkShaders::Blend(blendMode, one, two); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_HOST_FUNCTION(MakeColor) { - auto color = JsiSkColor::fromValue(runtime, arguments[0]); - sk_sp gradient = SkShaders::Color(color); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), std::move(gradient))); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeLinearGradient), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeRadialGradient), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeSweepGradient), - JSI_EXPORT_FUNC(JsiSkShaderFactory, - MakeTwoPointConicalGradient), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeTurbulence), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeFractalNoise), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeBlend), - JSI_EXPORT_FUNC(JsiSkShaderFactory, MakeColor)) - - JsiSkShaderFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurface.h deleted file mode 100644 index b7671ab750fcc8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurface.h +++ /dev/null @@ -1,67 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkSurface : public JsiSkWrappingSkPtrHostObject { -public: - JsiSkSurface(std::shared_ptr context, - sk_sp surface) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(surface)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Surface"); - } - - JSI_HOST_FUNCTION(getCanvas) { - return jsi::Object::createFromHostObject(runtime, - std::make_shared(getContext(), - getObject()->getCanvas())); - } - - JSI_HOST_FUNCTION(makeImageSnapshot) { - sk_sp image; - if(count == 1) { - auto rect = JsiSkRect::fromValue(runtime, arguments[0]); - image = getObject()->makeImageSnapshot(SkIRect::MakeXYWH(rect->x(), rect->y(), rect->width(), rect->height())); - } else { - image = getObject()->makeImageSnapshot(); - } - return jsi::Object::createFromHostObject(runtime, std::make_shared(getContext(), std::move(image))); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkSurface, __typename__)) - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkSurface, getCanvas), - JSI_EXPORT_FUNC(JsiSkSurface, makeImageSnapshot)) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurfaceFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurfaceFactory.h deleted file mode 100644 index da76c47b594f80..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkSurfaceFactory.h +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkSurfaceFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(Make) { - auto width = static_cast(arguments[0].asNumber()); - auto height = static_cast(arguments[1].asNumber()); - auto surface = SkSurface::MakeRasterN32Premul(width, height); - if(surface == nullptr) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject(runtime, - std::make_shared(getContext(), std::move(surface))); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkSurfaceFactory, Make)) - - JsiSkSurfaceFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlob.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlob.h deleted file mode 100644 index 5deffda9c5d978..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlob.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkTextBlob : public JsiSkWrappingSkPtrHostObject { - public: - JsiSkTextBlob( - std::shared_ptr context, - sk_sp shader - ) : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(shader)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "TextBlob"); - } - - JSI_EXPORT_PROPERTY_GETTERS( - JSI_EXPORT_PROP_GET(JsiSkTextBlob, __typename__), - ) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - - } - - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlobFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlobFactory.h deleted file mode 100644 index 76ae2076770ea5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTextBlobFactory.h +++ /dev/null @@ -1,109 +0,0 @@ -#pragma once - -#include -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include "JsiSkTextBlob.h" -#include "JsiSkRSXform.h" -#include "JsiSkFont.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkTextBlobFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(MakeFromText) { - auto str = arguments[0].asString(runtime).utf8(runtime); - auto font = JsiSkFont::fromValue(runtime, arguments[1]); - auto textBlob = SkTextBlob::MakeFromString(str.c_str(), *font); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), std::move(textBlob)) - ); - } - - JSI_HOST_FUNCTION(MakeFromGlyphs) { - auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime); - auto font = JsiSkFont::fromValue(runtime, arguments[1]); - int bytesPerGlyph = 2; - std::vector glyphs; - int glyphsSize = static_cast(jsiGlyphs.size(runtime)); - glyphs.reserve(glyphsSize); - for (int i = 0; i < glyphsSize; i++) { - glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber()); - } - auto textBlob = SkTextBlob::MakeFromText(glyphs.data(), glyphs.size() * bytesPerGlyph, *font, SkTextEncoding::kGlyphID); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), std::move(textBlob)) - ); - } - - JSI_HOST_FUNCTION(MakeFromRSXform) { - auto str = arguments[0].asString(runtime).utf8(runtime); - auto jsiRsxforms = arguments[1].asObject(runtime).asArray(runtime); - auto font = JsiSkFont::fromValue(runtime, arguments[2]); - std::vector rsxforms; - int rsxformsSize = static_cast(jsiRsxforms.size(runtime)); - rsxforms.reserve(rsxformsSize); - for (int i = 0; i < rsxformsSize; i++) { - auto rsxform = JsiSkRSXform::fromValue(runtime, jsiRsxforms.getValueAtIndex(runtime, i)); - rsxforms.push_back(*rsxform); - } - auto textBlob = SkTextBlob::MakeFromRSXform(str.c_str(), str.length(), rsxforms.data(), *font); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), std::move(textBlob)) - ); - } - - JSI_HOST_FUNCTION(MakeFromRSXformGlyphs) { - auto jsiGlyphs = arguments[0].asObject(runtime).asArray(runtime); - auto jsiRsxforms = arguments[1].asObject(runtime).asArray(runtime); - auto font = JsiSkFont::fromValue(runtime, arguments[2]); - int bytesPerGlyph = 2; - std::vector glyphs; - int glyphsSize = static_cast(jsiGlyphs.size(runtime)); - glyphs.reserve(glyphsSize); - for (int i = 0; i < glyphsSize; i++) { - glyphs.push_back(jsiGlyphs.getValueAtIndex(runtime, i).asNumber()); - } - std::vector rsxforms; - int rsxformsSize = static_cast(jsiRsxforms.size(runtime)); - rsxforms.reserve(rsxformsSize); - for (int i = 0; i < rsxformsSize; i++) { - auto rsxform = JsiSkRSXform::fromValue(runtime, jsiRsxforms.getValueAtIndex(runtime, i)); - rsxforms.push_back(*rsxform); - } - auto textBlob = SkTextBlob::MakeFromRSXform(glyphs.data(), glyphs.size() * bytesPerGlyph, rsxforms.data(), *font, SkTextEncoding::kGlyphID); - return jsi::Object::createFromHostObject( - runtime, - std::make_shared(getContext(), std::move(textBlob)) - ); - } - - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(JsiSkTextBlobFactory, MakeFromText), - JSI_EXPORT_FUNC(JsiSkTextBlobFactory, MakeFromGlyphs), - JSI_EXPORT_FUNC(JsiSkTextBlobFactory, MakeFromRSXform), - JSI_EXPORT_FUNC(JsiSkTextBlobFactory, MakeFromRSXformGlyphs), - ) - - JsiSkTextBlobFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypeface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypeface.h deleted file mode 100644 index 26f658c0f860e5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypeface.h +++ /dev/null @@ -1,85 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkHostObjects.h" -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class JsiSkTypeface : public JsiSkWrappingSkPtrHostObject { -public: - JSI_PROPERTY_GET(bold) { - ABI46_0_0RNSkLogger::warnToJavascriptConsole(runtime, "Typeface.bold is deprecated and will be removed in a future release."); - return jsi::Value(getObject()->isBold()); - } - - JSI_PROPERTY_GET(italic) { - ABI46_0_0RNSkLogger::warnToJavascriptConsole(runtime, "Typeface.italic is deprecated and will be removed in a future release."); - return jsi::Value(getObject()->isItalic()); - } - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Typeface"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkTypeface, bold), - JSI_EXPORT_PROP_GET(JsiSkTypeface, italic), - JSI_EXPORT_PROP_GET(JsiSkTypeface, __typename__)) - - JsiSkTypeface(std::shared_ptr context, - sk_sp typeface) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(typeface)){} - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - /** - Returns the jsi object from a host object of this type - */ - static jsi::Value toValue(jsi::Runtime &runtime, - std::shared_ptr context, - sk_sp tf) { - return jsi::Object::createFromHostObject( - runtime, std::make_shared(std::move(context), std::move(tf))); - } - -private: - static SkFontStyle getFontStyleFromNumber(int fontStyle) { - switch (fontStyle) { - case 0: - return SkFontStyle::Normal(); - case 1: - return SkFontStyle::Bold(); - case 2: - return SkFontStyle::Italic(); - case 3: - return SkFontStyle::BoldItalic(); - default: - return SkFontStyle::Normal(); - }; - } -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypefaceFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypefaceFactory.h deleted file mode 100644 index 906f8ea3b47674..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkTypefaceFactory.h +++ /dev/null @@ -1,34 +0,0 @@ -#pragma once - -#include -#include - -#include - -#include "JsiSkTypeface.h" -#include "JsiSkHostObjects.h" -#include "JsiSkData.h" - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkTypefaceFactory : public JsiSkHostObject { - public: - JSI_HOST_FUNCTION(MakeFreeTypeFaceFromData) { - auto data = JsiSkData::fromValue(runtime, arguments[0]); - auto typeface = SkFontMgr::RefDefault()->makeFromData(std::move(data)); - if(typeface == nullptr) { - return jsi::Value::null(); - } - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), typeface)); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkTypefaceFactory, MakeFreeTypeFaceFromData)) - - JsiSkTypefaceFactory(std::shared_ptr context) - : JsiSkHostObject(std::move(context)) {} - }; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkVertices.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkVertices.h deleted file mode 100644 index f64d199cb1fa0a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/JsiSkVertices.h +++ /dev/null @@ -1,145 +0,0 @@ -#pragma once - -#include -#include -#include - -#include "JsiSkHostObjects.h" - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - - using namespace ABI46_0_0facebook; - - class JsiSkVertices : public JsiSkWrappingSkPtrHostObject { - public: - - JsiSkVertices(std::shared_ptr context, - sk_sp vertices) - : JsiSkWrappingSkPtrHostObject(std::move(context), std::move(vertices)) {} - - // TODO: declare in JsiSkWrappingSkPtrHostObject via extra template parameter? - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "Vertices"); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(JsiSkVertices, __typename__)) - - JSI_HOST_FUNCTION(bounds) { - const auto& result = getObject()->bounds(); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(getContext(), result)); - } - - JSI_HOST_FUNCTION(uniqueID) { - return static_cast(getObject()->uniqueID()); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkVertices, bounds), - JSI_EXPORT_FUNC(JsiSkVertices, uniqueID), ) - - /** - Returns the underlying object from a host object of this type - */ - static sk_sp fromValue(jsi::Runtime &runtime, - const jsi::Value &obj) { - return obj.asObject(runtime) - .asHostObject(runtime) - ->getObject(); - } - - /** - * Creates the function for construction a new instance of the SkVertices - * wrapper - * @param context platform context - * @return A function for creating a new host object wrapper for the SkVertices - * class - */ - static const jsi::HostFunctionType - createCtor(std::shared_ptr context) { - return JSI_HOST_FUNCTION_LAMBDA { - auto mode = static_cast(arguments[0].getNumber()); - std::vector positions; - std::vector texs; - std::vector colors; - std::vector indices; - - auto jsiPositions = arguments[1].asObject(runtime).asArray(runtime); - auto positionsSize = static_cast(jsiPositions.size(runtime)); - positions.reserve(positionsSize); - for (int i = 0; i < positionsSize; i++) { - std::shared_ptr point = JsiSkPoint::fromValue( - runtime, jsiPositions.getValueAtIndex(runtime, i).asObject(runtime)); - positions.push_back(*point.get()); - } - - if (count >= 3 && !arguments[2].isNull() && !arguments[2].isUndefined()) { - auto jsiTexs = arguments[2].asObject(runtime).asArray(runtime); - auto texsSize = jsiTexs.size(runtime); - texs.reserve(texsSize); - for (int i = 0; i < texsSize; i++) { - auto point = JsiSkPoint::fromValue( - runtime, jsiTexs.getValueAtIndex(runtime, i).asObject(runtime)); - texs.push_back(*point.get()); - } - } - - if (count >= 4 && !arguments[3].isNull() && !arguments[3].isUndefined()) { - auto jsiColors = arguments[3].asObject(runtime).asArray(runtime); - auto colorsSize = jsiColors.size(runtime); - colors.reserve(colorsSize); - for (int i = 0; i < colorsSize; i++) { - SkColor color = JsiSkColor::fromValue(runtime, jsiColors.getValueAtIndex(runtime, i)); - colors.push_back(color); - } - } - - int indicesSize = 0; - if (count >= 5 && !arguments[4].isNull() && !arguments[4].isUndefined()) { - auto jsiIndices = arguments[4].asObject(runtime).asArray(runtime); - indicesSize = static_cast(jsiIndices.size(runtime)); - indices.reserve(indicesSize); - for (int i = 0; i < indicesSize; i++) { - uint16_t index = jsiIndices.getValueAtIndex(runtime, i).asNumber(); - indices.push_back(index); - } - } -// TODO: this is the technic used in CanvasKit: https://github.com/google/skia/blob/main/modules/canvaskit/interface.js#L1216 -// Note that the isVolatile parameter is unused when using MakeCopy() -// auto isVolatile = count >= 6 && !arguments[5].isNull() && !arguments[5].isUndefined() ? arguments[5].getBool() : false; -// auto flags = 0; -// // These flags are from SkVertices.h and should be kept in sync with those. -// if (texs.size() > 0) { -// flags |= (1 << 0); -// } -// if (colors.size() > 0) { -// flags |= (1 << 1); -// } -// if (!isVolatile) { -// flags |= (1 << 2); -// } -// auto builder = SkVertices::Builder(mode, positionsSize/2, indicesSize, flags); -// std::copy(positions.data(), positions.data() + positionsSize, builder.positions()); -// if (builder.texCoords()) { -// std::copy(std::begin(texs), std::end(texs), builder.texCoords()); -// } -// if (builder.colors()) { -// std::copy(std::begin(colors), std::end(colors), builder.colors()); -// } -// if (builder.indices()) { -// std::copy(std::begin(indices), std::end(indices), builder.indices()); -// } -// auto vertices = builder.detach(); - auto vertices = SkVertices::MakeCopy(mode, positionsSize, positions.data(), texs.data(), colors.data(), indicesSize, indices.data()); - return jsi::Object::createFromHostObject( - runtime, std::make_shared(context, std::move(vertices))); - }; - } - }; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.cpp b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.cpp deleted file mode 100644 index 47c8a90c110dfb..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.cpp +++ /dev/null @@ -1,194 +0,0 @@ -#include "CSSColorParser.h" - -namespace CSSColorParser { - - template - uint8_t clamp_css_byte(T i) { // Clamp to integer 0 .. 255. - i = ::round(i); // Seems to be what Chrome does (vs truncation). - return i < 0 ? 0 : i > 255 ? 255 : uint8_t(i); - } - - template - float clamp_css_float(T f) { // Clamp to float 0.0 .. 1.0. - return f < 0 ? 0 : f > 1 ? 1 : float(f); - } - - float parseFloat(const std::string& str) { - return strtof(str.c_str(), nullptr); - } - - int64_t parseInt(const std::string& str, uint8_t base = 10) { - return strtoll(str.c_str(), nullptr, base); - } - - uint8_t parse_css_int(const std::string& str) { // int or percentage. - if (str.length() && str.back() == '%') { - return clamp_css_byte(parseFloat(str) / 100.0f * 255.0f); - } else { - return clamp_css_byte(parseInt(str)); - } - } - - float parse_css_float(const std::string& str) { // float or percentage. - if (str.length() && str.back() == '%') { - return clamp_css_float(parseFloat(str) / 100.0f); - } else { - return clamp_css_float(parseFloat(str)); - } - } - - float css_hue_to_rgb(float m1, float m2, float h) { - if (h < 0.0f) { - h += 1.0f; - } else if (h > 1.0f) { - h -= 1.0f; - } - - if (h * 6.0f < 1.0f) { - return m1 + (m2 - m1) * h * 6.0f; - } - if (h * 2.0f < 1.0f) { - return m2; - } - if (h * 3.0f < 2.0f) { - return m1 + (m2 - m1) * (2.0f / 3.0f - h) * 6.0f; - } - return m1; - } - - std::vector split(const std::string& s, char delim) { - std::vector elems; - std::stringstream ss(s); - std::string item; - while (std::getline(ss, item, delim)) { - elems.push_back(item); - } - return elems; - } - - Color parse(const std::string& css_str) { - std::string str = css_str; - - // Remove all whitespace, not compliant, but should just be more accepting. - str.erase(std::remove(str.begin(), str.end(), ' '), str.end()); - - // Convert to lowercase. - std::transform(str.begin(), str.end(), str.begin(), ::tolower); - - for (const auto& namedColor : namedColors) { - if (str == namedColor.name) { - return { namedColor.color }; - } - } - - // #abc and #abc123 syntax. - if (str.length() && str.front() == '#') { - auto iv = parseInt(str.substr(1), 16); // TODO(deanm): Stricter parsing. - if (str.length() == 4) { - if (!(iv >= 0 && iv <= 0xfff)) { - return {}; - } else { - return { - static_cast(((iv & 0xf00) >> 4) | ((iv & 0xf00) >> 8)), - static_cast((iv & 0xf0) | ((iv & 0xf0) >> 4)), - static_cast((iv & 0xf) | ((iv & 0xf) << 4)), - 1 - }; - } - } else if (str.length() == 7) { - if (!(iv >= 0 && iv <= 0xffffff)) { - return {}; // Covers NaN. - } else { - return { - static_cast((iv & 0xff0000) >> 16), - static_cast((iv & 0xff00) >> 8), - static_cast(iv & 0xff), - 1 - }; - } - }else if (str.length() == 5) { - // #rgba - if (!(iv >= 0 && iv <= 0xffff)) return {}; // Covers NaN. - return { - static_cast(((iv & 0xf000) >> 8) | ((iv & 0xf000) >> 12)), - static_cast(((iv & 0x0f00) >> 4) | ((iv & 0x0f00) >> 8)), - static_cast((iv & 0x00f0) | ((iv & 0x00f0) >> 4)), - static_cast(((iv & 0x000f) << 4 | (iv & 0x000f))) / 255.0f - }; - } else if (str.length() == 9) { - // #rrggbbaa - if (!(iv >= 0 && iv <= 0xffffffff)) return {}; // Covers NaN. - return { - static_cast(((iv & 0xff000000) >> 24) & 0xff), - static_cast((iv & 0x00ff0000) >> 16), - static_cast((iv & 0x0000ff00) >> 8), - static_cast((iv & 0x000000ff)) / 255.0f - }; - } - - return {}; - } - - size_t op = str.find_first_of('('), ep = str.find_first_of(')'); - if (op != std::string::npos && ep + 1 == str.length()) { - const std::string fname = str.substr(0, op); - const std::vector params = split(str.substr(op + 1, ep - (op + 1)), ','); - - float alpha = 1.0f; - - if (fname == "rgba" || fname == "rgb") { - if (fname == "rgba") { - if (params.size() != 4) { - return { }; - } - alpha = parse_css_float(params.back()); - } else { - if (params.size() != 3) { - return { }; - } - } - - return { - parse_css_int(params[0]), - parse_css_int(params[1]), - parse_css_int(params[2]), - alpha - }; - - } else if (fname == "hsla" || fname == "hsl") { - if (fname == "hsla") { - if (params.size() != 4) { - return { }; - } - alpha = parse_css_float(params.back()); - } else { - if (params.size() != 3) { - return { }; - } - } - - float h = parseFloat(params[0]) / 360.0f; - float i; - // Normalize the hue to [0..1[ - h = std::modf(h, &i); - - // NOTE(deanm): According to the CSS spec s/l should only be - // percentages, but we don't bother and let float or percentage. - float s = parse_css_float(params[1]); - float l = parse_css_float(params[2]); - - float m2 = l <= 0.5f ? l * (s + 1.0f) : l + s - l * s; - float m1 = l * 2.0f - m2; - - return { - clamp_css_byte(css_hue_to_rgb(m1, m2, h + 1.0f / 3.0f) * 255.0f), - clamp_css_byte(css_hue_to_rgb(m1, m2, h) * 255.0f), - clamp_css_byte(css_hue_to_rgb(m1, m2, h - 1.0f / 3.0f) * 255.0f), - alpha - }; - } - } - - return { }; - } -} \ No newline at end of file diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.h deleted file mode 100644 index 8f04b3d685827c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/api/third_party/CSSColorParser.h +++ /dev/null @@ -1,134 +0,0 @@ -// (c) Dean McNamee , 2012. -// C++ port by Mapbox, Konstantin Käfer , 2014-2017. -// -// https://github.com/deanm/css-color-parser-js -// https://github.com/kkaefer/css-color-parser-cpp -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace CSSColorParser { - - struct Color { - inline Color() { - } - inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_) - : r(r_), g(g_), b(b_), a(a_ > 1 ? 1 : a_ < 0 ? 0 : a_) { - } - unsigned char r = 0, g = 0, b = 0; - float a = -1.0f; - }; - - struct NamedColor { const char *const name; const Color color; }; - - const NamedColor namedColors[] = { - { "transparent", { 0, 0, 0, 0 } }, { "aliceblue", { 240, 248, 255, 1 } }, - { "antiquewhite", { 250, 235, 215, 1 } }, { "aqua", { 0, 255, 255, 1 } }, - { "aquamarine", { 127, 255, 212, 1 } }, { "azure", { 240, 255, 255, 1 } }, - { "beige", { 245, 245, 220, 1 } }, { "bisque", { 255, 228, 196, 1 } }, - { "black", { 0, 0, 0, 1 } }, { "blanchedalmond", { 255, 235, 205, 1 } }, - { "blue", { 0, 0, 255, 1 } }, { "blueviolet", { 138, 43, 226, 1 } }, - { "brown", { 165, 42, 42, 1 } }, { "burlywood", { 222, 184, 135, 1 } }, - { "cadetblue", { 95, 158, 160, 1 } }, { "chartreuse", { 127, 255, 0, 1 } }, - { "chocolate", { 210, 105, 30, 1 } }, { "coral", { 255, 127, 80, 1 } }, - { "cornflowerblue", { 100, 149, 237, 1 } }, { "cornsilk", { 255, 248, 220, 1 } }, - { "crimson", { 220, 20, 60, 1 } }, { "cyan", { 0, 255, 255, 1 } }, - { "darkblue", { 0, 0, 139, 1 } }, { "darkcyan", { 0, 139, 139, 1 } }, - { "darkgoldenrod", { 184, 134, 11, 1 } }, { "darkgray", { 169, 169, 169, 1 } }, - { "darkgreen", { 0, 100, 0, 1 } }, { "darkgrey", { 169, 169, 169, 1 } }, - { "darkkhaki", { 189, 183, 107, 1 } }, { "darkmagenta", { 139, 0, 139, 1 } }, - { "darkolivegreen", { 85, 107, 47, 1 } }, { "darkorange", { 255, 140, 0, 1 } }, - { "darkorchid", { 153, 50, 204, 1 } }, { "darkred", { 139, 0, 0, 1 } }, - { "darksalmon", { 233, 150, 122, 1 } }, { "darkseagreen", { 143, 188, 143, 1 } }, - { "darkslateblue", { 72, 61, 139, 1 } }, { "darkslategray", { 47, 79, 79, 1 } }, - { "darkslategrey", { 47, 79, 79, 1 } }, { "darkturquoise", { 0, 206, 209, 1 } }, - { "darkviolet", { 148, 0, 211, 1 } }, { "deeppink", { 255, 20, 147, 1 } }, - { "deepskyblue", { 0, 191, 255, 1 } }, { "dimgray", { 105, 105, 105, 1 } }, - { "dimgrey", { 105, 105, 105, 1 } }, { "dodgerblue", { 30, 144, 255, 1 } }, - { "firebrick", { 178, 34, 34, 1 } }, { "floralwhite", { 255, 250, 240, 1 } }, - { "forestgreen", { 34, 139, 34, 1 } }, { "fuchsia", { 255, 0, 255, 1 } }, - { "gainsboro", { 220, 220, 220, 1 } }, { "ghostwhite", { 248, 248, 255, 1 } }, - { "gold", { 255, 215, 0, 1 } }, { "goldenrod", { 218, 165, 32, 1 } }, - { "gray", { 128, 128, 128, 1 } }, { "green", { 0, 128, 0, 1 } }, - { "greenyellow", { 173, 255, 47, 1 } }, { "grey", { 128, 128, 128, 1 } }, - { "honeydew", { 240, 255, 240, 1 } }, { "hotpink", { 255, 105, 180, 1 } }, - { "indianred", { 205, 92, 92, 1 } }, { "indigo", { 75, 0, 130, 1 } }, - { "ivory", { 255, 255, 240, 1 } }, { "khaki", { 240, 230, 140, 1 } }, - { "lavender", { 230, 230, 250, 1 } }, { "lavenderblush", { 255, 240, 245, 1 } }, - { "lawngreen", { 124, 252, 0, 1 } }, { "lemonchiffon", { 255, 250, 205, 1 } }, - { "lightblue", { 173, 216, 230, 1 } }, { "lightcoral", { 240, 128, 128, 1 } }, - { "lightcyan", { 224, 255, 255, 1 } }, { "lightgoldenrodyellow", { 250, 250, 210, 1 } }, - { "lightgray", { 211, 211, 211, 1 } }, { "lightgreen", { 144, 238, 144, 1 } }, - { "lightgrey", { 211, 211, 211, 1 } }, { "lightpink", { 255, 182, 193, 1 } }, - { "lightsalmon", { 255, 160, 122, 1 } }, { "lightseagreen", { 32, 178, 170, 1 } }, - { "lightskyblue", { 135, 206, 250, 1 } }, { "lightslategray", { 119, 136, 153, 1 } }, - { "lightslategrey", { 119, 136, 153, 1 } }, { "lightsteelblue", { 176, 196, 222, 1 } }, - { "lightyellow", { 255, 255, 224, 1 } }, { "lime", { 0, 255, 0, 1 } }, - { "limegreen", { 50, 205, 50, 1 } }, { "linen", { 250, 240, 230, 1 } }, - { "magenta", { 255, 0, 255, 1 } }, { "maroon", { 128, 0, 0, 1 } }, - { "mediumaquamarine", { 102, 205, 170, 1 } }, { "mediumblue", { 0, 0, 205, 1 } }, - { "mediumorchid", { 186, 85, 211, 1 } }, { "mediumpurple", { 147, 112, 219, 1 } }, - { "mediumseagreen", { 60, 179, 113, 1 } }, { "mediumslateblue", { 123, 104, 238, 1 } }, - { "mediumspringgreen", { 0, 250, 154, 1 } }, { "mediumturquoise", { 72, 209, 204, 1 } }, - { "mediumvioletred", { 199, 21, 133, 1 } }, { "midnightblue", { 25, 25, 112, 1 } }, - { "mintcream", { 245, 255, 250, 1 } }, { "mistyrose", { 255, 228, 225, 1 } }, - { "moccasin", { 255, 228, 181, 1 } }, { "navajowhite", { 255, 222, 173, 1 } }, - { "navy", { 0, 0, 128, 1 } }, { "oldlace", { 253, 245, 230, 1 } }, - { "olive", { 128, 128, 0, 1 } }, { "olivedrab", { 107, 142, 35, 1 } }, - { "orange", { 255, 165, 0, 1 } }, { "orangered", { 255, 69, 0, 1 } }, - { "orchid", { 218, 112, 214, 1 } }, { "palegoldenrod", { 238, 232, 170, 1 } }, - { "palegreen", { 152, 251, 152, 1 } }, { "paleturquoise", { 175, 238, 238, 1 } }, - { "palevioletred", { 219, 112, 147, 1 } }, { "papayawhip", { 255, 239, 213, 1 } }, - { "peachpuff", { 255, 218, 185, 1 } }, { "peru", { 205, 133, 63, 1 } }, - { "pink", { 255, 192, 203, 1 } }, { "plum", { 221, 160, 221, 1 } }, - { "powderblue", { 176, 224, 230, 1 } }, { "purple", { 128, 0, 128, 1 } }, - { "red", { 255, 0, 0, 1 } }, { "rosybrown", { 188, 143, 143, 1 } }, - { "royalblue", { 65, 105, 225, 1 } }, { "saddlebrown", { 139, 69, 19, 1 } }, - { "salmon", { 250, 128, 114, 1 } }, { "sandybrown", { 244, 164, 96, 1 } }, - { "seagreen", { 46, 139, 87, 1 } }, { "seashell", { 255, 245, 238, 1 } }, - { "sienna", { 160, 82, 45, 1 } }, { "silver", { 192, 192, 192, 1 } }, - { "skyblue", { 135, 206, 235, 1 } }, { "slateblue", { 106, 90, 205, 1 } }, - { "slategray", { 112, 128, 144, 1 } }, { "slategrey", { 112, 128, 144, 1 } }, - { "snow", { 255, 250, 250, 1 } }, { "springgreen", { 0, 255, 127, 1 } }, - { "steelblue", { 70, 130, 180, 1 } }, { "tan", { 210, 180, 140, 1 } }, - { "teal", { 0, 128, 128, 1 } }, { "thistle", { 216, 191, 216, 1 } }, - { "tomato", { 255, 99, 71, 1 } }, { "turquoise", { 64, 224, 208, 1 } }, - { "violet", { 238, 130, 238, 1 } }, { "wheat", { 245, 222, 179, 1 } }, - { "white", { 255, 255, 255, 1 } }, { "whitesmoke", { 245, 245, 245, 1 } }, - { "yellow", { 255, 255, 0, 1 } }, { "yellowgreen", { 154, 205, 50, 1 } } - }; - - inline bool operator==(const Color& lhs, const Color& rhs) { - return lhs.r == rhs.r && lhs.g == rhs.g && lhs.b == rhs.b && ::fabs(lhs.a - rhs.a) < 0.0001f; - } - - inline bool operator!=(const Color& lhs, const Color& rhs) { - return !(lhs == rhs); - } - - Color parse(const std::string& css_str); -} // namespace CSSColorParser \ No newline at end of file diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.cpp b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.cpp deleted file mode 100644 index 877bc01cab7db7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.cpp +++ /dev/null @@ -1,154 +0,0 @@ -#include -#include -#include - -// To be able to find objects that aren't cleaned up correctly, -// we can set this value to 1 and debug the constructor/destructor -#define JSI_DEBUG_ALLOCATIONS 0 - -namespace ABI46_0_0RNJsi { - -#if JSI_DEBUG_ALLOCATIONS -int objCounter = 0; -std::vector objects; -#endif - -JsiHostObject::JsiHostObject() { -#if JSI_DEBUG_ALLOCATIONS - objects.push_back(this); - objCounter++; -#endif -} -JsiHostObject::~JsiHostObject() { -#if JSI_DEBUG_ALLOCATIONS - for (size_t i = 0; i < objects.size(); ++i) { - if (objects.at(i) == this) { - objects.erase(objects.begin() + i); - break; - } - } - objCounter--; -#endif -} - -void JsiHostObject::set(jsi::Runtime &rt, const jsi::PropNameID &name, - const jsi::Value &value) { - - auto nameVal = name.utf8(rt); - auto nameStr = nameVal.c_str(); - - /** Check the static setters map */ - const JsiPropertySettersMap &setters = getExportedPropertySettersMap(); - auto setter = setters.find(nameStr); - if (setter != setters.end()) { - auto dispatcher = std::bind(setter->second, this, std::placeholders::_1, - std::placeholders::_2); - return dispatcher(rt, value); - } - - if (_propMap.count(nameStr) > 0) { - auto prop = _propMap.at(nameStr); - (prop.set)(rt, value); - } -} - -jsi::Value JsiHostObject::get(jsi::Runtime &runtime, - const jsi::PropNameID &name) { - auto nameVal = name.utf8(runtime); - auto nameStr = nameVal.c_str(); - - // Check the static getters map - const JsiPropertyGettersMap &getters = getExportedPropertyGettersMap(); - auto getter = getters.find(nameStr); - if (getter != getters.end()) { - auto dispatcher = std::bind(getter->second, this, std::placeholders::_1); - return dispatcher(runtime); - } - - // Check the cache for functions - auto runtimeCache = _cache.find(&runtime); - JsiHostFunctionCache *currentCache; - if (runtimeCache != _cache.end()) { - currentCache = &runtimeCache->second; - // Check if the runtime cache as a cache of the host function - auto cachedFunc = runtimeCache->second.find(nameStr); - if (cachedFunc != runtimeCache->second.end()) { - return cachedFunc->second->asFunction(runtime); - } - } else { - // Create cache for this runtime - JsiHostFunctionCache runtimeCache; - _cache.emplace(&runtime, JsiHostFunctionCache{}); - currentCache = &_cache.at(&runtime); - } - - // Check the static function map - const JsiFunctionMap &funcs = getExportedFunctionMap(); - auto func = funcs.find(nameStr); - if (func != funcs.end()) { - auto dispatcher = std::bind(func->second, (JsiHostObject *)this, - std::placeholders::_1, std::placeholders::_2, - std::placeholders::_3, std::placeholders::_4); - - // Add to cache - currentCache->emplace(nameStr, std::make_unique( - jsi::Function::createFromHostFunction( - runtime, name, 0, dispatcher))); - - // return retVal; - return currentCache->at(nameStr)->asFunction(runtime); - } - - if (_funcMap.count(nameStr) > 0) { - return jsi::Function::createFromHostFunction(runtime, name, 0, - _funcMap.at(nameStr)); - } - - if (_propMap.count(nameStr) > 0) { - auto prop = _propMap.at(nameStr); - return (prop.get)(runtime); - } - - return jsi::Value::undefined(); -} - -std::vector -JsiHostObject::getPropertyNames(jsi::Runtime &runtime) { - // statically exported functions - const auto& funcs = getExportedFunctionMap(); - - // Statically exported property getters - const auto& getters = getExportedPropertyGettersMap(); - - // Statically exported property setters - const auto& setters = getExportedPropertySettersMap(); - - std::vector propNames; - propNames.reserve(funcs.size() + getters.size() + setters.size() + _funcMap.size() + _propMap.size()); - - for (auto it = funcs.cbegin(); it != funcs.cend(); ++it) { - propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first)); - } - - for (auto it = getters.cbegin(); it != getters.cend(); ++it) { - propNames.push_back(jsi::PropNameID::forUtf8(runtime, it->first)); - } - - for (auto it = getters.cbegin(); it != getters.cend(); ++it) { - if (getters.count(it->first) == 0) { - propNames.push_back(jsi::PropNameID::forUtf8(runtime, it->first)); - } - } - - // functions - for (auto it = _funcMap.cbegin(); it != _funcMap.cend(); ++it) { - propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first)); - } - // props - for (auto it = _propMap.cbegin(); it != _propMap.cend(); ++it) { - propNames.push_back(jsi::PropNameID::forAscii(runtime, it->first)); - } - return propNames; -} - -} // namespace ABI46_0_0RNJsi diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.h deleted file mode 100644 index 861accdeca83f5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiHostObject.h +++ /dev/null @@ -1,241 +0,0 @@ -#pragma once - -#include - -#include -#include -#include -#include - -#define STR_CAT_NX(A, B) A##B -#define STR_CAT(A, B) STR_CAT_NX(A, B) -#define STR_GET get_ -#define STR_SET set_ - -/** - * Creates a new Host function declaration as a lambda with all deps passed - * with implicit lambda capture clause - */ -#define JSI_HOST_FUNCTION_LAMBDA \ - [=](jsi::Runtime & runtime, const jsi::Value &thisValue, \ - const jsi::Value *arguments, size_t count) -> jsi::Value - -/** - * Creates a new Host function declaration - */ -#define JSI_HOST_FUNCTION(NAME) \ - jsi::Value NAME(jsi::Runtime &runtime, const jsi::Value &thisValue, \ - const jsi::Value *arguments, size_t count) - -/** - * Creates a new property setter function declaration - */ -#define JSI_PROPERTY_SET(NAME) \ - void STR_CAT(STR_SET, NAME)(jsi::Runtime & runtime, const jsi::Value &value) - -/** - * Creates a new property getter function declaration - */ -#define JSI_PROPERTY_GET(NAME) \ - jsi::Value STR_CAT(STR_GET, NAME)(jsi::Runtime & runtime) - -/** - * Creates a JSI export function declaration - */ -#define JSI_EXPORT_FUNC(CLASS, FUNCTION) \ - { \ -#FUNCTION, (jsi::Value(JsiHostObject::*)( \ - jsi::Runtime & runtime, const jsi::Value &thisValue, \ - const jsi::Value *arguments, size_t)) & \ - CLASS::FUNCTION \ - } - -/** - * Creates a JSI export functions statement - */ -#define JSI_EXPORT_FUNCTIONS(...) \ - const JsiFunctionMap &getExportedFunctionMap() override { \ - static JsiFunctionMap map = {__VA_ARGS__}; \ - return map; \ - } - -/** - * Creates a JSI export getter declaration - */ -#define JSI_EXPORT_PROP_GET(CLASS, FUNCTION) \ - { \ -#FUNCTION, (jsi::Value(JsiHostObject::*)(jsi::Runtime & runtime)) & \ - CLASS::STR_CAT(STR_GET, FUNCTION) \ - } - -/** - * Creates a JSI export getters statement - */ -#define JSI_EXPORT_PROPERTY_GETTERS(...) \ - const JsiPropertyGettersMap &getExportedPropertyGettersMap() override { \ - static JsiPropertyGettersMap map = {__VA_ARGS__}; \ - return map; \ -} - -/** - * Creates a JSI export setter declaration - */ -#define JSI_EXPORT_PROP_SET(CLASS, FUNCTION) \ - { \ -#FUNCTION, \ - (void(JsiHostObject::*)(jsi::Runtime & runtime, const jsi::Value &)) & \ - CLASS::STR_CAT(STR_SET, FUNCTION) \ - } - -/** - * Creates a JSI export setters statement - */ -#define JSI_EXPORT_PROPERTY_SETTERS(...) \ - const JsiPropertySettersMap &getExportedPropertySettersMap() override { \ - static JsiPropertySettersMap map = {__VA_ARGS__}; \ - return map; \ - } - -namespace ABI46_0_0RNJsi { - -using namespace ABI46_0_0facebook; - -using JsPropertyType = struct { - std::function get; - std::function set; -}; - -class JsiHostObject; - -using JsiFunctionMap = std::unordered_map; - -using JsiPropertyGettersMap = std::unordered_map; - -using JsiPropertySettersMap = std::unordered_map; - -using JsiHostFunctionCache = - std::unordered_map>; - -using JsiRuntimeCache = - std::unordered_map; - -/** - * Base class for jsi host objects - */ -class JsiHostObject : public jsi::HostObject { -public: - JsiHostObject(); - ~JsiHostObject(); - -protected: - /** - Override to return map of name/functions - */ - virtual const JsiFunctionMap &getExportedFunctionMap() { - static const JsiFunctionMap empty; - return empty; - }; - - /** - Override to get property getters map of name/functions - */ - virtual const JsiPropertyGettersMap &getExportedPropertyGettersMap() { - static const JsiPropertyGettersMap empty; - return empty; - }; - - /** - Override to get property setters map of name/functions - */ - virtual const JsiPropertySettersMap &getExportedPropertySettersMap() { - static const JsiPropertySettersMap empty; - return empty; - }; - - /** - * Overridden jsi::HostObject set property method - * @param rt Runtime - * @param name Name of value to set - * @param value Value to set - */ - void set(jsi::Runtime &rt, const jsi::PropNameID &name, - const jsi::Value &value) override; - - /** - * Overridden jsi::HostObject get property method. Returns functions from - * the map of functions. - * @param runtime Runtime - * @param name Name of value to get - * @return Value - */ - jsi::Value get(jsi::Runtime &runtime, const jsi::PropNameID &name) override; - - /** - * Overridden getPropertyNames from jsi::HostObject. Returns all keys in the - * function and property maps - * @param runtime Runtime - * @return List of property names - */ - std::vector getPropertyNames(jsi::Runtime &runtime) override; - - /** - * Installs a function into the function map - */ - void installFunction(const std::string &name, - const jsi::HostFunctionType &function) { - _funcMap.emplace(name, function); - } - - /** - * Installs a property with get/set - * @param name Name of property to install - * @param get Getter function - * @param set Setter function - */ - void installProperty( - const std::string &name, - const std::function &get, - const std::function &set) { - _propMap.emplace(name, JsPropertyType{.get = get, .set = set}); - } - - /** - * Installs a property with only getter - * @param name Name of property to install - * @param get Getter function - */ - void installReadonlyProperty( - const std::string &name, - const std::function &get) { - _propMap.emplace(name, JsPropertyType{ - .get = get, - .set = [](jsi::Runtime &, const jsi::Value &) {}, - }); - } - - /** - * Installs a property which points to a given host object - * @param name Name of property to install - * @param hostObject Object to return - */ - void installReadonlyProperty(const std::string &name, - std::shared_ptr hostObject) { - _propMap.emplace(name, JsPropertyType{ - .get = - [hostObject](jsi::Runtime &runtime) { - return jsi::Object::createFromHostObject( - runtime, hostObject); - }, - .set = [](jsi::Runtime &, const jsi::Value &) {}, - }); - } - -private: - std::unordered_map _funcMap; - std::unordered_map _propMap; - JsiRuntimeCache _cache; -}; -} // namespace ABI46_0_0RNJsi diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiSimpleValueWrapper.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiSimpleValueWrapper.h deleted file mode 100644 index 88557699cf512a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/jsi/JsiSimpleValueWrapper.h +++ /dev/null @@ -1,108 +0,0 @@ - -#pragma once - -#include - -namespace ABI46_0_0RNJsi -{ -using namespace ABI46_0_0facebook; - -enum JsiWrapperValueType -{ - NonInitialized, - Undefined, - Null, - Bool, - Number, - JsiValue -}; - -/** - Implements a simple wrapper class for JSI primitives like numbers and boolean values. Objects, - strings and arrays are stored as values inside a property holder. The class also provides a method - for comparing values that will compare numbers, booleans and strings. - */ -class JsiSimpleValueWrapper -{ -public: - JsiSimpleValueWrapper(jsi::Runtime& runtime) : - _type(JsiWrapperValueType::NonInitialized), - _propNameId(jsi::PropNameID::forUtf8(runtime, "value")) - {} - - jsi::Value getCurrent(jsi::Runtime &runtime) - { - switch (_type) - { - case JsiWrapperValueType::NonInitialized: - return nullptr; - case JsiWrapperValueType::Undefined: - return jsi::Value::undefined(); - case JsiWrapperValueType::Null: - return jsi::Value::null(); - case JsiWrapperValueType::Bool: - return _boolValue; - case JsiWrapperValueType::Number: - return _numberValue; - case JsiWrapperValueType::JsiValue: - if (_valueHolder == nullptr) { - return jsi::Value::undefined(); - } - return _valueHolder->getProperty(runtime, _propNameId); - } - } - - void setCurrent(jsi::Runtime &runtime, const jsi::Value &value) - { - if(value.isNumber()) { - _type = JsiWrapperValueType::Number; - _numberValue = value.asNumber(); - } else if(value.isBool()) { - _type = JsiWrapperValueType::Bool; - _boolValue = value.getBool(); - } else if(value.isUndefined()) { - _type = JsiWrapperValueType::Undefined; - } else if(value.isNull()) { - _type = JsiWrapperValueType::Null; - } else { - _type = JsiWrapperValueType::JsiValue; - // Save as javascript object - we don't want to have to copy strings, objects and values - if(_valueHolder == nullptr) { - _valueHolder = std::make_shared(runtime); - } - _valueHolder->setProperty(runtime, _propNameId, value); - } - } - - bool equals(jsi::Runtime& runtime, const jsi::Value &value) { - if (_type == JsiWrapperValueType::NonInitialized) { - return false; - } - if(value.isNumber() && _type == JsiWrapperValueType::Number) { - return _numberValue == value.asNumber(); - } else if(value.isBool() && _type == JsiWrapperValueType::Bool) { - return _boolValue == value.getBool(); - } else if(value.isUndefined()) { - return _type == JsiWrapperValueType::Undefined; - } else if(value.isNull()) { - return _type == JsiWrapperValueType::Null; - } else if(value.isString()) { - auto current = getCurrent(runtime); - if (current.isString()) { - return jsi::String::strictEquals(runtime, value.asString(runtime), current.asString(runtime)); - } - return false; - } - return false; - } - -private: - jsi::PropNameID _propNameId; - std::shared_ptr _valueHolder; - - bool _boolValue; - double _numberValue; - - JsiWrapperValueType _type; -}; -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkAnimation.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkAnimation.h deleted file mode 100644 index d6572cd0b9ab86..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkAnimation.h +++ /dev/null @@ -1,68 +0,0 @@ - -#pragma once - -#include - -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ -using namespace ABI46_0_0facebook; - -/** - Implements an animation that can be used to drive other values - */ -class ABI46_0_0RNSkAnimation : public ABI46_0_0RNSkClockValue -{ - -public: - ABI46_0_0RNSkAnimation(std::shared_ptr platformContext, - size_t identifier, - jsi::Runtime& runtime, - const jsi::Value *arguments, - size_t count) : - ABI46_0_0RNSkClockValue(platformContext, identifier, runtime, arguments, count) { - // Save the update function - _updateFunction = std::make_shared(arguments[0].asObject(runtime).asFunction(runtime)); - - // Set state to undefined initially. - _args[1] = jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(cancel) { - stopClock(); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(ABI46_0_0RNSkAnimation, cancel)) - - -protected: - - void tick(jsi::Runtime &runtime, const jsi::Value &value) override { - // Set up arguments and call the update function - _args[0] = value.asNumber(); - _args[1] = _updateFunction->call(runtime, static_cast(_args.data()), _args.size()); - - // Get finished - auto finished = _args[1].asObject(runtime).getProperty(runtime, "finished").getBool(); - if(finished) { - stopClock(); - } - - // Get the next value - auto nextValue = _args[1].asObject(runtime).getProperty(runtime, "current").asNumber(); - - // Update self - update(runtime, nextValue); - } - -private: - - std::shared_ptr _updateFunction; - std::array _args; -}; -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDispatchQueue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDispatchQueue.h deleted file mode 100644 index 28e38af1204d93..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDispatchQueue.h +++ /dev/null @@ -1,47 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include - -// https://github.com/embeddedartistry/embedded-resources/blob/master/examples/cpp/dispatch.cpp -namespace ABI46_0_0RNSkia { - -class ABI46_0_0RNSkDispatchQueue { - typedef std::function fp_t; - -public: - ABI46_0_0RNSkDispatchQueue(std::string name, size_t thread_cnt = 1); - - ~ABI46_0_0RNSkDispatchQueue(); - - // dispatch and copy - void dispatch(const fp_t &op); - - // dispatch and move - void dispatch(fp_t &&op); - - // Deleted operations - ABI46_0_0RNSkDispatchQueue(const ABI46_0_0RNSkDispatchQueue &rhs) = delete; - - ABI46_0_0RNSkDispatchQueue &operator=(const ABI46_0_0RNSkDispatchQueue &rhs) = delete; - - ABI46_0_0RNSkDispatchQueue(ABI46_0_0RNSkDispatchQueue &&rhs) = delete; - - ABI46_0_0RNSkDispatchQueue &operator=(ABI46_0_0RNSkDispatchQueue &&rhs) = delete; - -private: - std::string name_; - std::mutex lock_; - std::vector threads_; - std::queue q_; - std::condition_variable cv_; - bool quit_ = false; - - void dispatch_thread_handler(void); -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDrawView.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDrawView.h deleted file mode 100644 index 1d42692ef2b263..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkDrawView.h +++ /dev/null @@ -1,212 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -class SkPicture; -class SkRect; -class SkImage; - -namespace ABI46_0_0RNSkia { -class JsiSkCanvas; -using namespace ABI46_0_0facebook; -using ABI46_0_0RNSkDrawCallback = - std::function, int, int, double, - std::shared_ptr)>; - -enum ABI46_0_0RNSkDrawingMode { Default, Continuous }; - -class ABI46_0_0RNSkDrawView: public std::enable_shared_from_this { -public: - /** - * Constructor - */ - ABI46_0_0RNSkDrawView(std::shared_ptr context); - - /** - Destructor - */ - virtual ~ABI46_0_0RNSkDrawView(); - - /** - * Repaints the Skia view using the underlying context and the drawcallback. - * This method schedules a draw request that will be run on the correct - * thread and js runtime. - */ - void requestRedraw(); - - /** - Calls the drawing callback on the javascript thread - */ - void performDraw(); - - /** - * Installs the draw callback for the view - */ - void setDrawCallback(std::shared_ptr callback); - - /** - Sets the native id of the view - */ - void setNativeId(size_t nativeId); - - /** - Returns the native id - */ - size_t getNativeId() { return _nativeId; } - - /** - Sets the drawing mode for the view - */ - void setDrawingMode(ABI46_0_0RNSkDrawingMode mode); - - /** - * Set to true to show the debug overlays on render - */ - void setShowDebugOverlays(bool show) { _showDebugOverlay = show; } - - /** - Update touch state with new touch points - */ - void updateTouchState(std::vector&& points); - - /** - Draws the view's surface into an image - return an SkImage - */ - sk_sp makeImageSnapshot(std::shared_ptr bounds); - -protected: - /** - Returns the scaled width of the view - */ - virtual float getScaledWidth() = 0; - - /** - Returns the scaled height of the view - */ - virtual float getScaledHeight() = 0; - - /** - Override to render picture to GPU - */ - virtual void drawPicture(const sk_sp picture) = 0; - - /** - * @return The platformcontext - */ - std::shared_ptr getPlatformContext() { - return _platformContext; - } - -private: - /** - Starts beginDrawCallback loop if the drawing mode is continuous - */ - void beginDrawingLoop(); - - /** - Ends an ongoing beginDrawCallback loop for this view - */ - void endDrawingLoop(); - - /** - Draw loop callback - */ - void drawLoopCallback(bool invalidated); - - /** - Draw in canvas - */ - void drawInCanvas(std::shared_ptr canvas, - int width, - int height, - double time); - - /** - * Stores the draw drawCallback - */ - std::shared_ptr _drawCallback; - - /** - * Stores a pointer to the jsi wrapper for the canvas. The reason for - * storing this pointer and not recreate it is that it creates a set of - * functions that we don't want to recreate on each render - */ - std::shared_ptr _jsiCanvas; - - /** - * JS Drawing mutex - */ - std::shared_ptr _jsDrawingLock; - - /** - * SKIA Drawing mutex - */ - std::shared_ptr _gpuDrawingLock; - - /** - * Pointer to the platform context - */ - std::shared_ptr _platformContext; - - /** - Drawing mode - */ - ABI46_0_0RNSkDrawingMode _drawingMode; - - /** - * Show debug overlays - */ - bool _showDebugOverlay = false; - - /** - * True if the drawing loop has been requested - */ - size_t _drawingLoopId = 0; - - /** - * Info object parameter - */ - std::shared_ptr _infoObject; - - /** - Timing information for javascript drawing - */ - ABI46_0_0RNSkTimingInfo _jsTimingInfo; - - /** - Timing information for GPU rendering - */ - ABI46_0_0RNSkTimingInfo _gpuTimingInfo; - - /** - Redraw queue counter - */ - std::atomic _redrawRequestCounter = { 1 }; - - /** - * Native id - */ - size_t _nativeId; - -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkInfoParameter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkInfoParameter.h deleted file mode 100644 index 2cd763f5830193..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkInfoParameter.h +++ /dev/null @@ -1,102 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -#include - -#include - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0RNJsi; -using namespace std::chrono; - -enum ABI46_0_0RNSkTouchType { Start, Active, End, Cancelled }; - -using ABI46_0_0RNSkTouchPoint = struct { - double x; - double y; - double force; - ABI46_0_0RNSkTouchType type; - size_t id; - long timestamp; -}; - -class ABI46_0_0RNSkInfoObject : public JsiHostObject { -public: - JSI_PROPERTY_GET(width) { return _width; } - JSI_PROPERTY_GET(height) { return _height; } - JSI_PROPERTY_GET(timestamp) { return _timestamp; } - - JSI_PROPERTY_GET(touches) { - auto ops = jsi::Array(runtime, _touchesCache.size()); - for (size_t i = 0; i < _touchesCache.size(); i++) { - auto cur = _touchesCache.at(i); - auto touches = jsi::Array(runtime, cur.size()); - for (size_t n = 0; n < cur.size(); n++) { - auto touchObj = jsi::Object(runtime); - auto t = cur.at(n); - touchObj.setProperty(runtime, "x", t.x); - touchObj.setProperty(runtime, "y", t.y); - touchObj.setProperty(runtime, "force", t.force); - touchObj.setProperty(runtime, "type", (double)t.type); - touchObj.setProperty(runtime, "timestamp", (double)t.timestamp / 1000.0); - touchObj.setProperty(runtime, "id", (double)t.id); - touches.setValueAtIndex(runtime, n, touchObj); - } - ops.setValueAtIndex(runtime, i, touches); - } - return ops; - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(ABI46_0_0RNSkInfoObject, width), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkInfoObject, height), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkInfoObject, timestamp), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkInfoObject, touches)) - - void beginDrawOperation(int width, int height, double timestamp) { - _width = width; - _height = height; - _timestamp = timestamp; - - // Copy touches so that we can continue to add/receive touch points while - // in the drawing callback. - std::lock_guard lock(_mutex); - _touchesCache.clear(); - _touchesCache.reserve(_currentTouches.size()); - for (size_t i = 0; i < _currentTouches.size(); ++i) { - _touchesCache.push_back(_currentTouches.at(i)); - } - _currentTouches.clear(); - } - - void endDrawOperation() { _touchesCache.clear(); } - - void updateTouches(std::vector&& touches) { - std::lock_guard lock(_mutex); - // Add timestamp - auto ms = std::chrono::duration_cast( - system_clock::now().time_since_epoch()).count(); - - for(size_t i=0; i> _currentTouches; - std::vector> _touchesCache; - std::mutex _mutex; -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkJsiViewApi.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkJsiViewApi.h deleted file mode 100644 index f3a428638f990a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkJsiViewApi.h +++ /dev/null @@ -1,308 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia { -using namespace ABI46_0_0facebook; - -using CallbackInfo = struct CallbackInfo { - CallbackInfo() { - drawCallback = nullptr; - view = nullptr; - } - std::shared_ptr drawCallback; - std::shared_ptr view; -}; - -class ABI46_0_0RNSkJsiViewApi : public JsiHostObject { -public: - JSI_HOST_FUNCTION(setDrawCallback) { - if (count != 2) { - _platformContext->raiseError( - std::string("setDrawCallback: Expected 2 arguments, got " + - std::to_string(count) + ".")); - return jsi::Value::undefined(); - } - - if (!arguments[0].isNumber()) { - _platformContext->raiseError( - "setDrawCallback: First argument must be a number"); - return jsi::Value::undefined(); - } - - // We accept undefined to zero out the drawCallback - if (!arguments[1].isUndefined()) { - if (!arguments[1].isObject()) { - _platformContext->raiseError( - "setDrawCallback: Second argument must be a function"); - return jsi::Value::undefined(); - } - if (!arguments[1].asObject(runtime).isFunction(runtime)) { - _platformContext->raiseError( - "setDrawCallback: Second argument must be a function"); - return jsi::Value::undefined(); - } - } - - // find skia draw view - int nativeId = arguments[0].asNumber(); - - // and function to install as the draw drawCallback - auto info = getEnsuredCallbackInfo(nativeId); - if (arguments[1].isUndefined()) { - info->drawCallback = nullptr; - } else { - info->drawCallback = std::make_shared( - arguments[1].asObject(runtime).asFunction(runtime)); - } - - // Update view if set - if (info->view != nullptr && info->drawCallback != nullptr) { - info->view->setNativeId(nativeId); - info->view->setDrawCallback(info->drawCallback); - } - - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(invalidateSkiaView) { - if (count != 1) { - _platformContext->raiseError( - std::string("invalidateSkiaView: Expected 2 arguments, got " + - std::to_string(count) + ".")); - return jsi::Value::undefined(); - } - - if (!arguments[0].isNumber()) { - _platformContext->raiseError( - "invalidateSkiaView: First argument must be a number"); - return jsi::Value::undefined(); - } - - // find skia draw view - int nativeId = arguments[0].asNumber(); - - auto info = getEnsuredCallbackInfo(nativeId); - if (info->view != nullptr) { - info->view->requestRedraw(); - } - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(makeImageSnapshot) { - - // find skia draw view - int nativeId = arguments[0].asNumber(); - sk_sp image; - auto info = getEnsuredCallbackInfo(nativeId); - if (info->view != nullptr) { - if(count > 1 && !arguments[1].isUndefined() && !arguments[1].isNull()) { - auto rect = JsiSkRect::fromValue(runtime, arguments[1]); - image = info->view->makeImageSnapshot(rect); - } else { - image = info->view->makeImageSnapshot(nullptr); - } - if(image == nullptr) { - jsi::detail::throwJSError(runtime, "Could not create image from current surface."); - return jsi::Value::undefined(); - } - return jsi::Object::createFromHostObject(runtime, std::make_shared(_platformContext, image)); - } - jsi::detail::throwJSError(runtime, "No Skia View currently available."); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(setDrawMode) { - if (count != 2) { - _platformContext->raiseError( - std::string("setDrawMode: Expected 2 arguments, got " + - std::to_string(count) + ".")); - return jsi::Value::undefined(); - } - - if (!arguments[0].isNumber()) { - _platformContext->raiseError( - "setDrawMode: First argument must be a number"); - return jsi::Value::undefined(); - } - - // find skia draw view - int nativeId = arguments[0].asNumber(); - auto info = getEnsuredCallbackInfo(nativeId); - if (info->view != nullptr) { - auto nextMode = arguments[1].asString(runtime).utf8(runtime); - if(nextMode.compare("continuous") == 0) { - info->view->setDrawingMode(ABI46_0_0RNSkDrawingMode::Continuous); - } else { - info->view->setDrawingMode(ABI46_0_0RNSkDrawingMode::Default); - } - } - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(registerValuesInView) { - // Check params - if(!arguments[1].isObject() || !arguments[1].asObject(runtime).isArray(runtime)) { - jsi::detail::throwJSError(runtime, "Expected array of Values as second parameter"); - return jsi::Value::undefined(); - } - - // Get identifier of native SkiaView - int nativeId = arguments[0].asNumber(); - - // Get values that should be added as dependencies - auto values = arguments[1].asObject(runtime).asArray(runtime); - std::vector> unsubscribers; - const std::size_t size = values.size(runtime); - unsubscribers.reserve(size); - for(size_t i=0; i(runtime); - - if(value != nullptr) { - // Add change listener - unsubscribers.push_back(value->addListener([this, nativeId](jsi::Runtime&){ - requestRedrawView(nativeId); - })); - } - } - - // Return unsubscribe method that unsubscribes to all values - // that we subscribed to. - return jsi::Function::createFromHostFunction(runtime, - jsi::PropNameID::forUtf8(runtime, "unsubscribe"), - 0, - JSI_HOST_FUNCTION_LAMBDA { - // decrease dependency count on the Skia View - for(auto &unsub : unsubscribers) { - unsub(); - } - return jsi::Value::undefined(); - }); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(ABI46_0_0RNSkJsiViewApi, setDrawCallback), - JSI_EXPORT_FUNC(ABI46_0_0RNSkJsiViewApi, invalidateSkiaView), - JSI_EXPORT_FUNC(ABI46_0_0RNSkJsiViewApi, makeImageSnapshot), - JSI_EXPORT_FUNC(ABI46_0_0RNSkJsiViewApi, setDrawMode), - JSI_EXPORT_FUNC(ABI46_0_0RNSkJsiViewApi, registerValuesInView)) - - /** - * Constructor - * @param platformContext Platform context - */ - ABI46_0_0RNSkJsiViewApi(std::shared_ptr platformContext) - : JsiHostObject(), _platformContext(platformContext) {} - - /** - * Invalidates the api object - */ - void invalidate() { - unregisterAll(); - } - - /** - Call to remove all draw view infos - */ - void unregisterAll() { - // Unregister all views - auto tempList = _callbackInfos; - for (const auto& info : tempList) { - unregisterSkiaDrawView(info.first); - } - _callbackInfos.clear(); - } - - /** - * Registers a skia view - * @param nativeId Id of view to register - * @param view View to register - */ - void registerSkiaDrawView(size_t nativeId, std::shared_ptr view) { - auto info = getEnsuredCallbackInfo(nativeId); - info->view = view; - if (info->drawCallback != nullptr) { - info->view->setNativeId(nativeId); - info->view->setDrawCallback(info->drawCallback); - } - } - - /** - * Unregisters a Skia draw view - * @param nativeId View id - */ - void unregisterSkiaDrawView(size_t nativeId) { - if (_callbackInfos.count(nativeId) == 0) { - return; - } - auto info = getEnsuredCallbackInfo(nativeId); - if (info->view != nullptr) { - info->view->setDrawCallback(nullptr); - } - info->view = nullptr; - info->drawCallback = nullptr; - _callbackInfos.erase(nativeId); - } - - /** - Sets a skia draw view for the given id. This function can be used - to mark that an underlying SkiaView is not available (it could be - removed due to ex. a transition). The view can be set to a nullptr - or a valid view, effectively toggling the view's availability. If - a valid view is set, the setDrawCallback method is called on the - view (if a valid callback exists). - */ - void setSkiaDrawView(size_t nativeId, std::shared_ptr view) { - if (_callbackInfos.find(nativeId) == _callbackInfos.end()) { - return; - } - auto info = getEnsuredCallbackInfo(nativeId); - if (view != nullptr && info->drawCallback != nullptr) { - info->view = view; - info->view->setNativeId(nativeId); - info->view->setDrawCallback(info->drawCallback); - } else if(view == nullptr && info->drawCallback != nullptr) { - info->view->setDrawCallback(nullptr); - info->view = view; - } - } - -private: - /** - * Creates or returns the callback info object for the given view - * @param nativeId View id - * @return The callback info object for the requested view - */ - CallbackInfo *getEnsuredCallbackInfo(size_t nativeId) { - if (_callbackInfos.count(nativeId) == 0) { - CallbackInfo info; - _callbackInfos.emplace(nativeId, info); - } - return &_callbackInfos.at(nativeId); - } - - /** - Send a redraw request to the view - */ - void requestRedrawView(size_t nativeId) { - auto info = getEnsuredCallbackInfo(nativeId); - if(info->view != nullptr) { - info->view->requestRedraw(); - } - } - - // List of callbacks - std::unordered_map _callbackInfos; - - // Platform context - std::shared_ptr _platformContext; -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkManager.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkManager.h deleted file mode 100644 index 496df90cc22709..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkManager.h +++ /dev/null @@ -1,81 +0,0 @@ -#pragma once - -#include -#include - -#include "ABI46_0_0RNSkPlatformContext.h" - -namespace ABI46_0_0facebook { - namespace ABI46_0_0React { - class CallInvoker; - } -} - -namespace ABI46_0_0RNSkia { -class ABI46_0_0RNSkDrawView; -class ABI46_0_0RNSkJsiViewApi; -using namespace ABI46_0_0facebook; - -class ABI46_0_0RNSkManager { -public: - /** - Initialializes a new instance of the ABI46_0_0RNSkManager - @param jsRuntime The main JavaScript runtime - @param jsCallInvoker The callinvoker - @param platformContext Context used by wrappers to get platform - functionality - */ - ABI46_0_0RNSkManager(jsi::Runtime *jsRuntime, - std::shared_ptr jsCallInvoker, - std::shared_ptr platformContext); - - ~ABI46_0_0RNSkManager(); - - /** - Invalidates the Skia Manager - */ - void invalidate(); - - /** - * Registers a ABI46_0_0RNSkDrawView with the given native id - * @param nativeId Native view id - * @param view View to register - */ - void registerSkiaDrawView(size_t nativeId, std::shared_ptr view); - - /** - * Unregisters the ABI46_0_0RNSkDrawView from the list of registered views - * @param nativeId Native view Id - */ - void unregisterSkiaDrawView(size_t nativeId); - - /** - Sets the view pointed to by nativeId to the provided value. - Used when we want to remove a view without unregistering it - - this happens typically on iOS. - */ - void setSkiaDrawView(size_t nativeId, std::shared_ptr view); - - /** - * @return The platform context - */ - std::shared_ptr getPlatformContext() { - return _platformContext; - } - -private: - /** - * Installs the javascript methods for registering/unregistering draw - * callbacks for ABI46_0_0RNSkDrawViews. Called on installation of the parent native - * module. - */ - void installBindings(); - - jsi::Runtime *_jsRuntime; - std::shared_ptr _platformContext; - std::shared_ptr _jsCallInvoker; - std::shared_ptr _viewApi; - std::atomic _isInvalidated = {false}; -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkPlatformContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkPlatformContext.h deleted file mode 100644 index 219136e6406417..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkPlatformContext.h +++ /dev/null @@ -1,196 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -#include - -#include - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class ABI46_0_0RNSkPlatformContext { -public: - /** - * Constructor - */ - ABI46_0_0RNSkPlatformContext( - jsi::Runtime *runtime, std::shared_ptr callInvoker, - float pixelDensity) - : _pixelDensity(pixelDensity), _jsRuntime(runtime), - _callInvoker(callInvoker), - _dispatchQueue(std::make_unique("skia-render-thread")) { - _jsThreadId = std::this_thread::get_id(); - } - - /** - * Destructor - */ - virtual ~ABI46_0_0RNSkPlatformContext() { - invalidate(); - } - - void invalidate() { - if(!_isValid) { - return; - } - // Stop the refresh loop - stopDrawLoop(); - // Notify draw loop listeners once with the invalidated parameter - // set to true signalling that we are done and can clean up. - notifyDrawLoop(true); - _isValid = false; - } - - /* - Returns true if the current execution context is the javascript thread. - */ - bool isOnJavascriptThread() { - return _jsThreadId == std::this_thread::get_id(); - }; - - /** - * Schedules the function to be run on the javascript thread async - * @param func Function to run - */ - void runOnJavascriptThread(std::function func) { - if(!_isValid) { return; } - _callInvoker->invokeAsync(std::move(func)); - } - - /** - Runs the function on the render thread - */ - void runOnRenderThread(std::function func) { - if(!_isValid) { return; } - _dispatchQueue->dispatch(std::move(func)); - } - - /** - Returns the javascript runtime - */ - jsi::Runtime *getJsRuntime() { return _jsRuntime; } - - /** - * Returns an SkStream wrapping the require uri provided. - * @param sourceUri Uri for the resource to load as a string - * @op Operation to execute when the stream has successfuly been loaded. - */ - virtual void performStreamOperation( - const std::string &sourceUri, - const std::function)> &op) = 0; - - /** - * Raises an exception on the platform. This function does not necessarily - * throw an exception and stop execution, so it is important to stop execution - * by returning after calling the function - * @param err Error to raise - */ - virtual void raiseError(const std::exception &err) = 0; - - /** - * Raises an exception on the platform. This function does not necessarily - * throw an exception and stop execution, so it is important to stop execution - * by returning after calling the function - * @param message Message to show - */ - void raiseError(const std::string &message) { - return raiseError(std::runtime_error(message)); - } - - /** - * @return Current scale factor for pixels - */ - float getPixelDensity() { return _pixelDensity; }; - - /** - * Starts (if not started) a loop that will call back on display sync - * @param callback Callback to call on sync - * @returns Identifier of the draw loop entry - */ - size_t beginDrawLoop(size_t nativeId, std::function callback) { - if(!_isValid) { return 0; } - auto shouldStart = false; - { - std::lock_guard lock(_drawCallbacksLock); - _drawCallbacks.emplace(nativeId, std::move(callback)); - shouldStart = _drawCallbacks.size() == 1; - } - if (shouldStart) { - // Start - startDrawLoop(); - } - return nativeId; - } - - /** - * Ends (if running) the drawing loop that was started with beginDrawLoop. - * This method must be called symmetrically with the beginDrawLoop method. - * @param nativeId Identifier of view to end - */ - void endDrawLoop(size_t nativeId) { - if(!_isValid) { return; } - auto shouldStop = false; - { - std::lock_guard lock(_drawCallbacksLock); - if (_drawCallbacks.count(nativeId) > 0) { - _drawCallbacks.erase(nativeId); - } - shouldStop = _drawCallbacks.size() == 0; - } - if (shouldStop) { - stopDrawLoop(); - } - } - - /** - * Notifies all drawing callbacks - * @param invalidated True if the context was invalidated, otherwise false. This - * can be used to receive a notification that we have stopped the main drawloop - */ - void notifyDrawLoop(bool invalidated) { - if(!_isValid) { return; } - std::unordered_map> tmp; - { - std::lock_guard lock(_drawCallbacksLock); - tmp.insert(_drawCallbacks.cbegin(), _drawCallbacks.cend()); - } - for (auto it = tmp.begin(); it != tmp.end(); it++) { - it->second(invalidated); - } - } - - virtual void startDrawLoop() = 0; - virtual void stopDrawLoop() = 0; - -private: - float _pixelDensity; - - std::thread::id _jsThreadId; - - jsi::Runtime *_jsRuntime; - std::shared_ptr _callInvoker; - std::unique_ptr _dispatchQueue; - - std::unordered_map> _drawCallbacks; - std::mutex _drawCallbacksLock; - std::atomic _isValid = {true}; -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkValueApi.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkValueApi.h deleted file mode 100644 index ae012d53ee86e3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/ABI46_0_0RNSkValueApi.h +++ /dev/null @@ -1,73 +0,0 @@ - -#pragma once - -#include -#include -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia { -using namespace ABI46_0_0facebook; - -class ABI46_0_0RNSkValueApi : public JsiHostObject { -public: - /** - * Constructor - * @param platformContext Platform context - */ - ABI46_0_0RNSkValueApi(std::shared_ptr platformContext) - : JsiHostObject(), _platformContext(platformContext) { - _valueIdentifier = 50000; - } - - /** - * Destructor - */ - ~ABI46_0_0RNSkValueApi() { - } - - JSI_HOST_FUNCTION(createValue) { - return jsi::Object::createFromHostObject(runtime, - std::make_shared(_platformContext, runtime, arguments, count)); - } - - JSI_HOST_FUNCTION(createComputedValue) { - // Creation and initialization is done in two steps to be able to use weak references when setting - // up dependencies - since weak_from_this needs our instance to be a shared_ptr before calling - // weak_from_this(). - auto computedValue = std::make_shared(_platformContext, runtime, arguments, count); - computedValue->initializeDependencies(runtime, arguments, count); - return jsi::Object::createFromHostObject(runtime, computedValue); - } - - JSI_HOST_FUNCTION(createAnimation) { - return jsi::Object::createFromHostObject(runtime, - std::make_shared(_platformContext, - ++_valueIdentifier, - runtime, - arguments, - count)); - } - - JSI_HOST_FUNCTION(createClockValue) { - return jsi::Object::createFromHostObject(runtime, - std::make_shared(_platformContext, - ++_valueIdentifier, - runtime, - arguments, - count)); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(ABI46_0_0RNSkValueApi, createValue), - JSI_EXPORT_FUNC(ABI46_0_0RNSkValueApi, createComputedValue), - JSI_EXPORT_FUNC(ABI46_0_0RNSkValueApi, createClockValue), - JSI_EXPORT_FUNC(ABI46_0_0RNSkValueApi, createAnimation)) - -private: - // Platform context - std::shared_ptr _platformContext; - std::atomic _valueIdentifier; -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDispatchQueue.cpp b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDispatchQueue.cpp deleted file mode 100644 index 72c6761161b95e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDispatchQueue.cpp +++ /dev/null @@ -1,84 +0,0 @@ -#include "ABI46_0_0RNSkDispatchQueue.h" - -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ - - ABI46_0_0RNSkDispatchQueue::~ABI46_0_0RNSkDispatchQueue() - { - // Signal to dispatch threads that it's time to wrap up - std::unique_lock lock(lock_); - quit_ = true; - lock.unlock(); - cv_.notify_all(); - - // Wait for threads to finish before we exit - for (size_t i = 0; i < threads_.size(); i++) - { - if (threads_[i].joinable()) - { - threads_[i].join(); - } - } - } - - ABI46_0_0RNSkDispatchQueue::ABI46_0_0RNSkDispatchQueue(std::string name, size_t thread_cnt) - : name_{std::move(name)}, threads_(thread_cnt) - { - for (size_t i = 0; i < threads_.size(); i++) - { - threads_[i] = std::thread(&ABI46_0_0RNSkDispatchQueue::dispatch_thread_handler, this); - } - } - - void ABI46_0_0RNSkDispatchQueue::dispatch(const fp_t &op) - { - std::unique_lock lock(lock_); - q_.push(op); - - // Manual unlocking is done before notifying, to avoid waking up - // the waiting thread only to block again (see notify_one for details) - lock.unlock(); - cv_.notify_one(); - } - - void ABI46_0_0RNSkDispatchQueue::dispatch(fp_t &&op) - { - std::unique_lock lock(lock_); - q_.push(std::move(op)); - - // Manual unlocking is done before notifying, to avoid waking up - // the waiting thread only to block again (see notify_one for details) - lock.unlock(); - cv_.notify_one(); - } - - void ABI46_0_0RNSkDispatchQueue::dispatch_thread_handler(void) - { - std::unique_lock lock(lock_); - - do - { - // Wait until we have data or a quit signal - cv_.wait(lock, [this] - { return (q_.size() || quit_); }); - - // after wait, we own the lock - if (!quit_ && q_.size()) - { - auto op = std::move(q_.front()); - q_.pop(); - - // unlock now that we're done messing with the queue - lock.unlock(); - - op(); - - lock.lock(); - } - } while (!quit_); - } -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDrawView.cpp b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDrawView.cpp deleted file mode 100644 index e5068085c22503..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkDrawView.cpp +++ /dev/null @@ -1,291 +0,0 @@ -// -// Created by Christian Falch on 23/08/2021. -// - -#include "ABI46_0_0RNSkDrawView.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic pop - -namespace ABI46_0_0RNSkia { - -using namespace std::chrono; - -ABI46_0_0RNSkDrawView::ABI46_0_0RNSkDrawView(std::shared_ptr context) - : _jsiCanvas(std::make_shared(context)), - _platformContext(std::move(context)), - _infoObject(std::make_shared()), - _jsDrawingLock(std::make_shared()), - _gpuDrawingLock(std::make_shared()), - _jsTimingInfo("SKIA/JS"), - _gpuTimingInfo("SKIA/GPU") - {} - -ABI46_0_0RNSkDrawView::~ABI46_0_0RNSkDrawView() { - endDrawingLoop(); -} - -void ABI46_0_0RNSkDrawView::setNativeId(size_t nativeId) { - _nativeId = nativeId; - beginDrawingLoop(); -} - -void ABI46_0_0RNSkDrawView::setDrawCallback(std::shared_ptr callback) { - - if (callback == nullptr) { - _drawCallback = nullptr; - // We can just reset everything - this is a signal that we're done. - endDrawingLoop(); - return; - } - - // Reset timing info - _jsTimingInfo.reset(); - _gpuTimingInfo.reset(); - - // Create draw drawCallback wrapper - _drawCallback = std::make_shared( - [weakSelf = weak_from_this(), - callback = std::move(callback)](std::shared_ptr canvas, - int width, - int height, - double timestamp, - std::shared_ptr context) { - - auto self = weakSelf.lock(); - if(self) { - auto runtime = context->getJsRuntime(); - - // Update info parameter - self->_infoObject->beginDrawOperation(width, height, timestamp); - - // Set up arguments array - std::vector args(2); - args[0] = jsi::Object::createFromHostObject(*runtime, canvas); - args[1] = jsi::Object::createFromHostObject(*runtime, self->_infoObject); - - // To be able to call the drawing function we'll wrap it once again - callback->call(*runtime, - static_cast(args.data()), - (size_t)2); - - // Reset touches - self->_infoObject->endDrawOperation(); - - // Draw debug overlays - if (self->_showDebugOverlay) { - - // Display average rendering timer - auto jsAvg = self->_jsTimingInfo.getAverage(); - //auto jsFps = _jsTimingInfo.getFps(); - - auto gpuAvg = self->_gpuTimingInfo.getAverage(); - //auto gpuFps = _gpuTimingInfo.getFps(); - - auto total = jsAvg + gpuAvg; - - // Build string - std::ostringstream stream; - stream << "js: " << jsAvg << "ms gpu: " << gpuAvg << "ms " << " total: " << total << "ms"; - - std::string debugString = stream.str(); - - // Set up debug font/paints - auto font = SkFont(); - font.setSize(14); - auto paint = SkPaint(); - paint.setColor(SkColors::kRed); - canvas->getCanvas()->drawSimpleText( - debugString.c_str(), debugString.size(), SkTextEncoding::kUTF8, 8, - 18, font, paint); - } - } - }); - - // Request redraw - requestRedraw(); -} - -void ABI46_0_0RNSkDrawView::drawInCanvas(std::shared_ptr canvas, - int width, - int height, - double time) { - - // Call the draw drawCallback and perform js based drawing - auto skCanvas = canvas->getCanvas(); - if (_drawCallback != nullptr && skCanvas != nullptr) { - // Make sure to scale correctly - auto pd = _platformContext->getPixelDensity(); - skCanvas->save(); - skCanvas->scale(pd, pd); - - // Call draw function. - (*_drawCallback)(canvas, width / pd, height / pd, time, _platformContext); - - // Restore and flush canvas - skCanvas->restore(); - skCanvas->flush(); - } -} - -sk_sp ABI46_0_0RNSkDrawView::makeImageSnapshot(std::shared_ptr bounds) { - // Assert width/height - auto surface = SkSurface::MakeRasterN32Premul(getScaledWidth(), getScaledHeight()); - auto canvas = surface->getCanvas(); - auto jsiCanvas = std::make_shared(_platformContext); - jsiCanvas->setCanvas(canvas); - - milliseconds ms = duration_cast( - system_clock::now().time_since_epoch()); - - drawInCanvas(jsiCanvas, getScaledWidth(), getScaledHeight(), ms.count() / 1000); - - if(bounds != nullptr) { - SkIRect b = SkIRect::MakeXYWH(bounds->x(), bounds->y(), bounds->width(), bounds->height()); - return surface->makeImageSnapshot(b); - } else { - return surface->makeImageSnapshot(); - } -} - -void ABI46_0_0RNSkDrawView::updateTouchState(std::vector&& points) { - _infoObject->updateTouches(std::move(points)); - requestRedraw(); -} - -void ABI46_0_0RNSkDrawView::performDraw() { - // Start timing - _jsTimingInfo.beginTiming(); - - // Record the drawing operations on the JS thread so that we can - // move the actual drawing onto the render thread later - SkPictureRecorder recorder; - SkRTreeFactory factory; - SkCanvas* canvas = recorder.beginRecording(getScaledWidth(), getScaledHeight(), &factory); - _jsiCanvas->setCanvas(canvas); - - // Get current milliseconds - milliseconds ms = duration_cast( - system_clock::now().time_since_epoch()); - - try { - // Perform the javascript drawing - drawInCanvas(_jsiCanvas, getScaledWidth(), getScaledHeight(), ms.count() / 1000.0); - } catch(...) { - _jsTimingInfo.stopTiming(); - _jsDrawingLock->unlock(); - throw; - } - - // Finish drawing operations - auto p = recorder.finishRecordingAsPicture(); - - // Calculate duration - _jsTimingInfo.stopTiming(); - - if(_gpuDrawingLock->try_lock()) { - - // Post drawing message to the render thread where the picture recorded - // will be sent to the GPU/backend for rendering to screen. - auto gpuLock = _gpuDrawingLock; - _platformContext->runOnRenderThread([weakSelf = weak_from_this(), p = std::move(p), gpuLock]() { - auto self = weakSelf.lock(); - if (self) { - // Draw the picture recorded on the real GPU canvas - self->_gpuTimingInfo.beginTiming(); - self->drawPicture(p); - self->_gpuTimingInfo.stopTiming(); - } - // Unlock GPU drawing - gpuLock->unlock(); - }); - } else { -#ifdef DEBUG - _gpuTimingInfo.markSkipped(); -#endif - // Request a new redraw since the last frame was skipped. - requestRedraw(); - } - - // Unlock JS drawing - _jsDrawingLock->unlock(); -} - -void ABI46_0_0RNSkDrawView::requestRedraw() { - _redrawRequestCounter++; -} - -void ABI46_0_0RNSkDrawView::beginDrawingLoop() { - if (_drawingLoopId != 0 || _nativeId == 0) { - return; - } - // Set to zero to avoid calling beginDrawLoop before we return - _drawingLoopId = _platformContext->beginDrawLoop(_nativeId, - [weakSelf = weak_from_this()](bool invalidated) { - auto self = weakSelf.lock(); - if(self) { - self->drawLoopCallback(invalidated); - } - }); -} - -void ABI46_0_0RNSkDrawView::drawLoopCallback(bool invalidated) { - if(_redrawRequestCounter > 0 || _drawingMode == ABI46_0_0RNSkDrawingMode::Continuous) { - _redrawRequestCounter = 0; - - // We render on the javascript thread. - if(_jsDrawingLock->try_lock()) { - _platformContext->runOnJavascriptThread([weakSelf = weak_from_this()](){ - auto self = weakSelf.lock(); - if(self) { - self->performDraw(); - } - }); - } else { -#ifdef DEBUG - _jsTimingInfo.markSkipped(); -#endif - requestRedraw(); - } - } -} - -void ABI46_0_0RNSkDrawView::endDrawingLoop() { - if(_drawingLoopId != 0) { - _drawingLoopId = 0; - _platformContext->endDrawLoop(_nativeId); - } -} - -void ABI46_0_0RNSkDrawView::setDrawingMode(ABI46_0_0RNSkDrawingMode mode) { - if(mode == _drawingMode || _nativeId == 0) { - return; - } - _drawingMode = mode; -} - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkManager.cpp b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkManager.cpp deleted file mode 100644 index 54b0ac85e3cc2f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/RNSkManager.cpp +++ /dev/null @@ -1,81 +0,0 @@ -#include "ABI46_0_0RNSkManager.h" - -#include -#include - -#include - -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia { -using namespace ABI46_0_0facebook; - -ABI46_0_0RNSkManager::ABI46_0_0RNSkManager( - jsi::Runtime *jsRuntime, - std::shared_ptr jsCallInvoker, - std::shared_ptr platformContext) - : _jsRuntime(jsRuntime), _jsCallInvoker(jsCallInvoker), - _platformContext(platformContext), - _viewApi(std::make_shared(platformContext)) { - - // Install bindings - installBindings(); -} - -ABI46_0_0RNSkManager::~ABI46_0_0RNSkManager() { - invalidate(); - // Free up any references - _viewApi = nullptr; - _jsRuntime = nullptr; - _platformContext = nullptr; - _jsCallInvoker = nullptr; -} - -void ABI46_0_0RNSkManager::invalidate() { - if(_isInvalidated) { - return; - } - _isInvalidated = true; - - // Invalidate members - _viewApi->invalidate(); - _platformContext->invalidate(); -} - -void ABI46_0_0RNSkManager::registerSkiaDrawView(size_t nativeId, std::shared_ptr view) { - if (!_isInvalidated && _viewApi != nullptr) - _viewApi->registerSkiaDrawView(nativeId, view); -} - -void ABI46_0_0RNSkManager::unregisterSkiaDrawView(size_t nativeId) { - if (!_isInvalidated && _viewApi != nullptr) - _viewApi->unregisterSkiaDrawView(nativeId); -} - -void ABI46_0_0RNSkManager::setSkiaDrawView(size_t nativeId, std::shared_ptr view) { - if (!_isInvalidated && _viewApi != nullptr) - _viewApi->setSkiaDrawView(nativeId, view); -} - -void ABI46_0_0RNSkManager::installBindings() { - // Create the API objects and install it on the global object in the - // provided runtime. - - auto skiaApi = std::make_shared(*_jsRuntime, _platformContext); - _jsRuntime->global().setProperty( - *_jsRuntime, "SkiaApi", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(skiaApi))); - - _jsRuntime->global().setProperty( - *_jsRuntime, "SkiaViewApi", - jsi::Object::createFromHostObject(*_jsRuntime, _viewApi)); - - auto skiaValueApi = std::make_shared(_platformContext); - _jsRuntime->global().setProperty( - *_jsRuntime, "SkiaValueApi", - jsi::Object::createFromHostObject(*_jsRuntime, std::move(skiaValueApi))); -} -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkClockValue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkClockValue.h deleted file mode 100644 index 8ca3d370ab18ed..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkClockValue.h +++ /dev/null @@ -1,141 +0,0 @@ - -#pragma once - -#include -#include -#include - -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ -using namespace ABI46_0_0facebook; -/** - Implements a readonly Value that is updated every time the screen is redrawn. Its value will be the - number of milliseconds since the animation value was started. - */ -class ABI46_0_0RNSkClockValue : public ABI46_0_0RNSkReadonlyValue -{ -enum ABI46_0_0RNSkClockState { - NotStarted = 0, - Running = 1, - Stopped = 2 -}; - -public: - ABI46_0_0RNSkClockValue(std::shared_ptr platformContext, - size_t identifier, - jsi::Runtime& runtime, - const jsi::Value *arguments, - size_t count) : ABI46_0_0RNSkReadonlyValue(platformContext), - _runtime(runtime), - _identifier(identifier) { - // Start by updating to zero (start value) - update(_runtime, static_cast(0)); - } - - virtual ~ABI46_0_0RNSkClockValue() { - stopClock(); - } - - JSI_HOST_FUNCTION(start) { - startClock(); - return jsi::Value::undefined(); - } - - JSI_HOST_FUNCTION(stop) { - stopClock(); - return jsi::Value::undefined(); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(ABI46_0_0RNSkReadonlyValue, addListener), - JSI_EXPORT_FUNC(ABI46_0_0RNSkClockValue, start), - JSI_EXPORT_FUNC(ABI46_0_0RNSkClockValue, stop)) - - - virtual void startClock() { - if(_state == ABI46_0_0RNSkClockState::Running) { - return; - } - - auto now = std::chrono::high_resolution_clock::now(); - if(_state == ABI46_0_0RNSkClockState::NotStarted) { - _start = now; - _stop = now; - } - - // Subtract pause time from start - auto timeSinceStop = now - _stop; - _start += timeSinceStop; - - _state = ABI46_0_0RNSkClockState::Running; - - getContext()->beginDrawLoop(_identifier, [weakSelf = weak_from_this()](bool invalidated){ - auto self = weakSelf.lock(); - if(self) { - std::dynamic_pointer_cast(self)->notifyUpdate(invalidated); - } - }); - } - - virtual void stopClock() { - if(_state == ABI46_0_0RNSkClockState::Running) { - _state = ABI46_0_0RNSkClockState::Stopped; - _stop = std::chrono::high_resolution_clock::now(); - getContext()->endDrawLoop(_identifier); - } - } - -protected: - virtual void tick(jsi::Runtime &runtime, const jsi::Value &value) { - ABI46_0_0RNSkClockValue::update(runtime, value); - } - - void notifyUpdate(bool invalidated) { - if(invalidated) { - stopClock(); - return; - } - - if(_state != ABI46_0_0RNSkClockState::Running) { - return; - } - - // Ensure we call any updates from the draw loop on the javascript thread - getContext()->runOnJavascriptThread( - // To ensure that this shared_ptr instance is not deallocated before we are done - // running the update lambda we pass a shared from this to the lambda scope. - [weakSelf = weak_from_this()]() { - auto self = weakSelf.lock(); - if(self) { - auto selfClockValue = std::dynamic_pointer_cast(self); - if(selfClockValue->getState() == ABI46_0_0RNSkClockState::Running) { - auto now = std::chrono::high_resolution_clock::now(); - auto deltaFromStart = std::chrono::duration_cast(now - selfClockValue->_start).count(); - selfClockValue->tick(selfClockValue->_runtime, static_cast(deltaFromStart)); - } - } - }); - } - - /** - Returns the draw identifier for the clock. This identifier is used - for the draw loop. - */ - size_t getIdentifier() { return _identifier; } - - /** - Returns the state of the clock - */ - ABI46_0_0RNSkClockState getState() { return _state; } - - jsi::Runtime &_runtime; - size_t _identifier; - std::chrono::time_point _start; - std::chrono::time_point _stop; - std::atomic _state = { ABI46_0_0RNSkClockState::NotStarted }; -}; - -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkComputedValue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkComputedValue.h deleted file mode 100644 index f2850e267d3d06..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkComputedValue.h +++ /dev/null @@ -1,99 +0,0 @@ - -#pragma once - -#include "ABI46_0_0RNSkReadonlyValue.h" -#include -#include - -#include -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ -using namespace ABI46_0_0facebook; - -/** - Creates a readonly value that depends on one or more other values. The derived value has a callback - function that is used to calculate the new value when any of the dependencies change. - */ -class ABI46_0_0RNSkComputedValue : public ABI46_0_0RNSkReadonlyValue -{ -public: - ABI46_0_0RNSkComputedValue(std::shared_ptr platformContext, - jsi::Runtime &runtime, - const jsi::Value *arguments, - size_t count - ) - : ABI46_0_0RNSkReadonlyValue(platformContext) { - // Verify input - if(!arguments[0].isObject() || - !arguments[0].asObject(runtime).isFunction(runtime)) { - jsi::detail::throwJSError(runtime, "Expected callback function as first parameter"); - } - - if(!arguments[1].isObject() || - !arguments[1].asObject(runtime).isArray(runtime)) { - jsi::detail::throwJSError(runtime, "Expected array of dependencies as second parameter"); - } - - // Get callback for calculating result - _callback = std::make_shared(arguments[0].asObject(runtime).asFunction(runtime)); - } - - void initializeDependencies(jsi::Runtime &runtime, const jsi::Value *arguments, size_t count) { - // Save dependencies - std::vector> dependencies; - - // Ensure that all dependencies are Values - auto deps = arguments[1].asObject(runtime).asArray(runtime); - const std::size_t size = deps.size(runtime); - dependencies.reserve(size); - for(size_t i=0; i(runtime); - if(value == nullptr) { - continue; - } - dependencies.push_back(value); - } - - // register change handler on dependencies - _unsubscribers.reserve(_unsubscribers.size() + size); - for(const auto &dep: dependencies) { - _unsubscribers.push_back(dep->addListener([weakSelf = weak_from_this()](jsi::Runtime& runtime) { - auto self = weakSelf.lock(); - if(self) { - auto selfAsThis = std::dynamic_pointer_cast(self); - selfAsThis->dependencyUpdated(runtime); - } - })); - } - - // Set initial value - dependencyUpdated(runtime); - } - - virtual ~ABI46_0_0RNSkComputedValue() { - // Unregister listeners - for(const auto &unsubscribe: _unsubscribers) { - unsubscribe(); - } - } - -private: - void dependencyUpdated(jsi::Runtime &runtime) { - // Calculate new value - update(runtime, _callback->call(runtime, nullptr, 0)); - } - - std::shared_ptr _callback; - std::vector> _unsubscribers; -}; -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkReadonlyValue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkReadonlyValue.h deleted file mode 100644 index a17fb79eb02b50..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkReadonlyValue.h +++ /dev/null @@ -1,142 +0,0 @@ - -#pragma once - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ -using namespace ABI46_0_0facebook; - -/** - Implements a readonly Value that is updated every time the screen is redrawn. Its value will be the - number of milliseconds since the animation value was started. - */ -class ABI46_0_0RNSkReadonlyValue : public JsiSkHostObject, - public std::enable_shared_from_this -{ -public: - ABI46_0_0RNSkReadonlyValue(std::shared_ptr platformContext) - : JsiSkHostObject(platformContext), - _valueHolder(std::make_unique(*platformContext->getJsRuntime())) - { } - - virtual ~ABI46_0_0RNSkReadonlyValue() { } - - JSI_PROPERTY_GET(__typename__) { - return jsi::String::createFromUtf8(runtime, "RNSkValue"); - } - - JSI_PROPERTY_GET(current) { - return getCurrent(runtime); - } - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(ABI46_0_0RNSkReadonlyValue, __typename__), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkReadonlyValue, current)) - - JSI_HOST_FUNCTION(addListener) { - if(!arguments[0].isObject() || !arguments[0].asObject(runtime).isFunction(runtime)) { - jsi::detail::throwJSError(runtime, "Expected function as first parameter."); - return jsi::Value::undefined(); - } - auto callback = std::make_shared(arguments[0].asObject(runtime).asFunction(runtime)); - - auto unsubscribe = addListener([weakSelf = weak_from_this(), - callback = std::move(callback)](jsi::Runtime& runtime){ - auto self = weakSelf.lock(); - if(self) { - auto selfReadonlyValue = std::dynamic_pointer_cast(self); - callback->call(runtime, selfReadonlyValue->get_current(runtime)); - } - }); - - return jsi::Function::createFromHostFunction(runtime, - jsi::PropNameID::forUtf8(runtime, "unsubscribe"), - 0, - JSI_HOST_FUNCTION_LAMBDA { - unsubscribe(); - return jsi::Value::undefined(); - }); - } - - JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(ABI46_0_0RNSkReadonlyValue, addListener)) - - /** - * Adds a callback that will be called whenever the value changes - * @param cb Callback - * @return unsubscribe function - */ - const std::function addListener(const std::function cb) { - std::lock_guard lock(_mutex); - auto listenerId = _listenerId++; - _listeners.emplace(listenerId, cb); - return [weakSelf = weak_from_this(), listenerId]() { - auto self = weakSelf.lock(); - if(self) { - self->removeListener(listenerId); - } - }; - } - - /** - Updates the underlying value and notifies all listeners about the change. - Listeners are only notified if the value was actually changed for numeric, boolean and string - values. For all other values listeners are notified without comparison. - @param runtime Current JS Runtime - @param value Next value - */ - virtual void update(jsi::Runtime &runtime, const jsi::Value &value) { - auto equal = _valueHolder->equals(runtime, value); - _valueHolder->setCurrent(runtime, value); - if(!equal) { - notifyListeners(runtime); - } - } - - jsi::Value getCurrent(jsi::Runtime &runtime) { - return _valueHolder->getCurrent(runtime); - } - -protected: - - /** - Notifies listeners about changes - @param runtime Current JS Runtime - */ - void notifyListeners(jsi::Runtime &runtime) { - std::unordered_map> tmp; - { - std::lock_guard lock(_mutex); - tmp.insert(_listeners.cbegin(), _listeners.cend()); - } - for(const auto &listener: tmp) { - listener.second(runtime); - } - } - - /** - Removes a subscription listeners - @param listenerId identifier of listener to remove - */ - void removeListener(long listenerId) { - std::lock_guard lock(_mutex); - _listeners.erase(listenerId); - } - -private: - std::unique_ptr _valueHolder; - - long _listenerId = 0; - std::unordered_map> _listeners; - std::mutex _mutex; -}; -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkValue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkValue.h deleted file mode 100644 index c2d48278cbe8f5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/rnskia/values/ABI46_0_0RNSkValue.h +++ /dev/null @@ -1,117 +0,0 @@ -#pragma once - -#include -#include - -#include -#include -#include -#include -#include - -namespace ABI46_0_0RNSkia -{ -using namespace ABI46_0_0facebook; -/** - Implements a Value that can be both read and written to. It inherits from the ReadonlyValue with - functionailty for subscribing to changes. - */ -class ABI46_0_0RNSkValue : public ABI46_0_0RNSkReadonlyValue -{ -public: - ABI46_0_0RNSkValue(std::shared_ptr platformContext, - jsi::Runtime& runtime, const jsi::Value *arguments, size_t count) - : ABI46_0_0RNSkReadonlyValue(platformContext) { - if(count == 1) { - update(runtime, arguments[0]); - } - } - - ~ABI46_0_0RNSkValue() { - unsubscribe(); - } - - JSI_PROPERTY_SET(current) { - // When someone else is setting the value we need to stop any ongoing - // animations - unsubscribe(); - update(runtime, value); - } - - JSI_PROPERTY_SET(animation) { - // Cancel existing animation - unsubscribe(); - - // Verify input - if(value.isObject() && value.asObject(runtime).isHostObject(runtime)) { - auto animation = value.asObject(runtime).getHostObject(runtime); - if(animation != nullptr) { - // Now we have a value animation - let us connect and start - subscribe(animation); - } - } else if(value.isUndefined() || value.isNull()) { - // Do nothing - we've already unsubscribed - } else { - jsi::detail::throwJSError(runtime, "Animation expected."); - } - } - - JSI_PROPERTY_GET(animation) { - if(_animation != nullptr) { - return jsi::Object::createFromHostObject(runtime, _animation); - } - return jsi::Value::undefined(); - } - - JSI_EXPORT_PROPERTY_SETTERS(JSI_EXPORT_PROP_SET(ABI46_0_0RNSkValue, current), - JSI_EXPORT_PROP_SET(ABI46_0_0RNSkValue, animation)) - - JSI_EXPORT_PROPERTY_GETTERS(JSI_EXPORT_PROP_GET(ABI46_0_0RNSkReadonlyValue, __typename__), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkValue, current), - JSI_EXPORT_PROP_GET(ABI46_0_0RNSkValue, animation)) - - JSI_EXPORT_FUNCTIONS( - JSI_EXPORT_FUNC(ABI46_0_0RNSkValue, addListener), - ) - -private: - void subscribe(std::shared_ptr animation) { - if(animation != nullptr) { - _animation = animation; - _unsubscribe = std::make_shared>( - _animation->addListener([weakSelf = weak_from_this()](jsi::Runtime &runtime) { - auto self = weakSelf.lock(); - if(self) { - auto selfAsThis = std::dynamic_pointer_cast(self); - selfAsThis->animationDidUpdate(runtime); - } - })); - // Start the animation - _animation->startClock(); - } - } - - void animationDidUpdate(jsi::Runtime& runtime) { - if(_animation != nullptr) { - // Update ourselves from the current animation value - update(runtime, _animation->get_current(runtime)); - } - } - - void unsubscribe() { - if(_unsubscribe != nullptr) { - (*_unsubscribe)(); - _unsubscribe = nullptr; - } - - if(_animation != nullptr) { - _animation->stopClock(); - _animation = nullptr; - } - } - - std::shared_ptr _animation; - std::shared_ptr> _unsubscribe; -}; - -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAndroidFrameworkUtils.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAndroidFrameworkUtils.h deleted file mode 100644 index 5c8059cd91ee7a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAndroidFrameworkUtils.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAndroidFrameworkUtils_DEFINED -#define SkAndroidFrameworkUtils_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkPoint.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTileMode.h" - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - -class SkCanvas; -struct SkIRect; -struct SkRect; -class SkSurface; -class SkShader; - -/** - * SkAndroidFrameworkUtils expose private APIs used only by Android framework. - */ -class SkAndroidFrameworkUtils { -public: - -#if SK_SUPPORT_GPU - /** - * clipWithStencil draws the current clip into a stencil buffer with reference value and mask - * set to 0x1. This function works only on a GPU canvas. - * - * @param canvas A GPU canvas that has a non-empty clip. - * - * @return true on success or false if clip is empty or not a GPU canvas. - */ - static bool clipWithStencil(SkCanvas* canvas); -#endif //SK_SUPPORT_GPU - - static void SafetyNetLog(const char*); - - static sk_sp getSurfaceFromCanvas(SkCanvas* canvas); - - static int SaveBehind(SkCanvas* canvas, const SkRect* subset); - - // Operating within the canvas' clip stack, this resets the geometry of the clip to be wide - // open modula any device clip restriction that was set outside of the clip stack. - static void ResetClip(SkCanvas* canvas); - - /** - * Unrolls a chain of nested SkPaintFilterCanvas to return the base wrapped canvas. - * - * @param canvas A SkPaintFilterCanvas or any other SkCanvas subclass. - * - * @return SkCanvas that was found in the innermost SkPaintFilterCanvas. - */ - static SkCanvas* getBaseWrappedCanvas(SkCanvas* canvas); - - /** - * Skia will change the order in which local matrices concatenate. In order to not break Android - * apps targeting older API levels we offer this function to use the legacy concatenation order. - */ - static void UseLegacyLocalMatrixConcatenation(); - - /** - * If the shader represents a linear gradient ShaderAsALinearGradient - * returns true and if info is not null, ShaderAsALinearGradient populates - * info with the parameters for the gradient. fColorCount is both an input - * and output parameter. On input, it indicates how many entries in - * fColors and fColorOffsets can be used, if they are not nullptr. After - * asAGradient has run, fColorCount indicates how many color-offset pairs - * there are in the gradient. fColorOffsets specifies where on the range of - * 0 to 1 to transition to the given color. fPoints represent the endpoints - * of the gradient. - */ - struct LinearGradientInfo { - int fColorCount = 0; //!< In-out parameter, specifies passed size - // of fColors/fColorOffsets on input, and - // actual number of colors/offsets on - // output. - SkColor* fColors = nullptr; //!< The colors in the gradient. - SkScalar* fColorOffsets = nullptr; //!< The unit offset for color transitions. - SkPoint fPoints[2]; //!< Type specific, see above. - SkTileMode fTileMode; - uint32_t fGradientFlags = 0; //!< see SkGradientShader::Flags - }; - - static bool ShaderAsALinearGradient(SkShader* shader, LinearGradientInfo*); -}; - -#endif // SK_BUILD_FOR_ANDROID_ANDROID - -#endif // SkAndroidFrameworkUtils_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAnimatedImage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAnimatedImage.h deleted file mode 100644 index 8143c1722bec0d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/android/SkAnimatedImage.h +++ /dev/null @@ -1,179 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAnimatedImage_DEFINED -#define SkAnimatedImage_DEFINED - -#include "include/codec/SkCodecAnimation.h" -#include "include/core/SkBitmap.h" -#include "include/core/SkDrawable.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkRect.h" - -class SkAndroidCodec; -class SkImage; -class SkPicture; - -/** - * Thread unsafe drawable for drawing animated images (e.g. GIF). - */ -class SK_API SkAnimatedImage : public SkDrawable { -public: - /** - * Create an SkAnimatedImage from the SkAndroidCodec. - * - * Returns null on failure to allocate pixels. On success, this will - * decode the first frame. - * - * @param info Width and height may require scaling. - * @param cropRect Rectangle to crop to after scaling. - * @param postProcess Picture to apply after scaling and cropping. - */ - static sk_sp Make(std::unique_ptr, - const SkImageInfo& info, SkIRect cropRect, sk_sp postProcess); - - /** - * Simpler version that uses the default size, no cropping, and no postProcess. - */ - static sk_sp Make(std::unique_ptr); - - ~SkAnimatedImage() override; - - /** - * Reset the animation to the beginning. - */ - void reset(); - - /** - * Whether the animation completed. - * - * Returns true after all repetitions are complete, or an error stops the - * animation. Gets reset to false if the animation is restarted. - */ - bool isFinished() const { return fFinished; } - - /** - * Returned by decodeNextFrame and currentFrameDuration if the animation - * is not running. - */ - static constexpr int kFinished = -1; - - /** - * Decode the next frame. - * - * If the animation is on the last frame or has hit an error, returns - * kFinished. - */ - int decodeNextFrame(); - - /** - * Returns the current frame as an SkImage. The SkImage will not change - * after it has been returned. - * If there is no current frame, nullptr will be returned. - */ - sk_sp getCurrentFrame(); - - /** - * How long to display the current frame. - * - * Useful for the first frame, for which decodeNextFrame is called - * internally. - */ - int currentFrameDuration() { - return fCurrentFrameDuration; - } - - /** - * Change the repetition count. - * - * By default, the image will repeat the number of times indicated in the - * encoded data. - * - * Use SkCodec::kRepetitionCountInfinite for infinite, and 0 to show all - * frames once and then stop. - */ - void setRepetitionCount(int count); - - /** - * Return the currently set repetition count. - */ - int getRepetitionCount() const { - return fRepetitionCount; - } - - /** - * Return the total number of frames in the animation. - */ - int getFrameCount() const { return fFrameCount; } - -protected: - SkRect onGetBounds() override; - void onDraw(SkCanvas*) override; - -private: - struct Frame { - SkBitmap fBitmap; - int fIndex; - SkCodecAnimation::DisposalMethod fDisposalMethod; - - // init() may have to create a new SkPixelRef, if the - // current one is already in use by another owner (e.g. - // an SkPicture). This determines whether to copy the - // existing one to the new one. - enum class OnInit { - // Restore the image from the old SkPixelRef to the - // new one. - kRestoreIfNecessary, - // No need to restore. - kNoRestore, - }; - - Frame(); - bool init(const SkImageInfo& info, OnInit); - bool copyTo(Frame*) const; - }; - - std::unique_ptr fCodec; - SkImageInfo fDecodeInfo; - const SkIRect fCropRect; - const sk_sp fPostProcess; - const int fFrameCount; - SkMatrix fMatrix; - int fSampleSize; - - bool fFinished; - int fCurrentFrameDuration; - Frame fDisplayFrame; - Frame fDecodingFrame; - Frame fRestoreFrame; - int fRepetitionCount; - int fRepetitionsCompleted; - - SkAnimatedImage(std::unique_ptr, const SkImageInfo& requestedInfo, - SkIRect cropRect, sk_sp postProcess); - - int computeNextFrame(int current, bool* animationEnded); - double finish(); - - /** - * True if there is no crop, orientation, or post decoding scaling. - */ - bool simple() const { return fMatrix.isIdentity() && !fPostProcess - && fCropRect == fDecodeInfo.bounds(); } - - /** - * Returns the current frame as an SkImage. - * - * Like getCurrentFrame, but only returns the raw data from the internal SkBitmap. (i.e. no - * scaling, orientation-correction or cropping.) If simple(), this is the final output. - */ - sk_sp getCurrentFrameSimple(); - - using INHERITED = SkDrawable; -}; - -#endif // SkAnimatedImage_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkAndroidCodec.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkAndroidCodec.h deleted file mode 100644 index 02625838308bdd..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkAndroidCodec.h +++ /dev/null @@ -1,279 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAndroidCodec_DEFINED -#define SkAndroidCodec_DEFINED - -#include "include/codec/SkCodec.h" -#include "include/core/SkAlphaType.h" -#include "include/core/SkColorSpace.h" -#include "include/core/SkColorType.h" -#include "include/core/SkEncodedImageFormat.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" -#include "include/core/SkTypes.h" -#include "include/private/SkEncodedInfo.h" -#include "include/private/SkNoncopyable.h" -#include "modules/skcms/skcms.h" - -#include -#include - -class SkData; -class SkPngChunkReader; -class SkStream; -struct SkIRect; - -/** - * Abstract interface defining image codec functionality that is necessary for - * Android. - */ -class SK_API SkAndroidCodec : SkNoncopyable { -public: - /** - * Deprecated. - * - * Now that SkAndroidCodec supports multiframe images, there are multiple - * ways to handle compositing an oriented frame on top of an oriented frame - * with different tradeoffs. SkAndroidCodec now ignores the orientation and - * forces the client to handle it. - */ - enum class ExifOrientationBehavior { - kIgnore, - kRespect, - }; - - /** - * Pass ownership of an SkCodec to a newly-created SkAndroidCodec. - */ - static std::unique_ptr MakeFromCodec(std::unique_ptr); - - /** - * If this stream represents an encoded image that we know how to decode, - * return an SkAndroidCodec that can decode it. Otherwise return NULL. - * - * The SkPngChunkReader handles unknown chunks in PNGs. - * See SkCodec.h for more details. - * - * If NULL is returned, the stream is deleted immediately. Otherwise, the - * SkCodec takes ownership of it, and will delete it when done with it. - */ - static std::unique_ptr MakeFromStream(std::unique_ptr, - SkPngChunkReader* = nullptr); - - /** - * If this data represents an encoded image that we know how to decode, - * return an SkAndroidCodec that can decode it. Otherwise return NULL. - * - * The SkPngChunkReader handles unknown chunks in PNGs. - * See SkCodec.h for more details. - */ - static std::unique_ptr MakeFromData(sk_sp, SkPngChunkReader* = nullptr); - - virtual ~SkAndroidCodec(); - - // TODO: fInfo is now just a cache of SkCodec's SkImageInfo. No need to - // cache and return a reference here, once Android call-sites are updated. - const SkImageInfo& getInfo() const { return fInfo; } - - /** - * Return the ICC profile of the encoded data. - */ - const skcms_ICCProfile* getICCProfile() const { - return fCodec->getEncodedInfo().profile(); - } - - /** - * Format of the encoded data. - */ - SkEncodedImageFormat getEncodedFormat() const { return fCodec->getEncodedFormat(); } - - /** - * @param requestedColorType Color type requested by the client - * - * |requestedColorType| may be overriden. We will default to kF16 - * for high precision images. - * - * In the general case, if it is possible to decode to - * |requestedColorType|, this returns |requestedColorType|. - * Otherwise, this returns a color type that is an appropriate - * match for the the encoded data. - */ - SkColorType computeOutputColorType(SkColorType requestedColorType); - - /** - * @param requestedUnpremul Indicates if the client requested - * unpremultiplied output - * - * Returns the appropriate alpha type to decode to. If the image - * has alpha, the value of requestedUnpremul will be honored. - */ - SkAlphaType computeOutputAlphaType(bool requestedUnpremul); - - /** - * @param outputColorType Color type that the client will decode to. - * @param prefColorSpace Preferred color space to decode to. - * This may not return |prefColorSpace| for a couple reasons. - * (1) Android Principles: 565 must be sRGB, F16 must be - * linear sRGB, transfer function must be parametric. - * (2) Codec Limitations: F16 requires a linear color space. - * - * Returns the appropriate color space to decode to. - */ - sk_sp computeOutputColorSpace(SkColorType outputColorType, - sk_sp prefColorSpace = nullptr); - - /** - * Compute the appropriate sample size to get to |size|. - * - * @param size As an input parameter, the desired output size of - * the decode. As an output parameter, the smallest sampled size - * larger than the input. - * @return the sample size to set AndroidOptions::fSampleSize to decode - * to the output |size|. - */ - int computeSampleSize(SkISize* size) const; - - /** - * Returns the dimensions of the scaled output image, for an input - * sampleSize. - * - * When the sample size divides evenly into the original dimensions, the - * scaled output dimensions will simply be equal to the original - * dimensions divided by the sample size. - * - * When the sample size does not divide even into the original - * dimensions, the codec may round up or down, depending on what is most - * efficient to decode. - * - * Finally, the codec will always recommend a non-zero output, so the output - * dimension will always be one if the sampleSize is greater than the - * original dimension. - */ - SkISize getSampledDimensions(int sampleSize) const; - - /** - * Return (via desiredSubset) a subset which can decoded from this codec, - * or false if the input subset is invalid. - * - * @param desiredSubset in/out parameter - * As input, a desired subset of the original bounds - * (as specified by getInfo). - * As output, if true is returned, desiredSubset may - * have been modified to a subset which is - * supported. Although a particular change may have - * been made to desiredSubset to create something - * supported, it is possible other changes could - * result in a valid subset. If false is returned, - * desiredSubset's value is undefined. - * @return true If the input desiredSubset is valid. - * desiredSubset may be modified to a subset - * supported by the codec. - * false If desiredSubset is invalid (NULL or not fully - * contained within the image). - */ - bool getSupportedSubset(SkIRect* desiredSubset) const; - // TODO: Rename SkCodec::getValidSubset() to getSupportedSubset() - - /** - * Returns the dimensions of the scaled, partial output image, for an - * input sampleSize and subset. - * - * @param sampleSize Factor to scale down by. - * @param subset Must be a valid subset of the original image - * dimensions and a subset supported by SkAndroidCodec. - * getSubset() can be used to obtain a subset supported - * by SkAndroidCodec. - * @return Size of the scaled partial image. Or zero size - * if either of the inputs is invalid. - */ - SkISize getSampledSubsetDimensions(int sampleSize, const SkIRect& subset) const; - - /** - * Additional options to pass to getAndroidPixels(). - */ - // FIXME: It's a bit redundant to name these AndroidOptions when this class is already - // called SkAndroidCodec. On the other hand, it's may be a bit confusing to call - // these Options when SkCodec has a slightly different set of Options. Maybe these - // should be DecodeOptions or SamplingOptions? - struct AndroidOptions : public SkCodec::Options { - AndroidOptions() - : SkCodec::Options() - , fSampleSize(1) - {} - - /** - * The client may provide an integer downscale factor for the decode. - * The codec may implement this downscaling by sampling or another - * method if it is more efficient. - * - * The default is 1, representing no downscaling. - */ - int fSampleSize; - }; - - /** - * Decode into the given pixels, a block of memory of size at - * least (info.fHeight - 1) * rowBytes + (info.fWidth * - * bytesPerPixel) - * - * Repeated calls to this function should give the same results, - * allowing the PixelRef to be immutable. - * - * @param info A description of the format (config, size) - * expected by the caller. This can simply be identical - * to the info returned by getInfo(). - * - * This contract also allows the caller to specify - * different output-configs, which the implementation can - * decide to support or not. - * - * A size that does not match getInfo() implies a request - * to scale or subset. If the codec cannot perform this - * scaling or subsetting, it will return an error code. - * - * The AndroidOptions object is also used to specify any requested scaling or subsetting - * using options->fSampleSize and options->fSubset. If NULL, the defaults (as specified above - * for AndroidOptions) are used. - * - * @return Result kSuccess, or another value explaining the type of failure. - */ - // FIXME: It's a bit redundant to name this getAndroidPixels() when this class is already - // called SkAndroidCodec. On the other hand, it's may be a bit confusing to call - // this getPixels() when it is a slightly different API than SkCodec's getPixels(). - // Maybe this should be decode() or decodeSubset()? - SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, - const AndroidOptions* options); - - /** - * Simplified version of getAndroidPixels() where we supply the default AndroidOptions as - * specified above for AndroidOptions. It will not perform any scaling or subsetting. - */ - SkCodec::Result getAndroidPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); - - SkCodec::Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { - return this->getAndroidPixels(info, pixels, rowBytes); - } - - SkCodec* codec() const { return fCodec.get(); } - -protected: - SkAndroidCodec(SkCodec*); - - virtual SkISize onGetSampledDimensions(int sampleSize) const = 0; - - virtual bool onGetSupportedSubset(SkIRect* desiredSubset) const = 0; - - virtual SkCodec::Result onGetAndroidPixels(const SkImageInfo& info, void* pixels, - size_t rowBytes, const AndroidOptions& options) = 0; - -private: - const SkImageInfo fInfo; - std::unique_ptr fCodec; -}; -#endif // SkAndroidCodec_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodec.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodec.h deleted file mode 100644 index 5af847afcfe30a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodec.h +++ /dev/null @@ -1,1001 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCodec_DEFINED -#define SkCodec_DEFINED - -#include "include/codec/SkCodecAnimation.h" -#include "include/codec/SkEncodedOrigin.h" -#include "include/core/SkAlphaType.h" -#include "include/core/SkEncodedImageFormat.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" -#include "include/core/SkTypes.h" -#include "include/core/SkYUVAPixmaps.h" -#include "include/private/SkEncodedInfo.h" -#include "include/private/SkNoncopyable.h" -#include "modules/skcms/skcms.h" - -#include -#include -#include -#include - -class SkAndroidCodec; -class SkData; -class SkFrameHolder; -class SkImage; -class SkPngChunkReader; -class SkSampler; -class SkStream; - -namespace DM { -class CodecSrc; -} // namespace DM - -/** - * Abstraction layer directly on top of an image codec. - */ -class SK_API SkCodec : SkNoncopyable { -public: - /** - * Minimum number of bytes that must be buffered in SkStream input. - * - * An SkStream passed to NewFromStream must be able to use this many - * bytes to determine the image type. Then the same SkStream must be - * passed to the correct decoder to read from the beginning. - * - * This can be accomplished by implementing peek() to support peeking - * this many bytes, or by implementing rewind() to be able to rewind() - * after reading this many bytes. - */ - static constexpr size_t MinBufferedBytesNeeded() { return 32; } - - /** - * Error codes for various SkCodec methods. - */ - enum Result { - /** - * General return value for success. - */ - kSuccess, - /** - * The input is incomplete. A partial image was generated. - */ - kIncompleteInput, - /** - * Like kIncompleteInput, except the input had an error. - * - * If returned from an incremental decode, decoding cannot continue, - * even with more data. - */ - kErrorInInput, - /** - * The generator cannot convert to match the request, ignoring - * dimensions. - */ - kInvalidConversion, - /** - * The generator cannot scale to requested size. - */ - kInvalidScale, - /** - * Parameters (besides info) are invalid. e.g. NULL pixels, rowBytes - * too small, etc. - */ - kInvalidParameters, - /** - * The input did not contain a valid image. - */ - kInvalidInput, - /** - * Fulfilling this request requires rewinding the input, which is not - * supported for this input. - */ - kCouldNotRewind, - /** - * An internal error, such as OOM. - */ - kInternalError, - /** - * This method is not implemented by this codec. - * FIXME: Perhaps this should be kUnsupported? - */ - kUnimplemented, - }; - - /** - * Readable string representing the error code. - */ - static const char* ResultToString(Result); - - /** - * For container formats that contain both still images and image sequences, - * instruct the decoder how the output should be selected. (Refer to comments - * for each value for more details.) - */ - enum class SelectionPolicy { - /** - * If the container format contains both still images and image sequences, - * SkCodec should choose one of the still images. This is the default. - */ - kPreferStillImage, - /** - * If the container format contains both still images and image sequences, - * SkCodec should choose one of the image sequences for animation. - */ - kPreferAnimation, - }; - - /** - * If this stream represents an encoded image that we know how to decode, - * return an SkCodec that can decode it. Otherwise return NULL. - * - * As stated above, this call must be able to peek or read - * MinBufferedBytesNeeded to determine the correct format, and then start - * reading from the beginning. First it will attempt to peek, and it - * assumes that if less than MinBufferedBytesNeeded bytes (but more than - * zero) are returned, this is because the stream is shorter than this, - * so falling back to reading would not provide more data. If peek() - * returns zero bytes, this call will instead attempt to read(). This - * will require that the stream can be rewind()ed. - * - * If Result is not NULL, it will be set to either kSuccess if an SkCodec - * is returned or a reason for the failure if NULL is returned. - * - * If SkPngChunkReader is not NULL, take a ref and pass it to libpng if - * the image is a png. - * - * If the SkPngChunkReader is not NULL then: - * If the image is not a PNG, the SkPngChunkReader will be ignored. - * If the image is a PNG, the SkPngChunkReader will be reffed. - * If the PNG has unknown chunks, the SkPngChunkReader will be used - * to handle these chunks. SkPngChunkReader will be called to read - * any unknown chunk at any point during the creation of the codec - * or the decode. Note that if SkPngChunkReader fails to read a - * chunk, this could result in a failure to create the codec or a - * failure to decode the image. - * If the PNG does not contain unknown chunks, the SkPngChunkReader - * will not be used or modified. - * - * If NULL is returned, the stream is deleted immediately. Otherwise, the - * SkCodec takes ownership of it, and will delete it when done with it. - */ - static std::unique_ptr MakeFromStream( - std::unique_ptr, Result* = nullptr, - SkPngChunkReader* = nullptr, - SelectionPolicy selectionPolicy = SelectionPolicy::kPreferStillImage); - - /** - * If this data represents an encoded image that we know how to decode, - * return an SkCodec that can decode it. Otherwise return NULL. - * - * If the SkPngChunkReader is not NULL then: - * If the image is not a PNG, the SkPngChunkReader will be ignored. - * If the image is a PNG, the SkPngChunkReader will be reffed. - * If the PNG has unknown chunks, the SkPngChunkReader will be used - * to handle these chunks. SkPngChunkReader will be called to read - * any unknown chunk at any point during the creation of the codec - * or the decode. Note that if SkPngChunkReader fails to read a - * chunk, this could result in a failure to create the codec or a - * failure to decode the image. - * If the PNG does not contain unknown chunks, the SkPngChunkReader - * will not be used or modified. - */ - static std::unique_ptr MakeFromData(sk_sp, SkPngChunkReader* = nullptr); - - virtual ~SkCodec(); - - /** - * Return a reasonable SkImageInfo to decode into. - * - * If the image has an ICC profile that does not map to an SkColorSpace, - * the returned SkImageInfo will use SRGB. - */ - SkImageInfo getInfo() const { return fEncodedInfo.makeImageInfo(); } - - SkISize dimensions() const { return {fEncodedInfo.width(), fEncodedInfo.height()}; } - SkIRect bounds() const { - return SkIRect::MakeWH(fEncodedInfo.width(), fEncodedInfo.height()); - } - - /** - * Return the ICC profile of the encoded data. - */ - const skcms_ICCProfile* getICCProfile() const { - return this->getEncodedInfo().profile(); - } - - /** - * Returns the image orientation stored in the EXIF data. - * If there is no EXIF data, or if we cannot read the EXIF data, returns kTopLeft. - */ - SkEncodedOrigin getOrigin() const { return fOrigin; } - - /** - * Return a size that approximately supports the desired scale factor. - * The codec may not be able to scale efficiently to the exact scale - * factor requested, so return a size that approximates that scale. - * The returned value is the codec's suggestion for the closest valid - * scale that it can natively support - */ - SkISize getScaledDimensions(float desiredScale) const { - // Negative and zero scales are errors. - SkASSERT(desiredScale > 0.0f); - if (desiredScale <= 0.0f) { - return SkISize::Make(0, 0); - } - - // Upscaling is not supported. Return the original size if the client - // requests an upscale. - if (desiredScale >= 1.0f) { - return this->dimensions(); - } - return this->onGetScaledDimensions(desiredScale); - } - - /** - * Return (via desiredSubset) a subset which can decoded from this codec, - * or false if this codec cannot decode subsets or anything similar to - * desiredSubset. - * - * @param desiredSubset In/out parameter. As input, a desired subset of - * the original bounds (as specified by getInfo). If true is returned, - * desiredSubset may have been modified to a subset which is - * supported. Although a particular change may have been made to - * desiredSubset to create something supported, it is possible other - * changes could result in a valid subset. - * If false is returned, desiredSubset's value is undefined. - * @return true if this codec supports decoding desiredSubset (as - * returned, potentially modified) - */ - bool getValidSubset(SkIRect* desiredSubset) const { - return this->onGetValidSubset(desiredSubset); - } - - /** - * Format of the encoded data. - */ - SkEncodedImageFormat getEncodedFormat() const { return this->onGetEncodedFormat(); } - - /** - * Whether or not the memory passed to getPixels is zero initialized. - */ - enum ZeroInitialized { - /** - * The memory passed to getPixels is zero initialized. The SkCodec - * may take advantage of this by skipping writing zeroes. - */ - kYes_ZeroInitialized, - /** - * The memory passed to getPixels has not been initialized to zero, - * so the SkCodec must write all zeroes to memory. - * - * This is the default. It will be used if no Options struct is used. - */ - kNo_ZeroInitialized, - }; - - /** - * Additional options to pass to getPixels. - */ - struct Options { - Options() - : fZeroInitialized(kNo_ZeroInitialized) - , fSubset(nullptr) - , fFrameIndex(0) - , fPriorFrame(kNoFrame) - {} - - ZeroInitialized fZeroInitialized; - /** - * If not NULL, represents a subset of the original image to decode. - * Must be within the bounds returned by getInfo(). - * If the EncodedFormat is SkEncodedImageFormat::kWEBP (the only one which - * currently supports subsets), the top and left values must be even. - * - * In getPixels and incremental decode, we will attempt to decode the - * exact rectangular subset specified by fSubset. - * - * In a scanline decode, it does not make sense to specify a subset - * top or subset height, since the client already controls which rows - * to get and which rows to skip. During scanline decodes, we will - * require that the subset top be zero and the subset height be equal - * to the full height. We will, however, use the values of - * subset left and subset width to decode partial scanlines on calls - * to getScanlines(). - */ - const SkIRect* fSubset; - - /** - * The frame to decode. - * - * Only meaningful for multi-frame images. - */ - int fFrameIndex; - - /** - * If not kNoFrame, the dst already contains the prior frame at this index. - * - * Only meaningful for multi-frame images. - * - * If fFrameIndex needs to be blended with a prior frame (as reported by - * getFrameInfo[fFrameIndex].fRequiredFrame), the client can set this to - * any non-kRestorePrevious frame in [fRequiredFrame, fFrameIndex) to - * indicate that that frame is already in the dst. Options.fZeroInitialized - * is ignored in this case. - * - * If set to kNoFrame, the codec will decode any necessary required frame(s) first. - */ - int fPriorFrame; - }; - - /** - * Decode into the given pixels, a block of memory of size at - * least (info.fHeight - 1) * rowBytes + (info.fWidth * - * bytesPerPixel) - * - * Repeated calls to this function should give the same results, - * allowing the PixelRef to be immutable. - * - * @param info A description of the format (config, size) - * expected by the caller. This can simply be identical - * to the info returned by getInfo(). - * - * This contract also allows the caller to specify - * different output-configs, which the implementation can - * decide to support or not. - * - * A size that does not match getInfo() implies a request - * to scale. If the generator cannot perform this scale, - * it will return kInvalidScale. - * - * If the info contains a non-null SkColorSpace, the codec - * will perform the appropriate color space transformation. - * - * If the caller passes in the SkColorSpace that maps to the - * ICC profile reported by getICCProfile(), the color space - * transformation is a no-op. - * - * If the caller passes a null SkColorSpace, no color space - * transformation will be done. - * - * If a scanline decode is in progress, scanline mode will end, requiring the client to call - * startScanlineDecode() in order to return to decoding scanlines. - * - * @return Result kSuccess, or another value explaining the type of failure. - */ - Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, const Options*); - - /** - * Simplified version of getPixels() that uses the default Options. - */ - Result getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { - return this->getPixels(info, pixels, rowBytes, nullptr); - } - - Result getPixels(const SkPixmap& pm, const Options* opts = nullptr) { - return this->getPixels(pm.info(), pm.writable_addr(), pm.rowBytes(), opts); - } - - /** - * Return an image containing the pixels. - */ - std::tuple, SkCodec::Result> getImage(const SkImageInfo& info, - const Options* opts = nullptr); - std::tuple, SkCodec::Result> getImage(); - - /** - * If decoding to YUV is supported, this returns true. Otherwise, this - * returns false and the caller will ignore output parameter yuvaPixmapInfo. - * - * @param supportedDataTypes Indicates the data type/planar config combinations that are - * supported by the caller. If the generator supports decoding to - * YUV(A), but not as a type in supportedDataTypes, this method - * returns false. - * @param yuvaPixmapInfo Output parameter that specifies the planar configuration, subsampling, - * orientation, chroma siting, plane color types, and row bytes. - */ - bool queryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes& supportedDataTypes, - SkYUVAPixmapInfo* yuvaPixmapInfo) const; - - /** - * Returns kSuccess, or another value explaining the type of failure. - * This always attempts to perform a full decode. To get the planar - * configuration without decoding use queryYUVAInfo(). - * - * @param yuvaPixmaps Contains preallocated pixmaps configured according to a successful call - * to queryYUVAInfo(). - */ - Result getYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps); - - /** - * Prepare for an incremental decode with the specified options. - * - * This may require a rewind. - * - * If kIncompleteInput is returned, may be called again after more data has - * been provided to the source SkStream. - * - * @param dstInfo Info of the destination. If the dimensions do not match - * those of getInfo, this implies a scale. - * @param dst Memory to write to. Needs to be large enough to hold the subset, - * if present, or the full image as described in dstInfo. - * @param options Contains decoding options, including if memory is zero - * initialized and whether to decode a subset. - * @return Enum representing success or reason for failure. - */ - Result startIncrementalDecode(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, - const Options*); - - Result startIncrementalDecode(const SkImageInfo& dstInfo, void* dst, size_t rowBytes) { - return this->startIncrementalDecode(dstInfo, dst, rowBytes, nullptr); - } - - /** - * Start/continue the incremental decode. - * - * Not valid to call before a call to startIncrementalDecode() returns - * kSuccess. - * - * If kIncompleteInput is returned, may be called again after more data has - * been provided to the source SkStream. - * - * Unlike getPixels and getScanlines, this does not do any filling. This is - * left up to the caller, since they may be skipping lines or continuing the - * decode later. In the latter case, they may choose to initialize all lines - * first, or only initialize the remaining lines after the first call. - * - * @param rowsDecoded Optional output variable returning the total number of - * lines initialized. Only meaningful if this method returns kIncompleteInput. - * Otherwise the implementation may not set it. - * Note that some implementations may have initialized this many rows, but - * not necessarily finished those rows (e.g. interlaced PNG). This may be - * useful for determining what rows the client needs to initialize. - * @return kSuccess if all lines requested in startIncrementalDecode have - * been completely decoded. kIncompleteInput otherwise. - */ - Result incrementalDecode(int* rowsDecoded = nullptr) { - if (!fStartedIncrementalDecode) { - return kInvalidParameters; - } - return this->onIncrementalDecode(rowsDecoded); - } - - /** - * The remaining functions revolve around decoding scanlines. - */ - - /** - * Prepare for a scanline decode with the specified options. - * - * After this call, this class will be ready to decode the first scanline. - * - * This must be called in order to call getScanlines or skipScanlines. - * - * This may require rewinding the stream. - * - * Not all SkCodecs support this. - * - * @param dstInfo Info of the destination. If the dimensions do not match - * those of getInfo, this implies a scale. - * @param options Contains decoding options, including if memory is zero - * initialized. - * @return Enum representing success or reason for failure. - */ - Result startScanlineDecode(const SkImageInfo& dstInfo, const Options* options); - - /** - * Simplified version of startScanlineDecode() that uses the default Options. - */ - Result startScanlineDecode(const SkImageInfo& dstInfo) { - return this->startScanlineDecode(dstInfo, nullptr); - } - - /** - * Write the next countLines scanlines into dst. - * - * Not valid to call before calling startScanlineDecode(). - * - * @param dst Must be non-null, and large enough to hold countLines - * scanlines of size rowBytes. - * @param countLines Number of lines to write. - * @param rowBytes Number of bytes per row. Must be large enough to hold - * a scanline based on the SkImageInfo used to create this object. - * @return the number of lines successfully decoded. If this value is - * less than countLines, this will fill the remaining lines with a - * default value. - */ - int getScanlines(void* dst, int countLines, size_t rowBytes); - - /** - * Skip count scanlines. - * - * Not valid to call before calling startScanlineDecode(). - * - * The default version just calls onGetScanlines and discards the dst. - * NOTE: If skipped lines are the only lines with alpha, this default - * will make reallyHasAlpha return true, when it could have returned - * false. - * - * @return true if the scanlines were successfully skipped - * false on failure, possible reasons for failure include: - * An incomplete input image stream. - * Calling this function before calling startScanlineDecode(). - * If countLines is less than zero or so large that it moves - * the current scanline past the end of the image. - */ - bool skipScanlines(int countLines); - - /** - * The order in which rows are output from the scanline decoder is not the - * same for all variations of all image types. This explains the possible - * output row orderings. - */ - enum SkScanlineOrder { - /* - * By far the most common, this indicates that the image can be decoded - * reliably using the scanline decoder, and that rows will be output in - * the logical order. - */ - kTopDown_SkScanlineOrder, - - /* - * This indicates that the scanline decoder reliably outputs rows, but - * they will be returned in reverse order. If the scanline format is - * kBottomUp, the nextScanline() API can be used to determine the actual - * y-coordinate of the next output row, but the client is not forced - * to take advantage of this, given that it's not too tough to keep - * track independently. - * - * For full image decodes, it is safe to get all of the scanlines at - * once, since the decoder will handle inverting the rows as it - * decodes. - * - * For subset decodes and sampling, it is simplest to get and skip - * scanlines one at a time, using the nextScanline() API. It is - * possible to ask for larger chunks at a time, but this should be used - * with caution. As with full image decodes, the decoder will handle - * inverting the requested rows, but rows will still be delivered - * starting from the bottom of the image. - * - * Upside down bmps are an example. - */ - kBottomUp_SkScanlineOrder, - }; - - /** - * An enum representing the order in which scanlines will be returned by - * the scanline decoder. - * - * This is undefined before startScanlineDecode() is called. - */ - SkScanlineOrder getScanlineOrder() const { return this->onGetScanlineOrder(); } - - /** - * Returns the y-coordinate of the next row to be returned by the scanline - * decoder. - * - * This will equal fCurrScanline, except in the case of strangely - * encoded image types (bottom-up bmps). - * - * Results are undefined when not in scanline decoding mode. - */ - int nextScanline() const { return this->outputScanline(fCurrScanline); } - - /** - * Returns the output y-coordinate of the row that corresponds to an input - * y-coordinate. The input y-coordinate represents where the scanline - * is located in the encoded data. - * - * This will equal inputScanline, except in the case of strangely - * encoded image types (bottom-up bmps, interlaced gifs). - */ - int outputScanline(int inputScanline) const; - - /** - * Return the number of frames in the image. - * - * May require reading through the stream. - */ - int getFrameCount() { - return this->onGetFrameCount(); - } - - // Sentinel value used when a frame index implies "no frame": - // - FrameInfo::fRequiredFrame set to this value means the frame - // is independent. - // - Options::fPriorFrame set to this value means no (relevant) prior frame - // is residing in dst's memory. - static constexpr int kNoFrame = -1; - - // This transitional definition was added in August 2018, and will eventually be removed. -#ifdef SK_LEGACY_SKCODEC_NONE_ENUM - static constexpr int kNone = kNoFrame; -#endif - - /** - * Information about individual frames in a multi-framed image. - */ - struct FrameInfo { - /** - * The frame that this frame needs to be blended with, or - * kNoFrame if this frame is independent (so it can be - * drawn over an uninitialized buffer). - * - * Note that this is the *earliest* frame that can be used - * for blending. Any frame from [fRequiredFrame, i) can be - * used, unless its fDisposalMethod is kRestorePrevious. - */ - int fRequiredFrame; - - /** - * Number of milliseconds to show this frame. - */ - int fDuration; - - /** - * Whether the end marker for this frame is contained in the stream. - * - * Note: this does not guarantee that an attempt to decode will be complete. - * There could be an error in the stream. - */ - bool fFullyReceived; - - /** - * This is conservative; it will still return non-opaque if e.g. a - * color index-based frame has a color with alpha but does not use it. - */ - SkAlphaType fAlphaType; - - /** - * Whether the updated rectangle contains alpha. - * - * This is conservative; it will still be set to true if e.g. a color - * index-based frame has a color with alpha but does not use it. In - * addition, it may be set to true, even if the final frame, after - * blending, is opaque. - */ - bool fHasAlphaWithinBounds; - - /** - * How this frame should be modified before decoding the next one. - */ - SkCodecAnimation::DisposalMethod fDisposalMethod; - - /** - * How this frame should blend with the prior frame. - */ - SkCodecAnimation::Blend fBlend; - - /** - * The rectangle updated by this frame. - * - * It may be empty, if the frame does not change the image. It will - * always be contained by SkCodec::dimensions(). - */ - SkIRect fFrameRect; - }; - - /** - * Return info about a single frame. - * - * Does not read through the stream, so it should be called after - * getFrameCount() to parse any frames that have not already been parsed. - * - * Only supported by animated (multi-frame) codecs. Note that this is a - * property of the codec (the SkCodec subclass), not the image. - * - * To elaborate, some codecs support animation (e.g. GIF). Others do not - * (e.g. BMP). Animated codecs can still represent single frame images. - * Calling getFrameInfo(0, etc) will return true for a single frame GIF - * even if the overall image is not animated (in that the pixels on screen - * do not change over time). When incrementally decoding a GIF image, we - * might only know that there's a single frame *so far*. - * - * For non-animated SkCodec subclasses, it's sufficient but not necessary - * for this method to always return false. - */ - bool getFrameInfo(int index, FrameInfo* info) const { - if (index < 0) { - return false; - } - return this->onGetFrameInfo(index, info); - } - - /** - * Return info about all the frames in the image. - * - * May require reading through the stream to determine info about the - * frames (including the count). - * - * As such, future decoding calls may require a rewind. - * - * This may return an empty vector for non-animated codecs. See the - * getFrameInfo(int, FrameInfo*) comment. - */ - std::vector getFrameInfo(); - - static constexpr int kRepetitionCountInfinite = -1; - - /** - * Return the number of times to repeat, if this image is animated. This number does not - * include the first play through of each frame. For example, a repetition count of 4 means - * that each frame is played 5 times and then the animation stops. - * - * It can return kRepetitionCountInfinite, a negative number, meaning that the animation - * should loop forever. - * - * May require reading the stream to find the repetition count. - * - * As such, future decoding calls may require a rewind. - * - * For still (non-animated) image codecs, this will return 0. - */ - int getRepetitionCount() { - return this->onGetRepetitionCount(); - } - - // Register a decoder at runtime by passing two function pointers: - // - peek() to return true if the span of bytes appears to be your encoded format; - // - make() to attempt to create an SkCodec from the given stream. - // Not thread safe. - static void Register( - bool (*peek)(const void*, size_t), - std::unique_ptr (*make)(std::unique_ptr, SkCodec::Result*)); - -protected: - const SkEncodedInfo& getEncodedInfo() const { return fEncodedInfo; } - - using XformFormat = skcms_PixelFormat; - - SkCodec(SkEncodedInfo&&, - XformFormat srcFormat, - std::unique_ptr, - SkEncodedOrigin = kTopLeft_SkEncodedOrigin); - - void setSrcXformFormat(XformFormat pixelFormat); - - XformFormat getSrcXformFormat() const { - return fSrcXformFormat; - } - - virtual SkISize onGetScaledDimensions(float /*desiredScale*/) const { - // By default, scaling is not supported. - return this->dimensions(); - } - - // FIXME: What to do about subsets?? - /** - * Subclasses should override if they support dimensions other than the - * srcInfo's. - */ - virtual bool onDimensionsSupported(const SkISize&) { - return false; - } - - virtual SkEncodedImageFormat onGetEncodedFormat() const = 0; - - /** - * @param rowsDecoded When the encoded image stream is incomplete, this function - * will return kIncompleteInput and rowsDecoded will be set to - * the number of scanlines that were successfully decoded. - * This will allow getPixels() to fill the uninitialized memory. - */ - virtual Result onGetPixels(const SkImageInfo& info, - void* pixels, size_t rowBytes, const Options&, - int* rowsDecoded) = 0; - - virtual bool onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes&, - SkYUVAPixmapInfo*) const { return false; } - - virtual Result onGetYUVAPlanes(const SkYUVAPixmaps&) { return kUnimplemented; } - - virtual bool onGetValidSubset(SkIRect* /*desiredSubset*/) const { - // By default, subsets are not supported. - return false; - } - - /** - * If the stream was previously read, attempt to rewind. - * - * If the stream needed to be rewound, call onRewind. - * @returns true if the codec is at the right position and can be used. - * false if there was a failure to rewind. - * - * This is called by getPixels(), getYUV8Planes(), startIncrementalDecode() and - * startScanlineDecode(). Subclasses may call if they need to rewind at another time. - */ - bool SK_WARN_UNUSED_RESULT rewindIfNeeded(); - - /** - * Called by rewindIfNeeded, if the stream needed to be rewound. - * - * Subclasses should do any set up needed after a rewind. - */ - virtual bool onRewind() { - return true; - } - - /** - * Get method for the input stream - */ - SkStream* stream() { - return fStream.get(); - } - - /** - * The remaining functions revolve around decoding scanlines. - */ - - /** - * Most images types will be kTopDown and will not need to override this function. - */ - virtual SkScanlineOrder onGetScanlineOrder() const { return kTopDown_SkScanlineOrder; } - - const SkImageInfo& dstInfo() const { return fDstInfo; } - - const Options& options() const { return fOptions; } - - /** - * Returns the number of scanlines that have been decoded so far. - * This is unaffected by the SkScanlineOrder. - * - * Returns -1 if we have not started a scanline decode. - */ - int currScanline() const { return fCurrScanline; } - - virtual int onOutputScanline(int inputScanline) const; - - /** - * Return whether we can convert to dst. - * - * Will be called for the appropriate frame, prior to initializing the colorXform. - */ - virtual bool conversionSupported(const SkImageInfo& dst, bool srcIsOpaque, - bool needsColorXform); - - // Some classes never need a colorXform e.g. - // - ICO uses its embedded codec's colorXform - // - WBMP is just Black/White - virtual bool usesColorXform() const { return true; } - void applyColorXform(void* dst, const void* src, int count) const; - - bool colorXform() const { return fXformTime != kNo_XformTime; } - bool xformOnDecode() const { return fXformTime == kDecodeRow_XformTime; } - - virtual int onGetFrameCount() { - return 1; - } - - virtual bool onGetFrameInfo(int, FrameInfo*) const { - return false; - } - - virtual int onGetRepetitionCount() { - return 0; - } - -private: - const SkEncodedInfo fEncodedInfo; - XformFormat fSrcXformFormat; - std::unique_ptr fStream; - bool fNeedsRewind; - const SkEncodedOrigin fOrigin; - - SkImageInfo fDstInfo; - Options fOptions; - - enum XformTime { - kNo_XformTime, - kPalette_XformTime, - kDecodeRow_XformTime, - }; - XformTime fXformTime; - XformFormat fDstXformFormat; // Based on fDstInfo. - skcms_ICCProfile fDstProfile; - skcms_AlphaFormat fDstXformAlphaFormat; - - // Only meaningful during scanline decodes. - int fCurrScanline; - - bool fStartedIncrementalDecode; - - // Allows SkAndroidCodec to call handleFrameIndex (potentially decoding a prior frame and - // clearing to transparent) without SkCodec calling it, too. - bool fAndroidCodecHandlesFrameIndex; - - bool initializeColorXform(const SkImageInfo& dstInfo, SkEncodedInfo::Alpha, bool srcIsOpaque); - - /** - * Return whether these dimensions are supported as a scale. - * - * The codec may choose to cache the information about scale and subset. - * Either way, the same information will be passed to onGetPixels/onStart - * on success. - * - * This must return true for a size returned from getScaledDimensions. - */ - bool dimensionsSupported(const SkISize& dim) { - return dim == this->dimensions() || this->onDimensionsSupported(dim); - } - - /** - * For multi-framed images, return the object with information about the frames. - */ - virtual const SkFrameHolder* getFrameHolder() const { - return nullptr; - } - - /** - * Check for a valid Options.fFrameIndex, and decode prior frames if necessary. - * - * If androidCodec is not null, that means this SkCodec is owned by an SkAndroidCodec. In that - * case, the Options will be treated as an AndroidOptions, and SkAndroidCodec will be used to - * decode a prior frame, if a prior frame is needed. When such an owned SkCodec calls - * handleFrameIndex, it will immediately return kSuccess, since SkAndroidCodec already handled - * it. - */ - Result handleFrameIndex(const SkImageInfo&, void* pixels, size_t rowBytes, const Options&, - SkAndroidCodec* androidCodec = nullptr); - - // Methods for scanline decoding. - virtual Result onStartScanlineDecode(const SkImageInfo& /*dstInfo*/, - const Options& /*options*/) { - return kUnimplemented; - } - - virtual Result onStartIncrementalDecode(const SkImageInfo& /*dstInfo*/, void*, size_t, - const Options&) { - return kUnimplemented; - } - - virtual Result onIncrementalDecode(int*) { - return kUnimplemented; - } - - - virtual bool onSkipScanlines(int /*countLines*/) { return false; } - - virtual int onGetScanlines(void* /*dst*/, int /*countLines*/, size_t /*rowBytes*/) { return 0; } - - /** - * On an incomplete decode, getPixels() and getScanlines() will call this function - * to fill any uinitialized memory. - * - * @param dstInfo Contains the destination color type - * Contains the destination alpha type - * Contains the destination width - * The height stored in this info is unused - * @param dst Pointer to the start of destination pixel memory - * @param rowBytes Stride length in destination pixel memory - * @param zeroInit Indicates if memory is zero initialized - * @param linesRequested Number of lines that the client requested - * @param linesDecoded Number of lines that were successfully decoded - */ - void fillIncompleteImage(const SkImageInfo& dstInfo, void* dst, size_t rowBytes, - ZeroInitialized zeroInit, int linesRequested, int linesDecoded); - - /** - * Return an object which will allow forcing scanline decodes to sample in X. - * - * May create a sampler, if one is not currently being used. Otherwise, does - * not affect ownership. - * - * Only valid during scanline decoding or incremental decoding. - */ - virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr; } - - friend class DM::CodecSrc; // for fillIncompleteImage - friend class SkSampledCodec; - friend class SkIcoCodec; - friend class SkAndroidCodec; // for fEncodedInfo -}; -#endif // SkCodec_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodecAnimation.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodecAnimation.h deleted file mode 100644 index c5883e2af2c094..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkCodecAnimation.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCodecAnimation_DEFINED -#define SkCodecAnimation_DEFINED - -namespace SkCodecAnimation { - /** - * This specifies how the next frame is based on this frame. - * - * Names are based on the GIF 89a spec. - * - * The numbers correspond to values in a GIF. - */ - enum class DisposalMethod { - /** - * The next frame should be drawn on top of this one. - * - * In a GIF, a value of 0 (not specified) is also treated as Keep. - */ - kKeep = 1, - - /** - * Similar to Keep, except the area inside this frame's rectangle - * should be cleared to the BackGround color (transparent) before - * drawing the next frame. - */ - kRestoreBGColor = 2, - - /** - * The next frame should be drawn on top of the previous frame - i.e. - * disregarding this one. - * - * In a GIF, a value of 4 is also treated as RestorePrevious. - */ - kRestorePrevious = 3, - }; - - /** - * How to blend the current frame. - */ - enum class Blend { - /** - * Blend with the prior frame as if using SkBlendMode::kSrcOver. - */ - kSrcOver, - - /** - * Blend with the prior frame as if using SkBlendMode::kSrc. - * - * This frame's pixels replace the destination pixels. - */ - kSrc, - }; - -} // namespace SkCodecAnimation -#endif // SkCodecAnimation_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkEncodedOrigin.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkEncodedOrigin.h deleted file mode 100644 index 19d083672f6b97..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/codec/SkEncodedOrigin.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkEncodedOrigin_DEFINED -#define SkEncodedOrigin_DEFINED - -#include "include/core/SkMatrix.h" - -// These values match the orientation www.exif.org/Exif2-2.PDF. -enum SkEncodedOrigin { - kTopLeft_SkEncodedOrigin = 1, // Default - kTopRight_SkEncodedOrigin = 2, // Reflected across y-axis - kBottomRight_SkEncodedOrigin = 3, // Rotated 180 - kBottomLeft_SkEncodedOrigin = 4, // Reflected across x-axis - kLeftTop_SkEncodedOrigin = 5, // Reflected across x-axis, Rotated 90 CCW - kRightTop_SkEncodedOrigin = 6, // Rotated 90 CW - kRightBottom_SkEncodedOrigin = 7, // Reflected across x-axis, Rotated 90 CW - kLeftBottom_SkEncodedOrigin = 8, // Rotated 90 CCW - kDefault_SkEncodedOrigin = kTopLeft_SkEncodedOrigin, - kLast_SkEncodedOrigin = kLeftBottom_SkEncodedOrigin, -}; - -/** - * Given an encoded origin and the width and height of the source data, returns a matrix - * that transforms the source rectangle with upper left corner at [0, 0] and origin to a correctly - * oriented destination rectangle of [0, 0, w, h]. - */ -static inline SkMatrix SkEncodedOriginToMatrix(SkEncodedOrigin origin, int w, int h) { - switch (origin) { - case kTopLeft_SkEncodedOrigin: return SkMatrix::I(); - case kTopRight_SkEncodedOrigin: return SkMatrix::MakeAll(-1, 0, w, 0, 1, 0, 0, 0, 1); - case kBottomRight_SkEncodedOrigin: return SkMatrix::MakeAll(-1, 0, w, 0, -1, h, 0, 0, 1); - case kBottomLeft_SkEncodedOrigin: return SkMatrix::MakeAll( 1, 0, 0, 0, -1, h, 0, 0, 1); - case kLeftTop_SkEncodedOrigin: return SkMatrix::MakeAll( 0, 1, 0, 1, 0, 0, 0, 0, 1); - case kRightTop_SkEncodedOrigin: return SkMatrix::MakeAll( 0, -1, w, 1, 0, 0, 0, 0, 1); - case kRightBottom_SkEncodedOrigin: return SkMatrix::MakeAll( 0, -1, w, -1, 0, h, 0, 0, 1); - case kLeftBottom_SkEncodedOrigin: return SkMatrix::MakeAll( 0, 1, 0, -1, 0, h, 0, 0, 1); - } - SK_ABORT("Unexpected origin"); -} - -/** - * Return true if the encoded origin includes a 90 degree rotation, in which case the width - * and height of the source data are swapped relative to a correctly oriented destination. - */ -static inline bool SkEncodedOriginSwapsWidthHeight(SkEncodedOrigin origin) { - return origin >= kLeftTop_SkEncodedOrigin; -} - -#endif // SkEncodedOrigin_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/config/SkUserConfig.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/config/SkUserConfig.h deleted file mode 100644 index 313d324e405b8b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/config/SkUserConfig.h +++ /dev/null @@ -1,89 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkUserConfig_DEFINED -#define SkUserConfig_DEFINED - -/* SkTypes.h, the root of the public header files, includes this file - SkUserConfig.h after first initializing certain Skia defines, letting - this file change or augment those flags. - - Below are optional defines that add, subtract, or change default behavior - in Skia. Your port can locally edit this file to enable/disable flags as - you choose, or these can be delared on your command line (i.e. -Dfoo). - - By default, this include file will always default to having all of the flags - commented out, so including it will have no effect. -*/ - -/////////////////////////////////////////////////////////////////////////////// - -/* Skia has lots of debug-only code. Often this is just null checks or other - parameter checking, but sometimes it can be quite intrusive (e.g. check that - each 32bit pixel is in premultiplied form). This code can be very useful - during development, but will slow things down in a shipping product. - - By default, these mutually exclusive flags are defined in SkTypes.h, - based on the presence or absence of NDEBUG, but that decision can be changed - here. - */ -//#define SK_DEBUG -//#define SK_RELEASE - -/* To write debug messages to a console, skia will call SkDebugf(...) following - printf conventions (e.g. const char* format, ...). If you want to redirect - this to something other than printf, define yours here - */ -//#define SkDebugf(...) MyFunction(__VA_ARGS__) - -/* - * To specify a different default font cache limit, define this. If this is - * undefined, skia will use a built-in value. - */ -//#define SK_DEFAULT_FONT_CACHE_LIMIT (1024 * 1024) - -/* - * To specify the default size of the image cache, undefine this and set it to - * the desired value (in bytes). SkGraphics.h as a runtime API to set this - * value as well. If this is undefined, a built-in value will be used. - */ -//#define SK_DEFAULT_IMAGE_CACHE_LIMIT (1024 * 1024) - -/* Define this to set the upper limit for text to support LCD. Values that - are very large increase the cost in the font cache and draw slower, without - improving readability. If this is undefined, Skia will use its default - value (e.g. 48) - */ -//#define SK_MAX_SIZE_FOR_LCDTEXT 48 - -/* Change the kN32_SkColorType ordering to BGRA to work in X windows. - */ -//#define SK_R32_SHIFT 16 - - -/* Determines whether to build code that supports the GPU backend. Some classes - that are not GPU-specific, such as SkShader subclasses, have optional code - that is used allows them to interact with the GPU backend. If you'd like to - omit this code set SK_SUPPORT_GPU to 0. This also allows you to omit the gpu - directories from your include search path when you're not building the GPU - backend. Defaults to 1 (build the GPU code). - */ -//#define SK_SUPPORT_GPU 1 - -/* Skia makes use of histogram logging macros to trace the frequency of - * events. By default, Skia provides no-op versions of these macros. - * Skia consumers can provide their own definitions of these macros to - * integrate with their histogram collection backend. - */ -//#define SK_HISTOGRAM_BOOLEAN(name, sample) -//#define SK_HISTOGRAM_ENUMERATION(name, sample, enum_size) -//#define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) -//#define SK_HISTOGRAM_MEMORY_KB(name, sample) - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAlphaType.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAlphaType.h deleted file mode 100644 index 0c99906dfd54bc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAlphaType.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAlphaType_DEFINED -#define SkAlphaType_DEFINED - -/** \enum SkAlphaType - Describes how to interpret the alpha component of a pixel. A pixel may - be opaque, or alpha, describing multiple levels of transparency. - - In simple blending, alpha weights the draw color and the destination - color to create a new color. If alpha describes a weight from zero to one: - - new color = draw color * alpha + destination color * (1 - alpha) - - In practice alpha is encoded in two or more bits, where 1.0 equals all bits set. - - RGB may have alpha included in each component value; the stored - value is the original RGB multiplied by alpha. Premultiplied color - components improve performance. -*/ -enum SkAlphaType : int { - kUnknown_SkAlphaType, //!< uninitialized - kOpaque_SkAlphaType, //!< pixel is opaque - kPremul_SkAlphaType, //!< pixel components are premultiplied by alpha - kUnpremul_SkAlphaType, //!< pixel components are independent of alpha - kLastEnum_SkAlphaType = kUnpremul_SkAlphaType, //!< last valid value -}; - -/** Returns true if SkAlphaType equals kOpaque_SkAlphaType. - - kOpaque_SkAlphaType is a hint that the SkColorType is opaque, or that all - alpha values are set to their 1.0 equivalent. If SkAlphaType is - kOpaque_SkAlphaType, and SkColorType is not opaque, then the result of - drawing any pixel with a alpha value less than 1.0 is undefined. -*/ -static inline bool SkAlphaTypeIsOpaque(SkAlphaType at) { - return kOpaque_SkAlphaType == at; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAnnotation.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAnnotation.h deleted file mode 100644 index 2006f309e9428d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkAnnotation.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAnnotation_DEFINED -#define SkAnnotation_DEFINED - -#include "include/core/SkTypes.h" - -class SkData; -struct SkPoint; -struct SkRect; -class SkCanvas; - -/** - * Annotate the canvas by associating the specified URL with the - * specified rectangle (in local coordinates, just like drawRect). - * - * The URL is expected to be escaped and be valid 7-bit ASCII. - * - * If the backend of this canvas does not support annotations, this call is - * safely ignored. - * - * The caller is responsible for managing its ownership of the SkData. - */ -SK_API void SkAnnotateRectWithURL(SkCanvas*, const SkRect&, SkData*); - -/** - * Annotate the canvas by associating a name with the specified point. - * - * If the backend of this canvas does not support annotations, this call is - * safely ignored. - * - * The caller is responsible for managing its ownership of the SkData. - */ -SK_API void SkAnnotateNamedDestination(SkCanvas*, const SkPoint&, SkData*); - -/** - * Annotate the canvas by making the specified rectangle link to a named - * destination. - * - * If the backend of this canvas does not support annotations, this call is - * safely ignored. - * - * The caller is responsible for managing its ownership of the SkData. - */ -SK_API void SkAnnotateLinkToDestination(SkCanvas*, const SkRect&, SkData*); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBBHFactory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBBHFactory.h deleted file mode 100644 index 2507d0f15073ab..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBBHFactory.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBBHFactory_DEFINED -#define SkBBHFactory_DEFINED - -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" -#include - -class SkBBoxHierarchy : public SkRefCnt { -public: - struct Metadata { - bool isDraw; // The corresponding SkRect bounds a draw command, not a pure state change. - }; - - /** - * Insert N bounding boxes into the hierarchy. - */ - virtual void insert(const SkRect[], int N) = 0; - virtual void insert(const SkRect[], const Metadata[], int N); - - /** - * Populate results with the indices of bounding boxes intersecting that query. - */ - virtual void search(const SkRect& query, std::vector* results) const = 0; - - /** - * Return approximate size in memory of *this. - */ - virtual size_t bytesUsed() const = 0; - -protected: - SkBBoxHierarchy() = default; - SkBBoxHierarchy(const SkBBoxHierarchy&) = delete; - SkBBoxHierarchy& operator=(const SkBBoxHierarchy&) = delete; -}; - -class SK_API SkBBHFactory { -public: - /** - * Allocate a new SkBBoxHierarchy. Return NULL on failure. - */ - virtual sk_sp operator()() const = 0; - virtual ~SkBBHFactory() {} - -protected: - SkBBHFactory() = default; - SkBBHFactory(const SkBBHFactory&) = delete; - SkBBHFactory& operator=(const SkBBHFactory&) = delete; -}; - -class SK_API SkRTreeFactory : public SkBBHFactory { -public: - sk_sp operator()() const override; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBitmap.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBitmap.h deleted file mode 100644 index 658f20716e7e5b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBitmap.h +++ /dev/null @@ -1,1265 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBitmap_DEFINED -#define SkBitmap_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkPoint.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkShader.h" -#include "include/core/SkTileMode.h" - -class SkBitmap; -class SkColorSpace; -struct SkMask; -class SkMipmap; -struct SkIRect; -struct SkRect; -class SkPaint; -class SkPixelRef; -class SkShader; - -/** \class SkBitmap - SkBitmap describes a two-dimensional raster pixel array. SkBitmap is built on - SkImageInfo, containing integer width and height, SkColorType and SkAlphaType - describing the pixel format, and SkColorSpace describing the range of colors. - SkBitmap points to SkPixelRef, which describes the physical array of pixels. - SkImageInfo bounds may be located anywhere fully inside SkPixelRef bounds. - - SkBitmap can be drawn using SkCanvas. SkBitmap can be a drawing destination for SkCanvas - draw member functions. SkBitmap flexibility as a pixel container limits some - optimizations available to the target platform. - - If pixel array is primarily read-only, use SkImage for better performance. - If pixel array is primarily written to, use SkSurface for better performance. - - Declaring SkBitmap const prevents altering SkImageInfo: the SkBitmap height, width, - and so on cannot change. It does not affect SkPixelRef: a caller may write its - pixels. Declaring SkBitmap const affects SkBitmap configuration, not its contents. - - SkBitmap is not thread safe. Each thread must have its own copy of SkBitmap fields, - although threads may share the underlying pixel array. -*/ -class SK_API SkBitmap { -public: - class SK_API Allocator; - - /** Creates an empty SkBitmap without pixels, with kUnknown_SkColorType, - kUnknown_SkAlphaType, and with a width and height of zero. SkPixelRef origin is - set to (0, 0). - - Use setInfo() to associate SkColorType, SkAlphaType, width, and height - after SkBitmap has been created. - - @return empty SkBitmap - - example: https://fiddle.skia.org/c/@Bitmap_empty_constructor - */ - SkBitmap(); - - /** Copies settings from src to returned SkBitmap. Shares pixels if src has pixels - allocated, so both bitmaps reference the same pixels. - - @param src SkBitmap to copy SkImageInfo, and share SkPixelRef - @return copy of src - - example: https://fiddle.skia.org/c/@Bitmap_copy_const_SkBitmap - */ - SkBitmap(const SkBitmap& src); - - /** Copies settings from src to returned SkBitmap. Moves ownership of src pixels to - SkBitmap. - - @param src SkBitmap to copy SkImageInfo, and reassign SkPixelRef - @return copy of src - - example: https://fiddle.skia.org/c/@Bitmap_move_SkBitmap - */ - SkBitmap(SkBitmap&& src); - - /** Decrements SkPixelRef reference count, if SkPixelRef is not nullptr. - */ - ~SkBitmap(); - - /** Copies settings from src to returned SkBitmap. Shares pixels if src has pixels - allocated, so both bitmaps reference the same pixels. - - @param src SkBitmap to copy SkImageInfo, and share SkPixelRef - @return copy of src - - example: https://fiddle.skia.org/c/@Bitmap_copy_operator - */ - SkBitmap& operator=(const SkBitmap& src); - - /** Copies settings from src to returned SkBitmap. Moves ownership of src pixels to - SkBitmap. - - @param src SkBitmap to copy SkImageInfo, and reassign SkPixelRef - @return copy of src - - example: https://fiddle.skia.org/c/@Bitmap_move_operator - */ - SkBitmap& operator=(SkBitmap&& src); - - /** Swaps the fields of the two bitmaps. - - @param other SkBitmap exchanged with original - - example: https://fiddle.skia.org/c/@Bitmap_swap - */ - void swap(SkBitmap& other); - - /** Returns a constant reference to the SkPixmap holding the SkBitmap pixel - address, row bytes, and SkImageInfo. - - @return reference to SkPixmap describing this SkBitmap - */ - const SkPixmap& pixmap() const { return fPixmap; } - - /** Returns width, height, SkAlphaType, SkColorType, and SkColorSpace. - - @return reference to SkImageInfo - */ - const SkImageInfo& info() const { return fPixmap.info(); } - - /** Returns pixel count in each row. Should be equal or less than - rowBytes() / info().bytesPerPixel(). - - May be less than pixelRef().width(). Will not exceed pixelRef().width() less - pixelRefOrigin().fX. - - @return pixel width in SkImageInfo - */ - int width() const { return fPixmap.width(); } - - /** Returns pixel row count. - - Maybe be less than pixelRef().height(). Will not exceed pixelRef().height() less - pixelRefOrigin().fY. - - @return pixel height in SkImageInfo - */ - int height() const { return fPixmap.height(); } - - SkColorType colorType() const { return fPixmap.colorType(); } - - SkAlphaType alphaType() const { return fPixmap.alphaType(); } - - /** Returns SkColorSpace, the range of colors, associated with SkImageInfo. The - reference count of SkColorSpace is unchanged. The returned SkColorSpace is - immutable. - - @return SkColorSpace in SkImageInfo, or nullptr - */ - SkColorSpace* colorSpace() const; - - /** Returns smart pointer to SkColorSpace, the range of colors, associated with - SkImageInfo. The smart pointer tracks the number of objects sharing this - SkColorSpace reference so the memory is released when the owners destruct. - - The returned SkColorSpace is immutable. - - @return SkColorSpace in SkImageInfo wrapped in a smart pointer - */ - sk_sp refColorSpace() const; - - /** Returns number of bytes per pixel required by SkColorType. - Returns zero if colorType( is kUnknown_SkColorType. - - @return bytes in pixel - */ - int bytesPerPixel() const { return fPixmap.info().bytesPerPixel(); } - - /** Returns number of pixels that fit on row. Should be greater than or equal to - width(). - - @return maximum pixels per row - */ - int rowBytesAsPixels() const { return fPixmap.rowBytesAsPixels(); } - - /** Returns bit shift converting row bytes to row pixels. - Returns zero for kUnknown_SkColorType. - - @return one of: 0, 1, 2, 3; left shift to convert pixels to bytes - */ - int shiftPerPixel() const { return fPixmap.shiftPerPixel(); } - - /** Returns true if either width() or height() are zero. - - Does not check if SkPixelRef is nullptr; call drawsNothing() to check width(), - height(), and SkPixelRef. - - @return true if dimensions do not enclose area - */ - bool empty() const { return fPixmap.info().isEmpty(); } - - /** Returns true if SkPixelRef is nullptr. - - Does not check if width() or height() are zero; call drawsNothing() to check - width(), height(), and SkPixelRef. - - @return true if no SkPixelRef is associated - */ - bool isNull() const { return nullptr == fPixelRef; } - - /** Returns true if width() or height() are zero, or if SkPixelRef is nullptr. - If true, SkBitmap has no effect when drawn or drawn into. - - @return true if drawing has no effect - */ - bool drawsNothing() const { - return this->empty() || this->isNull(); - } - - /** Returns row bytes, the interval from one pixel row to the next. Row bytes - is at least as large as: width() * info().bytesPerPixel(). - - Returns zero if colorType() is kUnknown_SkColorType, or if row bytes supplied to - setInfo() is not large enough to hold a row of pixels. - - @return byte length of pixel row - */ - size_t rowBytes() const { return fPixmap.rowBytes(); } - - /** Sets SkAlphaType, if alphaType is compatible with SkColorType. - Returns true unless alphaType is kUnknown_SkAlphaType and current SkAlphaType - is not kUnknown_SkAlphaType. - - Returns true if SkColorType is kUnknown_SkColorType. alphaType is ignored, and - SkAlphaType remains kUnknown_SkAlphaType. - - Returns true if SkColorType is kRGB_565_SkColorType or kGray_8_SkColorType. - alphaType is ignored, and SkAlphaType remains kOpaque_SkAlphaType. - - If SkColorType is kARGB_4444_SkColorType, kRGBA_8888_SkColorType, - kBGRA_8888_SkColorType, or kRGBA_F16_SkColorType: returns true unless - alphaType is kUnknown_SkAlphaType and SkAlphaType is not kUnknown_SkAlphaType. - If SkAlphaType is kUnknown_SkAlphaType, alphaType is ignored. - - If SkColorType is kAlpha_8_SkColorType, returns true unless - alphaType is kUnknown_SkAlphaType and SkAlphaType is not kUnknown_SkAlphaType. - If SkAlphaType is kUnknown_SkAlphaType, alphaType is ignored. If alphaType is - kUnpremul_SkAlphaType, it is treated as kPremul_SkAlphaType. - - This changes SkAlphaType in SkPixelRef; all bitmaps sharing SkPixelRef - are affected. - - @return true if SkAlphaType is set - - example: https://fiddle.skia.org/c/@Bitmap_setAlphaType - */ - bool setAlphaType(SkAlphaType alphaType); - - /** Returns pixel address, the base address corresponding to the pixel origin. - - @return pixel address - */ - void* getPixels() const { return fPixmap.writable_addr(); } - - /** Returns minimum memory required for pixel storage. - Does not include unused memory on last row when rowBytesAsPixels() exceeds width(). - Returns SIZE_MAX if result does not fit in size_t. - Returns zero if height() or width() is 0. - Returns height() times rowBytes() if colorType() is kUnknown_SkColorType. - - @return size in bytes of image buffer - */ - size_t computeByteSize() const { return fPixmap.computeByteSize(); } - - /** Returns true if pixels can not change. - - Most immutable SkBitmap checks trigger an assert only on debug builds. - - @return true if pixels are immutable - - example: https://fiddle.skia.org/c/@Bitmap_isImmutable - */ - bool isImmutable() const; - - /** Sets internal flag to mark SkBitmap as immutable. Once set, pixels can not change. - Any other bitmap sharing the same SkPixelRef are also marked as immutable. - Once SkPixelRef is marked immutable, the setting cannot be cleared. - - Writing to immutable SkBitmap pixels triggers an assert on debug builds. - - example: https://fiddle.skia.org/c/@Bitmap_setImmutable - */ - void setImmutable(); - - /** Returns true if SkAlphaType is set to hint that all pixels are opaque; their - alpha value is implicitly or explicitly 1.0. If true, and all pixels are - not opaque, Skia may draw incorrectly. - - Does not check if SkColorType allows alpha, or if any pixel value has - transparency. - - @return true if SkImageInfo SkAlphaType is kOpaque_SkAlphaType - */ - bool isOpaque() const { - return SkAlphaTypeIsOpaque(this->alphaType()); - } - - /** Resets to its initial state; all fields are set to zero, as if SkBitmap had - been initialized by SkBitmap(). - - Sets width, height, row bytes to zero; pixel address to nullptr; SkColorType to - kUnknown_SkColorType; and SkAlphaType to kUnknown_SkAlphaType. - - If SkPixelRef is allocated, its reference count is decreased by one, releasing - its memory if SkBitmap is the sole owner. - - example: https://fiddle.skia.org/c/@Bitmap_reset - */ - void reset(); - - /** Returns true if all pixels are opaque. SkColorType determines how pixels - are encoded, and whether pixel describes alpha. Returns true for SkColorType - without alpha in each pixel; for other SkColorType, returns true if all - pixels have alpha values equivalent to 1.0 or greater. - - For SkColorType kRGB_565_SkColorType or kGray_8_SkColorType: always - returns true. For SkColorType kAlpha_8_SkColorType, kBGRA_8888_SkColorType, - kRGBA_8888_SkColorType: returns true if all pixel alpha values are 255. - For SkColorType kARGB_4444_SkColorType: returns true if all pixel alpha values are 15. - For kRGBA_F16_SkColorType: returns true if all pixel alpha values are 1.0 or - greater. - - Returns false for kUnknown_SkColorType. - - @param bm SkBitmap to check - @return true if all pixels have opaque values or SkColorType is opaque - */ - static bool ComputeIsOpaque(const SkBitmap& bm) { - return bm.pixmap().computeIsOpaque(); - } - - /** Returns SkRect { 0, 0, width(), height() }. - - @param bounds container for floating point rectangle - - example: https://fiddle.skia.org/c/@Bitmap_getBounds - */ - void getBounds(SkRect* bounds) const; - - /** Returns SkIRect { 0, 0, width(), height() }. - - @param bounds container for integral rectangle - - example: https://fiddle.skia.org/c/@Bitmap_getBounds_2 - */ - void getBounds(SkIRect* bounds) const; - - /** Returns SkIRect { 0, 0, width(), height() }. - - @return integral rectangle from origin to width() and height() - */ - SkIRect bounds() const { return fPixmap.info().bounds(); } - - /** Returns SkISize { width(), height() }. - - @return integral size of width() and height() - */ - SkISize dimensions() const { return fPixmap.info().dimensions(); } - - /** Returns the bounds of this bitmap, offset by its SkPixelRef origin. - - @return bounds within SkPixelRef bounds - */ - SkIRect getSubset() const { - SkIPoint origin = this->pixelRefOrigin(); - return SkIRect::MakeXYWH(origin.x(), origin.y(), this->width(), this->height()); - } - - /** Sets width, height, SkAlphaType, SkColorType, SkColorSpace, and optional - rowBytes. Frees pixels, and returns true if successful. - - imageInfo.alphaType() may be altered to a value permitted by imageInfo.colorSpace(). - If imageInfo.colorType() is kUnknown_SkColorType, imageInfo.alphaType() is - set to kUnknown_SkAlphaType. - If imageInfo.colorType() is kAlpha_8_SkColorType and imageInfo.alphaType() is - kUnpremul_SkAlphaType, imageInfo.alphaType() is replaced by kPremul_SkAlphaType. - If imageInfo.colorType() is kRGB_565_SkColorType or kGray_8_SkColorType, - imageInfo.alphaType() is set to kOpaque_SkAlphaType. - If imageInfo.colorType() is kARGB_4444_SkColorType, kRGBA_8888_SkColorType, - kBGRA_8888_SkColorType, or kRGBA_F16_SkColorType: imageInfo.alphaType() remains - unchanged. - - rowBytes must equal or exceed imageInfo.minRowBytes(). If imageInfo.colorSpace() is - kUnknown_SkColorType, rowBytes is ignored and treated as zero; for all other - SkColorSpace values, rowBytes of zero is treated as imageInfo.minRowBytes(). - - Calls reset() and returns false if: - - rowBytes exceeds 31 bits - - imageInfo.width() is negative - - imageInfo.height() is negative - - rowBytes is positive and less than imageInfo.width() times imageInfo.bytesPerPixel() - - @param imageInfo contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param rowBytes imageInfo.minRowBytes() or larger; or zero - @return true if SkImageInfo set successfully - - example: https://fiddle.skia.org/c/@Bitmap_setInfo - */ - bool setInfo(const SkImageInfo& imageInfo, size_t rowBytes = 0); - - /** \enum SkBitmap::AllocFlags - AllocFlags is obsolete. We always zero pixel memory when allocated. - */ - enum AllocFlags { - kZeroPixels_AllocFlag = 1 << 0, //!< zero pixel memory. No effect. This is the default. - }; - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. Memory is zeroed. - - Returns false and calls reset() if SkImageInfo could not be set, or memory could - not be allocated, or memory could not optionally be zeroed. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of calloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param flags kZeroPixels_AllocFlag, or zero - @return true if pixels allocation is successful - */ - bool SK_WARN_UNUSED_RESULT tryAllocPixelsFlags(const SkImageInfo& info, uint32_t flags); - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. Memory is zeroed. - - Aborts execution if SkImageInfo could not be set, or memory could - not be allocated, or memory could not optionally - be zeroed. Abort steps may be provided by the user at compile time by defining - SK_ABORT. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of calloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param flags kZeroPixels_AllocFlag, or zero - - example: https://fiddle.skia.org/c/@Bitmap_allocPixelsFlags - */ - void allocPixelsFlags(const SkImageInfo& info, uint32_t flags); - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(), - or equal zero. Pass in zero for rowBytes to compute the minimum valid value. - - Returns false and calls reset() if SkImageInfo could not be set, or memory could - not be allocated. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of malloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param rowBytes size of pixel row or larger; may be zero - @return true if pixel storage is allocated - */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info, size_t rowBytes); - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. rowBytes must equal or exceed info.width() times info.bytesPerPixel(), - or equal zero. Pass in zero for rowBytes to compute the minimum valid value. - - Aborts execution if SkImageInfo could not be set, or memory could - not be allocated. Abort steps may be provided by - the user at compile time by defining SK_ABORT. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of malloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param rowBytes size of pixel row or larger; may be zero - - example: https://fiddle.skia.org/c/@Bitmap_allocPixels - */ - void allocPixels(const SkImageInfo& info, size_t rowBytes); - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. - - Returns false and calls reset() if SkImageInfo could not be set, or memory could - not be allocated. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of malloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @return true if pixel storage is allocated - */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels(const SkImageInfo& info) { - return this->tryAllocPixels(info, info.minRowBytes()); - } - - /** Sets SkImageInfo to info following the rules in setInfo() and allocates pixel - memory. - - Aborts execution if SkImageInfo could not be set, or memory could - not be allocated. Abort steps may be provided by - the user at compile time by defining SK_ABORT. - - On most platforms, allocating pixel memory may succeed even though there is - not sufficient memory to hold pixels; allocation does not take place - until the pixels are written to. The actual behavior depends on the platform - implementation of malloc(). - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - - example: https://fiddle.skia.org/c/@Bitmap_allocPixels_2 - */ - void allocPixels(const SkImageInfo& info); - - /** Sets SkImageInfo to width, height, and native color type; and allocates - pixel memory. If isOpaque is true, sets SkImageInfo to kOpaque_SkAlphaType; - otherwise, sets to kPremul_SkAlphaType. - - Calls reset() and returns false if width exceeds 29 bits or is negative, - or height is negative. - - Returns false if allocation fails. - - Use to create SkBitmap that matches SkPMColor, the native pixel arrangement on - the platform. SkBitmap drawn to output device skips converting its pixel format. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @param isOpaque true if pixels do not have transparency - @return true if pixel storage is allocated - */ - bool SK_WARN_UNUSED_RESULT tryAllocN32Pixels(int width, int height, bool isOpaque = false); - - /** Sets SkImageInfo to width, height, and the native color type; and allocates - pixel memory. If isOpaque is true, sets SkImageInfo to kOpaque_SkAlphaType; - otherwise, sets to kPremul_SkAlphaType. - - Aborts if width exceeds 29 bits or is negative, or height is negative, or - allocation fails. Abort steps may be provided by the user at compile time by - defining SK_ABORT. - - Use to create SkBitmap that matches SkPMColor, the native pixel arrangement on - the platform. SkBitmap drawn to output device skips converting its pixel format. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @param isOpaque true if pixels do not have transparency - - example: https://fiddle.skia.org/c/@Bitmap_allocN32Pixels - */ - void allocN32Pixels(int width, int height, bool isOpaque = false); - - /** Sets SkImageInfo to info following the rules in setInfo(), and creates SkPixelRef - containing pixels and rowBytes. releaseProc, if not nullptr, is called - immediately on failure or when pixels are no longer referenced. context may be - nullptr. - - If SkImageInfo could not be set, or rowBytes is less than info.minRowBytes(): - calls releaseProc if present, calls reset(), and returns false. - - Otherwise, if pixels equals nullptr: sets SkImageInfo, calls releaseProc if - present, returns true. - - If SkImageInfo is set, pixels is not nullptr, and releaseProc is not nullptr: - when pixels are no longer referenced, calls releaseProc with pixels and context - as parameters. - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param pixels address or pixel storage; may be nullptr - @param rowBytes size of pixel row or larger - @param releaseProc function called when pixels can be deleted; may be nullptr - @param context caller state passed to releaseProc; may be nullptr - @return true if SkImageInfo is set to info - */ - bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, - void (*releaseProc)(void* addr, void* context), void* context); - - /** Sets SkImageInfo to info following the rules in setInfo(), and creates SkPixelRef - containing pixels and rowBytes. - - If SkImageInfo could not be set, or rowBytes is less than info.minRowBytes(): - calls reset(), and returns false. - - Otherwise, if pixels equals nullptr: sets SkImageInfo, returns true. - - Caller must ensure that pixels are valid for the lifetime of SkBitmap and SkPixelRef. - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param pixels address or pixel storage; may be nullptr - @param rowBytes size of pixel row or larger - @return true if SkImageInfo is set to info - */ - bool installPixels(const SkImageInfo& info, void* pixels, size_t rowBytes) { - return this->installPixels(info, pixels, rowBytes, nullptr, nullptr); - } - - /** Sets SkImageInfo to pixmap.info() following the rules in setInfo(), and creates - SkPixelRef containing pixmap.addr() and pixmap.rowBytes(). - - If SkImageInfo could not be set, or pixmap.rowBytes() is less than - SkImageInfo::minRowBytes(): calls reset(), and returns false. - - Otherwise, if pixmap.addr() equals nullptr: sets SkImageInfo, returns true. - - Caller must ensure that pixmap is valid for the lifetime of SkBitmap and SkPixelRef. - - @param pixmap SkImageInfo, pixel address, and rowBytes() - @return true if SkImageInfo was set to pixmap.info() - - example: https://fiddle.skia.org/c/@Bitmap_installPixels_3 - */ - bool installPixels(const SkPixmap& pixmap); - - /** Deprecated. - */ - bool installMaskPixels(const SkMask& mask); - - /** Replaces SkPixelRef with pixels, preserving SkImageInfo and rowBytes(). - Sets SkPixelRef origin to (0, 0). - - If pixels is nullptr, or if info().colorType() equals kUnknown_SkColorType; - release reference to SkPixelRef, and set SkPixelRef to nullptr. - - Caller is responsible for handling ownership pixel memory for the lifetime - of SkBitmap and SkPixelRef. - - @param pixels address of pixel storage, managed by caller - - example: https://fiddle.skia.org/c/@Bitmap_setPixels - */ - void setPixels(void* pixels); - - /** Allocates pixel memory with HeapAllocator, and replaces existing SkPixelRef. - The allocation size is determined by SkImageInfo width, height, and SkColorType. - - Returns false if info().colorType() is kUnknown_SkColorType, or allocation fails. - - @return true if the allocation succeeds - */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels() { - return this->tryAllocPixels((Allocator*)nullptr); - } - - /** Allocates pixel memory with HeapAllocator, and replaces existing SkPixelRef. - The allocation size is determined by SkImageInfo width, height, and SkColorType. - - Aborts if info().colorType() is kUnknown_SkColorType, or allocation fails. - Abort steps may be provided by the user at compile - time by defining SK_ABORT. - - example: https://fiddle.skia.org/c/@Bitmap_allocPixels_3 - */ - void allocPixels(); - - /** Allocates pixel memory with allocator, and replaces existing SkPixelRef. - The allocation size is determined by SkImageInfo width, height, and SkColorType. - If allocator is nullptr, use HeapAllocator instead. - - Returns false if Allocator::allocPixelRef return false. - - @param allocator instance of SkBitmap::Allocator instantiation - @return true if custom allocator reports success - */ - bool SK_WARN_UNUSED_RESULT tryAllocPixels(Allocator* allocator); - - /** Allocates pixel memory with allocator, and replaces existing SkPixelRef. - The allocation size is determined by SkImageInfo width, height, and SkColorType. - If allocator is nullptr, use HeapAllocator instead. - - Aborts if Allocator::allocPixelRef return false. Abort steps may be provided by - the user at compile time by defining SK_ABORT. - - @param allocator instance of SkBitmap::Allocator instantiation - - example: https://fiddle.skia.org/c/@Bitmap_allocPixels_4 - */ - void allocPixels(Allocator* allocator); - - /** Returns SkPixelRef, which contains: pixel base address; its dimensions; and - rowBytes(), the interval from one row to the next. Does not change SkPixelRef - reference count. SkPixelRef may be shared by multiple bitmaps. - If SkPixelRef has not been set, returns nullptr. - - @return SkPixelRef, or nullptr - */ - SkPixelRef* pixelRef() const { return fPixelRef.get(); } - - /** Returns origin of pixels within SkPixelRef. SkBitmap bounds is always contained - by SkPixelRef bounds, which may be the same size or larger. Multiple SkBitmap - can share the same SkPixelRef, where each SkBitmap has different bounds. - - The returned origin added to SkBitmap dimensions equals or is smaller than the - SkPixelRef dimensions. - - Returns (0, 0) if SkPixelRef is nullptr. - - @return pixel origin within SkPixelRef - - example: https://fiddle.skia.org/c/@Bitmap_pixelRefOrigin - */ - SkIPoint pixelRefOrigin() const; - - /** Replaces pixelRef and origin in SkBitmap. dx and dy specify the offset - within the SkPixelRef pixels for the top-left corner of the bitmap. - - Asserts in debug builds if dx or dy are out of range. Pins dx and dy - to legal range in release builds. - - The caller is responsible for ensuring that the pixels match the - SkColorType and SkAlphaType in SkImageInfo. - - @param pixelRef SkPixelRef describing pixel address and rowBytes() - @param dx column offset in SkPixelRef for bitmap origin - @param dy row offset in SkPixelRef for bitmap origin - - example: https://fiddle.skia.org/c/@Bitmap_setPixelRef - */ - void setPixelRef(sk_sp pixelRef, int dx, int dy); - - /** Returns true if SkBitmap is can be drawn. - - @return true if getPixels() is not nullptr - */ - bool readyToDraw() const { - return this->getPixels() != nullptr; - } - - /** Returns a unique value corresponding to the pixels in SkPixelRef. - Returns a different value after notifyPixelsChanged() has been called. - Returns zero if SkPixelRef is nullptr. - - Determines if pixels have changed since last examined. - - @return unique value for pixels in SkPixelRef - - example: https://fiddle.skia.org/c/@Bitmap_getGenerationID - */ - uint32_t getGenerationID() const; - - /** Marks that pixels in SkPixelRef have changed. Subsequent calls to - getGenerationID() return a different value. - - example: https://fiddle.skia.org/c/@Bitmap_notifyPixelsChanged - */ - void notifyPixelsChanged() const; - - /** Replaces pixel values with c, interpreted as being in the sRGB SkColorSpace. - All pixels contained by bounds() are affected. If the colorType() is - kGray_8_SkColorType or kRGB_565_SkColorType, then alpha is ignored; RGB is - treated as opaque. If colorType() is kAlpha_8_SkColorType, then RGB is ignored. - - @param c unpremultiplied color - @param colorSpace SkColorSpace of c - - example: https://fiddle.skia.org/c/@Bitmap_eraseColor - */ - void eraseColor(SkColor4f c, SkColorSpace* colorSpace = nullptr) const; - - /** Replaces pixel values with c, interpreted as being in the sRGB SkColorSpace. - All pixels contained by bounds() are affected. If the colorType() is - kGray_8_SkColorType or kRGB_565_SkColorType, then alpha is ignored; RGB is - treated as opaque. If colorType() is kAlpha_8_SkColorType, then RGB is ignored. - - Input color is ultimately converted to an SkColor4f, so eraseColor(SkColor4f c) - will have higher color resolution. - - @param c unpremultiplied color. - - example: https://fiddle.skia.org/c/@Bitmap_eraseColor - */ - void eraseColor(SkColor c) const; - - /** Replaces pixel values with unpremultiplied color built from a, r, g, and b, - interpreted as being in the sRGB SkColorSpace. All pixels contained by - bounds() are affected. If the colorType() is kGray_8_SkColorType or - kRGB_565_SkColorType, then a is ignored; r, g, and b are treated as opaque. - If colorType() is kAlpha_8_SkColorType, then r, g, and b are ignored. - - @param a amount of alpha, from fully transparent (0) to fully opaque (255) - @param r amount of red, from no red (0) to full red (255) - @param g amount of green, from no green (0) to full green (255) - @param b amount of blue, from no blue (0) to full blue (255) - */ - void eraseARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) const { - this->eraseColor(SkColorSetARGB(a, r, g, b)); - } - - /** Replaces pixel values inside area with c. interpreted as being in the sRGB - SkColorSpace. If area does not intersect bounds(), call has no effect. - - If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then alpha - is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType, - then RGB is ignored. - - @param c unpremultiplied color - @param area rectangle to fill - @param colorSpace SkColorSpace of c - - example: https://fiddle.skia.org/c/@Bitmap_erase - */ - void erase(SkColor4f c, SkColorSpace* colorSpace, const SkIRect& area) const; - void erase(SkColor4f c, const SkIRect& area) const; - - /** Replaces pixel values inside area with c. interpreted as being in the sRGB - SkColorSpace. If area does not intersect bounds(), call has no effect. - - If the colorType() is kGray_8_SkColorType or kRGB_565_SkColorType, then alpha - is ignored; RGB is treated as opaque. If colorType() is kAlpha_8_SkColorType, - then RGB is ignored. - - Input color is ultimately converted to an SkColor4f, so erase(SkColor4f c) - will have higher color resolution. - - @param c unpremultiplied color - @param area rectangle to fill - - example: https://fiddle.skia.org/c/@Bitmap_erase - */ - void erase(SkColor c, const SkIRect& area) const; - - /** Deprecated. - */ - void eraseArea(const SkIRect& area, SkColor c) const { - this->erase(c, area); - } - - /** Returns pixel at (x, y) as unpremultiplied color. - Returns black with alpha if SkColorType is kAlpha_8_SkColorType. - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined; and returns undefined values or may crash if - SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or - pixel address is nullptr. - - SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the - conversion to unpremultiplied color; original pixel data may have additional - precision. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return pixel converted to unpremultiplied color - */ - SkColor getColor(int x, int y) const { - return this->pixmap().getColor(x, y); - } - - /** Returns pixel at (x, y) as unpremultiplied float color. - Returns black with alpha if SkColorType is kAlpha_8_SkColorType. - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined; and returns undefined values or may crash if - SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or - pixel address is nullptr. - - SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the - conversion to unpremultiplied color. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return pixel converted to unpremultiplied color - */ - SkColor4f getColor4f(int x, int y) const { return this->pixmap().getColor4f(x, y); } - - /** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1]. - This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent - (and more precise if the pixels store more than 8 bits per component). - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return alpha converted to normalized float - */ - float getAlphaf(int x, int y) const { - return this->pixmap().getAlphaf(x, y); - } - - /** Returns pixel address at (x, y). - - Input is not validated: out of bounds values of x or y, or kUnknown_SkColorType, - trigger an assert() if built with SK_DEBUG defined. Returns nullptr if - SkColorType is kUnknown_SkColorType, or SkPixelRef is nullptr. - - Performs a lookup of pixel size; for better performance, call - one of: getAddr8(), getAddr16(), or getAddr32(). - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return generic pointer to pixel - - example: https://fiddle.skia.org/c/@Bitmap_getAddr - */ - void* getAddr(int x, int y) const; - - /** Returns address at (x, y). - - Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: - - SkPixelRef is nullptr - - bytesPerPixel() is not four - - x is negative, or not less than width() - - y is negative, or not less than height() - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return unsigned 32-bit pointer to pixel at (x, y) - */ - inline uint32_t* getAddr32(int x, int y) const; - - /** Returns address at (x, y). - - Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: - - SkPixelRef is nullptr - - bytesPerPixel() is not two - - x is negative, or not less than width() - - y is negative, or not less than height() - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return unsigned 16-bit pointer to pixel at (x, y) - */ - inline uint16_t* getAddr16(int x, int y) const; - - /** Returns address at (x, y). - - Input is not validated. Triggers an assert() if built with SK_DEBUG defined and: - - SkPixelRef is nullptr - - bytesPerPixel() is not one - - x is negative, or not less than width() - - y is negative, or not less than height() - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return unsigned 8-bit pointer to pixel at (x, y) - */ - inline uint8_t* getAddr8(int x, int y) const; - - /** Shares SkPixelRef with dst. Pixels are not copied; SkBitmap and dst point - to the same pixels; dst bounds() are set to the intersection of subset - and the original bounds(). - - subset may be larger than bounds(). Any area outside of bounds() is ignored. - - Any contents of dst are discarded. - - Return false if: - - dst is nullptr - - SkPixelRef is nullptr - - subset does not intersect bounds() - - @param dst SkBitmap set to subset - @param subset rectangle of pixels to reference - @return true if dst is replaced by subset - - example: https://fiddle.skia.org/c/@Bitmap_extractSubset - */ - bool extractSubset(SkBitmap* dst, const SkIRect& subset) const; - - /** Copies a SkRect of pixels from SkBitmap to dstPixels. Copy starts at (srcX, srcY), - and does not exceed SkBitmap (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and SkColorSpace of - destination. dstRowBytes specifics the gap from one destination row to the next. - Returns true if pixels are copied. Returns false if: - - dstInfo has no address - - dstRowBytes is less than dstInfo.minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkBitmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkBitmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(srcX) >= Bitmap width(), or if abs(srcY) >= Bitmap height(). - - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @return true if pixels are copied to dstPixels - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY) const; - - /** Copies a SkRect of pixels from SkBitmap to dst. Copy starts at (srcX, srcY), and - does not exceed SkBitmap (width(), height()). - - dst specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of destination. dst.rowBytes() specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if: - - dst pixel storage equals nullptr - - dst.rowBytes is less than SkImageInfo::minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst SkColorType must match. - If SkBitmap colorType() is kGray_8_SkColorType, dst SkColorSpace must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, dst SkAlphaType must - match. If SkBitmap colorSpace() is nullptr, dst SkColorSpace must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(srcX) >= Bitmap width(), or if abs(srcY) >= Bitmap height(). - - @param dst destination SkPixmap: SkImageInfo, pixels, row bytes - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @return true if pixels are copied to dst - - example: https://fiddle.skia.org/c/@Bitmap_readPixels_2 - */ - bool readPixels(const SkPixmap& dst, int srcX, int srcY) const; - - /** Copies a SkRect of pixels from SkBitmap to dst. Copy starts at (0, 0), and - does not exceed SkBitmap (width(), height()). - - dst specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of destination. dst.rowBytes() specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if: - - dst pixel storage equals nullptr - - dst.rowBytes is less than SkImageInfo::minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst SkColorType must match. - If SkBitmap colorType() is kGray_8_SkColorType, dst SkColorSpace must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, dst SkAlphaType must - match. If SkBitmap colorSpace() is nullptr, dst SkColorSpace must match. Returns - false if pixel conversion is not possible. - - @param dst destination SkPixmap: SkImageInfo, pixels, row bytes - @return true if pixels are copied to dst - */ - bool readPixels(const SkPixmap& dst) const { - return this->readPixels(dst, 0, 0); - } - - /** Copies a SkRect of pixels from src. Copy starts at (dstX, dstY), and does not exceed - (src.width(), src.height()). - - src specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of source. src.rowBytes() specifics the gap from one source - row to the next. Returns true if pixels are copied. Returns false if: - - src pixel storage equals nullptr - - src.rowBytes is less than SkImageInfo::minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; src SkColorType must match. - If SkBitmap colorType() is kGray_8_SkColorType, src SkColorSpace must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, src SkAlphaType must - match. If SkBitmap colorSpace() is nullptr, src SkColorSpace must match. Returns - false if pixel conversion is not possible. - - dstX and dstY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(dstX) >= Bitmap width(), or if abs(dstY) >= Bitmap height(). - - @param src source SkPixmap: SkImageInfo, pixels, row bytes - @param dstX column index whose absolute value is less than width() - @param dstY row index whose absolute value is less than height() - @return true if src pixels are copied to SkBitmap - - example: https://fiddle.skia.org/c/@Bitmap_writePixels - */ - bool writePixels(const SkPixmap& src, int dstX, int dstY); - - /** Copies a SkRect of pixels from src. Copy starts at (0, 0), and does not exceed - (src.width(), src.height()). - - src specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of source. src.rowBytes() specifics the gap from one source - row to the next. Returns true if pixels are copied. Returns false if: - - src pixel storage equals nullptr - - src.rowBytes is less than SkImageInfo::minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkBitmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; src SkColorType must match. - If SkBitmap colorType() is kGray_8_SkColorType, src SkColorSpace must match. - If SkBitmap alphaType() is kOpaque_SkAlphaType, src SkAlphaType must - match. If SkBitmap colorSpace() is nullptr, src SkColorSpace must match. Returns - false if pixel conversion is not possible. - - @param src source SkPixmap: SkImageInfo, pixels, row bytes - @return true if src pixels are copied to SkBitmap - */ - bool writePixels(const SkPixmap& src) { - return this->writePixels(src, 0, 0); - } - - /** Sets dst to alpha described by pixels. Returns false if dst cannot be written to - or dst pixels cannot be allocated. - - Uses HeapAllocator to reserve memory for dst SkPixelRef. - - @param dst holds SkPixelRef to fill with alpha layer - @return true if alpha layer was constructed in dst SkPixelRef - */ - bool extractAlpha(SkBitmap* dst) const { - return this->extractAlpha(dst, nullptr, nullptr, nullptr); - } - - /** Sets dst to alpha described by pixels. Returns false if dst cannot be written to - or dst pixels cannot be allocated. - - If paint is not nullptr and contains SkMaskFilter, SkMaskFilter - generates mask alpha from SkBitmap. Uses HeapAllocator to reserve memory for dst - SkPixelRef. Sets offset to top-left position for dst for alignment with SkBitmap; - (0, 0) unless SkMaskFilter generates mask. - - @param dst holds SkPixelRef to fill with alpha layer - @param paint holds optional SkMaskFilter; may be nullptr - @param offset top-left position for dst; may be nullptr - @return true if alpha layer was constructed in dst SkPixelRef - */ - bool extractAlpha(SkBitmap* dst, const SkPaint* paint, - SkIPoint* offset) const { - return this->extractAlpha(dst, paint, nullptr, offset); - } - - /** Sets dst to alpha described by pixels. Returns false if dst cannot be written to - or dst pixels cannot be allocated. - - If paint is not nullptr and contains SkMaskFilter, SkMaskFilter - generates mask alpha from SkBitmap. allocator may reference a custom allocation - class or be set to nullptr to use HeapAllocator. Sets offset to top-left - position for dst for alignment with SkBitmap; (0, 0) unless SkMaskFilter generates - mask. - - @param dst holds SkPixelRef to fill with alpha layer - @param paint holds optional SkMaskFilter; may be nullptr - @param allocator function to reserve memory for SkPixelRef; may be nullptr - @param offset top-left position for dst; may be nullptr - @return true if alpha layer was constructed in dst SkPixelRef - */ - bool extractAlpha(SkBitmap* dst, const SkPaint* paint, Allocator* allocator, - SkIPoint* offset) const; - - /** Copies SkBitmap pixel address, row bytes, and SkImageInfo to pixmap, if address - is available, and returns true. If pixel address is not available, return - false and leave pixmap unchanged. - - pixmap contents become invalid on any future change to SkBitmap. - - @param pixmap storage for pixel state if pixels are readable; otherwise, ignored - @return true if SkBitmap has direct access to pixels - - example: https://fiddle.skia.org/c/@Bitmap_peekPixels - */ - bool peekPixels(SkPixmap* pixmap) const; - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions&, - const SkMatrix* = nullptr) const; - - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling, - const SkMatrix& localMatrix) const { - return this->makeShader(tmx, tmy, sampling, &localMatrix); - } - - sk_sp makeShader(const SkSamplingOptions& sampling, - const SkMatrix* localMatrix = nullptr) const { - return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, localMatrix); - } - - sk_sp makeShader(const SkSamplingOptions& sampling, - const SkMatrix& localMatrix) const { - return this->makeShader(sampling, &localMatrix); - } - - /** - * Returns a new image from the bitmap. If the bitmap is marked immutable, this will - * share the pixel buffer. If not, it will make a copy of the pixels for the image. - */ - sk_sp asImage() const; - - /** Asserts if internal values are illegal or inconsistent. Only available if - SK_DEBUG is defined at compile time. - */ - SkDEBUGCODE(void validate() const;) - - /** \class SkBitmap::Allocator - Abstract subclass of HeapAllocator. - */ - class Allocator : public SkRefCnt { - public: - - /** Allocates the pixel memory for the bitmap, given its dimensions and - SkColorType. Returns true on success, where success means either setPixels() - or setPixelRef() was called. - - @param bitmap SkBitmap containing SkImageInfo as input, and SkPixelRef as output - @return true if SkPixelRef was allocated - */ - virtual bool allocPixelRef(SkBitmap* bitmap) = 0; - private: - using INHERITED = SkRefCnt; - }; - - /** \class SkBitmap::HeapAllocator - Subclass of SkBitmap::Allocator that returns a SkPixelRef that allocates its pixel - memory from the heap. This is the default SkBitmap::Allocator invoked by - allocPixels(). - */ - class HeapAllocator : public Allocator { - public: - - /** Allocates the pixel memory for the bitmap, given its dimensions and - SkColorType. Returns true on success, where success means either setPixels() - or setPixelRef() was called. - - @param bitmap SkBitmap containing SkImageInfo as input, and SkPixelRef as output - @return true if pixels are allocated - - example: https://fiddle.skia.org/c/@Bitmap_HeapAllocator_allocPixelRef - */ - bool allocPixelRef(SkBitmap* bitmap) override; - }; - -private: - sk_sp fPixelRef; - SkPixmap fPixmap; - sk_sp fMips; - - friend class SkImage_Raster; - friend class SkReadBuffer; // unflatten - friend class GrProxyProvider; // fMips -}; - -/////////////////////////////////////////////////////////////////////////////// - -inline uint32_t* SkBitmap::getAddr32(int x, int y) const { - SkASSERT(fPixmap.addr()); - return fPixmap.writable_addr32(x, y); -} - -inline uint16_t* SkBitmap::getAddr16(int x, int y) const { - SkASSERT(fPixmap.addr()); - return fPixmap.writable_addr16(x, y); -} - -inline uint8_t* SkBitmap::getAddr8(int x, int y) const { - SkASSERT(fPixmap.addr()); - return fPixmap.writable_addr8(x, y); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlendMode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlendMode.h deleted file mode 100644 index 4abe9157620f93..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlendMode.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlendMode_DEFINED -#define SkBlendMode_DEFINED - -#include "include/core/SkTypes.h" - -/** - * Blends are operators that take in two colors (source, destination) and return a new color. - * Many of these operate the same on all 4 components: red, green, blue, alpha. For these, - * we just document what happens to one component, rather than naming each one separately. - * - * Different SkColorTypes have different representations for color components: - * 8-bit: 0..255 - * 6-bit: 0..63 - * 5-bit: 0..31 - * 4-bit: 0..15 - * floats: 0...1 - * - * The documentation is expressed as if the component values are always 0..1 (floats). - * - * For brevity, the documentation uses the following abbreviations - * s : source - * d : destination - * sa : source alpha - * da : destination alpha - * - * Results are abbreviated - * r : if all 4 components are computed in the same manner - * ra : result alpha component - * rc : result "color": red, green, blue components - */ -enum class SkBlendMode { - kClear, //!< r = 0 - kSrc, //!< r = s - kDst, //!< r = d - kSrcOver, //!< r = s + (1-sa)*d - kDstOver, //!< r = d + (1-da)*s - kSrcIn, //!< r = s * da - kDstIn, //!< r = d * sa - kSrcOut, //!< r = s * (1-da) - kDstOut, //!< r = d * (1-sa) - kSrcATop, //!< r = s*da + d*(1-sa) - kDstATop, //!< r = d*sa + s*(1-da) - kXor, //!< r = s*(1-da) + d*(1-sa) - kPlus, //!< r = min(s + d, 1) - kModulate, //!< r = s*d - kScreen, //!< r = s + d - s*d - - kOverlay, //!< multiply or screen, depending on destination - kDarken, //!< rc = s + d - max(s*da, d*sa), ra = kSrcOver - kLighten, //!< rc = s + d - min(s*da, d*sa), ra = kSrcOver - kColorDodge, //!< brighten destination to reflect source - kColorBurn, //!< darken destination to reflect source - kHardLight, //!< multiply or screen, depending on source - kSoftLight, //!< lighten or darken, depending on source - kDifference, //!< rc = s + d - 2*(min(s*da, d*sa)), ra = kSrcOver - kExclusion, //!< rc = s + d - two(s*d), ra = kSrcOver - kMultiply, //!< r = s*(1-da) + d*(1-sa) + s*d - - kHue, //!< hue of source with saturation and luminosity of destination - kSaturation, //!< saturation of source with hue and luminosity of destination - kColor, //!< hue and saturation of source with luminosity of destination - kLuminosity, //!< luminosity of source with hue and saturation of destination - - kLastCoeffMode = kScreen, //!< last porter duff blend mode - kLastSeparableMode = kMultiply, //!< last blend mode operating separately on components - kLastMode = kLuminosity, //!< last valid value -}; - -static constexpr int kSkBlendModeCount = static_cast(SkBlendMode::kLastMode) + 1; - -/** - * For Porter-Duff SkBlendModes (those <= kLastCoeffMode), these coefficients describe the blend - * equation used. Coefficient-based blend modes specify an equation: - * ('dstCoeff' * dst + 'srcCoeff' * src), where the coefficient values are constants, functions of - * the src or dst alpha, or functions of the src or dst color. - */ -enum class SkBlendModeCoeff { - kZero, /** 0 */ - kOne, /** 1 */ - kSC, /** src color */ - kISC, /** inverse src color (i.e. 1 - sc) */ - kDC, /** dst color */ - kIDC, /** inverse dst color (i.e. 1 - dc) */ - kSA, /** src alpha */ - kISA, /** inverse src alpha (i.e. 1 - sa) */ - kDA, /** dst alpha */ - kIDA, /** inverse dst alpha (i.e. 1 - da) */ - - kCoeffCount -}; - -/** - * Returns true if 'mode' is a coefficient-based blend mode (<= kLastCoeffMode). If true is - * returned, the mode's src and dst coefficient functions are set in 'src' and 'dst'. - */ -SK_API bool SkBlendMode_AsCoeff(SkBlendMode mode, SkBlendModeCoeff* src, SkBlendModeCoeff* dst); - - -/** Returns name of blendMode as null-terminated C string. - - @return C string -*/ -SK_API const char* SkBlendMode_Name(SkBlendMode blendMode); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlender.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlender.h deleted file mode 100644 index 7acba87f52adea..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlender.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlender_DEFINED -#define SkBlender_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkFlattenable.h" - -/** - * SkBlender represents a custom blend function in the Skia pipeline. When an SkBlender is - * present in a paint, the SkBlendMode is ignored. A blender combines a source color (the - * result of our paint) and destination color (from the canvas) into a final color. - */ -class SK_API SkBlender : public SkFlattenable { -public: - /** - * Create a blender that implements the specified BlendMode. - */ - static sk_sp Mode(SkBlendMode mode); - -private: - SkBlender() = default; - friend class SkBlenderBase; - - using INHERITED = SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlurTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlurTypes.h deleted file mode 100644 index aec37b6e686ded..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkBlurTypes.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlurTypes_DEFINED -#define SkBlurTypes_DEFINED - -#include "include/core/SkTypes.h" - -enum SkBlurStyle : int { - kNormal_SkBlurStyle, //!< fuzzy inside and outside - kSolid_SkBlurStyle, //!< solid inside, fuzzy outside - kOuter_SkBlurStyle, //!< nothing inside, fuzzy outside - kInner_SkBlurStyle, //!< fuzzy inside, nothing outside - - kLastEnum_SkBlurStyle = kInner_SkBlurStyle, -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvas.h deleted file mode 100644 index b16872809e3220..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvas.h +++ /dev/null @@ -1,2615 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCanvas_DEFINED -#define SkCanvas_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkClipOp.h" -#include "include/core/SkColor.h" -#include "include/core/SkFontTypes.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkM44.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkPaint.h" -#include "include/core/SkPoint.h" -#include "include/core/SkRasterHandleAllocator.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkScalar.h" -#include "include/core/SkSize.h" -#include "include/core/SkString.h" -#include "include/core/SkSurfaceProps.h" -#include "include/core/SkTypes.h" -#include "include/private/SkDeque.h" -#include "include/private/SkMacros.h" - -#include -#include -#include -#include - -#ifndef SK_SUPPORT_LEGACY_GETTOTALMATRIX -#define SK_SUPPORT_LEGACY_GETTOTALMATRIX -#endif - -namespace sktext { -class GlyphRunBuilder; -class GlyphRunList; -} - -class AutoLayerForImageFilter; -class GrBackendRenderTarget; -class GrRecordingContext; -class SkBaseDevice; -class SkBitmap; -class SkData; -class SkDrawable; -struct SkDrawShadowRec; -class SkFont; -class SkImage; -class SkImageFilter; -class SkPaintFilterCanvas; -class SkPath; -class SkPicture; -class SkPixmap; -class SkRegion; -class SkRRect; -struct SkRSXform; -class SkMesh; -class SkSpecialImage; -class SkSurface; -class SkSurface_Base; -class SkTextBlob; -class SkVertices; - -namespace skgpu::graphite { class Recorder; } -namespace sktext::gpu { class Slug; } -namespace SkRecords { class Draw; } - -// TODO: -// This is not ideal but Chrome is depending on a forward decl of GrSlug here. -// It should be removed once Chrome has migrated to sktext::gpu::Slug. -using GrSlug = sktext::gpu::Slug; - -/** \class SkCanvas - SkCanvas provides an interface for drawing, and how the drawing is clipped and transformed. - SkCanvas contains a stack of SkMatrix and clip values. - - SkCanvas and SkPaint together provide the state to draw into SkSurface or SkBaseDevice. - Each SkCanvas draw call transforms the geometry of the object by the concatenation of all - SkMatrix values in the stack. The transformed geometry is clipped by the intersection - of all of clip values in the stack. The SkCanvas draw calls use SkPaint to supply drawing - state such as color, SkTypeface, text size, stroke width, SkShader and so on. - - To draw to a pixel-based destination, create raster surface or GPU surface. - Request SkCanvas from SkSurface to obtain the interface to draw. - SkCanvas generated by raster surface draws to memory visible to the CPU. - SkCanvas generated by GPU surface uses Vulkan or OpenGL to draw to the GPU. - - To draw to a document, obtain SkCanvas from SVG canvas, document PDF, or SkPictureRecorder. - SkDocument based SkCanvas and other SkCanvas subclasses reference SkBaseDevice describing the - destination. - - SkCanvas can be constructed to draw to SkBitmap without first creating raster surface. - This approach may be deprecated in the future. -*/ -class SK_API SkCanvas { -public: - - /** Allocates raster SkCanvas that will draw directly into pixels. - - SkCanvas is returned if all parameters are valid. - Valid parameters include: - info dimensions are zero or positive; - info contains SkColorType and SkAlphaType supported by raster surface; - pixels is not nullptr; - rowBytes is zero or large enough to contain info width pixels of SkColorType. - - Pass zero for rowBytes to compute rowBytes from info width and size of pixel. - If rowBytes is greater than zero, it must be equal to or greater than - info width times bytes required for SkColorType. - - Pixel buffer size should be info height times computed rowBytes. - Pixels are not initialized. - To access pixels after drawing, call flush() or peekPixels(). - - @param info width, height, SkColorType, SkAlphaType, SkColorSpace, of raster surface; - width, or height, or both, may be zero - @param pixels pointer to destination pixels buffer - @param rowBytes interval from one SkSurface row to the next, or zero - @param props LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkCanvas if all parameters are valid; otherwise, nullptr - */ - static std::unique_ptr MakeRasterDirect(const SkImageInfo& info, void* pixels, - size_t rowBytes, - const SkSurfaceProps* props = nullptr); - - /** Allocates raster SkCanvas specified by inline image specification. Subsequent SkCanvas - calls draw into pixels. - SkColorType is set to kN32_SkColorType. - SkAlphaType is set to kPremul_SkAlphaType. - To access pixels after drawing, call flush() or peekPixels(). - - SkCanvas is returned if all parameters are valid. - Valid parameters include: - width and height are zero or positive; - pixels is not nullptr; - rowBytes is zero or large enough to contain width pixels of kN32_SkColorType. - - Pass zero for rowBytes to compute rowBytes from width and size of pixel. - If rowBytes is greater than zero, it must be equal to or greater than - width times bytes required for SkColorType. - - Pixel buffer size should be height times rowBytes. - - @param width pixel column count on raster surface created; must be zero or greater - @param height pixel row count on raster surface created; must be zero or greater - @param pixels pointer to destination pixels buffer; buffer size should be height - times rowBytes - @param rowBytes interval from one SkSurface row to the next, or zero - @return SkCanvas if all parameters are valid; otherwise, nullptr - */ - static std::unique_ptr MakeRasterDirectN32(int width, int height, SkPMColor* pixels, - size_t rowBytes) { - return MakeRasterDirect(SkImageInfo::MakeN32Premul(width, height), pixels, rowBytes); - } - - /** Creates an empty SkCanvas with no backing device or pixels, with - a width and height of zero. - - @return empty SkCanvas - - example: https://fiddle.skia.org/c/@Canvas_empty_constructor - */ - SkCanvas(); - - /** Creates SkCanvas of the specified dimensions without a SkSurface. - Used by subclasses with custom implementations for draw member functions. - - If props equals nullptr, SkSurfaceProps are created with - SkSurfaceProps::InitType settings, which choose the pixel striping - direction and order. Since a platform may dynamically change its direction when - the device is rotated, and since a platform may have multiple monitors with - different characteristics, it is best not to rely on this legacy behavior. - - @param width zero or greater - @param height zero or greater - @param props LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkCanvas placeholder with dimensions - - example: https://fiddle.skia.org/c/@Canvas_int_int_const_SkSurfaceProps_star - */ - SkCanvas(int width, int height, const SkSurfaceProps* props = nullptr); - - /** Private. For internal use only. - */ - explicit SkCanvas(sk_sp device); - - /** Constructs a canvas that draws into bitmap. - Sets kUnknown_SkPixelGeometry in constructed SkSurface. - - SkBitmap is copied so that subsequently editing bitmap will not affect - constructed SkCanvas. - - May be deprecated in the future. - - @param bitmap width, height, SkColorType, SkAlphaType, and pixel - storage of raster surface - @return SkCanvas that can be used to draw into bitmap - - example: https://fiddle.skia.org/c/@Canvas_copy_const_SkBitmap - */ - explicit SkCanvas(const SkBitmap& bitmap); - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - /** Private. - */ - enum class ColorBehavior { - kLegacy, //!< placeholder - }; - - /** Private. For use by Android framework only. - - @param bitmap specifies a bitmap for the canvas to draw into - @param behavior specializes this constructor; value is unused - @return SkCanvas that can be used to draw into bitmap - */ - SkCanvas(const SkBitmap& bitmap, ColorBehavior behavior); -#endif - - /** Constructs a canvas that draws into bitmap. - Use props to match the device characteristics, like LCD striping. - - bitmap is copied so that subsequently editing bitmap will not affect - constructed SkCanvas. - - @param bitmap width, height, SkColorType, SkAlphaType, - and pixel storage of raster surface - @param props order and orientation of RGB striping; and whether to use - device independent fonts - @return SkCanvas that can be used to draw into bitmap - - example: https://fiddle.skia.org/c/@Canvas_const_SkBitmap_const_SkSurfaceProps - */ - SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props); - - /** Draws saved layers, if any. - Frees up resources used by SkCanvas. - - example: https://fiddle.skia.org/c/@Canvas_destructor - */ - virtual ~SkCanvas(); - - /** Returns SkImageInfo for SkCanvas. If SkCanvas is not associated with raster surface or - GPU surface, returned SkColorType is set to kUnknown_SkColorType. - - @return dimensions and SkColorType of SkCanvas - - example: https://fiddle.skia.org/c/@Canvas_imageInfo - */ - SkImageInfo imageInfo() const; - - /** Copies SkSurfaceProps, if SkCanvas is associated with raster surface or - GPU surface, and returns true. Otherwise, returns false and leave props unchanged. - - @param props storage for writable SkSurfaceProps - @return true if SkSurfaceProps was copied - - DEPRECATED: Replace usage with getBaseProps() or getTopProps() - - example: https://fiddle.skia.org/c/@Canvas_getProps - */ - bool getProps(SkSurfaceProps* props) const; - - /** Returns the SkSurfaceProps associated with the canvas (i.e., at the base of the layer - stack). - - @return base SkSurfaceProps - */ - SkSurfaceProps getBaseProps() const; - - /** Returns the SkSurfaceProps associated with the canvas that are currently active (i.e., at - the top of the layer stack). This can differ from getBaseProps depending on the flags - passed to saveLayer (see SaveLayerFlagsSet). - - @return SkSurfaceProps active in the current/top layer - */ - SkSurfaceProps getTopProps() const; - - /** Triggers the immediate execution of all pending draw operations. - If SkCanvas is associated with GPU surface, resolves all pending GPU operations. - If SkCanvas is associated with raster surface, has no effect; raster draw - operations are never deferred. - - DEPRECATED: Replace usage with GrDirectContext::flush() - */ - void flush(); - - /** Gets the size of the base or root layer in global canvas coordinates. The - origin of the base layer is always (0,0). The area available for drawing may be - smaller (due to clipping or saveLayer). - - @return integral width and height of base layer - - example: https://fiddle.skia.org/c/@Canvas_getBaseLayerSize - */ - virtual SkISize getBaseLayerSize() const; - - /** Creates SkSurface matching info and props, and associates it with SkCanvas. - Returns nullptr if no match found. - - If props is nullptr, matches SkSurfaceProps in SkCanvas. If props is nullptr and SkCanvas - does not have SkSurfaceProps, creates SkSurface with default SkSurfaceProps. - - @param info width, height, SkColorType, SkAlphaType, and SkColorSpace - @param props SkSurfaceProps to match; may be nullptr to match SkCanvas - @return SkSurface matching info and props, or nullptr if no match is available - - example: https://fiddle.skia.org/c/@Canvas_makeSurface - */ - sk_sp makeSurface(const SkImageInfo& info, const SkSurfaceProps* props = nullptr); - - /** Returns GPU context of the GPU surface associated with SkCanvas. - - @return GPU context, if available; nullptr otherwise - - example: https://fiddle.skia.org/c/@Canvas_recordingContext - */ - virtual GrRecordingContext* recordingContext(); - - /** Returns Recorder for the GPU surface associated with SkCanvas. - - @return Recorder, if available; nullptr otherwise - */ - virtual skgpu::graphite::Recorder* recorder(); - - /** Sometimes a canvas is owned by a surface. If it is, getSurface() will return a bare - * pointer to that surface, else this will return nullptr. - */ - SkSurface* getSurface() const; - - /** Returns the pixel base address, SkImageInfo, rowBytes, and origin if the pixels - can be read directly. The returned address is only valid - while SkCanvas is in scope and unchanged. Any SkCanvas call or SkSurface call - may invalidate the returned address and other returned values. - - If pixels are inaccessible, info, rowBytes, and origin are unchanged. - - @param info storage for writable pixels' SkImageInfo; may be nullptr - @param rowBytes storage for writable pixels' row bytes; may be nullptr - @param origin storage for SkCanvas top layer origin, its top-left corner; - may be nullptr - @return address of pixels, or nullptr if inaccessible - - example: https://fiddle.skia.org/c/@Canvas_accessTopLayerPixels_a - example: https://fiddle.skia.org/c/@Canvas_accessTopLayerPixels_b - */ - void* accessTopLayerPixels(SkImageInfo* info, size_t* rowBytes, SkIPoint* origin = nullptr); - - /** Returns custom context that tracks the SkMatrix and clip. - - Use SkRasterHandleAllocator to blend Skia drawing with custom drawing, typically performed - by the host platform user interface. The custom context returned is generated by - SkRasterHandleAllocator::MakeCanvas, which creates a custom canvas with raster storage for - the drawing destination. - - @return context of custom allocation - - example: https://fiddle.skia.org/c/@Canvas_accessTopRasterHandle - */ - SkRasterHandleAllocator::Handle accessTopRasterHandle() const; - - /** Returns true if SkCanvas has direct access to its pixels. - - Pixels are readable when SkBaseDevice is raster. Pixels are not readable when SkCanvas - is returned from GPU surface, returned by SkDocument::beginPage, returned by - SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility class - like DebugCanvas. - - pixmap is valid only while SkCanvas is in scope and unchanged. Any - SkCanvas or SkSurface call may invalidate the pixmap values. - - @param pixmap storage for pixel state if pixels are readable; otherwise, ignored - @return true if SkCanvas has direct access to pixels - - example: https://fiddle.skia.org/c/@Canvas_peekPixels - */ - bool peekPixels(SkPixmap* pixmap); - - /** Copies SkRect of pixels from SkCanvas into dstPixels. SkMatrix and clip are - ignored. - - Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()). - Destination SkRect corners are (0, 0) and (dstInfo.width(), dstInfo.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to dstInfo.colorType() and dstInfo.alphaType() if required. - - Pixels are readable when SkBaseDevice is raster, or backed by a GPU. - Pixels are not readable when SkCanvas is returned by SkDocument::beginPage, - returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility - class like DebugCanvas. - - The destination pixel storage must be allocated by the caller. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. dstPixels contents outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down destination. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkCanvas pixels could not be converted to dstInfo.colorType() or dstInfo.alphaType(). - - SkCanvas pixels are not readable; for instance, SkCanvas is document-based. - - dstRowBytes is too small to contain one row of pixels. - - @param dstInfo width, height, SkColorType, and SkAlphaType of dstPixels - @param dstPixels storage for pixels; dstInfo.height() times dstRowBytes, or larger - @param dstRowBytes size of one destination row; dstInfo.width() times pixel size, or larger - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY); - - /** Copies SkRect of pixels from SkCanvas into pixmap. SkMatrix and clip are - ignored. - - Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()). - Destination SkRect corners are (0, 0) and (pixmap.width(), pixmap.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to pixmap.colorType() and pixmap.alphaType() if required. - - Pixels are readable when SkBaseDevice is raster, or backed by a GPU. - Pixels are not readable when SkCanvas is returned by SkDocument::beginPage, - returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility - class like DebugCanvas. - - Caller must allocate pixel storage in pixmap if needed. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination SkRect - are copied. pixmap pixels contents outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down pixmap. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkCanvas pixels could not be converted to pixmap.colorType() or pixmap.alphaType(). - - SkCanvas pixels are not readable; for instance, SkCanvas is document-based. - - SkPixmap pixels could not be allocated. - - pixmap.rowBytes() is too small to contain one row of pixels. - - @param pixmap storage for pixels copied from SkCanvas - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - - example: https://fiddle.skia.org/c/@Canvas_readPixels_2 - */ - bool readPixels(const SkPixmap& pixmap, int srcX, int srcY); - - /** Copies SkRect of pixels from SkCanvas into bitmap. SkMatrix and clip are - ignored. - - Source SkRect corners are (srcX, srcY) and (imageInfo().width(), imageInfo().height()). - Destination SkRect corners are (0, 0) and (bitmap.width(), bitmap.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to bitmap.colorType() and bitmap.alphaType() if required. - - Pixels are readable when SkBaseDevice is raster, or backed by a GPU. - Pixels are not readable when SkCanvas is returned by SkDocument::beginPage, - returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility - class like DebugCanvas. - - Caller must allocate pixel storage in bitmap if needed. - - SkBitmap values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. SkBitmap pixels outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down bitmap. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkCanvas pixels could not be converted to bitmap.colorType() or bitmap.alphaType(). - - SkCanvas pixels are not readable; for instance, SkCanvas is document-based. - - bitmap pixels could not be allocated. - - bitmap.rowBytes() is too small to contain one row of pixels. - - @param bitmap storage for pixels copied from SkCanvas - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - - example: https://fiddle.skia.org/c/@Canvas_readPixels_3 - */ - bool readPixels(const SkBitmap& bitmap, int srcX, int srcY); - - /** Copies SkRect from pixels to SkCanvas. SkMatrix and clip are ignored. - Source SkRect corners are (0, 0) and (info.width(), info.height()). - Destination SkRect corners are (x, y) and - (imageInfo().width(), imageInfo().height()). - - Copies each readable pixel intersecting both rectangles, without scaling, - converting to imageInfo().colorType() and imageInfo().alphaType() if required. - - Pixels are writable when SkBaseDevice is raster, or backed by a GPU. - Pixels are not writable when SkCanvas is returned by SkDocument::beginPage, - returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility - class like DebugCanvas. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. SkCanvas pixels outside SkRect intersection are unchanged. - - Pass negative values for x or y to offset pixels to the left or - above SkCanvas pixels. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - pixels could not be converted to SkCanvas imageInfo().colorType() or - imageInfo().alphaType(). - - SkCanvas pixels are not writable; for instance, SkCanvas is document-based. - - rowBytes is too small to contain one row of pixels. - - @param info width, height, SkColorType, and SkAlphaType of pixels - @param pixels pixels to copy, of size info.height() times rowBytes, or larger - @param rowBytes size of one row of pixels; info.width() times pixel size, or larger - @param x offset into SkCanvas writable pixels on x-axis; may be negative - @param y offset into SkCanvas writable pixels on y-axis; may be negative - @return true if pixels were written to SkCanvas - - example: https://fiddle.skia.org/c/@Canvas_writePixels - */ - bool writePixels(const SkImageInfo& info, const void* pixels, size_t rowBytes, int x, int y); - - /** Copies SkRect from pixels to SkCanvas. SkMatrix and clip are ignored. - Source SkRect corners are (0, 0) and (bitmap.width(), bitmap.height()). - - Destination SkRect corners are (x, y) and - (imageInfo().width(), imageInfo().height()). - - Copies each readable pixel intersecting both rectangles, without scaling, - converting to imageInfo().colorType() and imageInfo().alphaType() if required. - - Pixels are writable when SkBaseDevice is raster, or backed by a GPU. - Pixels are not writable when SkCanvas is returned by SkDocument::beginPage, - returned by SkPictureRecorder::beginRecording, or SkCanvas is the base of a utility - class like DebugCanvas. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. SkCanvas pixels outside SkRect intersection are unchanged. - - Pass negative values for x or y to offset pixels to the left or - above SkCanvas pixels. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - bitmap does not have allocated pixels. - - bitmap pixels could not be converted to SkCanvas imageInfo().colorType() or - imageInfo().alphaType(). - - SkCanvas pixels are not writable; for instance, SkCanvas is document based. - - bitmap pixels are inaccessible; for instance, bitmap wraps a texture. - - @param bitmap contains pixels copied to SkCanvas - @param x offset into SkCanvas writable pixels on x-axis; may be negative - @param y offset into SkCanvas writable pixels on y-axis; may be negative - @return true if pixels were written to SkCanvas - - example: https://fiddle.skia.org/c/@Canvas_writePixels_2 - example: https://fiddle.skia.org/c/@State_Stack_a - example: https://fiddle.skia.org/c/@State_Stack_b - */ - bool writePixels(const SkBitmap& bitmap, int x, int y); - - /** Saves SkMatrix and clip. - Calling restore() discards changes to SkMatrix and clip, - restoring the SkMatrix and clip to their state when save() was called. - - SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), setMatrix(), - and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), clipPath(), clipRegion(). - - Saved SkCanvas state is put on a stack; multiple calls to save() should be balance - by an equal number of calls to restore(). - - Call restoreToCount() with result to restore this and subsequent saves. - - @return depth of saved stack - - example: https://fiddle.skia.org/c/@Canvas_save - */ - int save(); - - /** Saves SkMatrix and clip, and allocates a SkSurface for subsequent drawing. - Calling restore() discards changes to SkMatrix and clip, and draws the SkSurface. - - SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), - setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), - clipPath(), clipRegion(). - - SkRect bounds suggests but does not define the SkSurface size. To clip drawing to - a specific rectangle, use clipRect(). - - Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and - SkBlendMode when restore() is called. - - Call restoreToCount() with returned value to restore this and subsequent saves. - - @param bounds hint to limit the size of the layer; may be nullptr - @param paint graphics state for layer; may be nullptr - @return depth of saved stack - - example: https://fiddle.skia.org/c/@Canvas_saveLayer - example: https://fiddle.skia.org/c/@Canvas_saveLayer_4 - */ - int saveLayer(const SkRect* bounds, const SkPaint* paint); - - /** Saves SkMatrix and clip, and allocates a SkSurface for subsequent drawing. - Calling restore() discards changes to SkMatrix and clip, and draws the SkSurface. - - SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), - setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), - clipPath(), clipRegion(). - - SkRect bounds suggests but does not define the layer size. To clip drawing to - a specific rectangle, use clipRect(). - - Optional SkPaint paint applies alpha, SkColorFilter, SkImageFilter, and - SkBlendMode when restore() is called. - - Call restoreToCount() with returned value to restore this and subsequent saves. - - @param bounds hint to limit the size of layer; may be nullptr - @param paint graphics state for layer; may be nullptr - @return depth of saved stack - */ - int saveLayer(const SkRect& bounds, const SkPaint* paint) { - return this->saveLayer(&bounds, paint); - } - - /** Saves SkMatrix and clip, and allocates SkSurface for subsequent drawing. - - Calling restore() discards changes to SkMatrix and clip, - and blends layer with alpha opacity onto prior layer. - - SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), - setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), - clipPath(), clipRegion(). - - SkRect bounds suggests but does not define layer size. To clip drawing to - a specific rectangle, use clipRect(). - - alpha of zero is fully transparent, 255 is fully opaque. - - Call restoreToCount() with returned value to restore this and subsequent saves. - - @param bounds hint to limit the size of layer; may be nullptr - @param alpha opacity of layer - @return depth of saved stack - - example: https://fiddle.skia.org/c/@Canvas_saveLayerAlpha - */ - int saveLayerAlpha(const SkRect* bounds, U8CPU alpha); - - /** \enum SkCanvas::SaveLayerFlagsSet - SaveLayerFlags provides options that may be used in any combination in SaveLayerRec, - defining how layer allocated by saveLayer() operates. It may be set to zero, - kPreserveLCDText_SaveLayerFlag, kInitWithPrevious_SaveLayerFlag, or both flags. - */ - enum SaveLayerFlagsSet { - kPreserveLCDText_SaveLayerFlag = 1 << 1, - kInitWithPrevious_SaveLayerFlag = 1 << 2, //!< initializes with previous contents - // instead of matching previous layer's colortype, use F16 - kF16ColorType = 1 << 4, - }; - - typedef uint32_t SaveLayerFlags; - - /** \struct SkCanvas::SaveLayerRec - SaveLayerRec contains the state used to create the layer. - */ - struct SaveLayerRec { - /** Sets fBounds, fPaint, and fBackdrop to nullptr. Clears fSaveLayerFlags. - - @return empty SaveLayerRec - */ - SaveLayerRec() {} - - /** Sets fBounds, fPaint, and fSaveLayerFlags; sets fBackdrop to nullptr. - - @param bounds layer dimensions; may be nullptr - @param paint applied to layer when overlaying prior layer; may be nullptr - @param saveLayerFlags SaveLayerRec options to modify layer - @return SaveLayerRec with empty fBackdrop - */ - SaveLayerRec(const SkRect* bounds, const SkPaint* paint, SaveLayerFlags saveLayerFlags = 0) - : SaveLayerRec(bounds, paint, nullptr, 1.f, saveLayerFlags) {} - - /** Sets fBounds, fPaint, fBackdrop, and fSaveLayerFlags. - - @param bounds layer dimensions; may be nullptr - @param paint applied to layer when overlaying prior layer; - may be nullptr - @param backdrop If not null, this causes the current layer to be filtered by - backdrop, and then drawn into the new layer - (respecting the current clip). - If null, the new layer is initialized with transparent-black. - @param saveLayerFlags SaveLayerRec options to modify layer - @return SaveLayerRec fully specified - */ - SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* backdrop, - SaveLayerFlags saveLayerFlags) - : SaveLayerRec(bounds, paint, backdrop, 1.f, saveLayerFlags) {} - - /** hints at layer size limit */ - const SkRect* fBounds = nullptr; - - /** modifies overlay */ - const SkPaint* fPaint = nullptr; - - /** - * If not null, this triggers the same initialization behavior as setting - * kInitWithPrevious_SaveLayerFlag on fSaveLayerFlags: the current layer is copied into - * the new layer, rather than initializing the new layer with transparent-black. - * This is then filtered by fBackdrop (respecting the current clip). - */ - const SkImageFilter* fBackdrop = nullptr; - - /** preserves LCD text, creates with prior layer contents */ - SaveLayerFlags fSaveLayerFlags = 0; - - private: - friend class SkCanvas; - friend class SkCanvasPriv; - - SaveLayerRec(const SkRect* bounds, const SkPaint* paint, const SkImageFilter* backdrop, - SkScalar backdropScale, SaveLayerFlags saveLayerFlags) - : fBounds(bounds) - , fPaint(paint) - , fBackdrop(backdrop) - , fSaveLayerFlags(saveLayerFlags) - , fExperimentalBackdropScale(backdropScale) {} - - // Relative scale factor that the image content used to initialize the layer when the - // kInitFromPrevious flag or a backdrop filter is used. - SkScalar fExperimentalBackdropScale = 1.f; - }; - - /** Saves SkMatrix and clip, and allocates SkSurface for subsequent drawing. - - Calling restore() discards changes to SkMatrix and clip, - and blends SkSurface with alpha opacity onto the prior layer. - - SkMatrix may be changed by translate(), scale(), rotate(), skew(), concat(), - setMatrix(), and resetMatrix(). Clip may be changed by clipRect(), clipRRect(), - clipPath(), clipRegion(). - - SaveLayerRec contains the state used to create the layer. - - Call restoreToCount() with returned value to restore this and subsequent saves. - - @param layerRec layer state - @return depth of save state stack before this call was made. - - example: https://fiddle.skia.org/c/@Canvas_saveLayer_3 - */ - int saveLayer(const SaveLayerRec& layerRec); - - /** Removes changes to SkMatrix and clip since SkCanvas state was - last saved. The state is removed from the stack. - - Does nothing if the stack is empty. - - example: https://fiddle.skia.org/c/@AutoCanvasRestore_restore - - example: https://fiddle.skia.org/c/@Canvas_restore - */ - void restore(); - - /** Returns the number of saved states, each containing: SkMatrix and clip. - Equals the number of save() calls less the number of restore() calls plus one. - The save count of a new canvas is one. - - @return depth of save state stack - - example: https://fiddle.skia.org/c/@Canvas_getSaveCount - */ - int getSaveCount() const; - - /** Restores state to SkMatrix and clip values when save(), saveLayer(), - saveLayerPreserveLCDTextRequests(), or saveLayerAlpha() returned saveCount. - - Does nothing if saveCount is greater than state stack count. - Restores state to initial values if saveCount is less than or equal to one. - - @param saveCount depth of state stack to restore - - example: https://fiddle.skia.org/c/@Canvas_restoreToCount - */ - void restoreToCount(int saveCount); - - /** Translates SkMatrix by dx along the x-axis and dy along the y-axis. - - Mathematically, replaces SkMatrix with a translation matrix - premultiplied with SkMatrix. - - This has the effect of moving the drawing by (dx, dy) before transforming - the result with SkMatrix. - - @param dx distance to translate on x-axis - @param dy distance to translate on y-axis - - example: https://fiddle.skia.org/c/@Canvas_translate - */ - void translate(SkScalar dx, SkScalar dy); - - /** Scales SkMatrix by sx on the x-axis and sy on the y-axis. - - Mathematically, replaces SkMatrix with a scale matrix - premultiplied with SkMatrix. - - This has the effect of scaling the drawing by (sx, sy) before transforming - the result with SkMatrix. - - @param sx amount to scale on x-axis - @param sy amount to scale on y-axis - - example: https://fiddle.skia.org/c/@Canvas_scale - */ - void scale(SkScalar sx, SkScalar sy); - - /** Rotates SkMatrix by degrees. Positive degrees rotates clockwise. - - Mathematically, replaces SkMatrix with a rotation matrix - premultiplied with SkMatrix. - - This has the effect of rotating the drawing by degrees before transforming - the result with SkMatrix. - - @param degrees amount to rotate, in degrees - - example: https://fiddle.skia.org/c/@Canvas_rotate - */ - void rotate(SkScalar degrees); - - /** Rotates SkMatrix by degrees about a point at (px, py). Positive degrees rotates - clockwise. - - Mathematically, constructs a rotation matrix; premultiplies the rotation matrix by - a translation matrix; then replaces SkMatrix with the resulting matrix - premultiplied with SkMatrix. - - This has the effect of rotating the drawing about a given point before - transforming the result with SkMatrix. - - @param degrees amount to rotate, in degrees - @param px x-axis value of the point to rotate about - @param py y-axis value of the point to rotate about - - example: https://fiddle.skia.org/c/@Canvas_rotate_2 - */ - void rotate(SkScalar degrees, SkScalar px, SkScalar py); - - /** Skews SkMatrix by sx on the x-axis and sy on the y-axis. A positive value of sx - skews the drawing right as y-axis values increase; a positive value of sy skews - the drawing down as x-axis values increase. - - Mathematically, replaces SkMatrix with a skew matrix premultiplied with SkMatrix. - - This has the effect of skewing the drawing by (sx, sy) before transforming - the result with SkMatrix. - - @param sx amount to skew on x-axis - @param sy amount to skew on y-axis - - example: https://fiddle.skia.org/c/@Canvas_skew - */ - void skew(SkScalar sx, SkScalar sy); - - /** Replaces SkMatrix with matrix premultiplied with existing SkMatrix. - - This has the effect of transforming the drawn geometry by matrix, before - transforming the result with existing SkMatrix. - - @param matrix matrix to premultiply with existing SkMatrix - - example: https://fiddle.skia.org/c/@Canvas_concat - */ - void concat(const SkMatrix& matrix); - void concat(const SkM44&); - - /** Replaces SkMatrix with matrix. - Unlike concat(), any prior matrix state is overwritten. - - @param matrix matrix to copy, replacing existing SkMatrix - - example: https://fiddle.skia.org/c/@Canvas_setMatrix - */ - void setMatrix(const SkM44& matrix); - - // DEPRECATED -- use SkM44 version - void setMatrix(const SkMatrix& matrix); - - /** Sets SkMatrix to the identity matrix. - Any prior matrix state is overwritten. - - example: https://fiddle.skia.org/c/@Canvas_resetMatrix - */ - void resetMatrix(); - - /** Replaces clip with the intersection or difference of clip and rect, - with an aliased or anti-aliased clip edge. rect is transformed by SkMatrix - before it is combined with clip. - - @param rect SkRect to combine with clip - @param op SkClipOp to apply to clip - @param doAntiAlias true if clip is to be anti-aliased - - example: https://fiddle.skia.org/c/@Canvas_clipRect - */ - void clipRect(const SkRect& rect, SkClipOp op, bool doAntiAlias); - - /** Replaces clip with the intersection or difference of clip and rect. - Resulting clip is aliased; pixels are fully contained by the clip. - rect is transformed by SkMatrix before it is combined with clip. - - @param rect SkRect to combine with clip - @param op SkClipOp to apply to clip - */ - void clipRect(const SkRect& rect, SkClipOp op) { - this->clipRect(rect, op, false); - } - - /** Replaces clip with the intersection of clip and rect. - Resulting clip is aliased; pixels are fully contained by the clip. - rect is transformed by SkMatrix - before it is combined with clip. - - @param rect SkRect to combine with clip - @param doAntiAlias true if clip is to be anti-aliased - */ - void clipRect(const SkRect& rect, bool doAntiAlias = false) { - this->clipRect(rect, SkClipOp::kIntersect, doAntiAlias); - } - - void clipIRect(const SkIRect& irect, SkClipOp op = SkClipOp::kIntersect) { - this->clipRect(SkRect::Make(irect), op, false); - } - - /** Sets the maximum clip rectangle, which can be set by clipRect(), clipRRect() and - clipPath() and intersect the current clip with the specified rect. - The maximum clip affects only future clipping operations; it is not retroactive. - The clip restriction is not recorded in pictures. - - Pass an empty rect to disable maximum clip. - This private API is for use by Android framework only. - - DEPRECATED: Replace usage with SkAndroidFrameworkUtils::replaceClip() - - @param rect maximum allowed clip in device coordinates - */ - void androidFramework_setDeviceClipRestriction(const SkIRect& rect); - - /** Replaces clip with the intersection or difference of clip and rrect, - with an aliased or anti-aliased clip edge. - rrect is transformed by SkMatrix - before it is combined with clip. - - @param rrect SkRRect to combine with clip - @param op SkClipOp to apply to clip - @param doAntiAlias true if clip is to be anti-aliased - - example: https://fiddle.skia.org/c/@Canvas_clipRRect - */ - void clipRRect(const SkRRect& rrect, SkClipOp op, bool doAntiAlias); - - /** Replaces clip with the intersection or difference of clip and rrect. - Resulting clip is aliased; pixels are fully contained by the clip. - rrect is transformed by SkMatrix before it is combined with clip. - - @param rrect SkRRect to combine with clip - @param op SkClipOp to apply to clip - */ - void clipRRect(const SkRRect& rrect, SkClipOp op) { - this->clipRRect(rrect, op, false); - } - - /** Replaces clip with the intersection of clip and rrect, - with an aliased or anti-aliased clip edge. - rrect is transformed by SkMatrix before it is combined with clip. - - @param rrect SkRRect to combine with clip - @param doAntiAlias true if clip is to be anti-aliased - */ - void clipRRect(const SkRRect& rrect, bool doAntiAlias = false) { - this->clipRRect(rrect, SkClipOp::kIntersect, doAntiAlias); - } - - /** Replaces clip with the intersection or difference of clip and path, - with an aliased or anti-aliased clip edge. SkPath::FillType determines if path - describes the area inside or outside its contours; and if path contour overlaps - itself or another path contour, whether the overlaps form part of the area. - path is transformed by SkMatrix before it is combined with clip. - - @param path SkPath to combine with clip - @param op SkClipOp to apply to clip - @param doAntiAlias true if clip is to be anti-aliased - - example: https://fiddle.skia.org/c/@Canvas_clipPath - */ - void clipPath(const SkPath& path, SkClipOp op, bool doAntiAlias); - - /** Replaces clip with the intersection or difference of clip and path. - Resulting clip is aliased; pixels are fully contained by the clip. - SkPath::FillType determines if path - describes the area inside or outside its contours; and if path contour overlaps - itself or another path contour, whether the overlaps form part of the area. - path is transformed by SkMatrix - before it is combined with clip. - - @param path SkPath to combine with clip - @param op SkClipOp to apply to clip - */ - void clipPath(const SkPath& path, SkClipOp op) { - this->clipPath(path, op, false); - } - - /** Replaces clip with the intersection of clip and path. - Resulting clip is aliased; pixels are fully contained by the clip. - SkPath::FillType determines if path - describes the area inside or outside its contours; and if path contour overlaps - itself or another path contour, whether the overlaps form part of the area. - path is transformed by SkMatrix before it is combined with clip. - - @param path SkPath to combine with clip - @param doAntiAlias true if clip is to be anti-aliased - */ - void clipPath(const SkPath& path, bool doAntiAlias = false) { - this->clipPath(path, SkClipOp::kIntersect, doAntiAlias); - } - - void clipShader(sk_sp, SkClipOp = SkClipOp::kIntersect); - - /** Replaces clip with the intersection or difference of clip and SkRegion deviceRgn. - Resulting clip is aliased; pixels are fully contained by the clip. - deviceRgn is unaffected by SkMatrix. - - @param deviceRgn SkRegion to combine with clip - @param op SkClipOp to apply to clip - - example: https://fiddle.skia.org/c/@Canvas_clipRegion - */ - void clipRegion(const SkRegion& deviceRgn, SkClipOp op = SkClipOp::kIntersect); - - /** Returns true if SkRect rect, transformed by SkMatrix, can be quickly determined to be - outside of clip. May return false even though rect is outside of clip. - - Use to check if an area to be drawn is clipped out, to skip subsequent draw calls. - - @param rect SkRect to compare with clip - @return true if rect, transformed by SkMatrix, does not intersect clip - - example: https://fiddle.skia.org/c/@Canvas_quickReject - */ - bool quickReject(const SkRect& rect) const; - - /** Returns true if path, transformed by SkMatrix, can be quickly determined to be - outside of clip. May return false even though path is outside of clip. - - Use to check if an area to be drawn is clipped out, to skip subsequent draw calls. - - @param path SkPath to compare with clip - @return true if path, transformed by SkMatrix, does not intersect clip - - example: https://fiddle.skia.org/c/@Canvas_quickReject_2 - */ - bool quickReject(const SkPath& path) const; - - /** Returns bounds of clip, transformed by inverse of SkMatrix. If clip is empty, - return SkRect::MakeEmpty, where all SkRect sides equal zero. - - SkRect returned is outset by one to account for partial pixel coverage if clip - is anti-aliased. - - @return bounds of clip in local coordinates - - example: https://fiddle.skia.org/c/@Canvas_getLocalClipBounds - */ - SkRect getLocalClipBounds() const; - - /** Returns bounds of clip, transformed by inverse of SkMatrix. If clip is empty, - return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero. - - bounds is outset by one to account for partial pixel coverage if clip - is anti-aliased. - - @param bounds SkRect of clip in local coordinates - @return true if clip bounds is not empty - */ - bool getLocalClipBounds(SkRect* bounds) const { - *bounds = this->getLocalClipBounds(); - return !bounds->isEmpty(); - } - - /** Returns SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty, - return SkRect::MakeEmpty, where all SkRect sides equal zero. - - Unlike getLocalClipBounds(), returned SkIRect is not outset. - - @return bounds of clip in SkBaseDevice coordinates - - example: https://fiddle.skia.org/c/@Canvas_getDeviceClipBounds - */ - SkIRect getDeviceClipBounds() const; - - /** Returns SkIRect bounds of clip, unaffected by SkMatrix. If clip is empty, - return false, and set bounds to SkRect::MakeEmpty, where all SkRect sides equal zero. - - Unlike getLocalClipBounds(), bounds is not outset. - - @param bounds SkRect of clip in device coordinates - @return true if clip bounds is not empty - */ - bool getDeviceClipBounds(SkIRect* bounds) const { - *bounds = this->getDeviceClipBounds(); - return !bounds->isEmpty(); - } - - /** Fills clip with color color. - mode determines how ARGB is combined with destination. - - @param color unpremultiplied ARGB - @param mode SkBlendMode used to combine source color and destination - - example: https://fiddle.skia.org/c/@Canvas_drawColor - */ - void drawColor(SkColor color, SkBlendMode mode = SkBlendMode::kSrcOver) { - this->drawColor(SkColor4f::FromColor(color), mode); - } - - /** Fills clip with color color. - mode determines how ARGB is combined with destination. - - @param color SkColor4f representing unpremultiplied color. - @param mode SkBlendMode used to combine source color and destination - */ - void drawColor(const SkColor4f& color, SkBlendMode mode = SkBlendMode::kSrcOver); - - /** Fills clip with color color using SkBlendMode::kSrc. - This has the effect of replacing all pixels contained by clip with color. - - @param color unpremultiplied ARGB - */ - void clear(SkColor color) { - this->clear(SkColor4f::FromColor(color)); - } - - /** Fills clip with color color using SkBlendMode::kSrc. - This has the effect of replacing all pixels contained by clip with color. - - @param color SkColor4f representing unpremultiplied color. - */ - void clear(const SkColor4f& color) { - this->drawColor(color, SkBlendMode::kSrc); - } - - /** Makes SkCanvas contents undefined. Subsequent calls that read SkCanvas pixels, - such as drawing with SkBlendMode, return undefined results. discard() does - not change clip or SkMatrix. - - discard() may do nothing, depending on the implementation of SkSurface or SkBaseDevice - that created SkCanvas. - - discard() allows optimized performance on subsequent draws by removing - cached data associated with SkSurface or SkBaseDevice. - It is not necessary to call discard() once done with SkCanvas; - any cached data is deleted when owning SkSurface or SkBaseDevice is deleted. - */ - void discard() { this->onDiscard(); } - - /** Fills clip with SkPaint paint. SkPaint components, SkShader, - SkColorFilter, SkImageFilter, and SkBlendMode affect drawing; - SkMaskFilter and SkPathEffect in paint are ignored. - - @param paint graphics state used to fill SkCanvas - - example: https://fiddle.skia.org/c/@Canvas_drawPaint - */ - void drawPaint(const SkPaint& paint); - - /** \enum SkCanvas::PointMode - Selects if an array of points are drawn as discrete points, as lines, or as - an open polygon. - */ - enum PointMode { - kPoints_PointMode, //!< draw each point separately - kLines_PointMode, //!< draw each pair of points as a line segment - kPolygon_PointMode, //!< draw the array of points as a open polygon - }; - - /** Draws pts using clip, SkMatrix and SkPaint paint. - count is the number of points; if count is less than one, has no effect. - mode may be one of: kPoints_PointMode, kLines_PointMode, or kPolygon_PointMode. - - If mode is kPoints_PointMode, the shape of point drawn depends on paint - SkPaint::Cap. If paint is set to SkPaint::kRound_Cap, each point draws a - circle of diameter SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap - or SkPaint::kButt_Cap, each point draws a square of width and height - SkPaint stroke width. - - If mode is kLines_PointMode, each pair of points draws a line segment. - One line is drawn for every two points; each point is used once. If count is odd, - the final point is ignored. - - If mode is kPolygon_PointMode, each adjacent pair of points draws a line segment. - count minus one lines are drawn; the first and last point are used once. - - Each line segment respects paint SkPaint::Cap and SkPaint stroke width. - SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style. - - Always draws each element one at a time; is not affected by - SkPaint::Join, and unlike drawPath(), does not create a mask from all points - and lines before drawing. - - @param mode whether pts draws points or lines - @param count number of points in the array - @param pts array of points to draw - @param paint stroke, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawPoints - */ - void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint& paint); - - /** Draws point at (x, y) using clip, SkMatrix and SkPaint paint. - - The shape of point drawn depends on paint SkPaint::Cap. - If paint is set to SkPaint::kRound_Cap, draw a circle of diameter - SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap or SkPaint::kButt_Cap, - draw a square of width and height SkPaint stroke width. - SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style. - - @param x left edge of circle or square - @param y top edge of circle or square - @param paint stroke, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawPoint - */ - void drawPoint(SkScalar x, SkScalar y, const SkPaint& paint); - - /** Draws point p using clip, SkMatrix and SkPaint paint. - - The shape of point drawn depends on paint SkPaint::Cap. - If paint is set to SkPaint::kRound_Cap, draw a circle of diameter - SkPaint stroke width. If paint is set to SkPaint::kSquare_Cap or SkPaint::kButt_Cap, - draw a square of width and height SkPaint stroke width. - SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style. - - @param p top-left edge of circle or square - @param paint stroke, blend, color, and so on, used to draw - */ - void drawPoint(SkPoint p, const SkPaint& paint) { - this->drawPoint(p.x(), p.y(), paint); - } - - /** Draws line segment from (x0, y0) to (x1, y1) using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint stroke width describes the line thickness; - SkPaint::Cap draws the end rounded or square; - SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style. - - @param x0 start of line segment on x-axis - @param y0 start of line segment on y-axis - @param x1 end of line segment on x-axis - @param y1 end of line segment on y-axis - @param paint stroke, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawLine - */ - void drawLine(SkScalar x0, SkScalar y0, SkScalar x1, SkScalar y1, const SkPaint& paint); - - /** Draws line segment from p0 to p1 using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint stroke width describes the line thickness; - SkPaint::Cap draws the end rounded or square; - SkPaint::Style is ignored, as if were set to SkPaint::kStroke_Style. - - @param p0 start of line segment - @param p1 end of line segment - @param paint stroke, blend, color, and so on, used to draw - */ - void drawLine(SkPoint p0, SkPoint p1, const SkPaint& paint) { - this->drawLine(p0.x(), p0.y(), p1.x(), p1.y(), paint); - } - - /** Draws SkRect rect using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint::Style determines if rectangle is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness, and - SkPaint::Join draws the corners rounded or square. - - @param rect rectangle to draw - @param paint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawRect - */ - void drawRect(const SkRect& rect, const SkPaint& paint); - - /** Draws SkIRect rect using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint::Style determines if rectangle is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness, and - SkPaint::Join draws the corners rounded or square. - - @param rect rectangle to draw - @param paint stroke or fill, blend, color, and so on, used to draw - */ - void drawIRect(const SkIRect& rect, const SkPaint& paint) { - SkRect r; - r.set(rect); // promotes the ints to scalars - this->drawRect(r, paint); - } - - /** Draws SkRegion region using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint::Style determines if rectangle is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness, and - SkPaint::Join draws the corners rounded or square. - - @param region region to draw - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawRegion - */ - void drawRegion(const SkRegion& region, const SkPaint& paint); - - /** Draws oval oval using clip, SkMatrix, and SkPaint. - In paint: SkPaint::Style determines if oval is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - - @param oval SkRect bounds of oval - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawOval - */ - void drawOval(const SkRect& oval, const SkPaint& paint); - - /** Draws SkRRect rrect using clip, SkMatrix, and SkPaint paint. - In paint: SkPaint::Style determines if rrect is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - - rrect may represent a rectangle, circle, oval, uniformly rounded rectangle, or - may have any combination of positive non-square radii for the four corners. - - @param rrect SkRRect with up to eight corner radii to draw - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawRRect - */ - void drawRRect(const SkRRect& rrect, const SkPaint& paint); - - /** Draws SkRRect outer and inner - using clip, SkMatrix, and SkPaint paint. - outer must contain inner or the drawing is undefined. - In paint: SkPaint::Style determines if SkRRect is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - If stroked and SkRRect corner has zero length radii, SkPaint::Join can - draw corners rounded or square. - - GPU-backed platforms optimize drawing when both outer and inner are - concave and outer contains inner. These platforms may not be able to draw - SkPath built with identical data as fast. - - @param outer SkRRect outer bounds to draw - @param inner SkRRect inner bounds to draw - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawDRRect_a - example: https://fiddle.skia.org/c/@Canvas_drawDRRect_b - */ - void drawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint); - - /** Draws circle at (cx, cy) with radius using clip, SkMatrix, and SkPaint paint. - If radius is zero or less, nothing is drawn. - In paint: SkPaint::Style determines if circle is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - - @param cx circle center on the x-axis - @param cy circle center on the y-axis - @param radius half the diameter of circle - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawCircle - */ - void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint& paint); - - /** Draws circle at center with radius using clip, SkMatrix, and SkPaint paint. - If radius is zero or less, nothing is drawn. - In paint: SkPaint::Style determines if circle is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - - @param center circle center - @param radius half the diameter of circle - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - */ - void drawCircle(SkPoint center, SkScalar radius, const SkPaint& paint) { - this->drawCircle(center.x(), center.y(), radius, paint); - } - - /** Draws arc using clip, SkMatrix, and SkPaint paint. - - Arc is part of oval bounded by oval, sweeping from startAngle to startAngle plus - sweepAngle. startAngle and sweepAngle are in degrees. - - startAngle of zero places start point at the right middle edge of oval. - A positive sweepAngle places arc end point clockwise from start point; - a negative sweepAngle places arc end point counterclockwise from start point. - sweepAngle may exceed 360 degrees, a full circle. - If useCenter is true, draw a wedge that includes lines from oval - center to arc end points. If useCenter is false, draw arc between end points. - - If SkRect oval is empty or sweepAngle is zero, nothing is drawn. - - @param oval SkRect bounds of oval containing arc to draw - @param startAngle angle in degrees where arc begins - @param sweepAngle sweep angle in degrees; positive is clockwise - @param useCenter if true, include the center of the oval - @param paint SkPaint stroke or fill, blend, color, and so on, used to draw - */ - void drawArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, - bool useCenter, const SkPaint& paint); - - /** Draws SkRRect bounded by SkRect rect, with corner radii (rx, ry) using clip, - SkMatrix, and SkPaint paint. - - In paint: SkPaint::Style determines if SkRRect is stroked or filled; - if stroked, SkPaint stroke width describes the line thickness. - If rx or ry are less than zero, they are treated as if they are zero. - If rx plus ry exceeds rect width or rect height, radii are scaled down to fit. - If rx and ry are zero, SkRRect is drawn as SkRect and if stroked is affected by - SkPaint::Join. - - @param rect SkRect bounds of SkRRect to draw - @param rx axis length on x-axis of oval describing rounded corners - @param ry axis length on y-axis of oval describing rounded corners - @param paint stroke, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawRoundRect - */ - void drawRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, const SkPaint& paint); - - /** Draws SkPath path using clip, SkMatrix, and SkPaint paint. - SkPath contains an array of path contour, each of which may be open or closed. - - In paint: SkPaint::Style determines if SkRRect is stroked or filled: - if filled, SkPath::FillType determines whether path contour describes inside or - outside of fill; if stroked, SkPaint stroke width describes the line thickness, - SkPaint::Cap describes line ends, and SkPaint::Join describes how - corners are drawn. - - @param path SkPath to draw - @param paint stroke, blend, color, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawPath - */ - void drawPath(const SkPath& path, const SkPaint& paint); - - void drawImage(const SkImage* image, SkScalar left, SkScalar top) { - this->drawImage(image, left, top, SkSamplingOptions(), nullptr); - } - void drawImage(const sk_sp& image, SkScalar left, SkScalar top) { - this->drawImage(image.get(), left, top, SkSamplingOptions(), nullptr); - } - - /** \enum SkCanvas::SrcRectConstraint - SrcRectConstraint controls the behavior at the edge of source SkRect, - provided to drawImageRect() when there is any filtering. If kStrict is set, - then extra code is used to ensure it never samples outside of the src-rect. - kStrict_SrcRectConstraint disables the use of mipmaps and anisotropic filtering. - */ - enum SrcRectConstraint { - kStrict_SrcRectConstraint, //!< sample only inside bounds; slower - kFast_SrcRectConstraint, //!< sample outside bounds; faster - }; - - void drawImage(const SkImage*, SkScalar x, SkScalar y, const SkSamplingOptions&, - const SkPaint* = nullptr); - void drawImage(const sk_sp& image, SkScalar x, SkScalar y, - const SkSamplingOptions& sampling, const SkPaint* paint = nullptr) { - this->drawImage(image.get(), x, y, sampling, paint); - } - void drawImageRect(const SkImage*, const SkRect& src, const SkRect& dst, - const SkSamplingOptions&, const SkPaint*, SrcRectConstraint); - void drawImageRect(const SkImage*, const SkRect& dst, const SkSamplingOptions&, - const SkPaint* = nullptr); - void drawImageRect(const sk_sp& image, const SkRect& src, const SkRect& dst, - const SkSamplingOptions& sampling, const SkPaint* paint, - SrcRectConstraint constraint) { - this->drawImageRect(image.get(), src, dst, sampling, paint, constraint); - } - void drawImageRect(const sk_sp& image, const SkRect& dst, - const SkSamplingOptions& sampling, const SkPaint* paint = nullptr) { - this->drawImageRect(image.get(), dst, sampling, paint); - } - - /** Draws SkImage image stretched proportionally to fit into SkRect dst. - SkIRect center divides the image into nine sections: four sides, four corners, and - the center. Corners are unmodified or scaled down proportionately if their sides - are larger than dst; center and four sides are scaled to fit remaining space, if any. - - Additionally transform draw using clip, SkMatrix, and optional SkPaint paint. - - If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter, and - SkBlendMode. If image is kAlpha_8_SkColorType, apply SkShader. - If paint contains SkMaskFilter, generate mask from image bounds. - Any SkMaskFilter on paint is ignored as is paint anti-aliasing state. - - If generated mask extends beyond image bounds, replicate image edge colors, just - as SkShader made from SkImage::makeShader with SkShader::kClamp_TileMode set - replicates the image edge color when it samples outside of its bounds. - - @param image SkImage containing pixels, dimensions, and format - @param center SkIRect edge of image corners and sides - @param dst destination SkRect of image to draw to - @param filter what technique to use when sampling the image - @param paint SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter, - and so on; or nullptr - */ - void drawImageNine(const SkImage* image, const SkIRect& center, const SkRect& dst, - SkFilterMode filter, const SkPaint* paint = nullptr); - - /** \struct SkCanvas::Lattice - SkCanvas::Lattice divides SkBitmap or SkImage into a rectangular grid. - Grid entries on even columns and even rows are fixed; these entries are - always drawn at their original size if the destination is large enough. - If the destination side is too small to hold the fixed entries, all fixed - entries are proportionately scaled down to fit. - The grid entries not on even columns and rows are scaled to fit the - remaining space, if any. - */ - struct Lattice { - - /** \enum SkCanvas::Lattice::RectType - Optional setting per rectangular grid entry to make it transparent, - or to fill the grid entry with a color. - */ - enum RectType : uint8_t { - kDefault = 0, //!< draws SkBitmap into lattice rectangle - kTransparent, //!< skips lattice rectangle by making it transparent - kFixedColor, //!< draws one of fColors into lattice rectangle - }; - - const int* fXDivs; //!< x-axis values dividing bitmap - const int* fYDivs; //!< y-axis values dividing bitmap - const RectType* fRectTypes; //!< array of fill types - int fXCount; //!< number of x-coordinates - int fYCount; //!< number of y-coordinates - const SkIRect* fBounds; //!< source bounds to draw from - const SkColor* fColors; //!< array of colors - }; - - /** Draws SkImage image stretched proportionally to fit into SkRect dst. - - SkCanvas::Lattice lattice divides image into a rectangular grid. - Each intersection of an even-numbered row and column is fixed; - fixed lattice elements never scale larger than their initial - size and shrink proportionately when all fixed elements exceed the bitmap - dimension. All other grid elements scale to fill the available space, if any. - - Additionally transform draw using clip, SkMatrix, and optional SkPaint paint. - - If SkPaint paint is supplied, apply SkColorFilter, alpha, SkImageFilter, and - SkBlendMode. If image is kAlpha_8_SkColorType, apply SkShader. - If paint contains SkMaskFilter, generate mask from image bounds. - Any SkMaskFilter on paint is ignored as is paint anti-aliasing state. - - If generated mask extends beyond bitmap bounds, replicate bitmap edge colors, - just as SkShader made from SkShader::MakeBitmapShader with - SkShader::kClamp_TileMode set replicates the bitmap edge color when it samples - outside of its bounds. - - @param image SkImage containing pixels, dimensions, and format - @param lattice division of bitmap into fixed and variable rectangles - @param dst destination SkRect of image to draw to - @param filter what technique to use when sampling the image - @param paint SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter, - and so on; or nullptr - */ - void drawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst, - SkFilterMode filter, const SkPaint* paint = nullptr); - void drawImageLattice(const SkImage* image, const Lattice& lattice, const SkRect& dst) { - this->drawImageLattice(image, lattice, dst, SkFilterMode::kNearest, nullptr); - } - - /** - * Experimental. Controls anti-aliasing of each edge of images in an image-set. - */ - enum QuadAAFlags : unsigned { - kLeft_QuadAAFlag = 0b0001, - kTop_QuadAAFlag = 0b0010, - kRight_QuadAAFlag = 0b0100, - kBottom_QuadAAFlag = 0b1000, - - kNone_QuadAAFlags = 0b0000, - kAll_QuadAAFlags = 0b1111, - }; - - /** This is used by the experimental API below. */ - struct SK_API ImageSetEntry { - ImageSetEntry(sk_sp image, const SkRect& srcRect, const SkRect& dstRect, - int matrixIndex, float alpha, unsigned aaFlags, bool hasClip); - - ImageSetEntry(sk_sp image, const SkRect& srcRect, const SkRect& dstRect, - float alpha, unsigned aaFlags); - - ImageSetEntry(); - ~ImageSetEntry(); - ImageSetEntry(const ImageSetEntry&); - ImageSetEntry& operator=(const ImageSetEntry&); - - sk_sp fImage; - SkRect fSrcRect; - SkRect fDstRect; - int fMatrixIndex = -1; // Index into the preViewMatrices arg, or < 0 - float fAlpha = 1.f; - unsigned fAAFlags = kNone_QuadAAFlags; // QuadAAFlags - bool fHasClip = false; // True to use next 4 points in dstClip arg as quad - }; - - /** - * This is an experimental API for the SkiaRenderer Chromium project, and its API will surely - * evolve if it is not removed outright. - * - * This behaves very similarly to drawRect() combined with a clipPath() formed by clip - * quadrilateral. 'rect' and 'clip' are in the same coordinate space. If 'clip' is null, then it - * is as if the rectangle was not clipped (or, alternatively, clipped to itself). If not null, - * then it must provide 4 points. - * - * In addition to combining the draw and clipping into one operation, this function adds the - * additional capability of controlling each of the rectangle's edges anti-aliasing - * independently. The edges of the clip will respect the per-edge AA flags. It is required that - * 'clip' be contained inside 'rect'. In terms of mapping to edge labels, the 'clip' points - * should be ordered top-left, top-right, bottom-right, bottom-left so that the edge between [0] - * and [1] is "top", [1] and [2] is "right", [2] and [3] is "bottom", and [3] and [0] is "left". - * This ordering matches SkRect::toQuad(). - * - * This API only draws solid color, filled rectangles so it does not accept a full SkPaint. - */ - void experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags, - const SkColor4f& color, SkBlendMode mode); - void experimental_DrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags, - SkColor color, SkBlendMode mode) { - this->experimental_DrawEdgeAAQuad(rect, clip, aaFlags, SkColor4f::FromColor(color), mode); - } - - /** - * This is an bulk variant of experimental_DrawEdgeAAQuad() that renders 'cnt' textured quads. - * For each entry, 'fDstRect' is rendered with its clip (determined by entry's 'fHasClip' and - * the current index in 'dstClip'). The entry's fImage is applied to the destination rectangle - * by sampling from 'fSrcRect' sub-image. The corners of 'fSrcRect' map to the corners of - * 'fDstRect', just like in drawImageRect(), and they will be properly interpolated when - * applying a clip. - * - * Like experimental_DrawEdgeAAQuad(), each entry can specify edge AA flags that apply to both - * the destination rect and its clip. - * - * If provided, the 'dstClips' array must have length equal 4 * the number of entries with - * fHasClip true. If 'dstClips' is null, every entry must have 'fHasClip' set to false. The - * destination clip coordinates will be read consecutively with the image set entries, advancing - * by 4 points every time an entry with fHasClip is passed. - * - * This entry point supports per-entry manipulations to the canvas's current matrix. If an - * entry provides 'fMatrixIndex' >= 0, it will be drawn as if the canvas's CTM was - * canvas->getTotalMatrix() * preViewMatrices[fMatrixIndex]. If 'fMatrixIndex' is less than 0, - * the pre-view matrix transform is implicitly the identity, so it will be drawn using just the - * current canvas matrix. The pre-view matrix modifies the canvas's view matrix, it does not - * affect the local coordinates of each entry. - * - * An optional paint may be provided, which supports the same subset of features usable with - * drawImageRect (i.e. assumed to be filled and no path effects). When a paint is provided, the - * image set is drawn as if each image used the applied paint independently, so each is affected - * by the image, color, and/or mask filter. - */ - void experimental_DrawEdgeAAImageSet(const ImageSetEntry imageSet[], int cnt, - const SkPoint dstClips[], const SkMatrix preViewMatrices[], - const SkSamplingOptions&, const SkPaint* paint = nullptr, - SrcRectConstraint constraint = kStrict_SrcRectConstraint); - - /** Draws text, with origin at (x, y), using clip, SkMatrix, SkFont font, - and SkPaint paint. - - When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or - SkTextEncoding::kUTF32, this function uses the default - character-to-glyph mapping from the SkTypeface in font. It does not - perform typeface fallback for characters not found in the SkTypeface. - It does not perform kerning or other complex shaping; glyphs are - positioned based on their default advances. - - Text meaning depends on SkTextEncoding. - - Text size is affected by SkMatrix and SkFont text size. Default text - size is 12 point. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param text character code points or glyphs drawn - @param byteLength byte length of text array - @param encoding text encoding used in the text array - @param x start of text on x-axis - @param y start of text on y-axis - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawSimpleText(const void* text, size_t byteLength, SkTextEncoding encoding, - SkScalar x, SkScalar y, const SkFont& font, const SkPaint& paint); - - /** Draws null terminated string, with origin at (x, y), using clip, SkMatrix, - SkFont font, and SkPaint paint. - - This function uses the default character-to-glyph mapping from the - SkTypeface in font. It does not perform typeface fallback for - characters not found in the SkTypeface. It does not perform kerning; - glyphs are positioned based on their default advances. - - String str is encoded as UTF-8. - - Text size is affected by SkMatrix and font text size. Default text - size is 12 point. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param str character code points drawn, - ending with a char value of zero - @param x start of string on x-axis - @param y start of string on y-axis - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawString(const char str[], SkScalar x, SkScalar y, const SkFont& font, - const SkPaint& paint) { - this->drawSimpleText(str, strlen(str), SkTextEncoding::kUTF8, x, y, font, paint); - } - - /** Draws SkString, with origin at (x, y), using clip, SkMatrix, SkFont font, - and SkPaint paint. - - This function uses the default character-to-glyph mapping from the - SkTypeface in font. It does not perform typeface fallback for - characters not found in the SkTypeface. It does not perform kerning; - glyphs are positioned based on their default advances. - - SkString str is encoded as UTF-8. - - Text size is affected by SkMatrix and SkFont text size. Default text - size is 12 point. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param str character code points drawn, - ending with a char value of zero - @param x start of string on x-axis - @param y start of string on y-axis - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawString(const SkString& str, SkScalar x, SkScalar y, const SkFont& font, - const SkPaint& paint) { - this->drawSimpleText(str.c_str(), str.size(), SkTextEncoding::kUTF8, x, y, font, paint); - } - - /** Draws count glyphs, at positions relative to origin styled with font and paint with - supporting utf8 and cluster information. - - This function draw glyphs at the given positions relative to the given origin. - It does not perform typeface fallback for glyphs not found in the SkTypeface in font. - - The drawing obeys the current transform matrix and clipping. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param count number of glyphs to draw - @param glyphs the array of glyphIDs to draw - @param positions where to draw each glyph relative to origin - @param clusters array of size count of cluster information - @param textByteCount size of the utf8text - @param utf8text utf8text supporting information for the glyphs - @param origin the origin of all the positions - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint positions[], - const uint32_t clusters[], int textByteCount, const char utf8text[], - SkPoint origin, const SkFont& font, const SkPaint& paint); - - /** Draws count glyphs, at positions relative to origin styled with font and paint. - - This function draw glyphs at the given positions relative to the given origin. - It does not perform typeface fallback for glyphs not found in the SkTypeface in font. - - The drawing obeys the current transform matrix and clipping. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param count number of glyphs to draw - @param glyphs the array of glyphIDs to draw - @param positions where to draw each glyph relative to origin - @param origin the origin of all the positions - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawGlyphs(int count, const SkGlyphID glyphs[], const SkPoint positions[], - SkPoint origin, const SkFont& font, const SkPaint& paint); - - /** Draws count glyphs, at positions relative to origin styled with font and paint. - - This function draw glyphs using the given scaling and rotations. They are positioned - relative to the given origin. It does not perform typeface fallback for glyphs not found - in the SkTypeface in font. - - The drawing obeys the current transform matrix and clipping. - - All elements of paint: SkPathEffect, SkMaskFilter, SkShader, - SkColorFilter, and SkImageFilter; apply to text. By - default, draws filled black glyphs. - - @param count number of glyphs to draw - @param glyphs the array of glyphIDs to draw - @param xforms where to draw and orient each glyph - @param origin the origin of all the positions - @param font typeface, text size and so, used to describe the text - @param paint blend, color, and so on, used to draw - */ - void drawGlyphs(int count, const SkGlyphID glyphs[], const SkRSXform xforms[], - SkPoint origin, const SkFont& font, const SkPaint& paint); - - /** Draws SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint. - - blob contains glyphs, their positions, and paint attributes specific to text: - SkTypeface, SkPaint text size, SkPaint text scale x, - SkPaint text skew x, SkPaint::Align, SkPaint::Hinting, anti-alias, SkPaint fake bold, - SkPaint font embedded bitmaps, SkPaint full hinting spacing, LCD text, SkPaint linear text, - and SkPaint subpixel text. - - SkTextEncoding must be set to SkTextEncoding::kGlyphID. - - Elements of paint: anti-alias, SkBlendMode, color including alpha, - SkColorFilter, SkPaint dither, SkMaskFilter, SkPathEffect, SkShader, and - SkPaint::Style; apply to blob. If SkPaint contains SkPaint::kStroke_Style: - SkPaint miter limit, SkPaint::Cap, SkPaint::Join, and SkPaint stroke width; - apply to SkPath created from blob. - - @param blob glyphs, positions, and their paints' text size, typeface, and so on - @param x horizontal offset applied to blob - @param y vertical offset applied to blob - @param paint blend, color, stroking, and so on, used to draw - - example: https://fiddle.skia.org/c/@Canvas_drawTextBlob - */ - void drawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, const SkPaint& paint); - - /** Draws SkTextBlob blob at (x, y), using clip, SkMatrix, and SkPaint paint. - - blob contains glyphs, their positions, and paint attributes specific to text: - SkTypeface, SkPaint text size, SkPaint text scale x, - SkPaint text skew x, SkPaint::Align, SkPaint::Hinting, anti-alias, SkPaint fake bold, - SkPaint font embedded bitmaps, SkPaint full hinting spacing, LCD text, SkPaint linear text, - and SkPaint subpixel text. - - SkTextEncoding must be set to SkTextEncoding::kGlyphID. - - Elements of paint: SkPathEffect, SkMaskFilter, SkShader, SkColorFilter, - and SkImageFilter; apply to blob. - - @param blob glyphs, positions, and their paints' text size, typeface, and so on - @param x horizontal offset applied to blob - @param y vertical offset applied to blob - @param paint blend, color, stroking, and so on, used to draw - */ - void drawTextBlob(const sk_sp& blob, SkScalar x, SkScalar y, const SkPaint& paint) { - this->drawTextBlob(blob.get(), x, y, paint); - } - - /** Draws SkPicture picture, using clip and SkMatrix. - Clip and SkMatrix are unchanged by picture contents, as if - save() was called before and restore() was called after drawPicture(). - - SkPicture records a series of draw commands for later playback. - - @param picture recorded drawing commands to play - */ - void drawPicture(const SkPicture* picture) { - this->drawPicture(picture, nullptr, nullptr); - } - - /** Draws SkPicture picture, using clip and SkMatrix. - Clip and SkMatrix are unchanged by picture contents, as if - save() was called before and restore() was called after drawPicture(). - - SkPicture records a series of draw commands for later playback. - - @param picture recorded drawing commands to play - */ - void drawPicture(const sk_sp& picture) { - this->drawPicture(picture.get()); - } - - /** Draws SkPicture picture, using clip and SkMatrix; transforming picture with - SkMatrix matrix, if provided; and use SkPaint paint alpha, SkColorFilter, - SkImageFilter, and SkBlendMode, if provided. - - If paint is non-null, then the picture is always drawn into a temporary layer before - actually landing on the canvas. Note that drawing into a layer can also change its - appearance if there are any non-associative blendModes inside any of the pictures elements. - - @param picture recorded drawing commands to play - @param matrix SkMatrix to rotate, scale, translate, and so on; may be nullptr - @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr - - example: https://fiddle.skia.org/c/@Canvas_drawPicture_3 - */ - void drawPicture(const SkPicture* picture, const SkMatrix* matrix, const SkPaint* paint); - - /** Draws SkPicture picture, using clip and SkMatrix; transforming picture with - SkMatrix matrix, if provided; and use SkPaint paint alpha, SkColorFilter, - SkImageFilter, and SkBlendMode, if provided. - - If paint is non-null, then the picture is always drawn into a temporary layer before - actually landing on the canvas. Note that drawing into a layer can also change its - appearance if there are any non-associative blendModes inside any of the pictures elements. - - @param picture recorded drawing commands to play - @param matrix SkMatrix to rotate, scale, translate, and so on; may be nullptr - @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr - */ - void drawPicture(const sk_sp& picture, const SkMatrix* matrix, - const SkPaint* paint) { - this->drawPicture(picture.get(), matrix, paint); - } - - /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix. - If paint contains an SkShader and vertices does not contain texCoords, the shader - is mapped using the vertices' positions. - - SkBlendMode is ignored if SkVertices does not have colors. Otherwise, it combines - - the SkShader if SkPaint contains SkShader - - or the opaque SkPaint color if SkPaint does not contain SkShader - as the src of the blend and the interpolated vertex colors as the dst. - - SkMaskFilter, SkPathEffect, and antialiasing on SkPaint are ignored. - - @param vertices triangle mesh to draw - @param mode combines vertices' colors with SkShader if present or SkPaint opaque color - if not. Ignored if the vertices do not contain color. - @param paint specifies the SkShader, used as SkVertices texture, and SkColorFilter. - - example: https://fiddle.skia.org/c/@Canvas_drawVertices - */ - void drawVertices(const SkVertices* vertices, SkBlendMode mode, const SkPaint& paint); - - /** Draws SkVertices vertices, a triangle mesh, using clip and SkMatrix. - If paint contains an SkShader and vertices does not contain texCoords, the shader - is mapped using the vertices' positions. - - SkBlendMode is ignored if SkVertices does not have colors. Otherwise, it combines - - the SkShader if SkPaint contains SkShader - - or the opaque SkPaint color if SkPaint does not contain SkShader - as the src of the blend and the interpolated vertex colors as the dst. - - SkMaskFilter, SkPathEffect, and antialiasing on SkPaint are ignored. - - @param vertices triangle mesh to draw - @param mode combines vertices' colors with SkShader if present or SkPaint opaque color - if not. Ignored if the vertices do not contain color. - @param paint specifies the SkShader, used as SkVertices texture, may be nullptr - - example: https://fiddle.skia.org/c/@Canvas_drawVertices_2 - */ - void drawVertices(const sk_sp& vertices, SkBlendMode mode, const SkPaint& paint); - -#if defined(SK_ENABLE_SKSL) - /** - Experimental, under active development, and subject to change without notice. - - Draws a mesh using a user-defined specification (see SkMeshSpecification). - - SkBlender is ignored if SkMesh's specification does not output fragment shader color. - Otherwise, it combines - - the SkShader if SkPaint contains SkShader - - or the opaque SkPaint color if SkPaint does not contain SkShader - as the src of the blend and the mesh's fragment color as the dst. - - SkMaskFilter, SkPathEffect, and antialiasing on SkPaint are ignored. - - @param mesh the mesh vertices and compatible specification. - @param blender combines vertices colors with SkShader if present or SkPaint opaque color - if not. Ignored if the custom mesh does not output color. Defaults to - SkBlendMode::kModulate if nullptr. - @param paint specifies the SkShader, used as SkVertices texture, may be nullptr - */ - void drawMesh(const SkMesh& mesh, sk_sp blender, const SkPaint& paint); -#endif - - /** Draws a Coons patch: the interpolation of four cubics with shared corners, - associating a color, and optionally a texture SkPoint, with each corner. - - SkPoint array cubics specifies four SkPath cubic starting at the top-left corner, - in clockwise order, sharing every fourth point. The last SkPath cubic ends at the - first point. - - Color array color associates colors with corners in top-left, top-right, - bottom-right, bottom-left order. - - If paint contains SkShader, SkPoint array texCoords maps SkShader as texture to - corners in top-left, top-right, bottom-right, bottom-left order. If texCoords is - nullptr, SkShader is mapped using positions (derived from cubics). - - SkBlendMode is ignored if colors is null. Otherwise, it combines - - the SkShader if SkPaint contains SkShader - - or the opaque SkPaint color if SkPaint does not contain SkShader - as the src of the blend and the interpolated patch colors as the dst. - - SkMaskFilter, SkPathEffect, and antialiasing on SkPaint are ignored. - - @param cubics SkPath cubic array, sharing common points - @param colors color array, one for each corner - @param texCoords SkPoint array of texture coordinates, mapping SkShader to corners; - may be nullptr - @param mode combines patch's colors with SkShader if present or SkPaint opaque color - if not. Ignored if colors is null. - @param paint SkShader, SkColorFilter, SkBlendMode, used to draw - */ - void drawPatch(const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint); - - /** Draws a set of sprites from atlas, using clip, SkMatrix, and optional SkPaint paint. - paint uses anti-alias, alpha, SkColorFilter, SkImageFilter, and SkBlendMode - to draw, if present. For each entry in the array, SkRect tex locates sprite in - atlas, and SkRSXform xform transforms it into destination space. - - SkMaskFilter and SkPathEffect on paint are ignored. - - xform, tex, and colors if present, must contain count entries. - Optional colors are applied for each sprite using SkBlendMode mode, treating - sprite as source and colors as destination. - Optional cullRect is a conservative bounds of all transformed sprites. - If cullRect is outside of clip, canvas can skip drawing. - - If atlas is nullptr, this draws nothing. - - @param atlas SkImage containing sprites - @param xform SkRSXform mappings for sprites in atlas - @param tex SkRect locations of sprites in atlas - @param colors one per sprite, blended with sprite using SkBlendMode; may be nullptr - @param count number of sprites to draw - @param mode SkBlendMode combining colors and sprites - @param sampling SkSamplingOptions used when sampling from the atlas image - @param cullRect bounds of transformed sprites for efficient clipping; may be nullptr - @param paint SkColorFilter, SkImageFilter, SkBlendMode, and so on; may be nullptr - */ - void drawAtlas(const SkImage* atlas, const SkRSXform xform[], const SkRect tex[], - const SkColor colors[], int count, SkBlendMode mode, - const SkSamplingOptions& sampling, const SkRect* cullRect, const SkPaint* paint); - - /** Draws SkDrawable drawable using clip and SkMatrix, concatenated with - optional matrix. - - If SkCanvas has an asynchronous implementation, as is the case - when it is recording into SkPicture, then drawable will be referenced, - so that SkDrawable::draw() can be called when the operation is finalized. To force - immediate drawing, call SkDrawable::draw() instead. - - @param drawable custom struct encapsulating drawing commands - @param matrix transformation applied to drawing; may be nullptr - - example: https://fiddle.skia.org/c/@Canvas_drawDrawable - */ - void drawDrawable(SkDrawable* drawable, const SkMatrix* matrix = nullptr); - - /** Draws SkDrawable drawable using clip and SkMatrix, offset by (x, y). - - If SkCanvas has an asynchronous implementation, as is the case - when it is recording into SkPicture, then drawable will be referenced, - so that SkDrawable::draw() can be called when the operation is finalized. To force - immediate drawing, call SkDrawable::draw() instead. - - @param drawable custom struct encapsulating drawing commands - @param x offset into SkCanvas writable pixels on x-axis - @param y offset into SkCanvas writable pixels on y-axis - - example: https://fiddle.skia.org/c/@Canvas_drawDrawable_2 - */ - void drawDrawable(SkDrawable* drawable, SkScalar x, SkScalar y); - - /** Associates SkRect on SkCanvas with an annotation; a key-value pair, where the key is - a null-terminated UTF-8 string, and optional value is stored as SkData. - - Only some canvas implementations, such as recording to SkPicture, or drawing to - document PDF, use annotations. - - @param rect SkRect extent of canvas to annotate - @param key string used for lookup - @param value data holding value stored in annotation - - example: https://fiddle.skia.org/c/@Canvas_drawAnnotation_2 - */ - void drawAnnotation(const SkRect& rect, const char key[], SkData* value); - - /** Associates SkRect on SkCanvas when an annotation; a key-value pair, where the key is - a null-terminated UTF-8 string, and optional value is stored as SkData. - - Only some canvas implementations, such as recording to SkPicture, or drawing to - document PDF, use annotations. - - @param rect SkRect extent of canvas to annotate - @param key string used for lookup - @param value data holding value stored in annotation - */ - void drawAnnotation(const SkRect& rect, const char key[], const sk_sp& value) { - this->drawAnnotation(rect, key, value.get()); - } - - /** Returns true if clip is empty; that is, nothing will draw. - - May do work when called; it should not be called - more often than needed. However, once called, subsequent calls perform no - work until clip changes. - - @return true if clip is empty - - example: https://fiddle.skia.org/c/@Canvas_isClipEmpty - */ - virtual bool isClipEmpty() const; - - /** Returns true if clip is SkRect and not empty. - Returns false if the clip is empty, or if it is not SkRect. - - @return true if clip is SkRect and not empty - - example: https://fiddle.skia.org/c/@Canvas_isClipRect - */ - virtual bool isClipRect() const; - - /** Returns the current transform from local coordinates to the 'device', which for most - * purposes means pixels. - * - * @return transformation from local coordinates to device / pixels. - */ - SkM44 getLocalToDevice() const; - - /** - * Throws away the 3rd row and column in the matrix, so be warned. - */ - SkMatrix getLocalToDeviceAs3x3() const { - return this->getLocalToDevice().asM33(); - } - -#ifdef SK_SUPPORT_LEGACY_GETTOTALMATRIX - /** DEPRECATED - * Legacy version of getLocalToDevice(), which strips away any Z information, and - * just returns a 3x3 version. - * - * @return 3x3 version of getLocalToDevice() - * - * example: https://fiddle.skia.org/c/@Canvas_getTotalMatrix - * example: https://fiddle.skia.org/c/@Clip - */ - SkMatrix getTotalMatrix() const; -#endif - - /////////////////////////////////////////////////////////////////////////// - -#if defined(SK_BUILD_FOR_ANDROID_FRAMEWORK) && SK_SUPPORT_GPU - // These methods exist to support WebView in Android Framework. - SkIRect topLayerBounds() const; - GrBackendRenderTarget topLayerBackendRenderTarget() const; -#endif - - /** - * Returns the global clip as a region. If the clip contains AA, then only the bounds - * of the clip may be returned. - */ - void temporary_internal_getRgnClip(SkRegion* region); - - void private_draw_shadow_rec(const SkPath&, const SkDrawShadowRec&); - - -protected: - // default impl defers to getDevice()->newSurface(info) - virtual sk_sp onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props); - - // default impl defers to its device - virtual bool onPeekPixels(SkPixmap* pixmap); - virtual bool onAccessTopLayerPixels(SkPixmap* pixmap); - virtual SkImageInfo onImageInfo() const; - virtual bool onGetProps(SkSurfaceProps* props, bool top) const; - virtual void onFlush(); - - // Subclass save/restore notifiers. - // Overriders should call the corresponding INHERITED method up the inheritance chain. - // getSaveLayerStrategy()'s return value may suppress full layer allocation. - enum SaveLayerStrategy { - kFullLayer_SaveLayerStrategy, - kNoLayer_SaveLayerStrategy, - }; - - virtual void willSave() {} - // Overriders should call the corresponding INHERITED method up the inheritance chain. - virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& ) { - return kFullLayer_SaveLayerStrategy; - } - - // returns true if we should actually perform the saveBehind, or false if we should just save. - virtual bool onDoSaveBehind(const SkRect*) { return true; } - virtual void willRestore() {} - virtual void didRestore() {} - - virtual void didConcat44(const SkM44&) {} - virtual void didSetM44(const SkM44&) {} - virtual void didTranslate(SkScalar, SkScalar) {} - virtual void didScale(SkScalar, SkScalar) {} - - // NOTE: If you are adding a new onDraw virtual to SkCanvas, PLEASE add an override to - // SkCanvasVirtualEnforcer (in SkCanvasVirtualEnforcer.h). This ensures that subclasses using - // that mechanism will be required to implement the new function. - virtual void onDrawPaint(const SkPaint& paint); - virtual void onDrawBehind(const SkPaint& paint); - virtual void onDrawRect(const SkRect& rect, const SkPaint& paint); - virtual void onDrawRRect(const SkRRect& rrect, const SkPaint& paint); - virtual void onDrawDRRect(const SkRRect& outer, const SkRRect& inner, const SkPaint& paint); - virtual void onDrawOval(const SkRect& rect, const SkPaint& paint); - virtual void onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle, - bool useCenter, const SkPaint& paint); - virtual void onDrawPath(const SkPath& path, const SkPaint& paint); - virtual void onDrawRegion(const SkRegion& region, const SkPaint& paint); - - virtual void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint& paint); - - virtual void onDrawGlyphRunList(const sktext::GlyphRunList& glyphRunList, const SkPaint& paint); - - virtual void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode mode, const SkPaint& paint); - virtual void onDrawPoints(PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint); - - virtual void onDrawImage2(const SkImage*, SkScalar dx, SkScalar dy, const SkSamplingOptions&, - const SkPaint*); - virtual void onDrawImageRect2(const SkImage*, const SkRect& src, const SkRect& dst, - const SkSamplingOptions&, const SkPaint*, SrcRectConstraint); - virtual void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect& dst, - SkFilterMode, const SkPaint*); - virtual void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect src[], - const SkColor[], int count, SkBlendMode, const SkSamplingOptions&, - const SkRect* cull, const SkPaint*); - virtual void onDrawEdgeAAImageSet2(const ImageSetEntry imageSet[], int count, - const SkPoint dstClips[], const SkMatrix preViewMatrices[], - const SkSamplingOptions&, const SkPaint*, - SrcRectConstraint); - - virtual void onDrawVerticesObject(const SkVertices* vertices, SkBlendMode mode, - const SkPaint& paint); -#ifdef SK_ENABLE_SKSL - virtual void onDrawMesh(const SkMesh&, sk_sp, const SkPaint&); -#endif - virtual void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value); - virtual void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&); - - virtual void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix); - virtual void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, - const SkPaint* paint); - - virtual void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], QuadAAFlags aaFlags, - const SkColor4f& color, SkBlendMode mode); - - enum ClipEdgeStyle { - kHard_ClipEdgeStyle, - kSoft_ClipEdgeStyle - }; - - virtual void onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeStyle); - virtual void onClipRRect(const SkRRect& rrect, SkClipOp op, ClipEdgeStyle edgeStyle); - virtual void onClipPath(const SkPath& path, SkClipOp op, ClipEdgeStyle edgeStyle); - virtual void onClipShader(sk_sp, SkClipOp); - virtual void onClipRegion(const SkRegion& deviceRgn, SkClipOp op); - virtual void onResetClip(); - - virtual void onDiscard(); - -#if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED)) - /** Experimental - */ - virtual sk_sp onConvertGlyphRunListToSlug( - const sktext::GlyphRunList& glyphRunList, const SkPaint& paint); - - /** Experimental - */ - virtual void onDrawSlug(const sktext::gpu::Slug* slug); -#endif - -private: - - enum ShaderOverrideOpacity { - kNone_ShaderOverrideOpacity, //!< there is no overriding shader (bitmap or image) - kOpaque_ShaderOverrideOpacity, //!< the overriding shader is opaque - kNotOpaque_ShaderOverrideOpacity, //!< the overriding shader may not be opaque - }; - - // notify our surface (if we have one) that we are about to draw, so it - // can perform copy-on-write or invalidate any cached images - // returns false if the copy failed - bool SK_WARN_UNUSED_RESULT predrawNotify(bool willOverwritesEntireSurface = false); - bool SK_WARN_UNUSED_RESULT predrawNotify(const SkRect*, const SkPaint*, ShaderOverrideOpacity); - - enum class CheckForOverwrite : bool { - kNo = false, - kYes = true - }; - // call the appropriate predrawNotify and create a layer if needed. - std::optional aboutToDraw( - SkCanvas* canvas, - const SkPaint& paint, - const SkRect* rawBounds = nullptr, - CheckForOverwrite = CheckForOverwrite::kNo, - ShaderOverrideOpacity = kNone_ShaderOverrideOpacity); - - // The bottom-most device in the stack, only changed by init(). Image properties and the final - // canvas pixels are determined by this device. - SkBaseDevice* baseDevice() const { - SkASSERT(fBaseDevice); - return fBaseDevice.get(); - } - - // The top-most device in the stack, will change within saveLayer()'s. All drawing and clipping - // operations should route to this device. - SkBaseDevice* topDevice() const; - - // Canvases maintain a sparse stack of layers, where the top-most layer receives the drawing, - // clip, and matrix commands. There is a layer per call to saveLayer() using the - // kFullLayer_SaveLayerStrategy. - struct Layer { - sk_sp fDevice; - sk_sp fImageFilter; // applied to layer *before* being drawn by paint - SkPaint fPaint; - bool fDiscard; - - Layer(sk_sp device, sk_sp imageFilter, const SkPaint& paint); - }; - - // Encapsulate state needed to restore from saveBehind() - struct BackImage { - sk_sp fImage; - SkIPoint fLoc; - }; - - class MCRec { - public: - // If not null, this MCRec corresponds with the saveLayer() record that made the layer. - // The base "layer" is not stored here, since it is stored inline in SkCanvas and has no - // restoration behavior. - std::unique_ptr fLayer; - - // This points to the device of the top-most layer (which may be lower in the stack), or - // to the canvas's fBaseDevice. The MCRec does not own the device. - SkBaseDevice* fDevice; - - std::unique_ptr fBackImage; - SkM44 fMatrix; - int fDeferredSaveCount = 0; - - MCRec(SkBaseDevice* device); - MCRec(const MCRec* prev); - ~MCRec(); - - void newLayer(sk_sp layerDevice, - sk_sp filter, - const SkPaint& restorePaint); - - void reset(SkBaseDevice* device); - }; - - // the first N recs that can fit here mean we won't call malloc - static constexpr int kMCRecSize = 96; // most recent measurement - static constexpr int kMCRecCount = 32; // common depth for save/restores - - intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)]; - - SkDeque fMCStack; - // points to top of stack - MCRec* fMCRec; - - // Installed via init() - sk_sp fBaseDevice; - const SkSurfaceProps fProps; - - int fSaveCount; // value returned by getSaveCount() - - std::unique_ptr fAllocator; - - SkSurface_Base* fSurfaceBase; - SkSurface_Base* getSurfaceBase() const { return fSurfaceBase; } - void setSurfaceBase(SkSurface_Base* sb) { - fSurfaceBase = sb; - } - friend class SkSurface_Base; - friend class SkSurface_Gpu; - - SkIRect fClipRestrictionRect = SkIRect::MakeEmpty(); - int fClipRestrictionSaveCount = -1; - - void doSave(); - void checkForDeferredSave(); - void internalSetMatrix(const SkM44&); - - friend class SkAndroidFrameworkUtils; - friend class SkCanvasPriv; // needs to expose android functions for testing outside android - friend class AutoLayerForImageFilter; - friend class SkSurface_Raster; // needs getDevice() - friend class SkNoDrawCanvas; // needs resetForNextPicture() - friend class SkNWayCanvas; - friend class SkPictureRecord; // predrawNotify (why does it need it? ) - friend class SkOverdrawCanvas; - friend class SkRasterHandleAllocator; - friend class SkRecords::Draw; - template - friend class SkTestCanvas; - -protected: - // For use by SkNoDrawCanvas (via SkCanvasVirtualEnforcer, which can't be a friend) - SkCanvas(const SkIRect& bounds); -private: - SkCanvas(const SkBitmap&, std::unique_ptr, - SkRasterHandleAllocator::Handle, const SkSurfaceProps* props); - - SkCanvas(SkCanvas&&) = delete; - SkCanvas(const SkCanvas&) = delete; - SkCanvas& operator=(SkCanvas&&) = delete; - SkCanvas& operator=(const SkCanvas&) = delete; - -#if (SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED)) - friend class sktext::gpu::Slug; - /** Experimental - * Convert a SkTextBlob to a sktext::gpu::Slug using the current canvas state. - */ - sk_sp convertBlobToSlug(const SkTextBlob& blob, SkPoint origin, - const SkPaint& paint); - - /** Experimental - * Draw an sktext::gpu::Slug given the current canvas state. - */ - void drawSlug(const sktext::gpu::Slug* slug); -#endif - - /** Experimental - * Saves the specified subset of the current pixels in the current layer, - * and then clears those pixels to transparent black. - * Restores the pixels on restore() by drawing them in SkBlendMode::kDstOver. - * - * @param subset conservative bounds of the area to be saved / restored. - * @return depth of save state stack before this call was made. - */ - int only_axis_aligned_saveBehind(const SkRect* subset); - - /** - * Like drawPaint, but magically clipped to the most recent saveBehind buffer rectangle. - * If there is no active saveBehind, then this draws nothing. - */ - void drawClippedToSaveBehind(const SkPaint&); - - void resetForNextPicture(const SkIRect& bounds); - - // needs gettotalclip() - friend class SkCanvasStateUtils; - - void init(sk_sp); - - // All base onDrawX() functions should call this and skip drawing if it returns true. - // If 'matrix' is non-null, it maps the paint's fast bounds before checking for quick rejection - bool internalQuickReject(const SkRect& bounds, const SkPaint& paint, - const SkMatrix* matrix = nullptr); - - void internalDrawPaint(const SkPaint& paint); - void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy); - void internalSaveBehind(const SkRect*); - - void internalConcat44(const SkM44&); - - // shared by save() and saveLayer() - void internalSave(); - void internalRestore(); - - enum class DeviceCompatibleWithFilter : bool { - // Check the src device's local-to-device matrix for compatibility with the filter, and if - // it is not compatible, introduce an intermediate image and transformation that allows the - // filter to be evaluated on the modified src content. - kUnknown = false, - // Assume that the src device's local-to-device matrix is compatible with the filter. - kYes = true - }; - /** - * Filters the contents of 'src' and draws the result into 'dst'. The filter is evaluated - * relative to the current canvas matrix, and src is drawn to dst using their relative transform - * 'paint' is applied after the filter and must not have a mask or image filter of its own. - * A null 'filter' behaves as if the identity filter were used. - * - * 'scaleFactor' is an extra uniform scale transform applied to downscale the 'src' image - * before any filtering, or as part of the copy, and is then drawn with 1/scaleFactor to 'dst'. - * Must be 1.0 if 'compat' is kYes (i.e. any scale factor has already been baked into the - * relative transforms between the devices). - */ - void internalDrawDeviceWithFilter(SkBaseDevice* src, SkBaseDevice* dst, - const SkImageFilter* filter, const SkPaint& paint, - DeviceCompatibleWithFilter compat, - SkScalar scaleFactor = 1.f); - - /* - * Returns true if drawing the specified rect (or all if it is null) with the specified - * paint (or default if null) would overwrite the entire root device of the canvas - * (i.e. the canvas' surface if it had one). - */ - bool wouldOverwriteEntireSurface(const SkRect*, const SkPaint*, ShaderOverrideOpacity) const; - - /** - * Returns true if the paint's imagefilter can be invoked directly, without needed a layer. - */ - bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkSamplingOptions&, - const SkPaint&); - - /** - * Returns true if the clip (for any active layer) contains antialiasing. - * If the clip is empty, this will return false. - */ - bool androidFramework_isClipAA() const; - - /** - * Reset the clip to be wide-open (modulo any separately specified device clip restriction). - * This operate within the save/restore clip stack so it can be undone by restoring to an - * earlier save point. - */ - void internal_private_resetClip(); - - virtual SkPaintFilterCanvas* internal_private_asPaintFilterCanvas() const { return nullptr; } - - // Keep track of the device clip bounds in the canvas' global space to reject draws before - // invoking the top-level device. - SkRect fQuickRejectBounds; - - // Compute the clip's bounds based on all clipped SkDevice's reported device bounds transformed - // into the canvas' global space. - SkRect computeDeviceClipBounds(bool outsetForAA=true) const; - - class AutoUpdateQRBounds; - void validateClip() const; - - std::unique_ptr fScratchGlyphRunBuilder; - - using INHERITED = SkRefCnt; -}; - -/** \class SkAutoCanvasRestore - Stack helper class calls SkCanvas::restoreToCount when SkAutoCanvasRestore - goes out of scope. Use this to guarantee that the canvas is restored to a known - state. -*/ -class SkAutoCanvasRestore { -public: - - /** Preserves SkCanvas::save() count. Optionally saves SkCanvas clip and SkCanvas matrix. - - @param canvas SkCanvas to guard - @param doSave call SkCanvas::save() - @return utility to restore SkCanvas state on destructor - */ - SkAutoCanvasRestore(SkCanvas* canvas, bool doSave) : fCanvas(canvas), fSaveCount(0) { - if (fCanvas) { - fSaveCount = canvas->getSaveCount(); - if (doSave) { - canvas->save(); - } - } - } - - /** Restores SkCanvas to saved state. Destructor is called when container goes out of - scope. - */ - ~SkAutoCanvasRestore() { - if (fCanvas) { - fCanvas->restoreToCount(fSaveCount); - } - } - - /** Restores SkCanvas to saved state immediately. Subsequent calls and - ~SkAutoCanvasRestore() have no effect. - */ - void restore() { - if (fCanvas) { - fCanvas->restoreToCount(fSaveCount); - fCanvas = nullptr; - } - } - -private: - SkCanvas* fCanvas; - int fSaveCount; - - SkAutoCanvasRestore(SkAutoCanvasRestore&&) = delete; - SkAutoCanvasRestore(const SkAutoCanvasRestore&) = delete; - SkAutoCanvasRestore& operator=(SkAutoCanvasRestore&&) = delete; - SkAutoCanvasRestore& operator=(const SkAutoCanvasRestore&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvasVirtualEnforcer.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvasVirtualEnforcer.h deleted file mode 100644 index 5086b4337d3f7e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCanvasVirtualEnforcer.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCanvasVirtualEnforcer_DEFINED -#define SkCanvasVirtualEnforcer_DEFINED - -#include "include/core/SkCanvas.h" - -// If you would ordinarily want to inherit from Base (eg SkCanvas, SkNWayCanvas), instead -// inherit from SkCanvasVirtualEnforcer, which will make the build fail if you forget -// to override one of SkCanvas' key virtual hooks. -template -class SkCanvasVirtualEnforcer : public Base { -public: - using Base::Base; - -protected: - void onDrawPaint(const SkPaint& paint) override = 0; - void onDrawBehind(const SkPaint&) override {} // make zero after android updates - void onDrawRect(const SkRect& rect, const SkPaint& paint) override = 0; - void onDrawRRect(const SkRRect& rrect, const SkPaint& paint) override = 0; - void onDrawDRRect(const SkRRect& outer, const SkRRect& inner, - const SkPaint& paint) override = 0; - void onDrawOval(const SkRect& rect, const SkPaint& paint) override = 0; - void onDrawArc(const SkRect& rect, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, - const SkPaint& paint) override = 0; - void onDrawPath(const SkPath& path, const SkPaint& paint) override = 0; - void onDrawRegion(const SkRegion& region, const SkPaint& paint) override = 0; - - void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint& paint) override = 0; - - void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode mode, - const SkPaint& paint) override = 0; - void onDrawPoints(SkCanvas::PointMode mode, size_t count, const SkPoint pts[], - const SkPaint& paint) override = 0; - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - // This is under active development for Chrome and not used in Android. Hold off on adding - // implementations in Android's SkCanvas subclasses until this stabilizes. - void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], - SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override {} -#else - void onDrawEdgeAAQuad(const SkRect& rect, const SkPoint clip[4], - SkCanvas::QuadAAFlags aaFlags, const SkColor4f& color, SkBlendMode mode) override = 0; -#endif - - void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override = 0; - void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override = 0; - - void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix) override = 0; - void onDrawPicture(const SkPicture* picture, const SkMatrix* matrix, - const SkPaint* paint) override = 0; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCapabilities.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCapabilities.h deleted file mode 100644 index ef15c1670823d6..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCapabilities.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCapabilities_DEFINED -#define SkCapabilities_DEFINED - -#include "include/core/SkRefCnt.h" - -#ifdef SK_ENABLE_SKSL -#include "include/sksl/SkSLVersion.h" -namespace SkSL { struct ShaderCaps; } -#endif - -#if defined(SK_GRAPHITE_ENABLED) -namespace skgpu::graphite { class Caps; } -#endif - -class SK_API SkCapabilities : public SkRefCnt { -public: - static sk_sp RasterBackend(); - -#ifdef SK_ENABLE_SKSL - SkSL::Version skslVersion() const { return fSkSLVersion; } -#endif - -protected: -#if defined(SK_GRAPHITE_ENABLED) - friend class skgpu::graphite::Caps; // for ctor -#endif - - SkCapabilities() = default; - -#ifdef SK_ENABLE_SKSL - void initSkCaps(const SkSL::ShaderCaps*); - - SkSL::Version fSkSLVersion = SkSL::Version::k100; -#endif -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkClipOp.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkClipOp.h deleted file mode 100644 index 3da6c61131f7b2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkClipOp.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkClipOp_DEFINED -#define SkClipOp_DEFINED - -#include "include/core/SkTypes.h" - -enum class SkClipOp { - kDifference = 0, - kIntersect = 1, - kMax_EnumValue = kIntersect -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColor.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColor.h deleted file mode 100644 index 6a920e93fddb43..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColor.h +++ /dev/null @@ -1,445 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColor_DEFINED -#define SkColor_DEFINED - -#include "include/core/SkAlphaType.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -#include - -/** \file SkColor.h - - Types, consts, functions, and macros for colors. -*/ - -/** 8-bit type for an alpha value. 255 is 100% opaque, zero is 100% transparent. -*/ -typedef uint8_t SkAlpha; - -/** 32-bit ARGB color value, unpremultiplied. Color components are always in - a known order. This is different from SkPMColor, which has its bytes in a configuration - dependent order, to match the format of kBGRA_8888_SkColorType bitmaps. SkColor - is the type used to specify colors in SkPaint and in gradients. - - Color that is premultiplied has the same component values as color - that is unpremultiplied if alpha is 255, fully opaque, although may have the - component values in a different order. -*/ -typedef uint32_t SkColor; - -/** Returns color value from 8-bit component values. Asserts if SK_DEBUG is defined - if a, r, g, or b exceed 255. Since color is unpremultiplied, a may be smaller - than the largest of r, g, and b. - - @param a amount of alpha, from fully transparent (0) to fully opaque (255) - @param r amount of red, from no red (0) to full red (255) - @param g amount of green, from no green (0) to full green (255) - @param b amount of blue, from no blue (0) to full blue (255) - @return color and alpha, unpremultiplied -*/ -static constexpr inline SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - return SkASSERT(a <= 255 && r <= 255 && g <= 255 && b <= 255), - (a << 24) | (r << 16) | (g << 8) | (b << 0); -} - -/** Returns color value from 8-bit component values, with alpha set - fully opaque to 255. -*/ -#define SkColorSetRGB(r, g, b) SkColorSetARGB(0xFF, r, g, b) - -/** Returns alpha byte from color value. -*/ -#define SkColorGetA(color) (((color) >> 24) & 0xFF) - -/** Returns red component of color, from zero to 255. -*/ -#define SkColorGetR(color) (((color) >> 16) & 0xFF) - -/** Returns green component of color, from zero to 255. -*/ -#define SkColorGetG(color) (((color) >> 8) & 0xFF) - -/** Returns blue component of color, from zero to 255. -*/ -#define SkColorGetB(color) (((color) >> 0) & 0xFF) - -/** Returns unpremultiplied color with red, blue, and green set from c; and alpha set - from a. Alpha component of c is ignored and is replaced by a in result. - - @param c packed RGB, eight bits per component - @param a alpha: transparent at zero, fully opaque at 255 - @return color with transparency -*/ -static constexpr inline SkColor SK_WARN_UNUSED_RESULT SkColorSetA(SkColor c, U8CPU a) { - return (c & 0x00FFFFFF) | (a << 24); -} - -/** Represents fully transparent SkAlpha value. SkAlpha ranges from zero, - fully transparent; to 255, fully opaque. -*/ -constexpr SkAlpha SK_AlphaTRANSPARENT = 0x00; - -/** Represents fully opaque SkAlpha value. SkAlpha ranges from zero, - fully transparent; to 255, fully opaque. -*/ -constexpr SkAlpha SK_AlphaOPAQUE = 0xFF; - -/** Represents fully transparent SkColor. May be used to initialize a destination - containing a mask or a non-rectangular image. -*/ -constexpr SkColor SK_ColorTRANSPARENT = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); - -/** Represents fully opaque black. -*/ -constexpr SkColor SK_ColorBLACK = SkColorSetARGB(0xFF, 0x00, 0x00, 0x00); - -/** Represents fully opaque dark gray. - Note that SVG dark gray is equivalent to 0xFFA9A9A9. -*/ -constexpr SkColor SK_ColorDKGRAY = SkColorSetARGB(0xFF, 0x44, 0x44, 0x44); - -/** Represents fully opaque gray. - Note that HTML gray is equivalent to 0xFF808080. -*/ -constexpr SkColor SK_ColorGRAY = SkColorSetARGB(0xFF, 0x88, 0x88, 0x88); - -/** Represents fully opaque light gray. HTML silver is equivalent to 0xFFC0C0C0. - Note that SVG light gray is equivalent to 0xFFD3D3D3. -*/ -constexpr SkColor SK_ColorLTGRAY = SkColorSetARGB(0xFF, 0xCC, 0xCC, 0xCC); - -/** Represents fully opaque white. -*/ -constexpr SkColor SK_ColorWHITE = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0xFF); - -/** Represents fully opaque red. -*/ -constexpr SkColor SK_ColorRED = SkColorSetARGB(0xFF, 0xFF, 0x00, 0x00); - -/** Represents fully opaque green. HTML lime is equivalent. - Note that HTML green is equivalent to 0xFF008000. -*/ -constexpr SkColor SK_ColorGREEN = SkColorSetARGB(0xFF, 0x00, 0xFF, 0x00); - -/** Represents fully opaque blue. -*/ -constexpr SkColor SK_ColorBLUE = SkColorSetARGB(0xFF, 0x00, 0x00, 0xFF); - -/** Represents fully opaque yellow. -*/ -constexpr SkColor SK_ColorYELLOW = SkColorSetARGB(0xFF, 0xFF, 0xFF, 0x00); - -/** Represents fully opaque cyan. HTML aqua is equivalent. -*/ -constexpr SkColor SK_ColorCYAN = SkColorSetARGB(0xFF, 0x00, 0xFF, 0xFF); - -/** Represents fully opaque magenta. HTML fuchsia is equivalent. -*/ -constexpr SkColor SK_ColorMAGENTA = SkColorSetARGB(0xFF, 0xFF, 0x00, 0xFF); - -/** Converts RGB to its HSV components. - hsv[0] contains hsv hue, a value from zero to less than 360. - hsv[1] contains hsv saturation, a value from zero to one. - hsv[2] contains hsv value, a value from zero to one. - - @param red red component value from zero to 255 - @param green green component value from zero to 255 - @param blue blue component value from zero to 255 - @param hsv three element array which holds the resulting HSV components -*/ -SK_API void SkRGBToHSV(U8CPU red, U8CPU green, U8CPU blue, SkScalar hsv[3]); - -/** Converts ARGB to its HSV components. Alpha in ARGB is ignored. - hsv[0] contains hsv hue, and is assigned a value from zero to less than 360. - hsv[1] contains hsv saturation, a value from zero to one. - hsv[2] contains hsv value, a value from zero to one. - - @param color ARGB color to convert - @param hsv three element array which holds the resulting HSV components -*/ -static inline void SkColorToHSV(SkColor color, SkScalar hsv[3]) { - SkRGBToHSV(SkColorGetR(color), SkColorGetG(color), SkColorGetB(color), hsv); -} - -/** Converts HSV components to an ARGB color. Alpha is passed through unchanged. - hsv[0] represents hsv hue, an angle from zero to less than 360. - hsv[1] represents hsv saturation, and varies from zero to one. - hsv[2] represents hsv value, and varies from zero to one. - - Out of range hsv values are pinned. - - @param alpha alpha component of the returned ARGB color - @param hsv three element array which holds the input HSV components - @return ARGB equivalent to HSV -*/ -SK_API SkColor SkHSVToColor(U8CPU alpha, const SkScalar hsv[3]); - -/** Converts HSV components to an ARGB color. Alpha is set to 255. - hsv[0] represents hsv hue, an angle from zero to less than 360. - hsv[1] represents hsv saturation, and varies from zero to one. - hsv[2] represents hsv value, and varies from zero to one. - - Out of range hsv values are pinned. - - @param hsv three element array which holds the input HSV components - @return RGB equivalent to HSV -*/ -static inline SkColor SkHSVToColor(const SkScalar hsv[3]) { - return SkHSVToColor(0xFF, hsv); -} - -/** 32-bit ARGB color value, premultiplied. The byte order for this value is - configuration dependent, matching the format of kBGRA_8888_SkColorType bitmaps. - This is different from SkColor, which is unpremultiplied, and is always in the - same byte order. -*/ -typedef uint32_t SkPMColor; - -/** Returns a SkPMColor value from unpremultiplied 8-bit component values. - - @param a amount of alpha, from fully transparent (0) to fully opaque (255) - @param r amount of red, from no red (0) to full red (255) - @param g amount of green, from no green (0) to full green (255) - @param b amount of blue, from no blue (0) to full blue (255) - @return premultiplied color -*/ -SK_API SkPMColor SkPreMultiplyARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); - -/** Returns pmcolor closest to color c. Multiplies c RGB components by the c alpha, - and arranges the bytes to match the format of kN32_SkColorType. - - @param c unpremultiplied ARGB color - @return premultiplied color -*/ -SK_API SkPMColor SkPreMultiplyColor(SkColor c); - -/** \enum SkColorChannel - Describes different color channels one can manipulate -*/ -enum class SkColorChannel { - kR, // the red channel - kG, // the green channel - kB, // the blue channel - kA, // the alpha channel - - kLastEnum = kA, -}; - -/** Used to represent the channels available in a color type or texture format as a mask. */ -enum SkColorChannelFlag : uint32_t { - kRed_SkColorChannelFlag = 1 << static_cast(SkColorChannel::kR), - kGreen_SkColorChannelFlag = 1 << static_cast(SkColorChannel::kG), - kBlue_SkColorChannelFlag = 1 << static_cast(SkColorChannel::kB), - kAlpha_SkColorChannelFlag = 1 << static_cast(SkColorChannel::kA), - kGray_SkColorChannelFlag = 0x10, - // Convenience values - kGrayAlpha_SkColorChannelFlags = kGray_SkColorChannelFlag | kAlpha_SkColorChannelFlag, - kRG_SkColorChannelFlags = kRed_SkColorChannelFlag | kGreen_SkColorChannelFlag, - kRGB_SkColorChannelFlags = kRG_SkColorChannelFlags | kBlue_SkColorChannelFlag, - kRGBA_SkColorChannelFlags = kRGB_SkColorChannelFlags | kAlpha_SkColorChannelFlag, -}; -static_assert(0 == (kGray_SkColorChannelFlag & kRGBA_SkColorChannelFlags), "bitfield conflict"); - -/** \struct SkRGBA4f - RGBA color value, holding four floating point components. Color components are always in - a known order. kAT determines if the SkRGBA4f's R, G, and B components are premultiplied - by alpha or not. - - Skia's public API always uses unpremultiplied colors, which can be stored as - SkRGBA4f. For convenience, this type can also be referred to - as SkColor4f. -*/ -template -struct SkRGBA4f { - float fR; //!< red component - float fG; //!< green component - float fB; //!< blue component - float fA; //!< alpha component - - /** Compares SkRGBA4f with other, and returns true if all components are equal. - - @param other SkRGBA4f to compare - @return true if SkRGBA4f equals other - */ - bool operator==(const SkRGBA4f& other) const { - return fA == other.fA && fR == other.fR && fG == other.fG && fB == other.fB; - } - - /** Compares SkRGBA4f with other, and returns true if not all components are equal. - - @param other SkRGBA4f to compare - @return true if SkRGBA4f is not equal to other - */ - bool operator!=(const SkRGBA4f& other) const { - return !(*this == other); - } - - /** Returns SkRGBA4f multiplied by scale. - - @param scale value to multiply by - @return SkRGBA4f as (fR * scale, fG * scale, fB * scale, fA * scale) - */ - SkRGBA4f operator*(float scale) const { - return { fR * scale, fG * scale, fB * scale, fA * scale }; - } - - /** Returns SkRGBA4f multiplied component-wise by scale. - - @param scale SkRGBA4f to multiply by - @return SkRGBA4f as (fR * scale.fR, fG * scale.fG, fB * scale.fB, fA * scale.fA) - */ - SkRGBA4f operator*(const SkRGBA4f& scale) const { - return { fR * scale.fR, fG * scale.fG, fB * scale.fB, fA * scale.fA }; - } - - /** Returns a pointer to components of SkRGBA4f, for array access. - - @return pointer to array [fR, fG, fB, fA] - */ - const float* vec() const { return &fR; } - - /** Returns a pointer to components of SkRGBA4f, for array access. - - @return pointer to array [fR, fG, fB, fA] - */ - float* vec() { return &fR; } - - /** As a std::array */ - std::array array() const { return {fR, fG, fB, fA}; } - - /** Returns one component. Asserts if index is out of range and SK_DEBUG is defined. - - @param index one of: 0 (fR), 1 (fG), 2 (fB), 3 (fA) - @return value corresponding to index - */ - float operator[](int index) const { - SkASSERT(index >= 0 && index < 4); - return this->vec()[index]; - } - - /** Returns one component. Asserts if index is out of range and SK_DEBUG is defined. - - @param index one of: 0 (fR), 1 (fG), 2 (fB), 3 (fA) - @return value corresponding to index - */ - float& operator[](int index) { - SkASSERT(index >= 0 && index < 4); - return this->vec()[index]; - } - - /** Returns true if SkRGBA4f is an opaque color. Asserts if fA is out of range and - SK_DEBUG is defined. - - @return true if SkRGBA4f is opaque - */ - bool isOpaque() const { - SkASSERT(fA <= 1.0f && fA >= 0.0f); - return fA == 1.0f; - } - - /** Returns true if all channels are in [0, 1]. */ - bool fitsInBytes() const { - SkASSERT(fA >= 0.0f && fA <= 1.0f); - return fR >= 0.0f && fR <= 1.0f && - fG >= 0.0f && fG <= 1.0f && - fB >= 0.0f && fB <= 1.0f; - } - - /** Returns closest SkRGBA4f to SkColor. Only allowed if SkRGBA4f is unpremultiplied. - - @param color Color with Alpha, red, blue, and green components - @return SkColor as SkRGBA4f - - example: https://fiddle.skia.org/c/@RGBA4f_FromColor - */ - static SkRGBA4f FromColor(SkColor color); // impl. depends on kAT - - /** Returns closest SkColor to SkRGBA4f. Only allowed if SkRGBA4f is unpremultiplied. - - @return color as SkColor - - example: https://fiddle.skia.org/c/@RGBA4f_toSkColor - */ - SkColor toSkColor() const; // impl. depends on kAT - - /** Returns closest SkRGBA4f to SkPMColor. Only allowed if SkRGBA4f is premultiplied. - - @return SkPMColor as SkRGBA4f - */ - static SkRGBA4f FromPMColor(SkPMColor); // impl. depends on kAT - - /** Returns SkRGBA4f premultiplied by alpha. Asserts at compile time if SkRGBA4f is - already premultiplied. - - @return premultiplied color - */ - SkRGBA4f premul() const { - static_assert(kAT == kUnpremul_SkAlphaType, ""); - return { fR * fA, fG * fA, fB * fA, fA }; - } - - /** Returns SkRGBA4f unpremultiplied by alpha. Asserts at compile time if SkRGBA4f is - already unpremultiplied. - - @return unpremultiplied color - */ - SkRGBA4f unpremul() const { - static_assert(kAT == kPremul_SkAlphaType, ""); - - if (fA == 0.0f) { - return { 0, 0, 0, 0 }; - } else { - float invAlpha = 1 / fA; - return { fR * invAlpha, fG * invAlpha, fB * invAlpha, fA }; - } - } - - // This produces bytes in RGBA order (eg GrColor). Impl. is the same, regardless of kAT - uint32_t toBytes_RGBA() const; - static SkRGBA4f FromBytes_RGBA(uint32_t color); - - /** - Returns a copy of the SkRGBA4f but with alpha component set to 1.0f. - - @return opaque color - */ - SkRGBA4f makeOpaque() const { - return { fR, fG, fB, 1.0f }; - } -}; - -/** \struct SkColor4f - RGBA color value, holding four floating point components. Color components are always in - a known order, and are unpremultiplied. - - This is a specialization of SkRGBA4f. For details, @see SkRGBA4f. -*/ -using SkColor4f = SkRGBA4f; - -template <> SK_API SkColor4f SkColor4f::FromColor(SkColor); -template <> SK_API SkColor SkColor4f::toSkColor() const; -template <> SK_API uint32_t SkColor4f::toBytes_RGBA() const; -template <> SK_API SkColor4f SkColor4f::FromBytes_RGBA(uint32_t color); - -namespace SkColors { -constexpr SkColor4f kTransparent = {0, 0, 0, 0}; -constexpr SkColor4f kBlack = {0, 0, 0, 1}; -constexpr SkColor4f kDkGray = {0.25f, 0.25f, 0.25f, 1}; -constexpr SkColor4f kGray = {0.50f, 0.50f, 0.50f, 1}; -constexpr SkColor4f kLtGray = {0.75f, 0.75f, 0.75f, 1}; -constexpr SkColor4f kWhite = {1, 1, 1, 1}; -constexpr SkColor4f kRed = {1, 0, 0, 1}; -constexpr SkColor4f kGreen = {0, 1, 0, 1}; -constexpr SkColor4f kBlue = {0, 0, 1, 1}; -constexpr SkColor4f kYellow = {1, 1, 0, 1}; -constexpr SkColor4f kCyan = {0, 1, 1, 1}; -constexpr SkColor4f kMagenta = {1, 0, 1, 1}; -} // namespace SkColors -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorFilter.h deleted file mode 100644 index 1e0f6ea6f5821f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorFilter.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorFilter_DEFINED -#define SkColorFilter_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkColor.h" -#include "include/core/SkFlattenable.h" - -class SkColorMatrix; -class SkColorSpace; - -/** -* ColorFilters are optional objects in the drawing pipeline. When present in -* a paint, they are called with the "src" colors, and return new colors, which -* are then passed onto the next stage (either ImageFilter or Xfermode). -* -* All subclasses are required to be reentrant-safe : it must be legal to share -* the same instance between several threads. -*/ -class SK_API SkColorFilter : public SkFlattenable { -public: - /** If the filter can be represented by a source color plus Mode, this - * returns true, and sets (if not NULL) the color and mode appropriately. - * If not, this returns false and ignores the parameters. - */ - bool asAColorMode(SkColor* color, SkBlendMode* mode) const; - - /** If the filter can be represented by a 5x4 matrix, this - * returns true, and sets the matrix appropriately. - * If not, this returns false and ignores the parameter. - */ - bool asAColorMatrix(float matrix[20]) const; - - // Returns true if the filter is guaranteed to never change the alpha of a color it filters. - bool isAlphaUnchanged() const; - - SkColor filterColor(SkColor) const; - - /** - * Converts the src color (in src colorspace), into the dst colorspace, - * then applies this filter to it, returning the filtered color in the dst colorspace. - */ - SkColor4f filterColor4f(const SkColor4f& srcColor, SkColorSpace* srcCS, - SkColorSpace* dstCS) const; - - /** Construct a colorfilter whose effect is to first apply the inner filter and then apply - * this filter, applied to the output of the inner filter. - * - * result = this(inner(...)) - */ - sk_sp makeComposed(sk_sp inner) const; - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr); - -private: - SkColorFilter() = default; - friend class SkColorFilterBase; - - using INHERITED = SkFlattenable; -}; - -class SK_API SkColorFilters { -public: - static sk_sp Compose(sk_sp outer, sk_sp inner) { - return outer ? outer->makeComposed(inner) : inner; - } - - // Blends between the constant color (src) and input color (dst) based on the SkBlendMode. - // If the color space is null, the constant color is assumed to be defined in sRGB. - static sk_sp Blend(const SkColor4f& c, sk_sp, SkBlendMode mode); - static sk_sp Blend(SkColor c, SkBlendMode mode); - - static sk_sp Matrix(const SkColorMatrix&); - static sk_sp Matrix(const float rowMajor[20]); - - // A version of Matrix which operates in HSLA space instead of RGBA. - // I.e. HSLA-to-RGBA(Matrix(RGBA-to-HSLA(input))). - static sk_sp HSLAMatrix(const SkColorMatrix&); - static sk_sp HSLAMatrix(const float rowMajor[20]); - - static sk_sp LinearToSRGBGamma(); - static sk_sp SRGBToLinearGamma(); - static sk_sp Lerp(float t, sk_sp dst, sk_sp src); - - /** - * Create a table colorfilter, copying the table into the filter, and - * applying it to all 4 components. - * a' = table[a]; - * r' = table[r]; - * g' = table[g]; - * b' = table[b]; - * Components are operated on in unpremultiplied space. If the incomming - * colors are premultiplied, they are temporarily unpremultiplied, then - * the table is applied, and then the result is remultiplied. - */ - static sk_sp Table(const uint8_t table[256]); - - /** - * Create a table colorfilter, with a different table for each - * component [A, R, G, B]. If a given table is NULL, then it is - * treated as identity, with the component left unchanged. If a table - * is not null, then its contents are copied into the filter. - */ - static sk_sp TableARGB(const uint8_t tableA[256], - const uint8_t tableR[256], - const uint8_t tableG[256], - const uint8_t tableB[256]); - - /** - * Create a colorfilter that multiplies the RGB channels by one color, and - * then adds a second color, pinning the result for each component to - * [0..255]. The alpha components of the mul and add arguments - * are ignored. - */ - static sk_sp Lighting(SkColor mul, SkColor add); - -private: - SkColorFilters() = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorPriv.h deleted file mode 100644 index 29f64339baaac3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorPriv.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorPriv_DEFINED -#define SkColorPriv_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkMath.h" -#include "include/private/SkTPin.h" -#include "include/private/SkTo.h" - -/** Turn 0..255 into 0..256 by adding 1 at the half-way point. Used to turn a - byte into a scale value, so that we can say scale * value >> 8 instead of - alpha * value / 255. - - In debugging, asserts that alpha is 0..255 -*/ -static inline unsigned SkAlpha255To256(U8CPU alpha) { - SkASSERT(SkToU8(alpha) == alpha); - // this one assues that blending on top of an opaque dst keeps it that way - // even though it is less accurate than a+(a>>7) for non-opaque dsts - return alpha + 1; -} - -/** Multiplify value by 0..256, and shift the result down 8 - (i.e. return (value * alpha256) >> 8) - */ -#define SkAlphaMul(value, alpha256) (((value) * (alpha256)) >> 8) - -static inline U8CPU SkUnitScalarClampToByte(SkScalar x) { - return static_cast(SkTPin(x, 0.0f, 1.0f) * 255 + 0.5); -} - -#define SK_A32_BITS 8 -#define SK_R32_BITS 8 -#define SK_G32_BITS 8 -#define SK_B32_BITS 8 - -#define SK_A32_MASK ((1 << SK_A32_BITS) - 1) -#define SK_R32_MASK ((1 << SK_R32_BITS) - 1) -#define SK_G32_MASK ((1 << SK_G32_BITS) - 1) -#define SK_B32_MASK ((1 << SK_B32_BITS) - 1) - -/* - * Skia's 32bit backend only supports 1 swizzle order at a time (compile-time). - * This is specified by SK_R32_SHIFT=0 or SK_R32_SHIFT=16. - * - * For easier compatibility with Skia's GPU backend, we further restrict these - * to either (in memory-byte-order) RGBA or BGRA. Note that this "order" does - * not directly correspond to the same shift-order, since we have to take endianess - * into account. - * - * Here we enforce this constraint. - */ - -#define SK_RGBA_R32_SHIFT 0 -#define SK_RGBA_G32_SHIFT 8 -#define SK_RGBA_B32_SHIFT 16 -#define SK_RGBA_A32_SHIFT 24 - -#define SK_BGRA_B32_SHIFT 0 -#define SK_BGRA_G32_SHIFT 8 -#define SK_BGRA_R32_SHIFT 16 -#define SK_BGRA_A32_SHIFT 24 - -#if defined(SK_PMCOLOR_IS_RGBA) || defined(SK_PMCOLOR_IS_BGRA) - #error "Configure PMCOLOR by setting SK_R32_SHIFT." -#endif - -// Deduce which SK_PMCOLOR_IS_ to define from the _SHIFT defines - -#if (SK_A32_SHIFT == SK_RGBA_A32_SHIFT && \ - SK_R32_SHIFT == SK_RGBA_R32_SHIFT && \ - SK_G32_SHIFT == SK_RGBA_G32_SHIFT && \ - SK_B32_SHIFT == SK_RGBA_B32_SHIFT) - #define SK_PMCOLOR_IS_RGBA -#elif (SK_A32_SHIFT == SK_BGRA_A32_SHIFT && \ - SK_R32_SHIFT == SK_BGRA_R32_SHIFT && \ - SK_G32_SHIFT == SK_BGRA_G32_SHIFT && \ - SK_B32_SHIFT == SK_BGRA_B32_SHIFT) - #define SK_PMCOLOR_IS_BGRA -#else - #error "need 32bit packing to be either RGBA or BGRA" -#endif - -#define SkGetPackedA32(packed) ((uint32_t)((packed) << (24 - SK_A32_SHIFT)) >> 24) -#define SkGetPackedR32(packed) ((uint32_t)((packed) << (24 - SK_R32_SHIFT)) >> 24) -#define SkGetPackedG32(packed) ((uint32_t)((packed) << (24 - SK_G32_SHIFT)) >> 24) -#define SkGetPackedB32(packed) ((uint32_t)((packed) << (24 - SK_B32_SHIFT)) >> 24) - -#define SkA32Assert(a) SkASSERT((unsigned)(a) <= SK_A32_MASK) -#define SkR32Assert(r) SkASSERT((unsigned)(r) <= SK_R32_MASK) -#define SkG32Assert(g) SkASSERT((unsigned)(g) <= SK_G32_MASK) -#define SkB32Assert(b) SkASSERT((unsigned)(b) <= SK_B32_MASK) - -/** - * Pack the components into a SkPMColor, checking (in the debug version) that - * the components are 0..255, and are already premultiplied (i.e. alpha >= color) - */ -static inline SkPMColor SkPackARGB32(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - SkA32Assert(a); - SkASSERT(r <= a); - SkASSERT(g <= a); - SkASSERT(b <= a); - - return (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) | - (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT); -} - -/** - * Same as SkPackARGB32, but this version guarantees to not check that the - * values are premultiplied in the debug version. - */ -static inline SkPMColor SkPackARGB32NoCheck(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - return (a << SK_A32_SHIFT) | (r << SK_R32_SHIFT) | - (g << SK_G32_SHIFT) | (b << SK_B32_SHIFT); -} - -static inline -SkPMColor SkPremultiplyARGBInline(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - SkA32Assert(a); - SkR32Assert(r); - SkG32Assert(g); - SkB32Assert(b); - - if (a != 255) { - r = SkMulDiv255Round(r, a); - g = SkMulDiv255Round(g, a); - b = SkMulDiv255Round(b, a); - } - return SkPackARGB32(a, r, g, b); -} - -// When Android is compiled optimizing for size, SkAlphaMulQ doesn't get -// inlined; forcing inlining significantly improves performance. -static SK_ALWAYS_INLINE uint32_t SkAlphaMulQ(uint32_t c, unsigned scale) { - uint32_t mask = 0xFF00FF; - - uint32_t rb = ((c & mask) * scale) >> 8; - uint32_t ag = ((c >> 8) & mask) * scale; - return (rb & mask) | (ag & ~mask); -} - -static inline SkPMColor SkPMSrcOver(SkPMColor src, SkPMColor dst) { - return src + SkAlphaMulQ(dst, SkAlpha255To256(255 - SkGetPackedA32(src))); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorSpace.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorSpace.h deleted file mode 100644 index a09758645b161b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorSpace.h +++ /dev/null @@ -1,245 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorSpace_DEFINED -#define SkColorSpace_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/private/SkFixed.h" -#include "include/private/SkOnce.h" -#include "modules/skcms/skcms.h" -#include - -class SkData; - -/** - * Describes a color gamut with primaries and a white point. - */ -struct SK_API SkColorSpacePrimaries { - float fRX; - float fRY; - float fGX; - float fGY; - float fBX; - float fBY; - float fWX; - float fWY; - - /** - * Convert primaries and a white point to a toXYZD50 matrix, the preferred color gamut - * representation of SkColorSpace. - */ - bool toXYZD50(skcms_Matrix3x3* toXYZD50) const; -}; - -namespace SkNamedTransferFn { - -// Like SkNamedGamut::kSRGB, keeping this bitwise exactly the same as skcms makes things fastest. -static constexpr skcms_TransferFunction kSRGB = - { 2.4f, (float)(1/1.055), (float)(0.055/1.055), (float)(1/12.92), 0.04045f, 0.0f, 0.0f }; - -static constexpr skcms_TransferFunction k2Dot2 = - { 2.2f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; - -static constexpr skcms_TransferFunction kLinear = - { 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f }; - -static constexpr skcms_TransferFunction kRec2020 = - {2.22222f, 0.909672f, 0.0903276f, 0.222222f, 0.0812429f, 0, 0}; - -static constexpr skcms_TransferFunction kPQ = - {-2.0f, -107/128.0f, 1.0f, 32/2523.0f, 2413/128.0f, -2392/128.0f, 8192/1305.0f }; - -static constexpr skcms_TransferFunction kHLG = - {-3.0f, 2.0f, 2.0f, 1/0.17883277f, 0.28466892f, 0.55991073f, 0.0f }; - -} // namespace SkNamedTransferFn - -namespace SkNamedGamut { - -static constexpr skcms_Matrix3x3 kSRGB = {{ - // ICC fixed-point (16.16) representation, taken from skcms. Please keep them exactly in sync. - // 0.436065674f, 0.385147095f, 0.143066406f, - // 0.222488403f, 0.716873169f, 0.060607910f, - // 0.013916016f, 0.097076416f, 0.714096069f, - { SkFixedToFloat(0x6FA2), SkFixedToFloat(0x6299), SkFixedToFloat(0x24A0) }, - { SkFixedToFloat(0x38F5), SkFixedToFloat(0xB785), SkFixedToFloat(0x0F84) }, - { SkFixedToFloat(0x0390), SkFixedToFloat(0x18DA), SkFixedToFloat(0xB6CF) }, -}}; - -static constexpr skcms_Matrix3x3 kAdobeRGB = {{ - // ICC fixed-point (16.16) repesentation of: - // 0.60974, 0.20528, 0.14919, - // 0.31111, 0.62567, 0.06322, - // 0.01947, 0.06087, 0.74457, - { SkFixedToFloat(0x9c18), SkFixedToFloat(0x348d), SkFixedToFloat(0x2631) }, - { SkFixedToFloat(0x4fa5), SkFixedToFloat(0xa02c), SkFixedToFloat(0x102f) }, - { SkFixedToFloat(0x04fc), SkFixedToFloat(0x0f95), SkFixedToFloat(0xbe9c) }, -}}; - -static constexpr skcms_Matrix3x3 kDisplayP3 = {{ - { 0.515102f, 0.291965f, 0.157153f }, - { 0.241182f, 0.692236f, 0.0665819f }, - { -0.00104941f, 0.0418818f, 0.784378f }, -}}; - -static constexpr skcms_Matrix3x3 kRec2020 = {{ - { 0.673459f, 0.165661f, 0.125100f }, - { 0.279033f, 0.675338f, 0.0456288f }, - { -0.00193139f, 0.0299794f, 0.797162f }, -}}; - -static constexpr skcms_Matrix3x3 kXYZ = {{ - { 1.0f, 0.0f, 0.0f }, - { 0.0f, 1.0f, 0.0f }, - { 0.0f, 0.0f, 1.0f }, -}}; - -} // namespace SkNamedGamut - -class SK_API SkColorSpace : public SkNVRefCnt { -public: - /** - * Create the sRGB color space. - */ - static sk_sp MakeSRGB(); - - /** - * Colorspace with the sRGB primaries, but a linear (1.0) gamma. - */ - static sk_sp MakeSRGBLinear(); - - /** - * Create an SkColorSpace from a transfer function and a row-major 3x3 transformation to XYZ. - */ - static sk_sp MakeRGB(const skcms_TransferFunction& transferFn, - const skcms_Matrix3x3& toXYZ); - - /** - * Create an SkColorSpace from a parsed (skcms) ICC profile. - */ - static sk_sp Make(const skcms_ICCProfile&); - - /** - * Convert this color space to an skcms ICC profile struct. - */ - void toProfile(skcms_ICCProfile*) const; - - /** - * Returns true if the color space gamma is near enough to be approximated as sRGB. - */ - bool gammaCloseToSRGB() const; - - /** - * Returns true if the color space gamma is linear. - */ - bool gammaIsLinear() const; - - /** - * Sets |fn| to the transfer function from this color space. Returns true if the transfer - * function can be represented as coefficients to the standard ICC 7-parameter equation. - * Returns false otherwise (eg, PQ, HLG). - */ - bool isNumericalTransferFn(skcms_TransferFunction* fn) const; - - /** - * Returns true and sets |toXYZD50| if the color gamut can be described as a matrix. - * Returns false otherwise. - */ - bool toXYZD50(skcms_Matrix3x3* toXYZD50) const; - - /** - * Returns a hash of the gamut transformation to XYZ D50. Allows for fast equality checking - * of gamuts, at the (very small) risk of collision. - */ - uint32_t toXYZD50Hash() const { return fToXYZD50Hash; } - - /** - * Returns a color space with the same gamut as this one, but with a linear gamma. - * For color spaces whose gamut can not be described in terms of XYZ D50, returns - * linear sRGB. - */ - sk_sp makeLinearGamma() const; - - /** - * Returns a color space with the same gamut as this one, with with the sRGB transfer - * function. For color spaces whose gamut can not be described in terms of XYZ D50, returns - * sRGB. - */ - sk_sp makeSRGBGamma() const; - - /** - * Returns a color space with the same transfer function as this one, but with the primary - * colors rotated. For any XYZ space, this produces a new color space that maps RGB to GBR - * (when applied to a source), and maps RGB to BRG (when applied to a destination). For other - * types of color spaces, returns nullptr. - * - * This is used for testing, to construct color spaces that have severe and testable behavior. - */ - sk_sp makeColorSpin() const; - - /** - * Returns true if the color space is sRGB. - * Returns false otherwise. - * - * This allows a little bit of tolerance, given that we might see small numerical error - * in some cases: converting ICC fixed point to float, converting white point to D50, - * rounding decisions on transfer function and matrix. - * - * This does not consider a 2.2f exponential transfer function to be sRGB. While these - * functions are similar (and it is sometimes useful to consider them together), this - * function checks for logical equality. - */ - bool isSRGB() const; - - /** - * Returns nullptr on failure. Fails when we fallback to serializing ICC data and - * the data is too large to serialize. - */ - sk_sp serialize() const; - - /** - * If |memory| is nullptr, returns the size required to serialize. - * Otherwise, serializes into |memory| and returns the size. - */ - size_t writeToMemory(void* memory) const; - - static sk_sp Deserialize(const void* data, size_t length); - - /** - * If both are null, we return true. If one is null and the other is not, we return false. - * If both are non-null, we do a deeper compare. - */ - static bool Equals(const SkColorSpace*, const SkColorSpace*); - - void transferFn(float gabcdef[7]) const; // DEPRECATED: Remove when webview usage is gone - void transferFn(skcms_TransferFunction* fn) const; - void invTransferFn(skcms_TransferFunction* fn) const; - void gamutTransformTo(const SkColorSpace* dst, skcms_Matrix3x3* src_to_dst) const; - - uint32_t transferFnHash() const { return fTransferFnHash; } - uint64_t hash() const { return (uint64_t)fTransferFnHash << 32 | fToXYZD50Hash; } - -private: - friend class SkColorSpaceSingletonFactory; - - SkColorSpace(const skcms_TransferFunction& transferFn, const skcms_Matrix3x3& toXYZ); - - void computeLazyDstFields() const; - - uint32_t fTransferFnHash; - uint32_t fToXYZD50Hash; - - skcms_TransferFunction fTransferFn; - skcms_Matrix3x3 fToXYZD50; - - mutable skcms_TransferFunction fInvTransferFn; - mutable skcms_Matrix3x3 fFromXYZD50; - mutable SkOnce fLazyDstFieldsOnce; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorType.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorType.h deleted file mode 100644 index b51aa7b96f96ba..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkColorType.h +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorType_DEFINED -#define SkColorType_DEFINED - -#include "include/core/SkTypes.h" - -/** \enum SkColorType - Describes how pixel bits encode color. A pixel may be an alpha mask, a grayscale, RGB, or ARGB. - - kN32_SkColorType selects the native 32-bit ARGB format for the current configuration. This can - lead to inconsistent results across platforms, so use with caution. -*/ -enum SkColorType : int { - kUnknown_SkColorType, //!< uninitialized - kAlpha_8_SkColorType, //!< pixel with alpha in 8-bit byte - kRGB_565_SkColorType, //!< pixel with 5 bits red, 6 bits green, 5 bits blue, in 16-bit word - kARGB_4444_SkColorType, //!< pixel with 4 bits for alpha, red, green, blue; in 16-bit word - kRGBA_8888_SkColorType, //!< pixel with 8 bits for red, green, blue, alpha; in 32-bit word - kRGB_888x_SkColorType, //!< pixel with 8 bits each for red, green, blue; in 32-bit word - kBGRA_8888_SkColorType, //!< pixel with 8 bits for blue, green, red, alpha; in 32-bit word - kRGBA_1010102_SkColorType, //!< 10 bits for red, green, blue; 2 bits for alpha; in 32-bit word - kBGRA_1010102_SkColorType, //!< 10 bits for blue, green, red; 2 bits for alpha; in 32-bit word - kRGB_101010x_SkColorType, //!< pixel with 10 bits each for red, green, blue; in 32-bit word - kBGR_101010x_SkColorType, //!< pixel with 10 bits each for blue, green, red; in 32-bit word - kGray_8_SkColorType, //!< pixel with grayscale level in 8-bit byte - kRGBA_F16Norm_SkColorType, //!< pixel with half floats in [0,1] for red, green, blue, alpha; - // in 64-bit word - kRGBA_F16_SkColorType, //!< pixel with half floats for red, green, blue, alpha; - // in 64-bit word - kRGBA_F32_SkColorType, //!< pixel using C float for red, green, blue, alpha; in 128-bit word - - // The following 6 colortypes are just for reading from - not for rendering to - kR8G8_unorm_SkColorType, //!< pixel with a uint8_t for red and green - - kA16_float_SkColorType, //!< pixel with a half float for alpha - kR16G16_float_SkColorType, //!< pixel with a half float for red and green - - kA16_unorm_SkColorType, //!< pixel with a little endian uint16_t for alpha - kR16G16_unorm_SkColorType, //!< pixel with a little endian uint16_t for red and green - kR16G16B16A16_unorm_SkColorType, //!< pixel with a little endian uint16_t for red, green, blue - // and alpha - - kSRGBA_8888_SkColorType, - kR8_unorm_SkColorType, - - kLastEnum_SkColorType = kR8_unorm_SkColorType, //!< last valid value - -#if SK_PMCOLOR_BYTE_ORDER(B,G,R,A) - kN32_SkColorType = kBGRA_8888_SkColorType,//!< native 32-bit BGRA encoding - -#elif SK_PMCOLOR_BYTE_ORDER(R,G,B,A) - kN32_SkColorType = kRGBA_8888_SkColorType,//!< native 32-bit RGBA encoding - -#else - #error "SK_*32_SHIFT values must correspond to BGRA or RGBA byte order" -#endif -}; -static constexpr int kSkColorTypeCnt = static_cast(kLastEnum_SkColorType) + 1; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkContourMeasure.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkContourMeasure.h deleted file mode 100644 index 08a50b11054c8c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkContourMeasure.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkContourMeasure_DEFINED -#define SkContourMeasure_DEFINED - -#include "include/core/SkPath.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkTDArray.h" - -struct SkConic; - -class SK_API SkContourMeasure : public SkRefCnt { -public: - /** Return the length of the contour. - */ - SkScalar length() const { return fLength; } - - /** Pins distance to 0 <= distance <= length(), and then computes the corresponding - * position and tangent. - */ - bool SK_WARN_UNUSED_RESULT getPosTan(SkScalar distance, SkPoint* position, - SkVector* tangent) const; - - enum MatrixFlags { - kGetPosition_MatrixFlag = 0x01, - kGetTangent_MatrixFlag = 0x02, - kGetPosAndTan_MatrixFlag = kGetPosition_MatrixFlag | kGetTangent_MatrixFlag - }; - - /** Pins distance to 0 <= distance <= getLength(), and then computes - the corresponding matrix (by calling getPosTan). - Returns false if there is no path, or a zero-length path was specified, in which case - matrix is unchanged. - */ - bool SK_WARN_UNUSED_RESULT getMatrix(SkScalar distance, SkMatrix* matrix, - MatrixFlags flags = kGetPosAndTan_MatrixFlag) const; - - /** Given a start and stop distance, return in dst the intervening segment(s). - If the segment is zero-length, return false, else return true. - startD and stopD are pinned to legal values (0..getLength()). If startD > stopD - then return false (and leave dst untouched). - Begin the segment with a moveTo if startWithMoveTo is true - */ - bool SK_WARN_UNUSED_RESULT getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, - bool startWithMoveTo) const; - - /** Return true if the contour is closed() - */ - bool isClosed() const { return fIsClosed; } - -private: - struct Segment { - SkScalar fDistance; // total distance up to this point - unsigned fPtIndex; // index into the fPts array - unsigned fTValue : 30; - unsigned fType : 2; // actually the enum SkSegType - // See SkPathMeasurePriv.h - - SkScalar getScalarT() const; - - static const Segment* Next(const Segment* seg) { - unsigned ptIndex = seg->fPtIndex; - do { - ++seg; - } while (seg->fPtIndex == ptIndex); - return seg; - } - - }; - - const SkTDArray fSegments; - const SkTDArray fPts; // Points used to define the segments - - const SkScalar fLength; - const bool fIsClosed; - - SkContourMeasure(SkTDArray&& segs, SkTDArray&& pts, - SkScalar length, bool isClosed); - ~SkContourMeasure() override {} - - const Segment* distanceToSegment(SkScalar distance, SkScalar* t) const; - - friend class SkContourMeasureIter; -}; - -class SK_API SkContourMeasureIter { -public: - SkContourMeasureIter(); - /** - * Initialize the Iter with a path. - * The parts of the path that are needed are copied, so the client is free to modify/delete - * the path after this call. - * - * resScale controls the precision of the measure. values > 1 increase the - * precision (and possibly slow down the computation). - */ - SkContourMeasureIter(const SkPath& path, bool forceClosed, SkScalar resScale = 1); - ~SkContourMeasureIter(); - - /** - * Reset the Iter with a path. - * The parts of the path that are needed are copied, so the client is free to modify/delete - * the path after this call. - */ - void reset(const SkPath& path, bool forceClosed, SkScalar resScale = 1); - - /** - * Iterates through contours in path, returning a contour-measure object for each contour - * in the path. Returns null when it is done. - * - * This only returns non-zero length contours, where a contour is the segments between - * a kMove_Verb and either ... - * - the next kMove_Verb - * - kClose_Verb (1 or more) - * - kDone_Verb - * If it encounters a zero-length contour, it is skipped. - */ - sk_sp next(); - -private: - class Impl; - - std::unique_ptr fImpl; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCoverageMode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCoverageMode.h deleted file mode 100644 index ea5b73d1a47768..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCoverageMode.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCoverageMode_DEFINED -#define SkCoverageMode_DEFINED - -#include "include/core/SkTypes.h" - -/** - * Describes geometric operations (ala SkRegion::Op) that can be applied to coverage bytes. - * These can be thought of as variants of porter-duff (SkBlendMode) modes, but only applied - * to the alpha channel. - * - * See SkMaskFilter for ways to use these when combining two different masks. - */ -enum class SkCoverageMode { - kUnion, // A ∪ B A+B-A*B - kIntersect, // A ∩ B A*B - kDifference, // A - B A*(1-B) - kReverseDifference, // B - A B*(1-A) - kXor, // A ⊕ B A+B-2*A*B - - kLast = kXor, -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCubicMap.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCubicMap.h deleted file mode 100644 index 7389b92afd0991..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkCubicMap.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCubicMap_DEFINED -#define SkCubicMap_DEFINED - -#include "include/core/SkPoint.h" - -/** - * Fast evaluation of a cubic ease-in / ease-out curve. This is defined as a parametric cubic - * curve inside the unit square. - * - * pt[0] is implicitly { 0, 0 } - * pt[3] is implicitly { 1, 1 } - * pts[1,2].X are inside the unit [0..1] - */ -class SK_API SkCubicMap { -public: - SkCubicMap(SkPoint p1, SkPoint p2); - - static bool IsLinear(SkPoint p1, SkPoint p2) { - return SkScalarNearlyEqual(p1.fX, p1.fY) && SkScalarNearlyEqual(p2.fX, p2.fY); - } - - float computeYFromX(float x) const; - - SkPoint computeFromT(float t) const; - -private: - enum Type { - kLine_Type, // x == y - kCubeRoot_Type, // At^3 == x - kSolver_Type, // general monotonic cubic solver - }; - - SkPoint fCoeff[3]; - Type fType; -}; - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkData.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkData.h deleted file mode 100644 index 2a4b40d5f614a8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkData.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkData_DEFINED -#define SkData_DEFINED - -#include - -#include "include/core/SkRefCnt.h" - -class SkStream; - -/** - * SkData holds an immutable data buffer. Not only is the data immutable, - * but the actual ptr that is returned (by data() or bytes()) is guaranteed - * to always be the same for the life of this instance. - */ -class SK_API SkData final : public SkNVRefCnt { -public: - /** - * Returns the number of bytes stored. - */ - size_t size() const { return fSize; } - - bool isEmpty() const { return 0 == fSize; } - - /** - * Returns the ptr to the data. - */ - const void* data() const { return fPtr; } - - /** - * Like data(), returns a read-only ptr into the data, but in this case - * it is cast to uint8_t*, to make it easy to add an offset to it. - */ - const uint8_t* bytes() const { - return reinterpret_cast(fPtr); - } - - /** - * USE WITH CAUTION. - * This call will assert that the refcnt is 1, as a precaution against modifying the - * contents when another client/thread has access to the data. - */ - void* writable_data() { - if (fSize) { - // only assert we're unique if we're not empty - SkASSERT(this->unique()); - } - return const_cast(fPtr); - } - - /** - * Helper to copy a range of the data into a caller-provided buffer. - * Returns the actual number of bytes copied, after clamping offset and - * length to the size of the data. If buffer is NULL, it is ignored, and - * only the computed number of bytes is returned. - */ - size_t copyRange(size_t offset, size_t length, void* buffer) const; - - /** - * Returns true if these two objects have the same length and contents, - * effectively returning 0 == memcmp(...) - */ - bool equals(const SkData* other) const; - - /** - * Function that, if provided, will be called when the SkData goes out - * of scope, allowing for custom allocation/freeing of the data's contents. - */ - typedef void (*ReleaseProc)(const void* ptr, void* context); - - /** - * Create a new dataref by copying the specified data - */ - static sk_sp MakeWithCopy(const void* data, size_t length); - - - /** - * Create a new data with uninitialized contents. The caller should call writable_data() - * to write into the buffer, but this must be done before another ref() is made. - */ - static sk_sp MakeUninitialized(size_t length); - - /** - * Create a new data with zero-initialized contents. The caller should call writable_data() - * to write into the buffer, but this must be done before another ref() is made. - */ - static sk_sp MakeZeroInitialized(size_t length); - - /** - * Create a new dataref by copying the specified c-string - * (a null-terminated array of bytes). The returned SkData will have size() - * equal to strlen(cstr) + 1. If cstr is NULL, it will be treated the same - * as "". - */ - static sk_sp MakeWithCString(const char cstr[]); - - /** - * Create a new dataref, taking the ptr as is, and using the - * releaseproc to free it. The proc may be NULL. - */ - static sk_sp MakeWithProc(const void* ptr, size_t length, ReleaseProc proc, void* ctx); - - /** - * Call this when the data parameter is already const and will outlive the lifetime of the - * SkData. Suitable for with const globals. - */ - static sk_sp MakeWithoutCopy(const void* data, size_t length) { - return MakeWithProc(data, length, NoopReleaseProc, nullptr); - } - - /** - * Create a new dataref from a pointer allocated by malloc. The Data object - * takes ownership of that allocation, and will handling calling sk_free. - */ - static sk_sp MakeFromMalloc(const void* data, size_t length); - - /** - * Create a new dataref the file with the specified path. - * If the file cannot be opened, this returns NULL. - */ - static sk_sp MakeFromFileName(const char path[]); - - /** - * Create a new dataref from a stdio FILE. - * This does not take ownership of the FILE, nor close it. - * The caller is free to close the FILE at its convenience. - * The FILE must be open for reading only. - * Returns NULL on failure. - */ - static sk_sp MakeFromFILE(FILE* f); - - /** - * Create a new dataref from a file descriptor. - * This does not take ownership of the file descriptor, nor close it. - * The caller is free to close the file descriptor at its convenience. - * The file descriptor must be open for reading only. - * Returns NULL on failure. - */ - static sk_sp MakeFromFD(int fd); - - /** - * Attempt to read size bytes into a SkData. If the read succeeds, return the data, - * else return NULL. Either way the stream's cursor may have been changed as a result - * of calling read(). - */ - static sk_sp MakeFromStream(SkStream*, size_t size); - - /** - * Create a new dataref using a subset of the data in the specified - * src dataref. - */ - static sk_sp MakeSubset(const SkData* src, size_t offset, size_t length); - - /** - * Returns a new empty dataref (or a reference to a shared empty dataref). - * New or shared, the caller must see that unref() is eventually called. - */ - static sk_sp MakeEmpty(); - -private: - friend class SkNVRefCnt; - ReleaseProc fReleaseProc; - void* fReleaseProcContext; - const void* fPtr; - size_t fSize; - - SkData(const void* ptr, size_t size, ReleaseProc, void* context); - explicit SkData(size_t size); // inplace new/delete - ~SkData(); - - // Ensure the unsized delete is called. - void operator delete(void* p); - - // shared internal factory - static sk_sp PrivateNewWithCopy(const void* srcOrNull, size_t length); - - static void NoopReleaseProc(const void*, void*); // {} - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDataTable.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDataTable.h deleted file mode 100644 index a6a510b7b221e8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDataTable.h +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDataTable_DEFINED -#define SkDataTable_DEFINED - -#include "include/core/SkData.h" -#include "include/private/SkTDArray.h" - -/** - * Like SkData, SkDataTable holds an immutable data buffer. The data buffer is - * organized into a table of entries, each with a length, so the entries are - * not required to all be the same size. - */ -class SK_API SkDataTable : public SkRefCnt { -public: - /** - * Returns true if the table is empty (i.e. has no entries). - */ - bool isEmpty() const { return 0 == fCount; } - - /** - * Return the number of entries in the table. 0 for an empty table - */ - int count() const { return fCount; } - - /** - * Return the size of the index'th entry in the table. The caller must - * ensure that index is valid for this table. - */ - size_t atSize(int index) const; - - /** - * Return a pointer to the data of the index'th entry in the table. - * The caller must ensure that index is valid for this table. - * - * @param size If non-null, this returns the byte size of this entry. This - * will be the same value that atSize(index) would return. - */ - const void* at(int index, size_t* size = nullptr) const; - - template - const T* atT(int index, size_t* size = nullptr) const { - return reinterpret_cast(this->at(index, size)); - } - - /** - * Returns the index'th entry as a c-string, and assumes that the trailing - * null byte had been copied into the table as well. - */ - const char* atStr(int index) const { - size_t size; - const char* str = this->atT(index, &size); - SkASSERT(strlen(str) + 1 == size); - return str; - } - - typedef void (*FreeProc)(void* context); - - static sk_sp MakeEmpty(); - - /** - * Return a new DataTable that contains a copy of the data stored in each - * "array". - * - * @param ptrs array of points to each element to be copied into the table. - * @param sizes array of byte-lengths for each entry in the corresponding - * ptrs[] array. - * @param count the number of array elements in ptrs[] and sizes[] to copy. - */ - static sk_sp MakeCopyArrays(const void * const * ptrs, - const size_t sizes[], int count); - - /** - * Return a new table that contains a copy of the data in array. - * - * @param array contiguous array of data for all elements to be copied. - * @param elemSize byte-length for a given element. - * @param count the number of entries to be copied out of array. The number - * of bytes that will be copied is count * elemSize. - */ - static sk_sp MakeCopyArray(const void* array, size_t elemSize, int count); - - static sk_sp MakeArrayProc(const void* array, size_t elemSize, int count, - FreeProc proc, void* context); - -private: - struct Dir { - const void* fPtr; - uintptr_t fSize; - }; - - int fCount; - size_t fElemSize; - union { - const Dir* fDir; - const char* fElems; - } fU; - - FreeProc fFreeProc; - void* fFreeProcContext; - - SkDataTable(); - SkDataTable(const void* array, size_t elemSize, int count, - FreeProc, void* context); - SkDataTable(const Dir*, int count, FreeProc, void* context); - ~SkDataTable() override; - - friend class SkDataTableBuilder; // access to Dir - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayList.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayList.h deleted file mode 100644 index 28e460fa8b050a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayList.h +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDeferredDisplayList_DEFINED -#define SkDeferredDisplayList_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkSurfaceCharacterization.h" -#include "include/core/SkTypes.h" - -class SkDeferredDisplayListPriv; - -#if SK_SUPPORT_GPU -#include "include/gpu/GrRecordingContext.h" -#include "include/private/SkTArray.h" -#include -class GrRenderTask; -class GrRenderTargetProxy; -#else -using GrRenderTargetProxy = SkRefCnt; -#endif - -/* - * This class contains pre-processed gpu operations that can be replayed into - * an SkSurface via SkSurface::draw(SkDeferredDisplayList*). - */ -class SkDeferredDisplayList : public SkNVRefCnt { -public: - SK_API ~SkDeferredDisplayList(); - - SK_API const SkSurfaceCharacterization& characterization() const { - return fCharacterization; - } - -#if SK_SUPPORT_GPU - /** - * Iterate through the programs required by the DDL. - */ - class SK_API ProgramIterator { - public: - ProgramIterator(GrDirectContext*, SkDeferredDisplayList*); - ~ProgramIterator(); - - // This returns true if any work was done. Getting a cache hit does not count as work. - bool compile(); - bool done() const; - void next(); - - private: - GrDirectContext* fDContext; - const SkTArray& fProgramData; - int fIndex; - }; -#endif - - // Provides access to functions that aren't part of the public API. - SkDeferredDisplayListPriv priv(); - const SkDeferredDisplayListPriv priv() const; // NOLINT(readability-const-return-type) - -private: - friend class GrDrawingManager; // for access to 'fRenderTasks', 'fLazyProxyData', 'fArenas' - friend class SkDeferredDisplayListRecorder; // for access to 'fLazyProxyData' - friend class SkDeferredDisplayListPriv; - - // This object is the source from which the lazy proxy backing the DDL will pull its backing - // texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy - // can outlive the DDL. - class LazyProxyData : public SkRefCnt { -#if SK_SUPPORT_GPU - public: - // Upon being replayed - this field will be filled in (by the DrawingManager) with the - // proxy backing the destination SkSurface. Note that, since there is no good place to - // clear it, it can become a dangling pointer. Additionally, since the renderTargetProxy - // doesn't get a ref here, the SkSurface that owns it must remain alive until the DDL - // is flushed. - // TODO: the drawing manager could ref the renderTargetProxy for the DDL and then add - // a renderingTask to unref it after the DDL's ops have been executed. - GrRenderTargetProxy* fReplayDest = nullptr; -#endif - }; - - SK_API SkDeferredDisplayList(const SkSurfaceCharacterization& characterization, - sk_sp fTargetProxy, - sk_sp); - -#if SK_SUPPORT_GPU - const SkTArray& programData() const { - return fProgramData; - } -#endif - - const SkSurfaceCharacterization fCharacterization; - -#if SK_SUPPORT_GPU - // These are ordered such that the destructor cleans op tasks up first (which may refer back - // to the arena and memory pool in their destructors). - GrRecordingContext::OwnedArenas fArenas; - SkTArray> fRenderTasks; - - SkTArray fProgramData; - sk_sp fTargetProxy; - sk_sp fLazyProxyData; -#endif -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayListRecorder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayListRecorder.h deleted file mode 100644 index 8103485597fcf5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDeferredDisplayListRecorder.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDeferredDisplayListRecorder_DEFINED -#define SkDeferredDisplayListRecorder_DEFINED - -#include "include/core/SkDeferredDisplayList.h" -#include "include/core/SkImage.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSurfaceCharacterization.h" -#include "include/core/SkTypes.h" - -class GrBackendFormat; -class GrBackendTexture; -class GrRecordingContext; -class GrYUVABackendTextureInfo; -class SkCanvas; -class SkSurface; - -/* - * This class is intended to be used as: - * Get an SkSurfaceCharacterization representing the intended gpu-backed destination SkSurface - * Create one of these (an SkDeferredDisplayListRecorder) on the stack - * Get the canvas and render into it - * Snap off and hold on to an SkDeferredDisplayList - * Once your app actually needs the pixels, call SkSurface::draw(SkDeferredDisplayList*) - * - * This class never accesses the GPU but performs all the cpu work it can. It - * is thread-safe (i.e., one can break a scene into tiles and perform their cpu-side - * work in parallel ahead of time). - */ -class SK_API SkDeferredDisplayListRecorder { -public: - SkDeferredDisplayListRecorder(const SkSurfaceCharacterization&); - ~SkDeferredDisplayListRecorder(); - - const SkSurfaceCharacterization& characterization() const { - return fCharacterization; - } - - // The backing canvas will become invalid (and this entry point will return - // null) once 'detach' is called. - // Note: ownership of the SkCanvas is not transferred via this call. - SkCanvas* getCanvas(); - - sk_sp detach(); - -#if SK_SUPPORT_GPU - using PromiseImageTextureContext = SkImage::PromiseImageTextureContext; - using PromiseImageTextureFulfillProc = SkImage::PromiseImageTextureFulfillProc; - using PromiseImageTextureReleaseProc = SkImage::PromiseImageTextureReleaseProc; - -#ifndef SK_MAKE_PROMISE_TEXTURE_DISABLE_LEGACY_API - /** Deprecated: Use SkImage::MakePromiseTexture instead. */ - sk_sp makePromiseTexture(const GrBackendFormat& backendFormat, - int width, - int height, - GrMipmapped mipmapped, - GrSurfaceOrigin origin, - SkColorType colorType, - SkAlphaType alphaType, - sk_sp colorSpace, - PromiseImageTextureFulfillProc textureFulfillProc, - PromiseImageTextureReleaseProc textureReleaseProc, - PromiseImageTextureContext textureContext); - - /** Deprecated: Use SkImage::MakePromiseYUVATexture instead. */ - sk_sp makeYUVAPromiseTexture(const GrYUVABackendTextureInfo& yuvaBackendTextureInfo, - sk_sp imageColorSpace, - PromiseImageTextureFulfillProc textureFulfillProc, - PromiseImageTextureReleaseProc textureReleaseProc, - PromiseImageTextureContext textureContexts[]); -#endif // SK_MAKE_PROMISE_TEXTURE_DISABLE_LEGACY_API -#endif // SK_SUPPORT_GPU - -private: - SkDeferredDisplayListRecorder(const SkDeferredDisplayListRecorder&) = delete; - SkDeferredDisplayListRecorder& operator=(const SkDeferredDisplayListRecorder&) = delete; - - bool init(); - - const SkSurfaceCharacterization fCharacterization; - -#if SK_SUPPORT_GPU - sk_sp fContext; - sk_sp fTargetProxy; - sk_sp fLazyProxyData; - sk_sp fSurface; -#endif -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDocument.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDocument.h deleted file mode 100644 index eacfb2c040b87c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDocument.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDocument_DEFINED -#define SkDocument_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" - -class SkCanvas; -class SkWStream; -struct SkRect; - -/** SK_ScalarDefaultDPI is 72 dots per inch. */ -static constexpr SkScalar SK_ScalarDefaultRasterDPI = 72.0f; - -/** - * High-level API for creating a document-based canvas. To use.. - * - * 1. Create a document, specifying a stream to store the output. - * 2. For each "page" of content: - * a. canvas = doc->beginPage(...) - * b. draw_my_content(canvas); - * c. doc->endPage(); - * 3. Close the document with doc->close(). - */ -class SK_API SkDocument : public SkRefCnt { -public: - - /** - * Begin a new page for the document, returning the canvas that will draw - * into the page. The document owns this canvas, and it will go out of - * scope when endPage() or close() is called, or the document is deleted. - */ - SkCanvas* beginPage(SkScalar width, SkScalar height, const SkRect* content = nullptr); - - /** - * Call endPage() when the content for the current page has been drawn - * (into the canvas returned by beginPage()). After this call the canvas - * returned by beginPage() will be out-of-scope. - */ - void endPage(); - - /** - * Call close() when all pages have been drawn. This will close the file - * or stream holding the document's contents. After close() the document - * can no longer add new pages. Deleting the document will automatically - * call close() if need be. - */ - void close(); - - /** - * Call abort() to stop producing the document immediately. - * The stream output must be ignored, and should not be trusted. - */ - void abort(); - -protected: - SkDocument(SkWStream*); - - // note: subclasses must call close() in their destructor, as the base class - // cannot do this for them. - ~SkDocument() override; - - virtual SkCanvas* onBeginPage(SkScalar width, SkScalar height) = 0; - virtual void onEndPage() = 0; - virtual void onClose(SkWStream*) = 0; - virtual void onAbort() = 0; - - // Allows subclasses to write to the stream as pages are written. - SkWStream* getStream() { return fStream; } - - enum State { - kBetweenPages_State, - kInPage_State, - kClosed_State - }; - State getState() const { return fState; } - -private: - SkWStream* fStream; - State fState; - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawLooper.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawLooper.h deleted file mode 100644 index 69d341c25fd5e2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawLooper.h +++ /dev/null @@ -1,135 +0,0 @@ - -/* - * Copyright 2011 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkDrawLooper_DEFINED -#define SkDrawLooper_DEFINED - -#include "include/core/SkBlurTypes.h" -#include "include/core/SkColor.h" -#include "include/core/SkFlattenable.h" -#include "include/core/SkPoint.h" -#include // std::function - -#ifndef SK_SUPPORT_LEGACY_DRAWLOOPER -#error "SkDrawLooper is unsupported" -#endif - -class SkArenaAlloc; -class SkCanvas; -class SkMatrix; -class SkPaint; -struct SkRect; - -/** \class SkDrawLooper - DEPRECATED: No longer supported in Skia. -*/ -class SK_API SkDrawLooper : public SkFlattenable { -public: - /** - * Holds state during a draw. Users call next() until it returns false. - * - * Subclasses of SkDrawLooper should create a subclass of this object to - * hold state specific to their subclass. - */ - class SK_API Context { - public: - Context() {} - virtual ~Context() {} - - struct Info { - SkVector fTranslate; - bool fApplyPostCTM; - - void applyToCTM(SkMatrix* ctm) const; - void applyToCanvas(SkCanvas*) const; - }; - - /** - * Called in a loop on objects returned by SkDrawLooper::createContext(). - * Each time true is returned, the object is drawn (possibly with a modified - * canvas and/or paint). When false is finally returned, drawing for the object - * stops. - * - * On each call, the paint will be in its original state, but the - * canvas will be as it was following the previous call to next() or - * createContext(). - * - * The implementation must ensure that, when next() finally returns - * false, the canvas has been restored to the state it was - * initially, before createContext() was first called. - */ - virtual bool next(Info*, SkPaint*) = 0; - - private: - Context(const Context&) = delete; - Context& operator=(const Context&) = delete; - }; - - /** - * Called right before something is being drawn. Returns a Context - * whose next() method should be called until it returns false. - */ - virtual Context* makeContext(SkArenaAlloc*) const = 0; - - /** - * The fast bounds functions are used to enable the paint to be culled early - * in the drawing pipeline. If a subclass can support this feature it must - * return true for the canComputeFastBounds() function. If that function - * returns false then computeFastBounds behavior is undefined otherwise it - * is expected to have the following behavior. Given the parent paint and - * the parent's bounding rect the subclass must fill in and return the - * storage rect, where the storage rect is with the union of the src rect - * and the looper's bounding rect. - */ - bool canComputeFastBounds(const SkPaint& paint) const; - void computeFastBounds(const SkPaint& paint, const SkRect& src, SkRect* dst) const; - - struct BlurShadowRec { - SkScalar fSigma; - SkVector fOffset; - SkColor fColor; - SkBlurStyle fStyle; - }; - /** - * If this looper can be interpreted as having two layers, such that - * 1. The first layer (bottom most) just has a blur and translate - * 2. The second layer has no modifications to either paint or canvas - * 3. No other layers. - * then return true, and if not null, fill out the BlurShadowRec). - * - * If any of the above are not met, return false and ignore the BlurShadowRec parameter. - */ - virtual bool asABlurShadow(BlurShadowRec*) const; - - static SkFlattenable::Type GetFlattenableType() { - return kSkDrawLooper_Type; - } - - SkFlattenable::Type getFlattenableType() const override { - return kSkDrawLooper_Type; - } - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr) { - return sk_sp(static_cast( - SkFlattenable::Deserialize( - kSkDrawLooper_Type, data, size, procs).release())); - } - - void apply(SkCanvas* canvas, const SkPaint& paint, - std::function); - -protected: - SkDrawLooper() {} - -private: - using INHERITED = SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawable.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawable.h deleted file mode 100644 index c86543dc6b367b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkDrawable.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDrawable_DEFINED -#define SkDrawable_DEFINED - -#include "include/core/SkFlattenable.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkScalar.h" - -class GrBackendDrawableInfo; -class SkCanvas; -class SkMatrix; -class SkPicture; -enum class GrBackendApi : unsigned; -struct SkRect; - -/** - * Base-class for objects that draw into SkCanvas. - * - * The object has a generation ID, which is guaranteed to be unique across all drawables. To - * allow for clients of the drawable that may want to cache the results, the drawable must - * change its generation ID whenever its internal state changes such that it will draw differently. - */ -class SK_API SkDrawable : public SkFlattenable { -public: - /** - * Draws into the specified content. The drawing sequence will be balanced upon return - * (i.e. the saveLevel() on the canvas will match what it was when draw() was called, - * and the current matrix and clip settings will not be changed. - */ - void draw(SkCanvas*, const SkMatrix* = nullptr); - void draw(SkCanvas*, SkScalar x, SkScalar y); - - /** - * When using the GPU backend it is possible for a drawable to execute using the underlying 3D - * API rather than the SkCanvas API. It does so by creating a GpuDrawHandler. The GPU backend - * is deferred so the handler will be given access to the 3D API at the correct point in the - * drawing stream as the GPU backend flushes. Since the drawable may mutate, each time it is - * drawn to a GPU-backed canvas a new handler is snapped, representing the drawable's state at - * the time of the snap. - * - * When the GPU backend flushes to the 3D API it will call the draw method on the - * GpuDrawHandler. At this time the drawable may add commands to the stream of GPU commands for - * the unerlying 3D API. The draw function takes a GrBackendDrawableInfo which contains - * information about the current state of 3D API which the caller must respect. See - * GrBackendDrawableInfo for more specific details on what information is sent and the - * requirements for different 3D APIs. - * - * Additionaly there may be a slight delay from when the drawable adds its commands to when - * those commands are actually submitted to the GPU. Thus the drawable or GpuDrawHandler is - * required to keep any resources that are used by its added commands alive and valid until - * those commands are submitted to the GPU. The GpuDrawHandler will be kept alive and then - * deleted once the commands are submitted to the GPU. The dtor of the GpuDrawHandler is the - * signal to the drawable that the commands have all been submitted. Different 3D APIs may have - * additional requirements for certain resources which require waiting for the GPU to finish - * all work on those resources before reusing or deleting them. In this case, the drawable can - * use the dtor call of the GpuDrawHandler to add a fence to the GPU to track when the GPU work - * has completed. - * - * Currently this is only supported for the GPU Vulkan backend. - */ - - class GpuDrawHandler { - public: - virtual ~GpuDrawHandler() {} - - virtual void draw(const GrBackendDrawableInfo&) {} - }; - - /** - * Snaps off a GpuDrawHandler to represent the state of the SkDrawable at the time the snap is - * called. This is used for executing GPU backend specific draws intermixed with normal Skia GPU - * draws. The GPU API, which will be used for the draw, as well as the full matrix, device clip - * bounds and imageInfo of the target buffer are passed in as inputs. - */ - std::unique_ptr snapGpuDrawHandler(GrBackendApi backendApi, - const SkMatrix& matrix, - const SkIRect& clipBounds, - const SkImageInfo& bufferInfo) { - return this->onSnapGpuDrawHandler(backendApi, matrix, clipBounds, bufferInfo); - } - - SkPicture* newPictureSnapshot(); - - /** - * Return a unique value for this instance. If two calls to this return the same value, - * it is presumed that calling the draw() method will render the same thing as well. - * - * Subclasses that change their state should call notifyDrawingChanged() to ensure that - * a new value will be returned the next time it is called. - */ - uint32_t getGenerationID(); - - /** - * Return the (conservative) bounds of what the drawable will draw. If the drawable can - * change what it draws (e.g. animation or in response to some external change), then this - * must return a bounds that is always valid for all possible states. - */ - SkRect getBounds(); - - /** - * Return approximately how many bytes would be freed if this drawable is destroyed. - * The base implementation returns 0 to indicate that this is unknown. - */ - size_t approximateBytesUsed(); - - /** - * Calling this invalidates the previous generation ID, and causes a new one to be computed - * the next time getGenerationID() is called. Typically this is called by the object itself, - * in response to its internal state changing. - */ - void notifyDrawingChanged(); - - static SkFlattenable::Type GetFlattenableType() { - return kSkDrawable_Type; - } - - SkFlattenable::Type getFlattenableType() const override { - return kSkDrawable_Type; - } - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr) { - return sk_sp(static_cast( - SkFlattenable::Deserialize( - kSkDrawable_Type, data, size, procs).release())); - } - - Factory getFactory() const override { return nullptr; } - const char* getTypeName() const override { return nullptr; } - -protected: - SkDrawable(); - - virtual SkRect onGetBounds() = 0; - virtual size_t onApproximateBytesUsed(); - virtual void onDraw(SkCanvas*) = 0; - - virtual std::unique_ptr onSnapGpuDrawHandler(GrBackendApi, const SkMatrix&, - const SkIRect& /*clipBounds*/, - const SkImageInfo&) { - return nullptr; - } - - // TODO: Delete this once Android gets updated to take the clipBounds version above. - virtual std::unique_ptr onSnapGpuDrawHandler(GrBackendApi, const SkMatrix&) { - return nullptr; - } - - /** - * Default implementation calls onDraw() with a canvas that records into a picture. Subclasses - * may override if they have a more efficient way to return a picture for the current state - * of their drawable. Note: this picture must draw the same as what would be drawn from - * onDraw(). - */ - virtual SkPicture* onNewPictureSnapshot(); - -private: - int32_t fGenerationID; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkEncodedImageFormat.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkEncodedImageFormat.h deleted file mode 100644 index 99ca44e765c53c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkEncodedImageFormat.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkEncodedImageFormat_DEFINED -#define SkEncodedImageFormat_DEFINED - -#include - -/** - * Enum describing format of encoded data. - */ -enum class SkEncodedImageFormat { -#ifdef SK_BUILD_FOR_GOOGLE3 - kUnknown, -#endif - kBMP, - kGIF, - kICO, - kJPEG, - kPNG, - kWBMP, - kWEBP, - kPKM, - kKTX, - kASTC, - kDNG, - kHEIF, - kAVIF, - kJPEGXL, -}; - -#endif // SkEncodedImageFormat_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkExecutor.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkExecutor.h deleted file mode 100644 index 88e2ca6e52ec5e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkExecutor.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkExecutor_DEFINED -#define SkExecutor_DEFINED - -#include -#include -#include "include/core/SkTypes.h" - -class SK_API SkExecutor { -public: - virtual ~SkExecutor(); - - // Create a thread pool SkExecutor with a fixed thread count, by default the number of cores. - static std::unique_ptr MakeFIFOThreadPool(int threads = 0, - bool allowBorrowing = true); - static std::unique_ptr MakeLIFOThreadPool(int threads = 0, - bool allowBorrowing = true); - - // There is always a default SkExecutor available by calling SkExecutor::GetDefault(). - static SkExecutor& GetDefault(); - static void SetDefault(SkExecutor*); // Does not take ownership. Not thread safe. - - // Add work to execute. - virtual void add(std::function) = 0; - - // If it makes sense for this executor, use this thread to execute work for a little while. - virtual void borrow() {} - -protected: - SkExecutor() = default; - SkExecutor(const SkExecutor&) = delete; - SkExecutor& operator=(const SkExecutor&) = delete; -}; - -#endif//SkExecutor_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFlattenable.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFlattenable.h deleted file mode 100644 index 916ee174f48283..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFlattenable.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFlattenable_DEFINED -#define SkFlattenable_DEFINED - -#include "include/core/SkRefCnt.h" - -class SkData; -class SkReadBuffer; -class SkWriteBuffer; - -struct SkSerialProcs; -struct SkDeserialProcs; - -/** \class SkFlattenable - - SkFlattenable is the base class for objects that need to be flattened - into a data stream for either transport or as part of the key to the - font cache. - */ -class SK_API SkFlattenable : public SkRefCnt { -public: - enum Type { - kSkColorFilter_Type, - kSkBlender_Type, - kSkDrawable_Type, - kSkDrawLooper_Type, // no longer used internally by Skia - kSkImageFilter_Type, - kSkMaskFilter_Type, - kSkPathEffect_Type, - kSkShader_Type, - }; - - typedef sk_sp (*Factory)(SkReadBuffer&); - - SkFlattenable() {} - - /** Implement this to return a factory function pointer that can be called - to recreate your class given a buffer (previously written to by your - override of flatten(). - */ - virtual Factory getFactory() const = 0; - - /** - * Returns the name of the object's class. - */ - virtual const char* getTypeName() const = 0; - - static Factory NameToFactory(const char name[]); - static const char* FactoryToName(Factory); - - static void Register(const char name[], Factory); - - /** - * Override this if your subclass needs to record data that it will need to recreate itself - * from its CreateProc (returned by getFactory()). - * - * DEPRECATED public : will move to protected ... use serialize() instead - */ - virtual void flatten(SkWriteBuffer&) const {} - - virtual Type getFlattenableType() const = 0; - - // - // public ways to serialize / deserialize - // - sk_sp serialize(const SkSerialProcs* = nullptr) const; - size_t serialize(void* memory, size_t memory_size, - const SkSerialProcs* = nullptr) const; - static sk_sp Deserialize(Type, const void* data, size_t length, - const SkDeserialProcs* procs = nullptr); - -protected: - class PrivateInitializer { - public: - static void InitEffects(); - static void InitImageFilters(); - }; - -private: - static void RegisterFlattenablesIfNeeded(); - static void Finalize(); - - friend class SkGraphics; - - using INHERITED = SkRefCnt; -}; - -#if defined(SK_DISABLE_EFFECT_DESERIALIZATION) - #define SK_REGISTER_FLATTENABLE(type) do{}while(false) - - #define SK_FLATTENABLE_HOOKS(type) \ - static sk_sp CreateProc(SkReadBuffer&); \ - friend class SkFlattenable::PrivateInitializer; \ - Factory getFactory() const override { return nullptr; } \ - const char* getTypeName() const override { return #type; } -#else - #define SK_REGISTER_FLATTENABLE(type) \ - SkFlattenable::Register(#type, type::CreateProc) - - #define SK_FLATTENABLE_HOOKS(type) \ - static sk_sp CreateProc(SkReadBuffer&); \ - friend class SkFlattenable::PrivateInitializer; \ - Factory getFactory() const override { return type::CreateProc; } \ - const char* getTypeName() const override { return #type; } -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFont.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFont.h deleted file mode 100644 index 05fb7db414887c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFont.h +++ /dev/null @@ -1,539 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFont_DEFINED -#define SkFont_DEFINED - -#include "include/core/SkFontTypes.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypeface.h" - -#include - -class SkMatrix; -class SkPaint; -class SkPath; -struct SkFontMetrics; - -/** \class SkFont - SkFont controls options applied when drawing and measuring text. -*/ -class SK_API SkFont { -public: - /** Whether edge pixels draw opaque or with partial transparency. - */ - enum class Edging { - kAlias, //!< no transparent pixels on glyph edges - kAntiAlias, //!< may have transparent pixels on glyph edges - kSubpixelAntiAlias, //!< glyph positioned in pixel using transparency - }; - - /** Constructs SkFont with default values. - - @return default initialized SkFont - */ - SkFont(); - - /** Constructs SkFont with default values with SkTypeface and size in points. - - @param typeface font and style used to draw and measure text - @param size typographic height of text - @return initialized SkFont - */ - SkFont(sk_sp typeface, SkScalar size); - - /** Constructs SkFont with default values with SkTypeface. - - @param typeface font and style used to draw and measure text - @return initialized SkFont - */ - explicit SkFont(sk_sp typeface); - - - /** Constructs SkFont with default values with SkTypeface and size in points, - horizontal scale, and horizontal skew. Horizontal scale emulates condensed - and expanded fonts. Horizontal skew emulates oblique fonts. - - @param typeface font and style used to draw and measure text - @param size typographic height of text - @param scaleX text horizontal scale - @param skewX additional shear on x-axis relative to y-axis - @return initialized SkFont - */ - SkFont(sk_sp typeface, SkScalar size, SkScalar scaleX, SkScalar skewX); - - - /** Compares SkFont and font, and returns true if they are equivalent. - May return false if SkTypeface has identical contents but different pointers. - - @param font font to compare - @return true if SkFont pair are equivalent - */ - bool operator==(const SkFont& font) const; - - /** Compares SkFont and font, and returns true if they are not equivalent. - May return true if SkTypeface has identical contents but different pointers. - - @param font font to compare - @return true if SkFont pair are not equivalent - */ - bool operator!=(const SkFont& font) const { return !(*this == font); } - - /** If true, instructs the font manager to always hint glyphs. - Returned value is only meaningful if platform uses FreeType as the font manager. - - @return true if all glyphs are hinted - */ - bool isForceAutoHinting() const { return SkToBool(fFlags & kForceAutoHinting_PrivFlag); } - - /** Returns true if font engine may return glyphs from font bitmaps instead of from outlines. - - @return true if glyphs may be font bitmaps - */ - bool isEmbeddedBitmaps() const { return SkToBool(fFlags & kEmbeddedBitmaps_PrivFlag); } - - /** Returns true if glyphs may be drawn at sub-pixel offsets. - - @return true if glyphs may be drawn at sub-pixel offsets. - */ - bool isSubpixel() const { return SkToBool(fFlags & kSubpixel_PrivFlag); } - - /** Returns true if font and glyph metrics are requested to be linearly scalable. - - @return true if font and glyph metrics are requested to be linearly scalable. - */ - bool isLinearMetrics() const { return SkToBool(fFlags & kLinearMetrics_PrivFlag); } - - /** Returns true if bold is approximated by increasing the stroke width when creating glyph - bitmaps from outlines. - - @return bold is approximated through stroke width - */ - bool isEmbolden() const { return SkToBool(fFlags & kEmbolden_PrivFlag); } - - /** Returns true if baselines will be snapped to pixel positions when the current transformation - matrix is axis aligned. - - @return baselines may be snapped to pixels - */ - bool isBaselineSnap() const { return SkToBool(fFlags & kBaselineSnap_PrivFlag); } - - /** Sets whether to always hint glyphs. - If forceAutoHinting is set, instructs the font manager to always hint glyphs. - - Only affects platforms that use FreeType as the font manager. - - @param forceAutoHinting setting to always hint glyphs - */ - void setForceAutoHinting(bool forceAutoHinting); - - /** Requests, but does not require, to use bitmaps in fonts instead of outlines. - - @param embeddedBitmaps setting to use bitmaps in fonts - */ - void setEmbeddedBitmaps(bool embeddedBitmaps); - - /** Requests, but does not require, that glyphs respect sub-pixel positioning. - - @param subpixel setting for sub-pixel positioning - */ - void setSubpixel(bool subpixel); - - /** Requests, but does not require, linearly scalable font and glyph metrics. - - For outline fonts 'true' means font and glyph metrics should ignore hinting and rounding. - Note that some bitmap formats may not be able to scale linearly and will ignore this flag. - - @param linearMetrics setting for linearly scalable font and glyph metrics. - */ - void setLinearMetrics(bool linearMetrics); - - /** Increases stroke width when creating glyph bitmaps to approximate a bold typeface. - - @param embolden setting for bold approximation - */ - void setEmbolden(bool embolden); - - /** Requests that baselines be snapped to pixels when the current transformation matrix is axis - aligned. - - @param baselineSnap setting for baseline snapping to pixels - */ - void setBaselineSnap(bool baselineSnap); - - /** Whether edge pixels draw opaque or with partial transparency. - */ - Edging getEdging() const { return (Edging)fEdging; } - - /** Requests, but does not require, that edge pixels draw opaque or with - partial transparency. - */ - void setEdging(Edging edging); - - /** Sets level of glyph outline adjustment. - Does not check for valid values of hintingLevel. - */ - void setHinting(SkFontHinting hintingLevel); - - /** Returns level of glyph outline adjustment. - */ - SkFontHinting getHinting() const { return (SkFontHinting)fHinting; } - - /** Returns a font with the same attributes of this font, but with the specified size. - Returns nullptr if size is less than zero, infinite, or NaN. - - @param size typographic height of text - @return initialized SkFont - */ - SkFont makeWithSize(SkScalar size) const; - - /** Returns SkTypeface if set, or nullptr. - Does not alter SkTypeface SkRefCnt. - - @return SkTypeface if previously set, nullptr otherwise - */ - SkTypeface* getTypeface() const {return fTypeface.get(); } - - /** Returns SkTypeface if set, or the default typeface. - Does not alter SkTypeface SkRefCnt. - - @return SkTypeface if previously set or, a pointer to the default typeface if not - previously set. - */ - SkTypeface* getTypefaceOrDefault() const; - - /** Returns text size in points. - - @return typographic height of text - */ - SkScalar getSize() const { return fSize; } - - /** Returns text scale on x-axis. - Default value is 1. - - @return text horizontal scale - */ - SkScalar getScaleX() const { return fScaleX; } - - /** Returns text skew on x-axis. - Default value is zero. - - @return additional shear on x-axis relative to y-axis - */ - SkScalar getSkewX() const { return fSkewX; } - - /** Increases SkTypeface SkRefCnt by one. - - @return SkTypeface if previously set, nullptr otherwise - */ - sk_sp refTypeface() const { return fTypeface; } - - /** Increases SkTypeface SkRefCnt by one. - - @return SkTypeface if previously set or, a pointer to the default typeface if not - previously set. - */ - sk_sp refTypefaceOrDefault() const; - - /** Sets SkTypeface to typeface, decreasing SkRefCnt of the previous SkTypeface. - Pass nullptr to clear SkTypeface and use the default typeface. Increments - tf SkRefCnt by one. - - @param tf font and style used to draw text - */ - void setTypeface(sk_sp tf) { fTypeface = tf; } - - /** Sets text size in points. - Has no effect if textSize is not greater than or equal to zero. - - @param textSize typographic height of text - */ - void setSize(SkScalar textSize); - - /** Sets text scale on x-axis. - Default value is 1. - - @param scaleX text horizontal scale - */ - void setScaleX(SkScalar scaleX); - - /** Sets text skew on x-axis. - Default value is zero. - - @param skewX additional shear on x-axis relative to y-axis - */ - void setSkewX(SkScalar skewX); - - /** Converts text into glyph indices. - Returns the number of glyph indices represented by text. - SkTextEncoding specifies how text represents characters or glyphs. - glyphs may be nullptr, to compute the glyph count. - - Does not check text for valid character codes or valid glyph indices. - - If byteLength equals zero, returns zero. - If byteLength includes a partial character, the partial character is ignored. - - If encoding is SkTextEncoding::kUTF8 and text contains an invalid UTF-8 sequence, - zero is returned. - - When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or - SkTextEncoding::kUTF32; then each Unicode codepoint is mapped to a - single glyph. This function uses the default character-to-glyph - mapping from the SkTypeface and maps characters not found in the - SkTypeface to zero. - - If maxGlyphCount is not sufficient to store all the glyphs, no glyphs are copied. - The total glyph count is returned for subsequent buffer reallocation. - - @param text character storage encoded with SkTextEncoding - @param byteLength length of character storage in bytes - @param glyphs storage for glyph indices; may be nullptr - @param maxGlyphCount storage capacity - @return number of glyphs represented by text of length byteLength - */ - int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding encoding, - SkGlyphID glyphs[], int maxGlyphCount) const; - - /** Returns glyph index for Unicode character. - - If the character is not supported by the SkTypeface, returns 0. - - @param uni Unicode character - @return glyph index - */ - SkGlyphID unicharToGlyph(SkUnichar uni) const; - - void unicharsToGlyphs(const SkUnichar uni[], int count, SkGlyphID glyphs[]) const; - - /** Returns number of glyphs represented by text. - - If encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or - SkTextEncoding::kUTF32; then each Unicode codepoint is mapped to a - single glyph. - - @param text character storage encoded with SkTextEncoding - @param byteLength length of character storage in bytes - @return number of glyphs represented by text of length byteLength - */ - int countText(const void* text, size_t byteLength, SkTextEncoding encoding) const { - return this->textToGlyphs(text, byteLength, encoding, nullptr, 0); - } - - /** Returns the advance width of text. - The advance is the normal distance to move before drawing additional text. - Returns the bounding box of text if bounds is not nullptr. - - @param text character storage encoded with SkTextEncoding - @param byteLength length of character storage in bytes - @param bounds returns bounding box relative to (0, 0) if not nullptr - @return the sum of the default advance widths - */ - SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding encoding, - SkRect* bounds = nullptr) const { - return this->measureText(text, byteLength, encoding, bounds, nullptr); - } - - /** Returns the advance width of text. - The advance is the normal distance to move before drawing additional text. - Returns the bounding box of text if bounds is not nullptr. The paint - stroke settings, mask filter, or path effect may modify the bounds. - - @param text character storage encoded with SkTextEncoding - @param byteLength length of character storage in bytes - @param bounds returns bounding box relative to (0, 0) if not nullptr - @param paint optional; may be nullptr - @return the sum of the default advance widths - */ - SkScalar measureText(const void* text, size_t byteLength, SkTextEncoding encoding, - SkRect* bounds, const SkPaint* paint) const; - - /** DEPRECATED - Retrieves the advance and bounds for each glyph in glyphs. - Both widths and bounds may be nullptr. - If widths is not nullptr, widths must be an array of count entries. - if bounds is not nullptr, bounds must be an array of count entries. - - @param glyphs array of glyph indices to be measured - @param count number of glyphs - @param widths returns text advances for each glyph; may be nullptr - @param bounds returns bounds for each glyph relative to (0, 0); may be nullptr - */ - void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[]) const { - this->getWidthsBounds(glyphs, count, widths, bounds, nullptr); - } - - // DEPRECATED - void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[], std::nullptr_t) const { - this->getWidths(glyphs, count, widths); - } - - /** Retrieves the advance and bounds for each glyph in glyphs. - Both widths and bounds may be nullptr. - If widths is not nullptr, widths must be an array of count entries. - if bounds is not nullptr, bounds must be an array of count entries. - - @param glyphs array of glyph indices to be measured - @param count number of glyphs - @param widths returns text advances for each glyph - */ - void getWidths(const SkGlyphID glyphs[], int count, SkScalar widths[]) const { - this->getWidthsBounds(glyphs, count, widths, nullptr, nullptr); - } - - /** Retrieves the advance and bounds for each glyph in glyphs. - Both widths and bounds may be nullptr. - If widths is not nullptr, widths must be an array of count entries. - if bounds is not nullptr, bounds must be an array of count entries. - - @param glyphs array of glyph indices to be measured - @param count number of glyphs - @param widths returns text advances for each glyph; may be nullptr - @param bounds returns bounds for each glyph relative to (0, 0); may be nullptr - @param paint optional, specifies stroking, SkPathEffect and SkMaskFilter - */ - void getWidthsBounds(const SkGlyphID glyphs[], int count, SkScalar widths[], SkRect bounds[], - const SkPaint* paint) const; - - - /** Retrieves the bounds for each glyph in glyphs. - bounds must be an array of count entries. - If paint is not nullptr, its stroking, SkPathEffect, and SkMaskFilter fields are respected. - - @param glyphs array of glyph indices to be measured - @param count number of glyphs - @param bounds returns bounds for each glyph relative to (0, 0); may be nullptr - @param paint optional, specifies stroking, SkPathEffect, and SkMaskFilter - */ - void getBounds(const SkGlyphID glyphs[], int count, SkRect bounds[], - const SkPaint* paint) const { - this->getWidthsBounds(glyphs, count, nullptr, bounds, paint); - } - - /** Retrieves the positions for each glyph, beginning at the specified origin. The caller - must allocated at least count number of elements in the pos[] array. - - @param glyphs array of glyph indices to be positioned - @param count number of glyphs - @param pos returns glyphs positions - @param origin location of the first glyph. Defaults to {0, 0}. - */ - void getPos(const SkGlyphID glyphs[], int count, SkPoint pos[], SkPoint origin = {0, 0}) const; - - /** Retrieves the x-positions for each glyph, beginning at the specified origin. The caller - must allocated at least count number of elements in the xpos[] array. - - @param glyphs array of glyph indices to be positioned - @param count number of glyphs - @param xpos returns glyphs x-positions - @param origin x-position of the first glyph. Defaults to 0. - */ - void getXPos(const SkGlyphID glyphs[], int count, SkScalar xpos[], SkScalar origin = 0) const; - - /** Returns intervals [start, end] describing lines parallel to the advance that intersect - * with the glyphs. - * - * @param glyphs the glyphs to intersect - * @param count the number of glyphs and positions - * @param pos the position of each glyph - * @param top the top of the line intersecting - * @param bottom the bottom of the line intersecting - @return array of pairs of x values [start, end]. May be empty. - */ - std::vector getIntercepts(const SkGlyphID glyphs[], int count, const SkPoint pos[], - SkScalar top, SkScalar bottom, - const SkPaint* = nullptr) const; - - /** Modifies path to be the outline of the glyph. - If the glyph has an outline, modifies path to be the glyph's outline and returns true. - The glyph outline may be empty. Degenerate contours in the glyph outline will be skipped. - If glyph is described by a bitmap, returns false and ignores path parameter. - - @param glyphID index of glyph - @param path pointer to existing SkPath - @return true if glyphID is described by path - */ - bool getPath(SkGlyphID glyphID, SkPath* path) const; - - /** Returns path corresponding to glyph array. - - @param glyphIDs array of glyph indices - @param count number of glyphs - @param glyphPathProc function returning one glyph description as path - @param ctx function context - */ - void getPaths(const SkGlyphID glyphIDs[], int count, - void (*glyphPathProc)(const SkPath* pathOrNull, const SkMatrix& mx, void* ctx), - void* ctx) const; - - /** Returns SkFontMetrics associated with SkTypeface. - The return value is the recommended spacing between lines: the sum of metrics - descent, ascent, and leading. - If metrics is not nullptr, SkFontMetrics is copied to metrics. - Results are scaled by text size but does not take into account - dimensions required by text scale, text skew, fake bold, - style stroke, and SkPathEffect. - - @param metrics storage for SkFontMetrics; may be nullptr - @return recommended spacing between lines - */ - SkScalar getMetrics(SkFontMetrics* metrics) const; - - /** Returns the recommended spacing between lines: the sum of metrics - descent, ascent, and leading. - Result is scaled by text size but does not take into account - dimensions required by stroking and SkPathEffect. - Returns the same result as getMetrics(). - - @return recommended spacing between lines - */ - SkScalar getSpacing() const { return this->getMetrics(nullptr); } - - /** Dumps fields of the font to SkDebugf. May change its output over time, so clients should - * not rely on this for anything specific. Used to aid in debugging. - */ - void dump() const; - - using sk_is_trivially_relocatable = std::true_type; - -private: - enum PrivFlags { - kForceAutoHinting_PrivFlag = 1 << 0, - kEmbeddedBitmaps_PrivFlag = 1 << 1, - kSubpixel_PrivFlag = 1 << 2, - kLinearMetrics_PrivFlag = 1 << 3, - kEmbolden_PrivFlag = 1 << 4, - kBaselineSnap_PrivFlag = 1 << 5, - }; - - static constexpr unsigned kAllFlags = kForceAutoHinting_PrivFlag - | kEmbeddedBitmaps_PrivFlag - | kSubpixel_PrivFlag - | kLinearMetrics_PrivFlag - | kEmbolden_PrivFlag - | kBaselineSnap_PrivFlag; - - sk_sp fTypeface; - SkScalar fSize; - SkScalar fScaleX; - SkScalar fSkewX; - uint8_t fFlags; - uint8_t fEdging; - uint8_t fHinting; - - static_assert(::sk_is_trivially_relocatable::value); - - SkScalar setupForAsPaths(SkPaint*); - bool hasSomeAntiAliasing() const; - - friend class SkFontPriv; - friend class SkGlyphRunListPainterCPU; - friend class SkStrikeSpec; - friend class SkRemoteGlyphCacheTest; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontArguments.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontArguments.h deleted file mode 100644 index a5139bb21bde68..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontArguments.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontArguments_DEFINED -#define SkFontArguments_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -/** Represents a set of actual arguments for a font. */ -struct SkFontArguments { - struct VariationPosition { - struct Coordinate { - SkFourByteTag axis; - float value; - }; - const Coordinate* coordinates; - int coordinateCount; - }; - - /** Specify a palette to use and overrides for palette entries. - * - * `overrides` is a list of pairs of palette entry index and color. - * The overriden palette entries will use the associated color. - * Override pairs with palette entry indices out of range will not be applied. - * Later override entries override earlier ones. - */ - struct Palette { - struct Override { - int index; - SkColor color; - }; - int index; - const Override* overrides; - int overrideCount; - }; - - SkFontArguments() - : fCollectionIndex(0) - , fVariationDesignPosition{nullptr, 0} - , fPalette{0, nullptr, 0} {} - - /** Specify the index of the desired font. - * - * Font formats like ttc, dfont, cff, cid, pfr, t42, t1, and fon may actually be indexed - * collections of fonts. - */ - SkFontArguments& setCollectionIndex(int collectionIndex) { - fCollectionIndex = collectionIndex; - return *this; - } - - /** Specify a position in the variation design space. - * - * Any axis not specified will use the default value. - * Any specified axis not actually present in the font will be ignored. - * - * @param position not copied. The value must remain valid for life of SkFontArguments. - */ - SkFontArguments& setVariationDesignPosition(VariationPosition position) { - fVariationDesignPosition.coordinates = position.coordinates; - fVariationDesignPosition.coordinateCount = position.coordinateCount; - return *this; - } - - int getCollectionIndex() const { - return fCollectionIndex; - } - - VariationPosition getVariationDesignPosition() const { - return fVariationDesignPosition; - } - - SkFontArguments& setPalette(Palette palette) { - fPalette.index = palette.index; - fPalette.overrides = palette.overrides; - fPalette.overrideCount = palette.overrideCount; - return *this; - } - - Palette getPalette() const { return fPalette; } - -private: - int fCollectionIndex; - VariationPosition fVariationDesignPosition; - Palette fPalette; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMetrics.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMetrics.h deleted file mode 100644 index 717a87f056f38c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMetrics.h +++ /dev/null @@ -1,138 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMetrics_DEFINED -#define SkFontMetrics_DEFINED - -#include "include/core/SkScalar.h" - -/** \class SkFontMetrics - The metrics of an SkFont. - The metric values are consistent with the Skia y-down coordinate system. - */ -struct SK_API SkFontMetrics { - bool operator==(const SkFontMetrics& that) { - return - this->fFlags == that.fFlags && - this->fTop == that.fTop && - this->fAscent == that.fAscent && - this->fDescent == that.fDescent && - this->fBottom == that.fBottom && - this->fLeading == that.fLeading && - this->fAvgCharWidth == that.fAvgCharWidth && - this->fMaxCharWidth == that.fMaxCharWidth && - this->fXMin == that.fXMin && - this->fXMax == that.fXMax && - this->fXHeight == that.fXHeight && - this->fCapHeight == that.fCapHeight && - this->fUnderlineThickness == that.fUnderlineThickness && - this->fUnderlinePosition == that.fUnderlinePosition && - this->fStrikeoutThickness == that.fStrikeoutThickness && - this->fStrikeoutPosition == that.fStrikeoutPosition; - } - - /** \enum FontMetricsFlags - FontMetricsFlags indicate when certain metrics are valid; - the underline or strikeout metrics may be valid and zero. - Fonts with embedded bitmaps may not have valid underline or strikeout metrics. - */ - enum FontMetricsFlags { - kUnderlineThicknessIsValid_Flag = 1 << 0, //!< set if fUnderlineThickness is valid - kUnderlinePositionIsValid_Flag = 1 << 1, //!< set if fUnderlinePosition is valid - kStrikeoutThicknessIsValid_Flag = 1 << 2, //!< set if fStrikeoutThickness is valid - kStrikeoutPositionIsValid_Flag = 1 << 3, //!< set if fStrikeoutPosition is valid - kBoundsInvalid_Flag = 1 << 4, //!< set if fTop, fBottom, fXMin, fXMax invalid - }; - - uint32_t fFlags; //!< FontMetricsFlags indicating which metrics are valid - SkScalar fTop; //!< greatest extent above origin of any glyph bounding box, typically negative; deprecated with variable fonts - SkScalar fAscent; //!< distance to reserve above baseline, typically negative - SkScalar fDescent; //!< distance to reserve below baseline, typically positive - SkScalar fBottom; //!< greatest extent below origin of any glyph bounding box, typically positive; deprecated with variable fonts - SkScalar fLeading; //!< distance to add between lines, typically positive or zero - SkScalar fAvgCharWidth; //!< average character width, zero if unknown - SkScalar fMaxCharWidth; //!< maximum character width, zero if unknown - SkScalar fXMin; //!< greatest extent to left of origin of any glyph bounding box, typically negative; deprecated with variable fonts - SkScalar fXMax; //!< greatest extent to right of origin of any glyph bounding box, typically positive; deprecated with variable fonts - SkScalar fXHeight; //!< height of lower-case 'x', zero if unknown, typically negative - SkScalar fCapHeight; //!< height of an upper-case letter, zero if unknown, typically negative - SkScalar fUnderlineThickness; //!< underline thickness - SkScalar fUnderlinePosition; //!< distance from baseline to top of stroke, typically positive - SkScalar fStrikeoutThickness; //!< strikeout thickness - SkScalar fStrikeoutPosition; //!< distance from baseline to bottom of stroke, typically negative - - /** Returns true if SkFontMetrics has a valid underline thickness, and sets - thickness to that value. If the underline thickness is not valid, - return false, and ignore thickness. - - @param thickness storage for underline width - @return true if font specifies underline width - */ - bool hasUnderlineThickness(SkScalar* thickness) const { - if (SkToBool(fFlags & kUnderlineThicknessIsValid_Flag)) { - *thickness = fUnderlineThickness; - return true; - } - return false; - } - - /** Returns true if SkFontMetrics has a valid underline position, and sets - position to that value. If the underline position is not valid, - return false, and ignore position. - - @param position storage for underline position - @return true if font specifies underline position - */ - bool hasUnderlinePosition(SkScalar* position) const { - if (SkToBool(fFlags & kUnderlinePositionIsValid_Flag)) { - *position = fUnderlinePosition; - return true; - } - return false; - } - - /** Returns true if SkFontMetrics has a valid strikeout thickness, and sets - thickness to that value. If the underline thickness is not valid, - return false, and ignore thickness. - - @param thickness storage for strikeout width - @return true if font specifies strikeout width - */ - bool hasStrikeoutThickness(SkScalar* thickness) const { - if (SkToBool(fFlags & kStrikeoutThicknessIsValid_Flag)) { - *thickness = fStrikeoutThickness; - return true; - } - return false; - } - - /** Returns true if SkFontMetrics has a valid strikeout position, and sets - position to that value. If the underline position is not valid, - return false, and ignore position. - - @param position storage for strikeout position - @return true if font specifies strikeout position - */ - bool hasStrikeoutPosition(SkScalar* position) const { - if (SkToBool(fFlags & kStrikeoutPositionIsValid_Flag)) { - *position = fStrikeoutPosition; - return true; - } - return false; - } - - /** Returns true if SkFontMetrics has a valid fTop, fBottom, fXMin, and fXMax. - If the bounds are not valid, return false. - - @return true if font specifies maximum glyph bounds - */ - bool hasBounds() const { - return !SkToBool(fFlags & kBoundsInvalid_Flag); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMgr.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMgr.h deleted file mode 100644 index 125262b4667535..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontMgr.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_DEFINED -#define SkFontMgr_DEFINED - -#include "include/core/SkFontArguments.h" -#include "include/core/SkFontStyle.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkData; -class SkFontData; -class SkStreamAsset; -class SkString; -class SkTypeface; - -class SK_API SkFontStyleSet : public SkRefCnt { -public: - virtual int count() = 0; - virtual void getStyle(int index, SkFontStyle*, SkString* style) = 0; - virtual SkTypeface* createTypeface(int index) = 0; - virtual SkTypeface* matchStyle(const SkFontStyle& pattern) = 0; - - static SkFontStyleSet* CreateEmpty(); - -protected: - SkTypeface* matchStyleCSS3(const SkFontStyle& pattern); - -private: - using INHERITED = SkRefCnt; -}; - -class SK_API SkFontMgr : public SkRefCnt { -public: - int countFamilies() const; - void getFamilyName(int index, SkString* familyName) const; - SkFontStyleSet* createStyleSet(int index) const; - - /** - * The caller must call unref() on the returned object. - * Never returns NULL; will return an empty set if the name is not found. - * - * Passing nullptr as the parameter will return the default system family. - * Note that most systems don't have a default system family, so passing nullptr will often - * result in the empty set. - * - * It is possible that this will return a style set not accessible from - * createStyleSet(int) due to hidden or auto-activated fonts. - */ - SkFontStyleSet* matchFamily(const char familyName[]) const; - - /** - * Find the closest matching typeface to the specified familyName and style - * and return a ref to it. The caller must call unref() on the returned - * object. Will return nullptr if no 'good' match is found. - * - * Passing |nullptr| as the parameter for |familyName| will return the - * default system font. - * - * It is possible that this will return a style set not accessible from - * createStyleSet(int) or matchFamily(const char[]) due to hidden or - * auto-activated fonts. - */ - SkTypeface* matchFamilyStyle(const char familyName[], const SkFontStyle&) const; - - /** - * Use the system fallback to find a typeface for the given character. - * Note that bcp47 is a combination of ISO 639, 15924, and 3166-1 codes, - * so it is fine to just pass a ISO 639 here. - * - * Will return NULL if no family can be found for the character - * in the system fallback. - * - * Passing |nullptr| as the parameter for |familyName| will return the - * default system font. - * - * bcp47[0] is the least significant fallback, bcp47[bcp47Count-1] is the - * most significant. If no specified bcp47 codes match, any font with the - * requested character will be matched. - */ - SkTypeface* matchFamilyStyleCharacter(const char familyName[], const SkFontStyle&, - const char* bcp47[], int bcp47Count, - SkUnichar character) const; - - /** - * Create a typeface for the specified data and TTC index (pass 0 for none) - * or NULL if the data is not recognized. The caller must call unref() on - * the returned object if it is not null. - */ - sk_sp makeFromData(sk_sp, int ttcIndex = 0) const; - - /** - * Create a typeface for the specified stream and TTC index - * (pass 0 for none) or NULL if the stream is not recognized. The caller - * must call unref() on the returned object if it is not null. - */ - sk_sp makeFromStream(std::unique_ptr, int ttcIndex = 0) const; - - /* Experimental, API subject to change. */ - sk_sp makeFromStream(std::unique_ptr, const SkFontArguments&) const; - - /** - * Create a typeface for the specified fileName and TTC index - * (pass 0 for none) or NULL if the file is not found, or its contents are - * not recognized. The caller must call unref() on the returned object - * if it is not null. - */ - sk_sp makeFromFile(const char path[], int ttcIndex = 0) const; - - sk_sp legacyMakeTypeface(const char familyName[], SkFontStyle style) const; - - /** Return the default fontmgr. */ - static sk_sp RefDefault(); - - /* Returns an empty font manager without any typeface dependencies */ - static sk_sp RefEmpty(); - -protected: - virtual int onCountFamilies() const = 0; - virtual void onGetFamilyName(int index, SkString* familyName) const = 0; - virtual SkFontStyleSet* onCreateStyleSet(int index)const = 0; - - /** May return NULL if the name is not found. */ - virtual SkFontStyleSet* onMatchFamily(const char familyName[]) const = 0; - - virtual SkTypeface* onMatchFamilyStyle(const char familyName[], - const SkFontStyle&) const = 0; - virtual SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&, - const char* bcp47[], int bcp47Count, - SkUnichar character) const = 0; - - virtual sk_sp onMakeFromData(sk_sp, int ttcIndex) const = 0; - virtual sk_sp onMakeFromStreamIndex(std::unique_ptr, - int ttcIndex) const = 0; - virtual sk_sp onMakeFromStreamArgs(std::unique_ptr, - const SkFontArguments&) const = 0; - virtual sk_sp onMakeFromFile(const char path[], int ttcIndex) const = 0; - - virtual sk_sp onLegacyMakeTypeface(const char familyName[], SkFontStyle) const = 0; - - // this method is never called -- will be removed - virtual SkTypeface* onMatchFaceStyle(const SkTypeface*, - const SkFontStyle&) const { - return nullptr; - } - -private: - - /** Implemented by porting layer to return the default factory. */ - static sk_sp Factory(); - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontParameters.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontParameters.h deleted file mode 100644 index ae4f1d68b6c87a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontParameters.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontParameters_DEFINED -#define SkFontParameters_DEFINED - -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -struct SkFontParameters { - struct Variation { - // Parameters in a variation font axis. - struct Axis { - constexpr Axis() : tag(0), min(0), def(0), max(0), flags(0) {} - constexpr Axis(SkFourByteTag tag, float min, float def, float max, bool hidden) : - tag(tag), min(min), def(def), max(max), flags(hidden ? HIDDEN : 0) {} - - // Four character identifier of the font axis (weight, width, slant, italic...). - SkFourByteTag tag; - // Minimum value supported by this axis. - float min; - // Default value set by this axis. - float def; - // Maximum value supported by this axis. The maximum can equal the minimum. - float max; - // Return whether this axis is recommended to be remain hidden in user interfaces. - bool isHidden() const { return flags & HIDDEN; } - // Set this axis to be remain hidden in user interfaces. - void setHidden(bool hidden) { flags = hidden ? (flags | HIDDEN) : (flags & ~HIDDEN); } - private: - static constexpr uint16_t HIDDEN = 0x0001; - // Attributes for a font axis. - uint16_t flags; - }; - }; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontStyle.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontStyle.h deleted file mode 100644 index 04893ef2fdc591..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontStyle.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontStyle_DEFINED -#define SkFontStyle_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkTPin.h" - -class SK_API SkFontStyle { -public: - enum Weight { - kInvisible_Weight = 0, - kThin_Weight = 100, - kExtraLight_Weight = 200, - kLight_Weight = 300, - kNormal_Weight = 400, - kMedium_Weight = 500, - kSemiBold_Weight = 600, - kBold_Weight = 700, - kExtraBold_Weight = 800, - kBlack_Weight = 900, - kExtraBlack_Weight = 1000, - }; - - enum Width { - kUltraCondensed_Width = 1, - kExtraCondensed_Width = 2, - kCondensed_Width = 3, - kSemiCondensed_Width = 4, - kNormal_Width = 5, - kSemiExpanded_Width = 6, - kExpanded_Width = 7, - kExtraExpanded_Width = 8, - kUltraExpanded_Width = 9, - }; - - enum Slant { - kUpright_Slant, - kItalic_Slant, - kOblique_Slant, - }; - - constexpr SkFontStyle(int weight, int width, Slant slant) : fValue( - (SkTPin(weight, kInvisible_Weight, kExtraBlack_Weight)) + - (SkTPin(width, kUltraCondensed_Width, kUltraExpanded_Width) << 16) + - (SkTPin(slant, kUpright_Slant, kOblique_Slant) << 24) - ) { } - - constexpr SkFontStyle() : SkFontStyle{kNormal_Weight, kNormal_Width, kUpright_Slant} { } - - bool operator==(const SkFontStyle& rhs) const { - return fValue == rhs.fValue; - } - - int weight() const { return fValue & 0xFFFF; } - int width() const { return (fValue >> 16) & 0xFF; } - Slant slant() const { return (Slant)((fValue >> 24) & 0xFF); } - - static constexpr SkFontStyle Normal() { - return SkFontStyle(kNormal_Weight, kNormal_Width, kUpright_Slant); - } - static constexpr SkFontStyle Bold() { - return SkFontStyle(kBold_Weight, kNormal_Width, kUpright_Slant); - } - static constexpr SkFontStyle Italic() { - return SkFontStyle(kNormal_Weight, kNormal_Width, kItalic_Slant ); - } - static constexpr SkFontStyle BoldItalic() { - return SkFontStyle(kBold_Weight, kNormal_Width, kItalic_Slant ); - } - -private: - int32_t fValue; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontTypes.h deleted file mode 100644 index 76f5dde67fe838..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkFontTypes.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontTypes_DEFINED -#define SkFontTypes_DEFINED - -enum class SkTextEncoding { - kUTF8, //!< uses bytes to represent UTF-8 or ASCII - kUTF16, //!< uses two byte words to represent most of Unicode - kUTF32, //!< uses four byte words to represent all of Unicode - kGlyphID, //!< uses two byte words to represent glyph indices -}; - -enum class SkFontHinting { - kNone, //!< glyph outlines unchanged - kSlight, //!< minimal modification to improve constrast - kNormal, //!< glyph outlines modified to improve constrast - kFull, //!< modifies glyph outlines for maximum constrast -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkGraphics.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkGraphics.h deleted file mode 100644 index c24bb742e71df7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkGraphics.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkGraphics_DEFINED -#define SkGraphics_DEFINED - -#include "include/core/SkRefCnt.h" - -class SkData; -class SkImageGenerator; -class SkOpenTypeSVGDecoder; -class SkTraceMemoryDump; - -class SK_API SkGraphics { -public: - /** - * Call this at process initialization time if your environment does not - * permit static global initializers that execute code. - * Init() is thread-safe and idempotent. - */ - static void Init(); - - /** - * Return the max number of bytes that should be used by the font cache. - * If the cache needs to allocate more, it will purge previous entries. - * This max can be changed by calling SetFontCacheLimit(). - */ - static size_t GetFontCacheLimit(); - - /** - * Specify the max number of bytes that should be used by the font cache. - * If the cache needs to allocate more, it will purge previous entries. - * - * This function returns the previous setting, as if GetFontCacheLimit() - * had be called before the new limit was set. - */ - static size_t SetFontCacheLimit(size_t bytes); - - /** - * Return the number of bytes currently used by the font cache. - */ - static size_t GetFontCacheUsed(); - - /** - * Return the number of entries in the font cache. - * A cache "entry" is associated with each typeface + pointSize + matrix. - */ - static int GetFontCacheCountUsed(); - - /** - * Return the current limit to the number of entries in the font cache. - * A cache "entry" is associated with each typeface + pointSize + matrix. - */ - static int GetFontCacheCountLimit(); - - /** - * Set the limit to the number of entries in the font cache, and return - * the previous value. If this new value is lower than the previous, - * it will automatically try to purge entries to meet the new limit. - */ - static int SetFontCacheCountLimit(int count); - - /** - * For debugging purposes, this will attempt to purge the font cache. It - * does not change the limit, but will cause subsequent font measures and - * draws to be recreated, since they will no longer be in the cache. - */ - static void PurgeFontCache(); - - /** - * This function returns the memory used for temporary images and other resources. - */ - static size_t GetResourceCacheTotalBytesUsed(); - - /** - * These functions get/set the memory usage limit for the resource cache, used for temporary - * bitmaps and other resources. Entries are purged from the cache when the memory useage - * exceeds this limit. - */ - static size_t GetResourceCacheTotalByteLimit(); - static size_t SetResourceCacheTotalByteLimit(size_t newLimit); - - /** - * For debugging purposes, this will attempt to purge the resource cache. It - * does not change the limit. - */ - static void PurgeResourceCache(); - - /** - * When the cachable entry is very lage (e.g. a large scaled bitmap), adding it to the cache - * can cause most/all of the existing entries to be purged. To avoid the, the client can set - * a limit for a single allocation. If a cacheable entry would have been cached, but its size - * exceeds this limit, then we do not attempt to cache it at all. - * - * Zero is the default value, meaning we always attempt to cache entries. - */ - static size_t GetResourceCacheSingleAllocationByteLimit(); - static size_t SetResourceCacheSingleAllocationByteLimit(size_t newLimit); - - /** - * Dumps memory usage of caches using the SkTraceMemoryDump interface. See SkTraceMemoryDump - * for usage of this method. - */ - static void DumpMemoryStatistics(SkTraceMemoryDump* dump); - - /** - * Free as much globally cached memory as possible. This will purge all private caches in Skia, - * including font and image caches. - * - * If there are caches associated with GPU context, those will not be affected by this call. - */ - static void PurgeAllCaches(); - - /** - * Applications with command line options may pass optional state, such - * as cache sizes, here, for instance: - * font-cache-limit=12345678 - * - * The flags format is name=value[;name=value...] with no spaces. - * This format is subject to change. - */ - static void SetFlags(const char* flags); - - typedef std::unique_ptr - (*ImageGeneratorFromEncodedDataFactory)(sk_sp); - - /** - * To instantiate images from encoded data, first looks at this runtime function-ptr. If it - * exists, it is called to create an SkImageGenerator from SkData. If there is no function-ptr - * or there is, but it returns NULL, then skia will call its internal default implementation. - * - * Returns the previous factory (which could be NULL). - */ - static ImageGeneratorFromEncodedDataFactory - SetImageGeneratorFromEncodedDataFactory(ImageGeneratorFromEncodedDataFactory); - - /** - * To draw OpenType SVG data, Skia will look at this runtime function pointer. If this function - * pointer is set, the SkTypeface implementations which support OpenType SVG will call this - * function to create an SkOpenTypeSVGDecoder to decode the OpenType SVG and draw it as needed. - * If this function is not set, the SkTypeface implementations will generally not support - * OpenType SVG and attempt to use other glyph representations if available. - */ - using OpenTypeSVGDecoderFactory = - std::unique_ptr (*)(const uint8_t* svg, size_t length); - static OpenTypeSVGDecoderFactory SetOpenTypeSVGDecoderFactory(OpenTypeSVGDecoderFactory); - static OpenTypeSVGDecoderFactory GetOpenTypeSVGDecoderFactory(); - - /** - * Temporarily (until variable COLRv1 is released) pass a feature switch function for whether - * variable COLRv1 is enabled. Needed for initializing FreeType with a property setting so that - * variable COLRv1 can be enabled in Chrome Canaries during development. - */ - using VariableColrV1EnabledFunc = bool (*)(); - static VariableColrV1EnabledFunc SetVariableColrV1EnabledFunc(VariableColrV1EnabledFunc); - static bool GetVariableColrV1Enabled(); - - /** - * Call early in main() to allow Skia to use a JIT to accelerate CPU-bound operations. - */ - static void AllowJIT(); -}; - -class SkAutoGraphics { -public: - SkAutoGraphics() { - SkGraphics::Init(); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkICC.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkICC.h deleted file mode 100644 index cb84c1ffbc76d6..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkICC.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkICC_DEFINED -#define SkICC_DEFINED - -#include "include/core/SkData.h" - -struct skcms_Matrix3x3; -struct skcms_TransferFunction; - -SK_API sk_sp SkWriteICCProfile(const skcms_TransferFunction&, - const skcms_Matrix3x3& toXYZD50); - -#endif//SkICC_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImage.h deleted file mode 100644 index 4157eafa0b509a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImage.h +++ /dev/null @@ -1,1407 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImage_DEFINED -#define SkImage_DEFINED - -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkScalar.h" -#include "include/core/SkShader.h" -#include "include/core/SkSurfaceProps.h" -#include "include/core/SkTileMode.h" -#if SK_SUPPORT_GPU -#include "include/gpu/GrTypes.h" -#endif -#if defined(SK_GRAPHITE_ENABLED) -#include "include/gpu/graphite/GraphiteTypes.h" -#endif -#include // std::function -#include - -#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 -#include -#endif - -class GrBackendFormat; -class GrBackendTexture; -class GrContextThreadSafeProxy; -class GrDirectContext; -class GrRecordingContext; -class GrYUVABackendTextureInfo; -class GrYUVABackendTextures; -class SkCanvas; -class SkData; -class SkImage; -class SkImageFilter; -class SkImageGenerator; -class SkMipmap; -class SkPaint; -class SkPicture; -class SkPixmap; -class SkPromiseImageTexture; -class SkSurface; -class SkYUVAPixmaps; - -enum class SkEncodedImageFormat; - -#if defined(SK_GRAPHITE_ENABLED) -namespace skgpu::graphite { -class BackendTexture; -class Recorder; -}; -#endif - -/** \class SkImage - SkImage describes a two dimensional array of pixels to draw. The pixels may be - decoded in a raster bitmap, encoded in a SkPicture or compressed data stream, - or located in GPU memory as a GPU texture. - - SkImage cannot be modified after it is created. SkImage may allocate additional - storage as needed; for instance, an encoded SkImage may decode when drawn. - - SkImage width and height are greater than zero. Creating an SkImage with zero width - or height returns SkImage equal to nullptr. - - SkImage may be created from SkBitmap, SkPixmap, SkSurface, SkPicture, encoded streams, - GPU texture, YUV_ColorSpace data, or hardware buffer. Encoded streams supported - include BMP, GIF, HEIF, ICO, JPEG, PNG, WBMP, WebP. Supported encoding details - vary with platform. -*/ -class SK_API SkImage : public SkRefCnt { -public: - - /** Caller data passed to RasterReleaseProc; may be nullptr. - */ - typedef void* ReleaseContext; - - /** Creates SkImage from SkPixmap and copy of pixels. Since pixels are copied, SkPixmap - pixels may be modified or deleted without affecting SkImage. - - SkImage is returned if SkPixmap is valid. Valid SkPixmap parameters include: - dimensions are greater than zero; - each dimension fits in 29 bits; - SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; - row bytes are large enough to hold one row of pixels; - pixel address is not nullptr. - - @param pixmap SkImageInfo, pixel address, and row bytes - @return copy of SkPixmap pixels, or nullptr - - example: https://fiddle.skia.org/c/@Image_MakeRasterCopy - */ - static sk_sp MakeRasterCopy(const SkPixmap& pixmap); - - /** Creates SkImage from SkImageInfo, sharing pixels. - - SkImage is returned if SkImageInfo is valid. Valid SkImageInfo parameters include: - dimensions are greater than zero; - each dimension fits in 29 bits; - SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; - rowBytes are large enough to hold one row of pixels; - pixels is not nullptr, and contains enough data for SkImage. - - @param info contains width, height, SkAlphaType, SkColorType, SkColorSpace - @param pixels address or pixel storage - @param rowBytes size of pixel row or larger - @return SkImage sharing pixels, or nullptr - */ - static sk_sp MakeRasterData(const SkImageInfo& info, sk_sp pixels, - size_t rowBytes); - - /** Function called when SkImage no longer shares pixels. ReleaseContext is - provided by caller when SkImage is created, and may be nullptr. - */ - typedef void (*RasterReleaseProc)(const void* pixels, ReleaseContext); - - /** Creates SkImage from pixmap, sharing SkPixmap pixels. Pixels must remain valid and - unchanged until rasterReleaseProc is called. rasterReleaseProc is passed - releaseContext when SkImage is deleted or no longer refers to pixmap pixels. - - Pass nullptr for rasterReleaseProc to share SkPixmap without requiring a callback - when SkImage is released. Pass nullptr for releaseContext if rasterReleaseProc - does not require state. - - SkImage is returned if pixmap is valid. Valid SkPixmap parameters include: - dimensions are greater than zero; - each dimension fits in 29 bits; - SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; - row bytes are large enough to hold one row of pixels; - pixel address is not nullptr. - - @param pixmap SkImageInfo, pixel address, and row bytes - @param rasterReleaseProc function called when pixels can be released; or nullptr - @param releaseContext state passed to rasterReleaseProc; or nullptr - @return SkImage sharing pixmap - */ - static sk_sp MakeFromRaster(const SkPixmap& pixmap, - RasterReleaseProc rasterReleaseProc, - ReleaseContext releaseContext); - - /** Creates SkImage from bitmap, sharing or copying bitmap pixels. If the bitmap - is marked immutable, and its pixel memory is shareable, it may be shared - instead of copied. - - SkImage is returned if bitmap is valid. Valid SkBitmap parameters include: - dimensions are greater than zero; - each dimension fits in 29 bits; - SkColorType and SkAlphaType are valid, and SkColorType is not kUnknown_SkColorType; - row bytes are large enough to hold one row of pixels; - pixel address is not nullptr. - - @param bitmap SkImageInfo, row bytes, and pixels - @return created SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_MakeFromBitmap - */ - static sk_sp MakeFromBitmap(const SkBitmap& bitmap); - - /** Creates SkImage from data returned by imageGenerator. Generated data is owned by SkImage and - may not be shared or accessed. - - SkImage is returned if generator data is valid. Valid data parameters vary by type of data - and platform. - - imageGenerator may wrap SkPicture data, codec data, or custom data. - - @param imageGenerator stock or custom routines to retrieve SkImage - @return created SkImage, or nullptr - */ - static sk_sp MakeFromGenerator(std::unique_ptr imageGenerator); - - /** - * Return an image backed by the encoded data, but attempt to defer decoding until the image - * is actually used/drawn. This deferral allows the system to cache the result, either on the - * CPU or on the GPU, depending on where the image is drawn. If memory is low, the cache may - * be purged, causing the next draw of the image to have to re-decode. - * - * If alphaType is nullopt, the image's alpha type will be chosen automatically based on the - * image format. Transparent images will default to kPremul_SkAlphaType. If alphaType contains - * kPremul_SkAlphaType or kUnpremul_SkAlphaType, that alpha type will be used. Forcing opaque - * (passing kOpaque_SkAlphaType) is not allowed, and will return nullptr. - * - * This is similar to DecodeTo[Raster,Texture], but this method will attempt to defer the - * actual decode, while the DecodeTo... method explicitly decode and allocate the backend - * when the call is made. - * - * If the encoded format is not supported, nullptr is returned. - * - * @param encoded the encoded data - * @return created SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_MakeFromEncoded - */ - static sk_sp MakeFromEncoded(sk_sp encoded, - std::optional alphaType = std::nullopt); - - /* - * Experimental: - * Skia | GL_COMPRESSED_* | MTLPixelFormat* | VK_FORMAT_*_BLOCK - * -------------------------------------------------------------------------------------- - * kETC2_RGB8_UNORM | ETC1_RGB8 | ETC2_RGB8 (iOS-only) | ETC2_R8G8B8_UNORM - * | RGB8_ETC2 | | - * -------------------------------------------------------------------------------------- - * kBC1_RGB8_UNORM | RGB_S3TC_DXT1_EXT | N/A | BC1_RGB_UNORM - * -------------------------------------------------------------------------------------- - * kBC1_RGBA8_UNORM | RGBA_S3TC_DXT1_EXT | BC1_RGBA (macOS-only)| BC1_RGBA_UNORM - */ - enum class CompressionType { - kNone, - kETC2_RGB8_UNORM, // the same as ETC1 - - kBC1_RGB8_UNORM, - kBC1_RGBA8_UNORM, - kLast = kBC1_RGBA8_UNORM, - }; - - static constexpr int kCompressionTypeCount = static_cast(CompressionType::kLast) + 1; - - static const CompressionType kETC1_CompressionType = CompressionType::kETC2_RGB8_UNORM; - - /** Creates a CPU-backed SkImage from compressed data. - - This method will decompress the compressed data and create an image wrapping - it. Any mipmap levels present in the compressed data are discarded. - - @param data compressed data to store in SkImage - @param width width of full SkImage - @param height height of full SkImage - @param type type of compression used - @return created SkImage, or nullptr - */ - static sk_sp MakeRasterFromCompressed(sk_sp data, - int width, int height, - CompressionType type); - - enum class BitDepth { - kU8, //!< uses 8-bit unsigned int per color component - kF16, //!< uses 16-bit float per color component - }; - - /** Creates SkImage from picture. Returned SkImage width and height are set by dimensions. - SkImage draws picture with matrix and paint, set to bitDepth and colorSpace. - - If matrix is nullptr, draws with identity SkMatrix. If paint is nullptr, draws - with default SkPaint. colorSpace may be nullptr. - - @param picture stream of drawing commands - @param dimensions width and height - @param matrix SkMatrix to rotate, scale, translate, and so on; may be nullptr - @param paint SkPaint to apply transparency, filtering, and so on; may be nullptr - @param bitDepth 8-bit integer or 16-bit float: per component - @param colorSpace range of colors; may be nullptr - @param props props to use when rasterizing the picture - @return created SkImage, or nullptr - */ - static sk_sp MakeFromPicture(sk_sp picture, const SkISize& dimensions, - const SkMatrix* matrix, const SkPaint* paint, - BitDepth bitDepth, sk_sp colorSpace, - SkSurfaceProps props = {}); - -#if SK_SUPPORT_GPU - /** Creates a GPU-backed SkImage from compressed data. - - This method will return an SkImage representing the compressed data. - If the GPU doesn't support the specified compression method, the data - will be decompressed and then wrapped in a GPU-backed image. - - Note: one can query the supported compression formats via - GrRecordingContext::compressedBackendFormat. - - @param context GPU context - @param data compressed data to store in SkImage - @param width width of full SkImage - @param height height of full SkImage - @param type type of compression used - @param mipmapped does 'data' contain data for all the mipmap levels? - @param isProtected do the contents of 'data' require DRM protection (on Vulkan)? - @return created SkImage, or nullptr - */ - static sk_sp MakeTextureFromCompressed(GrDirectContext* direct, - sk_sp data, - int width, int height, - CompressionType type, - GrMipmapped mipmapped = GrMipmapped::kNo, - GrProtected isProtected = GrProtected::kNo); - - /** User function called when supplied texture may be deleted. - */ - typedef void (*TextureReleaseProc)(ReleaseContext releaseContext); - - /** Creates SkImage from GPU texture associated with context. GPU texture must stay - valid and unchanged until textureReleaseProc is called. textureReleaseProc is - passed releaseContext when SkImage is deleted or no longer refers to texture. - - SkImage is returned if format of backendTexture is recognized and supported. - Recognized formats vary by GPU back-end. - - @note When using a DDL recording context, textureReleaseProc will be called on the - GPU thread after the DDL is played back on the direct context. - - @param context GPU context - @param backendTexture texture residing on GPU - @param colorSpace This describes the color space of this image's contents, as - seen after sampling. In general, if the format of the backend - texture is SRGB, some linear colorSpace should be supplied - (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the - backend texture is linear, then the colorSpace should include - a description of the transfer function as - well (e.g., SkColorSpace::MakeSRGB()). - @param textureReleaseProc function called when texture can be released - @param releaseContext state passed to textureReleaseProc - @return created SkImage, or nullptr - */ - static sk_sp MakeFromTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, - SkColorType colorType, - SkAlphaType alphaType, - sk_sp colorSpace, - TextureReleaseProc textureReleaseProc = nullptr, - ReleaseContext releaseContext = nullptr); - - /** Creates an SkImage from a GPU backend texture. The backend texture must stay - valid and unchanged until textureReleaseProc is called. The textureReleaseProc is - called when the SkImage is deleted or no longer refers to the texture and will be - passed the releaseContext. - - An SkImage is returned if the format of backendTexture is recognized and supported. - Recognized formats vary by GPU back-end. - - @note When using a DDL recording context, textureReleaseProc will be called on the - GPU thread after the DDL is played back on the direct context. - - @param context the GPU context - @param backendTexture a texture already allocated by the GPU - @param alphaType This characterizes the nature of the alpha values in the - backend texture. For opaque compressed formats (e.g., ETC1) - this should usually be set to kOpaque_SkAlphaType. - @param colorSpace This describes the color space of this image's contents, as - seen after sampling. In general, if the format of the backend - texture is SRGB, some linear colorSpace should be supplied - (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the - backend texture is linear, then the colorSpace should include - a description of the transfer function as - well (e.g., SkColorSpace::MakeSRGB()). - @param textureReleaseProc function called when the backend texture can be released - @param releaseContext state passed to textureReleaseProc - @return created SkImage, or nullptr - */ - static sk_sp MakeFromCompressedTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, - SkAlphaType alphaType, - sk_sp colorSpace, - TextureReleaseProc textureReleaseProc = nullptr, - ReleaseContext releaseContext = nullptr); - - /** Creates SkImage from pixmap. SkImage is uploaded to GPU back-end using context. - - Created SkImage is available to other GPU contexts, and is available across thread - boundaries. All contexts must be in the same GPU share group, or otherwise - share resources. - - When SkImage is no longer referenced, context releases texture memory - asynchronously. - - GrBackendTexture created from pixmap is uploaded to match SkSurface created with - dstColorSpace. SkColorSpace of SkImage is determined by pixmap.colorSpace(). - - SkImage is returned referring to GPU back-end if context is not nullptr, - format of data is recognized and supported, and if context supports moving - resources between contexts. Otherwise, pixmap pixel data is copied and SkImage - as returned in raster format if possible; nullptr may be returned. - Recognized GPU formats vary by platform and GPU back-end. - - @param context GPU context - @param pixmap SkImageInfo, pixel address, and row bytes - @param buildMips create SkImage as mip map if true - @param dstColorSpace range of colors of matching SkSurface on GPU - @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary - @return created SkImage, or nullptr - */ - static sk_sp MakeCrossContextFromPixmap(GrDirectContext* context, - const SkPixmap& pixmap, - bool buildMips, - bool limitToMaxTextureSize = false); - - /** Creates SkImage from backendTexture associated with context. backendTexture and - returned SkImage are managed internally, and are released when no longer needed. - - SkImage is returned if format of backendTexture is recognized and supported. - Recognized formats vary by GPU back-end. - - @param context GPU context - @param backendTexture texture residing on GPU - @param textureOrigin origin of backendTexture - @param colorType color type of the resulting image - @param alphaType alpha type of the resulting image - @param colorSpace range of colors; may be nullptr - @return created SkImage, or nullptr - */ - static sk_sp MakeFromAdoptedTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin textureOrigin, - SkColorType colorType); - static sk_sp MakeFromAdoptedTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin textureOrigin, - SkColorType colorType, - SkAlphaType alphaType); - static sk_sp MakeFromAdoptedTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin textureOrigin, - SkColorType colorType, - SkAlphaType alphaType, - sk_sp colorSpace); - - /** Creates an SkImage from YUV[A] planar textures. This requires that the textures stay valid - for the lifetime of the image. The ReleaseContext can be used to know when it is safe to - either delete or overwrite the textures. If ReleaseProc is provided it is also called before - return on failure. - - @param context GPU context - @param yuvaTextures A set of textures containing YUVA data and a description of the - data and transformation to RGBA. - @param imageColorSpace range of colors of the resulting image after conversion to RGB; - may be nullptr - @param textureReleaseProc called when the backend textures can be released - @param releaseContext state passed to textureReleaseProc - @return created SkImage, or nullptr - */ - static sk_sp MakeFromYUVATextures(GrRecordingContext* context, - const GrYUVABackendTextures& yuvaTextures, - sk_sp imageColorSpace = nullptr, - TextureReleaseProc textureReleaseProc = nullptr, - ReleaseContext releaseContext = nullptr); - - /** Creates SkImage from SkYUVAPixmaps. - - The image will remain planar with each plane converted to a texture using the passed - GrRecordingContext. - - SkYUVAPixmaps has a SkYUVAInfo which specifies the transformation from YUV to RGB. - The SkColorSpace of the resulting RGB values is specified by imageColorSpace. This will - be the SkColorSpace reported by the image and when drawn the RGB values will be converted - from this space into the destination space (if the destination is tagged). - - Currently, this is only supported using the GPU backend and will fail if context is nullptr. - - SkYUVAPixmaps does not need to remain valid after this returns. - - @param context GPU context - @param pixmaps The planes as pixmaps with supported SkYUVAInfo that - specifies conversion to RGB. - @param buildMips create internal YUVA textures as mip map if kYes. This is - silently ignored if the context does not support mip maps. - @param limitToMaxTextureSize downscale image to GPU maximum texture size, if necessary - @param imageColorSpace range of colors of the resulting image; may be nullptr - @return created SkImage, or nullptr - */ - static sk_sp MakeFromYUVAPixmaps(GrRecordingContext* context, - const SkYUVAPixmaps& pixmaps, - GrMipmapped buildMips = GrMipmapped::kNo, - bool limitToMaxTextureSize = false, - sk_sp imageColorSpace = nullptr); - - using PromiseImageTextureContext = void*; - using PromiseImageTextureFulfillProc = - sk_sp (*)(PromiseImageTextureContext); - using PromiseImageTextureReleaseProc = void (*)(PromiseImageTextureContext); - - /** Create a new SkImage that is very similar to an SkImage created by MakeFromTexture. The - difference is that the caller need not have created the texture nor populated it with the - image pixel data. Moreover, the SkImage may be created on a thread as the creation of the - image does not require access to the backend API or GrDirectContext. Instead of passing a - GrBackendTexture the client supplies a description of the texture consisting of - GrBackendFormat, width, height, and GrMipmapped state. The resulting SkImage can be drawn - to a SkDeferredDisplayListRecorder or directly to a GPU-backed SkSurface. - - When the actual texture is required to perform a backend API draw, textureFulfillProc will - be called to receive a GrBackendTexture. The properties of the GrBackendTexture must match - those set during the SkImage creation, and it must refer to a valid existing texture in the - backend API context/device, and be populated with the image pixel data. The texture cannot - be deleted until textureReleaseProc is called. - - There is at most one call to each of textureFulfillProc and textureReleaseProc. - textureReleaseProc is always called even if image creation fails or if the - image is never fulfilled (e.g. it is never drawn or all draws are clipped out) - - @param gpuContextProxy the thread-safe proxy of the gpu context. required. - @param backendFormat format of promised gpu texture - @param dimensions width & height of promised gpu texture - @param mipmapped mip mapped state of promised gpu texture - @param origin surface origin of promised gpu texture - @param colorType color type of promised gpu texture - @param alphaType alpha type of promised gpu texture - @param colorSpace range of colors; may be nullptr - @param textureFulfillProc function called to get actual gpu texture - @param textureReleaseProc function called when texture can be deleted - @param textureContext state passed to textureFulfillProc and textureReleaseProc - @return created SkImage, or nullptr - */ - static sk_sp MakePromiseTexture(sk_sp gpuContextProxy, - const GrBackendFormat& backendFormat, - SkISize dimensions, - GrMipmapped mipmapped, - GrSurfaceOrigin origin, - SkColorType colorType, - SkAlphaType alphaType, - sk_sp colorSpace, - PromiseImageTextureFulfillProc textureFulfillProc, - PromiseImageTextureReleaseProc textureReleaseProc, - PromiseImageTextureContext textureContext); - - /** This entry point operates like 'MakePromiseTexture' but it is used to construct a SkImage - from YUV[A] data. The source data may be planar (i.e. spread across multiple textures). In - the extreme Y, U, V, and A are all in different planes and thus the image is specified by - four textures. 'backendTextureInfo' describes the planar arrangement, texture formats, - conversion to RGB, and origin of the textures. Separate 'textureFulfillProc' and - 'textureReleaseProc' calls are made for each texture. Each texture has its own - PromiseImageTextureContext. If 'backendTextureInfo' is not valid then no release proc - calls are made. Otherwise, the calls will be made even on failure. 'textureContexts' has one - entry for each of the up to four textures, as indicated by 'backendTextureInfo'. - - Currently the mip mapped property of 'backendTextureInfo' is ignored. However, in the - near future it will be required that if it is kYes then textureFulfillProc must return - a mip mapped texture for each plane in order to successfully draw the image. - - @param gpuContextProxy the thread-safe proxy of the gpu context. required. - @param backendTextureInfo info about the promised yuva gpu texture - @param imageColorSpace range of colors; may be nullptr - @param textureFulfillProc function called to get actual gpu texture - @param textureReleaseProc function called when texture can be deleted - @param textureContexts state passed to textureFulfillProc and textureReleaseProc - @return created SkImage, or nullptr - */ - static sk_sp MakePromiseYUVATexture(sk_sp gpuContextProxy, - const GrYUVABackendTextureInfo& backendTextureInfo, - sk_sp imageColorSpace, - PromiseImageTextureFulfillProc textureFulfillProc, - PromiseImageTextureReleaseProc textureReleaseProc, - PromiseImageTextureContext textureContexts[]); - -#endif // SK_SUPPORT_GPU - -#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 - /** (See Skia bug 7447) - Creates SkImage from Android hardware buffer. - Returned SkImage takes a reference on the buffer. - - Only available on Android, when __ANDROID_API__ is defined to be 26 or greater. - - @param hardwareBuffer AHardwareBuffer Android hardware buffer - @param colorSpace range of colors; may be nullptr - @return created SkImage, or nullptr - */ - static sk_sp MakeFromAHardwareBuffer( - AHardwareBuffer* hardwareBuffer, - SkAlphaType alphaType = kPremul_SkAlphaType, - sk_sp colorSpace = nullptr, - GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin); - - /** Creates SkImage from Android hardware buffer and uploads the data from the SkPixmap to it. - Returned SkImage takes a reference on the buffer. - - Only available on Android, when __ANDROID_API__ is defined to be 26 or greater. - - @param context GPU context - @param pixmap SkPixmap that contains data to be uploaded to the AHardwareBuffer - @param hardwareBuffer AHardwareBuffer Android hardware buffer - @param surfaceOrigin surface origin for resulting image - @return created SkImage, or nullptr - */ - static sk_sp MakeFromAHardwareBufferWithData( - GrDirectContext* context, - const SkPixmap& pixmap, - AHardwareBuffer* hardwareBuffer, - GrSurfaceOrigin surfaceOrigin = kTopLeft_GrSurfaceOrigin); -#endif - - /** Returns a SkImageInfo describing the width, height, color type, alpha type, and color space - of the SkImage. - - @return image info of SkImage. - */ - const SkImageInfo& imageInfo() const { return fInfo; } - - /** Returns pixel count in each row. - - @return pixel width in SkImage - */ - int width() const { return fInfo.width(); } - - /** Returns pixel row count. - - @return pixel height in SkImage - */ - int height() const { return fInfo.height(); } - - /** Returns SkISize { width(), height() }. - - @return integral size of width() and height() - */ - SkISize dimensions() const { return SkISize::Make(fInfo.width(), fInfo.height()); } - - /** Returns SkIRect { 0, 0, width(), height() }. - - @return integral rectangle from origin to width() and height() - */ - SkIRect bounds() const { return SkIRect::MakeWH(fInfo.width(), fInfo.height()); } - - /** Returns value unique to image. SkImage contents cannot change after SkImage is - created. Any operation to create a new SkImage will receive generate a new - unique number. - - @return unique identifier - */ - uint32_t uniqueID() const { return fUniqueID; } - - /** Returns SkAlphaType. - - SkAlphaType returned was a parameter to an SkImage constructor, - or was parsed from encoded data. - - @return SkAlphaType in SkImage - - example: https://fiddle.skia.org/c/@Image_alphaType - */ - SkAlphaType alphaType() const; - - /** Returns SkColorType if known; otherwise, returns kUnknown_SkColorType. - - @return SkColorType of SkImage - - example: https://fiddle.skia.org/c/@Image_colorType - */ - SkColorType colorType() const; - - /** Returns SkColorSpace, the range of colors, associated with SkImage. The - reference count of SkColorSpace is unchanged. The returned SkColorSpace is - immutable. - - SkColorSpace returned was passed to an SkImage constructor, - or was parsed from encoded data. SkColorSpace returned may be ignored when SkImage - is drawn, depending on the capabilities of the SkSurface receiving the drawing. - - @return SkColorSpace in SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_colorSpace - */ - SkColorSpace* colorSpace() const; - - /** Returns a smart pointer to SkColorSpace, the range of colors, associated with - SkImage. The smart pointer tracks the number of objects sharing this - SkColorSpace reference so the memory is released when the owners destruct. - - The returned SkColorSpace is immutable. - - SkColorSpace returned was passed to an SkImage constructor, - or was parsed from encoded data. SkColorSpace returned may be ignored when SkImage - is drawn, depending on the capabilities of the SkSurface receiving the drawing. - - @return SkColorSpace in SkImage, or nullptr, wrapped in a smart pointer - - example: https://fiddle.skia.org/c/@Image_refColorSpace - */ - sk_sp refColorSpace() const; - - /** Returns true if SkImage pixels represent transparency only. If true, each pixel - is packed in 8 bits as defined by kAlpha_8_SkColorType. - - @return true if pixels represent a transparency mask - - example: https://fiddle.skia.org/c/@Image_isAlphaOnly - */ - bool isAlphaOnly() const; - - /** Returns true if pixels ignore their alpha value and are treated as fully opaque. - - @return true if SkAlphaType is kOpaque_SkAlphaType - */ - bool isOpaque() const { return SkAlphaTypeIsOpaque(this->alphaType()); } - - /** - * Make a shader with the specified tiling and mipmap sampling. - */ - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions&, - const SkMatrix* localMatrix = nullptr) const; - - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling, - const SkMatrix& lm) const { - return this->makeShader(tmx, tmy, sampling, &lm); - } - sk_sp makeShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const { - return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, &lm); - } - sk_sp makeShader(const SkSamplingOptions& sampling, - const SkMatrix* lm = nullptr) const { - return this->makeShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, lm); - } - - /** - * makeRawShader functions like makeShader, but for images that contain non-color data. - * This includes images encoding things like normals, material properties (eg, roughness), - * heightmaps, or any other purely mathematical data that happens to be stored in an image. - * These types of images are useful with some programmable shaders (see: SkRuntimeEffect). - * - * Raw image shaders work like regular image shaders (including filtering and tiling), with - * a few major differences: - * - No color space transformation is ever applied (the color space of the image is ignored). - * - Images with an alpha type of kUnpremul are *not* automatically premultiplied. - * - Bicubic filtering is not supported. If SkSamplingOptions::useCubic is true, these - * factories will return nullptr. - */ - sk_sp makeRawShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions&, - const SkMatrix* localMatrix = nullptr) const; - - sk_sp makeRawShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions& sampling, - const SkMatrix& lm) const { - return this->makeRawShader(tmx, tmy, sampling, &lm); - } - sk_sp makeRawShader(const SkSamplingOptions& sampling, const SkMatrix& lm) const { - return this->makeRawShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, &lm); - } - sk_sp makeRawShader(const SkSamplingOptions& sampling, - const SkMatrix* lm = nullptr) const { - return this->makeRawShader(SkTileMode::kClamp, SkTileMode::kClamp, sampling, lm); - } - - using CubicResampler = SkCubicResampler; - - /** Copies SkImage pixel address, row bytes, and SkImageInfo to pixmap, if address - is available, and returns true. If pixel address is not available, return - false and leave pixmap unchanged. - - @param pixmap storage for pixel state if pixels are readable; otherwise, ignored - @return true if SkImage has direct access to pixels - - example: https://fiddle.skia.org/c/@Image_peekPixels - */ - bool peekPixels(SkPixmap* pixmap) const; - - /** Returns true if the contents of SkImage was created on or uploaded to GPU memory, - and is available as a GPU texture. - - @return true if SkImage is a GPU texture - - example: https://fiddle.skia.org/c/@Image_isTextureBacked - */ - bool isTextureBacked() const; - - /** Returns an approximation of the amount of texture memory used by the image. Returns - zero if the image is not texture backed or if the texture has an external format. - */ - size_t textureSize() const; - - /** Returns true if SkImage can be drawn on either raster surface or GPU surface. - If context is nullptr, tests if SkImage draws on raster surface; - otherwise, tests if SkImage draws on GPU surface associated with context. - - SkImage backed by GPU texture may become invalid if associated context is - invalid. lazy image may be invalid and may not draw to raster surface or - GPU surface or both. - - @param context GPU context - @return true if SkImage can be drawn - - example: https://fiddle.skia.org/c/@Image_isValid - */ - bool isValid(GrRecordingContext* context) const; - -#if SK_SUPPORT_GPU - /** Flushes any pending uses of texture-backed images in the GPU backend. If the image is not - texture-backed (including promise texture images) or if the GrDirectContext does not - have the same context ID as the context backing the image then this is a no-op. - - If the image was not used in any non-culled draws in the current queue of work for the - passed GrDirectContext then this is a no-op unless the GrFlushInfo contains semaphores or - a finish proc. Those are respected even when the image has not been used. - - @param context the context on which to flush pending usages of the image. - @param info flush options - */ - GrSemaphoresSubmitted flush(GrDirectContext* context, const GrFlushInfo& flushInfo) const; - - void flush(GrDirectContext* context) const { this->flush(context, {}); } - - /** Version of flush() that uses a default GrFlushInfo. Also submits the flushed work to the - GPU. - */ - void flushAndSubmit(GrDirectContext*) const; - - /** Retrieves the back-end texture. If SkImage has no back-end texture, an invalid - object is returned. Call GrBackendTexture::isValid to determine if the result - is valid. - - If flushPendingGrContextIO is true, completes deferred I/O operations. - - If origin in not nullptr, copies location of content drawn into SkImage. - - @param flushPendingGrContextIO flag to flush outstanding requests - @return back-end API texture handle; invalid on failure - */ - GrBackendTexture getBackendTexture(bool flushPendingGrContextIO, - GrSurfaceOrigin* origin = nullptr) const; -#endif // SK_SUPPORT_GPU - - /** \enum SkImage::CachingHint - CachingHint selects whether Skia may internally cache SkBitmap generated by - decoding SkImage, or by copying SkImage from GPU to CPU. The default behavior - allows caching SkBitmap. - - Choose kDisallow_CachingHint if SkImage pixels are to be used only once, or - if SkImage pixels reside in a cache outside of Skia, or to reduce memory pressure. - - Choosing kAllow_CachingHint does not ensure that pixels will be cached. - SkImage pixels may not be cached if memory requirements are too large or - pixels are not accessible. - */ - enum CachingHint { - kAllow_CachingHint, //!< allows internally caching decoded and copied pixels - kDisallow_CachingHint, //!< disallows internally caching decoded and copied pixels - }; - - /** Copies SkRect of pixels from SkImage to dstPixels. Copy starts at offset (srcX, srcY), - and does not exceed SkImage (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and SkColorSpace of - destination. dstRowBytes specifies the gap from one destination row to the next. - Returns true if pixels are copied. Returns false if: - - dstInfo.addr() equals nullptr - - dstRowBytes is less than dstInfo.minRowBytes() - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkImage SkColorType is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkImage SkColorType is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkImage SkAlphaType is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkImage SkColorSpace is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(srcX) >= Image width(), or if abs(srcY) >= Image height(). - - If cachingHint is kAllow_CachingHint, pixels may be retained locally. - If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache. - - @param context the GrDirectContext in play, if it exists - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @param cachingHint whether the pixels should be cached locally - @return true if pixels are copied to dstPixels - */ - bool readPixels(GrDirectContext* context, - const SkImageInfo& dstInfo, - void* dstPixels, - size_t dstRowBytes, - int srcX, int srcY, - CachingHint cachingHint = kAllow_CachingHint) const; - - /** Copies a SkRect of pixels from SkImage to dst. Copy starts at (srcX, srcY), and - does not exceed SkImage (width(), height()). - - dst specifies width, height, SkColorType, SkAlphaType, SkColorSpace, pixel storage, - and row bytes of destination. dst.rowBytes() specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if: - - dst pixel storage equals nullptr - - dst.rowBytes is less than SkImageInfo::minRowBytes - - SkPixelRef is nullptr - - Pixels are copied only if pixel conversion is possible. If SkImage SkColorType is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst.colorType() must match. - If SkImage SkColorType is kGray_8_SkColorType, dst.colorSpace() must match. - If SkImage SkAlphaType is kOpaque_SkAlphaType, dst.alphaType() must - match. If SkImage SkColorSpace is nullptr, dst.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if width() or height() is zero or negative. - Returns false if abs(srcX) >= Image width(), or if abs(srcY) >= Image height(). - - If cachingHint is kAllow_CachingHint, pixels may be retained locally. - If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache. - - @param context the GrDirectContext in play, if it exists - @param dst destination SkPixmap: SkImageInfo, pixels, row bytes - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @param cachingHint whether the pixels should be cached locallyZ - @return true if pixels are copied to dst - */ - bool readPixels(GrDirectContext* context, - const SkPixmap& dst, - int srcX, - int srcY, - CachingHint cachingHint = kAllow_CachingHint) const; - -#ifndef SK_IMAGE_READ_PIXELS_DISABLE_LEGACY_API - /** Deprecated. Use the variants that accept a GrDirectContext. */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY, CachingHint cachingHint = kAllow_CachingHint) const; - bool readPixels(const SkPixmap& dst, int srcX, int srcY, - CachingHint cachingHint = kAllow_CachingHint) const; -#endif - - /** The result from asyncRescaleAndReadPixels() or asyncRescaleAndReadPixelsYUV420(). */ - class AsyncReadResult { - public: - AsyncReadResult(const AsyncReadResult&) = delete; - AsyncReadResult(AsyncReadResult&&) = delete; - AsyncReadResult& operator=(const AsyncReadResult&) = delete; - AsyncReadResult& operator=(AsyncReadResult&&) = delete; - - virtual ~AsyncReadResult() = default; - virtual int count() const = 0; - virtual const void* data(int i) const = 0; - virtual size_t rowBytes(int i) const = 0; - - protected: - AsyncReadResult() = default; - }; - - /** Client-provided context that is passed to client-provided ReadPixelsContext. */ - using ReadPixelsContext = void*; - - /** Client-provided callback to asyncRescaleAndReadPixels() or - asyncRescaleAndReadPixelsYUV420() that is called when read result is ready or on failure. - */ - using ReadPixelsCallback = void(ReadPixelsContext, std::unique_ptr); - - enum class RescaleGamma : bool { kSrc, kLinear }; - - enum class RescaleMode { - kNearest, - kRepeatedLinear, - kRepeatedCubic, - }; - - /** Makes image pixel data available to caller, possibly asynchronously. - - Currently asynchronous reads are only supported on the GPU backend and only when the - underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all - other cases this operates synchronously. - - Data is read from the source sub-rectangle, then converted to the color space, color type, - and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the image - causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing pixel data in the requested color type, alpha type, and color - space. The AsyncReadResult will have count() == 1. Upon failure the callback is called with - nullptr for AsyncReadResult. For a GPU image this flushes work but a submit must occur to - guarantee a finite time before the callback is called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage - is GPU-backed the data is immediately invalidated if the context is abandoned or - destroyed. - - @param info info of the requested pixels - @param srcRect subrectangle of image to read - @param callback function to call with result of the read - @param context passed to callback - */ - void asyncReadPixels(const SkImageInfo& info, - const SkIRect& srcRect, - ReadPixelsCallback callback, - ReadPixelsContext context) const; - - /** Makes image pixel data available to caller, possibly asynchronously. It can also rescale - the image pixels. - - Currently asynchronous reads are only supported on the GPU backend and only when the - underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all - other cases this operates synchronously. - - Data is read from the source sub-rectangle, is optionally converted to a linear gamma, is - rescaled to the size indicated by 'info', is then converted to the color space, color type, - and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the image - causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing pixel data in the requested color type, alpha type, and color - space. The AsyncReadResult will have count() == 1. Upon failure the callback is called with - nullptr for AsyncReadResult. For a GPU image this flushes work but a submit must occur to - guarantee a finite time before the callback is called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage - is GPU-backed the data is immediately invalidated if the context is abandoned or - destroyed. - - @param info info of the requested pixels - @param srcRect subrectangle of image to read - @param rescaleGamma controls whether rescaling is done in the image's gamma or whether - the source data is transformed to a linear gamma before rescaling. - @param rescaleMode controls the technique (and cost) of the rescaling - @param callback function to call with result of the read - @param context passed to callback - */ - void asyncRescaleAndReadPixels(const SkImageInfo& info, - const SkIRect& srcRect, - RescaleGamma rescaleGamma, - RescaleMode rescaleMode, - ReadPixelsCallback callback, - ReadPixelsContext context) const; - - /** - Similar to asyncRescaleAndReadPixels but performs an additional conversion to YUV. The - RGB->YUV conversion is controlled by 'yuvColorSpace'. The YUV data is returned as three - planes ordered y, u, v. The u and v planes are half the width and height of the resized - rectangle. The y, u, and v values are single bytes. Currently this fails if 'dstSize' - width and height are not even. A 'srcRect' that is not contained by the bounds of the - image causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing the planar data. The AsyncReadResult will have count() == 3. - Upon failure the callback is called with nullptr for AsyncReadResult. For a GPU image this - flushes work but a submit must occur to guarantee a finite time before the callback is - called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the SkImage - is GPU-backed the data is immediately invalidated if the context is abandoned or - destroyed. - - @param yuvColorSpace The transformation from RGB to YUV. Applied to the resized image - after it is converted to dstColorSpace. - @param dstColorSpace The color space to convert the resized image to, after rescaling. - @param srcRect The portion of the image to rescale and convert to YUV planes. - @param dstSize The size to rescale srcRect to - @param rescaleGamma controls whether rescaling is done in the image's gamma or whether - the source data is transformed to a linear gamma before rescaling. - @param rescaleMode controls the technique (and cost) of the rescaling - @param callback function to call with the planar read result - @param context passed to callback - */ - void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace, - sk_sp dstColorSpace, - const SkIRect& srcRect, - const SkISize& dstSize, - RescaleGamma rescaleGamma, - RescaleMode rescaleMode, - ReadPixelsCallback callback, - ReadPixelsContext context) const; - - /** Copies SkImage to dst, scaling pixels to fit dst.width() and dst.height(), and - converting pixels to match dst.colorType() and dst.alphaType(). Returns true if - pixels are copied. Returns false if dst.addr() is nullptr, or dst.rowBytes() is - less than dst SkImageInfo::minRowBytes. - - Pixels are copied only if pixel conversion is possible. If SkImage SkColorType is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst.colorType() must match. - If SkImage SkColorType is kGray_8_SkColorType, dst.colorSpace() must match. - If SkImage SkAlphaType is kOpaque_SkAlphaType, dst.alphaType() must - match. If SkImage SkColorSpace is nullptr, dst.colorSpace() must match. Returns - false if pixel conversion is not possible. - - If cachingHint is kAllow_CachingHint, pixels may be retained locally. - If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache. - - @param dst destination SkPixmap: SkImageInfo, pixels, row bytes - @return true if pixels are scaled to fit dst - */ - bool scalePixels(const SkPixmap& dst, const SkSamplingOptions&, - CachingHint cachingHint = kAllow_CachingHint) const; - - /** Encodes SkImage pixels, returning result as SkData. - - Returns nullptr if encoding fails, or if encodedImageFormat is not supported. - - SkImage encoding in a format requires both building with one or more of: - SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP; and platform support - for the encoded format. - - If SK_BUILD_FOR_MAC or SK_BUILD_FOR_IOS is defined, encodedImageFormat can - additionally be one of: SkEncodedImageFormat::kICO, SkEncodedImageFormat::kBMP, - SkEncodedImageFormat::kGIF. - - quality is a platform and format specific metric trading off size and encoding - error. When used, quality equaling 100 encodes with the least error. quality may - be ignored by the encoder. - - @param encodedImageFormat one of: SkEncodedImageFormat::kJPEG, SkEncodedImageFormat::kPNG, - SkEncodedImageFormat::kWEBP - @param quality encoder specific metric with 100 equaling best - @return encoded SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_encodeToData - */ - sk_sp encodeToData(SkEncodedImageFormat encodedImageFormat, int quality) const; - - /** Encodes SkImage pixels, returning result as SkData. Returns existing encoded data - if present; otherwise, SkImage is encoded with SkEncodedImageFormat::kPNG. Skia - must be built with SK_ENCODE_PNG to encode SkImage. - - Returns nullptr if existing encoded data is missing or invalid, and - encoding fails. - - @return encoded SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_encodeToData_2 - */ - sk_sp encodeToData() const; - - /** Returns encoded SkImage pixels as SkData, if SkImage was created from supported - encoded stream format. Platform support for formats vary and may require building - with one or more of: SK_ENCODE_JPEG, SK_ENCODE_PNG, SK_ENCODE_WEBP. - - Returns nullptr if SkImage contents are not encoded. - - @return encoded SkImage, or nullptr - - example: https://fiddle.skia.org/c/@Image_refEncodedData - */ - sk_sp refEncodedData() const; - - /** Returns subset of this image. - - Returns nullptr if any of the following are true: - - Subset is empty - - Subset is not contained inside the image's bounds - - Pixels in the image could not be read or copied - - If this image is texture-backed, the context parameter is required and must match the - context of the source image. If the context parameter is provided, and the image is - raster-backed, the subset will be converted to texture-backed. - - @param subset bounds of returned SkImage - @param context the GrDirectContext in play, if it exists - @return the subsetted image, or nullptr - - example: https://fiddle.skia.org/c/@Image_makeSubset - */ - sk_sp makeSubset(const SkIRect& subset, GrDirectContext* direct = nullptr) const; - - /** - * Returns true if the image has mipmap levels. - */ - bool hasMipmaps() const; - - /** - * Returns an image with the same "base" pixels as the this image, but with mipmap levels - * automatically generated and attached. - */ - sk_sp withDefaultMipmaps() const; - -#if SK_SUPPORT_GPU - /** Returns SkImage backed by GPU texture associated with context. Returned SkImage is - compatible with SkSurface created with dstColorSpace. The returned SkImage respects - mipmapped setting; if mipmapped equals GrMipmapped::kYes, the backing texture - allocates mip map levels. - - The mipmapped parameter is effectively treated as kNo if MIP maps are not supported by the - GPU. - - Returns original SkImage if the image is already texture-backed, the context matches, and - mipmapped is compatible with the backing GPU texture. SkBudgeted is ignored in this case. - - Returns nullptr if context is nullptr, or if SkImage was created with another - GrDirectContext. - - @param GrDirectContext the GrDirectContext in play, if it exists - @param GrMipmapped whether created SkImage texture must allocate mip map levels - @param SkBudgeted whether to count a newly created texture for the returned image - counts against the context's budget. - @return created SkImage, or nullptr - */ - sk_sp makeTextureImage(GrDirectContext*, - GrMipmapped = GrMipmapped::kNo, - SkBudgeted = SkBudgeted::kYes) const; -#endif - -#ifdef SK_GRAPHITE_ENABLED - /** Creates an SkImage from a GPU texture associated with the recorder. - - SkImage is returned if the format of backendTexture is recognized and supported. - Recognized formats vary by GPU back-end. - - @param recorder The recorder - @param backendTexture texture residing on GPU - @param colorSpace This describes the color space of this image's contents, as - seen after sampling. In general, if the format of the backend - texture is SRGB, some linear colorSpace should be supplied - (e.g., SkColorSpace::MakeSRGBLinear()). If the format of the - backend texture is linear, then the colorSpace should include - a description of the transfer function as - well (e.g., SkColorSpace::MakeSRGB()). - @return created SkImage, or nullptr - */ - static sk_sp MakeGraphiteFromBackendTexture(skgpu::graphite::Recorder*, - const skgpu::graphite::BackendTexture&, - SkColorType colorType, - SkAlphaType alphaType, - sk_sp colorSpace); - - struct RequiredImageProperties { - skgpu::graphite::Mipmapped fMipmapped; - }; - - /** Graphite version of makeTextureImage. - - Returns an SkImage backed by a Graphite texture, using the provided Recorder for creation - and uploads if necessary. The returned SkImage respects the required image properties' - mipmap setting for non-Graphite SkImages; i.e., if mipmapping is required, the backing - Graphite texture will have allocated mip map levels. - - It is assumed that MIP maps are always supported by the GPU. - - Returns original SkImage if the image is already Graphite-backed and the required mipmapping - is compatible with the backing Graphite texture. If the required mipmapping is not - compatible, nullptr will be returned. - - Returns nullptr if no Recorder is provided, or if SkImage was created with another - Recorder and work on that Recorder has not been submitted. - - @param Recorder the Recorder to use for storing commands - @param RequiredImageProperties properties the returned SkImage must possess (e.g., - mipmaps) - @return created SkImage, or nullptr - */ - sk_sp makeTextureImage(skgpu::graphite::Recorder*, - RequiredImageProperties = {}) const; -#endif - - /** Returns raster image or lazy image. Copies SkImage backed by GPU texture into - CPU memory if needed. Returns original SkImage if decoded in raster bitmap, - or if encoded in a stream. - - Returns nullptr if backed by GPU texture and copy fails. - - @return raster image, lazy image, or nullptr - - example: https://fiddle.skia.org/c/@Image_makeNonTextureImage - */ - sk_sp makeNonTextureImage() const; - - /** Returns raster image. Copies SkImage backed by GPU texture into CPU memory, - or decodes SkImage from lazy image. Returns original SkImage if decoded in - raster bitmap. - - Returns nullptr if copy, decode, or pixel read fails. - - If cachingHint is kAllow_CachingHint, pixels may be retained locally. - If cachingHint is kDisallow_CachingHint, pixels are not added to the local cache. - - @return raster image, or nullptr - - example: https://fiddle.skia.org/c/@Image_makeRasterImage - */ - sk_sp makeRasterImage(CachingHint cachingHint = kDisallow_CachingHint) const; - - /** Creates filtered SkImage. filter processes original SkImage, potentially changing - color, position, and size. subset is the bounds of original SkImage processed - by filter. clipBounds is the expected bounds of the filtered SkImage. outSubset - is required storage for the actual bounds of the filtered SkImage. offset is - required storage for translation of returned SkImage. - - Returns nullptr if SkImage could not be created or if the recording context provided doesn't - match the GPU context in which the image was created. If nullptr is returned, outSubset - and offset are undefined. - - Useful for animation of SkImageFilter that varies size from frame to frame. - Returned SkImage is created larger than required by filter so that GPU texture - can be reused with different sized effects. outSubset describes the valid bounds - of GPU texture returned. offset translates the returned SkImage to keep subsequent - animation frames aligned with respect to each other. - - @param context the GrRecordingContext in play - if it exists - @param filter how SkImage is sampled when transformed - @param subset bounds of SkImage processed by filter - @param clipBounds expected bounds of filtered SkImage - @param outSubset storage for returned SkImage bounds - @param offset storage for returned SkImage translation - @return filtered SkImage, or nullptr - */ - sk_sp makeWithFilter(GrRecordingContext* context, - const SkImageFilter* filter, const SkIRect& subset, - const SkIRect& clipBounds, SkIRect* outSubset, - SkIPoint* offset) const; - - /** Defines a callback function, taking one parameter of type GrBackendTexture with - no return value. Function is called when back-end texture is to be released. - */ - typedef std::function BackendTextureReleaseProc; - -#if SK_SUPPORT_GPU - /** Creates a GrBackendTexture from the provided SkImage. Returns true and - stores result in backendTexture and backendTextureReleaseProc if - texture is created; otherwise, returns false and leaves - backendTexture and backendTextureReleaseProc unmodified. - - Call backendTextureReleaseProc after deleting backendTexture. - backendTextureReleaseProc cleans up auxiliary data related to returned - backendTexture. The caller must delete returned backendTexture after use. - - If SkImage is both texture backed and singly referenced, image is returned in - backendTexture without conversion or making a copy. SkImage is singly referenced - if its was transferred solely using std::move(). - - If SkImage is not texture backed, returns texture with SkImage contents. - - @param context GPU context - @param image SkImage used for texture - @param backendTexture storage for back-end texture - @param backendTextureReleaseProc storage for clean up function - @return true if back-end texture was created - */ - static bool MakeBackendTextureFromSkImage(GrDirectContext* context, - sk_sp image, - GrBackendTexture* backendTexture, - BackendTextureReleaseProc* backendTextureReleaseProc); -#endif - /** Deprecated. - */ - enum LegacyBitmapMode { - kRO_LegacyBitmapMode, //!< returned bitmap is read-only and immutable - }; - - /** Deprecated. - Creates raster SkBitmap with same pixels as SkImage. If legacyBitmapMode is - kRO_LegacyBitmapMode, returned bitmap is read-only and immutable. - Returns true if SkBitmap is stored in bitmap. Returns false and resets bitmap if - SkBitmap write did not succeed. - - @param bitmap storage for legacy SkBitmap - @param legacyBitmapMode bitmap is read-only and immutable - @return true if SkBitmap was created - */ - bool asLegacyBitmap(SkBitmap* bitmap, - LegacyBitmapMode legacyBitmapMode = kRO_LegacyBitmapMode) const; - - /** Returns true if SkImage is backed by an image-generator or other service that creates - and caches its pixels or texture on-demand. - - @return true if SkImage is created as needed - - example: https://fiddle.skia.org/c/@Image_isLazyGenerated_a - example: https://fiddle.skia.org/c/@Image_isLazyGenerated_b - */ - bool isLazyGenerated() const; - - /** Creates SkImage in target SkColorSpace. - Returns nullptr if SkImage could not be created. - - Returns original SkImage if it is in target SkColorSpace. - Otherwise, converts pixels from SkImage SkColorSpace to target SkColorSpace. - If SkImage colorSpace() returns nullptr, SkImage SkColorSpace is assumed to be sRGB. - - If this image is texture-backed, the context parameter is required and must match the - context of the source image. - - @param target SkColorSpace describing color range of returned SkImage - @param direct The GrDirectContext in play, if it exists - @return created SkImage in target SkColorSpace - - example: https://fiddle.skia.org/c/@Image_makeColorSpace - */ - sk_sp makeColorSpace(sk_sp target, - GrDirectContext* direct = nullptr) const; - - /** Experimental. - Creates SkImage in target SkColorType and SkColorSpace. - Returns nullptr if SkImage could not be created. - - Returns original SkImage if it is in target SkColorType and SkColorSpace. - - If this image is texture-backed, the context parameter is required and must match the - context of the source image. - - @param targetColorType SkColorType of returned SkImage - @param targetColorSpace SkColorSpace of returned SkImage - @param direct The GrDirectContext in play, if it exists - @return created SkImage in target SkColorType and SkColorSpace - */ - sk_sp makeColorTypeAndColorSpace(SkColorType targetColorType, - sk_sp targetColorSpace, - GrDirectContext* direct = nullptr) const; - - /** Creates a new SkImage identical to this one, but with a different SkColorSpace. - This does not convert the underlying pixel data, so the resulting image will draw - differently. - */ - sk_sp reinterpretColorSpace(sk_sp newColorSpace) const; - -private: - SkImage(const SkImageInfo& info, uint32_t uniqueID); - - friend class SkBitmap; - friend class SkImage_Base; - friend class SkMipmapBuilder; - - SkImageInfo fInfo; - const uint32_t fUniqueID; - - sk_sp withMipmaps(sk_sp) const; - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageEncoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageEncoder.h deleted file mode 100644 index be0183c094cba4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageEncoder.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageEncoder_DEFINED -#define SkImageEncoder_DEFINED - -#include "include/core/SkEncodedImageFormat.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkBitmap; -class SkData; -class SkPixmap; -class SkWStream; - -/** - * Encode SkPixmap in the given binary image format. - * - * @param dst results are written to this stream. - * @param src source pixels. - * @param format image format, not all formats are supported. - * @param quality range from 0-100, this is supported by jpeg and webp. - * higher values correspond to improved visual quality, but less compression. - * - * @return false iff input is bad or format is unsupported. - * - * Will always return false if Skia is compiled without image - * encoders. - * - * For SkEncodedImageFormat::kWEBP, if quality is 100, it will use lossless compression. Otherwise - * it will use lossy. - * - * For examples of encoding an image to a file or to a block of memory, - * see tools/ToolUtils.h. - */ -SK_API bool SkEncodeImage(SkWStream* dst, const SkPixmap& src, - SkEncodedImageFormat format, int quality); - -/** - * The following helper function wraps SkEncodeImage(). - */ -SK_API bool SkEncodeImage(SkWStream* dst, const SkBitmap& src, SkEncodedImageFormat f, int q); - -/** - * Encode SkPixmap in the given binary image format. - * - * @param src source pixels. - * @param format image format, not all formats are supported. - * @param quality range from 0-100, this is supported by jpeg and webp. - * higher values correspond to improved visual quality, but less compression. - * - * @return encoded data or nullptr if input is bad or format is unsupported. - * - * Will always return nullptr if Skia is compiled without image - * encoders. - * - * For SkEncodedImageFormat::kWEBP, if quality is 100, it will use lossless compression. Otherwise - * it will use lossy. - */ -SK_API sk_sp SkEncodePixmap(const SkPixmap& src, SkEncodedImageFormat format, int quality); - -/** - * Helper that extracts the pixmap from the bitmap, and then calls SkEncodePixmap() - */ -SK_API sk_sp SkEncodeBitmap(const SkBitmap& src, SkEncodedImageFormat format, int quality); - -#endif // SkImageEncoder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageFilter.h deleted file mode 100644 index e2240916d4054d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageFilter.h +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageFilter_DEFINED -#define SkImageFilter_DEFINED - -#include "include/core/SkFlattenable.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkRect.h" - -class SkColorFilter; - -/** - * Base class for image filters. If one is installed in the paint, then all drawing occurs as - * usual, but it is as if the drawing happened into an offscreen (before the xfermode is applied). - * This offscreen bitmap will then be handed to the imagefilter, who in turn creates a new bitmap - * which is what will finally be drawn to the device (using the original xfermode). - * - * The local space of image filters matches the local space of the drawn geometry. For instance if - * there is rotation on the canvas, the blur will be computed along those rotated axes and not in - * the device space. In order to achieve this result, the actual drawing of the geometry may happen - * in an unrotated coordinate system so that the filtered image can be computed more easily, and - * then it will be post transformed to match what would have been produced if the geometry were - * drawn with the total canvas matrix to begin with. - */ -class SK_API SkImageFilter : public SkFlattenable { -public: - enum MapDirection { - kForward_MapDirection, - kReverse_MapDirection, - }; - /** - * Map a device-space rect recursively forward or backward through the filter DAG. - * kForward_MapDirection is used to determine which pixels of the destination canvas a source - * image rect would touch after filtering. kReverse_MapDirection is used to determine which rect - * of the source image would be required to fill the given rect (typically, clip bounds). Used - * for clipping and temp-buffer allocations, so the result need not be exact, but should never - * be smaller than the real answer. The default implementation recursively unions all input - * bounds, or returns the source rect if no inputs. - * - * In kReverse mode, 'inputRect' is the device-space bounds of the input pixels. In kForward - * mode it should always be null. If 'inputRect' is null in kReverse mode the resulting answer - * may be incorrect. - */ - SkIRect filterBounds(const SkIRect& src, const SkMatrix& ctm, - MapDirection, const SkIRect* inputRect = nullptr) const; - - /** - * Returns whether this image filter is a color filter and puts the color filter into the - * "filterPtr" parameter if it can. Does nothing otherwise. - * If this returns false, then the filterPtr is unchanged. - * If this returns true, then if filterPtr is not null, it must be set to a ref'd colorfitler - * (i.e. it may not be set to NULL). - */ - bool isColorFilterNode(SkColorFilter** filterPtr) const; - - // DEPRECATED : use isColorFilterNode() instead - bool asColorFilter(SkColorFilter** filterPtr) const { - return this->isColorFilterNode(filterPtr); - } - - /** - * Returns true (and optionally returns a ref'd filter) if this imagefilter can be completely - * replaced by the returned colorfilter. i.e. the two effects will affect drawing in the same - * way. - */ - bool asAColorFilter(SkColorFilter** filterPtr) const; - - /** - * Returns the number of inputs this filter will accept (some inputs can be NULL). - */ - int countInputs() const; - - /** - * Returns the input filter at a given index, or NULL if no input is connected. The indices - * used are filter-specific. - */ - const SkImageFilter* getInput(int i) const; - - // Default impl returns union of all input bounds. - virtual SkRect computeFastBounds(const SkRect& bounds) const; - - // Can this filter DAG compute the resulting bounds of an object-space rectangle? - bool canComputeFastBounds() const; - - /** - * If this filter can be represented by another filter + a localMatrix, return that filter, - * else return null. - */ - sk_sp makeWithLocalMatrix(const SkMatrix& matrix) const; - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr) { - return sk_sp(static_cast( - SkFlattenable::Deserialize(kSkImageFilter_Type, data, size, procs).release())); - } - -protected: - - sk_sp refMe() const { - return sk_ref_sp(const_cast(this)); - } - -private: - friend class SkImageFilter_Base; - - using INHERITED = SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageGenerator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageGenerator.h deleted file mode 100644 index 42125214e7167d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageGenerator.h +++ /dev/null @@ -1,226 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageGenerator_DEFINED -#define SkImageGenerator_DEFINED - -#include "include/core/SkBitmap.h" -#include "include/core/SkColor.h" -#include "include/core/SkImage.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkSurfaceProps.h" -#include "include/core/SkYUVAPixmaps.h" - -#include - -class GrRecordingContext; -class GrSurfaceProxyView; -class GrSamplerState; -class SkBitmap; -class SkData; -class SkMatrix; -class SkPaint; -class SkPicture; - -enum class GrImageTexGenPolicy : int; - -#if SK_GRAPHITE_ENABLED -namespace skgpu::graphite { -enum class Mipmapped : bool; -class Recorder; -} -#endif - -class SK_API SkImageGenerator { -public: - /** - * The PixelRef which takes ownership of this SkImageGenerator - * will call the image generator's destructor. - */ - virtual ~SkImageGenerator() { } - - uint32_t uniqueID() const { return fUniqueID; } - - /** - * Return a ref to the encoded (i.e. compressed) representation - * of this data. - * - * If non-NULL is returned, the caller is responsible for calling - * unref() on the data when it is finished. - */ - sk_sp refEncodedData() { - return this->onRefEncodedData(); - } - - /** - * Return the ImageInfo associated with this generator. - */ - const SkImageInfo& getInfo() const { return fInfo; } - - /** - * Can this generator be used to produce images that will be drawable to the specified context - * (or to CPU, if context is nullptr)? - */ - bool isValid(GrRecordingContext* context) const { - return this->onIsValid(context); - } - - /** - * Decode into the given pixels, a block of memory of size at - * least (info.fHeight - 1) * rowBytes + (info.fWidth * - * bytesPerPixel) - * - * Repeated calls to this function should give the same results, - * allowing the PixelRef to be immutable. - * - * @param info A description of the format - * expected by the caller. This can simply be identical - * to the info returned by getInfo(). - * - * This contract also allows the caller to specify - * different output-configs, which the implementation can - * decide to support or not. - * - * A size that does not match getInfo() implies a request - * to scale. If the generator cannot perform this scale, - * it will return false. - * - * @return true on success. - */ - bool getPixels(const SkImageInfo& info, void* pixels, size_t rowBytes); - - bool getPixels(const SkPixmap& pm) { - return this->getPixels(pm.info(), pm.writable_addr(), pm.rowBytes()); - } - - /** - * If decoding to YUV is supported, this returns true. Otherwise, this - * returns false and the caller will ignore output parameter yuvaPixmapInfo. - * - * @param supportedDataTypes Indicates the data type/planar config combinations that are - * supported by the caller. If the generator supports decoding to - * YUV(A), but not as a type in supportedDataTypes, this method - * returns false. - * @param yuvaPixmapInfo Output parameter that specifies the planar configuration, subsampling, - * orientation, chroma siting, plane color types, and row bytes. - */ - bool queryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes& supportedDataTypes, - SkYUVAPixmapInfo* yuvaPixmapInfo) const; - - /** - * Returns true on success and false on failure. - * This always attempts to perform a full decode. To get the planar - * configuration without decoding use queryYUVAInfo(). - * - * @param yuvaPixmaps Contains preallocated pixmaps configured according to a successful call - * to queryYUVAInfo(). - */ - bool getYUVAPlanes(const SkYUVAPixmaps& yuvaPixmaps); - -#if SK_SUPPORT_GPU - /** - * If the generator can natively/efficiently return its pixels as a GPU image (backed by a - * texture) this will return that image. If not, this will return NULL. - * - * Regarding the GrRecordingContext parameter: - * - * It must be non-NULL. The generator should only succeed if: - * - its internal context is the same - * - it can somehow convert its texture into one that is valid for the provided context. - * - * If the mipmapped parameter is kYes, the generator should try to create a TextureProxy that - * at least has the mip levels allocated and the base layer filled in. If this is not possible, - * the generator is allowed to return a non mipped proxy, but this will have some additional - * overhead in later allocating mips and copying of the base layer. - * - * GrImageTexGenPolicy determines whether or not a new texture must be created (and its budget - * status) or whether this may (but is not required to) return a pre-existing texture that is - * retained by the generator (kDraw). - */ - GrSurfaceProxyView generateTexture(GrRecordingContext*, - const SkImageInfo& info, - GrMipmapped mipmapped, - GrImageTexGenPolicy); -#endif - -#if SK_GRAPHITE_ENABLED - sk_sp makeTextureImage(skgpu::graphite::Recorder*, - const SkImageInfo&, - skgpu::graphite::Mipmapped); -#endif - - /** - * If the default image decoder system can interpret the specified (encoded) data, then - * this returns a new ImageGenerator for it. Otherwise this returns NULL. Either way - * the caller is still responsible for managing their ownership of the data. - * By default, images will be converted to premultiplied pixels. The alpha type can be - * overridden by specifying kPremul_SkAlphaType or kUnpremul_SkAlphaType. Specifying - * kOpaque_SkAlphaType is not supported, and will return NULL. - */ - static std::unique_ptr MakeFromEncoded( - sk_sp, std::optional = std::nullopt); - - /** Return a new image generator backed by the specified picture. If the size is empty or - * the picture is NULL, this returns NULL. - * The optional matrix and paint arguments are passed to drawPicture() at rasterization - * time. - */ - static std::unique_ptr MakeFromPicture(const SkISize&, sk_sp, - const SkMatrix*, const SkPaint*, - SkImage::BitDepth, - sk_sp, - SkSurfaceProps props = {}); - -protected: - static constexpr int kNeedNewImageUniqueID = 0; - - SkImageGenerator(const SkImageInfo& info, uint32_t uniqueId = kNeedNewImageUniqueID); - - virtual sk_sp onRefEncodedData() { return nullptr; } - struct Options {}; - virtual bool onGetPixels(const SkImageInfo&, void*, size_t, const Options&) { return false; } - virtual bool onIsValid(GrRecordingContext*) const { return true; } - virtual bool onQueryYUVAInfo(const SkYUVAPixmapInfo::SupportedDataTypes&, - SkYUVAPixmapInfo*) const { return false; } - virtual bool onGetYUVAPlanes(const SkYUVAPixmaps&) { return false; } -#if SK_SUPPORT_GPU - // returns nullptr - virtual GrSurfaceProxyView onGenerateTexture(GrRecordingContext*, const SkImageInfo&, - GrMipmapped, GrImageTexGenPolicy); - - // Most internal SkImageGenerators produce textures and views that use kTopLeft_GrSurfaceOrigin. - // If the generator may produce textures with different origins (e.g. - // GrAHardwareBufferImageGenerator) it should override this function to return the correct - // origin. - virtual GrSurfaceOrigin origin() const { return kTopLeft_GrSurfaceOrigin; } -#endif - -#if SK_GRAPHITE_ENABLED - virtual sk_sp onMakeTextureImage(skgpu::graphite::Recorder*, - const SkImageInfo&, - skgpu::graphite::Mipmapped); -#endif - -private: - const SkImageInfo fInfo; - const uint32_t fUniqueID; - - friend class SkImage_Lazy; - - // This is our default impl, which may be different on different platforms. - // It is called from NewFromEncoded() after it has checked for any runtime factory. - // The SkData will never be NULL, as that will have been checked by NewFromEncoded. - static std::unique_ptr MakeFromEncodedImpl(sk_sp, - std::optional); - - SkImageGenerator(SkImageGenerator&&) = delete; - SkImageGenerator(const SkImageGenerator&) = delete; - SkImageGenerator& operator=(SkImageGenerator&&) = delete; - SkImageGenerator& operator=(const SkImageGenerator&) = delete; -}; - -#endif // SkImageGenerator_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageInfo.h deleted file mode 100644 index 9befe3071fb2bc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkImageInfo.h +++ /dev/null @@ -1,614 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageInfo_DEFINED -#define SkImageInfo_DEFINED - -#include "include/core/SkAlphaType.h" -#include "include/core/SkColorType.h" -#include "include/core/SkMath.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" - -#include "include/private/SkTFitsIn.h" -#include "include/private/SkTo.h" - -class SkReadBuffer; -class SkWriteBuffer; -class SkColorSpace; - -/** Returns the number of bytes required to store a pixel, including unused padding. - Returns zero if ct is kUnknown_SkColorType or invalid. - - @return bytes per pixel -*/ -SK_API int SkColorTypeBytesPerPixel(SkColorType ct); - -/** Returns true if SkColorType always decodes alpha to 1.0, making the pixel - fully opaque. If true, SkColorType does not reserve bits to encode alpha. - - @return true if alpha is always set to 1.0 -*/ -SK_API bool SkColorTypeIsAlwaysOpaque(SkColorType ct); - -/** Returns true if canonical can be set to a valid SkAlphaType for colorType. If - there is more than one valid canonical SkAlphaType, set to alphaType, if valid. - If true is returned and canonical is not nullptr, store valid SkAlphaType. - - Returns false only if alphaType is kUnknown_SkAlphaType, color type is not - kUnknown_SkColorType, and SkColorType is not always opaque. If false is returned, - canonical is ignored. - - @param canonical storage for SkAlphaType - @return true if valid SkAlphaType can be associated with colorType -*/ -SK_API bool SkColorTypeValidateAlphaType(SkColorType colorType, SkAlphaType alphaType, - SkAlphaType* canonical = nullptr); - -/** \enum SkImageInfo::SkYUVColorSpace - Describes color range of YUV pixels. The color mapping from YUV to RGB varies - depending on the source. YUV pixels may be generated by JPEG images, standard - video streams, or high definition video streams. Each has its own mapping from - YUV to RGB. - - JPEG YUV values encode the full range of 0 to 255 for all three components. - Video YUV values often range from 16 to 235 for Y and from 16 to 240 for U and V (limited). - Details of encoding and conversion to RGB are described in YCbCr color space. - - The identity colorspace exists to provide a utility mapping from Y to R, U to G and V to B. - It can be used to visualize the YUV planes or to explicitly post process the YUV channels. -*/ -enum SkYUVColorSpace : int { - kJPEG_Full_SkYUVColorSpace, //!< describes full range - kRec601_Limited_SkYUVColorSpace, //!< describes SDTV range - kRec709_Full_SkYUVColorSpace, //!< describes HDTV range - kRec709_Limited_SkYUVColorSpace, - kBT2020_8bit_Full_SkYUVColorSpace, //!< describes UHDTV range, non-constant-luminance - kBT2020_8bit_Limited_SkYUVColorSpace, - kBT2020_10bit_Full_SkYUVColorSpace, - kBT2020_10bit_Limited_SkYUVColorSpace, - kBT2020_12bit_Full_SkYUVColorSpace, - kBT2020_12bit_Limited_SkYUVColorSpace, - kIdentity_SkYUVColorSpace, //!< maps Y->R, U->G, V->B - - kLastEnum_SkYUVColorSpace = kIdentity_SkYUVColorSpace, //!< last valid value - - // Legacy (deprecated) names: - kJPEG_SkYUVColorSpace = kJPEG_Full_SkYUVColorSpace, - kRec601_SkYUVColorSpace = kRec601_Limited_SkYUVColorSpace, - kRec709_SkYUVColorSpace = kRec709_Limited_SkYUVColorSpace, - kBT2020_SkYUVColorSpace = kBT2020_8bit_Limited_SkYUVColorSpace, -}; - -/** \struct SkColorInfo - Describes pixel and encoding. SkImageInfo can be created from SkColorInfo by - providing dimensions. - - It encodes how pixel bits describe alpha, transparency; color components red, blue, - and green; and SkColorSpace, the range and linearity of colors. -*/ -class SK_API SkColorInfo { -public: - /** Creates an SkColorInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, - and no SkColorSpace. - - @return empty SkImageInfo - */ - SkColorInfo(); - ~SkColorInfo(); - - /** Creates SkColorInfo from SkColorType ct, SkAlphaType at, and optionally SkColorSpace cs. - - If SkColorSpace cs is nullptr and SkColorInfo is part of drawing source: SkColorSpace - defaults to sRGB, mapping into SkSurface SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - @return created SkColorInfo - */ - SkColorInfo(SkColorType ct, SkAlphaType at, sk_sp cs); - - SkColorInfo(const SkColorInfo&); - SkColorInfo(SkColorInfo&&); - - SkColorInfo& operator=(const SkColorInfo&); - SkColorInfo& operator=(SkColorInfo&&); - - SkColorSpace* colorSpace() const; - sk_sp refColorSpace() const; - SkColorType colorType() const { return fColorType; } - SkAlphaType alphaType() const { return fAlphaType; } - - bool isOpaque() const { - return SkAlphaTypeIsOpaque(fAlphaType) - || SkColorTypeIsAlwaysOpaque(fColorType); - } - - bool gammaCloseToSRGB() const; - - /** Does other represent the same color type, alpha type, and color space? */ - bool operator==(const SkColorInfo& other) const; - - /** Does other represent a different color type, alpha type, or color space? */ - bool operator!=(const SkColorInfo& other) const; - - /** Creates SkColorInfo with same SkColorType, SkColorSpace, with SkAlphaType set - to newAlphaType. - - Created SkColorInfo contains newAlphaType even if it is incompatible with - SkColorType, in which case SkAlphaType in SkColorInfo is ignored. - */ - SkColorInfo makeAlphaType(SkAlphaType newAlphaType) const; - - /** Creates new SkColorInfo with same SkAlphaType, SkColorSpace, with SkColorType - set to newColorType. - */ - SkColorInfo makeColorType(SkColorType newColorType) const; - - /** Creates SkColorInfo with same SkAlphaType, SkColorType, with SkColorSpace - set to cs. cs may be nullptr. - */ - SkColorInfo makeColorSpace(sk_sp cs) const; - - /** Returns number of bytes per pixel required by SkColorType. - Returns zero if colorType() is kUnknown_SkColorType. - - @return bytes in pixel - - example: https://fiddle.skia.org/c/@ImageInfo_bytesPerPixel - */ - int bytesPerPixel() const; - - /** Returns bit shift converting row bytes to row pixels. - Returns zero for kUnknown_SkColorType. - - @return one of: 0, 1, 2, 3, 4; left shift to convert pixels to bytes - - example: https://fiddle.skia.org/c/@ImageInfo_shiftPerPixel - */ - int shiftPerPixel() const; - -private: - sk_sp fColorSpace; - SkColorType fColorType = kUnknown_SkColorType; - SkAlphaType fAlphaType = kUnknown_SkAlphaType; -}; - -/** \struct SkImageInfo - Describes pixel dimensions and encoding. SkBitmap, SkImage, PixMap, and SkSurface - can be created from SkImageInfo. SkImageInfo can be retrieved from SkBitmap and - SkPixmap, but not from SkImage and SkSurface. For example, SkImage and SkSurface - implementations may defer pixel depth, so may not completely specify SkImageInfo. - - SkImageInfo contains dimensions, the pixel integral width and height. It encodes - how pixel bits describe alpha, transparency; color components red, blue, - and green; and SkColorSpace, the range and linearity of colors. -*/ -struct SK_API SkImageInfo { -public: - - /** Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, - a width and height of zero, and no SkColorSpace. - - @return empty SkImageInfo - */ - SkImageInfo() = default; - - /** Creates SkImageInfo from integral dimensions width and height, SkColorType ct, - SkAlphaType at, and optionally SkColorSpace cs. - - If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace - defaults to sRGB, mapping into SkSurface SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @param cs range of colors; may be nullptr - @return created SkImageInfo - */ - static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at); - static SkImageInfo Make(int width, int height, SkColorType ct, SkAlphaType at, - sk_sp cs); - static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at); - static SkImageInfo Make(SkISize dimensions, SkColorType ct, SkAlphaType at, - sk_sp cs); - - /** Creates SkImageInfo from integral dimensions and SkColorInfo colorInfo, - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param dimensions pixel column and row count; must be zeros or greater - @param SkColorInfo the pixel encoding consisting of SkColorType, SkAlphaType, and - SkColorSpace (which may be nullptr) - @return created SkImageInfo - */ - static SkImageInfo Make(SkISize dimensions, const SkColorInfo& colorInfo) { - return SkImageInfo(dimensions, colorInfo); - } - static SkImageInfo Make(SkISize dimensions, SkColorInfo&& colorInfo) { - return SkImageInfo(dimensions, std::move(colorInfo)); - } - - /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, - SkAlphaType at, and optionally SkColorSpace cs. kN32_SkColorType will equal either - kBGRA_8888_SkColorType or kRGBA_8888_SkColorType, whichever is optimal. - - If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace - defaults to sRGB, mapping into SkSurface SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @param cs range of colors; may be nullptr - @return created SkImageInfo - */ - static SkImageInfo MakeN32(int width, int height, SkAlphaType at); - static SkImageInfo MakeN32(int width, int height, SkAlphaType at, sk_sp cs); - - /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, - SkAlphaType at, with sRGB SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @return created SkImageInfo - - example: https://fiddle.skia.org/c/@ImageInfo_MakeS32 - */ - static SkImageInfo MakeS32(int width, int height, SkAlphaType at); - - /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, - kPremul_SkAlphaType, with optional SkColorSpace. - - If SkColorSpace cs is nullptr and SkImageInfo is part of drawing source: SkColorSpace - defaults to sRGB, mapping into SkSurface SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @param cs range of colors; may be nullptr - @return created SkImageInfo - */ - static SkImageInfo MakeN32Premul(int width, int height); - static SkImageInfo MakeN32Premul(int width, int height, sk_sp cs); - - /** Creates SkImageInfo from integral dimensions width and height, kN32_SkColorType, - kPremul_SkAlphaType, with SkColorSpace set to nullptr. - - If SkImageInfo is part of drawing source: SkColorSpace defaults to sRGB, mapping - into SkSurface SkColorSpace. - - Parameters are not validated to see if their values are legal, or that the - combination is supported. - - @param dimensions width and height, each must be zero or greater - @param cs range of colors; may be nullptr - @return created SkImageInfo - */ - static SkImageInfo MakeN32Premul(SkISize dimensions); - static SkImageInfo MakeN32Premul(SkISize dimensions, sk_sp cs); - - /** Creates SkImageInfo from integral dimensions width and height, kAlpha_8_SkColorType, - kPremul_SkAlphaType, with SkColorSpace set to nullptr. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @return created SkImageInfo - */ - static SkImageInfo MakeA8(int width, int height); - /** Creates SkImageInfo from integral dimensions, kAlpha_8_SkColorType, - kPremul_SkAlphaType, with SkColorSpace set to nullptr. - - @param dimensions pixel row and column count; must be zero or greater - @return created SkImageInfo - */ - static SkImageInfo MakeA8(SkISize dimensions); - - /** Creates SkImageInfo from integral dimensions width and height, kUnknown_SkColorType, - kUnknown_SkAlphaType, with SkColorSpace set to nullptr. - - Returned SkImageInfo as part of source does not draw, and as part of destination - can not be drawn to. - - @param width pixel column count; must be zero or greater - @param height pixel row count; must be zero or greater - @return created SkImageInfo - */ - static SkImageInfo MakeUnknown(int width, int height); - - /** Creates SkImageInfo from integral dimensions width and height set to zero, - kUnknown_SkColorType, kUnknown_SkAlphaType, with SkColorSpace set to nullptr. - - Returned SkImageInfo as part of source does not draw, and as part of destination - can not be drawn to. - - @return created SkImageInfo - */ - static SkImageInfo MakeUnknown() { - return MakeUnknown(0, 0); - } - - /** Returns pixel count in each row. - - @return pixel width - */ - int width() const { return fDimensions.width(); } - - /** Returns pixel row count. - - @return pixel height - */ - int height() const { return fDimensions.height(); } - - SkColorType colorType() const { return fColorInfo.colorType(); } - - SkAlphaType alphaType() const { return fColorInfo.alphaType(); } - - /** Returns SkColorSpace, the range of colors. The reference count of - SkColorSpace is unchanged. The returned SkColorSpace is immutable. - - @return SkColorSpace, or nullptr - */ - SkColorSpace* colorSpace() const; - - /** Returns smart pointer to SkColorSpace, the range of colors. The smart pointer - tracks the number of objects sharing this SkColorSpace reference so the memory - is released when the owners destruct. - - The returned SkColorSpace is immutable. - - @return SkColorSpace wrapped in a smart pointer - */ - sk_sp refColorSpace() const; - - /** Returns if SkImageInfo describes an empty area of pixels by checking if either - width or height is zero or smaller. - - @return true if either dimension is zero or smaller - */ - bool isEmpty() const { return fDimensions.isEmpty(); } - - /** Returns the dimensionless SkColorInfo that represents the same color type, - alpha type, and color space as this SkImageInfo. - */ - const SkColorInfo& colorInfo() const { return fColorInfo; } - - /** Returns true if SkAlphaType is set to hint that all pixels are opaque; their - alpha value is implicitly or explicitly 1.0. If true, and all pixels are - not opaque, Skia may draw incorrectly. - - Does not check if SkColorType allows alpha, or if any pixel value has - transparency. - - @return true if SkAlphaType is kOpaque_SkAlphaType - */ - bool isOpaque() const { return fColorInfo.isOpaque(); } - - /** Returns SkISize { width(), height() }. - - @return integral size of width() and height() - */ - SkISize dimensions() const { return fDimensions; } - - /** Returns SkIRect { 0, 0, width(), height() }. - - @return integral rectangle from origin to width() and height() - */ - SkIRect bounds() const { return SkIRect::MakeSize(fDimensions); } - - /** Returns true if associated SkColorSpace is not nullptr, and SkColorSpace gamma - is approximately the same as sRGB. - This includes the - - @return true if SkColorSpace gamma is approximately the same as sRGB - */ - bool gammaCloseToSRGB() const { return fColorInfo.gammaCloseToSRGB(); } - - /** Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType, - with dimensions set to width and height. - - @param newWidth pixel column count; must be zero or greater - @param newHeight pixel row count; must be zero or greater - @return created SkImageInfo - */ - SkImageInfo makeWH(int newWidth, int newHeight) const { - return Make({newWidth, newHeight}, fColorInfo); - } - - /** Creates SkImageInfo with the same SkColorType, SkColorSpace, and SkAlphaType, - with dimensions set to newDimensions. - - @param newSize pixel column and row count; must be zero or greater - @return created SkImageInfo - */ - SkImageInfo makeDimensions(SkISize newSize) const { - return Make(newSize, fColorInfo); - } - - /** Creates SkImageInfo with same SkColorType, SkColorSpace, width, and height, - with SkAlphaType set to newAlphaType. - - Created SkImageInfo contains newAlphaType even if it is incompatible with - SkColorType, in which case SkAlphaType in SkImageInfo is ignored. - - @return created SkImageInfo - */ - SkImageInfo makeAlphaType(SkAlphaType newAlphaType) const { - return Make(fDimensions, fColorInfo.makeAlphaType(newAlphaType)); - } - - /** Creates SkImageInfo with same SkAlphaType, SkColorSpace, width, and height, - with SkColorType set to newColorType. - - @return created SkImageInfo - */ - SkImageInfo makeColorType(SkColorType newColorType) const { - return Make(fDimensions, fColorInfo.makeColorType(newColorType)); - } - - /** Creates SkImageInfo with same SkAlphaType, SkColorType, width, and height, - with SkColorSpace set to cs. - - @param cs range of colors; may be nullptr - @return created SkImageInfo - */ - SkImageInfo makeColorSpace(sk_sp cs) const; - - /** Returns number of bytes per pixel required by SkColorType. - Returns zero if colorType( is kUnknown_SkColorType. - - @return bytes in pixel - */ - int bytesPerPixel() const { return fColorInfo.bytesPerPixel(); } - - /** Returns bit shift converting row bytes to row pixels. - Returns zero for kUnknown_SkColorType. - - @return one of: 0, 1, 2, 3; left shift to convert pixels to bytes - */ - int shiftPerPixel() const { return fColorInfo.shiftPerPixel(); } - - /** Returns minimum bytes per row, computed from pixel width() and SkColorType, which - specifies bytesPerPixel(). SkBitmap maximum value for row bytes must fit - in 31 bits. - - @return width() times bytesPerPixel() as unsigned 64-bit integer - */ - uint64_t minRowBytes64() const { - return (uint64_t)sk_64_mul(this->width(), this->bytesPerPixel()); - } - - /** Returns minimum bytes per row, computed from pixel width() and SkColorType, which - specifies bytesPerPixel(). SkBitmap maximum value for row bytes must fit - in 31 bits. - - @return width() times bytesPerPixel() as size_t - */ - size_t minRowBytes() const { - uint64_t minRowBytes = this->minRowBytes64(); - if (!SkTFitsIn(minRowBytes)) { - return 0; - } - return (size_t)minRowBytes; - } - - /** Returns byte offset of pixel from pixel base address. - - Asserts in debug build if x or y is outside of bounds. Does not assert if - rowBytes is smaller than minRowBytes(), even though result may be incorrect. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @param rowBytes size of pixel row or larger - @return offset within pixel array - - example: https://fiddle.skia.org/c/@ImageInfo_computeOffset - */ - size_t computeOffset(int x, int y, size_t rowBytes) const; - - /** Compares SkImageInfo with other, and returns true if width, height, SkColorType, - SkAlphaType, and SkColorSpace are equivalent. - - @param other SkImageInfo to compare - @return true if SkImageInfo equals other - */ - bool operator==(const SkImageInfo& other) const { - return fDimensions == other.fDimensions && fColorInfo == other.fColorInfo; - } - - /** Compares SkImageInfo with other, and returns true if width, height, SkColorType, - SkAlphaType, and SkColorSpace are not equivalent. - - @param other SkImageInfo to compare - @return true if SkImageInfo is not equal to other - */ - bool operator!=(const SkImageInfo& other) const { - return !(*this == other); - } - - /** Returns storage required by pixel array, given SkImageInfo dimensions, SkColorType, - and rowBytes. rowBytes is assumed to be at least as large as minRowBytes(). - - Returns zero if height is zero. - Returns SIZE_MAX if answer exceeds the range of size_t. - - @param rowBytes size of pixel row or larger - @return memory required by pixel buffer - - example: https://fiddle.skia.org/c/@ImageInfo_computeByteSize - */ - size_t computeByteSize(size_t rowBytes) const; - - /** Returns storage required by pixel array, given SkImageInfo dimensions, and - SkColorType. Uses minRowBytes() to compute bytes for pixel row. - - Returns zero if height is zero. - Returns SIZE_MAX if answer exceeds the range of size_t. - - @return least memory required by pixel buffer - */ - size_t computeMinByteSize() const { - return this->computeByteSize(this->minRowBytes()); - } - - /** Returns true if byteSize equals SIZE_MAX. computeByteSize() and - computeMinByteSize() return SIZE_MAX if size_t can not hold buffer size. - - @param byteSize result of computeByteSize() or computeMinByteSize() - @return true if computeByteSize() or computeMinByteSize() result exceeds size_t - */ - static bool ByteSizeOverflowed(size_t byteSize) { - return SIZE_MAX == byteSize; - } - - /** Returns true if rowBytes is valid for this SkImageInfo. - - @param rowBytes size of pixel row including padding - @return true if rowBytes is large enough to contain pixel row and is properly - aligned - */ - bool validRowBytes(size_t rowBytes) const { - if (rowBytes < this->minRowBytes64()) { - return false; - } - int shift = this->shiftPerPixel(); - size_t alignedRowBytes = rowBytes >> shift << shift; - return alignedRowBytes == rowBytes; - } - - /** Creates an empty SkImageInfo with kUnknown_SkColorType, kUnknown_SkAlphaType, - a width and height of zero, and no SkColorSpace. - */ - void reset() { *this = {}; } - - /** Asserts if internal values are illegal or inconsistent. Only available if - SK_DEBUG is defined at compile time. - */ - SkDEBUGCODE(void validate() const;) - -private: - SkColorInfo fColorInfo; - SkISize fDimensions = {0, 0}; - - SkImageInfo(SkISize dimensions, const SkColorInfo& colorInfo) - : fColorInfo(colorInfo), fDimensions(dimensions) {} - - SkImageInfo(SkISize dimensions, SkColorInfo&& colorInfo) - : fColorInfo(std::move(colorInfo)), fDimensions(dimensions) {} -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkM44.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkM44.h deleted file mode 100644 index 7fdbcb8e820d34..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkM44.h +++ /dev/null @@ -1,427 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkM44_DEFINED -#define SkM44_DEFINED - -#include "include/core/SkMatrix.h" -#include "include/core/SkRect.h" -#include "include/core/SkScalar.h" - -struct SK_API SkV2 { - float x, y; - - bool operator==(const SkV2 v) const { return x == v.x && y == v.y; } - bool operator!=(const SkV2 v) const { return !(*this == v); } - - static SkScalar Dot(SkV2 a, SkV2 b) { return a.x * b.x + a.y * b.y; } - static SkScalar Cross(SkV2 a, SkV2 b) { return a.x * b.y - a.y * b.x; } - static SkV2 Normalize(SkV2 v) { return v * (1.0f / v.length()); } - - SkV2 operator-() const { return {-x, -y}; } - SkV2 operator+(SkV2 v) const { return {x+v.x, y+v.y}; } - SkV2 operator-(SkV2 v) const { return {x-v.x, y-v.y}; } - - SkV2 operator*(SkV2 v) const { return {x*v.x, y*v.y}; } - friend SkV2 operator*(SkV2 v, SkScalar s) { return {v.x*s, v.y*s}; } - friend SkV2 operator*(SkScalar s, SkV2 v) { return {v.x*s, v.y*s}; } - friend SkV2 operator/(SkV2 v, SkScalar s) { return {v.x/s, v.y/s}; } - friend SkV2 operator/(SkScalar s, SkV2 v) { return {s/v.x, s/v.y}; } - - void operator+=(SkV2 v) { *this = *this + v; } - void operator-=(SkV2 v) { *this = *this - v; } - void operator*=(SkV2 v) { *this = *this * v; } - void operator*=(SkScalar s) { *this = *this * s; } - void operator/=(SkScalar s) { *this = *this / s; } - - SkScalar lengthSquared() const { return Dot(*this, *this); } - SkScalar length() const { return SkScalarSqrt(this->lengthSquared()); } - - SkScalar dot(SkV2 v) const { return Dot(*this, v); } - SkScalar cross(SkV2 v) const { return Cross(*this, v); } - SkV2 normalize() const { return Normalize(*this); } - - const float* ptr() const { return &x; } - float* ptr() { return &x; } -}; - -struct SK_API SkV3 { - float x, y, z; - - bool operator==(const SkV3& v) const { - return x == v.x && y == v.y && z == v.z; - } - bool operator!=(const SkV3& v) const { return !(*this == v); } - - static SkScalar Dot(const SkV3& a, const SkV3& b) { return a.x*b.x + a.y*b.y + a.z*b.z; } - static SkV3 Cross(const SkV3& a, const SkV3& b) { - return { a.y*b.z - a.z*b.y, a.z*b.x - a.x*b.z, a.x*b.y - a.y*b.x }; - } - static SkV3 Normalize(const SkV3& v) { return v * (1.0f / v.length()); } - - SkV3 operator-() const { return {-x, -y, -z}; } - SkV3 operator+(const SkV3& v) const { return { x + v.x, y + v.y, z + v.z }; } - SkV3 operator-(const SkV3& v) const { return { x - v.x, y - v.y, z - v.z }; } - - SkV3 operator*(const SkV3& v) const { - return { x*v.x, y*v.y, z*v.z }; - } - friend SkV3 operator*(const SkV3& v, SkScalar s) { - return { v.x*s, v.y*s, v.z*s }; - } - friend SkV3 operator*(SkScalar s, const SkV3& v) { return v*s; } - - void operator+=(SkV3 v) { *this = *this + v; } - void operator-=(SkV3 v) { *this = *this - v; } - void operator*=(SkV3 v) { *this = *this * v; } - void operator*=(SkScalar s) { *this = *this * s; } - - SkScalar lengthSquared() const { return Dot(*this, *this); } - SkScalar length() const { return SkScalarSqrt(Dot(*this, *this)); } - - SkScalar dot(const SkV3& v) const { return Dot(*this, v); } - SkV3 cross(const SkV3& v) const { return Cross(*this, v); } - SkV3 normalize() const { return Normalize(*this); } - - const float* ptr() const { return &x; } - float* ptr() { return &x; } -}; - -struct SK_API SkV4 { - float x, y, z, w; - - bool operator==(const SkV4& v) const { - return x == v.x && y == v.y && z == v.z && w == v.w; - } - bool operator!=(const SkV4& v) const { return !(*this == v); } - - SkV4 operator-() const { return {-x, -y, -z, -w}; } - SkV4 operator+(const SkV4& v) const { return { x + v.x, y + v.y, z + v.z, w + v.w }; } - SkV4 operator-(const SkV4& v) const { return { x - v.x, y - v.y, z - v.z, w - v.w }; } - - SkV4 operator*(const SkV4& v) const { - return { x*v.x, y*v.y, z*v.z, w*v.w }; - } - friend SkV4 operator*(const SkV4& v, SkScalar s) { - return { v.x*s, v.y*s, v.z*s, v.w*s }; - } - friend SkV4 operator*(SkScalar s, const SkV4& v) { return v*s; } - - const float* ptr() const { return &x; } - float* ptr() { return &x; } - - float operator[](int i) const { - SkASSERT(i >= 0 && i < 4); - return this->ptr()[i]; - } - float& operator[](int i) { - SkASSERT(i >= 0 && i < 4); - return this->ptr()[i]; - } -}; - -/** - * 4x4 matrix used by SkCanvas and other parts of Skia. - * - * Skia assumes a right-handed coordinate system: - * +X goes to the right - * +Y goes down - * +Z goes into the screen (away from the viewer) - */ -class SK_API SkM44 { -public: - SkM44(const SkM44& src) = default; - SkM44& operator=(const SkM44& src) = default; - - constexpr SkM44() - : fMat{1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1} - {} - - SkM44(const SkM44& a, const SkM44& b) { - this->setConcat(a, b); - } - - enum Uninitialized_Constructor { - kUninitialized_Constructor - }; - SkM44(Uninitialized_Constructor) {} - - enum NaN_Constructor { - kNaN_Constructor - }; - constexpr SkM44(NaN_Constructor) - : fMat{SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, - SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, - SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, - SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN, SK_ScalarNaN} - {} - - /** - * The constructor parameters are in row-major order. - */ - constexpr SkM44(SkScalar m0, SkScalar m4, SkScalar m8, SkScalar m12, - SkScalar m1, SkScalar m5, SkScalar m9, SkScalar m13, - SkScalar m2, SkScalar m6, SkScalar m10, SkScalar m14, - SkScalar m3, SkScalar m7, SkScalar m11, SkScalar m15) - // fMat is column-major order in memory. - : fMat{m0, m1, m2, m3, - m4, m5, m6, m7, - m8, m9, m10, m11, - m12, m13, m14, m15} - {} - - static SkM44 Rows(const SkV4& r0, const SkV4& r1, const SkV4& r2, const SkV4& r3) { - SkM44 m(kUninitialized_Constructor); - m.setRow(0, r0); - m.setRow(1, r1); - m.setRow(2, r2); - m.setRow(3, r3); - return m; - } - static SkM44 Cols(const SkV4& c0, const SkV4& c1, const SkV4& c2, const SkV4& c3) { - SkM44 m(kUninitialized_Constructor); - m.setCol(0, c0); - m.setCol(1, c1); - m.setCol(2, c2); - m.setCol(3, c3); - return m; - } - - static SkM44 RowMajor(const SkScalar r[16]) { - return SkM44(r[ 0], r[ 1], r[ 2], r[ 3], - r[ 4], r[ 5], r[ 6], r[ 7], - r[ 8], r[ 9], r[10], r[11], - r[12], r[13], r[14], r[15]); - } - static SkM44 ColMajor(const SkScalar c[16]) { - return SkM44(c[0], c[4], c[ 8], c[12], - c[1], c[5], c[ 9], c[13], - c[2], c[6], c[10], c[14], - c[3], c[7], c[11], c[15]); - } - - static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z = 0) { - return SkM44(1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1); - } - - static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z = 1) { - return SkM44(x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1); - } - - static SkM44 Rotate(SkV3 axis, SkScalar radians) { - SkM44 m(kUninitialized_Constructor); - m.setRotate(axis, radians); - return m; - } - - // Scales and translates 'src' to fill 'dst' exactly. - static SkM44 RectToRect(const SkRect& src, const SkRect& dst); - - static SkM44 LookAt(const SkV3& eye, const SkV3& center, const SkV3& up); - static SkM44 Perspective(float near, float far, float angle); - - bool operator==(const SkM44& other) const; - bool operator!=(const SkM44& other) const { - return !(other == *this); - } - - void getColMajor(SkScalar v[]) const { - memcpy(v, fMat, sizeof(fMat)); - } - void getRowMajor(SkScalar v[]) const; - - SkScalar rc(int r, int c) const { - SkASSERT(r >= 0 && r <= 3); - SkASSERT(c >= 0 && c <= 3); - return fMat[c*4 + r]; - } - void setRC(int r, int c, SkScalar value) { - SkASSERT(r >= 0 && r <= 3); - SkASSERT(c >= 0 && c <= 3); - fMat[c*4 + r] = value; - } - - SkV4 row(int i) const { - SkASSERT(i >= 0 && i <= 3); - return {fMat[i + 0], fMat[i + 4], fMat[i + 8], fMat[i + 12]}; - } - SkV4 col(int i) const { - SkASSERT(i >= 0 && i <= 3); - return {fMat[i*4 + 0], fMat[i*4 + 1], fMat[i*4 + 2], fMat[i*4 + 3]}; - } - - void setRow(int i, const SkV4& v) { - SkASSERT(i >= 0 && i <= 3); - fMat[i + 0] = v.x; - fMat[i + 4] = v.y; - fMat[i + 8] = v.z; - fMat[i + 12] = v.w; - } - void setCol(int i, const SkV4& v) { - SkASSERT(i >= 0 && i <= 3); - memcpy(&fMat[i*4], v.ptr(), sizeof(v)); - } - - SkM44& setIdentity() { - *this = { 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1 }; - return *this; - } - - SkM44& setTranslate(SkScalar x, SkScalar y, SkScalar z = 0) { - *this = { 1, 0, 0, x, - 0, 1, 0, y, - 0, 0, 1, z, - 0, 0, 0, 1 }; - return *this; - } - - SkM44& setScale(SkScalar x, SkScalar y, SkScalar z = 1) { - *this = { x, 0, 0, 0, - 0, y, 0, 0, - 0, 0, z, 0, - 0, 0, 0, 1 }; - return *this; - } - - /** - * Set this matrix to rotate about the specified unit-length axis vector, - * by an angle specified by its sin() and cos(). - * - * This does not attempt to verify that axis.length() == 1 or that the sin,cos values - * are correct. - */ - SkM44& setRotateUnitSinCos(SkV3 axis, SkScalar sinAngle, SkScalar cosAngle); - - /** - * Set this matrix to rotate about the specified unit-length axis vector, - * by an angle specified in radians. - * - * This does not attempt to verify that axis.length() == 1. - */ - SkM44& setRotateUnit(SkV3 axis, SkScalar radians) { - return this->setRotateUnitSinCos(axis, SkScalarSin(radians), SkScalarCos(radians)); - } - - /** - * Set this matrix to rotate about the specified axis vector, - * by an angle specified in radians. - * - * Note: axis is not assumed to be unit-length, so it will be normalized internally. - * If axis is already unit-length, call setRotateAboutUnitRadians() instead. - */ - SkM44& setRotate(SkV3 axis, SkScalar radians); - - SkM44& setConcat(const SkM44& a, const SkM44& b); - - friend SkM44 operator*(const SkM44& a, const SkM44& b) { - return SkM44(a, b); - } - - SkM44& preConcat(const SkM44& m) { - return this->setConcat(*this, m); - } - - SkM44& postConcat(const SkM44& m) { - return this->setConcat(m, *this); - } - - /** - * A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 0, 1]. - * For most uses, a bottom row of [0, 0, 0, X] behaves like a non-perspective matrix, though - * it will be categorized as perspective. Calling normalizePerspective() will change the - * matrix such that, if its bottom row was [0, 0, 0, X], it will be changed to [0, 0, 0, 1] - * by scaling the rest of the matrix by 1/X. - * - * | A B C D | | A/X B/X C/X D/X | - * | E F G H | -> | E/X F/X G/X H/X | for X != 0 - * | I J K L | | I/X J/X K/X L/X | - * | 0 0 0 X | | 0 0 0 1 | - */ - void normalizePerspective(); - - /** Returns true if all elements of the matrix are finite. Returns false if any - element is infinity, or NaN. - - @return true if matrix has only finite elements - */ - bool isFinite() const { return SkScalarsAreFinite(fMat, 16); } - - /** If this is invertible, return that in inverse and return true. If it is - * not invertible, return false and leave the inverse parameter unchanged. - */ - bool SK_WARN_UNUSED_RESULT invert(SkM44* inverse) const; - - SkM44 SK_WARN_UNUSED_RESULT transpose() const; - - void dump() const; - - //////////// - - SkV4 map(float x, float y, float z, float w) const; - SkV4 operator*(const SkV4& v) const { - return this->map(v.x, v.y, v.z, v.w); - } - SkV3 operator*(SkV3 v) const { - auto v4 = this->map(v.x, v.y, v.z, 0); - return {v4.x, v4.y, v4.z}; - } - ////////////////////// Converting to/from SkMatrix - - /* When converting from SkM44 to SkMatrix, the third row and - * column is dropped. When converting from SkMatrix to SkM44 - * the third row and column remain as identity: - * [ a b c ] [ a b 0 c ] - * [ d e f ] -> [ d e 0 f ] - * [ g h i ] [ 0 0 1 0 ] - * [ g h 0 i ] - */ - SkMatrix asM33() const { - return SkMatrix::MakeAll(fMat[0], fMat[4], fMat[12], - fMat[1], fMat[5], fMat[13], - fMat[3], fMat[7], fMat[15]); - } - - explicit SkM44(const SkMatrix& src) - : SkM44(src[SkMatrix::kMScaleX], src[SkMatrix::kMSkewX], 0, src[SkMatrix::kMTransX], - src[SkMatrix::kMSkewY], src[SkMatrix::kMScaleY], 0, src[SkMatrix::kMTransY], - 0, 0, 1, 0, - src[SkMatrix::kMPersp0], src[SkMatrix::kMPersp1], 0, src[SkMatrix::kMPersp2]) - {} - - SkM44& preTranslate(SkScalar x, SkScalar y, SkScalar z = 0); - SkM44& postTranslate(SkScalar x, SkScalar y, SkScalar z = 0); - - SkM44& preScale(SkScalar x, SkScalar y); - SkM44& preScale(SkScalar x, SkScalar y, SkScalar z); - SkM44& preConcat(const SkMatrix&); - -private: - /* Stored in column-major. - * Indices - * 0 4 8 12 1 0 0 trans_x - * 1 5 9 13 e.g. 0 1 0 trans_y - * 2 6 10 14 0 0 1 trans_z - * 3 7 11 15 0 0 0 1 - */ - SkScalar fMat[16]; - - friend class SkMatrixPriv; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMallocPixelRef.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMallocPixelRef.h deleted file mode 100644 index cce54b50f47478..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMallocPixelRef.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2008 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMallocPixelRef_DEFINED -#define SkMallocPixelRef_DEFINED - -#include "include/core/SkPixelRef.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" -class SkData; -struct SkImageInfo; - -/** We explicitly use the same allocator for our pixels that SkMask does, - so that we can freely assign memory allocated by one class to the other. -*/ -namespace SkMallocPixelRef { - /** - * Return a new SkMallocPixelRef, automatically allocating storage for the - * pixels. If rowBytes are 0, an optimal value will be chosen automatically. - * If rowBytes is > 0, then it will be respected, or NULL will be returned - * if rowBytes is invalid for the specified info. - * - * All pixel bytes are zeroed. - * - * Returns NULL on failure. - */ - SK_API sk_sp MakeAllocate(const SkImageInfo&, size_t rowBytes); - - /** - * Return a new SkMallocPixelRef that will use the provided SkData and - * rowBytes as pixel storage. The SkData will be ref()ed and on - * destruction of the PixelRef, the SkData will be unref()ed. - * - * Returns NULL on failure. - */ - SK_API sk_sp MakeWithData(const SkImageInfo&, size_t rowBytes, sk_sp data); -} // namespace SkMallocPixelRef -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMaskFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMaskFilter.h deleted file mode 100644 index 3fde51b717e533..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMaskFilter.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMaskFilter_DEFINED -#define SkMaskFilter_DEFINED - -#include "include/core/SkBlurTypes.h" -#include "include/core/SkCoverageMode.h" -#include "include/core/SkFlattenable.h" -#include "include/core/SkScalar.h" - -class SkMatrix; -struct SkRect; - -/** \class SkMaskFilter - - SkMaskFilter is the base class for object that perform transformations on - the mask before drawing it. An example subclass is Blur. -*/ -class SK_API SkMaskFilter : public SkFlattenable { -public: - /** Create a blur maskfilter. - * @param style The SkBlurStyle to use - * @param sigma Standard deviation of the Gaussian blur to apply. Must be > 0. - * @param respectCTM if true the blur's sigma is modified by the CTM. - * @return The new blur maskfilter - */ - static sk_sp MakeBlur(SkBlurStyle style, SkScalar sigma, - bool respectCTM = true); - - /** - * Returns the approximate bounds that would result from filtering the src rect. - * The actual result may be different, but it should be contained within the - * returned bounds. - */ - SkRect approximateFilteredBounds(const SkRect& src) const; - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr); - -private: - static void RegisterFlattenables(); - friend class SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMath.h deleted file mode 100644 index 97352afab9d6f3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMath.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMath_DEFINED -#define SkMath_DEFINED - -#include "include/core/SkTypes.h" - -// 64bit -> 32bit utilities - -// Handy util that can be passed two ints, and will automatically promote to -// 64bits before the multiply, so the caller doesn't have to remember to cast -// e.g. (int64_t)a * b; -static inline int64_t sk_64_mul(int64_t a, int64_t b) { - return a * b; -} - -/////////////////////////////////////////////////////////////////////////////// - -/** - * Returns true if value is a power of 2. Does not explicitly check for - * value <= 0. - */ -template constexpr inline bool SkIsPow2(T value) { - return (value & (value - 1)) == 0; -} - -/////////////////////////////////////////////////////////////////////////////// - -/** - * Return a*b/((1 << shift) - 1), rounding any fractional bits. - * Only valid if a and b are unsigned and <= 32767 and shift is > 0 and <= 8 - */ -static inline unsigned SkMul16ShiftRound(U16CPU a, U16CPU b, int shift) { - SkASSERT(a <= 32767); - SkASSERT(b <= 32767); - SkASSERT(shift > 0 && shift <= 8); - unsigned prod = a*b + (1 << (shift - 1)); - return (prod + (prod >> shift)) >> shift; -} - -/** - * Return a*b/255, rounding any fractional bits. - * Only valid if a and b are unsigned and <= 32767. - */ -static inline U8CPU SkMulDiv255Round(U16CPU a, U16CPU b) { - return SkMul16ShiftRound(a,b,8); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMatrix.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMatrix.h deleted file mode 100644 index 03140760d6f2ba..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMatrix.h +++ /dev/null @@ -1,1986 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMatrix_DEFINED -#define SkMatrix_DEFINED - -#include "include/core/SkRect.h" -#include "include/private/SkMacros.h" -#include "include/private/SkTo.h" - -struct SkRSXform; -struct SkPoint3; - -// Remove when clients are updated to live without this -#define SK_SUPPORT_LEGACY_MATRIX_RECTTORECT - -/** - * When we transform points through a matrix containing perspective (the bottom row is something - * other than 0,0,1), the bruteforce math can produce confusing results (since we might divide - * by 0, or a negative w value). By default, methods that map rects and paths will apply - * perspective clipping, but this can be changed by specifying kYes to those methods. - */ -enum class SkApplyPerspectiveClip { - kNo, //!< Don't pre-clip the geometry before applying the (perspective) matrix - kYes, //!< Do pre-clip the geometry before applying the (perspective) matrix -}; - -/** \class SkMatrix - SkMatrix holds a 3x3 matrix for transforming coordinates. This allows mapping - SkPoint and vectors with translation, scaling, skewing, rotation, and - perspective. - - SkMatrix elements are in row major order. - SkMatrix constexpr default constructs to identity. - - SkMatrix includes a hidden variable that classifies the type of matrix to - improve performance. SkMatrix is not thread safe unless getType() is called first. - - example: https://fiddle.skia.org/c/@Matrix_063 -*/ -SK_BEGIN_REQUIRE_DENSE -class SK_API SkMatrix { -public: - - /** Creates an identity SkMatrix: - - | 1 0 0 | - | 0 1 0 | - | 0 0 1 | - */ - constexpr SkMatrix() : SkMatrix(1,0,0, 0,1,0, 0,0,1, kIdentity_Mask | kRectStaysRect_Mask) {} - - /** Sets SkMatrix to scale by (sx, sy). Returned matrix is: - - | sx 0 0 | - | 0 sy 0 | - | 0 0 1 | - - @param sx horizontal scale factor - @param sy vertical scale factor - @return SkMatrix with scale - */ - static SkMatrix SK_WARN_UNUSED_RESULT Scale(SkScalar sx, SkScalar sy) { - SkMatrix m; - m.setScale(sx, sy); - return m; - } - - /** Sets SkMatrix to translate by (dx, dy). Returned matrix is: - - | 1 0 dx | - | 0 1 dy | - | 0 0 1 | - - @param dx horizontal translation - @param dy vertical translation - @return SkMatrix with translation - */ - static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkScalar dx, SkScalar dy) { - SkMatrix m; - m.setTranslate(dx, dy); - return m; - } - static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkVector t) { return Translate(t.x(), t.y()); } - static SkMatrix SK_WARN_UNUSED_RESULT Translate(SkIVector t) { return Translate(t.x(), t.y()); } - - /** Sets SkMatrix to rotate by |deg| about a pivot point at (0, 0). - - @param deg rotation angle in degrees (positive rotates clockwise) - @return SkMatrix with rotation - */ - static SkMatrix SK_WARN_UNUSED_RESULT RotateDeg(SkScalar deg) { - SkMatrix m; - m.setRotate(deg); - return m; - } - static SkMatrix SK_WARN_UNUSED_RESULT RotateDeg(SkScalar deg, SkPoint pt) { - SkMatrix m; - m.setRotate(deg, pt.x(), pt.y()); - return m; - } - static SkMatrix SK_WARN_UNUSED_RESULT RotateRad(SkScalar rad) { - return RotateDeg(SkRadiansToDegrees(rad)); - } - - /** Sets SkMatrix to skew by (kx, ky) about pivot point (0, 0). - - @param kx horizontal skew factor - @param ky vertical skew factor - @return SkMatrix with skew - */ - static SkMatrix SK_WARN_UNUSED_RESULT Skew(SkScalar kx, SkScalar ky) { - SkMatrix m; - m.setSkew(kx, ky); - return m; - } - - /** \enum SkMatrix::ScaleToFit - ScaleToFit describes how SkMatrix is constructed to map one SkRect to another. - ScaleToFit may allow SkMatrix to have unequal horizontal and vertical scaling, - or may restrict SkMatrix to square scaling. If restricted, ScaleToFit specifies - how SkMatrix maps to the side or center of the destination SkRect. - */ - enum ScaleToFit { - kFill_ScaleToFit, //!< scales in x and y to fill destination SkRect - kStart_ScaleToFit, //!< scales and aligns to left and top - kCenter_ScaleToFit, //!< scales and aligns to center - kEnd_ScaleToFit, //!< scales and aligns to right and bottom - }; - - /** Returns SkMatrix set to scale and translate src to dst. ScaleToFit selects - whether mapping completely fills dst or preserves the aspect ratio, and how to - align src within dst. Returns the identity SkMatrix if src is empty. If dst is - empty, returns SkMatrix set to: - - | 0 0 0 | - | 0 0 0 | - | 0 0 1 | - - @param src SkRect to map from - @param dst SkRect to map to - @param mode How to handle the mapping - @return SkMatrix mapping src to dst - */ - static SkMatrix SK_WARN_UNUSED_RESULT RectToRect(const SkRect& src, const SkRect& dst, - ScaleToFit mode = kFill_ScaleToFit) { - return MakeRectToRect(src, dst, mode); - } - - /** Sets SkMatrix to: - - | scaleX skewX transX | - | skewY scaleY transY | - | pers0 pers1 pers2 | - - @param scaleX horizontal scale factor - @param skewX horizontal skew factor - @param transX horizontal translation - @param skewY vertical skew factor - @param scaleY vertical scale factor - @param transY vertical translation - @param pers0 input x-axis perspective factor - @param pers1 input y-axis perspective factor - @param pers2 perspective scale factor - @return SkMatrix constructed from parameters - */ - static SkMatrix SK_WARN_UNUSED_RESULT MakeAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, - SkScalar skewY, SkScalar scaleY, SkScalar transY, - SkScalar pers0, SkScalar pers1, SkScalar pers2) { - SkMatrix m; - m.setAll(scaleX, skewX, transX, skewY, scaleY, transY, pers0, pers1, pers2); - return m; - } - - /** \enum SkMatrix::TypeMask - Enum of bit fields for mask returned by getType(). - Used to identify the complexity of SkMatrix, to optimize performance. - */ - enum TypeMask { - kIdentity_Mask = 0, //!< identity SkMatrix; all bits clear - kTranslate_Mask = 0x01, //!< translation SkMatrix - kScale_Mask = 0x02, //!< scale SkMatrix - kAffine_Mask = 0x04, //!< skew or rotate SkMatrix - kPerspective_Mask = 0x08, //!< perspective SkMatrix - }; - - /** Returns a bit field describing the transformations the matrix may - perform. The bit field is computed conservatively, so it may include - false positives. For example, when kPerspective_Mask is set, all - other bits are set. - - @return kIdentity_Mask, or combinations of: kTranslate_Mask, kScale_Mask, - kAffine_Mask, kPerspective_Mask - */ - TypeMask getType() const { - if (fTypeMask & kUnknown_Mask) { - fTypeMask = this->computeTypeMask(); - } - // only return the public masks - return (TypeMask)(fTypeMask & 0xF); - } - - /** Returns true if SkMatrix is identity. Identity matrix is: - - | 1 0 0 | - | 0 1 0 | - | 0 0 1 | - - @return true if SkMatrix has no effect - */ - bool isIdentity() const { - return this->getType() == 0; - } - - /** Returns true if SkMatrix at most scales and translates. SkMatrix may be identity, - contain only scale elements, only translate elements, or both. SkMatrix form is: - - | scale-x 0 translate-x | - | 0 scale-y translate-y | - | 0 0 1 | - - @return true if SkMatrix is identity; or scales, translates, or both - */ - bool isScaleTranslate() const { - return !(this->getType() & ~(kScale_Mask | kTranslate_Mask)); - } - - /** Returns true if SkMatrix is identity, or translates. SkMatrix form is: - - | 1 0 translate-x | - | 0 1 translate-y | - | 0 0 1 | - - @return true if SkMatrix is identity, or translates - */ - bool isTranslate() const { return !(this->getType() & ~(kTranslate_Mask)); } - - /** Returns true SkMatrix maps SkRect to another SkRect. If true, SkMatrix is identity, - or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all - cases, SkMatrix may also have translation. SkMatrix form is either: - - | scale-x 0 translate-x | - | 0 scale-y translate-y | - | 0 0 1 | - - or - - | 0 rotate-x translate-x | - | rotate-y 0 translate-y | - | 0 0 1 | - - for non-zero values of scale-x, scale-y, rotate-x, and rotate-y. - - Also called preservesAxisAlignment(); use the one that provides better inline - documentation. - - @return true if SkMatrix maps one SkRect into another - */ - bool rectStaysRect() const { - if (fTypeMask & kUnknown_Mask) { - fTypeMask = this->computeTypeMask(); - } - return (fTypeMask & kRectStaysRect_Mask) != 0; - } - - /** Returns true SkMatrix maps SkRect to another SkRect. If true, SkMatrix is identity, - or scales, or rotates a multiple of 90 degrees, or mirrors on axes. In all - cases, SkMatrix may also have translation. SkMatrix form is either: - - | scale-x 0 translate-x | - | 0 scale-y translate-y | - | 0 0 1 | - - or - - | 0 rotate-x translate-x | - | rotate-y 0 translate-y | - | 0 0 1 | - - for non-zero values of scale-x, scale-y, rotate-x, and rotate-y. - - Also called rectStaysRect(); use the one that provides better inline - documentation. - - @return true if SkMatrix maps one SkRect into another - */ - bool preservesAxisAlignment() const { return this->rectStaysRect(); } - - /** Returns true if the matrix contains perspective elements. SkMatrix form is: - - | -- -- -- | - | -- -- -- | - | perspective-x perspective-y perspective-scale | - - where perspective-x or perspective-y is non-zero, or perspective-scale is - not one. All other elements may have any value. - - @return true if SkMatrix is in most general form - */ - bool hasPerspective() const { - return SkToBool(this->getPerspectiveTypeMaskOnly() & - kPerspective_Mask); - } - - /** Returns true if SkMatrix contains only translation, rotation, reflection, and - uniform scale. - Returns false if SkMatrix contains different scales, skewing, perspective, or - degenerate forms that collapse to a line or point. - - Describes that the SkMatrix makes rendering with and without the matrix are - visually alike; a transformed circle remains a circle. Mathematically, this is - referred to as similarity of a Euclidean space, or a similarity transformation. - - Preserves right angles, keeping the arms of the angle equal lengths. - - @param tol to be deprecated - @return true if SkMatrix only rotates, uniformly scales, translates - - example: https://fiddle.skia.org/c/@Matrix_isSimilarity - */ - bool isSimilarity(SkScalar tol = SK_ScalarNearlyZero) const; - - /** Returns true if SkMatrix contains only translation, rotation, reflection, and - scale. Scale may differ along rotated axes. - Returns false if SkMatrix skewing, perspective, or degenerate forms that collapse - to a line or point. - - Preserves right angles, but not requiring that the arms of the angle - retain equal lengths. - - @param tol to be deprecated - @return true if SkMatrix only rotates, scales, translates - - example: https://fiddle.skia.org/c/@Matrix_preservesRightAngles - */ - bool preservesRightAngles(SkScalar tol = SK_ScalarNearlyZero) const; - - /** SkMatrix organizes its values in row-major order. These members correspond to - each value in SkMatrix. - */ - static constexpr int kMScaleX = 0; //!< horizontal scale factor - static constexpr int kMSkewX = 1; //!< horizontal skew factor - static constexpr int kMTransX = 2; //!< horizontal translation - static constexpr int kMSkewY = 3; //!< vertical skew factor - static constexpr int kMScaleY = 4; //!< vertical scale factor - static constexpr int kMTransY = 5; //!< vertical translation - static constexpr int kMPersp0 = 6; //!< input x perspective factor - static constexpr int kMPersp1 = 7; //!< input y perspective factor - static constexpr int kMPersp2 = 8; //!< perspective bias - - /** Affine arrays are in column-major order to match the matrix used by - PDF and XPS. - */ - static constexpr int kAScaleX = 0; //!< horizontal scale factor - static constexpr int kASkewY = 1; //!< vertical skew factor - static constexpr int kASkewX = 2; //!< horizontal skew factor - static constexpr int kAScaleY = 3; //!< vertical scale factor - static constexpr int kATransX = 4; //!< horizontal translation - static constexpr int kATransY = 5; //!< vertical translation - - /** Returns one matrix value. Asserts if index is out of range and SK_DEBUG is - defined. - - @param index one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, - kMPersp0, kMPersp1, kMPersp2 - @return value corresponding to index - */ - SkScalar operator[](int index) const { - SkASSERT((unsigned)index < 9); - return fMat[index]; - } - - /** Returns one matrix value. Asserts if index is out of range and SK_DEBUG is - defined. - - @param index one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, - kMPersp0, kMPersp1, kMPersp2 - @return value corresponding to index - */ - SkScalar get(int index) const { - SkASSERT((unsigned)index < 9); - return fMat[index]; - } - - /** Returns one matrix value from a particular row/column. Asserts if index is out - of range and SK_DEBUG is defined. - - @param r matrix row to fetch - @param c matrix column to fetch - @return value at the given matrix position - */ - SkScalar rc(int r, int c) const { - SkASSERT(r >= 0 && r <= 2); - SkASSERT(c >= 0 && c <= 2); - return fMat[r*3 + c]; - } - - /** Returns scale factor multiplied by x-axis input, contributing to x-axis output. - With mapPoints(), scales SkPoint along the x-axis. - - @return horizontal scale factor - */ - SkScalar getScaleX() const { return fMat[kMScaleX]; } - - /** Returns scale factor multiplied by y-axis input, contributing to y-axis output. - With mapPoints(), scales SkPoint along the y-axis. - - @return vertical scale factor - */ - SkScalar getScaleY() const { return fMat[kMScaleY]; } - - /** Returns scale factor multiplied by x-axis input, contributing to y-axis output. - With mapPoints(), skews SkPoint along the y-axis. - Skewing both axes can rotate SkPoint. - - @return vertical skew factor - */ - SkScalar getSkewY() const { return fMat[kMSkewY]; } - - /** Returns scale factor multiplied by y-axis input, contributing to x-axis output. - With mapPoints(), skews SkPoint along the x-axis. - Skewing both axes can rotate SkPoint. - - @return horizontal scale factor - */ - SkScalar getSkewX() const { return fMat[kMSkewX]; } - - /** Returns translation contributing to x-axis output. - With mapPoints(), moves SkPoint along the x-axis. - - @return horizontal translation factor - */ - SkScalar getTranslateX() const { return fMat[kMTransX]; } - - /** Returns translation contributing to y-axis output. - With mapPoints(), moves SkPoint along the y-axis. - - @return vertical translation factor - */ - SkScalar getTranslateY() const { return fMat[kMTransY]; } - - /** Returns factor scaling input x-axis relative to input y-axis. - - @return input x-axis perspective factor - */ - SkScalar getPerspX() const { return fMat[kMPersp0]; } - - /** Returns factor scaling input y-axis relative to input x-axis. - - @return input y-axis perspective factor - */ - SkScalar getPerspY() const { return fMat[kMPersp1]; } - - /** Returns writable SkMatrix value. Asserts if index is out of range and SK_DEBUG is - defined. Clears internal cache anticipating that caller will change SkMatrix value. - - Next call to read SkMatrix state may recompute cache; subsequent writes to SkMatrix - value must be followed by dirtyMatrixTypeCache(). - - @param index one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, - kMPersp0, kMPersp1, kMPersp2 - @return writable value corresponding to index - */ - SkScalar& operator[](int index) { - SkASSERT((unsigned)index < 9); - this->setTypeMask(kUnknown_Mask); - return fMat[index]; - } - - /** Sets SkMatrix value. Asserts if index is out of range and SK_DEBUG is - defined. Safer than operator[]; internal cache is always maintained. - - @param index one of: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, - kMPersp0, kMPersp1, kMPersp2 - @param value scalar to store in SkMatrix - */ - SkMatrix& set(int index, SkScalar value) { - SkASSERT((unsigned)index < 9); - fMat[index] = value; - this->setTypeMask(kUnknown_Mask); - return *this; - } - - /** Sets horizontal scale factor. - - @param v horizontal scale factor to store - */ - SkMatrix& setScaleX(SkScalar v) { return this->set(kMScaleX, v); } - - /** Sets vertical scale factor. - - @param v vertical scale factor to store - */ - SkMatrix& setScaleY(SkScalar v) { return this->set(kMScaleY, v); } - - /** Sets vertical skew factor. - - @param v vertical skew factor to store - */ - SkMatrix& setSkewY(SkScalar v) { return this->set(kMSkewY, v); } - - /** Sets horizontal skew factor. - - @param v horizontal skew factor to store - */ - SkMatrix& setSkewX(SkScalar v) { return this->set(kMSkewX, v); } - - /** Sets horizontal translation. - - @param v horizontal translation to store - */ - SkMatrix& setTranslateX(SkScalar v) { return this->set(kMTransX, v); } - - /** Sets vertical translation. - - @param v vertical translation to store - */ - SkMatrix& setTranslateY(SkScalar v) { return this->set(kMTransY, v); } - - /** Sets input x-axis perspective factor, which causes mapXY() to vary input x-axis values - inversely proportional to input y-axis values. - - @param v perspective factor - */ - SkMatrix& setPerspX(SkScalar v) { return this->set(kMPersp0, v); } - - /** Sets input y-axis perspective factor, which causes mapXY() to vary input y-axis values - inversely proportional to input x-axis values. - - @param v perspective factor - */ - SkMatrix& setPerspY(SkScalar v) { return this->set(kMPersp1, v); } - - /** Sets all values from parameters. Sets matrix to: - - | scaleX skewX transX | - | skewY scaleY transY | - | persp0 persp1 persp2 | - - @param scaleX horizontal scale factor to store - @param skewX horizontal skew factor to store - @param transX horizontal translation to store - @param skewY vertical skew factor to store - @param scaleY vertical scale factor to store - @param transY vertical translation to store - @param persp0 input x-axis values perspective factor to store - @param persp1 input y-axis values perspective factor to store - @param persp2 perspective scale factor to store - */ - SkMatrix& setAll(SkScalar scaleX, SkScalar skewX, SkScalar transX, - SkScalar skewY, SkScalar scaleY, SkScalar transY, - SkScalar persp0, SkScalar persp1, SkScalar persp2) { - fMat[kMScaleX] = scaleX; - fMat[kMSkewX] = skewX; - fMat[kMTransX] = transX; - fMat[kMSkewY] = skewY; - fMat[kMScaleY] = scaleY; - fMat[kMTransY] = transY; - fMat[kMPersp0] = persp0; - fMat[kMPersp1] = persp1; - fMat[kMPersp2] = persp2; - this->setTypeMask(kUnknown_Mask); - return *this; - } - - /** Copies nine scalar values contained by SkMatrix into buffer, in member value - ascending order: kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, - kMPersp0, kMPersp1, kMPersp2. - - @param buffer storage for nine scalar values - */ - void get9(SkScalar buffer[9]) const { - memcpy(buffer, fMat, 9 * sizeof(SkScalar)); - } - - /** Sets SkMatrix to nine scalar values in buffer, in member value ascending order: - kMScaleX, kMSkewX, kMTransX, kMSkewY, kMScaleY, kMTransY, kMPersp0, kMPersp1, - kMPersp2. - - Sets matrix to: - - | buffer[0] buffer[1] buffer[2] | - | buffer[3] buffer[4] buffer[5] | - | buffer[6] buffer[7] buffer[8] | - - In the future, set9 followed by get9 may not return the same values. Since SkMatrix - maps non-homogeneous coordinates, scaling all nine values produces an equivalent - transformation, possibly improving precision. - - @param buffer nine scalar values - */ - SkMatrix& set9(const SkScalar buffer[9]); - - /** Sets SkMatrix to identity; which has no effect on mapped SkPoint. Sets SkMatrix to: - - | 1 0 0 | - | 0 1 0 | - | 0 0 1 | - - Also called setIdentity(); use the one that provides better inline - documentation. - */ - SkMatrix& reset(); - - /** Sets SkMatrix to identity; which has no effect on mapped SkPoint. Sets SkMatrix to: - - | 1 0 0 | - | 0 1 0 | - | 0 0 1 | - - Also called reset(); use the one that provides better inline - documentation. - */ - SkMatrix& setIdentity() { return this->reset(); } - - /** Sets SkMatrix to translate by (dx, dy). - - @param dx horizontal translation - @param dy vertical translation - */ - SkMatrix& setTranslate(SkScalar dx, SkScalar dy); - - /** Sets SkMatrix to translate by (v.fX, v.fY). - - @param v vector containing horizontal and vertical translation - */ - SkMatrix& setTranslate(const SkVector& v) { return this->setTranslate(v.fX, v.fY); } - - /** Sets SkMatrix to scale by sx and sy, about a pivot point at (px, py). - The pivot point is unchanged when mapped with SkMatrix. - - @param sx horizontal scale factor - @param sy vertical scale factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& setScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py); - - /** Sets SkMatrix to scale by sx and sy about at pivot point at (0, 0). - - @param sx horizontal scale factor - @param sy vertical scale factor - */ - SkMatrix& setScale(SkScalar sx, SkScalar sy); - - /** Sets SkMatrix to rotate by degrees about a pivot point at (px, py). - The pivot point is unchanged when mapped with SkMatrix. - - Positive degrees rotates clockwise. - - @param degrees angle of axes relative to upright axes - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& setRotate(SkScalar degrees, SkScalar px, SkScalar py); - - /** Sets SkMatrix to rotate by degrees about a pivot point at (0, 0). - Positive degrees rotates clockwise. - - @param degrees angle of axes relative to upright axes - */ - SkMatrix& setRotate(SkScalar degrees); - - /** Sets SkMatrix to rotate by sinValue and cosValue, about a pivot point at (px, py). - The pivot point is unchanged when mapped with SkMatrix. - - Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - Vector length specifies scale. - - @param sinValue rotation vector x-axis component - @param cosValue rotation vector y-axis component - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& setSinCos(SkScalar sinValue, SkScalar cosValue, - SkScalar px, SkScalar py); - - /** Sets SkMatrix to rotate by sinValue and cosValue, about a pivot point at (0, 0). - - Vector (sinValue, cosValue) describes the angle of rotation relative to (0, 1). - Vector length specifies scale. - - @param sinValue rotation vector x-axis component - @param cosValue rotation vector y-axis component - */ - SkMatrix& setSinCos(SkScalar sinValue, SkScalar cosValue); - - /** Sets SkMatrix to rotate, scale, and translate using a compressed matrix form. - - Vector (rsxForm.fSSin, rsxForm.fSCos) describes the angle of rotation relative - to (0, 1). Vector length specifies scale. Mapped point is rotated and scaled - by vector, then translated by (rsxForm.fTx, rsxForm.fTy). - - @param rsxForm compressed SkRSXform matrix - @return reference to SkMatrix - - example: https://fiddle.skia.org/c/@Matrix_setRSXform - */ - SkMatrix& setRSXform(const SkRSXform& rsxForm); - - /** Sets SkMatrix to skew by kx and ky, about a pivot point at (px, py). - The pivot point is unchanged when mapped with SkMatrix. - - @param kx horizontal skew factor - @param ky vertical skew factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& setSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py); - - /** Sets SkMatrix to skew by kx and ky, about a pivot point at (0, 0). - - @param kx horizontal skew factor - @param ky vertical skew factor - */ - SkMatrix& setSkew(SkScalar kx, SkScalar ky); - - /** Sets SkMatrix to SkMatrix a multiplied by SkMatrix b. Either a or b may be this. - - Given: - - | A B C | | J K L | - a = | D E F |, b = | M N O | - | G H I | | P Q R | - - sets SkMatrix to: - - | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - - @param a SkMatrix on left side of multiply expression - @param b SkMatrix on right side of multiply expression - */ - SkMatrix& setConcat(const SkMatrix& a, const SkMatrix& b); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from translation (dx, dy). - This can be thought of as moving the point to be mapped before applying SkMatrix. - - Given: - - | A B C | | 1 0 dx | - Matrix = | D E F |, T(dx, dy) = | 0 1 dy | - | G H I | | 0 0 1 | - - sets SkMatrix to: - - | A B C | | 1 0 dx | | A B A*dx+B*dy+C | - Matrix * T(dx, dy) = | D E F | | 0 1 dy | = | D E D*dx+E*dy+F | - | G H I | | 0 0 1 | | G H G*dx+H*dy+I | - - @param dx x-axis translation before applying SkMatrix - @param dy y-axis translation before applying SkMatrix - */ - SkMatrix& preTranslate(SkScalar dx, SkScalar dy); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from scaling by (sx, sy) - about pivot point (px, py). - This can be thought of as scaling about a pivot point before applying SkMatrix. - - Given: - - | A B C | | sx 0 dx | - Matrix = | D E F |, S(sx, sy, px, py) = | 0 sy dy | - | G H I | | 0 0 1 | - - where - - dx = px - sx * px - dy = py - sy * py - - sets SkMatrix to: - - | A B C | | sx 0 dx | | A*sx B*sy A*dx+B*dy+C | - Matrix * S(sx, sy, px, py) = | D E F | | 0 sy dy | = | D*sx E*sy D*dx+E*dy+F | - | G H I | | 0 0 1 | | G*sx H*sy G*dx+H*dy+I | - - @param sx horizontal scale factor - @param sy vertical scale factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& preScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from scaling by (sx, sy) - about pivot point (0, 0). - This can be thought of as scaling about the origin before applying SkMatrix. - - Given: - - | A B C | | sx 0 0 | - Matrix = | D E F |, S(sx, sy) = | 0 sy 0 | - | G H I | | 0 0 1 | - - sets SkMatrix to: - - | A B C | | sx 0 0 | | A*sx B*sy C | - Matrix * S(sx, sy) = | D E F | | 0 sy 0 | = | D*sx E*sy F | - | G H I | | 0 0 1 | | G*sx H*sy I | - - @param sx horizontal scale factor - @param sy vertical scale factor - */ - SkMatrix& preScale(SkScalar sx, SkScalar sy); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from rotating by degrees - about pivot point (px, py). - This can be thought of as rotating about a pivot point before applying SkMatrix. - - Positive degrees rotates clockwise. - - Given: - - | A B C | | c -s dx | - Matrix = | D E F |, R(degrees, px, py) = | s c dy | - | G H I | | 0 0 1 | - - where - - c = cos(degrees) - s = sin(degrees) - dx = s * py + (1 - c) * px - dy = -s * px + (1 - c) * py - - sets SkMatrix to: - - | A B C | | c -s dx | | Ac+Bs -As+Bc A*dx+B*dy+C | - Matrix * R(degrees, px, py) = | D E F | | s c dy | = | Dc+Es -Ds+Ec D*dx+E*dy+F | - | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc G*dx+H*dy+I | - - @param degrees angle of axes relative to upright axes - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& preRotate(SkScalar degrees, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from rotating by degrees - about pivot point (0, 0). - This can be thought of as rotating about the origin before applying SkMatrix. - - Positive degrees rotates clockwise. - - Given: - - | A B C | | c -s 0 | - Matrix = | D E F |, R(degrees, px, py) = | s c 0 | - | G H I | | 0 0 1 | - - where - - c = cos(degrees) - s = sin(degrees) - - sets SkMatrix to: - - | A B C | | c -s 0 | | Ac+Bs -As+Bc C | - Matrix * R(degrees, px, py) = | D E F | | s c 0 | = | Dc+Es -Ds+Ec F | - | G H I | | 0 0 1 | | Gc+Hs -Gs+Hc I | - - @param degrees angle of axes relative to upright axes - */ - SkMatrix& preRotate(SkScalar degrees); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from skewing by (kx, ky) - about pivot point (px, py). - This can be thought of as skewing about a pivot point before applying SkMatrix. - - Given: - - | A B C | | 1 kx dx | - Matrix = | D E F |, K(kx, ky, px, py) = | ky 1 dy | - | G H I | | 0 0 1 | - - where - - dx = -kx * py - dy = -ky * px - - sets SkMatrix to: - - | A B C | | 1 kx dx | | A+B*ky A*kx+B A*dx+B*dy+C | - Matrix * K(kx, ky, px, py) = | D E F | | ky 1 dy | = | D+E*ky D*kx+E D*dx+E*dy+F | - | G H I | | 0 0 1 | | G+H*ky G*kx+H G*dx+H*dy+I | - - @param kx horizontal skew factor - @param ky vertical skew factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& preSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix constructed from skewing by (kx, ky) - about pivot point (0, 0). - This can be thought of as skewing about the origin before applying SkMatrix. - - Given: - - | A B C | | 1 kx 0 | - Matrix = | D E F |, K(kx, ky) = | ky 1 0 | - | G H I | | 0 0 1 | - - sets SkMatrix to: - - | A B C | | 1 kx 0 | | A+B*ky A*kx+B C | - Matrix * K(kx, ky) = | D E F | | ky 1 0 | = | D+E*ky D*kx+E F | - | G H I | | 0 0 1 | | G+H*ky G*kx+H I | - - @param kx horizontal skew factor - @param ky vertical skew factor - */ - SkMatrix& preSkew(SkScalar kx, SkScalar ky); - - /** Sets SkMatrix to SkMatrix multiplied by SkMatrix other. - This can be thought of mapping by other before applying SkMatrix. - - Given: - - | A B C | | J K L | - Matrix = | D E F |, other = | M N O | - | G H I | | P Q R | - - sets SkMatrix to: - - | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - Matrix * other = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - - @param other SkMatrix on right side of multiply expression - */ - SkMatrix& preConcat(const SkMatrix& other); - - /** Sets SkMatrix to SkMatrix constructed from translation (dx, dy) multiplied by SkMatrix. - This can be thought of as moving the point to be mapped after applying SkMatrix. - - Given: - - | J K L | | 1 0 dx | - Matrix = | M N O |, T(dx, dy) = | 0 1 dy | - | P Q R | | 0 0 1 | - - sets SkMatrix to: - - | 1 0 dx | | J K L | | J+dx*P K+dx*Q L+dx*R | - T(dx, dy) * Matrix = | 0 1 dy | | M N O | = | M+dy*P N+dy*Q O+dy*R | - | 0 0 1 | | P Q R | | P Q R | - - @param dx x-axis translation after applying SkMatrix - @param dy y-axis translation after applying SkMatrix - */ - SkMatrix& postTranslate(SkScalar dx, SkScalar dy); - - /** Sets SkMatrix to SkMatrix constructed from scaling by (sx, sy) about pivot point - (px, py), multiplied by SkMatrix. - This can be thought of as scaling about a pivot point after applying SkMatrix. - - Given: - - | J K L | | sx 0 dx | - Matrix = | M N O |, S(sx, sy, px, py) = | 0 sy dy | - | P Q R | | 0 0 1 | - - where - - dx = px - sx * px - dy = py - sy * py - - sets SkMatrix to: - - | sx 0 dx | | J K L | | sx*J+dx*P sx*K+dx*Q sx*L+dx+R | - S(sx, sy, px, py) * Matrix = | 0 sy dy | | M N O | = | sy*M+dy*P sy*N+dy*Q sy*O+dy*R | - | 0 0 1 | | P Q R | | P Q R | - - @param sx horizontal scale factor - @param sy vertical scale factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& postScale(SkScalar sx, SkScalar sy, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix constructed from scaling by (sx, sy) about pivot point - (0, 0), multiplied by SkMatrix. - This can be thought of as scaling about the origin after applying SkMatrix. - - Given: - - | J K L | | sx 0 0 | - Matrix = | M N O |, S(sx, sy) = | 0 sy 0 | - | P Q R | | 0 0 1 | - - sets SkMatrix to: - - | sx 0 0 | | J K L | | sx*J sx*K sx*L | - S(sx, sy) * Matrix = | 0 sy 0 | | M N O | = | sy*M sy*N sy*O | - | 0 0 1 | | P Q R | | P Q R | - - @param sx horizontal scale factor - @param sy vertical scale factor - */ - SkMatrix& postScale(SkScalar sx, SkScalar sy); - - /** Sets SkMatrix to SkMatrix constructed from rotating by degrees about pivot point - (px, py), multiplied by SkMatrix. - This can be thought of as rotating about a pivot point after applying SkMatrix. - - Positive degrees rotates clockwise. - - Given: - - | J K L | | c -s dx | - Matrix = | M N O |, R(degrees, px, py) = | s c dy | - | P Q R | | 0 0 1 | - - where - - c = cos(degrees) - s = sin(degrees) - dx = s * py + (1 - c) * px - dy = -s * px + (1 - c) * py - - sets SkMatrix to: - - |c -s dx| |J K L| |cJ-sM+dx*P cK-sN+dx*Q cL-sO+dx+R| - R(degrees, px, py) * Matrix = |s c dy| |M N O| = |sJ+cM+dy*P sK+cN+dy*Q sL+cO+dy*R| - |0 0 1| |P Q R| | P Q R| - - @param degrees angle of axes relative to upright axes - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& postRotate(SkScalar degrees, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix constructed from rotating by degrees about pivot point - (0, 0), multiplied by SkMatrix. - This can be thought of as rotating about the origin after applying SkMatrix. - - Positive degrees rotates clockwise. - - Given: - - | J K L | | c -s 0 | - Matrix = | M N O |, R(degrees, px, py) = | s c 0 | - | P Q R | | 0 0 1 | - - where - - c = cos(degrees) - s = sin(degrees) - - sets SkMatrix to: - - | c -s dx | | J K L | | cJ-sM cK-sN cL-sO | - R(degrees, px, py) * Matrix = | s c dy | | M N O | = | sJ+cM sK+cN sL+cO | - | 0 0 1 | | P Q R | | P Q R | - - @param degrees angle of axes relative to upright axes - */ - SkMatrix& postRotate(SkScalar degrees); - - /** Sets SkMatrix to SkMatrix constructed from skewing by (kx, ky) about pivot point - (px, py), multiplied by SkMatrix. - This can be thought of as skewing about a pivot point after applying SkMatrix. - - Given: - - | J K L | | 1 kx dx | - Matrix = | M N O |, K(kx, ky, px, py) = | ky 1 dy | - | P Q R | | 0 0 1 | - - where - - dx = -kx * py - dy = -ky * px - - sets SkMatrix to: - - | 1 kx dx| |J K L| |J+kx*M+dx*P K+kx*N+dx*Q L+kx*O+dx+R| - K(kx, ky, px, py) * Matrix = |ky 1 dy| |M N O| = |ky*J+M+dy*P ky*K+N+dy*Q ky*L+O+dy*R| - | 0 0 1| |P Q R| | P Q R| - - @param kx horizontal skew factor - @param ky vertical skew factor - @param px pivot on x-axis - @param py pivot on y-axis - */ - SkMatrix& postSkew(SkScalar kx, SkScalar ky, SkScalar px, SkScalar py); - - /** Sets SkMatrix to SkMatrix constructed from skewing by (kx, ky) about pivot point - (0, 0), multiplied by SkMatrix. - This can be thought of as skewing about the origin after applying SkMatrix. - - Given: - - | J K L | | 1 kx 0 | - Matrix = | M N O |, K(kx, ky) = | ky 1 0 | - | P Q R | | 0 0 1 | - - sets SkMatrix to: - - | 1 kx 0 | | J K L | | J+kx*M K+kx*N L+kx*O | - K(kx, ky) * Matrix = | ky 1 0 | | M N O | = | ky*J+M ky*K+N ky*L+O | - | 0 0 1 | | P Q R | | P Q R | - - @param kx horizontal skew factor - @param ky vertical skew factor - */ - SkMatrix& postSkew(SkScalar kx, SkScalar ky); - - /** Sets SkMatrix to SkMatrix other multiplied by SkMatrix. - This can be thought of mapping by other after applying SkMatrix. - - Given: - - | J K L | | A B C | - Matrix = | M N O |, other = | D E F | - | P Q R | | G H I | - - sets SkMatrix to: - - | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - other * Matrix = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - - @param other SkMatrix on left side of multiply expression - */ - SkMatrix& postConcat(const SkMatrix& other); - -#ifndef SK_SUPPORT_LEGACY_MATRIX_RECTTORECT -private: -#endif - /** Sets SkMatrix to scale and translate src SkRect to dst SkRect. stf selects whether - mapping completely fills dst or preserves the aspect ratio, and how to align - src within dst. Returns false if src is empty, and sets SkMatrix to identity. - Returns true if dst is empty, and sets SkMatrix to: - - | 0 0 0 | - | 0 0 0 | - | 0 0 1 | - - @param src SkRect to map from - @param dst SkRect to map to - @return true if SkMatrix can represent SkRect mapping - - example: https://fiddle.skia.org/c/@Matrix_setRectToRect - */ - bool setRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf); - - /** Returns SkMatrix set to scale and translate src SkRect to dst SkRect. stf selects - whether mapping completely fills dst or preserves the aspect ratio, and how to - align src within dst. Returns the identity SkMatrix if src is empty. If dst is - empty, returns SkMatrix set to: - - | 0 0 0 | - | 0 0 0 | - | 0 0 1 | - - @param src SkRect to map from - @param dst SkRect to map to - @return SkMatrix mapping src to dst - */ - static SkMatrix MakeRectToRect(const SkRect& src, const SkRect& dst, ScaleToFit stf) { - SkMatrix m; - m.setRectToRect(src, dst, stf); - return m; - } -#ifndef SK_SUPPORT_LEGACY_MATRIX_RECTTORECT -public: -#endif - - /** Sets SkMatrix to map src to dst. count must be zero or greater, and four or less. - - If count is zero, sets SkMatrix to identity and returns true. - If count is one, sets SkMatrix to translate and returns true. - If count is two or more, sets SkMatrix to map SkPoint if possible; returns false - if SkMatrix cannot be constructed. If count is four, SkMatrix may include - perspective. - - @param src SkPoint to map from - @param dst SkPoint to map to - @param count number of SkPoint in src and dst - @return true if SkMatrix was constructed successfully - - example: https://fiddle.skia.org/c/@Matrix_setPolyToPoly - */ - bool setPolyToPoly(const SkPoint src[], const SkPoint dst[], int count); - - /** Sets inverse to reciprocal matrix, returning true if SkMatrix can be inverted. - Geometrically, if SkMatrix maps from source to destination, inverse SkMatrix - maps from destination to source. If SkMatrix can not be inverted, inverse is - unchanged. - - @param inverse storage for inverted SkMatrix; may be nullptr - @return true if SkMatrix can be inverted - */ - bool SK_WARN_UNUSED_RESULT invert(SkMatrix* inverse) const { - // Allow the trivial case to be inlined. - if (this->isIdentity()) { - if (inverse) { - inverse->reset(); - } - return true; - } - return this->invertNonIdentity(inverse); - } - - /** Fills affine with identity values in column major order. - Sets affine to: - - | 1 0 0 | - | 0 1 0 | - - Affine 3 by 2 matrices in column major order are used by OpenGL and XPS. - - @param affine storage for 3 by 2 affine matrix - - example: https://fiddle.skia.org/c/@Matrix_SetAffineIdentity - */ - static void SetAffineIdentity(SkScalar affine[6]); - - /** Fills affine in column major order. Sets affine to: - - | scale-x skew-x translate-x | - | skew-y scale-y translate-y | - - If SkMatrix contains perspective, returns false and leaves affine unchanged. - - @param affine storage for 3 by 2 affine matrix; may be nullptr - @return true if SkMatrix does not contain perspective - */ - bool SK_WARN_UNUSED_RESULT asAffine(SkScalar affine[6]) const; - - /** Sets SkMatrix to affine values, passed in column major order. Given affine, - column, then row, as: - - | scale-x skew-x translate-x | - | skew-y scale-y translate-y | - - SkMatrix is set, row, then column, to: - - | scale-x skew-x translate-x | - | skew-y scale-y translate-y | - | 0 0 1 | - - @param affine 3 by 2 affine matrix - */ - SkMatrix& setAffine(const SkScalar affine[6]); - - /** - * A matrix is categorized as 'perspective' if the bottom row is not [0, 0, 1]. - * However, for most uses (e.g. mapPoints) a bottom row of [0, 0, X] behaves like a - * non-perspective matrix, though it will be categorized as perspective. Calling - * normalizePerspective() will change the matrix such that, if its bottom row was [0, 0, X], - * it will be changed to [0, 0, 1] by scaling the rest of the matrix by 1/X. - * - * | A B C | | A/X B/X C/X | - * | D E F | -> | D/X E/X F/X | for X != 0 - * | 0 0 X | | 0 0 1 | - */ - void normalizePerspective() { - if (fMat[8] != 1) { - this->doNormalizePerspective(); - } - } - - /** Maps src SkPoint array of length count to dst SkPoint array of equal or greater - length. SkPoint are mapped by multiplying each SkPoint by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - where - - for (i = 0; i < count; ++i) { - x = src[i].fX - y = src[i].fY - } - - each dst SkPoint is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - src and dst may point to the same storage. - - @param dst storage for mapped SkPoint - @param src SkPoint to transform - @param count number of SkPoint to transform - - example: https://fiddle.skia.org/c/@Matrix_mapPoints - */ - void mapPoints(SkPoint dst[], const SkPoint src[], int count) const; - - /** Maps pts SkPoint array of length count in place. SkPoint are mapped by multiplying - each SkPoint by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - where - - for (i = 0; i < count; ++i) { - x = pts[i].fX - y = pts[i].fY - } - - each resulting pts SkPoint is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param pts storage for mapped SkPoint - @param count number of SkPoint to transform - */ - void mapPoints(SkPoint pts[], int count) const { - this->mapPoints(pts, pts, count); - } - - /** Maps src SkPoint3 array of length count to dst SkPoint3 array, which must of length count or - greater. SkPoint3 array is mapped by multiplying each SkPoint3 by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, src = | y | - | G H I | | z | - - each resulting dst SkPoint is computed as: - - |A B C| |x| - Matrix * src = |D E F| |y| = |Ax+By+Cz Dx+Ey+Fz Gx+Hy+Iz| - |G H I| |z| - - @param dst storage for mapped SkPoint3 array - @param src SkPoint3 array to transform - @param count items in SkPoint3 array to transform - - example: https://fiddle.skia.org/c/@Matrix_mapHomogeneousPoints - */ - void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const; - - /** - * Returns homogeneous points, starting with 2D src points (with implied w = 1). - */ - void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint src[], int count) const; - - /** Returns SkPoint pt multiplied by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - result is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param p SkPoint to map - @return mapped SkPoint - */ - SkPoint mapPoint(SkPoint pt) const { - SkPoint result; - this->mapXY(pt.x(), pt.y(), &result); - return result; - } - - /** Maps SkPoint (x, y) to result. SkPoint is mapped by multiplying by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - result is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param x x-axis value of SkPoint to map - @param y y-axis value of SkPoint to map - @param result storage for mapped SkPoint - - example: https://fiddle.skia.org/c/@Matrix_mapXY - */ - void mapXY(SkScalar x, SkScalar y, SkPoint* result) const; - - /** Returns SkPoint (x, y) multiplied by SkMatrix. Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - result is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param x x-axis value of SkPoint to map - @param y y-axis value of SkPoint to map - @return mapped SkPoint - */ - SkPoint mapXY(SkScalar x, SkScalar y) const { - SkPoint result; - this->mapXY(x,y, &result); - return result; - } - - - /** Returns (0, 0) multiplied by SkMatrix. Given: - - | A B C | | 0 | - Matrix = | D E F |, pt = | 0 | - | G H I | | 1 | - - result is computed as: - - |A B C| |0| C F - Matrix * pt = |D E F| |0| = |C F I| = - , - - |G H I| |1| I I - - @return mapped (0, 0) - */ - SkPoint mapOrigin() const { - SkScalar x = this->getTranslateX(), - y = this->getTranslateY(); - if (this->hasPerspective()) { - SkScalar w = fMat[kMPersp2]; - if (w) { w = 1 / w; } - x *= w; - y *= w; - } - return {x, y}; - } - - /** Maps src vector array of length count to vector SkPoint array of equal or greater - length. Vectors are mapped by multiplying each vector by SkMatrix, treating - SkMatrix translation as zero. Given: - - | A B 0 | | x | - Matrix = | D E 0 |, src = | y | - | G H I | | 1 | - - where - - for (i = 0; i < count; ++i) { - x = src[i].fX - y = src[i].fY - } - - each dst vector is computed as: - - |A B 0| |x| Ax+By Dx+Ey - Matrix * src = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - src and dst may point to the same storage. - - @param dst storage for mapped vectors - @param src vectors to transform - @param count number of vectors to transform - - example: https://fiddle.skia.org/c/@Matrix_mapVectors - */ - void mapVectors(SkVector dst[], const SkVector src[], int count) const; - - /** Maps vecs vector array of length count in place, multiplying each vector by - SkMatrix, treating SkMatrix translation as zero. Given: - - | A B 0 | | x | - Matrix = | D E 0 |, vec = | y | - | G H I | | 1 | - - where - - for (i = 0; i < count; ++i) { - x = vecs[i].fX - y = vecs[i].fY - } - - each result vector is computed as: - - |A B 0| |x| Ax+By Dx+Ey - Matrix * vec = |D E 0| |y| = |Ax+By Dx+Ey Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param vecs vectors to transform, and storage for mapped vectors - @param count number of vectors to transform - */ - void mapVectors(SkVector vecs[], int count) const { - this->mapVectors(vecs, vecs, count); - } - - /** Maps vector (dx, dy) to result. Vector is mapped by multiplying by SkMatrix, - treating SkMatrix translation as zero. Given: - - | A B 0 | | dx | - Matrix = | D E 0 |, vec = | dy | - | G H I | | 1 | - - each result vector is computed as: - - |A B 0| |dx| A*dx+B*dy D*dx+E*dy - Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , ----------- - |G H I| | 1| G*dx+H*dy+I G*dx+*dHy+I - - @param dx x-axis value of vector to map - @param dy y-axis value of vector to map - @param result storage for mapped vector - */ - void mapVector(SkScalar dx, SkScalar dy, SkVector* result) const { - SkVector vec = { dx, dy }; - this->mapVectors(result, &vec, 1); - } - - /** Returns vector (dx, dy) multiplied by SkMatrix, treating SkMatrix translation as zero. - Given: - - | A B 0 | | dx | - Matrix = | D E 0 |, vec = | dy | - | G H I | | 1 | - - each result vector is computed as: - - |A B 0| |dx| A*dx+B*dy D*dx+E*dy - Matrix * vec = |D E 0| |dy| = |A*dx+B*dy D*dx+E*dy G*dx+H*dy+I| = ----------- , ----------- - |G H I| | 1| G*dx+H*dy+I G*dx+*dHy+I - - @param dx x-axis value of vector to map - @param dy y-axis value of vector to map - @return mapped vector - */ - SkVector mapVector(SkScalar dx, SkScalar dy) const { - SkVector vec = { dx, dy }; - this->mapVectors(&vec, &vec, 1); - return vec; - } - - /** Sets dst to bounds of src corners mapped by SkMatrix. - Returns true if mapped corners are dst corners. - - Returned value is the same as calling rectStaysRect(). - - @param dst storage for bounds of mapped SkPoint - @param src SkRect to map - @param pc whether to apply perspective clipping - @return true if dst is equivalent to mapped src - - example: https://fiddle.skia.org/c/@Matrix_mapRect - */ - bool mapRect(SkRect* dst, const SkRect& src, - SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const; - - /** Sets rect to bounds of rect corners mapped by SkMatrix. - Returns true if mapped corners are computed rect corners. - - Returned value is the same as calling rectStaysRect(). - - @param rect rectangle to map, and storage for bounds of mapped corners - @param pc whether to apply perspective clipping - @return true if result is equivalent to mapped rect - */ - bool mapRect(SkRect* rect, SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const { - return this->mapRect(rect, *rect, pc); - } - - /** Returns bounds of src corners mapped by SkMatrix. - - @param src rectangle to map - @return mapped bounds - */ - SkRect mapRect(const SkRect& src, - SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const { - SkRect dst; - (void)this->mapRect(&dst, src, pc); - return dst; - } - - /** Maps four corners of rect to dst. SkPoint are mapped by multiplying each - rect corner by SkMatrix. rect corner is processed in this order: - (rect.fLeft, rect.fTop), (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom), - (rect.fLeft, rect.fBottom). - - rect may be empty: rect.fLeft may be greater than or equal to rect.fRight; - rect.fTop may be greater than or equal to rect.fBottom. - - Given: - - | A B C | | x | - Matrix = | D E F |, pt = | y | - | G H I | | 1 | - - where pt is initialized from each of (rect.fLeft, rect.fTop), - (rect.fRight, rect.fTop), (rect.fRight, rect.fBottom), (rect.fLeft, rect.fBottom), - each dst SkPoint is computed as: - - |A B C| |x| Ax+By+C Dx+Ey+F - Matrix * pt = |D E F| |y| = |Ax+By+C Dx+Ey+F Gx+Hy+I| = ------- , ------- - |G H I| |1| Gx+Hy+I Gx+Hy+I - - @param dst storage for mapped corner SkPoint - @param rect SkRect to map - - Note: this does not perform perspective clipping (as that might result in more than - 4 points, so results are suspect if the matrix contains perspective. - */ - void mapRectToQuad(SkPoint dst[4], const SkRect& rect) const { - // This could potentially be faster if we only transformed each x and y of the rect once. - rect.toQuad(dst); - this->mapPoints(dst, 4); - } - - /** Sets dst to bounds of src corners mapped by SkMatrix. If matrix contains - elements other than scale or translate: asserts if SK_DEBUG is defined; - otherwise, results are undefined. - - @param dst storage for bounds of mapped SkPoint - @param src SkRect to map - - example: https://fiddle.skia.org/c/@Matrix_mapRectScaleTranslate - */ - void mapRectScaleTranslate(SkRect* dst, const SkRect& src) const; - - /** Returns geometric mean radius of ellipse formed by constructing circle of - size radius, and mapping constructed circle with SkMatrix. The result squared is - equal to the major axis length times the minor axis length. - Result is not meaningful if SkMatrix contains perspective elements. - - @param radius circle size to map - @return average mapped radius - - example: https://fiddle.skia.org/c/@Matrix_mapRadius - */ - SkScalar mapRadius(SkScalar radius) const; - - /** Compares a and b; returns true if a and b are numerically equal. Returns true - even if sign of zero values are different. Returns false if either SkMatrix - contains NaN, even if the other SkMatrix also contains NaN. - - @param a SkMatrix to compare - @param b SkMatrix to compare - @return true if SkMatrix a and SkMatrix b are numerically equal - */ - friend SK_API bool operator==(const SkMatrix& a, const SkMatrix& b); - - /** Compares a and b; returns true if a and b are not numerically equal. Returns false - even if sign of zero values are different. Returns true if either SkMatrix - contains NaN, even if the other SkMatrix also contains NaN. - - @param a SkMatrix to compare - @param b SkMatrix to compare - @return true if SkMatrix a and SkMatrix b are numerically not equal - */ - friend SK_API bool operator!=(const SkMatrix& a, const SkMatrix& b) { - return !(a == b); - } - - /** Writes text representation of SkMatrix to standard output. Floating point values - are written with limited precision; it may not be possible to reconstruct - original SkMatrix from output. - - example: https://fiddle.skia.org/c/@Matrix_dump - */ - void dump() const; - - /** Returns the minimum scaling factor of SkMatrix by decomposing the scaling and - skewing elements. - Returns -1 if scale factor overflows or SkMatrix contains perspective. - - @return minimum scale factor - - example: https://fiddle.skia.org/c/@Matrix_getMinScale - */ - SkScalar getMinScale() const; - - /** Returns the maximum scaling factor of SkMatrix by decomposing the scaling and - skewing elements. - Returns -1 if scale factor overflows or SkMatrix contains perspective. - - @return maximum scale factor - - example: https://fiddle.skia.org/c/@Matrix_getMaxScale - */ - SkScalar getMaxScale() const; - - /** Sets scaleFactors[0] to the minimum scaling factor, and scaleFactors[1] to the - maximum scaling factor. Scaling factors are computed by decomposing - the SkMatrix scaling and skewing elements. - - Returns true if scaleFactors are found; otherwise, returns false and sets - scaleFactors to undefined values. - - @param scaleFactors storage for minimum and maximum scale factors - @return true if scale factors were computed correctly - */ - bool SK_WARN_UNUSED_RESULT getMinMaxScales(SkScalar scaleFactors[2]) const; - - /** Decomposes SkMatrix into scale components and whatever remains. Returns false if - SkMatrix could not be decomposed. - - Sets scale to portion of SkMatrix that scale axes. Sets remaining to SkMatrix - with scaling factored out. remaining may be passed as nullptr - to determine if SkMatrix can be decomposed without computing remainder. - - Returns true if scale components are found. scale and remaining are - unchanged if SkMatrix contains perspective; scale factors are not finite, or - are nearly zero. - - On success: Matrix = Remaining * scale. - - @param scale axes scaling factors; may be nullptr - @param remaining SkMatrix without scaling; may be nullptr - @return true if scale can be computed - - example: https://fiddle.skia.org/c/@Matrix_decomposeScale - */ - bool decomposeScale(SkSize* scale, SkMatrix* remaining = nullptr) const; - - /** Returns reference to const identity SkMatrix. Returned SkMatrix is set to: - - | 1 0 0 | - | 0 1 0 | - | 0 0 1 | - - @return const identity SkMatrix - - example: https://fiddle.skia.org/c/@Matrix_I - */ - static const SkMatrix& I(); - - /** Returns reference to a const SkMatrix with invalid values. Returned SkMatrix is set - to: - - | SK_ScalarMax SK_ScalarMax SK_ScalarMax | - | SK_ScalarMax SK_ScalarMax SK_ScalarMax | - | SK_ScalarMax SK_ScalarMax SK_ScalarMax | - - @return const invalid SkMatrix - - example: https://fiddle.skia.org/c/@Matrix_InvalidMatrix - */ - static const SkMatrix& InvalidMatrix(); - - /** Returns SkMatrix a multiplied by SkMatrix b. - - Given: - - | A B C | | J K L | - a = | D E F |, b = | M N O | - | G H I | | P Q R | - - sets SkMatrix to: - - | A B C | | J K L | | AJ+BM+CP AK+BN+CQ AL+BO+CR | - a * b = | D E F | * | M N O | = | DJ+EM+FP DK+EN+FQ DL+EO+FR | - | G H I | | P Q R | | GJ+HM+IP GK+HN+IQ GL+HO+IR | - - @param a SkMatrix on left side of multiply expression - @param b SkMatrix on right side of multiply expression - @return SkMatrix computed from a times b - */ - static SkMatrix Concat(const SkMatrix& a, const SkMatrix& b) { - SkMatrix result; - result.setConcat(a, b); - return result; - } - - friend SkMatrix operator*(const SkMatrix& a, const SkMatrix& b) { - return Concat(a, b); - } - - /** Sets internal cache to unknown state. Use to force update after repeated - modifications to SkMatrix element reference returned by operator[](int index). - */ - void dirtyMatrixTypeCache() { - this->setTypeMask(kUnknown_Mask); - } - - /** Initializes SkMatrix with scale and translate elements. - - | sx 0 tx | - | 0 sy ty | - | 0 0 1 | - - @param sx horizontal scale factor to store - @param sy vertical scale factor to store - @param tx horizontal translation to store - @param ty vertical translation to store - */ - void setScaleTranslate(SkScalar sx, SkScalar sy, SkScalar tx, SkScalar ty) { - fMat[kMScaleX] = sx; - fMat[kMSkewX] = 0; - fMat[kMTransX] = tx; - - fMat[kMSkewY] = 0; - fMat[kMScaleY] = sy; - fMat[kMTransY] = ty; - - fMat[kMPersp0] = 0; - fMat[kMPersp1] = 0; - fMat[kMPersp2] = 1; - - int mask = 0; - if (sx != 1 || sy != 1) { - mask |= kScale_Mask; - } - if (tx != 0.0f || ty != 0.0f) { - mask |= kTranslate_Mask; - } - this->setTypeMask(mask | kRectStaysRect_Mask); - } - - /** Returns true if all elements of the matrix are finite. Returns false if any - element is infinity, or NaN. - - @return true if matrix has only finite elements - */ - bool isFinite() const { return SkScalarsAreFinite(fMat, 9); } - -private: - /** Set if the matrix will map a rectangle to another rectangle. This - can be true if the matrix is scale-only, or rotates a multiple of - 90 degrees. - - This bit will be set on identity matrices - */ - static constexpr int kRectStaysRect_Mask = 0x10; - - /** Set if the perspective bit is valid even though the rest of - the matrix is Unknown. - */ - static constexpr int kOnlyPerspectiveValid_Mask = 0x40; - - static constexpr int kUnknown_Mask = 0x80; - - static constexpr int kORableMasks = kTranslate_Mask | - kScale_Mask | - kAffine_Mask | - kPerspective_Mask; - - static constexpr int kAllMasks = kTranslate_Mask | - kScale_Mask | - kAffine_Mask | - kPerspective_Mask | - kRectStaysRect_Mask; - - SkScalar fMat[9]; - mutable int32_t fTypeMask; - - constexpr SkMatrix(SkScalar sx, SkScalar kx, SkScalar tx, - SkScalar ky, SkScalar sy, SkScalar ty, - SkScalar p0, SkScalar p1, SkScalar p2, int typeMask) - : fMat{sx, kx, tx, - ky, sy, ty, - p0, p1, p2} - , fTypeMask(typeMask) {} - - static void ComputeInv(SkScalar dst[9], const SkScalar src[9], double invDet, bool isPersp); - - uint8_t computeTypeMask() const; - uint8_t computePerspectiveTypeMask() const; - - void setTypeMask(int mask) { - // allow kUnknown or a valid mask - SkASSERT(kUnknown_Mask == mask || (mask & kAllMasks) == mask || - ((kUnknown_Mask | kOnlyPerspectiveValid_Mask) & mask) - == (kUnknown_Mask | kOnlyPerspectiveValid_Mask)); - fTypeMask = mask; - } - - void orTypeMask(int mask) { - SkASSERT((mask & kORableMasks) == mask); - fTypeMask |= mask; - } - - void clearTypeMask(int mask) { - // only allow a valid mask - SkASSERT((mask & kAllMasks) == mask); - fTypeMask &= ~mask; - } - - TypeMask getPerspectiveTypeMaskOnly() const { - if ((fTypeMask & kUnknown_Mask) && - !(fTypeMask & kOnlyPerspectiveValid_Mask)) { - fTypeMask = this->computePerspectiveTypeMask(); - } - return (TypeMask)(fTypeMask & 0xF); - } - - /** Returns true if we already know that the matrix is identity; - false otherwise. - */ - bool isTriviallyIdentity() const { - if (fTypeMask & kUnknown_Mask) { - return false; - } - return ((fTypeMask & 0xF) == 0); - } - - inline void updateTranslateMask() { - if ((fMat[kMTransX] != 0) | (fMat[kMTransY] != 0)) { - fTypeMask |= kTranslate_Mask; - } else { - fTypeMask &= ~kTranslate_Mask; - } - } - - typedef void (*MapXYProc)(const SkMatrix& mat, SkScalar x, SkScalar y, - SkPoint* result); - - static MapXYProc GetMapXYProc(TypeMask mask) { - SkASSERT((mask & ~kAllMasks) == 0); - return gMapXYProcs[mask & kAllMasks]; - } - - MapXYProc getMapXYProc() const { - return GetMapXYProc(this->getType()); - } - - typedef void (*MapPtsProc)(const SkMatrix& mat, SkPoint dst[], - const SkPoint src[], int count); - - static MapPtsProc GetMapPtsProc(TypeMask mask) { - SkASSERT((mask & ~kAllMasks) == 0); - return gMapPtsProcs[mask & kAllMasks]; - } - - MapPtsProc getMapPtsProc() const { - return GetMapPtsProc(this->getType()); - } - - bool SK_WARN_UNUSED_RESULT invertNonIdentity(SkMatrix* inverse) const; - - static bool Poly2Proc(const SkPoint[], SkMatrix*); - static bool Poly3Proc(const SkPoint[], SkMatrix*); - static bool Poly4Proc(const SkPoint[], SkMatrix*); - - static void Identity_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void Trans_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void Scale_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void ScaleTrans_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void Rot_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void RotTrans_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - static void Persp_xy(const SkMatrix&, SkScalar, SkScalar, SkPoint*); - - static const MapXYProc gMapXYProcs[]; - - static void Identity_pts(const SkMatrix&, SkPoint[], const SkPoint[], int); - static void Trans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); - static void Scale_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); - static void ScaleTrans_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], - int count); - static void Persp_pts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); - - static void Affine_vpts(const SkMatrix&, SkPoint dst[], const SkPoint[], int); - - static const MapPtsProc gMapPtsProcs[]; - - // return the number of bytes written, whether or not buffer is null - size_t writeToMemory(void* buffer) const; - /** - * Reads data from the buffer parameter - * - * @param buffer Memory to read from - * @param length Amount of memory available in the buffer - * @return number of bytes read (must be a multiple of 4) or - * 0 if there was not enough memory available - */ - size_t readFromMemory(const void* buffer, size_t length); - - // legacy method -- still needed? why not just postScale(1/divx, ...)? - bool postIDiv(int divx, int divy); - void doNormalizePerspective(); - - friend class SkPerspIter; - friend class SkMatrixPriv; - friend class SerializationTest; -}; -SK_END_REQUIRE_DENSE - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMesh.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMesh.h deleted file mode 100644 index f34672e3ab05ec..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMesh.h +++ /dev/null @@ -1,389 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMesh_DEFINED -#define SkMesh_DEFINED - -#include "include/core/SkTypes.h" - -#ifdef SK_ENABLE_SKSL -#include "include/core/SkAlphaType.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSpan.h" -#include "include/core/SkString.h" -#include "include/effects/SkRuntimeEffect.h" - -#include -#include - -class GrDirectContext; -class SkColorSpace; -class SkData; - -namespace SkSL { struct Program; } - -/** - * A specification for custom meshes. Specifies the vertex buffer attributes and stride, the - * vertex program that produces a user-defined set of varyings, a fragment program that ingests - * the interpolated varyings and produces local coordinates and optionally a color. - * - * The signature of the vertex program must be: - * float2 main(Attributes, out Varyings) - * where the return value is a local position that will be transformed by SkCanvas's matrix. - * - * The signature of the fragment program must be either: - * (float2|void) main(Varyings) - * or - * (float2|void) main(Varyings, out (half4|float4) color) - * - * where the return value is the local coordinates that will be used to access SkShader. If the - * return type is void then the interpolated position from vertex shader return is used as the local - * coordinate. If the color variant is used it will be blended with SkShader (or SkPaint color in - * absence of a shader) using the SkBlender provided to the SkCanvas draw call. - * - * The vertex and fragment programs may both contain uniforms. Uniforms with the same name are - * assumed to be shared between stages. It is an error to specify uniforms in the vertex and - * fragment program with the same name but different types, dimensionality, or layouts. - */ -class SkMeshSpecification : public SkNVRefCnt { -public: - /** These values are enforced when creating a specification. */ - static constexpr size_t kMaxStride = 1024; - static constexpr size_t kMaxAttributes = 8; - static constexpr size_t kStrideAlignment = 4; - static constexpr size_t kOffsetAlignment = 4; - static constexpr size_t kMaxVaryings = 6; - - struct Attribute { - enum class Type : uint32_t { // CPU representation Shader Type - kFloat, // float float - kFloat2, // two floats float2 - kFloat3, // three floats float3 - kFloat4, // four floats float4 - kUByte4_unorm, // four bytes half4 - - kLast = kUByte4_unorm - }; - Type type; - size_t offset; - SkString name; - }; - - struct Varying { - enum class Type : uint32_t { - kFloat, // "float" - kFloat2, // "float2" - kFloat3, // "float3" - kFloat4, // "float4" - kHalf, // "half" - kHalf2, // "half2" - kHalf3, // "half3" - kHalf4, // "half4" - - kLast = kHalf4 - }; - Type type; - SkString name; - }; - - using Uniform = SkRuntimeEffect::Uniform; - - ~SkMeshSpecification(); - - struct Result { - sk_sp specification; - SkString error; - }; - - /** - * If successful the return is a specification and an empty error string. Otherwise, it is a - * null specification a non-empty error string. - * - * @param attributes The vertex attributes that will be consumed by 'vs'. Attributes need - * not be tightly packed but attribute offsets must be aligned to - * kOffsetAlignment and offset + size may not be greater than - * 'vertexStride'. At least one attribute is required. - * @param vertexStride The offset between successive attribute values. This must be aligned to - * kStrideAlignment. - * @param varyings The varyings that will be written by 'vs' and read by 'fs'. This may - * be empty. - * @param vs The vertex shader code that computes a vertex position and the varyings - * from the attributes. - * @param fs The fragment code that computes a local coordinate and optionally a - * color from the varyings. The local coordinate is used to sample - * SkShader. - * @param cs The colorspace of the color produced by 'fs'. Ignored if 'fs's main() - * function does not have a color out param. - * @param at The alpha type of the color produced by 'fs'. Ignored if 'fs's main() - * function does not have a color out param. Cannot be kUnknown. - */ - static Result Make(SkSpan attributes, - size_t vertexStride, - SkSpan varyings, - const SkString& vs, - const SkString& fs); - static Result Make(SkSpan attributes, - size_t vertexStride, - SkSpan varyings, - const SkString& vs, - const SkString& fs, - sk_sp cs); - static Result Make(SkSpan attributes, - size_t vertexStride, - SkSpan varyings, - const SkString& vs, - const SkString& fs, - sk_sp cs, - SkAlphaType at); - - SkSpan attributes() const { return SkSpan(fAttributes); } - - /** - * Combined size of all 'uniform' variables. When creating a SkMesh with this specification - * provide an SkData of this size, containing values for all of those variables. Use uniforms() - * to get the offset of each uniform within the SkData. - */ - size_t uniformSize() const; - - /** - * Provides info about individual uniforms including the offset into an SkData where each - * uniform value should be placed. - */ - SkSpan uniforms() const { return SkSpan(fUniforms); } - - /** Returns pointer to the named uniform variable's description, or nullptr if not found. */ - const Uniform* findUniform(std::string_view name) const; - - /** Returns pointer to the named attribute, or nullptr if not found. */ - const Attribute* findAttribute(std::string_view name) const; - - /** Returns pointer to the named varying, or nullptr if not found. */ - const Varying* findVarying(std::string_view name) const; - - size_t stride() const { return fStride; } - -private: - friend struct SkMeshSpecificationPriv; - - enum class ColorType { - kNone, - kHalf4, - kFloat4, - }; - - static Result MakeFromSourceWithStructs(SkSpan attributes, - size_t stride, - SkSpan varyings, - const SkString& vs, - const SkString& fs, - sk_sp cs, - SkAlphaType at); - - SkMeshSpecification(SkSpan, - size_t, - SkSpan, - std::vector uniforms, - std::unique_ptr, - std::unique_ptr, - ColorType, - bool hasLocalCoords, - sk_sp, - SkAlphaType); - - SkMeshSpecification(const SkMeshSpecification&) = delete; - SkMeshSpecification(SkMeshSpecification&&) = delete; - - SkMeshSpecification& operator=(const SkMeshSpecification&) = delete; - SkMeshSpecification& operator=(SkMeshSpecification&&) = delete; - - const std::vector fAttributes; - const std::vector fVaryings; - const std::vector fUniforms; - const std::unique_ptr fVS; - const std::unique_ptr fFS; - const size_t fStride; - uint32_t fHash; - const ColorType fColorType; - const bool fHasLocalCoords; - const sk_sp fColorSpace; - const SkAlphaType fAlphaType; -}; - -/** - * A vertex buffer, a topology, optionally an index buffer, and a compatible SkMeshSpecification. - * - * The data in the vertex buffer is expected to contain the attributes described by the spec - * for vertexCount vertices beginning at vertexOffset. vertexOffset must be aligned to the - * SkMeshSpecification's vertex stride. The size of the buffer must be at least vertexOffset + - * spec->stride()*vertexCount (even if vertex attributes contains pad at the end of the stride). If - * the specified bounds does not contain all the points output by the spec's vertex program when - * applied to the vertices in the custom mesh then the result is undefined. - * - * MakeIndexed may be used to create an indexed mesh. indexCount indices are read from the index - * buffer at the specified offset which must be aligned to 2. The indices are always unsigned 16bit - * integers. The index count must be at least 3. - * - * If Make() is used the implicit index sequence is 0, 1, 2, 3, ... and vertexCount must be at least - * 3. - * - * Both Make() and MakeIndexed() take a SkData with the uniform values. See - * SkMeshSpecification::uniformSize() and SkMeshSpecification::uniforms() for sizing and packing - * uniforms into the SkData. - */ -class SkMesh { -public: - class IndexBuffer : public SkRefCnt { - public: - virtual size_t size() const = 0; - - /** - * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer - * at offset. Fails if offset + size > this->size() or if either offset or size is not - * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We - * take it as a parameter to emphasize that the context must be used to update the data and - * thus the context must be valid for the current thread. - */ - bool update(GrDirectContext*, const void* data, size_t offset, size_t size); - - private: - virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0; - }; - - class VertexBuffer : public SkRefCnt { - public: - virtual size_t size() const = 0; - - /** - * Modifies the data in the IndexBuffer by copying size bytes from data into the buffer - * at offset. Fails if offset + size > this->size() or if either offset or size is not - * aligned to 4 bytes. The GrDirectContext* must match that used to create the buffer. We - * take it as a parameter to emphasize that the context must be used to update the data and - * thus the context must be valid for the current thread. - */ - bool update(GrDirectContext*, const void* data, size_t offset, size_t size); - - private: - virtual bool onUpdate(GrDirectContext*, const void* data, size_t offset, size_t size) = 0; - }; - - SkMesh(); - ~SkMesh(); - - SkMesh(const SkMesh&); - SkMesh(SkMesh&&); - - SkMesh& operator=(const SkMesh&); - SkMesh& operator=(SkMesh&&); - - /** - * Makes an index buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed - * depending on whether GrDirectContext* is nullptr. - * - * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is - * uploaded to the GPU and a GPU-backed buffer is returned. It may - * only be used to draw into SkSurfaces that are backed by the passed - * GrDirectContext. - * @param data The data used to populate the buffer, or nullptr to create a zero- - * initialized buffer. - * @param size Both the size of the data in 'data' and the size of the resulting - * buffer. - */ - static sk_sp MakeIndexBuffer(GrDirectContext*, const void* data, size_t size); - - /** Deprecated in favor of const void* and size_t version above. */ - static sk_sp MakeIndexBuffer(GrDirectContext*, sk_sp); - - /** - * Makes a vertex buffer to be used with SkMeshes. The buffer may be CPU- or GPU-backed - * depending on whether GrDirectContext* is nullptr. - * - * @param GrDirectContext* If nullptr a CPU-backed object is returned. Otherwise, the data is - * uploaded to the GPU and a GPU-backed buffer is returned. It may - * only be used to draw into SkSurfaces that are backed by the passed - * GrDirectContext. - * @param data The data used to populate the buffer, or nullptr to create a zero- - * initialized buffer. - * @param size Both the size of the data in 'data' and the size of the resulting - * buffer. - */ - static sk_sp MakeVertexBuffer(GrDirectContext*, const void*, size_t size); - - /** Deprecated in favor of const void* and size_t version above. */ - static sk_sp MakeVertexBuffer(GrDirectContext*, sk_sp); - - enum class Mode { kTriangles, kTriangleStrip }; - - static SkMesh Make(sk_sp, - Mode, - sk_sp, - size_t vertexCount, - size_t vertexOffset, - sk_sp uniforms, - const SkRect& bounds); - - static SkMesh MakeIndexed(sk_sp, - Mode, - sk_sp, - size_t vertexCount, - size_t vertexOffset, - sk_sp, - size_t indexCount, - size_t indexOffset, - sk_sp uniforms, - const SkRect& bounds); - - sk_sp refSpec() const { return fSpec; } - SkMeshSpecification* spec() const { return fSpec.get(); } - - Mode mode() const { return fMode; } - - sk_sp refVertexBuffer() const { return fVB; } - VertexBuffer* vertexBuffer() const { return fVB.get(); } - - size_t vertexOffset() const { return fVOffset; } - size_t vertexCount() const { return fVCount; } - - sk_sp refIndexBuffer() const { return fIB; } - IndexBuffer* indexBuffer() const { return fIB.get(); } - - size_t indexOffset() const { return fIOffset; } - size_t indexCount() const { return fICount; } - - sk_sp refUniforms() const { return fUniforms; } - const SkData* uniforms() const { return fUniforms.get(); } - - SkRect bounds() const { return fBounds; } - - bool isValid() const; - -private: - friend struct SkMeshPriv; - - bool validate() const; - - sk_sp fSpec; - - sk_sp fVB; - sk_sp fIB; - - sk_sp fUniforms; - - size_t fVOffset = 0; // Must be a multiple of spec->stride() - size_t fVCount = 0; - - size_t fIOffset = 0; // Must be a multiple of sizeof(uint16_t) - size_t fICount = 0; - - Mode fMode = Mode::kTriangles; - - SkRect fBounds = SkRect::MakeEmpty(); -}; - -#endif // SK_ENABLE_SKSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMilestone.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMilestone.h deleted file mode 100644 index a6c6bdf195e1f2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkMilestone.h +++ /dev/null @@ -1,9 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SK_MILESTONE -#define SK_MILESTONE 108 -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOpenTypeSVGDecoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOpenTypeSVGDecoder.h deleted file mode 100644 index 5a2e48a9df11aa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOpenTypeSVGDecoder.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2022 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOpenTypeSVGDecoder_DEFINED -#define SkOpenTypeSVGDecoder_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkSpan.h" -#include "include/core/SkTypes.h" - -#include - -class SkCanvas; - -class SkOpenTypeSVGDecoder { -public: - /** Each instance probably owns an SVG DOM. - * The instance may be cached so needs to report how much memory it retains. - */ - virtual size_t approximateSize() = 0; - virtual bool render(SkCanvas&, int upem, SkGlyphID glyphId, - SkColor foregroundColor, SkSpan palette) = 0; - virtual ~SkOpenTypeSVGDecoder() = default; -}; - -#endif // SkOpenTypeSVGDecoder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOverdrawCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOverdrawCanvas.h deleted file mode 100644 index f3ffc0655663c5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkOverdrawCanvas.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOverdrawCanvas_DEFINED -#define SkOverdrawCanvas_DEFINED - -#include "include/core/SkCanvasVirtualEnforcer.h" -#include "include/utils/SkNWayCanvas.h" - -/** - * Captures all drawing commands. Rather than draw the actual content, this device - * increments the alpha channel of each pixel every time it would have been touched - * by a draw call. This is useful for detecting overdraw. - */ -class SK_API SkOverdrawCanvas : public SkCanvasVirtualEnforcer { -public: - /* Does not take ownership of canvas */ - SkOverdrawCanvas(SkCanvas*); - - void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override; - void onDrawGlyphRunList( - const sktext::GlyphRunList& glyphRunList, const SkPaint& paint) override; - void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, - const SkPaint&) override; - void onDrawPaint(const SkPaint&) override; - void onDrawBehind(const SkPaint& paint) override; - void onDrawRect(const SkRect&, const SkPaint&) override; - void onDrawRegion(const SkRegion&, const SkPaint&) override; - void onDrawOval(const SkRect&, const SkPaint&) override; - void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; - void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; - void onDrawRRect(const SkRRect&, const SkPaint&) override; - void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override; - void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; - void onDrawPath(const SkPath&, const SkPaint&) override; - - void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, - const SkPaint*) override; - void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, - const SkPaint*, SrcRectConstraint) override; - void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, - const SkPaint*) override; - void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, - SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override; - - void onDrawDrawable(SkDrawable*, const SkMatrix*) override; - void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; - - void onDrawAnnotation(const SkRect&, const char key[], SkData* value) override; - void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; - - void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], SkCanvas::QuadAAFlags, const SkColor4f&, - SkBlendMode) override; - void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], - const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override; - -private: - inline SkPaint overdrawPaint(const SkPaint& paint); - - SkPaint fPaint; - - using INHERITED = SkCanvasVirtualEnforcer; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPaint.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPaint.h deleted file mode 100644 index d6c1d830c7ed36..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPaint.h +++ /dev/null @@ -1,718 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPaint_DEFINED -#define SkPaint_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkColor.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkTo.h" - -#include - -class SkBlender; -class SkColorFilter; -class SkColorSpace; -struct SkRect; -class SkImageFilter; -class SkMaskFilter; -class SkMatrix; -class SkPath; -class SkPathEffect; -class SkShader; - -/** \class SkPaint - SkPaint controls options applied when drawing. SkPaint collects all - options outside of the SkCanvas clip and SkCanvas matrix. - - Various options apply to strokes and fills, and images. - - SkPaint collects effects and filters that describe single-pass and multiple-pass - algorithms that alter the drawing geometry, color, and transparency. For instance, - SkPaint does not directly implement dashing or blur, but contains the objects that do so. -*/ -class SK_API SkPaint { -public: - - /** Constructs SkPaint with default values. - - @return default initialized SkPaint - - example: https://fiddle.skia.org/c/@Paint_empty_constructor - */ - SkPaint(); - - /** Constructs SkPaint with default values and the given color. - - Sets alpha and RGB used when stroking and filling. The color is four floating - point values, unpremultiplied. The color values are interpreted as being in - the colorSpace. If colorSpace is nullptr, then color is assumed to be in the - sRGB color space. - - @param color unpremultiplied RGBA - @param colorSpace SkColorSpace describing the encoding of color - @return SkPaint with the given color - */ - explicit SkPaint(const SkColor4f& color, SkColorSpace* colorSpace = nullptr); - - /** Makes a shallow copy of SkPaint. SkPathEffect, SkShader, - SkMaskFilter, SkColorFilter, and SkImageFilter are shared - between the original paint and the copy. Objects containing SkRefCnt increment - their references by one. - - The referenced objects SkPathEffect, SkShader, SkMaskFilter, SkColorFilter, - and SkImageFilter cannot be modified after they are created. - This prevents objects with SkRefCnt from being modified once SkPaint refers to them. - - @param paint original to copy - @return shallow copy of paint - - example: https://fiddle.skia.org/c/@Paint_copy_const_SkPaint - */ - SkPaint(const SkPaint& paint); - - /** Implements a move constructor to avoid increasing the reference counts - of objects referenced by the paint. - - After the call, paint is undefined, and can be safely destructed. - - @param paint original to move - @return content of paint - - example: https://fiddle.skia.org/c/@Paint_move_SkPaint - */ - SkPaint(SkPaint&& paint); - - /** Decreases SkPaint SkRefCnt of owned objects: SkPathEffect, SkShader, - SkMaskFilter, SkColorFilter, and SkImageFilter. If the - objects containing SkRefCnt go to zero, they are deleted. - */ - ~SkPaint(); - - /** Makes a shallow copy of SkPaint. SkPathEffect, SkShader, - SkMaskFilter, SkColorFilter, and SkImageFilter are shared - between the original paint and the copy. Objects containing SkRefCnt in the - prior destination are decreased by one, and the referenced objects are deleted if the - resulting count is zero. Objects containing SkRefCnt in the parameter paint - are increased by one. paint is unmodified. - - @param paint original to copy - @return content of paint - - example: https://fiddle.skia.org/c/@Paint_copy_operator - */ - SkPaint& operator=(const SkPaint& paint); - - /** Moves the paint to avoid increasing the reference counts - of objects referenced by the paint parameter. Objects containing SkRefCnt in the - prior destination are decreased by one; those objects are deleted if the resulting count - is zero. - - After the call, paint is undefined, and can be safely destructed. - - @param paint original to move - @return content of paint - - example: https://fiddle.skia.org/c/@Paint_move_operator - */ - SkPaint& operator=(SkPaint&& paint); - - /** Compares a and b, and returns true if a and b are equivalent. May return false - if SkPathEffect, SkShader, SkMaskFilter, SkColorFilter, - or SkImageFilter have identical contents but different pointers. - - @param a SkPaint to compare - @param b SkPaint to compare - @return true if SkPaint pair are equivalent - */ - SK_API friend bool operator==(const SkPaint& a, const SkPaint& b); - - /** Compares a and b, and returns true if a and b are not equivalent. May return true - if SkPathEffect, SkShader, SkMaskFilter, SkColorFilter, - or SkImageFilter have identical contents but different pointers. - - @param a SkPaint to compare - @param b SkPaint to compare - @return true if SkPaint pair are not equivalent - */ - friend bool operator!=(const SkPaint& a, const SkPaint& b) { - return !(a == b); - } - - /** Sets all SkPaint contents to their initial values. This is equivalent to replacing - SkPaint with the result of SkPaint(). - - example: https://fiddle.skia.org/c/@Paint_reset - */ - void reset(); - - /** Returns true if pixels on the active edges of SkPath may be drawn with partial transparency. - @return antialiasing state - */ - bool isAntiAlias() const { - return SkToBool(fBitfields.fAntiAlias); - } - - /** Requests, but does not require, that edge pixels draw opaque or with - partial transparency. - @param aa setting for antialiasing - */ - void setAntiAlias(bool aa) { fBitfields.fAntiAlias = static_cast(aa); } - - /** Returns true if color error may be distributed to smooth color transition. - @return dithering state - */ - bool isDither() const { - return SkToBool(fBitfields.fDither); - } - - /** Requests, but does not require, to distribute color error. - @param dither setting for ditering - */ - void setDither(bool dither) { fBitfields.fDither = static_cast(dither); } - - /** \enum SkPaint::Style - Set Style to fill, stroke, or both fill and stroke geometry. - The stroke and fill - share all paint attributes; for instance, they are drawn with the same color. - - Use kStrokeAndFill_Style to avoid hitting the same pixels twice with a stroke draw and - a fill draw. - */ - enum Style : uint8_t { - kFill_Style, //!< set to fill geometry - kStroke_Style, //!< set to stroke geometry - kStrokeAndFill_Style, //!< sets to stroke and fill geometry - }; - - /** May be used to verify that SkPaint::Style is a legal value. - */ - static constexpr int kStyleCount = kStrokeAndFill_Style + 1; - - /** Returns whether the geometry is filled, stroked, or filled and stroked. - */ - Style getStyle() const { return (Style)fBitfields.fStyle; } - - /** Sets whether the geometry is filled, stroked, or filled and stroked. - Has no effect if style is not a legal SkPaint::Style value. - - example: https://fiddle.skia.org/c/@Paint_setStyle - example: https://fiddle.skia.org/c/@Stroke_Width - */ - void setStyle(Style style); - - /** - * Set paint's style to kStroke if true, or kFill if false. - */ - void setStroke(bool); - - /** Retrieves alpha and RGB, unpremultiplied, packed into 32 bits. - Use helpers SkColorGetA(), SkColorGetR(), SkColorGetG(), and SkColorGetB() to extract - a color component. - - @return unpremultiplied ARGB - */ - SkColor getColor() const { return fColor4f.toSkColor(); } - - /** Retrieves alpha and RGB, unpremultiplied, as four floating point values. RGB are - extended sRGB values (sRGB gamut, and encoded with the sRGB transfer function). - - @return unpremultiplied RGBA - */ - SkColor4f getColor4f() const { return fColor4f; } - - /** Sets alpha and RGB used when stroking and filling. The color is a 32-bit value, - unpremultiplied, packing 8-bit components for alpha, red, blue, and green. - - @param color unpremultiplied ARGB - - example: https://fiddle.skia.org/c/@Paint_setColor - */ - void setColor(SkColor color); - - /** Sets alpha and RGB used when stroking and filling. The color is four floating - point values, unpremultiplied. The color values are interpreted as being in - the colorSpace. If colorSpace is nullptr, then color is assumed to be in the - sRGB color space. - - @param color unpremultiplied RGBA - @param colorSpace SkColorSpace describing the encoding of color - */ - void setColor(const SkColor4f& color, SkColorSpace* colorSpace = nullptr); - - void setColor4f(const SkColor4f& color, SkColorSpace* colorSpace = nullptr) { - this->setColor(color, colorSpace); - } - - /** Retrieves alpha from the color used when stroking and filling. - - @return alpha ranging from zero, fully transparent, to one, fully opaque - */ - float getAlphaf() const { return fColor4f.fA; } - - // Helper that scales the alpha by 255. - uint8_t getAlpha() const { - return static_cast(sk_float_round2int(this->getAlphaf() * 255)); - } - - /** Replaces alpha, leaving RGB - unchanged. An out of range value triggers an assert in the debug - build. a is a value from 0.0 to 1.0. - a set to zero makes color fully transparent; a set to 1.0 makes color - fully opaque. - - @param a alpha component of color - */ - void setAlphaf(float a); - - // Helper that accepts an int between 0 and 255, and divides it by 255.0 - void setAlpha(U8CPU a) { - this->setAlphaf(a * (1.0f / 255)); - } - - /** Sets color used when drawing solid fills. The color components range from 0 to 255. - The color is unpremultiplied; alpha sets the transparency independent of RGB. - - @param a amount of alpha, from fully transparent (0) to fully opaque (255) - @param r amount of red, from no red (0) to full red (255) - @param g amount of green, from no green (0) to full green (255) - @param b amount of blue, from no blue (0) to full blue (255) - - example: https://fiddle.skia.org/c/@Paint_setARGB - */ - void setARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b); - - /** Returns the thickness of the pen used by SkPaint to - outline the shape. - - @return zero for hairline, greater than zero for pen thickness - */ - SkScalar getStrokeWidth() const { return fWidth; } - - /** Sets the thickness of the pen used by the paint to outline the shape. - A stroke-width of zero is treated as "hairline" width. Hairlines are always exactly one - pixel wide in device space (their thickness does not change as the canvas is scaled). - Negative stroke-widths are invalid; setting a negative width will have no effect. - - @param width zero thickness for hairline; greater than zero for pen thickness - - example: https://fiddle.skia.org/c/@Miter_Limit - example: https://fiddle.skia.org/c/@Paint_setStrokeWidth - */ - void setStrokeWidth(SkScalar width); - - /** Returns the limit at which a sharp corner is drawn beveled. - - @return zero and greater miter limit - */ - SkScalar getStrokeMiter() const { return fMiterLimit; } - - /** Sets the limit at which a sharp corner is drawn beveled. - Valid values are zero and greater. - Has no effect if miter is less than zero. - - @param miter zero and greater miter limit - - example: https://fiddle.skia.org/c/@Paint_setStrokeMiter - */ - void setStrokeMiter(SkScalar miter); - - /** \enum SkPaint::Cap - Cap draws at the beginning and end of an open path contour. - */ - enum Cap { - kButt_Cap, //!< no stroke extension - kRound_Cap, //!< adds circle - kSquare_Cap, //!< adds square - kLast_Cap = kSquare_Cap, //!< largest Cap value - kDefault_Cap = kButt_Cap, //!< equivalent to kButt_Cap - }; - - /** May be used to verify that SkPaint::Cap is a legal value. - */ - static constexpr int kCapCount = kLast_Cap + 1; - - /** \enum SkPaint::Join - Join specifies how corners are drawn when a shape is stroked. Join - affects the four corners of a stroked rectangle, and the connected segments in a - stroked path. - - Choose miter join to draw sharp corners. Choose round join to draw a circle with a - radius equal to the stroke width on top of the corner. Choose bevel join to minimally - connect the thick strokes. - - The fill path constructed to describe the stroked path respects the join setting but may - not contain the actual join. For instance, a fill path constructed with round joins does - not necessarily include circles at each connected segment. - */ - enum Join : uint8_t { - kMiter_Join, //!< extends to miter limit - kRound_Join, //!< adds circle - kBevel_Join, //!< connects outside edges - kLast_Join = kBevel_Join, //!< equivalent to the largest value for Join - kDefault_Join = kMiter_Join, //!< equivalent to kMiter_Join - }; - - /** May be used to verify that SkPaint::Join is a legal value. - */ - static constexpr int kJoinCount = kLast_Join + 1; - - /** Returns the geometry drawn at the beginning and end of strokes. - */ - Cap getStrokeCap() const { return (Cap)fBitfields.fCapType; } - - /** Sets the geometry drawn at the beginning and end of strokes. - - example: https://fiddle.skia.org/c/@Paint_setStrokeCap_a - example: https://fiddle.skia.org/c/@Paint_setStrokeCap_b - */ - void setStrokeCap(Cap cap); - - /** Returns the geometry drawn at the corners of strokes. - */ - Join getStrokeJoin() const { return (Join)fBitfields.fJoinType; } - - /** Sets the geometry drawn at the corners of strokes. - - example: https://fiddle.skia.org/c/@Paint_setStrokeJoin - */ - void setStrokeJoin(Join join); - - /** Returns the filled equivalent of the stroked path. - - @param src SkPath read to create a filled version - @param dst resulting SkPath; may be the same as src, but may not be nullptr - @param cullRect optional limit passed to SkPathEffect - @param resScale if > 1, increase precision, else if (0 < resScale < 1) reduce precision - to favor speed and size - @return true if the path represents style fill, or false if it represents hairline - */ - bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect, - SkScalar resScale = 1) const; - - bool getFillPath(const SkPath& src, SkPath* dst, const SkRect* cullRect, - const SkMatrix& ctm) const; - - /** Returns the filled equivalent of the stroked path. - - Replaces dst with the src path modified by SkPathEffect and style stroke. - SkPathEffect, if any, is not culled. stroke width is created with default precision. - - @param src SkPath read to create a filled version - @param dst resulting SkPath dst may be the same as src, but may not be nullptr - @return true if the path represents style fill, or false if it represents hairline - */ - bool getFillPath(const SkPath& src, SkPath* dst) const { - return this->getFillPath(src, dst, nullptr, 1); - } - - /** Returns optional colors used when filling a path, such as a gradient. - - Does not alter SkShader SkRefCnt. - - @return SkShader if previously set, nullptr otherwise - */ - SkShader* getShader() const { return fShader.get(); } - - /** Returns optional colors used when filling a path, such as a gradient. - - Increases SkShader SkRefCnt by one. - - @return SkShader if previously set, nullptr otherwise - - example: https://fiddle.skia.org/c/@Paint_refShader - */ - sk_sp refShader() const; - - /** Sets optional colors used when filling a path, such as a gradient. - - Sets SkShader to shader, decreasing SkRefCnt of the previous SkShader. - Increments shader SkRefCnt by one. - - @param shader how geometry is filled with color; if nullptr, color is used instead - - example: https://fiddle.skia.org/c/@Color_Filter_Methods - example: https://fiddle.skia.org/c/@Paint_setShader - */ - void setShader(sk_sp shader); - - /** Returns SkColorFilter if set, or nullptr. - Does not alter SkColorFilter SkRefCnt. - - @return SkColorFilter if previously set, nullptr otherwise - */ - SkColorFilter* getColorFilter() const { return fColorFilter.get(); } - - /** Returns SkColorFilter if set, or nullptr. - Increases SkColorFilter SkRefCnt by one. - - @return SkColorFilter if set, or nullptr - - example: https://fiddle.skia.org/c/@Paint_refColorFilter - */ - sk_sp refColorFilter() const; - - /** Sets SkColorFilter to filter, decreasing SkRefCnt of the previous - SkColorFilter. Pass nullptr to clear SkColorFilter. - - Increments filter SkRefCnt by one. - - @param colorFilter SkColorFilter to apply to subsequent draw - - example: https://fiddle.skia.org/c/@Blend_Mode_Methods - example: https://fiddle.skia.org/c/@Paint_setColorFilter - */ - void setColorFilter(sk_sp colorFilter); - - /** If the current blender can be represented as a SkBlendMode enum, this returns that - * enum in the optional's value(). If it cannot, then the returned optional does not - * contain a value. - */ - std::optional asBlendMode() const; - - /** - * Queries the blender, and if it can be represented as a SkBlendMode, return that mode, - * else return the defaultMode provided. - */ - SkBlendMode getBlendMode_or(SkBlendMode defaultMode) const; - - /** Returns true iff the current blender claims to be equivalent to SkBlendMode::kSrcOver. - * - * Also returns true of the current blender is nullptr. - */ - bool isSrcOver() const; - - /** Helper method for calling setBlender(). - * - * This sets a blender that implements the specified blendmode enum. - */ - void setBlendMode(SkBlendMode mode); - - /** Returns the user-supplied blend function, if one has been set. - * Does not alter SkBlender's SkRefCnt. - * - * A nullptr blender signifies the default SrcOver behavior. - * - * @return the SkBlender assigned to this paint, otherwise nullptr - */ - SkBlender* getBlender() const { return fBlender.get(); } - - /** Returns the user-supplied blend function, if one has been set. - * Increments the SkBlender's SkRefCnt by one. - * - * A nullptr blender signifies the default SrcOver behavior. - * - * @return the SkBlender assigned to this paint, otherwise nullptr - */ - sk_sp refBlender() const; - - /** Sets the current blender, increasing its refcnt, and if a blender is already - * present, decreasing that object's refcnt. - * - * A nullptr blender signifies the default SrcOver behavior. - * - * For convenience, you can call setBlendMode() if the blend effect can be expressed - * as one of those values. - */ - void setBlender(sk_sp blender); - - /** Returns SkPathEffect if set, or nullptr. - Does not alter SkPathEffect SkRefCnt. - - @return SkPathEffect if previously set, nullptr otherwise - */ - SkPathEffect* getPathEffect() const { return fPathEffect.get(); } - - /** Returns SkPathEffect if set, or nullptr. - Increases SkPathEffect SkRefCnt by one. - - @return SkPathEffect if previously set, nullptr otherwise - - example: https://fiddle.skia.org/c/@Paint_refPathEffect - */ - sk_sp refPathEffect() const; - - /** Sets SkPathEffect to pathEffect, decreasing SkRefCnt of the previous - SkPathEffect. Pass nullptr to leave the path geometry unaltered. - - Increments pathEffect SkRefCnt by one. - - @param pathEffect replace SkPath with a modification when drawn - - example: https://fiddle.skia.org/c/@Mask_Filter_Methods - example: https://fiddle.skia.org/c/@Paint_setPathEffect - */ - void setPathEffect(sk_sp pathEffect); - - /** Returns SkMaskFilter if set, or nullptr. - Does not alter SkMaskFilter SkRefCnt. - - @return SkMaskFilter if previously set, nullptr otherwise - */ - SkMaskFilter* getMaskFilter() const { return fMaskFilter.get(); } - - /** Returns SkMaskFilter if set, or nullptr. - - Increases SkMaskFilter SkRefCnt by one. - - @return SkMaskFilter if previously set, nullptr otherwise - - example: https://fiddle.skia.org/c/@Paint_refMaskFilter - */ - sk_sp refMaskFilter() const; - - /** Sets SkMaskFilter to maskFilter, decreasing SkRefCnt of the previous - SkMaskFilter. Pass nullptr to clear SkMaskFilter and leave SkMaskFilter effect on - mask alpha unaltered. - - Increments maskFilter SkRefCnt by one. - - @param maskFilter modifies clipping mask generated from drawn geometry - - example: https://fiddle.skia.org/c/@Paint_setMaskFilter - example: https://fiddle.skia.org/c/@Typeface_Methods - */ - void setMaskFilter(sk_sp maskFilter); - - /** Returns SkImageFilter if set, or nullptr. - Does not alter SkImageFilter SkRefCnt. - - @return SkImageFilter if previously set, nullptr otherwise - */ - SkImageFilter* getImageFilter() const { return fImageFilter.get(); } - - /** Returns SkImageFilter if set, or nullptr. - Increases SkImageFilter SkRefCnt by one. - - @return SkImageFilter if previously set, nullptr otherwise - - example: https://fiddle.skia.org/c/@Paint_refImageFilter - */ - sk_sp refImageFilter() const; - - /** Sets SkImageFilter to imageFilter, decreasing SkRefCnt of the previous - SkImageFilter. Pass nullptr to clear SkImageFilter, and remove SkImageFilter effect - on drawing. - - Increments imageFilter SkRefCnt by one. - - @param imageFilter how SkImage is sampled when transformed - - example: https://fiddle.skia.org/c/@Paint_setImageFilter - */ - void setImageFilter(sk_sp imageFilter); - - /** Returns true if SkPaint prevents all drawing; - otherwise, the SkPaint may or may not allow drawing. - - Returns true if, for example, SkBlendMode combined with alpha computes a - new alpha of zero. - - @return true if SkPaint prevents all drawing - - example: https://fiddle.skia.org/c/@Paint_nothingToDraw - */ - bool nothingToDraw() const; - - /** (to be made private) - Returns true if SkPaint does not include elements requiring extensive computation - to compute SkBaseDevice bounds of drawn geometry. For instance, SkPaint with SkPathEffect - always returns false. - - @return true if SkPaint allows for fast computation of bounds - */ - bool canComputeFastBounds() const; - - /** (to be made private) - Only call this if canComputeFastBounds() returned true. This takes a - raw rectangle (the raw bounds of a shape), and adjusts it for stylistic - effects in the paint (e.g. stroking). If needed, it uses the storage - parameter. It returns the adjusted bounds that can then be used - for SkCanvas::quickReject tests. - - The returned SkRect will either be orig or storage, thus the caller - should not rely on storage being set to the result, but should always - use the returned value. It is legal for orig and storage to be the same - SkRect. - For example: - if (!path.isInverseFillType() && paint.canComputeFastBounds()) { - SkRect storage; - if (canvas->quickReject(paint.computeFastBounds(path.getBounds(), &storage))) { - return; // do not draw the path - } - } - // draw the path - - @param orig geometry modified by SkPaint when drawn - @param storage computed bounds of geometry; may not be nullptr - @return fast computed bounds - */ - const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const; - - /** (to be made private) - - @param orig geometry modified by SkPaint when drawn - @param storage computed bounds of geometry - @return fast computed bounds - */ - const SkRect& computeFastStrokeBounds(const SkRect& orig, - SkRect* storage) const { - return this->doComputeFastBounds(orig, storage, kStroke_Style); - } - - /** (to be made private) - Computes the bounds, overriding the SkPaint SkPaint::Style. This can be used to - account for additional width required by stroking orig, without - altering SkPaint::Style set to fill. - - @param orig geometry modified by SkPaint when drawn - @param storage computed bounds of geometry - @param style overrides SkPaint::Style - @return fast computed bounds - */ - const SkRect& doComputeFastBounds(const SkRect& orig, SkRect* storage, - Style style) const; - - using sk_is_trivially_relocatable = std::true_type; - -private: - sk_sp fPathEffect; - sk_sp fShader; - sk_sp fMaskFilter; - sk_sp fColorFilter; - sk_sp fImageFilter; - sk_sp fBlender; - - SkColor4f fColor4f; - SkScalar fWidth; - SkScalar fMiterLimit; - union { - struct { - unsigned fAntiAlias : 1; - unsigned fDither : 1; - unsigned fCapType : 2; - unsigned fJoinType : 2; - unsigned fStyle : 2; - unsigned fPadding : 24; // 24 == 32 -1-1-2-2-2 - } fBitfields; - uint32_t fBitfieldsUInt; - }; - - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - - friend class SkPaintPriv; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPath.h deleted file mode 100644 index fea6932e040350..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPath.h +++ /dev/null @@ -1,1882 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPath_DEFINED -#define SkPath_DEFINED - -#include "include/core/SkMatrix.h" -#include "include/core/SkPathTypes.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkTo.h" - -#include -#include - -class SkAutoPathBoundsUpdate; -class SkData; -class SkPathRef; -class SkRRect; -class SkWStream; - -enum class SkPathConvexity; -enum class SkPathFirstDirection; - -// WIP -- define this locally, and fix call-sites to use SkPathBuilder (skbug.com/9000) -//#define SK_HIDE_PATH_EDIT_METHODS - -/** \class SkPath - SkPath contain geometry. SkPath may be empty, or contain one or more verbs that - outline a figure. SkPath always starts with a move verb to a Cartesian coordinate, - and may be followed by additional verbs that add lines or curves. - Adding a close verb makes the geometry into a continuous loop, a closed contour. - SkPath may contain any number of contours, each beginning with a move verb. - - SkPath contours may contain only a move verb, or may also contain lines, - quadratic beziers, conics, and cubic beziers. SkPath contours may be open or - closed. - - When used to draw a filled area, SkPath describes whether the fill is inside or - outside the geometry. SkPath also describes the winding rule used to fill - overlapping contours. - - Internally, SkPath lazily computes metrics likes bounds and convexity. Call - SkPath::updateBoundsCache to make SkPath thread safe. -*/ -class SK_API SkPath { -public: - /** - * Create a new path with the specified segments. - * - * The points and weights arrays are read in order, based on the sequence of verbs. - * - * Move 1 point - * Line 1 point - * Quad 2 points - * Conic 2 points and 1 weight - * Cubic 3 points - * Close 0 points - * - * If an illegal sequence of verbs is encountered, or the specified number of points - * or weights is not sufficient given the verbs, an empty Path is returned. - * - * A legal sequence of verbs consists of any number of Contours. A contour always begins - * with a Move verb, followed by 0 or more segments: Line, Quad, Conic, Cubic, followed - * by an optional Close. - */ - static SkPath Make(const SkPoint[], int pointCount, - const uint8_t[], int verbCount, - const SkScalar[], int conicWeightCount, - SkPathFillType, bool isVolatile = false); - - static SkPath Rect(const SkRect&, SkPathDirection = SkPathDirection::kCW, - unsigned startIndex = 0); - static SkPath Oval(const SkRect&, SkPathDirection = SkPathDirection::kCW); - static SkPath Oval(const SkRect&, SkPathDirection, unsigned startIndex); - static SkPath Circle(SkScalar center_x, SkScalar center_y, SkScalar radius, - SkPathDirection dir = SkPathDirection::kCW); - static SkPath RRect(const SkRRect&, SkPathDirection dir = SkPathDirection::kCW); - static SkPath RRect(const SkRRect&, SkPathDirection, unsigned startIndex); - static SkPath RRect(const SkRect& bounds, SkScalar rx, SkScalar ry, - SkPathDirection dir = SkPathDirection::kCW); - - static SkPath Polygon(const SkPoint pts[], int count, bool isClosed, - SkPathFillType = SkPathFillType::kWinding, - bool isVolatile = false); - - static SkPath Polygon(const std::initializer_list& list, bool isClosed, - SkPathFillType fillType = SkPathFillType::kWinding, - bool isVolatile = false) { - return Polygon(list.begin(), SkToInt(list.size()), isClosed, fillType, isVolatile); - } - - static SkPath Line(const SkPoint a, const SkPoint b) { - return Polygon({a, b}, false); - } - - /** Constructs an empty SkPath. By default, SkPath has no verbs, no SkPoint, and no weights. - FillType is set to kWinding. - - @return empty SkPath - - example: https://fiddle.skia.org/c/@Path_empty_constructor - */ - SkPath(); - - /** Constructs a copy of an existing path. - Copy constructor makes two paths identical by value. Internally, path and - the returned result share pointer values. The underlying verb array, SkPoint array - and weights are copied when modified. - - Creating a SkPath copy is very efficient and never allocates memory. - SkPath are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param path SkPath to copy by value - @return copy of SkPath - - example: https://fiddle.skia.org/c/@Path_copy_const_SkPath - */ - SkPath(const SkPath& path); - - /** Releases ownership of any shared data and deletes data if SkPath is sole owner. - - example: https://fiddle.skia.org/c/@Path_destructor - */ - ~SkPath(); - - /** Constructs a copy of an existing path. - SkPath assignment makes two paths identical by value. Internally, assignment - shares pointer values. The underlying verb array, SkPoint array and weights - are copied when modified. - - Copying SkPath by assignment is very efficient and never allocates memory. - SkPath are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param path verb array, SkPoint array, weights, and SkPath::FillType to copy - @return SkPath copied by value - - example: https://fiddle.skia.org/c/@Path_copy_operator - */ - SkPath& operator=(const SkPath& path); - - /** Compares a and b; returns true if SkPath::FillType, verb array, SkPoint array, and weights - are equivalent. - - @param a SkPath to compare - @param b SkPath to compare - @return true if SkPath pair are equivalent - */ - friend SK_API bool operator==(const SkPath& a, const SkPath& b); - - /** Compares a and b; returns true if SkPath::FillType, verb array, SkPoint array, and weights - are not equivalent. - - @param a SkPath to compare - @param b SkPath to compare - @return true if SkPath pair are not equivalent - */ - friend bool operator!=(const SkPath& a, const SkPath& b) { - return !(a == b); - } - - /** Returns true if SkPath contain equal verbs and equal weights. - If SkPath contain one or more conics, the weights must match. - - conicTo() may add different verbs depending on conic weight, so it is not - trivial to interpolate a pair of SkPath containing conics with different - conic weight values. - - @param compare SkPath to compare - @return true if SkPath verb array and weights are equivalent - - example: https://fiddle.skia.org/c/@Path_isInterpolatable - */ - bool isInterpolatable(const SkPath& compare) const; - - /** Interpolates between SkPath with SkPoint array of equal size. - Copy verb array and weights to out, and set out SkPoint array to a weighted - average of this SkPoint array and ending SkPoint array, using the formula: - (Path Point * weight) + ending Point * (1 - weight). - - weight is most useful when between zero (ending SkPoint array) and - one (this Point_Array); will work with values outside of this - range. - - interpolate() returns false and leaves out unchanged if SkPoint array is not - the same size as ending SkPoint array. Call isInterpolatable() to check SkPath - compatibility prior to calling interpolate(). - - @param ending SkPoint array averaged with this SkPoint array - @param weight contribution of this SkPoint array, and - one minus contribution of ending SkPoint array - @param out SkPath replaced by interpolated averages - @return true if SkPath contain same number of SkPoint - - example: https://fiddle.skia.org/c/@Path_interpolate - */ - bool interpolate(const SkPath& ending, SkScalar weight, SkPath* out) const; - - /** Returns SkPathFillType, the rule used to fill SkPath. - - @return current SkPathFillType setting - */ - SkPathFillType getFillType() const { return (SkPathFillType)fFillType; } - - /** Sets FillType, the rule used to fill SkPath. While there is no check - that ft is legal, values outside of FillType are not supported. - */ - void setFillType(SkPathFillType ft) { - fFillType = SkToU8(ft); - } - - /** Returns if FillType describes area outside SkPath geometry. The inverse fill area - extends indefinitely. - - @return true if FillType is kInverseWinding or kInverseEvenOdd - */ - bool isInverseFillType() const { return SkPathFillType_IsInverse(this->getFillType()); } - - /** Replaces FillType with its inverse. The inverse of FillType describes the area - unmodified by the original FillType. - */ - void toggleInverseFillType() { - fFillType ^= 2; - } - - /** Returns true if the path is convex. If necessary, it will first compute the convexity. - */ - bool isConvex() const; - - /** Returns true if this path is recognized as an oval or circle. - - bounds receives bounds of oval. - - bounds is unmodified if oval is not found. - - @param bounds storage for bounding SkRect of oval; may be nullptr - @return true if SkPath is recognized as an oval or circle - - example: https://fiddle.skia.org/c/@Path_isOval - */ - bool isOval(SkRect* bounds) const; - - /** Returns true if path is representable as SkRRect. - Returns false if path is representable as oval, circle, or SkRect. - - rrect receives bounds of SkRRect. - - rrect is unmodified if SkRRect is not found. - - @param rrect storage for bounding SkRect of SkRRect; may be nullptr - @return true if SkPath contains only SkRRect - - example: https://fiddle.skia.org/c/@Path_isRRect - */ - bool isRRect(SkRRect* rrect) const; - - /** Sets SkPath to its initial state. - Removes verb array, SkPoint array, and weights, and sets FillType to kWinding. - Internal storage associated with SkPath is released. - - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_reset - */ - SkPath& reset(); - - /** Sets SkPath to its initial state, preserving internal storage. - Removes verb array, SkPoint array, and weights, and sets FillType to kWinding. - Internal storage associated with SkPath is retained. - - Use rewind() instead of reset() if SkPath storage will be reused and performance - is critical. - - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_rewind - */ - SkPath& rewind(); - - /** Returns if SkPath is empty. - Empty SkPath may have FillType but has no SkPoint, SkPath::Verb, or conic weight. - SkPath() constructs empty SkPath; reset() and rewind() make SkPath empty. - - @return true if the path contains no SkPath::Verb array - */ - bool isEmpty() const; - - /** Returns if contour is closed. - Contour is closed if SkPath SkPath::Verb array was last modified by close(). When stroked, - closed contour draws SkPaint::Join instead of SkPaint::Cap at first and last SkPoint. - - @return true if the last contour ends with a kClose_Verb - - example: https://fiddle.skia.org/c/@Path_isLastContourClosed - */ - bool isLastContourClosed() const; - - /** Returns true for finite SkPoint array values between negative SK_ScalarMax and - positive SK_ScalarMax. Returns false for any SkPoint array value of - SK_ScalarInfinity, SK_ScalarNegativeInfinity, or SK_ScalarNaN. - - @return true if all SkPoint values are finite - */ - bool isFinite() const; - - /** Returns true if the path is volatile; it will not be altered or discarded - by the caller after it is drawn. SkPath by default have volatile set false, allowing - SkSurface to attach a cache of data which speeds repeated drawing. If true, SkSurface - may not speed repeated drawing. - - @return true if caller will alter SkPath after drawing - */ - bool isVolatile() const { - return SkToBool(fIsVolatile); - } - - /** Specifies whether SkPath is volatile; whether it will be altered or discarded - by the caller after it is drawn. SkPath by default have volatile set false, allowing - SkBaseDevice to attach a cache of data which speeds repeated drawing. - - Mark temporary paths, discarded or modified after use, as volatile - to inform SkBaseDevice that the path need not be cached. - - Mark animating SkPath volatile to improve performance. - Mark unchanging SkPath non-volatile to improve repeated rendering. - - raster surface SkPath draws are affected by volatile for some shadows. - GPU surface SkPath draws are affected by volatile for some shadows and concave geometries. - - @param isVolatile true if caller will alter SkPath after drawing - @return reference to SkPath - */ - SkPath& setIsVolatile(bool isVolatile) { - fIsVolatile = isVolatile; - return *this; - } - - /** Tests if line between SkPoint pair is degenerate. - Line with no length or that moves a very short distance is degenerate; it is - treated as a point. - - exact changes the equality test. If true, returns true only if p1 equals p2. - If false, returns true if p1 equals or nearly equals p2. - - @param p1 line start point - @param p2 line end point - @param exact if false, allow nearly equals - @return true if line is degenerate; its length is effectively zero - - example: https://fiddle.skia.org/c/@Path_IsLineDegenerate - */ - static bool IsLineDegenerate(const SkPoint& p1, const SkPoint& p2, bool exact); - - /** Tests if quad is degenerate. - Quad with no length or that moves a very short distance is degenerate; it is - treated as a point. - - @param p1 quad start point - @param p2 quad control point - @param p3 quad end point - @param exact if true, returns true only if p1, p2, and p3 are equal; - if false, returns true if p1, p2, and p3 are equal or nearly equal - @return true if quad is degenerate; its length is effectively zero - */ - static bool IsQuadDegenerate(const SkPoint& p1, const SkPoint& p2, - const SkPoint& p3, bool exact); - - /** Tests if cubic is degenerate. - Cubic with no length or that moves a very short distance is degenerate; it is - treated as a point. - - @param p1 cubic start point - @param p2 cubic control point 1 - @param p3 cubic control point 2 - @param p4 cubic end point - @param exact if true, returns true only if p1, p2, p3, and p4 are equal; - if false, returns true if p1, p2, p3, and p4 are equal or nearly equal - @return true if cubic is degenerate; its length is effectively zero - */ - static bool IsCubicDegenerate(const SkPoint& p1, const SkPoint& p2, - const SkPoint& p3, const SkPoint& p4, bool exact); - - /** Returns true if SkPath contains only one line; - SkPath::Verb array has two entries: kMove_Verb, kLine_Verb. - If SkPath contains one line and line is not nullptr, line is set to - line start point and line end point. - Returns false if SkPath is not one line; line is unaltered. - - @param line storage for line. May be nullptr - @return true if SkPath contains exactly one line - - example: https://fiddle.skia.org/c/@Path_isLine - */ - bool isLine(SkPoint line[2]) const; - - /** Returns the number of points in SkPath. - SkPoint count is initially zero. - - @return SkPath SkPoint array length - - example: https://fiddle.skia.org/c/@Path_countPoints - */ - int countPoints() const; - - /** Returns SkPoint at index in SkPoint array. Valid range for index is - 0 to countPoints() - 1. - Returns (0, 0) if index is out of range. - - @param index SkPoint array element selector - @return SkPoint array value or (0, 0) - - example: https://fiddle.skia.org/c/@Path_getPoint - */ - SkPoint getPoint(int index) const; - - /** Returns number of points in SkPath. Up to max points are copied. - points may be nullptr; then, max must be zero. - If max is greater than number of points, excess points storage is unaltered. - - @param points storage for SkPath SkPoint array. May be nullptr - @param max maximum to copy; must be greater than or equal to zero - @return SkPath SkPoint array length - - example: https://fiddle.skia.org/c/@Path_getPoints - */ - int getPoints(SkPoint points[], int max) const; - - /** Returns the number of verbs: kMove_Verb, kLine_Verb, kQuad_Verb, kConic_Verb, - kCubic_Verb, and kClose_Verb; added to SkPath. - - @return length of verb array - - example: https://fiddle.skia.org/c/@Path_countVerbs - */ - int countVerbs() const; - - /** Returns the number of verbs in the path. Up to max verbs are copied. The - verbs are copied as one byte per verb. - - @param verbs storage for verbs, may be nullptr - @param max maximum number to copy into verbs - @return the actual number of verbs in the path - - example: https://fiddle.skia.org/c/@Path_getVerbs - */ - int getVerbs(uint8_t verbs[], int max) const; - - /** Returns the approximate byte size of the SkPath in memory. - - @return approximate size - */ - size_t approximateBytesUsed() const; - - /** Exchanges the verb array, SkPoint array, weights, and SkPath::FillType with other. - Cached state is also exchanged. swap() internally exchanges pointers, so - it is lightweight and does not allocate memory. - - swap() usage has largely been replaced by operator=(const SkPath& path). - SkPath do not copy their content on assignment until they are written to, - making assignment as efficient as swap(). - - @param other SkPath exchanged by value - - example: https://fiddle.skia.org/c/@Path_swap - */ - void swap(SkPath& other); - - /** Returns minimum and maximum axes values of SkPoint array. - Returns (0, 0, 0, 0) if SkPath contains no points. Returned bounds width and height may - be larger or smaller than area affected when SkPath is drawn. - - SkRect returned includes all SkPoint added to SkPath, including SkPoint associated with - kMove_Verb that define empty contours. - - @return bounds of all SkPoint in SkPoint array - */ - const SkRect& getBounds() const; - - /** Updates internal bounds so that subsequent calls to getBounds() are instantaneous. - Unaltered copies of SkPath may also access cached bounds through getBounds(). - - For now, identical to calling getBounds() and ignoring the returned value. - - Call to prepare SkPath subsequently drawn from multiple threads, - to avoid a race condition where each draw separately computes the bounds. - */ - void updateBoundsCache() const { - // for now, just calling getBounds() is sufficient - this->getBounds(); - } - - /** Returns minimum and maximum axes values of the lines and curves in SkPath. - Returns (0, 0, 0, 0) if SkPath contains no points. - Returned bounds width and height may be larger or smaller than area affected - when SkPath is drawn. - - Includes SkPoint associated with kMove_Verb that define empty - contours. - - Behaves identically to getBounds() when SkPath contains - only lines. If SkPath contains curves, computed bounds includes - the maximum extent of the quad, conic, or cubic; is slower than getBounds(); - and unlike getBounds(), does not cache the result. - - @return tight bounds of curves in SkPath - - example: https://fiddle.skia.org/c/@Path_computeTightBounds - */ - SkRect computeTightBounds() const; - - /** Returns true if rect is contained by SkPath. - May return false when rect is contained by SkPath. - - For now, only returns true if SkPath has one contour and is convex. - rect may share points and edges with SkPath and be contained. - Returns true if rect is empty, that is, it has zero width or height; and - the SkPoint or line described by rect is contained by SkPath. - - @param rect SkRect, line, or SkPoint checked for containment - @return true if rect is contained - - example: https://fiddle.skia.org/c/@Path_conservativelyContainsRect - */ - bool conservativelyContainsRect(const SkRect& rect) const; - - /** Grows SkPath verb array and SkPoint array to contain extraPtCount additional SkPoint. - May improve performance and use less memory by - reducing the number and size of allocations when creating SkPath. - - @param extraPtCount number of additional SkPoint to allocate - - example: https://fiddle.skia.org/c/@Path_incReserve - */ - void incReserve(int extraPtCount); - -#ifdef SK_HIDE_PATH_EDIT_METHODS -private: -#endif - - /** Adds beginning of contour at SkPoint (x, y). - - @param x x-axis value of contour start - @param y y-axis value of contour start - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_moveTo - */ - SkPath& moveTo(SkScalar x, SkScalar y); - - /** Adds beginning of contour at SkPoint p. - - @param p contour start - @return reference to SkPath - */ - SkPath& moveTo(const SkPoint& p) { - return this->moveTo(p.fX, p.fY); - } - - /** Adds beginning of contour relative to last point. - If SkPath is empty, starts contour at (dx, dy). - Otherwise, start contour at last point offset by (dx, dy). - Function name stands for "relative move to". - - @param dx offset from last point to contour start on x-axis - @param dy offset from last point to contour start on y-axis - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_rMoveTo - */ - SkPath& rMoveTo(SkScalar dx, SkScalar dy); - - /** Adds line from last point to (x, y). If SkPath is empty, or last SkPath::Verb is - kClose_Verb, last point is set to (0, 0) before adding line. - - lineTo() appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed. - lineTo() then appends kLine_Verb to verb array and (x, y) to SkPoint array. - - @param x end of added line on x-axis - @param y end of added line on y-axis - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_lineTo - */ - SkPath& lineTo(SkScalar x, SkScalar y); - - /** Adds line from last point to SkPoint p. If SkPath is empty, or last SkPath::Verb is - kClose_Verb, last point is set to (0, 0) before adding line. - - lineTo() first appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed. - lineTo() then appends kLine_Verb to verb array and SkPoint p to SkPoint array. - - @param p end SkPoint of added line - @return reference to SkPath - */ - SkPath& lineTo(const SkPoint& p) { - return this->lineTo(p.fX, p.fY); - } - - /** Adds line from last point to vector (dx, dy). If SkPath is empty, or last SkPath::Verb is - kClose_Verb, last point is set to (0, 0) before adding line. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; - then appends kLine_Verb to verb array and line end to SkPoint array. - Line end is last point plus vector (dx, dy). - Function name stands for "relative line to". - - @param dx offset from last point to line end on x-axis - @param dy offset from last point to line end on y-axis - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_rLineTo - example: https://fiddle.skia.org/c/@Quad_a - example: https://fiddle.skia.org/c/@Quad_b - */ - SkPath& rLineTo(SkScalar dx, SkScalar dy); - - /** Adds quad from last point towards (x1, y1), to (x2, y2). - If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) - before adding quad. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; - then appends kQuad_Verb to verb array; and (x1, y1), (x2, y2) - to SkPoint array. - - @param x1 control SkPoint of quad on x-axis - @param y1 control SkPoint of quad on y-axis - @param x2 end SkPoint of quad on x-axis - @param y2 end SkPoint of quad on y-axis - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_quadTo - */ - SkPath& quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2); - - /** Adds quad from last point towards SkPoint p1, to SkPoint p2. - If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) - before adding quad. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; - then appends kQuad_Verb to verb array; and SkPoint p1, p2 - to SkPoint array. - - @param p1 control SkPoint of added quad - @param p2 end SkPoint of added quad - @return reference to SkPath - */ - SkPath& quadTo(const SkPoint& p1, const SkPoint& p2) { - return this->quadTo(p1.fX, p1.fY, p2.fX, p2.fY); - } - - /** Adds quad from last point towards vector (dx1, dy1), to vector (dx2, dy2). - If SkPath is empty, or last SkPath::Verb - is kClose_Verb, last point is set to (0, 0) before adding quad. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, - if needed; then appends kQuad_Verb to verb array; and appends quad - control and quad end to SkPoint array. - Quad control is last point plus vector (dx1, dy1). - Quad end is last point plus vector (dx2, dy2). - Function name stands for "relative quad to". - - @param dx1 offset from last point to quad control on x-axis - @param dy1 offset from last point to quad control on y-axis - @param dx2 offset from last point to quad end on x-axis - @param dy2 offset from last point to quad end on y-axis - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Conic_Weight_a - example: https://fiddle.skia.org/c/@Conic_Weight_b - example: https://fiddle.skia.org/c/@Conic_Weight_c - example: https://fiddle.skia.org/c/@Path_rQuadTo - */ - SkPath& rQuadTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2); - - /** Adds conic from last point towards (x1, y1), to (x2, y2), weighted by w. - If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) - before adding conic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed. - - If w is finite and not one, appends kConic_Verb to verb array; - and (x1, y1), (x2, y2) to SkPoint array; and w to conic weights. - - If w is one, appends kQuad_Verb to verb array, and - (x1, y1), (x2, y2) to SkPoint array. - - If w is not finite, appends kLine_Verb twice to verb array, and - (x1, y1), (x2, y2) to SkPoint array. - - @param x1 control SkPoint of conic on x-axis - @param y1 control SkPoint of conic on y-axis - @param x2 end SkPoint of conic on x-axis - @param y2 end SkPoint of conic on y-axis - @param w weight of added conic - @return reference to SkPath - */ - SkPath& conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, - SkScalar w); - - /** Adds conic from last point towards SkPoint p1, to SkPoint p2, weighted by w. - If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to (0, 0) - before adding conic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed. - - If w is finite and not one, appends kConic_Verb to verb array; - and SkPoint p1, p2 to SkPoint array; and w to conic weights. - - If w is one, appends kQuad_Verb to verb array, and SkPoint p1, p2 - to SkPoint array. - - If w is not finite, appends kLine_Verb twice to verb array, and - SkPoint p1, p2 to SkPoint array. - - @param p1 control SkPoint of added conic - @param p2 end SkPoint of added conic - @param w weight of added conic - @return reference to SkPath - */ - SkPath& conicTo(const SkPoint& p1, const SkPoint& p2, SkScalar w) { - return this->conicTo(p1.fX, p1.fY, p2.fX, p2.fY, w); - } - - /** Adds conic from last point towards vector (dx1, dy1), to vector (dx2, dy2), - weighted by w. If SkPath is empty, or last SkPath::Verb - is kClose_Verb, last point is set to (0, 0) before adding conic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, - if needed. - - If w is finite and not one, next appends kConic_Verb to verb array, - and w is recorded as conic weight; otherwise, if w is one, appends - kQuad_Verb to verb array; or if w is not finite, appends kLine_Verb - twice to verb array. - - In all cases appends SkPoint control and end to SkPoint array. - control is last point plus vector (dx1, dy1). - end is last point plus vector (dx2, dy2). - - Function name stands for "relative conic to". - - @param dx1 offset from last point to conic control on x-axis - @param dy1 offset from last point to conic control on y-axis - @param dx2 offset from last point to conic end on x-axis - @param dy2 offset from last point to conic end on y-axis - @param w weight of added conic - @return reference to SkPath - */ - SkPath& rConicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, - SkScalar w); - - /** Adds cubic from last point towards (x1, y1), then towards (x2, y2), ending at - (x3, y3). If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to - (0, 0) before adding cubic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; - then appends kCubic_Verb to verb array; and (x1, y1), (x2, y2), (x3, y3) - to SkPoint array. - - @param x1 first control SkPoint of cubic on x-axis - @param y1 first control SkPoint of cubic on y-axis - @param x2 second control SkPoint of cubic on x-axis - @param y2 second control SkPoint of cubic on y-axis - @param x3 end SkPoint of cubic on x-axis - @param y3 end SkPoint of cubic on y-axis - @return reference to SkPath - */ - SkPath& cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, - SkScalar x3, SkScalar y3); - - /** Adds cubic from last point towards SkPoint p1, then towards SkPoint p2, ending at - SkPoint p3. If SkPath is empty, or last SkPath::Verb is kClose_Verb, last point is set to - (0, 0) before adding cubic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, if needed; - then appends kCubic_Verb to verb array; and SkPoint p1, p2, p3 - to SkPoint array. - - @param p1 first control SkPoint of cubic - @param p2 second control SkPoint of cubic - @param p3 end SkPoint of cubic - @return reference to SkPath - */ - SkPath& cubicTo(const SkPoint& p1, const SkPoint& p2, const SkPoint& p3) { - return this->cubicTo(p1.fX, p1.fY, p2.fX, p2.fY, p3.fX, p3.fY); - } - - /** Adds cubic from last point towards vector (dx1, dy1), then towards - vector (dx2, dy2), to vector (dx3, dy3). - If SkPath is empty, or last SkPath::Verb - is kClose_Verb, last point is set to (0, 0) before adding cubic. - - Appends kMove_Verb to verb array and (0, 0) to SkPoint array, - if needed; then appends kCubic_Verb to verb array; and appends cubic - control and cubic end to SkPoint array. - Cubic control is last point plus vector (dx1, dy1). - Cubic end is last point plus vector (dx2, dy2). - Function name stands for "relative cubic to". - - @param dx1 offset from last point to first cubic control on x-axis - @param dy1 offset from last point to first cubic control on y-axis - @param dx2 offset from last point to second cubic control on x-axis - @param dy2 offset from last point to second cubic control on y-axis - @param dx3 offset from last point to cubic end on x-axis - @param dy3 offset from last point to cubic end on y-axis - @return reference to SkPath - */ - SkPath& rCubicTo(SkScalar dx1, SkScalar dy1, SkScalar dx2, SkScalar dy2, - SkScalar dx3, SkScalar dy3); - - /** Appends arc to SkPath. Arc added is part of ellipse - bounded by oval, from startAngle through sweepAngle. Both startAngle and - sweepAngle are measured in degrees, where zero degrees is aligned with the - positive x-axis, and positive sweeps extends arc clockwise. - - arcTo() adds line connecting SkPath last SkPoint to initial arc SkPoint if forceMoveTo - is false and SkPath is not empty. Otherwise, added contour begins with first point - of arc. Angles greater than -360 and less than 360 are treated modulo 360. - - @param oval bounds of ellipse containing arc - @param startAngle starting angle of arc in degrees - @param sweepAngle sweep, in degrees. Positive is clockwise; treated modulo 360 - @param forceMoveTo true to start a new contour with arc - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_arcTo - */ - SkPath& arcTo(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle, bool forceMoveTo); - - /** Appends arc to SkPath, after appending line if needed. Arc is implemented by conic - weighted to describe part of circle. Arc is contained by tangent from - last SkPath point to (x1, y1), and tangent from (x1, y1) to (x2, y2). Arc - is part of circle sized to radius, positioned so it touches both tangent lines. - - If last Path Point does not start Arc, arcTo appends connecting Line to Path. - The length of Vector from (x1, y1) to (x2, y2) does not affect Arc. - - Arc sweep is always less than 180 degrees. If radius is zero, or if - tangents are nearly parallel, arcTo appends Line from last Path Point to (x1, y1). - - arcTo appends at most one Line and one conic. - arcTo implements the functionality of PostScript arct and HTML Canvas arcTo. - - @param x1 x-axis value common to pair of tangents - @param y1 y-axis value common to pair of tangents - @param x2 x-axis value end of second tangent - @param y2 y-axis value end of second tangent - @param radius distance from arc to circle center - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_arcTo_2_a - example: https://fiddle.skia.org/c/@Path_arcTo_2_b - example: https://fiddle.skia.org/c/@Path_arcTo_2_c - */ - SkPath& arcTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar radius); - - /** Appends arc to SkPath, after appending line if needed. Arc is implemented by conic - weighted to describe part of circle. Arc is contained by tangent from - last SkPath point to p1, and tangent from p1 to p2. Arc - is part of circle sized to radius, positioned so it touches both tangent lines. - - If last SkPath SkPoint does not start arc, arcTo() appends connecting line to SkPath. - The length of vector from p1 to p2 does not affect arc. - - Arc sweep is always less than 180 degrees. If radius is zero, or if - tangents are nearly parallel, arcTo() appends line from last SkPath SkPoint to p1. - - arcTo() appends at most one line and one conic. - arcTo() implements the functionality of PostScript arct and HTML Canvas arcTo. - - @param p1 SkPoint common to pair of tangents - @param p2 end of second tangent - @param radius distance from arc to circle center - @return reference to SkPath - */ - SkPath& arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius) { - return this->arcTo(p1.fX, p1.fY, p2.fX, p2.fY, radius); - } - - /** \enum SkPath::ArcSize - Four oval parts with radii (rx, ry) start at last SkPath SkPoint and ends at (x, y). - ArcSize and Direction select one of the four oval parts. - */ - enum ArcSize { - kSmall_ArcSize, //!< smaller of arc pair - kLarge_ArcSize, //!< larger of arc pair - }; - - /** Appends arc to SkPath. Arc is implemented by one or more conics weighted to - describe part of oval with radii (rx, ry) rotated by xAxisRotate degrees. Arc - curves from last SkPath SkPoint to (x, y), choosing one of four possible routes: - clockwise or counterclockwise, and smaller or larger. - - Arc sweep is always less than 360 degrees. arcTo() appends line to (x, y) if - either radii are zero, or if last SkPath SkPoint equals (x, y). arcTo() scales radii - (rx, ry) to fit last SkPath SkPoint and (x, y) if both are greater than zero but - too small. - - arcTo() appends up to four conic curves. - arcTo() implements the functionality of SVG arc, although SVG sweep-flag value - is opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, - while kCW_Direction cast to int is zero. - - @param rx radius on x-axis before x-axis rotation - @param ry radius on y-axis before x-axis rotation - @param xAxisRotate x-axis rotation in degrees; positive values are clockwise - @param largeArc chooses smaller or larger arc - @param sweep chooses clockwise or counterclockwise arc - @param x end of arc - @param y end of arc - @return reference to SkPath - */ - SkPath& arcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, - SkPathDirection sweep, SkScalar x, SkScalar y); - - /** Appends arc to SkPath. Arc is implemented by one or more conic weighted to describe - part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves - from last SkPath SkPoint to (xy.fX, xy.fY), choosing one of four possible routes: - clockwise or counterclockwise, - and smaller or larger. - - Arc sweep is always less than 360 degrees. arcTo() appends line to xy if either - radii are zero, or if last SkPath SkPoint equals (xy.fX, xy.fY). arcTo() scales radii r to - fit last SkPath SkPoint and xy if both are greater than zero but too small to describe - an arc. - - arcTo() appends up to four conic curves. - arcTo() implements the functionality of SVG arc, although SVG sweep-flag value is - opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while - kCW_Direction cast to int is zero. - - @param r radii on axes before x-axis rotation - @param xAxisRotate x-axis rotation in degrees; positive values are clockwise - @param largeArc chooses smaller or larger arc - @param sweep chooses clockwise or counterclockwise arc - @param xy end of arc - @return reference to SkPath - */ - SkPath& arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, SkPathDirection sweep, - const SkPoint xy) { - return this->arcTo(r.fX, r.fY, xAxisRotate, largeArc, sweep, xy.fX, xy.fY); - } - - /** Appends arc to SkPath, relative to last SkPath SkPoint. Arc is implemented by one or - more conic, weighted to describe part of oval with radii (rx, ry) rotated by - xAxisRotate degrees. Arc curves from last SkPath SkPoint to relative end SkPoint: - (dx, dy), choosing one of four possible routes: clockwise or - counterclockwise, and smaller or larger. If SkPath is empty, the start arc SkPoint - is (0, 0). - - Arc sweep is always less than 360 degrees. arcTo() appends line to end SkPoint - if either radii are zero, or if last SkPath SkPoint equals end SkPoint. - arcTo() scales radii (rx, ry) to fit last SkPath SkPoint and end SkPoint if both are - greater than zero but too small to describe an arc. - - arcTo() appends up to four conic curves. - arcTo() implements the functionality of svg arc, although SVG "sweep-flag" value is - opposite the integer value of sweep; SVG "sweep-flag" uses 1 for clockwise, while - kCW_Direction cast to int is zero. - - @param rx radius before x-axis rotation - @param ry radius before x-axis rotation - @param xAxisRotate x-axis rotation in degrees; positive values are clockwise - @param largeArc chooses smaller or larger arc - @param sweep chooses clockwise or counterclockwise arc - @param dx x-axis offset end of arc from last SkPath SkPoint - @param dy y-axis offset end of arc from last SkPath SkPoint - @return reference to SkPath - */ - SkPath& rArcTo(SkScalar rx, SkScalar ry, SkScalar xAxisRotate, ArcSize largeArc, - SkPathDirection sweep, SkScalar dx, SkScalar dy); - - /** Appends kClose_Verb to SkPath. A closed contour connects the first and last SkPoint - with line, forming a continuous loop. Open and closed contour draw the same - with SkPaint::kFill_Style. With SkPaint::kStroke_Style, open contour draws - SkPaint::Cap at contour start and end; closed contour draws - SkPaint::Join at contour start and end. - - close() has no effect if SkPath is empty or last SkPath SkPath::Verb is kClose_Verb. - - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_close - */ - SkPath& close(); - -#ifdef SK_HIDE_PATH_EDIT_METHODS -public: -#endif - - /** Approximates conic with quad array. Conic is constructed from start SkPoint p0, - control SkPoint p1, end SkPoint p2, and weight w. - Quad array is stored in pts; this storage is supplied by caller. - Maximum quad count is 2 to the pow2. - Every third point in array shares last SkPoint of previous quad and first SkPoint of - next quad. Maximum pts storage size is given by: - (1 + 2 * (1 << pow2)) * sizeof(SkPoint). - - Returns quad count used the approximation, which may be smaller - than the number requested. - - conic weight determines the amount of influence conic control point has on the curve. - w less than one represents an elliptical section. w greater than one represents - a hyperbolic section. w equal to one represents a parabolic section. - - Two quad curves are sufficient to approximate an elliptical conic with a sweep - of up to 90 degrees; in this case, set pow2 to one. - - @param p0 conic start SkPoint - @param p1 conic control SkPoint - @param p2 conic end SkPoint - @param w conic weight - @param pts storage for quad array - @param pow2 quad count, as power of two, normally 0 to 5 (1 to 32 quad curves) - @return number of quad curves written to pts - */ - static int ConvertConicToQuads(const SkPoint& p0, const SkPoint& p1, const SkPoint& p2, - SkScalar w, SkPoint pts[], int pow2); - - /** Returns true if SkPath is equivalent to SkRect when filled. - If false: rect, isClosed, and direction are unchanged. - If true: rect, isClosed, and direction are written to if not nullptr. - - rect may be smaller than the SkPath bounds. SkPath bounds may include kMove_Verb points - that do not alter the area drawn by the returned rect. - - @param rect storage for bounds of SkRect; may be nullptr - @param isClosed storage set to true if SkPath is closed; may be nullptr - @param direction storage set to SkRect direction; may be nullptr - @return true if SkPath contains SkRect - - example: https://fiddle.skia.org/c/@Path_isRect - */ - bool isRect(SkRect* rect, bool* isClosed = nullptr, SkPathDirection* direction = nullptr) const; - -#ifdef SK_HIDE_PATH_EDIT_METHODS -private: -#endif - - /** Adds a new contour to the path, defined by the rect, and wound in the - specified direction. The verbs added to the path will be: - - kMove, kLine, kLine, kLine, kClose - - start specifies which corner to begin the contour: - 0: upper-left corner - 1: upper-right corner - 2: lower-right corner - 3: lower-left corner - - This start point also acts as the implied beginning of the subsequent, - contour, if it does not have an explicit moveTo(). e.g. - - path.addRect(...) - // if we don't say moveTo() here, we will use the rect's start point - path.lineTo(...) - - @param rect SkRect to add as a closed contour - @param dir SkPath::Direction to orient the new contour - @param start initial corner of SkRect to add - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addRect_2 - */ - SkPath& addRect(const SkRect& rect, SkPathDirection dir, unsigned start); - - SkPath& addRect(const SkRect& rect, SkPathDirection dir = SkPathDirection::kCW) { - return this->addRect(rect, dir, 0); - } - - SkPath& addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, - SkPathDirection dir = SkPathDirection::kCW) { - return this->addRect({left, top, right, bottom}, dir, 0); - } - - /** Adds oval to path, appending kMove_Verb, four kConic_Verb, and kClose_Verb. - Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width - and half oval height. Oval begins at (oval.fRight, oval.centerY()) and continues - clockwise if dir is kCW_Direction, counterclockwise if dir is kCCW_Direction. - - @param oval bounds of ellipse added - @param dir SkPath::Direction to wind ellipse - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addOval - */ - SkPath& addOval(const SkRect& oval, SkPathDirection dir = SkPathDirection::kCW); - - /** Adds oval to SkPath, appending kMove_Verb, four kConic_Verb, and kClose_Verb. - Oval is upright ellipse bounded by SkRect oval with radii equal to half oval width - and half oval height. Oval begins at start and continues - clockwise if dir is kCW_Direction, counterclockwise if dir is kCCW_Direction. - - @param oval bounds of ellipse added - @param dir SkPath::Direction to wind ellipse - @param start index of initial point of ellipse - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addOval_2 - */ - SkPath& addOval(const SkRect& oval, SkPathDirection dir, unsigned start); - - /** Adds circle centered at (x, y) of size radius to SkPath, appending kMove_Verb, - four kConic_Verb, and kClose_Verb. Circle begins at: (x + radius, y), continuing - clockwise if dir is kCW_Direction, and counterclockwise if dir is kCCW_Direction. - - Has no effect if radius is zero or negative. - - @param x center of circle - @param y center of circle - @param radius distance from center to edge - @param dir SkPath::Direction to wind circle - @return reference to SkPath - */ - SkPath& addCircle(SkScalar x, SkScalar y, SkScalar radius, - SkPathDirection dir = SkPathDirection::kCW); - - /** Appends arc to SkPath, as the start of new contour. Arc added is part of ellipse - bounded by oval, from startAngle through sweepAngle. Both startAngle and - sweepAngle are measured in degrees, where zero degrees is aligned with the - positive x-axis, and positive sweeps extends arc clockwise. - - If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly - zero, append oval instead of arc. Otherwise, sweepAngle values are treated - modulo 360, and arc may or may not draw depending on numeric rounding. - - @param oval bounds of ellipse containing arc - @param startAngle starting angle of arc in degrees - @param sweepAngle sweep, in degrees. Positive is clockwise; treated modulo 360 - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addArc - */ - SkPath& addArc(const SkRect& oval, SkScalar startAngle, SkScalar sweepAngle); - - /** Appends SkRRect to SkPath, creating a new closed contour. SkRRect has bounds - equal to rect; each corner is 90 degrees of an ellipse with radii (rx, ry). If - dir is kCW_Direction, SkRRect starts at top-left of the lower-left corner and - winds clockwise. If dir is kCCW_Direction, SkRRect starts at the bottom-left - of the upper-left corner and winds counterclockwise. - - If either rx or ry is too large, rx and ry are scaled uniformly until the - corners fit. If rx or ry is less than or equal to zero, addRoundRect() appends - SkRect rect to SkPath. - - After appending, SkPath may be empty, or may contain: SkRect, oval, or SkRRect. - - @param rect bounds of SkRRect - @param rx x-axis radius of rounded corners on the SkRRect - @param ry y-axis radius of rounded corners on the SkRRect - @param dir SkPath::Direction to wind SkRRect - @return reference to SkPath - */ - SkPath& addRoundRect(const SkRect& rect, SkScalar rx, SkScalar ry, - SkPathDirection dir = SkPathDirection::kCW); - - /** Appends SkRRect to SkPath, creating a new closed contour. SkRRect has bounds - equal to rect; each corner is 90 degrees of an ellipse with radii from the - array. - - @param rect bounds of SkRRect - @param radii array of 8 SkScalar values, a radius pair for each corner - @param dir SkPath::Direction to wind SkRRect - @return reference to SkPath - */ - SkPath& addRoundRect(const SkRect& rect, const SkScalar radii[], - SkPathDirection dir = SkPathDirection::kCW); - - /** Adds rrect to SkPath, creating a new closed contour. If - dir is kCW_Direction, rrect starts at top-left of the lower-left corner and - winds clockwise. If dir is kCCW_Direction, rrect starts at the bottom-left - of the upper-left corner and winds counterclockwise. - - After appending, SkPath may be empty, or may contain: SkRect, oval, or SkRRect. - - @param rrect bounds and radii of rounded rectangle - @param dir SkPath::Direction to wind SkRRect - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addRRect - */ - SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir = SkPathDirection::kCW); - - /** Adds rrect to SkPath, creating a new closed contour. If dir is kCW_Direction, rrect - winds clockwise; if dir is kCCW_Direction, rrect winds counterclockwise. - start determines the first point of rrect to add. - - @param rrect bounds and radii of rounded rectangle - @param dir SkPath::Direction to wind SkRRect - @param start index of initial point of SkRRect - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addRRect_2 - */ - SkPath& addRRect(const SkRRect& rrect, SkPathDirection dir, unsigned start); - - /** Adds contour created from line array, adding (count - 1) line segments. - Contour added starts at pts[0], then adds a line for every additional SkPoint - in pts array. If close is true, appends kClose_Verb to SkPath, connecting - pts[count - 1] and pts[0]. - - If count is zero, append kMove_Verb to path. - Has no effect if count is less than one. - - @param pts array of line sharing end and start SkPoint - @param count length of SkPoint array - @param close true to add line connecting contour end and start - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_addPoly - */ - SkPath& addPoly(const SkPoint pts[], int count, bool close); - - /** Adds contour created from list. Contour added starts at list[0], then adds a line - for every additional SkPoint in list. If close is true, appends kClose_Verb to SkPath, - connecting last and first SkPoint in list. - - If list is empty, append kMove_Verb to path. - - @param list array of SkPoint - @param close true to add line connecting contour end and start - @return reference to SkPath - */ - SkPath& addPoly(const std::initializer_list& list, bool close) { - return this->addPoly(list.begin(), SkToInt(list.size()), close); - } - -#ifdef SK_HIDE_PATH_EDIT_METHODS -public: -#endif - - /** \enum SkPath::AddPathMode - AddPathMode chooses how addPath() appends. Adding one SkPath to another can extend - the last contour or start a new contour. - */ - enum AddPathMode { - kAppend_AddPathMode, //!< appended to destination unaltered - kExtend_AddPathMode, //!< add line if prior contour is not closed - }; - - /** Appends src to SkPath, offset by (dx, dy). - - If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are - added unaltered. If mode is kExtend_AddPathMode, add line before appending - verbs, SkPoint, and conic weights. - - @param src SkPath verbs, SkPoint, and conic weights to add - @param dx offset added to src SkPoint array x-axis coordinates - @param dy offset added to src SkPoint array y-axis coordinates - @param mode kAppend_AddPathMode or kExtend_AddPathMode - @return reference to SkPath - */ - SkPath& addPath(const SkPath& src, SkScalar dx, SkScalar dy, - AddPathMode mode = kAppend_AddPathMode); - - /** Appends src to SkPath. - - If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are - added unaltered. If mode is kExtend_AddPathMode, add line before appending - verbs, SkPoint, and conic weights. - - @param src SkPath verbs, SkPoint, and conic weights to add - @param mode kAppend_AddPathMode or kExtend_AddPathMode - @return reference to SkPath - */ - SkPath& addPath(const SkPath& src, AddPathMode mode = kAppend_AddPathMode) { - SkMatrix m; - m.reset(); - return this->addPath(src, m, mode); - } - - /** Appends src to SkPath, transformed by matrix. Transformed curves may have different - verbs, SkPoint, and conic weights. - - If mode is kAppend_AddPathMode, src verb array, SkPoint array, and conic weights are - added unaltered. If mode is kExtend_AddPathMode, add line before appending - verbs, SkPoint, and conic weights. - - @param src SkPath verbs, SkPoint, and conic weights to add - @param matrix transform applied to src - @param mode kAppend_AddPathMode or kExtend_AddPathMode - @return reference to SkPath - */ - SkPath& addPath(const SkPath& src, const SkMatrix& matrix, - AddPathMode mode = kAppend_AddPathMode); - - /** Appends src to SkPath, from back to front. - Reversed src always appends a new contour to SkPath. - - @param src SkPath verbs, SkPoint, and conic weights to add - @return reference to SkPath - - example: https://fiddle.skia.org/c/@Path_reverseAddPath - */ - SkPath& reverseAddPath(const SkPath& src); - - /** Offsets SkPoint array by (dx, dy). Offset SkPath replaces dst. - If dst is nullptr, SkPath is replaced by offset data. - - @param dx offset added to SkPoint array x-axis coordinates - @param dy offset added to SkPoint array y-axis coordinates - @param dst overwritten, translated copy of SkPath; may be nullptr - - example: https://fiddle.skia.org/c/@Path_offset - */ - void offset(SkScalar dx, SkScalar dy, SkPath* dst) const; - - /** Offsets SkPoint array by (dx, dy). SkPath is replaced by offset data. - - @param dx offset added to SkPoint array x-axis coordinates - @param dy offset added to SkPoint array y-axis coordinates - */ - void offset(SkScalar dx, SkScalar dy) { - this->offset(dx, dy, this); - } - - /** Transforms verb array, SkPoint array, and weight by matrix. - transform may change verbs and increase their number. - Transformed SkPath replaces dst; if dst is nullptr, original data - is replaced. - - @param matrix SkMatrix to apply to SkPath - @param dst overwritten, transformed copy of SkPath; may be nullptr - @param pc whether to apply perspective clipping - - example: https://fiddle.skia.org/c/@Path_transform - */ - void transform(const SkMatrix& matrix, SkPath* dst, - SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const; - - /** Transforms verb array, SkPoint array, and weight by matrix. - transform may change verbs and increase their number. - SkPath is replaced by transformed data. - - @param matrix SkMatrix to apply to SkPath - @param pc whether to apply perspective clipping - */ - void transform(const SkMatrix& matrix, - SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) { - this->transform(matrix, this, pc); - } - - SkPath makeTransform(const SkMatrix& m, - SkApplyPerspectiveClip pc = SkApplyPerspectiveClip::kYes) const { - SkPath dst; - this->transform(m, &dst, pc); - return dst; - } - - SkPath makeScale(SkScalar sx, SkScalar sy) { - return this->makeTransform(SkMatrix::Scale(sx, sy), SkApplyPerspectiveClip::kNo); - } - - /** Returns last point on SkPath in lastPt. Returns false if SkPoint array is empty, - storing (0, 0) if lastPt is not nullptr. - - @param lastPt storage for final SkPoint in SkPoint array; may be nullptr - @return true if SkPoint array contains one or more SkPoint - - example: https://fiddle.skia.org/c/@Path_getLastPt - */ - bool getLastPt(SkPoint* lastPt) const; - - /** Sets last point to (x, y). If SkPoint array is empty, append kMove_Verb to - verb array and append (x, y) to SkPoint array. - - @param x set x-axis value of last point - @param y set y-axis value of last point - - example: https://fiddle.skia.org/c/@Path_setLastPt - */ - void setLastPt(SkScalar x, SkScalar y); - - /** Sets the last point on the path. If SkPoint array is empty, append kMove_Verb to - verb array and append p to SkPoint array. - - @param p set value of last point - */ - void setLastPt(const SkPoint& p) { - this->setLastPt(p.fX, p.fY); - } - - /** \enum SkPath::SegmentMask - SegmentMask constants correspond to each drawing Verb type in SkPath; for - instance, if SkPath only contains lines, only the kLine_SegmentMask bit is set. - */ - enum SegmentMask { - kLine_SegmentMask = kLine_SkPathSegmentMask, - kQuad_SegmentMask = kQuad_SkPathSegmentMask, - kConic_SegmentMask = kConic_SkPathSegmentMask, - kCubic_SegmentMask = kCubic_SkPathSegmentMask, - }; - - /** Returns a mask, where each set bit corresponds to a SegmentMask constant - if SkPath contains one or more verbs of that type. - Returns zero if SkPath contains no lines, or curves: quads, conics, or cubics. - - getSegmentMasks() returns a cached result; it is very fast. - - @return SegmentMask bits or zero - */ - uint32_t getSegmentMasks() const; - - /** \enum SkPath::Verb - Verb instructs SkPath how to interpret one or more SkPoint and optional conic weight; - manage contour, and terminate SkPath. - */ - enum Verb { - kMove_Verb = static_cast(SkPathVerb::kMove), - kLine_Verb = static_cast(SkPathVerb::kLine), - kQuad_Verb = static_cast(SkPathVerb::kQuad), - kConic_Verb = static_cast(SkPathVerb::kConic), - kCubic_Verb = static_cast(SkPathVerb::kCubic), - kClose_Verb = static_cast(SkPathVerb::kClose), - kDone_Verb = kClose_Verb + 1 - }; - - /** \class SkPath::Iter - Iterates through verb array, and associated SkPoint array and conic weight. - Provides options to treat open contours as closed, and to ignore - degenerate data. - */ - class SK_API Iter { - public: - - /** Initializes SkPath::Iter with an empty SkPath. next() on SkPath::Iter returns - kDone_Verb. - Call setPath to initialize SkPath::Iter at a later time. - - @return SkPath::Iter of empty SkPath - - example: https://fiddle.skia.org/c/@Path_Iter_Iter - */ - Iter(); - - /** Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in - path. If forceClose is true, SkPath::Iter will add kLine_Verb and kClose_Verb after each - open contour. path is not altered. - - @param path SkPath to iterate - @param forceClose true if open contours generate kClose_Verb - @return SkPath::Iter of path - - example: https://fiddle.skia.org/c/@Path_Iter_const_SkPath - */ - Iter(const SkPath& path, bool forceClose); - - /** Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in - path. If forceClose is true, SkPath::Iter will add kLine_Verb and kClose_Verb after each - open contour. path is not altered. - - @param path SkPath to iterate - @param forceClose true if open contours generate kClose_Verb - - example: https://fiddle.skia.org/c/@Path_Iter_setPath - */ - void setPath(const SkPath& path, bool forceClose); - - /** Returns next SkPath::Verb in verb array, and advances SkPath::Iter. - When verb array is exhausted, returns kDone_Verb. - - Zero to four SkPoint are stored in pts, depending on the returned SkPath::Verb. - - @param pts storage for SkPoint data describing returned SkPath::Verb - @return next SkPath::Verb from verb array - - example: https://fiddle.skia.org/c/@Path_RawIter_next - */ - Verb next(SkPoint pts[4]); - - /** Returns conic weight if next() returned kConic_Verb. - - If next() has not been called, or next() did not return kConic_Verb, - result is undefined. - - @return conic weight for conic SkPoint returned by next() - */ - SkScalar conicWeight() const { return *fConicWeights; } - - /** Returns true if last kLine_Verb returned by next() was generated - by kClose_Verb. When true, the end point returned by next() is - also the start point of contour. - - If next() has not been called, or next() did not return kLine_Verb, - result is undefined. - - @return true if last kLine_Verb was generated by kClose_Verb - */ - bool isCloseLine() const { return SkToBool(fCloseLine); } - - /** Returns true if subsequent calls to next() return kClose_Verb before returning - kMove_Verb. if true, contour SkPath::Iter is processing may end with kClose_Verb, or - SkPath::Iter may have been initialized with force close set to true. - - @return true if contour is closed - - example: https://fiddle.skia.org/c/@Path_Iter_isClosedContour - */ - bool isClosedContour() const; - - private: - const SkPoint* fPts; - const uint8_t* fVerbs; - const uint8_t* fVerbStop; - const SkScalar* fConicWeights; - SkPoint fMoveTo; - SkPoint fLastPt; - bool fForceClose; - bool fNeedClose; - bool fCloseLine; - - Verb autoClose(SkPoint pts[2]); - }; - -private: - /** \class SkPath::RangeIter - Iterates through a raw range of path verbs, points, and conics. All values are returned - unaltered. - - NOTE: This class will be moved into SkPathPriv once RangeIter is removed. - */ - class RangeIter { - public: - RangeIter() = default; - RangeIter(const uint8_t* verbs, const SkPoint* points, const SkScalar* weights) - : fVerb(verbs), fPoints(points), fWeights(weights) { - SkDEBUGCODE(fInitialPoints = fPoints;) - } - bool operator!=(const RangeIter& that) const { - return fVerb != that.fVerb; - } - bool operator==(const RangeIter& that) const { - return fVerb == that.fVerb; - } - RangeIter& operator++() { - auto verb = static_cast(*fVerb++); - fPoints += pts_advance_after_verb(verb); - if (verb == SkPathVerb::kConic) { - ++fWeights; - } - return *this; - } - RangeIter operator++(int) { - RangeIter copy = *this; - this->operator++(); - return copy; - } - SkPathVerb peekVerb() const { - return static_cast(*fVerb); - } - std::tuple operator*() const { - SkPathVerb verb = this->peekVerb(); - // We provide the starting point for beziers by peeking backwards from the current - // point, which works fine as long as there is always a kMove before any geometry. - // (SkPath::injectMoveToIfNeeded should have guaranteed this to be the case.) - int backset = pts_backset_for_verb(verb); - SkASSERT(fPoints + backset >= fInitialPoints); - return {verb, fPoints + backset, fWeights}; - } - private: - constexpr static int pts_advance_after_verb(SkPathVerb verb) { - switch (verb) { - case SkPathVerb::kMove: return 1; - case SkPathVerb::kLine: return 1; - case SkPathVerb::kQuad: return 2; - case SkPathVerb::kConic: return 2; - case SkPathVerb::kCubic: return 3; - case SkPathVerb::kClose: return 0; - } - SkUNREACHABLE; - } - constexpr static int pts_backset_for_verb(SkPathVerb verb) { - switch (verb) { - case SkPathVerb::kMove: return 0; - case SkPathVerb::kLine: return -1; - case SkPathVerb::kQuad: return -1; - case SkPathVerb::kConic: return -1; - case SkPathVerb::kCubic: return -1; - case SkPathVerb::kClose: return -1; - } - SkUNREACHABLE; - } - const uint8_t* fVerb = nullptr; - const SkPoint* fPoints = nullptr; - const SkScalar* fWeights = nullptr; - SkDEBUGCODE(const SkPoint* fInitialPoints = nullptr;) - }; -public: - - /** \class SkPath::RawIter - Use Iter instead. This class will soon be removed and RangeIter will be made private. - */ - class SK_API RawIter { - public: - - /** Initializes RawIter with an empty SkPath. next() on RawIter returns kDone_Verb. - Call setPath to initialize SkPath::Iter at a later time. - - @return RawIter of empty SkPath - */ - RawIter() {} - - /** Sets RawIter to return elements of verb array, SkPoint array, and conic weight in path. - - @param path SkPath to iterate - @return RawIter of path - */ - RawIter(const SkPath& path) { - setPath(path); - } - - /** Sets SkPath::Iter to return elements of verb array, SkPoint array, and conic weight in - path. - - @param path SkPath to iterate - */ - void setPath(const SkPath&); - - /** Returns next SkPath::Verb in verb array, and advances RawIter. - When verb array is exhausted, returns kDone_Verb. - Zero to four SkPoint are stored in pts, depending on the returned SkPath::Verb. - - @param pts storage for SkPoint data describing returned SkPath::Verb - @return next SkPath::Verb from verb array - */ - Verb next(SkPoint[4]); - - /** Returns next SkPath::Verb, but does not advance RawIter. - - @return next SkPath::Verb from verb array - */ - Verb peek() const { - return (fIter != fEnd) ? static_cast(std::get<0>(*fIter)) : kDone_Verb; - } - - /** Returns conic weight if next() returned kConic_Verb. - - If next() has not been called, or next() did not return kConic_Verb, - result is undefined. - - @return conic weight for conic SkPoint returned by next() - */ - SkScalar conicWeight() const { - return fConicWeight; - } - - private: - RangeIter fIter; - RangeIter fEnd; - SkScalar fConicWeight = 0; - friend class SkPath; - - }; - - /** Returns true if the point (x, y) is contained by SkPath, taking into - account FillType. - - @param x x-axis value of containment test - @param y y-axis value of containment test - @return true if SkPoint is in SkPath - - example: https://fiddle.skia.org/c/@Path_contains - */ - bool contains(SkScalar x, SkScalar y) const; - - /** Writes text representation of SkPath to stream. If stream is nullptr, writes to - standard output. Set dumpAsHex true to generate exact binary representations - of floating point numbers used in SkPoint array and conic weights. - - @param stream writable SkWStream receiving SkPath text representation; may be nullptr - @param dumpAsHex true if SkScalar values are written as hexadecimal - - example: https://fiddle.skia.org/c/@Path_dump - */ - void dump(SkWStream* stream, bool dumpAsHex) const; - - void dump() const { this->dump(nullptr, false); } - void dumpHex() const { this->dump(nullptr, true); } - - // Like dump(), but outputs for the SkPath::Make() factory - void dumpArrays(SkWStream* stream, bool dumpAsHex) const; - void dumpArrays() const { this->dumpArrays(nullptr, false); } - - /** Writes SkPath to buffer, returning the number of bytes written. - Pass nullptr to obtain the storage size. - - Writes SkPath::FillType, verb array, SkPoint array, conic weight, and - additionally writes computed information like SkPath::Convexity and bounds. - - Use only be used in concert with readFromMemory(); - the format used for SkPath in memory is not guaranteed. - - @param buffer storage for SkPath; may be nullptr - @return size of storage required for SkPath; always a multiple of 4 - - example: https://fiddle.skia.org/c/@Path_writeToMemory - */ - size_t writeToMemory(void* buffer) const; - - /** Writes SkPath to buffer, returning the buffer written to, wrapped in SkData. - - serialize() writes SkPath::FillType, verb array, SkPoint array, conic weight, and - additionally writes computed information like SkPath::Convexity and bounds. - - serialize() should only be used in concert with readFromMemory(). - The format used for SkPath in memory is not guaranteed. - - @return SkPath data wrapped in SkData buffer - - example: https://fiddle.skia.org/c/@Path_serialize - */ - sk_sp serialize() const; - - /** Initializes SkPath from buffer of size length. Returns zero if the buffer is - data is inconsistent, or the length is too small. - - Reads SkPath::FillType, verb array, SkPoint array, conic weight, and - additionally reads computed information like SkPath::Convexity and bounds. - - Used only in concert with writeToMemory(); - the format used for SkPath in memory is not guaranteed. - - @param buffer storage for SkPath - @param length buffer size in bytes; must be multiple of 4 - @return number of bytes read, or zero on failure - - example: https://fiddle.skia.org/c/@Path_readFromMemory - */ - size_t readFromMemory(const void* buffer, size_t length); - - /** (See Skia bug 1762.) - Returns a non-zero, globally unique value. A different value is returned - if verb array, SkPoint array, or conic weight changes. - - Setting SkPath::FillType does not change generation identifier. - - Each time the path is modified, a different generation identifier will be returned. - SkPath::FillType does affect generation identifier on Android framework. - - @return non-zero, globally unique value - - example: https://fiddle.skia.org/c/@Path_getGenerationID - */ - uint32_t getGenerationID() const; - - /** Returns if SkPath data is consistent. Corrupt SkPath data is detected if - internal values are out of range or internal storage does not match - array dimensions. - - @return true if SkPath data is consistent - */ - bool isValid() const; - - using sk_is_trivially_relocatable = std::true_type; - -private: - SkPath(sk_sp, SkPathFillType, bool isVolatile, SkPathConvexity, - SkPathFirstDirection firstDirection); - - sk_sp fPathRef; - int fLastMoveToIndex; - mutable std::atomic fConvexity; // SkPathConvexity - mutable std::atomic fFirstDirection; // SkPathFirstDirection - uint8_t fFillType : 2; - uint8_t fIsVolatile : 1; - - static_assert(::sk_is_trivially_relocatable::value); - - /** Resets all fields other than fPathRef to their initial 'empty' values. - * Assumes the caller has already emptied fPathRef. - * On Android increments fGenerationID without reseting it. - */ - void resetFields(); - - /** Sets all fields other than fPathRef to the values in 'that'. - * Assumes the caller has already set fPathRef. - * Doesn't change fGenerationID or fSourcePath on Android. - */ - void copyFields(const SkPath& that); - - size_t writeToMemoryAsRRect(void* buffer) const; - size_t readAsRRect(const void*, size_t); - size_t readFromMemory_EQ4Or5(const void*, size_t); - - friend class Iter; - friend class SkPathPriv; - friend class SkPathStroker; - - /* Append, in reverse order, the first contour of path, ignoring path's - last point. If no moveTo() call has been made for this contour, the - first point is automatically set to (0,0). - */ - SkPath& reversePathTo(const SkPath&); - - // called before we add points for lineTo, quadTo, cubicTo, checking to see - // if we need to inject a leading moveTo first - // - // SkPath path; path.lineTo(...); <--- need a leading moveTo(0, 0) - // SkPath path; ... path.close(); path.lineTo(...) <-- need a moveTo(previous moveTo) - // - inline void injectMoveToIfNeeded(); - - inline bool hasOnlyMoveTos() const; - - SkPathConvexity computeConvexity() const; - - bool isValidImpl() const; - /** Asserts if SkPath data is inconsistent. - Debugging check intended for internal use only. - */ -#ifdef SK_DEBUG - void validate() const; - void validateRef() const; -#endif - - // called by stroker to see if all points (in the last contour) are equal and worthy of a cap - bool isZeroLengthSincePoint(int startPtIndex) const; - - /** Returns if the path can return a bound at no cost (true) or will have to - perform some computation (false). - */ - bool hasComputedBounds() const; - - // 'rect' needs to be sorted - void setBounds(const SkRect& rect); - - void setPt(int index, SkScalar x, SkScalar y); - - SkPath& dirtyAfterEdit(); - - // Bottlenecks for working with fConvexity and fFirstDirection. - // Notice the setters are const... these are mutable atomic fields. - void setConvexity(SkPathConvexity) const; - - void setFirstDirection(SkPathFirstDirection) const; - SkPathFirstDirection getFirstDirection() const; - - /** Returns the comvexity type, computing if needed. Never returns kUnknown. - @return path's convexity type (convex or concave) - */ - SkPathConvexity getConvexity() const; - - SkPathConvexity getConvexityOrUnknown() const; - - // Compares the cached value with a freshly computed one (computeConvexity()) - bool isConvexityAccurate() const; - - /** Stores a convexity type for this path. This is what will be returned if - * getConvexityOrUnknown() is called. If you pass kUnknown, then if getContexityType() - * is called, the real convexity will be computed. - * - * example: https://fiddle.skia.org/c/@Path_setConvexity - */ - void setConvexity(SkPathConvexity convexity); - - /** Shrinks SkPath verb array and SkPoint array storage to discard unused capacity. - * May reduce the heap overhead for SkPath known to be fully constructed. - * - * NOTE: This may relocate the underlying buffers, and thus any Iterators referencing - * this path should be discarded after calling shrinkToFit(). - */ - void shrinkToFit(); - - friend class SkAutoPathBoundsUpdate; - friend class SkAutoDisableOvalCheck; - friend class SkAutoDisableDirectionCheck; - friend class SkPathBuilder; - friend class SkPathEdgeIter; - friend class SkPathWriter; - friend class SkOpBuilder; - friend class SkBench_AddPathTest; // perf test reversePathTo - friend class PathTest_Private; // unit test reversePathTo - friend class ForceIsRRect_Private; // unit test isRRect - friend class FuzzPath; // for legacy access to validateRef -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathBuilder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathBuilder.h deleted file mode 100644 index b52eaaaa96b0b6..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathBuilder.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPathBuilder_DEFINED -#define SkPathBuilder_DEFINED - -#include "include/core/SkMatrix.h" -#include "include/core/SkPath.h" -#include "include/core/SkPathTypes.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkTDArray.h" - -class SK_API SkPathBuilder { -public: - SkPathBuilder(); - SkPathBuilder(SkPathFillType); - SkPathBuilder(const SkPath&); - SkPathBuilder(const SkPathBuilder&) = default; - ~SkPathBuilder(); - - SkPathBuilder& operator=(const SkPath&); - SkPathBuilder& operator=(const SkPathBuilder&) = default; - - SkPathFillType fillType() const { return fFillType; } - SkRect computeBounds() const; - - SkPath snapshot() const; // the builder is unchanged after returning this path - SkPath detach(); // the builder is reset to empty after returning this path - - SkPathBuilder& setFillType(SkPathFillType ft) { fFillType = ft; return *this; } - SkPathBuilder& setIsVolatile(bool isVolatile) { fIsVolatile = isVolatile; return *this; } - - SkPathBuilder& reset(); - - SkPathBuilder& moveTo(SkPoint pt); - SkPathBuilder& moveTo(SkScalar x, SkScalar y) { return this->moveTo(SkPoint::Make(x, y)); } - - SkPathBuilder& lineTo(SkPoint pt); - SkPathBuilder& lineTo(SkScalar x, SkScalar y) { return this->lineTo(SkPoint::Make(x, y)); } - - SkPathBuilder& quadTo(SkPoint pt1, SkPoint pt2); - SkPathBuilder& quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { - return this->quadTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2)); - } - SkPathBuilder& quadTo(const SkPoint pts[2]) { return this->quadTo(pts[0], pts[1]); } - - SkPathBuilder& conicTo(SkPoint pt1, SkPoint pt2, SkScalar w); - SkPathBuilder& conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w) { - return this->conicTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2), w); - } - SkPathBuilder& conicTo(const SkPoint pts[2], SkScalar w) { - return this->conicTo(pts[0], pts[1], w); - } - - SkPathBuilder& cubicTo(SkPoint pt1, SkPoint pt2, SkPoint pt3); - SkPathBuilder& cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3) { - return this->cubicTo(SkPoint::Make(x1, y1), SkPoint::Make(x2, y2), SkPoint::Make(x3, y3)); - } - SkPathBuilder& cubicTo(const SkPoint pts[3]) { - return this->cubicTo(pts[0], pts[1], pts[2]); - } - - SkPathBuilder& close(); - - // Append a series of lineTo(...) - SkPathBuilder& polylineTo(const SkPoint pts[], int count); - SkPathBuilder& polylineTo(const std::initializer_list& list) { - return this->polylineTo(list.begin(), SkToInt(list.size())); - } - - // Relative versions of segments, relative to the previous position. - - SkPathBuilder& rLineTo(SkPoint pt); - SkPathBuilder& rLineTo(SkScalar x, SkScalar y) { return this->rLineTo({x, y}); } - SkPathBuilder& rQuadTo(SkPoint pt1, SkPoint pt2); - SkPathBuilder& rQuadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) { - return this->rQuadTo({x1, y1}, {x2, y2}); - } - SkPathBuilder& rConicTo(SkPoint p1, SkPoint p2, SkScalar w); - SkPathBuilder& rConicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w) { - return this->rConicTo({x1, y1}, {x2, y2}, w); - } - SkPathBuilder& rCubicTo(SkPoint pt1, SkPoint pt2, SkPoint pt3); - SkPathBuilder& rCubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3) { - return this->rCubicTo({x1, y1}, {x2, y2}, {x3, y3}); - } - - // Arcs - - /** Appends arc to the builder. Arc added is part of ellipse - bounded by oval, from startAngle through sweepAngle. Both startAngle and - sweepAngle are measured in degrees, where zero degrees is aligned with the - positive x-axis, and positive sweeps extends arc clockwise. - - arcTo() adds line connecting the builder's last point to initial arc point if forceMoveTo - is false and the builder is not empty. Otherwise, added contour begins with first point - of arc. Angles greater than -360 and less than 360 are treated modulo 360. - - @param oval bounds of ellipse containing arc - @param startAngleDeg starting angle of arc in degrees - @param sweepAngleDeg sweep, in degrees. Positive is clockwise; treated modulo 360 - @param forceMoveTo true to start a new contour with arc - @return reference to the builder - */ - SkPathBuilder& arcTo(const SkRect& oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg, - bool forceMoveTo); - - /** Appends arc to SkPath, after appending line if needed. Arc is implemented by conic - weighted to describe part of circle. Arc is contained by tangent from - last SkPath point to p1, and tangent from p1 to p2. Arc - is part of circle sized to radius, positioned so it touches both tangent lines. - - If last SkPath SkPoint does not start arc, arcTo() appends connecting line to SkPath. - The length of vector from p1 to p2 does not affect arc. - - Arc sweep is always less than 180 degrees. If radius is zero, or if - tangents are nearly parallel, arcTo() appends line from last SkPath SkPoint to p1. - - arcTo() appends at most one line and one conic. - arcTo() implements the functionality of PostScript arct and HTML Canvas arcTo. - - @param p1 SkPoint common to pair of tangents - @param p2 end of second tangent - @param radius distance from arc to circle center - @return reference to SkPath - */ - SkPathBuilder& arcTo(SkPoint p1, SkPoint p2, SkScalar radius); - - enum ArcSize { - kSmall_ArcSize, //!< smaller of arc pair - kLarge_ArcSize, //!< larger of arc pair - }; - - /** Appends arc to SkPath. Arc is implemented by one or more conic weighted to describe - part of oval with radii (r.fX, r.fY) rotated by xAxisRotate degrees. Arc curves - from last SkPath SkPoint to (xy.fX, xy.fY), choosing one of four possible routes: - clockwise or counterclockwise, - and smaller or larger. - - Arc sweep is always less than 360 degrees. arcTo() appends line to xy if either - radii are zero, or if last SkPath SkPoint equals (xy.fX, xy.fY). arcTo() scales radii r to - fit last SkPath SkPoint and xy if both are greater than zero but too small to describe - an arc. - - arcTo() appends up to four conic curves. - arcTo() implements the functionality of SVG arc, although SVG sweep-flag value is - opposite the integer value of sweep; SVG sweep-flag uses 1 for clockwise, while - kCW_Direction cast to int is zero. - - @param r radii on axes before x-axis rotation - @param xAxisRotate x-axis rotation in degrees; positive values are clockwise - @param largeArc chooses smaller or larger arc - @param sweep chooses clockwise or counterclockwise arc - @param xy end of arc - @return reference to SkPath - */ - SkPathBuilder& arcTo(SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, SkPathDirection sweep, - SkPoint xy); - - /** Appends arc to the builder, as the start of new contour. Arc added is part of ellipse - bounded by oval, from startAngle through sweepAngle. Both startAngle and - sweepAngle are measured in degrees, where zero degrees is aligned with the - positive x-axis, and positive sweeps extends arc clockwise. - - If sweepAngle <= -360, or sweepAngle >= 360; and startAngle modulo 90 is nearly - zero, append oval instead of arc. Otherwise, sweepAngle values are treated - modulo 360, and arc may or may not draw depending on numeric rounding. - - @param oval bounds of ellipse containing arc - @param startAngleDeg starting angle of arc in degrees - @param sweepAngleDeg sweep, in degrees. Positive is clockwise; treated modulo 360 - @return reference to this builder - */ - SkPathBuilder& addArc(const SkRect& oval, SkScalar startAngleDeg, SkScalar sweepAngleDeg); - - // Add a new contour - - SkPathBuilder& addRect(const SkRect&, SkPathDirection, unsigned startIndex); - SkPathBuilder& addOval(const SkRect&, SkPathDirection, unsigned startIndex); - SkPathBuilder& addRRect(const SkRRect&, SkPathDirection, unsigned startIndex); - - SkPathBuilder& addRect(const SkRect& rect, SkPathDirection dir = SkPathDirection::kCW) { - return this->addRect(rect, dir, 0); - } - SkPathBuilder& addOval(const SkRect& rect, SkPathDirection dir = SkPathDirection::kCW) { - // legacy start index: 1 - return this->addOval(rect, dir, 1); - } - SkPathBuilder& addRRect(const SkRRect& rrect, SkPathDirection dir = SkPathDirection::kCW) { - // legacy start indices: 6 (CW) and 7 (CCW) - return this->addRRect(rrect, dir, dir == SkPathDirection::kCW ? 6 : 7); - } - - SkPathBuilder& addCircle(SkScalar center_x, SkScalar center_y, SkScalar radius, - SkPathDirection dir = SkPathDirection::kCW); - - SkPathBuilder& addPolygon(const SkPoint pts[], int count, bool isClosed); - SkPathBuilder& addPolygon(const std::initializer_list& list, bool isClosed) { - return this->addPolygon(list.begin(), SkToInt(list.size()), isClosed); - } - - SkPathBuilder& addPath(const SkPath&); - - // Performance hint, to reserve extra storage for subsequent calls to lineTo, quadTo, etc. - - void incReserve(int extraPtCount, int extraVerbCount); - void incReserve(int extraPtCount) { - this->incReserve(extraPtCount, extraPtCount); - } - - SkPathBuilder& offset(SkScalar dx, SkScalar dy); - - SkPathBuilder& toggleInverseFillType() { - fFillType = (SkPathFillType)((unsigned)fFillType ^ 2); - return *this; - } - -private: - SkTDArray fPts; - SkTDArray fVerbs; - SkTDArray fConicWeights; - - SkPathFillType fFillType; - bool fIsVolatile; - - unsigned fSegmentMask; - SkPoint fLastMovePoint; - int fLastMoveIndex; // only needed until SkPath is immutable - bool fNeedsMoveVerb; - - enum IsA { - kIsA_JustMoves, // we only have 0 or more moves - kIsA_MoreThanMoves, // we have verbs other than just move - kIsA_Oval, // we are 0 or more moves followed by an oval - kIsA_RRect, // we are 0 or more moves followed by a rrect - }; - IsA fIsA = kIsA_JustMoves; - int fIsAStart = -1; // tracks direction iff fIsA is not unknown - bool fIsACCW = false; // tracks direction iff fIsA is not unknown - - int countVerbs() const { return fVerbs.size(); } - - // called right before we add a (non-move) verb - void ensureMove() { - fIsA = kIsA_MoreThanMoves; - if (fNeedsMoveVerb) { - this->moveTo(fLastMovePoint); - } - } - - SkPath make(sk_sp) const; - - SkPathBuilder& privateReverseAddPath(const SkPath&); - - friend class SkPathPriv; -}; - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathEffect.h deleted file mode 100644 index abb370c52af58e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathEffect.h +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPathEffect_DEFINED -#define SkPathEffect_DEFINED - -#include "include/core/SkFlattenable.h" -#include "include/core/SkScalar.h" -// not needed, but some of our clients need it (they don't IWYU) -#include "include/core/SkPath.h" - -class SkPath; -struct SkRect; -class SkStrokeRec; - -/** \class SkPathEffect - - SkPathEffect is the base class for objects in the SkPaint that affect - the geometry of a drawing primitive before it is transformed by the - canvas' matrix and drawn. - - Dashing is implemented as a subclass of SkPathEffect. -*/ -class SK_API SkPathEffect : public SkFlattenable { -public: - /** - * Returns a patheffect that apples each effect (first and second) to the original path, - * and returns a path with the sum of these. - * - * result = first(path) + second(path) - * - */ - static sk_sp MakeSum(sk_sp first, sk_sp second); - - /** - * Returns a patheffect that applies the inner effect to the path, and then applies the - * outer effect to the result of the inner's. - * - * result = outer(inner(path)) - */ - static sk_sp MakeCompose(sk_sp outer, sk_sp inner); - - static SkFlattenable::Type GetFlattenableType() { - return kSkPathEffect_Type; - } - - // move to base? - - enum DashType { - kNone_DashType, //!< ignores the info parameter - kDash_DashType, //!< fills in all of the info parameter - }; - - struct DashInfo { - DashInfo() : fIntervals(nullptr), fCount(0), fPhase(0) {} - DashInfo(SkScalar* intervals, int32_t count, SkScalar phase) - : fIntervals(intervals), fCount(count), fPhase(phase) {} - - SkScalar* fIntervals; //!< Length of on/off intervals for dashed lines - // Even values represent ons, and odds offs - int32_t fCount; //!< Number of intervals in the dash. Should be even number - SkScalar fPhase; //!< Offset into the dashed interval pattern - // mod the sum of all intervals - }; - - DashType asADash(DashInfo* info) const; - - /** - * Given a src path (input) and a stroke-rec (input and output), apply - * this effect to the src path, returning the new path in dst, and return - * true. If this effect cannot be applied, return false and ignore dst - * and stroke-rec. - * - * The stroke-rec specifies the initial request for stroking (if any). - * The effect can treat this as input only, or it can choose to change - * the rec as well. For example, the effect can decide to change the - * stroke's width or join, or the effect can change the rec from stroke - * to fill (or fill to stroke) in addition to returning a new (dst) path. - * - * If this method returns true, the caller will apply (as needed) the - * resulting stroke-rec to dst and then draw. - */ - bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect* cullR) const; - - /** Version of filterPath that can be called when the CTM is known. */ - bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*, const SkRect* cullR, - const SkMatrix& ctm) const; - - /** True if this path effect requires a valid CTM */ - bool needsCTM() const; - - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr); - -private: - SkPathEffect() = default; - friend class SkPathEffectBase; - - using INHERITED = SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathMeasure.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathMeasure.h deleted file mode 100644 index 2335c7c23ce13b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathMeasure.h +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPathMeasure_DEFINED -#define SkPathMeasure_DEFINED - -#include "include/core/SkContourMeasure.h" -#include "include/core/SkPath.h" -#include "include/private/SkTDArray.h" - -class SK_API SkPathMeasure { -public: - SkPathMeasure(); - /** Initialize the pathmeasure with the specified path. The parts of the path that are needed - * are copied, so the client is free to modify/delete the path after this call. - * - * resScale controls the precision of the measure. values > 1 increase the - * precision (and possibly slow down the computation). - */ - SkPathMeasure(const SkPath& path, bool forceClosed, SkScalar resScale = 1); - ~SkPathMeasure(); - - /** Reset the pathmeasure with the specified path. The parts of the path that are needed - * are copied, so the client is free to modify/delete the path after this call.. - */ - void setPath(const SkPath*, bool forceClosed); - - /** Return the total length of the current contour, or 0 if no path - is associated (e.g. resetPath(null)) - */ - SkScalar getLength(); - - /** Pins distance to 0 <= distance <= getLength(), and then computes - the corresponding position and tangent. - Returns false if there is no path, or a zero-length path was specified, in which case - position and tangent are unchanged. - */ - bool SK_WARN_UNUSED_RESULT getPosTan(SkScalar distance, SkPoint* position, - SkVector* tangent); - - enum MatrixFlags { - kGetPosition_MatrixFlag = 0x01, - kGetTangent_MatrixFlag = 0x02, - kGetPosAndTan_MatrixFlag = kGetPosition_MatrixFlag | kGetTangent_MatrixFlag - }; - - /** Pins distance to 0 <= distance <= getLength(), and then computes - the corresponding matrix (by calling getPosTan). - Returns false if there is no path, or a zero-length path was specified, in which case - matrix is unchanged. - */ - bool SK_WARN_UNUSED_RESULT getMatrix(SkScalar distance, SkMatrix* matrix, - MatrixFlags flags = kGetPosAndTan_MatrixFlag); - - /** Given a start and stop distance, return in dst the intervening segment(s). - If the segment is zero-length, return false, else return true. - startD and stopD are pinned to legal values (0..getLength()). If startD > stopD - then return false (and leave dst untouched). - Begin the segment with a moveTo if startWithMoveTo is true - */ - bool getSegment(SkScalar startD, SkScalar stopD, SkPath* dst, bool startWithMoveTo); - - /** Return true if the current contour is closed() - */ - bool isClosed(); - - /** Move to the next contour in the path. Return true if one exists, or false if - we're done with the path. - */ - bool nextContour(); - -#ifdef SK_DEBUG - void dump(); -#endif - -private: - SkContourMeasureIter fIter; - sk_sp fContour; - - SkPathMeasure(const SkPathMeasure&) = delete; - SkPathMeasure& operator=(const SkPathMeasure&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathTypes.h deleted file mode 100644 index f589ea46ce2e34..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPathTypes.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2019 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPathTypes_DEFINED -#define SkPathTypes_DEFINED - -#include "include/core/SkTypes.h" - -enum class SkPathFillType { - /** Specifies that "inside" is computed by a non-zero sum of signed edge crossings */ - kWinding, - /** Specifies that "inside" is computed by an odd number of edge crossings */ - kEvenOdd, - /** Same as Winding, but draws outside of the path, rather than inside */ - kInverseWinding, - /** Same as EvenOdd, but draws outside of the path, rather than inside */ - kInverseEvenOdd -}; - -static inline bool SkPathFillType_IsEvenOdd(SkPathFillType ft) { - return (static_cast(ft) & 1) != 0; -} - -static inline bool SkPathFillType_IsInverse(SkPathFillType ft) { - return (static_cast(ft) & 2) != 0; -} - -static inline SkPathFillType SkPathFillType_ConvertToNonInverse(SkPathFillType ft) { - return static_cast(static_cast(ft) & 1); -} - -enum class SkPathDirection { - /** clockwise direction for adding closed contours */ - kCW, - /** counter-clockwise direction for adding closed contours */ - kCCW, -}; - -enum SkPathSegmentMask { - kLine_SkPathSegmentMask = 1 << 0, - kQuad_SkPathSegmentMask = 1 << 1, - kConic_SkPathSegmentMask = 1 << 2, - kCubic_SkPathSegmentMask = 1 << 3, -}; - -enum class SkPathVerb { - kMove, //!< SkPath::RawIter returns 1 point - kLine, //!< SkPath::RawIter returns 2 points - kQuad, //!< SkPath::RawIter returns 3 points - kConic, //!< SkPath::RawIter returns 3 points + 1 weight - kCubic, //!< SkPath::RawIter returns 4 points - kClose //!< SkPath::RawIter returns 0 points -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPicture.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPicture.h deleted file mode 100644 index b6422dd56e3ee2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPicture.h +++ /dev/null @@ -1,277 +0,0 @@ -/* - * Copyright 2007 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPicture_DEFINED -#define SkPicture_DEFINED - -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkShader.h" -#include "include/core/SkTileMode.h" -#include "include/core/SkTypes.h" - -class SkCanvas; -class SkData; -struct SkDeserialProcs; -class SkImage; -class SkMatrix; -struct SkSerialProcs; -class SkStream; -class SkWStream; - -/** \class SkPicture - SkPicture records drawing commands made to SkCanvas. The command stream may be - played in whole or in part at a later time. - - SkPicture is an abstract class. SkPicture may be generated by SkPictureRecorder - or SkDrawable, or from SkPicture previously saved to SkData or SkStream. - - SkPicture may contain any SkCanvas drawing command, as well as one or more - SkCanvas matrix or SkCanvas clip. SkPicture has a cull SkRect, which is used as - a bounding box hint. To limit SkPicture bounds, use SkCanvas clip when - recording or drawing SkPicture. -*/ -class SK_API SkPicture : public SkRefCnt { -public: - ~SkPicture() override; - - /** Recreates SkPicture that was serialized into a stream. Returns constructed SkPicture - if successful; otherwise, returns nullptr. Fails if data does not permit - constructing valid SkPicture. - - procs->fPictureProc permits supplying a custom function to decode SkPicture. - If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx - may be used to provide user context to procs->fPictureProc; procs->fPictureProc - is called with a pointer to data, data byte length, and user context. - - @param stream container for serial data - @param procs custom serial data decoders; may be nullptr - @return SkPicture constructed from stream data - */ - static sk_sp MakeFromStream(SkStream* stream, - const SkDeserialProcs* procs = nullptr); - - /** Recreates SkPicture that was serialized into data. Returns constructed SkPicture - if successful; otherwise, returns nullptr. Fails if data does not permit - constructing valid SkPicture. - - procs->fPictureProc permits supplying a custom function to decode SkPicture. - If procs->fPictureProc is nullptr, default decoding is used. procs->fPictureCtx - may be used to provide user context to procs->fPictureProc; procs->fPictureProc - is called with a pointer to data, data byte length, and user context. - - @param data container for serial data - @param procs custom serial data decoders; may be nullptr - @return SkPicture constructed from data - */ - static sk_sp MakeFromData(const SkData* data, - const SkDeserialProcs* procs = nullptr); - - /** - - @param data pointer to serial data - @param size size of data - @param procs custom serial data decoders; may be nullptr - @return SkPicture constructed from data - */ - static sk_sp MakeFromData(const void* data, size_t size, - const SkDeserialProcs* procs = nullptr); - - /** \class SkPicture::AbortCallback - AbortCallback is an abstract class. An implementation of AbortCallback may - passed as a parameter to SkPicture::playback, to stop it before all drawing - commands have been processed. - - If AbortCallback::abort returns true, SkPicture::playback is interrupted. - */ - class SK_API AbortCallback { - public: - /** Has no effect. - */ - virtual ~AbortCallback() = default; - - /** Stops SkPicture playback when some condition is met. A subclass of - AbortCallback provides an override for abort() that can stop SkPicture::playback. - - The part of SkPicture drawn when aborted is undefined. SkPicture instantiations are - free to stop drawing at different points during playback. - - If the abort happens inside one or more calls to SkCanvas::save(), stack - of SkCanvas matrix and SkCanvas clip values is restored to its state before - SkPicture::playback was called. - - @return true to stop playback - - example: https://fiddle.skia.org/c/@Picture_AbortCallback_abort - */ - virtual bool abort() = 0; - - protected: - AbortCallback() = default; - AbortCallback(const AbortCallback&) = delete; - AbortCallback& operator=(const AbortCallback&) = delete; - }; - - /** Replays the drawing commands on the specified canvas. In the case that the - commands are recorded, each command in the SkPicture is sent separately to canvas. - - To add a single command to draw SkPicture to recording canvas, call - SkCanvas::drawPicture instead. - - @param canvas receiver of drawing commands - @param callback allows interruption of playback - - example: https://fiddle.skia.org/c/@Picture_playback - */ - virtual void playback(SkCanvas* canvas, AbortCallback* callback = nullptr) const = 0; - - /** Returns cull SkRect for this picture, passed in when SkPicture was created. - Returned SkRect does not specify clipping SkRect for SkPicture; cull is hint - of SkPicture bounds. - - SkPicture is free to discard recorded drawing commands that fall outside - cull. - - @return bounds passed when SkPicture was created - - example: https://fiddle.skia.org/c/@Picture_cullRect - */ - virtual SkRect cullRect() const = 0; - - /** Returns a non-zero value unique among SkPicture in Skia process. - - @return identifier for SkPicture - */ - uint32_t uniqueID() const { return fUniqueID; } - - /** Returns storage containing SkData describing SkPicture, using optional custom - encoders. - - procs->fPictureProc permits supplying a custom function to encode SkPicture. - If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx - may be used to provide user context to procs->fPictureProc; procs->fPictureProc - is called with a pointer to SkPicture and user context. - - @param procs custom serial data encoders; may be nullptr - @return storage containing serialized SkPicture - - example: https://fiddle.skia.org/c/@Picture_serialize - */ - sk_sp serialize(const SkSerialProcs* procs = nullptr) const; - - /** Writes picture to stream, using optional custom encoders. - - procs->fPictureProc permits supplying a custom function to encode SkPicture. - If procs->fPictureProc is nullptr, default encoding is used. procs->fPictureCtx - may be used to provide user context to procs->fPictureProc; procs->fPictureProc - is called with a pointer to SkPicture and user context. - - @param stream writable serial data stream - @param procs custom serial data encoders; may be nullptr - - example: https://fiddle.skia.org/c/@Picture_serialize_2 - */ - void serialize(SkWStream* stream, const SkSerialProcs* procs = nullptr) const; - - /** Returns a placeholder SkPicture. Result does not draw, and contains only - cull SkRect, a hint of its bounds. Result is immutable; it cannot be changed - later. Result identifier is unique. - - Returned placeholder can be intercepted during playback to insert other - commands into SkCanvas draw stream. - - @param cull placeholder dimensions - @return placeholder with unique identifier - - example: https://fiddle.skia.org/c/@Picture_MakePlaceholder - */ - static sk_sp MakePlaceholder(SkRect cull); - - /** Returns the approximate number of operations in SkPicture. Returned value - may be greater or less than the number of SkCanvas calls - recorded: some calls may be recorded as more than one operation, other - calls may be optimized away. - - @param nested if true, include the op-counts of nested pictures as well, else - just return count the ops in the top-level picture. - @return approximate operation count - - example: https://fiddle.skia.org/c/@Picture_approximateOpCount - */ - virtual int approximateOpCount(bool nested = false) const = 0; - - /** Returns the approximate byte size of SkPicture. Does not include large objects - referenced by SkPicture. - - @return approximate size - - example: https://fiddle.skia.org/c/@Picture_approximateBytesUsed - */ - virtual size_t approximateBytesUsed() const = 0; - - /** Return a new shader that will draw with this picture. - * - * @param tmx The tiling mode to use when sampling in the x-direction. - * @param tmy The tiling mode to use when sampling in the y-direction. - * @param mode How to filter the tiles - * @param localMatrix Optional matrix used when sampling - * @param tile The tile rectangle in picture coordinates: this represents the subset - * (or superset) of the picture used when building a tile. It is not - * affected by localMatrix and does not imply scaling (only translation - * and cropping). If null, the tile rect is considered equal to the picture - * bounds. - * @return Returns a new shader object. Note: this function never returns null. - */ - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode, - const SkMatrix* localMatrix, const SkRect* tileRect) const; - - sk_sp makeShader(SkTileMode tmx, SkTileMode tmy, SkFilterMode mode) const { - return this->makeShader(tmx, tmy, mode, nullptr, nullptr); - } - -private: - // Allowed subclasses. - SkPicture(); - friend class SkBigPicture; - friend class SkEmptyPicture; - friend class SkPicturePriv; - - void serialize(SkWStream*, const SkSerialProcs*, class SkRefCntSet* typefaces, - bool textBlobsOnly=false) const; - static sk_sp MakeFromStream(SkStream*, const SkDeserialProcs*, - class SkTypefacePlayback*); - friend class SkPictureData; - - /** Return true if the SkStream/Buffer represents a serialized picture, and - fills out SkPictInfo. After this function returns, the data source is not - rewound so it will have to be manually reset before passing to - MakeFromStream or MakeFromBuffer. Note, MakeFromStream and - MakeFromBuffer perform this check internally so these entry points are - intended for stand alone tools. - If false is returned, SkPictInfo is unmodified. - */ - static bool StreamIsSKP(SkStream*, struct SkPictInfo*); - static bool BufferIsSKP(class SkReadBuffer*, struct SkPictInfo*); - friend bool SkPicture_StreamIsSKP(SkStream*, struct SkPictInfo*); - - // Returns NULL if this is not an SkBigPicture. - virtual const class SkBigPicture* asSkBigPicture() const { return nullptr; } - - static bool IsValidPictInfo(const struct SkPictInfo& info); - static sk_sp Forwardport(const struct SkPictInfo&, - const class SkPictureData*, - class SkReadBuffer* buffer); - - struct SkPictInfo createHeader() const; - class SkPictureData* backport() const; - - uint32_t fUniqueID; - mutable std::atomic fAddedToCache{false}; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPictureRecorder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPictureRecorder.h deleted file mode 100644 index af3926dd25f0f2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPictureRecorder.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPictureRecorder_DEFINED -#define SkPictureRecorder_DEFINED - -#include "include/core/SkBBHFactory.h" -#include "include/core/SkPicture.h" -#include "include/core/SkRefCnt.h" - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK -namespace android { - class Picture; -}; -#endif - -class SkCanvas; -class SkDrawable; -class SkPictureRecord; -class SkRecord; -class SkRecorder; - -class SK_API SkPictureRecorder { -public: - SkPictureRecorder(); - ~SkPictureRecorder(); - - enum FinishFlags { - }; - - /** Returns the canvas that records the drawing commands. - @param bounds the cull rect used when recording this picture. Any drawing the falls outside - of this rect is undefined, and may be drawn or it may not. - @param bbh optional acceleration structure - @param recordFlags optional flags that control recording. - @return the canvas. - */ - SkCanvas* beginRecording(const SkRect& bounds, sk_sp bbh); - - SkCanvas* beginRecording(const SkRect& bounds, SkBBHFactory* bbhFactory = nullptr); - - SkCanvas* beginRecording(SkScalar width, SkScalar height, - SkBBHFactory* bbhFactory = nullptr) { - return this->beginRecording(SkRect::MakeWH(width, height), bbhFactory); - } - - /** Returns the recording canvas if one is active, or NULL if recording is - not active. This does not alter the refcnt on the canvas (if present). - */ - SkCanvas* getRecordingCanvas(); - - /** - * Signal that the caller is done recording. This invalidates the canvas returned by - * beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who - * must call unref() when they are done using it. - * - * The returned picture is immutable. If during recording drawables were added to the canvas, - * these will have been "drawn" into a recording canvas, so that this resulting picture will - * reflect their current state, but will not contain a live reference to the drawables - * themselves. - */ - sk_sp finishRecordingAsPicture(); - - /** - * Signal that the caller is done recording, and update the cull rect to use for bounding - * box hierarchy (BBH) generation. The behavior is the same as calling - * finishRecordingAsPicture(), except that this method updates the cull rect initially passed - * into beginRecording. - * @param cullRect the new culling rectangle to use as the overall bound for BBH generation - * and subsequent culling operations. - * @return the picture containing the recorded content. - */ - sk_sp finishRecordingAsPictureWithCull(const SkRect& cullRect); - - /** - * Signal that the caller is done recording. This invalidates the canvas returned by - * beginRecording/getRecordingCanvas. Ownership of the object is passed to the caller, who - * must call unref() when they are done using it. - * - * Unlike finishRecordingAsPicture(), which returns an immutable picture, the returned drawable - * may contain live references to other drawables (if they were added to the recording canvas) - * and therefore this drawable will reflect the current state of those nested drawables anytime - * it is drawn or a new picture is snapped from it (by calling drawable->newPictureSnapshot()). - */ - sk_sp finishRecordingAsDrawable(); - -private: - void reset(); - - /** Replay the current (partially recorded) operation stream into - canvas. This call doesn't close the current recording. - */ -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - friend class android::Picture; -#endif - friend class SkPictureRecorderReplayTester; // for unit testing - void partialReplay(SkCanvas* canvas) const; - - bool fActivelyRecording; - SkRect fCullRect; - sk_sp fBBH; - std::unique_ptr fRecorder; - sk_sp fRecord; - - SkPictureRecorder(SkPictureRecorder&&) = delete; - SkPictureRecorder& operator=(SkPictureRecorder&&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixelRef.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixelRef.h deleted file mode 100644 index ce25665b01a6aa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixelRef.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2008 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPixelRef_DEFINED -#define SkPixelRef_DEFINED - -#include "include/core/SkBitmap.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" -#include "include/private/SkIDChangeListener.h" -#include "include/private/SkMutex.h" -#include "include/private/SkTDArray.h" - -#include - -struct SkIRect; - -class GrTexture; -class SkDiscardableMemory; - -/** \class SkPixelRef - - This class is the smart container for pixel memory, and is used with SkBitmap. - This class can be shared/accessed between multiple threads. -*/ -class SK_API SkPixelRef : public SkRefCnt { -public: - SkPixelRef(int width, int height, void* addr, size_t rowBytes); - ~SkPixelRef() override; - - SkISize dimensions() const { return {fWidth, fHeight}; } - int width() const { return fWidth; } - int height() const { return fHeight; } - void* pixels() const { return fPixels; } - size_t rowBytes() const { return fRowBytes; } - - /** Returns a non-zero, unique value corresponding to the pixels in this - pixelref. Each time the pixels are changed (and notifyPixelsChanged is - called), a different generation ID will be returned. - */ - uint32_t getGenerationID() const; - - /** - * Call this if you have changed the contents of the pixels. This will in- - * turn cause a different generation ID value to be returned from - * getGenerationID(). - */ - void notifyPixelsChanged(); - - /** Returns true if this pixelref is marked as immutable, meaning that the - contents of its pixels will not change for the lifetime of the pixelref. - */ - bool isImmutable() const { return fMutability != kMutable; } - - /** Marks this pixelref is immutable, meaning that the contents of its - pixels will not change for the lifetime of the pixelref. This state can - be set on a pixelref, but it cannot be cleared once it is set. - */ - void setImmutable(); - - // Register a listener that may be called the next time our generation ID changes. - // - // We'll only call the listener if we're confident that we are the only SkPixelRef with this - // generation ID. If our generation ID changes and we decide not to call the listener, we'll - // never call it: you must add a new listener for each generation ID change. We also won't call - // the listener when we're certain no one knows what our generation ID is. - // - // This can be used to invalidate caches keyed by SkPixelRef generation ID. - // Takes ownership of listener. Threadsafe. - void addGenIDChangeListener(sk_sp listener); - - // Call when this pixelref is part of the key to a resourcecache entry. This allows the cache - // to know automatically those entries can be purged when this pixelref is changed or deleted. - void notifyAddedToCache() { - fAddedToCache.store(true); - } - - virtual SkDiscardableMemory* diagnostic_only_getDiscardable() const { return nullptr; } - -protected: - void android_only_reset(int width, int height, size_t rowBytes); - -private: - int fWidth; - int fHeight; - void* fPixels; - size_t fRowBytes; - - // Bottom bit indicates the Gen ID is unique. - bool genIDIsUnique() const { return SkToBool(fTaggedGenID.load() & 1); } - mutable std::atomic fTaggedGenID; - - SkIDChangeListener::List fGenIDChangeListeners; - - // Set true by caches when they cache content that's derived from the current pixels. - std::atomic fAddedToCache; - - enum Mutability { - kMutable, // PixelRefs begin mutable. - kTemporarilyImmutable, // Considered immutable, but can revert to mutable. - kImmutable, // Once set to this state, it never leaves. - } fMutability : 8; // easily fits inside a byte - - void needsNewGenID(); - void callGenIDChangeListeners(); - - void setTemporarilyImmutable(); - void restoreMutability(); - friend class SkSurface_Raster; // For temporary immutable methods above. - - void setImmutableWithID(uint32_t genID); - friend void SkBitmapCache_setImmutableWithID(SkPixelRef*, uint32_t); - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixmap.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixmap.h deleted file mode 100644 index 7bc2aa05ac73e8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPixmap.h +++ /dev/null @@ -1,740 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPixmap_DEFINED -#define SkPixmap_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkSamplingOptions.h" - -class SkColorSpace; -class SkData; -struct SkMask; - -/** \class SkPixmap - SkPixmap provides a utility to pair SkImageInfo with pixels and row bytes. - SkPixmap is a low level class which provides convenience functions to access - raster destinations. SkCanvas can not draw SkPixmap, nor does SkPixmap provide - a direct drawing destination. - - Use SkBitmap to draw pixels referenced by SkPixmap; use SkSurface to draw into - pixels referenced by SkPixmap. - - SkPixmap does not try to manage the lifetime of the pixel memory. Use SkPixelRef - to manage pixel memory; SkPixelRef is safe across threads. -*/ -class SK_API SkPixmap { -public: - - /** Creates an empty SkPixmap without pixels, with kUnknown_SkColorType, with - kUnknown_SkAlphaType, and with a width and height of zero. Use - reset() to associate pixels, SkColorType, SkAlphaType, width, and height - after SkPixmap has been created. - - @return empty SkPixmap - */ - SkPixmap() - : fPixels(nullptr), fRowBytes(0), fInfo(SkImageInfo::MakeUnknown(0, 0)) - {} - - /** Creates SkPixmap from info width, height, SkAlphaType, and SkColorType. - addr points to pixels, or nullptr. rowBytes should be info.width() times - info.bytesPerPixel(), or larger. - - No parameter checking is performed; it is up to the caller to ensure that - addr and rowBytes agree with info. - - The memory lifetime of pixels is managed by the caller. When SkPixmap goes - out of scope, addr is unaffected. - - SkPixmap may be later modified by reset() to change its size, pixel type, or - storage. - - @param info width, height, SkAlphaType, SkColorType of SkImageInfo - @param addr pointer to pixels allocated by caller; may be nullptr - @param rowBytes size of one row of addr; width times pixel size, or larger - @return initialized SkPixmap - */ - SkPixmap(const SkImageInfo& info, const void* addr, size_t rowBytes) - : fPixels(addr), fRowBytes(rowBytes), fInfo(info) - {} - - /** Sets width, height, row bytes to zero; pixel address to nullptr; SkColorType to - kUnknown_SkColorType; and SkAlphaType to kUnknown_SkAlphaType. - - The prior pixels are unaffected; it is up to the caller to release pixels - memory if desired. - - example: https://fiddle.skia.org/c/@Pixmap_reset - */ - void reset(); - - /** Sets width, height, SkAlphaType, and SkColorType from info. - Sets pixel address from addr, which may be nullptr. - Sets row bytes from rowBytes, which should be info.width() times - info.bytesPerPixel(), or larger. - - Does not check addr. Asserts if built with SK_DEBUG defined and if rowBytes is - too small to hold one row of pixels. - - The memory lifetime pixels are managed by the caller. When SkPixmap goes - out of scope, addr is unaffected. - - @param info width, height, SkAlphaType, SkColorType of SkImageInfo - @param addr pointer to pixels allocated by caller; may be nullptr - @param rowBytes size of one row of addr; width times pixel size, or larger - - example: https://fiddle.skia.org/c/@Pixmap_reset_2 - */ - void reset(const SkImageInfo& info, const void* addr, size_t rowBytes); - - /** Changes SkColorSpace in SkImageInfo; preserves width, height, SkAlphaType, and - SkColorType in SkImage, and leaves pixel address and row bytes unchanged. - SkColorSpace reference count is incremented. - - @param colorSpace SkColorSpace moved to SkImageInfo - - example: https://fiddle.skia.org/c/@Pixmap_setColorSpace - */ - void setColorSpace(sk_sp colorSpace); - - /** Deprecated. - */ - bool SK_WARN_UNUSED_RESULT reset(const SkMask& mask); - - /** Sets subset width, height, pixel address to intersection of SkPixmap with area, - if intersection is not empty; and return true. Otherwise, leave subset unchanged - and return false. - - Failing to read the return value generates a compile time warning. - - @param subset storage for width, height, pixel address of intersection - @param area bounds to intersect with SkPixmap - @return true if intersection of SkPixmap and area is not empty - */ - bool SK_WARN_UNUSED_RESULT extractSubset(SkPixmap* subset, const SkIRect& area) const; - - /** Returns width, height, SkAlphaType, SkColorType, and SkColorSpace. - - @return reference to SkImageInfo - */ - const SkImageInfo& info() const { return fInfo; } - - /** Returns row bytes, the interval from one pixel row to the next. Row bytes - is at least as large as: width() * info().bytesPerPixel(). - - Returns zero if colorType() is kUnknown_SkColorType. - It is up to the SkBitmap creator to ensure that row bytes is a useful value. - - @return byte length of pixel row - */ - size_t rowBytes() const { return fRowBytes; } - - /** Returns pixel address, the base address corresponding to the pixel origin. - - It is up to the SkPixmap creator to ensure that pixel address is a useful value. - - @return pixel address - */ - const void* addr() const { return fPixels; } - - /** Returns pixel count in each pixel row. Should be equal or less than: - rowBytes() / info().bytesPerPixel(). - - @return pixel width in SkImageInfo - */ - int width() const { return fInfo.width(); } - - /** Returns pixel row count. - - @return pixel height in SkImageInfo - */ - int height() const { return fInfo.height(); } - - /** - * Return the dimensions of the pixmap (from its ImageInfo) - */ - SkISize dimensions() const { return fInfo.dimensions(); } - - SkColorType colorType() const { return fInfo.colorType(); } - - SkAlphaType alphaType() const { return fInfo.alphaType(); } - - /** Returns SkColorSpace, the range of colors, associated with SkImageInfo. The - reference count of SkColorSpace is unchanged. The returned SkColorSpace is - immutable. - - @return SkColorSpace in SkImageInfo, or nullptr - */ - SkColorSpace* colorSpace() const; - - /** Returns smart pointer to SkColorSpace, the range of colors, associated with - SkImageInfo. The smart pointer tracks the number of objects sharing this - SkColorSpace reference so the memory is released when the owners destruct. - - The returned SkColorSpace is immutable. - - @return SkColorSpace in SkImageInfo wrapped in a smart pointer - */ - sk_sp refColorSpace() const; - - /** Returns true if SkAlphaType is kOpaque_SkAlphaType. - Does not check if SkColorType allows alpha, or if any pixel value has - transparency. - - @return true if SkImageInfo has opaque SkAlphaType - */ - bool isOpaque() const { return fInfo.isOpaque(); } - - /** Returns SkIRect { 0, 0, width(), height() }. - - @return integral rectangle from origin to width() and height() - */ - SkIRect bounds() const { return SkIRect::MakeWH(this->width(), this->height()); } - - /** Returns number of pixels that fit on row. Should be greater than or equal to - width(). - - @return maximum pixels per row - */ - int rowBytesAsPixels() const { return int(fRowBytes >> this->shiftPerPixel()); } - - /** Returns bit shift converting row bytes to row pixels. - Returns zero for kUnknown_SkColorType. - - @return one of: 0, 1, 2, 3; left shift to convert pixels to bytes - */ - int shiftPerPixel() const { return fInfo.shiftPerPixel(); } - - /** Returns minimum memory required for pixel storage. - Does not include unused memory on last row when rowBytesAsPixels() exceeds width(). - Returns SIZE_MAX if result does not fit in size_t. - Returns zero if height() or width() is 0. - Returns height() times rowBytes() if colorType() is kUnknown_SkColorType. - - @return size in bytes of image buffer - */ - size_t computeByteSize() const { return fInfo.computeByteSize(fRowBytes); } - - /** Returns true if all pixels are opaque. SkColorType determines how pixels - are encoded, and whether pixel describes alpha. Returns true for SkColorType - without alpha in each pixel; for other SkColorType, returns true if all - pixels have alpha values equivalent to 1.0 or greater. - - For SkColorType kRGB_565_SkColorType or kGray_8_SkColorType: always - returns true. For SkColorType kAlpha_8_SkColorType, kBGRA_8888_SkColorType, - kRGBA_8888_SkColorType: returns true if all pixel alpha values are 255. - For SkColorType kARGB_4444_SkColorType: returns true if all pixel alpha values are 15. - For kRGBA_F16_SkColorType: returns true if all pixel alpha values are 1.0 or - greater. - - Returns false for kUnknown_SkColorType. - - @return true if all pixels have opaque values or SkColorType is opaque - - example: https://fiddle.skia.org/c/@Pixmap_computeIsOpaque - */ - bool computeIsOpaque() const; - - /** Returns pixel at (x, y) as unpremultiplied color. - Returns black with alpha if SkColorType is kAlpha_8_SkColorType. - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined; and returns undefined values or may crash if - SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or - pixel address is nullptr. - - SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the - conversion to unpremultiplied color; original pixel data may have additional - precision. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return pixel converted to unpremultiplied color - - example: https://fiddle.skia.org/c/@Pixmap_getColor - */ - SkColor getColor(int x, int y) const; - - /** Returns pixel at (x, y) as unpremultiplied color as an SkColor4f. - Returns black with alpha if SkColorType is kAlpha_8_SkColorType. - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined; and returns undefined values or may crash if - SK_RELEASE is defined. Fails if SkColorType is kUnknown_SkColorType or - pixel address is nullptr. - - SkColorSpace in SkImageInfo is ignored. Some color precision may be lost in the - conversion to unpremultiplied color; original pixel data may have additional - precision, though this is less likely than for getColor(). Rounding errors may - occur if the underlying type has lower precision. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return pixel converted to unpremultiplied float color - */ - SkColor4f getColor4f(int x, int y) const; - - /** Look up the pixel at (x,y) and return its alpha component, normalized to [0..1]. - This is roughly equivalent to SkGetColorA(getColor()), but can be more efficent - (and more precise if the pixels store more than 8 bits per component). - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return alpha converted to normalized float - */ - float getAlphaf(int x, int y) const; - - /** Returns readable pixel address at (x, y). Returns nullptr if SkPixelRef is nullptr. - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. Returns nullptr if SkColorType is kUnknown_SkColorType. - - Performs a lookup of pixel size; for better performance, call - one of: addr8, addr16, addr32, addr64, or addrF16(). - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable generic pointer to pixel - */ - const void* addr(int x, int y) const { - return (const char*)fPixels + fInfo.computeOffset(x, y, fRowBytes); - } - - /** Returns readable base pixel address. Result is addressable as unsigned 8-bit bytes. - Will trigger an assert() if SkColorType is not kAlpha_8_SkColorType or - kGray_8_SkColorType, and is built with SK_DEBUG defined. - - One byte corresponds to one pixel. - - @return readable unsigned 8-bit pointer to pixels - */ - const uint8_t* addr8() const { - SkASSERT(1 == fInfo.bytesPerPixel()); - return reinterpret_cast(fPixels); - } - - /** Returns readable base pixel address. Result is addressable as unsigned 16-bit words. - Will trigger an assert() if SkColorType is not kRGB_565_SkColorType or - kARGB_4444_SkColorType, and is built with SK_DEBUG defined. - - One word corresponds to one pixel. - - @return readable unsigned 16-bit pointer to pixels - */ - const uint16_t* addr16() const { - SkASSERT(2 == fInfo.bytesPerPixel()); - return reinterpret_cast(fPixels); - } - - /** Returns readable base pixel address. Result is addressable as unsigned 32-bit words. - Will trigger an assert() if SkColorType is not kRGBA_8888_SkColorType or - kBGRA_8888_SkColorType, and is built with SK_DEBUG defined. - - One word corresponds to one pixel. - - @return readable unsigned 32-bit pointer to pixels - */ - const uint32_t* addr32() const { - SkASSERT(4 == fInfo.bytesPerPixel()); - return reinterpret_cast(fPixels); - } - - /** Returns readable base pixel address. Result is addressable as unsigned 64-bit words. - Will trigger an assert() if SkColorType is not kRGBA_F16_SkColorType and is built - with SK_DEBUG defined. - - One word corresponds to one pixel. - - @return readable unsigned 64-bit pointer to pixels - */ - const uint64_t* addr64() const { - SkASSERT(8 == fInfo.bytesPerPixel()); - return reinterpret_cast(fPixels); - } - - /** Returns readable base pixel address. Result is addressable as unsigned 16-bit words. - Will trigger an assert() if SkColorType is not kRGBA_F16_SkColorType and is built - with SK_DEBUG defined. - - Each word represents one color component encoded as a half float. - Four words correspond to one pixel. - - @return readable unsigned 16-bit pointer to first component of pixels - */ - const uint16_t* addrF16() const { - SkASSERT(8 == fInfo.bytesPerPixel()); - SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType() || - kRGBA_F16Norm_SkColorType == fInfo.colorType()); - return reinterpret_cast(fPixels); - } - - /** Returns readable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. - - Will trigger an assert() if SkColorType is not kAlpha_8_SkColorType or - kGray_8_SkColorType, and is built with SK_DEBUG defined. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable unsigned 8-bit pointer to pixel at (x, y) - */ - const uint8_t* addr8(int x, int y) const { - SkASSERT((unsigned)x < (unsigned)fInfo.width()); - SkASSERT((unsigned)y < (unsigned)fInfo.height()); - return (const uint8_t*)((const char*)this->addr8() + (size_t)y * fRowBytes + (x << 0)); - } - - /** Returns readable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. - - Will trigger an assert() if SkColorType is not kRGB_565_SkColorType or - kARGB_4444_SkColorType, and is built with SK_DEBUG defined. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable unsigned 16-bit pointer to pixel at (x, y) - */ - const uint16_t* addr16(int x, int y) const { - SkASSERT((unsigned)x < (unsigned)fInfo.width()); - SkASSERT((unsigned)y < (unsigned)fInfo.height()); - return (const uint16_t*)((const char*)this->addr16() + (size_t)y * fRowBytes + (x << 1)); - } - - /** Returns readable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. - - Will trigger an assert() if SkColorType is not kRGBA_8888_SkColorType or - kBGRA_8888_SkColorType, and is built with SK_DEBUG defined. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable unsigned 32-bit pointer to pixel at (x, y) - */ - const uint32_t* addr32(int x, int y) const { - SkASSERT((unsigned)x < (unsigned)fInfo.width()); - SkASSERT((unsigned)y < (unsigned)fInfo.height()); - return (const uint32_t*)((const char*)this->addr32() + (size_t)y * fRowBytes + (x << 2)); - } - - /** Returns readable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. - - Will trigger an assert() if SkColorType is not kRGBA_F16_SkColorType and is built - with SK_DEBUG defined. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable unsigned 64-bit pointer to pixel at (x, y) - */ - const uint64_t* addr64(int x, int y) const { - SkASSERT((unsigned)x < (unsigned)fInfo.width()); - SkASSERT((unsigned)y < (unsigned)fInfo.height()); - return (const uint64_t*)((const char*)this->addr64() + (size_t)y * fRowBytes + (x << 3)); - } - - /** Returns readable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. - - Will trigger an assert() if SkColorType is not kRGBA_F16_SkColorType and is built - with SK_DEBUG defined. - - Each unsigned 16-bit word represents one color component encoded as a half float. - Four words correspond to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return readable unsigned 16-bit pointer to pixel component at (x, y) - */ - const uint16_t* addrF16(int x, int y) const { - SkASSERT(kRGBA_F16_SkColorType == fInfo.colorType() || - kRGBA_F16Norm_SkColorType == fInfo.colorType()); - return reinterpret_cast(this->addr64(x, y)); - } - - /** Returns writable base pixel address. - - @return writable generic base pointer to pixels - */ - void* writable_addr() const { return const_cast(fPixels); } - - /** Returns writable pixel address at (x, y). - - Input is not validated: out of bounds values of x or y trigger an assert() if - built with SK_DEBUG defined. Returns zero if SkColorType is kUnknown_SkColorType. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable generic pointer to pixel - */ - void* writable_addr(int x, int y) const { - return const_cast(this->addr(x, y)); - } - - /** Returns writable pixel address at (x, y). Result is addressable as unsigned - 8-bit bytes. Will trigger an assert() if SkColorType is not kAlpha_8_SkColorType - or kGray_8_SkColorType, and is built with SK_DEBUG defined. - - One byte corresponds to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable unsigned 8-bit pointer to pixels - */ - uint8_t* writable_addr8(int x, int y) const { - return const_cast(this->addr8(x, y)); - } - - /** Returns writable_addr pixel address at (x, y). Result is addressable as unsigned - 16-bit words. Will trigger an assert() if SkColorType is not kRGB_565_SkColorType - or kARGB_4444_SkColorType, and is built with SK_DEBUG defined. - - One word corresponds to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable unsigned 16-bit pointer to pixel - */ - uint16_t* writable_addr16(int x, int y) const { - return const_cast(this->addr16(x, y)); - } - - /** Returns writable pixel address at (x, y). Result is addressable as unsigned - 32-bit words. Will trigger an assert() if SkColorType is not - kRGBA_8888_SkColorType or kBGRA_8888_SkColorType, and is built with SK_DEBUG - defined. - - One word corresponds to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable unsigned 32-bit pointer to pixel - */ - uint32_t* writable_addr32(int x, int y) const { - return const_cast(this->addr32(x, y)); - } - - /** Returns writable pixel address at (x, y). Result is addressable as unsigned - 64-bit words. Will trigger an assert() if SkColorType is not - kRGBA_F16_SkColorType and is built with SK_DEBUG defined. - - One word corresponds to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable unsigned 64-bit pointer to pixel - */ - uint64_t* writable_addr64(int x, int y) const { - return const_cast(this->addr64(x, y)); - } - - /** Returns writable pixel address at (x, y). Result is addressable as unsigned - 16-bit words. Will trigger an assert() if SkColorType is not - kRGBA_F16_SkColorType and is built with SK_DEBUG defined. - - Each word represents one color component encoded as a half float. - Four words correspond to one pixel. - - @param x column index, zero or greater, and less than width() - @param y row index, zero or greater, and less than height() - @return writable unsigned 16-bit pointer to first component of pixel - */ - uint16_t* writable_addrF16(int x, int y) const { - return reinterpret_cast(writable_addr64(x, y)); - } - - /** Copies a SkRect of pixels to dstPixels. Copy starts at (0, 0), and does not - exceed SkPixmap (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and - SkColorSpace of destination. dstRowBytes specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if - dstInfo address equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes(). - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkPixmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkPixmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - Returns false if SkPixmap width() or height() is zero or negative. - - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @return true if pixels are copied to dstPixels - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes) const { - return this->readPixels(dstInfo, dstPixels, dstRowBytes, 0, 0); - } - - /** Copies a SkRect of pixels to dstPixels. Copy starts at (srcX, srcY), and does not - exceed SkPixmap (width(), height()). - - dstInfo specifies width, height, SkColorType, SkAlphaType, and - SkColorSpace of destination. dstRowBytes specifics the gap from one destination - row to the next. Returns true if pixels are copied. Returns false if - dstInfo address equals nullptr, or dstRowBytes is less than dstInfo.minRowBytes(). - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dstInfo.colorType() must match. - If SkPixmap colorType() is kGray_8_SkColorType, dstInfo.colorSpace() must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dstInfo.alphaType() must - match. If SkPixmap colorSpace() is nullptr, dstInfo.colorSpace() must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false if SkPixmap width() or height() is zero or negative. Returns false if: - abs(srcX) >= Pixmap width(), or if abs(srcY) >= Pixmap height(). - - @param dstInfo destination width, height, SkColorType, SkAlphaType, SkColorSpace - @param dstPixels destination pixel storage - @param dstRowBytes destination row length - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @return true if pixels are copied to dstPixels - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, int srcX, - int srcY) const; - - /** Copies a SkRect of pixels to dst. Copy starts at (srcX, srcY), and does not - exceed SkPixmap (width(), height()). dst specifies width, height, SkColorType, - SkAlphaType, and SkColorSpace of destination. Returns true if pixels are copied. - Returns false if dst address equals nullptr, or dst.rowBytes() is less than - dst SkImageInfo::minRowBytes. - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst.info().colorType must match. - If SkPixmap colorType() is kGray_8_SkColorType, dst.info().colorSpace must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dst.info().alphaType must - match. If SkPixmap colorSpace() is nullptr, dst.info().colorSpace must match. Returns - false if pixel conversion is not possible. - - srcX and srcY may be negative to copy only top or left of source. Returns - false SkPixmap width() or height() is zero or negative. Returns false if: - abs(srcX) >= Pixmap width(), or if abs(srcY) >= Pixmap height(). - - @param dst SkImageInfo and pixel address to write to - @param srcX column index whose absolute value is less than width() - @param srcY row index whose absolute value is less than height() - @return true if pixels are copied to dst - */ - bool readPixels(const SkPixmap& dst, int srcX, int srcY) const { - return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), srcX, srcY); - } - - /** Copies pixels inside bounds() to dst. dst specifies width, height, SkColorType, - SkAlphaType, and SkColorSpace of destination. Returns true if pixels are copied. - Returns false if dst address equals nullptr, or dst.rowBytes() is less than - dst SkImageInfo::minRowBytes. - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst SkColorType must match. - If SkPixmap colorType() is kGray_8_SkColorType, dst SkColorSpace must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dst SkAlphaType must - match. If SkPixmap colorSpace() is nullptr, dst SkColorSpace must match. Returns - false if pixel conversion is not possible. - - Returns false if SkPixmap width() or height() is zero or negative. - - @param dst SkImageInfo and pixel address to write to - @return true if pixels are copied to dst - */ - bool readPixels(const SkPixmap& dst) const { - return this->readPixels(dst.info(), dst.writable_addr(), dst.rowBytes(), 0, 0); - } - - /** Copies SkBitmap to dst, scaling pixels to fit dst.width() and dst.height(), and - converting pixels to match dst.colorType() and dst.alphaType(). Returns true if - pixels are copied. Returns false if dst address is nullptr, or dst.rowBytes() is - less than dst SkImageInfo::minRowBytes. - - Pixels are copied only if pixel conversion is possible. If SkPixmap colorType() is - kGray_8_SkColorType, or kAlpha_8_SkColorType; dst SkColorType must match. - If SkPixmap colorType() is kGray_8_SkColorType, dst SkColorSpace must match. - If SkPixmap alphaType() is kOpaque_SkAlphaType, dst SkAlphaType must - match. If SkPixmap colorSpace() is nullptr, dst SkColorSpace must match. Returns - false if pixel conversion is not possible. - - Returns false if SkBitmap width() or height() is zero or negative. - - @param dst SkImageInfo and pixel address to write to - @return true if pixels are scaled to fit dst - - example: https://fiddle.skia.org/c/@Pixmap_scalePixels - */ - bool scalePixels(const SkPixmap& dst, const SkSamplingOptions&) const; - - /** Writes color to pixels bounded by subset; returns true on success. - Returns false if colorType() is kUnknown_SkColorType, or if subset does - not intersect bounds(). - - @param color sRGB unpremultiplied color to write - @param subset bounding integer SkRect of written pixels - @return true if pixels are changed - - example: https://fiddle.skia.org/c/@Pixmap_erase - */ - bool erase(SkColor color, const SkIRect& subset) const; - - /** Writes color to pixels inside bounds(); returns true on success. - Returns false if colorType() is kUnknown_SkColorType, or if bounds() - is empty. - - @param color sRGB unpremultiplied color to write - @return true if pixels are changed - */ - bool erase(SkColor color) const { return this->erase(color, this->bounds()); } - - /** Writes color to pixels bounded by subset; returns true on success. - if subset is nullptr, writes colors pixels inside bounds(). Returns false if - colorType() is kUnknown_SkColorType, if subset is not nullptr and does - not intersect bounds(), or if subset is nullptr and bounds() is empty. - - @param color sRGB unpremultiplied color to write - @param subset bounding integer SkRect of pixels to write; may be nullptr - @return true if pixels are changed - - example: https://fiddle.skia.org/c/@Pixmap_erase_3 - */ - bool erase(const SkColor4f& color, const SkIRect* subset = nullptr) const { - return this->erase(color, nullptr, subset); - } - - /** Writes color to pixels bounded by subset; returns true on success. - if subset is nullptr, writes colors pixels inside bounds(). Returns false if - colorType() is kUnknown_SkColorType, if subset is not nullptr and does - not intersect bounds(), or if subset is nullptr and bounds() is empty. - - @param color unpremultiplied color to write - @param cs SkColorSpace of color - @param subset bounding integer SkRect of pixels to write; may be nullptr - @return true if pixels are changed - */ - bool erase(const SkColor4f& color, SkColorSpace* cs, const SkIRect* subset = nullptr) const; - -private: - const void* fPixels; - size_t fRowBytes; - SkImageInfo fInfo; - - friend class SkPixmapPriv; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPngChunkReader.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPngChunkReader.h deleted file mode 100644 index 0ee8a9ecc7275b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPngChunkReader.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPngChunkReader_DEFINED -#define SkPngChunkReader_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -/** - * SkPngChunkReader - * - * Base class for optional callbacks to retrieve meta/chunk data out of a PNG - * encoded image as it is being decoded. - * Used by SkCodec. - */ -class SkPngChunkReader : public SkRefCnt { -public: - /** - * This will be called by the decoder when it sees an unknown chunk. - * - * Use by SkCodec: - * Depending on the location of the unknown chunks, this callback may be - * called by - * - the factory (NewFromStream/NewFromData) - * - getPixels - * - startScanlineDecode - * - the first call to getScanlines/skipScanlines - * The callback may be called from a different thread (e.g. if the SkCodec - * is passed to another thread), and it may be called multiple times, if - * the SkCodec is used multiple times. - * - * @param tag Name for this type of chunk. - * @param data Data to be interpreted by the subclass. - * @param length Number of bytes of data in the chunk. - * @return true to continue decoding, or false to indicate an error, which - * will cause the decoder to not return the image. - */ - virtual bool readChunk(const char tag[], const void* data, size_t length) = 0; -}; -#endif // SkPngChunkReader_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint.h deleted file mode 100644 index 92cb0b7f099948..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint.h +++ /dev/null @@ -1,566 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPoint_DEFINED -#define SkPoint_DEFINED - -#include "include/core/SkMath.h" -#include "include/core/SkScalar.h" -#include "include/private/SkSafe32.h" - -struct SkIPoint; - -/** SkIVector provides an alternative name for SkIPoint. SkIVector and SkIPoint - can be used interchangeably for all purposes. -*/ -typedef SkIPoint SkIVector; - -/** \struct SkIPoint - SkIPoint holds two 32-bit integer coordinates. -*/ -struct SkIPoint { - int32_t fX; //!< x-axis value - int32_t fY; //!< y-axis value - - /** Sets fX to x, fY to y. - - @param x integer x-axis value of constructed SkIPoint - @param y integer y-axis value of constructed SkIPoint - @return SkIPoint (x, y) - */ - static constexpr SkIPoint Make(int32_t x, int32_t y) { - return {x, y}; - } - - /** Returns x-axis value of SkIPoint. - - @return fX - */ - constexpr int32_t x() const { return fX; } - - /** Returns y-axis value of SkIPoint. - - @return fY - */ - constexpr int32_t y() const { return fY; } - - /** Returns true if fX and fY are both zero. - - @return true if fX is zero and fY is zero - */ - bool isZero() const { return (fX | fY) == 0; } - - /** Sets fX to x and fY to y. - - @param x new value for fX - @param y new value for fY - */ - void set(int32_t x, int32_t y) { - fX = x; - fY = y; - } - - /** Returns SkIPoint changing the signs of fX and fY. - - @return SkIPoint as (-fX, -fY) - */ - SkIPoint operator-() const { - return {-fX, -fY}; - } - - /** Offsets SkIPoint by ivector v. Sets SkIPoint to (fX + v.fX, fY + v.fY). - - @param v ivector to add - */ - void operator+=(const SkIVector& v) { - fX = Sk32_sat_add(fX, v.fX); - fY = Sk32_sat_add(fY, v.fY); - } - - /** Subtracts ivector v from SkIPoint. Sets SkIPoint to: (fX - v.fX, fY - v.fY). - - @param v ivector to subtract - */ - void operator-=(const SkIVector& v) { - fX = Sk32_sat_sub(fX, v.fX); - fY = Sk32_sat_sub(fY, v.fY); - } - - /** Returns true if SkIPoint is equivalent to SkIPoint constructed from (x, y). - - @param x value compared with fX - @param y value compared with fY - @return true if SkIPoint equals (x, y) - */ - bool equals(int32_t x, int32_t y) const { - return fX == x && fY == y; - } - - /** Returns true if a is equivalent to b. - - @param a SkIPoint to compare - @param b SkIPoint to compare - @return true if a.fX == b.fX and a.fY == b.fY - */ - friend bool operator==(const SkIPoint& a, const SkIPoint& b) { - return a.fX == b.fX && a.fY == b.fY; - } - - /** Returns true if a is not equivalent to b. - - @param a SkIPoint to compare - @param b SkIPoint to compare - @return true if a.fX != b.fX or a.fY != b.fY - */ - friend bool operator!=(const SkIPoint& a, const SkIPoint& b) { - return a.fX != b.fX || a.fY != b.fY; - } - - /** Returns ivector from b to a; computed as (a.fX - b.fX, a.fY - b.fY). - - Can also be used to subtract ivector from ivector, returning ivector. - - @param a SkIPoint or ivector to subtract from - @param b ivector to subtract - @return ivector from b to a - */ - friend SkIVector operator-(const SkIPoint& a, const SkIPoint& b) { - return { Sk32_sat_sub(a.fX, b.fX), Sk32_sat_sub(a.fY, b.fY) }; - } - - /** Returns SkIPoint resulting from SkIPoint a offset by ivector b, computed as: - (a.fX + b.fX, a.fY + b.fY). - - Can also be used to offset SkIPoint b by ivector a, returning SkIPoint. - Can also be used to add ivector to ivector, returning ivector. - - @param a SkIPoint or ivector to add to - @param b SkIPoint or ivector to add - @return SkIPoint equal to a offset by b - */ - friend SkIPoint operator+(const SkIPoint& a, const SkIVector& b) { - return { Sk32_sat_add(a.fX, b.fX), Sk32_sat_add(a.fY, b.fY) }; - } -}; - -struct SkPoint; - -/** SkVector provides an alternative name for SkPoint. SkVector and SkPoint can - be used interchangeably for all purposes. -*/ -typedef SkPoint SkVector; - -/** \struct SkPoint - SkPoint holds two 32-bit floating point coordinates. -*/ -struct SK_API SkPoint { - SkScalar fX; //!< x-axis value - SkScalar fY; //!< y-axis value - - /** Sets fX to x, fY to y. Used both to set SkPoint and vector. - - @param x SkScalar x-axis value of constructed SkPoint or vector - @param y SkScalar y-axis value of constructed SkPoint or vector - @return SkPoint (x, y) - */ - static constexpr SkPoint Make(SkScalar x, SkScalar y) { - return {x, y}; - } - - /** Returns x-axis value of SkPoint or vector. - - @return fX - */ - constexpr SkScalar x() const { return fX; } - - /** Returns y-axis value of SkPoint or vector. - - @return fY - */ - constexpr SkScalar y() const { return fY; } - - /** Returns true if fX and fY are both zero. - - @return true if fX is zero and fY is zero - */ - bool isZero() const { return (0 == fX) & (0 == fY); } - - /** Sets fX to x and fY to y. - - @param x new value for fX - @param y new value for fY - */ - void set(SkScalar x, SkScalar y) { - fX = x; - fY = y; - } - - /** Sets fX to x and fY to y, promoting integers to SkScalar values. - - Assigning a large integer value directly to fX or fY may cause a compiler - error, triggered by narrowing conversion of int to SkScalar. This safely - casts x and y to avoid the error. - - @param x new value for fX - @param y new value for fY - */ - void iset(int32_t x, int32_t y) { - fX = SkIntToScalar(x); - fY = SkIntToScalar(y); - } - - /** Sets fX to p.fX and fY to p.fY, promoting integers to SkScalar values. - - Assigning an SkIPoint containing a large integer value directly to fX or fY may - cause a compiler error, triggered by narrowing conversion of int to SkScalar. - This safely casts p.fX and p.fY to avoid the error. - - @param p SkIPoint members promoted to SkScalar - */ - void iset(const SkIPoint& p) { - fX = SkIntToScalar(p.fX); - fY = SkIntToScalar(p.fY); - } - - /** Sets fX to absolute value of pt.fX; and fY to absolute value of pt.fY. - - @param pt members providing magnitude for fX and fY - */ - void setAbs(const SkPoint& pt) { - fX = SkScalarAbs(pt.fX); - fY = SkScalarAbs(pt.fY); - } - - /** Adds offset to each SkPoint in points array with count entries. - - @param points SkPoint array - @param count entries in array - @param offset vector added to points - */ - static void Offset(SkPoint points[], int count, const SkVector& offset) { - Offset(points, count, offset.fX, offset.fY); - } - - /** Adds offset (dx, dy) to each SkPoint in points array of length count. - - @param points SkPoint array - @param count entries in array - @param dx added to fX in points - @param dy added to fY in points - */ - static void Offset(SkPoint points[], int count, SkScalar dx, SkScalar dy) { - for (int i = 0; i < count; ++i) { - points[i].offset(dx, dy); - } - } - - /** Adds offset (dx, dy) to SkPoint. - - @param dx added to fX - @param dy added to fY - */ - void offset(SkScalar dx, SkScalar dy) { - fX += dx; - fY += dy; - } - - /** Returns the Euclidean distance from origin, computed as: - - sqrt(fX * fX + fY * fY) - - . - - @return straight-line distance to origin - */ - SkScalar length() const { return SkPoint::Length(fX, fY); } - - /** Returns the Euclidean distance from origin, computed as: - - sqrt(fX * fX + fY * fY) - - . - - @return straight-line distance to origin - */ - SkScalar distanceToOrigin() const { return this->length(); } - - /** Scales (fX, fY) so that length() returns one, while preserving ratio of fX to fY, - if possible. If prior length is nearly zero, sets vector to (0, 0) and returns - false; otherwise returns true. - - @return true if former length is not zero or nearly zero - - example: https://fiddle.skia.org/c/@Point_normalize_2 - */ - bool normalize(); - - /** Sets vector to (x, y) scaled so length() returns one, and so that - (fX, fY) is proportional to (x, y). If (x, y) length is nearly zero, - sets vector to (0, 0) and returns false; otherwise returns true. - - @param x proportional value for fX - @param y proportional value for fY - @return true if (x, y) length is not zero or nearly zero - - example: https://fiddle.skia.org/c/@Point_setNormalize - */ - bool setNormalize(SkScalar x, SkScalar y); - - /** Scales vector so that distanceToOrigin() returns length, if possible. If former - length is nearly zero, sets vector to (0, 0) and return false; otherwise returns - true. - - @param length straight-line distance to origin - @return true if former length is not zero or nearly zero - - example: https://fiddle.skia.org/c/@Point_setLength - */ - bool setLength(SkScalar length); - - /** Sets vector to (x, y) scaled to length, if possible. If former - length is nearly zero, sets vector to (0, 0) and return false; otherwise returns - true. - - @param x proportional value for fX - @param y proportional value for fY - @param length straight-line distance to origin - @return true if (x, y) length is not zero or nearly zero - - example: https://fiddle.skia.org/c/@Point_setLength_2 - */ - bool setLength(SkScalar x, SkScalar y, SkScalar length); - - /** Sets dst to SkPoint times scale. dst may be SkPoint to modify SkPoint in place. - - @param scale factor to multiply SkPoint by - @param dst storage for scaled SkPoint - - example: https://fiddle.skia.org/c/@Point_scale - */ - void scale(SkScalar scale, SkPoint* dst) const; - - /** Scales SkPoint in place by scale. - - @param value factor to multiply SkPoint by - */ - void scale(SkScalar value) { this->scale(value, this); } - - /** Changes the sign of fX and fY. - */ - void negate() { - fX = -fX; - fY = -fY; - } - - /** Returns SkPoint changing the signs of fX and fY. - - @return SkPoint as (-fX, -fY) - */ - SkPoint operator-() const { - return {-fX, -fY}; - } - - /** Adds vector v to SkPoint. Sets SkPoint to: (fX + v.fX, fY + v.fY). - - @param v vector to add - */ - void operator+=(const SkVector& v) { - fX += v.fX; - fY += v.fY; - } - - /** Subtracts vector v from SkPoint. Sets SkPoint to: (fX - v.fX, fY - v.fY). - - @param v vector to subtract - */ - void operator-=(const SkVector& v) { - fX -= v.fX; - fY -= v.fY; - } - - /** Returns SkPoint multiplied by scale. - - @param scale scalar to multiply by - @return SkPoint as (fX * scale, fY * scale) - */ - SkPoint operator*(SkScalar scale) const { - return {fX * scale, fY * scale}; - } - - /** Multiplies SkPoint by scale. Sets SkPoint to: (fX * scale, fY * scale). - - @param scale scalar to multiply by - @return reference to SkPoint - */ - SkPoint& operator*=(SkScalar scale) { - fX *= scale; - fY *= scale; - return *this; - } - - /** Returns true if both fX and fY are measurable values. - - @return true for values other than infinities and NaN - */ - bool isFinite() const { - SkScalar accum = 0; - accum *= fX; - accum *= fY; - - // accum is either NaN or it is finite (zero). - SkASSERT(0 == accum || SkScalarIsNaN(accum)); - - // value==value will be true iff value is not NaN - // TODO: is it faster to say !accum or accum==accum? - return !SkScalarIsNaN(accum); - } - - /** Returns true if SkPoint is equivalent to SkPoint constructed from (x, y). - - @param x value compared with fX - @param y value compared with fY - @return true if SkPoint equals (x, y) - */ - bool equals(SkScalar x, SkScalar y) const { - return fX == x && fY == y; - } - - /** Returns true if a is equivalent to b. - - @param a SkPoint to compare - @param b SkPoint to compare - @return true if a.fX == b.fX and a.fY == b.fY - */ - friend bool operator==(const SkPoint& a, const SkPoint& b) { - return a.fX == b.fX && a.fY == b.fY; - } - - /** Returns true if a is not equivalent to b. - - @param a SkPoint to compare - @param b SkPoint to compare - @return true if a.fX != b.fX or a.fY != b.fY - */ - friend bool operator!=(const SkPoint& a, const SkPoint& b) { - return a.fX != b.fX || a.fY != b.fY; - } - - /** Returns vector from b to a, computed as (a.fX - b.fX, a.fY - b.fY). - - Can also be used to subtract vector from SkPoint, returning SkPoint. - Can also be used to subtract vector from vector, returning vector. - - @param a SkPoint to subtract from - @param b SkPoint to subtract - @return vector from b to a - */ - friend SkVector operator-(const SkPoint& a, const SkPoint& b) { - return {a.fX - b.fX, a.fY - b.fY}; - } - - /** Returns SkPoint resulting from SkPoint a offset by vector b, computed as: - (a.fX + b.fX, a.fY + b.fY). - - Can also be used to offset SkPoint b by vector a, returning SkPoint. - Can also be used to add vector to vector, returning vector. - - @param a SkPoint or vector to add to - @param b SkPoint or vector to add - @return SkPoint equal to a offset by b - */ - friend SkPoint operator+(const SkPoint& a, const SkVector& b) { - return {a.fX + b.fX, a.fY + b.fY}; - } - - /** Returns the Euclidean distance from origin, computed as: - - sqrt(x * x + y * y) - - . - - @param x component of length - @param y component of length - @return straight-line distance to origin - - example: https://fiddle.skia.org/c/@Point_Length - */ - static SkScalar Length(SkScalar x, SkScalar y); - - /** Scales (vec->fX, vec->fY) so that length() returns one, while preserving ratio of vec->fX - to vec->fY, if possible. If original length is nearly zero, sets vec to (0, 0) and returns - zero; otherwise, returns length of vec before vec is scaled. - - Returned prior length may be SK_ScalarInfinity if it can not be represented by SkScalar. - - Note that normalize() is faster if prior length is not required. - - @param vec normalized to unit length - @return original vec length - - example: https://fiddle.skia.org/c/@Point_Normalize - */ - static SkScalar Normalize(SkVector* vec); - - /** Returns the Euclidean distance between a and b. - - @param a line end point - @param b line end point - @return straight-line distance from a to b - */ - static SkScalar Distance(const SkPoint& a, const SkPoint& b) { - return Length(a.fX - b.fX, a.fY - b.fY); - } - - /** Returns the dot product of vector a and vector b. - - @param a left side of dot product - @param b right side of dot product - @return product of input magnitudes and cosine of the angle between them - */ - static SkScalar DotProduct(const SkVector& a, const SkVector& b) { - return a.fX * b.fX + a.fY * b.fY; - } - - /** Returns the cross product of vector a and vector b. - - a and b form three-dimensional vectors with z-axis value equal to zero. The - cross product is a three-dimensional vector with x-axis and y-axis values equal - to zero. The cross product z-axis component is returned. - - @param a left side of cross product - @param b right side of cross product - @return area spanned by vectors signed by angle direction - */ - static SkScalar CrossProduct(const SkVector& a, const SkVector& b) { - return a.fX * b.fY - a.fY * b.fX; - } - - /** Returns the cross product of vector and vec. - - Vector and vec form three-dimensional vectors with z-axis value equal to zero. - The cross product is a three-dimensional vector with x-axis and y-axis values - equal to zero. The cross product z-axis component is returned. - - @param vec right side of cross product - @return area spanned by vectors signed by angle direction - */ - SkScalar cross(const SkVector& vec) const { - return CrossProduct(*this, vec); - } - - /** Returns the dot product of vector and vector vec. - - @param vec right side of dot product - @return product of input magnitudes and cosine of the angle between them - */ - SkScalar dot(const SkVector& vec) const { - return DotProduct(*this, vec); - } - -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint3.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint3.h deleted file mode 100644 index e372f82791c678..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPoint3.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPoint3_DEFINED -#define SkPoint3_DEFINED - -#include "include/core/SkPoint.h" - -struct SK_API SkPoint3 { - SkScalar fX, fY, fZ; - - static SkPoint3 Make(SkScalar x, SkScalar y, SkScalar z) { - SkPoint3 pt; - pt.set(x, y, z); - return pt; - } - - SkScalar x() const { return fX; } - SkScalar y() const { return fY; } - SkScalar z() const { return fZ; } - - void set(SkScalar x, SkScalar y, SkScalar z) { fX = x; fY = y; fZ = z; } - - friend bool operator==(const SkPoint3& a, const SkPoint3& b) { - return a.fX == b.fX && a.fY == b.fY && a.fZ == b.fZ; - } - - friend bool operator!=(const SkPoint3& a, const SkPoint3& b) { - return !(a == b); - } - - /** Returns the Euclidian distance from (0,0,0) to (x,y,z) - */ - static SkScalar Length(SkScalar x, SkScalar y, SkScalar z); - - /** Return the Euclidian distance from (0,0,0) to the point - */ - SkScalar length() const { return SkPoint3::Length(fX, fY, fZ); } - - /** Set the point (vector) to be unit-length in the same direction as it - already points. If the point has a degenerate length (i.e., nearly 0) - then set it to (0,0,0) and return false; otherwise return true. - */ - bool normalize(); - - /** Return a new point whose X, Y and Z coordinates are scaled. - */ - SkPoint3 makeScale(SkScalar scale) const { - SkPoint3 p; - p.set(scale * fX, scale * fY, scale * fZ); - return p; - } - - /** Scale the point's coordinates by scale. - */ - void scale(SkScalar value) { - fX *= value; - fY *= value; - fZ *= value; - } - - /** Return a new point whose X, Y and Z coordinates are the negative of the - original point's - */ - SkPoint3 operator-() const { - SkPoint3 neg; - neg.fX = -fX; - neg.fY = -fY; - neg.fZ = -fZ; - return neg; - } - - /** Returns a new point whose coordinates are the difference between - a and b (i.e., a - b) - */ - friend SkPoint3 operator-(const SkPoint3& a, const SkPoint3& b) { - return { a.fX - b.fX, a.fY - b.fY, a.fZ - b.fZ }; - } - - /** Returns a new point whose coordinates are the sum of a and b (a + b) - */ - friend SkPoint3 operator+(const SkPoint3& a, const SkPoint3& b) { - return { a.fX + b.fX, a.fY + b.fY, a.fZ + b.fZ }; - } - - /** Add v's coordinates to the point's - */ - void operator+=(const SkPoint3& v) { - fX += v.fX; - fY += v.fY; - fZ += v.fZ; - } - - /** Subtract v's coordinates from the point's - */ - void operator-=(const SkPoint3& v) { - fX -= v.fX; - fY -= v.fY; - fZ -= v.fZ; - } - - friend SkPoint3 operator*(SkScalar t, SkPoint3 p) { - return { t * p.fX, t * p.fY, t * p.fZ }; - } - - /** Returns true if fX, fY, and fZ are measurable values. - - @return true for values other than infinities and NaN - */ - bool isFinite() const { - SkScalar accum = 0; - accum *= fX; - accum *= fY; - accum *= fZ; - - // accum is either NaN or it is finite (zero). - SkASSERT(0 == accum || SkScalarIsNaN(accum)); - - // value==value will be true iff value is not NaN - // TODO: is it faster to say !accum or accum==accum? - return !SkScalarIsNaN(accum); - } - - /** Returns the dot product of a and b, treating them as 3D vectors - */ - static SkScalar DotProduct(const SkPoint3& a, const SkPoint3& b) { - return a.fX * b.fX + a.fY * b.fY + a.fZ * b.fZ; - } - - SkScalar dot(const SkPoint3& vec) const { - return DotProduct(*this, vec); - } - - /** Returns the cross product of a and b, treating them as 3D vectors - */ - static SkPoint3 CrossProduct(const SkPoint3& a, const SkPoint3& b) { - SkPoint3 result; - result.fX = a.fY*b.fZ - a.fZ*b.fY; - result.fY = a.fZ*b.fX - a.fX*b.fZ; - result.fZ = a.fX*b.fY - a.fY*b.fX; - - return result; - } - - SkPoint3 cross(const SkPoint3& vec) const { - return CrossProduct(*this, vec); - } -}; - -typedef SkPoint3 SkVector3; -typedef SkPoint3 SkColor3f; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPromiseImageTexture.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPromiseImageTexture.h deleted file mode 100644 index 05434c0942517b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkPromiseImageTexture.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPromiseImageTexture_DEFINED -#define SkPromiseImageTexture_DEFINED - -#include "include/core/SkTypes.h" - -#if SK_SUPPORT_GPU -#include "include/core/SkRefCnt.h" -#include "include/gpu/GrBackendSurface.h" -/** - * This type is used to fulfill textures for PromiseImages. Once an instance is returned from a - * PromiseImageTextureFulfillProc the GrBackendTexture it wraps must remain valid until the - * corresponding PromiseImageTextureReleaseProc is called. - */ -class SK_API SkPromiseImageTexture : public SkNVRefCnt { -public: - SkPromiseImageTexture() = delete; - SkPromiseImageTexture(const SkPromiseImageTexture&) = delete; - SkPromiseImageTexture(SkPromiseImageTexture&&) = delete; - ~SkPromiseImageTexture(); - SkPromiseImageTexture& operator=(const SkPromiseImageTexture&) = delete; - SkPromiseImageTexture& operator=(SkPromiseImageTexture&&) = delete; - - static sk_sp Make(const GrBackendTexture& backendTexture) { - if (!backendTexture.isValid()) { - return nullptr; - } - return sk_sp(new SkPromiseImageTexture(backendTexture)); - } - - GrBackendTexture backendTexture() const { return fBackendTexture; } - -private: - explicit SkPromiseImageTexture(const GrBackendTexture& backendTexture); - - GrBackendTexture fBackendTexture; -}; -#endif // SK_SUPPORT_GPU - -#endif // SkPromiseImageTexture_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRRect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRRect.h deleted file mode 100644 index 099385168ff73c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRRect.h +++ /dev/null @@ -1,512 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRRect_DEFINED -#define SkRRect_DEFINED - -#include "include/core/SkPoint.h" -#include "include/core/SkRect.h" - -class SkPath; -class SkMatrix; -class SkString; - -/** \class SkRRect - SkRRect describes a rounded rectangle with a bounds and a pair of radii for each corner. - The bounds and radii can be set so that SkRRect describes: a rectangle with sharp corners; - a circle; an oval; or a rectangle with one or more rounded corners. - - SkRRect allows implementing CSS properties that describe rounded corners. - SkRRect may have up to eight different radii, one for each axis on each of its four - corners. - - SkRRect may modify the provided parameters when initializing bounds and radii. - If either axis radii is zero or less: radii are stored as zero; corner is square. - If corner curves overlap, radii are proportionally reduced to fit within bounds. -*/ -class SK_API SkRRect { -public: - - /** Initializes bounds at (0, 0), the origin, with zero width and height. - Initializes corner radii to (0, 0), and sets type of kEmpty_Type. - - @return empty SkRRect - */ - SkRRect() = default; - - /** Initializes to copy of rrect bounds and corner radii. - - @param rrect bounds and corner to copy - @return copy of rrect - */ - SkRRect(const SkRRect& rrect) = default; - - /** Copies rrect bounds and corner radii. - - @param rrect bounds and corner to copy - @return copy of rrect - */ - SkRRect& operator=(const SkRRect& rrect) = default; - - /** \enum SkRRect::Type - Type describes possible specializations of SkRRect. Each Type is - exclusive; a SkRRect may only have one type. - - Type members become progressively less restrictive; larger values of - Type have more degrees of freedom than smaller values. - */ - enum Type { - kEmpty_Type, //!< zero width or height - kRect_Type, //!< non-zero width and height, and zeroed radii - kOval_Type, //!< non-zero width and height filled with radii - kSimple_Type, //!< non-zero width and height with equal radii - kNinePatch_Type, //!< non-zero width and height with axis-aligned radii - kComplex_Type, //!< non-zero width and height with arbitrary radii - kLastType = kComplex_Type, //!< largest Type value - }; - - Type getType() const { - SkASSERT(this->isValid()); - return static_cast(fType); - } - - Type type() const { return this->getType(); } - - inline bool isEmpty() const { return kEmpty_Type == this->getType(); } - inline bool isRect() const { return kRect_Type == this->getType(); } - inline bool isOval() const { return kOval_Type == this->getType(); } - inline bool isSimple() const { return kSimple_Type == this->getType(); } - inline bool isNinePatch() const { return kNinePatch_Type == this->getType(); } - inline bool isComplex() const { return kComplex_Type == this->getType(); } - - /** Returns span on the x-axis. This does not check if result fits in 32-bit float; - result may be infinity. - - @return rect().fRight minus rect().fLeft - */ - SkScalar width() const { return fRect.width(); } - - /** Returns span on the y-axis. This does not check if result fits in 32-bit float; - result may be infinity. - - @return rect().fBottom minus rect().fTop - */ - SkScalar height() const { return fRect.height(); } - - /** Returns top-left corner radii. If type() returns kEmpty_Type, kRect_Type, - kOval_Type, or kSimple_Type, returns a value representative of all corner radii. - If type() returns kNinePatch_Type or kComplex_Type, at least one of the - remaining three corners has a different value. - - @return corner radii for simple types - */ - SkVector getSimpleRadii() const { - return fRadii[0]; - } - - /** Sets bounds to zero width and height at (0, 0), the origin. Sets - corner radii to zero and sets type to kEmpty_Type. - */ - void setEmpty() { *this = SkRRect(); } - - /** Sets bounds to sorted rect, and sets corner radii to zero. - If set bounds has width and height, and sets type to kRect_Type; - otherwise, sets type to kEmpty_Type. - - @param rect bounds to set - */ - void setRect(const SkRect& rect) { - if (!this->initializeRect(rect)) { - return; - } - - memset(fRadii, 0, sizeof(fRadii)); - fType = kRect_Type; - - SkASSERT(this->isValid()); - } - - /** Initializes bounds at (0, 0), the origin, with zero width and height. - Initializes corner radii to (0, 0), and sets type of kEmpty_Type. - - @return empty SkRRect - */ - static SkRRect MakeEmpty() { return SkRRect(); } - - /** Initializes to copy of r bounds and zeroes corner radii. - - @param r bounds to copy - @return copy of r - */ - static SkRRect MakeRect(const SkRect& r) { - SkRRect rr; - rr.setRect(r); - return rr; - } - - /** Sets bounds to oval, x-axis radii to half oval.width(), and all y-axis radii - to half oval.height(). If oval bounds is empty, sets to kEmpty_Type. - Otherwise, sets to kOval_Type. - - @param oval bounds of oval - @return oval - */ - static SkRRect MakeOval(const SkRect& oval) { - SkRRect rr; - rr.setOval(oval); - return rr; - } - - /** Sets to rounded rectangle with the same radii for all four corners. - If rect is empty, sets to kEmpty_Type. - Otherwise, if xRad and yRad are zero, sets to kRect_Type. - Otherwise, if xRad is at least half rect.width() and yRad is at least half - rect.height(), sets to kOval_Type. - Otherwise, sets to kSimple_Type. - - @param rect bounds of rounded rectangle - @param xRad x-axis radius of corners - @param yRad y-axis radius of corners - @return rounded rectangle - */ - static SkRRect MakeRectXY(const SkRect& rect, SkScalar xRad, SkScalar yRad) { - SkRRect rr; - rr.setRectXY(rect, xRad, yRad); - return rr; - } - - /** Sets bounds to oval, x-axis radii to half oval.width(), and all y-axis radii - to half oval.height(). If oval bounds is empty, sets to kEmpty_Type. - Otherwise, sets to kOval_Type. - - @param oval bounds of oval - */ - void setOval(const SkRect& oval); - - /** Sets to rounded rectangle with the same radii for all four corners. - If rect is empty, sets to kEmpty_Type. - Otherwise, if xRad or yRad is zero, sets to kRect_Type. - Otherwise, if xRad is at least half rect.width() and yRad is at least half - rect.height(), sets to kOval_Type. - Otherwise, sets to kSimple_Type. - - @param rect bounds of rounded rectangle - @param xRad x-axis radius of corners - @param yRad y-axis radius of corners - - example: https://fiddle.skia.org/c/@RRect_setRectXY - */ - void setRectXY(const SkRect& rect, SkScalar xRad, SkScalar yRad); - - /** Sets bounds to rect. Sets radii to (leftRad, topRad), (rightRad, topRad), - (rightRad, bottomRad), (leftRad, bottomRad). - - If rect is empty, sets to kEmpty_Type. - Otherwise, if leftRad and rightRad are zero, sets to kRect_Type. - Otherwise, if topRad and bottomRad are zero, sets to kRect_Type. - Otherwise, if leftRad and rightRad are equal and at least half rect.width(), and - topRad and bottomRad are equal at least half rect.height(), sets to kOval_Type. - Otherwise, if leftRad and rightRad are equal, and topRad and bottomRad are equal, - sets to kSimple_Type. Otherwise, sets to kNinePatch_Type. - - Nine patch refers to the nine parts defined by the radii: one center rectangle, - four edge patches, and four corner patches. - - @param rect bounds of rounded rectangle - @param leftRad left-top and left-bottom x-axis radius - @param topRad left-top and right-top y-axis radius - @param rightRad right-top and right-bottom x-axis radius - @param bottomRad left-bottom and right-bottom y-axis radius - */ - void setNinePatch(const SkRect& rect, SkScalar leftRad, SkScalar topRad, - SkScalar rightRad, SkScalar bottomRad); - - /** Sets bounds to rect. Sets radii array for individual control of all for corners. - - If rect is empty, sets to kEmpty_Type. - Otherwise, if one of each corner radii are zero, sets to kRect_Type. - Otherwise, if all x-axis radii are equal and at least half rect.width(), and - all y-axis radii are equal at least half rect.height(), sets to kOval_Type. - Otherwise, if all x-axis radii are equal, and all y-axis radii are equal, - sets to kSimple_Type. Otherwise, sets to kNinePatch_Type. - - @param rect bounds of rounded rectangle - @param radii corner x-axis and y-axis radii - - example: https://fiddle.skia.org/c/@RRect_setRectRadii - */ - void setRectRadii(const SkRect& rect, const SkVector radii[4]); - - /** \enum SkRRect::Corner - The radii are stored: top-left, top-right, bottom-right, bottom-left. - */ - enum Corner { - kUpperLeft_Corner, //!< index of top-left corner radii - kUpperRight_Corner, //!< index of top-right corner radii - kLowerRight_Corner, //!< index of bottom-right corner radii - kLowerLeft_Corner, //!< index of bottom-left corner radii - }; - - /** Returns bounds. Bounds may have zero width or zero height. Bounds right is - greater than or equal to left; bounds bottom is greater than or equal to top. - Result is identical to getBounds(). - - @return bounding box - */ - const SkRect& rect() const { return fRect; } - - /** Returns scalar pair for radius of curve on x-axis and y-axis for one corner. - Both radii may be zero. If not zero, both are positive and finite. - - @return x-axis and y-axis radii for one corner - */ - SkVector radii(Corner corner) const { return fRadii[corner]; } - - /** Returns bounds. Bounds may have zero width or zero height. Bounds right is - greater than or equal to left; bounds bottom is greater than or equal to top. - Result is identical to rect(). - - @return bounding box - */ - const SkRect& getBounds() const { return fRect; } - - /** Returns true if bounds and radii in a are equal to bounds and radii in b. - - a and b are not equal if either contain NaN. a and b are equal if members - contain zeroes with different signs. - - @param a SkRect bounds and radii to compare - @param b SkRect bounds and radii to compare - @return true if members are equal - */ - friend bool operator==(const SkRRect& a, const SkRRect& b) { - return a.fRect == b.fRect && SkScalarsEqual(&a.fRadii[0].fX, &b.fRadii[0].fX, 8); - } - - /** Returns true if bounds and radii in a are not equal to bounds and radii in b. - - a and b are not equal if either contain NaN. a and b are equal if members - contain zeroes with different signs. - - @param a SkRect bounds and radii to compare - @param b SkRect bounds and radii to compare - @return true if members are not equal - */ - friend bool operator!=(const SkRRect& a, const SkRRect& b) { - return a.fRect != b.fRect || !SkScalarsEqual(&a.fRadii[0].fX, &b.fRadii[0].fX, 8); - } - - /** Copies SkRRect to dst, then insets dst bounds by dx and dy, and adjusts dst - radii by dx and dy. dx and dy may be positive, negative, or zero. dst may be - SkRRect. - - If either corner radius is zero, the corner has no curvature and is unchanged. - Otherwise, if adjusted radius becomes negative, pins radius to zero. - If dx exceeds half dst bounds width, dst bounds left and right are set to - bounds x-axis center. If dy exceeds half dst bounds height, dst bounds top and - bottom are set to bounds y-axis center. - - If dx or dy cause the bounds to become infinite, dst bounds is zeroed. - - @param dx added to rect().fLeft, and subtracted from rect().fRight - @param dy added to rect().fTop, and subtracted from rect().fBottom - @param dst insets bounds and radii - - example: https://fiddle.skia.org/c/@RRect_inset - */ - void inset(SkScalar dx, SkScalar dy, SkRRect* dst) const; - - /** Insets bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be - positive, negative, or zero. - - If either corner radius is zero, the corner has no curvature and is unchanged. - Otherwise, if adjusted radius becomes negative, pins radius to zero. - If dx exceeds half bounds width, bounds left and right are set to - bounds x-axis center. If dy exceeds half bounds height, bounds top and - bottom are set to bounds y-axis center. - - If dx or dy cause the bounds to become infinite, bounds is zeroed. - - @param dx added to rect().fLeft, and subtracted from rect().fRight - @param dy added to rect().fTop, and subtracted from rect().fBottom - */ - void inset(SkScalar dx, SkScalar dy) { - this->inset(dx, dy, this); - } - - /** Outsets dst bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be - positive, negative, or zero. - - If either corner radius is zero, the corner has no curvature and is unchanged. - Otherwise, if adjusted radius becomes negative, pins radius to zero. - If dx exceeds half dst bounds width, dst bounds left and right are set to - bounds x-axis center. If dy exceeds half dst bounds height, dst bounds top and - bottom are set to bounds y-axis center. - - If dx or dy cause the bounds to become infinite, dst bounds is zeroed. - - @param dx subtracted from rect().fLeft, and added to rect().fRight - @param dy subtracted from rect().fTop, and added to rect().fBottom - @param dst outset bounds and radii - */ - void outset(SkScalar dx, SkScalar dy, SkRRect* dst) const { - this->inset(-dx, -dy, dst); - } - - /** Outsets bounds by dx and dy, and adjusts radii by dx and dy. dx and dy may be - positive, negative, or zero. - - If either corner radius is zero, the corner has no curvature and is unchanged. - Otherwise, if adjusted radius becomes negative, pins radius to zero. - If dx exceeds half bounds width, bounds left and right are set to - bounds x-axis center. If dy exceeds half bounds height, bounds top and - bottom are set to bounds y-axis center. - - If dx or dy cause the bounds to become infinite, bounds is zeroed. - - @param dx subtracted from rect().fLeft, and added to rect().fRight - @param dy subtracted from rect().fTop, and added to rect().fBottom - */ - void outset(SkScalar dx, SkScalar dy) { - this->inset(-dx, -dy, this); - } - - /** Translates SkRRect by (dx, dy). - - @param dx offset added to rect().fLeft and rect().fRight - @param dy offset added to rect().fTop and rect().fBottom - */ - void offset(SkScalar dx, SkScalar dy) { - fRect.offset(dx, dy); - } - - /** Returns SkRRect translated by (dx, dy). - - @param dx offset added to rect().fLeft and rect().fRight - @param dy offset added to rect().fTop and rect().fBottom - @return SkRRect bounds offset by (dx, dy), with unchanged corner radii - */ - SkRRect SK_WARN_UNUSED_RESULT makeOffset(SkScalar dx, SkScalar dy) const { - return SkRRect(fRect.makeOffset(dx, dy), fRadii, fType); - } - - /** Returns true if rect is inside the bounds and corner radii, and if - SkRRect and rect are not empty. - - @param rect area tested for containment - @return true if SkRRect contains rect - - example: https://fiddle.skia.org/c/@RRect_contains - */ - bool contains(const SkRect& rect) const; - - /** Returns true if bounds and radii values are finite and describe a SkRRect - SkRRect::Type that matches getType(). All SkRRect methods construct valid types, - even if the input values are not valid. Invalid SkRRect data can only - be generated by corrupting memory. - - @return true if bounds and radii match type() - - example: https://fiddle.skia.org/c/@RRect_isValid - */ - bool isValid() const; - - static constexpr size_t kSizeInMemory = 12 * sizeof(SkScalar); - - /** Writes SkRRect to buffer. Writes kSizeInMemory bytes, and returns - kSizeInMemory, the number of bytes written. - - @param buffer storage for SkRRect - @return bytes written, kSizeInMemory - - example: https://fiddle.skia.org/c/@RRect_writeToMemory - */ - size_t writeToMemory(void* buffer) const; - - /** Reads SkRRect from buffer, reading kSizeInMemory bytes. - Returns kSizeInMemory, bytes read if length is at least kSizeInMemory. - Otherwise, returns zero. - - @param buffer memory to read from - @param length size of buffer - @return bytes read, or 0 if length is less than kSizeInMemory - - example: https://fiddle.skia.org/c/@RRect_readFromMemory - */ - size_t readFromMemory(const void* buffer, size_t length); - - /** Transforms by SkRRect by matrix, storing result in dst. - Returns true if SkRRect transformed can be represented by another SkRRect. - Returns false if matrix contains transformations that are not axis aligned. - - Asserts in debug builds if SkRRect equals dst. - - @param matrix SkMatrix specifying the transform - @param dst SkRRect to store the result - @return true if transformation succeeded. - - example: https://fiddle.skia.org/c/@RRect_transform - */ - bool transform(const SkMatrix& matrix, SkRRect* dst) const; - - /** Writes text representation of SkRRect to standard output. - Set asHex true to generate exact binary representations - of floating point numbers. - - @param asHex true if SkScalar values are written as hexadecimal - - example: https://fiddle.skia.org/c/@RRect_dump - */ - void dump(bool asHex) const; - SkString dumpToString(bool asHex) const; - - /** Writes text representation of SkRRect to standard output. The representation - may be directly compiled as C++ code. Floating point values are written - with limited precision; it may not be possible to reconstruct original - SkRRect from output. - */ - void dump() const { this->dump(false); } - - /** Writes text representation of SkRRect to standard output. The representation - may be directly compiled as C++ code. Floating point values are written - in hexadecimal to preserve their exact bit pattern. The output reconstructs the - original SkRRect. - */ - void dumpHex() const { this->dump(true); } - -private: - static bool AreRectAndRadiiValid(const SkRect&, const SkVector[4]); - - SkRRect(const SkRect& rect, const SkVector radii[4], int32_t type) - : fRect(rect) - , fRadii{radii[0], radii[1], radii[2], radii[3]} - , fType(type) {} - - /** - * Initializes fRect. If the passed in rect is not finite or empty the rrect will be fully - * initialized and false is returned. Otherwise, just fRect is initialized and true is returned. - */ - bool initializeRect(const SkRect&); - - void computeType(); - bool checkCornerContainment(SkScalar x, SkScalar y) const; - // Returns true if the radii had to be scaled to fit rect - bool scaleRadii(); - - SkRect fRect = SkRect::MakeEmpty(); - // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[] - SkVector fRadii[4] = {{0, 0}, {0, 0}, {0,0}, {0,0}}; - // use an explicitly sized type so we're sure the class is dense (no uninitialized bytes) - int32_t fType = kEmpty_Type; - // TODO: add padding so we can use memcpy for flattening and not copy uninitialized data - - // to access fRadii directly - friend class SkPath; - friend class SkRRectPriv; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRSXform.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRSXform.h deleted file mode 100644 index 5fcfff29221afd..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRSXform.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRSXform_DEFINED -#define SkRSXform_DEFINED - -#include "include/core/SkPoint.h" -#include "include/core/SkSize.h" - -/** - * A compressed form of a rotation+scale matrix. - * - * [ fSCos -fSSin fTx ] - * [ fSSin fSCos fTy ] - * [ 0 0 1 ] - */ -struct SK_API SkRSXform { - static SkRSXform Make(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) { - SkRSXform xform = { scos, ssin, tx, ty }; - return xform; - } - - /* - * Initialize a new xform based on the scale, rotation (in radians), final tx,ty location - * and anchor-point ax,ay within the src quad. - * - * Note: the anchor point is not normalized (e.g. 0...1) but is in pixels of the src image. - */ - static SkRSXform MakeFromRadians(SkScalar scale, SkScalar radians, SkScalar tx, SkScalar ty, - SkScalar ax, SkScalar ay) { - const SkScalar s = SkScalarSin(radians) * scale; - const SkScalar c = SkScalarCos(radians) * scale; - return Make(c, s, tx + -c * ax + s * ay, ty + -s * ax - c * ay); - } - - SkScalar fSCos; - SkScalar fSSin; - SkScalar fTx; - SkScalar fTy; - - bool rectStaysRect() const { - return 0 == fSCos || 0 == fSSin; - } - - void setIdentity() { - fSCos = 1; - fSSin = fTx = fTy = 0; - } - - void set(SkScalar scos, SkScalar ssin, SkScalar tx, SkScalar ty) { - fSCos = scos; - fSSin = ssin; - fTx = tx; - fTy = ty; - } - - void toQuad(SkScalar width, SkScalar height, SkPoint quad[4]) const; - void toQuad(const SkSize& size, SkPoint quad[4]) const { - this->toQuad(size.width(), size.height(), quad); - } - void toTriStrip(SkScalar width, SkScalar height, SkPoint strip[4]) const; -}; - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRasterHandleAllocator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRasterHandleAllocator.h deleted file mode 100644 index 6fe121a6dedecc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRasterHandleAllocator.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRasterHandleAllocator_DEFINED -#define SkRasterHandleAllocator_DEFINED - -#include "include/core/SkImageInfo.h" - -class SkBitmap; -class SkCanvas; -class SkMatrix; -class SkSurfaceProps; - -/** - * If a client wants to control the allocation of raster layers in a canvas, it should subclass - * SkRasterHandleAllocator. This allocator performs two tasks: - * 1. controls how the memory for the pixels is allocated - * 2. associates a "handle" to a private object that can track the matrix/clip of the SkCanvas - * - * This example allocates a canvas, and defers to the allocator to create the base layer. - * - * std::unique_ptr canvas = SkRasterHandleAllocator::MakeCanvas( - * SkImageInfo::Make(...), - * std::make_unique(...), - * nullptr); - * - * If you have already allocated the base layer (and its handle, release-proc etc.) then you - * can pass those in using the last parameter to MakeCanvas(). - * - * Regardless of how the base layer is allocated, each time canvas->saveLayer() is called, - * your allocator's allocHandle() will be called. - */ -class SK_API SkRasterHandleAllocator { -public: - virtual ~SkRasterHandleAllocator() = default; - - // The value that is returned to clients of the canvas that has this allocator installed. - typedef void* Handle; - - struct Rec { - // When the allocation goes out of scope, this proc is called to free everything associated - // with it: the pixels, the "handle", etc. This is passed the pixel address and fReleaseCtx. - void (*fReleaseProc)(void* pixels, void* ctx); - void* fReleaseCtx; // context passed to fReleaseProc - void* fPixels; // pixels for this allocation - size_t fRowBytes; // rowbytes for these pixels - Handle fHandle; // public handle returned by SkCanvas::accessTopRasterHandle() - }; - - /** - * Given a requested info, allocate the corresponding pixels/rowbytes, and whatever handle - * is desired to give clients access to those pixels. The rec also contains a proc and context - * which will be called when this allocation goes out of scope. - * - * e.g. - * when canvas->saveLayer() is called, the allocator will be called to allocate the pixels - * for the layer. When canvas->restore() is called, the fReleaseProc will be called. - */ - virtual bool allocHandle(const SkImageInfo&, Rec*) = 0; - - /** - * Clients access the handle for a given layer by calling SkCanvas::accessTopRasterHandle(). - * To allow the handle to reflect the current matrix/clip in the canvs, updateHandle() is - * is called. The subclass is responsible to update the handle as it sees fit. - */ - virtual void updateHandle(Handle, const SkMatrix&, const SkIRect&) = 0; - - /** - * This creates a canvas which will use the allocator to manage pixel allocations, including - * all calls to saveLayer(). - * - * If rec is non-null, then it will be used as the base-layer of pixels/handle. - * If rec is null, then the allocator will be called for the base-layer as well. - */ - static std::unique_ptr MakeCanvas(std::unique_ptr, - const SkImageInfo&, const Rec* rec = nullptr, - const SkSurfaceProps* props = nullptr); - -protected: - SkRasterHandleAllocator() = default; - SkRasterHandleAllocator(const SkRasterHandleAllocator&) = delete; - SkRasterHandleAllocator& operator=(const SkRasterHandleAllocator&) = delete; - -private: - friend class SkBitmapDevice; - - Handle allocBitmap(const SkImageInfo&, SkBitmap*); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRect.h deleted file mode 100644 index 9467a331c3e19a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRect.h +++ /dev/null @@ -1,1385 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRect_DEFINED -#define SkRect_DEFINED - -#include "include/core/SkPoint.h" -#include "include/core/SkSize.h" -#include "include/private/SkSafe32.h" -#include "include/private/SkTFitsIn.h" - -#include -#include - -struct SkRect; - -/** \struct SkIRect - SkIRect holds four 32-bit integer coordinates describing the upper and - lower bounds of a rectangle. SkIRect may be created from outer bounds or - from position, width, and height. SkIRect describes an area; if its right - is less than or equal to its left, or if its bottom is less than or equal to - its top, it is considered empty. -*/ -struct SK_API SkIRect { - int32_t fLeft; //!< smaller x-axis bounds - int32_t fTop; //!< smaller y-axis bounds - int32_t fRight; //!< larger x-axis bounds - int32_t fBottom; //!< larger y-axis bounds - - /** Returns constructed SkIRect set to (0, 0, 0, 0). - Many other rectangles are empty; if left is equal to or greater than right, - or if top is equal to or greater than bottom. Setting all members to zero - is a convenience, but does not designate a special empty rectangle. - - @return bounds (0, 0, 0, 0) - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeEmpty() { - return SkIRect{0, 0, 0, 0}; - } - - /** Returns constructed SkIRect set to (0, 0, w, h). Does not validate input; w or h - may be negative. - - @param w width of constructed SkIRect - @param h height of constructed SkIRect - @return bounds (0, 0, w, h) - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeWH(int32_t w, int32_t h) { - return SkIRect{0, 0, w, h}; - } - - /** Returns constructed SkIRect set to (0, 0, size.width(), size.height()). - Does not validate input; size.width() or size.height() may be negative. - - @param size values for SkIRect width and height - @return bounds (0, 0, size.width(), size.height()) - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeSize(const SkISize& size) { - return SkIRect{0, 0, size.fWidth, size.fHeight}; - } - - /** Returns constructed SkIRect set to (pt.x(), pt.y(), pt.x() + size.width(), - pt.y() + size.height()). Does not validate input; size.width() or size.height() may be - negative. - - @param pt values for SkIRect fLeft and fTop - @param size values for SkIRect width and height - @return bounds at pt with width and height of size - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakePtSize(SkIPoint pt, SkISize size) { - return MakeXYWH(pt.x(), pt.y(), size.width(), size.height()); - } - - /** Returns constructed SkIRect set to (l, t, r, b). Does not sort input; SkIRect may - result in fLeft greater than fRight, or fTop greater than fBottom. - - @param l integer stored in fLeft - @param t integer stored in fTop - @param r integer stored in fRight - @param b integer stored in fBottom - @return bounds (l, t, r, b) - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeLTRB(int32_t l, int32_t t, - int32_t r, int32_t b) { - return SkIRect{l, t, r, b}; - } - - /** Returns constructed SkIRect set to: (x, y, x + w, y + h). - Does not validate input; w or h may be negative. - - @param x stored in fLeft - @param y stored in fTop - @param w added to x and stored in fRight - @param h added to y and stored in fBottom - @return bounds at (x, y) with width w and height h - */ - static constexpr SkIRect SK_WARN_UNUSED_RESULT MakeXYWH(int32_t x, int32_t y, - int32_t w, int32_t h) { - return { x, y, Sk32_sat_add(x, w), Sk32_sat_add(y, h) }; - } - - /** Returns left edge of SkIRect, if sorted. - Call sort() to reverse fLeft and fRight if needed. - - @return fLeft - */ - constexpr int32_t left() const { return fLeft; } - - /** Returns top edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fTop - */ - constexpr int32_t top() const { return fTop; } - - /** Returns right edge of SkIRect, if sorted. - Call sort() to reverse fLeft and fRight if needed. - - @return fRight - */ - constexpr int32_t right() const { return fRight; } - - /** Returns bottom edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fBottom - */ - constexpr int32_t bottom() const { return fBottom; } - - /** Returns left edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid, - and sort() to reverse fLeft and fRight if needed. - - @return fLeft - */ - constexpr int32_t x() const { return fLeft; } - - /** Returns top edge of SkIRect, if sorted. Call isEmpty() to see if SkIRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fTop - */ - constexpr int32_t y() const { return fTop; } - - // Experimental - constexpr SkIPoint topLeft() const { return {fLeft, fTop}; } - - /** Returns span on the x-axis. This does not check if SkIRect is sorted, or if - result fits in 32-bit signed integer; result may be negative. - - @return fRight minus fLeft - */ - constexpr int32_t width() const { return Sk32_can_overflow_sub(fRight, fLeft); } - - /** Returns span on the y-axis. This does not check if SkIRect is sorted, or if - result fits in 32-bit signed integer; result may be negative. - - @return fBottom minus fTop - */ - constexpr int32_t height() const { return Sk32_can_overflow_sub(fBottom, fTop); } - - /** Returns spans on the x-axis and y-axis. This does not check if SkIRect is sorted, - or if result fits in 32-bit signed integer; result may be negative. - - @return SkISize (width, height) - */ - constexpr SkISize size() const { return SkISize::Make(this->width(), this->height()); } - - /** Returns span on the x-axis. This does not check if SkIRect is sorted, so the - result may be negative. This is safer than calling width() since width() might - overflow in its calculation. - - @return fRight minus fLeft cast to int64_t - */ - constexpr int64_t width64() const { return (int64_t)fRight - (int64_t)fLeft; } - - /** Returns span on the y-axis. This does not check if SkIRect is sorted, so the - result may be negative. This is safer than calling height() since height() might - overflow in its calculation. - - @return fBottom minus fTop cast to int64_t - */ - constexpr int64_t height64() const { return (int64_t)fBottom - (int64_t)fTop; } - - /** Returns true if fLeft is equal to or greater than fRight, or if fTop is equal - to or greater than fBottom. Call sort() to reverse rectangles with negative - width64() or height64(). - - @return true if width64() or height64() are zero or negative - */ - bool isEmpty64() const { return fRight <= fLeft || fBottom <= fTop; } - - /** Returns true if width() or height() are zero or negative. - - @return true if width() or height() are zero or negative - */ - bool isEmpty() const { - int64_t w = this->width64(); - int64_t h = this->height64(); - if (w <= 0 || h <= 0) { - return true; - } - // Return true if either exceeds int32_t - return !SkTFitsIn(w | h); - } - - /** Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are - identical to corresponding members in b. - - @param a SkIRect to compare - @param b SkIRect to compare - @return true if members are equal - */ - friend bool operator==(const SkIRect& a, const SkIRect& b) { - return a.fLeft == b.fLeft && a.fTop == b.fTop && - a.fRight == b.fRight && a.fBottom == b.fBottom; - } - - /** Returns true if any member in a: fLeft, fTop, fRight, and fBottom; is not - identical to the corresponding member in b. - - @param a SkIRect to compare - @param b SkIRect to compare - @return true if members are not equal - */ - friend bool operator!=(const SkIRect& a, const SkIRect& b) { - return a.fLeft != b.fLeft || a.fTop != b.fTop || - a.fRight != b.fRight || a.fBottom != b.fBottom; - } - - /** Sets SkIRect to (0, 0, 0, 0). - - Many other rectangles are empty; if left is equal to or greater than right, - or if top is equal to or greater than bottom. Setting all members to zero - is a convenience, but does not designate a special empty rectangle. - */ - void setEmpty() { memset(this, 0, sizeof(*this)); } - - /** Sets SkIRect to (left, top, right, bottom). - left and right are not sorted; left is not necessarily less than right. - top and bottom are not sorted; top is not necessarily less than bottom. - - @param left stored in fLeft - @param top stored in fTop - @param right stored in fRight - @param bottom stored in fBottom - */ - void setLTRB(int32_t left, int32_t top, int32_t right, int32_t bottom) { - fLeft = left; - fTop = top; - fRight = right; - fBottom = bottom; - } - - /** Sets SkIRect to: (x, y, x + width, y + height). - Does not validate input; width or height may be negative. - - @param x stored in fLeft - @param y stored in fTop - @param width added to x and stored in fRight - @param height added to y and stored in fBottom - */ - void setXYWH(int32_t x, int32_t y, int32_t width, int32_t height) { - fLeft = x; - fTop = y; - fRight = Sk32_sat_add(x, width); - fBottom = Sk32_sat_add(y, height); - } - - void setWH(int32_t width, int32_t height) { - fLeft = 0; - fTop = 0; - fRight = width; - fBottom = height; - } - - void setSize(SkISize size) { - fLeft = 0; - fTop = 0; - fRight = size.width(); - fBottom = size.height(); - } - - /** Returns SkIRect offset by (dx, dy). - - If dx is negative, SkIRect returned is moved to the left. - If dx is positive, SkIRect returned is moved to the right. - If dy is negative, SkIRect returned is moved upward. - If dy is positive, SkIRect returned is moved downward. - - @param dx offset added to fLeft and fRight - @param dy offset added to fTop and fBottom - @return SkIRect offset by dx and dy, with original width and height - */ - constexpr SkIRect makeOffset(int32_t dx, int32_t dy) const { - return { - Sk32_sat_add(fLeft, dx), Sk32_sat_add(fTop, dy), - Sk32_sat_add(fRight, dx), Sk32_sat_add(fBottom, dy), - }; - } - - /** Returns SkIRect offset by (offset.x(), offset.y()). - - If offset.x() is negative, SkIRect returned is moved to the left. - If offset.x() is positive, SkIRect returned is moved to the right. - If offset.y() is negative, SkIRect returned is moved upward. - If offset.y() is positive, SkIRect returned is moved downward. - - @param offset translation vector - @return SkIRect translated by offset, with original width and height - */ - constexpr SkIRect makeOffset(SkIVector offset) const { - return this->makeOffset(offset.x(), offset.y()); - } - - /** Returns SkIRect, inset by (dx, dy). - - If dx is negative, SkIRect returned is wider. - If dx is positive, SkIRect returned is narrower. - If dy is negative, SkIRect returned is taller. - If dy is positive, SkIRect returned is shorter. - - @param dx offset added to fLeft and subtracted from fRight - @param dy offset added to fTop and subtracted from fBottom - @return SkIRect inset symmetrically left and right, top and bottom - */ - SkIRect makeInset(int32_t dx, int32_t dy) const { - return { - Sk32_sat_add(fLeft, dx), Sk32_sat_add(fTop, dy), - Sk32_sat_sub(fRight, dx), Sk32_sat_sub(fBottom, dy), - }; - } - - /** Returns SkIRect, outset by (dx, dy). - - If dx is negative, SkIRect returned is narrower. - If dx is positive, SkIRect returned is wider. - If dy is negative, SkIRect returned is shorter. - If dy is positive, SkIRect returned is taller. - - @param dx offset subtracted to fLeft and added from fRight - @param dy offset subtracted to fTop and added from fBottom - @return SkIRect outset symmetrically left and right, top and bottom - */ - SkIRect makeOutset(int32_t dx, int32_t dy) const { - return { - Sk32_sat_sub(fLeft, dx), Sk32_sat_sub(fTop, dy), - Sk32_sat_add(fRight, dx), Sk32_sat_add(fBottom, dy), - }; - } - - /** Offsets SkIRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom. - - If dx is negative, moves SkIRect returned to the left. - If dx is positive, moves SkIRect returned to the right. - If dy is negative, moves SkIRect returned upward. - If dy is positive, moves SkIRect returned downward. - - @param dx offset added to fLeft and fRight - @param dy offset added to fTop and fBottom - */ - void offset(int32_t dx, int32_t dy) { - fLeft = Sk32_sat_add(fLeft, dx); - fTop = Sk32_sat_add(fTop, dy); - fRight = Sk32_sat_add(fRight, dx); - fBottom = Sk32_sat_add(fBottom, dy); - } - - /** Offsets SkIRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to - fTop, fBottom. - - If delta.fX is negative, moves SkIRect returned to the left. - If delta.fX is positive, moves SkIRect returned to the right. - If delta.fY is negative, moves SkIRect returned upward. - If delta.fY is positive, moves SkIRect returned downward. - - @param delta offset added to SkIRect - */ - void offset(const SkIPoint& delta) { - this->offset(delta.fX, delta.fY); - } - - /** Offsets SkIRect so that fLeft equals newX, and fTop equals newY. width and height - are unchanged. - - @param newX stored in fLeft, preserving width() - @param newY stored in fTop, preserving height() - */ - void offsetTo(int32_t newX, int32_t newY) { - fRight = Sk64_pin_to_s32((int64_t)fRight + newX - fLeft); - fBottom = Sk64_pin_to_s32((int64_t)fBottom + newY - fTop); - fLeft = newX; - fTop = newY; - } - - /** Insets SkIRect by (dx,dy). - - If dx is positive, makes SkIRect narrower. - If dx is negative, makes SkIRect wider. - If dy is positive, makes SkIRect shorter. - If dy is negative, makes SkIRect taller. - - @param dx offset added to fLeft and subtracted from fRight - @param dy offset added to fTop and subtracted from fBottom - */ - void inset(int32_t dx, int32_t dy) { - fLeft = Sk32_sat_add(fLeft, dx); - fTop = Sk32_sat_add(fTop, dy); - fRight = Sk32_sat_sub(fRight, dx); - fBottom = Sk32_sat_sub(fBottom, dy); - } - - /** Outsets SkIRect by (dx, dy). - - If dx is positive, makes SkIRect wider. - If dx is negative, makes SkIRect narrower. - If dy is positive, makes SkIRect taller. - If dy is negative, makes SkIRect shorter. - - @param dx subtracted to fLeft and added from fRight - @param dy subtracted to fTop and added from fBottom - */ - void outset(int32_t dx, int32_t dy) { this->inset(-dx, -dy); } - - /** Adjusts SkIRect by adding dL to fLeft, dT to fTop, dR to fRight, and dB to fBottom. - - If dL is positive, narrows SkIRect on the left. If negative, widens it on the left. - If dT is positive, shrinks SkIRect on the top. If negative, lengthens it on the top. - If dR is positive, narrows SkIRect on the right. If negative, widens it on the right. - If dB is positive, shrinks SkIRect on the bottom. If negative, lengthens it on the bottom. - - The resulting SkIRect is not checked for validity. Thus, if the resulting SkIRect left is - greater than right, the SkIRect will be considered empty. Call sort() after this call - if that is not the desired behavior. - - @param dL offset added to fLeft - @param dT offset added to fTop - @param dR offset added to fRight - @param dB offset added to fBottom - */ - void adjust(int32_t dL, int32_t dT, int32_t dR, int32_t dB) { - fLeft = Sk32_sat_add(fLeft, dL); - fTop = Sk32_sat_add(fTop, dT); - fRight = Sk32_sat_add(fRight, dR); - fBottom = Sk32_sat_add(fBottom, dB); - } - - /** Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. - Returns false if SkIRect is empty. - - Considers input to describe constructed SkIRect: (x, y, x + 1, y + 1) and - returns true if constructed area is completely enclosed by SkIRect area. - - @param x test SkIPoint x-coordinate - @param y test SkIPoint y-coordinate - @return true if (x, y) is inside SkIRect - */ - bool contains(int32_t x, int32_t y) const { - return x >= fLeft && x < fRight && y >= fTop && y < fBottom; - } - - /** Returns true if SkIRect contains r. - Returns false if SkIRect is empty or r is empty. - - SkIRect contains r when SkIRect area completely includes r area. - - @param r SkIRect contained - @return true if all sides of SkIRect are outside r - */ - bool contains(const SkIRect& r) const { - return !r.isEmpty() && !this->isEmpty() && // check for empties - fLeft <= r.fLeft && fTop <= r.fTop && - fRight >= r.fRight && fBottom >= r.fBottom; - } - - /** Returns true if SkIRect contains r. - Returns false if SkIRect is empty or r is empty. - - SkIRect contains r when SkIRect area completely includes r area. - - @param r SkRect contained - @return true if all sides of SkIRect are outside r - */ - inline bool contains(const SkRect& r) const; - - /** Returns true if SkIRect contains construction. - Asserts if SkIRect is empty or construction is empty, and if SK_DEBUG is defined. - - Return is undefined if SkIRect is empty or construction is empty. - - @param r SkIRect contained - @return true if all sides of SkIRect are outside r - */ - bool containsNoEmptyCheck(const SkIRect& r) const { - SkASSERT(fLeft < fRight && fTop < fBottom); - SkASSERT(r.fLeft < r.fRight && r.fTop < r.fBottom); - return fLeft <= r.fLeft && fTop <= r.fTop && fRight >= r.fRight && fBottom >= r.fBottom; - } - - /** Returns true if SkIRect intersects r, and sets SkIRect to intersection. - Returns false if SkIRect does not intersect r, and leaves SkIRect unchanged. - - Returns false if either r or SkIRect is empty, leaving SkIRect unchanged. - - @param r limit of result - @return true if r and SkIRect have area in common - */ - bool intersect(const SkIRect& r) { - return this->intersect(*this, r); - } - - /** Returns true if a intersects b, and sets SkIRect to intersection. - Returns false if a does not intersect b, and leaves SkIRect unchanged. - - Returns false if either a or b is empty, leaving SkIRect unchanged. - - @param a SkIRect to intersect - @param b SkIRect to intersect - @return true if a and b have area in common - */ - bool SK_WARN_UNUSED_RESULT intersect(const SkIRect& a, const SkIRect& b); - - /** Returns true if a intersects b. - Returns false if either a or b is empty, or do not intersect. - - @param a SkIRect to intersect - @param b SkIRect to intersect - @return true if a and b have area in common - */ - static bool Intersects(const SkIRect& a, const SkIRect& b) { - return SkIRect{}.intersect(a, b); - } - - /** Sets SkIRect to the union of itself and r. - - Has no effect if r is empty. Otherwise, if SkIRect is empty, sets SkIRect to r. - - @param r expansion SkIRect - - example: https://fiddle.skia.org/c/@IRect_join_2 - */ - void join(const SkIRect& r); - - /** Swaps fLeft and fRight if fLeft is greater than fRight; and swaps - fTop and fBottom if fTop is greater than fBottom. Result may be empty, - and width() and height() will be zero or positive. - */ - void sort() { - using std::swap; - if (fLeft > fRight) { - swap(fLeft, fRight); - } - if (fTop > fBottom) { - swap(fTop, fBottom); - } - } - - /** Returns SkIRect with fLeft and fRight swapped if fLeft is greater than fRight; and - with fTop and fBottom swapped if fTop is greater than fBottom. Result may be empty; - and width() and height() will be zero or positive. - - @return sorted SkIRect - */ - SkIRect makeSorted() const { - return MakeLTRB(std::min(fLeft, fRight), std::min(fTop, fBottom), - std::max(fLeft, fRight), std::max(fTop, fBottom)); - } -}; - -/** \struct SkRect - SkRect holds four SkScalar coordinates describing the upper and - lower bounds of a rectangle. SkRect may be created from outer bounds or - from position, width, and height. SkRect describes an area; if its right - is less than or equal to its left, or if its bottom is less than or equal to - its top, it is considered empty. -*/ -struct SK_API SkRect { - SkScalar fLeft; //!< smaller x-axis bounds - SkScalar fTop; //!< smaller y-axis bounds - SkScalar fRight; //!< larger x-axis bounds - SkScalar fBottom; //!< larger y-axis bounds - - /** Returns constructed SkRect set to (0, 0, 0, 0). - Many other rectangles are empty; if left is equal to or greater than right, - or if top is equal to or greater than bottom. Setting all members to zero - is a convenience, but does not designate a special empty rectangle. - - @return bounds (0, 0, 0, 0) - */ - static constexpr SkRect SK_WARN_UNUSED_RESULT MakeEmpty() { - return SkRect{0, 0, 0, 0}; - } - - /** Returns constructed SkRect set to SkScalar values (0, 0, w, h). Does not - validate input; w or h may be negative. - - Passing integer values may generate a compiler warning since SkRect cannot - represent 32-bit integers exactly. Use SkIRect for an exact integer rectangle. - - @param w SkScalar width of constructed SkRect - @param h SkScalar height of constructed SkRect - @return bounds (0, 0, w, h) - */ - static constexpr SkRect SK_WARN_UNUSED_RESULT MakeWH(SkScalar w, SkScalar h) { - return SkRect{0, 0, w, h}; - } - - /** Returns constructed SkRect set to integer values (0, 0, w, h). Does not validate - input; w or h may be negative. - - Use to avoid a compiler warning that input may lose precision when stored. - Use SkIRect for an exact integer rectangle. - - @param w integer width of constructed SkRect - @param h integer height of constructed SkRect - @return bounds (0, 0, w, h) - */ - static SkRect SK_WARN_UNUSED_RESULT MakeIWH(int w, int h) { - return {0, 0, SkIntToScalar(w), SkIntToScalar(h)}; - } - - /** Returns constructed SkRect set to (0, 0, size.width(), size.height()). Does not - validate input; size.width() or size.height() may be negative. - - @param size SkScalar values for SkRect width and height - @return bounds (0, 0, size.width(), size.height()) - */ - static constexpr SkRect SK_WARN_UNUSED_RESULT MakeSize(const SkSize& size) { - return SkRect{0, 0, size.fWidth, size.fHeight}; - } - - /** Returns constructed SkRect set to (l, t, r, b). Does not sort input; SkRect may - result in fLeft greater than fRight, or fTop greater than fBottom. - - @param l SkScalar stored in fLeft - @param t SkScalar stored in fTop - @param r SkScalar stored in fRight - @param b SkScalar stored in fBottom - @return bounds (l, t, r, b) - */ - static constexpr SkRect SK_WARN_UNUSED_RESULT MakeLTRB(SkScalar l, SkScalar t, SkScalar r, - SkScalar b) { - return SkRect {l, t, r, b}; - } - - /** Returns constructed SkRect set to (x, y, x + w, y + h). - Does not validate input; w or h may be negative. - - @param x stored in fLeft - @param y stored in fTop - @param w added to x and stored in fRight - @param h added to y and stored in fBottom - @return bounds at (x, y) with width w and height h - */ - static constexpr SkRect SK_WARN_UNUSED_RESULT MakeXYWH(SkScalar x, SkScalar y, SkScalar w, - SkScalar h) { - return SkRect {x, y, x + w, y + h}; - } - - /** Returns constructed SkIRect set to (0, 0, size.width(), size.height()). - Does not validate input; size.width() or size.height() may be negative. - - @param size integer values for SkRect width and height - @return bounds (0, 0, size.width(), size.height()) - */ - static SkRect Make(const SkISize& size) { - return MakeIWH(size.width(), size.height()); - } - - /** Returns constructed SkIRect set to irect, promoting integers to scalar. - Does not validate input; fLeft may be greater than fRight, fTop may be greater - than fBottom. - - @param irect integer unsorted bounds - @return irect members converted to SkScalar - */ - static SkRect SK_WARN_UNUSED_RESULT Make(const SkIRect& irect) { - return { - SkIntToScalar(irect.fLeft), SkIntToScalar(irect.fTop), - SkIntToScalar(irect.fRight), SkIntToScalar(irect.fBottom) - }; - } - - /** Returns true if fLeft is equal to or greater than fRight, or if fTop is equal - to or greater than fBottom. Call sort() to reverse rectangles with negative - width() or height(). - - @return true if width() or height() are zero or negative - */ - bool isEmpty() const { - // We write it as the NOT of a non-empty rect, so we will return true if any values - // are NaN. - return !(fLeft < fRight && fTop < fBottom); - } - - /** Returns true if fLeft is equal to or less than fRight, or if fTop is equal - to or less than fBottom. Call sort() to reverse rectangles with negative - width() or height(). - - @return true if width() or height() are zero or positive - */ - bool isSorted() const { return fLeft <= fRight && fTop <= fBottom; } - - /** Returns true if all values in the rectangle are finite: SK_ScalarMin or larger, - and SK_ScalarMax or smaller. - - @return true if no member is infinite or NaN - */ - bool isFinite() const { - float accum = 0; - accum *= fLeft; - accum *= fTop; - accum *= fRight; - accum *= fBottom; - - // accum is either NaN or it is finite (zero). - SkASSERT(0 == accum || SkScalarIsNaN(accum)); - - // value==value will be true iff value is not NaN - // TODO: is it faster to say !accum or accum==accum? - return !SkScalarIsNaN(accum); - } - - /** Returns left edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid. - Call sort() to reverse fLeft and fRight if needed. - - @return fLeft - */ - constexpr SkScalar x() const { return fLeft; } - - /** Returns top edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fTop - */ - constexpr SkScalar y() const { return fTop; } - - /** Returns left edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid. - Call sort() to reverse fLeft and fRight if needed. - - @return fLeft - */ - constexpr SkScalar left() const { return fLeft; } - - /** Returns top edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fTop - */ - constexpr SkScalar top() const { return fTop; } - - /** Returns right edge of SkRect, if sorted. Call isSorted() to see if SkRect is valid. - Call sort() to reverse fLeft and fRight if needed. - - @return fRight - */ - constexpr SkScalar right() const { return fRight; } - - /** Returns bottom edge of SkRect, if sorted. Call isEmpty() to see if SkRect may be invalid, - and sort() to reverse fTop and fBottom if needed. - - @return fBottom - */ - constexpr SkScalar bottom() const { return fBottom; } - - /** Returns span on the x-axis. This does not check if SkRect is sorted, or if - result fits in 32-bit float; result may be negative or infinity. - - @return fRight minus fLeft - */ - constexpr SkScalar width() const { return fRight - fLeft; } - - /** Returns span on the y-axis. This does not check if SkRect is sorted, or if - result fits in 32-bit float; result may be negative or infinity. - - @return fBottom minus fTop - */ - constexpr SkScalar height() const { return fBottom - fTop; } - - /** Returns average of left edge and right edge. Result does not change if SkRect - is sorted. Result may overflow to infinity if SkRect is far from the origin. - - @return midpoint on x-axis - */ - constexpr SkScalar centerX() const { - // don't use SkScalarHalf(fLeft + fBottom) as that might overflow before the 0.5 - return SkScalarHalf(fLeft) + SkScalarHalf(fRight); - } - - /** Returns average of top edge and bottom edge. Result does not change if SkRect - is sorted. - - @return midpoint on y-axis - */ - constexpr SkScalar centerY() const { - // don't use SkScalarHalf(fTop + fBottom) as that might overflow before the 0.5 - return SkScalarHalf(fTop) + SkScalarHalf(fBottom); - } - - /** Returns the point this->centerX(), this->centerY(). - @return rectangle center - */ - constexpr SkPoint center() const { return {this->centerX(), this->centerY()}; } - - /** Returns true if all members in a: fLeft, fTop, fRight, and fBottom; are - equal to the corresponding members in b. - - a and b are not equal if either contain NaN. a and b are equal if members - contain zeroes with different signs. - - @param a SkRect to compare - @param b SkRect to compare - @return true if members are equal - */ - friend bool operator==(const SkRect& a, const SkRect& b) { - return SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4); - } - - /** Returns true if any in a: fLeft, fTop, fRight, and fBottom; does not - equal the corresponding members in b. - - a and b are not equal if either contain NaN. a and b are equal if members - contain zeroes with different signs. - - @param a SkRect to compare - @param b SkRect to compare - @return true if members are not equal - */ - friend bool operator!=(const SkRect& a, const SkRect& b) { - return !SkScalarsEqual((const SkScalar*)&a, (const SkScalar*)&b, 4); - } - - /** Returns four points in quad that enclose SkRect ordered as: top-left, top-right, - bottom-right, bottom-left. - - TODO: Consider adding parameter to control whether quad is clockwise or counterclockwise. - - @param quad storage for corners of SkRect - - example: https://fiddle.skia.org/c/@Rect_toQuad - */ - void toQuad(SkPoint quad[4]) const; - - /** Sets SkRect to (0, 0, 0, 0). - - Many other rectangles are empty; if left is equal to or greater than right, - or if top is equal to or greater than bottom. Setting all members to zero - is a convenience, but does not designate a special empty rectangle. - */ - void setEmpty() { *this = MakeEmpty(); } - - /** Sets SkRect to src, promoting src members from integer to scalar. - Very large values in src may lose precision. - - @param src integer SkRect - */ - void set(const SkIRect& src) { - fLeft = SkIntToScalar(src.fLeft); - fTop = SkIntToScalar(src.fTop); - fRight = SkIntToScalar(src.fRight); - fBottom = SkIntToScalar(src.fBottom); - } - - /** Sets SkRect to (left, top, right, bottom). - left and right are not sorted; left is not necessarily less than right. - top and bottom are not sorted; top is not necessarily less than bottom. - - @param left stored in fLeft - @param top stored in fTop - @param right stored in fRight - @param bottom stored in fBottom - */ - void setLTRB(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom) { - fLeft = left; - fTop = top; - fRight = right; - fBottom = bottom; - } - - /** Sets to bounds of SkPoint array with count entries. If count is zero or smaller, - or if SkPoint array contains an infinity or NaN, sets to (0, 0, 0, 0). - - Result is either empty or sorted: fLeft is less than or equal to fRight, and - fTop is less than or equal to fBottom. - - @param pts SkPoint array - @param count entries in array - */ - void setBounds(const SkPoint pts[], int count) { - (void)this->setBoundsCheck(pts, count); - } - - /** Sets to bounds of SkPoint array with count entries. Returns false if count is - zero or smaller, or if SkPoint array contains an infinity or NaN; in these cases - sets SkRect to (0, 0, 0, 0). - - Result is either empty or sorted: fLeft is less than or equal to fRight, and - fTop is less than or equal to fBottom. - - @param pts SkPoint array - @param count entries in array - @return true if all SkPoint values are finite - - example: https://fiddle.skia.org/c/@Rect_setBoundsCheck - */ - bool setBoundsCheck(const SkPoint pts[], int count); - - /** Sets to bounds of SkPoint pts array with count entries. If any SkPoint in pts - contains infinity or NaN, all SkRect dimensions are set to NaN. - - @param pts SkPoint array - @param count entries in array - - example: https://fiddle.skia.org/c/@Rect_setBoundsNoCheck - */ - void setBoundsNoCheck(const SkPoint pts[], int count); - - /** Sets bounds to the smallest SkRect enclosing SkPoint p0 and p1. The result is - sorted and may be empty. Does not check to see if values are finite. - - @param p0 corner to include - @param p1 corner to include - */ - void set(const SkPoint& p0, const SkPoint& p1) { - fLeft = std::min(p0.fX, p1.fX); - fRight = std::max(p0.fX, p1.fX); - fTop = std::min(p0.fY, p1.fY); - fBottom = std::max(p0.fY, p1.fY); - } - - /** Sets SkRect to (x, y, x + width, y + height). - Does not validate input; width or height may be negative. - - @param x stored in fLeft - @param y stored in fTop - @param width added to x and stored in fRight - @param height added to y and stored in fBottom - */ - void setXYWH(SkScalar x, SkScalar y, SkScalar width, SkScalar height) { - fLeft = x; - fTop = y; - fRight = x + width; - fBottom = y + height; - } - - /** Sets SkRect to (0, 0, width, height). Does not validate input; - width or height may be negative. - - @param width stored in fRight - @param height stored in fBottom - */ - void setWH(SkScalar width, SkScalar height) { - fLeft = 0; - fTop = 0; - fRight = width; - fBottom = height; - } - void setIWH(int32_t width, int32_t height) { - this->setWH(SkIntToScalar(width), SkIntToScalar(height)); - } - - /** Returns SkRect offset by (dx, dy). - - If dx is negative, SkRect returned is moved to the left. - If dx is positive, SkRect returned is moved to the right. - If dy is negative, SkRect returned is moved upward. - If dy is positive, SkRect returned is moved downward. - - @param dx added to fLeft and fRight - @param dy added to fTop and fBottom - @return SkRect offset on axes, with original width and height - */ - constexpr SkRect makeOffset(SkScalar dx, SkScalar dy) const { - return MakeLTRB(fLeft + dx, fTop + dy, fRight + dx, fBottom + dy); - } - - /** Returns SkRect offset by v. - - @param v added to rect - @return SkRect offset on axes, with original width and height - */ - constexpr SkRect makeOffset(SkVector v) const { return this->makeOffset(v.x(), v.y()); } - - /** Returns SkRect, inset by (dx, dy). - - If dx is negative, SkRect returned is wider. - If dx is positive, SkRect returned is narrower. - If dy is negative, SkRect returned is taller. - If dy is positive, SkRect returned is shorter. - - @param dx added to fLeft and subtracted from fRight - @param dy added to fTop and subtracted from fBottom - @return SkRect inset symmetrically left and right, top and bottom - */ - SkRect makeInset(SkScalar dx, SkScalar dy) const { - return MakeLTRB(fLeft + dx, fTop + dy, fRight - dx, fBottom - dy); - } - - /** Returns SkRect, outset by (dx, dy). - - If dx is negative, SkRect returned is narrower. - If dx is positive, SkRect returned is wider. - If dy is negative, SkRect returned is shorter. - If dy is positive, SkRect returned is taller. - - @param dx subtracted to fLeft and added from fRight - @param dy subtracted to fTop and added from fBottom - @return SkRect outset symmetrically left and right, top and bottom - */ - SkRect makeOutset(SkScalar dx, SkScalar dy) const { - return MakeLTRB(fLeft - dx, fTop - dy, fRight + dx, fBottom + dy); - } - - /** Offsets SkRect by adding dx to fLeft, fRight; and by adding dy to fTop, fBottom. - - If dx is negative, moves SkRect to the left. - If dx is positive, moves SkRect to the right. - If dy is negative, moves SkRect upward. - If dy is positive, moves SkRect downward. - - @param dx offset added to fLeft and fRight - @param dy offset added to fTop and fBottom - */ - void offset(SkScalar dx, SkScalar dy) { - fLeft += dx; - fTop += dy; - fRight += dx; - fBottom += dy; - } - - /** Offsets SkRect by adding delta.fX to fLeft, fRight; and by adding delta.fY to - fTop, fBottom. - - If delta.fX is negative, moves SkRect to the left. - If delta.fX is positive, moves SkRect to the right. - If delta.fY is negative, moves SkRect upward. - If delta.fY is positive, moves SkRect downward. - - @param delta added to SkRect - */ - void offset(const SkPoint& delta) { - this->offset(delta.fX, delta.fY); - } - - /** Offsets SkRect so that fLeft equals newX, and fTop equals newY. width and height - are unchanged. - - @param newX stored in fLeft, preserving width() - @param newY stored in fTop, preserving height() - */ - void offsetTo(SkScalar newX, SkScalar newY) { - fRight += newX - fLeft; - fBottom += newY - fTop; - fLeft = newX; - fTop = newY; - } - - /** Insets SkRect by (dx, dy). - - If dx is positive, makes SkRect narrower. - If dx is negative, makes SkRect wider. - If dy is positive, makes SkRect shorter. - If dy is negative, makes SkRect taller. - - @param dx added to fLeft and subtracted from fRight - @param dy added to fTop and subtracted from fBottom - */ - void inset(SkScalar dx, SkScalar dy) { - fLeft += dx; - fTop += dy; - fRight -= dx; - fBottom -= dy; - } - - /** Outsets SkRect by (dx, dy). - - If dx is positive, makes SkRect wider. - If dx is negative, makes SkRect narrower. - If dy is positive, makes SkRect taller. - If dy is negative, makes SkRect shorter. - - @param dx subtracted to fLeft and added from fRight - @param dy subtracted to fTop and added from fBottom - */ - void outset(SkScalar dx, SkScalar dy) { this->inset(-dx, -dy); } - - /** Returns true if SkRect intersects r, and sets SkRect to intersection. - Returns false if SkRect does not intersect r, and leaves SkRect unchanged. - - Returns false if either r or SkRect is empty, leaving SkRect unchanged. - - @param r limit of result - @return true if r and SkRect have area in common - - example: https://fiddle.skia.org/c/@Rect_intersect - */ - bool intersect(const SkRect& r); - - /** Returns true if a intersects b, and sets SkRect to intersection. - Returns false if a does not intersect b, and leaves SkRect unchanged. - - Returns false if either a or b is empty, leaving SkRect unchanged. - - @param a SkRect to intersect - @param b SkRect to intersect - @return true if a and b have area in common - */ - bool SK_WARN_UNUSED_RESULT intersect(const SkRect& a, const SkRect& b); - - -private: - static bool Intersects(SkScalar al, SkScalar at, SkScalar ar, SkScalar ab, - SkScalar bl, SkScalar bt, SkScalar br, SkScalar bb) { - SkScalar L = std::max(al, bl); - SkScalar R = std::min(ar, br); - SkScalar T = std::max(at, bt); - SkScalar B = std::min(ab, bb); - return L < R && T < B; - } - -public: - - /** Returns true if SkRect intersects r. - Returns false if either r or SkRect is empty, or do not intersect. - - @param r SkRect to intersect - @return true if r and SkRect have area in common - */ - bool intersects(const SkRect& r) const { - return Intersects(fLeft, fTop, fRight, fBottom, - r.fLeft, r.fTop, r.fRight, r.fBottom); - } - - /** Returns true if a intersects b. - Returns false if either a or b is empty, or do not intersect. - - @param a SkRect to intersect - @param b SkRect to intersect - @return true if a and b have area in common - */ - static bool Intersects(const SkRect& a, const SkRect& b) { - return Intersects(a.fLeft, a.fTop, a.fRight, a.fBottom, - b.fLeft, b.fTop, b.fRight, b.fBottom); - } - - /** Sets SkRect to the union of itself and r. - - Has no effect if r is empty. Otherwise, if SkRect is empty, sets - SkRect to r. - - @param r expansion SkRect - - example: https://fiddle.skia.org/c/@Rect_join_2 - */ - void join(const SkRect& r); - - /** Sets SkRect to the union of itself and r. - - Asserts if r is empty and SK_DEBUG is defined. - If SkRect is empty, sets SkRect to r. - - May produce incorrect results if r is empty. - - @param r expansion SkRect - */ - void joinNonEmptyArg(const SkRect& r) { - SkASSERT(!r.isEmpty()); - // if we are empty, just assign - if (fLeft >= fRight || fTop >= fBottom) { - *this = r; - } else { - this->joinPossiblyEmptyRect(r); - } - } - - /** Sets SkRect to the union of itself and the construction. - - May produce incorrect results if SkRect or r is empty. - - @param r expansion SkRect - */ - void joinPossiblyEmptyRect(const SkRect& r) { - fLeft = std::min(fLeft, r.left()); - fTop = std::min(fTop, r.top()); - fRight = std::max(fRight, r.right()); - fBottom = std::max(fBottom, r.bottom()); - } - - /** Returns true if: fLeft <= x < fRight && fTop <= y < fBottom. - Returns false if SkRect is empty. - - @param x test SkPoint x-coordinate - @param y test SkPoint y-coordinate - @return true if (x, y) is inside SkRect - */ - bool contains(SkScalar x, SkScalar y) const { - return x >= fLeft && x < fRight && y >= fTop && y < fBottom; - } - - /** Returns true if SkRect contains r. - Returns false if SkRect is empty or r is empty. - - SkRect contains r when SkRect area completely includes r area. - - @param r SkRect contained - @return true if all sides of SkRect are outside r - */ - bool contains(const SkRect& r) const { - // todo: can we eliminate the this->isEmpty check? - return !r.isEmpty() && !this->isEmpty() && - fLeft <= r.fLeft && fTop <= r.fTop && - fRight >= r.fRight && fBottom >= r.fBottom; - } - - /** Returns true if SkRect contains r. - Returns false if SkRect is empty or r is empty. - - SkRect contains r when SkRect area completely includes r area. - - @param r SkIRect contained - @return true if all sides of SkRect are outside r - */ - bool contains(const SkIRect& r) const { - // todo: can we eliminate the this->isEmpty check? - return !r.isEmpty() && !this->isEmpty() && - fLeft <= SkIntToScalar(r.fLeft) && fTop <= SkIntToScalar(r.fTop) && - fRight >= SkIntToScalar(r.fRight) && fBottom >= SkIntToScalar(r.fBottom); - } - - /** Sets SkIRect by adding 0.5 and discarding the fractional portion of SkRect - members, using (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), - SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)). - - @param dst storage for SkIRect - */ - void round(SkIRect* dst) const { - SkASSERT(dst); - dst->setLTRB(SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), - SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)); - } - - /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding - up fRight and fBottom, using - (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), - SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)). - - @param dst storage for SkIRect - */ - void roundOut(SkIRect* dst) const { - SkASSERT(dst); - dst->setLTRB(SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), - SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)); - } - - /** Sets SkRect by discarding the fractional portion of fLeft and fTop; and rounding - up fRight and fBottom, using - (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), - SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)). - - @param dst storage for SkRect - */ - void roundOut(SkRect* dst) const { - dst->setLTRB(SkScalarFloorToScalar(fLeft), SkScalarFloorToScalar(fTop), - SkScalarCeilToScalar(fRight), SkScalarCeilToScalar(fBottom)); - } - - /** Sets SkRect by rounding up fLeft and fTop; and discarding the fractional portion - of fRight and fBottom, using - (SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop), - SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)). - - @param dst storage for SkIRect - */ - void roundIn(SkIRect* dst) const { - SkASSERT(dst); - dst->setLTRB(SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop), - SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)); - } - - /** Returns SkIRect by adding 0.5 and discarding the fractional portion of SkRect - members, using (SkScalarRoundToInt(fLeft), SkScalarRoundToInt(fTop), - SkScalarRoundToInt(fRight), SkScalarRoundToInt(fBottom)). - - @return rounded SkIRect - */ - SkIRect round() const { - SkIRect ir; - this->round(&ir); - return ir; - } - - /** Sets SkIRect by discarding the fractional portion of fLeft and fTop; and rounding - up fRight and fBottom, using - (SkScalarFloorToInt(fLeft), SkScalarFloorToInt(fTop), - SkScalarCeilToInt(fRight), SkScalarCeilToInt(fBottom)). - - @return rounded SkIRect - */ - SkIRect roundOut() const { - SkIRect ir; - this->roundOut(&ir); - return ir; - } - /** Sets SkIRect by rounding up fLeft and fTop; and discarding the fractional portion - of fRight and fBottom, using - (SkScalarCeilToInt(fLeft), SkScalarCeilToInt(fTop), - SkScalarFloorToInt(fRight), SkScalarFloorToInt(fBottom)). - - @return rounded SkIRect - */ - SkIRect roundIn() const { - SkIRect ir; - this->roundIn(&ir); - return ir; - } - - /** Swaps fLeft and fRight if fLeft is greater than fRight; and swaps - fTop and fBottom if fTop is greater than fBottom. Result may be empty; - and width() and height() will be zero or positive. - */ - void sort() { - using std::swap; - if (fLeft > fRight) { - swap(fLeft, fRight); - } - - if (fTop > fBottom) { - swap(fTop, fBottom); - } - } - - /** Returns SkRect with fLeft and fRight swapped if fLeft is greater than fRight; and - with fTop and fBottom swapped if fTop is greater than fBottom. Result may be empty; - and width() and height() will be zero or positive. - - @return sorted SkRect - */ - SkRect makeSorted() const { - return MakeLTRB(std::min(fLeft, fRight), std::min(fTop, fBottom), - std::max(fLeft, fRight), std::max(fTop, fBottom)); - } - - /** Returns pointer to first scalar in SkRect, to treat it as an array with four - entries. - - @return pointer to fLeft - */ - const SkScalar* asScalars() const { return &fLeft; } - - /** Writes text representation of SkRect to standard output. Set asHex to true to - generate exact binary representations of floating point numbers. - - @param asHex true if SkScalar values are written as hexadecimal - - example: https://fiddle.skia.org/c/@Rect_dump - */ - void dump(bool asHex) const; - - /** Writes text representation of SkRect to standard output. The representation may be - directly compiled as C++ code. Floating point values are written - with limited precision; it may not be possible to reconstruct original SkRect - from output. - */ - void dump() const { this->dump(false); } - - /** Writes text representation of SkRect to standard output. The representation may be - directly compiled as C++ code. Floating point values are written - in hexadecimal to preserve their exact bit pattern. The output reconstructs the - original SkRect. - - Use instead of dump() when submitting - */ - void dumpHex() const { this->dump(true); } -}; - -inline bool SkIRect::contains(const SkRect& r) const { - return !r.isEmpty() && !this->isEmpty() && // check for empties - (SkScalar)fLeft <= r.fLeft && (SkScalar)fTop <= r.fTop && - (SkScalar)fRight >= r.fRight && (SkScalar)fBottom >= r.fBottom; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRefCnt.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRefCnt.h deleted file mode 100644 index fc687b38401717..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRefCnt.h +++ /dev/null @@ -1,394 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRefCnt_DEFINED -#define SkRefCnt_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkTemplates.h" - -#include // std::atomic, std::memory_order_* -#include // std::nullptr_t -#include // std::basic_ostream -#include // TODO: unused -#include // std::enable_if, std::is_convertible -#include // std::forward, std::swap - -/** \class SkRefCntBase - - SkRefCntBase is the base class for objects that may be shared by multiple - objects. When an existing owner wants to share a reference, it calls ref(). - When an owner wants to release its reference, it calls unref(). When the - shared object's reference count goes to zero as the result of an unref() - call, its (virtual) destructor is called. It is an error for the - destructor to be called explicitly (or via the object going out of scope on - the stack or calling delete) if getRefCnt() > 1. -*/ -class SK_API SkRefCntBase { -public: - /** Default construct, initializing the reference count to 1. - */ - SkRefCntBase() : fRefCnt(1) {} - - /** Destruct, asserting that the reference count is 1. - */ - virtual ~SkRefCntBase() { - #ifdef SK_DEBUG - SkASSERTF(this->getRefCnt() == 1, "fRefCnt was %d", this->getRefCnt()); - // illegal value, to catch us if we reuse after delete - fRefCnt.store(0, std::memory_order_relaxed); - #endif - } - - /** May return true if the caller is the only owner. - * Ensures that all previous owner's actions are complete. - */ - bool unique() const { - if (1 == fRefCnt.load(std::memory_order_acquire)) { - // The acquire barrier is only really needed if we return true. It - // prevents code conditioned on the result of unique() from running - // until previous owners are all totally done calling unref(). - return true; - } - return false; - } - - /** Increment the reference count. Must be balanced by a call to unref(). - */ - void ref() const { - SkASSERT(this->getRefCnt() > 0); - // No barrier required. - (void)fRefCnt.fetch_add(+1, std::memory_order_relaxed); - } - - /** Decrement the reference count. If the reference count is 1 before the - decrement, then delete the object. Note that if this is the case, then - the object needs to have been allocated via new, and not on the stack. - */ - void unref() const { - SkASSERT(this->getRefCnt() > 0); - // A release here acts in place of all releases we "should" have been doing in ref(). - if (1 == fRefCnt.fetch_add(-1, std::memory_order_acq_rel)) { - // Like unique(), the acquire is only needed on success, to make sure - // code in internal_dispose() doesn't happen before the decrement. - this->internal_dispose(); - } - } - -private: - -#ifdef SK_DEBUG - /** Return the reference count. Use only for debugging. */ - int32_t getRefCnt() const { - return fRefCnt.load(std::memory_order_relaxed); - } -#endif - - /** - * Called when the ref count goes to 0. - */ - virtual void internal_dispose() const { - #ifdef SK_DEBUG - SkASSERT(0 == this->getRefCnt()); - fRefCnt.store(1, std::memory_order_relaxed); - #endif - delete this; - } - - // The following friends are those which override internal_dispose() - // and conditionally call SkRefCnt::internal_dispose(). - friend class SkWeakRefCnt; - - mutable std::atomic fRefCnt; - - SkRefCntBase(SkRefCntBase&&) = delete; - SkRefCntBase(const SkRefCntBase&) = delete; - SkRefCntBase& operator=(SkRefCntBase&&) = delete; - SkRefCntBase& operator=(const SkRefCntBase&) = delete; -}; - -#ifdef SK_REF_CNT_MIXIN_INCLUDE -// It is the responsibility of the following include to define the type SkRefCnt. -// This SkRefCnt should normally derive from SkRefCntBase. -#include SK_REF_CNT_MIXIN_INCLUDE -#else -class SK_API SkRefCnt : public SkRefCntBase { - // "#include SK_REF_CNT_MIXIN_INCLUDE" doesn't work with this build system. - #if defined(SK_BUILD_FOR_GOOGLE3) - public: - void deref() const { this->unref(); } - #endif -}; -#endif - -/////////////////////////////////////////////////////////////////////////////// - -/** Call obj->ref() and return obj. The obj must not be nullptr. - */ -template static inline T* SkRef(T* obj) { - SkASSERT(obj); - obj->ref(); - return obj; -} - -/** Check if the argument is non-null, and if so, call obj->ref() and return obj. - */ -template static inline T* SkSafeRef(T* obj) { - if (obj) { - obj->ref(); - } - return obj; -} - -/** Check if the argument is non-null, and if so, call obj->unref() - */ -template static inline void SkSafeUnref(T* obj) { - if (obj) { - obj->unref(); - } -} - -/////////////////////////////////////////////////////////////////////////////// - -// This is a variant of SkRefCnt that's Not Virtual, so weighs 4 bytes instead of 8 or 16. -// There's only benefit to using this if the deriving class does not otherwise need a vtable. -template -class SkNVRefCnt { -public: - SkNVRefCnt() : fRefCnt(1) {} - ~SkNVRefCnt() { - #ifdef SK_DEBUG - int rc = fRefCnt.load(std::memory_order_relaxed); - SkASSERTF(rc == 1, "NVRefCnt was %d", rc); - #endif - } - - // Implementation is pretty much the same as SkRefCntBase. All required barriers are the same: - // - unique() needs acquire when it returns true, and no barrier if it returns false; - // - ref() doesn't need any barrier; - // - unref() needs a release barrier, and an acquire if it's going to call delete. - - bool unique() const { return 1 == fRefCnt.load(std::memory_order_acquire); } - void ref() const { (void)fRefCnt.fetch_add(+1, std::memory_order_relaxed); } - void unref() const { - if (1 == fRefCnt.fetch_add(-1, std::memory_order_acq_rel)) { - // restore the 1 for our destructor's assert - SkDEBUGCODE(fRefCnt.store(1, std::memory_order_relaxed)); - delete (const Derived*)this; - } - } - void deref() const { this->unref(); } - - // This must be used with caution. It is only valid to call this when 'threadIsolatedTestCnt' - // refs are known to be isolated to the current thread. That is, it is known that there are at - // least 'threadIsolatedTestCnt' refs for which no other thread may make a balancing unref() - // call. Assuming the contract is followed, if this returns false then no other thread has - // ownership of this. If it returns true then another thread *may* have ownership. - bool refCntGreaterThan(int32_t threadIsolatedTestCnt) const { - int cnt = fRefCnt.load(std::memory_order_acquire); - // If this fails then the above contract has been violated. - SkASSERT(cnt >= threadIsolatedTestCnt); - return cnt > threadIsolatedTestCnt; - } - -private: - mutable std::atomic fRefCnt; - - SkNVRefCnt(SkNVRefCnt&&) = delete; - SkNVRefCnt(const SkNVRefCnt&) = delete; - SkNVRefCnt& operator=(SkNVRefCnt&&) = delete; - SkNVRefCnt& operator=(const SkNVRefCnt&) = delete; -}; - -/////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * Shared pointer class to wrap classes that support a ref()/unref() interface. - * - * This can be used for classes inheriting from SkRefCnt, but it also works for other - * classes that match the interface, but have different internal choices: e.g. the hosted class - * may have its ref/unref be thread-safe, but that is not assumed/imposed by sk_sp. - * - * Declared with the trivial_abi attribute where supported so that sk_sp and types containing it - * may be considered as trivially relocatable by the compiler so that destroying-move operations - * i.e. move constructor followed by destructor can be optimized to memcpy. - */ -#if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::trivial_abi) -#define SK_SP_TRIVIAL_ABI [[clang::trivial_abi]] -#else -#define SK_SP_TRIVIAL_ABI -#endif -template class SK_SP_TRIVIAL_ABI sk_sp { -public: - using element_type = T; - - constexpr sk_sp() : fPtr(nullptr) {} - constexpr sk_sp(std::nullptr_t) : fPtr(nullptr) {} - - /** - * Shares the underlying object by calling ref(), so that both the argument and the newly - * created sk_sp both have a reference to it. - */ - sk_sp(const sk_sp& that) : fPtr(SkSafeRef(that.get())) {} - template ::value>::type> - sk_sp(const sk_sp& that) : fPtr(SkSafeRef(that.get())) {} - - /** - * Move the underlying object from the argument to the newly created sk_sp. Afterwards only - * the new sk_sp will have a reference to the object, and the argument will point to null. - * No call to ref() or unref() will be made. - */ - sk_sp(sk_sp&& that) : fPtr(that.release()) {} - template ::value>::type> - sk_sp(sk_sp&& that) : fPtr(that.release()) {} - - /** - * Adopt the bare pointer into the newly created sk_sp. - * No call to ref() or unref() will be made. - */ - explicit sk_sp(T* obj) : fPtr(obj) {} - - /** - * Calls unref() on the underlying object pointer. - */ - ~sk_sp() { - SkSafeUnref(fPtr); - SkDEBUGCODE(fPtr = nullptr); - } - - sk_sp& operator=(std::nullptr_t) { this->reset(); return *this; } - - /** - * Shares the underlying object referenced by the argument by calling ref() on it. If this - * sk_sp previously had a reference to an object (i.e. not null) it will call unref() on that - * object. - */ - sk_sp& operator=(const sk_sp& that) { - if (this != &that) { - this->reset(SkSafeRef(that.get())); - } - return *this; - } - template ::value>::type> - sk_sp& operator=(const sk_sp& that) { - this->reset(SkSafeRef(that.get())); - return *this; - } - - /** - * Move the underlying object from the argument to the sk_sp. If the sk_sp previously held - * a reference to another object, unref() will be called on that object. No call to ref() - * will be made. - */ - sk_sp& operator=(sk_sp&& that) { - this->reset(that.release()); - return *this; - } - template ::value>::type> - sk_sp& operator=(sk_sp&& that) { - this->reset(that.release()); - return *this; - } - - T& operator*() const { - SkASSERT(this->get() != nullptr); - return *this->get(); - } - - explicit operator bool() const { return this->get() != nullptr; } - - T* get() const { return fPtr; } - T* operator->() const { return fPtr; } - - /** - * Adopt the new bare pointer, and call unref() on any previously held object (if not null). - * No call to ref() will be made. - */ - void reset(T* ptr = nullptr) { - // Calling fPtr->unref() may call this->~() or this->reset(T*). - // http://wg21.cmeerw.net/lwg/issue998 - // http://wg21.cmeerw.net/lwg/issue2262 - T* oldPtr = fPtr; - fPtr = ptr; - SkSafeUnref(oldPtr); - } - - /** - * Return the bare pointer, and set the internal object pointer to nullptr. - * The caller must assume ownership of the object, and manage its reference count directly. - * No call to unref() will be made. - */ - T* SK_WARN_UNUSED_RESULT release() { - T* ptr = fPtr; - fPtr = nullptr; - return ptr; - } - - void swap(sk_sp& that) /*noexcept*/ { - using std::swap; - swap(fPtr, that.fPtr); - } - - using sk_is_trivially_relocatable = std::true_type; - -private: - T* fPtr; -}; - -template inline void swap(sk_sp& a, sk_sp& b) /*noexcept*/ { - a.swap(b); -} - -template inline bool operator==(const sk_sp& a, const sk_sp& b) { - return a.get() == b.get(); -} -template inline bool operator==(const sk_sp& a, std::nullptr_t) /*noexcept*/ { - return !a; -} -template inline bool operator==(std::nullptr_t, const sk_sp& b) /*noexcept*/ { - return !b; -} - -template inline bool operator!=(const sk_sp& a, const sk_sp& b) { - return a.get() != b.get(); -} -template inline bool operator!=(const sk_sp& a, std::nullptr_t) /*noexcept*/ { - return static_cast(a); -} -template inline bool operator!=(std::nullptr_t, const sk_sp& b) /*noexcept*/ { - return static_cast(b); -} - -template -auto operator<<(std::basic_ostream& os, const sk_sp& sp) -> decltype(os << sp.get()) { - return os << sp.get(); -} - -template -sk_sp sk_make_sp(Args&&... args) { - return sk_sp(new T(std::forward(args)...)); -} - -/* - * Returns a sk_sp wrapping the provided ptr AND calls ref on it (if not null). - * - * This is different than the semantics of the constructor for sk_sp, which just wraps the ptr, - * effectively "adopting" it. - */ -template sk_sp sk_ref_sp(T* obj) { - return sk_sp(SkSafeRef(obj)); -} - -template sk_sp sk_ref_sp(const T* obj) { - return sk_sp(const_cast(SkSafeRef(obj))); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRegion.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRegion.h deleted file mode 100644 index 463a39ff36d541..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkRegion.h +++ /dev/null @@ -1,678 +0,0 @@ -/* - * Copyright 2005 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRegion_DEFINED -#define SkRegion_DEFINED - -#include "include/core/SkRect.h" -#include "include/private/SkTemplates.h" - -class SkPath; -class SkRgnBuilder; - -/** \class SkRegion - SkRegion describes the set of pixels used to clip SkCanvas. SkRegion is compact, - efficiently storing a single integer rectangle, or a run length encoded array - of rectangles. SkRegion may reduce the current SkCanvas clip, or may be drawn as - one or more integer rectangles. SkRegion iterator returns the scan lines or - rectangles contained by it, optionally intersecting a bounding rectangle. -*/ -class SK_API SkRegion { - typedef int32_t RunType; -public: - - /** Constructs an empty SkRegion. SkRegion is set to empty bounds - at (0, 0) with zero width and height. - - @return empty SkRegion - - example: https://fiddle.skia.org/c/@Region_empty_constructor - */ - SkRegion(); - - /** Constructs a copy of an existing region. - Copy constructor makes two regions identical by value. Internally, region and - the returned result share pointer values. The underlying SkRect array is - copied when modified. - - Creating a SkRegion copy is very efficient and never allocates memory. - SkRegion are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param region SkRegion to copy by value - @return copy of SkRegion - - example: https://fiddle.skia.org/c/@Region_copy_const_SkRegion - */ - SkRegion(const SkRegion& region); - - /** Constructs a rectangular SkRegion matching the bounds of rect. - - @param rect bounds of constructed SkRegion - @return rectangular SkRegion - - example: https://fiddle.skia.org/c/@Region_copy_const_SkIRect - */ - explicit SkRegion(const SkIRect& rect); - - /** Releases ownership of any shared data and deletes data if SkRegion is sole owner. - - example: https://fiddle.skia.org/c/@Region_destructor - */ - ~SkRegion(); - - /** Constructs a copy of an existing region. - Makes two regions identical by value. Internally, region and - the returned result share pointer values. The underlying SkRect array is - copied when modified. - - Creating a SkRegion copy is very efficient and never allocates memory. - SkRegion are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param region SkRegion to copy by value - @return SkRegion to copy by value - - example: https://fiddle.skia.org/c/@Region_copy_operator - */ - SkRegion& operator=(const SkRegion& region); - - /** Compares SkRegion and other; returns true if they enclose exactly - the same area. - - @param other SkRegion to compare - @return true if SkRegion pair are equivalent - - example: https://fiddle.skia.org/c/@Region_equal1_operator - */ - bool operator==(const SkRegion& other) const; - - /** Compares SkRegion and other; returns true if they do not enclose the same area. - - @param other SkRegion to compare - @return true if SkRegion pair are not equivalent - */ - bool operator!=(const SkRegion& other) const { - return !(*this == other); - } - - /** Sets SkRegion to src, and returns true if src bounds is not empty. - This makes SkRegion and src identical by value. Internally, - SkRegion and src share pointer values. The underlying SkRect array is - copied when modified. - - Creating a SkRegion copy is very efficient and never allocates memory. - SkRegion are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param src SkRegion to copy - @return copy of src - */ - bool set(const SkRegion& src) { - *this = src; - return !this->isEmpty(); - } - - /** Exchanges SkIRect array of SkRegion and other. swap() internally exchanges pointers, - so it is lightweight and does not allocate memory. - - swap() usage has largely been replaced by operator=(const SkRegion& region). - SkPath do not copy their content on assignment until they are written to, - making assignment as efficient as swap(). - - @param other operator=(const SkRegion& region) set - - example: https://fiddle.skia.org/c/@Region_swap - */ - void swap(SkRegion& other); - - /** Returns true if SkRegion is empty. - Empty SkRegion has bounds width or height less than or equal to zero. - SkRegion() constructs empty SkRegion; setEmpty() - and setRect() with dimensionless data make SkRegion empty. - - @return true if bounds has no width or height - */ - bool isEmpty() const { return fRunHead == emptyRunHeadPtr(); } - - /** Returns true if SkRegion is one SkIRect with positive dimensions. - - @return true if SkRegion contains one SkIRect - */ - bool isRect() const { return fRunHead == kRectRunHeadPtr; } - - /** Returns true if SkRegion is described by more than one rectangle. - - @return true if SkRegion contains more than one SkIRect - */ - bool isComplex() const { return !this->isEmpty() && !this->isRect(); } - - /** Returns minimum and maximum axes values of SkIRect array. - Returns (0, 0, 0, 0) if SkRegion is empty. - - @return combined bounds of all SkIRect elements - */ - const SkIRect& getBounds() const { return fBounds; } - - /** Returns a value that increases with the number of - elements in SkRegion. Returns zero if SkRegion is empty. - Returns one if SkRegion equals SkIRect; otherwise, returns - value greater than one indicating that SkRegion is complex. - - Call to compare SkRegion for relative complexity. - - @return relative complexity - - example: https://fiddle.skia.org/c/@Region_computeRegionComplexity - */ - int computeRegionComplexity() const; - - /** Appends outline of SkRegion to path. - Returns true if SkRegion is not empty; otherwise, returns false, and leaves path - unmodified. - - @param path SkPath to append to - @return true if path changed - - example: https://fiddle.skia.org/c/@Region_getBoundaryPath - */ - bool getBoundaryPath(SkPath* path) const; - - /** Constructs an empty SkRegion. SkRegion is set to empty bounds - at (0, 0) with zero width and height. Always returns false. - - @return false - - example: https://fiddle.skia.org/c/@Region_setEmpty - */ - bool setEmpty(); - - /** Constructs a rectangular SkRegion matching the bounds of rect. - If rect is empty, constructs empty and returns false. - - @param rect bounds of constructed SkRegion - @return true if rect is not empty - - example: https://fiddle.skia.org/c/@Region_setRect - */ - bool setRect(const SkIRect& rect); - - /** Constructs SkRegion as the union of SkIRect in rects array. If count is - zero, constructs empty SkRegion. Returns false if constructed SkRegion is empty. - - May be faster than repeated calls to op(). - - @param rects array of SkIRect - @param count array size - @return true if constructed SkRegion is not empty - - example: https://fiddle.skia.org/c/@Region_setRects - */ - bool setRects(const SkIRect rects[], int count); - - /** Constructs a copy of an existing region. - Makes two regions identical by value. Internally, region and - the returned result share pointer values. The underlying SkRect array is - copied when modified. - - Creating a SkRegion copy is very efficient and never allocates memory. - SkRegion are always copied by value from the interface; the underlying shared - pointers are not exposed. - - @param region SkRegion to copy by value - @return SkRegion to copy by value - - example: https://fiddle.skia.org/c/@Region_setRegion - */ - bool setRegion(const SkRegion& region); - - /** Constructs SkRegion to match outline of path within clip. - Returns false if constructed SkRegion is empty. - - Constructed SkRegion draws the same pixels as path through clip when - anti-aliasing is disabled. - - @param path SkPath providing outline - @param clip SkRegion containing path - @return true if constructed SkRegion is not empty - - example: https://fiddle.skia.org/c/@Region_setPath - */ - bool setPath(const SkPath& path, const SkRegion& clip); - - /** Returns true if SkRegion intersects rect. - Returns false if either rect or SkRegion is empty, or do not intersect. - - @param rect SkIRect to intersect - @return true if rect and SkRegion have area in common - - example: https://fiddle.skia.org/c/@Region_intersects - */ - bool intersects(const SkIRect& rect) const; - - /** Returns true if SkRegion intersects other. - Returns false if either other or SkRegion is empty, or do not intersect. - - @param other SkRegion to intersect - @return true if other and SkRegion have area in common - - example: https://fiddle.skia.org/c/@Region_intersects_2 - */ - bool intersects(const SkRegion& other) const; - - /** Returns true if SkIPoint (x, y) is inside SkRegion. - Returns false if SkRegion is empty. - - @param x test SkIPoint x-coordinate - @param y test SkIPoint y-coordinate - @return true if (x, y) is inside SkRegion - - example: https://fiddle.skia.org/c/@Region_contains - */ - bool contains(int32_t x, int32_t y) const; - - /** Returns true if other is completely inside SkRegion. - Returns false if SkRegion or other is empty. - - @param other SkIRect to contain - @return true if other is inside SkRegion - - example: https://fiddle.skia.org/c/@Region_contains_2 - */ - bool contains(const SkIRect& other) const; - - /** Returns true if other is completely inside SkRegion. - Returns false if SkRegion or other is empty. - - @param other SkRegion to contain - @return true if other is inside SkRegion - - example: https://fiddle.skia.org/c/@Region_contains_3 - */ - bool contains(const SkRegion& other) const; - - /** Returns true if SkRegion is a single rectangle and contains r. - May return false even though SkRegion contains r. - - @param r SkIRect to contain - @return true quickly if r points are equal or inside - */ - bool quickContains(const SkIRect& r) const { - SkASSERT(this->isEmpty() == fBounds.isEmpty()); // valid region - - return r.fLeft < r.fRight && r.fTop < r.fBottom && - fRunHead == kRectRunHeadPtr && // this->isRect() - /* fBounds.contains(left, top, right, bottom); */ - fBounds.fLeft <= r.fLeft && fBounds.fTop <= r.fTop && - fBounds.fRight >= r.fRight && fBounds.fBottom >= r.fBottom; - } - - /** Returns true if SkRegion does not intersect rect. - Returns true if rect is empty or SkRegion is empty. - May return false even though SkRegion does not intersect rect. - - @param rect SkIRect to intersect - @return true if rect does not intersect - */ - bool quickReject(const SkIRect& rect) const { - return this->isEmpty() || rect.isEmpty() || - !SkIRect::Intersects(fBounds, rect); - } - - /** Returns true if SkRegion does not intersect rgn. - Returns true if rgn is empty or SkRegion is empty. - May return false even though SkRegion does not intersect rgn. - - @param rgn SkRegion to intersect - @return true if rgn does not intersect - */ - bool quickReject(const SkRegion& rgn) const { - return this->isEmpty() || rgn.isEmpty() || - !SkIRect::Intersects(fBounds, rgn.fBounds); - } - - /** Offsets SkRegion by ivector (dx, dy). Has no effect if SkRegion is empty. - - @param dx x-axis offset - @param dy y-axis offset - */ - void translate(int dx, int dy) { this->translate(dx, dy, this); } - - /** Offsets SkRegion by ivector (dx, dy), writing result to dst. SkRegion may be passed - as dst parameter, translating SkRegion in place. Has no effect if dst is nullptr. - If SkRegion is empty, sets dst to empty. - - @param dx x-axis offset - @param dy y-axis offset - @param dst translated result - - example: https://fiddle.skia.org/c/@Region_translate_2 - */ - void translate(int dx, int dy, SkRegion* dst) const; - - /** \enum SkRegion::Op - The logical operations that can be performed when combining two SkRegion. - */ - enum Op { - kDifference_Op, //!< target minus operand - kIntersect_Op, //!< target intersected with operand - kUnion_Op, //!< target unioned with operand - kXOR_Op, //!< target exclusive or with operand - kReverseDifference_Op, //!< operand minus target - kReplace_Op, //!< replace target with operand - kLastOp = kReplace_Op, //!< last operator - }; - - static const int kOpCnt = kLastOp + 1; - - /** Replaces SkRegion with the result of SkRegion op rect. - Returns true if replaced SkRegion is not empty. - - @param rect SkIRect operand - @return false if result is empty - */ - bool op(const SkIRect& rect, Op op) { - if (this->isRect() && kIntersect_Op == op) { - if (!fBounds.intersect(rect)) { - return this->setEmpty(); - } - return true; - } - return this->op(*this, rect, op); - } - - /** Replaces SkRegion with the result of SkRegion op rgn. - Returns true if replaced SkRegion is not empty. - - @param rgn SkRegion operand - @return false if result is empty - */ - bool op(const SkRegion& rgn, Op op) { return this->op(*this, rgn, op); } - - /** Replaces SkRegion with the result of rect op rgn. - Returns true if replaced SkRegion is not empty. - - @param rect SkIRect operand - @param rgn SkRegion operand - @return false if result is empty - - example: https://fiddle.skia.org/c/@Region_op_4 - */ - bool op(const SkIRect& rect, const SkRegion& rgn, Op op); - - /** Replaces SkRegion with the result of rgn op rect. - Returns true if replaced SkRegion is not empty. - - @param rgn SkRegion operand - @param rect SkIRect operand - @return false if result is empty - - example: https://fiddle.skia.org/c/@Region_op_5 - */ - bool op(const SkRegion& rgn, const SkIRect& rect, Op op); - - /** Replaces SkRegion with the result of rgna op rgnb. - Returns true if replaced SkRegion is not empty. - - @param rgna SkRegion operand - @param rgnb SkRegion operand - @return false if result is empty - - example: https://fiddle.skia.org/c/@Region_op_6 - */ - bool op(const SkRegion& rgna, const SkRegion& rgnb, Op op); - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - /** Private. Android framework only. - - @return string representation of SkRegion - */ - char* toString(); -#endif - - /** \class SkRegion::Iterator - Returns sequence of rectangles, sorted along y-axis, then x-axis, that make - up SkRegion. - */ - class SK_API Iterator { - public: - - /** Initializes SkRegion::Iterator with an empty SkRegion. done() on SkRegion::Iterator - returns true. - Call reset() to initialized SkRegion::Iterator at a later time. - - @return empty SkRegion iterator - */ - Iterator() : fRgn(nullptr), fDone(true) {} - - /** Sets SkRegion::Iterator to return elements of SkIRect array in region. - - @param region SkRegion to iterate - @return SkRegion iterator - - example: https://fiddle.skia.org/c/@Region_Iterator_copy_const_SkRegion - */ - Iterator(const SkRegion& region); - - /** SkPoint SkRegion::Iterator to start of SkRegion. - Returns true if SkRegion was set; otherwise, returns false. - - @return true if SkRegion was set - - example: https://fiddle.skia.org/c/@Region_Iterator_rewind - */ - bool rewind(); - - /** Resets iterator, using the new SkRegion. - - @param region SkRegion to iterate - - example: https://fiddle.skia.org/c/@Region_Iterator_reset - */ - void reset(const SkRegion& region); - - /** Returns true if SkRegion::Iterator is pointing to final SkIRect in SkRegion. - - @return true if data parsing is complete - */ - bool done() const { return fDone; } - - /** Advances SkRegion::Iterator to next SkIRect in SkRegion if it is not done. - - example: https://fiddle.skia.org/c/@Region_Iterator_next - */ - void next(); - - /** Returns SkIRect element in SkRegion. Does not return predictable results if SkRegion - is empty. - - @return part of SkRegion as SkIRect - */ - const SkIRect& rect() const { return fRect; } - - /** Returns SkRegion if set; otherwise, returns nullptr. - - @return iterated SkRegion - */ - const SkRegion* rgn() const { return fRgn; } - - private: - const SkRegion* fRgn; - const SkRegion::RunType* fRuns; - SkIRect fRect = {0, 0, 0, 0}; - bool fDone; - }; - - /** \class SkRegion::Cliperator - Returns the sequence of rectangles, sorted along y-axis, then x-axis, that make - up SkRegion intersected with the specified clip rectangle. - */ - class SK_API Cliperator { - public: - - /** Sets SkRegion::Cliperator to return elements of SkIRect array in SkRegion within clip. - - @param region SkRegion to iterate - @param clip bounds of iteration - @return SkRegion iterator - - example: https://fiddle.skia.org/c/@Region_Cliperator_const_SkRegion_const_SkIRect - */ - Cliperator(const SkRegion& region, const SkIRect& clip); - - /** Returns true if SkRegion::Cliperator is pointing to final SkIRect in SkRegion. - - @return true if data parsing is complete - */ - bool done() { return fDone; } - - /** Advances iterator to next SkIRect in SkRegion contained by clip. - - example: https://fiddle.skia.org/c/@Region_Cliperator_next - */ - void next(); - - /** Returns SkIRect element in SkRegion, intersected with clip passed to - SkRegion::Cliperator constructor. Does not return predictable results if SkRegion - is empty. - - @return part of SkRegion inside clip as SkIRect - */ - const SkIRect& rect() const { return fRect; } - - private: - Iterator fIter; - SkIRect fClip; - SkIRect fRect = {0, 0, 0, 0}; - bool fDone; - }; - - /** \class SkRegion::Spanerator - Returns the line segment ends within SkRegion that intersect a horizontal line. - */ - class Spanerator { - public: - - /** Sets SkRegion::Spanerator to return line segments in SkRegion on scan line. - - @param region SkRegion to iterate - @param y horizontal line to intersect - @param left bounds of iteration - @param right bounds of iteration - @return SkRegion iterator - - example: https://fiddle.skia.org/c/@Region_Spanerator_const_SkRegion_int_int_int - */ - Spanerator(const SkRegion& region, int y, int left, int right); - - /** Advances iterator to next span intersecting SkRegion within line segment provided - in constructor. Returns true if interval was found. - - @param left pointer to span start; may be nullptr - @param right pointer to span end; may be nullptr - @return true if interval was found - - example: https://fiddle.skia.org/c/@Region_Spanerator_next - */ - bool next(int* left, int* right); - - private: - const SkRegion::RunType* fRuns; - int fLeft, fRight; - bool fDone; - }; - - /** Writes SkRegion to buffer, and returns number of bytes written. - If buffer is nullptr, returns number number of bytes that would be written. - - @param buffer storage for binary data - @return size of SkRegion - - example: https://fiddle.skia.org/c/@Region_writeToMemory - */ - size_t writeToMemory(void* buffer) const; - - /** Constructs SkRegion from buffer of size length. Returns bytes read. - Returned value will be multiple of four or zero if length was too small. - - @param buffer storage for binary data - @param length size of buffer - @return bytes read - - example: https://fiddle.skia.org/c/@Region_readFromMemory - */ - size_t readFromMemory(const void* buffer, size_t length); - - using sk_is_trivially_relocatable = std::true_type; - -private: - static constexpr int kOpCount = kReplace_Op + 1; - - // T - // [B N L R S] - // S - static constexpr int kRectRegionRuns = 7; - - struct RunHead; - - static RunHead* emptyRunHeadPtr() { return (SkRegion::RunHead*) -1; } - static constexpr RunHead* kRectRunHeadPtr = nullptr; - - // allocate space for count runs - void allocateRuns(int count); - void allocateRuns(int count, int ySpanCount, int intervalCount); - void allocateRuns(const RunHead& src); - - SkDEBUGCODE(void dump() const;) - - SkIRect fBounds; - RunHead* fRunHead; - - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - - void freeRuns(); - - /** - * Return the runs from this region, consing up fake runs if the region - * is empty or a rect. In those 2 cases, we use tmpStorage to hold the - * run data. - */ - const RunType* getRuns(RunType tmpStorage[], int* intervals) const; - - // This is called with runs[] that do not yet have their interval-count - // field set on each scanline. That is computed as part of this call - // (inside ComputeRunBounds). - bool setRuns(RunType runs[], int count); - - int count_runtype_values(int* itop, int* ibot) const; - - bool isValid() const; - - static void BuildRectRuns(const SkIRect& bounds, - RunType runs[kRectRegionRuns]); - - // If the runs define a simple rect, return true and set bounds to that - // rect. If not, return false and ignore bounds. - static bool RunsAreARect(const SkRegion::RunType runs[], int count, - SkIRect* bounds); - - /** - * If the last arg is null, just return if the result is non-empty, - * else store the result in the last arg. - */ - static bool Oper(const SkRegion&, const SkRegion&, SkRegion::Op, SkRegion*); - - friend struct RunHead; - friend class Iterator; - friend class Spanerator; - friend class SkRegionPriv; - friend class SkRgnBuilder; - friend class SkFlatRegion; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSamplingOptions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSamplingOptions.h deleted file mode 100644 index 24b6d51659607d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSamplingOptions.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageSampling_DEFINED -#define SkImageSampling_DEFINED - -#include "include/core/SkTypes.h" - -#include -#include - -enum class SkFilterMode { - kNearest, // single sample point (nearest neighbor) - kLinear, // interporate between 2x2 sample points (bilinear interpolation) - - kLast = kLinear, -}; -static constexpr int kSkFilterModeCount = static_cast(SkFilterMode::kLast) + 1; - -enum class SkMipmapMode { - kNone, // ignore mipmap levels, sample from the "base" - kNearest, // sample from the nearest level - kLinear, // interpolate between the two nearest levels - - kLast = kLinear, -}; -static constexpr int kSkMipmapModeCount = static_cast(SkMipmapMode::kLast) + 1; - -/* - * Specify B and C (each between 0...1) to create a shader that applies the corresponding - * cubic reconstruction filter to the image. - * - * Example values: - * B = 1/3, C = 1/3 "Mitchell" filter - * B = 0, C = 1/2 "Catmull-Rom" filter - * - * See "Reconstruction Filters in Computer Graphics" - * Don P. Mitchell - * Arun N. Netravali - * 1988 - * https://www.cs.utexas.edu/~fussell/courses/cs384g-fall2013/lectures/mitchell/Mitchell.pdf - * - * Desmos worksheet https://www.desmos.com/calculator/aghdpicrvr - * Nice overview https://entropymine.com/imageworsener/bicubic/ - */ -struct SkCubicResampler { - float B, C; - - // Historic default for kHigh_SkFilterQuality - static constexpr SkCubicResampler Mitchell() { return {1/3.0f, 1/3.0f}; } - static constexpr SkCubicResampler CatmullRom() { return {0.0f, 1/2.0f}; } -}; - -struct SK_API SkSamplingOptions { - const int maxAniso = 0; - const bool useCubic = false; - const SkCubicResampler cubic = {0, 0}; - const SkFilterMode filter = SkFilterMode::kNearest; - const SkMipmapMode mipmap = SkMipmapMode::kNone; - - constexpr SkSamplingOptions() = default; - SkSamplingOptions(const SkSamplingOptions&) = default; - SkSamplingOptions& operator=(const SkSamplingOptions& that) { - this->~SkSamplingOptions(); // A pedantic no-op. - new (this) SkSamplingOptions(that); - return *this; - } - - constexpr SkSamplingOptions(SkFilterMode fm, SkMipmapMode mm) - : filter(fm) - , mipmap(mm) {} - - explicit constexpr SkSamplingOptions(SkFilterMode fm) - : filter(fm) - , mipmap(SkMipmapMode::kNone) {} - - explicit constexpr SkSamplingOptions(const SkCubicResampler& c) - : useCubic(true) - , cubic(c) {} - - static constexpr SkSamplingOptions Aniso(int maxAniso) { - return SkSamplingOptions{std::max(maxAniso, 1)}; - } - - bool operator==(const SkSamplingOptions& other) const { - return maxAniso == other.maxAniso - && useCubic == other.useCubic - && cubic.B == other.cubic.B - && cubic.C == other.cubic.C - && filter == other.filter - && mipmap == other.mipmap; - } - bool operator!=(const SkSamplingOptions& other) const { return !(*this == other); } - - bool isAniso() const { return maxAniso != 0; } - -private: - constexpr SkSamplingOptions(int maxAniso) : maxAniso(maxAniso) {} -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkScalar.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkScalar.h deleted file mode 100644 index 2a6bb3ec361ef7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkScalar.h +++ /dev/null @@ -1,175 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkScalar_DEFINED -#define SkScalar_DEFINED - -#include "include/private/SkFloatingPoint.h" - -#undef SK_SCALAR_IS_FLOAT -#define SK_SCALAR_IS_FLOAT 1 - -typedef float SkScalar; - -#define SK_Scalar1 1.0f -#define SK_ScalarHalf 0.5f -#define SK_ScalarSqrt2 SK_FloatSqrt2 -#define SK_ScalarPI SK_FloatPI -#define SK_ScalarTanPIOver8 0.414213562f -#define SK_ScalarRoot2Over2 0.707106781f -#define SK_ScalarMax 3.402823466e+38f -#define SK_ScalarMin (-SK_ScalarMax) -#define SK_ScalarInfinity SK_FloatInfinity -#define SK_ScalarNegativeInfinity SK_FloatNegativeInfinity -#define SK_ScalarNaN SK_FloatNaN - -#define SkScalarFloorToScalar(x) sk_float_floor(x) -#define SkScalarCeilToScalar(x) sk_float_ceil(x) -#define SkScalarRoundToScalar(x) sk_float_round(x) -#define SkScalarTruncToScalar(x) sk_float_trunc(x) - -#define SkScalarFloorToInt(x) sk_float_floor2int(x) -#define SkScalarCeilToInt(x) sk_float_ceil2int(x) -#define SkScalarRoundToInt(x) sk_float_round2int(x) - -#define SkScalarAbs(x) sk_float_abs(x) -#define SkScalarCopySign(x, y) sk_float_copysign(x, y) -#define SkScalarMod(x, y) sk_float_mod(x,y) -#define SkScalarSqrt(x) sk_float_sqrt(x) -#define SkScalarPow(b, e) sk_float_pow(b, e) - -#define SkScalarSin(radians) (float)sk_float_sin(radians) -#define SkScalarCos(radians) (float)sk_float_cos(radians) -#define SkScalarTan(radians) (float)sk_float_tan(radians) -#define SkScalarASin(val) (float)sk_float_asin(val) -#define SkScalarACos(val) (float)sk_float_acos(val) -#define SkScalarATan2(y, x) (float)sk_float_atan2(y,x) -#define SkScalarExp(x) (float)sk_float_exp(x) -#define SkScalarLog(x) (float)sk_float_log(x) -#define SkScalarLog2(x) (float)sk_float_log2(x) - -////////////////////////////////////////////////////////////////////////////////////////////////// - -#define SkIntToScalar(x) static_cast(x) -#define SkIntToFloat(x) static_cast(x) -#define SkScalarTruncToInt(x) sk_float_saturate2int(x) - -#define SkScalarToFloat(x) static_cast(x) -#define SkFloatToScalar(x) static_cast(x) -#define SkScalarToDouble(x) static_cast(x) -#define SkDoubleToScalar(x) sk_double_to_float(x) - -static inline bool SkScalarIsNaN(SkScalar x) { return x != x; } - -/** Returns true if x is not NaN and not infinite - */ -static inline bool SkScalarIsFinite(SkScalar x) { return sk_float_isfinite(x); } - -static inline bool SkScalarsAreFinite(SkScalar a, SkScalar b) { - return sk_floats_are_finite(a, b); -} - -static inline bool SkScalarsAreFinite(const SkScalar array[], int count) { - return sk_floats_are_finite(array, count); -} - -/** Returns the fractional part of the scalar. */ -static inline SkScalar SkScalarFraction(SkScalar x) { - return x - SkScalarTruncToScalar(x); -} - -static inline SkScalar SkScalarSquare(SkScalar x) { return x * x; } - -#define SkScalarInvert(x) sk_ieee_float_divide_TODO_IS_DIVIDE_BY_ZERO_SAFE_HERE(SK_Scalar1, (x)) -#define SkScalarAve(a, b) (((a) + (b)) * SK_ScalarHalf) -#define SkScalarHalf(a) ((a) * SK_ScalarHalf) - -#define SkDegreesToRadians(degrees) ((degrees) * (SK_ScalarPI / 180)) -#define SkRadiansToDegrees(radians) ((radians) * (180 / SK_ScalarPI)) - -static inline bool SkScalarIsInt(SkScalar x) { - return x == SkScalarFloorToScalar(x); -} - -/** - * Returns -1 || 0 || 1 depending on the sign of value: - * -1 if x < 0 - * 0 if x == 0 - * 1 if x > 0 - */ -static inline int SkScalarSignAsInt(SkScalar x) { - return x < 0 ? -1 : (x > 0); -} - -// Scalar result version of above -static inline SkScalar SkScalarSignAsScalar(SkScalar x) { - return x < 0 ? -SK_Scalar1 : ((x > 0) ? SK_Scalar1 : 0); -} - -#define SK_ScalarNearlyZero (SK_Scalar1 / (1 << 12)) - -static inline bool SkScalarNearlyZero(SkScalar x, - SkScalar tolerance = SK_ScalarNearlyZero) { - SkASSERT(tolerance >= 0); - return SkScalarAbs(x) <= tolerance; -} - -static inline bool SkScalarNearlyEqual(SkScalar x, SkScalar y, - SkScalar tolerance = SK_ScalarNearlyZero) { - SkASSERT(tolerance >= 0); - return SkScalarAbs(x-y) <= tolerance; -} - -#define SK_ScalarSinCosNearlyZero (SK_Scalar1 / (1 << 16)) - -static inline float SkScalarSinSnapToZero(SkScalar radians) { - float v = SkScalarSin(radians); - return SkScalarNearlyZero(v, SK_ScalarSinCosNearlyZero) ? 0.0f : v; -} - -static inline float SkScalarCosSnapToZero(SkScalar radians) { - float v = SkScalarCos(radians); - return SkScalarNearlyZero(v, SK_ScalarSinCosNearlyZero) ? 0.0f : v; -} - -/** Linearly interpolate between A and B, based on t. - If t is 0, return A - If t is 1, return B - else interpolate. - t must be [0..SK_Scalar1] -*/ -static inline SkScalar SkScalarInterp(SkScalar A, SkScalar B, SkScalar t) { - SkASSERT(t >= 0 && t <= SK_Scalar1); - return A + (B - A) * t; -} - -/** Interpolate along the function described by (keys[length], values[length]) - for the passed searchKey. SearchKeys outside the range keys[0]-keys[Length] - clamp to the min or max value. This function assumes the number of pairs - (length) will be small and a linear search is used. - - Repeated keys are allowed for discontinuous functions (so long as keys is - monotonically increasing). If key is the value of a repeated scalar in - keys the first one will be used. -*/ -SkScalar SkScalarInterpFunc(SkScalar searchKey, const SkScalar keys[], - const SkScalar values[], int length); - -/* - * Helper to compare an array of scalars. - */ -static inline bool SkScalarsEqual(const SkScalar a[], const SkScalar b[], int n) { - SkASSERT(n >= 0); - for (int i = 0; i < n; ++i) { - if (a[i] != b[i]) { - return false; - } - } - return true; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSerialProcs.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSerialProcs.h deleted file mode 100644 index 87e10d847ce6ca..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSerialProcs.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSerialProcs_DEFINED -#define SkSerialProcs_DEFINED - -#include "include/core/SkImage.h" -#include "include/core/SkPicture.h" -#include "include/core/SkTypeface.h" - -/** - * A serial-proc is asked to serialize the specified object (e.g. picture or image). - * If a data object is returned, it will be used (even if it is zero-length). - * If null is returned, then Skia will take its default action. - * - * The default action for pictures is to use Skia's internal format. - * The default action for images is to encode either in its native format or PNG. - * The default action for typefaces is to use Skia's internal format. - */ - -typedef sk_sp (*SkSerialPictureProc)(SkPicture*, void* ctx); -typedef sk_sp (*SkSerialImageProc)(SkImage*, void* ctx); -typedef sk_sp (*SkSerialTypefaceProc)(SkTypeface*, void* ctx); - -/** - * Called with the encoded form of a picture (previously written with a custom - * SkSerialPictureProc proc). Return a picture object, or nullptr indicating failure. - */ -typedef sk_sp (*SkDeserialPictureProc)(const void* data, size_t length, void* ctx); - -/** - * Called with the encoded from of an image. The proc can return an image object, or if it - * returns nullptr, then Skia will take its default action to try to create an image from the data. - * - * Note that unlike SkDeserialPictureProc and SkDeserialTypefaceProc, return nullptr from this - * does not indicate failure, but is a signal for Skia to take its default action. - */ -typedef sk_sp (*SkDeserialImageProc)(const void* data, size_t length, void* ctx); - -/** - * Called with the encoded form of a typeface (previously written with a custom - * SkSerialTypefaceProc proc). Return a typeface object, or nullptr indicating failure. - */ -typedef sk_sp (*SkDeserialTypefaceProc)(const void* data, size_t length, void* ctx); - -struct SK_API SkSerialProcs { - SkSerialPictureProc fPictureProc = nullptr; - void* fPictureCtx = nullptr; - - SkSerialImageProc fImageProc = nullptr; - void* fImageCtx = nullptr; - - SkSerialTypefaceProc fTypefaceProc = nullptr; - void* fTypefaceCtx = nullptr; -}; - -struct SK_API SkDeserialProcs { - SkDeserialPictureProc fPictureProc = nullptr; - void* fPictureCtx = nullptr; - - SkDeserialImageProc fImageProc = nullptr; - void* fImageCtx = nullptr; - - SkDeserialTypefaceProc fTypefaceProc = nullptr; - void* fTypefaceCtx = nullptr; -}; - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkShader.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkShader.h deleted file mode 100644 index 1c05c6238cb599..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkShader.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkShader_DEFINED -#define SkShader_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkColor.h" -#include "include/core/SkFlattenable.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkTileMode.h" - -class SkArenaAlloc; -class SkBitmap; -class SkBlender; -class SkColorFilter; -class SkColorSpace; -class SkImage; -class SkPath; -class SkPicture; -class SkRasterPipeline; -class GrFragmentProcessor; - -/** \class SkShader - * - * Shaders specify the source color(s) for what is being drawn. If a paint - * has no shader, then the paint's color is used. If the paint has a - * shader, then the shader's color(s) are use instead, but they are - * modulated by the paint's alpha. This makes it easy to create a shader - * once (e.g. bitmap tiling or gradient) and then change its transparency - * w/o having to modify the original shader... only the paint's alpha needs - * to be modified. - */ -class SK_API SkShader : public SkFlattenable { -public: - /** - * Returns true if the shader is guaranteed to produce only opaque - * colors, subject to the SkPaint using the shader to apply an opaque - * alpha value. Subclasses should override this to allow some - * optimizations. - */ - virtual bool isOpaque() const { return false; } - - /** - * Iff this shader is backed by a single SkImage, return its ptr (the caller must ref this - * if they want to keep it longer than the lifetime of the shader). If not, return nullptr. - */ - SkImage* isAImage(SkMatrix* localMatrix, SkTileMode xy[2]) const; - - bool isAImage() const { - return this->isAImage(nullptr, (SkTileMode*)nullptr) != nullptr; - } - - // TODO(skbug.com/8941): Have Android use SkAndroidFrameworkUtils, move types to SkShaderBase, - // and delete asAGradient(). -#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK -private: -#endif - - /** - * If the shader subclass can be represented as a gradient, asAGradient - * returns the matching GradientType enum (or kNone_GradientType if it - * cannot). Also, if info is not null, asAGradient populates info with - * the relevant (see below) parameters for the gradient. fColorCount - * is both an input and output parameter. On input, it indicates how - * many entries in fColors and fColorOffsets can be used, if they are - * non-NULL. After asAGradient has run, fColorCount indicates how - * many color-offset pairs there are in the gradient. If there is - * insufficient space to store all of the color-offset pairs, fColors - * and fColorOffsets will not be altered. fColorOffsets specifies - * where on the range of 0 to 1 to transition to the given color. - * The meaning of fPoint and fRadius is dependant on the type of gradient. - * - * None: - * info is ignored. - * Color: - * fColorOffsets[0] is meaningless. - * Linear: - * fPoint[0] and fPoint[1] are the end-points of the gradient - * Radial: - * fPoint[0] and fRadius[0] are the center and radius - * Conical: - * fPoint[0] and fRadius[0] are the center and radius of the 1st circle - * fPoint[1] and fRadius[1] are the center and radius of the 2nd circle - * Sweep: - * fPoint[0] is the center of the sweep. - */ - - enum GradientType { - kNone_GradientType, - kColor_GradientType, - kLinear_GradientType, - kRadial_GradientType, - kSweep_GradientType, - kConical_GradientType, - }; - - struct GradientInfo { - int fColorCount = 0; //!< In-out parameter, specifies passed size - // of fColors/fColorOffsets on input, and - // actual number of colors/offsets on - // output. - SkColor* fColors = nullptr; //!< The colors in the gradient. - SkScalar* fColorOffsets = nullptr; //!< The unit offset for color transitions. - SkPoint fPoint[2]; //!< Type specific, see above. - SkScalar fRadius[2]; //!< Type specific, see above. - SkTileMode fTileMode; - uint32_t fGradientFlags = 0; //!< see SkGradientShader::Flags - }; - - GradientType asAGradient(GradientInfo* info) const; - -#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK -public: -#endif - - ////////////////////////////////////////////////////////////////////////// - // Methods to create combinations or variants of shaders - - /** - * Return a shader that will apply the specified localMatrix to this shader. - * The specified matrix will be applied before any matrix associated with this shader. - */ - sk_sp makeWithLocalMatrix(const SkMatrix&) const; - - /** - * Create a new shader that produces the same colors as invoking this shader and then applying - * the colorfilter. - */ - sk_sp makeWithColorFilter(sk_sp) const; - -private: - SkShader() = default; - friend class SkShaderBase; - - using INHERITED = SkFlattenable; -}; - -class SK_API SkShaders { -public: - static sk_sp Empty(); - static sk_sp Color(SkColor); - static sk_sp Color(const SkColor4f&, sk_sp); - static sk_sp Blend(SkBlendMode mode, sk_sp dst, sk_sp src); - static sk_sp Blend(sk_sp, sk_sp dst, sk_sp src); - -private: - SkShaders() = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSize.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSize.h deleted file mode 100644 index 79d673775e8d15..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSize.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSize_DEFINED -#define SkSize_DEFINED - -#include "include/core/SkScalar.h" - -struct SkISize { - int32_t fWidth; - int32_t fHeight; - - static constexpr SkISize Make(int32_t w, int32_t h) { return {w, h}; } - - static constexpr SkISize MakeEmpty() { return {0, 0}; } - - void set(int32_t w, int32_t h) { *this = SkISize{w, h}; } - - /** Returns true iff fWidth == 0 && fHeight == 0 - */ - bool isZero() const { return 0 == fWidth && 0 == fHeight; } - - /** Returns true if either width or height are <= 0 */ - bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } - - /** Set the width and height to 0 */ - void setEmpty() { fWidth = fHeight = 0; } - - constexpr int32_t width() const { return fWidth; } - constexpr int32_t height() const { return fHeight; } - - constexpr int64_t area() const { return fWidth * fHeight; } - - bool equals(int32_t w, int32_t h) const { return fWidth == w && fHeight == h; } -}; - -static inline bool operator==(const SkISize& a, const SkISize& b) { - return a.fWidth == b.fWidth && a.fHeight == b.fHeight; -} - -static inline bool operator!=(const SkISize& a, const SkISize& b) { return !(a == b); } - -/////////////////////////////////////////////////////////////////////////////// - -struct SkSize { - SkScalar fWidth; - SkScalar fHeight; - - static SkSize Make(SkScalar w, SkScalar h) { return {w, h}; } - - static SkSize Make(const SkISize& src) { - return {SkIntToScalar(src.width()), SkIntToScalar(src.height())}; - } - - static SkSize MakeEmpty() { return {0, 0}; } - - void set(SkScalar w, SkScalar h) { *this = SkSize{w, h}; } - - /** Returns true iff fWidth == 0 && fHeight == 0 - */ - bool isZero() const { return 0 == fWidth && 0 == fHeight; } - - /** Returns true if either width or height are <= 0 */ - bool isEmpty() const { return fWidth <= 0 || fHeight <= 0; } - - /** Set the width and height to 0 */ - void setEmpty() { *this = SkSize{0, 0}; } - - SkScalar width() const { return fWidth; } - SkScalar height() const { return fHeight; } - - bool equals(SkScalar w, SkScalar h) const { return fWidth == w && fHeight == h; } - - SkISize toRound() const { return {SkScalarRoundToInt(fWidth), SkScalarRoundToInt(fHeight)}; } - - SkISize toCeil() const { return {SkScalarCeilToInt(fWidth), SkScalarCeilToInt(fHeight)}; } - - SkISize toFloor() const { return {SkScalarFloorToInt(fWidth), SkScalarFloorToInt(fHeight)}; } -}; - -static inline bool operator==(const SkSize& a, const SkSize& b) { - return a.fWidth == b.fWidth && a.fHeight == b.fHeight; -} - -static inline bool operator!=(const SkSize& a, const SkSize& b) { return !(a == b); } -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSpan.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSpan.h deleted file mode 100644 index 03eb3b5b0fb665..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSpan.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSpan_DEFINED -#define SkSpan_DEFINED - -#include -#include -#include -#include -#include -#include "include/private/SkTLogic.h" - -// Add macro to check the lifetime of initializer_list arguments. initializer_list has a very -// short life span, and can only be used as a parameter, and not as a variable. -#if defined(__clang__) && defined(__has_cpp_attribute) && __has_cpp_attribute(clang::lifetimebound) -#define SK_CHECK_IL_LIFETIME [[clang::lifetimebound]] -#else -#define SK_CHECK_IL_LIFETIME -#endif - -/** - * SkSpan holds a reference to contiguous data of type T along with a count. SkSpan does not own - * the data itself but is merely a reference, therefore you must take care with the lifetime of - * the underlying data. - * - * SkSpan is a count and a pointer into existing array or data type that stores its data in - * contiguous memory like std::vector. Any container that works with std::size() and std::data() - * can be used. - * - * SkSpan makes a convenient parameter for a routine to accept array like things. This allows you to - * write the routine without overloads for all different container types. - * - * Example: - * void routine(SkSpan a) { ... } - * - * std::vector v = {1, 2, 3, 4, 5}; - * - * routine(a); - * - * A word of caution when working with initializer_list, initializer_lists have a lifetime that is - * limited to the current statement. The following is correct and safe: - * - * Example: - * routine({1,2,3,4,5}); - * - * The following is undefined, and will result in erratic execution: - * - * Bad Example: - * initializer_list l = {1, 2, 3, 4, 5}; // The data behind l dies at the ;. - * routine(l); - */ -template -class SkSpan { -public: - constexpr SkSpan() : fPtr{nullptr}, fSize{0} {} - constexpr SkSpan(T* ptr, size_t size) : fPtr{ptr}, fSize{size} { - SkASSERT(ptr || size == 0); // disallow nullptr + a nonzero size - SkASSERT(size < kMaxSize); - } - template ::value>::type> - constexpr SkSpan(const SkSpan& that) : fPtr(std::data(that)), fSize{std::size(that)} {} - constexpr SkSpan(const SkSpan& o) = default; - template constexpr SkSpan(T(&a)[N]) : SkSpan(a, N) { } - template - constexpr SkSpan(Container& c) : SkSpan{std::data(c), std::size(c)} { } - SkSpan(std::initializer_list il SK_CHECK_IL_LIFETIME) - : SkSpan(std::data(il), std::size(il)) {} - - constexpr SkSpan& operator=(const SkSpan& that) = default; - - constexpr T& operator [] (size_t i) const { - SkASSERT(i < this->size()); - return fPtr[i]; - } - constexpr T& front() const { return fPtr[0]; } - constexpr T& back() const { return fPtr[fSize - 1]; } - constexpr T* begin() const { return fPtr; } - constexpr T* end() const { return fPtr + fSize; } - constexpr auto rbegin() const { return std::make_reverse_iterator(this->end()); } - constexpr auto rend() const { return std::make_reverse_iterator(this->begin()); } - constexpr T* data() const { return this->begin(); } - constexpr size_t size() const { return fSize; } - constexpr bool empty() const { return fSize == 0; } - constexpr size_t size_bytes() const { return fSize * sizeof(T); } - constexpr SkSpan first(size_t prefixLen) const { - SkASSERT(prefixLen <= this->size()); - return SkSpan{fPtr, prefixLen}; - } - constexpr SkSpan last(size_t postfixLen) const { - SkASSERT(postfixLen <= this->size()); - return SkSpan{fPtr + (this->size() - postfixLen), postfixLen}; - } - constexpr SkSpan subspan(size_t offset) const { - return this->subspan(offset, this->size() - offset); - } - constexpr SkSpan subspan(size_t offset, size_t count) const { - SkASSERT(offset <= this->size()); - SkASSERT(count <= this->size() - offset); - return SkSpan{fPtr + offset, count}; - } - -private: - static const constexpr size_t kMaxSize = std::numeric_limits::max() / sizeof(T); - T* fPtr; - size_t fSize; -}; - -template -SkSpan(Container&) -> - SkSpan()))>>; - -template -SkSpan(std::initializer_list) -> - SkSpan>()))>>; - -#endif // SkSpan_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStream.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStream.h deleted file mode 100644 index 768de9b5a33d09..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStream.h +++ /dev/null @@ -1,524 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkStream_DEFINED -#define SkStream_DEFINED - -#include "include/core/SkData.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/private/SkTo.h" - -#include - -class SkStream; -class SkStreamRewindable; -class SkStreamSeekable; -class SkStreamAsset; -class SkStreamMemory; - -/** - * SkStream -- abstraction for a source of bytes. Subclasses can be backed by - * memory, or a file, or something else. - * - * NOTE: - * - * Classic "streams" APIs are sort of async, in that on a request for N - * bytes, they may return fewer than N bytes on a given call, in which case - * the caller can "try again" to get more bytes, eventually (modulo an error) - * receiving their total N bytes. - * - * Skia streams behave differently. They are effectively synchronous, and will - * always return all N bytes of the request if possible. If they return fewer - * (the read() call returns the number of bytes read) then that means there is - * no more data (at EOF or hit an error). The caller should *not* call again - * in hopes of fulfilling more of the request. - */ -class SK_API SkStream { -public: - virtual ~SkStream() {} - SkStream() {} - - /** - * Attempts to open the specified file as a stream, returns nullptr on failure. - */ - static std::unique_ptr MakeFromFile(const char path[]); - - /** Reads or skips size number of bytes. - * If buffer == NULL, skip size bytes, return how many were skipped. - * If buffer != NULL, copy size bytes into buffer, return how many were copied. - * @param buffer when NULL skip size bytes, otherwise copy size bytes into buffer - * @param size the number of bytes to skip or copy - * @return the number of bytes actually read. - */ - virtual size_t read(void* buffer, size_t size) = 0; - - /** Skip size number of bytes. - * @return the actual number bytes that could be skipped. - */ - size_t skip(size_t size) { - return this->read(nullptr, size); - } - - /** - * Attempt to peek at size bytes. - * If this stream supports peeking, copy min(size, peekable bytes) into - * buffer, and return the number of bytes copied. - * If the stream does not support peeking, or cannot peek any bytes, - * return 0 and leave buffer unchanged. - * The stream is guaranteed to be in the same visible state after this - * call, regardless of success or failure. - * @param buffer Must not be NULL, and must be at least size bytes. Destination - * to copy bytes. - * @param size Number of bytes to copy. - * @return The number of bytes peeked/copied. - */ - virtual size_t peek(void* /*buffer*/, size_t /*size*/) const { return 0; } - - /** Returns true when all the bytes in the stream have been read. - * This may return true early (when there are no more bytes to be read) - * or late (after the first unsuccessful read). - */ - virtual bool isAtEnd() const = 0; - - bool SK_WARN_UNUSED_RESULT readS8(int8_t*); - bool SK_WARN_UNUSED_RESULT readS16(int16_t*); - bool SK_WARN_UNUSED_RESULT readS32(int32_t*); - - bool SK_WARN_UNUSED_RESULT readU8(uint8_t* i) { return this->readS8((int8_t*)i); } - bool SK_WARN_UNUSED_RESULT readU16(uint16_t* i) { return this->readS16((int16_t*)i); } - bool SK_WARN_UNUSED_RESULT readU32(uint32_t* i) { return this->readS32((int32_t*)i); } - - bool SK_WARN_UNUSED_RESULT readBool(bool* b) { - uint8_t i; - if (!this->readU8(&i)) { return false; } - *b = (i != 0); - return true; - } - bool SK_WARN_UNUSED_RESULT readScalar(SkScalar*); - bool SK_WARN_UNUSED_RESULT readPackedUInt(size_t*); - -//SkStreamRewindable - /** Rewinds to the beginning of the stream. Returns true if the stream is known - * to be at the beginning after this call returns. - */ - virtual bool rewind() { return false; } - - /** Duplicates this stream. If this cannot be done, returns NULL. - * The returned stream will be positioned at the beginning of its data. - */ - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - /** Duplicates this stream. If this cannot be done, returns NULL. - * The returned stream will be positioned the same as this stream. - */ - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } - -//SkStreamSeekable - /** Returns true if this stream can report its current position. */ - virtual bool hasPosition() const { return false; } - /** Returns the current position in the stream. If this cannot be done, returns 0. */ - virtual size_t getPosition() const { return 0; } - - /** Seeks to an absolute position in the stream. If this cannot be done, returns false. - * If an attempt is made to seek past the end of the stream, the position will be set - * to the end of the stream. - */ - virtual bool seek(size_t /*position*/) { return false; } - - /** Seeks to an relative offset in the stream. If this cannot be done, returns false. - * If an attempt is made to move to a position outside the stream, the position will be set - * to the closest point within the stream (beginning or end). - */ - virtual bool move(long /*offset*/) { return false; } - -//SkStreamAsset - /** Returns true if this stream can report its total length. */ - virtual bool hasLength() const { return false; } - /** Returns the total length of the stream. If this cannot be done, returns 0. */ - virtual size_t getLength() const { return 0; } - -//SkStreamMemory - /** Returns the starting address for the data. If this cannot be done, returns NULL. */ - //TODO: replace with virtual const SkData* getData() - virtual const void* getMemoryBase() { return nullptr; } - -private: - virtual SkStream* onDuplicate() const { return nullptr; } - virtual SkStream* onFork() const { return nullptr; } - - SkStream(SkStream&&) = delete; - SkStream(const SkStream&) = delete; - SkStream& operator=(SkStream&&) = delete; - SkStream& operator=(const SkStream&) = delete; -}; - -/** SkStreamRewindable is a SkStream for which rewind and duplicate are required. */ -class SK_API SkStreamRewindable : public SkStream { -public: - bool rewind() override = 0; - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } -private: - SkStreamRewindable* onDuplicate() const override = 0; -}; - -/** SkStreamSeekable is a SkStreamRewindable for which position, seek, move, and fork are required. */ -class SK_API SkStreamSeekable : public SkStreamRewindable { -public: - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - - bool hasPosition() const override { return true; } - size_t getPosition() const override = 0; - bool seek(size_t position) override = 0; - bool move(long offset) override = 0; - - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } -private: - SkStreamSeekable* onDuplicate() const override = 0; - SkStreamSeekable* onFork() const override = 0; -}; - -/** SkStreamAsset is a SkStreamSeekable for which getLength is required. */ -class SK_API SkStreamAsset : public SkStreamSeekable { -public: - bool hasLength() const override { return true; } - size_t getLength() const override = 0; - - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } -private: - SkStreamAsset* onDuplicate() const override = 0; - SkStreamAsset* onFork() const override = 0; -}; - -/** SkStreamMemory is a SkStreamAsset for which getMemoryBase is required. */ -class SK_API SkStreamMemory : public SkStreamAsset { -public: - const void* getMemoryBase() override = 0; - - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } -private: - SkStreamMemory* onDuplicate() const override = 0; - SkStreamMemory* onFork() const override = 0; -}; - -class SK_API SkWStream { -public: - virtual ~SkWStream(); - SkWStream() {} - - /** Called to write bytes to a SkWStream. Returns true on success - @param buffer the address of at least size bytes to be written to the stream - @param size The number of bytes in buffer to write to the stream - @return true on success - */ - virtual bool write(const void* buffer, size_t size) = 0; - virtual void flush(); - - virtual size_t bytesWritten() const = 0; - - // helpers - - bool write8(U8CPU value) { - uint8_t v = SkToU8(value); - return this->write(&v, 1); - } - bool write16(U16CPU value) { - uint16_t v = SkToU16(value); - return this->write(&v, 2); - } - bool write32(uint32_t v) { - return this->write(&v, 4); - } - - bool writeText(const char text[]) { - SkASSERT(text); - return this->write(text, strlen(text)); - } - - bool newline() { return this->write("\n", strlen("\n")); } - - bool writeDecAsText(int32_t); - bool writeBigDecAsText(int64_t, int minDigits = 0); - bool writeHexAsText(uint32_t, int minDigits = 0); - bool writeScalarAsText(SkScalar); - - bool writeBool(bool v) { return this->write8(v); } - bool writeScalar(SkScalar); - bool writePackedUInt(size_t); - - bool writeStream(SkStream* input, size_t length); - - /** - * This returns the number of bytes in the stream required to store - * 'value'. - */ - static int SizeOfPackedUInt(size_t value); - -private: - SkWStream(const SkWStream&) = delete; - SkWStream& operator=(const SkWStream&) = delete; -}; - -class SK_API SkNullWStream : public SkWStream { -public: - SkNullWStream() : fBytesWritten(0) {} - - bool write(const void* , size_t n) override { fBytesWritten += n; return true; } - void flush() override {} - size_t bytesWritten() const override { return fBytesWritten; } - -private: - size_t fBytesWritten; -}; - -//////////////////////////////////////////////////////////////////////////////////////// - -#include - -/** A stream that wraps a C FILE* file stream. */ -class SK_API SkFILEStream : public SkStreamAsset { -public: - /** Initialize the stream by calling sk_fopen on the specified path. - * This internal stream will be closed in the destructor. - */ - explicit SkFILEStream(const char path[] = nullptr); - - /** Initialize the stream with an existing C FILE stream. - * The current position of the C FILE stream will be considered the - * beginning of the SkFILEStream and the current seek end of the FILE will be the end. - * The C FILE stream will be closed in the destructor. - */ - explicit SkFILEStream(FILE* file); - - /** Initialize the stream with an existing C FILE stream. - * The current position of the C FILE stream will be considered the - * beginning of the SkFILEStream and size bytes later will be the end. - * The C FILE stream will be closed in the destructor. - */ - explicit SkFILEStream(FILE* file, size_t size); - - ~SkFILEStream() override; - - static std::unique_ptr Make(const char path[]) { - std::unique_ptr stream(new SkFILEStream(path)); - return stream->isValid() ? std::move(stream) : nullptr; - } - - /** Returns true if the current path could be opened. */ - bool isValid() const { return fFILE != nullptr; } - - /** Close this SkFILEStream. */ - void close(); - - size_t read(void* buffer, size_t size) override; - bool isAtEnd() const override; - - bool rewind() override; - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - - size_t getPosition() const override; - bool seek(size_t position) override; - bool move(long offset) override; - - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } - - size_t getLength() const override; - -private: - explicit SkFILEStream(FILE*, size_t size, size_t start); - explicit SkFILEStream(std::shared_ptr, size_t end, size_t start); - explicit SkFILEStream(std::shared_ptr, size_t end, size_t start, size_t current); - - SkStreamAsset* onDuplicate() const override; - SkStreamAsset* onFork() const override; - - std::shared_ptr fFILE; - // My own council will I keep on sizes and offsets. - // These are seek positions in the underling FILE, not offsets into the stream. - size_t fEnd; - size_t fStart; - size_t fCurrent; - - using INHERITED = SkStreamAsset; -}; - -class SK_API SkMemoryStream : public SkStreamMemory { -public: - SkMemoryStream(); - - /** We allocate (and free) the memory. Write to it via getMemoryBase() */ - SkMemoryStream(size_t length); - - /** If copyData is true, the stream makes a private copy of the data. */ - SkMemoryStream(const void* data, size_t length, bool copyData = false); - - /** Creates the stream to read from the specified data */ - SkMemoryStream(sk_sp data); - - /** Returns a stream with a copy of the input data. */ - static std::unique_ptr MakeCopy(const void* data, size_t length); - - /** Returns a stream with a bare pointer reference to the input data. */ - static std::unique_ptr MakeDirect(const void* data, size_t length); - - /** Returns a stream with a shared reference to the input data. */ - static std::unique_ptr Make(sk_sp data); - - /** Resets the stream to the specified data and length, - just like the constructor. - if copyData is true, the stream makes a private copy of the data - */ - virtual void setMemory(const void* data, size_t length, - bool copyData = false); - /** Replace any memory buffer with the specified buffer. The caller - must have allocated data with sk_malloc or sk_realloc, since it - will be freed with sk_free. - */ - void setMemoryOwned(const void* data, size_t length); - - sk_sp asData() const { return fData; } - void setData(sk_sp data); - - void skipToAlign4(); - const void* getAtPos(); - - size_t read(void* buffer, size_t size) override; - bool isAtEnd() const override; - - size_t peek(void* buffer, size_t size) const override; - - bool rewind() override; - - std::unique_ptr duplicate() const { - return std::unique_ptr(this->onDuplicate()); - } - - size_t getPosition() const override; - bool seek(size_t position) override; - bool move(long offset) override; - - std::unique_ptr fork() const { - return std::unique_ptr(this->onFork()); - } - - size_t getLength() const override; - - const void* getMemoryBase() override; - -private: - SkMemoryStream* onDuplicate() const override; - SkMemoryStream* onFork() const override; - - sk_sp fData; - size_t fOffset; - - using INHERITED = SkStreamMemory; -}; - -///////////////////////////////////////////////////////////////////////////////////////////// - -class SK_API SkFILEWStream : public SkWStream { -public: - SkFILEWStream(const char path[]); - ~SkFILEWStream() override; - - /** Returns true if the current path could be opened. - */ - bool isValid() const { return fFILE != nullptr; } - - bool write(const void* buffer, size_t size) override; - void flush() override; - void fsync(); - size_t bytesWritten() const override; - -private: - FILE* fFILE; - - using INHERITED = SkWStream; -}; - -class SK_API SkDynamicMemoryWStream : public SkWStream { -public: - SkDynamicMemoryWStream() = default; - SkDynamicMemoryWStream(SkDynamicMemoryWStream&&); - SkDynamicMemoryWStream& operator=(SkDynamicMemoryWStream&&); - ~SkDynamicMemoryWStream() override; - - bool write(const void* buffer, size_t size) override; - size_t bytesWritten() const override; - - bool read(void* buffer, size_t offset, size_t size); - - /** More efficient version of read(dst, 0, bytesWritten()). */ - void copyTo(void* dst) const; - bool writeToStream(SkWStream* dst) const; - - /** Equivalent to copyTo() followed by reset(), but may save memory use. */ - void copyToAndReset(void* dst); - - /** Equivalent to writeToStream() followed by reset(), but may save memory use. */ - bool writeToAndReset(SkWStream* dst); - - /** Equivalent to writeToStream() followed by reset(), but may save memory use. - When the dst is also a SkDynamicMemoryWStream, the implementation is constant time. */ - bool writeToAndReset(SkDynamicMemoryWStream* dst); - - /** Prepend this stream to dst, resetting this. */ - void prependToAndReset(SkDynamicMemoryWStream* dst); - - /** Return the contents as SkData, and then reset the stream. */ - sk_sp detachAsData(); - - /** Reset, returning a reader stream with the current content. */ - std::unique_ptr detachAsStream(); - - /** Reset the stream to its original, empty, state. */ - void reset(); - void padToAlign4(); -private: - struct Block; - Block* fHead = nullptr; - Block* fTail = nullptr; - size_t fBytesWrittenBeforeTail = 0; - -#ifdef SK_DEBUG - void validate() const; -#else - void validate() const {} -#endif - - // For access to the Block type. - friend class SkBlockMemoryStream; - friend class SkBlockMemoryRefCnt; - - using INHERITED = SkWStream; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkString.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkString.h deleted file mode 100644 index e659910c6f00e2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkString.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkString_DEFINED -#define SkString_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/private/SkMalloc.h" -#include "include/private/SkTArray.h" -#include "include/private/SkTo.h" - -#include -#include -#include -#include -#include - -/* Some helper functions for C strings */ -static inline bool SkStrStartsWith(const char string[], const char prefixStr[]) { - SkASSERT(string); - SkASSERT(prefixStr); - return !strncmp(string, prefixStr, strlen(prefixStr)); -} -static inline bool SkStrStartsWith(const char string[], const char prefixChar) { - SkASSERT(string); - return (prefixChar == *string); -} - -bool SkStrEndsWith(const char string[], const char suffixStr[]); -bool SkStrEndsWith(const char string[], const char suffixChar); - -int SkStrStartsWithOneOf(const char string[], const char prefixes[]); - -static inline int SkStrFind(const char string[], const char substring[]) { - const char *first = strstr(string, substring); - if (nullptr == first) return -1; - return SkToInt(first - &string[0]); -} - -static inline int SkStrFindLastOf(const char string[], const char subchar) { - const char* last = strrchr(string, subchar); - if (nullptr == last) return -1; - return SkToInt(last - &string[0]); -} - -static inline bool SkStrContains(const char string[], const char substring[]) { - SkASSERT(string); - SkASSERT(substring); - return (-1 != SkStrFind(string, substring)); -} -static inline bool SkStrContains(const char string[], const char subchar) { - SkASSERT(string); - char tmp[2]; - tmp[0] = subchar; - tmp[1] = '\0'; - return (-1 != SkStrFind(string, tmp)); -} - -/* - * The SkStrAppend... methods will write into the provided buffer, assuming it is large enough. - * Each method has an associated const (e.g. kSkStrAppendU32_MaxSize) which will be the largest - * value needed for that method's buffer. - * - * char storage[kSkStrAppendU32_MaxSize]; - * SkStrAppendU32(storage, value); - * - * Note : none of the SkStrAppend... methods write a terminating 0 to their buffers. Instead, - * the methods return the ptr to the end of the written part of the buffer. This can be used - * to compute the length, and/or know where to write a 0 if that is desired. - * - * char storage[kSkStrAppendU32_MaxSize + 1]; - * char* stop = SkStrAppendU32(storage, value); - * size_t len = stop - storage; - * *stop = 0; // valid, since storage was 1 byte larger than the max. - */ - -static constexpr int kSkStrAppendU32_MaxSize = 10; -char* SkStrAppendU32(char buffer[], uint32_t); -static constexpr int kSkStrAppendU64_MaxSize = 20; -char* SkStrAppendU64(char buffer[], uint64_t, int minDigits); - -static constexpr int kSkStrAppendS32_MaxSize = kSkStrAppendU32_MaxSize + 1; -char* SkStrAppendS32(char buffer[], int32_t); -static constexpr int kSkStrAppendS64_MaxSize = kSkStrAppendU64_MaxSize + 1; -char* SkStrAppendS64(char buffer[], int64_t, int minDigits); - -/** - * Floats have at most 8 significant digits, so we limit our %g to that. - * However, the total string could be 15 characters: -1.2345678e-005 - * - * In theory we should only expect up to 2 digits for the exponent, but on - * some platforms we have seen 3 (as in the example above). - */ -static constexpr int kSkStrAppendScalar_MaxSize = 15; - -/** - * Write the scalar in decimal format into buffer, and return a pointer to - * the next char after the last one written. Note: a terminating 0 is not - * written into buffer, which must be at least kSkStrAppendScalar_MaxSize. - * Thus if the caller wants to add a 0 at the end, buffer must be at least - * kSkStrAppendScalar_MaxSize + 1 bytes large. - */ -char* SkStrAppendScalar(char buffer[], SkScalar); - -/** \class SkString - - Light weight class for managing strings. Uses reference - counting to make string assignments and copies very fast - with no extra RAM cost. Assumes UTF8 encoding. -*/ -class SK_API SkString { -public: - SkString(); - explicit SkString(size_t len); - explicit SkString(const char text[]); - SkString(const char text[], size_t len); - SkString(const SkString&); - SkString(SkString&&); - explicit SkString(const std::string&); - explicit SkString(std::string_view); - ~SkString(); - - bool isEmpty() const { return 0 == fRec->fLength; } - size_t size() const { return (size_t) fRec->fLength; } - const char* c_str() const { return fRec->data(); } - char operator[](size_t n) const { return this->c_str()[n]; } - - bool equals(const SkString&) const; - bool equals(const char text[]) const; - bool equals(const char text[], size_t len) const; - - bool startsWith(const char prefixStr[]) const { - return SkStrStartsWith(fRec->data(), prefixStr); - } - bool startsWith(const char prefixChar) const { - return SkStrStartsWith(fRec->data(), prefixChar); - } - bool endsWith(const char suffixStr[]) const { - return SkStrEndsWith(fRec->data(), suffixStr); - } - bool endsWith(const char suffixChar) const { - return SkStrEndsWith(fRec->data(), suffixChar); - } - bool contains(const char substring[]) const { - return SkStrContains(fRec->data(), substring); - } - bool contains(const char subchar) const { - return SkStrContains(fRec->data(), subchar); - } - int find(const char substring[]) const { - return SkStrFind(fRec->data(), substring); - } - int findLastOf(const char subchar) const { - return SkStrFindLastOf(fRec->data(), subchar); - } - - friend bool operator==(const SkString& a, const SkString& b) { - return a.equals(b); - } - friend bool operator!=(const SkString& a, const SkString& b) { - return !a.equals(b); - } - - // these methods edit the string - - SkString& operator=(const SkString&); - SkString& operator=(SkString&&); - SkString& operator=(const char text[]); - - char* writable_str(); - char& operator[](size_t n) { return this->writable_str()[n]; } - - void reset(); - /** String contents are preserved on resize. (For destructive resize, `set(nullptr, length)`.) - * `resize` automatically reserves an extra byte at the end of the buffer for a null terminator. - */ - void resize(size_t len); - void set(const SkString& src) { *this = src; } - void set(const char text[]); - void set(const char text[], size_t len); - void set(std::string_view str) { this->set(str.data(), str.size()); } - - void insert(size_t offset, const char text[]); - void insert(size_t offset, const char text[], size_t len); - void insert(size_t offset, const SkString& str) { this->insert(offset, str.c_str(), str.size()); } - void insert(size_t offset, std::string_view str) { this->insert(offset, str.data(), str.size()); } - void insertUnichar(size_t offset, SkUnichar); - void insertS32(size_t offset, int32_t value); - void insertS64(size_t offset, int64_t value, int minDigits = 0); - void insertU32(size_t offset, uint32_t value); - void insertU64(size_t offset, uint64_t value, int minDigits = 0); - void insertHex(size_t offset, uint32_t value, int minDigits = 0); - void insertScalar(size_t offset, SkScalar); - - void append(const char text[]) { this->insert((size_t)-1, text); } - void append(const char text[], size_t len) { this->insert((size_t)-1, text, len); } - void append(const SkString& str) { this->insert((size_t)-1, str.c_str(), str.size()); } - void append(std::string_view str) { this->insert((size_t)-1, str.data(), str.size()); } - void appendUnichar(SkUnichar uni) { this->insertUnichar((size_t)-1, uni); } - void appendS32(int32_t value) { this->insertS32((size_t)-1, value); } - void appendS64(int64_t value, int minDigits = 0) { this->insertS64((size_t)-1, value, minDigits); } - void appendU32(uint32_t value) { this->insertU32((size_t)-1, value); } - void appendU64(uint64_t value, int minDigits = 0) { this->insertU64((size_t)-1, value, minDigits); } - void appendHex(uint32_t value, int minDigits = 0) { this->insertHex((size_t)-1, value, minDigits); } - void appendScalar(SkScalar value) { this->insertScalar((size_t)-1, value); } - - void prepend(const char text[]) { this->insert(0, text); } - void prepend(const char text[], size_t len) { this->insert(0, text, len); } - void prepend(const SkString& str) { this->insert(0, str.c_str(), str.size()); } - void prepend(std::string_view str) { this->insert(0, str.data(), str.size()); } - void prependUnichar(SkUnichar uni) { this->insertUnichar(0, uni); } - void prependS32(int32_t value) { this->insertS32(0, value); } - void prependS64(int32_t value, int minDigits = 0) { this->insertS64(0, value, minDigits); } - void prependHex(uint32_t value, int minDigits = 0) { this->insertHex(0, value, minDigits); } - void prependScalar(SkScalar value) { this->insertScalar((size_t)-1, value); } - - void printf(const char format[], ...) SK_PRINTF_LIKE(2, 3); - void printVAList(const char format[], va_list) SK_PRINTF_LIKE(2, 0); - void appendf(const char format[], ...) SK_PRINTF_LIKE(2, 3); - void appendVAList(const char format[], va_list) SK_PRINTF_LIKE(2, 0); - void prependf(const char format[], ...) SK_PRINTF_LIKE(2, 3); - void prependVAList(const char format[], va_list) SK_PRINTF_LIKE(2, 0); - - void remove(size_t offset, size_t length); - - SkString& operator+=(const SkString& s) { this->append(s); return *this; } - SkString& operator+=(const char text[]) { this->append(text); return *this; } - SkString& operator+=(const char c) { this->append(&c, 1); return *this; } - - /** - * Swap contents between this and other. This function is guaranteed - * to never fail or throw. - */ - void swap(SkString& other); - - using sk_is_trivially_relocatable = std::true_type; - -private: - struct Rec { - public: - constexpr Rec(uint32_t len, int32_t refCnt) : fLength(len), fRefCnt(refCnt) {} - static sk_sp Make(const char text[], size_t len); - char* data() { return fBeginningOfData; } - const char* data() const { return fBeginningOfData; } - void ref() const; - void unref() const; - bool unique() const; -#ifdef SK_DEBUG - int32_t getRefCnt() const; -#endif - uint32_t fLength; // logically size_t, but we want it to stay 32 bits - - private: - mutable std::atomic fRefCnt; - char fBeginningOfData[1] = {'\0'}; - - // Ensure the unsized delete is called. - void operator delete(void* p) { ::operator delete(p); } - }; - sk_sp fRec; - - static_assert(::sk_is_trivially_relocatable::value); - -#ifdef SK_DEBUG - const SkString& validate() const; -#else - const SkString& validate() const { return *this; } -#endif - - static const Rec gEmptyRec; -}; - -/// Creates a new string and writes into it using a printf()-style format. -SkString SkStringPrintf(const char* format, ...) SK_PRINTF_LIKE(1, 2); -/// This makes it easier to write a caller as a VAR_ARGS function where the format string is -/// optional. -static inline SkString SkStringPrintf() { return SkString(); } - -static inline void swap(SkString& a, SkString& b) { - a.swap(b); -} - -enum SkStrSplitMode { - // Strictly return all results. If the input is ",," and the separator is ',' this will return - // an array of three empty strings. - kStrict_SkStrSplitMode, - - // Only nonempty results will be added to the results. Multiple separators will be - // coalesced. Separators at the beginning and end of the input will be ignored. If the input is - // ",," and the separator is ',', this will return an empty vector. - kCoalesce_SkStrSplitMode -}; - -// Split str on any characters in delimiters into out. (Think, strtok with a sane API.) -void SkStrSplit(const char* str, const char* delimiters, SkStrSplitMode splitMode, - SkTArray* out); -inline void SkStrSplit(const char* str, const char* delimiters, SkTArray* out) { - SkStrSplit(str, delimiters, kCoalesce_SkStrSplitMode, out); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStrokeRec.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStrokeRec.h deleted file mode 100644 index b4796fcbfa6caa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkStrokeRec.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkStrokeRec_DEFINED -#define SkStrokeRec_DEFINED - -#include "include/core/SkPaint.h" -#include "include/private/SkMacros.h" - -class SkPath; - -SK_BEGIN_REQUIRE_DENSE -class SK_API SkStrokeRec { -public: - enum InitStyle { - kHairline_InitStyle, - kFill_InitStyle - }; - SkStrokeRec(InitStyle style); - SkStrokeRec(const SkPaint&, SkPaint::Style, SkScalar resScale = 1); - explicit SkStrokeRec(const SkPaint&, SkScalar resScale = 1); - - enum Style { - kHairline_Style, - kFill_Style, - kStroke_Style, - kStrokeAndFill_Style - }; - - static constexpr int kStyleCount = kStrokeAndFill_Style + 1; - - Style getStyle() const; - SkScalar getWidth() const { return fWidth; } - SkScalar getMiter() const { return fMiterLimit; } - SkPaint::Cap getCap() const { return (SkPaint::Cap)fCap; } - SkPaint::Join getJoin() const { return (SkPaint::Join)fJoin; } - - bool isHairlineStyle() const { - return kHairline_Style == this->getStyle(); - } - - bool isFillStyle() const { - return kFill_Style == this->getStyle(); - } - - void setFillStyle(); - void setHairlineStyle(); - /** - * Specify the strokewidth, and optionally if you want stroke + fill. - * Note, if width==0, then this request is taken to mean: - * strokeAndFill==true -> new style will be Fill - * strokeAndFill==false -> new style will be Hairline - */ - void setStrokeStyle(SkScalar width, bool strokeAndFill = false); - - void setStrokeParams(SkPaint::Cap cap, SkPaint::Join join, SkScalar miterLimit) { - fCap = cap; - fJoin = join; - fMiterLimit = miterLimit; - } - - SkScalar getResScale() const { - return fResScale; - } - - void setResScale(SkScalar rs) { - SkASSERT(rs > 0 && SkScalarIsFinite(rs)); - fResScale = rs; - } - - /** - * Returns true if this specifes any thick stroking, i.e. applyToPath() - * will return true. - */ - bool needToApply() const { - Style style = this->getStyle(); - return (kStroke_Style == style) || (kStrokeAndFill_Style == style); - } - - /** - * Apply these stroke parameters to the src path, returning the result - * in dst. - * - * If there was no change (i.e. style == hairline or fill) this returns - * false and dst is unchanged. Otherwise returns true and the result is - * stored in dst. - * - * src and dst may be the same path. - */ - bool applyToPath(SkPath* dst, const SkPath& src) const; - - /** - * Apply these stroke parameters to a paint. - */ - void applyToPaint(SkPaint* paint) const; - - /** - * Gives a conservative value for the outset that should applied to a - * geometries bounds to account for any inflation due to applying this - * strokeRec to the geometry. - */ - SkScalar getInflationRadius() const; - - /** - * Equivalent to: - * SkStrokeRec rec(paint, style); - * rec.getInflationRadius(); - * This does not account for other effects on the paint (i.e. path - * effect). - */ - static SkScalar GetInflationRadius(const SkPaint&, SkPaint::Style); - - static SkScalar GetInflationRadius(SkPaint::Join, SkScalar miterLimit, SkPaint::Cap, - SkScalar strokeWidth); - - /** - * Compare if two SkStrokeRecs have an equal effect on a path. - * Equal SkStrokeRecs produce equal paths. Equality of produced - * paths does not take the ResScale parameter into account. - */ - bool hasEqualEffect(const SkStrokeRec& other) const { - if (!this->needToApply()) { - return this->getStyle() == other.getStyle(); - } - return fWidth == other.fWidth && - (fJoin != SkPaint::kMiter_Join || fMiterLimit == other.fMiterLimit) && - fCap == other.fCap && - fJoin == other.fJoin && - fStrokeAndFill == other.fStrokeAndFill; - } - -private: - void init(const SkPaint&, SkPaint::Style, SkScalar resScale); - - SkScalar fResScale; - SkScalar fWidth; - SkScalar fMiterLimit; - // The following three members are packed together into a single u32. - // This is to avoid unnecessary padding and ensure binary equality for - // hashing (because the padded areas might contain garbage values). - // - // fCap and fJoin are larger than needed to avoid having to initialize - // any pad values - uint32_t fCap : 16; // SkPaint::Cap - uint32_t fJoin : 15; // SkPaint::Join - uint32_t fStrokeAndFill : 1; // bool -}; -SK_END_REQUIRE_DENSE - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurface.h deleted file mode 100644 index 98dcfdefcb3db4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurface.h +++ /dev/null @@ -1,1177 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSurface_DEFINED -#define SkSurface_DEFINED - -#include "include/core/SkImage.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSurfaceProps.h" - -#if SK_SUPPORT_GPU -#include "include/gpu/GrTypes.h" -#endif - -#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 -#include -#endif - -#if SK_SUPPORT_GPU && defined(SK_METAL) -#include "include/gpu/mtl/GrMtlTypes.h" -#endif - -class SkCanvas; -class SkCapabilities; -class SkDeferredDisplayList; -class SkPaint; -class SkSurfaceCharacterization; -class GrBackendRenderTarget; -class GrBackendSemaphore; -class GrBackendTexture; -class GrDirectContext; -class GrRecordingContext; -class GrRenderTarget; -enum GrSurfaceOrigin: int; - -namespace skgpu { -class MutableTextureState; -} - -namespace skgpu::graphite { -class BackendTexture; -class Recorder; -} - -/** \class SkSurface - SkSurface is responsible for managing the pixels that a canvas draws into. The pixels can be - allocated either in CPU memory (a raster surface) or on the GPU (a GrRenderTarget surface). - SkSurface takes care of allocating a SkCanvas that will draw into the surface. Call - surface->getCanvas() to use that canvas (but don't delete it, it is owned by the surface). - SkSurface always has non-zero dimensions. If there is a request for a new surface, and either - of the requested dimensions are zero, then nullptr will be returned. -*/ -class SK_API SkSurface : public SkRefCnt { -public: - - /** Allocates raster SkSurface. SkCanvas returned by SkSurface draws directly into pixels. - - SkSurface is returned if all parameters are valid. - Valid parameters include: - info dimensions are greater than zero; - info contains SkColorType and SkAlphaType supported by raster surface; - pixels is not nullptr; - rowBytes is large enough to contain info width pixels of SkColorType. - - Pixel buffer size should be info height times computed rowBytes. - Pixels are not initialized. - To access pixels after drawing, peekPixels() or readPixels(). - - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width and height must be greater than zero - @param pixels pointer to destination pixels buffer - @param rowBytes interval from one SkSurface row to the next - @param surfaceProps LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRasterDirect(const SkImageInfo& imageInfo, void* pixels, - size_t rowBytes, - const SkSurfaceProps* surfaceProps = nullptr); - - static sk_sp MakeRasterDirect(const SkPixmap& pm, - const SkSurfaceProps* props = nullptr) { - return MakeRasterDirect(pm.info(), pm.writable_addr(), pm.rowBytes(), props); - } - - /** Allocates raster SkSurface. SkCanvas returned by SkSurface draws directly into pixels. - releaseProc is called with pixels and context when SkSurface is deleted. - - SkSurface is returned if all parameters are valid. - Valid parameters include: - info dimensions are greater than zero; - info contains SkColorType and SkAlphaType supported by raster surface; - pixels is not nullptr; - rowBytes is large enough to contain info width pixels of SkColorType. - - Pixel buffer size should be info height times computed rowBytes. - Pixels are not initialized. - To access pixels after drawing, call flush() or peekPixels(). - - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width and height must be greater than zero - @param pixels pointer to destination pixels buffer - @param rowBytes interval from one SkSurface row to the next - @param releaseProc called when SkSurface is deleted; may be nullptr - @param context passed to releaseProc; may be nullptr - @param surfaceProps LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRasterDirectReleaseProc(const SkImageInfo& imageInfo, void* pixels, - size_t rowBytes, - void (*releaseProc)(void* pixels, void* context), - void* context, const SkSurfaceProps* surfaceProps = nullptr); - - /** Allocates raster SkSurface. SkCanvas returned by SkSurface draws directly into pixels. - Allocates and zeroes pixel memory. Pixel memory size is imageInfo.height() times - rowBytes, or times imageInfo.minRowBytes() if rowBytes is zero. - Pixel memory is deleted when SkSurface is deleted. - - SkSurface is returned if all parameters are valid. - Valid parameters include: - info dimensions are greater than zero; - info contains SkColorType and SkAlphaType supported by raster surface; - rowBytes is large enough to contain info width pixels of SkColorType, or is zero. - - If rowBytes is zero, a suitable value will be chosen internally. - - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width and height must be greater than zero - @param rowBytes interval from one SkSurface row to the next; may be zero - @param surfaceProps LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRaster(const SkImageInfo& imageInfo, size_t rowBytes, - const SkSurfaceProps* surfaceProps); - - /** Allocates raster SkSurface. SkCanvas returned by SkSurface draws directly into pixels. - Allocates and zeroes pixel memory. Pixel memory size is imageInfo.height() times - imageInfo.minRowBytes(). - Pixel memory is deleted when SkSurface is deleted. - - SkSurface is returned if all parameters are valid. - Valid parameters include: - info dimensions are greater than zero; - info contains SkColorType and SkAlphaType supported by raster surface. - - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width and height must be greater than zero - @param props LCD striping orientation and setting for device independent fonts; - may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRaster(const SkImageInfo& imageInfo, - const SkSurfaceProps* props = nullptr) { - return MakeRaster(imageInfo, 0, props); - } - - /** Allocates raster SkSurface. SkCanvas returned by SkSurface draws directly into pixels. - Allocates and zeroes pixel memory. Pixel memory size is height times width times - four. Pixel memory is deleted when SkSurface is deleted. - - Internally, sets SkImageInfo to width, height, native color type, and - kPremul_SkAlphaType. - - SkSurface is returned if width and height are greater than zero. - - Use to create SkSurface that matches SkPMColor, the native pixel arrangement on - the platform. SkSurface drawn to output device skips converting its pixel format. - - @param width pixel column count; must be greater than zero - @param height pixel row count; must be greater than zero - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRasterN32Premul(int width, int height, - const SkSurfaceProps* surfaceProps = nullptr); - - /** Caller data passed to RenderTarget/TextureReleaseProc; may be nullptr. */ - typedef void* ReleaseContext; - - /** User function called when supplied render target may be deleted. */ - typedef void (*RenderTargetReleaseProc)(ReleaseContext releaseContext); - - /** User function called when supplied texture may be deleted. */ - typedef void (*TextureReleaseProc)(ReleaseContext releaseContext); - - /** Wraps a GPU-backed texture into SkSurface. Caller must ensure the texture is - valid for the lifetime of returned SkSurface. If sampleCnt greater than zero, - creates an intermediate MSAA SkSurface which is used for drawing backendTexture. - - SkSurface is returned if all parameters are valid. backendTexture is valid if - its pixel configuration agrees with colorSpace and context; for instance, if - backendTexture has an sRGB configuration, then context must support sRGB, - and colorSpace must be present. Further, backendTexture width and height must - not exceed context capabilities, and the context must be able to support - back-end textures. - - Upon success textureReleaseProc is called when it is safe to delete the texture in the - backend API (accounting only for use of the texture by this surface). If SkSurface creation - fails textureReleaseProc is called before this function returns. - - If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. - - @param context GPU context - @param backendTexture texture residing on GPU - @param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing - @param colorSpace range of colors; may be nullptr - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @param textureReleaseProc function called when texture can be released - @param releaseContext state passed to textureReleaseProc - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeFromBackendTexture(GrRecordingContext* context, - const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, int sampleCnt, - SkColorType colorType, - sk_sp colorSpace, - const SkSurfaceProps* surfaceProps, - TextureReleaseProc textureReleaseProc = nullptr, - ReleaseContext releaseContext = nullptr); - - /** Wraps a GPU-backed buffer into SkSurface. Caller must ensure backendRenderTarget - is valid for the lifetime of returned SkSurface. - - SkSurface is returned if all parameters are valid. backendRenderTarget is valid if - its pixel configuration agrees with colorSpace and context; for instance, if - backendRenderTarget has an sRGB configuration, then context must support sRGB, - and colorSpace must be present. Further, backendRenderTarget width and height must - not exceed context capabilities, and the context must be able to support - back-end render targets. - - Upon success releaseProc is called when it is safe to delete the render target in the - backend API (accounting only for use of the render target by this surface). If SkSurface - creation fails releaseProc is called before this function returns. - - If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. - - @param context GPU context - @param backendRenderTarget GPU intermediate memory buffer - @param colorSpace range of colors - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @param releaseProc function called when backendRenderTarget can be released - @param releaseContext state passed to releaseProc - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeFromBackendRenderTarget(GrRecordingContext* context, - const GrBackendRenderTarget& backendRenderTarget, - GrSurfaceOrigin origin, - SkColorType colorType, - sk_sp colorSpace, - const SkSurfaceProps* surfaceProps, - RenderTargetReleaseProc releaseProc = nullptr, - ReleaseContext releaseContext = nullptr); - - /** Returns SkSurface on GPU indicated by context. Allocates memory for - pixels, based on the width, height, and SkColorType in SkImageInfo. budgeted - selects whether allocation for pixels is tracked by context. imageInfo - describes the pixel format in SkColorType, and transparency in - SkAlphaType, and color matching in SkColorSpace. - - sampleCount requests the number of samples per pixel. - Pass zero to disable multi-sample anti-aliasing. The request is rounded - up to the next supported count, or rounded down if it is larger than the - maximum supported count. - - surfaceOrigin pins either the top-left or the bottom-left corner to the origin. - - shouldCreateWithMips hints that SkImage returned by makeImageSnapshot() is mip map. - - If SK_SUPPORT_GPU is defined as zero, has no effect and returns nullptr. - - @param context GPU context - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace; - width, or height, or both, may be zero - @param sampleCount samples per pixel, or 0 to disable full scene anti-aliasing - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @param shouldCreateWithMips hint that SkSurface will host mip map images - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRenderTarget(GrRecordingContext* context, SkBudgeted budgeted, - const SkImageInfo& imageInfo, - int sampleCount, GrSurfaceOrigin surfaceOrigin, - const SkSurfaceProps* surfaceProps, - bool shouldCreateWithMips = false); - - /** Returns SkSurface on GPU indicated by context. Allocates memory for - pixels, based on the width, height, and SkColorType in SkImageInfo. budgeted - selects whether allocation for pixels is tracked by context. imageInfo - describes the pixel format in SkColorType, and transparency in - SkAlphaType, and color matching in SkColorSpace. - - sampleCount requests the number of samples per pixel. - Pass zero to disable multi-sample anti-aliasing. The request is rounded - up to the next supported count, or rounded down if it is larger than the - maximum supported count. - - SkSurface bottom-left corner is pinned to the origin. - - @param context GPU context - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width, or height, or both, may be zero - @param sampleCount samples per pixel, or 0 to disable multi-sample anti-aliasing - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRenderTarget(GrRecordingContext* context, SkBudgeted budgeted, - const SkImageInfo& imageInfo, int sampleCount, - const SkSurfaceProps* surfaceProps) { -#if SK_SUPPORT_GPU - return MakeRenderTarget(context, budgeted, imageInfo, sampleCount, - kBottomLeft_GrSurfaceOrigin, surfaceProps); -#else - // TODO(kjlubick, scroggo) Remove this once Android is updated. - return nullptr; -#endif - } - - /** Returns SkSurface on GPU indicated by context. Allocates memory for - pixels, based on the width, height, and SkColorType in SkImageInfo. budgeted - selects whether allocation for pixels is tracked by context. imageInfo - describes the pixel format in SkColorType, and transparency in - SkAlphaType, and color matching in SkColorSpace. - - SkSurface bottom-left corner is pinned to the origin. - - @param context GPU context - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of raster surface; width, or height, or both, may be zero - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRenderTarget(GrRecordingContext* context, SkBudgeted budgeted, - const SkImageInfo& imageInfo) { -#if SK_SUPPORT_GPU - if (!imageInfo.width() || !imageInfo.height()) { - return nullptr; - } - return MakeRenderTarget(context, budgeted, imageInfo, 0, kBottomLeft_GrSurfaceOrigin, - nullptr); -#else - // TODO(kjlubick, scroggo) Remove this once Android is updated. - return nullptr; -#endif - } - - /** Returns SkSurface on GPU indicated by context that is compatible with the provided - characterization. budgeted selects whether allocation for pixels is tracked by context. - - @param context GPU context - @param characterization description of the desired SkSurface - @return SkSurface if all parameters are valid; otherwise, nullptr - */ - static sk_sp MakeRenderTarget(GrRecordingContext* context, - const SkSurfaceCharacterization& characterization, - SkBudgeted budgeted); - - -#if defined(SK_BUILD_FOR_ANDROID) && __ANDROID_API__ >= 26 - /** Private. - Creates SkSurface from Android hardware buffer. - Returned SkSurface takes a reference on the buffer. The ref on the buffer will be released - when the SkSurface is destroyed and there is no pending work on the GPU involving the - buffer. - - Only available on Android, when __ANDROID_API__ is defined to be 26 or greater. - - Currently this is only supported for buffers that can be textured as well as rendered to. - In other words that must have both AHARDWAREBUFFER_USAGE_GPU_COLOR_OUTPUT and - AHARDWAREBUFFER_USAGE_GPU_SAMPLED_IMAGE usage bits. - - @param context GPU context - @param hardwareBuffer AHardwareBuffer Android hardware buffer - @param colorSpace range of colors; may be nullptr - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @param fromWindow Whether or not the AHardwareBuffer is part of an Android Window. - Currently only used with Vulkan backend. - @return created SkSurface, or nullptr - */ - static sk_sp MakeFromAHardwareBuffer(GrDirectContext* context, - AHardwareBuffer* hardwareBuffer, - GrSurfaceOrigin origin, - sk_sp colorSpace, - const SkSurfaceProps* surfaceProps -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - , bool fromWindow = false -#endif // SK_BUILD_FOR_ANDROID_FRAMEWORK - ); -#endif - -#ifdef SK_GRAPHITE_ENABLED - /** - * In Graphite, while clients hold a ref on an SkSurface, the backing gpu object does _not_ - * count against the budget. Once an SkSurface is freed, the backing gpu object may or may - * not become a scratch (i.e., reusable) resource but, if it does, it will be counted against - * the budget. - */ - static sk_sp MakeGraphite( - skgpu::graphite::Recorder*, - const SkImageInfo& imageInfo, - skgpu::graphite::Mipmapped = skgpu::graphite::Mipmapped::kNo, - const SkSurfaceProps* surfaceProps = nullptr); - - /** - * Wraps a GPU-backed texture in an SkSurface. Depending on the backend gpu API, the caller may - * be required to ensure the texture is valid for the lifetime of the returned SkSurface. The - * required lifetimes for the specific apis are: - * Metal: Skia will call retain on the underlying MTLTexture so the caller can drop it once - * this call returns. - * - * SkSurface is returned if all the parameters are valid. The backendTexture is valid if its - * format agrees with colorSpace and recorder; for instance, if backendTexture has an sRGB - * configuration, then the recorder must support sRGB, and colorSpace must be present. Further, - * backendTexture's width and height must not exceed the recorder's capabilities, and the - * recorder must be able to support the back-end texture. - */ - static sk_sp MakeGraphiteFromBackendTexture(skgpu::graphite::Recorder*, - const skgpu::graphite::BackendTexture&, - SkColorType colorType, - sk_sp colorSpace, - const SkSurfaceProps* props); - -#endif // SK_GRAPHITE_ENABLED - -#if SK_SUPPORT_GPU && defined(SK_METAL) - /** Creates SkSurface from CAMetalLayer. - Returned SkSurface takes a reference on the CAMetalLayer. The ref on the layer will be - released when the SkSurface is destroyed. - - Only available when Metal API is enabled. - - Will grab the current drawable from the layer and use its texture as a backendRT to - create a renderable surface. - - @param context GPU context - @param layer GrMTLHandle (expected to be a CAMetalLayer*) - @param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing - @param colorSpace range of colors; may be nullptr - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @param drawable Pointer to drawable to be filled in when this surface is - instantiated; may not be nullptr - @return created SkSurface, or nullptr - */ - static sk_sp MakeFromCAMetalLayer(GrRecordingContext* context, - GrMTLHandle layer, - GrSurfaceOrigin origin, - int sampleCnt, - SkColorType colorType, - sk_sp colorSpace, - const SkSurfaceProps* surfaceProps, - GrMTLHandle* drawable) - SK_API_AVAILABLE_CA_METAL_LAYER; - - /** Creates SkSurface from MTKView. - Returned SkSurface takes a reference on the MTKView. The ref on the layer will be - released when the SkSurface is destroyed. - - Only available when Metal API is enabled. - - Will grab the current drawable from the layer and use its texture as a backendRT to - create a renderable surface. - - @param context GPU context - @param layer GrMTLHandle (expected to be a MTKView*) - @param sampleCnt samples per pixel, or 0 to disable full scene anti-aliasing - @param colorSpace range of colors; may be nullptr - @param surfaceProps LCD striping orientation and setting for device independent - fonts; may be nullptr - @return created SkSurface, or nullptr - */ - static sk_sp MakeFromMTKView(GrRecordingContext* context, - GrMTLHandle mtkView, - GrSurfaceOrigin origin, - int sampleCnt, - SkColorType colorType, - sk_sp colorSpace, - const SkSurfaceProps* surfaceProps) - SK_API_AVAILABLE(macos(10.11), ios(9.0)); -#endif - - /** Is this surface compatible with the provided characterization? - - This method can be used to determine if an existing SkSurface is a viable destination - for an SkDeferredDisplayList. - - @param characterization The characterization for which a compatibility check is desired - @return true if this surface is compatible with the characterization; - false otherwise - */ - bool isCompatible(const SkSurfaceCharacterization& characterization) const; - - /** Returns SkSurface without backing pixels. Drawing to SkCanvas returned from SkSurface - has no effect. Calling makeImageSnapshot() on returned SkSurface returns nullptr. - - @param width one or greater - @param height one or greater - @return SkSurface if width and height are positive; otherwise, nullptr - - example: https://fiddle.skia.org/c/@Surface_MakeNull - */ - static sk_sp MakeNull(int width, int height); - - /** Returns pixel count in each row; may be zero or greater. - - @return number of pixel columns - */ - int width() const { return fWidth; } - - /** Returns pixel row count; may be zero or greater. - - @return number of pixel rows - */ - int height() const { return fHeight; } - - /** Returns an ImageInfo describing the surface. - */ - SkImageInfo imageInfo(); - - /** Returns unique value identifying the content of SkSurface. Returned value changes - each time the content changes. Content is changed by drawing, or by calling - notifyContentWillChange(). - - @return unique content identifier - - example: https://fiddle.skia.org/c/@Surface_notifyContentWillChange - */ - uint32_t generationID(); - - /** \enum SkSurface::ContentChangeMode - ContentChangeMode members are parameters to notifyContentWillChange(). - */ - enum ContentChangeMode { - kDiscard_ContentChangeMode, //!< discards surface on change - kRetain_ContentChangeMode, //!< preserves surface on change - }; - - /** Notifies that SkSurface contents will be changed by code outside of Skia. - Subsequent calls to generationID() return a different value. - - TODO: Can kRetain_ContentChangeMode be deprecated? - - example: https://fiddle.skia.org/c/@Surface_notifyContentWillChange - */ - void notifyContentWillChange(ContentChangeMode mode); - - /** Returns the recording context being used by the SkSurface. - - @return the recording context, if available; nullptr otherwise - */ - GrRecordingContext* recordingContext(); - - /** Returns the recorder being used by the SkSurface. - - @return the recorder, if available; nullptr otherwise - */ - skgpu::graphite::Recorder* recorder(); - -#if SK_SUPPORT_GPU - enum BackendHandleAccess { - kFlushRead_BackendHandleAccess, //!< back-end object is readable - kFlushWrite_BackendHandleAccess, //!< back-end object is writable - kDiscardWrite_BackendHandleAccess, //!< back-end object must be overwritten - }; - - /** Deprecated. - */ - static const BackendHandleAccess kFlushRead_TextureHandleAccess = - kFlushRead_BackendHandleAccess; - - /** Deprecated. - */ - static const BackendHandleAccess kFlushWrite_TextureHandleAccess = - kFlushWrite_BackendHandleAccess; - - /** Deprecated. - */ - static const BackendHandleAccess kDiscardWrite_TextureHandleAccess = - kDiscardWrite_BackendHandleAccess; - - /** Retrieves the back-end texture. If SkSurface has no back-end texture, an invalid - object is returned. Call GrBackendTexture::isValid to determine if the result - is valid. - - The returned GrBackendTexture should be discarded if the SkSurface is drawn to or deleted. - - @return GPU texture reference; invalid on failure - */ - GrBackendTexture getBackendTexture(BackendHandleAccess backendHandleAccess); - - /** Retrieves the back-end render target. If SkSurface has no back-end render target, an invalid - object is returned. Call GrBackendRenderTarget::isValid to determine if the result - is valid. - - The returned GrBackendRenderTarget should be discarded if the SkSurface is drawn to - or deleted. - - @return GPU render target reference; invalid on failure - */ - GrBackendRenderTarget getBackendRenderTarget(BackendHandleAccess backendHandleAccess); - - /** If the surface was made via MakeFromBackendTexture then it's backing texture may be - substituted with a different texture. The contents of the previous backing texture are - copied into the new texture. SkCanvas state is preserved. The original sample count is - used. The GrBackendFormat and dimensions of replacement texture must match that of - the original. - - Upon success textureReleaseProc is called when it is safe to delete the texture in the - backend API (accounting only for use of the texture by this surface). If SkSurface creation - fails textureReleaseProc is called before this function returns. - - @param backendTexture the new backing texture for the surface - @param mode Retain or discard current Content - @param textureReleaseProc function called when texture can be released - @param releaseContext state passed to textureReleaseProc - */ - bool replaceBackendTexture(const GrBackendTexture& backendTexture, - GrSurfaceOrigin origin, - ContentChangeMode mode = kRetain_ContentChangeMode, - TextureReleaseProc textureReleaseProc = nullptr, - ReleaseContext releaseContext = nullptr); -#endif - - /** Returns SkCanvas that draws into SkSurface. Subsequent calls return the same SkCanvas. - SkCanvas returned is managed and owned by SkSurface, and is deleted when SkSurface - is deleted. - - @return drawing SkCanvas for SkSurface - - example: https://fiddle.skia.org/c/@Surface_getCanvas - */ - SkCanvas* getCanvas(); - - /** Returns SkCapabilities that describes the capabilities of the SkSurface's device. - - @return SkCapabilities of SkSurface's device. - */ - sk_sp capabilities(); - - /** Returns a compatible SkSurface, or nullptr. Returned SkSurface contains - the same raster, GPU, or null properties as the original. Returned SkSurface - does not share the same pixels. - - Returns nullptr if imageInfo width or height are zero, or if imageInfo - is incompatible with SkSurface. - - @param imageInfo width, height, SkColorType, SkAlphaType, SkColorSpace, - of SkSurface; width and height must be greater than zero - @return compatible SkSurface or nullptr - - example: https://fiddle.skia.org/c/@Surface_makeSurface - */ - sk_sp makeSurface(const SkImageInfo& imageInfo); - - /** Calls makeSurface(ImageInfo) with the same ImageInfo as this surface, but with the - * specified width and height. - */ - sk_sp makeSurface(int width, int height); - - /** Returns SkImage capturing SkSurface contents. Subsequent drawing to SkSurface contents - are not captured. SkImage allocation is accounted for if SkSurface was created with - SkBudgeted::kYes. - - @return SkImage initialized with SkSurface contents - - example: https://fiddle.skia.org/c/@Surface_makeImageSnapshot - */ - sk_sp makeImageSnapshot(); - - /** - * Like the no-parameter version, this returns an image of the current surface contents. - * This variant takes a rectangle specifying the subset of the surface that is of interest. - * These bounds will be sanitized before being used. - * - If bounds extends beyond the surface, it will be trimmed to just the intersection of - * it and the surface. - * - If bounds does not intersect the surface, then this returns nullptr. - * - If bounds == the surface, then this is the same as calling the no-parameter variant. - - example: https://fiddle.skia.org/c/@Surface_makeImageSnapshot_2 - */ - sk_sp makeImageSnapshot(const SkIRect& bounds); - - /** Draws SkSurface contents to canvas, with its top-left corner at (x, y). - - If SkPaint paint is not nullptr, apply SkColorFilter, alpha, SkImageFilter, and SkBlendMode. - - @param canvas SkCanvas drawn into - @param x horizontal offset in SkCanvas - @param y vertical offset in SkCanvas - @param sampling what technique to use when sampling the surface pixels - @param paint SkPaint containing SkBlendMode, SkColorFilter, SkImageFilter, - and so on; or nullptr - - example: https://fiddle.skia.org/c/@Surface_draw - */ - void draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkSamplingOptions& sampling, - const SkPaint* paint); - - void draw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint = nullptr) { - this->draw(canvas, x, y, SkSamplingOptions(), paint); - } - - /** Copies SkSurface pixel address, row bytes, and SkImageInfo to SkPixmap, if address - is available, and returns true. If pixel address is not available, return - false and leave SkPixmap unchanged. - - pixmap contents become invalid on any future change to SkSurface. - - @param pixmap storage for pixel state if pixels are readable; otherwise, ignored - @return true if SkSurface has direct access to pixels - - example: https://fiddle.skia.org/c/@Surface_peekPixels - */ - bool peekPixels(SkPixmap* pixmap); - - /** Copies SkRect of pixels to dst. - - Source SkRect corners are (srcX, srcY) and SkSurface (width(), height()). - Destination SkRect corners are (0, 0) and (dst.width(), dst.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to dst.colorType() and dst.alphaType() if required. - - Pixels are readable when SkSurface is raster, or backed by a GPU. - - The destination pixel storage must be allocated by the caller. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. dst contents outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down destination. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkPixmap pixels could not be allocated. - - dst.rowBytes() is too small to contain one row of pixels. - - @param dst storage for pixels copied from SkSurface - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - - example: https://fiddle.skia.org/c/@Surface_readPixels - */ - bool readPixels(const SkPixmap& dst, int srcX, int srcY); - - /** Copies SkRect of pixels from SkCanvas into dstPixels. - - Source SkRect corners are (srcX, srcY) and SkSurface (width(), height()). - Destination SkRect corners are (0, 0) and (dstInfo.width(), dstInfo.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to dstInfo.colorType() and dstInfo.alphaType() if required. - - Pixels are readable when SkSurface is raster, or backed by a GPU. - - The destination pixel storage must be allocated by the caller. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. dstPixels contents outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down destination. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkSurface pixels could not be converted to dstInfo.colorType() or dstInfo.alphaType(). - - dstRowBytes is too small to contain one row of pixels. - - @param dstInfo width, height, SkColorType, and SkAlphaType of dstPixels - @param dstPixels storage for pixels; dstInfo.height() times dstRowBytes, or larger - @param dstRowBytes size of one destination row; dstInfo.width() times pixel size, or larger - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - */ - bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes, - int srcX, int srcY); - - /** Copies SkRect of pixels from SkSurface into bitmap. - - Source SkRect corners are (srcX, srcY) and SkSurface (width(), height()). - Destination SkRect corners are (0, 0) and (bitmap.width(), bitmap.height()). - Copies each readable pixel intersecting both rectangles, without scaling, - converting to bitmap.colorType() and bitmap.alphaType() if required. - - Pixels are readable when SkSurface is raster, or backed by a GPU. - - The destination pixel storage must be allocated by the caller. - - Pixel values are converted only if SkColorType and SkAlphaType - do not match. Only pixels within both source and destination rectangles - are copied. dst contents outside SkRect intersection are unchanged. - - Pass negative values for srcX or srcY to offset pixels across or down destination. - - Does not copy, and returns false if: - - Source and destination rectangles do not intersect. - - SkSurface pixels could not be converted to dst.colorType() or dst.alphaType(). - - dst pixels could not be allocated. - - dst.rowBytes() is too small to contain one row of pixels. - - @param dst storage for pixels copied from SkSurface - @param srcX offset into readable pixels on x-axis; may be negative - @param srcY offset into readable pixels on y-axis; may be negative - @return true if pixels were copied - - example: https://fiddle.skia.org/c/@Surface_readPixels_3 - */ - bool readPixels(const SkBitmap& dst, int srcX, int srcY); - - using AsyncReadResult = SkImage::AsyncReadResult; - - /** Client-provided context that is passed to client-provided ReadPixelsContext. */ - using ReadPixelsContext = void*; - - /** Client-provided callback to asyncRescaleAndReadPixels() or - asyncRescaleAndReadPixelsYUV420() that is called when read result is ready or on failure. - */ - using ReadPixelsCallback = void(ReadPixelsContext, std::unique_ptr); - - /** Controls the gamma that rescaling occurs in for asyncRescaleAndReadPixels() and - asyncRescaleAndReadPixelsYUV420(). - */ - using RescaleGamma = SkImage::RescaleGamma; - using RescaleMode = SkImage::RescaleMode; - - /** Makes surface pixel data available to caller, possibly asynchronously. - - Currently asynchronous reads are only supported on the GPU backend and only when the - underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all - other cases this operates synchronously. - - Data is read from the source sub-rectangle, then converted to the color space, color type, - and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the surface - causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing pixel data in the requested color type, alpha type, and color - space. The AsyncReadResult will have count() == 1. Upon failure the callback is called - with nullptr for AsyncReadResult. For a GPU surface this flushes work but a submit must - occur to guarantee a finite time before the callback is called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the - SkSurface is GPU-backed the data is immediately invalidated if the context is abandoned - or destroyed. - - @param info info of the requested pixels - @param srcRect subrectangle of surface to read - @param callback function to call with result of the read - @param context passed to callback - */ - void asyncReadPixels(const SkImageInfo& info, - const SkIRect& srcRect, - ReadPixelsCallback callback, - ReadPixelsContext context); - - /** Makes surface pixel data available to caller, possibly asynchronously. It can also rescale - the surface pixels. - - Currently asynchronous reads are only supported on the GPU backend and only when the - underlying 3D API supports transfer buffers and CPU/GPU synchronization primitives. In all - other cases this operates synchronously. - - Data is read from the source sub-rectangle, is optionally converted to a linear gamma, is - rescaled to the size indicated by 'info', is then converted to the color space, color type, - and alpha type of 'info'. A 'srcRect' that is not contained by the bounds of the surface - causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing pixel data in the requested color type, alpha type, and color - space. The AsyncReadResult will have count() == 1. Upon failure the callback is called - with nullptr for AsyncReadResult. For a GPU surface this flushes work but a submit must - occur to guarantee a finite time before the callback is called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the - SkSurface is GPU-backed the data is immediately invalidated if the context is abandoned - or destroyed. - - @param info info of the requested pixels - @param srcRect subrectangle of surface to read - @param rescaleGamma controls whether rescaling is done in the surface's gamma or whether - the source data is transformed to a linear gamma before rescaling. - @param rescaleMode controls the technique of the rescaling - @param callback function to call with result of the read - @param context passed to callback - */ - void asyncRescaleAndReadPixels(const SkImageInfo& info, - const SkIRect& srcRect, - RescaleGamma rescaleGamma, - RescaleMode rescaleMode, - ReadPixelsCallback callback, - ReadPixelsContext context); - - /** - Similar to asyncRescaleAndReadPixels but performs an additional conversion to YUV. The - RGB->YUV conversion is controlled by 'yuvColorSpace'. The YUV data is returned as three - planes ordered y, u, v. The u and v planes are half the width and height of the resized - rectangle. The y, u, and v values are single bytes. Currently this fails if 'dstSize' - width and height are not even. A 'srcRect' that is not contained by the bounds of the - surface causes failure. - - When the pixel data is ready the caller's ReadPixelsCallback is called with a - AsyncReadResult containing the planar data. The AsyncReadResult will have count() == 3. - Upon failure the callback is called with nullptr for AsyncReadResult. For a GPU surface this - flushes work but a submit must occur to guarantee a finite time before the callback is - called. - - The data is valid for the lifetime of AsyncReadResult with the exception that if the - SkSurface is GPU-backed the data is immediately invalidated if the context is abandoned - or destroyed. - - @param yuvColorSpace The transformation from RGB to YUV. Applied to the resized image - after it is converted to dstColorSpace. - @param dstColorSpace The color space to convert the resized image to, after rescaling. - @param srcRect The portion of the surface to rescale and convert to YUV planes. - @param dstSize The size to rescale srcRect to - @param rescaleGamma controls whether rescaling is done in the surface's gamma or whether - the source data is transformed to a linear gamma before rescaling. - @param rescaleMode controls the sampling technique of the rescaling - @param callback function to call with the planar read result - @param context passed to callback - */ - void asyncRescaleAndReadPixelsYUV420(SkYUVColorSpace yuvColorSpace, - sk_sp dstColorSpace, - const SkIRect& srcRect, - const SkISize& dstSize, - RescaleGamma rescaleGamma, - RescaleMode rescaleMode, - ReadPixelsCallback callback, - ReadPixelsContext context); - - /** Copies SkRect of pixels from the src SkPixmap to the SkSurface. - - Source SkRect corners are (0, 0) and (src.width(), src.height()). - Destination SkRect corners are (dstX, dstY) and - (dstX + Surface width(), dstY + Surface height()). - - Copies each readable pixel intersecting both rectangles, without scaling, - converting to SkSurface colorType() and SkSurface alphaType() if required. - - @param src storage for pixels to copy to SkSurface - @param dstX x-axis position relative to SkSurface to begin copy; may be negative - @param dstY y-axis position relative to SkSurface to begin copy; may be negative - - example: https://fiddle.skia.org/c/@Surface_writePixels - */ - void writePixels(const SkPixmap& src, int dstX, int dstY); - - /** Copies SkRect of pixels from the src SkBitmap to the SkSurface. - - Source SkRect corners are (0, 0) and (src.width(), src.height()). - Destination SkRect corners are (dstX, dstY) and - (dstX + Surface width(), dstY + Surface height()). - - Copies each readable pixel intersecting both rectangles, without scaling, - converting to SkSurface colorType() and SkSurface alphaType() if required. - - @param src storage for pixels to copy to SkSurface - @param dstX x-axis position relative to SkSurface to begin copy; may be negative - @param dstY y-axis position relative to SkSurface to begin copy; may be negative - - example: https://fiddle.skia.org/c/@Surface_writePixels_2 - */ - void writePixels(const SkBitmap& src, int dstX, int dstY); - - /** Returns SkSurfaceProps for surface. - - @return LCD striping orientation and setting for device independent fonts - */ - const SkSurfaceProps& props() const { return fProps; } - - /** Call to ensure all reads/writes of the surface have been issued to the underlying 3D API. - Skia will correctly order its own draws and pixel operations. This must to be used to ensure - correct ordering when the surface backing store is accessed outside Skia (e.g. direct use of - the 3D API or a windowing system). GrDirectContext has additional flush and submit methods - that apply to all surfaces and images created from a GrDirectContext. This is equivalent to - calling SkSurface::flush with a default GrFlushInfo followed by - GrDirectContext::submit(syncCpu). - */ - void flushAndSubmit(bool syncCpu = false); - - enum class BackendSurfaceAccess { - kNoAccess, //!< back-end object will not be used by client - kPresent, //!< back-end surface will be used for presenting to screen - }; - -#if SK_SUPPORT_GPU - /** If a surface is GPU texture backed, is being drawn with MSAA, and there is a resolve - texture, this call will insert a resolve command into the stream of gpu commands. In order - for the resolve to actually have an effect, the work still needs to be flushed and submitted - to the GPU after recording the resolve command. If a resolve is not supported or the - SkSurface has no dirty work to resolve, then this call is a no-op. - - This call is most useful when the SkSurface is created by wrapping a single sampled gpu - texture, but asking Skia to render with MSAA. If the client wants to use the wrapped texture - outside of Skia, the only way to trigger a resolve is either to call this command or use - SkSurface::flush. - */ - void resolveMSAA(); - - /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface - MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent - to the gpu. Some specific API details: - GL: Commands are actually sent to the driver, but glFlush is never called. Thus some - sync objects from the flush will not be valid until a submission occurs. - - Vulkan/Metal/D3D/Dawn: Commands are recorded to the backend APIs corresponding command - buffer or encoder objects. However, these objects are not sent to the gpu until a - submission occurs. - - The work that is submitted to the GPU will be dependent on the BackendSurfaceAccess that is - passed in. - - If BackendSurfaceAccess::kNoAccess is passed in all commands will be issued to the GPU. - - If BackendSurfaceAccess::kPresent is passed in and the backend API is not Vulkan, it is - treated the same as kNoAccess. If the backend API is Vulkan, the VkImage that backs the - SkSurface will be transferred back to its original queue. If the SkSurface was created by - wrapping a VkImage, the queue will be set to the queue which was originally passed in on - the GrVkImageInfo. Additionally, if the original queue was not external or foreign the - layout of the VkImage will be set to VK_IMAGE_LAYOUT_PRESENT_SRC_KHR. - - The GrFlushInfo describes additional options to flush. Please see documentation at - GrFlushInfo for more info. - - If the return is GrSemaphoresSubmitted::kYes, only initialized GrBackendSemaphores will be - submitted to the gpu during the next submit call (it is possible Skia failed to create a - subset of the semaphores). The client should not wait on these semaphores until after submit - has been called, but must keep them alive until then. If a submit flag was passed in with - the flush these valid semaphores can we waited on immediately. If this call returns - GrSemaphoresSubmitted::kNo, the GPU backend will not submit any semaphores to be signaled on - the GPU. Thus the client should not have the GPU wait on any of the semaphores passed in - with the GrFlushInfo. Regardless of whether semaphores were submitted to the GPU or not, the - client is still responsible for deleting any initialized semaphores. - Regardless of semaphore submission the context will still be flushed. It should be - emphasized that a return value of GrSemaphoresSubmitted::kNo does not mean the flush did not - happen. It simply means there were no semaphores submitted to the GPU. A caller should only - take this as a failure if they passed in semaphores to be submitted. - - Pending surface commands are flushed regardless of the return result. - - @param access type of access the call will do on the backend object after flush - @param info flush options - */ - GrSemaphoresSubmitted flush(BackendSurfaceAccess access, const GrFlushInfo& info); - - /** Issues pending SkSurface commands to the GPU-backed API objects and resolves any SkSurface - MSAA. A call to GrDirectContext::submit is always required to ensure work is actually sent - to the gpu. Some specific API details: - GL: Commands are actually sent to the driver, but glFlush is never called. Thus some - sync objects from the flush will not be valid until a submission occurs. - - Vulkan/Metal/D3D/Dawn: Commands are recorded to the backend APIs corresponding command - buffer or encoder objects. However, these objects are not sent to the gpu until a - submission occurs. - - The GrFlushInfo describes additional options to flush. Please see documentation at - GrFlushInfo for more info. - - If a skgpu::MutableTextureState is passed in, at the end of the flush we will transition - the surface to be in the state requested by the skgpu::MutableTextureState. If the surface - (or SkImage or GrBackendSurface wrapping the same backend object) is used again after this - flush the state may be changed and no longer match what is requested here. This is often - used if the surface will be used for presenting or external use and the client wants backend - object to be prepped for that use. A finishedProc or semaphore on the GrFlushInfo will also - include the work for any requested state change. - - If the backend API is Vulkan, the caller can set the skgpu::MutableTextureState's - VkImageLayout to VK_IMAGE_LAYOUT_UNDEFINED or queueFamilyIndex to VK_QUEUE_FAMILY_IGNORED to - tell Skia to not change those respective states. - - If the return is GrSemaphoresSubmitted::kYes, only initialized GrBackendSemaphores will be - submitted to the gpu during the next submit call (it is possible Skia failed to create a - subset of the semaphores). The client should not wait on these semaphores until after submit - has been called, but must keep them alive until then. If a submit flag was passed in with - the flush these valid semaphores can we waited on immediately. If this call returns - GrSemaphoresSubmitted::kNo, the GPU backend will not submit any semaphores to be signaled on - the GPU. Thus the client should not have the GPU wait on any of the semaphores passed in - with the GrFlushInfo. Regardless of whether semaphores were submitted to the GPU or not, the - client is still responsible for deleting any initialized semaphores. - Regardleess of semaphore submission the context will still be flushed. It should be - emphasized that a return value of GrSemaphoresSubmitted::kNo does not mean the flush did not - happen. It simply means there were no semaphores submitted to the GPU. A caller should only - take this as a failure if they passed in semaphores to be submitted. - - Pending surface commands are flushed regardless of the return result. - - @param info flush options - @param access optional state change request after flush - */ - GrSemaphoresSubmitted flush(const GrFlushInfo& info, - const skgpu::MutableTextureState* newState = nullptr); -#endif // SK_SUPPORT_GPU - - void flush(); - - /** Inserts a list of GPU semaphores that the current GPU-backed API must wait on before - executing any more commands on the GPU for this surface. If this call returns false, then - the GPU back-end will not wait on any passed in semaphores, and the client will still own - the semaphores, regardless of the value of deleteSemaphoresAfterWait. - - If deleteSemaphoresAfterWait is false then Skia will not delete the semaphores. In this case - it is the client's responsibility to not destroy or attempt to reuse the semaphores until it - knows that Skia has finished waiting on them. This can be done by using finishedProcs - on flush calls. - - @param numSemaphores size of waitSemaphores array - @param waitSemaphores array of semaphore containers - @paramm deleteSemaphoresAfterWait who owns and should delete the semaphores - @return true if GPU is waiting on semaphores - */ - bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores, - bool deleteSemaphoresAfterWait = true); - - /** Initializes SkSurfaceCharacterization that can be used to perform GPU back-end - processing in a separate thread. Typically this is used to divide drawing - into multiple tiles. SkDeferredDisplayListRecorder records the drawing commands - for each tile. - - Return true if SkSurface supports characterization. raster surface returns false. - - @param characterization properties for parallel drawing - @return true if supported - - example: https://fiddle.skia.org/c/@Surface_characterize - */ - bool characterize(SkSurfaceCharacterization* characterization) const; - - /** Draws the deferred display list created via a SkDeferredDisplayListRecorder. - If the deferred display list is not compatible with this SkSurface, the draw is skipped - and false is return. - - The xOffset and yOffset parameters are experimental and, if not both zero, will cause - the draw to be ignored. - When implemented, if xOffset or yOffset are non-zero, the DDL will be drawn offset by that - amount into the surface. - - @param deferredDisplayList drawing commands - @param xOffset x-offset at which to draw the DDL - @param yOffset y-offset at which to draw the DDL - @return false if deferredDisplayList is not compatible - - example: https://fiddle.skia.org/c/@Surface_draw_2 - */ - bool draw(sk_sp deferredDisplayList, - int xOffset = 0, - int yOffset = 0); - -protected: - SkSurface(int width, int height, const SkSurfaceProps* surfaceProps); - SkSurface(const SkImageInfo& imageInfo, const SkSurfaceProps* surfaceProps); - - // called by subclass if their contents have changed - void dirtyGenerationID() { - fGenerationID = 0; - } - -private: - const SkSurfaceProps fProps; - const int fWidth; - const int fHeight; - uint32_t fGenerationID; - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceCharacterization.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceCharacterization.h deleted file mode 100644 index 91b10e87bf7a98..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceCharacterization.h +++ /dev/null @@ -1,263 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSurfaceCharacterization_DEFINED -#define SkSurfaceCharacterization_DEFINED - - -#include "include/core/SkColorSpace.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSurfaceProps.h" - -class SkColorSpace; - - -#if SK_SUPPORT_GPU -#include "include/gpu/GrBackendSurface.h" -#include "include/gpu/GrContextThreadSafeProxy.h" -#include "include/gpu/GrTypes.h" - -/** \class SkSurfaceCharacterization - A surface characterization contains all the information Ganesh requires to makes its internal - rendering decisions. When passed into a SkDeferredDisplayListRecorder it will copy the - data and pass it on to the SkDeferredDisplayList if/when it is created. Note that both of - those objects (the Recorder and the DisplayList) will take a ref on the - GrContextThreadSafeProxy and SkColorSpace objects. -*/ -class SK_API SkSurfaceCharacterization { -public: - enum class Textureable : bool { kNo = false, kYes = true }; - enum class MipMapped : bool { kNo = false, kYes = true }; - enum class UsesGLFBO0 : bool { kNo = false, kYes = true }; - // This flag indicates that the backing VkImage for this Vulkan surface will have the - // VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT set. This bit allows skia to handle advanced blends - // more optimally in a shader by being able to directly read the dst values. - enum class VkRTSupportsInputAttachment : bool { kNo = false, kYes = true }; - // This flag indicates if the surface is wrapping a raw Vulkan secondary command buffer. - enum class VulkanSecondaryCBCompatible : bool { kNo = false, kYes = true }; - - SkSurfaceCharacterization() - : fCacheMaxResourceBytes(0) - , fOrigin(kBottomLeft_GrSurfaceOrigin) - , fSampleCnt(0) - , fIsTextureable(Textureable::kYes) - , fIsMipMapped(MipMapped::kYes) - , fUsesGLFBO0(UsesGLFBO0::kNo) - , fVulkanSecondaryCBCompatible(VulkanSecondaryCBCompatible::kNo) - , fIsProtected(GrProtected::kNo) - , fSurfaceProps(0, kUnknown_SkPixelGeometry) { - } - - SkSurfaceCharacterization(SkSurfaceCharacterization&&) = default; - SkSurfaceCharacterization& operator=(SkSurfaceCharacterization&&) = default; - - SkSurfaceCharacterization(const SkSurfaceCharacterization&) = default; - SkSurfaceCharacterization& operator=(const SkSurfaceCharacterization& other) = default; - bool operator==(const SkSurfaceCharacterization& other) const; - bool operator!=(const SkSurfaceCharacterization& other) const { - return !(*this == other); - } - - /* - * Return a new surface characterization with the only difference being a different width - * and height - */ - SkSurfaceCharacterization createResized(int width, int height) const; - - /* - * Return a new surface characterization with only a replaced color space - */ - SkSurfaceCharacterization createColorSpace(sk_sp) const; - - /* - * Return a new surface characterization with the backend format replaced. A colorType - * must also be supplied to indicate the interpretation of the new format. - */ - SkSurfaceCharacterization createBackendFormat(SkColorType colorType, - const GrBackendFormat& backendFormat) const; - - /* - * Return a new surface characterization with just a different use of FBO0 (in GL) - */ - SkSurfaceCharacterization createFBO0(bool usesGLFBO0) const; - - GrContextThreadSafeProxy* contextInfo() const { return fContextInfo.get(); } - sk_sp refContextInfo() const { return fContextInfo; } - size_t cacheMaxResourceBytes() const { return fCacheMaxResourceBytes; } - - bool isValid() const { return kUnknown_SkColorType != fImageInfo.colorType(); } - - const SkImageInfo& imageInfo() const { return fImageInfo; } - const GrBackendFormat& backendFormat() const { return fBackendFormat; } - GrSurfaceOrigin origin() const { return fOrigin; } - SkISize dimensions() const { return fImageInfo.dimensions(); } - int width() const { return fImageInfo.width(); } - int height() const { return fImageInfo.height(); } - SkColorType colorType() const { return fImageInfo.colorType(); } - int sampleCount() const { return fSampleCnt; } - bool isTextureable() const { return Textureable::kYes == fIsTextureable; } - bool isMipMapped() const { return MipMapped::kYes == fIsMipMapped; } - bool usesGLFBO0() const { return UsesGLFBO0::kYes == fUsesGLFBO0; } - bool vkRTSupportsInputAttachment() const { - return VkRTSupportsInputAttachment::kYes == fVkRTSupportsInputAttachment; - } - bool vulkanSecondaryCBCompatible() const { - return VulkanSecondaryCBCompatible::kYes == fVulkanSecondaryCBCompatible; - } - GrProtected isProtected() const { return fIsProtected; } - SkColorSpace* colorSpace() const { return fImageInfo.colorSpace(); } - sk_sp refColorSpace() const { return fImageInfo.refColorSpace(); } - const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; } - - // Is the provided backend texture compatible with this surface characterization? - bool isCompatible(const GrBackendTexture&) const; - -private: - friend class SkSurface_Gpu; // for 'set' & 'config' - friend class GrVkSecondaryCBDrawContext; // for 'set' & 'config' - friend class GrContextThreadSafeProxy; // for private ctor - friend class SkDeferredDisplayListRecorder; // for 'config' - friend class SkSurface; // for 'config' - - SkDEBUGCODE(void validate() const;) - - SkSurfaceCharacterization(sk_sp contextInfo, - size_t cacheMaxResourceBytes, - const SkImageInfo& ii, - const GrBackendFormat& backendFormat, - GrSurfaceOrigin origin, - int sampleCnt, - Textureable isTextureable, - MipMapped isMipMapped, - UsesGLFBO0 usesGLFBO0, - VkRTSupportsInputAttachment vkRTSupportsInputAttachment, - VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible, - GrProtected isProtected, - const SkSurfaceProps& surfaceProps) - : fContextInfo(std::move(contextInfo)) - , fCacheMaxResourceBytes(cacheMaxResourceBytes) - , fImageInfo(ii) - , fBackendFormat(backendFormat) - , fOrigin(origin) - , fSampleCnt(sampleCnt) - , fIsTextureable(isTextureable) - , fIsMipMapped(isMipMapped) - , fUsesGLFBO0(usesGLFBO0) - , fVkRTSupportsInputAttachment(vkRTSupportsInputAttachment) - , fVulkanSecondaryCBCompatible(vulkanSecondaryCBCompatible) - , fIsProtected(isProtected) - , fSurfaceProps(surfaceProps) { - if (fSurfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) { - // Dynamic MSAA is not currently supported with DDL. - *this = {}; - } - SkDEBUGCODE(this->validate()); - } - - void set(sk_sp contextInfo, - size_t cacheMaxResourceBytes, - const SkImageInfo& ii, - const GrBackendFormat& backendFormat, - GrSurfaceOrigin origin, - int sampleCnt, - Textureable isTextureable, - MipMapped isMipMapped, - UsesGLFBO0 usesGLFBO0, - VkRTSupportsInputAttachment vkRTSupportsInputAttachment, - VulkanSecondaryCBCompatible vulkanSecondaryCBCompatible, - GrProtected isProtected, - const SkSurfaceProps& surfaceProps) { - if (surfaceProps.flags() & SkSurfaceProps::kDynamicMSAA_Flag) { - // Dynamic MSAA is not currently supported with DDL. - *this = {}; - } else { - fContextInfo = contextInfo; - fCacheMaxResourceBytes = cacheMaxResourceBytes; - - fImageInfo = ii; - fBackendFormat = backendFormat; - fOrigin = origin; - fSampleCnt = sampleCnt; - fIsTextureable = isTextureable; - fIsMipMapped = isMipMapped; - fUsesGLFBO0 = usesGLFBO0; - fVkRTSupportsInputAttachment = vkRTSupportsInputAttachment; - fVulkanSecondaryCBCompatible = vulkanSecondaryCBCompatible; - fIsProtected = isProtected; - fSurfaceProps = surfaceProps; - } - SkDEBUGCODE(this->validate()); - } - - sk_sp fContextInfo; - size_t fCacheMaxResourceBytes; - - SkImageInfo fImageInfo; - GrBackendFormat fBackendFormat; - GrSurfaceOrigin fOrigin; - int fSampleCnt; - Textureable fIsTextureable; - MipMapped fIsMipMapped; - UsesGLFBO0 fUsesGLFBO0; - VkRTSupportsInputAttachment fVkRTSupportsInputAttachment; - VulkanSecondaryCBCompatible fVulkanSecondaryCBCompatible; - GrProtected fIsProtected; - SkSurfaceProps fSurfaceProps; -}; - -#else// !SK_SUPPORT_GPU -class GrBackendFormat; - -class SK_API SkSurfaceCharacterization { -public: - SkSurfaceCharacterization() : fSurfaceProps(0, kUnknown_SkPixelGeometry) { } - - SkSurfaceCharacterization createResized(int width, int height) const { - return *this; - } - - SkSurfaceCharacterization createColorSpace(sk_sp) const { - return *this; - } - - SkSurfaceCharacterization createBackendFormat(SkColorType, const GrBackendFormat&) const { - return *this; - } - - SkSurfaceCharacterization createFBO0(bool usesGLFBO0) const { - return *this; - } - - bool operator==(const SkSurfaceCharacterization& other) const { return false; } - bool operator!=(const SkSurfaceCharacterization& other) const { - return !(*this == other); - } - - size_t cacheMaxResourceBytes() const { return 0; } - - bool isValid() const { return false; } - - int width() const { return 0; } - int height() const { return 0; } - int stencilCount() const { return 0; } - bool isTextureable() const { return false; } - bool isMipMapped() const { return false; } - bool usesGLFBO0() const { return false; } - bool vkRTSupportsAttachmentInput() const { return false; } - bool vulkanSecondaryCBCompatible() const { return false; } - SkColorSpace* colorSpace() const { return nullptr; } - sk_sp refColorSpace() const { return nullptr; } - const SkSurfaceProps& surfaceProps()const { return fSurfaceProps; } - -private: - SkSurfaceProps fSurfaceProps; -}; - -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceProps.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceProps.h deleted file mode 100644 index 7b07554e5be341..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSurfaceProps.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSurfaceProps_DEFINED -#define SkSurfaceProps_DEFINED - -#include "include/core/SkTypes.h" - -/** - * Description of how the LCD strips are arranged for each pixel. If this is unknown, or the - * pixels are meant to be "portable" and/or transformed before showing (e.g. rotated, scaled) - * then use kUnknown_SkPixelGeometry. - */ -enum SkPixelGeometry { - kUnknown_SkPixelGeometry, - kRGB_H_SkPixelGeometry, - kBGR_H_SkPixelGeometry, - kRGB_V_SkPixelGeometry, - kBGR_V_SkPixelGeometry, -}; - -// Returns true iff geo is a known geometry and is RGB. -static inline bool SkPixelGeometryIsRGB(SkPixelGeometry geo) { - return kRGB_H_SkPixelGeometry == geo || kRGB_V_SkPixelGeometry == geo; -} - -// Returns true iff geo is a known geometry and is BGR. -static inline bool SkPixelGeometryIsBGR(SkPixelGeometry geo) { - return kBGR_H_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo; -} - -// Returns true iff geo is a known geometry and is horizontal. -static inline bool SkPixelGeometryIsH(SkPixelGeometry geo) { - return kRGB_H_SkPixelGeometry == geo || kBGR_H_SkPixelGeometry == geo; -} - -// Returns true iff geo is a known geometry and is vertical. -static inline bool SkPixelGeometryIsV(SkPixelGeometry geo) { - return kRGB_V_SkPixelGeometry == geo || kBGR_V_SkPixelGeometry == geo; -} - -/** - * Describes properties and constraints of a given SkSurface. The rendering engine can parse these - * during drawing, and can sometimes optimize its performance (e.g. disabling an expensive - * feature). - */ -class SK_API SkSurfaceProps { -public: - enum Flags { - kUseDeviceIndependentFonts_Flag = 1 << 0, - // Use internal MSAA to render to non-MSAA GPU surfaces. - kDynamicMSAA_Flag = 1 << 1 - }; - /** Deprecated alias used by Chromium. Will be removed. */ - static const Flags kUseDistanceFieldFonts_Flag = kUseDeviceIndependentFonts_Flag; - - /** No flags, unknown pixel geometry. */ - SkSurfaceProps(); - SkSurfaceProps(uint32_t flags, SkPixelGeometry); - - SkSurfaceProps(const SkSurfaceProps&); - SkSurfaceProps& operator=(const SkSurfaceProps&); - - SkSurfaceProps cloneWithPixelGeometry(SkPixelGeometry newPixelGeometry) const { - return SkSurfaceProps(fFlags, newPixelGeometry); - } - - uint32_t flags() const { return fFlags; } - SkPixelGeometry pixelGeometry() const { return fPixelGeometry; } - - bool isUseDeviceIndependentFonts() const { - return SkToBool(fFlags & kUseDeviceIndependentFonts_Flag); - } - - bool operator==(const SkSurfaceProps& that) const { - return fFlags == that.fFlags && fPixelGeometry == that.fPixelGeometry; - } - - bool operator!=(const SkSurfaceProps& that) const { - return !(*this == that); - } - -private: - uint32_t fFlags; - SkPixelGeometry fPixelGeometry; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSwizzle.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSwizzle.h deleted file mode 100644 index 61e93b2da700b7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkSwizzle.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSwizzle_DEFINED -#define SkSwizzle_DEFINED - -#include "include/core/SkTypes.h" - -/** - Swizzles byte order of |count| 32-bit pixels, swapping R and B. - (RGBA <-> BGRA) -*/ -SK_API void SkSwapRB(uint32_t* dest, const uint32_t* src, int count); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTextBlob.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTextBlob.h deleted file mode 100644 index e010ea9cc788db..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTextBlob.h +++ /dev/null @@ -1,506 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTextBlob_DEFINED -#define SkTextBlob_DEFINED - -#include "include/core/SkFont.h" -#include "include/core/SkPaint.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkString.h" -#include "include/private/SkTemplates.h" - -#include - -struct SkRSXform; -struct SkSerialProcs; -struct SkDeserialProcs; - -namespace sktext { -class GlyphRunList; -} - -/** \class SkTextBlob - SkTextBlob combines multiple text runs into an immutable container. Each text - run consists of glyphs, SkPaint, and position. Only parts of SkPaint related to - fonts and text rendering are used by run. -*/ -class SK_API SkTextBlob final : public SkNVRefCnt { -private: - class RunRecord; - -public: - - /** Returns conservative bounding box. Uses SkPaint associated with each glyph to - determine glyph bounds, and unions all bounds. Returned bounds may be - larger than the bounds of all glyphs in runs. - - @return conservative bounding box - */ - const SkRect& bounds() const { return fBounds; } - - /** Returns a non-zero value unique among all text blobs. - - @return identifier for SkTextBlob - */ - uint32_t uniqueID() const { return fUniqueID; } - - /** Returns the number of intervals that intersect bounds. - bounds describes a pair of lines parallel to the text advance. - The return count is zero or a multiple of two, and is at most twice the number of glyphs in - the the blob. - - Pass nullptr for intervals to determine the size of the interval array. - - Runs within the blob that contain SkRSXform are ignored when computing intercepts. - - @param bounds lower and upper line parallel to the advance - @param intervals returned intersections; may be nullptr - @param paint specifies stroking, SkPathEffect that affects the result; may be nullptr - @return number of intersections; may be zero - */ - int getIntercepts(const SkScalar bounds[2], SkScalar intervals[], - const SkPaint* paint = nullptr) const; - - /** Creates SkTextBlob with a single run. - - font contains attributes used to define the run text. - - When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or - SkTextEncoding::kUTF32, this function uses the default - character-to-glyph mapping from the SkTypeface in font. It does not - perform typeface fallback for characters not found in the SkTypeface. - It does not perform kerning or other complex shaping; glyphs are - positioned based on their default advances. - - @param text character code points or glyphs drawn - @param byteLength byte length of text array - @param font text size, typeface, text scale, and so on, used to draw - @param encoding text encoding used in the text array - @return SkTextBlob constructed from one run - */ - static sk_sp MakeFromText(const void* text, size_t byteLength, const SkFont& font, - SkTextEncoding encoding = SkTextEncoding::kUTF8); - - /** Creates SkTextBlob with a single run. string meaning depends on SkTextEncoding; - by default, string is encoded as UTF-8. - - font contains attributes used to define the run text. - - When encoding is SkTextEncoding::kUTF8, SkTextEncoding::kUTF16, or - SkTextEncoding::kUTF32, this function uses the default - character-to-glyph mapping from the SkTypeface in font. It does not - perform typeface fallback for characters not found in the SkTypeface. - It does not perform kerning or other complex shaping; glyphs are - positioned based on their default advances. - - @param string character code points or glyphs drawn - @param font text size, typeface, text scale, and so on, used to draw - @param encoding text encoding used in the text array - @return SkTextBlob constructed from one run - */ - static sk_sp MakeFromString(const char* string, const SkFont& font, - SkTextEncoding encoding = SkTextEncoding::kUTF8) { - if (!string) { - return nullptr; - } - return MakeFromText(string, strlen(string), font, encoding); - } - - /** Returns a textblob built from a single run of text with x-positions and a single y value. - This is equivalent to using SkTextBlobBuilder and calling allocRunPosH(). - Returns nullptr if byteLength is zero. - - @param text character code points or glyphs drawn (based on encoding) - @param byteLength byte length of text array - @param xpos array of x-positions, must contain values for all of the character points. - @param constY shared y-position for each character point, to be paired with each xpos. - @param font SkFont used for this run - @param encoding specifies the encoding of the text array. - @return new textblob or nullptr - */ - static sk_sp MakeFromPosTextH(const void* text, size_t byteLength, - const SkScalar xpos[], SkScalar constY, const SkFont& font, - SkTextEncoding encoding = SkTextEncoding::kUTF8); - - /** Returns a textblob built from a single run of text with positions. - This is equivalent to using SkTextBlobBuilder and calling allocRunPos(). - Returns nullptr if byteLength is zero. - - @param text character code points or glyphs drawn (based on encoding) - @param byteLength byte length of text array - @param pos array of positions, must contain values for all of the character points. - @param font SkFont used for this run - @param encoding specifies the encoding of the text array. - @return new textblob or nullptr - */ - static sk_sp MakeFromPosText(const void* text, size_t byteLength, - const SkPoint pos[], const SkFont& font, - SkTextEncoding encoding = SkTextEncoding::kUTF8); - - static sk_sp MakeFromRSXform(const void* text, size_t byteLength, - const SkRSXform xform[], const SkFont& font, - SkTextEncoding encoding = SkTextEncoding::kUTF8); - - /** Writes data to allow later reconstruction of SkTextBlob. memory points to storage - to receive the encoded data, and memory_size describes the size of storage. - Returns bytes used if provided storage is large enough to hold all data; - otherwise, returns zero. - - procs.fTypefaceProc permits supplying a custom function to encode SkTypeface. - If procs.fTypefaceProc is nullptr, default encoding is used. procs.fTypefaceCtx - may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc - is called with a pointer to SkTypeface and user context. - - @param procs custom serial data encoders; may be nullptr - @param memory storage for data - @param memory_size size of storage - @return bytes written, or zero if required storage is larger than memory_size - - example: https://fiddle.skia.org/c/@TextBlob_serialize - */ - size_t serialize(const SkSerialProcs& procs, void* memory, size_t memory_size) const; - - /** Returns storage containing SkData describing SkTextBlob, using optional custom - encoders. - - procs.fTypefaceProc permits supplying a custom function to encode SkTypeface. - If procs.fTypefaceProc is nullptr, default encoding is used. procs.fTypefaceCtx - may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc - is called with a pointer to SkTypeface and user context. - - @param procs custom serial data encoders; may be nullptr - @return storage containing serialized SkTextBlob - - example: https://fiddle.skia.org/c/@TextBlob_serialize_2 - */ - sk_sp serialize(const SkSerialProcs& procs) const; - - /** Recreates SkTextBlob that was serialized into data. Returns constructed SkTextBlob - if successful; otherwise, returns nullptr. Fails if size is smaller than - required data length, or if data does not permit constructing valid SkTextBlob. - - procs.fTypefaceProc permits supplying a custom function to decode SkTypeface. - If procs.fTypefaceProc is nullptr, default decoding is used. procs.fTypefaceCtx - may be used to provide user context to procs.fTypefaceProc; procs.fTypefaceProc - is called with a pointer to SkTypeface data, data byte length, and user context. - - @param data pointer for serial data - @param size size of data - @param procs custom serial data decoders; may be nullptr - @return SkTextBlob constructed from data in memory - */ - static sk_sp Deserialize(const void* data, size_t size, - const SkDeserialProcs& procs); - - class SK_API Iter { - public: - struct Run { - SkTypeface* fTypeface; - int fGlyphCount; - const uint16_t* fGlyphIndices; -#ifdef SK_UNTIL_CRBUG_1187654_IS_FIXED - const uint32_t* fClusterIndex_forTest; - int fUtf8Size_forTest; - const char* fUtf8_forTest; -#endif - }; - - Iter(const SkTextBlob&); - - /** - * Returns true for each "run" inside the textblob, setting the Run fields (if not null). - * If this returns false, there are no more runs, and the Run parameter will be ignored. - */ - bool next(Run*); - - // Experimental, DO NO USE, will change/go-away - struct ExperimentalRun { - SkFont font; - int count; - const uint16_t* glyphs; - const SkPoint* positions; - }; - bool experimentalNext(ExperimentalRun*); - - private: - const RunRecord* fRunRecord; - }; - -private: - friend class SkNVRefCnt; - - enum GlyphPositioning : uint8_t; - - explicit SkTextBlob(const SkRect& bounds); - - ~SkTextBlob(); - - // Memory for objects of this class is created with sk_malloc rather than operator new and must - // be freed with sk_free. - void operator delete(void* p); - void* operator new(size_t); - void* operator new(size_t, void* p); - - static unsigned ScalarsPerGlyph(GlyphPositioning pos); - - // Call when this blob is part of the key to a cache entry. This allows the cache - // to know automatically those entries can be purged when this SkTextBlob is deleted. - void notifyAddedToCache(uint32_t cacheID) const { - fCacheID.store(cacheID); - } - - friend class sktext::GlyphRunList; - friend class SkTextBlobBuilder; - friend class SkTextBlobPriv; - friend class SkTextBlobRunIterator; - - const SkRect fBounds; - const uint32_t fUniqueID; - mutable std::atomic fCacheID; - - SkDEBUGCODE(size_t fStorageSize;) - - // The actual payload resides in externally-managed storage, following the object. - // (see the .cpp for more details) - - using INHERITED = SkRefCnt; -}; - -/** \class SkTextBlobBuilder - Helper class for constructing SkTextBlob. -*/ -class SK_API SkTextBlobBuilder { -public: - - /** Constructs empty SkTextBlobBuilder. By default, SkTextBlobBuilder has no runs. - - @return empty SkTextBlobBuilder - - example: https://fiddle.skia.org/c/@TextBlobBuilder_empty_constructor - */ - SkTextBlobBuilder(); - - /** Deletes data allocated internally by SkTextBlobBuilder. - */ - ~SkTextBlobBuilder(); - - /** Returns SkTextBlob built from runs of glyphs added by builder. Returned - SkTextBlob is immutable; it may be copied, but its contents may not be altered. - Returns nullptr if no runs of glyphs were added by builder. - - Resets SkTextBlobBuilder to its initial empty state, allowing it to be - reused to build a new set of runs. - - @return SkTextBlob or nullptr - - example: https://fiddle.skia.org/c/@TextBlobBuilder_make - */ - sk_sp make(); - - /** \struct SkTextBlobBuilder::RunBuffer - RunBuffer supplies storage for glyphs and positions within a run. - - A run is a sequence of glyphs sharing font metrics and positioning. - Each run may position its glyphs in one of three ways: - by specifying where the first glyph is drawn, and allowing font metrics to - determine the advance to subsequent glyphs; by specifying a baseline, and - the position on that baseline for each glyph in run; or by providing SkPoint - array, one per glyph. - */ - struct RunBuffer { - SkGlyphID* glyphs; //!< storage for glyph indexes in run - SkScalar* pos; //!< storage for glyph positions in run - char* utf8text; //!< storage for text UTF-8 code units in run - uint32_t* clusters; //!< storage for glyph clusters (index of UTF-8 code unit) - - // Helpers, since the "pos" field can be different types (always some number of floats). - SkPoint* points() const { return reinterpret_cast(pos); } - SkRSXform* xforms() const { return reinterpret_cast(pos); } - }; - - /** Returns run with storage for glyphs. Caller must write count glyphs to - RunBuffer::glyphs before next call to SkTextBlobBuilder. - - RunBuffer::pos, RunBuffer::utf8text, and RunBuffer::clusters should be ignored. - - Glyphs share metrics in font. - - Glyphs are positioned on a baseline at (x, y), using font metrics to - determine their relative placement. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from (x, y) and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param x horizontal offset within the blob - @param y vertical offset within the blob - @param bounds optional run bounding box - @return writable glyph buffer - */ - const RunBuffer& allocRun(const SkFont& font, int count, SkScalar x, SkScalar y, - const SkRect* bounds = nullptr); - - /** Returns run with storage for glyphs and positions along baseline. Caller must - write count glyphs to RunBuffer::glyphs and count scalars to RunBuffer::pos - before next call to SkTextBlobBuilder. - - RunBuffer::utf8text and RunBuffer::clusters should be ignored. - - Glyphs share metrics in font. - - Glyphs are positioned on a baseline at y, using x-axis positions written by - caller to RunBuffer::pos. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from y, RunBuffer::pos, and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param y vertical offset within the blob - @param bounds optional run bounding box - @return writable glyph buffer and x-axis position buffer - */ - const RunBuffer& allocRunPosH(const SkFont& font, int count, SkScalar y, - const SkRect* bounds = nullptr); - - /** Returns run with storage for glyphs and SkPoint positions. Caller must - write count glyphs to RunBuffer::glyphs and count SkPoint to RunBuffer::pos - before next call to SkTextBlobBuilder. - - RunBuffer::utf8text and RunBuffer::clusters should be ignored. - - Glyphs share metrics in font. - - Glyphs are positioned using SkPoint written by caller to RunBuffer::pos, using - two scalar values for each SkPoint. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from RunBuffer::pos, and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param bounds optional run bounding box - @return writable glyph buffer and SkPoint buffer - */ - const RunBuffer& allocRunPos(const SkFont& font, int count, - const SkRect* bounds = nullptr); - - // RunBuffer.pos points to SkRSXform array - const RunBuffer& allocRunRSXform(const SkFont& font, int count); - - /** Returns run with storage for glyphs, text, and clusters. Caller must - write count glyphs to RunBuffer::glyphs, textByteCount UTF-8 code units - into RunBuffer::utf8text, and count monotonic indexes into utf8text - into RunBuffer::clusters before next call to SkTextBlobBuilder. - - RunBuffer::pos should be ignored. - - Glyphs share metrics in font. - - Glyphs are positioned on a baseline at (x, y), using font metrics to - determine their relative placement. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from (x, y) and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param x horizontal offset within the blob - @param y vertical offset within the blob - @param textByteCount number of UTF-8 code units - @param bounds optional run bounding box - @return writable glyph buffer, text buffer, and cluster buffer - */ - const RunBuffer& allocRunText(const SkFont& font, int count, SkScalar x, SkScalar y, - int textByteCount, const SkRect* bounds = nullptr); - - /** Returns run with storage for glyphs, positions along baseline, text, - and clusters. Caller must write count glyphs to RunBuffer::glyphs, - count scalars to RunBuffer::pos, textByteCount UTF-8 code units into - RunBuffer::utf8text, and count monotonic indexes into utf8text into - RunBuffer::clusters before next call to SkTextBlobBuilder. - - Glyphs share metrics in font. - - Glyphs are positioned on a baseline at y, using x-axis positions written by - caller to RunBuffer::pos. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from y, RunBuffer::pos, and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param y vertical offset within the blob - @param textByteCount number of UTF-8 code units - @param bounds optional run bounding box - @return writable glyph buffer, x-axis position buffer, text buffer, and cluster buffer - */ - const RunBuffer& allocRunTextPosH(const SkFont& font, int count, SkScalar y, int textByteCount, - const SkRect* bounds = nullptr); - - /** Returns run with storage for glyphs, SkPoint positions, text, and - clusters. Caller must write count glyphs to RunBuffer::glyphs, count - SkPoint to RunBuffer::pos, textByteCount UTF-8 code units into - RunBuffer::utf8text, and count monotonic indexes into utf8text into - RunBuffer::clusters before next call to SkTextBlobBuilder. - - Glyphs share metrics in font. - - Glyphs are positioned using SkPoint written by caller to RunBuffer::pos, using - two scalar values for each SkPoint. - - bounds defines an optional bounding box, used to suppress drawing when SkTextBlob - bounds does not intersect SkSurface bounds. If bounds is nullptr, SkTextBlob bounds - is computed from RunBuffer::pos, and RunBuffer::glyphs metrics. - - @param font SkFont used for this run - @param count number of glyphs - @param textByteCount number of UTF-8 code units - @param bounds optional run bounding box - @return writable glyph buffer, SkPoint buffer, text buffer, and cluster buffer - */ - const RunBuffer& allocRunTextPos(const SkFont& font, int count, int textByteCount, - const SkRect* bounds = nullptr); - - // RunBuffer.pos points to SkRSXform array - const RunBuffer& allocRunTextRSXform(const SkFont& font, int count, int textByteCount, - const SkRect* bounds = nullptr); - -private: - void reserve(size_t size); - void allocInternal(const SkFont& font, SkTextBlob::GlyphPositioning positioning, - int count, int textBytes, SkPoint offset, const SkRect* bounds); - bool mergeRun(const SkFont& font, SkTextBlob::GlyphPositioning positioning, - uint32_t count, SkPoint offset); - void updateDeferredBounds(); - - static SkRect ConservativeRunBounds(const SkTextBlob::RunRecord&); - static SkRect TightRunBounds(const SkTextBlob::RunRecord&); - - friend class SkTextBlobPriv; - friend class SkTextBlobBuilderPriv; - - SkAutoTMalloc fStorage; - size_t fStorageSize; - size_t fStorageUsed; - - SkRect fBounds; - int fRunCount; - bool fDeferredBounds; - size_t fLastRun; // index into fStorage - - RunBuffer fCurrentRunBuffer; -}; - -#endif // SkTextBlob_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTileMode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTileMode.h deleted file mode 100644 index 8a9d0209589daa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTileMode.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTileModes_DEFINED -#define SkTileModes_DEFINED - -#include "include/core/SkTypes.h" - -enum class SkTileMode { - /** - * Replicate the edge color if the shader draws outside of its - * original bounds. - */ - kClamp, - - /** - * Repeat the shader's image horizontally and vertically. - */ - kRepeat, - - /** - * Repeat the shader's image horizontally and vertically, alternating - * mirror images so that adjacent images always seam. - */ - kMirror, - - /** - * Only draw within the original domain, return transparent-black everywhere else. - */ - kDecal, - - kLastTileMode = kDecal, -}; - -static constexpr int kSkTileModeCount = static_cast(SkTileMode::kLastTileMode) + 1; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTime.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTime.h deleted file mode 100644 index 3da2c8c7715b90..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTime.h +++ /dev/null @@ -1,63 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkTime_DEFINED -#define SkTime_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkMacros.h" - -#include - -class SkString; - -/** \class SkTime - Platform-implemented utilities to return time of day, and millisecond counter. -*/ -class SK_API SkTime { -public: - struct DateTime { - int16_t fTimeZoneMinutes; // The number of minutes that GetDateTime() - // is ahead of or behind UTC. - uint16_t fYear; //!< e.g. 2005 - uint8_t fMonth; //!< 1..12 - uint8_t fDayOfWeek; //!< 0..6, 0==Sunday - uint8_t fDay; //!< 1..31 - uint8_t fHour; //!< 0..23 - uint8_t fMinute; //!< 0..59 - uint8_t fSecond; //!< 0..59 - - void toISO8601(SkString* dst) const; - }; - static void GetDateTime(DateTime*); - - static double GetSecs() { return GetNSecs() * 1e-9; } - static double GetMSecs() { return GetNSecs() * 1e-6; } - static double GetNSecs(); -}; - -/////////////////////////////////////////////////////////////////////////////// - -class SkAutoTime { -public: - // The label is not deep-copied, so its address must remain valid for the - // lifetime of this object - SkAutoTime(const char* label = nullptr) - : fLabel(label) - , fNow(SkTime::GetMSecs()) {} - ~SkAutoTime() { - uint64_t dur = static_cast(SkTime::GetMSecs() - fNow); - SkDebugf("%s %" PRIu64 "\n", fLabel ? fLabel : "", dur); - } -private: - const char* fLabel; - double fNow; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTraceMemoryDump.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTraceMemoryDump.h deleted file mode 100644 index 7837bfbd8983c7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTraceMemoryDump.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTraceMemoryDump_DEFINED -#define SkTraceMemoryDump_DEFINED - -#include "include/core/SkTypes.h" - -class SkDiscardableMemory; - -/** - * Interface for memory tracing. - * This interface is meant to be passed as argument to the memory dump methods of Skia objects. - * The implementation of this interface is provided by the embedder. - */ -class SK_API SkTraceMemoryDump { -public: - /** - * Enum to specify the level of the requested details for the dump from the Skia objects. - */ - enum LevelOfDetail { - // Dump only the minimal details to get the total memory usage (Usually just the totals). - kLight_LevelOfDetail, - - // Dump the detailed breakdown of the objects in the caches. - kObjectsBreakdowns_LevelOfDetail - }; - - /** - * Appends a new memory dump (i.e. a row) to the trace memory infrastructure. - * If dumpName does not exist yet, a new one is created. Otherwise, a new column is appended to - * the previously created dump. - * Arguments: - * dumpName: an absolute, slash-separated, name for the item being dumped - * e.g., "skia/CacheX/EntryY". - * valueName: a string indicating the name of the column. - * e.g., "size", "active_size", "number_of_objects". - * This string is supposed to be long lived and is NOT copied. - * units: a string indicating the units for the value. - * e.g., "bytes", "objects". - * This string is supposed to be long lived and is NOT copied. - * value: the actual value being dumped. - */ - virtual void dumpNumericValue(const char* dumpName, - const char* valueName, - const char* units, - uint64_t value) = 0; - - virtual void dumpStringValue(const char* /*dumpName*/, - const char* /*valueName*/, - const char* /*value*/) { } - - /** - * Sets the memory backing for an existing dump. - * backingType and backingObjectId are used by the embedder to associate the memory dumped via - * dumpNumericValue with the corresponding dump that backs the memory. - */ - virtual void setMemoryBacking(const char* dumpName, - const char* backingType, - const char* backingObjectId) = 0; - - /** - * Specialization for memory backed by discardable memory. - */ - virtual void setDiscardableMemoryBacking( - const char* dumpName, - const SkDiscardableMemory& discardableMemoryObject) = 0; - - /** - * Returns the type of details requested in the dump. The granularity of the dump is supposed to - * match the LevelOfDetail argument. The level of detail must not affect the total size - * reported, but only granularity of the child entries. - */ - virtual LevelOfDetail getRequestedDetails() const = 0; - - /** - * Returns true if we should dump wrapped objects. Wrapped objects come from outside Skia, and - * may be independently tracked there. - */ - virtual bool shouldDumpWrappedObjects() const { return true; } - - /** - * If shouldDumpWrappedObjects() returns true then this function will be called to populate - * the output with information on whether the item being dumped is a wrapped object. - */ - virtual void dumpWrappedState(const char* /*dumpName*/, bool /*isWrappedObject*/) {} - -protected: - virtual ~SkTraceMemoryDump() = default; - SkTraceMemoryDump() = default; - SkTraceMemoryDump(const SkTraceMemoryDump&) = delete; - SkTraceMemoryDump& operator=(const SkTraceMemoryDump&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypeface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypeface.h deleted file mode 100644 index d4a13877152d33..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypeface.h +++ /dev/null @@ -1,470 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTypeface_DEFINED -#define SkTypeface_DEFINED - -#include "include/core/SkFontArguments.h" -#include "include/core/SkFontParameters.h" -#include "include/core/SkFontStyle.h" -#include "include/core/SkFontTypes.h" -#include "include/core/SkRect.h" -#include "include/core/SkString.h" -#include "include/private/SkOnce.h" -#include "include/private/SkWeakRefCnt.h" - -class SkData; -class SkDescriptor; -class SkFontData; -class SkFontDescriptor; -class SkScalerContext; -class SkStream; -class SkStreamAsset; -class SkWStream; -struct SkAdvancedTypefaceMetrics; -struct SkScalerContextEffects; -struct SkScalerContextRec; - -using SkTypefaceID = uint32_t; - -// SkFontID is deprecated, please use SkTypefaceID. -using SkFontID = SkTypefaceID; - - -/** Machine endian. */ -typedef uint32_t SkFontTableTag; - -/** \class SkTypeface - - The SkTypeface class specifies the typeface and intrinsic style of a font. - This is used in the paint, along with optionally algorithmic settings like - textSize, textSkewX, textScaleX, kFakeBoldText_Mask, to specify - how text appears when drawn (and measured). - - Typeface objects are immutable, and so they can be shared between threads. -*/ -class SK_API SkTypeface : public SkWeakRefCnt { -public: - /** Returns the typeface's intrinsic style attributes. */ - SkFontStyle fontStyle() const { - return fStyle; - } - - /** Returns true if style() has the kBold bit set. */ - bool isBold() const { return fStyle.weight() >= SkFontStyle::kSemiBold_Weight; } - - /** Returns true if style() has the kItalic bit set. */ - bool isItalic() const { return fStyle.slant() != SkFontStyle::kUpright_Slant; } - - /** Returns true if the typeface claims to be fixed-pitch. - * This is a style bit, advance widths may vary even if this returns true. - */ - bool isFixedPitch() const { return fIsFixedPitch; } - - /** Copy into 'coordinates' (allocated by the caller) the design variation coordinates. - * - * @param coordinates the buffer into which to write the design variation coordinates. - * @param coordinateCount the number of entries available through 'coordinates'. - * - * @return The number of axes, or -1 if there is an error. - * If 'coordinates != nullptr' and 'coordinateCount >= numAxes' then 'coordinates' will be - * filled with the variation coordinates describing the position of this typeface in design - * variation space. It is possible the number of axes can be retrieved but actual position - * cannot. - */ - int getVariationDesignPosition(SkFontArguments::VariationPosition::Coordinate coordinates[], - int coordinateCount) const; - - /** Copy into 'parameters' (allocated by the caller) the design variation parameters. - * - * @param parameters the buffer into which to write the design variation parameters. - * @param coordinateCount the number of entries available through 'parameters'. - * - * @return The number of axes, or -1 if there is an error. - * If 'parameters != nullptr' and 'parameterCount >= numAxes' then 'parameters' will be - * filled with the variation parameters describing the position of this typeface in design - * variation space. It is possible the number of axes can be retrieved but actual parameters - * cannot. - */ - int getVariationDesignParameters(SkFontParameters::Variation::Axis parameters[], - int parameterCount) const; - - /** Return a 32bit value for this typeface, unique for the underlying font - data. Will never return 0. - */ - SkTypefaceID uniqueID() const { return fUniqueID; } - - /** Return the uniqueID for the specified typeface. If the face is null, - resolve it to the default font and return its uniqueID. Will never - return 0. - */ - static SkTypefaceID UniqueID(const SkTypeface* face); - - /** Returns true if the two typefaces reference the same underlying font, - handling either being null (treating null as the default font) - */ - static bool Equal(const SkTypeface* facea, const SkTypeface* faceb); - - /** Returns the default normal typeface, which is never nullptr. */ - static sk_sp MakeDefault(); - - /** Creates a new reference to the typeface that most closely matches the - requested familyName and fontStyle. This method allows extended font - face specifiers as in the SkFontStyle type. Will never return null. - - @param familyName May be NULL. The name of the font family. - @param fontStyle The style of the typeface. - @return reference to the closest-matching typeface. Call must call - unref() when they are done. - */ - static sk_sp MakeFromName(const char familyName[], SkFontStyle fontStyle); - - /** Return a new typeface given a file. If the file does not exist, or is - not a valid font file, returns nullptr. - */ - static sk_sp MakeFromFile(const char path[], int index = 0); - - /** Return a new typeface given a stream. If the stream is - not a valid font file, returns nullptr. Ownership of the stream is - transferred, so the caller must not reference it again. - */ - static sk_sp MakeFromStream(std::unique_ptr stream, int index = 0); - - /** Return a new typeface given a SkData. If the data is null, or is not a valid font file, - * returns nullptr. - */ - static sk_sp MakeFromData(sk_sp, int index = 0); - - /** Return a new typeface based on this typeface but parameterized as specified in the - SkFontArguments. If the SkFontArguments does not supply an argument for a parameter - in the font then the value from this typeface will be used as the value for that - argument. If the cloned typeface would be exaclty the same as this typeface then - this typeface may be ref'ed and returned. May return nullptr on failure. - */ - sk_sp makeClone(const SkFontArguments&) const; - - /** - * A typeface can serialize just a descriptor (names, etc.), or it can also include the - * actual font data (which can be large). This enum controls how serialize() decides what - * to serialize. - */ - enum class SerializeBehavior { - kDoIncludeData, - kDontIncludeData, - kIncludeDataIfLocal, - }; - - /** Write a unique signature to a stream, sufficient to reconstruct a - typeface referencing the same font when Deserialize is called. - */ - void serialize(SkWStream*, SerializeBehavior = SerializeBehavior::kIncludeDataIfLocal) const; - - /** - * Same as serialize(SkWStream*, ...) but returns the serialized data in SkData, instead of - * writing it to a stream. - */ - sk_sp serialize(SerializeBehavior = SerializeBehavior::kIncludeDataIfLocal) const; - - /** Given the data previously written by serialize(), return a new instance - of a typeface referring to the same font. If that font is not available, - return nullptr. - Does not affect ownership of SkStream. - */ - static sk_sp MakeDeserialize(SkStream*); - - /** - * Given an array of UTF32 character codes, return their corresponding glyph IDs. - * - * @param chars pointer to the array of UTF32 chars - * @param number of chars and glyphs - * @param glyphs returns the corresponding glyph IDs for each character. - */ - void unicharsToGlyphs(const SkUnichar uni[], int count, SkGlyphID glyphs[]) const; - - int textToGlyphs(const void* text, size_t byteLength, SkTextEncoding encoding, - SkGlyphID glyphs[], int maxGlyphCount) const; - - /** - * Return the glyphID that corresponds to the specified unicode code-point - * (in UTF32 encoding). If the unichar is not supported, returns 0. - * - * This is a short-cut for calling unicharsToGlyphs(). - */ - SkGlyphID unicharToGlyph(SkUnichar unichar) const; - - /** - * Return the number of glyphs in the typeface. - */ - int countGlyphs() const; - - // Table getters -- may fail if the underlying font format is not organized - // as 4-byte tables. - - /** Return the number of tables in the font. */ - int countTables() const; - - /** Copy into tags[] (allocated by the caller) the list of table tags in - * the font, and return the number. This will be the same as CountTables() - * or 0 if an error occured. If tags == NULL, this only returns the count - * (the same as calling countTables()). - */ - int getTableTags(SkFontTableTag tags[]) const; - - /** Given a table tag, return the size of its contents, or 0 if not present - */ - size_t getTableSize(SkFontTableTag) const; - - /** Copy the contents of a table into data (allocated by the caller). Note - * that the contents of the table will be in their native endian order - * (which for most truetype tables is big endian). If the table tag is - * not found, or there is an error copying the data, then 0 is returned. - * If this happens, it is possible that some or all of the memory pointed - * to by data may have been written to, even though an error has occured. - * - * @param tag The table tag whose contents are to be copied - * @param offset The offset in bytes into the table's contents where the - * copy should start from. - * @param length The number of bytes, starting at offset, of table data - * to copy. - * @param data storage address where the table contents are copied to - * @return the number of bytes actually copied into data. If offset+length - * exceeds the table's size, then only the bytes up to the table's - * size are actually copied, and this is the value returned. If - * offset > the table's size, or tag is not a valid table, - * then 0 is returned. - */ - size_t getTableData(SkFontTableTag tag, size_t offset, size_t length, - void* data) const; - - /** - * Return an immutable copy of the requested font table, or nullptr if that table was - * not found. This can sometimes be faster than calling getTableData() twice: once to find - * the length, and then again to copy the data. - * - * @param tag The table tag whose contents are to be copied - * @return an immutable copy of the table's data, or nullptr. - */ - sk_sp copyTableData(SkFontTableTag tag) const; - - /** - * Return the units-per-em value for this typeface, or zero if there is an - * error. - */ - int getUnitsPerEm() const; - - /** - * Given a run of glyphs, return the associated horizontal adjustments. - * Adjustments are in "design units", which are integers relative to the - * typeface's units per em (see getUnitsPerEm). - * - * Some typefaces are known to never support kerning. Calling this method - * with all zeros (e.g. getKerningPairAdustments(NULL, 0, NULL)) returns - * a boolean indicating if the typeface might support kerning. If it - * returns false, then it will always return false (no kerning) for all - * possible glyph runs. If it returns true, then it *may* return true for - * somne glyph runs. - * - * If count is non-zero, then the glyphs parameter must point to at least - * [count] valid glyph IDs, and the adjustments parameter must be - * sized to at least [count - 1] entries. If the method returns true, then - * [count-1] entries in the adjustments array will be set. If the method - * returns false, then no kerning should be applied, and the adjustments - * array will be in an undefined state (possibly some values may have been - * written, but none of them should be interpreted as valid values). - */ - bool getKerningPairAdjustments(const SkGlyphID glyphs[], int count, - int32_t adjustments[]) const; - - struct LocalizedString { - SkString fString; - SkString fLanguage; - }; - class LocalizedStrings { - public: - LocalizedStrings() = default; - virtual ~LocalizedStrings() { } - virtual bool next(LocalizedString* localizedString) = 0; - void unref() { delete this; } - - private: - LocalizedStrings(const LocalizedStrings&) = delete; - LocalizedStrings& operator=(const LocalizedStrings&) = delete; - }; - /** - * Returns an iterator which will attempt to enumerate all of the - * family names specified by the font. - * It is the caller's responsibility to unref() the returned pointer. - */ - LocalizedStrings* createFamilyNameIterator() const; - - /** - * Return the family name for this typeface. It will always be returned - * encoded as UTF8, but the language of the name is whatever the host - * platform chooses. - */ - void getFamilyName(SkString* name) const; - - /** - * Return the PostScript name for this typeface. - * Value may change based on variation parameters. - * Returns false if no PostScript name is available. - */ - bool getPostScriptName(SkString* name) const; - - /** - * Return a stream for the contents of the font data, or NULL on failure. - * If ttcIndex is not null, it is set to the TrueTypeCollection index - * of this typeface within the stream, or 0 if the stream is not a - * collection. - * The caller is responsible for deleting the stream. - */ - std::unique_ptr openStream(int* ttcIndex) const; - - /** - * Return a stream for the contents of the font data. - * Returns nullptr on failure or if the font data isn't already available in stream form. - * Use when the stream can be used opportunistically but the calling code would prefer - * to fall back to table access if creating the stream would be expensive. - * Otherwise acts the same as openStream. - */ - std::unique_ptr openExistingStream(int* ttcIndex) const; - - /** - * Return a scalercontext for the given descriptor. It may return a - * stub scalercontext that will not crash, but will draw nothing. - */ - std::unique_ptr createScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const; - - /** - * Return a rectangle (scaled to 1-pt) that represents the union of the bounds of all - * of the glyphs, but each one positioned at (0,). This may be conservatively large, and - * will not take into account any hinting or other size-specific adjustments. - */ - SkRect getBounds() const; - - // PRIVATE / EXPERIMENTAL -- do not call - void filterRec(SkScalerContextRec* rec) const { - this->onFilterRec(rec); - } - // PRIVATE / EXPERIMENTAL -- do not call - void getFontDescriptor(SkFontDescriptor* desc, bool* isLocal) const { - this->onGetFontDescriptor(desc, isLocal); - } - // PRIVATE / EXPERIMENTAL -- do not call - void* internal_private_getCTFontRef() const { - return this->onGetCTFontRef(); - } - -protected: - explicit SkTypeface(const SkFontStyle& style, bool isFixedPitch = false); - ~SkTypeface() override; - - virtual sk_sp onMakeClone(const SkFontArguments&) const = 0; - - /** Sets the fixedPitch bit. If used, must be called in the constructor. */ - void setIsFixedPitch(bool isFixedPitch) { fIsFixedPitch = isFixedPitch; } - /** Sets the font style. If used, must be called in the constructor. */ - void setFontStyle(SkFontStyle style) { fStyle = style; } - - // Must return a valid scaler context. It can not return nullptr. - virtual std::unique_ptr onCreateScalerContext(const SkScalerContextEffects&, - const SkDescriptor*) const = 0; - virtual void onFilterRec(SkScalerContextRec*) const = 0; - friend class SkScalerContext; // onFilterRec - - // Subclasses *must* override this method to work with the PDF backend. - virtual std::unique_ptr onGetAdvancedMetrics() const = 0; - // For type1 postscript fonts only, set the glyph names for each glyph. - // destination array is non-null, and points to an array of size this->countGlyphs(). - // Backends that do not suport type1 fonts should not override. - virtual void getPostScriptGlyphNames(SkString*) const = 0; - - // The mapping from glyph to Unicode; array indices are glyph ids. - // For each glyph, give the default Unicode value, if it exists. - // dstArray is non-null, and points to an array of size this->countGlyphs(). - virtual void getGlyphToUnicodeMap(SkUnichar* dstArray) const = 0; - - virtual std::unique_ptr onOpenStream(int* ttcIndex) const = 0; - - virtual std::unique_ptr onOpenExistingStream(int* ttcIndex) const; - - virtual bool onGlyphMaskNeedsCurrentColor() const = 0; - - virtual int onGetVariationDesignPosition( - SkFontArguments::VariationPosition::Coordinate coordinates[], - int coordinateCount) const = 0; - - virtual int onGetVariationDesignParameters( - SkFontParameters::Variation::Axis parameters[], int parameterCount) const = 0; - - virtual void onGetFontDescriptor(SkFontDescriptor*, bool* isLocal) const = 0; - - virtual void onCharsToGlyphs(const SkUnichar* chars, int count, SkGlyphID glyphs[]) const = 0; - virtual int onCountGlyphs() const = 0; - - virtual int onGetUPEM() const = 0; - virtual bool onGetKerningPairAdjustments(const SkGlyphID glyphs[], int count, - int32_t adjustments[]) const; - - /** Returns the family name of the typeface as known by its font manager. - * This name may or may not be produced by the family name iterator. - */ - virtual void onGetFamilyName(SkString* familyName) const = 0; - virtual bool onGetPostScriptName(SkString*) const = 0; - - /** Returns an iterator over the family names in the font. */ - virtual LocalizedStrings* onCreateFamilyNameIterator() const = 0; - - virtual int onGetTableTags(SkFontTableTag tags[]) const = 0; - virtual size_t onGetTableData(SkFontTableTag, size_t offset, - size_t length, void* data) const = 0; - virtual sk_sp onCopyTableData(SkFontTableTag) const; - - virtual bool onComputeBounds(SkRect*) const; - - virtual void* onGetCTFontRef() const { return nullptr; } - -private: - /** Returns true if the typeface's glyph masks may refer to the foreground - * paint foreground color. This is needed to determine caching requirements. Usually true for - * typefaces that contain a COLR table. - */ - bool glyphMaskNeedsCurrentColor() const; - friend class SkStrikeServerImpl; // glyphMaskNeedsCurrentColor - - /** Retrieve detailed typeface metrics. Used by the PDF backend. */ - std::unique_ptr getAdvancedMetrics() const; - friend class SkRandomTypeface; // getAdvancedMetrics - friend class SkPDFFont; // getAdvancedMetrics - - /** Style specifies the intrinsic style attributes of a given typeface */ - enum Style { - kNormal = 0, - kBold = 0x01, - kItalic = 0x02, - - // helpers - kBoldItalic = 0x03 - }; - static SkFontStyle FromOldStyle(Style oldStyle); - static SkTypeface* GetDefaultTypeface(Style style = SkTypeface::kNormal); - - friend class SkFontPriv; // GetDefaultTypeface - friend class SkPaintPriv; // GetDefaultTypeface - friend class SkFont; // getGlyphToUnicodeMap - -private: - SkTypefaceID fUniqueID; - SkFontStyle fStyle; - mutable SkRect fBounds; - mutable SkOnce fBoundsOnce; - bool fIsFixedPitch; - - using INHERITED = SkWeakRefCnt; -}; -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypes.h deleted file mode 100644 index 8f7a2c0982b680..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkTypes.h +++ /dev/null @@ -1,626 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTypes_DEFINED -#define SkTypes_DEFINED - -/** \file SkTypes.h -*/ - -// Pre-SkUserConfig.h setup. - -// Allows embedders that want to disable macros that take arguments to just -// define that symbol to be one of these -#define SK_NOTHING_ARG1(arg1) -#define SK_NOTHING_ARG2(arg1, arg2) -#define SK_NOTHING_ARG3(arg1, arg2, arg3) - -#if !defined(SK_BUILD_FOR_ANDROID) && !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_WIN) && \ - !defined(SK_BUILD_FOR_UNIX) && !defined(SK_BUILD_FOR_MAC) - - #ifdef __APPLE__ - #include - #endif - - #if defined(_WIN32) || defined(__SYMBIAN32__) - #define SK_BUILD_FOR_WIN - #elif defined(ANDROID) || defined(__ANDROID__) - #define SK_BUILD_FOR_ANDROID - #elif defined(linux) || defined(__linux) || defined(__FreeBSD__) || \ - defined(__OpenBSD__) || defined(__sun) || defined(__NetBSD__) || \ - defined(__DragonFly__) || defined(__Fuchsia__) || \ - defined(__GLIBC__) || defined(__GNU__) || defined(__unix__) - #define SK_BUILD_FOR_UNIX - #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR - #define SK_BUILD_FOR_IOS - #else - #define SK_BUILD_FOR_MAC - #endif - -#endif - -#if defined(SK_BUILD_FOR_WIN) && !defined(__clang__) - #if !defined(SK_RESTRICT) - #define SK_RESTRICT __restrict - #endif - #if !defined(SK_WARN_UNUSED_RESULT) - #define SK_WARN_UNUSED_RESULT - #endif -#endif - -#if !defined(SK_RESTRICT) - #define SK_RESTRICT __restrict__ -#endif - -#if !defined(SK_WARN_UNUSED_RESULT) - #define SK_WARN_UNUSED_RESULT __attribute__((warn_unused_result)) -#endif - -#if !defined(SK_CPU_BENDIAN) && !defined(SK_CPU_LENDIAN) - #if defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_BIG_ENDIAN__) - #define SK_CPU_BENDIAN - #elif defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) - #define SK_CPU_LENDIAN - #elif defined(__sparc) || defined(__sparc__) || \ - defined(_POWER) || defined(__powerpc__) || \ - defined(__ppc__) || defined(__hppa) || \ - defined(__PPC__) || defined(__PPC64__) || \ - defined(_MIPSEB) || defined(__ARMEB__) || \ - defined(__s390__) || \ - (defined(__sh__) && defined(__BIG_ENDIAN__)) || \ - (defined(__ia64) && defined(__BIG_ENDIAN__)) - #define SK_CPU_BENDIAN - #else - #define SK_CPU_LENDIAN - #endif -#endif - -#if defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || defined(_M_X64) - #define SK_CPU_X86 1 -#endif - -/** - * SK_CPU_SSE_LEVEL - * - * If defined, SK_CPU_SSE_LEVEL should be set to the highest supported level. - * On non-intel CPU this should be undefined. - */ -#define SK_CPU_SSE_LEVEL_SSE1 10 -#define SK_CPU_SSE_LEVEL_SSE2 20 -#define SK_CPU_SSE_LEVEL_SSE3 30 -#define SK_CPU_SSE_LEVEL_SSSE3 31 -#define SK_CPU_SSE_LEVEL_SSE41 41 -#define SK_CPU_SSE_LEVEL_SSE42 42 -#define SK_CPU_SSE_LEVEL_AVX 51 -#define SK_CPU_SSE_LEVEL_AVX2 52 -#define SK_CPU_SSE_LEVEL_SKX 60 - -// Are we in GCC/Clang? -#ifndef SK_CPU_SSE_LEVEL - // These checks must be done in descending order to ensure we set the highest - // available SSE level. - #if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \ - defined(__AVX512BW__) && defined(__AVX512VL__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SKX - #elif defined(__AVX2__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2 - #elif defined(__AVX__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX - #elif defined(__SSE4_2__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE42 - #elif defined(__SSE4_1__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE41 - #elif defined(__SSSE3__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSSE3 - #elif defined(__SSE3__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE3 - #elif defined(__SSE2__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2 - #endif -#endif - -// Are we in VisualStudio? -#ifndef SK_CPU_SSE_LEVEL - // These checks must be done in descending order to ensure we set the highest - // available SSE level. 64-bit intel guarantees at least SSE2 support. - #if defined(__AVX512F__) && defined(__AVX512DQ__) && defined(__AVX512CD__) && \ - defined(__AVX512BW__) && defined(__AVX512VL__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SKX - #elif defined(__AVX2__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX2 - #elif defined(__AVX__) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_AVX - #elif defined(_M_X64) || defined(_M_AMD64) - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2 - #elif defined(_M_IX86_FP) - #if _M_IX86_FP >= 2 - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE2 - #elif _M_IX86_FP == 1 - #define SK_CPU_SSE_LEVEL SK_CPU_SSE_LEVEL_SSE1 - #endif - #endif -#endif - -// ARM defines -#if defined(__arm__) && (!defined(__APPLE__) || !TARGET_IPHONE_SIMULATOR) - #define SK_CPU_ARM32 -#elif defined(__aarch64__) - #define SK_CPU_ARM64 -#endif - -// All 64-bit ARM chips have NEON. Many 32-bit ARM chips do too. -#if !defined(SK_ARM_HAS_NEON) && defined(__ARM_NEON) - #define SK_ARM_HAS_NEON -#endif - -#if defined(__ARM_FEATURE_CRC32) - #define SK_ARM_HAS_CRC32 -#endif - - -// DLL/.so exports. -#if !defined(SKIA_IMPLEMENTATION) - #define SKIA_IMPLEMENTATION 0 -#endif -#if !defined(SK_API) - #if defined(SKIA_DLL) - #if defined(_MSC_VER) - #if SKIA_IMPLEMENTATION - #define SK_API __declspec(dllexport) - #else - #define SK_API __declspec(dllimport) - #endif - #else - #define SK_API __attribute__((visibility("default"))) - #endif - #else - #define SK_API - #endif -#endif - -// SK_SPI is functionally identical to SK_API, but used within src to clarify that it's less stable -#if !defined(SK_SPI) - #define SK_SPI SK_API -#endif - -// IWYU pragma: begin_exports -#if defined (SK_USER_CONFIG_HEADER) - #include SK_USER_CONFIG_HEADER -#else - #include "include/config/SkUserConfig.h" -#endif -// IWYU pragma: end_exports -#include -#include - -// Post SkUserConfig.h checks and such. -#if !defined(SK_DEBUG) && !defined(SK_RELEASE) - #ifdef NDEBUG - #define SK_RELEASE - #else - #define SK_DEBUG - #endif -#endif - -#if defined(SK_DEBUG) && defined(SK_RELEASE) -# error "cannot define both SK_DEBUG and SK_RELEASE" -#elif !defined(SK_DEBUG) && !defined(SK_RELEASE) -# error "must define either SK_DEBUG or SK_RELEASE" -#endif - -#if defined(SK_CPU_LENDIAN) && defined(SK_CPU_BENDIAN) -# error "cannot define both SK_CPU_LENDIAN and SK_CPU_BENDIAN" -#elif !defined(SK_CPU_LENDIAN) && !defined(SK_CPU_BENDIAN) -# error "must define either SK_CPU_LENDIAN or SK_CPU_BENDIAN" -#endif - -#if defined(SK_CPU_BENDIAN) && !defined(I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN) - #error "The Skia team is not endian-savvy enough to support big-endian CPUs." - #error "If you still want to use Skia," - #error "please define I_ACKNOWLEDGE_SKIA_DOES_NOT_SUPPORT_BIG_ENDIAN." -#endif - -#if !defined(SK_ATTRIBUTE) -# if defined(__clang__) || defined(__GNUC__) -# define SK_ATTRIBUTE(attr) __attribute__((attr)) -# else -# define SK_ATTRIBUTE(attr) -# endif -#endif - -#if !defined(SK_SUPPORT_GPU) -# define SK_SUPPORT_GPU 1 -#endif - -#if SK_SUPPORT_GPU || defined(SK_GRAPHITE_ENABLED) -# if !defined(SK_ENABLE_SKSL) -# define SK_ENABLE_SKSL -# endif -#else -# undef SK_GL -# undef SK_VULKAN -# undef SK_METAL -# undef SK_DAWN -# undef SK_DIRECT3D -#endif - -#if !defined(SkUNREACHABLE) -# if defined(_MSC_VER) && !defined(__clang__) -# include -# define FAST_FAIL_INVALID_ARG 5 -// See https://developercommunity.visualstudio.com/content/problem/1128631/code-flow-doesnt-see-noreturn-with-extern-c.html -// for why this is wrapped. Hopefully removable after msvc++ 19.27 is no longer supported. -[[noreturn]] static inline void sk_fast_fail() { __fastfail(FAST_FAIL_INVALID_ARG); } -# define SkUNREACHABLE sk_fast_fail() -# else -# define SkUNREACHABLE __builtin_trap() -# endif -#endif - -#if defined(SK_BUILD_FOR_GOOGLE3) - void SkDebugfForDumpStackTrace(const char* data, void* unused); - namespace base { - void DumpStackTrace(int skip_count, void w(const char*, void*), void* arg); - } -# define SK_DUMP_GOOGLE3_STACK() ::base::DumpStackTrace(0, SkDebugfForDumpStackTrace, nullptr) -#else -# define SK_DUMP_GOOGLE3_STACK() -#endif - -#ifndef SK_ABORT -# ifdef SK_BUILD_FOR_WIN - // This style lets Visual Studio follow errors back to the source file. -# define SK_DUMP_LINE_FORMAT "%s(%d)" -# else -# define SK_DUMP_LINE_FORMAT "%s:%d" -# endif -# define SK_ABORT(message, ...) \ - do { \ - SkDebugf(SK_DUMP_LINE_FORMAT ": fatal error: \"" message "\"\n", \ - __FILE__, __LINE__, ##__VA_ARGS__); \ - SK_DUMP_GOOGLE3_STACK(); \ - sk_abort_no_print(); \ - } while (false) -#endif - -// If SK_R32_SHIFT is set, we'll use that to choose RGBA or BGRA. -// If not, we'll default to RGBA everywhere except BGRA on Windows. -#if defined(SK_R32_SHIFT) - static_assert(SK_R32_SHIFT == 0 || SK_R32_SHIFT == 16, ""); -#elif defined(SK_BUILD_FOR_WIN) - #define SK_R32_SHIFT 16 -#else - #define SK_R32_SHIFT 0 -#endif - -#if defined(SK_B32_SHIFT) - static_assert(SK_B32_SHIFT == (16-SK_R32_SHIFT), ""); -#else - #define SK_B32_SHIFT (16-SK_R32_SHIFT) -#endif - -#define SK_G32_SHIFT 8 -#define SK_A32_SHIFT 24 - - -/** - * SK_PMCOLOR_BYTE_ORDER can be used to query the byte order of SkPMColor at compile time. - */ -#ifdef SK_CPU_BENDIAN -# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \ - (SK_ ## C3 ## 32_SHIFT == 0 && \ - SK_ ## C2 ## 32_SHIFT == 8 && \ - SK_ ## C1 ## 32_SHIFT == 16 && \ - SK_ ## C0 ## 32_SHIFT == 24) -#else -# define SK_PMCOLOR_BYTE_ORDER(C0, C1, C2, C3) \ - (SK_ ## C0 ## 32_SHIFT == 0 && \ - SK_ ## C1 ## 32_SHIFT == 8 && \ - SK_ ## C2 ## 32_SHIFT == 16 && \ - SK_ ## C3 ## 32_SHIFT == 24) -#endif - -#if defined SK_DEBUG && defined SK_BUILD_FOR_WIN - #ifdef free - #undef free - #endif - #include - #undef free -#endif - -#if !defined(SK_UNUSED) -# if !defined(__clang__) && defined(_MSC_VER) -# define SK_UNUSED __pragma(warning(suppress:4189)) -# else -# define SK_UNUSED SK_ATTRIBUTE(unused) -# endif -#endif - -/** - * If your judgment is better than the compiler's (i.e. you've profiled it), - * you can use SK_ALWAYS_INLINE to force inlining. E.g. - * inline void someMethod() { ... } // may not be inlined - * SK_ALWAYS_INLINE void someMethod() { ... } // should always be inlined - */ -#if !defined(SK_ALWAYS_INLINE) -# if defined(SK_BUILD_FOR_WIN) -# define SK_ALWAYS_INLINE __forceinline -# else -# define SK_ALWAYS_INLINE SK_ATTRIBUTE(always_inline) inline -# endif -#endif - -/** - * If your judgment is better than the compiler's (i.e. you've profiled it), - * you can use SK_NEVER_INLINE to prevent inlining. - */ -#if !defined(SK_NEVER_INLINE) -# if defined(SK_BUILD_FOR_WIN) -# define SK_NEVER_INLINE __declspec(noinline) -# else -# define SK_NEVER_INLINE SK_ATTRIBUTE(noinline) -# endif -#endif - -#ifndef SK_PRINTF_LIKE -# if defined(__clang__) || defined(__GNUC__) -# define SK_PRINTF_LIKE(A, B) __attribute__((format(printf, (A), (B)))) -# else -# define SK_PRINTF_LIKE(A, B) -# endif -#endif - -#ifndef SK_ALLOW_STATIC_GLOBAL_INITIALIZERS - #define SK_ALLOW_STATIC_GLOBAL_INITIALIZERS 0 -#endif - -#if !defined(SK_GAMMA_EXPONENT) - #define SK_GAMMA_EXPONENT (0.0f) // SRGB -#endif - -#ifndef GR_TEST_UTILS -# define GR_TEST_UTILS 0 -#endif - -#if !SK_SUPPORT_GPU - #define SK_GPU_V1 0 // always false if Ganesh is disabled -#elif !defined(SK_GPU_V1) -# define SK_GPU_V1 1 // otherwise default to v1 enabled -#endif - -#if defined(SK_HISTOGRAM_ENUMERATION) || \ - defined(SK_HISTOGRAM_BOOLEAN) || \ - defined(SK_HISTOGRAM_EXACT_LINEAR) || \ - defined(SK_HISTOGRAM_MEMORY_KB) -# define SK_HISTOGRAMS_ENABLED 1 -#else -# define SK_HISTOGRAMS_ENABLED 0 -#endif - -#ifndef SK_HISTOGRAM_BOOLEAN -# define SK_HISTOGRAM_BOOLEAN(name, sample) -#endif - -#ifndef SK_HISTOGRAM_ENUMERATION -# define SK_HISTOGRAM_ENUMERATION(name, sample, enum_size) -#endif - -#ifndef SK_HISTOGRAM_EXACT_LINEAR -# define SK_HISTOGRAM_EXACT_LINEAR(name, sample, value_max) -#endif - -#ifndef SK_HISTOGRAM_MEMORY_KB -# define SK_HISTOGRAM_MEMORY_KB(name, sample) -#endif - -#define SK_HISTOGRAM_PERCENTAGE(name, percent_as_int) \ - SK_HISTOGRAM_EXACT_LINEAR(name, percent_as_int, 101) - -#ifndef SK_DISABLE_LEGACY_SHADERCONTEXT -#define SK_ENABLE_LEGACY_SHADERCONTEXT -#endif - -#ifdef SK_ENABLE_API_AVAILABLE -#define SK_API_AVAILABLE API_AVAILABLE -#else -#define SK_API_AVAILABLE(...) -#endif - -#if defined(SK_BUILD_FOR_LIBFUZZER) || defined(SK_BUILD_FOR_AFL_FUZZ) - #define SK_BUILD_FOR_FUZZER -#endif - -/** Called internally if we hit an unrecoverable error. - The platform implementation must not return, but should either throw - an exception or otherwise exit. -*/ -[[noreturn]] SK_API extern void sk_abort_no_print(void); - -#ifndef SkDebugf - SK_API void SkDebugf(const char format[], ...) SK_PRINTF_LIKE(1, 2); -#endif - -// SkASSERT, SkASSERTF and SkASSERT_RELEASE can be used as stand alone assertion expressions, e.g. -// uint32_t foo(int x) { -// SkASSERT(x > 4); -// return x - 4; -// } -// and are also written to be compatible with constexpr functions: -// constexpr uint32_t foo(int x) { -// return SkASSERT(x > 4), -// x - 4; -// } -#define SkASSERT_RELEASE(cond) \ - static_cast( (cond) ? (void)0 : []{ SK_ABORT("assert(%s)", #cond); }() ) - -#ifdef SK_DEBUG - #define SkASSERT(cond) SkASSERT_RELEASE(cond) - #define SkASSERTF(cond, fmt, ...) static_cast( (cond) ? (void)0 : [&]{ \ - SkDebugf(fmt"\n", ##__VA_ARGS__); \ - SK_ABORT("assert(%s)", #cond); \ - }() ) - #define SkDEBUGFAIL(message) SK_ABORT("%s", message) - #define SkDEBUGFAILF(fmt, ...) SK_ABORT(fmt, ##__VA_ARGS__) - #define SkDEBUGCODE(...) __VA_ARGS__ - #define SkDEBUGF(...) SkDebugf(__VA_ARGS__) - #define SkAssertResult(cond) SkASSERT(cond) -#else - #define SkASSERT(cond) static_cast(0) - #define SkASSERTF(cond, fmt, ...) static_cast(0) - #define SkDEBUGFAIL(message) - #define SkDEBUGFAILF(fmt, ...) - #define SkDEBUGCODE(...) - #define SkDEBUGF(...) - - // unlike SkASSERT, this macro executes its condition in the non-debug build. - // The if is present so that this can be used with functions marked SK_WARN_UNUSED_RESULT. - #define SkAssertResult(cond) if (cond) {} do {} while(false) -#endif - -//////////////////////////////////////////////////////////////////////////////// - -/** Fast type for unsigned 8 bits. Use for parameter passing and local - variables, not for storage -*/ -typedef unsigned U8CPU; - -/** Fast type for unsigned 16 bits. Use for parameter passing and local - variables, not for storage -*/ -typedef unsigned U16CPU; - -/** @return false or true based on the condition -*/ -template static constexpr bool SkToBool(const T& x) { - return (bool)x; -} - -static constexpr int16_t SK_MaxS16 = INT16_MAX; -static constexpr int16_t SK_MinS16 = -SK_MaxS16; - -static constexpr int32_t SK_MaxS32 = INT32_MAX; -static constexpr int32_t SK_MinS32 = -SK_MaxS32; -static constexpr int32_t SK_NaN32 = INT32_MIN; - -static constexpr int64_t SK_MaxS64 = INT64_MAX; -static constexpr int64_t SK_MinS64 = -SK_MaxS64; - -static inline constexpr int32_t SkLeftShift(int32_t value, int32_t shift) { - return (int32_t) ((uint32_t) value << shift); -} - -static inline constexpr int64_t SkLeftShift(int64_t value, int32_t shift) { - return (int64_t) ((uint64_t) value << shift); -} - -//////////////////////////////////////////////////////////////////////////////// - -/** @return the number of entries in an array (not a pointer) -*/ -// The SkArrayCountHelper template returns a type 'char (&)[N]', a reference to an array of -// char with N elements, where N is deduced using function parameter type deduction. This is then -// used in the sizeof operator in SK_ARRAY_COUNT. The sizeof operator ignores the reference, and -// just evaluates the size of the array type. -// -// DEPRECATED: use std::size() instead. -// Note: Rarely, std::size(z) can't deduce the type of z during compile time for static_assert -// while SK_ARRAY_COUNT can. It can't be deduced because z is part of class, and the class' this -// pointer is not a valid constexpr expression. Use SkASSERT instead. -template char (&SkArrayCountHelper(T (&array)[N]))[N]; -#define SK_ARRAY_COUNT(array) (sizeof(SkArrayCountHelper(array))) - -//////////////////////////////////////////////////////////////////////////////// - -template static constexpr T SkAlign2(T x) { return (x + 1) >> 1 << 1; } -template static constexpr T SkAlign4(T x) { return (x + 3) >> 2 << 2; } -template static constexpr T SkAlign8(T x) { return (x + 7) >> 3 << 3; } - -template static constexpr bool SkIsAlign2(T x) { return 0 == (x & 1); } -template static constexpr bool SkIsAlign4(T x) { return 0 == (x & 3); } -template static constexpr bool SkIsAlign8(T x) { return 0 == (x & 7); } - -template static constexpr T SkAlignPtr(T x) { - return sizeof(void*) == 8 ? SkAlign8(x) : SkAlign4(x); -} -template static constexpr bool SkIsAlignPtr(T x) { - return sizeof(void*) == 8 ? SkIsAlign8(x) : SkIsAlign4(x); -} - -/** - * align up to a power of 2 - */ -static inline constexpr size_t SkAlignTo(size_t x, size_t alignment) { - // The same as alignment && SkIsPow2(value), w/o a dependency cycle. - SkASSERT(alignment && (alignment & (alignment - 1)) == 0); - return (x + alignment - 1) & ~(alignment - 1); -} - -typedef uint32_t SkFourByteTag; -static inline constexpr SkFourByteTag SkSetFourByteTag(char a, char b, char c, char d) { - return (((uint32_t)a << 24) | ((uint32_t)b << 16) | ((uint32_t)c << 8) | (uint32_t)d); -} - -//////////////////////////////////////////////////////////////////////////////// - -/** 32 bit integer to hold a unicode value -*/ -typedef int32_t SkUnichar; - -/** 16 bit unsigned integer to hold a glyph index -*/ -typedef uint16_t SkGlyphID; - -/** 32 bit value to hold a millisecond duration - Note that SK_MSecMax is about 25 days. -*/ -typedef uint32_t SkMSec; - -/** Maximum representable milliseconds; 24d 20h 31m 23.647s. -*/ -static constexpr SkMSec SK_MSecMax = INT32_MAX; - -/** The generation IDs in Skia reserve 0 has an invalid marker. -*/ -static constexpr uint32_t SK_InvalidGenID = 0; - -/** The unique IDs in Skia reserve 0 has an invalid marker. -*/ -static constexpr uint32_t SK_InvalidUniqueID = 0; - -static inline int32_t SkAbs32(int32_t value) { - SkASSERT(value != SK_NaN32); // The most negative int32_t can't be negated. - if (value < 0) { - value = -value; - } - return value; -} - -template static inline T SkTAbs(T value) { - if (value < 0) { - value = -value; - } - return value; -} - -//////////////////////////////////////////////////////////////////////////////// - -/** Indicates whether an allocation should count against a cache budget. -*/ -enum class SkBudgeted : bool { - kNo = false, - kYes = true -}; - -/** Indicates whether a backing store needs to be an exact match or can be - larger than is strictly necessary -*/ -enum class SkBackingFit { - kApprox, - kExact -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkUnPreMultiply.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkUnPreMultiply.h deleted file mode 100644 index b492619d0793c8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkUnPreMultiply.h +++ /dev/null @@ -1,56 +0,0 @@ - -/* - * Copyright 2008 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - - - -#ifndef SkUnPreMultiply_DEFINED -#define SkUnPreMultiply_DEFINED - -#include "include/core/SkColor.h" - -class SK_API SkUnPreMultiply { -public: - typedef uint32_t Scale; - - // index this table with alpha [0..255] - static const Scale* GetScaleTable() { - return gTable; - } - - static Scale GetScale(U8CPU alpha) { - SkASSERT(alpha <= 255); - return gTable[alpha]; - } - - /** Usage: - - const Scale* table = SkUnPreMultiply::GetScaleTable(); - - for (...) { - unsigned a = ... - SkUnPreMultiply::Scale scale = table[a]; - - red = SkUnPreMultiply::ApplyScale(scale, red); - ... - // now red is unpremultiplied - } - */ - static U8CPU ApplyScale(Scale scale, U8CPU component) { - SkASSERT(component <= 255); - return (scale * component + (1 << 23)) >> 24; - } - - static SkColor PMColorToColor(SkPMColor c); - -private: - static const uint32_t gTable[256]; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkVertices.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkVertices.h deleted file mode 100644 index fc53e9d01aaf8f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkVertices.h +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkVertices_DEFINED -#define SkVertices_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" - -class SkData; -struct SkPoint; -class SkVerticesPriv; - -/** - * An immutable set of vertex data that can be used with SkCanvas::drawVertices. - */ -class SK_API SkVertices : public SkNVRefCnt { - struct Desc; - struct Sizes; -public: - enum VertexMode { - kTriangles_VertexMode, - kTriangleStrip_VertexMode, - kTriangleFan_VertexMode, - - kLast_VertexMode = kTriangleFan_VertexMode, - }; - - /** - * Create a vertices by copying the specified arrays. texs, colors may be nullptr, - * and indices is ignored if indexCount == 0. - */ - static sk_sp MakeCopy(VertexMode mode, int vertexCount, - const SkPoint positions[], - const SkPoint texs[], - const SkColor colors[], - int indexCount, - const uint16_t indices[]); - - static sk_sp MakeCopy(VertexMode mode, int vertexCount, - const SkPoint positions[], - const SkPoint texs[], - const SkColor colors[]) { - return MakeCopy(mode, - vertexCount, - positions, - texs, - colors, - 0, - nullptr); - } - - enum BuilderFlags { - kHasTexCoords_BuilderFlag = 1 << 0, - kHasColors_BuilderFlag = 1 << 1, - }; - class Builder { - public: - Builder(VertexMode mode, int vertexCount, int indexCount, uint32_t flags); - - bool isValid() const { return fVertices != nullptr; } - - SkPoint* positions(); - uint16_t* indices(); // returns null if there are no indices - - // If we have custom attributes, these will always be null - SkPoint* texCoords(); // returns null if there are no texCoords - SkColor* colors(); // returns null if there are no colors - - // Detach the built vertices object. After the first call, this will always return null. - sk_sp detach(); - - private: - Builder(const Desc&); - - void init(const Desc&); - - // holds a partially complete object. only completed in detach() - sk_sp fVertices; - // Extra storage for intermediate vertices in the case where the client specifies indexed - // triangle fans. These get converted to indexed triangles when the Builder is finalized. - std::unique_ptr fIntermediateFanIndices; - - friend class SkVertices; - friend class SkVerticesPriv; - }; - - uint32_t uniqueID() const { return fUniqueID; } - const SkRect& bounds() const { return fBounds; } - - // returns approximate byte size of the vertices object - size_t approximateSize() const; - - // Provides access to functions that aren't part of the public API. - SkVerticesPriv priv(); - const SkVerticesPriv priv() const; // NOLINT(readability-const-return-type) - -private: - SkVertices() {} - - friend class SkVerticesPriv; - - // these are needed since we've manually sized our allocation (see Builder::init) - friend class SkNVRefCnt; - void operator delete(void* p); - - Sizes getSizes() const; - - // we store this first, to pair with the refcnt in our base-class, so we don't have an - // unnecessary pad between it and the (possibly 8-byte aligned) ptrs. - uint32_t fUniqueID; - - // these point inside our allocation, so none of these can be "freed" - SkPoint* fPositions; // [vertexCount] - uint16_t* fIndices; // [indexCount] or null - SkPoint* fTexs; // [vertexCount] or null - SkColor* fColors; // [vertexCount] or null - - SkRect fBounds; // computed to be the union of the fPositions[] - int fVertexCount; - int fIndexCount; - - VertexMode fMode; - // below here is where the actual array data is stored. -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAInfo.h deleted file mode 100644 index a3cf210f370994..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAInfo.h +++ /dev/null @@ -1,304 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkYUVAInfo_DEFINED -#define SkYUVAInfo_DEFINED - -#include "include/codec/SkEncodedOrigin.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkSize.h" - -#include -#include - -/** - * Specifies the structure of planes for a YUV image with optional alpha. The actual planar data - * is not part of this structure and depending on usage is in external textures or pixmaps. - */ -class SK_API SkYUVAInfo { -public: - enum YUVAChannels { kY, kU, kV, kA, kLast = kA }; - static constexpr int kYUVAChannelCount = static_cast(YUVAChannels::kLast + 1); - - struct YUVALocation; // For internal use. - using YUVALocations = std::array; - - /** - * Specifies how YUV (and optionally A) are divided among planes. Planes are separated by - * underscores in the enum value names. Within each plane the pixmap/texture channels are - * mapped to the YUVA channels in the order specified, e.g. for kY_UV Y is in channel 0 of plane - * 0, U is in channel 0 of plane 1, and V is in channel 1 of plane 1. Channel ordering - * within a pixmap/texture given the channels it contains: - * A: 0:A - * Luminance/Gray: 0:Gray - * Luminance/Gray + Alpha: 0:Gray, 1:A - * RG 0:R, 1:G - * RGB 0:R, 1:G, 2:B - * RGBA 0:R, 1:G, 2:B, 3:A - */ - enum class PlaneConfig { - kUnknown, - - kY_U_V, ///< Plane 0: Y, Plane 1: U, Plane 2: V - kY_V_U, ///< Plane 0: Y, Plane 1: V, Plane 2: U - kY_UV, ///< Plane 0: Y, Plane 1: UV - kY_VU, ///< Plane 0: Y, Plane 1: VU - kYUV, ///< Plane 0: YUV - kUYV, ///< Plane 0: UYV - - kY_U_V_A, ///< Plane 0: Y, Plane 1: U, Plane 2: V, Plane 3: A - kY_V_U_A, ///< Plane 0: Y, Plane 1: V, Plane 2: U, Plane 3: A - kY_UV_A, ///< Plane 0: Y, Plane 1: UV, Plane 2: A - kY_VU_A, ///< Plane 0: Y, Plane 1: VU, Plane 2: A - kYUVA, ///< Plane 0: YUVA - kUYVA, ///< Plane 0: UYVA - - kLast = kUYVA - }; - - /** - * UV subsampling is also specified in the enum value names using J:a:b notation (e.g. 4:2:0 is - * 1/2 horizontal and 1/2 vertical resolution for U and V). If alpha is present it is not sub- - * sampled. Note that Subsampling values other than k444 are only valid with PlaneConfig values - * that have U and V in different planes than Y (and A, if present). - */ - enum class Subsampling { - kUnknown, - - k444, ///< No subsampling. UV values for each Y. - k422, ///< 1 set of UV values for each 2x1 block of Y values. - k420, ///< 1 set of UV values for each 2x2 block of Y values. - k440, ///< 1 set of UV values for each 1x2 block of Y values. - k411, ///< 1 set of UV values for each 4x1 block of Y values. - k410, ///< 1 set of UV values for each 4x2 block of Y values. - - kLast = k410 - }; - - /** - * Describes how subsampled chroma values are sited relative to luma values. - * - * Currently only centered siting is supported but will expand to support additional sitings. - */ - enum class Siting { - /** - * Subsampled chroma value is sited at the center of the block of corresponding luma values. - */ - kCentered, - }; - - static constexpr int kMaxPlanes = 4; - - /** ratio of Y/A values to U/V values in x and y. */ - static std::tuple SubsamplingFactors(Subsampling); - - /** - * SubsamplingFactors(Subsampling) if planedIdx refers to a U/V plane and otherwise {1, 1} if - * inputs are valid. Invalid inputs consist of incompatible PlaneConfig/Subsampling/planeIdx - * combinations. {0, 0} is returned for invalid inputs. - */ - static std::tuple PlaneSubsamplingFactors(PlaneConfig, Subsampling, int planeIdx); - - /** - * Given image dimensions, a planer configuration, subsampling, and origin, determine the - * expected size of each plane. Returns the number of expected planes. planeDimensions[0] - * through planeDimensions[] are written. The input image dimensions are as displayed - * (after the planes have been transformed to the intended display orientation). The plane - * dimensions are output as the planes are stored in memory (may be rotated from image - * dimensions). - */ - static int PlaneDimensions(SkISize imageDimensions, - PlaneConfig, - Subsampling, - SkEncodedOrigin, - SkISize planeDimensions[kMaxPlanes]); - - /** Number of planes for a given PlaneConfig. */ - static constexpr int NumPlanes(PlaneConfig); - - /** - * Number of Y, U, V, A channels in the ith plane for a given PlaneConfig (or 0 if i is - * invalid). - */ - static constexpr int NumChannelsInPlane(PlaneConfig, int i); - - /** - * Given a PlaneConfig and a set of channel flags for each plane, convert to YUVALocations - * representation. Fails if channel flags aren't valid for the PlaneConfig (i.e. don't have - * enough channels in a plane) by returning an invalid set of locations (plane indices are -1). - */ - static YUVALocations GetYUVALocations(PlaneConfig, const uint32_t* planeChannelFlags); - - /** Does the PlaneConfig have alpha values? */ - static bool HasAlpha(PlaneConfig); - - SkYUVAInfo() = default; - SkYUVAInfo(const SkYUVAInfo&) = default; - - /** - * 'dimensions' should specify the size of the full resolution image (after planes have been - * oriented to how the image is displayed as indicated by 'origin'). - */ - SkYUVAInfo(SkISize dimensions, - PlaneConfig, - Subsampling, - SkYUVColorSpace, - SkEncodedOrigin origin = kTopLeft_SkEncodedOrigin, - Siting sitingX = Siting::kCentered, - Siting sitingY = Siting::kCentered); - - SkYUVAInfo& operator=(const SkYUVAInfo& that) = default; - - PlaneConfig planeConfig() const { return fPlaneConfig; } - Subsampling subsampling() const { return fSubsampling; } - - std::tuple planeSubsamplingFactors(int planeIdx) const { - return PlaneSubsamplingFactors(fPlaneConfig, fSubsampling, planeIdx); - } - - /** - * Dimensions of the full resolution image (after planes have been oriented to how the image - * is displayed as indicated by fOrigin). - */ - SkISize dimensions() const { return fDimensions; } - int width() const { return fDimensions.width(); } - int height() const { return fDimensions.height(); } - - SkYUVColorSpace yuvColorSpace() const { return fYUVColorSpace; } - Siting sitingX() const { return fSitingX; } - Siting sitingY() const { return fSitingY; } - - SkEncodedOrigin origin() const { return fOrigin; } - - SkMatrix originMatrix() const { - return SkEncodedOriginToMatrix(fOrigin, this->width(), this->height()); - } - - bool hasAlpha() const { return HasAlpha(fPlaneConfig); } - - /** - * Returns the number of planes and initializes planeDimensions[0]..planeDimensions[] to - * the expected dimensions for each plane. Dimensions are as stored in memory, before - * transformation to image display space as indicated by origin(). - */ - int planeDimensions(SkISize planeDimensions[kMaxPlanes]) const { - return PlaneDimensions(fDimensions, fPlaneConfig, fSubsampling, fOrigin, planeDimensions); - } - - /** - * Given a per-plane row bytes, determine size to allocate for all planes. Optionally retrieves - * the per-plane byte sizes in planeSizes if not null. If total size overflows will return - * SIZE_MAX and set all planeSizes to SIZE_MAX. - */ - size_t computeTotalBytes(const size_t rowBytes[kMaxPlanes], - size_t planeSizes[kMaxPlanes] = nullptr) const; - - int numPlanes() const { return NumPlanes(fPlaneConfig); } - - int numChannelsInPlane(int i) const { return NumChannelsInPlane(fPlaneConfig, i); } - - /** - * Given a set of channel flags for each plane, converts this->planeConfig() to YUVALocations - * representation. Fails if the channel flags aren't valid for the PlaneConfig (i.e. don't have - * enough channels in a plane) by returning default initialized locations (all plane indices are - * -1). - */ - YUVALocations toYUVALocations(const uint32_t* channelFlags) const; - - /** - * Makes a SkYUVAInfo that is identical to this one but with the passed Subsampling. If the - * passed Subsampling is not k444 and this info's PlaneConfig is not compatible with chroma - * subsampling (because Y is in the same plane as UV) then the result will be an invalid - * SkYUVAInfo. - */ - SkYUVAInfo makeSubsampling(SkYUVAInfo::Subsampling) const; - - /** - * Makes a SkYUVAInfo that is identical to this one but with the passed dimensions. If the - * passed dimensions is empty then the result will be an invalid SkYUVAInfo. - */ - SkYUVAInfo makeDimensions(SkISize) const; - - bool operator==(const SkYUVAInfo& that) const; - bool operator!=(const SkYUVAInfo& that) const { return !(*this == that); } - - bool isValid() const { return fPlaneConfig != PlaneConfig::kUnknown; } - -private: - SkISize fDimensions = {0, 0}; - - PlaneConfig fPlaneConfig = PlaneConfig::kUnknown; - Subsampling fSubsampling = Subsampling::kUnknown; - - SkYUVColorSpace fYUVColorSpace = SkYUVColorSpace::kIdentity_SkYUVColorSpace; - - /** - * YUVA data often comes from formats like JPEG that support EXIF orientation. - * Code that operates on the raw YUV data often needs to know that orientation. - */ - SkEncodedOrigin fOrigin = kTopLeft_SkEncodedOrigin; - - Siting fSitingX = Siting::kCentered; - Siting fSitingY = Siting::kCentered; -}; - -constexpr int SkYUVAInfo::NumPlanes(PlaneConfig planeConfig) { - switch (planeConfig) { - case PlaneConfig::kUnknown: return 0; - case PlaneConfig::kY_U_V: return 3; - case PlaneConfig::kY_V_U: return 3; - case PlaneConfig::kY_UV: return 2; - case PlaneConfig::kY_VU: return 2; - case PlaneConfig::kYUV: return 1; - case PlaneConfig::kUYV: return 1; - case PlaneConfig::kY_U_V_A: return 4; - case PlaneConfig::kY_V_U_A: return 4; - case PlaneConfig::kY_UV_A: return 3; - case PlaneConfig::kY_VU_A: return 3; - case PlaneConfig::kYUVA: return 1; - case PlaneConfig::kUYVA: return 1; - } - SkUNREACHABLE; -} - -constexpr int SkYUVAInfo::NumChannelsInPlane(PlaneConfig config, int i) { - switch (config) { - case PlaneConfig::kUnknown: - return 0; - - case SkYUVAInfo::PlaneConfig::kY_U_V: - case SkYUVAInfo::PlaneConfig::kY_V_U: - return i >= 0 && i < 3 ? 1 : 0; - case SkYUVAInfo::PlaneConfig::kY_UV: - case SkYUVAInfo::PlaneConfig::kY_VU: - switch (i) { - case 0: return 1; - case 1: return 2; - default: return 0; - } - case SkYUVAInfo::PlaneConfig::kYUV: - case SkYUVAInfo::PlaneConfig::kUYV: - return i == 0 ? 3 : 0; - case SkYUVAInfo::PlaneConfig::kY_U_V_A: - case SkYUVAInfo::PlaneConfig::kY_V_U_A: - return i >= 0 && i < 4 ? 1 : 0; - case SkYUVAInfo::PlaneConfig::kY_UV_A: - case SkYUVAInfo::PlaneConfig::kY_VU_A: - switch (i) { - case 0: return 1; - case 1: return 2; - case 2: return 1; - default: return 0; - } - case SkYUVAInfo::PlaneConfig::kYUVA: - case SkYUVAInfo::PlaneConfig::kUYVA: - return i == 0 ? 4 : 0; - } - return 0; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAPixmaps.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAPixmaps.h deleted file mode 100644 index de04ab14dc3c9a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/core/SkYUVAPixmaps.h +++ /dev/null @@ -1,336 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkYUVAPixmaps_DEFINED -#define SkYUVAPixmaps_DEFINED - -#include "include/core/SkData.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkYUVAInfo.h" -#include "include/private/SkTo.h" - -#include -#include - -class GrImageContext; - -/** - * SkYUVAInfo combined with per-plane SkColorTypes and row bytes. Fully specifies the SkPixmaps - * for a YUVA image without the actual pixel memory and data. - */ -class SK_API SkYUVAPixmapInfo { -public: - static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes; - - using PlaneConfig = SkYUVAInfo::PlaneConfig; - using Subsampling = SkYUVAInfo::Subsampling; - - /** - * Data type for Y, U, V, and possibly A channels independent of how values are packed into - * planes. - **/ - enum class DataType { - kUnorm8, ///< 8 bit unsigned normalized - kUnorm16, ///< 16 bit unsigned normalized - kFloat16, ///< 16 bit (half) floating point - kUnorm10_Unorm2, ///< 10 bit unorm for Y, U, and V. 2 bit unorm for alpha (if present). - - kLast = kUnorm10_Unorm2 - }; - static constexpr int kDataTypeCnt = static_cast(DataType::kLast) + 1; - - class SK_API SupportedDataTypes { - public: - /** Defaults to nothing supported. */ - constexpr SupportedDataTypes() = default; - - /** Init based on texture formats supported by the context. */ - SupportedDataTypes(const GrImageContext&); - - /** All legal combinations of PlaneConfig and DataType are supported. */ - static constexpr SupportedDataTypes All(); - - /** - * Checks whether there is a supported combination of color types for planes structured - * as indicated by PlaneConfig with channel data types as indicated by DataType. - */ - constexpr bool supported(PlaneConfig, DataType) const; - - /** - * Update to add support for pixmaps with numChannel channels where each channel is - * represented as DataType. - */ - void enableDataType(DataType, int numChannels); - - private: - // The bit for DataType dt with n channels is at index kDataTypeCnt*(n-1) + dt. - std::bitset fDataTypeSupport = {}; - }; - - /** - * Gets the default SkColorType to use with numChannels channels, each represented as DataType. - * Returns kUnknown_SkColorType if no such color type. - */ - static constexpr SkColorType DefaultColorTypeForDataType(DataType dataType, int numChannels); - - /** - * If the SkColorType is supported for YUVA pixmaps this will return the number of YUVA channels - * that can be stored in a plane of this color type and what the DataType is of those channels. - * If the SkColorType is not supported as a YUVA plane the number of channels is reported as 0 - * and the DataType returned should be ignored. - */ - static std::tuple NumChannelsAndDataType(SkColorType); - - /** Default SkYUVAPixmapInfo is invalid. */ - SkYUVAPixmapInfo() = default; - - /** - * Initializes the SkYUVAPixmapInfo from a SkYUVAInfo with per-plane color types and row bytes. - * This will be invalid if the colorTypes aren't compatible with the SkYUVAInfo or if a - * rowBytes entry is not valid for the plane dimensions and color type. Color type and - * row byte values beyond the number of planes in SkYUVAInfo are ignored. All SkColorTypes - * must have the same DataType or this will be invalid. - * - * If rowBytes is nullptr then bpp*width is assumed for each plane. - */ - SkYUVAPixmapInfo(const SkYUVAInfo&, - const SkColorType[kMaxPlanes], - const size_t rowBytes[kMaxPlanes]); - /** - * Like above but uses DefaultColorTypeForDataType to determine each plane's SkColorType. If - * rowBytes is nullptr then bpp*width is assumed for each plane. - */ - SkYUVAPixmapInfo(const SkYUVAInfo&, DataType, const size_t rowBytes[kMaxPlanes]); - - SkYUVAPixmapInfo(const SkYUVAPixmapInfo&) = default; - - SkYUVAPixmapInfo& operator=(const SkYUVAPixmapInfo&) = default; - - bool operator==(const SkYUVAPixmapInfo&) const; - bool operator!=(const SkYUVAPixmapInfo& that) const { return !(*this == that); } - - const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; } - - SkYUVColorSpace yuvColorSpace() const { return fYUVAInfo.yuvColorSpace(); } - - /** The number of SkPixmap planes, 0 if this SkYUVAPixmapInfo is invalid. */ - int numPlanes() const { return fYUVAInfo.numPlanes(); } - - /** The per-YUV[A] channel data type. */ - DataType dataType() const { return fDataType; } - - /** - * Row bytes for the ith plane. Returns zero if i >= numPlanes() or this SkYUVAPixmapInfo is - * invalid. - */ - size_t rowBytes(int i) const { return fRowBytes[static_cast(i)]; } - - /** Image info for the ith plane, or default SkImageInfo if i >= numPlanes() */ - const SkImageInfo& planeInfo(int i) const { return fPlaneInfos[static_cast(i)]; } - - /** - * Determine size to allocate for all planes. Optionally retrieves the per-plane sizes in - * planeSizes if not null. If total size overflows will return SIZE_MAX and set all planeSizes - * to SIZE_MAX. Returns 0 and fills planesSizes with 0 if this SkYUVAPixmapInfo is not valid. - */ - size_t computeTotalBytes(size_t planeSizes[kMaxPlanes] = nullptr) const; - - /** - * Takes an allocation that is assumed to be at least computeTotalBytes() in size and configures - * the first numPlanes() entries in pixmaps array to point into that memory. The remaining - * entries of pixmaps are default initialized. Fails if this SkYUVAPixmapInfo not valid. - */ - bool initPixmapsFromSingleAllocation(void* memory, SkPixmap pixmaps[kMaxPlanes]) const; - - /** - * Returns true if this has been configured with a non-empty dimensioned SkYUVAInfo with - * compatible color types and row bytes. - */ - bool isValid() const { return fYUVAInfo.isValid(); } - - /** Is this valid and does it use color types allowed by the passed SupportedDataTypes? */ - bool isSupported(const SupportedDataTypes&) const; - -private: - SkYUVAInfo fYUVAInfo; - std::array fPlaneInfos = {}; - std::array fRowBytes = {}; - DataType fDataType = DataType::kUnorm8; - static_assert(kUnknown_SkColorType == 0, "default init isn't kUnknown"); -}; - -/** - * Helper to store SkPixmap planes as described by a SkYUVAPixmapInfo. Can be responsible for - * allocating/freeing memory for pixmaps or use external memory. - */ -class SK_API SkYUVAPixmaps { -public: - using DataType = SkYUVAPixmapInfo::DataType; - static constexpr auto kMaxPlanes = SkYUVAPixmapInfo::kMaxPlanes; - - static SkColorType RecommendedRGBAColorType(DataType); - - /** Allocate space for pixmaps' pixels in the SkYUVAPixmaps. */ - static SkYUVAPixmaps Allocate(const SkYUVAPixmapInfo& yuvaPixmapInfo); - - /** - * Use storage in SkData as backing store for pixmaps' pixels. SkData is retained by the - * SkYUVAPixmaps. - */ - static SkYUVAPixmaps FromData(const SkYUVAPixmapInfo&, sk_sp); - - /** - * Makes a deep copy of the src SkYUVAPixmaps. The returned SkYUVAPixmaps owns its planes' - * backing stores. - */ - static SkYUVAPixmaps MakeCopy(const SkYUVAPixmaps& src); - - /** - * Use passed in memory as backing store for pixmaps' pixels. Caller must ensure memory remains - * allocated while pixmaps are in use. There must be at least - * SkYUVAPixmapInfo::computeTotalBytes() allocated starting at memory. - */ - static SkYUVAPixmaps FromExternalMemory(const SkYUVAPixmapInfo&, void* memory); - - /** - * Wraps existing SkPixmaps. The SkYUVAPixmaps will have no ownership of the SkPixmaps' pixel - * memory so the caller must ensure it remains valid. Will return an invalid SkYUVAPixmaps if - * the SkYUVAInfo isn't compatible with the SkPixmap array (number of planes, plane dimensions, - * sufficient color channels in planes, ...). - */ - static SkYUVAPixmaps FromExternalPixmaps(const SkYUVAInfo&, const SkPixmap[kMaxPlanes]); - - /** Default SkYUVAPixmaps is invalid. */ - SkYUVAPixmaps() = default; - ~SkYUVAPixmaps() = default; - - SkYUVAPixmaps(SkYUVAPixmaps&& that) = default; - SkYUVAPixmaps& operator=(SkYUVAPixmaps&& that) = default; - SkYUVAPixmaps(const SkYUVAPixmaps&) = default; - SkYUVAPixmaps& operator=(const SkYUVAPixmaps& that) = default; - - /** Does have initialized pixmaps compatible with its SkYUVAInfo. */ - bool isValid() const { return !fYUVAInfo.dimensions().isEmpty(); } - - const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; } - - DataType dataType() const { return fDataType; } - - SkYUVAPixmapInfo pixmapsInfo() const; - - /** Number of pixmap planes or 0 if this SkYUVAPixmaps is invalid. */ - int numPlanes() const { return this->isValid() ? fYUVAInfo.numPlanes() : 0; } - - /** - * Access the SkPixmap planes. They are default initialized if this is not a valid - * SkYUVAPixmaps. - */ - const std::array& planes() const { return fPlanes; } - - /** - * Get the ith SkPixmap plane. SkPixmap will be default initialized if i >= numPlanes or this - * SkYUVAPixmaps is invalid. - */ - const SkPixmap& plane(int i) const { return fPlanes[SkToSizeT(i)]; } - - /** - * Computes a YUVALocations representation of the planar layout. The result is guaranteed to be - * valid if this->isValid(). - */ - SkYUVAInfo::YUVALocations toYUVALocations() const; - - /** Does this SkPixmaps own the backing store of the planes? */ - bool ownsStorage() const { return SkToBool(fData); } - -private: - SkYUVAPixmaps(const SkYUVAPixmapInfo&, sk_sp); - SkYUVAPixmaps(const SkYUVAInfo&, DataType, const SkPixmap[kMaxPlanes]); - - std::array fPlanes = {}; - sk_sp fData; - SkYUVAInfo fYUVAInfo; - DataType fDataType; -}; - -////////////////////////////////////////////////////////////////////////////// - -constexpr SkYUVAPixmapInfo::SupportedDataTypes SkYUVAPixmapInfo::SupportedDataTypes::All() { - using ULL = unsigned long long; // bitset cons. takes this. - ULL bits = 0; - for (ULL c = 1; c <= 4; ++c) { - for (ULL dt = 0; dt <= ULL(kDataTypeCnt); ++dt) { - if (DefaultColorTypeForDataType(static_cast(dt), - static_cast(c)) != kUnknown_SkColorType) { - bits |= ULL(1) << (dt + static_cast(kDataTypeCnt)*(c - 1)); - } - } - } - SupportedDataTypes combinations; - combinations.fDataTypeSupport = bits; - return combinations; -} - -constexpr bool SkYUVAPixmapInfo::SupportedDataTypes::supported(PlaneConfig config, - DataType type) const { - int n = SkYUVAInfo::NumPlanes(config); - for (int i = 0; i < n; ++i) { - auto c = static_cast(SkYUVAInfo::NumChannelsInPlane(config, i)); - SkASSERT(c >= 1 && c <= 4); - if (!fDataTypeSupport[static_cast(type) + - (c - 1)*static_cast(kDataTypeCnt)]) { - return false; - } - } - return true; -} - -constexpr SkColorType SkYUVAPixmapInfo::DefaultColorTypeForDataType(DataType dataType, - int numChannels) { - switch (numChannels) { - case 1: - switch (dataType) { - case DataType::kUnorm8: return kGray_8_SkColorType; - case DataType::kUnorm16: return kA16_unorm_SkColorType; - case DataType::kFloat16: return kA16_float_SkColorType; - case DataType::kUnorm10_Unorm2: return kUnknown_SkColorType; - } - break; - case 2: - switch (dataType) { - case DataType::kUnorm8: return kR8G8_unorm_SkColorType; - case DataType::kUnorm16: return kR16G16_unorm_SkColorType; - case DataType::kFloat16: return kR16G16_float_SkColorType; - case DataType::kUnorm10_Unorm2: return kUnknown_SkColorType; - } - break; - case 3: - // None of these are tightly packed. The intended use case is for interleaved YUVA - // planes where we're forcing opaqueness by ignoring the alpha values. - // There are "x" rather than "A" variants for Unorm8 and Unorm10_Unorm2 but we don't - // choose them because 1) there is no inherent advantage and 2) there is better support - // in the GPU backend for the "A" versions. - switch (dataType) { - case DataType::kUnorm8: return kRGBA_8888_SkColorType; - case DataType::kUnorm16: return kR16G16B16A16_unorm_SkColorType; - case DataType::kFloat16: return kRGBA_F16_SkColorType; - case DataType::kUnorm10_Unorm2: return kRGBA_1010102_SkColorType; - } - break; - case 4: - switch (dataType) { - case DataType::kUnorm8: return kRGBA_8888_SkColorType; - case DataType::kUnorm16: return kR16G16B16A16_unorm_SkColorType; - case DataType::kFloat16: return kRGBA_F16_SkColorType; - case DataType::kUnorm10_Unorm2: return kRGBA_1010102_SkColorType; - } - break; - } - return kUnknown_SkColorType; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkPDFDocument.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkPDFDocument.h deleted file mode 100644 index bf131848baa129..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkPDFDocument.h +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright 2018 Google LLC. -// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file. -#ifndef SkPDFDocument_DEFINED -#define SkPDFDocument_DEFINED - -#include "include/core/SkDocument.h" - -#include - -#include "include/core/SkColor.h" -#include "include/core/SkMilestone.h" -#include "include/core/SkScalar.h" -#include "include/core/SkString.h" -#include "include/core/SkTime.h" -#include "include/private/SkNoncopyable.h" - -#define SKPDF_STRING(X) SKPDF_STRING_IMPL(X) -#define SKPDF_STRING_IMPL(X) #X - -class SkExecutor; -class SkPDFArray; -class SkPDFTagTree; - -namespace SkPDF { - -/** Attributes for nodes in the PDF tree. */ -class SK_API AttributeList : SkNoncopyable { -public: - AttributeList(); - ~AttributeList(); - - // Each attribute must have an owner (e.g. "Layout", "List", "Table", etc) - // and an attribute name (e.g. "BBox", "RowSpan", etc.) from PDF32000_2008 14.8.5, - // and then a value of the proper type according to the spec. - void appendInt(const char* owner, const char* name, int value); - void appendFloat(const char* owner, const char* name, float value); - void appendName(const char* owner, const char* attrName, const char* value); - void appendFloatArray(const char* owner, - const char* name, - const std::vector& value); - void appendNodeIdArray(const char* owner, - const char* attrName, - const std::vector& nodeIds); - -private: - friend class ::SkPDFTagTree; - - std::unique_ptr fAttrs; -}; - -/** A node in a PDF structure tree, giving a semantic representation - of the content. Each node ID is associated with content - by passing the SkCanvas and node ID to SkPDF::SetNodeId() when drawing. - NodeIDs should be unique within each tree. -*/ -struct StructureElementNode { - SkString fTypeString; - std::vector> fChildVector; - int fNodeId = 0; - std::vector fAdditionalNodeIds; - AttributeList fAttributes; - SkString fAlt; - SkString fLang; -}; - -/** Optional metadata to be passed into the PDF factory function. -*/ -struct Metadata { - /** The document's title. - */ - SkString fTitle; - - /** The name of the person who created the document. - */ - SkString fAuthor; - - /** The subject of the document. - */ - SkString fSubject; - - /** Keywords associated with the document. Commas may be used to delineate - keywords within the string. - */ - SkString fKeywords; - - /** If the document was converted to PDF from another format, - the name of the conforming product that created the - original document from which it was converted. - */ - SkString fCreator; - - /** The product that is converting this document to PDF. - */ - SkString fProducer = SkString("Skia/PDF m" SKPDF_STRING(SK_MILESTONE)); - - /** The date and time the document was created. - The zero default value represents an unknown/unset time. - */ - SkTime::DateTime fCreation = {0, 0, 0, 0, 0, 0, 0, 0}; - - /** The date and time the document was most recently modified. - The zero default value represents an unknown/unset time. - */ - SkTime::DateTime fModified = {0, 0, 0, 0, 0, 0, 0, 0}; - - /** The DPI (pixels-per-inch) at which features without native PDF support - will be rasterized (e.g. draw image with perspective, draw text with - perspective, ...) A larger DPI would create a PDF that reflects the - original intent with better fidelity, but it can make for larger PDF - files too, which would use more memory while rendering, and it would be - slower to be processed or sent online or to printer. - */ - SkScalar fRasterDPI = SK_ScalarDefaultRasterDPI; - - /** If true, include XMP metadata, a document UUID, and sRGB output intent - information. This adds length to the document and makes it - non-reproducable, but are necessary features for PDF/A-2b conformance - */ - bool fPDFA = false; - - /** Encoding quality controls the trade-off between size and quality. By - default this is set to 101 percent, which corresponds to lossless - encoding. If this value is set to a value <= 100, and the image is - opaque, it will be encoded (using JPEG) with that quality setting. - */ - int fEncodingQuality = 101; - - /** An optional tree of structured document tags that provide - a semantic representation of the content. The caller - should retain ownership. - */ - StructureElementNode* fStructureElementTreeRoot = nullptr; - - /** Executor to handle threaded work within PDF Backend. If this is nullptr, - then all work will be done serially on the main thread. To have worker - threads assist with various tasks, set this to a valid SkExecutor - instance. Currently used for executing Deflate algorithm in parallel. - - If set, the PDF output will be non-reproducible in the order and - internal numbering of objects, but should render the same. - - Experimental. - */ - SkExecutor* fExecutor = nullptr; - - /** Preferred Subsetter. Only respected if both are compiled in. - - The Sfntly subsetter is deprecated. - - Experimental. - */ - enum Subsetter { - kHarfbuzz_Subsetter, - kSfntly_Subsetter, - } fSubsetter = kHarfbuzz_Subsetter; -}; - -/** Associate a node ID with subsequent drawing commands in an - SkCanvas. The same node ID can appear in a StructureElementNode - in order to associate a document's structure element tree with - its content. - - A node ID of zero indicates no node ID. - - @param canvas The canvas used to draw to the PDF. - @param nodeId The node ID for subsequent drawing commands. -*/ -SK_API void SetNodeId(SkCanvas* dst, int nodeID); - -/** Create a PDF-backed document, writing the results into a SkWStream. - - PDF pages are sized in point units. 1 pt == 1/72 inch == 127/360 mm. - - @param stream A PDF document will be written to this stream. The document may write - to the stream at anytime during its lifetime, until either close() is - called or the document is deleted. - @param metadata a PDFmetadata object. Any fields may be left empty. - - @returns NULL if there is an error, otherwise a newly created PDF-backed SkDocument. -*/ -SK_API sk_sp MakeDocument(SkWStream* stream, const Metadata& metadata); - -static inline sk_sp MakeDocument(SkWStream* stream) { - return MakeDocument(stream, Metadata()); -} - -} // namespace SkPDF - -#undef SKPDF_STRING -#undef SKPDF_STRING_IMPL -#endif // SkPDFDocument_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkXPSDocument.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkXPSDocument.h deleted file mode 100644 index 5cd0777c9b17c7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/docs/SkXPSDocument.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkXPSDocument_DEFINED -#define SkXPSDocument_DEFINED - -#include "include/core/SkTypes.h" - -#ifdef SK_BUILD_FOR_WIN - -#include "include/core/SkDocument.h" - -struct IXpsOMObjectFactory; - -namespace SkXPS { - -SK_API sk_sp MakeDocument(SkWStream* stream, - IXpsOMObjectFactory* xpsFactory, - SkScalar dpi = SK_ScalarDefaultRasterDPI); - -} // namespace SkXPS -#endif // SK_BUILD_FOR_WIN -#endif // SkXPSDocument_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk1DPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk1DPathEffect.h deleted file mode 100644 index fd05c52df7c8b9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk1DPathEffect.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef Sk1DPathEffect_DEFINED -#define Sk1DPathEffect_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkPath; -class SkPathEffect; - -class SK_API SkPath1DPathEffect { -public: - enum Style { - kTranslate_Style, // translate the shape to each position - kRotate_Style, // rotate the shape about its center - kMorph_Style, // transform each point, and turn lines into curves - - kLastEnum_Style = kMorph_Style, - }; - - /** Dash by replicating the specified path. - @param path The path to replicate (dash) - @param advance The space between instances of path - @param phase distance (mod advance) along path for its initial position - @param style how to transform path at each point (based on the current - position and tangent) - */ - static sk_sp Make(const SkPath& path, SkScalar advance, SkScalar phase, Style); - - static void RegisterFlattenables(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk2DPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk2DPathEffect.h deleted file mode 100644 index b8b3ba39817b4c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/Sk2DPathEffect.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef Sk2DPathEffect_DEFINED -#define Sk2DPathEffect_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkMatrix; -class SkPath; -class SkPathEffect; - -class SK_API SkLine2DPathEffect { -public: - static sk_sp Make(SkScalar width, const SkMatrix& matrix); - - static void RegisterFlattenables(); -}; - -class SK_API SkPath2DPathEffect { -public: - static sk_sp Make(const SkMatrix& matrix, const SkPath& path); - - static void RegisterFlattenables(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlenders.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlenders.h deleted file mode 100644 index 7507071b056135..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlenders.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlenders_DEFINED -#define SkBlenders_DEFINED - -#include "include/core/SkBlender.h" - -class SK_API SkBlenders { -public: - /** - * Create a blender that implements the following: - * k1 * src * dst + k2 * src + k3 * dst + k4 - * @param k1, k2, k3, k4 The four coefficients. - * @param enforcePMColor If true, the RGB channels will be clamped to the calculated alpha. - */ - static sk_sp Arithmetic(float k1, float k2, float k3, float k4, bool enforcePremul); - -private: - SkBlenders() = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurDrawLooper.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurDrawLooper.h deleted file mode 100644 index fc766f807aa47f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurDrawLooper.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2008 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlurDrawLooper_DEFINED -#define SkBlurDrawLooper_DEFINED - -#include "include/core/SkDrawLooper.h" - -#ifndef SK_SUPPORT_LEGACY_DRAWLOOPER -#error "SkDrawLooper is unsupported" -#endif - -/** - * DEPRECATED: No longer supported in Skia. - */ -namespace SkBlurDrawLooper { - sk_sp SK_API Make(SkColor4f color, SkColorSpace* cs, - SkScalar sigma, SkScalar dx, SkScalar dy); - sk_sp SK_API Make(SkColor color, SkScalar sigma, SkScalar dx, SkScalar dy); -} // namespace SkBlurDrawLooper - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurMaskFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurMaskFilter.h deleted file mode 100644 index 1b9319869ed8ed..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkBlurMaskFilter.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBlurMaskFilter_DEFINED -#define SkBlurMaskFilter_DEFINED - -// we include this since our callers will need to at least be able to ref/unref -#include "include/core/SkBlurTypes.h" -#include "include/core/SkMaskFilter.h" -#include "include/core/SkRect.h" -#include "include/core/SkScalar.h" - -class SkRRect; - -class SK_API SkBlurMaskFilter { -public: -#ifdef SK_SUPPORT_LEGACY_EMBOSSMASKFILTER - /** Create an emboss maskfilter - @param blurSigma standard deviation of the Gaussian blur to apply - before applying lighting (e.g. 3) - @param direction array of 3 scalars [x, y, z] specifying the direction of the light source - @param ambient 0...1 amount of ambient light - @param specular coefficient for specular highlights (e.g. 8) - @return the emboss maskfilter - */ - static sk_sp MakeEmboss(SkScalar blurSigma, const SkScalar direction[3], - SkScalar ambient, SkScalar specular); -#endif -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrix.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrix.h deleted file mode 100644 index ee470f96d38b26..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrix.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2007 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorMatrix_DEFINED -#define SkColorMatrix_DEFINED - -#include "include/core/SkImageInfo.h" -#include "include/core/SkTypes.h" - -#include -#include - -class SK_API SkColorMatrix { -public: - constexpr SkColorMatrix() : SkColorMatrix(1, 0, 0, 0, 0, - 0, 1, 0, 0, 0, - 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0) {} - - constexpr SkColorMatrix(float m00, float m01, float m02, float m03, float m04, - float m10, float m11, float m12, float m13, float m14, - float m20, float m21, float m22, float m23, float m24, - float m30, float m31, float m32, float m33, float m34) - : fMat { m00, m01, m02, m03, m04, - m10, m11, m12, m13, m14, - m20, m21, m22, m23, m24, - m30, m31, m32, m33, m34 } {} - - static SkColorMatrix RGBtoYUV(SkYUVColorSpace); - static SkColorMatrix YUVtoRGB(SkYUVColorSpace); - - void setIdentity(); - void setScale(float rScale, float gScale, float bScale, float aScale = 1.0f); - - void postTranslate(float dr, float dg, float db, float da); - - void setConcat(const SkColorMatrix& a, const SkColorMatrix& b); - void preConcat(const SkColorMatrix& mat) { this->setConcat(*this, mat); } - void postConcat(const SkColorMatrix& mat) { this->setConcat(mat, *this); } - - void setSaturation(float sat); - - void setRowMajor(const float src[20]) { std::copy_n(src, 20, fMat.begin()); } - void getRowMajor(float dst[20]) const { std::copy_n(fMat.begin(), 20, dst); } - -private: - std::array fMat; - - friend class SkColorFilters; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrixFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrixFilter.h deleted file mode 100644 index 3e5337b0cf94a2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkColorMatrixFilter.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2007 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorMatrixFilter_DEFINED -#define SkColorMatrixFilter_DEFINED - -#include "include/core/SkColorFilter.h" - -// (DEPRECATED) This factory function is deprecated. Please use the one in -// SkColorFilters (i.e., Lighting). -class SK_API SkColorMatrixFilter : public SkColorFilter { -public: - static sk_sp MakeLightingFilter(SkColor mul, SkColor add) { - return SkColorFilters::Lighting(mul, add); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkCornerPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkCornerPathEffect.h deleted file mode 100644 index 7f7e7159f3fba3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkCornerPathEffect.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCornerPathEffect_DEFINED -#define SkCornerPathEffect_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkPathEffect; - -/** \class SkCornerPathEffect - - SkCornerPathEffect is a subclass of SkPathEffect that can turn sharp corners - into various treatments (e.g. rounded corners) -*/ -class SK_API SkCornerPathEffect { -public: - /** radius must be > 0 to have an effect. It specifies the distance from each corner - that should be "rounded". - */ - static sk_sp Make(SkScalar radius); - - static void RegisterFlattenables(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDashPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDashPathEffect.h deleted file mode 100644 index f30064aa9476f9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDashPathEffect.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDashPathEffect_DEFINED -#define SkDashPathEffect_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkPathEffect; - -class SK_API SkDashPathEffect { -public: - /** intervals: array containing an even number of entries (>=2), with - the even indices specifying the length of "on" intervals, and the odd - indices specifying the length of "off" intervals. This array will be - copied in Make, and can be disposed of freely after. - count: number of elements in the intervals array - phase: offset into the intervals array (mod the sum of all of the - intervals). - - For example: if intervals[] = {10, 20}, count = 2, and phase = 25, - this will set up a dashed path like so: - 5 pixels off - 10 pixels on - 20 pixels off - 10 pixels on - 20 pixels off - ... - A phase of -5, 25, 55, 85, etc. would all result in the same path, - because the sum of all the intervals is 30. - - Note: only affects stroked paths. - */ - static sk_sp Make(const SkScalar intervals[], int count, SkScalar phase); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDiscretePathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDiscretePathEffect.h deleted file mode 100644 index 6054cbdc9915e0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkDiscretePathEffect.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkDiscretePathEffect_DEFINED -#define SkDiscretePathEffect_DEFINED - -#include "include/core/SkPathEffect.h" - -/** \class SkDiscretePathEffect - - This path effect chops a path into discrete segments, and randomly displaces them. -*/ -class SK_API SkDiscretePathEffect { -public: - /** Break the path into segments of segLength length, and randomly move the endpoints - away from the original path by a maximum of deviation. - Note: works on filled or framed paths - - @param seedAssist This is a caller-supplied seedAssist that modifies - the seed value that is used to randomize the path - segments' endpoints. If not supplied it defaults to 0, - in which case filtering a path multiple times will - result in the same set of segments (this is useful for - testing). If a caller does not want this behaviour - they can pass in a different seedAssist to get a - different set of path segments. - */ - static sk_sp Make(SkScalar segLength, SkScalar dev, uint32_t seedAssist = 0); - - static void RegisterFlattenables(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkGradientShader.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkGradientShader.h deleted file mode 100644 index df08c96f593227..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkGradientShader.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkGradientShader_DEFINED -#define SkGradientShader_DEFINED - -#include "include/core/SkColorSpace.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkShader.h" -#include "include/core/SkTileMode.h" - -/** \class SkGradientShader - - SkGradientShader hosts factories for creating subclasses of SkShader that - render linear and radial gradients. In general, degenerate cases should not - produce surprising results, but there are several types of degeneracies: - - * A linear gradient made from the same two points. - * A radial gradient with a radius of zero. - * A sweep gradient where the start and end angle are the same. - * A two point conical gradient where the two centers and the two radii are - the same. - - For any degenerate gradient with a decal tile mode, it will draw empty since the interpolating - region is zero area and the outer region is discarded by the decal mode. - - For any degenerate gradient with a repeat or mirror tile mode, it will draw a solid color that - is the average gradient color, since infinitely many repetitions of the gradients will fill the - shape. - - For a clamped gradient, every type is well-defined at the limit except for linear gradients. The - radial gradient with zero radius becomes the last color. The sweep gradient draws the sector - from 0 to the provided angle with the first color, with a hardstop switching to the last color. - When the provided angle is 0, this is just the solid last color again. Similarly, the two point - conical gradient becomes a circle filled with the first color, sized to the provided radius, - with a hardstop switching to the last color. When the two radii are both zero, this is just the - solid last color. - - As a linear gradient approaches the degenerate case, its shader will approach the appearance of - two half planes, each filled by the first and last colors of the gradient. The planes will be - oriented perpendicular to the vector between the two defining points of the gradient. However, - once they become the same point, Skia cannot reconstruct what that expected orientation is. To - provide a stable and predictable color in this case, Skia just uses the last color as a solid - fill to be similar to many of the other degenerate gradients' behaviors in clamp mode. -*/ -class SK_API SkGradientShader { -public: - enum Flags { - /** By default gradients will interpolate their colors in unpremul space - * and then premultiply each of the results. By setting this flag, the - * gradients will premultiply their colors first, and then interpolate - * between them. - * example: https://fiddle.skia.org/c/@GradientShader_MakeLinear - */ - kInterpolateColorsInPremul_Flag = 1 << 0, - }; - - struct Interpolation { - enum class InPremul : bool { kNo = false, kYes = true }; - - InPremul fInPremul = InPremul::kNo; - - static Interpolation FromFlags(uint32_t flags) { - return {flags & kInterpolateColorsInPremul_Flag ? InPremul::kYes : InPremul::kNo}; - } - }; - - /** Returns a shader that generates a linear gradient between the two specified points. -

- @param pts The start and end points for the gradient. - @param colors The array[count] of colors, to be distributed between the two points - @param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of - each corresponding color in the colors array. If this is NULL, - the the colors are distributed evenly between the start and end point. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >=2. The number of colors (and pos if not NULL) entries. - @param mode The tiling mode - - example: https://fiddle.skia.org/c/@GradientShader_MakeLinear - */ - static sk_sp MakeLinear(const SkPoint pts[2], - const SkColor colors[], const SkScalar pos[], int count, - SkTileMode mode, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr); - - /** Returns a shader that generates a linear gradient between the two specified points. -

- @param pts The start and end points for the gradient. - @param colors The array[count] of colors, to be distributed between the two points - @param pos May be NULL. array[count] of SkScalars, or NULL, of the relative position of - each corresponding color in the colors array. If this is NULL, - the the colors are distributed evenly between the start and end point. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >=2. The number of colors (and pos if not NULL) entries. - @param mode The tiling mode - - example: https://fiddle.skia.org/c/@GradientShader_MakeLinear - */ - static sk_sp MakeLinear(const SkPoint pts[2], - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, SkTileMode mode, - const Interpolation& interpolation, - const SkMatrix* localMatrix); - static sk_sp MakeLinear(const SkPoint pts[2], - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, SkTileMode mode, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr) { - return MakeLinear(pts, colors, std::move(colorSpace), pos, count, mode, - Interpolation::FromFlags(flags), localMatrix); - } - - /** Returns a shader that generates a radial gradient given the center and radius. -

- @param center The center of the circle for this gradient - @param radius Must be positive. The radius of the circle for this gradient - @param colors The array[count] of colors, to be distributed between the center and edge of the circle - @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of - each corresponding color in the colors array. If this is NULL, - the the colors are distributed evenly between the center and edge of the circle. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >= 2. The number of colors (and pos if not NULL) entries - @param mode The tiling mode - */ - static sk_sp MakeRadial(const SkPoint& center, SkScalar radius, - const SkColor colors[], const SkScalar pos[], int count, - SkTileMode mode, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr); - - /** Returns a shader that generates a radial gradient given the center and radius. -

- @param center The center of the circle for this gradient - @param radius Must be positive. The radius of the circle for this gradient - @param colors The array[count] of colors, to be distributed between the center and edge of the circle - @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative position of - each corresponding color in the colors array. If this is NULL, - the the colors are distributed evenly between the center and edge of the circle. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >= 2. The number of colors (and pos if not NULL) entries - @param mode The tiling mode - */ - static sk_sp MakeRadial(const SkPoint& center, SkScalar radius, - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, SkTileMode mode, - const Interpolation& interpolation, - const SkMatrix* localMatrix); - static sk_sp MakeRadial(const SkPoint& center, SkScalar radius, - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, SkTileMode mode, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr) { - return MakeRadial(center, radius, colors, std::move(colorSpace), pos, count, mode, - Interpolation::FromFlags(flags), localMatrix); - } - - /** - * Returns a shader that generates a conical gradient given two circles, or - * returns NULL if the inputs are invalid. The gradient interprets the - * two circles according to the following HTML spec. - * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient - */ - static sk_sp MakeTwoPointConical(const SkPoint& start, SkScalar startRadius, - const SkPoint& end, SkScalar endRadius, - const SkColor colors[], const SkScalar pos[], - int count, SkTileMode mode, - uint32_t flags = 0, - const SkMatrix* localMatrix = nullptr); - - /** - * Returns a shader that generates a conical gradient given two circles, or - * returns NULL if the inputs are invalid. The gradient interprets the - * two circles according to the following HTML spec. - * http://dev.w3.org/html5/2dcontext/#dom-context-2d-createradialgradient - */ - static sk_sp MakeTwoPointConical(const SkPoint& start, SkScalar startRadius, - const SkPoint& end, SkScalar endRadius, - const SkColor4f colors[], - sk_sp colorSpace, const SkScalar pos[], - int count, SkTileMode mode, - const Interpolation& interpolation, - const SkMatrix* localMatrix); - static sk_sp MakeTwoPointConical(const SkPoint& start, SkScalar startRadius, - const SkPoint& end, SkScalar endRadius, - const SkColor4f colors[], - sk_sp colorSpace, const SkScalar pos[], - int count, SkTileMode mode, - uint32_t flags = 0, - const SkMatrix* localMatrix = nullptr) { - return MakeTwoPointConical(start, startRadius, end, endRadius, colors, - std::move(colorSpace), pos, count, mode, - Interpolation::FromFlags(flags), localMatrix); - } - - /** Returns a shader that generates a sweep gradient given a center. - - The shader accepts negative angles and angles larger than 360, draws - between 0 and 360 degrees, similar to the CSS conic-gradient - semantics. 0 degrees means horizontal positive x axis. The start angle - must be less than the end angle, otherwise a null pointer is - returned. If color stops do not contain 0 and 1 but are within this - range, the respective outer color stop is repeated for 0 and 1. Color - stops less than 0 are clamped to 0, and greater than 1 are clamped to 1. -

- @param cx The X coordinate of the center of the sweep - @param cx The Y coordinate of the center of the sweep - @param colors The array[count] of colors, to be distributed around the center, within - the gradient angle range. - @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative - position of each corresponding color in the colors array. If this is - NULL, then the colors are distributed evenly within the angular range. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >= 2. The number of colors (and pos if not NULL) entries - @param mode Tiling mode: controls drawing outside of the gradient angular range. - @param startAngle Start of the angular range, corresponding to pos == 0. - @param endAngle End of the angular range, corresponding to pos == 1. - */ - static sk_sp MakeSweep(SkScalar cx, SkScalar cy, - const SkColor colors[], const SkScalar pos[], int count, - SkTileMode mode, - SkScalar startAngle, SkScalar endAngle, - uint32_t flags, const SkMatrix* localMatrix); - static sk_sp MakeSweep(SkScalar cx, SkScalar cy, - const SkColor colors[], const SkScalar pos[], int count, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr) { - return MakeSweep(cx, cy, colors, pos, count, SkTileMode::kClamp, 0, 360, flags, - localMatrix); - } - - /** Returns a shader that generates a sweep gradient given a center. - - The shader accepts negative angles and angles larger than 360, draws - between 0 and 360 degrees, similar to the CSS conic-gradient - semantics. 0 degrees means horizontal positive x axis. The start angle - must be less than the end angle, otherwise a null pointer is - returned. If color stops do not contain 0 and 1 but are within this - range, the respective outer color stop is repeated for 0 and 1. Color - stops less than 0 are clamped to 0, and greater than 1 are clamped to 1. -

- @param cx The X coordinate of the center of the sweep - @param cx The Y coordinate of the center of the sweep - @param colors The array[count] of colors, to be distributed around the center, within - the gradient angle range. - @param pos May be NULL. The array[count] of SkScalars, or NULL, of the relative - position of each corresponding color in the colors array. If this is - NULL, then the colors are distributed evenly within the angular range. - If this is not null, the values must begin with 0, end with 1.0, and - intermediate values must be strictly increasing. - @param count Must be >= 2. The number of colors (and pos if not NULL) entries - @param mode Tiling mode: controls drawing outside of the gradient angular range. - @param startAngle Start of the angular range, corresponding to pos == 0. - @param endAngle End of the angular range, corresponding to pos == 1. - */ - static sk_sp MakeSweep(SkScalar cx, SkScalar cy, - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, - SkTileMode mode, - SkScalar startAngle, SkScalar endAngle, - const Interpolation& interpolation, - const SkMatrix* localMatrix); - static sk_sp MakeSweep(SkScalar cx, SkScalar cy, - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, - SkTileMode mode, - SkScalar startAngle, SkScalar endAngle, - uint32_t flags, const SkMatrix* localMatrix) { - return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, mode, startAngle, - endAngle, Interpolation::FromFlags(flags), localMatrix); - } - static sk_sp MakeSweep(SkScalar cx, SkScalar cy, - const SkColor4f colors[], sk_sp colorSpace, - const SkScalar pos[], int count, - uint32_t flags = 0, const SkMatrix* localMatrix = nullptr) { - return MakeSweep(cx, cy, colors, std::move(colorSpace), pos, count, SkTileMode::kClamp, - 0, 360, flags, localMatrix); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkHighContrastFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkHighContrastFilter.h deleted file mode 100644 index 1224ade5e456fe..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkHighContrastFilter.h +++ /dev/null @@ -1,84 +0,0 @@ -/* -* Copyright 2017 Google Inc. -* -* Use of this source code is governed by a BSD-style license that can be -* found in the LICENSE file. -*/ - -#ifndef SkHighContrastFilter_DEFINED -#define SkHighContrastFilter_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkColorFilter; - -/** - * Configuration struct for SkHighContrastFilter. - * - * Provides transformations to improve contrast for users with low vision. - */ -struct SkHighContrastConfig { - enum class InvertStyle { - kNoInvert, - kInvertBrightness, - kInvertLightness, - - kLast = kInvertLightness - }; - - SkHighContrastConfig() { - fGrayscale = false; - fInvertStyle = InvertStyle::kNoInvert; - fContrast = 0.0f; - } - - SkHighContrastConfig(bool grayscale, - InvertStyle invertStyle, - SkScalar contrast) - : fGrayscale(grayscale), - fInvertStyle(invertStyle), - fContrast(contrast) {} - - // Returns true if all of the fields are set within the valid range. - bool isValid() const { - return fInvertStyle >= InvertStyle::kNoInvert && - fInvertStyle <= InvertStyle::kInvertLightness && - fContrast >= -1.0 && - fContrast <= 1.0; - } - - // If true, the color will be converted to grayscale. - bool fGrayscale; - - // Whether to invert brightness, lightness, or neither. - InvertStyle fInvertStyle; - - // After grayscale and inverting, the contrast can be adjusted linearly. - // The valid range is -1.0 through 1.0, where 0.0 is no adjustment. - SkScalar fContrast; -}; - -/** - * Color filter that provides transformations to improve contrast - * for users with low vision. - * - * Applies the following transformations in this order. Each of these - * can be configured using SkHighContrastConfig. - * - * - Conversion to grayscale - * - Color inversion (either in RGB or HSL space) - * - Increasing the resulting contrast. - * - * Calling SkHighContrastFilter::Make will return nullptr if the config is - * not valid, e.g. if you try to call it with a contrast outside the range of - * -1.0 to 1.0. - */ - -struct SK_API SkHighContrastFilter { - // Returns the filter, or nullptr if the config is invalid. - static sk_sp Make(const SkHighContrastConfig& config); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkImageFilters.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkImageFilters.h deleted file mode 100644 index 5665c607015c77..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkImageFilters.h +++ /dev/null @@ -1,552 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageFilters_DEFINED -#define SkImageFilters_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkColor.h" -#include "include/core/SkImage.h" -#include "include/core/SkImageFilter.h" -#include "include/core/SkPicture.h" -#include "include/core/SkRect.h" -#include "include/core/SkTileMode.h" -#include "include/core/SkTypes.h" -#include "include/effects/SkRuntimeEffect.h" - -#include - -class SkBlender; -class SkColorFilter; -class SkPaint; -class SkRegion; - -namespace skif { - static constexpr SkRect kNoCropRect = {SK_ScalarNegativeInfinity, SK_ScalarNegativeInfinity, - SK_ScalarInfinity, SK_ScalarInfinity}; -} - -// A set of factory functions providing useful SkImageFilter effects. For image filters that take an -// input filter, providing nullptr means it will automatically use the dynamic source image. This -// source depends on how the filter is applied, but is either the contents of a saved layer when -// drawing with SkCanvas, or an explicit SkImage if using SkImage::makeWithFilter. -class SK_API SkImageFilters { -public: - // This is just a convenience type to allow passing SkIRects, SkRects, and optional pointers - // to those types as a crop rect for the image filter factories. It's not intended to be used - // directly. - struct CropRect { - CropRect() : fCropRect(skif::kNoCropRect) {} - // Intentionally not explicit so callers don't have to use this type but can use SkIRect or - // SkRect as desired. - CropRect(std::nullptr_t) : fCropRect(skif::kNoCropRect) {} - CropRect(const SkIRect& crop) : fCropRect(SkRect::Make(crop)) {} - CropRect(const SkRect& crop) : fCropRect(crop) {} - CropRect(const SkIRect* optionalCrop) : fCropRect(optionalCrop ? SkRect::Make(*optionalCrop) - : skif::kNoCropRect) {} - CropRect(const SkRect* optionalCrop) : fCropRect(optionalCrop ? *optionalCrop - : skif::kNoCropRect) {} - - operator const SkRect*() const { return fCropRect == skif::kNoCropRect ? nullptr : &fCropRect; } - - SkRect fCropRect; - }; - - /** - * Create a filter that updates the alpha of the image based on 'region'. Pixels inside the - * region are made more opaque and pixels outside are made more transparent. - * - * Specifically, if a pixel is inside the region, its alpha will be set to - * max(innerMin, pixel's alpha). If a pixel is outside the region, its alpha will be updated to - * min(outerMax, pixel's alpha). - * @param region The geometric region controlling the inner and outer alpha thresholds. - * @param innerMin The minimum alpha value for pixels inside 'region'. - * @param outerMax The maximum alpha value for pixels outside of 'region'. - * @param input The input filter, or uses the source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp AlphaThreshold(const SkRegion& region, SkScalar innerMin, - SkScalar outerMax, sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that implements a custom blend mode. Each output pixel is the result of - * combining the corresponding background and foreground pixels using the 4 coefficients: - * k1 * foreground * background + k2 * foreground + k3 * background + k4 - * @param k1, k2, k3, k4 The four coefficients used to combine the foreground and background. - * @param enforcePMColor If true, the RGB channels will be clamped to the calculated alpha. - * @param background The background content, using the source bitmap when this is null. - * @param foreground The foreground content, using the source bitmap when this is null. - * @param cropRect Optional rectangle that crops the inputs and output. - */ - static sk_sp Arithmetic(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4, - bool enforcePMColor, sk_sp background, - sk_sp foreground, - const CropRect& cropRect = {}); - - /** - * This filter takes an SkBlendMode and uses it to composite the two filters together. - * @param mode The blend mode that defines the compositing operation - * @param background The Dst pixels used in blending, if null the source bitmap is used. - * @param foreground The Src pixels used in blending, if null the source bitmap is used. - * @cropRect Optional rectangle to crop input and output. - */ - static sk_sp Blend(SkBlendMode mode, sk_sp background, - sk_sp foreground = nullptr, - const CropRect& cropRect = {}); - - /** - * This filter takes an SkBlendMode and uses it to composite the two filters together. - * @param blender The blender that defines the compositing operation - * @param background The Dst pixels used in blending, if null the source bitmap is used. - * @param foreground The Src pixels used in blending, if null the source bitmap is used. - * @cropRect Optional rectangle to crop input and output. - */ - static sk_sp Blend(sk_sp blender, sk_sp background, - sk_sp foreground = nullptr, - const CropRect& cropRect = {}); - - /** - * Create a filter that blurs its input by the separate X and Y sigmas. The provided tile mode - * is used when the blur kernel goes outside the input image. - * @param sigmaX The Gaussian sigma value for blurring along the X axis. - * @param sigmaY The Gaussian sigma value for blurring along the Y axis. - * @param tileMode The tile mode applied at edges . - * TODO (michaelludwig) - kMirror is not supported yet - * @param input The input filter that is blurred, uses source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp Blur(SkScalar sigmaX, SkScalar sigmaY, SkTileMode tileMode, - sk_sp input, const CropRect& cropRect = {}); - // As above, but defaults to the decal tile mode. - static sk_sp Blur(SkScalar sigmaX, SkScalar sigmaY, sk_sp input, - const CropRect& cropRect = {}) { - return Blur(sigmaX, sigmaY, SkTileMode::kDecal, std::move(input), cropRect); - } - - /** - * Create a filter that applies the color filter to the input filter results. - * @param cf The color filter that transforms the input image. - * @param input The input filter, or uses the source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp ColorFilter(sk_sp cf, sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that composes 'inner' with 'outer', such that the results of 'inner' are - * treated as the source bitmap passed to 'outer', i.e. result = outer(inner(source)). - * @param outer The outer filter that evaluates the results of inner. - * @param inner The inner filter that produces the input to outer. - */ - static sk_sp Compose(sk_sp outer, sk_sp inner); - - /** - * Create a filter that moves each pixel in its color input based on an (x,y) vector encoded - * in its displacement input filter. Two color components of the displacement image are - * mapped into a vector as scale * (color[xChannel], color[yChannel]), where the channel - * selectors are one of R, G, B, or A. - * @param xChannelSelector RGBA channel that encodes the x displacement per pixel. - * @param yChannelSelector RGBA channel that encodes the y displacement per pixel. - * @param scale Scale applied to displacement extracted from image. - * @param displacement The filter defining the displacement image, or null to use source. - * @param color The filter providing the color pixels to be displaced. If null, - * it will use the source. - * @param cropRect Optional rectangle that crops the color input and output. - */ - static sk_sp DisplacementMap(SkColorChannel xChannelSelector, - SkColorChannel yChannelSelector, - SkScalar scale, sk_sp displacement, - sk_sp color, - const CropRect& cropRect = {}); - - /** - * Create a filter that draws a drop shadow under the input content. This filter produces an - * image that includes the inputs' content. - * @param dx The X offset of the shadow. - * @param dy The Y offset of the shadow. - * @param sigmaX The blur radius for the shadow, along the X axis. - * @param sigmaY The blur radius for the shadow, along the Y axis. - * @param color The color of the drop shadow. - * @param input The input filter, or will use the source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp DropShadow(SkScalar dx, SkScalar dy, - SkScalar sigmaX, SkScalar sigmaY, - SkColor color, sk_sp input, - const CropRect& cropRect = {}); - /** - * Create a filter that renders a drop shadow, in exactly the same manner as ::DropShadow, - * except that the resulting image does not include the input content. This allows the shadow - * and input to be composed by a filter DAG in a more flexible manner. - * @param dx The X offset of the shadow. - * @param dy The Y offset of the shadow. - * @param sigmaX The blur radius for the shadow, along the X axis. - * @param sigmaY The blur radius for the shadow, along the Y axis. - * @param color The color of the drop shadow. - * @param input The input filter, or will use the source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp DropShadowOnly(SkScalar dx, SkScalar dy, - SkScalar sigmaX, SkScalar sigmaY, - SkColor color, sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that draws the 'srcRect' portion of image into 'dstRect' using the given - * filter quality. Similar to SkCanvas::drawImageRect. Returns null if 'image' is null. - * @param image The image that is output by the filter, subset by 'srcRect'. - * @param srcRect The source pixels sampled into 'dstRect' - * @param dstRect The local rectangle to draw the image into. - * @param sampling The sampling to use when drawing the image. - */ - static sk_sp Image(sk_sp image, const SkRect& srcRect, - const SkRect& dstRect, const SkSamplingOptions& sampling); - - /** - * Create a filter that draws the image using the given sampling. - * Similar to SkCanvas::drawImage. Returns null if 'image' is null. - * @param image The image that is output by the filter. - * @param sampling The sampling to use when drawing the image. - */ - static sk_sp Image(sk_sp image, const SkSamplingOptions& sampling) { - if (image) { - SkRect r = SkRect::Make(image->bounds()); - return Image(std::move(image), r, r, sampling); - } else { - return nullptr; - } - } - - /** - * Create a filter that draws the image using Mitchel cubic resampling. - * @param image The image that is output by the filter. - */ - static sk_sp Image(sk_sp image) { - return Image(std::move(image), SkSamplingOptions({1/3.0f, 1/3.0f})); - } - - /** - * Create a filter that mimics a zoom/magnifying lens effect. - * @param srcRect - * @param inset - * @param input The input filter that is magnified, if null the source bitmap is used. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp Magnifier(const SkRect& srcRect, SkScalar inset, - sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that applies an NxM image processing kernel to the input image. This can be - * used to produce effects such as sharpening, blurring, edge detection, etc. - * @param kernelSize The kernel size in pixels, in each dimension (N by M). - * @param kernel The image processing kernel. Must contain N * M elements, in row order. - * @param gain A scale factor applied to each pixel after convolution. This can be - * used to normalize the kernel, if it does not already sum to 1. - * @param bias A bias factor added to each pixel after convolution. - * @param kernelOffset An offset applied to each pixel coordinate before convolution. - * This can be used to center the kernel over the image - * (e.g., a 3x3 kernel should have an offset of {1, 1}). - * @param tileMode How accesses outside the image are treated. - * TODO (michaelludwig) - kMirror is not supported yet - * @param convolveAlpha If true, all channels are convolved. If false, only the RGB channels - * are convolved, and alpha is copied from the source image. - * @param input The input image filter, if null the source bitmap is used instead. - * @param cropRect Optional rectangle to which the output processing will be limited. - */ - static sk_sp MatrixConvolution(const SkISize& kernelSize, - const SkScalar kernel[], SkScalar gain, - SkScalar bias, const SkIPoint& kernelOffset, - SkTileMode tileMode, bool convolveAlpha, - sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that transforms the input image by 'matrix'. This matrix transforms the - * local space, which means it effectively happens prior to any transformation coming from the - * SkCanvas initiating the filtering. - * @param matrix The matrix to apply to the original content. - * @param sampling How the image will be sampled when it is transformed - * @param input The image filter to transform, or null to use the source image. - */ - static sk_sp MatrixTransform(const SkMatrix& matrix, - const SkSamplingOptions& sampling, - sk_sp input); - - /** - * Create a filter that merges the 'count' filters together by drawing their results in order - * with src-over blending. - * @param filters The input filter array to merge, which must have 'count' elements. Any null - * filter pointers will use the source bitmap instead. - * @param count The number of input filters to be merged. - * @param cropRect Optional rectangle that crops all input filters and the output. - */ - static sk_sp Merge(sk_sp* const filters, int count, - const CropRect& cropRect = {}); - /** - * Create a filter that merges the results of the two filters together with src-over blending. - * @param first The first input filter, or the source bitmap if this is null. - * @param second The second input filter, or the source bitmap if this null. - * @param cropRect Optional rectangle that crops the inputs and output. - */ - static sk_sp Merge(sk_sp first, sk_sp second, - const CropRect& cropRect = {}) { - sk_sp array[] = { std::move(first), std::move(second) }; - return Merge(array, 2, cropRect); - } - - /** - * Create a filter that offsets the input filter by the given vector. - * @param dx The x offset in local space that the image is shifted. - * @param dy The y offset in local space that the image is shifted. - * @param input The input that will be moved, if null the source bitmap is used instead. - * @param cropRect Optional rectangle to crop the input and output. - */ - static sk_sp Offset(SkScalar dx, SkScalar dy, sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that fills the output with the given paint. - * @param paint The paint to fill - * @param cropRect Optional rectangle that will be filled. If null, the source bitmap's bounds - * are filled even though the source bitmap itself is not used. - * - * DEPRECATED: Use Shader() instead, since many features of SkPaint are ignored when filling - * the target output, and paint color/alpha can be emulated with SkShaders::Color(). - */ - static sk_sp Paint(const SkPaint& paint, const CropRect& cropRect = {}); - - /** - * Create a filter that produces the SkPicture as its output, drawn into targetRect. Note that - * the targetRect is not the same as the SkIRect cropRect that many filters accept. Returns - * null if 'pic' is null. - * @param pic The picture that is drawn for the filter output. - * @param targetRect The drawing region for the picture. - */ - static sk_sp Picture(sk_sp pic, const SkRect& targetRect); - // As above, but uses SkPicture::cullRect for the drawing region. - static sk_sp Picture(sk_sp pic) { - SkRect target = pic ? pic->cullRect() : SkRect::MakeEmpty(); - return Picture(std::move(pic), target); - } - -#ifdef SK_ENABLE_SKSL - /** - * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced - * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate - * system, so it will automatically be affected by SkCanvas' transform. - * - * @param builder The builder used to produce the runtime shader, that will in turn - * fill the result image - * @param childShaderName The name of the child shader defined in the builder that will be - * bound to the input param (or the source image if the input param - * is null). If empty, the builder can have exactly one child shader, - * which automatically binds the input param. - * @param input The image filter that will be provided as input to the runtime - * shader. If null the implicit source image is used instead - */ - static sk_sp RuntimeShader(const SkRuntimeShaderBuilder& builder, - std::string_view childShaderName, - sk_sp input); - - /** - * Create a filter that fills the output with the per-pixel evaluation of the SkShader produced - * by the SkRuntimeShaderBuilder. The shader is defined in the image filter's local coordinate - * system, so it will automatically be affected by SkCanvas' transform. - * - * @param builder The builder used to produce the runtime shader, that will in turn - * fill the result image - * @param childShaderNames The names of the child shaders defined in the builder that will be - * bound to the input params (or the source image if the input param - * is null). If any name is null, or appears more than once, factory - * fails and returns nullptr. - * @param inputs The image filters that will be provided as input to the runtime - * shader. If any are null, the implicit source image is used instead. - * @param inputCount How many entries are present in 'childShaderNames' and 'inputs'. - */ - static sk_sp RuntimeShader(const SkRuntimeShaderBuilder& builder, - std::string_view childShaderNames[], - const sk_sp inputs[], - int inputCount); -#endif // SK_ENABLE_SKSL - - enum class Dither : bool { - kNo = false, - kYes = true - }; - - /** - * Create a filter that fills the output with the per-pixel evaluation of the SkShader. The - * shader is defined in the image filter's local coordinate system, so will automatically - * be affected by SkCanvas' transform. - * - * Like Image() and Picture(), this is a leaf filter that can be used to introduce inputs to - * a complex filter graph, but should generally be combined with a filter that as at least - * one null input to use the implicit source image. - * @param shader The shader that fills the result image - */ - static sk_sp Shader(sk_sp shader, const CropRect& cropRect = {}) { - return Shader(std::move(shader), Dither::kNo, cropRect); - } - static sk_sp Shader(sk_sp shader, Dither dither, - const CropRect& cropRect = {}); - - /** - * Create a tile image filter. - * @param src Defines the pixels to tile - * @param dst Defines the pixel region that the tiles will be drawn to - * @param input The input that will be tiled, if null the source bitmap is used instead. - */ - static sk_sp Tile(const SkRect& src, const SkRect& dst, - sk_sp input); - - // Morphology filter effects - - /** - * Create a filter that dilates each input pixel's channel values to the max value within the - * given radii along the x and y axes. - * @param radiusX The distance to dilate along the x axis to either side of each pixel. - * @param radiusY The distance to dilate along the y axis to either side of each pixel. - * @param input The image filter that is dilated, using source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp Dilate(SkScalar radiusX, SkScalar radiusY, - sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that erodes each input pixel's channel values to the minimum channel value - * within the given radii along the x and y axes. - * @param radiusX The distance to erode along the x axis to either side of each pixel. - * @param radiusY The distance to erode along the y axis to either side of each pixel. - * @param input The image filter that is eroded, using source bitmap if this is null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp Erode(SkScalar radiusX, SkScalar radiusY, - sk_sp input, - const CropRect& cropRect = {}); - - // Lighting filter effects - - /** - * Create a filter that calculates the diffuse illumination from a distant light source, - * interpreting the alpha channel of the input as the height profile of the surface (to - * approximate normal vectors). - * @param direction The direction to the distance light. - * @param lightColor The color of the diffuse light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param kd Diffuse reflectance coefficient. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp DistantLitDiffuse(const SkPoint3& direction, SkColor lightColor, - SkScalar surfaceScale, SkScalar kd, - sk_sp input, - const CropRect& cropRect = {}); - /** - * Create a filter that calculates the diffuse illumination from a point light source, using - * alpha channel of the input as the height profile of the surface (to approximate normal - * vectors). - * @param location The location of the point light. - * @param lightColor The color of the diffuse light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param kd Diffuse reflectance coefficient. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp PointLitDiffuse(const SkPoint3& location, SkColor lightColor, - SkScalar surfaceScale, SkScalar kd, - sk_sp input, - const CropRect& cropRect = {}); - /** - * Create a filter that calculates the diffuse illumination from a spot light source, using - * alpha channel of the input as the height profile of the surface (to approximate normal - * vectors). The spot light is restricted to be within 'cutoffAngle' of the vector between - * the location and target. - * @param location The location of the spot light. - * @param target The location that the spot light is point towards - * @param falloffExponent Exponential falloff parameter for illumination outside of cutoffAngle - * @param cutoffAngle Maximum angle from lighting direction that receives full light - * @param lightColor The color of the diffuse light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param kd Diffuse reflectance coefficient. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp SpotLitDiffuse(const SkPoint3& location, const SkPoint3& target, - SkScalar falloffExponent, SkScalar cutoffAngle, - SkColor lightColor, SkScalar surfaceScale, - SkScalar kd, sk_sp input, - const CropRect& cropRect = {}); - - /** - * Create a filter that calculates the specular illumination from a distant light source, - * interpreting the alpha channel of the input as the height profile of the surface (to - * approximate normal vectors). - * @param direction The direction to the distance light. - * @param lightColor The color of the specular light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param ks Specular reflectance coefficient. - * @param shininess The specular exponent determining how shiny the surface is. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp DistantLitSpecular(const SkPoint3& direction, SkColor lightColor, - SkScalar surfaceScale, SkScalar ks, - SkScalar shininess, sk_sp input, - const CropRect& cropRect = {}); - /** - * Create a filter that calculates the specular illumination from a point light source, using - * alpha channel of the input as the height profile of the surface (to approximate normal - * vectors). - * @param location The location of the point light. - * @param lightColor The color of the specular light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param ks Specular reflectance coefficient. - * @param shininess The specular exponent determining how shiny the surface is. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp PointLitSpecular(const SkPoint3& location, SkColor lightColor, - SkScalar surfaceScale, SkScalar ks, - SkScalar shininess, sk_sp input, - const CropRect& cropRect = {}); - /** - * Create a filter that calculates the specular illumination from a spot light source, using - * alpha channel of the input as the height profile of the surface (to approximate normal - * vectors). The spot light is restricted to be within 'cutoffAngle' of the vector between - * the location and target. - * @param location The location of the spot light. - * @param target The location that the spot light is point towards - * @param falloffExponent Exponential falloff parameter for illumination outside of cutoffAngle - * @param cutoffAngle Maximum angle from lighting direction that receives full light - * @param lightColor The color of the specular light source. - * @param surfaceScale Scale factor to transform from alpha values to physical height. - * @param ks Specular reflectance coefficient. - * @param shininess The specular exponent determining how shiny the surface is. - * @param input The input filter that defines surface normals (as alpha), or uses the - * source bitmap when null. - * @param cropRect Optional rectangle that crops the input and output. - */ - static sk_sp SpotLitSpecular(const SkPoint3& location, const SkPoint3& target, - SkScalar falloffExponent, SkScalar cutoffAngle, - SkColor lightColor, SkScalar surfaceScale, - SkScalar ks, SkScalar shininess, - sk_sp input, - const CropRect& cropRect = {}); - -private: - SkImageFilters() = delete; -}; - -#endif // SkImageFilters_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLayerDrawLooper.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLayerDrawLooper.h deleted file mode 100644 index 1e875b58cc1c3d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLayerDrawLooper.h +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkLayerDrawLooper_DEFINED -#define SkLayerDrawLooper_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkDrawLooper.h" -#include "include/core/SkPaint.h" -#include "include/core/SkPoint.h" - -#ifndef SK_SUPPORT_LEGACY_DRAWLOOPER -#error "SkDrawLooper is unsupported" -#endif - -/** - * DEPRECATED: No longer supported by Skia. - */ -class SK_API SkLayerDrawLooper : public SkDrawLooper { -public: - ~SkLayerDrawLooper() override; - - /** - * Bits specifies which aspects of the layer's paint should replace the - * corresponding aspects on the draw's paint. - * kEntirePaint_Bits means use the layer's paint completely. - * 0 means ignore the layer's paint... except for fColorMode, which is - * always applied. - */ - enum Bits { - kStyle_Bit = 1 << 0, //!< use this layer's Style/stroke settings - kPathEffect_Bit = 1 << 2, //!< use this layer's patheffect - kMaskFilter_Bit = 1 << 3, //!< use this layer's maskfilter - kShader_Bit = 1 << 4, //!< use this layer's shader - kColorFilter_Bit = 1 << 5, //!< use this layer's colorfilter - kXfermode_Bit = 1 << 6, //!< use this layer's xfermode - - // unsupported kTextSkewX_Bit = 1 << 1, - - /** - * Use the layer's paint entirely, with these exceptions: - * - We never override the draw's paint's text_encoding, since that is - * used to interpret the text/len parameters in draw[Pos]Text. - * - Color is always computed using the LayerInfo's fColorMode. - */ - kEntirePaint_Bits = -1 - - }; - typedef int32_t BitFlags; - - /** - * Info for how to apply the layer's paint and offset. - * - * fColorMode controls how we compute the final color for the layer: - * The layer's paint's color is treated as the SRC - * The draw's paint's color is treated as the DST - * final-color = Mode(layers-color, draws-color); - * Any SkBlendMode will work. Two common choices are: - * kSrc: to use the layer's color, ignoring the draw's - * kDst: to just keep the draw's color, ignoring the layer's - */ - struct SK_API LayerInfo { - BitFlags fPaintBits; - SkBlendMode fColorMode; - SkVector fOffset; - bool fPostTranslate; //!< applies to fOffset - - /** - * Initial the LayerInfo. Defaults to settings that will draw the - * layer with no changes: e.g. - * fPaintBits == 0 - * fColorMode == kDst_Mode - * fOffset == (0, 0) - */ - LayerInfo(); - }; - - SkDrawLooper::Context* makeContext(SkArenaAlloc*) const override; - - bool asABlurShadow(BlurShadowRec* rec) const override; - -protected: - SkLayerDrawLooper(); - - void flatten(SkWriteBuffer&) const override; - -private: - SK_FLATTENABLE_HOOKS(SkLayerDrawLooper) - - struct Rec { - Rec* fNext; - SkPaint fPaint; - LayerInfo fInfo; - }; - Rec* fRecs; - int fCount; - - // state-machine during the init/next cycle - class LayerDrawLooperContext : public SkDrawLooper::Context { - public: - explicit LayerDrawLooperContext(const SkLayerDrawLooper* looper); - - protected: - bool next(Info*, SkPaint* paint) override; - - private: - Rec* fCurrRec; - - static void ApplyInfo(SkPaint* dst, const SkPaint& src, const LayerInfo&); - }; - - using INHERITED = SkDrawLooper; - -public: - class SK_API Builder { - public: - Builder(); - - ~Builder(); - - /** - * Call for each layer you want to add (from top to bottom). - * This returns a paint you can modify, but that ptr is only valid until - * the next call made to addLayer(). - */ - SkPaint* addLayer(const LayerInfo&); - - /** - * This layer will draw with the original paint, at the specified offset - */ - void addLayer(SkScalar dx, SkScalar dy); - - /** - * This layer will with the original paint and no offset. - */ - void addLayer() { this->addLayer(0, 0); } - - /// Similar to addLayer, but adds a layer to the top. - SkPaint* addLayerOnTop(const LayerInfo&); - - /** - * Pass list of layers on to newly built looper and return it. This will - * also reset the builder, so it can be used to build another looper. - */ - sk_sp detach(); - - private: - Builder(const Builder&) = delete; - Builder& operator=(const Builder&) = delete; - - Rec* fRecs; - Rec* fTopRec; - int fCount; - }; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLumaColorFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLumaColorFilter.h deleted file mode 100644 index 41a9a45f3fba27..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkLumaColorFilter.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkLumaColorFilter_DEFINED -#define SkLumaColorFilter_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkColorFilter; - -/** - * SkLumaColorFilter multiplies the luma of its input into the alpha channel, - * and sets the red, green, and blue channels to zero. - * - * SkLumaColorFilter(r,g,b,a) = {0,0,0, a * luma(r,g,b)} - * - * This is similar to a luminanceToAlpha feColorMatrix, - * but note how this filter folds in the previous alpha, - * something an feColorMatrix cannot do. - * - * feColorMatrix(luminanceToAlpha; r,g,b,a) = {0,0,0, luma(r,g,b)} - * - * (Despite its name, an feColorMatrix using luminanceToAlpha does - * actually compute luma, a dot-product of gamma-encoded color channels, - * not luminance, a dot-product of linear color channels. So at least - * SkLumaColorFilter and feColorMatrix+luminanceToAlpha agree there.) - */ -struct SK_API SkLumaColorFilter { - static sk_sp Make(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOpPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOpPathEffect.h deleted file mode 100644 index 3c9110f0cc1aaa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOpPathEffect.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOpPathEffect_DEFINED -#define SkOpPathEffect_DEFINED - -#include "include/core/SkPaint.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/pathops/SkPathOps.h" - -class SkMatrix; -class SkPathEffect; - -class SK_API SkMergePathEffect { -public: - /* Defers to two other patheffects, and then combines their outputs using the specified op. - * e.g. - * result = output_one op output_two - * - * If either one or two is nullptr, then the original path is passed through to the op. - */ - static sk_sp Make(sk_sp one, sk_sp two, SkPathOp op); -}; - -class SK_API SkMatrixPathEffect { -public: - static sk_sp MakeTranslate(SkScalar dx, SkScalar dy); - static sk_sp Make(const SkMatrix&); -}; - -class SK_API SkStrokePathEffect { -public: - static sk_sp Make(SkScalar width, SkPaint::Join, SkPaint::Cap, - SkScalar miter = 4); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOverdrawColorFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOverdrawColorFilter.h deleted file mode 100644 index 5f1642483ae23b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkOverdrawColorFilter.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/core/SkColor.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkColorFilter; - -#ifndef SkOverdrawColorFilter_DEFINED -#define SkOverdrawColorFilter_DEFINED - -/** - * Uses the value in the src alpha channel to set the dst pixel. - * 0 -> colors[0] - * 1 -> colors[1] - * ... - * 5 (or larger) -> colors[5] - * - */ -class SK_API SkOverdrawColorFilter { -public: - static constexpr int kNumColors = 6; - - static sk_sp MakeWithSkColors(const SkColor[kNumColors]); -}; - -#endif // SkOverdrawColorFilter_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkPerlinNoiseShader.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkPerlinNoiseShader.h deleted file mode 100644 index f94b3420fceaa4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkPerlinNoiseShader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPerlinNoiseShader_DEFINED -#define SkPerlinNoiseShader_DEFINED - -#include "include/core/SkShader.h" - -/** \class SkPerlinNoiseShader - - SkPerlinNoiseShader creates an image using the Perlin turbulence function. - - It can produce tileable noise if asked to stitch tiles and provided a tile size. - In order to fill a large area with repeating noise, set the stitchTiles flag to - true, and render exactly a single tile of noise. Without this flag, the result - will contain visible seams between tiles. - - The algorithm used is described here : - http://www.w3.org/TR/SVG/filters.html#feTurbulenceElement -*/ -class SK_API SkPerlinNoiseShader { -public: - /** - * This will construct Perlin noise of the given type (Fractal Noise or Turbulence). - * - * Both base frequencies (X and Y) have a usual range of (0..1) and must be non-negative. - * - * The number of octaves provided should be fairly small, with a limit of 255 enforced. - * Each octave doubles the frequency, so 10 octaves would produce noise from - * baseFrequency * 1, * 2, * 4, ..., * 512, which quickly yields insignificantly small - * periods and resembles regular unstructured noise rather than Perlin noise. - * - * If tileSize isn't NULL or an empty size, the tileSize parameter will be used to modify - * the frequencies so that the noise will be tileable for the given tile size. If tileSize - * is NULL or an empty size, the frequencies will be used as is without modification. - */ - static sk_sp MakeFractalNoise(SkScalar baseFrequencyX, SkScalar baseFrequencyY, - int numOctaves, SkScalar seed, - const SkISize* tileSize = nullptr); - static sk_sp MakeTurbulence(SkScalar baseFrequencyX, SkScalar baseFrequencyY, - int numOctaves, SkScalar seed, - const SkISize* tileSize = nullptr); - - static void RegisterFlattenables(); - -private: - SkPerlinNoiseShader() = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkRuntimeEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkRuntimeEffect.h deleted file mode 100644 index a8e0f4d7dc8372..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkRuntimeEffect.h +++ /dev/null @@ -1,514 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRuntimeEffect_DEFINED -#define SkRuntimeEffect_DEFINED - -#include "include/core/SkBlender.h" -#include "include/core/SkColorFilter.h" -#include "include/core/SkData.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkShader.h" -#include "include/core/SkSpan.h" -#include "include/core/SkString.h" -#include "include/private/SkOnce.h" -#include "include/private/SkSLSampleUsage.h" - -#include -#include -#include - -#ifdef SK_ENABLE_SKSL - -#include "include/sksl/SkSLVersion.h" - -class GrRecordingContext; -class SkFilterColorProgram; -class SkImage; -class SkRuntimeImageFilter; - -namespace SkSL { -class DebugTrace; -class ErrorReporter; -class FunctionDefinition; -struct Program; -enum class ProgramKind : int8_t; -struct ProgramSettings; -} // namespace SkSL - -namespace skvm { -class Program; -} // namespace skvm - -/* - * SkRuntimeEffect supports creating custom SkShader and SkColorFilter objects using Skia's SkSL - * shading language. - * - * NOTE: This API is experimental and subject to change. - */ -class SK_API SkRuntimeEffect : public SkRefCnt { -public: - // Reflected description of a uniform variable in the effect's SkSL - struct Uniform { - enum class Type { - kFloat, - kFloat2, - kFloat3, - kFloat4, - kFloat2x2, - kFloat3x3, - kFloat4x4, - kInt, - kInt2, - kInt3, - kInt4, - }; - - enum Flags { - // Uniform is declared as an array. 'count' contains array length. - kArray_Flag = 0x1, - - // Uniform is declared with layout(color). Colors should be supplied as unpremultiplied, - // extended-range (unclamped) sRGB (ie SkColor4f). The uniform will be automatically - // transformed to unpremultiplied extended-range working-space colors. - kColor_Flag = 0x2, - - // When used with SkMeshSpecification, indicates that the uniform is present in the - // vertex shader. Not used with SkRuntimeEffect. - kVertex_Flag = 0x4, - - // When used with SkMeshSpecification, indicates that the uniform is present in the - // fragment shader. Not used with SkRuntimeEffect. - kFragment_Flag = 0x8, - - // This flag indicates that the SkSL uniform uses a medium-precision type - // (i.e., `half` instead of `float`). - kHalfPrecision_Flag = 0x10, - }; - - std::string_view name; - size_t offset; - Type type; - int count; - uint32_t flags; - - bool isArray() const { return SkToBool(this->flags & kArray_Flag); } - bool isColor() const { return SkToBool(this->flags & kColor_Flag); } - size_t sizeInBytes() const; - }; - - // Reflected description of a uniform child (shader or colorFilter) in the effect's SkSL - enum class ChildType { - kShader, - kColorFilter, - kBlender, - }; - - struct Child { - std::string_view name; - ChildType type; - int index; - }; - - class Options { - public: - // For testing purposes, disables optimization and inlining. (Normally, Runtime Effects - // don't run the inliner directly, but they still get an inlining pass once they are - // painted.) - bool forceUnoptimized = false; - - private: - friend class SkRuntimeEffect; - friend class SkRuntimeEffectPriv; - - // Public SkSL does not allow access to sk_FragCoord. The semantics of that variable are - // confusing, and expose clients to implementation details of saveLayer and image filters. - bool usePrivateRTShaderModule = false; - - // TODO(skia:11209) - Replace this with a promised SkCapabilities? - // This flag lifts the ES2 restrictions on Runtime Effects that are gated by the - // `strictES2Mode` check. Be aware that the software renderer and pipeline-stage effect are - // still largely ES3-unaware and can still fail or crash if post-ES2 features are used. - // This is only intended for use by tests and certain internally created effects. - SkSL::Version maxVersionAllowed = SkSL::Version::k100; - }; - - // If the effect is compiled successfully, `effect` will be non-null. - // Otherwise, `errorText` will contain the reason for failure. - struct Result { - sk_sp effect; - SkString errorText; - }; - - // MakeForColorFilter and MakeForShader verify that the SkSL code is valid for those stages of - // the Skia pipeline. In all of the signatures described below, color parameters and return - // values are flexible. They are listed as being 'vec4', but they can also be 'half4' or - // 'float4'. ('vec4' is an alias for 'float4'). - - // We can't use a default argument for `options` due to a bug in Clang. - // https://bugs.llvm.org/show_bug.cgi?id=36684 - - // Color filter SkSL requires an entry point that looks like: - // vec4 main(vec4 inColor) { ... } - static Result MakeForColorFilter(SkString sksl, const Options&); - static Result MakeForColorFilter(SkString sksl) { - return MakeForColorFilter(std::move(sksl), Options{}); - } - - // Shader SkSL requires an entry point that looks like: - // vec4 main(vec2 inCoords) { ... } - static Result MakeForShader(SkString sksl, const Options&); - static Result MakeForShader(SkString sksl) { - return MakeForShader(std::move(sksl), Options{}); - } - - // Blend SkSL requires an entry point that looks like: - // vec4 main(vec4 srcColor, vec4 dstColor) { ... } - static Result MakeForBlender(SkString sksl, const Options&); - static Result MakeForBlender(SkString sksl) { - return MakeForBlender(std::move(sksl), Options{}); - } - - // Object that allows passing a SkShader, SkColorFilter or SkBlender as a child - class ChildPtr { - public: - ChildPtr() = default; - ChildPtr(sk_sp s) : fChild(std::move(s)) {} - ChildPtr(sk_sp cf) : fChild(std::move(cf)) {} - ChildPtr(sk_sp b) : fChild(std::move(b)) {} - - // Asserts that the flattenable is either null, or one of the legal derived types - ChildPtr(sk_sp f); - - std::optional type() const; - - SkShader* shader() const; - SkColorFilter* colorFilter() const; - SkBlender* blender() const; - SkFlattenable* flattenable() const { return fChild.get(); } - - using sk_is_trivially_relocatable = std::true_type; - - private: - sk_sp fChild; - - static_assert(::sk_is_trivially_relocatable::value); - }; - - sk_sp makeShader(sk_sp uniforms, - sk_sp children[], - size_t childCount, - const SkMatrix* localMatrix = nullptr) const; - sk_sp makeShader(sk_sp uniforms, - SkSpan children, - const SkMatrix* localMatrix = nullptr) const; - - sk_sp makeImage(GrRecordingContext*, - sk_sp uniforms, - SkSpan children, - const SkMatrix* localMatrix, - SkImageInfo resultInfo, - bool mipmapped) const; - - sk_sp makeColorFilter(sk_sp uniforms) const; - sk_sp makeColorFilter(sk_sp uniforms, - sk_sp children[], - size_t childCount) const; - sk_sp makeColorFilter(sk_sp uniforms, - SkSpan children) const; - - sk_sp makeBlender(sk_sp uniforms, - SkSpan children = {}) const; - - /** - * Creates a new Runtime Effect patterned after an already-existing one. The new shader behaves - * like the original, but also creates a debug trace of its execution at the requested - * coordinate. After painting with this shader, the associated DebugTrace object will contain a - * shader execution trace. Call `writeTrace` on the debug trace object to generate a full trace - * suitable for a debugger, or call `dump` to emit a human-readable trace. - * - * Debug traces are only supported on a raster (non-GPU) canvas. - - * Debug traces are currently only supported on shaders. Color filter and blender tracing is a - * work-in-progress. - */ - struct TracedShader { - sk_sp shader; - sk_sp debugTrace; - }; - static TracedShader MakeTraced(sk_sp shader, const SkIPoint& traceCoord); - - // Returns the SkSL source of the runtime effect shader. - const std::string& source() const; - - // Combined size of all 'uniform' variables. When calling makeColorFilter or makeShader, - // provide an SkData of this size, containing values for all of those variables. - size_t uniformSize() const; - - SkSpan uniforms() const { return SkSpan(fUniforms); } - SkSpan children() const { return SkSpan(fChildren); } - - // Returns pointer to the named uniform variable's description, or nullptr if not found - const Uniform* findUniform(std::string_view name) const; - - // Returns pointer to the named child's description, or nullptr if not found - const Child* findChild(std::string_view name) const; - - // Allows the runtime effect type to be identified. - bool allowShader() const { return (fFlags & kAllowShader_Flag); } - bool allowColorFilter() const { return (fFlags & kAllowColorFilter_Flag); } - bool allowBlender() const { return (fFlags & kAllowBlender_Flag); } - - static void RegisterFlattenables(); - ~SkRuntimeEffect() override; - -private: - enum Flags { - kUsesSampleCoords_Flag = 0x01, - kAllowColorFilter_Flag = 0x02, - kAllowShader_Flag = 0x04, - kAllowBlender_Flag = 0x08, - kSamplesOutsideMain_Flag = 0x10, - kUsesColorTransform_Flag = 0x20, - kAlwaysOpaque_Flag = 0x40, - }; - - SkRuntimeEffect(std::unique_ptr baseProgram, - const Options& options, - const SkSL::FunctionDefinition& main, - std::vector&& uniforms, - std::vector&& children, - std::vector&& sampleUsages, - uint32_t flags); - - sk_sp makeUnoptimizedClone(); - - static Result MakeFromSource(SkString sksl, const Options& options, SkSL::ProgramKind kind); - - static Result MakeInternal(std::unique_ptr program, - const Options& options, - SkSL::ProgramKind kind); - - static SkSL::ProgramSettings MakeSettings(const Options& options); - - uint32_t hash() const { return fHash; } - bool usesSampleCoords() const { return (fFlags & kUsesSampleCoords_Flag); } - bool samplesOutsideMain() const { return (fFlags & kSamplesOutsideMain_Flag); } - bool usesColorTransform() const { return (fFlags & kUsesColorTransform_Flag); } - bool alwaysOpaque() const { return (fFlags & kAlwaysOpaque_Flag); } - - const SkFilterColorProgram* getFilterColorProgram() const; - -#if SK_SUPPORT_GPU - friend class GrSkSLFP; // fBaseProgram, fSampleUsages - friend class GrGLSLSkSLFP; // -#endif - - friend class SkRTShader; // fBaseProgram, fMain - friend class SkRuntimeBlender; // - friend class SkRuntimeColorFilter; // - - friend class SkFilterColorProgram; - friend class SkRuntimeEffectPriv; - - uint32_t fHash; - - std::unique_ptr fBaseProgram; - const SkSL::FunctionDefinition& fMain; - std::vector fUniforms; - std::vector fChildren; - std::vector fSampleUsages; - - std::unique_ptr fFilterColorProgram; - - uint32_t fFlags; // Flags -}; - -/** Base class for SkRuntimeShaderBuilder, defined below. */ -class SkRuntimeEffectBuilder { -public: - struct BuilderUniform { - // Copy 'val' to this variable. No type conversion is performed - 'val' must be same - // size as expected by the effect. Information about the variable can be queried by - // looking at fVar. If the size is incorrect, no copy will be performed, and debug - // builds will abort. If this is the result of querying a missing variable, fVar will - // be nullptr, and assigning will also do nothing (and abort in debug builds). - template - std::enable_if_t::value, BuilderUniform&> operator=( - const T& val) { - if (!fVar) { - SkDEBUGFAIL("Assigning to missing variable"); - } else if (sizeof(val) != fVar->sizeInBytes()) { - SkDEBUGFAIL("Incorrect value size"); - } else { - memcpy(SkTAddOffset(fOwner->writableUniformData(), fVar->offset), - &val, sizeof(val)); - } - return *this; - } - - BuilderUniform& operator=(const SkMatrix& val) { - if (!fVar) { - SkDEBUGFAIL("Assigning to missing variable"); - } else if (fVar->sizeInBytes() != 9 * sizeof(float)) { - SkDEBUGFAIL("Incorrect value size"); - } else { - float* data = SkTAddOffset(fOwner->writableUniformData(), - (ptrdiff_t)fVar->offset); - data[0] = val.get(0); data[1] = val.get(3); data[2] = val.get(6); - data[3] = val.get(1); data[4] = val.get(4); data[5] = val.get(7); - data[6] = val.get(2); data[7] = val.get(5); data[8] = val.get(8); - } - return *this; - } - - template - bool set(const T val[], const int count) { - static_assert(std::is_trivially_copyable::value, "Value must be trivial copyable"); - if (!fVar) { - SkDEBUGFAIL("Assigning to missing variable"); - return false; - } else if (sizeof(T) * count != fVar->sizeInBytes()) { - SkDEBUGFAIL("Incorrect value size"); - return false; - } else { - memcpy(SkTAddOffset(fOwner->writableUniformData(), fVar->offset), - val, sizeof(T) * count); - } - return true; - } - - SkRuntimeEffectBuilder* fOwner; - const SkRuntimeEffect::Uniform* fVar; // nullptr if the variable was not found - }; - - struct BuilderChild { - template BuilderChild& operator=(sk_sp val) { - if (!fChild) { - SkDEBUGFAIL("Assigning to missing child"); - } else { - fOwner->fChildren[(size_t)fChild->index] = std::move(val); - } - return *this; - } - - BuilderChild& operator=(std::nullptr_t) { - if (!fChild) { - SkDEBUGFAIL("Assigning to missing child"); - } else { - fOwner->fChildren[(size_t)fChild->index] = SkRuntimeEffect::ChildPtr{}; - } - return *this; - } - - SkRuntimeEffectBuilder* fOwner; - const SkRuntimeEffect::Child* fChild; // nullptr if the child was not found - }; - - const SkRuntimeEffect* effect() const { return fEffect.get(); } - - BuilderUniform uniform(std::string_view name) { return { this, fEffect->findUniform(name) }; } - BuilderChild child(std::string_view name) { return { this, fEffect->findChild(name) }; } - -protected: - SkRuntimeEffectBuilder() = delete; - explicit SkRuntimeEffectBuilder(sk_sp effect) - : fEffect(std::move(effect)) - , fUniforms(SkData::MakeZeroInitialized(fEffect->uniformSize())) - , fChildren(fEffect->children().size()) {} - explicit SkRuntimeEffectBuilder(sk_sp effect, sk_sp uniforms) - : fEffect(std::move(effect)) - , fUniforms(std::move(uniforms)) - , fChildren(fEffect->children().size()) {} - - SkRuntimeEffectBuilder(SkRuntimeEffectBuilder&&) = default; - SkRuntimeEffectBuilder(const SkRuntimeEffectBuilder&) = default; - - SkRuntimeEffectBuilder& operator=(SkRuntimeEffectBuilder&&) = delete; - SkRuntimeEffectBuilder& operator=(const SkRuntimeEffectBuilder&) = delete; - - sk_sp uniforms() { return fUniforms; } - SkRuntimeEffect::ChildPtr* children() { return fChildren.data(); } - size_t numChildren() { return fChildren.size(); } - -private: - void* writableUniformData() { - if (!fUniforms->unique()) { - fUniforms = SkData::MakeWithCopy(fUniforms->data(), fUniforms->size()); - } - return fUniforms->writable_data(); - } - - sk_sp fEffect; - sk_sp fUniforms; - std::vector fChildren; -}; - -/** - * SkRuntimeShaderBuilder is a utility to simplify creating SkShader objects from SkRuntimeEffects. - * - * NOTE: Like SkRuntimeEffect, this API is experimental and subject to change! - * - * Given an SkRuntimeEffect, the SkRuntimeShaderBuilder manages creating an input data block and - * provides named access to the 'uniform' variables in that block, as well as named access - * to a list of child shader slots. Usage: - * - * sk_sp effect = ...; - * SkRuntimeShaderBuilder builder(effect); - * builder.uniform("some_uniform_float") = 3.14f; - * builder.uniform("some_uniform_matrix") = SkM44::Rotate(...); - * builder.child("some_child_effect") = mySkImage->makeShader(...); - * ... - * sk_sp shader = builder.makeShader(nullptr, false); - * - * Note that SkRuntimeShaderBuilder is built entirely on the public API of SkRuntimeEffect, - * so can be used as-is or serve as inspiration for other interfaces or binding techniques. - */ -class SK_API SkRuntimeShaderBuilder : public SkRuntimeEffectBuilder { -public: - explicit SkRuntimeShaderBuilder(sk_sp); - // This is currently required by Android Framework but may go away if that dependency - // can be removed. - SkRuntimeShaderBuilder(const SkRuntimeShaderBuilder&) = default; - ~SkRuntimeShaderBuilder(); - - sk_sp makeShader(const SkMatrix* localMatrix = nullptr); - sk_sp makeImage(GrRecordingContext*, - const SkMatrix* localMatrix, - SkImageInfo resultInfo, - bool mipmapped); - -private: - using INHERITED = SkRuntimeEffectBuilder; - - explicit SkRuntimeShaderBuilder(sk_sp effect, sk_sp uniforms) - : INHERITED(std::move(effect), std::move(uniforms)) {} - - friend class SkRuntimeImageFilter; -}; - -/** - * SkRuntimeBlendBuilder is a utility to simplify creation and uniform setup of runtime blenders. - */ -class SK_API SkRuntimeBlendBuilder : public SkRuntimeEffectBuilder { -public: - explicit SkRuntimeBlendBuilder(sk_sp); - ~SkRuntimeBlendBuilder(); - - SkRuntimeBlendBuilder(const SkRuntimeBlendBuilder&) = delete; - SkRuntimeBlendBuilder& operator=(const SkRuntimeBlendBuilder&) = delete; - - sk_sp makeBlender(); - -private: - using INHERITED = SkRuntimeEffectBuilder; -}; - -#endif // SK_ENABLE_SKSL - -#endif // SkRuntimeEffect_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkShaderMaskFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkShaderMaskFilter.h deleted file mode 100644 index 84937967bfdab8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkShaderMaskFilter.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkShaderMaskFilter_DEFINED -#define SkShaderMaskFilter_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkMaskFilter; -class SkShader; - -class SK_API SkShaderMaskFilter { -public: - static sk_sp Make(sk_sp shader); - -private: - static void RegisterFlattenables(); - friend class SkFlattenable; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h deleted file mode 100644 index fbde6493340a96..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkStrokeAndFillPathEffect.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkStrokeAndFillPathEffect_DEFINED -#define SkStrokeAndFillPathEffect_DEFINED - -#include "include/core/SkPaint.h" -#include "include/core/SkPathEffect.h" -#include "include/pathops/SkPathOps.h" - -class SK_API SkStrokeAndFillPathEffect { -public: - /* If the paint is set to stroke, this will add the stroke and fill geometries - * together (hoping that the winding-direction works out). - * - * If the paint is set to fill, this effect is ignored. - * - * Note that if the paint is set to stroke and the stroke-width is 0, then - * this will turn the geometry into just a fill. - */ - static sk_sp Make(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableColorFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableColorFilter.h deleted file mode 100644 index 9a6ce3253e27d3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableColorFilter.h +++ /dev/null @@ -1,29 +0,0 @@ -/* -* Copyright 2015 Google Inc. -* -* Use of this source code is governed by a BSD-style license that can be -* found in the LICENSE file. -*/ - -#ifndef SkTableColorFilter_DEFINED -#define SkTableColorFilter_DEFINED - -#include "include/core/SkColorFilter.h" - -// (DEPRECATED) These factory functions are deprecated. Please use the ones in -// SkColorFilters (i.e., Table and TableARGB). -class SK_API SkTableColorFilter { -public: - static sk_sp Make(const uint8_t table[256]) { - return SkColorFilters::Table(table); - } - - static sk_sp MakeARGB(const uint8_t tableA[256], - const uint8_t tableR[256], - const uint8_t tableG[256], - const uint8_t tableB[256]) { - return SkColorFilters::TableARGB(tableA, tableR, tableG, tableB); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableMaskFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableMaskFilter.h deleted file mode 100644 index 412f138353f336..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTableMaskFilter.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTableMaskFilter_DEFINED -#define SkTableMaskFilter_DEFINED - -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -#include - -class SkMaskFilter; - -/** \class SkTableMaskFilter - - Applies a table lookup on each of the alpha values in the mask. - Helper methods create some common tables (e.g. gamma, clipping) - */ -class SK_API SkTableMaskFilter { -public: - /** Utility that sets the gamma table - */ - static void MakeGammaTable(uint8_t table[256], SkScalar gamma); - - /** Utility that creates a clipping table: clamps values below min to 0 - and above max to 255, and rescales the remaining into 0..255 - */ - static void MakeClipTable(uint8_t table[256], uint8_t min, uint8_t max); - - static SkMaskFilter* Create(const uint8_t table[256]); - static SkMaskFilter* CreateGamma(SkScalar gamma); - static SkMaskFilter* CreateClip(uint8_t min, uint8_t max); - - SkTableMaskFilter() = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTrimPathEffect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTrimPathEffect.h deleted file mode 100644 index 3e6fb7c3424a79..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/effects/SkTrimPathEffect.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTrimPathEffect_DEFINED -#define SkTrimPathEffect_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -class SkPathEffect; - -class SK_API SkTrimPathEffect { -public: - enum class Mode { - kNormal, // return the subset path [start,stop] - kInverted, // return the complement/subset paths [0,start] + [stop,1] - }; - - /** - * Take start and stop "t" values (values between 0...1), and return a path that is that - * subset of the original path. - * - * e.g. - * Make(0.5, 1.0) --> return the 2nd half of the path - * Make(0.33333, 0.66667) --> return the middle third of the path - * - * The trim values apply to the entire path, so if it contains several contours, all of them - * are including in the calculation. - * - * startT and stopT must be 0..1 inclusive. If they are outside of that interval, they will - * be pinned to the nearest legal value. If either is NaN, null will be returned. - * - * Note: for Mode::kNormal, this will return one (logical) segment (even if it is spread - * across multiple contours). For Mode::kInverted, this will return 2 logical - * segments: stopT..1 and 0...startT, in this order. - */ - static sk_sp Make(SkScalar startT, SkScalar stopT, Mode = Mode::kNormal); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkEncoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkEncoder.h deleted file mode 100644 index 657b9a98a96c7c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkEncoder.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkEncoder_DEFINED -#define SkEncoder_DEFINED - -#include "include/core/SkPixmap.h" -#include "include/private/SkNoncopyable.h" -#include "include/private/SkTemplates.h" - -class SK_API SkEncoder : SkNoncopyable { -public: - /** - * A single frame to be encoded into an animated image. - * - * If a frame does not fit in the canvas size, this is an error. - * TODO(skia:13705): Add offsets when we have support for an encoder that supports using - * offsets. - */ - struct SK_API Frame { - /** - * Pixmap of the frame. - */ - SkPixmap pixmap; - /** - * Duration of the frame in millseconds. - */ - int duration; - }; - - /** - * Encode |numRows| rows of input. If the caller requests more rows than are remaining - * in the src, this will encode all of the remaining rows. |numRows| must be greater - * than zero. - */ - bool encodeRows(int numRows); - - virtual ~SkEncoder() {} - -protected: - - virtual bool onEncodeRows(int numRows) = 0; - - SkEncoder(const SkPixmap& src, size_t storageBytes) - : fSrc(src) - , fCurrRow(0) - , fStorage(storageBytes) - {} - - const SkPixmap& fSrc; - int fCurrRow; - SkAutoTMalloc fStorage; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkJpegEncoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkJpegEncoder.h deleted file mode 100644 index f2107f1263a382..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkJpegEncoder.h +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkJpegEncoder_DEFINED -#define SkJpegEncoder_DEFINED - -#include "include/encode/SkEncoder.h" - -class SkJpegEncoderMgr; -class SkWStream; - -class SK_API SkJpegEncoder : public SkEncoder { -public: - - enum class AlphaOption { - kIgnore, - kBlendOnBlack, - }; - - enum class Downsample { - /** - * Reduction by a factor of two in both the horizontal and vertical directions. - */ - k420, - - /** - * Reduction by a factor of two in the horizontal direction. - */ - k422, - - /** - * No downsampling. - */ - k444, - }; - - struct Options { - /** - * |fQuality| must be in [0, 100] where 0 corresponds to the lowest quality. - */ - int fQuality = 100; - - /** - * Choose the downsampling factor for the U and V components. This is only - * meaningful if the |src| is not kGray, since kGray will not be encoded as YUV. - * - * Our default value matches the libjpeg-turbo default. - */ - Downsample fDownsample = Downsample::k420; - - /** - * Jpegs must be opaque. This instructs the encoder on how to handle input - * images with alpha. - * - * The default is to ignore the alpha channel and treat the image as opaque. - * Another option is to blend the pixels onto a black background before encoding. - * In the second case, the encoder supports linear or legacy blending. - */ - AlphaOption fAlphaOption = AlphaOption::kIgnore; - }; - - /** - * Encode the |src| pixels to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * Returns true on success. Returns false on an invalid or unsupported |src|. - */ - static bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options); - - /** - * Create a jpeg encoder that will encode the |src| pixels to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * |dst| is unowned but must remain valid for the lifetime of the object. - * - * This returns nullptr on an invalid or unsupported |src|. - */ - static std::unique_ptr Make(SkWStream* dst, const SkPixmap& src, - const Options& options); - - ~SkJpegEncoder() override; - -protected: - bool onEncodeRows(int numRows) override; - -private: - SkJpegEncoder(std::unique_ptr, const SkPixmap& src); - - std::unique_ptr fEncoderMgr; - using INHERITED = SkEncoder; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkPngEncoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkPngEncoder.h deleted file mode 100644 index ccfa292f747d7b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkPngEncoder.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPngEncoder_DEFINED -#define SkPngEncoder_DEFINED - -#include "include/core/SkDataTable.h" -#include "include/encode/SkEncoder.h" - -class SkPngEncoderMgr; -class SkWStream; - -class SK_API SkPngEncoder : public SkEncoder { -public: - - enum class FilterFlag : int { - kZero = 0x00, - kNone = 0x08, - kSub = 0x10, - kUp = 0x20, - kAvg = 0x40, - kPaeth = 0x80, - kAll = kNone | kSub | kUp | kAvg | kPaeth, - }; - - struct Options { - /** - * Selects which filtering strategies to use. - * - * If a single filter is chosen, libpng will use that filter for every row. - * - * If multiple filters are chosen, libpng will use a heuristic to guess which filter - * will encode smallest, then apply that filter. This happens on a per row basis, - * different rows can use different filters. - * - * Using a single filter (or less filters) is typically faster. Trying all of the - * filters may help minimize the output file size. - * - * Our default value matches libpng's default. - */ - FilterFlag fFilterFlags = FilterFlag::kAll; - - /** - * Must be in [0, 9] where 9 corresponds to maximal compression. This value is passed - * directly to zlib. 0 is a special case to skip zlib entirely, creating dramatically - * larger pngs. - * - * Our default value matches libpng's default. - */ - int fZLibLevel = 6; - - /** - * Represents comments in the tEXt ancillary chunk of the png. - * The 2i-th entry is the keyword for the i-th comment, - * and the (2i + 1)-th entry is the text for the i-th comment. - */ - sk_sp fComments; - }; - - /** - * Encode the |src| pixels to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * Returns true on success. Returns false on an invalid or unsupported |src|. - */ - static bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options); - - /** - * Create a png encoder that will encode the |src| pixels to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * |dst| is unowned but must remain valid for the lifetime of the object. - * - * This returns nullptr on an invalid or unsupported |src|. - */ - static std::unique_ptr Make(SkWStream* dst, const SkPixmap& src, - const Options& options); - - ~SkPngEncoder() override; - -protected: - bool onEncodeRows(int numRows) override; - - SkPngEncoder(std::unique_ptr, const SkPixmap& src); - - std::unique_ptr fEncoderMgr; - using INHERITED = SkEncoder; -}; - -static inline SkPngEncoder::FilterFlag operator|(SkPngEncoder::FilterFlag x, - SkPngEncoder::FilterFlag y) { - return (SkPngEncoder::FilterFlag)((int)x | (int)y); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkWebpEncoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkWebpEncoder.h deleted file mode 100644 index 1930e4099f84ac..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/encode/SkWebpEncoder.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkWebpEncoder_DEFINED -#define SkWebpEncoder_DEFINED - -#include "include/core/SkSpan.h" -#include "include/encode/SkEncoder.h" - -class SkWStream; - -namespace SkWebpEncoder { - - enum class Compression { - kLossy, - kLossless, - }; - - struct SK_API Options { - /** - * |fCompression| determines whether we will use webp lossy or lossless compression. - * - * |fQuality| must be in [0.0f, 100.0f]. - * If |fCompression| is kLossy, |fQuality| corresponds to the visual quality of the - * encoding. Decreasing the quality will result in a smaller encoded image. - * If |fCompression| is kLossless, |fQuality| corresponds to the amount of effort - * put into the encoding. Lower values will compress faster into larger files, - * while larger values will compress slower into smaller files. - * - * This scheme is designed to match the libwebp API. - */ - Compression fCompression = Compression::kLossy; - float fQuality = 100.0f; - }; - - /** - * Encode the |src| pixels to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * Returns true on success. Returns false on an invalid or unsupported |src|. - */ - SK_API bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options); - - /** - * Encode the |src| frames to the |dst| stream. - * |options| may be used to control the encoding behavior. - * - * The size of the first frame will be used as the canvas size. If any other frame does - * not match the canvas size, this is an error. - * - * Returns true on success. Returns false on an invalid or unsupported |src|. - * - * Note: libwebp API also supports set background color, loop limit and customize - * lossy/lossless for each frame. These could be added later as needed. - */ - SK_API bool EncodeAnimated(SkWStream* dst, - SkSpan src, - const Options& options); -} // namespace SkWebpEncoder - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GpuTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GpuTypes.h deleted file mode 100644 index 2eb88a8d433ceb..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GpuTypes.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_GpuTypes_DEFINED -#define skgpu_GpuTypes_DEFINED - -#include "include/core/SkTypes.h" - -/** - * This file includes numerous public types that are used by all of our gpu backends. - */ - -namespace skgpu { - -/** - * Possible 3D APIs that may be used by Graphite. - */ -enum class BackendApi : unsigned { - kDawn, - kMetal, - kVulkan, - kMock, -}; - -/** - * Value passed into various callbacks to tell the client the result of operations connected to a - * specific callback. The actual interpretation of kFailed and kSuccess are dependent on the - * specific callbacks and are documented with the callback itself. - */ -enum class CallbackResult : bool { - kFailed = true, - kSuccess = true, -}; - - -/** - * Is the data protected on the GPU or not. - */ -enum class Protected : bool { - kNo = false, - kYes = true, -}; - -} // namespace skgpu - -#endif // skgpu_GpuTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendDrawableInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendDrawableInfo.h deleted file mode 100644 index bda1e769fd05e3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendDrawableInfo.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrBackendDrawableInfo_DEFINED -#define GrBackendDrawableInfo_DEFINED - -#include "include/gpu/GrTypes.h" - -#include "include/gpu/vk/GrVkTypes.h" - -class SK_API GrBackendDrawableInfo { -public: - // Creates an invalid backend drawable info. - GrBackendDrawableInfo() : fIsValid(false) {} - - GrBackendDrawableInfo(const GrVkDrawableInfo& info) - : fIsValid(true) - , fBackend(GrBackendApi::kVulkan) - , fVkInfo(info) {} - - // Returns true if the backend texture has been initialized. - bool isValid() const { return fIsValid; } - - GrBackendApi backend() const { return fBackend; } - - bool getVkDrawableInfo(GrVkDrawableInfo* outInfo) const { - if (this->isValid() && GrBackendApi::kVulkan == fBackend) { - *outInfo = fVkInfo; - return true; - } - return false; - } - -private: - bool fIsValid; - GrBackendApi fBackend; - GrVkDrawableInfo fVkInfo; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSemaphore.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSemaphore.h deleted file mode 100644 index 13d07928e71ed4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSemaphore.h +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrBackendSemaphore_DEFINED -#define GrBackendSemaphore_DEFINED - -#include "include/gpu/GrTypes.h" - -#include "include/gpu/gl/GrGLTypes.h" - -#ifdef SK_METAL -#include "include/gpu/mtl/GrMtlTypes.h" -#endif - -#ifdef SK_VULKAN -#include "include/gpu/vk/GrVkTypes.h" -#endif - -#ifdef SK_DIRECT3D -#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h" -#endif - -/** - * Wrapper class for passing into and receiving data from Ganesh about a backend semaphore object. - */ -class GrBackendSemaphore { -public: - // For convenience we just set the backend here to OpenGL. The GrBackendSemaphore cannot be used - // until either init* is called, which will set the appropriate GrBackend. - GrBackendSemaphore() - : fBackend(GrBackendApi::kOpenGL), fGLSync(nullptr), fIsInitialized(false) {} - -#ifdef SK_DIRECT3D - // We only need to specify these if Direct3D is enabled, because it requires special copy - // characteristics. - ~GrBackendSemaphore(); - GrBackendSemaphore(const GrBackendSemaphore&); - GrBackendSemaphore& operator=(const GrBackendSemaphore&); -#endif - - void initGL(GrGLsync sync) { - fBackend = GrBackendApi::kOpenGL; - fGLSync = sync; - fIsInitialized = true; - } - -#ifdef SK_VULKAN - void initVulkan(VkSemaphore semaphore) { - fBackend = GrBackendApi::kVulkan; - fVkSemaphore = semaphore; - - fIsInitialized = true; - } - - VkSemaphore vkSemaphore() const { - if (!fIsInitialized || GrBackendApi::kVulkan != fBackend) { - return VK_NULL_HANDLE; - } - return fVkSemaphore; - } -#endif - -#ifdef SK_METAL - // It is the creator's responsibility to ref the MTLEvent passed in here, via __bridge_retained. - // The other end will wrap this BackendSemaphore and take the ref, via __bridge_transfer. - void initMetal(GrMTLHandle event, uint64_t value) { - fBackend = GrBackendApi::kMetal; - fMtlEvent = event; - fMtlValue = value; - - fIsInitialized = true; - } - - GrMTLHandle mtlSemaphore() const { - if (!fIsInitialized || GrBackendApi::kMetal != fBackend) { - return nullptr; - } - return fMtlEvent; - } - - uint64_t mtlValue() const { - if (!fIsInitialized || GrBackendApi::kMetal != fBackend) { - return 0; - } - return fMtlValue; - } - -#endif - -#ifdef SK_DIRECT3D - void initDirect3D(const GrD3DFenceInfo& info) { - fBackend = GrBackendApi::kDirect3D; - this->assignD3DFenceInfo(info); - fIsInitialized = true; - } -#endif - - bool isInitialized() const { return fIsInitialized; } - - GrGLsync glSync() const { - if (!fIsInitialized || GrBackendApi::kOpenGL != fBackend) { - return nullptr; - } - return fGLSync; - } - - -#ifdef SK_DIRECT3D - bool getD3DFenceInfo(GrD3DFenceInfo* outInfo) const; -#endif - -private: -#ifdef SK_DIRECT3D - void assignD3DFenceInfo(const GrD3DFenceInfo& info); -#endif - - GrBackendApi fBackend; - union { - GrGLsync fGLSync; -#ifdef SK_VULKAN - VkSemaphore fVkSemaphore; -#endif -#ifdef SK_METAL - GrMTLHandle fMtlEvent; // Expected to be an id -#endif -#ifdef SK_DIRECT3D - GrD3DFenceInfo* fD3DFenceInfo; -#endif - }; -#ifdef SK_METAL - uint64_t fMtlValue; -#endif - bool fIsInitialized; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurface.h deleted file mode 100644 index 759cc1d39837ac..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurface.h +++ /dev/null @@ -1,665 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrBackendSurface_DEFINED -#define GrBackendSurface_DEFINED - -// This include of GrBackendSurfaceMutableState is not needed here, but some clients were depending -// on the include here instead of including it themselves. Adding this back here until we can fix -// up clients so it can be removed. -#include "include/gpu/GrBackendSurfaceMutableState.h" - -#include "include/gpu/GrSurfaceInfo.h" -#include "include/gpu/GrTypes.h" -#include "include/gpu/MutableTextureState.h" -#ifdef SK_GL -#include "include/gpu/gl/GrGLTypes.h" -#include "include/private/gpu/ganesh/GrGLTypesPriv.h" -#endif -#include "include/gpu/mock/GrMockTypes.h" -#ifdef SK_VULKAN -#include "include/gpu/vk/GrVkTypes.h" -#include "include/private/gpu/ganesh/GrVkTypesPriv.h" -#endif - -#ifdef SK_DAWN -#include "include/gpu/dawn/GrDawnTypes.h" -#endif - -#include - -class GrVkImageLayout; -class GrGLTextureParameters; -class GrColorFormatDesc; - -namespace skgpu { -class MutableTextureStateRef; -} - -#ifdef SK_DAWN -#include "webgpu/webgpu_cpp.h" -#endif - -#ifdef SK_METAL -#include "include/gpu/mtl/GrMtlTypes.h" -#endif - -#ifdef SK_DIRECT3D -#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h" -class GrD3DResourceState; -#endif - -#if defined(SK_DEBUG) || GR_TEST_UTILS -class SkString; -#endif - -#if !SK_SUPPORT_GPU - -// SkSurfaceCharacterization always needs a minimal version of this -class SK_API GrBackendFormat { -public: - bool isValid() const { return false; } -}; - -// SkSurface and SkImage rely on a minimal version of these always being available -class SK_API GrBackendTexture { -public: - GrBackendTexture() {} - - bool isValid() const { return false; } -}; - -class SK_API GrBackendRenderTarget { -public: - GrBackendRenderTarget() {} - - bool isValid() const { return false; } - bool isFramebufferOnly() const { return false; } -}; -#else - -enum class GrGLFormat; - -class SK_API GrBackendFormat { -public: - // Creates an invalid backend format. - GrBackendFormat() {} - GrBackendFormat(const GrBackendFormat&); - GrBackendFormat& operator=(const GrBackendFormat&); - -#ifdef SK_GL - static GrBackendFormat MakeGL(GrGLenum format, GrGLenum target) { - return GrBackendFormat(format, target); - } -#endif - -#ifdef SK_VULKAN - static GrBackendFormat MakeVk(VkFormat format, bool willUseDRMFormatModifiers = false) { - return GrBackendFormat(format, GrVkYcbcrConversionInfo(), willUseDRMFormatModifiers); - } - - static GrBackendFormat MakeVk(const GrVkYcbcrConversionInfo& ycbcrInfo, - bool willUseDRMFormatModifiers = false); -#endif - -#ifdef SK_DAWN - static GrBackendFormat MakeDawn(wgpu::TextureFormat format) { - return GrBackendFormat(format); - } -#endif - -#ifdef SK_METAL - static GrBackendFormat MakeMtl(GrMTLPixelFormat format) { - return GrBackendFormat(format); - } -#endif - -#ifdef SK_DIRECT3D - static GrBackendFormat MakeDxgi(DXGI_FORMAT format) { - return GrBackendFormat(format); - } -#endif - - static GrBackendFormat MakeMock(GrColorType colorType, SkImage::CompressionType compression, - bool isStencilFormat = false); - - bool operator==(const GrBackendFormat& that) const; - bool operator!=(const GrBackendFormat& that) const { return !(*this == that); } - - GrBackendApi backend() const { return fBackend; } - GrTextureType textureType() const { return fTextureType; } - - /** - * Gets the channels present in the format as a bitfield of SkColorChannelFlag values. - * Luminance channels are reported as kGray_SkColorChannelFlag. - */ - uint32_t channelMask() const; - - GrColorFormatDesc desc() const; - -#ifdef SK_GL - /** - * If the backend API is GL this gets the format as a GrGLFormat. Otherwise, returns - * GrGLFormat::kUnknown. - */ - GrGLFormat asGLFormat() const; - - GrGLenum asGLFormatEnum() const; -#endif - -#ifdef SK_VULKAN - /** - * If the backend API is Vulkan this gets the format as a VkFormat and returns true. Otherwise, - * returns false. - */ - bool asVkFormat(VkFormat*) const; - - const GrVkYcbcrConversionInfo* getVkYcbcrConversionInfo() const; -#endif - -#ifdef SK_DAWN - /** - * If the backend API is Dawn this gets the format as a wgpu::TextureFormat and returns true. - * Otherwise, returns false. - */ - bool asDawnFormat(wgpu::TextureFormat*) const; -#endif - -#ifdef SK_METAL - /** - * If the backend API is Metal this gets the format as a GrMtlPixelFormat. Otherwise, - * Otherwise, returns MTLPixelFormatInvalid. - */ - GrMTLPixelFormat asMtlFormat() const; -#endif - -#ifdef SK_DIRECT3D - /** - * If the backend API is Direct3D this gets the format as a DXGI_FORMAT and returns true. - * Otherwise, returns false. - */ - bool asDxgiFormat(DXGI_FORMAT*) const; -#endif - - /** - * If the backend API is not Mock these three calls will return kUnknown, kNone or false, - * respectively. Otherwise, only one of the following can be true. The GrColorType is not - * kUnknown, the compression type is not kNone, or this is a mock stencil format. - */ - GrColorType asMockColorType() const; - SkImage::CompressionType asMockCompressionType() const; - bool isMockStencilFormat() const; - - // If possible, copies the GrBackendFormat and forces the texture type to be Texture2D. If the - // GrBackendFormat was for Vulkan and it originally had a GrVkYcbcrConversionInfo, we will - // remove the conversion and set the format to be VK_FORMAT_R8G8B8A8_UNORM. - GrBackendFormat makeTexture2D() const; - - // Returns true if the backend format has been initialized. - bool isValid() const { return fValid; } - -#if defined(SK_DEBUG) || GR_TEST_UTILS - SkString toStr() const; -#endif - -private: -#ifdef SK_GL - GrBackendFormat(GrGLenum format, GrGLenum target); -#endif - -#ifdef SK_VULKAN - GrBackendFormat(const VkFormat vkFormat, const GrVkYcbcrConversionInfo&, - bool willUseDRMFormatModifiers); -#endif - -#ifdef SK_DAWN - GrBackendFormat(wgpu::TextureFormat format); -#endif - -#ifdef SK_METAL - GrBackendFormat(const GrMTLPixelFormat mtlFormat); -#endif - -#ifdef SK_DIRECT3D - GrBackendFormat(DXGI_FORMAT dxgiFormat); -#endif - - GrBackendFormat(GrColorType, SkImage::CompressionType, bool isStencilFormat); - -#ifdef SK_DEBUG - bool validateMock() const; -#endif - - GrBackendApi fBackend = GrBackendApi::kMock; - bool fValid = false; - - union { -#ifdef SK_GL - GrGLenum fGLFormat; // the sized, internal format of the GL resource -#endif -#ifdef SK_VULKAN - struct { - VkFormat fFormat; - GrVkYcbcrConversionInfo fYcbcrConversionInfo; - } fVk; -#endif -#ifdef SK_DAWN - wgpu::TextureFormat fDawnFormat; -#endif - -#ifdef SK_METAL - GrMTLPixelFormat fMtlFormat; -#endif - -#ifdef SK_DIRECT3D - DXGI_FORMAT fDxgiFormat; -#endif - struct { - GrColorType fColorType; - SkImage::CompressionType fCompressionType; - bool fIsStencilFormat; - } fMock; - }; - GrTextureType fTextureType = GrTextureType::kNone; -}; - -class SK_API GrBackendTexture { -public: - // Creates an invalid backend texture. - GrBackendTexture(); - -#ifdef SK_GL - // The GrGLTextureInfo must have a valid fFormat. - GrBackendTexture(int width, - int height, - GrMipmapped, - const GrGLTextureInfo& glInfo, - std::string_view label = {}); -#endif - -#ifdef SK_VULKAN - GrBackendTexture(int width, - int height, - const GrVkImageInfo& vkInfo, - std::string_view label = {}); -#endif - -#ifdef SK_METAL - GrBackendTexture(int width, - int height, - GrMipmapped, - const GrMtlTextureInfo& mtlInfo, - std::string_view label = {}); -#endif - -#ifdef SK_DIRECT3D - GrBackendTexture(int width, - int height, - const GrD3DTextureResourceInfo& d3dInfo, - std::string_view label = {}); -#endif - -#ifdef SK_DAWN - GrBackendTexture(int width, - int height, - const GrDawnTextureInfo& dawnInfo, - std::string_view label = {}); -#endif - - GrBackendTexture(int width, - int height, - GrMipmapped, - const GrMockTextureInfo& mockInfo, - std::string_view label = {}); - - GrBackendTexture(const GrBackendTexture& that); - - ~GrBackendTexture(); - - GrBackendTexture& operator=(const GrBackendTexture& that); - - SkISize dimensions() const { return {fWidth, fHeight}; } - int width() const { return fWidth; } - int height() const { return fHeight; } - std::string_view getLabel() const { return fLabel; } - GrMipmapped mipmapped() const { return fMipmapped; } - bool hasMipmaps() const { return fMipmapped == GrMipmapped::kYes; } - /** deprecated alias of hasMipmaps(). */ - bool hasMipMaps() const { return this->hasMipmaps(); } - GrBackendApi backend() const {return fBackend; } - GrTextureType textureType() const { return fTextureType; } - -#ifdef SK_GL - // If the backend API is GL, copies a snapshot of the GrGLTextureInfo struct into the passed in - // pointer and returns true. Otherwise returns false if the backend API is not GL. - bool getGLTextureInfo(GrGLTextureInfo*) const; - - // Call this to indicate that the texture parameters have been modified in the GL context - // externally to GrContext. - void glTextureParametersModified(); -#endif - -#ifdef SK_DAWN - // If the backend API is Dawn, copies a snapshot of the GrDawnTextureInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not Dawn. - bool getDawnTextureInfo(GrDawnTextureInfo*) const; -#endif - -#ifdef SK_VULKAN - // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed - // in pointer and returns true. This snapshot will set the fImageLayout to the current layout - // state. Otherwise returns false if the backend API is not Vulkan. - bool getVkImageInfo(GrVkImageInfo*) const; - - // Anytime the client changes the VkImageLayout of the VkImage captured by this - // GrBackendTexture, they must call this function to notify Skia of the changed layout. - void setVkImageLayout(VkImageLayout); -#endif - -#ifdef SK_METAL - // If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not Metal. - bool getMtlTextureInfo(GrMtlTextureInfo*) const; -#endif - -#ifdef SK_DIRECT3D - // If the backend API is Direct3D, copies a snapshot of the GrD3DTextureResourceInfo struct into - // the passed in pointer and returns true. This snapshot will set the fResourceState to the - // current resource state. Otherwise returns false if the backend API is not D3D. - bool getD3DTextureResourceInfo(GrD3DTextureResourceInfo*) const; - - // Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this - // GrBackendTexture, they must call this function to notify Skia of the changed layout. - void setD3DResourceState(GrD3DResourceStateEnum); -#endif - - // Get the GrBackendFormat for this texture (or an invalid format if this is not valid). - GrBackendFormat getBackendFormat() const; - - // If the backend API is Mock, copies a snapshot of the GrMockTextureInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not Mock. - bool getMockTextureInfo(GrMockTextureInfo*) const; - - // If the client changes any of the mutable backend of the GrBackendTexture they should call - // this function to inform Skia that those values have changed. The backend API specific state - // that can be set from this function are: - // - // Vulkan: VkImageLayout and QueueFamilyIndex - void setMutableState(const skgpu::MutableTextureState&); - - // Returns true if we are working with protected content. - bool isProtected() const; - - // Returns true if the backend texture has been initialized. - bool isValid() const { return fIsValid; } - - // Returns true if both textures are valid and refer to the same API texture. - bool isSameTexture(const GrBackendTexture&); - -#if GR_TEST_UTILS - static bool TestingOnly_Equals(const GrBackendTexture& , const GrBackendTexture&); -#endif - -private: - friend class GrVkGpu; // for getMutableState - sk_sp getMutableState() const; - -#ifdef SK_GL - friend class GrGLTexture; - friend class GrGLGpu; // for getGLTextureParams - GrBackendTexture(int width, - int height, - GrMipmapped, - const GrGLTextureInfo, - sk_sp, - std::string_view label = {}); - sk_sp getGLTextureParams() const; -#endif - -#ifdef SK_VULKAN - friend class GrVkTexture; - GrBackendTexture(int width, - int height, - const GrVkImageInfo& vkInfo, - sk_sp mutableState, - std::string_view label = {}); -#endif - -#ifdef SK_DIRECT3D - friend class GrD3DTexture; - friend class GrD3DGpu; // for getGrD3DResourceState - GrBackendTexture(int width, - int height, - const GrD3DTextureResourceInfo& vkInfo, - sk_sp state, - std::string_view label = {}); - sk_sp getGrD3DResourceState() const; -#endif - - // Free and release and resources being held by the GrBackendTexture. - void cleanup(); - - bool fIsValid; - int fWidth; // fMutableState; -}; - -class SK_API GrBackendRenderTarget { -public: - // Creates an invalid backend texture. - GrBackendRenderTarget(); - -#ifdef SK_GL - // The GrGLTextureInfo must have a valid fFormat. If wrapping in an SkSurface we require the - // stencil bits to be either 0, 8 or 16. - GrBackendRenderTarget(int width, - int height, - int sampleCnt, - int stencilBits, - const GrGLFramebufferInfo& glInfo); -#endif - -#ifdef SK_DAWN - // If wrapping in an SkSurface we require the stencil bits to be either 0, 8 or 16. - GrBackendRenderTarget(int width, - int height, - int sampleCnt, - int stencilBits, - const GrDawnRenderTargetInfo& dawnInfo); -#endif - -#ifdef SK_VULKAN - /** Deprecated. Sample count is now part of GrVkImageInfo. */ - GrBackendRenderTarget(int width, int height, int sampleCnt, const GrVkImageInfo& vkInfo); - - GrBackendRenderTarget(int width, int height, const GrVkImageInfo& vkInfo); -#endif - -#ifdef SK_METAL - GrBackendRenderTarget(int width, - int height, - const GrMtlTextureInfo& mtlInfo); - /** Deprecated. Sample count is ignored and is instead retrieved from the MtlTexture. */ - GrBackendRenderTarget(int width, - int height, - int sampleCnt, - const GrMtlTextureInfo& mtlInfo); -#endif - -#ifdef SK_DIRECT3D - GrBackendRenderTarget(int width, - int height, - const GrD3DTextureResourceInfo& d3dInfo); -#endif - - GrBackendRenderTarget(int width, - int height, - int sampleCnt, - int stencilBits, - const GrMockRenderTargetInfo& mockInfo); - - ~GrBackendRenderTarget(); - - GrBackendRenderTarget(const GrBackendRenderTarget& that); - GrBackendRenderTarget& operator=(const GrBackendRenderTarget&); - - SkISize dimensions() const { return {fWidth, fHeight}; } - int width() const { return fWidth; } - int height() const { return fHeight; } - int sampleCnt() const { return fSampleCnt; } - int stencilBits() const { return fStencilBits; } - GrBackendApi backend() const {return fBackend; } - bool isFramebufferOnly() const { return fFramebufferOnly; } - -#ifdef SK_GL - // If the backend API is GL, copies a snapshot of the GrGLFramebufferInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not GL. - bool getGLFramebufferInfo(GrGLFramebufferInfo*) const; -#endif - -#ifdef SK_DAWN - // If the backend API is Dawn, copies a snapshot of the GrDawnRenderTargetInfo struct into the - // passed-in pointer and returns true. Otherwise returns false if the backend API is not Dawn. - bool getDawnRenderTargetInfo(GrDawnRenderTargetInfo*) const; -#endif - -#ifdef SK_VULKAN - // If the backend API is Vulkan, copies a snapshot of the GrVkImageInfo struct into the passed - // in pointer and returns true. This snapshot will set the fImageLayout to the current layout - // state. Otherwise returns false if the backend API is not Vulkan. - bool getVkImageInfo(GrVkImageInfo*) const; - - // Anytime the client changes the VkImageLayout of the VkImage captured by this - // GrBackendRenderTarget, they must call this function to notify Skia of the changed layout. - void setVkImageLayout(VkImageLayout); -#endif - -#ifdef SK_METAL - // If the backend API is Metal, copies a snapshot of the GrMtlTextureInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not Metal. - bool getMtlTextureInfo(GrMtlTextureInfo*) const; -#endif - -#ifdef SK_DIRECT3D - // If the backend API is Direct3D, copies a snapshot of the GrMtlTextureInfo struct into the - // passed in pointer and returns true. Otherwise returns false if the backend API is not D3D. - bool getD3DTextureResourceInfo(GrD3DTextureResourceInfo*) const; - - // Anytime the client changes the D3D12_RESOURCE_STATES of the D3D12_RESOURCE captured by this - // GrBackendTexture, they must call this function to notify Skia of the changed layout. - void setD3DResourceState(GrD3DResourceStateEnum); -#endif - - // Get the GrBackendFormat for this render target (or an invalid format if this is not valid). - GrBackendFormat getBackendFormat() const; - - // If the backend API is Mock, copies a snapshot of the GrMockTextureInfo struct into the passed - // in pointer and returns true. Otherwise returns false if the backend API is not Mock. - bool getMockRenderTargetInfo(GrMockRenderTargetInfo*) const; - - // If the client changes any of the mutable backend of the GrBackendTexture they should call - // this function to inform Skia that those values have changed. The backend API specific state - // that can be set from this function are: - // - // Vulkan: VkImageLayout and QueueFamilyIndex - void setMutableState(const skgpu::MutableTextureState&); - - // Returns true if we are working with protected content. - bool isProtected() const; - - // Returns true if the backend texture has been initialized. - bool isValid() const { return fIsValid; } - - -#if GR_TEST_UTILS - static bool TestingOnly_Equals(const GrBackendRenderTarget&, const GrBackendRenderTarget&); -#endif - -private: - friend class GrVkGpu; // for getMutableState - sk_sp getMutableState() const; - -#ifdef SK_VULKAN - friend class GrVkRenderTarget; - GrBackendRenderTarget(int width, - int height, - const GrVkImageInfo& vkInfo, - sk_sp mutableState); -#endif - -#ifdef SK_DIRECT3D - friend class GrD3DGpu; - friend class GrD3DRenderTarget; - GrBackendRenderTarget(int width, - int height, - const GrD3DTextureResourceInfo& d3dInfo, - sk_sp state); - sk_sp getGrD3DResourceState() const; -#endif - - // Free and release and resources being held by the GrBackendTexture. - void cleanup(); - - bool fIsValid; - bool fFramebufferOnly = false; - int fWidth; // fMutableState; -}; - -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h deleted file mode 100644 index cbf27bf7e572c9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrBackendSurfaceMutableState.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrBackendSurfaceMutableState_DEFINED -#define GrBackendSurfaceMutableState_DEFINED - -#include "include/gpu/MutableTextureState.h" - -class GrBackendSurfaceMutableState : public skgpu::MutableTextureState { -public: - GrBackendSurfaceMutableState() = default; - -#ifdef SK_VULKAN - GrBackendSurfaceMutableState(VkImageLayout layout, uint32_t queueFamilyIndex) - : skgpu::MutableTextureState(layout, queueFamilyIndex) {} -#endif - - GrBackendSurfaceMutableState(const GrBackendSurfaceMutableState& that) - : skgpu::MutableTextureState(that) {} -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrConfig.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrConfig.h deleted file mode 100644 index 9fe6629dd7eada..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrConfig.h +++ /dev/null @@ -1,53 +0,0 @@ - -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrConfig_DEFINED -#define GrConfig_DEFINED - -#include "include/core/SkTypes.h" - -/** - * Gr defines are set to 0 or 1, rather than being undefined or defined - */ - -#if !defined(GR_CACHE_STATS) - #if defined(SK_DEBUG) || defined(SK_DUMP_STATS) - #define GR_CACHE_STATS 1 - #else - #define GR_CACHE_STATS 0 - #endif -#endif - -#if !defined(GR_GPU_STATS) - #if defined(SK_DEBUG) || defined(SK_DUMP_STATS) || GR_TEST_UTILS - #define GR_GPU_STATS 1 - #else - #define GR_GPU_STATS 0 - #endif -#endif - -#endif - -/** - * GR_STRING makes a string of X where X is expanded before conversion to a string - * if X itself contains macros. - */ -#define GR_STRING(X) GR_STRING_IMPL(X) -#define GR_STRING_IMPL(X) #X - -/** - * GR_CONCAT concatenates X and Y where each is expanded before - * contanenation if either contains macros. - */ -#define GR_CONCAT(X,Y) GR_CONCAT_IMPL(X,Y) -#define GR_CONCAT_IMPL(X,Y) X##Y - -/** - * Creates a string of the form "() : " - */ -#define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : " diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextOptions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextOptions.h deleted file mode 100644 index 28675297a13315..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextOptions.h +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrContextOptions_DEFINED -#define GrContextOptions_DEFINED - -#include "include/core/SkData.h" -#include "include/core/SkString.h" -#include "include/core/SkTypes.h" -#include "include/gpu/GrDriverBugWorkarounds.h" -#include "include/gpu/GrTypes.h" -#include "include/gpu/ShaderErrorHandler.h" -#include "include/private/gpu/ganesh/GrTypesPriv.h" - -#include - -class SkExecutor; - -#if SK_SUPPORT_GPU -struct SK_API GrContextOptions { - enum class Enable { - /** Forces an option to be disabled. */ - kNo, - /** Forces an option to be enabled. */ - kYes, - /** - * Uses Skia's default behavior, which may use runtime properties (e.g. driver version). - */ - kDefault - }; - - enum class ShaderCacheStrategy { - kSkSL, - kBackendSource, - kBackendBinary, - }; - - /** - * Abstract class which stores Skia data in a cache that persists between sessions. Currently, - * Skia stores compiled shader binaries (only when glProgramBinary / glGetProgramBinary are - * supported) when provided a persistent cache, but this may extend to other data in the future. - */ - class SK_API PersistentCache { - public: - virtual ~PersistentCache() = default; - - /** - * Returns the data for the key if it exists in the cache, otherwise returns null. - */ - virtual sk_sp load(const SkData& key) = 0; - - // Placeholder until all clients override the 3-parameter store(), then remove this, and - // make that version pure virtual. - virtual void store(const SkData& /*key*/, const SkData& /*data*/) { SkASSERT(false); } - - /** - * Stores data in the cache, indexed by key. description provides a human-readable - * version of the key. - */ - virtual void store(const SkData& key, const SkData& data, const SkString& /*description*/) { - this->store(key, data); - } - - protected: - PersistentCache() = default; - PersistentCache(const PersistentCache&) = delete; - PersistentCache& operator=(const PersistentCache&) = delete; - }; - - using ShaderErrorHandler = skgpu::ShaderErrorHandler; - - GrContextOptions() {} - - // Suppress prints for the GrContext. - bool fSuppressPrints = false; - - /** - * Controls whether we check for GL errors after functions that allocate resources (e.g. - * glTexImage2D), for shader compilation success, and program link success. Ignored on - * backends other than GL. - */ - Enable fSkipGLErrorChecks = Enable::kDefault; - - /** Overrides: These options override feature detection using backend API queries. These - overrides can only reduce the feature set or limits, never increase them beyond the - detected values. */ - - int fMaxTextureSizeOverride = SK_MaxS32; - - /** the threshold in bytes above which we will use a buffer mapping API to map vertex and index - buffers to CPU memory in order to update them. A value of -1 means the GrContext should - deduce the optimal value for this platform. */ - int fBufferMapThreshold = -1; - - /** - * Executor to handle threaded work within Ganesh. If this is nullptr, then all work will be - * done serially on the main thread. To have worker threads assist with various tasks, set this - * to a valid SkExecutor instance. Currently, used for software path rendering, but may be used - * for other tasks. - */ - SkExecutor* fExecutor = nullptr; - - /** Construct mipmaps manually, via repeated downsampling draw-calls. This is used when - the driver's implementation (glGenerateMipmap) contains bugs. This requires mipmap - level control (ie desktop or ES3). */ - bool fDoManualMipmapping = false; - - /** - * Disables the use of coverage counting shortcuts to render paths. Coverage counting can cause - * artifacts along shared edges if care isn't taken to ensure both contours wind in the same - * direction. - */ - // FIXME: Once this is removed from Chrome and Android, rename to fEnable"". - bool fDisableCoverageCountingPaths = true; - - /** - * Disables distance field rendering for paths. Distance field computation can be expensive, - * and yields no benefit if a path is not rendered multiple times with different transforms. - */ - bool fDisableDistanceFieldPaths = false; - - /** - * If true this allows path mask textures to be cached. This is only really useful if paths - * are commonly rendered at the same scale and fractional translation. - */ - bool fAllowPathMaskCaching = true; - - /** - * If true, the GPU will not be used to perform YUV -> RGB conversion when generating - * textures from codec-backed images. - */ - bool fDisableGpuYUVConversion = false; - - /** - * The maximum size of cache textures used for Skia's Glyph cache. - */ - size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4; - - /** - * Below this threshold size in device space distance field fonts won't be used. Distance field - * fonts don't support hinting which is more important at smaller sizes. - */ - float fMinDistanceFieldFontSize = 18; - - /** - * Above this threshold size in device space glyphs are drawn as individual paths. - */ -#if defined(SK_BUILD_FOR_ANDROID) - float fGlyphsAsPathsFontSize = 384; -#elif defined(SK_BUILD_FOR_MAC) - float fGlyphsAsPathsFontSize = 256; -#else - float fGlyphsAsPathsFontSize = 324; -#endif - - /** - * Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by - * fGlypheCacheTextureMaximumBytes. - */ - Enable fAllowMultipleGlyphCacheTextures = Enable::kDefault; - - /** - * Bugs on certain drivers cause stencil buffers to leak. This flag causes Skia to avoid - * allocating stencil buffers and use alternate rasterization paths, avoiding the leak. - */ - bool fAvoidStencilBuffers = false; - - /** - * Enables driver workaround to use draws instead of HW clears, e.g. glClear on the GL backend. - */ - Enable fUseDrawInsteadOfClear = Enable::kDefault; - - /** - * Allow Ganesh to more aggressively reorder operations to reduce the number of render passes. - * Offscreen draws will be done upfront instead of interrupting the main render pass when - * possible. May increase VRAM usage, but still observes the resource cache limit. - * Enabled by default. - */ - Enable fReduceOpsTaskSplitting = Enable::kDefault; - - /** - * Some ES3 contexts report the ES2 external image extension, but not the ES3 version. - * If support for external images is critical, enabling this option will cause Ganesh to limit - * shaders to the ES2 shading language in that situation. - */ - bool fPreferExternalImagesOverES3 = false; - - /** - * Disables correctness workarounds that are enabled for particular GPUs, OSes, or drivers. - * This does not affect code path choices that are made for perfomance reasons nor does it - * override other GrContextOption settings. - */ - bool fDisableDriverCorrectnessWorkarounds = false; - - /** - * Maximum number of GPU programs or pipelines to keep active in the runtime cache. - */ - int fRuntimeProgramCacheSize = 256; - - /** - * Cache in which to store compiled shader binaries between runs. - */ - PersistentCache* fPersistentCache = nullptr; - - /** - * This affects the usage of the PersistentCache. We can cache SkSL, backend source (GLSL), or - * backend binaries (GL program binaries). By default we cache binaries, but if the driver's - * binary loading/storing is believed to have bugs, this can be limited to caching GLSL. - * Caching GLSL strings still saves CPU work when a GL program is created. - */ - ShaderCacheStrategy fShaderCacheStrategy = ShaderCacheStrategy::kBackendBinary; - - /** - * If present, use this object to report shader compilation failures. If not, report failures - * via SkDebugf and assert. - */ - ShaderErrorHandler* fShaderErrorHandler = nullptr; - - /** - * Specifies the number of samples Ganesh should use when performing internal draws with MSAA - * (hardware capabilities permitting). - * - * If 0, Ganesh will disable internal code paths that use multisampling. - */ - int fInternalMultisampleCount = 4; - - /** - * In Skia's vulkan backend a single GrContext submit equates to the submission of a single - * primary command buffer to the VkQueue. This value specifies how many vulkan secondary command - * buffers we will cache for reuse on a given primary command buffer. A single submit may use - * more than this many secondary command buffers, but after the primary command buffer is - * finished on the GPU it will only hold on to this many secondary command buffers for reuse. - * - * A value of -1 means we will pick a limit value internally. - */ - int fMaxCachedVulkanSecondaryCommandBuffers = -1; - - /** - * If true, the caps will never support mipmaps. - */ - bool fSuppressMipmapSupport = false; - - /** - * If true, and if supported, enables hardware tessellation in the caps. - * DEPRECATED: This value is ignored; experimental hardware tessellation is always disabled. - */ - bool fEnableExperimentalHardwareTessellation = false; - - /** - * If true, then add 1 pixel padding to all glyph masks in the atlas to support bi-lerp - * rendering of all glyphs. This must be set to true to use Slugs. - */ - #if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG) || \ - defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE) || \ - defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE) - bool fSupportBilerpFromGlyphAtlas = true; - #else - bool fSupportBilerpFromGlyphAtlas = false; - #endif - - /** - * Uses a reduced variety of shaders. May perform less optimally in steady state but can reduce - * jank due to shader compilations. - */ - bool fReducedShaderVariations = false; - - /** - * If true, then allow to enable MSAA on new Intel GPUs. - */ - bool fAllowMSAAOnNewIntel = false; - -#if GR_TEST_UTILS - /** - * Private options that are only meant for testing within Skia's tools. - */ - - /** - * Testing-only mode to exercise allocation failures in the flush-time callback objects. - * For now it only simulates allocation failure during the preFlush callback. - */ - bool fFailFlushTimeCallbacks = false; - - /** - * Prevents use of dual source blending, to test that all xfer modes work correctly without it. - */ - bool fSuppressDualSourceBlending = false; - - /** - * Prevents the use of non-coefficient-based blend equations, for testing dst reads, barriers, - * and in-shader blending. - */ - bool fSuppressAdvancedBlendEquations = false; - - /** - * Prevents the use of framebuffer fetches, for testing dst reads and texture barriers. - */ - bool fSuppressFramebufferFetch = false; - - /** - * If true, then all paths are processed as if "setIsVolatile" had been called. - */ - bool fAllPathsVolatile = false; - - /** - * Render everything in wireframe - */ - bool fWireframeMode = false; - - /** - * Enforces clearing of all textures when they're created. - */ - bool fClearAllTextures = false; - - /** - * Randomly generate a (false) GL_OUT_OF_MEMORY error - */ - bool fRandomGLOOM = false; - - /** - * Force off support for write/transfer pixels row bytes in caps. - */ - bool fDisallowWriteAndTransferPixelRowBytes = false; - - /** - * Include or exclude specific GPU path renderers. - */ - GpuPathRenderers fGpuPathRenderers = GpuPathRenderers::kDefault; - - /** - * Specify the GPU resource cache limit. Equivalent to calling `setResourceCacheLimit` on the - * context at construction time. - * - * A value of -1 means use the default limit value. - */ - int fResourceCacheLimitOverride = -1; - - /** - * Maximum width and height of internal texture atlases. - */ - int fMaxTextureAtlasSize = 2048; -#endif - - GrDriverBugWorkarounds fDriverBugWorkarounds; -}; -#else -struct GrContextOptions { - struct PersistentCache {}; -}; -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextThreadSafeProxy.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextThreadSafeProxy.h deleted file mode 100644 index 7e1ee65ffcdd59..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrContextThreadSafeProxy.h +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrContextThreadSafeProxy_DEFINED -#define GrContextThreadSafeProxy_DEFINED - -#include "include/core/SkRefCnt.h" - -#if SK_SUPPORT_GPU - -#include "include/core/SkImageInfo.h" -#include "include/gpu/GrContextOptions.h" -#include "include/gpu/GrTypes.h" - -#include - -class GrBackendFormat; -class GrCaps; -class GrContextThreadSafeProxyPriv; -class GrThreadSafeCache; -class GrThreadSafePipelineBuilder; -class SkSurfaceCharacterization; -class SkSurfaceProps; - -namespace sktext::gpu { class TextBlobRedrawCoordinator; } - -/** - * Can be used to perform actions related to the generating GrContext in a thread safe manner. The - * proxy does not access the 3D API (e.g. OpenGL) that backs the generating GrContext. - */ -class SK_API GrContextThreadSafeProxy final : public SkNVRefCnt { -public: - ~GrContextThreadSafeProxy(); - - /** - * Create a surface characterization for a DDL that will be replayed into the GrContext - * that created this proxy. On failure the resulting characterization will be invalid (i.e., - * "!c.isValid()"). - * - * @param cacheMaxResourceBytes The max resource bytes limit that will be in effect - * when the DDL created with this characterization is - * replayed. - * Note: the contract here is that the DDL will be - * created as if it had a full 'cacheMaxResourceBytes' - * to use. If replayed into a GrContext that already has - * locked GPU memory, the replay can exceed the budget. - * To rephrase, all resource allocation decisions are - * made at record time and at playback time the budget - * limits will be ignored. - * @param ii The image info specifying properties of the SkSurface - * that the DDL created with this characterization will - * be replayed into. - * Note: Ganesh doesn't make use of the SkImageInfo's - * alphaType - * @param backendFormat Information about the format of the GPU surface that - * will back the SkSurface upon replay - * @param sampleCount The sample count of the SkSurface that the DDL - * created with this characterization will be replayed - * into - * @param origin The origin of the SkSurface that the DDL created with - * this characterization will be replayed into - * @param surfaceProps The surface properties of the SkSurface that the DDL - * created with this characterization will be replayed - * into - * @param isMipMapped Will the surface the DDL will be replayed into have - * space allocated for mipmaps? - * @param willUseGLFBO0 Will the surface the DDL will be replayed into be - * backed by GL FBO 0. This flag is only valid if using - * an GL backend. - * @param isTextureable Will the surface be able to act as a texture? - * @param isProtected Will the (Vulkan) surface be DRM protected? - * @param vkRTSupportsInputAttachment Can the vulkan surface be used as in input - attachment? - * @param forVulkanSecondaryCommandBuffer Will the surface be wrapping a vulkan secondary - * command buffer via a GrVkSecondaryCBDrawContext? If - * this is true then the following is required: - * isTexureable = false - * isMipMapped = false - * willUseGLFBO0 = false - * vkRTSupportsInputAttachment = false - */ - SkSurfaceCharacterization createCharacterization( - size_t cacheMaxResourceBytes, - const SkImageInfo& ii, - const GrBackendFormat& backendFormat, - int sampleCount, - GrSurfaceOrigin origin, - const SkSurfaceProps& surfaceProps, - bool isMipMapped, - bool willUseGLFBO0 = false, - bool isTextureable = true, - GrProtected isProtected = GrProtected::kNo, - bool vkRTSupportsInputAttachment = false, - bool forVulkanSecondaryCommandBuffer = false); - - /* - * Retrieve the default GrBackendFormat for a given SkColorType and renderability. - * It is guaranteed that this backend format will be the one used by the following - * SkColorType and SkSurfaceCharacterization-based createBackendTexture methods. - * - * The caller should check that the returned format is valid. - */ - GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const; - - /** - * Retrieve the GrBackendFormat for a given SkImage::CompressionType. This is - * guaranteed to match the backend format used by the following - * createCompressedBackendTexture methods that take a CompressionType. - * - * The caller should check that the returned format is valid. - */ - GrBackendFormat compressedBackendFormat(SkImage::CompressionType c) const; - - /** - * Gets the maximum supported sample count for a color type. 1 is returned if only non-MSAA - * rendering is supported for the color type. 0 is returned if rendering to this color type - * is not supported at all. - */ - int maxSurfaceSampleCountForColorType(SkColorType colorType) const; - - bool isValid() const { return nullptr != fCaps; } - - bool operator==(const GrContextThreadSafeProxy& that) const { - // Each GrContext should only ever have a single thread-safe proxy. - SkASSERT((this == &that) == (this->fContextID == that.fContextID)); - return this == &that; - } - - bool operator!=(const GrContextThreadSafeProxy& that) const { return !(*this == that); } - - // Provides access to functions that aren't part of the public API. - GrContextThreadSafeProxyPriv priv(); - const GrContextThreadSafeProxyPriv priv() const; // NOLINT(readability-const-return-type) - -private: - friend class GrContextThreadSafeProxyPriv; // for ctor and hidden methods - - // DDL TODO: need to add unit tests for backend & maybe options - GrContextThreadSafeProxy(GrBackendApi, const GrContextOptions&); - - void abandonContext(); - bool abandoned() const; - - // TODO: This should be part of the constructor but right now we have a chicken-and-egg problem - // with GrContext where we get the caps by creating a GPU which requires a context (see the - // `init` method on GrContext_Base). - void init(sk_sp, sk_sp); - - const GrBackendApi fBackend; - const GrContextOptions fOptions; - const uint32_t fContextID; - sk_sp fCaps; - std::unique_ptr fTextBlobRedrawCoordinator; - std::unique_ptr fThreadSafeCache; - sk_sp fPipelineBuilder; - std::atomic fAbandoned{false}; -}; - -#else // !SK_SUPPORT_GPU -class SK_API GrContextThreadSafeProxy final : public SkNVRefCnt {}; -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDirectContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDirectContext.h deleted file mode 100644 index 903623fb7161df..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDirectContext.h +++ /dev/null @@ -1,905 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrDirectContext_DEFINED -#define GrDirectContext_DEFINED - -#include "include/gpu/GrRecordingContext.h" - -#include "include/gpu/GrBackendSurface.h" - -// We shouldn't need this but currently Android is relying on this being include transitively. -#include "include/core/SkUnPreMultiply.h" - -class GrAtlasManager; -class GrBackendSemaphore; -class GrClientMappedBufferManager; -class GrDirectContextPriv; -class GrContextThreadSafeProxy; -struct GrD3DBackendContext; -class GrFragmentProcessor; -class GrGpu; -struct GrGLInterface; -struct GrMtlBackendContext; -struct GrMockOptions; -class GrPath; -class GrResourceCache; -class GrResourceProvider; -class GrSurfaceProxy; -class GrTextureProxy; -struct GrVkBackendContext; - -class SkImage; -class SkString; -class SkSurfaceCharacterization; -class SkSurfaceProps; -class SkTaskGroup; -class SkTraceMemoryDump; - -namespace skgpu { -class Swizzle; -namespace v1 { class SmallPathAtlasMgr; } -} - -namespace sktext::gpu { -class StrikeCache; -} - -class SK_API GrDirectContext : public GrRecordingContext { -public: -#ifdef SK_GL - /** - * Creates a GrDirectContext for a backend context. If no GrGLInterface is provided then the - * result of GrGLMakeNativeInterface() is used if it succeeds. - */ - static sk_sp MakeGL(sk_sp, const GrContextOptions&); - static sk_sp MakeGL(sk_sp); - static sk_sp MakeGL(const GrContextOptions&); - static sk_sp MakeGL(); -#endif - -#ifdef SK_VULKAN - /** - * The Vulkan context (VkQueue, VkDevice, VkInstance) must be kept alive until the returned - * GrDirectContext is destroyed. This also means that any objects created with this - * GrDirectContext (e.g. SkSurfaces, SkImages, etc.) must also be released as they may hold - * refs on the GrDirectContext. Once all these objects and the GrDirectContext are released, - * then it is safe to delete the vulkan objects. - */ - static sk_sp MakeVulkan(const GrVkBackendContext&, const GrContextOptions&); - static sk_sp MakeVulkan(const GrVkBackendContext&); -#endif - -#ifdef SK_METAL - /** - * Makes a GrDirectContext which uses Metal as the backend. The GrMtlBackendContext contains a - * MTLDevice and MTLCommandQueue which should be used by the backend. These objects must - * have their own ref which will be released when the GrMtlBackendContext is destroyed. - * Ganesh will take its own ref on the objects which will be released when the GrDirectContext - * is destroyed. - */ - static sk_sp MakeMetal(const GrMtlBackendContext&, const GrContextOptions&); - static sk_sp MakeMetal(const GrMtlBackendContext&); - /** - * Deprecated. - * - * Makes a GrDirectContext which uses Metal as the backend. The device parameter is an - * MTLDevice and queue is an MTLCommandQueue which should be used by the backend. These objects - * must have a ref on them that can be transferred to Ganesh, which will release the ref - * when the GrDirectContext is destroyed. - */ - static sk_sp MakeMetal(void* device, void* queue, const GrContextOptions&); - static sk_sp MakeMetal(void* device, void* queue); -#endif - -#ifdef SK_DIRECT3D - /** - * Makes a GrDirectContext which uses Direct3D as the backend. The Direct3D context - * must be kept alive until the returned GrDirectContext is first destroyed or abandoned. - */ - static sk_sp MakeDirect3D(const GrD3DBackendContext&, const GrContextOptions&); - static sk_sp MakeDirect3D(const GrD3DBackendContext&); -#endif - -#ifdef SK_DAWN - static sk_sp MakeDawn(const wgpu::Device&, - const GrContextOptions&); - static sk_sp MakeDawn(const wgpu::Device&); -#endif - - static sk_sp MakeMock(const GrMockOptions*, const GrContextOptions&); - static sk_sp MakeMock(const GrMockOptions*); - - ~GrDirectContext() override; - - /** - * The context normally assumes that no outsider is setting state - * within the underlying 3D API's context/device/whatever. This call informs - * the context that the state was modified and it should resend. Shouldn't - * be called frequently for good performance. - * The flag bits, state, is dependent on which backend is used by the - * context, either GL or D3D (possible in future). - */ - void resetContext(uint32_t state = kAll_GrBackendState); - - /** - * If the backend is GrBackendApi::kOpenGL, then all texture unit/target combinations for which - * the context has modified the bound texture will have texture id 0 bound. This does not - * flush the context. Calling resetContext() does not change the set that will be bound - * to texture id 0 on the next call to resetGLTextureBindings(). After this is called - * all unit/target combinations are considered to have unmodified bindings until the context - * subsequently modifies them (meaning if this is called twice in a row with no intervening - * context usage then the second call is a no-op.) - */ - void resetGLTextureBindings(); - - /** - * Abandons all GPU resources and assumes the underlying backend 3D API context is no longer - * usable. Call this if you have lost the associated GPU context, and thus internal texture, - * buffer, etc. references/IDs are now invalid. Calling this ensures that the destructors of the - * context and any of its created resource objects will not make backend 3D API calls. Content - * rendered but not previously flushed may be lost. After this function is called all subsequent - * calls on the context will fail or be no-ops. - * - * The typical use case for this function is that the underlying 3D context was lost and further - * API calls may crash. - * - * This call is not valid to be made inside ReleaseProcs passed into SkSurface or SkImages. The - * call will simply fail (and assert in debug) if it is called while inside a ReleaseProc. - * - * For Vulkan, even if the device becomes lost, the VkQueue, VkDevice, or VkInstance used to - * create the context must be kept alive even after abandoning the context. Those objects must - * live for the lifetime of the context object itself. The reason for this is so that - * we can continue to delete any outstanding GrBackendTextures/RenderTargets which must be - * cleaned up even in a device lost state. - */ - void abandonContext() override; - - /** - * Returns true if the context was abandoned or if the if the backend specific context has - * gotten into an unrecoverarble, lost state (e.g. in Vulkan backend if we've gotten a - * VK_ERROR_DEVICE_LOST). If the backend context is lost, this call will also abandon this - * context. - */ - bool abandoned() override; - - // TODO: Remove this from public after migrating Chrome. - sk_sp threadSafeProxy(); - - /** - * Checks if the underlying 3D API reported an out-of-memory error. If this returns true it is - * reset and will return false until another out-of-memory error is reported by the 3D API. If - * the context is abandoned then this will report false. - * - * Currently this is implemented for: - * - * OpenGL [ES] - Note that client calls to glGetError() may swallow GL_OUT_OF_MEMORY errors and - * therefore hide the error from Skia. Also, it is not advised to use this in combination with - * enabling GrContextOptions::fSkipGLErrorChecks. That option may prevent the context from ever - * checking the GL context for OOM. - * - * Vulkan - Reports true if VK_ERROR_OUT_OF_HOST_MEMORY or VK_ERROR_OUT_OF_DEVICE_MEMORY has - * occurred. - */ - bool oomed(); - - /** - * This is similar to abandonContext() however the underlying 3D context is not yet lost and - * the context will cleanup all allocated resources before returning. After returning it will - * assume that the underlying context may no longer be valid. - * - * The typical use case for this function is that the client is going to destroy the 3D context - * but can't guarantee that context will be destroyed first (perhaps because it may be ref'ed - * elsewhere by either the client or Skia objects). - * - * For Vulkan, even if the device becomes lost, the VkQueue, VkDevice, or VkInstance used to - * create the context must be alive before calling releaseResourcesAndAbandonContext. - */ - void releaseResourcesAndAbandonContext(); - - /////////////////////////////////////////////////////////////////////////// - // Resource Cache - - /** DEPRECATED - * Return the current GPU resource cache limits. - * - * @param maxResources If non-null, will be set to -1. - * @param maxResourceBytes If non-null, returns maximum number of bytes of - * video memory that can be held in the cache. - */ - void getResourceCacheLimits(int* maxResources, size_t* maxResourceBytes) const; - - /** - * Return the current GPU resource cache limit in bytes. - */ - size_t getResourceCacheLimit() const; - - /** - * Gets the current GPU resource cache usage. - * - * @param resourceCount If non-null, returns the number of resources that are held in the - * cache. - * @param maxResourceBytes If non-null, returns the total number of bytes of video memory held - * in the cache. - */ - void getResourceCacheUsage(int* resourceCount, size_t* resourceBytes) const; - - /** - * Gets the number of bytes in the cache consumed by purgeable (e.g. unlocked) resources. - */ - size_t getResourceCachePurgeableBytes() const; - - /** DEPRECATED - * Specify the GPU resource cache limits. If the current cache exceeds the maxResourceBytes - * limit, it will be purged (LRU) to keep the cache within the limit. - * - * @param maxResources Unused. - * @param maxResourceBytes The maximum number of bytes of video memory - * that can be held in the cache. - */ - void setResourceCacheLimits(int maxResources, size_t maxResourceBytes); - - /** - * Specify the GPU resource cache limit. If the cache currently exceeds this limit, - * it will be purged (LRU) to keep the cache within the limit. - * - * @param maxResourceBytes The maximum number of bytes of video memory - * that can be held in the cache. - */ - void setResourceCacheLimit(size_t maxResourceBytes); - - /** - * Frees GPU created by the context. Can be called to reduce GPU memory - * pressure. - */ - void freeGpuResources(); - - /** - * Purge GPU resources that haven't been used in the past 'msNotUsed' milliseconds or are - * otherwise marked for deletion, regardless of whether the context is under budget. - * - * If 'scratchResourcesOnly' is true all unlocked scratch resources older than 'msNotUsed' will - * be purged but the unlocked resources with persistent data will remain. If - * 'scratchResourcesOnly' is false then all unlocked resources older than 'msNotUsed' will be - * purged. - * - * @param msNotUsed Only unlocked resources not used in these last milliseconds - * will be cleaned up. - * @param scratchResourcesOnly If true only unlocked scratch resources will be purged. - */ - void performDeferredCleanup(std::chrono::milliseconds msNotUsed, - bool scratchResourcesOnly=false); - - // Temporary compatibility API for Android. - void purgeResourcesNotUsedInMs(std::chrono::milliseconds msNotUsed) { - this->performDeferredCleanup(msNotUsed); - } - - /** - * Purge unlocked resources from the cache until the the provided byte count has been reached - * or we have purged all unlocked resources. The default policy is to purge in LRU order, but - * can be overridden to prefer purging scratch resources (in LRU order) prior to purging other - * resource types. - * - * @param maxBytesToPurge the desired number of bytes to be purged. - * @param preferScratchResources If true scratch resources will be purged prior to other - * resource types. - */ - void purgeUnlockedResources(size_t bytesToPurge, bool preferScratchResources); - - /** - * This entry point is intended for instances where an app has been backgrounded or - * suspended. - * If 'scratchResourcesOnly' is true all unlocked scratch resources will be purged but the - * unlocked resources with persistent data will remain. If 'scratchResourcesOnly' is false - * then all unlocked resources will be purged. - * In either case, after the unlocked resources are purged a separate pass will be made to - * ensure that resource usage is under budget (i.e., even if 'scratchResourcesOnly' is true - * some resources with persistent data may be purged to be under budget). - * - * @param scratchResourcesOnly If true only unlocked scratch resources will be purged prior - * enforcing the budget requirements. - */ - void purgeUnlockedResources(bool scratchResourcesOnly); - - /** - * Gets the maximum supported texture size. - */ - using GrRecordingContext::maxTextureSize; - - /** - * Gets the maximum supported render target size. - */ - using GrRecordingContext::maxRenderTargetSize; - - /** - * Can a SkImage be created with the given color type. - */ - using GrRecordingContext::colorTypeSupportedAsImage; - - /** - * Can a SkSurface be created with the given color type. To check whether MSAA is supported - * use maxSurfaceSampleCountForColorType(). - */ - using GrRecordingContext::colorTypeSupportedAsSurface; - - /** - * Gets the maximum supported sample count for a color type. 1 is returned if only non-MSAA - * rendering is supported for the color type. 0 is returned if rendering to this color type - * is not supported at all. - */ - using GrRecordingContext::maxSurfaceSampleCountForColorType; - - /////////////////////////////////////////////////////////////////////////// - // Misc. - - /** - * Inserts a list of GPU semaphores that the current GPU-backed API must wait on before - * executing any more commands on the GPU. If this call returns false, then the GPU back-end - * will not wait on any passed in semaphores, and the client will still own the semaphores, - * regardless of the value of deleteSemaphoresAfterWait. - * - * If deleteSemaphoresAfterWait is false then Skia will not delete the semaphores. In this case - * it is the client's responsibility to not destroy or attempt to reuse the semaphores until it - * knows that Skia has finished waiting on them. This can be done by using finishedProcs on - * flush calls. - */ - bool wait(int numSemaphores, const GrBackendSemaphore* waitSemaphores, - bool deleteSemaphoresAfterWait = true); - - /** - * Call to ensure all drawing to the context has been flushed and submitted to the underlying 3D - * API. This is equivalent to calling GrContext::flush with a default GrFlushInfo followed by - * GrContext::submit(syncCpu). - */ - void flushAndSubmit(bool syncCpu = false) { - this->flush(GrFlushInfo()); - this->submit(syncCpu); - } - - /** - * Call to ensure all drawing to the context has been flushed to underlying 3D API specific - * objects. A call to `submit` is always required to ensure work is actually sent to - * the gpu. Some specific API details: - * GL: Commands are actually sent to the driver, but glFlush is never called. Thus some - * sync objects from the flush will not be valid until a submission occurs. - * - * Vulkan/Metal/D3D/Dawn: Commands are recorded to the backend APIs corresponding command - * buffer or encoder objects. However, these objects are not sent to the gpu until a - * submission occurs. - * - * If the return is GrSemaphoresSubmitted::kYes, only initialized GrBackendSemaphores will be - * submitted to the gpu during the next submit call (it is possible Skia failed to create a - * subset of the semaphores). The client should not wait on these semaphores until after submit - * has been called, and must keep them alive until then. If this call returns - * GrSemaphoresSubmitted::kNo, the GPU backend will not submit any semaphores to be signaled on - * the GPU. Thus the client should not have the GPU wait on any of the semaphores passed in with - * the GrFlushInfo. Regardless of whether semaphores were submitted to the GPU or not, the - * client is still responsible for deleting any initialized semaphores. - * Regardleess of semaphore submission the context will still be flushed. It should be - * emphasized that a return value of GrSemaphoresSubmitted::kNo does not mean the flush did not - * happen. It simply means there were no semaphores submitted to the GPU. A caller should only - * take this as a failure if they passed in semaphores to be submitted. - */ - GrSemaphoresSubmitted flush(const GrFlushInfo& info); - - void flush() { this->flush({}); } - - /** - * Submit outstanding work to the gpu from all previously un-submitted flushes. The return - * value of the submit will indicate whether or not the submission to the GPU was successful. - * - * If the call returns true, all previously passed in semaphores in flush calls will have been - * submitted to the GPU and they can safely be waited on. The caller should wait on those - * semaphores or perform some other global synchronization before deleting the semaphores. - * - * If it returns false, then those same semaphores will not have been submitted and we will not - * try to submit them again. The caller is free to delete the semaphores at any time. - * - * If the syncCpu flag is true this function will return once the gpu has finished with all - * submitted work. - */ - bool submit(bool syncCpu = false); - - /** - * Checks whether any asynchronous work is complete and if so calls related callbacks. - */ - void checkAsyncWorkCompletion(); - - /** Enumerates all cached GPU resources and dumps their memory to traceMemoryDump. */ - // Chrome is using this! - void dumpMemoryStatistics(SkTraceMemoryDump* traceMemoryDump) const; - - bool supportsDistanceFieldText() const; - - void storeVkPipelineCacheData(); - - /** - * Retrieve the default GrBackendFormat for a given SkColorType and renderability. - * It is guaranteed that this backend format will be the one used by the following - * SkColorType and SkSurfaceCharacterization-based createBackendTexture methods. - * - * The caller should check that the returned format is valid. - */ - using GrRecordingContext::defaultBackendFormat; - - /** - * The explicitly allocated backend texture API allows clients to use Skia to create backend - * objects outside of Skia proper (i.e., Skia's caching system will not know about them.) - * - * It is the client's responsibility to delete all these objects (using deleteBackendTexture) - * before deleting the context used to create them. If the backend is Vulkan, the textures must - * be deleted before abandoning the context as well. Additionally, clients should only delete - * these objects on the thread for which that context is active. - * - * The client is responsible for ensuring synchronization between different uses - * of the backend object (i.e., wrapping it in a surface, rendering to it, deleting the - * surface, rewrapping it in a image and drawing the image will require explicit - * synchronization on the client's part). - */ - - /** - * If possible, create an uninitialized backend texture. The client should ensure that the - * returned backend texture is valid. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_UNDEFINED. - */ - GrBackendTexture createBackendTexture(int width, - int height, - const GrBackendFormat&, - GrMipmapped, - GrRenderable, - GrProtected = GrProtected::kNo, - std::string_view label = {}); - - /** - * If possible, create an uninitialized backend texture. The client should ensure that the - * returned backend texture is valid. - * If successful, the created backend texture will be compatible with the provided - * SkColorType. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_UNDEFINED. - */ - GrBackendTexture createBackendTexture(int width, int height, - SkColorType, - GrMipmapped, - GrRenderable, - GrProtected = GrProtected::kNo, - std::string_view label = {}); - - /** - * If possible, create a backend texture initialized to a particular color. The client should - * ensure that the returned backend texture is valid. The client can pass in a finishedProc - * to be notified when the data has been uploaded by the gpu and the texture can be deleted. The - * client is required to call `submit` to send the upload work to the gpu. The - * finishedProc will always get called even if we failed to create the GrBackendTexture. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - GrBackendTexture createBackendTexture(int width, int height, - const GrBackendFormat&, - const SkColor4f& color, - GrMipmapped, - GrRenderable, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}); - - /** - * If possible, create a backend texture initialized to a particular color. The client should - * ensure that the returned backend texture is valid. The client can pass in a finishedProc - * to be notified when the data has been uploaded by the gpu and the texture can be deleted. The - * client is required to call `submit` to send the upload work to the gpu. The - * finishedProc will always get called even if we failed to create the GrBackendTexture. - * If successful, the created backend texture will be compatible with the provided - * SkColorType. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - GrBackendTexture createBackendTexture(int width, int height, - SkColorType, - const SkColor4f& color, - GrMipmapped, - GrRenderable, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}); - - /** - * If possible, create a backend texture initialized with the provided pixmap data. The client - * should ensure that the returned backend texture is valid. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture. - * If successful, the created backend texture will be compatible with the provided - * pixmap(s). Compatible, in this case, means that the backend format will be the result - * of calling defaultBackendFormat on the base pixmap's colortype. The src data can be deleted - * when this call returns. - * If numLevels is 1 a non-mipmapped texture will result. If a mipmapped texture is desired - * the data for all the mipmap levels must be provided. In the mipmapped case all the - * colortypes of the provided pixmaps must be the same. Additionally, all the miplevels - * must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount). The - * GrSurfaceOrigin controls whether the pixmap data is vertically flipped in the texture. - * Note: the pixmap's alphatypes and colorspaces are ignored. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - GrBackendTexture createBackendTexture(const SkPixmap srcData[], - int numLevels, - GrSurfaceOrigin, - GrRenderable, - GrProtected, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}); - - /** - * Convenience version createBackendTexture() that takes just a base level pixmap. - */ - GrBackendTexture createBackendTexture(const SkPixmap& srcData, - GrSurfaceOrigin textureOrigin, - GrRenderable renderable, - GrProtected isProtected, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}) { - return this->createBackendTexture(&srcData, 1, textureOrigin, renderable, isProtected, - finishedProc, finishedContext, label); - } - - // Deprecated versions that do not take origin and assume top-left. - GrBackendTexture createBackendTexture(const SkPixmap srcData[], - int numLevels, - GrRenderable renderable, - GrProtected isProtected, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}) { - return this->createBackendTexture(srcData, - numLevels, - kTopLeft_GrSurfaceOrigin, - renderable, - isProtected, - finishedProc, - finishedContext, - label); - } - GrBackendTexture createBackendTexture(const SkPixmap& srcData, - GrRenderable renderable, - GrProtected isProtected, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr, - std::string_view label = {}) { - return this->createBackendTexture(&srcData, - 1, - renderable, - isProtected, - finishedProc, - finishedContext, - label); - } - - /** - * If possible, updates a backend texture to be filled to a particular color. The client should - * check the return value to see if the update was successful. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to update the GrBackendTexture. - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateBackendTexture(const GrBackendTexture&, - const SkColor4f& color, - GrGpuFinishedProc finishedProc, - GrGpuFinishedContext finishedContext); - - /** - * If possible, updates a backend texture to be filled to a particular color. The data in - * GrBackendTexture and passed in color is interpreted with respect to the passed in - * SkColorType. The client should check the return value to see if the update was successful. - * The client can pass in a finishedProc to be notified when the data has been uploaded by the - * gpu and the texture can be deleted. The client is required to call `submit` to send - * the upload work to the gpu. The finishedProc will always get called even if we failed to - * update the GrBackendTexture. - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateBackendTexture(const GrBackendTexture&, - SkColorType skColorType, - const SkColor4f& color, - GrGpuFinishedProc finishedProc, - GrGpuFinishedContext finishedContext); - - /** - * If possible, updates a backend texture filled with the provided pixmap data. The client - * should check the return value to see if the update was successful. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture. - * The backend texture must be compatible with the provided pixmap(s). Compatible, in this case, - * means that the backend format is compatible with the base pixmap's colortype. The src data - * can be deleted when this call returns. - * If the backend texture is mip mapped, the data for all the mipmap levels must be provided. - * In the mipmapped case all the colortypes of the provided pixmaps must be the same. - * Additionally, all the miplevels must be sized correctly (please see - * SkMipmap::ComputeLevelSize and ComputeLevelCount). The GrSurfaceOrigin controls whether the - * pixmap data is vertically flipped in the texture. - * Note: the pixmap's alphatypes and colorspaces are ignored. - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateBackendTexture(const GrBackendTexture&, - const SkPixmap srcData[], - int numLevels, - GrSurfaceOrigin = kTopLeft_GrSurfaceOrigin, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - /** - * Convenience version of updateBackendTexture that takes just a base level pixmap. - */ - bool updateBackendTexture(const GrBackendTexture& texture, - const SkPixmap& srcData, - GrSurfaceOrigin textureOrigin = kTopLeft_GrSurfaceOrigin, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr) { - return this->updateBackendTexture(texture, - &srcData, - 1, - textureOrigin, - finishedProc, - finishedContext); - } - - // Deprecated version that does not take origin and assumes top-left. - bool updateBackendTexture(const GrBackendTexture& texture, - const SkPixmap srcData[], - int numLevels, - GrGpuFinishedProc finishedProc, - GrGpuFinishedContext finishedContext) { - return this->updateBackendTexture(texture, - srcData, - numLevels, - kTopLeft_GrSurfaceOrigin, - finishedProc, - finishedContext); - } - - /** - * Retrieve the GrBackendFormat for a given SkImage::CompressionType. This is - * guaranteed to match the backend format used by the following - * createCompressedBackendTexture methods that take a CompressionType. - * - * The caller should check that the returned format is valid. - */ - using GrRecordingContext::compressedBackendFormat; - - /** - *If possible, create a compressed backend texture initialized to a particular color. The - * client should ensure that the returned backend texture is valid. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture. - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - GrBackendTexture createCompressedBackendTexture(int width, int height, - const GrBackendFormat&, - const SkColor4f& color, - GrMipmapped, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - GrBackendTexture createCompressedBackendTexture(int width, int height, - SkImage::CompressionType, - const SkColor4f& color, - GrMipmapped, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - /** - * If possible, create a backend texture initialized with the provided raw data. The client - * should ensure that the returned backend texture is valid. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture - * If numLevels is 1 a non-mipmapped texture will result. If a mipmapped texture is desired - * the data for all the mipmap levels must be provided. Additionally, all the miplevels - * must be sized correctly (please see SkMipmap::ComputeLevelSize and ComputeLevelCount). - * For the Vulkan backend the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - GrBackendTexture createCompressedBackendTexture(int width, int height, - const GrBackendFormat&, - const void* data, size_t dataSize, - GrMipmapped, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - GrBackendTexture createCompressedBackendTexture(int width, int height, - SkImage::CompressionType, - const void* data, size_t dataSize, - GrMipmapped, - GrProtected = GrProtected::kNo, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - /** - * If possible, updates a backend texture filled with the provided color. If the texture is - * mipmapped, all levels of the mip chain will be updated to have the supplied color. The client - * should check the return value to see if the update was successful. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture. - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateCompressedBackendTexture(const GrBackendTexture&, - const SkColor4f& color, - GrGpuFinishedProc finishedProc, - GrGpuFinishedContext finishedContext); - - /** - * If possible, updates a backend texture filled with the provided raw data. The client - * should check the return value to see if the update was successful. The client can pass in a - * finishedProc to be notified when the data has been uploaded by the gpu and the texture can be - * deleted. The client is required to call `submit` to send the upload work to the gpu. - * The finishedProc will always get called even if we failed to create the GrBackendTexture. - * If a mipmapped texture is passed in, the data for all the mipmap levels must be provided. - * Additionally, all the miplevels must be sized correctly (please see - * SkMipMap::ComputeLevelSize and ComputeLevelCount). - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateCompressedBackendTexture(const GrBackendTexture&, - const void* data, - size_t dataSize, - GrGpuFinishedProc finishedProc, - GrGpuFinishedContext finishedContext); - - /** - * Updates the state of the GrBackendTexture/RenderTarget to have the passed in - * skgpu::MutableTextureState. All objects that wrap the backend surface (i.e. SkSurfaces and - * SkImages) will also be aware of this state change. This call does not submit the state change - * to the gpu, but requires the client to call `submit` to send it to the GPU. The work - * for this call is ordered linearly with all other calls that require GrContext::submit to be - * called (e.g updateBackendTexture and flush). If finishedProc is not null then it will be - * called with finishedContext after the state transition is known to have occurred on the GPU. - * - * See skgpu::MutableTextureState to see what state can be set via this call. - * - * If the backend API is Vulkan, the caller can set the skgpu::MutableTextureState's - * VkImageLayout to VK_IMAGE_LAYOUT_UNDEFINED or queueFamilyIndex to VK_QUEUE_FAMILY_IGNORED to - * tell Skia to not change those respective states. - * - * If previousState is not null and this returns true, then Skia will have filled in - * previousState to have the values of the state before this call. - */ - bool setBackendTextureState(const GrBackendTexture&, - const skgpu::MutableTextureState&, - skgpu::MutableTextureState* previousState = nullptr, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - bool setBackendRenderTargetState(const GrBackendRenderTarget&, - const skgpu::MutableTextureState&, - skgpu::MutableTextureState* previousState = nullptr, - GrGpuFinishedProc finishedProc = nullptr, - GrGpuFinishedContext finishedContext = nullptr); - - void deleteBackendTexture(GrBackendTexture); - - // This interface allows clients to pre-compile shaders and populate the runtime program cache. - // The key and data blobs should be the ones passed to the PersistentCache, in SkSL format. - // - // Steps to use this API: - // - // 1) Create a GrDirectContext as normal, but set fPersistentCache on GrContextOptions to - // something that will save the cached shader blobs. Set fShaderCacheStrategy to kSkSL. This - // will ensure that the blobs are SkSL, and are suitable for pre-compilation. - // 2) Run your application, and save all of the key/data pairs that are fed to the cache. - // - // 3) Switch over to shipping your application. Include the key/data pairs from above. - // 4) At startup (or any convenient time), call precompileShader for each key/data pair. - // This will compile the SkSL to create a GL program, and populate the runtime cache. - // - // This is only guaranteed to work if the context/device used in step #2 are created in the - // same way as the one used in step #4, and the same GrContextOptions are specified. - // Using cached shader blobs on a different device or driver are undefined. - bool precompileShader(const SkData& key, const SkData& data); - -#ifdef SK_ENABLE_DUMP_GPU - /** Returns a string with detailed information about the context & GPU, in JSON format. */ - SkString dump() const; -#endif - - class DirectContextID { - public: - static GrDirectContext::DirectContextID Next(); - - DirectContextID() : fID(SK_InvalidUniqueID) {} - - bool operator==(const DirectContextID& that) const { return fID == that.fID; } - bool operator!=(const DirectContextID& that) const { return !(*this == that); } - - void makeInvalid() { fID = SK_InvalidUniqueID; } - bool isValid() const { return fID != SK_InvalidUniqueID; } - - private: - constexpr DirectContextID(uint32_t id) : fID(id) {} - uint32_t fID; - }; - - DirectContextID directContextID() const { return fDirectContextID; } - - // Provides access to functions that aren't part of the public API. - GrDirectContextPriv priv(); - const GrDirectContextPriv priv() const; // NOLINT(readability-const-return-type) - -protected: - GrDirectContext(GrBackendApi backend, const GrContextOptions& options); - - bool init() override; - - GrAtlasManager* onGetAtlasManager() { return fAtlasManager.get(); } - skgpu::v1::SmallPathAtlasMgr* onGetSmallPathAtlasMgr(); - - GrDirectContext* asDirectContext() override { return this; } - -private: - // This call will make sure out work on the GPU is finished and will execute any outstanding - // asynchronous work (e.g. calling finished procs, freeing resources, etc.) related to the - // outstanding work on the gpu. The main use currently for this function is when tearing down or - // abandoning the context. - // - // When we finish up work on the GPU it could trigger callbacks to the client. In the case we - // are abandoning the context we don't want the client to be able to use the GrDirectContext to - // issue more commands during the callback. Thus before calling this function we set the - // GrDirectContext's state to be abandoned. However, we need to be able to get by the abaonded - // check in the call to know that it is safe to execute this. The shouldExecuteWhileAbandoned - // bool is used for this signal. - void syncAllOutstandingGpuWork(bool shouldExecuteWhileAbandoned); - - const DirectContextID fDirectContextID; - // fTaskGroup must appear before anything that uses it (e.g. fGpu), so that it is destroyed - // after all of its users. Clients of fTaskGroup will generally want to ensure that they call - // wait() on it as they are being destroyed, to avoid the possibility of pending tasks being - // invoked after objects they depend upon have already been destroyed. - std::unique_ptr fTaskGroup; - std::unique_ptr fStrikeCache; - sk_sp fGpu; - std::unique_ptr fResourceCache; - std::unique_ptr fResourceProvider; - - // This is incremented before we start calling ReleaseProcs from GrSurfaces and decremented - // after. A ReleaseProc may trigger code causing another resource to get freed so we to track - // the count to know if we in a ReleaseProc at any level. When this is set to a value greated - // than zero we will not allow abandonContext calls to be made on the context. - int fInsideReleaseProcCnt = 0; - - bool fDidTestPMConversions; - // true if the PM/UPM conversion succeeded; false otherwise - bool fPMUPMConversionsRoundTrip; - - GrContextOptions::PersistentCache* fPersistentCache; - - std::unique_ptr fMappedBufferManager; - std::unique_ptr fAtlasManager; - - std::unique_ptr fSmallPathAtlasMgr; - - friend class GrDirectContextPriv; - - using INHERITED = GrRecordingContext; -}; - - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkarounds.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkarounds.h deleted file mode 100644 index c57efc6016586c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkarounds.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrDriverBugWorkarounds_DEFINED -#define GrDriverBugWorkarounds_DEFINED - -// External embedders of Skia can override this to use their own list -// of workaround names. -#ifdef SK_GPU_WORKAROUNDS_HEADER -#include SK_GPU_WORKAROUNDS_HEADER -#else -// To regenerate this file, set gn arg "skia_generate_workarounds = true". -// This is not rebuilt by default to avoid embedders having to have extra -// build steps. -#include "include/gpu/GrDriverBugWorkaroundsAutogen.h" -#endif - -#include "include/core/SkTypes.h" - -#include -#include - -enum GrDriverBugWorkaroundType { -#define GPU_OP(type, name) type, - GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) -#undef GPU_OP - NUMBER_OF_GPU_DRIVER_BUG_WORKAROUND_TYPES -}; - -class SK_API GrDriverBugWorkarounds { - public: - GrDriverBugWorkarounds(); - GrDriverBugWorkarounds(const GrDriverBugWorkarounds&) = default; - explicit GrDriverBugWorkarounds(const std::vector& workarounds); - - GrDriverBugWorkarounds& operator=(const GrDriverBugWorkarounds&) = default; - - // Turn on any workarounds listed in |workarounds| (but don't turn any off). - void applyOverrides(const GrDriverBugWorkarounds& workarounds); - - ~GrDriverBugWorkarounds(); - -#define GPU_OP(type, name) bool name = false; - GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) -#undef GPU_OP -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h deleted file mode 100644 index d0b96ca80a428e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrDriverBugWorkaroundsAutogen.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// This file is auto-generated from build_workaround_header.py -// DO NOT EDIT! - -#define GPU_DRIVER_BUG_WORKAROUNDS(GPU_OP) \ - GPU_OP(ADD_AND_TRUE_TO_LOOP_CONDITION, \ - add_and_true_to_loop_condition) \ - GPU_OP(DISABLE_BLEND_EQUATION_ADVANCED, \ - disable_blend_equation_advanced) \ - GPU_OP(DISABLE_DISCARD_FRAMEBUFFER, \ - disable_discard_framebuffer) \ - GPU_OP(DISABLE_DUAL_SOURCE_BLENDING_SUPPORT, \ - disable_dual_source_blending_support) \ - GPU_OP(DISABLE_TEXTURE_STORAGE, \ - disable_texture_storage) \ - GPU_OP(DISALLOW_LARGE_INSTANCED_DRAW, \ - disallow_large_instanced_draw) \ - GPU_OP(EMULATE_ABS_INT_FUNCTION, \ - emulate_abs_int_function) \ - GPU_OP(FLUSH_ON_FRAMEBUFFER_CHANGE, \ - flush_on_framebuffer_change) \ - GPU_OP(FORCE_UPDATE_SCISSOR_STATE_WHEN_BINDING_FBO0, \ - force_update_scissor_state_when_binding_fbo0) \ - GPU_OP(GL_CLEAR_BROKEN, \ - gl_clear_broken) \ - GPU_OP(MAX_FRAGMENT_UNIFORM_VECTORS_32, \ - max_fragment_uniform_vectors_32) \ - GPU_OP(MAX_MSAA_SAMPLE_COUNT_4, \ - max_msaa_sample_count_4) \ - GPU_OP(PACK_PARAMETERS_WORKAROUND_WITH_PACK_BUFFER, \ - pack_parameters_workaround_with_pack_buffer) \ - GPU_OP(REMOVE_POW_WITH_CONSTANT_EXPONENT, \ - remove_pow_with_constant_exponent) \ - GPU_OP(REWRITE_DO_WHILE_LOOPS, \ - rewrite_do_while_loops) \ - GPU_OP(UNBIND_ATTACHMENTS_ON_BOUND_RENDER_FBO_DELETE, \ - unbind_attachments_on_bound_render_fbo_delete) \ - GPU_OP(UNFOLD_SHORT_CIRCUIT_AS_TERNARY_OPERATION, \ - unfold_short_circuit_as_ternary_operation) \ -// The End diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrRecordingContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrRecordingContext.h deleted file mode 100644 index f8b9c3f39230a3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrRecordingContext.h +++ /dev/null @@ -1,285 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrRecordingContext_DEFINED -#define GrRecordingContext_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/private/SkTArray.h" -#include "include/private/gpu/ganesh/GrImageContext.h" - -#if GR_GPU_STATS && GR_TEST_UTILS -#include -#include -#endif - -class GrAuditTrail; -class GrBackendFormat; -class GrDrawingManager; -class GrOnFlushCallbackObject; -class GrMemoryPool; -class GrProgramDesc; -class GrProgramInfo; -class GrProxyProvider; -class GrRecordingContextPriv; -class GrSurfaceProxy; -class GrThreadSafeCache; -class SkArenaAlloc; -class SkCapabilities; -class SkJSONWriter; - -namespace sktext::gpu { -class SubRunAllocator; -class TextBlobRedrawCoordinator; -} - -#if GR_TEST_UTILS -class SkString; -#endif - -class GrRecordingContext : public GrImageContext { -public: - ~GrRecordingContext() override; - - SK_API GrBackendFormat defaultBackendFormat(SkColorType ct, GrRenderable renderable) const { - return INHERITED::defaultBackendFormat(ct, renderable); - } - - /** - * Reports whether the GrDirectContext associated with this GrRecordingContext is abandoned. - * When called on a GrDirectContext it may actively check whether the underlying 3D API - * device/context has been disconnected before reporting the status. If so, calling this - * method will transition the GrDirectContext to the abandoned state. - */ - bool abandoned() override { return INHERITED::abandoned(); } - - /* - * Can a SkSurface be created with the given color type. To check whether MSAA is supported - * use maxSurfaceSampleCountForColorType(). - */ - SK_API bool colorTypeSupportedAsSurface(SkColorType colorType) const { - if (kR16G16_unorm_SkColorType == colorType || - kA16_unorm_SkColorType == colorType || - kA16_float_SkColorType == colorType || - kR16G16_float_SkColorType == colorType || - kR16G16B16A16_unorm_SkColorType == colorType || - kGray_8_SkColorType == colorType) { - return false; - } - - return this->maxSurfaceSampleCountForColorType(colorType) > 0; - } - - /** - * Gets the maximum supported texture size. - */ - SK_API int maxTextureSize() const; - - /** - * Gets the maximum supported render target size. - */ - SK_API int maxRenderTargetSize() const; - - /** - * Can a SkImage be created with the given color type. - */ - SK_API bool colorTypeSupportedAsImage(SkColorType) const; - - /** - * Gets the maximum supported sample count for a color type. 1 is returned if only non-MSAA - * rendering is supported for the color type. 0 is returned if rendering to this color type - * is not supported at all. - */ - SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const { - return INHERITED::maxSurfaceSampleCountForColorType(colorType); - } - - SK_API sk_sp skCapabilities() const; - - // Provides access to functions that aren't part of the public API. - GrRecordingContextPriv priv(); - const GrRecordingContextPriv priv() const; // NOLINT(readability-const-return-type) - - // The collection of specialized memory arenas for different types of data recorded by a - // GrRecordingContext. Arenas does not maintain ownership of the pools it groups together. - class Arenas { - public: - Arenas(SkArenaAlloc*, sktext::gpu::SubRunAllocator*); - - // For storing pipelines and other complex data as-needed by ops - SkArenaAlloc* recordTimeAllocator() { return fRecordTimeAllocator; } - - // For storing GrTextBlob SubRuns - sktext::gpu::SubRunAllocator* recordTimeSubRunAllocator() { - return fRecordTimeSubRunAllocator; - } - - private: - SkArenaAlloc* fRecordTimeAllocator; - sktext::gpu::SubRunAllocator* fRecordTimeSubRunAllocator; - }; - -protected: - friend class GrRecordingContextPriv; // for hidden functions - friend class SkDeferredDisplayList; // for OwnedArenas - friend class SkDeferredDisplayListPriv; // for ProgramData - - // Like Arenas, but preserves ownership of the underlying pools. - class OwnedArenas { - public: - OwnedArenas(bool ddlRecording); - ~OwnedArenas(); - - Arenas get(); - - OwnedArenas& operator=(OwnedArenas&&); - - private: - bool fDDLRecording; - std::unique_ptr fRecordTimeAllocator; - std::unique_ptr fRecordTimeSubRunAllocator; - }; - - GrRecordingContext(sk_sp, bool ddlRecording); - - bool init() override; - - void abandonContext() override; - - GrDrawingManager* drawingManager(); - - // There is no going back from this method. It should only be called to control the timing - // during abandon or destruction of the context. - void destroyDrawingManager(); - - Arenas arenas() { return fArenas.get(); } - // This entry point should only be used for DDL creation where we want the ops' lifetime to - // match that of the DDL. - OwnedArenas&& detachArenas(); - - GrProxyProvider* proxyProvider() { return fProxyProvider.get(); } - const GrProxyProvider* proxyProvider() const { return fProxyProvider.get(); } - - struct ProgramData { - ProgramData(std::unique_ptr, const GrProgramInfo*); - ProgramData(ProgramData&&); // for SkTArray - ProgramData(const ProgramData&) = delete; - ~ProgramData(); - - const GrProgramDesc& desc() const { return *fDesc; } - const GrProgramInfo& info() const { return *fInfo; } - - private: - // TODO: store the GrProgramDescs in the 'fRecordTimeData' arena - std::unique_ptr fDesc; - // The program infos should be stored in 'fRecordTimeData' so do not need to be ref - // counted or deleted in the destructor. - const GrProgramInfo* fInfo = nullptr; - }; - - // This entry point gives the recording context a chance to cache the provided - // programInfo. The DDL context takes this opportunity to store programInfos as a sidecar - // to the DDL. - virtual void recordProgramInfo(const GrProgramInfo*) {} - // This asks the recording context to return any programInfos it may have collected - // via the 'recordProgramInfo' call. It is up to the caller to ensure that the lifetime - // of the programInfos matches the intended use. For example, in DDL-record mode it - // is known that all the programInfos will have been allocated in an arena with the - // same lifetime at the DDL itself. - virtual void detachProgramData(SkTArray*) {} - - sktext::gpu::TextBlobRedrawCoordinator* getTextBlobRedrawCoordinator(); - const sktext::gpu::TextBlobRedrawCoordinator* getTextBlobRedrawCoordinator() const; - - GrThreadSafeCache* threadSafeCache(); - const GrThreadSafeCache* threadSafeCache() const; - - /** - * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.) - * - * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to - * ensure its lifetime is tied to that of the context. - */ - void addOnFlushCallbackObject(GrOnFlushCallbackObject*); - - GrRecordingContext* asRecordingContext() override { return this; } - - class Stats { - public: - Stats() = default; - -#if GR_GPU_STATS - void reset() { *this = {}; } - - int numPathMasksGenerated() const { return fNumPathMasksGenerated; } - void incNumPathMasksGenerated() { fNumPathMasksGenerated++; } - - int numPathMaskCacheHits() const { return fNumPathMaskCacheHits; } - void incNumPathMasksCacheHits() { fNumPathMaskCacheHits++; } - -#if GR_TEST_UTILS - void dump(SkString* out) const; - void dumpKeyValuePairs(SkTArray* keys, SkTArray* values) const; -#endif - - private: - int fNumPathMasksGenerated{0}; - int fNumPathMaskCacheHits{0}; - -#else // GR_GPU_STATS - void incNumPathMasksGenerated() {} - void incNumPathMasksCacheHits() {} - -#if GR_TEST_UTILS - void dump(SkString*) const {} - void dumpKeyValuePairs(SkTArray* keys, SkTArray* values) const {} -#endif -#endif // GR_GPU_STATS - } fStats; - -#if GR_GPU_STATS && GR_TEST_UTILS - struct DMSAAStats { - void dumpKeyValuePairs(SkTArray* keys, SkTArray* values) const; - void dump() const; - void merge(const DMSAAStats&); - int fNumRenderPasses = 0; - int fNumMultisampleRenderPasses = 0; - std::map fTriggerCounts; - }; - - DMSAAStats fDMSAAStats; -#endif - - Stats* stats() { return &fStats; } - const Stats* stats() const { return &fStats; } - void dumpJSON(SkJSONWriter*) const; - -protected: - // Delete last in case other objects call it during destruction. - std::unique_ptr fAuditTrail; - -private: - OwnedArenas fArenas; - - std::unique_ptr fDrawingManager; - std::unique_ptr fProxyProvider; - -#if GR_TEST_UTILS - int fSuppressWarningMessages = 0; -#endif - - using INHERITED = GrImageContext; -}; - -/** - * Safely cast a possibly-null base context to direct context. - */ -static inline GrDirectContext* GrAsDirectContext(GrContext_Base* base) { - return base ? base->asDirectContext() : nullptr; -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrSurfaceInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrSurfaceInfo.h deleted file mode 100644 index e037fb495781ae..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrSurfaceInfo.h +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrSurfaceInfo_DEFINED -#define GrSurfaceInfo_DEFINED - -#include "include/gpu/GrTypes.h" - -#ifdef SK_GL -#include "include/private/gpu/ganesh/GrGLTypesPriv.h" -#endif -#ifdef SK_VULKAN -#include "include/private/gpu/ganesh/GrVkTypesPriv.h" -#endif -#ifdef SK_DIRECT3D -#include "include/private/gpu/ganesh/GrD3DTypesMinimal.h" -struct GrD3DSurfaceInfo; -#endif -#ifdef SK_METAL -#include "include/private/gpu/ganesh/GrMtlTypesPriv.h" -#endif -#ifdef SK_DAWN -#include "include/private/gpu/ganesh/GrDawnTypesPriv.h" -#endif -#include "include/private/gpu/ganesh/GrMockTypesPriv.h" - -class GrSurfaceInfo { -public: - GrSurfaceInfo() {} -#ifdef SK_GL - GrSurfaceInfo(const GrGLSurfaceInfo& glInfo) - : fBackend(GrBackendApi::kOpenGL) - , fValid(true) - , fSampleCount(glInfo.fSampleCount) - , fLevelCount(glInfo.fLevelCount) - , fProtected(glInfo.fProtected) - , fGLSpec(glInfo) {} -#endif -#ifdef SK_VULKAN - GrSurfaceInfo(const GrVkSurfaceInfo& vkInfo) - : fBackend(GrBackendApi::kVulkan) - , fValid(true) - , fSampleCount(vkInfo.fSampleCount) - , fLevelCount(vkInfo.fLevelCount) - , fProtected(vkInfo.fProtected) - , fVkSpec(vkInfo) {} -#endif -#ifdef SK_DIRECT3D - GrSurfaceInfo(const GrD3DSurfaceInfo& d3dInfo); -#endif -#ifdef SK_METAL - GrSurfaceInfo(const GrMtlSurfaceInfo& mtlInfo) - : fBackend(GrBackendApi::kMetal) - , fValid(true) - , fSampleCount(mtlInfo.fSampleCount) - , fLevelCount(mtlInfo.fLevelCount) - , fProtected(mtlInfo.fProtected) - , fMtlSpec(mtlInfo) {} -#endif -#ifdef SK_DAWN - GrSurfaceInfo(const GrDawnSurfaceInfo& dawnInfo) - : fBackend(GrBackendApi::kDawn) - , fValid(true) - , fSampleCount(dawnInfo.fSampleCount) - , fLevelCount(dawnInfo.fLevelCount) - , fProtected(dawnInfo.fProtected) - , fDawnSpec(dawnInfo) {} -#endif - GrSurfaceInfo(const GrMockSurfaceInfo& mockInfo) - : fBackend(GrBackendApi::kMock) - , fValid(true) - , fSampleCount(mockInfo.fSampleCount) - , fLevelCount(mockInfo.fLevelCount) - , fProtected(mockInfo.fProtected) - , fMockSpec(mockInfo) {} - - ~GrSurfaceInfo(); - GrSurfaceInfo(const GrSurfaceInfo&) = default; - - bool isValid() const { return fValid; } - GrBackendApi backend() const { return fBackend; } - - uint32_t numSamples() const { return fSampleCount; } - uint32_t numMipLevels() const { return fLevelCount; } - GrProtected isProtected() const { return fProtected; } - -#ifdef SK_GL - bool getGLSurfaceInfo(GrGLSurfaceInfo* info) const { - if (!this->isValid() || fBackend != GrBackendApi::kOpenGL) { - return false; - } - *info = GrGLTextureSpecToSurfaceInfo(fGLSpec, fSampleCount, fLevelCount, fProtected); - return true; - } -#endif -#ifdef SK_VULKAN - bool getVkSurfaceInfo(GrVkSurfaceInfo* info) const { - if (!this->isValid() || fBackend != GrBackendApi::kVulkan) { - return false; - } - *info = GrVkImageSpecToSurfaceInfo(fVkSpec, fSampleCount, fLevelCount, fProtected); - return true; - } -#endif -#ifdef SK_DIRECT3D - bool getD3DSurfaceInfo(GrD3DSurfaceInfo*) const; -#endif -#ifdef SK_METAL - bool getMtlSurfaceInfo(GrMtlSurfaceInfo* info) const { - if (!this->isValid() || fBackend != GrBackendApi::kMetal) { - return false; - } - *info = GrMtlTextureSpecToSurfaceInfo(fMtlSpec, fSampleCount, fLevelCount, fProtected); - return true; - } -#endif -#ifdef SK_DAWN - bool getDawnSurfaceInfo(GrDawnSurfaceInfo* info) const { - if (!this->isValid() || fBackend != GrBackendApi::kDawn) { - return false; - } - *info = GrDawnTextureSpecToSurfaceInfo(fDawnSpec, fSampleCount, fLevelCount, fProtected); - return true; - } -#endif - bool getMockSurfaceInfo(GrMockSurfaceInfo* info) const { - if (!this->isValid() || fBackend != GrBackendApi::kMock) { - return false; - } - *info = GrMockTextureSpecToSurfaceInfo(fMockSpec, fSampleCount, fLevelCount, fProtected); - return true; - } - -private: - GrBackendApi fBackend = GrBackendApi::kMock; - bool fValid = false; - - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - union { -#ifdef SK_GL - GrGLTextureSpec fGLSpec; -#endif -#ifdef SK_VULKAN - GrVkImageSpec fVkSpec; -#endif -#ifdef SK_DIRECT3D - GrD3DTextureResourceSpecHolder fD3DSpec; -#endif -#ifdef SK_METAL - GrMtlTextureSpec fMtlSpec; -#endif -#ifdef SK_DAWN - GrDawnTextureSpec fDawnSpec; -#endif - GrMockTextureSpec fMockSpec; - }; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrTypes.h deleted file mode 100644 index f8895345d658a8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrTypes.h +++ /dev/null @@ -1,244 +0,0 @@ -/* - * Copyright 2010 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrTypes_DEFINED -#define GrTypes_DEFINED - -#include "include/core/SkMath.h" -#include "include/core/SkTypes.h" -#include "include/gpu/GrConfig.h" - -class GrBackendSemaphore; -class SkImage; -class SkSurface; - -//////////////////////////////////////////////////////////////////////////////// - -/** - * Wraps a C++11 enum that we use as a bitfield, and enables a limited amount of - * masking with type safety. Instantiated with the ~ operator. - */ -template class GrTFlagsMask { -public: - constexpr explicit GrTFlagsMask(TFlags value) : GrTFlagsMask(static_cast(value)) {} - constexpr explicit GrTFlagsMask(int value) : fValue(value) {} - constexpr int value() const { return fValue; } -private: - const int fValue; -}; - -/** - * Defines bitwise operators that make it possible to use an enum class as a - * basic bitfield. - */ -#define GR_MAKE_BITFIELD_CLASS_OPS(X) \ - [[maybe_unused]] constexpr GrTFlagsMask operator~(X a) { \ - return GrTFlagsMask(~static_cast(a)); \ - } \ - [[maybe_unused]] constexpr X operator|(X a, X b) { \ - return static_cast(static_cast(a) | static_cast(b)); \ - } \ - [[maybe_unused]] inline X& operator|=(X& a, X b) { \ - return (a = a | b); \ - } \ - [[maybe_unused]] constexpr bool operator&(X a, X b) { \ - return SkToBool(static_cast(a) & static_cast(b)); \ - } \ - [[maybe_unused]] constexpr GrTFlagsMask operator|(GrTFlagsMask a, GrTFlagsMask b) { \ - return GrTFlagsMask(a.value() | b.value()); \ - } \ - [[maybe_unused]] constexpr GrTFlagsMask operator|(GrTFlagsMask a, X b) { \ - return GrTFlagsMask(a.value() | static_cast(b)); \ - } \ - [[maybe_unused]] constexpr GrTFlagsMask operator|(X a, GrTFlagsMask b) { \ - return GrTFlagsMask(static_cast(a) | b.value()); \ - } \ - [[maybe_unused]] constexpr X operator&(GrTFlagsMask a, GrTFlagsMask b) { \ - return static_cast(a.value() & b.value()); \ - } \ - [[maybe_unused]] constexpr X operator&(GrTFlagsMask a, X b) { \ - return static_cast(a.value() & static_cast(b)); \ - } \ - [[maybe_unused]] constexpr X operator&(X a, GrTFlagsMask b) { \ - return static_cast(static_cast(a) & b.value()); \ - } \ - [[maybe_unused]] inline X& operator&=(X& a, GrTFlagsMask b) { \ - return (a = a & b); \ - } \ - -#define GR_DECL_BITFIELD_CLASS_OPS_FRIENDS(X) \ - friend constexpr GrTFlagsMask operator ~(X); \ - friend constexpr X operator |(X, X); \ - friend X& operator |=(X&, X); \ - friend constexpr bool operator &(X, X); \ - friend constexpr GrTFlagsMask operator|(GrTFlagsMask, GrTFlagsMask); \ - friend constexpr GrTFlagsMask operator|(GrTFlagsMask, X); \ - friend constexpr GrTFlagsMask operator|(X, GrTFlagsMask); \ - friend constexpr X operator&(GrTFlagsMask, GrTFlagsMask); \ - friend constexpr X operator&(GrTFlagsMask, X); \ - friend constexpr X operator&(X, GrTFlagsMask); \ - friend X& operator &=(X&, GrTFlagsMask) - -/////////////////////////////////////////////////////////////////////////////// - -/** - * Possible 3D APIs that may be used by Ganesh. - */ -enum class GrBackendApi : unsigned { - kOpenGL, - kVulkan, - kMetal, - kDirect3D, - kDawn, - /** - * Mock is a backend that does not draw anything. It is used for unit tests - * and to measure CPU overhead. - */ - kMock, - - /** - * Added here to support the legacy GrBackend enum value and clients who referenced it using - * GrBackend::kOpenGL_GrBackend. - */ - kOpenGL_GrBackend = kOpenGL, -}; - -/** - * Previously the above enum was not an enum class but a normal enum. To support the legacy use of - * the enum values we define them below so that no clients break. - */ -typedef GrBackendApi GrBackend; - -static constexpr GrBackendApi kMetal_GrBackend = GrBackendApi::kMetal; -static constexpr GrBackendApi kVulkan_GrBackend = GrBackendApi::kVulkan; -static constexpr GrBackendApi kMock_GrBackend = GrBackendApi::kMock; - -/////////////////////////////////////////////////////////////////////////////// - -/** - * Used to say whether a texture has mip levels allocated or not. - */ -enum class GrMipmapped : bool { - kNo = false, - kYes = true -}; -/** Deprecated legacy alias of GrMipmapped. */ -using GrMipMapped = GrMipmapped; - -/* - * Can a GrBackendObject be rendered to? - */ -enum class GrRenderable : bool { - kNo = false, - kYes = true -}; - -/* - * Used to say whether texture is backed by protected memory. - */ -enum class GrProtected : bool { - kNo = false, - kYes = true -}; - -/////////////////////////////////////////////////////////////////////////////// - -/** - * GPU SkImage and SkSurfaces can be stored such that (0, 0) in texture space may correspond to - * either the top-left or bottom-left content pixel. - */ -enum GrSurfaceOrigin : int { - kTopLeft_GrSurfaceOrigin, - kBottomLeft_GrSurfaceOrigin, -}; - -/** - * A GrContext's cache of backend context state can be partially invalidated. - * These enums are specific to the GL backend and we'd add a new set for an alternative backend. - */ -enum GrGLBackendState { - kRenderTarget_GrGLBackendState = 1 << 0, - // Also includes samplers bound to texture units. - kTextureBinding_GrGLBackendState = 1 << 1, - // View state stands for scissor and viewport - kView_GrGLBackendState = 1 << 2, - kBlend_GrGLBackendState = 1 << 3, - kMSAAEnable_GrGLBackendState = 1 << 4, - kVertex_GrGLBackendState = 1 << 5, - kStencil_GrGLBackendState = 1 << 6, - kPixelStore_GrGLBackendState = 1 << 7, - kProgram_GrGLBackendState = 1 << 8, - kFixedFunction_GrGLBackendState = 1 << 9, - kMisc_GrGLBackendState = 1 << 10, - kALL_GrGLBackendState = 0xffff -}; - -/** - * This value translates to reseting all the context state for any backend. - */ -static const uint32_t kAll_GrBackendState = 0xffffffff; - -typedef void* GrGpuFinishedContext; -typedef void (*GrGpuFinishedProc)(GrGpuFinishedContext finishedContext); - -typedef void* GrGpuSubmittedContext; -typedef void (*GrGpuSubmittedProc)(GrGpuSubmittedContext submittedContext, bool success); - -/** - * Struct to supply options to flush calls. - * - * After issuing all commands, fNumSemaphore semaphores will be signaled by the gpu. The client - * passes in an array of fNumSemaphores GrBackendSemaphores. In general these GrBackendSemaphore's - * can be either initialized or not. If they are initialized, the backend uses the passed in - * semaphore. If it is not initialized, a new semaphore is created and the GrBackendSemaphore - * object is initialized with that semaphore. The semaphores are not sent to the GPU until the next - * GrContext::submit call is made. See the GrContext::submit for more information. - * - * The client will own and be responsible for deleting the underlying semaphores that are stored - * and returned in initialized GrBackendSemaphore objects. The GrBackendSemaphore objects - * themselves can be deleted as soon as this function returns. - * - * If a finishedProc is provided, the finishedProc will be called when all work submitted to the gpu - * from this flush call and all previous flush calls has finished on the GPU. If the flush call - * fails due to an error and nothing ends up getting sent to the GPU, the finished proc is called - * immediately. - * - * If a submittedProc is provided, the submittedProc will be called when all work from this flush - * call is submitted to the GPU. If the flush call fails due to an error and nothing will get sent - * to the GPU, the submitted proc is called immediately. It is possibly that when work is finally - * submitted, that the submission actual fails. In this case we will not reattempt to do the - * submission. Skia notifies the client of these via the success bool passed into the submittedProc. - * The submittedProc is useful to the client to know when semaphores that were sent with the flush - * have actually been submitted to the GPU so that they can be waited on (or deleted if the submit - * fails). - * Note about GL: In GL work gets sent to the driver immediately during the flush call, but we don't - * really know when the driver sends the work to the GPU. Therefore, we treat the submitted proc as - * we do in other backends. It will be called when the next GrContext::submit is called after the - * flush (or possibly during the flush if there is no work to be done for the flush). The main use - * case for the submittedProc is to know when semaphores have been sent to the GPU and even in GL - * it is required to call GrContext::submit to flush them. So a client should be able to treat all - * backend APIs the same in terms of how the submitted procs are treated. - */ -struct GrFlushInfo { - size_t fNumSemaphores = 0; - GrBackendSemaphore* fSignalSemaphores = nullptr; - GrGpuFinishedProc fFinishedProc = nullptr; - GrGpuFinishedContext fFinishedContext = nullptr; - GrGpuSubmittedProc fSubmittedProc = nullptr; - GrGpuSubmittedContext fSubmittedContext = nullptr; -}; - -/** - * Enum used as return value when flush with semaphores so the client knows whether the valid - * semaphores will be submitted on the next GrContext::submit call. - */ -enum class GrSemaphoresSubmitted : bool { - kNo = false, - kYes = true -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrYUVABackendTextures.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrYUVABackendTextures.h deleted file mode 100644 index edcde7e5335bc9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/GrYUVABackendTextures.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrYUVABackendTextures_DEFINED -#define GrYUVABackendTextures_DEFINED - -#include "include/core/SkYUVAInfo.h" -#include "include/gpu/GrBackendSurface.h" - -#include - -/** - * A description of a set GrBackendTextures that hold the planar data described by a SkYUVAInfo. - */ -class SK_API GrYUVABackendTextureInfo { -public: - static constexpr auto kMaxPlanes = SkYUVAInfo::kMaxPlanes; - - /** Default GrYUVABackendTextureInfo is invalid. */ - GrYUVABackendTextureInfo() = default; - - /** - * Initializes a GrYUVABackendTextureInfo to describe a set of textures that can store the - * planes indicated by the SkYUVAInfo. The texture dimensions are taken from the SkYUVAInfo's - * plane dimensions. All the described textures share a common origin. The planar image this - * describes will be mip mapped if all the textures are individually mip mapped as indicated - * by GrMipmapped. This will produce an invalid result (return false from isValid()) if the - * passed formats' channels don't agree with SkYUVAInfo. - */ - GrYUVABackendTextureInfo(const SkYUVAInfo&, - const GrBackendFormat[kMaxPlanes], - GrMipmapped, - GrSurfaceOrigin); - - GrYUVABackendTextureInfo(const GrYUVABackendTextureInfo&) = default; - - GrYUVABackendTextureInfo& operator=(const GrYUVABackendTextureInfo&) = default; - - bool operator==(const GrYUVABackendTextureInfo&) const; - bool operator!=(const GrYUVABackendTextureInfo& that) const { return !(*this == that); } - - const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; } - - SkYUVColorSpace yuvColorSpace() const { return fYUVAInfo.yuvColorSpace(); } - - GrMipmapped mipmapped() const { return fMipmapped; } - - GrSurfaceOrigin textureOrigin() const { return fTextureOrigin; } - - /** The number of SkPixmap planes, 0 if this GrYUVABackendTextureInfo is invalid. */ - int numPlanes() const { return fYUVAInfo.numPlanes(); } - - /** Format of the ith plane, or invalid format if i >= numPlanes() */ - const GrBackendFormat& planeFormat(int i) const { return fPlaneFormats[i]; } - - /** - * Returns true if this has been configured with a valid SkYUVAInfo with compatible texture - * formats. - */ - bool isValid() const { return fYUVAInfo.isValid(); } - - /** - * Computes a YUVALocations representation of the planar layout. The result is guaranteed to be - * valid if this->isValid(). - */ - SkYUVAInfo::YUVALocations toYUVALocations() const; - -private: - SkYUVAInfo fYUVAInfo; - GrBackendFormat fPlaneFormats[kMaxPlanes]; - GrMipmapped fMipmapped = GrMipmapped::kNo; - GrSurfaceOrigin fTextureOrigin = kTopLeft_GrSurfaceOrigin; -}; - -/** - * A set of GrBackendTextures that hold the planar data for an image described a SkYUVAInfo. - */ -class SK_API GrYUVABackendTextures { -public: - GrYUVABackendTextures() = default; - GrYUVABackendTextures(const GrYUVABackendTextures&) = delete; - GrYUVABackendTextures(GrYUVABackendTextures&&) = default; - - GrYUVABackendTextures& operator=(const GrYUVABackendTextures&) = delete; - GrYUVABackendTextures& operator=(GrYUVABackendTextures&&) = default; - - GrYUVABackendTextures(const SkYUVAInfo&, - const GrBackendTexture[SkYUVAInfo::kMaxPlanes], - GrSurfaceOrigin textureOrigin); - - const std::array& textures() const { - return fTextures; - } - - GrBackendTexture texture(int i) const { - SkASSERT(i >= 0 && i < SkYUVAInfo::kMaxPlanes); - return fTextures[static_cast(i)]; - } - - const SkYUVAInfo& yuvaInfo() const { return fYUVAInfo; } - - int numPlanes() const { return fYUVAInfo.numPlanes(); } - - GrSurfaceOrigin textureOrigin() const { return fTextureOrigin; } - - bool isValid() const { return fYUVAInfo.isValid(); } - - /** - * Computes a YUVALocations representation of the planar layout. The result is guaranteed to be - * valid if this->isValid(). - */ - SkYUVAInfo::YUVALocations toYUVALocations() const; - -private: - SkYUVAInfo fYUVAInfo; - std::array fTextures; - GrSurfaceOrigin fTextureOrigin = kTopLeft_GrSurfaceOrigin; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/MutableTextureState.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/MutableTextureState.h deleted file mode 100644 index 19b7cd54c681a1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/MutableTextureState.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_MutableTextureState_DEFINED -#define skgpu_MutableTextureState_DEFINED - -#include "include/gpu/GpuTypes.h" - -#ifdef SK_VULKAN -#include "include/private/gpu/vk/VulkanTypesPriv.h" -#endif - -#include - -class GrVkGpu; - -namespace skgpu { - -/** - * Since Skia and clients can both modify gpu textures and their connected state, Skia needs a way - * for clients to inform us if they have modifiend any of this state. In order to not need setters - * for every single API and state, we use this class to be a generic wrapper around all the mutable - * state. This class is used for calls that inform Skia of these texture/image state changes by the - * client as well as for requesting state changes to be done by Skia. The backend specific state - * that is wrapped by this class are: - * - * Vulkan: VkImageLayout and QueueFamilyIndex - */ -class SK_API MutableTextureState { -public: - MutableTextureState() {} - -#ifdef SK_VULKAN - MutableTextureState(VkImageLayout layout, uint32_t queueFamilyIndex) - : fVkState(layout, queueFamilyIndex) - , fBackend(BackendApi::kVulkan) - , fIsValid(true) {} -#endif - - MutableTextureState(const MutableTextureState& that) - : fBackend(that.fBackend), fIsValid(that.fIsValid) { - if (!fIsValid) { - return; - } - switch (fBackend) { - case BackendApi::kVulkan: - #ifdef SK_VULKAN - SkASSERT(that.fBackend == BackendApi::kVulkan); - fVkState = that.fVkState; - #endif - break; - default: - (void)that; - SkUNREACHABLE; - } - } - - MutableTextureState& operator=(const MutableTextureState& that) { - if (this != &that) { - this->~MutableTextureState(); - new (this) MutableTextureState(that); - } - return *this; - } - -#ifdef SK_VULKAN - // If this class is not Vulkan backed it will return value of VK_IMAGE_LAYOUT_UNDEFINED. - // Otherwise it will return the VkImageLayout. - VkImageLayout getVkImageLayout() const { - if (this->isValid() && fBackend != BackendApi::kVulkan) { - return VK_IMAGE_LAYOUT_UNDEFINED; - } - return fVkState.getImageLayout(); - } - - // If this class is not Vulkan backed it will return value of VK_QUEUE_FAMILY_IGNORED. - // Otherwise it will return the VkImageLayout. - uint32_t getQueueFamilyIndex() const { - if (this->isValid() && fBackend != BackendApi::kVulkan) { - return VK_QUEUE_FAMILY_IGNORED; - } - return fVkState.getQueueFamilyIndex(); - } -#endif - - BackendApi backend() const { return fBackend; } - - // Returns true if the backend mutable state has been initialized. - bool isValid() const { return fIsValid; } - -private: - friend class MutableTextureStateRef; - friend class ::GrVkGpu; - -#ifdef SK_VULKAN - void setVulkanState(VkImageLayout layout, uint32_t queueFamilyIndex) { - SkASSERT(!this->isValid() || fBackend == BackendApi::kVulkan); - fVkState.setImageLayout(layout); - fVkState.setQueueFamilyIndex(queueFamilyIndex); - fBackend = BackendApi::kVulkan; - fIsValid = true; - } -#endif - - union { - char fPlaceholder; -#ifdef SK_VULKAN - VulkanMutableTextureState fVkState; -#endif - }; - - BackendApi fBackend = BackendApi::kMock; - bool fIsValid = false; -}; - -} // namespace skgpu - -#endif // skgpu_MutableTextureState_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/ShaderErrorHandler.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/ShaderErrorHandler.h deleted file mode 100644 index 8960da5c5a212b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/ShaderErrorHandler.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_ShaderErrorHandler_DEFINED -#define skgpu_ShaderErrorHandler_DEFINED - -#include "include/core/SkTypes.h" - -namespace skgpu { -/** - * Abstract class to report errors when compiling shaders. - */ -class SK_API ShaderErrorHandler { -public: - virtual ~ShaderErrorHandler() = default; - - virtual void compileError(const char* shader, const char* errors) = 0; - -protected: - ShaderErrorHandler() = default; - ShaderErrorHandler(const ShaderErrorHandler&) = delete; - ShaderErrorHandler& operator=(const ShaderErrorHandler&) = delete; -}; - -/** - * Used when no error handler is set. Will report failures via SkDebugf and asserts. - */ -ShaderErrorHandler* DefaultShaderErrorHandler(); - -} // namespace skgpu - -#endif // skgpu_ShaderErrorHandler_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h deleted file mode 100644 index bb85e52e5c0fc3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DBackendContext.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrD3DBackendContext_DEFINED -#define GrD3DBackendContext_DEFINED - -// GrD3DTypes.h includes d3d12.h, which in turn includes windows.h, which redefines many -// common identifiers such as: -// * interface -// * small -// * near -// * far -// * CreateSemaphore -// * MemoryBarrier -// -// You should only include GrD3DBackendContext.h if you are prepared to rename those identifiers. -#include "include/gpu/d3d/GrD3DTypes.h" - -#include "include/gpu/GrTypes.h" - -// The BackendContext contains all of the base D3D objects needed by the GrD3DGpu. The assumption -// is that the client will set these up and pass them to the GrD3DGpu constructor. -struct SK_API GrD3DBackendContext { - gr_cp fAdapter; - gr_cp fDevice; - gr_cp fQueue; - sk_sp fMemoryAllocator; - GrProtected fProtectedContext = GrProtected::kNo; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DTypes.h deleted file mode 100644 index d2e890f780a1f4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/d3d/GrD3DTypes.h +++ /dev/null @@ -1,248 +0,0 @@ - -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrD3DTypes_DEFINED -#define GrD3DTypes_DEFINED - -// This file includes d3d12.h, which in turn includes windows.h, which redefines many -// common identifiers such as: -// * interface -// * small -// * near -// * far -// * CreateSemaphore -// * MemoryBarrier -// -// You should only include this header if you need the Direct3D definitions and are -// prepared to rename those identifiers. - -#include "include/core/SkRefCnt.h" -#include "include/gpu/GrTypes.h" -#include -#include - -class GrD3DGpu; - - /** Check if the argument is non-null, and if so, call obj->AddRef() and return obj. - */ -template static inline T* GrSafeComAddRef(T* obj) { - if (obj) { - obj->AddRef(); - } - return obj; -} - -/** Check if the argument is non-null, and if so, call obj->Release() - */ -template static inline void GrSafeComRelease(T* obj) { - if (obj) { - obj->Release(); - } -} - -template class gr_cp { -public: - using element_type = T; - - constexpr gr_cp() : fObject(nullptr) {} - constexpr gr_cp(std::nullptr_t) : fObject(nullptr) {} - - /** - * Shares the underlying object by calling AddRef(), so that both the argument and the newly - * created gr_cp both have a reference to it. - */ - gr_cp(const gr_cp& that) : fObject(GrSafeComAddRef(that.get())) {} - - /** - * Move the underlying object from the argument to the newly created gr_cp. Afterwards only - * the new gr_cp will have a reference to the object, and the argument will point to null. - * No call to AddRef() or Release() will be made. - */ - gr_cp(gr_cp&& that) : fObject(that.release()) {} - - /** - * Adopt the bare object into the newly created gr_cp. - * No call to AddRef() or Release() will be made. - */ - explicit gr_cp(T* obj) { - fObject = obj; - } - - /** - * Calls Release() on the underlying object pointer. - */ - ~gr_cp() { - GrSafeComRelease(fObject); - SkDEBUGCODE(fObject = nullptr); - } - - /** - * Shares the underlying object referenced by the argument by calling AddRef() on it. If this - * gr_cp previously had a reference to an object (i.e. not null) it will call Release() - * on that object. - */ - gr_cp& operator=(const gr_cp& that) { - if (this != &that) { - this->reset(GrSafeComAddRef(that.get())); - } - return *this; - } - - /** - * Move the underlying object from the argument to the gr_cp. If the gr_cp - * previously held a reference to another object, Release() will be called on that object. - * No call to AddRef() will be made. - */ - gr_cp& operator=(gr_cp&& that) { - this->reset(that.release()); - return *this; - } - - explicit operator bool() const { return this->get() != nullptr; } - - T* get() const { return fObject; } - T* operator->() const { return fObject; } - T** operator&() { return &fObject; } - - /** - * Adopt the new object, and call Release() on any previously held object (if not null). - * No call to AddRef() will be made. - */ - void reset(T* object = nullptr) { - T* oldObject = fObject; - fObject = object; - GrSafeComRelease(oldObject); - } - - /** - * Shares the new object by calling AddRef() on it. If this gr_cp previously had a - * reference to an object (i.e. not null) it will call Release() on that object. - */ - void retain(T* object) { - if (this->fObject != object) { - this->reset(GrSafeComAddRef(object)); - } - } - - /** - * Return the original object, and set the internal object to nullptr. - * The caller must assume ownership of the object, and manage its reference count directly. - * No call to Release() will be made. - */ - T* SK_WARN_UNUSED_RESULT release() { - T* obj = fObject; - fObject = nullptr; - return obj; - } - -private: - T* fObject; -}; - -template inline bool operator==(const gr_cp& a, - const gr_cp& b) { - return a.get() == b.get(); -} - -template inline bool operator!=(const gr_cp& a, - const gr_cp& b) { - return a.get() != b.get(); -} - -// interface classes for the GPU memory allocator -class GrD3DAlloc : public SkRefCnt { -public: - ~GrD3DAlloc() override = default; -}; - -class GrD3DMemoryAllocator : public SkRefCnt { -public: - virtual gr_cp createResource(D3D12_HEAP_TYPE, const D3D12_RESOURCE_DESC*, - D3D12_RESOURCE_STATES initialResourceState, - sk_sp* allocation, - const D3D12_CLEAR_VALUE*) = 0; - virtual gr_cp createAliasingResource(sk_sp& allocation, - uint64_t localOffset, - const D3D12_RESOURCE_DESC*, - D3D12_RESOURCE_STATES initialResourceState, - const D3D12_CLEAR_VALUE*) = 0; -}; - -// Note: there is no notion of Borrowed or Adopted resources in the D3D backend, -// so Ganesh will ref fResource once it's asked to wrap it. -// Clients are responsible for releasing their own ref to avoid memory leaks. -struct GrD3DTextureResourceInfo { - gr_cp fResource = nullptr; - sk_sp fAlloc = nullptr; - D3D12_RESOURCE_STATES fResourceState = D3D12_RESOURCE_STATE_COMMON; - DXGI_FORMAT fFormat = DXGI_FORMAT_UNKNOWN; - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - unsigned int fSampleQualityPattern = DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN; - GrProtected fProtected = GrProtected::kNo; - - GrD3DTextureResourceInfo() = default; - - GrD3DTextureResourceInfo(ID3D12Resource* resource, - const sk_sp alloc, - D3D12_RESOURCE_STATES resourceState, - DXGI_FORMAT format, - uint32_t sampleCount, - uint32_t levelCount, - unsigned int sampleQualityLevel, - GrProtected isProtected = GrProtected::kNo) - : fResource(resource) - , fAlloc(alloc) - , fResourceState(resourceState) - , fFormat(format) - , fSampleCount(sampleCount) - , fLevelCount(levelCount) - , fSampleQualityPattern(sampleQualityLevel) - , fProtected(isProtected) {} - - GrD3DTextureResourceInfo(const GrD3DTextureResourceInfo& info, - D3D12_RESOURCE_STATES resourceState) - : fResource(info.fResource) - , fAlloc(info.fAlloc) - , fResourceState(resourceState) - , fFormat(info.fFormat) - , fSampleCount(info.fSampleCount) - , fLevelCount(info.fLevelCount) - , fSampleQualityPattern(info.fSampleQualityPattern) - , fProtected(info.fProtected) {} - -#if GR_TEST_UTILS - bool operator==(const GrD3DTextureResourceInfo& that) const { - return fResource == that.fResource && fResourceState == that.fResourceState && - fFormat == that.fFormat && fSampleCount == that.fSampleCount && - fLevelCount == that.fLevelCount && - fSampleQualityPattern == that.fSampleQualityPattern && fProtected == that.fProtected; - } -#endif -}; - -struct GrD3DFenceInfo { - GrD3DFenceInfo() - : fFence(nullptr) - , fValue(0) { - } - - gr_cp fFence; - uint64_t fValue; // signal value for the fence -}; - -struct GrD3DSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - DXGI_FORMAT fFormat = DXGI_FORMAT_UNKNOWN; - unsigned int fSampleQualityPattern = DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/dawn/GrDawnTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/dawn/GrDawnTypes.h deleted file mode 100644 index 70a2f9f6d6c5d9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/dawn/GrDawnTypes.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrDawnTypes_DEFINED -#define GrDawnTypes_DEFINED - -#include "include/gpu/GrTypes.h" - -#ifdef Always -#undef Always -static constexpr int Always = 2; -#endif -#ifdef Success -#undef Success -static constexpr int Success = 0; -#endif -#ifdef None -#undef None -static constexpr int None = 0L; -#endif -#include "webgpu/webgpu_cpp.h" - -struct GrDawnTextureInfo { - wgpu::Texture fTexture; - wgpu::TextureFormat fFormat; - uint32_t fLevelCount; - GrDawnTextureInfo() : fTexture(nullptr), fFormat(), fLevelCount(0) { - } - GrDawnTextureInfo(const GrDawnTextureInfo& other) - : fTexture(other.fTexture) - , fFormat(other.fFormat) - , fLevelCount(other.fLevelCount) { - } - GrDawnTextureInfo& operator=(const GrDawnTextureInfo& other) { - fTexture = other.fTexture; - fFormat = other.fFormat; - fLevelCount = other.fLevelCount; - return *this; - } - bool operator==(const GrDawnTextureInfo& other) const { - return fTexture.Get() == other.fTexture.Get() && - fFormat == other.fFormat && - fLevelCount == other.fLevelCount; - } -}; - -// GrDawnRenderTargetInfo holds a reference to a (1-mip) TextureView. This means that, for now, -// GrDawnRenderTarget is suitable for rendering, but not readPixels() or writePixels(). Also, -// backdrop filters and certain blend modes requiring copying the destination framebuffer -// will not work. -struct GrDawnRenderTargetInfo { - wgpu::TextureView fTextureView; - wgpu::TextureFormat fFormat; - uint32_t fLevelCount; - GrDawnRenderTargetInfo() : fTextureView(nullptr), fFormat(), fLevelCount(0) { - } - GrDawnRenderTargetInfo(const GrDawnRenderTargetInfo& other) - : fTextureView(other.fTextureView) - , fFormat(other.fFormat) - , fLevelCount(other.fLevelCount) { - } - explicit GrDawnRenderTargetInfo(const GrDawnTextureInfo& texInfo) - : fFormat(texInfo.fFormat) - , fLevelCount(1) { - wgpu::TextureViewDescriptor desc; - desc.format = texInfo.fFormat; - desc.mipLevelCount = 1; - fTextureView = texInfo.fTexture.CreateView(&desc); - } - GrDawnRenderTargetInfo& operator=(const GrDawnRenderTargetInfo& other) { - fTextureView = other.fTextureView; - fFormat = other.fFormat; - fLevelCount = other.fLevelCount; - return *this; - } - bool operator==(const GrDawnRenderTargetInfo& other) const { - return fTextureView.Get() == other.fTextureView.Get() && - fFormat == other.fFormat && - fLevelCount == other.fLevelCount; - } -}; - -struct GrDawnSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - wgpu::TextureFormat fFormat; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h deleted file mode 100644 index bfa2aea37670e5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleHelpers.h +++ /dev/null @@ -1,11 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/gpu/gl/GrGLAssembleInterface.h" - -void GrGetEGLQueryAndDisplay(GrEGLQueryStringFn** queryString, GrEGLDisplay* display, - void* ctx, GrGLGetProc get); diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h deleted file mode 100644 index 4f9f9f9ee0f915..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLAssembleInterface.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/gpu/gl/GrGLInterface.h" - -typedef GrGLFuncPtr (*GrGLGetProc)(void* ctx, const char name[]); - -/** - * Generic function for creating a GrGLInterface for an either OpenGL or GLES. It calls - * get() to get each function address. ctx is a generic ptr passed to and interpreted by get(). - */ -SK_API sk_sp GrGLMakeAssembledInterface(void *ctx, GrGLGetProc get); - -/** - * Generic function for creating a GrGLInterface for an OpenGL (but not GLES) context. It calls - * get() to get each function address. ctx is a generic ptr passed to and interpreted by get(). - */ -SK_API sk_sp GrGLMakeAssembledGLInterface(void *ctx, GrGLGetProc get); - -/** - * Generic function for creating a GrGLInterface for an OpenGL ES (but not Open GL) context. It - * calls get() to get each function address. ctx is a generic ptr passed to and interpreted by - * get(). - */ -SK_API sk_sp GrGLMakeAssembledGLESInterface(void *ctx, GrGLGetProc get); - -/** - * Generic function for creating a GrGLInterface for a WebGL (similar to OpenGL ES) context. It - * calls get() to get each function address. ctx is a generic ptr passed to and interpreted by - * get(). - */ -SK_API sk_sp GrGLMakeAssembledWebGLInterface(void *ctx, GrGLGetProc get); - -/** Deprecated version of GrGLMakeAssembledInterface() that returns a bare pointer. */ -SK_API const GrGLInterface* GrGLAssembleInterface(void *ctx, GrGLGetProc get); diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig.h deleted file mode 100644 index e3573486ca7e40..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig.h +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - - -#ifndef GrGLConfig_DEFINED -#define GrGLConfig_DEFINED - -#include "include/gpu/GrTypes.h" - -/** - * Optional GL config file. - */ -#ifdef GR_GL_CUSTOM_SETUP_HEADER - #include GR_GL_CUSTOM_SETUP_HEADER -#endif - -#if !defined(GR_GL_FUNCTION_TYPE) - #if defined(SK_BUILD_FOR_WIN) - #define GR_GL_FUNCTION_TYPE __stdcall - #else - #define GR_GL_FUNCTION_TYPE - #endif -#endif - -/** - * The following are optional defines that can be enabled at the compiler - * command line, in a IDE project, in a GrUserConfig.h file, or in a GL custom - * file (if one is in use). If a GR_GL_CUSTOM_SETUP_HEADER is used they can - * also be placed there. - * - * GR_GL_LOG_CALLS: if 1 Gr can print every GL call using SkDebugf. Defaults to - * 0. Logging can be enabled and disabled at runtime using a debugger via to - * global gLogCallsGL. The initial value of gLogCallsGL is controlled by - * GR_GL_LOG_CALLS_START. - * - * GR_GL_LOG_CALLS_START: controls the initial value of gLogCallsGL when - * GR_GL_LOG_CALLS is 1. Defaults to 0. - * - * GR_GL_CHECK_ERROR: if enabled Gr can do a glGetError() after every GL call. - * Defaults to 1 if SK_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1 - * this can be toggled in a debugger using the gCheckErrorGL global. The initial - * value of gCheckErrorGL is controlled by by GR_GL_CHECK_ERROR_START. - * - * GR_GL_CHECK_ERROR_START: controls the initial value of gCheckErrorGL - * when GR_GL_CHECK_ERROR is 1. Defaults to 1. - * - */ - -#if !defined(GR_GL_LOG_CALLS) - #ifdef SK_DEBUG - #define GR_GL_LOG_CALLS 1 - #else - #define GR_GL_LOG_CALLS 0 - #endif -#endif - -#if !defined(GR_GL_LOG_CALLS_START) - #define GR_GL_LOG_CALLS_START 0 -#endif - -#if !defined(GR_GL_CHECK_ERROR) - #ifdef SK_DEBUG - #define GR_GL_CHECK_ERROR 1 - #else - #define GR_GL_CHECK_ERROR 0 - #endif -#endif - -#if !defined(GR_GL_CHECK_ERROR_START) - #define GR_GL_CHECK_ERROR_START 1 -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig_chrome.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig_chrome.h deleted file mode 100644 index 40127d17048c82..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLConfig_chrome.h +++ /dev/null @@ -1,14 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef GrGLConfig_chrome_DEFINED -#define GrGLConfig_chrome_DEFINED - -// glGetError() forces a sync with gpu process on chrome -#define GR_GL_CHECK_ERROR_START 0 - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLExtensions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLExtensions.h deleted file mode 100644 index 1e2823f71a95be..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLExtensions.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrGLExtensions_DEFINED -#define GrGLExtensions_DEFINED - -#include "include/core/SkString.h" -#include "include/gpu/gl/GrGLFunctions.h" -#include "include/private/SkTArray.h" - -#include - -struct GrGLInterface; -class SkJSONWriter; - -/** - * This helper queries the current GL context for its extensions, remembers them, and can be - * queried. It supports both glGetString- and glGetStringi-style extension string APIs and will - * use the latter if it is available. It also will query for EGL extensions if a eglQueryString - * implementation is provided. - */ -class SK_API GrGLExtensions { -public: - GrGLExtensions() {} - - GrGLExtensions(const GrGLExtensions&); - - GrGLExtensions& operator=(const GrGLExtensions&); - - void swap(GrGLExtensions* that) { - using std::swap; - swap(fStrings, that->fStrings); - swap(fInitialized, that->fInitialized); - } - - /** - * We sometimes need to use this class without having yet created a GrGLInterface. This version - * of init expects that getString is always non-NULL while getIntegerv and getStringi are non- - * NULL if on desktop GL with version 3.0 or higher. Otherwise it will fail. - */ - bool init(GrGLStandard standard, - GrGLFunction getString, - GrGLFunction getStringi, - GrGLFunction getIntegerv, - GrGLFunction queryString = nullptr, - GrEGLDisplay eglDisplay = nullptr); - - bool isInitialized() const { return fInitialized; } - - /** - * Queries whether an extension is present. This will fail if init() has not been called. - */ - bool has(const char[]) const; - - /** - * Removes an extension if present. Returns true if the extension was present before the call. - */ - bool remove(const char[]); - - /** - * Adds an extension to list - */ - void add(const char[]); - - void reset() { fStrings.reset(); } - - void dumpJSON(SkJSONWriter*) const; - -private: - bool fInitialized = false; - SkTArray fStrings; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLFunctions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLFunctions.h deleted file mode 100644 index 59b9cd9e18d555..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLFunctions.h +++ /dev/null @@ -1,307 +0,0 @@ - -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrGLFunctions_DEFINED -#define GrGLFunctions_DEFINED - -#include -#include "include/gpu/gl/GrGLTypes.h" -#include "include/private/SkTLogic.h" - - -extern "C" { - -/////////////////////////////////////////////////////////////////////////////// - -using GrGLActiveTextureFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum texture); -using GrGLAttachShaderFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLuint shader); -using GrGLBeginQueryFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLuint id); -using GrGLBindAttribLocationFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLuint index, const char* name); -using GrGLBindBufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLuint buffer); -using GrGLBindFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLuint framebuffer); -using GrGLBindRenderbufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLuint renderbuffer); -using GrGLBindTextureFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLuint texture); -using GrGLBindFragDataLocationFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLuint colorNumber, const GrGLchar* name); -using GrGLBindFragDataLocationIndexedFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLuint colorNumber, GrGLuint index, const GrGLchar* name); -using GrGLBindSamplerFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint unit, GrGLuint sampler); -using GrGLBindVertexArrayFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint array); -using GrGLBlendBarrierFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLBlendColorFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha); -using GrGLBlendEquationFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode); -using GrGLBlendFuncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum sfactor, GrGLenum dfactor); -using GrGLBlitFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint srcX0, GrGLint srcY0, GrGLint srcX1, GrGLint srcY1, GrGLint dstX0, GrGLint dstY0, GrGLint dstX1, GrGLint dstY1, GrGLbitfield mask, GrGLenum filter); -using GrGLBufferDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizeiptr size, const GrGLvoid* data, GrGLenum usage); -using GrGLBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLintptr offset, GrGLsizeiptr size, const GrGLvoid* data); -using GrGLCheckFramebufferStatusFn = GrGLenum GR_GL_FUNCTION_TYPE(GrGLenum target); -using GrGLClearFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLbitfield mask); -using GrGLClearColorFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLclampf red, GrGLclampf green, GrGLclampf blue, GrGLclampf alpha); -using GrGLClearStencilFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint s); -using GrGLClearTexImageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint texture, GrGLint level, GrGLenum format, GrGLenum type, const GrGLvoid* data); -using GrGLClearTexSubImageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth, GrGLenum format, GrGLenum type, const GrGLvoid* data); -using GrGLColorMaskFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLboolean red, GrGLboolean green, GrGLboolean blue, GrGLboolean alpha); -using GrGLCompileShaderFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader); -using GrGLCompressedTexImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLenum internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLsizei imageSize, const GrGLvoid* data); -using GrGLCompressedTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLsizei imageSize, const GrGLvoid* data); -using GrGLCopyBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum readTargt, GrGLenum writeTarget, GrGLintptr readOffset, GrGLintptr writeOffset, GrGLsizeiptr size); -using GrGLCopyTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); -using GrGLCreateProgramFn = GrGLuint GR_GL_FUNCTION_TYPE(); -using GrGLCreateShaderFn = GrGLuint GR_GL_FUNCTION_TYPE(GrGLenum type); -using GrGLCullFaceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode); -using GrGLDeleteBuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* buffers); -using GrGLDeleteFencesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* fences); -using GrGLDeleteFramebuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* framebuffers); -using GrGLDeleteProgramFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program); -using GrGLDeleteQueriesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* ids); -using GrGLDeleteRenderbuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* renderbuffers); -using GrGLDeleteSamplersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei count, const GrGLuint* samplers); -using GrGLDeleteShaderFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader); -using GrGLDeleteTexturesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* textures); -using GrGLDeleteVertexArraysFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLuint* arrays); -using GrGLDepthMaskFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLboolean flag); -using GrGLDisableFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum cap); -using GrGLDisableVertexAttribArrayFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint index); -using GrGLDrawArraysFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLint first, GrGLsizei count); -using GrGLDrawArraysInstancedFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei primcount); -using GrGLDrawArraysIndirectFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, const GrGLvoid* indirect); -using GrGLDrawBufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode); -using GrGLDrawBuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, const GrGLenum* bufs); -using GrGLDrawElementsFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices); -using GrGLDrawElementsInstancedFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLsizei count, GrGLenum type, const GrGLvoid* indices, GrGLsizei primcount); -using GrGLDrawElementsIndirectFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLenum type, const GrGLvoid* indirect); -using GrGLDrawRangeElementsFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLuint start, GrGLuint end, GrGLsizei count, GrGLenum type, const GrGLvoid* indices); -using GrGLEnableFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum cap); -using GrGLEnableVertexAttribArrayFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint index); -using GrGLEndQueryFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target); -using GrGLFinishFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLFinishFenceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint fence); -using GrGLFlushFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLFlushMappedBufferRangeFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length); -using GrGLFramebufferRenderbufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum attachment, GrGLenum renderbuffertarget, GrGLuint renderbuffer); -using GrGLFramebufferTexture2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level); -using GrGLFramebufferTexture2DMultisampleFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum attachment, GrGLenum textarget, GrGLuint texture, GrGLint level, GrGLsizei samples); -using GrGLFrontFaceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode); -using GrGLGenBuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* buffers); -using GrGLGenFencesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* fences); -using GrGLGenFramebuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* framebuffers); -using GrGLGenerateMipmapFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target); -using GrGLGenQueriesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* ids); -using GrGLGenRenderbuffersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* renderbuffers); -using GrGLGenSamplersFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei count, GrGLuint* samplers); -using GrGLGenTexturesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* textures); -using GrGLGenVertexArraysFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei n, GrGLuint* arrays); -using GrGLGetBufferParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLint* params); -using GrGLGetErrorFn = GrGLenum GR_GL_FUNCTION_TYPE(); -using GrGLGetFramebufferAttachmentParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum attachment, GrGLenum pname, GrGLint* params); -using GrGLGetFloatvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLfloat* params); -using GrGLGetIntegervFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLint* params); -using GrGLGetMultisamplefvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLuint index, GrGLfloat* val); -using GrGLGetProgramBinaryFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, GrGLenum* binaryFormat, void* binary); -using GrGLGetProgramInfoLogFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLsizei bufsize, GrGLsizei* length, char* infolog); -using GrGLGetProgramivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLenum pname, GrGLint* params); -using GrGLGetQueryivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum GLtarget, GrGLenum pname, GrGLint* params); -using GrGLGetQueryObjecti64vFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLint64* params); -using GrGLGetQueryObjectivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLint* params); -using GrGLGetQueryObjectui64vFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLuint64* params); -using GrGLGetQueryObjectuivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum pname, GrGLuint* params); -using GrGLGetRenderbufferParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLint* params); -using GrGLGetShaderInfoLogFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader, GrGLsizei bufsize, GrGLsizei* length, char* infolog); -using GrGLGetShaderivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader, GrGLenum pname, GrGLint* params); -using GrGLGetShaderPrecisionFormatFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum shadertype, GrGLenum precisiontype, GrGLint* range, GrGLint* precision); -using GrGLGetStringFn = const GrGLubyte* GR_GL_FUNCTION_TYPE(GrGLenum name); -using GrGLGetStringiFn = const GrGLubyte* GR_GL_FUNCTION_TYPE(GrGLenum name, GrGLuint index); -using GrGLGetTexLevelParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLenum pname, GrGLint* params); -using GrGLGetUniformLocationFn = GrGLint GR_GL_FUNCTION_TYPE(GrGLuint program, const char* name); -using GrGLInsertEventMarkerFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei length, const char* marker); -using GrGLInvalidateBufferDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint buffer); -using GrGLInvalidateBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr length); -using GrGLInvalidateFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments); -using GrGLInvalidateSubFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments, GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); -using GrGLInvalidateTexImageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint texture, GrGLint level); -using GrGLInvalidateTexSubImageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint texture, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLint zoffset, GrGLsizei width, GrGLsizei height, GrGLsizei depth); -using GrGLIsTextureFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLuint texture); -using GrGLLineWidthFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLfloat width); -using GrGLLinkProgramFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program); -using GrGLMapBufferFn = GrGLvoid* GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum access); -using GrGLMapBufferRangeFn = GrGLvoid* GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLintptr offset, GrGLsizeiptr length, GrGLbitfield access); -using GrGLMapBufferSubDataFn = GrGLvoid* GR_GL_FUNCTION_TYPE(GrGLuint target, GrGLintptr offset, GrGLsizeiptr size, GrGLenum access); -using GrGLMapTexSubImage2DFn = GrGLvoid* GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLenum access); -using GrGLMemoryBarrierFn = GrGLvoid* GR_GL_FUNCTION_TYPE(GrGLbitfield barriers); -using GrGLPatchParameteriFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLint value); -using GrGLPixelStoreiFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum pname, GrGLint param); -using GrGLPolygonModeFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum face, GrGLenum mode); -using GrGLPopGroupMarkerFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLProgramBinaryFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLenum binaryFormat, void* binary, GrGLsizei length); -using GrGLProgramParameteriFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLenum pname, GrGLint value); -using GrGLPushGroupMarkerFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsizei length, const char* marker); -using GrGLQueryCounterFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint id, GrGLenum target); -using GrGLReadBufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum src); -using GrGLReadPixelsFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, GrGLvoid* pixels); -using GrGLRenderbufferStorageFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); -using GrGLRenderbufferStorageMultisampleFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei samples, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); -using GrGLResolveMultisampleFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLSamplerParameterfFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, GrGLfloat param); -using GrGLSamplerParameteriFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, GrGLint param); -using GrGLSamplerParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint sampler, GrGLenum pname, const GrGLint* params); -using GrGLScissorFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); -// GL_CHROMIUM_bind_uniform_location -using GrGLBindUniformLocationFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program, GrGLint location, const char* name); -using GrGLSetFenceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint fence, GrGLenum condition); -using GrGLShaderSourceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint shader, GrGLsizei count, const char* const* str, const GrGLint* length); -using GrGLStencilFuncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum func, GrGLint ref, GrGLuint mask); -using GrGLStencilFuncSeparateFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum face, GrGLenum func, GrGLint ref, GrGLuint mask); -using GrGLStencilMaskFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint mask); -using GrGLStencilMaskSeparateFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum face, GrGLuint mask); -using GrGLStencilOpFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum fail, GrGLenum zfail, GrGLenum zpass); -using GrGLStencilOpSeparateFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum face, GrGLenum fail, GrGLenum zfail, GrGLenum zpass); -using GrGLTexBufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum internalformat, GrGLuint buffer); -using GrGLTexBufferRangeFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum internalformat, GrGLuint buffer, GrGLintptr offset, GrGLsizeiptr size); -using GrGLTexImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint internalformat, GrGLsizei width, GrGLsizei height, GrGLint border, GrGLenum format, GrGLenum type, const GrGLvoid* pixels); -using GrGLTexParameterfFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLfloat param); -using GrGLTexParameterfvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, const GrGLfloat* params); -using GrGLTexParameteriFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, GrGLint param); -using GrGLTexParameterivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum pname, const GrGLint* params); -using GrGLTexStorage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei levels, GrGLenum internalformat, GrGLsizei width, GrGLsizei height); -using GrGLDiscardFramebufferFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLsizei numAttachments, const GrGLenum* attachments); -using GrGLTestFenceFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLuint fence); -using GrGLTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLint level, GrGLint xoffset, GrGLint yoffset, GrGLsizei width, GrGLsizei height, GrGLenum format, GrGLenum type, const GrGLvoid* pixels); -using GrGLTextureBarrierFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLUniform1fFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLfloat v0); -using GrGLUniform1iFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLint v0); -using GrGLUniform1fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLfloat* v); -using GrGLUniform1ivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLint* v); -using GrGLUniform2fFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLfloat v0, GrGLfloat v1); -using GrGLUniform2iFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLint v0, GrGLint v1); -using GrGLUniform2fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLfloat* v); -using GrGLUniform2ivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLint* v); -using GrGLUniform3fFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2); -using GrGLUniform3iFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2); -using GrGLUniform3fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLfloat* v); -using GrGLUniform3ivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLint* v); -using GrGLUniform4fFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLfloat v0, GrGLfloat v1, GrGLfloat v2, GrGLfloat v3); -using GrGLUniform4iFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLint v0, GrGLint v1, GrGLint v2, GrGLint v3); -using GrGLUniform4fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLfloat* v); -using GrGLUniform4ivFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, const GrGLint* v); -using GrGLUniformMatrix2fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); -using GrGLUniformMatrix3fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); -using GrGLUniformMatrix4fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint location, GrGLsizei count, GrGLboolean transpose, const GrGLfloat* value); -using GrGLUnmapBufferFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLenum target); -using GrGLUnmapBufferSubDataFn = GrGLvoid GR_GL_FUNCTION_TYPE(const GrGLvoid* mem); -using GrGLUnmapTexSubImage2DFn = GrGLvoid GR_GL_FUNCTION_TYPE(const GrGLvoid* mem); -using GrGLUseProgramFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint program); -using GrGLVertexAttrib1fFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, const GrGLfloat value); -using GrGLVertexAttrib2fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, const GrGLfloat* values); -using GrGLVertexAttrib3fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, const GrGLfloat* values); -using GrGLVertexAttrib4fvFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, const GrGLfloat* values); -using GrGLVertexAttribDivisorFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint index, GrGLuint divisor); -using GrGLVertexAttribIPointerFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, GrGLint size, GrGLenum type, GrGLsizei stride, const GrGLvoid* ptr); -using GrGLVertexAttribPointerFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint indx, GrGLint size, GrGLenum type, GrGLboolean normalized, GrGLsizei stride, const GrGLvoid* ptr); -using GrGLViewportFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLint x, GrGLint y, GrGLsizei width, GrGLsizei height); - -/* GL_NV_framebuffer_mixed_samples */ -using GrGLCoverageModulationFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum components); - -/* EXT_base_instance */ -using GrGLDrawArraysInstancedBaseInstanceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLint first, GrGLsizei count, GrGLsizei instancecount, GrGLuint baseinstance); -using GrGLDrawElementsInstancedBaseVertexBaseInstanceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLsizei count, GrGLenum type, const void *indices, GrGLsizei instancecount, GrGLint basevertex, GrGLuint baseinstance); - -/* EXT_multi_draw_indirect */ -using GrGLMultiDrawArraysIndirectFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, const GrGLvoid* indirect, GrGLsizei drawcount, GrGLsizei stride); -using GrGLMultiDrawElementsIndirectFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLenum type, const GrGLvoid* indirect, GrGLsizei drawcount, GrGLsizei stride); - -/* ANGLE_base_vertex_base_instance */ -using GrGLMultiDrawArraysInstancedBaseInstanceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, const GrGLint* firsts, const GrGLsizei* counts, const GrGLsizei* instanceCounts, const GrGLuint* baseInstances, const GrGLsizei drawcount); -using GrGLMultiDrawElementsInstancedBaseVertexBaseInstanceFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, const GrGLint* counts, GrGLenum type, const GrGLvoid* const* indices, const GrGLsizei* instanceCounts, const GrGLint* baseVertices, const GrGLuint* baseInstances, const GrGLsizei drawcount); - -/* ARB_sync */ -using GrGLFenceSyncFn = GrGLsync GR_GL_FUNCTION_TYPE(GrGLenum condition, GrGLbitfield flags); -using GrGLIsSyncFn = GrGLboolean GR_GL_FUNCTION_TYPE(GrGLsync sync); -using GrGLClientWaitSyncFn = GrGLenum GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout); -using GrGLWaitSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync, GrGLbitfield flags, GrGLuint64 timeout); -using GrGLDeleteSyncFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLsync sync); - -/* ARB_internalformat_query */ -using GrGLGetInternalformativFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum target, GrGLenum internalformat, GrGLenum pname, GrGLsizei bufSize, GrGLint* params); - -/* KHR_debug */ -using GrGLDebugMessageControlFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum source, GrGLenum type, GrGLenum severity, GrGLsizei count, const GrGLuint* ids, GrGLboolean enabled); -using GrGLDebugMessageInsertFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum source, GrGLenum type, GrGLuint id, GrGLenum severity, GrGLsizei length, const GrGLchar* buf); -using GrGLDebugMessageCallbackFn = GrGLvoid GR_GL_FUNCTION_TYPE(GRGLDEBUGPROC callback, const GrGLvoid* userParam); -using GrGLGetDebugMessageLogFn = GrGLuint GR_GL_FUNCTION_TYPE(GrGLuint count, GrGLsizei bufSize, GrGLenum* sources, GrGLenum* types, GrGLuint* ids, GrGLenum* severities, GrGLsizei* lengths, GrGLchar* messageLog); -using GrGLPushDebugGroupFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum source, GrGLuint id, GrGLsizei length, const GrGLchar* message); -using GrGLPopDebugGroupFn = GrGLvoid GR_GL_FUNCTION_TYPE(); -using GrGLObjectLabelFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum identifier, GrGLuint name, GrGLsizei length, const GrGLchar* label); - -/** EXT_window_rectangles */ -using GrGLWindowRectanglesFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLenum mode, GrGLsizei count, const GrGLint box[]); - -/** GL_QCOM_tiled_rendering */ -using GrGLStartTilingFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLuint x, GrGLuint y, GrGLuint width, GrGLuint height, GrGLbitfield preserveMask); -using GrGLEndTilingFn = GrGLvoid GR_GL_FUNCTION_TYPE(GrGLbitfield preserveMask); - -/** EGL functions */ -using GrEGLQueryStringFn = const char* GR_GL_FUNCTION_TYPE(GrEGLDisplay dpy, GrEGLint name); -using GrEGLGetCurrentDisplayFn = GrEGLDisplay GR_GL_FUNCTION_TYPE(); -using GrEGLCreateImageFn = GrEGLImage GR_GL_FUNCTION_TYPE(GrEGLDisplay dpy, GrEGLContext ctx, GrEGLenum target, GrEGLClientBuffer buffer, const GrEGLint* attrib_list); -using GrEGLDestroyImageFn = GrEGLBoolean GR_GL_FUNCTION_TYPE(GrEGLDisplay dpy, GrEGLImage image); -} // extern "C" - -// This is a lighter-weight std::function, trying to reduce code size and compile time -// by only supporting the exact use cases we require. -template class GrGLFunction; - -template -class GrGLFunction { -public: - using Fn = R GR_GL_FUNCTION_TYPE(Args...); - // Construct empty. - GrGLFunction() = default; - GrGLFunction(std::nullptr_t) {} - - // Construct from a simple function pointer. - GrGLFunction(Fn* fn_ptr) { - static_assert(sizeof(fn_ptr) <= sizeof(fBuf), "fBuf is too small"); - if (fn_ptr) { - memcpy(fBuf, &fn_ptr, sizeof(fn_ptr)); - fCall = [](const void* buf, Args... args) { - return (*(Fn**)buf)(std::forward(args)...); - }; - } - } - - // Construct from a small closure. - template - GrGLFunction(Closure closure) : GrGLFunction() { - static_assert(sizeof(Closure) <= sizeof(fBuf), "fBuf is too small"); -#if defined(__APPLE__) // I am having serious trouble getting these to work with all STLs... - static_assert(std::is_trivially_copyable::value, ""); - static_assert(std::is_trivially_destructible::value, ""); -#endif - - memcpy(fBuf, &closure, sizeof(closure)); - fCall = [](const void* buf, Args... args) { - auto closure = (const Closure*)buf; - return (*closure)(args...); - }; - } - - R operator()(Args... args) const { - SkASSERT(fCall); - return fCall(fBuf, std::forward(args)...); - } - - explicit operator bool() const { return fCall != nullptr; } - - void reset() { fCall = nullptr; } - -private: - using Call = R(const void* buf, Args...); - Call* fCall = nullptr; - size_t fBuf[4]; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLInterface.h deleted file mode 100644 index 5d6e3bb2d5f3de..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLInterface.h +++ /dev/null @@ -1,343 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrGLInterface_DEFINED -#define GrGLInterface_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/gl/GrGLExtensions.h" -#include "include/gpu/gl/GrGLFunctions.h" - -//////////////////////////////////////////////////////////////////////////////// - -typedef void(*GrGLFuncPtr)(); -struct GrGLInterface; - - -/** - * Rather than depend on platform-specific GL headers and libraries, we require - * the client to provide a struct of GL function pointers. This struct can be - * specified per-GrContext as a parameter to GrContext::MakeGL. If no interface is - * passed to MakeGL then a default GL interface is created using GrGLMakeNativeInterface(). - * If this returns nullptr then GrContext::MakeGL() will fail. - * - * The implementation of GrGLMakeNativeInterface is platform-specific. Several - * implementations have been provided (for GLX, WGL, EGL, etc), along with an - * implementation that simply returns nullptr. Clients should select the most - * appropriate one to build. - */ -SK_API sk_sp GrGLMakeNativeInterface(); - -/** - * GrContext uses the following interface to make all calls into OpenGL. When a - * GrContext is created it is given a GrGLInterface. The interface's function - * pointers must be valid for the OpenGL context associated with the GrContext. - * On some platforms, such as Windows, function pointers for OpenGL extensions - * may vary between OpenGL contexts. So the caller must be careful to use a - * GrGLInterface initialized for the correct context. All functions that should - * be available based on the OpenGL's version and extension string must be - * non-NULL or GrContext creation will fail. This can be tested with the - * validate() method when the OpenGL context has been made current. - */ -struct SK_API GrGLInterface : public SkRefCnt { -private: - using INHERITED = SkRefCnt; - -#if GR_GL_CHECK_ERROR - // This is here to avoid having our debug code that checks for a GL error after most GL calls - // accidentally swallow an OOM that should be reported. - mutable bool fOOMed = false; - bool fSuppressErrorLogging = false; -#endif - -public: - GrGLInterface(); - - // Validates that the GrGLInterface supports its advertised standard. This means the necessary - // function pointers have been initialized for both the GL version and any advertised - // extensions. - bool validate() const; - -#if GR_GL_CHECK_ERROR - GrGLenum checkError(const char* location, const char* call) const; - bool checkAndResetOOMed() const; - void suppressErrorLogging(); -#endif - -#if GR_TEST_UTILS - GrGLInterface(const GrGLInterface& that) - : fStandard(that.fStandard) - , fExtensions(that.fExtensions) - , fFunctions(that.fFunctions) {} -#endif - - // Indicates the type of GL implementation - union { - GrGLStandard fStandard; - GrGLStandard fBindingsExported; // Legacy name, will be remove when Chromium is updated. - }; - - GrGLExtensions fExtensions; - - bool hasExtension(const char ext[]) const { return fExtensions.has(ext); } - - /** - * The function pointers are in a struct so that we can have a compiler generated assignment - * operator. - */ - struct Functions { - GrGLFunction fActiveTexture; - GrGLFunction fAttachShader; - GrGLFunction fBeginQuery; - GrGLFunction fBindAttribLocation; - GrGLFunction fBindBuffer; - GrGLFunction fBindFragDataLocation; - GrGLFunction fBindFragDataLocationIndexed; - GrGLFunction fBindFramebuffer; - GrGLFunction fBindRenderbuffer; - GrGLFunction fBindSampler; - GrGLFunction fBindTexture; - GrGLFunction fBindVertexArray; - GrGLFunction fBlendBarrier; - GrGLFunction fBlendColor; - GrGLFunction fBlendEquation; - GrGLFunction fBlendFunc; - GrGLFunction fBlitFramebuffer; - GrGLFunction fBufferData; - GrGLFunction fBufferSubData; - GrGLFunction fCheckFramebufferStatus; - GrGLFunction fClear; - GrGLFunction fClearColor; - GrGLFunction fClearStencil; - GrGLFunction fClearTexImage; - GrGLFunction fClearTexSubImage; - GrGLFunction fColorMask; - GrGLFunction fCompileShader; - GrGLFunction fCompressedTexImage2D; - GrGLFunction fCompressedTexSubImage2D; - GrGLFunction fCopyBufferSubData; - GrGLFunction fCopyTexSubImage2D; - GrGLFunction fCreateProgram; - GrGLFunction fCreateShader; - GrGLFunction fCullFace; - GrGLFunction fDeleteBuffers; - GrGLFunction fDeleteFences; - GrGLFunction fDeleteFramebuffers; - GrGLFunction fDeleteProgram; - GrGLFunction fDeleteQueries; - GrGLFunction fDeleteRenderbuffers; - GrGLFunction fDeleteSamplers; - GrGLFunction fDeleteShader; - GrGLFunction fDeleteTextures; - GrGLFunction fDeleteVertexArrays; - GrGLFunction fDepthMask; - GrGLFunction fDisable; - GrGLFunction fDisableVertexAttribArray; - GrGLFunction fDrawArrays; - GrGLFunction fDrawArraysIndirect; - GrGLFunction fDrawArraysInstanced; - GrGLFunction fDrawBuffer; - GrGLFunction fDrawBuffers; - GrGLFunction fDrawElements; - GrGLFunction fDrawElementsIndirect; - GrGLFunction fDrawElementsInstanced; - GrGLFunction fDrawRangeElements; - GrGLFunction fEnable; - GrGLFunction fEnableVertexAttribArray; - GrGLFunction fEndQuery; - GrGLFunction fFinish; - GrGLFunction fFinishFence; - GrGLFunction fFlush; - GrGLFunction fFlushMappedBufferRange; - GrGLFunction fFramebufferRenderbuffer; - GrGLFunction fFramebufferTexture2D; - GrGLFunction fFramebufferTexture2DMultisample; - GrGLFunction fFrontFace; - GrGLFunction fGenBuffers; - GrGLFunction fGenFences; - GrGLFunction fGenFramebuffers; - GrGLFunction fGenerateMipmap; - GrGLFunction fGenQueries; - GrGLFunction fGenRenderbuffers; - GrGLFunction fGenSamplers; - GrGLFunction fGenTextures; - GrGLFunction fGenVertexArrays; - GrGLFunction fGetBufferParameteriv; - GrGLFunction fGetError; - GrGLFunction fGetFramebufferAttachmentParameteriv; - GrGLFunction fGetFloatv; - GrGLFunction fGetIntegerv; - GrGLFunction fGetMultisamplefv; - GrGLFunction fGetProgramBinary; - GrGLFunction fGetProgramInfoLog; - GrGLFunction fGetProgramiv; - GrGLFunction fGetQueryObjecti64v; - GrGLFunction fGetQueryObjectiv; - GrGLFunction fGetQueryObjectui64v; - GrGLFunction fGetQueryObjectuiv; - GrGLFunction fGetQueryiv; - GrGLFunction fGetRenderbufferParameteriv; - GrGLFunction fGetShaderInfoLog; - GrGLFunction fGetShaderiv; - GrGLFunction fGetShaderPrecisionFormat; - GrGLFunction fGetString; - GrGLFunction fGetStringi; - GrGLFunction fGetTexLevelParameteriv; - GrGLFunction fGetUniformLocation; - GrGLFunction fInsertEventMarker; - GrGLFunction fInvalidateBufferData; - GrGLFunction fInvalidateBufferSubData; - GrGLFunction fInvalidateFramebuffer; - GrGLFunction fInvalidateSubFramebuffer; - GrGLFunction fInvalidateTexImage; - GrGLFunction fInvalidateTexSubImage; - GrGLFunction fIsTexture; - GrGLFunction fLineWidth; - GrGLFunction fLinkProgram; - GrGLFunction fProgramBinary; - GrGLFunction fProgramParameteri; - GrGLFunction fMapBuffer; - GrGLFunction fMapBufferRange; - GrGLFunction fMapBufferSubData; - GrGLFunction fMapTexSubImage2D; - GrGLFunction fMemoryBarrier; - GrGLFunction fDrawArraysInstancedBaseInstance; - GrGLFunction fDrawElementsInstancedBaseVertexBaseInstance; - GrGLFunction fMultiDrawArraysIndirect; - GrGLFunction fMultiDrawElementsIndirect; - GrGLFunction fMultiDrawArraysInstancedBaseInstance; - GrGLFunction fMultiDrawElementsInstancedBaseVertexBaseInstance; - GrGLFunction fPatchParameteri; - GrGLFunction fPixelStorei; - GrGLFunction fPolygonMode; - GrGLFunction fPopGroupMarker; - GrGLFunction fPushGroupMarker; - GrGLFunction fQueryCounter; - GrGLFunction fReadBuffer; - GrGLFunction fReadPixels; - GrGLFunction fRenderbufferStorage; - - // On OpenGL ES there are multiple incompatible extensions that add support for MSAA - // and ES3 adds MSAA support to the standard. On an ES3 driver we may still use the - // older extensions for performance reasons or due to ES3 driver bugs. We want the function - // that creates the GrGLInterface to provide all available functions and internally - // we will select among them. They all have a method called glRenderbufferStorageMultisample*. - // So we have separate function pointers for GL_IMG/EXT_multisampled_to_texture, - // GL_CHROMIUM/ANGLE_framebuffer_multisample/ES3, and GL_APPLE_framebuffer_multisample - // variations. - // - // If a driver supports multiple GL_ARB_framebuffer_multisample-style extensions then we will - // assume the function pointers for the standard (or equivalent GL_ARB) version have - // been preferred over GL_EXT, GL_CHROMIUM, or GL_ANGLE variations that have reduced - // functionality. - - // GL_EXT_multisampled_render_to_texture (preferred) or GL_IMG_multisampled_render_to_texture - GrGLFunction fRenderbufferStorageMultisampleES2EXT; - // GL_APPLE_framebuffer_multisample - GrGLFunction fRenderbufferStorageMultisampleES2APPLE; - - // This is used to store the pointer for GL_ARB/EXT/ANGLE/CHROMIUM_framebuffer_multisample or - // the standard function in ES3+ or GL 3.0+. - GrGLFunction fRenderbufferStorageMultisample; - - // Pointer to BindUniformLocationCHROMIUM from the GL_CHROMIUM_bind_uniform_location extension. - GrGLFunction fBindUniformLocation; - - GrGLFunction fResolveMultisampleFramebuffer; - GrGLFunction fSamplerParameterf; - GrGLFunction fSamplerParameteri; - GrGLFunction fSamplerParameteriv; - GrGLFunction fScissor; - GrGLFunction fSetFence; - GrGLFunction fShaderSource; - GrGLFunction fStencilFunc; - GrGLFunction fStencilFuncSeparate; - GrGLFunction fStencilMask; - GrGLFunction fStencilMaskSeparate; - GrGLFunction fStencilOp; - GrGLFunction fStencilOpSeparate; - GrGLFunction fTestFence; - GrGLFunction fTexBuffer; - GrGLFunction fTexBufferRange; - GrGLFunction fTexImage2D; - GrGLFunction fTexParameterf; - GrGLFunction fTexParameterfv; - GrGLFunction fTexParameteri; - GrGLFunction fTexParameteriv; - GrGLFunction fTexSubImage2D; - GrGLFunction fTexStorage2D; - GrGLFunction fTextureBarrier; - GrGLFunction fDiscardFramebuffer; - GrGLFunction fUniform1f; - GrGLFunction fUniform1i; - GrGLFunction fUniform1fv; - GrGLFunction fUniform1iv; - GrGLFunction fUniform2f; - GrGLFunction fUniform2i; - GrGLFunction fUniform2fv; - GrGLFunction fUniform2iv; - GrGLFunction fUniform3f; - GrGLFunction fUniform3i; - GrGLFunction fUniform3fv; - GrGLFunction fUniform3iv; - GrGLFunction fUniform4f; - GrGLFunction fUniform4i; - GrGLFunction fUniform4fv; - GrGLFunction fUniform4iv; - GrGLFunction fUniformMatrix2fv; - GrGLFunction fUniformMatrix3fv; - GrGLFunction fUniformMatrix4fv; - GrGLFunction fUnmapBuffer; - GrGLFunction fUnmapBufferSubData; - GrGLFunction fUnmapTexSubImage2D; - GrGLFunction fUseProgram; - GrGLFunction fVertexAttrib1f; - GrGLFunction fVertexAttrib2fv; - GrGLFunction fVertexAttrib3fv; - GrGLFunction fVertexAttrib4fv; - GrGLFunction fVertexAttribDivisor; - GrGLFunction fVertexAttribIPointer; - GrGLFunction fVertexAttribPointer; - GrGLFunction fViewport; - - /* NV_framebuffer_mixed_samples */ - GrGLFunction fCoverageModulation; - - /* ARB_sync */ - GrGLFunction fFenceSync; - GrGLFunction fIsSync; - GrGLFunction fClientWaitSync; - GrGLFunction fWaitSync; - GrGLFunction fDeleteSync; - - /* ARB_internalforamt_query */ - GrGLFunction fGetInternalformativ; - - /* KHR_debug */ - GrGLFunction fDebugMessageControl; - GrGLFunction fDebugMessageInsert; - GrGLFunction fDebugMessageCallback; - GrGLFunction fGetDebugMessageLog; - GrGLFunction fPushDebugGroup; - GrGLFunction fPopDebugGroup; - GrGLFunction fObjectLabel; - - /* EXT_window_rectangles */ - GrGLFunction fWindowRectangles; - - /* GL_QCOM_tiled_rendering */ - GrGLFunction fStartTiling; - GrGLFunction fEndTiling; - } fFunctions; - -#if GR_TEST_UTILS - // This exists for internal testing. - virtual void abandon() const; -#endif -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLTypes.h deleted file mode 100644 index d5167787c1e05b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/GrGLTypes.h +++ /dev/null @@ -1,207 +0,0 @@ - -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrGLTypes_DEFINED -#define GrGLTypes_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/gl/GrGLConfig.h" - -/** - * Classifies GL contexts by which standard they implement (currently as OpenGL vs. OpenGL ES). - */ -enum GrGLStandard { - kNone_GrGLStandard, - kGL_GrGLStandard, - kGLES_GrGLStandard, - kWebGL_GrGLStandard, -}; -static const int kGrGLStandardCnt = 4; - -// The following allow certain interfaces to be turned off at compile time -// (for example, to lower code size). -#if SK_ASSUME_GL_ES - #define GR_IS_GR_GL(standard) false - #define GR_IS_GR_GL_ES(standard) true - #define GR_IS_GR_WEBGL(standard) false - #define SK_DISABLE_GL_INTERFACE 1 - #define SK_DISABLE_WEBGL_INTERFACE 1 -#elif SK_ASSUME_GL - #define GR_IS_GR_GL(standard) true - #define GR_IS_GR_GL_ES(standard) false - #define GR_IS_GR_WEBGL(standard) false - #define SK_DISABLE_GL_ES_INTERFACE 1 - #define SK_DISABLE_WEBGL_INTERFACE 1 -#elif SK_ASSUME_WEBGL - #define GR_IS_GR_GL(standard) false - #define GR_IS_GR_GL_ES(standard) false - #define GR_IS_GR_WEBGL(standard) true - #define SK_DISABLE_GL_ES_INTERFACE 1 - #define SK_DISABLE_GL_INTERFACE 1 -#else - #define GR_IS_GR_GL(standard) (kGL_GrGLStandard == standard) - #define GR_IS_GR_GL_ES(standard) (kGLES_GrGLStandard == standard) - #define GR_IS_GR_WEBGL(standard) (kWebGL_GrGLStandard == standard) -#endif - -/////////////////////////////////////////////////////////////////////////////// - -/** - * The supported GL formats represented as an enum. Actual support by GrContext depends on GL - * context version and extensions. - */ -enum class GrGLFormat { - kUnknown, - - kRGBA8, - kR8, - kALPHA8, - kLUMINANCE8, - kLUMINANCE8_ALPHA8, - kBGRA8, - kRGB565, - kRGBA16F, - kR16F, - kRGB8, - kRGBX8, - kRG8, - kRGB10_A2, - kRGBA4, - kSRGB8_ALPHA8, - kCOMPRESSED_ETC1_RGB8, - kCOMPRESSED_RGB8_ETC2, - kCOMPRESSED_RGB8_BC1, - kCOMPRESSED_RGBA8_BC1, - kR16, - kRG16, - kRGBA16, - kRG16F, - kLUMINANCE16F, - - kLastColorFormat = kLUMINANCE16F, - - // Depth/Stencil formats - kSTENCIL_INDEX8, - kSTENCIL_INDEX16, - kDEPTH24_STENCIL8, - - kLast = kDEPTH24_STENCIL8 -}; - -/////////////////////////////////////////////////////////////////////////////// -/** - * Declares typedefs for all the GL functions used in GrGLInterface - */ - -typedef unsigned int GrGLenum; -typedef unsigned char GrGLboolean; -typedef unsigned int GrGLbitfield; -typedef signed char GrGLbyte; -typedef char GrGLchar; -typedef short GrGLshort; -typedef int GrGLint; -typedef int GrGLsizei; -typedef int64_t GrGLint64; -typedef unsigned char GrGLubyte; -typedef unsigned short GrGLushort; -typedef unsigned int GrGLuint; -typedef uint64_t GrGLuint64; -typedef unsigned short int GrGLhalf; -typedef float GrGLfloat; -typedef float GrGLclampf; -typedef double GrGLdouble; -typedef double GrGLclampd; -typedef void GrGLvoid; -#ifdef _WIN64 -typedef signed long long int GrGLintptr; -typedef signed long long int GrGLsizeiptr; -#else -typedef signed long int GrGLintptr; -typedef signed long int GrGLsizeiptr; -#endif -typedef void* GrGLeglImage; -typedef struct __GLsync* GrGLsync; - -struct GrGLDrawArraysIndirectCommand { - GrGLuint fCount; - GrGLuint fInstanceCount; - GrGLuint fFirst; - GrGLuint fBaseInstance; // Requires EXT_base_instance on ES. -}; - -// static_asserts must have messages in this file because its included in C++14 client code. -static_assert(16 == sizeof(GrGLDrawArraysIndirectCommand), ""); - -struct GrGLDrawElementsIndirectCommand { - GrGLuint fCount; - GrGLuint fInstanceCount; - GrGLuint fFirstIndex; - GrGLuint fBaseVertex; - GrGLuint fBaseInstance; // Requires EXT_base_instance on ES. -}; - -static_assert(20 == sizeof(GrGLDrawElementsIndirectCommand), ""); - -/** - * KHR_debug - */ -typedef void (GR_GL_FUNCTION_TYPE* GRGLDEBUGPROC)(GrGLenum source, - GrGLenum type, - GrGLuint id, - GrGLenum severity, - GrGLsizei length, - const GrGLchar* message, - const void* userParam); - -/** - * EGL types. - */ -typedef void* GrEGLImage; -typedef void* GrEGLDisplay; -typedef void* GrEGLContext; -typedef void* GrEGLClientBuffer; -typedef unsigned int GrEGLenum; -typedef int32_t GrEGLint; -typedef unsigned int GrEGLBoolean; - -/////////////////////////////////////////////////////////////////////////////// -/** - * Types for interacting with GL resources created externally to Skia. GrBackendObjects for GL - * textures are really const GrGLTexture*. The fFormat here should be a sized, internal format - * for the texture. We will try to use the sized format if the GL Context supports it, otherwise - * we will internally fall back to using the base internal formats. - */ -struct GrGLTextureInfo { - GrGLenum fTarget; - GrGLuint fID; - GrGLenum fFormat = 0; - - bool operator==(const GrGLTextureInfo& that) const { - return fTarget == that.fTarget && fID == that.fID && fFormat == that.fFormat; - } -}; - -struct GrGLFramebufferInfo { - GrGLuint fFBOID; - GrGLenum fFormat = 0; - - bool operator==(const GrGLFramebufferInfo& that) const { - return fFBOID == that.fFBOID && fFormat == that.fFormat; - } -}; - -struct GrGLSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - GrGLenum fTarget = 0; - GrGLenum fFormat = 0; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/egl/GrGLMakeEGLInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/egl/GrGLMakeEGLInterface.h deleted file mode 100644 index a3eb420b040a86..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/egl/GrGLMakeEGLInterface.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/gpu/GrTypes.h" - -#include "include/core/SkRefCnt.h" - -struct GrGLInterface; - -sk_sp GrGLMakeEGLInterface(); diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h deleted file mode 100644 index b49cde4589aead..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/gl/glx/GrGLMakeGLXInterface.h +++ /dev/null @@ -1,14 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/gpu/GrTypes.h" - -#include "include/core/SkRefCnt.h" - -struct GrGLInterface; - -sk_sp GrGLMakeGLXInterface(); diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/BackendTexture.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/BackendTexture.h deleted file mode 100644 index f12d22ebb4f04b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/BackendTexture.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_BackendTexture_DEFINED -#define skgpu_graphite_BackendTexture_DEFINED - -#include "include/core/SkSize.h" -#include "include/gpu/graphite/GraphiteTypes.h" -#include "include/gpu/graphite/TextureInfo.h" - -#ifdef SK_METAL -#include "include/gpu/graphite/mtl/MtlTypes.h" -#endif - -#ifdef SK_VULKAN -#include "include/private/gpu/vk/SkiaVulkan.h" -#endif - -namespace skgpu::graphite { - -class BackendTexture { -public: - BackendTexture() {} -#ifdef SK_METAL - // The BackendTexture will not call retain or release on the passed in MtlHandle. Thus the - // client must keep the MtlHandle valid until they are no longer using the BackendTexture. - BackendTexture(SkISize dimensions, MtlHandle mtlTexture); -#endif - - BackendTexture(const BackendTexture&); - - ~BackendTexture(); - - BackendTexture& operator=(const BackendTexture&); - - bool operator==(const BackendTexture&) const; - bool operator!=(const BackendTexture& that) const { return !(*this == that); } - - bool isValid() const { return fInfo.isValid(); } - BackendApi backend() const { return fInfo.backend(); } - - SkISize dimensions() const { return fDimensions; } - - const TextureInfo& info() const { return fInfo; } - -#ifdef SK_METAL - MtlHandle getMtlTexture() const; -#endif - -private: - SkISize fDimensions; - TextureInfo fInfo; - - union { -#ifdef SK_METAL - MtlHandle fMtlTexture; -#endif -#ifdef SK_VULKAN - VkImage fVkImage; -#endif - }; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_BackendTexture_DEFINED - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/CombinationBuilder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/CombinationBuilder.h deleted file mode 100644 index a0c977b283bf58..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/CombinationBuilder.h +++ /dev/null @@ -1,195 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_CombinationBuilder_DEFINED -#define skgpu_graphite_CombinationBuilder_DEFINED - -#include "include/core/SkTypes.h" - -#ifdef SK_ENABLE_PRECOMPILE - -#include -#include -#include -#include "include/core/SkBlendMode.h" -#include "include/core/SkSpan.h" -#include "include/core/SkTileMode.h" -#include "include/private/SkTArray.h" -#include "include/private/SkTHash.h" - -class SkArenaAllocWithReset; -class SkKeyContext; -class SkPaintParamsKeyBuilder; -class SkShaderCodeDictionary; -class SkUniquePaintParamsID; - -namespace skgpu::graphite { - -class CombinationBuilder; -class CombinationBuilderTestAccess; -class Context; -class Option; - -enum class ShaderType : uint32_t { - kSolidColor, - - kLinearGradient, - kRadialGradient, - kSweepGradient, - kConicalGradient, - - kLocalMatrix, - kImage, - kPorterDuffBlendShader, - kBlendShader, - - kLast = kBlendShader -}; - -static constexpr int kShaderTypeCount = static_cast(ShaderType::kLast) + 1; - -struct TileModePair { - SkTileMode fX; - SkTileMode fY; - - bool operator==(const TileModePair& other) const { return fX == other.fX && fY == other.fY; } - bool operator!=(const TileModePair& other) const { return !(*this == other); } -}; - -// TODO: add ShaderID and ColorFilterID too -class BlenderID { -public: - BlenderID() : fID(0) {} // 0 is an invalid blender ID - BlenderID(const BlenderID& src) : fID(src.fID) {} - - bool isValid() const { return fID > 0; } - - bool operator==(const BlenderID& other) const { return fID == other.fID; } - - BlenderID& operator=(const BlenderID& src) { - fID = src.fID; - return *this; - } - -private: - friend class ::SkShaderCodeDictionary; // for ctor and asUInt access - friend class CombinationBuilder; // for asUInt access - - BlenderID(uint32_t id) : fID(id) {} - - uint32_t asUInt() const { return fID; } - - uint32_t fID; -}; - -// When combination options are added to the combination builder an CombinationOption -// object is frequently returned. This allows options to be added, recursively, to the -// previously added options. -// Note: CombinationOptions are stable memory-wise so, once returned, they are valid -// until CombinationBuilder::reset is called. -class CombinationOption { -public: - CombinationOption addChildOption(int childIndex, ShaderType); - - CombinationOption addChildOption(int childIndex, ShaderType, - int minNumStops, int maxNumStops); - - CombinationOption addChildOption(int childIndex, ShaderType, - SkSpan tileModes); - - bool isValid() const { return fDataInArena; } - -private: - friend class CombinationBuilder; // for ctor - friend class CombinationBuilderTestAccess; - - CombinationOption(CombinationBuilder* builder, Option* dataInArena) - : fBuilder(builder) - , fDataInArena(dataInArena) {} - - ShaderType type() const; - int numChildSlots() const; - SkDEBUGCODE(int epoch() const;) - - CombinationBuilder* fBuilder; - Option* fDataInArena; -}; - -class CombinationBuilder { -public: - enum class BlendModeGroup { - kPorterDuff, // [ kClear .. kScreen ] - kAdvanced, // [ kOverlay .. kMultiply ] - kColorAware, // [ kHue .. kLuminosity ] - kAll - }; - - CombinationBuilder(SkShaderCodeDictionary*); - ~CombinationBuilder(); - - // Blend Modes - void addOption(SkBlendMode); - void addOption(SkBlendMode rangeStart, SkBlendMode rangeEnd); // inclusive - void addOption(BlendModeGroup); - - // TODO: have this variant return an CombinationOption object - void addOption(BlenderID); - - // Shaders - CombinationOption addOption(ShaderType); - CombinationOption addOption(ShaderType, int minNumStops, int maxNumStops); // inclusive - CombinationOption addOption(ShaderType, SkSpan tileModes); - - void reset(); - -private: - friend class Context; // for access to 'buildCombinations' - friend class CombinationOption; // for 'addOptionInternal' and 'arena' - friend class CombinationBuilderTestAccess; // for 'num*Combinations' and 'epoch' - - int numShaderCombinations() const; - int numBlendModeCombinations() const; - int numCombinations() { - return this->numShaderCombinations() * this->numBlendModeCombinations(); - } - - // 'desiredCombination' must be less than numCombinations - void createKey(const SkKeyContext&, int desiredCombination, SkPaintParamsKeyBuilder*); - -#ifdef SK_DEBUG - void dump() const; - int epoch() const { return fEpoch; } -#endif - - SkArenaAllocWithReset* arena() { return fArena.get(); } - - template - Option* allocInArena(Args&&... args); - - Option* addOptionInternal(ShaderType); - Option* addOptionInternal(ShaderType, int minNumStops, int maxNumStops); - Option* addOptionInternal(ShaderType, SkSpan tileModes); - - void buildCombinations(SkShaderCodeDictionary*, - const std::function&); - - SkShaderCodeDictionary* fDictionary; - std::unique_ptr fArena; - SkTArray fShaderOptions; - - uint32_t fBlendModes; - // TODO: store the SkBlender-based blenders in the arena - SkTHashSet fBlenders; - - SkDEBUGCODE(int fEpoch = 0;) -}; - -} // namespace skgpu::graphite - -#endif // SK_ENABLE_PRECOMPILE - -#endif // skgpu_graphite_CombinationBuilder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Context.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Context.h deleted file mode 100644 index c5ff91e6cb7e00..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Context.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_Context_DEFINED -#define skgpu_graphite_Context_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkShader.h" -#include "include/gpu/graphite/ContextOptions.h" -#include "include/gpu/graphite/GraphiteTypes.h" -#include "include/gpu/graphite/Recorder.h" -#include "include/private/SingleOwner.h" - -#include - -class SkRuntimeEffect; - -namespace skgpu { struct VulkanBackendContext; } - -namespace skgpu::graphite { - -class BackendTexture; -class Context; -class ContextPriv; -struct DawnBackendContext; -class GlobalCache; -struct MtlBackendContext; -class QueueManager; -class Recording; -class ResourceProvider; -class SharedContext; - -#ifdef SK_ENABLE_PRECOMPILE -class BlenderID; -class CombinationBuilder; -#endif - -class SK_API Context final { -public: - Context(const Context&) = delete; - Context(Context&&) = delete; - Context& operator=(const Context&) = delete; - Context& operator=(Context&&) = delete; - - ~Context(); - -#ifdef SK_DAWN - static std::unique_ptr MakeDawn(const DawnBackendContext&, const ContextOptions&); -#endif -#ifdef SK_METAL - static std::unique_ptr MakeMetal(const MtlBackendContext&, const ContextOptions&); -#endif - -#ifdef SK_VULKAN - static std::unique_ptr MakeVulkan(const VulkanBackendContext&, const ContextOptions&); -#endif - - BackendApi backend() const; - - std::unique_ptr makeRecorder(const RecorderOptions& = {}); - - void insertRecording(const InsertRecordingInfo&); - void submit(SyncToCpu = SyncToCpu::kNo); - - /** - * Checks whether any asynchronous work is complete and if so calls related callbacks. - */ - void checkAsyncWorkCompletion(); - -#ifdef SK_ENABLE_PRECOMPILE - // TODO: add "ShaderID addUserDefinedShader(sk_sp)" here - // TODO: add "ColorFilterID addUserDefinedColorFilter(sk_sp)" here - BlenderID addUserDefinedBlender(sk_sp); - - void precompile(CombinationBuilder*); -#endif - - /** - * Called to delete the passed in BackendTexture. This should only be called if the - * BackendTexture was created by calling Recorder::createBackendTexture on a Recorder created - * from this Context. If the BackendTexture is not valid or does not match the BackendApi of the - * Context then nothing happens. - * - * Otherwise this will delete/release the backend object that is wrapped in the BackendTexture. - * The BackendTexture will be reset to an invalid state and should not be used again. - */ - void deleteBackendTexture(BackendTexture&); - - // Provides access to functions that aren't part of the public API. - ContextPriv priv(); - const ContextPriv priv() const; // NOLINT(readability-const-return-type) - -protected: - Context(sk_sp, std::unique_ptr); - -private: - friend class ContextPriv; - - SingleOwner* singleOwner() const { return &fSingleOwner; } - - sk_sp fSharedContext; - std::unique_ptr fResourceProvider; - std::unique_ptr fQueueManager; - - // In debug builds we guard against improper thread handling. This guard is passed to the - // ResourceCache for the Context. - mutable SingleOwner fSingleOwner; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_Context_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ContextOptions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ContextOptions.h deleted file mode 100644 index d55351a774c1d8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ContextOptions.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_ContextOptions_DEFINED -#define skgpu_graphite_ContextOptions_DEFINED - -namespace skgpu { class ShaderErrorHandler; } - -namespace skgpu::graphite { - -struct SK_API ContextOptions { - ContextOptions() {} - - /** - * If present, use this object to report shader compilation failures. If not, report failures - * via SkDebugf and assert. - */ - skgpu::ShaderErrorHandler* fShaderErrorHandler = nullptr; - - /** - * Will the client make sure to only ever be executing one thread that uses the Context and all - * derived classes (e.g. Recorders, Recordings, etc.) at a time. If so we can possibly make some - * objects (e.g. VulkanMemoryAllocator) not thread safe to improve single thread performance. - */ - bool fClientWillExternallySynchronizeAllThreads = false; - - /** - * The maximum size of cache textures used for Skia's Glyph cache. - */ - size_t fGlyphCacheTextureMaximumBytes = 2048 * 1024 * 4; - - /** - * Below this threshold size in device space distance field fonts won't be used. Distance field - * fonts don't support hinting which is more important at smaller sizes. - */ - float fMinDistanceFieldFontSize = 18; - - /** - * Above this threshold size in device space glyphs are drawn as individual paths. - */ -#if defined(SK_BUILD_FOR_ANDROID) - float fGlyphsAsPathsFontSize = 384; -#elif defined(SK_BUILD_FOR_MAC) - float fGlyphsAsPathsFontSize = 256; -#else - float fGlyphsAsPathsFontSize = 324; -#endif - - /** - * Can the glyph atlas use multiple textures. If allowed, the each texture's size is bound by - * fGlypheCacheTextureMaximumBytes. - */ - bool fAllowMultipleGlyphCacheTextures = true; - - /** - * If true, then add 1 pixel padding to all glyph masks in the atlas to support bi-lerp - * rendering of all glyphs. This must be set to true to use Slugs. - */ - #if defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG) || \ - defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE) || \ - defined(SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_STRIKE_SERIALIZE) - bool fSupportBilerpFromGlyphAtlas = true; - #else - bool fSupportBilerpFromGlyphAtlas = false; - #endif - -#if GRAPHITE_TEST_UTILS - /** - * Private options that are only meant for testing within Skia's tools. - */ - - /** - * Maximum width and height of internal texture atlases. - */ - int fMaxTextureAtlasSize = 2048; -#endif -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_ContextOptions diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/GraphiteTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/GraphiteTypes.h deleted file mode 100644 index 474e5089fcf2a1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/GraphiteTypes.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_GraphiteTypes_DEFINED -#define skgpu_graphite_GraphiteTypes_DEFINED - -#include "include/core/SkTypes.h" -#include "include/gpu/GpuTypes.h" - -#include - -namespace skgpu::graphite { - -class Recording; - -using GpuFinishedContext = void*; -using GpuFinishedProc = void (*)(GpuFinishedContext finishedContext, CallbackResult); - -/** - * The fFinishedProc is called when the Recording has been submitted and finished on the GPU, or - * when there is a failure that caused it not to be submitted. The callback will always be called - * and the caller can use the callback to know it is safe to free any resources associated with - * the Recording that they may be holding onto. If the Recording is successfully submitted to the - * GPU the callback will be called with CallbackResult::kSuccess once the GPU has finished. All - * other cases where some failure occured it will be called with CallbackResult::kFailed. - */ -struct InsertRecordingInfo { - Recording* fRecording = nullptr; - GpuFinishedContext fFinishedContext = nullptr; - GpuFinishedProc fFinishedProc = nullptr; -}; - -/** - * Actually submit work to the GPU and track its completion - */ -enum class SyncToCpu : bool { - kYes = true, - kNo = false -}; - -/** - * Is the texture mipmapped or not - */ -enum class Mipmapped : bool { - kNo = false, - kYes = true, -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_GraphiteTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ImageProvider.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ImageProvider.h deleted file mode 100644 index 748b678c5ffa9a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/ImageProvider.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_ImageProvider_DEFINED -#define skgpu_graphite_ImageProvider_DEFINED - -#include "include/core/SkImage.h" -#include "include/core/SkRefCnt.h" - -namespace skgpu::graphite { - -enum class Mipmapped : bool; -class Recorder; - -/* - * This class provides a centralized location for clients to perform any caching of images - * they desire. Whenever Graphite encounters an SkImage which is not Graphite-backed - * it will call ImageProvider::findOrCreate. The client's derived version of this class should - * return a Graphite-backed version of the provided SkImage that meets the specified - * requirements. - * - * Skia requires that 'findOrCreate' return a Graphite-backed image that preserves the dimensions, - * number of channels and alpha type of the original image. The bit depth of the - * individual channels can change (e.g., 4444 -> 8888 is allowed). - * Wrt mipmapping, the returned image can have different mipmap settings than requested. If - * mipmapping was requested but not returned, the sampling level will be reduced to linear. - * If the requirements are not met by the returned image (modulo the flexibility wrt mipmapping) - * Graphite will drop the draw. - * - * Note: by default, Graphite will not perform any caching of images - * - * Threading concerns: - * If the same ImageProvider is given to multiple Recorders it is up to the - * client to handle any required thread synchronization. This is not limited to just - * restricting access to whatever map a derived class may have but extends to ensuring - * that an image created on one Recorder has had its creation work submitted before it - * is used by any work submitted by another Recording. Please note, this requirement - * (re the submission of creation work and image usage on different threads) is common to all - * graphite SkImages and isn't unique to SkImages returned by the ImageProvider. - * - * TODO(b/240996632): add documentation re shutdown order. - * TODO(b/240997067): add unit tests - */ -class SK_API ImageProvider : public SkRefCnt { -public: - // If the client's derived class already has a Graphite-backed image that has the same - // contents as 'image' and meets the requirements, then it can be returned. - // makeTextureImage can always be called to create an acceptable Graphite-backed image - // which could then be cached. - virtual sk_sp findOrCreate(Recorder* recorder, - const SkImage* image, - SkImage::RequiredImageProperties) = 0; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_ImageProvider_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recorder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recorder.h deleted file mode 100644 index 82cbd0f1698cf1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recorder.h +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_Recorder_DEFINED -#define skgpu_graphite_Recorder_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" -#include "include/gpu/graphite/GraphiteTypes.h" -#include "include/private/SingleOwner.h" -#include "include/private/SkTHash.h" - -#include - -class SkPixmap; -class SkRuntimeEffectDictionary; -class SkTextureDataBlock; -class SkUniformDataBlock; - -namespace skgpu { class TokenTracker; } - -namespace sktext::gpu { -class StrikeCache; -class TextBlobRedrawCoordinator; -} - -namespace skgpu::graphite { - -class AtlasManager; -class BackendTexture; -class Caps; -class Device; -class DrawBufferManager; -class GlobalCache; -class ImageProvider; -class RecorderPriv; -class Recording; -class ResourceProvider; -class SharedContext; -class Task; -class TaskGraph; -class TextureInfo; -class UploadBufferManager; - -template class PipelineDataCache; -using UniformDataCache = PipelineDataCache; -using TextureDataCache = PipelineDataCache; - -struct SK_API RecorderOptions final { - RecorderOptions(); - RecorderOptions(const RecorderOptions&); - ~RecorderOptions(); - - sk_sp fImageProvider; -}; - -class SK_API Recorder final { -public: - Recorder(const Recorder&) = delete; - Recorder(Recorder&&) = delete; - Recorder& operator=(const Recorder&) = delete; - Recorder& operator=(Recorder&&) = delete; - - ~Recorder(); - - std::unique_ptr snap(); - - ImageProvider* clientImageProvider() { return fClientImageProvider.get(); } - const ImageProvider* clientImageProvider() const { return fClientImageProvider.get(); } - - /** - * Creates a new backend gpu texture matching the dimensions and TextureInfo. If an invalid - * TextureInfo or a TextureInfo Skia can't support is passed in, this will return an invalid - * BackendTexture. Thus the client should check isValid on the returned BackendTexture to know - * if it succeeded or not. - * - * If this does return a valid BackendTexture, the caller is required to use - * Recorder::deleteBackendTexture or Context::deleteBackendTexture to delete the texture. It is - * safe to use the Context that created this Recorder or any other Recorder created from the - * same Context to call deleteBackendTexture. - */ - BackendTexture createBackendTexture(SkISize dimensions, const TextureInfo&); - - /** - * If possible, updates a backend texture with the provided pixmap data. The client - * should check the return value to see if the update was successful. The client is required - * to insert a Recording into the Context and call `submit` to send the upload work to the gpu. - * The backend texture must be compatible with the provided pixmap(s). Compatible, in this case, - * means that the backend format is compatible with the base pixmap's colortype. The src data - * can be deleted when this call returns. - * If the backend texture is mip mapped, the data for all the mipmap levels must be provided. - * In the mipmapped case all the colortypes of the provided pixmaps must be the same. - * Additionally, all the miplevels must be sized correctly (please see - * SkMipmap::ComputeLevelSize and ComputeLevelCount). - * Note: the pixmap's alphatypes and colorspaces are ignored. - * For the Vulkan backend after a successful update the layout of the created VkImage will be: - * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL - */ - bool updateBackendTexture(const BackendTexture&, - const SkPixmap srcData[], - int numLevels); - - /** - * Called to delete the passed in BackendTexture. This should only be called if the - * BackendTexture was created by calling Recorder::createBackendTexture on a Recorder that is - * associated with the same Context. If the BackendTexture is not valid or does not match the - * BackendApi of the Recorder then nothing happens. - * - * Otherwise this will delete/release the backend object that is wrapped in the BackendTexture. - * The BackendTexture will be reset to an invalid state and should not be used again. - */ - void deleteBackendTexture(BackendTexture&); - - // Provides access to functions that aren't part of the public API. - RecorderPriv priv(); - const RecorderPriv priv() const; // NOLINT(readability-const-return-type) - -#if GR_TEST_UTILS - bool deviceIsRegistered(Device*); -#endif - -private: - friend class Context; // For ctor - friend class Device; // For registering and deregistering Devices; - friend class RecorderPriv; // for ctor and hidden methods - - Recorder(sk_sp, const RecorderOptions&); - - SingleOwner* singleOwner() const { return &fSingleOwner; } - - BackendApi backend() const; - - // We keep track of all Devices that are connected to a Recorder. This allows the client to - // safely delete an SkSurface or a Recorder in any order. If the client deletes the Recorder - // we need to notify all Devices that the Recorder is no longer valid. If we delete the - // SkSurface/Device first we will flush all the Device's into the Recorder before deregistering - // it from the Recorder. - // - // We do not need to take a ref on the Device since the Device will flush and deregister itself - // in its dtor. There is no other need for the Recorder to know about the Device after this - // point. - // - // Note: We could probably get by with only registering Devices directly connected to - // SkSurfaces. All other one off Devices will be created in a controlled scope where the - // Recorder should still be valid by the time they need to flush their work when the Device is - // deleted. We would have to make sure we safely handle cases where a client calls saveLayer - // then either deletes the SkSurface or Recorder before calling restore. For simplicity we just - // register every device for now, but if we see extra overhead in pushing back the extra - // pointers, we can look into only registering SkSurface Devices. - void registerDevice(Device*); - void deregisterDevice(const Device*); - - sk_sp fSharedContext; - std::unique_ptr fResourceProvider; - std::unique_ptr fRuntimeEffectDict; - - std::unique_ptr fGraph; - std::unique_ptr fUniformDataCache; - std::unique_ptr fTextureDataCache; - std::unique_ptr fDrawBufferManager; - std::unique_ptr fUploadBufferManager; - std::vector fTrackedDevices; - - uint32_t fRecorderID; // Needed for MessageBox handling for text - std::unique_ptr fAtlasManager; - std::unique_ptr fTokenTracker; - std::unique_ptr fStrikeCache; - std::unique_ptr fTextBlobCache; - sk_sp fClientImageProvider; - - // In debug builds we guard against improper thread handling - // This guard is passed to the ResourceCache. - // TODO: Should we also pass this to Device, DrawContext, and similar classes? - mutable SingleOwner fSingleOwner; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_Recorder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recording.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recording.h deleted file mode 100644 index b1cb770bf0667f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/Recording.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_Recording_DEFINED -#define skgpu_graphite_Recording_DEFINED - -#include "include/core/SkRefCnt.h" - -#include -#include - -namespace skgpu::graphite { - -class CommandBuffer; -class RecordingPriv; -class Resource; -class ResourceProvider; -class TaskGraph; - -class Recording final { -public: - ~Recording(); - - RecordingPriv priv(); - -private: - friend class Recorder; // for ctor - friend class RecordingPriv; - - Recording(std::unique_ptr); - - bool addCommands(CommandBuffer*, ResourceProvider*); - void addResourceRef(sk_sp); - - std::unique_ptr fGraph; - // We don't always take refs to all resources used by specific Tasks (e.g. a common buffer used - // for uploads). Instead we'll just hold onto one ref for those Resources outside the Tasks. - // Those refs are stored in the array here and will eventually be passed onto a CommandBuffer - // when the Recording adds its commands. - std::vector> fExtraResourceRefs; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_Recording_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/TextureInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/TextureInfo.h deleted file mode 100644 index 15f3081e55f73d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/TextureInfo.h +++ /dev/null @@ -1,123 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_TextureInfo_DEFINED -#define skgpu_graphite_TextureInfo_DEFINED - -#include "include/gpu/graphite/GraphiteTypes.h" - -#ifdef SK_METAL -#include "include/private/gpu/graphite/MtlTypesPriv.h" -#endif - -#ifdef SK_VULKAN -#include "include/private/gpu/graphite/VulkanGraphiteTypesPriv.h" -#endif - -namespace skgpu::graphite { - -class TextureInfo { -public: - TextureInfo() {} -#ifdef SK_METAL - TextureInfo(const MtlTextureInfo& mtlInfo) - : fBackend(BackendApi::kMetal) - , fValid(true) - , fSampleCount(mtlInfo.fSampleCount) - , fLevelCount(mtlInfo.fLevelCount) - , fProtected(Protected::kNo) - , fMtlSpec(mtlInfo) {} -#endif - -#ifdef SK_VULKAN - TextureInfo(const VulkanTextureInfo& vkInfo) - : fBackend(BackendApi::kVulkan) - , fValid(true) - , fSampleCount(vkInfo.fSampleCount) - , fLevelCount(vkInfo.fLevelCount) - , fProtected(Protected::kNo) - , fVkSpec(vkInfo) { - if (vkInfo.fFlags & VK_IMAGE_CREATE_PROTECTED_BIT) { - fProtected = Protected::kYes; - } - } -#endif - - ~TextureInfo() {} - TextureInfo(const TextureInfo&) = default; - TextureInfo& operator=(const TextureInfo&); - - bool operator==(const TextureInfo&) const; - bool operator!=(const TextureInfo& that) const { return !(*this == that); } - - bool isValid() const { return fValid; } - BackendApi backend() const { return fBackend; } - - uint32_t numSamples() const { return fSampleCount; } - uint32_t numMipLevels() const { return fLevelCount; } - Protected isProtected() const { return fProtected; } - -#ifdef SK_METAL - bool getMtlTextureInfo(MtlTextureInfo* info) const { - if (!this->isValid() || fBackend != BackendApi::kMetal) { - return false; - } - *info = MtlTextureSpecToTextureInfo(fMtlSpec, fSampleCount, fLevelCount); - return true; - } -#endif - -#ifdef SK_VULKAN - bool getVulkanTextureInfo(VulkanTextureInfo* info) const { - if (!this->isValid() || fBackend != BackendApi::kVulkan) { - return false; - } - *info = VulkanTextureSpecToTextureInfo(fVkSpec, fSampleCount, fLevelCount); - return true; - } -#endif - -private: -#ifdef SK_METAL - friend class MtlCaps; - friend class MtlGraphicsPipeline; - friend class MtlTexture; - const MtlTextureSpec& mtlTextureSpec() const { - SkASSERT(fValid && fBackend == BackendApi::kMetal); - return fMtlSpec; - } -#endif - -#ifdef SK_VULKAN - friend class VulkanCaps; - friend class VulkanTexture; - const VulkanTextureSpec& vulkanTextureSpec() const { - SkASSERT(fValid && fBackend == BackendApi::kVulkan); - return fVkSpec; - } -#endif - - BackendApi fBackend = BackendApi::kMock; - bool fValid = false; - - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - Protected fProtected = Protected::kNo; - - union { -#ifdef SK_METAL - MtlTextureSpec fMtlSpec; -#endif -#ifdef SK_VULKAN - VulkanTextureSpec fVkSpec; -#endif - }; -}; - -} // namespace skgpu::graphite - -#endif //skgpu_graphite_TextureInfo_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h deleted file mode 100644 index 99282c4d76094a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/dawn/DawnBackendContext.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_DawnBackendContext_DEFINED -#define skgpu_graphite_DawnBackendContext_DEFINED - -#include "webgpu/webgpu_cpp.h" - -namespace skgpu::graphite { - -// The DawnBackendContext contains all of the base Dawn objects needed by the graphite Dawn -// backend. The client will create this object and pass it into the Context::MakeDawn factory call -// when setting up Skia. -struct SK_API DawnBackendContext { - wgpu::Device fDevice; - wgpu::Queue fQueue; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_DawnBackendContext_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h deleted file mode 100644 index de5f917a9aa046..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlBackendContext.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_MtlBackendContext_DEFINED -#define skgpu_graphite_MtlBackendContext_DEFINED - -#include "include/gpu/graphite/mtl/MtlTypes.h" - -namespace skgpu::graphite { - -// The MtlBackendContext contains all of the base Metal objects needed by the graphite Metal -// backend. The client will create this object and pass it into the Context::MakeMetal factory call -// when setting up Skia. -struct SK_API MtlBackendContext { - sk_cfp fDevice; - sk_cfp fQueue; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_MtlBackendContext_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h deleted file mode 100644 index 5f4c4c8dccff68..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/mtl/MtlTypes.h +++ /dev/null @@ -1,68 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_MtlTypes_DEFINED -#define skgpu_graphite_MtlTypes_DEFINED - -#include "include/ports/SkCFObject.h" - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __APPLE__ - -#include -#include - -#if TARGET_OS_SIMULATOR -#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0)) -#else // TARGET_OS_SIMULATOR -#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0)) -#endif // TARGET_OS_SIMULATOR - -#endif // __APPLE__ - - -namespace skgpu::graphite { - -/** - * Declares typedefs for Metal types used in Graphite cpp code - */ -using MtlPixelFormat = unsigned int; -using MtlTextureUsage = unsigned int; -using MtlStorageMode = unsigned int; -using MtlHandle = const void*; - -struct MtlTextureInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - - // Since we aren't in an Obj-C header we can't directly use Mtl types here. Each of these can - // cast to their mapped Mtl types list below. - MtlPixelFormat fFormat = 0; // MTLPixelFormat fFormat = MTLPixelFormatInvalid; - MtlTextureUsage fUsage = 0; // MTLTextureUsage fUsage = MTLTextureUsageUnknown; - MtlStorageMode fStorageMode = 0; // MTLStorageMode fStorageMode = MTLStorageModeShared; - bool fFramebufferOnly = false; - - MtlTextureInfo() = default; - MtlTextureInfo(MtlHandle mtlTexture); - MtlTextureInfo(uint32_t sampleCount, - uint32_t levelCount, - MtlPixelFormat format, - MtlTextureUsage usage, - MtlStorageMode storageMode, - bool framebufferOnly) - : fSampleCount(sampleCount) - , fLevelCount(levelCount) - , fFormat(format) - , fUsage(usage) - , fStorageMode(storageMode) - , fFramebufferOnly(framebufferOnly) {} -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_MtlTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h deleted file mode 100644 index 4e9802dbca9dc0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/graphite/vk/VulkanGraphiteTypes.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_VulkanGraphiteTypes_DEFINED -#define skgpu_graphite_VulkanGraphiteTypes_DEFINED - -#include "include/gpu/vk/VulkanTypes.h" - -namespace skgpu::graphite { - -struct VulkanTextureInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - - // VkImageCreateInfo properties - // Currently the only supported flag is VK_IMAGE_CREATE_PROTECTED_BIT. Any other flag will not - // be accepted - VkImageCreateFlags fFlags = 0; - VkFormat fFormat = VK_FORMAT_UNDEFINED; - VkImageTiling fImageTiling = VK_IMAGE_TILING_OPTIMAL; - VkImageUsageFlags fImageUsageFlags = 0; - VkSharingMode fSharingMode = VK_SHARING_MODE_EXCLUSIVE; - uint32_t fCurrentQueueFamily = VK_QUEUE_FAMILY_IGNORED; - VkImageLayout fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED; - - // Properties related to the image view and sampling. These are less inherent properties of the - // VkImage but describe how the VkImage should be used within Skia. - - // What aspect to use for the VkImageView. The normal, default is VK_IMAGE_ASPECT_COLOR_BIT. - // However, if the VkImage is a Ycbcr format, the client can pass a specific plan here to have - // Skia directly sample a plane. In that case the client should also pass in a VkFormat that is - // compatible with the plane as described by the Vulkan spec. - VkImageAspectFlags fAspectMask = VK_IMAGE_ASPECT_COLOR_BIT; - // TODO: Either Make the ycbcr conversion info shareable with Ganesh or add a version for - // Graphite. - // GrVkYcbcrConversionInfo fYcbcrConversionInfo; - - VulkanTextureInfo() = default; - VulkanTextureInfo(uint32_t sampleCount, - uint32_t levelCount, - VkImageCreateFlags flags, - VkFormat format, - VkImageTiling imageTiling, - VkImageUsageFlags imageUsageFlags, - VkSharingMode sharingMode, - uint32_t currentQueueFamily, - VkImageLayout imageLayout, - VkImageAspectFlags aspectMask) - : fSampleCount(sampleCount) - , fLevelCount(levelCount) - , fFlags(flags) - , fFormat(format) - , fImageTiling(imageTiling) - , fImageUsageFlags(imageUsageFlags) - , fSharingMode(sharingMode) - , fCurrentQueueFamily(currentQueueFamily) - , fImageLayout(imageLayout) - , fAspectMask(aspectMask) {} -}; - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_VulkanGraphiteTypes_DEFINED - - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mock/GrMockTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mock/GrMockTypes.h deleted file mode 100644 index ac866167bc6791..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mock/GrMockTypes.h +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrMockOptions_DEFINED -#define GrMockOptions_DEFINED - -#include "include/gpu/GrTypes.h" -#include "include/private/gpu/ganesh/GrTypesPriv.h" - -class GrBackendFormat; - -struct GrMockTextureInfo { - GrMockTextureInfo() - : fColorType(GrColorType::kUnknown) - , fCompressionType(SkImage::CompressionType::kNone) - , fID(0) {} - - GrMockTextureInfo(GrColorType colorType, - SkImage::CompressionType compressionType, - int id) - : fColorType(colorType) - , fCompressionType(compressionType) - , fID(id) { - SkASSERT(fID); - if (fCompressionType != SkImage::CompressionType::kNone) { - SkASSERT(colorType == GrColorType::kUnknown); - } - } - - bool operator==(const GrMockTextureInfo& that) const { - return fColorType == that.fColorType && - fCompressionType == that.fCompressionType && - fID == that.fID; - } - - GrBackendFormat getBackendFormat() const; - - SkImage::CompressionType compressionType() const { return fCompressionType; } - - GrColorType colorType() const { - SkASSERT(fCompressionType == SkImage::CompressionType::kNone); - return fColorType; - } - - int id() const { return fID; } - -private: - GrColorType fColorType; - SkImage::CompressionType fCompressionType; - int fID; -}; - -struct GrMockRenderTargetInfo { - GrMockRenderTargetInfo() - : fColorType(GrColorType::kUnknown) - , fID(0) {} - - GrMockRenderTargetInfo(GrColorType colorType, int id) - : fColorType(colorType) - , fID(id) { - SkASSERT(fID); - } - - bool operator==(const GrMockRenderTargetInfo& that) const { - return fColorType == that.fColorType && - fID == that.fID; - } - - GrBackendFormat getBackendFormat() const; - - GrColorType colorType() const { return fColorType; } - -private: - GrColorType fColorType; - int fID; -}; - -struct GrMockSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - GrColorType fColorType = GrColorType::kUnknown; - SkImage::CompressionType fCompressionType = SkImage::CompressionType::kNone; -}; - -/** - * A pointer to this type is used as the GrBackendContext when creating a Mock GrContext. It can be - * used to specify capability options for the mock context. If nullptr is used a default constructed - * GrMockOptions is used. - */ -struct GrMockOptions { - GrMockOptions() { - using Renderability = ConfigOptions::Renderability; - // By default RGBA_8888 and BGRA_8888 are textureable and renderable and - // A8 and RGB565 are texturable. - fConfigOptions[(int)GrColorType::kRGBA_8888].fRenderability = Renderability::kNonMSAA; - fConfigOptions[(int)GrColorType::kRGBA_8888].fTexturable = true; - fConfigOptions[(int)GrColorType::kAlpha_8].fTexturable = true; - fConfigOptions[(int)GrColorType::kBGR_565].fTexturable = true; - - fConfigOptions[(int)GrColorType::kBGRA_8888] = fConfigOptions[(int)GrColorType::kRGBA_8888]; - - fCompressedOptions[(int)SkImage::CompressionType::kETC2_RGB8_UNORM].fTexturable = true; - fCompressedOptions[(int)SkImage::CompressionType::kBC1_RGB8_UNORM].fTexturable = true; - fCompressedOptions[(int)SkImage::CompressionType::kBC1_RGBA8_UNORM].fTexturable = true; - } - - struct ConfigOptions { - enum Renderability { kNo, kNonMSAA, kMSAA }; - Renderability fRenderability = kNo; - bool fTexturable = false; - }; - - // GrCaps options. - bool fMipmapSupport = false; - bool fDrawInstancedSupport = false; - bool fHalfFloatVertexAttributeSupport = false; - uint32_t fMapBufferFlags = 0; - int fMaxTextureSize = 2048; - int fMaxRenderTargetSize = 2048; - int fMaxWindowRectangles = 0; - int fMaxVertexAttributes = 16; - ConfigOptions fConfigOptions[kGrColorTypeCnt]; - ConfigOptions fCompressedOptions[SkImage::kCompressionTypeCount]; - - // GrShaderCaps options. - bool fIntegerSupport = false; - bool fFlatInterpolationSupport = false; - int fMaxVertexSamplers = 0; - int fMaxFragmentSamplers = 8; - bool fShaderDerivativeSupport = true; - bool fDualSourceBlendingSupport = false; - - // GrMockGpu options. - bool fFailTextureAllocations = false; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlBackendContext.h deleted file mode 100644 index 0d88f479acc8dc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlBackendContext.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrMtlBackendContext_DEFINED -#define GrMtlBackendContext_DEFINED - -#include "include/gpu/mtl/GrMtlTypes.h" - -// The BackendContext contains all of the base Metal objects needed by the GrMtlGpu. The assumption -// is that the client will set these up and pass them to the GrMtlGpu constructor. -struct SK_API GrMtlBackendContext { - sk_cfp fDevice; - sk_cfp fQueue; - sk_cfp fBinaryArchive; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlTypes.h deleted file mode 100644 index f7a232e3c6ceaa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/GrMtlTypes.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrMtlTypes_DEFINED -#define GrMtlTypes_DEFINED - -#include "include/gpu/GrTypes.h" -#include "include/ports/SkCFObject.h" - -/** - * Declares typedefs for Metal types used in Ganesh cpp code - */ -using GrMTLPixelFormat = unsigned int; -using GrMTLTextureUsage = unsigned int; -using GrMTLStorageMode = unsigned int; -using GrMTLHandle = const void*; - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __APPLE__ - -#include - -#if TARGET_OS_SIMULATOR -#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(13.0)) -#else // TARGET_OS_SIMULATOR -#define SK_API_AVAILABLE_CA_METAL_LAYER SK_API_AVAILABLE(macos(10.11), ios(8.0)) -#endif // TARGET_OS_SIMULATOR - -/** - * Types for interacting with Metal resources created externally to Skia. - * This is used by GrBackendObjects. - */ -struct GrMtlTextureInfo { -public: - GrMtlTextureInfo() {} - - sk_cfp fTexture; - - bool operator==(const GrMtlTextureInfo& that) const { - return fTexture == that.fTexture; - } -}; - -struct GrMtlSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - // Since we aren't in an Obj-C header we can't directly use Mtl types here. Each of these can - // cast to their mapped Mtl types list below. - GrMTLPixelFormat fFormat = 0; // MTLPixelFormat fFormat = MTLPixelFormatInvalid; - GrMTLTextureUsage fUsage = 0; // MTLTextureUsage fUsage = MTLTextureUsageUnknown; - GrMTLStorageMode fStorageMode = 0; // MTLStorageMode fStorageMode = MTLStorageModeShared; -}; - -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h deleted file mode 100644 index 425c4617914b8d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/mtl/MtlMemoryAllocator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2022 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_MtlMemoryAllocator_DEFINED -#define skgpu_MtlMemoryAllocator_DEFINED - -#ifdef __APPLE__ - -#ifdef __OBJC__ -#import -#endif - -namespace skgpu { - -// interface classes for the GPU memory allocator -class MtlAlloc : public SkRefCnt { -public: - ~MtlAlloc() override = default; -}; - -#ifdef __OBJC__ -class MtlMemoryAllocator : public SkRefCnt { -public: - virtual id newBufferWithLength(NSUInteger length, MTLResourceOptions options, - sk_sp* allocation) = 0; - virtual id newTextureWithDescriptor(MTLTextureDescriptor* texDesc, - sk_sp* allocation) = 0; -}; -#endif - -} // namespace skgpu - -#endif // __APPLE__ - -#endif // skgpu_MtlMemoryAllocator_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkBackendContext.h deleted file mode 100644 index b166e59920676a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkBackendContext.h +++ /dev/null @@ -1,78 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkBackendContext_DEFINED -#define GrVkBackendContext_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/vk/GrVkTypes.h" -#include "include/gpu/vk/VulkanMemoryAllocator.h" - -namespace skgpu { class VulkanExtensions; } - -enum GrVkExtensionFlags { - kEXT_debug_report_GrVkExtensionFlag = 0x0001, - kNV_glsl_shader_GrVkExtensionFlag = 0x0002, - kKHR_surface_GrVkExtensionFlag = 0x0004, - kKHR_swapchain_GrVkExtensionFlag = 0x0008, - kKHR_win32_surface_GrVkExtensionFlag = 0x0010, - kKHR_android_surface_GrVkExtensionFlag = 0x0020, - kKHR_xcb_surface_GrVkExtensionFlag = 0x0040, -}; - -enum GrVkFeatureFlags { - kGeometryShader_GrVkFeatureFlag = 0x0001, - kDualSrcBlend_GrVkFeatureFlag = 0x0002, - kSampleRateShading_GrVkFeatureFlag = 0x0004, -}; - -// It is not guarenteed VkPhysicalDeviceProperties2 will be in the client's header so we forward -// declare it here to be safe. -struct VkPhysicalDeviceFeatures2; - -// The BackendContext contains all of the base Vulkan objects needed by the GrVkGpu. The assumption -// is that the client will set these up and pass them to the GrVkGpu constructor. The VkDevice -// created must support at least one graphics queue, which is passed in as well. -// The QueueFamilyIndex must match the family of the given queue. It is needed for CommandPool -// creation, and any GrBackendObjects handed to us (e.g., for wrapped textures) needs to be created -// in or transitioned to that family. The refs held by members of this struct must be released -// (either by deleting the struct or manually releasing the refs) before the underlying vulkan -// device and instance are destroyed. -struct SK_API GrVkBackendContext { - VkInstance fInstance = VK_NULL_HANDLE; - VkPhysicalDevice fPhysicalDevice = VK_NULL_HANDLE; - VkDevice fDevice = VK_NULL_HANDLE; - VkQueue fQueue = VK_NULL_HANDLE; - uint32_t fGraphicsQueueIndex = 0; - uint32_t fMinAPIVersion = 0; // Deprecated. Use fInstanceVersion - // instead. - uint32_t fInstanceVersion = 0; // Deprecated. Use fMaxApiVersion - // The max api version set here should match the value set in VkApplicationInfo::apiVersion when - // then VkInstance was created. - uint32_t fMaxAPIVersion = 0; - uint32_t fExtensions = 0; // Deprecated. Use fVkExtensions instead. - const skgpu::VulkanExtensions* fVkExtensions = nullptr; - uint32_t fFeatures = 0; // Deprecated. Use fDeviceFeatures[2] - // instead. - // The client can create their VkDevice with either a VkPhysicalDeviceFeatures or - // VkPhysicalDeviceFeatures2 struct, thus we have to support taking both. The - // VkPhysicalDeviceFeatures2 struct is needed so we know if the client enabled any extension - // specific features. If fDeviceFeatures2 is not null then we ignore fDeviceFeatures. If both - // fDeviceFeatures and fDeviceFeatures2 are null we will assume no features are enabled. - const VkPhysicalDeviceFeatures* fDeviceFeatures = nullptr; - const VkPhysicalDeviceFeatures2* fDeviceFeatures2 = nullptr; - sk_sp fMemoryAllocator; - skgpu::VulkanGetProc fGetProc = nullptr; - // This is deprecated and should be set to false. The client is responsible for managing the - // lifetime of the VkInstance and VkDevice objects. - bool fOwnsInstanceAndDevice = false; - // Indicates that we are working with protected content and all CommandPool and Queue operations - // should be done in a protected context. - GrProtected fProtectedContext = GrProtected::kNo; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkExtensions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkExtensions.h deleted file mode 100644 index b32cc16eb5373d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkExtensions.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkExtensions_DEFINED -#define GrVkExtensions_DEFINED - -#include "include/gpu/vk/VulkanExtensions.h" - -using GrVkExtensions = skgpu::VulkanExtensions; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h deleted file mode 100644 index 034e1f506c6769..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkMemoryAllocator.h +++ /dev/null @@ -1,15 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkMemoryAllocator_DEFINED -#define GrVkMemoryAllocator_DEFINED - -#include "include/gpu/vk/VulkanMemoryAllocator.h" - -using GrVkMemoryAllocator = skgpu::VulkanMemoryAllocator; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkTypes.h deleted file mode 100644 index 9d0a4c2c601339..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/GrVkTypes.h +++ /dev/null @@ -1,149 +0,0 @@ - -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkTypes_DEFINED -#define GrVkTypes_DEFINED - -#include "include/gpu/GrTypes.h" -#include "include/gpu/vk/VulkanTypes.h" - -using GrVkBackendMemory = skgpu::VulkanBackendMemory; -using GrVkAlloc = skgpu::VulkanAlloc; - -// This struct is used to pass in the necessary information to create a VkSamplerYcbcrConversion -// object for an VkExternalFormatANDROID. -struct GrVkYcbcrConversionInfo { - bool operator==(const GrVkYcbcrConversionInfo& that) const { - // Invalid objects are not required to have all other fields initialized or matching. - if (!this->isValid() && !that.isValid()) { - return true; - } - return this->fFormat == that.fFormat && - this->fExternalFormat == that.fExternalFormat && - this->fYcbcrModel == that.fYcbcrModel && - this->fYcbcrRange == that.fYcbcrRange && - this->fXChromaOffset == that.fXChromaOffset && - this->fYChromaOffset == that.fYChromaOffset && - this->fChromaFilter == that.fChromaFilter && - this->fForceExplicitReconstruction == that.fForceExplicitReconstruction; - } - bool operator!=(const GrVkYcbcrConversionInfo& that) const { return !(*this == that); } - - bool isValid() const { return fYcbcrModel != VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY; } - - // Format of the source image. Must be set to VK_FORMAT_UNDEFINED for external images or - // a valid image format otherwise. - VkFormat fFormat = VK_FORMAT_UNDEFINED; - - // The external format. Must be non-zero for external images, zero otherwise. - // Should be compatible to be used in a VkExternalFormatANDROID struct. - uint64_t fExternalFormat = 0; - - VkSamplerYcbcrModelConversion fYcbcrModel = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY; - VkSamplerYcbcrRange fYcbcrRange = VK_SAMPLER_YCBCR_RANGE_ITU_FULL; - VkChromaLocation fXChromaOffset = VK_CHROMA_LOCATION_COSITED_EVEN; - VkChromaLocation fYChromaOffset = VK_CHROMA_LOCATION_COSITED_EVEN; - VkFilter fChromaFilter = VK_FILTER_NEAREST; - VkBool32 fForceExplicitReconstruction = false; - - // For external images format features here should be those returned by a call to - // vkAndroidHardwareBufferFormatPropertiesANDROID - VkFormatFeatureFlags fFormatFeatures = 0; -}; - -/* - * When wrapping a GrBackendTexture or GrBackendRendenderTarget, the fCurrentQueueFamily should - * either be VK_QUEUE_FAMILY_IGNORED, VK_QUEUE_FAMILY_EXTERNAL, or VK_QUEUE_FAMILY_FOREIGN_EXT. If - * fSharingMode is VK_SHARING_MODE_EXCLUSIVE then fCurrentQueueFamily can also be the graphics - * queue index passed into Skia. - */ -struct GrVkImageInfo { - VkImage fImage = VK_NULL_HANDLE; - skgpu::VulkanAlloc fAlloc; - VkImageTiling fImageTiling = VK_IMAGE_TILING_OPTIMAL; - VkImageLayout fImageLayout = VK_IMAGE_LAYOUT_UNDEFINED; - VkFormat fFormat = VK_FORMAT_UNDEFINED; - VkImageUsageFlags fImageUsageFlags = 0; - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - uint32_t fCurrentQueueFamily = VK_QUEUE_FAMILY_IGNORED; - GrProtected fProtected = GrProtected::kNo; - GrVkYcbcrConversionInfo fYcbcrConversionInfo; - VkSharingMode fSharingMode = VK_SHARING_MODE_EXCLUSIVE; -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - bool fPartOfSwapchainOrAndroidWindow = false; -#endif - -#if GR_TEST_UTILS - bool operator==(const GrVkImageInfo& that) const { - bool equal = fImage == that.fImage && fAlloc == that.fAlloc && - fImageTiling == that.fImageTiling && - fImageLayout == that.fImageLayout && - fFormat == that.fFormat && - fImageUsageFlags == that.fImageUsageFlags && - fSampleCount == that.fSampleCount && - fLevelCount == that.fLevelCount && - fCurrentQueueFamily == that.fCurrentQueueFamily && - fProtected == that.fProtected && - fYcbcrConversionInfo == that.fYcbcrConversionInfo && - fSharingMode == that.fSharingMode; -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - equal = equal && (fPartOfSwapchainOrAndroidWindow == that.fPartOfSwapchainOrAndroidWindow); -#endif - return equal; - } -#endif -}; - -using GrVkGetProc = skgpu::VulkanGetProc; - -/** - * This object is wrapped in a GrBackendDrawableInfo and passed in as an argument to - * drawBackendGpu() calls on an SkDrawable. The drawable will use this info to inject direct - * Vulkan calls into our stream of GPU draws. - * - * The SkDrawable is given a secondary VkCommandBuffer in which to record draws. The GPU backend - * will then execute that command buffer within a render pass it is using for its own draws. The - * drawable is also given the attachment of the color index, a compatible VkRenderPass, and the - * VkFormat of the color attachment so that it can make VkPipeline objects for the draws. The - * SkDrawable must not alter the state of the VkRenderpass or sub pass. - * - * Additionally, the SkDrawable may fill in the passed in fDrawBounds with the bounds of the draws - * that it submits to the command buffer. This will be used by the GPU backend for setting the - * bounds in vkCmdBeginRenderPass. If fDrawBounds is not updated, we will assume that the entire - * attachment may have been written to. - * - * The SkDrawable is always allowed to create its own command buffers and submit them to the queue - * to render offscreen textures which will be sampled in draws added to the passed in - * VkCommandBuffer. If this is done the SkDrawable is in charge of adding the required memory - * barriers to the queue for the sampled images since the Skia backend will not do this. - */ -struct GrVkDrawableInfo { - VkCommandBuffer fSecondaryCommandBuffer; - uint32_t fColorAttachmentIndex; - VkRenderPass fCompatibleRenderPass; - VkFormat fFormat; - VkRect2D* fDrawBounds; -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - bool fFromSwapchainOrAndroidWindow; -#endif -}; - -struct GrVkSurfaceInfo { - uint32_t fSampleCount = 1; - uint32_t fLevelCount = 0; - GrProtected fProtected = GrProtected::kNo; - - VkImageTiling fImageTiling = VK_IMAGE_TILING_OPTIMAL; - VkFormat fFormat = VK_FORMAT_UNDEFINED; - VkImageUsageFlags fImageUsageFlags = 0; - GrVkYcbcrConversionInfo fYcbcrConversionInfo; - VkSharingMode fSharingMode = VK_SHARING_MODE_EXCLUSIVE; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanBackendContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanBackendContext.h deleted file mode 100644 index c78e2de0c92f26..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanBackendContext.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_VulkanBackendContext_DEFINED -#define skgpu_VulkanBackendContext_DEFINED - -#include "include/gpu/GpuTypes.h" -#include "include/gpu/vk/VulkanMemoryAllocator.h" -#include "include/gpu/vk/VulkanTypes.h" - -namespace skgpu { - -class VulkanExtensions; - -// The VkBackendContext contains all of the base Vk objects needed by the skia Vulkan context. -struct SK_API VulkanBackendContext { - VkInstance fInstance; - VkPhysicalDevice fPhysicalDevice; - VkDevice fDevice; - VkQueue fQueue; - uint32_t fGraphicsQueueIndex; - // The max api version set here should match the value set in VkApplicationInfo::apiVersion when - // then VkInstance was created. - uint32_t fMaxAPIVersion; - const skgpu::VulkanExtensions* fVkExtensions = nullptr; - // The client can create their VkDevice with either a VkPhysicalDeviceFeatures or - // VkPhysicalDeviceFeatures2 struct, thus we have to support taking both. The - // VkPhysicalDeviceFeatures2 struct is needed so we know if the client enabled any extension - // specific features. If fDeviceFeatures2 is not null then we ignore fDeviceFeatures. If both - // fDeviceFeatures and fDeviceFeatures2 are null we will assume no features are enabled. - const VkPhysicalDeviceFeatures* fDeviceFeatures = nullptr; - const VkPhysicalDeviceFeatures2* fDeviceFeatures2 = nullptr; - // Optional. The client may provide an inplementation of a VulkanMemoryAllocator for Skia to use - // for allocating Vulkan resources that use VkDeviceMemory. - sk_sp fMemoryAllocator; - skgpu::VulkanGetProc fGetProc; - Protected fProtectedContext; -}; - -} // namespace skgpu::graphite - -#endif // skgpu_VulkanBackendContext_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanExtensions.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanExtensions.h deleted file mode 100644 index 445fd539083331..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanExtensions.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_VulkanExtensions_DEFINED -#define skgpu_VulkanExtensions_DEFINED - -#include "include/core/SkString.h" -#include "include/gpu/vk/VulkanTypes.h" -#include "include/private/SkTArray.h" - -namespace skgpu { - -/** - * Helper class that eats in an array of extensions strings for instance and device and allows for - * quicker querying if an extension is present. - */ -class SK_API VulkanExtensions { -public: - VulkanExtensions() {} - - void init(VulkanGetProc, VkInstance, VkPhysicalDevice, - uint32_t instanceExtensionCount, const char* const* instanceExtensions, - uint32_t deviceExtensionCount, const char* const* deviceExtensions); - - bool hasExtension(const char[], uint32_t minVersion) const; - - struct Info { - Info() {} - Info(const char* name) : fName(name), fSpecVersion(0) {} - - SkString fName; - uint32_t fSpecVersion; - - struct Less { - bool operator()(const Info& a, const SkString& b) const { - return strcmp(a.fName.c_str(), b.c_str()) < 0; - } - bool operator()(const SkString& a, const VulkanExtensions::Info& b) const { - return strcmp(a.c_str(), b.fName.c_str()) < 0; - } - }; - }; - -#ifdef SK_DEBUG - void dump() const { - SkDebugf("**Vulkan Extensions**\n"); - for (int i = 0; i < fExtensions.count(); ++i) { - SkDebugf("%s. Version: %d\n", - fExtensions[i].fName.c_str(), fExtensions[i].fSpecVersion); - } - SkDebugf("**End Vulkan Extensions**\n"); - } -#endif - -private: - void getSpecVersions(VulkanGetProc getProc, VkInstance, VkPhysicalDevice); - - SkTArray fExtensions; -}; - -} // namespace skgpu - -#endif // skgpu_VulkanExtensions_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h deleted file mode 100644 index 9d73fdf4bdf651..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanMemoryAllocator.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_VulkanMemoryAllocator_DEFINED -#define skgpu_VulkanMemoryAllocator_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/GpuTypes.h" -#include "include/gpu/vk/VulkanTypes.h" - -namespace skgpu { - -class VulkanMemoryAllocator : public SkRefCnt { -public: - enum AllocationPropertyFlags { - kNone_AllocationPropertyFlag = 0b0000, - // Allocation will be placed in its own VkDeviceMemory and not suballocated from some larger - // block. - kDedicatedAllocation_AllocationPropertyFlag = 0b0001, - // Says that the backing memory can only be accessed by the device. Additionally the device - // may lazily allocate the memory. This cannot be used with buffers that will be host - // visible. Setting this flag does not guarantee that we will allocate memory that respects - // it, but we will try to prefer memory that can respect it. - kLazyAllocation_AllocationPropertyFlag = 0b0010, - // The allocation will be mapped immediately and stay mapped until it is destroyed. This - // flag is only valid for buffers which are host visible (i.e. must have a usage other than - // BufferUsage::kGpuOnly). - kPersistentlyMapped_AllocationPropertyFlag = 0b0100, - // Allocation can only be accessed by the device using a protected context. - kProtected_AllocationPropertyFlag = 0b1000, - }; - - enum class BufferUsage { - // Buffers that will only be accessed from the device (large const buffers). Will always be - // in device local memory. - kGpuOnly, - // Buffers that typically will be updated multiple times by the host and read on the gpu - // (e.g. uniform or vertex buffers). CPU writes will generally be sequential in the buffer - // and will try to take advantage of the write-combined nature of the gpu buffers. Thus this - // will always be mappable and coherent memory, and it will prefer to be in device local - // memory. - kCpuWritesGpuReads, - // Buffers that will be accessed on the host and copied to another GPU resource (transfer - // buffers). Will always be mappable and coherent memory. - kTransfersFromCpuToGpu, - // Buffers which are typically writted to by the GPU and then read on the host. Will always - // be mappable memory, and will prefer cached memory. - kTransfersFromGpuToCpu, - }; - - virtual VkResult allocateImageMemory(VkImage image, - uint32_t allocationPropertyFlags, - skgpu::VulkanBackendMemory* memory) = 0; - - virtual VkResult allocateBufferMemory(VkBuffer buffer, - BufferUsage usage, - uint32_t allocationPropertyFlags, - skgpu::VulkanBackendMemory* memory) = 0; - - // Fills out the passed in skgpu::VulkanAlloc struct for the passed in - // skgpu::VulkanBackendMemory. - virtual void getAllocInfo(const skgpu::VulkanBackendMemory&, skgpu::VulkanAlloc*) const = 0; - - // Maps the entire allocation and returns a pointer to the start of the allocation. The - // implementation may map more memory than just the allocation, but the returned pointer must - // point at the start of the memory for the requested allocation. - virtual void* mapMemory(const skgpu::VulkanBackendMemory&) { return nullptr; } - virtual VkResult mapMemory(const skgpu::VulkanBackendMemory& memory, void** data) { - *data = this->mapMemory(memory); - // VK_ERROR_INITIALIZATION_FAILED is a bogus result to return from this function, but it is - // just something to return that is not VK_SUCCESS and can't be interpreted by a caller to - // mean something specific happened like device lost or oom. This will be removed once we - // update clients to implement this virtual. - return *data ? VK_SUCCESS : VK_ERROR_INITIALIZATION_FAILED; - } - virtual void unmapMemory(const skgpu::VulkanBackendMemory&) = 0; - - // The following two calls are used for managing non-coherent memory. The offset is relative to - // the start of the allocation and not the underlying VkDeviceMemory. Additionaly the client - // must make sure that the offset + size passed in is less that or equal to the allocation size. - // It is the responsibility of the implementation to make sure all alignment requirements are - // followed. The client should not have to deal with any sort of alignment issues. - virtual void flushMappedMemory(const skgpu::VulkanBackendMemory&, VkDeviceSize, VkDeviceSize) {} - virtual VkResult flushMemory(const skgpu::VulkanBackendMemory& memory, - VkDeviceSize offset, - VkDeviceSize size) { - this->flushMappedMemory(memory, offset, size); - return VK_SUCCESS; - } - virtual void invalidateMappedMemory(const skgpu::VulkanBackendMemory&, - VkDeviceSize, - VkDeviceSize) {} - virtual VkResult invalidateMemory(const skgpu::VulkanBackendMemory& memory, - VkDeviceSize offset, - VkDeviceSize size) { - this->invalidateMappedMemory(memory, offset, size); - return VK_SUCCESS; - } - - virtual void freeMemory(const skgpu::VulkanBackendMemory&) = 0; - - // Returns the total amount of memory that is allocated and in use by an allocation for this - // allocator. - virtual uint64_t totalUsedMemory() const = 0; - - // Returns the total amount of memory that is allocated by this allocator. - virtual uint64_t totalAllocatedMemory() const = 0; -}; - -} // namespace skgpu - -#endif // skgpu_VulkanMemoryAllocator_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanTypes.h deleted file mode 100644 index 5468c592114866..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/gpu/vk/VulkanTypes.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_VulkanTypes_DEFINED -#define skgpu_VulkanTypes_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/gpu/vk/SkiaVulkan.h" - -#include - -#ifndef VK_VERSION_1_1 -#error Skia requires the use of Vulkan 1.1 headers -#endif - -namespace skgpu { - -using VulkanGetProc = std::function; - -typedef intptr_t VulkanBackendMemory; - -/** - * Types for interacting with Vulkan resources created externally to Skia. - */ -struct VulkanAlloc { - // can be VK_NULL_HANDLE iff is an RT and is borrowed - VkDeviceMemory fMemory = VK_NULL_HANDLE; - VkDeviceSize fOffset = 0; - VkDeviceSize fSize = 0; // this can be indeterminate iff Tex uses borrow semantics - uint32_t fFlags = 0; - // handle to memory allocated via skgpu::VulkanMemoryAllocator. - VulkanBackendMemory fBackendMemory = 0; - - enum Flag { - kNoncoherent_Flag = 0x1, // memory must be flushed to device after mapping - kMappable_Flag = 0x2, // memory is able to be mapped. - kLazilyAllocated_Flag = 0x4, // memory was created with lazy allocation - }; - - bool operator==(const VulkanAlloc& that) const { - return fMemory == that.fMemory && fOffset == that.fOffset && fSize == that.fSize && - fFlags == that.fFlags && fUsesSystemHeap == that.fUsesSystemHeap; - } - -private: - bool fUsesSystemHeap = false; -}; - -} // namespace skgpu - -#endif // skgpu_VulkanTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/pathops/SkPathOps.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/pathops/SkPathOps.h deleted file mode 100644 index 18c71562e08c0c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/pathops/SkPathOps.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkPathOps_DEFINED -#define SkPathOps_DEFINED - -#include "include/core/SkPath.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTArray.h" -#include "include/private/SkTDArray.h" - -struct SkRect; - - -// FIXME: move everything below into the SkPath class -/** - * The logical operations that can be performed when combining two paths. - */ -enum SkPathOp { - kDifference_SkPathOp, //!< subtract the op path from the first path - kIntersect_SkPathOp, //!< intersect the two paths - kUnion_SkPathOp, //!< union (inclusive-or) the two paths - kXOR_SkPathOp, //!< exclusive-or the two paths - kReverseDifference_SkPathOp, //!< subtract the first path from the op path -}; - -/** Set this path to the result of applying the Op to this path and the - specified path: this = (this op operand). - The resulting path will be constructed from non-overlapping contours. - The curve order is reduced where possible so that cubics may be turned - into quadratics, and quadratics maybe turned into lines. - - Returns true if operation was able to produce a result; - otherwise, result is unmodified. - - @param one The first operand (for difference, the minuend) - @param two The second operand (for difference, the subtrahend) - @param op The operator to apply. - @param result The product of the operands. The result may be one of the - inputs. - @return True if the operation succeeded. - */ -bool SK_API Op(const SkPath& one, const SkPath& two, SkPathOp op, SkPath* result); - -/** Set this path to a set of non-overlapping contours that describe the - same area as the original path. - The curve order is reduced where possible so that cubics may - be turned into quadratics, and quadratics maybe turned into lines. - - Returns true if operation was able to produce a result; - otherwise, result is unmodified. - - @param path The path to simplify. - @param result The simplified path. The result may be the input. - @return True if simplification succeeded. - */ -bool SK_API Simplify(const SkPath& path, SkPath* result); - -/** Set the resulting rectangle to the tight bounds of the path. - - @param path The path measured. - @param result The tight bounds of the path. - @return True if the bounds could be computed. - */ -bool SK_API TightBounds(const SkPath& path, SkRect* result); - -/** Set the result with fill type winding to area equivalent to path. - Returns true if successful. Does not detect if path contains contours which - contain self-crossings or cross other contours; in these cases, may return - true even though result does not fill same area as path. - - Returns true if operation was able to produce a result; - otherwise, result is unmodified. The result may be the input. - - @param path The path typically with fill type set to even odd. - @param result The equivalent path with fill type set to winding. - @return True if winding path was set. - */ -bool SK_API AsWinding(const SkPath& path, SkPath* result); - -/** Perform a series of path operations, optimized for unioning many paths together. - */ -class SK_API SkOpBuilder { -public: - /** Add one or more paths and their operand. The builder is empty before the first - path is added, so the result of a single add is (emptyPath OP path). - - @param path The second operand. - @param _operator The operator to apply to the existing and supplied paths. - */ - void add(const SkPath& path, SkPathOp _operator); - - /** Computes the sum of all paths and operands, and resets the builder to its - initial state. - - @param result The product of the operands. - @return True if the operation succeeded. - */ - bool resolve(SkPath* result); - -private: - SkTArray fPathRefs; - SkTDArray fOps; - - static bool FixWinding(SkPath* path); - static void ReversePath(SkPath* path); - void reset(); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkCFObject.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkCFObject.h deleted file mode 100644 index 20e86671b79041..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkCFObject.h +++ /dev/null @@ -1,180 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCFObject_DEFINED -#define SkCFObject_DEFINED - -#ifdef __APPLE__ - -#include "include/core/SkTypes.h" - -#include // std::nullptr_t - -#import - -/** - * Wrapper class for managing lifetime of CoreFoundation objects. It will call - * CFRetain and CFRelease appropriately on creation, assignment, and deletion. - * Based on sk_sp<>. - */ -template static inline T SkCFSafeRetain(T obj) { - if (obj) { - CFRetain(obj); - } - return obj; -} - -template static inline void SkCFSafeRelease(T obj) { - if (obj) { - CFRelease(obj); - } -} - -template class sk_cfp { -public: - using element_type = T; - - constexpr sk_cfp() {} - constexpr sk_cfp(std::nullptr_t) {} - - /** - * Shares the underlying object by calling CFRetain(), so that both the argument and the newly - * created sk_cfp both have a reference to it. - */ - sk_cfp(const sk_cfp& that) : fObject(SkCFSafeRetain(that.get())) {} - - /** - * Move the underlying object from the argument to the newly created sk_cfp. Afterwards only - * the new sk_cfp will have a reference to the object, and the argument will point to null. - * No call to CFRetain() or CFRelease() will be made. - */ - sk_cfp(sk_cfp&& that) : fObject(that.release()) {} - - /** - * Adopt the bare object into the newly created sk_cfp. - * No call to CFRetain() or CFRelease() will be made. - */ - explicit sk_cfp(T obj) { - fObject = obj; - } - - /** - * Calls CFRelease() on the underlying object pointer. - */ - ~sk_cfp() { - SkCFSafeRelease(fObject); - SkDEBUGCODE(fObject = nil); - } - - sk_cfp& operator=(std::nullptr_t) { this->reset(); return *this; } - - /** - * Shares the underlying object referenced by the argument by calling CFRetain() on it. If this - * sk_cfp previously had a reference to an object (i.e. not null) it will call CFRelease() - * on that object. - */ - sk_cfp& operator=(const sk_cfp& that) { - if (this != &that) { - this->reset(SkCFSafeRetain(that.get())); - } - return *this; - } - - /** - * Move the underlying object from the argument to the sk_cfp. If the sk_cfp - * previously held a reference to another object, CFRelease() will be called on that object. - * No call to CFRetain() will be made. - */ - sk_cfp& operator=(sk_cfp&& that) { - this->reset(that.release()); - return *this; - } - - explicit operator bool() const { return this->get() != nil; } - - T get() const { return fObject; } - T operator*() const { - SkASSERT(fObject); - return fObject; - } - - /** - * Adopt the new object, and call CFRelease() on any previously held object (if not null). - * No call to CFRetain() will be made. - */ - void reset(T object = nil) { - // Need to unref after assigning, see - // http://wg21.cmeerw.net/lwg/issue998 - // http://wg21.cmeerw.net/lwg/issue2262 - T oldObject = fObject; - fObject = object; - SkCFSafeRelease(oldObject); - } - - /** - * Shares the new object by calling CFRetain() on it. If this sk_cfp previously had a - * reference to an object (i.e. not null) it will call CFRelease() on that object. - */ - void retain(T object) { - if (fObject != object) { - this->reset(SkCFSafeRetain(object)); - } - } - - /** - * Return the original object, and set the internal object to nullptr. - * The caller must assume ownership of the object, and manage its reference count directly. - * No call to CFRelease() will be made. - */ - T SK_WARN_UNUSED_RESULT release() { - T obj = fObject; - fObject = nil; - return obj; - } - -private: - T fObject = nil; -}; - -template inline bool operator==(const sk_cfp& a, - const sk_cfp& b) { - return a.get() == b.get(); -} -template inline bool operator==(const sk_cfp& a, - std::nullptr_t) { - return !a; -} -template inline bool operator==(std::nullptr_t, - const sk_cfp& b) { - return !b; -} - -template inline bool operator!=(const sk_cfp& a, - const sk_cfp& b) { - return a.get() != b.get(); -} -template inline bool operator!=(const sk_cfp& a, - std::nullptr_t) { - return static_cast(a); -} -template inline bool operator!=(std::nullptr_t, - const sk_cfp& b) { - return static_cast(b); -} - -/* - * Returns a sk_cfp wrapping the provided object AND calls retain on it (if not null). - * - * This is different than the semantics of the constructor for sk_cfp, which just wraps the - * object, effectively "adopting" it. - */ -template sk_cfp sk_ret_cfp(T obj) { - return sk_cfp(SkCFSafeRetain(obj)); -} - -#endif // __APPLE__ -#endif // SkCFObject_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontConfigInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontConfigInterface.h deleted file mode 100644 index 65fd612593f1a2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontConfigInterface.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontConfigInterface_DEFINED -#define SkFontConfigInterface_DEFINED - -#include "include/core/SkFontStyle.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkStream.h" -#include "include/core/SkTypeface.h" - -class SkFontMgr; - -/** - * \class SkFontConfigInterface - * - * A simple interface for remotable font management. - * The global instance can be found with RefGlobal(). - */ -class SK_API SkFontConfigInterface : public SkRefCnt { -public: - - /** - * Returns the global SkFontConfigInterface instance. If it is not - * nullptr, calls ref() on it. The caller must balance this with a call to - * unref(). The default SkFontConfigInterface is the result of calling - * GetSingletonDirectInterface. - */ - static sk_sp RefGlobal(); - - /** - * Replace the current global instance with the specified one. - */ - static void SetGlobal(sk_sp fc); - - /** - * This should be treated as private to the impl of SkFontConfigInterface. - * Callers should not change or expect any particular values. It is meant - * to be a union of possible storage types to aid the impl. - */ - struct FontIdentity { - FontIdentity() : fID(0), fTTCIndex(0) {} - - bool operator==(const FontIdentity& other) const { - return fID == other.fID && - fTTCIndex == other.fTTCIndex && - fString == other.fString; - } - bool operator!=(const FontIdentity& other) const { - return !(*this == other); - } - - uint32_t fID; - int32_t fTTCIndex; - SkString fString; - SkFontStyle fStyle; - - // If buffer is NULL, just return the number of bytes that would have - // been written. Will pad contents to a multiple of 4. - size_t writeToMemory(void* buffer = nullptr) const; - - // Recreate from a flattened buffer, returning the number of bytes read. - size_t readFromMemory(const void* buffer, size_t length); - }; - - /** - * Given a familyName and style, find the best match. - * - * If a match is found, return true and set its outFontIdentifier. - * If outFamilyName is not null, assign the found familyName to it - * (which may differ from the requested familyName). - * If outStyle is not null, assign the found style to it - * (which may differ from the requested style). - * - * If a match is not found, return false, and ignore all out parameters. - */ - virtual bool matchFamilyName(const char familyName[], - SkFontStyle requested, - FontIdentity* outFontIdentifier, - SkString* outFamilyName, - SkFontStyle* outStyle) = 0; - - /** - * Given a FontRef, open a stream to access its data, or return null - * if the FontRef's data is not available. The caller is responsible for - * deleting the stream when it is done accessing the data. - */ - virtual SkStreamAsset* openStream(const FontIdentity&) = 0; - - /** - * Return an SkTypeface for the given FontIdentity. - * - * The default implementation simply returns a new typeface built using data obtained from - * openStream(), but derived classes may implement more complex caching schemes. - */ - virtual sk_sp makeTypeface(const FontIdentity& identity) { - return SkTypeface::MakeFromStream(std::unique_ptr(this->openStream(identity)), - identity.fTTCIndex); - - } - - /** - * Return a singleton instance of a direct subclass that calls into - * libfontconfig. This does not affect the refcnt of the returned instance. - */ - static SkFontConfigInterface* GetSingletonDirectInterface(); - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h deleted file mode 100644 index 05771257d25fbf..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_FontConfigInterface.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_FontConfigInterface_DEFINED -#define SkFontMgr_FontConfigInterface_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkFontMgr; -class SkFontConfigInterface; - -/** Creates a SkFontMgr which wraps a SkFontConfigInterface. */ -SK_API sk_sp SkFontMgr_New_FCI(sk_sp fci); - -#endif // #ifndef SkFontMgr_FontConfigInterface_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_android.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_android.h deleted file mode 100644 index d68f3ba034a05b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_android.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_android_DEFINED -#define SkFontMgr_android_DEFINED - -#include "include/core/SkRefCnt.h" - -class SkFontMgr; - -struct SkFontMgr_Android_CustomFonts { - /** When specifying custom fonts, indicates how to use system fonts. */ - enum SystemFontUse { - kOnlyCustom, /** Use only custom fonts. NDK compliant. */ - kPreferCustom, /** Use custom fonts before system fonts. */ - kPreferSystem /** Use system fonts before custom fonts. */ - }; - /** Whether or not to use system fonts. */ - SystemFontUse fSystemFontUse; - - /** Base path to resolve relative font file names. If a directory, should end with '/'. */ - const char* fBasePath; - - /** Optional custom configuration file to use. */ - const char* fFontsXml; - - /** Optional custom configuration file for fonts which provide fallback. - * In the new style (version > 21) fontsXml format is used, this should be NULL. - */ - const char* fFallbackFontsXml; - - /** Optional custom flag. If set to true the SkFontMgr will acquire all requisite - * system IO resources on initialization. - */ - bool fIsolated; -}; - -/** Create a font manager for Android. If 'custom' is NULL, use only system fonts. */ -SK_API sk_sp SkFontMgr_New_Android(const SkFontMgr_Android_CustomFonts* custom); - -#endif // SkFontMgr_android_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_directory.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_directory.h deleted file mode 100644 index b1a60fb4dac151..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_directory.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_directory_DEFINED -#define SkFontMgr_directory_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkFontMgr; - -/** Create a custom font manager which scans a given directory for font files. - * This font manager uses FreeType for rendering. - */ -SK_API sk_sp SkFontMgr_New_Custom_Directory(const char* dir); - -#endif // SkFontMgr_directory_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_empty.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_empty.h deleted file mode 100644 index e5756421d0c52f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_empty.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_empty_DEFINED -#define SkFontMgr_empty_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -class SkFontMgr; - -/** Create a custom font manager that contains no built-in fonts. - * This font manager uses FreeType for rendering. - */ -SK_API sk_sp SkFontMgr_New_Custom_Empty(); - -#endif // SkFontMgr_empty_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fontconfig.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fontconfig.h deleted file mode 100644 index 4b2bb2d297f309..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fontconfig.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_fontconfig_DEFINED -#define SkFontMgr_fontconfig_DEFINED - -#include "include/core/SkRefCnt.h" -#include - -class SkFontMgr; - -/** Create a font manager around a FontConfig instance. - * If 'fc' is NULL, will use a new default config. - * Takes ownership of 'fc' and will call FcConfigDestroy on it. - */ -SK_API sk_sp SkFontMgr_New_FontConfig(FcConfig* fc); - -#endif // #ifndef SkFontMgr_fontconfig_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fuchsia.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fuchsia.h deleted file mode 100644 index d20530af723cb2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_fuchsia.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_fuchsia_DEFINED -#define SkFontMgr_fuchsia_DEFINED - -#include - -#include "include/core/SkRefCnt.h" - -class SkFontMgr; - -SK_API sk_sp SkFontMgr_New_Fuchsia(fuchsia::fonts::ProviderSyncPtr provider); - -#endif // SkFontMgr_fuchsia_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_indirect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_indirect.h deleted file mode 100644 index 73210bc9a546b4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_indirect.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_indirect_DEFINED -#define SkFontMgr_indirect_DEFINED - -#include "include/core/SkFontMgr.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypeface.h" -#include "include/core/SkTypes.h" -#include "include/ports/SkRemotableFontMgr.h" -#include "include/private/SkMutex.h" -#include "include/private/SkOnce.h" -#include "include/private/SkTArray.h" - -class SkData; -class SkFontStyle; -class SkStreamAsset; -class SkString; - -class SK_API SkFontMgr_Indirect : public SkFontMgr { -public: - // TODO: The SkFontMgr is only used for createFromStream/File/Data. - // In the future these calls should be broken out into their own interface - // with a name like SkFontRenderer. - SkFontMgr_Indirect(sk_sp impl, sk_sp proxy) - : fImpl(std::move(impl)), fProxy(std::move(proxy)) - { } - -protected: - int onCountFamilies() const override; - void onGetFamilyName(int index, SkString* familyName) const override; - SkFontStyleSet* onCreateStyleSet(int index) const override; - - SkFontStyleSet* onMatchFamily(const char familyName[]) const override; - - SkTypeface* onMatchFamilyStyle(const char familyName[], - const SkFontStyle& fontStyle) const override; - - SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], - const SkFontStyle&, - const char* bcp47[], - int bcp47Count, - SkUnichar character) const override; - - sk_sp onMakeFromStreamIndex(std::unique_ptr, int ttcIndex) const override; - sk_sp onMakeFromStreamArgs(std::unique_ptr stream, - const SkFontArguments& args) const override; - sk_sp onMakeFromFile(const char path[], int ttcIndex) const override; - sk_sp onMakeFromData(sk_sp, int ttcIndex) const override; - sk_sp onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override; - -private: - SkTypeface* createTypefaceFromFontId(const SkFontIdentity& fontId) const; - - sk_sp fImpl; - sk_sp fProxy; - - struct DataEntry { - uint32_t fDataId; // key1 - uint32_t fTtcIndex; // key2 - SkTypeface* fTypeface; // value: weak ref to typeface - - DataEntry() = default; - - DataEntry(DataEntry&& that) { *this = std::move(that); } - DataEntry& operator=(DataEntry&& that) { - if (this != &that) { - fDataId = that.fDataId; - fTtcIndex = that.fTtcIndex; - fTypeface = that.fTypeface; - - SkDEBUGCODE(that.fDataId = SkFontIdentity::kInvalidDataId;) - SkDEBUGCODE(that.fTtcIndex = 0xbbadbeef;) - that.fTypeface = nullptr; - } - return *this; - } - - ~DataEntry() { - if (fTypeface) { - fTypeface->weak_unref(); - } - } - }; - /** - * This cache is essentially { dataId: { ttcIndex: typeface } } - * For data caching we want a mapping from data id to weak references to - * typefaces with that data id. By storing the index next to the typeface, - * this data cache also acts as a typeface cache. - */ - mutable SkTArray fDataCache; - mutable SkMutex fDataCacheMutex; - - friend class SkStyleSet_Indirect; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_mac_ct.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_mac_ct.h deleted file mode 100644 index 45cba65b5da3ce..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkFontMgr_mac_ct.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFontMgr_mac_ct_DEFINED -#define SkFontMgr_mac_ct_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -#ifdef SK_BUILD_FOR_MAC -#import -#endif - -#ifdef SK_BUILD_FOR_IOS -#include -#endif - -class SkFontMgr; - -/** Create a font manager for CoreText. If the collection is nullptr the system default will be used. */ -SK_API extern sk_sp SkFontMgr_New_CoreText(CTFontCollectionRef); - -#endif // SkFontMgr_mac_ct_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorCG.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorCG.h deleted file mode 100644 index 93592cde4ece48..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorCG.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/core/SkTypes.h" -#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) - -#include "include/core/SkData.h" -#include "include/core/SkImageGenerator.h" - -#include - -namespace SkImageGeneratorCG { -SK_API std::unique_ptr MakeFromEncodedCG(sk_sp); -} // namespace SkImageGeneratorCG - -#endif //defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorNDK.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorNDK.h deleted file mode 100644 index 739a586f0d169d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorNDK.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageGeneratorNDK_DEFINED -#define SkImageGeneratorNDK_DEFINED - -#include "include/core/SkTypes.h" -#ifdef SK_ENABLE_NDK_IMAGES - -#include "include/core/SkData.h" -#include "include/core/SkImageGenerator.h" - -#include - -namespace SkImageGeneratorNDK { -/** - * Create a generator that uses the Android NDK's APIs for decoding images. - * - * Only supported on devices where __ANDROID_API__ >= 30. - * - * As with SkCodec, the SkColorSpace passed to getPixels() determines the - * type of color space transformations to apply. A null SkColorSpace means to - * apply none. - * - * A note on scaling: Calling getPixels() on the resulting SkImageGenerator - * with dimensions that do not match getInfo() requests a scale. For WebP - * files, dimensions smaller than those of getInfo are supported. For Jpeg - * files, dimensions of 1/2, 1/4, and 1/8 are supported. TODO: Provide an - * API like SkCodecImageGenerator::getScaledDimensions() to report which - * dimensions are supported? - */ -SK_API std::unique_ptr MakeFromEncodedNDK(sk_sp); -} - -#endif // SK_ENABLE_NDK_IMAGES -#endif // SkImageGeneratorNDK_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorWIC.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorWIC.h deleted file mode 100644 index eb57a209567aed..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkImageGeneratorWIC.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/core/SkTypes.h" - -#if defined(SK_BUILD_FOR_WIN) - -#include "include/core/SkData.h" -#include "include/core/SkImageGenerator.h" - -#include - -/* - * Any Windows program that uses COM must initialize the COM library by calling - * the CoInitializeEx function. In addition, each thread that uses a COM - * interface must make a separate call to this function. - * - * For every successful call to CoInitializeEx, the thread must call - * CoUninitialize before it exits. - * - * SkImageGeneratorWIC requires the COM library and leaves it to the client to - * initialize COM for their application. - * - * For more information on initializing COM, please see: - * https://msdn.microsoft.com/en-us/library/windows/desktop/ff485844.aspx - */ -namespace SkImageGeneratorWIC { -SK_API std::unique_ptr MakeFromEncodedWIC(sk_sp); -} - -#endif // SK_BUILD_FOR_WIN diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkRemotableFontMgr.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkRemotableFontMgr.h deleted file mode 100644 index 8017b77cd9a76e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkRemotableFontMgr.h +++ /dev/null @@ -1,139 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRemotableFontMgr_DEFINED -#define SkRemotableFontMgr_DEFINED - -#include "include/core/SkFontStyle.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTemplates.h" - -class SkDataTable; -class SkStreamAsset; - -struct SK_API SkFontIdentity { - static const uint32_t kInvalidDataId = 0xFFFFFFFF; - - // Note that fDataId is a data identifier, not a font identifier. - // (fDataID, fTtcIndex) can be seen as a font identifier. - uint32_t fDataId; - uint32_t fTtcIndex; - - // On Linux/FontConfig there is also the ability to specify preferences for rendering - // antialias, embedded bitmaps, autohint, hinting, hintstyle, lcd rendering - // may all be set or set to no-preference - // (No-preference is resolved against globals set by the platform) - // Since they may be selected against, these are really 'extensions' to SkFontStyle. - // SkFontStyle should pick these up. - SkFontStyle fFontStyle; -}; - -class SK_API SkRemotableFontIdentitySet : public SkRefCnt { -public: - SkRemotableFontIdentitySet(int count, SkFontIdentity** data); - - int count() const { return fCount; } - const SkFontIdentity& at(int index) const { return fData[index]; } - - static SkRemotableFontIdentitySet* NewEmpty(); - -private: - SkRemotableFontIdentitySet() : fCount(0), fData() { } - - friend SkRemotableFontIdentitySet* sk_remotable_font_identity_set_new(); - - int fCount; - SkAutoTArray fData; - - using INHERITED = SkRefCnt; -}; - -class SK_API SkRemotableFontMgr : public SkRefCnt { -public: - /** - * Returns all of the fonts with the given familyIndex. - * Returns NULL if the index is out of bounds. - * Returns empty if there are no fonts at the given index. - * - * The caller must unref() the returned object. - */ - virtual SkRemotableFontIdentitySet* getIndex(int familyIndex) const = 0; - - /** - * Returns the closest match to the given style in the given index. - * If there are no available fonts at the given index, the return value's - * data id will be kInvalidDataId. - */ - virtual SkFontIdentity matchIndexStyle(int familyIndex, const SkFontStyle&) const = 0; - - /** - * Returns all the fonts on the system with the given name. - * If the given name is NULL, will return the default font family. - * Never returns NULL; will return an empty set if the name is not found. - * - * It is possible that this will return fonts not accessible from - * getIndex(int) or matchIndexStyle(int, SkFontStyle) due to - * hidden or auto-activated fonts. - * - * The matching may be done in a system dependent way. The name may be - * matched case-insensitive, there may be system aliases which resolve, - * and names outside the current locale may be considered. However, this - * should only return fonts which are somehow associated with the requested - * name. - * - * The caller must unref() the returned object. - */ - virtual SkRemotableFontIdentitySet* matchName(const char familyName[]) const = 0; - - /** - * Returns the closest matching font to the specified name and style. - * If there are no available fonts which match the name, the return value's - * data id will be kInvalidDataId. - * If the given name is NULL, the match will be against any default fonts. - * - * It is possible that this will return a font identity not accessible from - * methods returning sets due to hidden or auto-activated fonts. - * - * The matching may be done in a system dependent way. The name may be - * matched case-insensitive, there may be system aliases which resolve, - * and names outside the current locale may be considered. However, this - * should only return a font which is somehow associated with the requested - * name. - * - * The caller must unref() the returned object. - */ - virtual SkFontIdentity matchNameStyle(const char familyName[], const SkFontStyle&) const = 0; - - /** - * Use the system fall-back to find a font for the given character. - * If no font can be found for the character, the return value's data id - * will be kInvalidDataId. - * If the name is NULL, the match will start against any default fonts. - * If the bpc47 is NULL, a default locale will be assumed. - * - * Note that bpc47 is a combination of ISO 639, 15924, and 3166-1 codes, - * so it is fine to just pass a ISO 639 here. - */ - virtual SkFontIdentity matchNameStyleCharacter(const char familyName[], const SkFontStyle&, - const char* bcp47[], int bcp47Count, - SkUnichar character) const=0; - - /** - * Returns the data for the given data id. - * Will return NULL if the data id is invalid. - * Note that this is a data id, not a font id. - * - * The caller must unref() the returned object. - */ - virtual SkStreamAsset* getData(int dataId) const = 0; - -private: - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_mac.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_mac.h deleted file mode 100644 index ec68e05492599d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_mac.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTypeface_mac_DEFINED -#define SkTypeface_mac_DEFINED - -#include "include/core/SkTypeface.h" - -#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) - -#include - -#ifdef SK_BUILD_FOR_MAC -#import -#endif - -#ifdef SK_BUILD_FOR_IOS -#include -#endif - -/** - * Like the other Typeface make methods, this returns a new reference to the - * corresponding typeface for the specified CTFontRef. - */ -SK_API extern sk_sp SkMakeTypefaceFromCTFont(CTFontRef); - -/** - * Returns the platform-specific CTFontRef handle for a - * given SkTypeface. Note that the returned CTFontRef gets - * released when the source SkTypeface is destroyed. - * - * This method is deprecated. It may only be used by Blink Mac - * legacy code in special cases related to text-shaping - * with AAT fonts, clipboard handling and font fallback. - * See https://code.google.com/p/skia/issues/detail?id=3408 - */ -SK_API extern CTFontRef SkTypeface_GetCTFontRef(const SkTypeface* face); - -#endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) -#endif // SkTypeface_mac_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_win.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_win.h deleted file mode 100644 index 8437e7a5143acd..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/ports/SkTypeface_win.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTypeface_win_DEFINED -#define SkTypeface_win_DEFINED - -#include "include/core/SkTypeface.h" -#include "include/core/SkTypes.h" - -#ifdef SK_BUILD_FOR_WIN - -#ifdef UNICODE -typedef struct tagLOGFONTW LOGFONTW; -typedef LOGFONTW LOGFONT; -#else -typedef struct tagLOGFONTA LOGFONTA; -typedef LOGFONTA LOGFONT; -#endif // UNICODE - -/** - * Like the other Typeface create methods, this returns a new reference to the - * corresponding typeface for the specified logfont. The caller is responsible - * for calling unref() when it is finished. - */ -SK_API SkTypeface* SkCreateTypefaceFromLOGFONT(const LOGFONT&); - -/** - * Copy the LOGFONT associated with this typeface into the lf parameter. Note - * that the lfHeight will need to be set afterwards, since the typeface does - * not track this (the paint does). - * typeface may be NULL, in which case we return the logfont for the default font. - */ -SK_API void SkLOGFONTFromTypeface(const SkTypeface* typeface, LOGFONT* lf); - -/** - * Set an optional callback to ensure that the data behind a LOGFONT is loaded. - * This will get called if Skia tries to access the data but hits a failure. - * Normally this is null, and is only required if the font data needs to be - * remotely (re)loaded. - */ -SK_API void SkTypeface_SetEnsureLOGFONTAccessibleProc(void (*)(const LOGFONT&)); - -// Experimental! -// -class SkFontMgr; -class SkRemotableFontMgr; -struct IDWriteFactory; -struct IDWriteFontCollection; -struct IDWriteFontFallback; - -SK_API sk_sp SkFontMgr_New_GDI(); -SK_API sk_sp SkFontMgr_New_DirectWrite(IDWriteFactory* factory = nullptr, - IDWriteFontCollection* collection = nullptr); -SK_API sk_sp SkFontMgr_New_DirectWrite(IDWriteFactory* factory, - IDWriteFontCollection* collection, - IDWriteFontFallback* fallback); - -/** - * Creates an SkFontMgr which renders using DirectWrite and obtains its data - * from the SkRemotableFontMgr. - * - * If DirectWrite could not be initialized, will return NULL. - */ -SK_API sk_sp SkFontMgr_New_DirectWriteRenderer(sk_sp); - -/** - * Creates an SkRemotableFontMgr backed by DirectWrite using the default - * system font collection in the current locale. - * - * If DirectWrite could not be initialized, will return NULL. - */ -SK_API sk_sp SkRemotableFontMgr_New_DirectWrite(); - -#endif // SK_BUILD_FOR_WIN -#endif // SkTypeface_win_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SingleOwner.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SingleOwner.h deleted file mode 100644 index f60f7c83b969ca..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SingleOwner.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_SingleOwner_DEFINED -#define skgpu_SingleOwner_DEFINED - -#include "include/core/SkTypes.h" - -#ifdef SK_DEBUG -#include "include/private/SkMutex.h" -#include "include/private/SkThreadID.h" -#endif - -namespace skgpu { - -#ifdef SK_DEBUG - -#define SKGPU_ASSERT_SINGLE_OWNER(obj) \ - skgpu::SingleOwner::AutoEnforce debug_SingleOwner(obj, __FILE__, __LINE__); - -// This is a debug tool to verify an object is only being used from one thread at a time. -class SingleOwner { -public: - SingleOwner() : fOwner(kIllegalThreadID), fReentranceCount(0) {} - - struct AutoEnforce { - AutoEnforce(SingleOwner* so, const char* file, int line) - : fFile(file), fLine(line), fSO(so) { - fSO->enter(file, line); - } - ~AutoEnforce() { fSO->exit(fFile, fLine); } - - const char* fFile; - int fLine; - SingleOwner* fSO; - }; - -private: - void enter(const char* file, int line) { - SkAutoMutexExclusive lock(fMutex); - SkThreadID self = SkGetThreadID(); - SkASSERTF(fOwner == self || fOwner == kIllegalThreadID, "%s:%d Single owner failure.", - file, line); - fReentranceCount++; - fOwner = self; - } - - void exit(const char* file, int line) { - SkAutoMutexExclusive lock(fMutex); - SkASSERTF(fOwner == SkGetThreadID(), "%s:%d Single owner failure.", file, line); - fReentranceCount--; - if (fReentranceCount == 0) { - fOwner = kIllegalThreadID; - } - } - - SkMutex fMutex; - SkThreadID fOwner SK_GUARDED_BY(fMutex); - int fReentranceCount SK_GUARDED_BY(fMutex); -}; -#else -#define SKGPU_ASSERT_SINGLE_OWNER(obj) -class SingleOwner {}; // Provide a no-op implementation so we can pass pointers to constructors -#endif - -} // namespace skgpu - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkBitmaskEnum.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkBitmaskEnum.h deleted file mode 100644 index b25045359d837a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkBitmaskEnum.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkEnumOperators_DEFINED -#define SkEnumOperators_DEFINED - -#include - -namespace sknonstd { -template struct is_bitmask_enum : std::false_type {}; - -template -std::enable_if_t::value, bool> constexpr Any(E e) { - return static_cast>(e) != 0; -} -} // namespace sknonstd - -template -std::enable_if_t::value, E> constexpr operator|(E l, E r) { - using U = std::underlying_type_t; - return static_cast(static_cast(l) | static_cast(r)); -} - -template -std::enable_if_t::value, E&> constexpr operator|=(E& l, E r) { - return l = l | r; -} - -template -std::enable_if_t::value, E> constexpr operator&(E l, E r) { - using U = std::underlying_type_t; - return static_cast(static_cast(l) & static_cast(r)); -} - -template -std::enable_if_t::value, E&> constexpr operator&=(E& l, E r) { - return l = l & r; -} - -template -std::enable_if_t::value, E> constexpr operator^(E l, E r) { - using U = std::underlying_type_t; - return static_cast(static_cast(l) ^ static_cast(r)); -} - -template -std::enable_if_t::value, E&> constexpr operator^=(E& l, E r) { - return l = l ^ r; -} - -template -std::enable_if_t::value, E> constexpr operator~(E e) { - return static_cast(~static_cast>(e)); -} - -#endif // SkEnumOperators_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkChecksum.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkChecksum.h deleted file mode 100644 index 235649feec3e37..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkChecksum.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkChecksum_DEFINED -#define SkChecksum_DEFINED - -#include "include/core/SkString.h" -#include "include/core/SkTypes.h" -#include "include/private/SkNoncopyable.h" -#include "include/private/SkOpts_spi.h" -#include "include/private/SkTLogic.h" - -#include -#include - -class SkChecksum : SkNoncopyable { -public: - /** - * uint32_t -> uint32_t hash, useful for when you're about to trucate this hash but you - * suspect its low bits aren't well mixed. - * - * This is the Murmur3 finalizer. - */ - static uint32_t Mix(uint32_t hash) { - hash ^= hash >> 16; - hash *= 0x85ebca6b; - hash ^= hash >> 13; - hash *= 0xc2b2ae35; - hash ^= hash >> 16; - return hash; - } - - /** - * uint32_t -> uint32_t hash, useful for when you're about to trucate this hash but you - * suspect its low bits aren't well mixed. - * - * This version is 2-lines cheaper than Mix, but seems to be sufficient for the font cache. - */ - static uint32_t CheapMix(uint32_t hash) { - hash ^= hash >> 16; - hash *= 0x85ebca6b; - hash ^= hash >> 16; - return hash; - } -}; - -// SkGoodHash should usually be your first choice in hashing data. -// It should be both reasonably fast and high quality. -struct SkGoodHash { - template - std::enable_if_t operator()(const K& k) const { - return SkChecksum::Mix(*(const uint32_t*)&k); - } - - template - std::enable_if_t operator()(const K& k) const { - return SkOpts::hash_fn(&k, sizeof(K), 0); - } - - uint32_t operator()(const SkString& k) const { - return SkOpts::hash_fn(k.c_str(), k.size(), 0); - } - - uint32_t operator()(const std::string& k) const { - return SkOpts::hash_fn(k.c_str(), k.size(), 0); - } - - uint32_t operator()(std::string_view k) const { - return SkOpts::hash_fn(k.data(), k.size(), 0); - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkColorData.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkColorData.h deleted file mode 100644 index 5761df2c0b5d4f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkColorData.h +++ /dev/null @@ -1,411 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkColorData_DEFINED -#define SkColorData_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkColorPriv.h" -#include "include/private/SkTo.h" -#include "include/private/SkVx.h" - -//////////////////////////////////////////////////////////////////////////////////////////// -// Convert a 16bit pixel to a 32bit pixel - -#define SK_R16_BITS 5 -#define SK_G16_BITS 6 -#define SK_B16_BITS 5 - -#define SK_R16_SHIFT (SK_B16_BITS + SK_G16_BITS) -#define SK_G16_SHIFT (SK_B16_BITS) -#define SK_B16_SHIFT 0 - -#define SK_R16_MASK ((1 << SK_R16_BITS) - 1) -#define SK_G16_MASK ((1 << SK_G16_BITS) - 1) -#define SK_B16_MASK ((1 << SK_B16_BITS) - 1) - -#define SkGetPackedR16(color) (((unsigned)(color) >> SK_R16_SHIFT) & SK_R16_MASK) -#define SkGetPackedG16(color) (((unsigned)(color) >> SK_G16_SHIFT) & SK_G16_MASK) -#define SkGetPackedB16(color) (((unsigned)(color) >> SK_B16_SHIFT) & SK_B16_MASK) - -static inline unsigned SkR16ToR32(unsigned r) { - return (r << (8 - SK_R16_BITS)) | (r >> (2 * SK_R16_BITS - 8)); -} - -static inline unsigned SkG16ToG32(unsigned g) { - return (g << (8 - SK_G16_BITS)) | (g >> (2 * SK_G16_BITS - 8)); -} - -static inline unsigned SkB16ToB32(unsigned b) { - return (b << (8 - SK_B16_BITS)) | (b >> (2 * SK_B16_BITS - 8)); -} - -#define SkPacked16ToR32(c) SkR16ToR32(SkGetPackedR16(c)) -#define SkPacked16ToG32(c) SkG16ToG32(SkGetPackedG16(c)) -#define SkPacked16ToB32(c) SkB16ToB32(SkGetPackedB16(c)) - -////////////////////////////////////////////////////////////////////////////// - -#define SkASSERT_IS_BYTE(x) SkASSERT(0 == ((x) & ~0xFFu)) - -// Reverse the bytes coorsponding to RED and BLUE in a packed pixels. Note the -// pair of them are in the same 2 slots in both RGBA and BGRA, thus there is -// no need to pass in the colortype to this function. -static inline uint32_t SkSwizzle_RB(uint32_t c) { - static const uint32_t kRBMask = (0xFF << SK_R32_SHIFT) | (0xFF << SK_B32_SHIFT); - - unsigned c0 = (c >> SK_R32_SHIFT) & 0xFF; - unsigned c1 = (c >> SK_B32_SHIFT) & 0xFF; - return (c & ~kRBMask) | (c0 << SK_B32_SHIFT) | (c1 << SK_R32_SHIFT); -} - -static inline uint32_t SkPackARGB_as_RGBA(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - SkASSERT_IS_BYTE(a); - SkASSERT_IS_BYTE(r); - SkASSERT_IS_BYTE(g); - SkASSERT_IS_BYTE(b); - return (a << SK_RGBA_A32_SHIFT) | (r << SK_RGBA_R32_SHIFT) | - (g << SK_RGBA_G32_SHIFT) | (b << SK_RGBA_B32_SHIFT); -} - -static inline uint32_t SkPackARGB_as_BGRA(U8CPU a, U8CPU r, U8CPU g, U8CPU b) { - SkASSERT_IS_BYTE(a); - SkASSERT_IS_BYTE(r); - SkASSERT_IS_BYTE(g); - SkASSERT_IS_BYTE(b); - return (a << SK_BGRA_A32_SHIFT) | (r << SK_BGRA_R32_SHIFT) | - (g << SK_BGRA_G32_SHIFT) | (b << SK_BGRA_B32_SHIFT); -} - -static inline SkPMColor SkSwizzle_RGBA_to_PMColor(uint32_t c) { -#ifdef SK_PMCOLOR_IS_RGBA - return c; -#else - return SkSwizzle_RB(c); -#endif -} - -static inline SkPMColor SkSwizzle_BGRA_to_PMColor(uint32_t c) { -#ifdef SK_PMCOLOR_IS_BGRA - return c; -#else - return SkSwizzle_RB(c); -#endif -} - -////////////////////////////////////////////////////////////////////////////// - -///@{ -/** See ITU-R Recommendation BT.709 at http://www.itu.int/rec/R-REC-BT.709/ .*/ -#define SK_ITU_BT709_LUM_COEFF_R (0.2126f) -#define SK_ITU_BT709_LUM_COEFF_G (0.7152f) -#define SK_ITU_BT709_LUM_COEFF_B (0.0722f) -///@} - -///@{ -/** A float value which specifies this channel's contribution to luminance. */ -#define SK_LUM_COEFF_R SK_ITU_BT709_LUM_COEFF_R -#define SK_LUM_COEFF_G SK_ITU_BT709_LUM_COEFF_G -#define SK_LUM_COEFF_B SK_ITU_BT709_LUM_COEFF_B -///@} - -/** Computes the luminance from the given r, g, and b in accordance with - SK_LUM_COEFF_X. For correct results, r, g, and b should be in linear space. -*/ -static inline U8CPU SkComputeLuminance(U8CPU r, U8CPU g, U8CPU b) { - //The following is - //r * SK_LUM_COEFF_R + g * SK_LUM_COEFF_G + b * SK_LUM_COEFF_B - //with SK_LUM_COEFF_X in 1.8 fixed point (rounding adjusted to sum to 256). - return (r * 54 + g * 183 + b * 19) >> 8; -} - -/** Calculates 256 - (value * alpha256) / 255 in range [0,256], - * for [0,255] value and [0,256] alpha256. - */ -static inline U16CPU SkAlphaMulInv256(U16CPU value, U16CPU alpha256) { - unsigned prod = 0xFFFF - value * alpha256; - return (prod + (prod >> 8)) >> 8; -} - -// The caller may want negative values, so keep all params signed (int) -// so we don't accidentally slip into unsigned math and lose the sign -// extension when we shift (in SkAlphaMul) -static inline int SkAlphaBlend(int src, int dst, int scale256) { - SkASSERT((unsigned)scale256 <= 256); - return dst + SkAlphaMul(src - dst, scale256); -} - -static inline uint16_t SkPackRGB16(unsigned r, unsigned g, unsigned b) { - SkASSERT(r <= SK_R16_MASK); - SkASSERT(g <= SK_G16_MASK); - SkASSERT(b <= SK_B16_MASK); - - return SkToU16((r << SK_R16_SHIFT) | (g << SK_G16_SHIFT) | (b << SK_B16_SHIFT)); -} - -#define SK_R16_MASK_IN_PLACE (SK_R16_MASK << SK_R16_SHIFT) -#define SK_G16_MASK_IN_PLACE (SK_G16_MASK << SK_G16_SHIFT) -#define SK_B16_MASK_IN_PLACE (SK_B16_MASK << SK_B16_SHIFT) - -/////////////////////////////////////////////////////////////////////////////// - -/** - * Abstract 4-byte interpolation, implemented on top of SkPMColor - * utility functions. Third parameter controls blending of the first two: - * (src, dst, 0) returns dst - * (src, dst, 0xFF) returns src - * scale is [0..256], unlike SkFourByteInterp which takes [0..255] - */ -static inline SkPMColor SkFourByteInterp256(SkPMColor src, SkPMColor dst, int scale) { - unsigned a = SkTo(SkAlphaBlend(SkGetPackedA32(src), SkGetPackedA32(dst), scale)); - unsigned r = SkTo(SkAlphaBlend(SkGetPackedR32(src), SkGetPackedR32(dst), scale)); - unsigned g = SkTo(SkAlphaBlend(SkGetPackedG32(src), SkGetPackedG32(dst), scale)); - unsigned b = SkTo(SkAlphaBlend(SkGetPackedB32(src), SkGetPackedB32(dst), scale)); - - return SkPackARGB32(a, r, g, b); -} - -/** - * Abstract 4-byte interpolation, implemented on top of SkPMColor - * utility functions. Third parameter controls blending of the first two: - * (src, dst, 0) returns dst - * (src, dst, 0xFF) returns src - */ -static inline SkPMColor SkFourByteInterp(SkPMColor src, SkPMColor dst, U8CPU srcWeight) { - int scale = (int)SkAlpha255To256(srcWeight); - return SkFourByteInterp256(src, dst, scale); -} - -/** - * 0xAARRGGBB -> 0x00AA00GG, 0x00RR00BB - */ -static inline void SkSplay(uint32_t color, uint32_t* ag, uint32_t* rb) { - const uint32_t mask = 0x00FF00FF; - *ag = (color >> 8) & mask; - *rb = color & mask; -} - -/** - * 0xAARRGGBB -> 0x00AA00GG00RR00BB - * (note, ARGB -> AGRB) - */ -static inline uint64_t SkSplay(uint32_t color) { - const uint32_t mask = 0x00FF00FF; - uint64_t agrb = (color >> 8) & mask; // 0x0000000000AA00GG - agrb <<= 32; // 0x00AA00GG00000000 - agrb |= color & mask; // 0x00AA00GG00RR00BB - return agrb; -} - -/** - * 0xAAxxGGxx, 0xRRxxBBxx-> 0xAARRGGBB - */ -static inline uint32_t SkUnsplay(uint32_t ag, uint32_t rb) { - const uint32_t mask = 0xFF00FF00; - return (ag & mask) | ((rb & mask) >> 8); -} - -/** - * 0xAAxxGGxxRRxxBBxx -> 0xAARRGGBB - * (note, AGRB -> ARGB) - */ -static inline uint32_t SkUnsplay(uint64_t agrb) { - const uint32_t mask = 0xFF00FF00; - return SkPMColor( - ((agrb & mask) >> 8) | // 0x00RR00BB - ((agrb >> 32) & mask)); // 0xAARRGGBB -} - -static inline SkPMColor SkFastFourByteInterp256_32(SkPMColor src, SkPMColor dst, unsigned scale) { - SkASSERT(scale <= 256); - - // Two 8-bit blends per two 32-bit registers, with space to make sure the math doesn't collide. - uint32_t src_ag, src_rb, dst_ag, dst_rb; - SkSplay(src, &src_ag, &src_rb); - SkSplay(dst, &dst_ag, &dst_rb); - - const uint32_t ret_ag = src_ag * scale + (256 - scale) * dst_ag; - const uint32_t ret_rb = src_rb * scale + (256 - scale) * dst_rb; - - return SkUnsplay(ret_ag, ret_rb); -} - -static inline SkPMColor SkFastFourByteInterp256_64(SkPMColor src, SkPMColor dst, unsigned scale) { - SkASSERT(scale <= 256); - // Four 8-bit blends in one 64-bit register, with space to make sure the math doesn't collide. - return SkUnsplay(SkSplay(src) * scale + (256-scale) * SkSplay(dst)); -} - -// TODO(mtklein): Replace slow versions with fast versions, using scale + (scale>>7) everywhere. - -/** - * Same as SkFourByteInterp256, but faster. - */ -static inline SkPMColor SkFastFourByteInterp256(SkPMColor src, SkPMColor dst, unsigned scale) { - // On a 64-bit machine, _64 is about 10% faster than _32, but ~40% slower on a 32-bit machine. - if (sizeof(void*) == 4) { - return SkFastFourByteInterp256_32(src, dst, scale); - } else { - return SkFastFourByteInterp256_64(src, dst, scale); - } -} - -/** - * Nearly the same as SkFourByteInterp, but faster and a touch more accurate, due to better - * srcWeight scaling to [0, 256]. - */ -static inline SkPMColor SkFastFourByteInterp(SkPMColor src, SkPMColor dst, U8CPU srcWeight) { - SkASSERT(srcWeight <= 255); - // scale = srcWeight + (srcWeight >> 7) is more accurate than - // scale = srcWeight + 1, but 7% slower - return SkFastFourByteInterp256(src, dst, srcWeight + (srcWeight >> 7)); -} - -/** - * Interpolates between colors src and dst using [0,256] scale. - */ -static inline SkPMColor SkPMLerp(SkPMColor src, SkPMColor dst, unsigned scale) { - return SkFastFourByteInterp256(src, dst, scale); -} - -static inline SkPMColor SkBlendARGB32(SkPMColor src, SkPMColor dst, U8CPU aa) { - SkASSERT((unsigned)aa <= 255); - - unsigned src_scale = SkAlpha255To256(aa); - unsigned dst_scale = SkAlphaMulInv256(SkGetPackedA32(src), src_scale); - - const uint32_t mask = 0xFF00FF; - - uint32_t src_rb = (src & mask) * src_scale; - uint32_t src_ag = ((src >> 8) & mask) * src_scale; - - uint32_t dst_rb = (dst & mask) * dst_scale; - uint32_t dst_ag = ((dst >> 8) & mask) * dst_scale; - - return (((src_rb + dst_rb) >> 8) & mask) | ((src_ag + dst_ag) & ~mask); -} - -//////////////////////////////////////////////////////////////////////////////////////////// -// Convert a 32bit pixel to a 16bit pixel (no dither) - -#define SkR32ToR16_MACRO(r) ((unsigned)(r) >> (SK_R32_BITS - SK_R16_BITS)) -#define SkG32ToG16_MACRO(g) ((unsigned)(g) >> (SK_G32_BITS - SK_G16_BITS)) -#define SkB32ToB16_MACRO(b) ((unsigned)(b) >> (SK_B32_BITS - SK_B16_BITS)) - -#ifdef SK_DEBUG - static inline unsigned SkR32ToR16(unsigned r) { - SkR32Assert(r); - return SkR32ToR16_MACRO(r); - } - static inline unsigned SkG32ToG16(unsigned g) { - SkG32Assert(g); - return SkG32ToG16_MACRO(g); - } - static inline unsigned SkB32ToB16(unsigned b) { - SkB32Assert(b); - return SkB32ToB16_MACRO(b); - } -#else - #define SkR32ToR16(r) SkR32ToR16_MACRO(r) - #define SkG32ToG16(g) SkG32ToG16_MACRO(g) - #define SkB32ToB16(b) SkB32ToB16_MACRO(b) -#endif - -static inline U16CPU SkPixel32ToPixel16(SkPMColor c) { - unsigned r = ((c >> (SK_R32_SHIFT + (8 - SK_R16_BITS))) & SK_R16_MASK) << SK_R16_SHIFT; - unsigned g = ((c >> (SK_G32_SHIFT + (8 - SK_G16_BITS))) & SK_G16_MASK) << SK_G16_SHIFT; - unsigned b = ((c >> (SK_B32_SHIFT + (8 - SK_B16_BITS))) & SK_B16_MASK) << SK_B16_SHIFT; - return r | g | b; -} - -static inline U16CPU SkPack888ToRGB16(U8CPU r, U8CPU g, U8CPU b) { - return (SkR32ToR16(r) << SK_R16_SHIFT) | - (SkG32ToG16(g) << SK_G16_SHIFT) | - (SkB32ToB16(b) << SK_B16_SHIFT); -} - -///////////////////////////////////////////////////////////////////////////////////////// - -static inline SkColor SkPixel16ToColor(U16CPU src) { - SkASSERT(src == SkToU16(src)); - - unsigned r = SkPacked16ToR32(src); - unsigned g = SkPacked16ToG32(src); - unsigned b = SkPacked16ToB32(src); - - SkASSERT((r >> (8 - SK_R16_BITS)) == SkGetPackedR16(src)); - SkASSERT((g >> (8 - SK_G16_BITS)) == SkGetPackedG16(src)); - SkASSERT((b >> (8 - SK_B16_BITS)) == SkGetPackedB16(src)); - - return SkColorSetRGB(r, g, b); -} - -/////////////////////////////////////////////////////////////////////////////// - -typedef uint16_t SkPMColor16; - -// Put in OpenGL order (r g b a) -#define SK_A4444_SHIFT 0 -#define SK_R4444_SHIFT 12 -#define SK_G4444_SHIFT 8 -#define SK_B4444_SHIFT 4 - -static inline U8CPU SkReplicateNibble(unsigned nib) { - SkASSERT(nib <= 0xF); - return (nib << 4) | nib; -} - -#define SkGetPackedA4444(c) (((unsigned)(c) >> SK_A4444_SHIFT) & 0xF) -#define SkGetPackedR4444(c) (((unsigned)(c) >> SK_R4444_SHIFT) & 0xF) -#define SkGetPackedG4444(c) (((unsigned)(c) >> SK_G4444_SHIFT) & 0xF) -#define SkGetPackedB4444(c) (((unsigned)(c) >> SK_B4444_SHIFT) & 0xF) - -#define SkPacked4444ToA32(c) SkReplicateNibble(SkGetPackedA4444(c)) - -static inline SkPMColor SkPixel4444ToPixel32(U16CPU c) { - uint32_t d = (SkGetPackedA4444(c) << SK_A32_SHIFT) | - (SkGetPackedR4444(c) << SK_R32_SHIFT) | - (SkGetPackedG4444(c) << SK_G32_SHIFT) | - (SkGetPackedB4444(c) << SK_B32_SHIFT); - return d | (d << 4); -} - -static inline skvx::float4 swizzle_rb(const skvx::float4& x) { - return skvx::shuffle<2, 1, 0, 3>(x); -} - -static inline skvx::float4 swizzle_rb_if_bgra(const skvx::float4& x) { -#ifdef SK_PMCOLOR_IS_BGRA - return swizzle_rb(x); -#else - return x; -#endif -} - -static inline skvx::float4 Sk4f_fromL32(uint32_t px) { - return skvx::cast(skvx::byte4::Load(&px)) * (1 / 255.0f); -} - -static inline uint32_t Sk4f_toL32(const skvx::float4& px) { - uint32_t l32; - // For the expected positive color values, the +0.5 before the pin and cast effectively rounds - // to the nearest int without having to call round() or lrint(). - skvx::cast(pin(px * 255.f + 0.5f, skvx::float4(0.f), skvx::float4(255.f))).store(&l32); - return l32; -} - -using SkPMColor4f = SkRGBA4f; - -constexpr SkPMColor4f SK_PMColor4fTRANSPARENT = { 0, 0, 0, 0 }; -constexpr SkPMColor4f SK_PMColor4fBLACK = { 0, 0, 0, 1 }; -constexpr SkPMColor4f SK_PMColor4fWHITE = { 1, 1, 1, 1 }; -constexpr SkPMColor4f SK_PMColor4fILLEGAL = { SK_FloatNegativeInfinity, - SK_FloatNegativeInfinity, - SK_FloatNegativeInfinity, - SK_FloatNegativeInfinity }; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkDeque.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkDeque.h deleted file mode 100644 index 8adc39c1c71f22..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkDeque.h +++ /dev/null @@ -1,141 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkDeque_DEFINED -#define SkDeque_DEFINED - -#include "include/core/SkTypes.h" - -/* - * The deque class works by blindly creating memory space of a specified element - * size. It manages the memory as a doubly linked list of blocks each of which - * can contain multiple elements. Pushes and pops add/remove blocks from the - * beginning/end of the list as necessary while each block tracks the used - * portion of its memory. - * One behavior to be aware of is that the pops do not immediately remove an - * empty block from the beginning/end of the list (Presumably so push/pop pairs - * on the block boundaries don't cause thrashing). This can result in the first/ - * last element not residing in the first/last block. - */ -class SK_API SkDeque { -public: - /** - * elemSize specifies the size of each individual element in the deque - * allocCount specifies how many elements are to be allocated as a block - */ - explicit SkDeque(size_t elemSize, int allocCount = 1); - SkDeque(size_t elemSize, void* storage, size_t storageSize, int allocCount = 1); - ~SkDeque(); - - bool empty() const { return 0 == fCount; } - int count() const { return fCount; } - size_t elemSize() const { return fElemSize; } - - const void* front() const { return fFront; } - const void* back() const { return fBack; } - - void* front() { - return (void*)((const SkDeque*)this)->front(); - } - - void* back() { - return (void*)((const SkDeque*)this)->back(); - } - - /** - * push_front and push_back return a pointer to the memory space - * for the new element - */ - void* push_front(); - void* push_back(); - - void pop_front(); - void pop_back(); - -private: - struct Block; - -public: - class Iter { - public: - enum IterStart { - kFront_IterStart, - kBack_IterStart, - }; - - /** - * Creates an uninitialized iterator. Must be reset() - */ - Iter(); - - Iter(const SkDeque& d, IterStart startLoc); - void* next(); - void* prev(); - - void reset(const SkDeque& d, IterStart startLoc); - - private: - SkDeque::Block* fCurBlock; - char* fPos; - size_t fElemSize; - }; - - // Inherit privately from Iter to prevent access to reverse iteration - class F2BIter : private Iter { - public: - F2BIter() {} - - /** - * Wrap Iter's 2 parameter ctor to force initialization to the - * beginning of the deque - */ - F2BIter(const SkDeque& d) : INHERITED(d, kFront_IterStart) {} - - using Iter::next; - - /** - * Wrap Iter::reset to force initialization to the beginning of the - * deque - */ - void reset(const SkDeque& d) { - this->INHERITED::reset(d, kFront_IterStart); - } - - private: - using INHERITED = Iter; - }; - -private: - // allow unit test to call numBlocksAllocated - friend class DequeUnitTestHelper; - - void* fFront; - void* fBack; - - Block* fFrontBlock; - Block* fBackBlock; - size_t fElemSize; - void* fInitialStorage; - int fCount; // number of elements in the deque - int fAllocCount; // number of elements to allocate per block - - Block* allocateBlock(int allocCount); - void freeBlock(Block* block); - - /** - * This returns the number of chunk blocks allocated by the deque. It - * can be used to gauge the effectiveness of the selected allocCount. - */ - int numBlocksAllocated() const; - - SkDeque(const SkDeque&) = delete; - SkDeque& operator=(const SkDeque&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkEncodedInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkEncodedInfo.h deleted file mode 100644 index 74e2ad1480cefe..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkEncodedInfo.h +++ /dev/null @@ -1,272 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkEncodedInfo_DEFINED -#define SkEncodedInfo_DEFINED - -#include "include/core/SkAlphaType.h" -#include "include/core/SkColorSpace.h" -#include "include/core/SkColorType.h" -#include "include/core/SkData.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" -#include "modules/skcms/skcms.h" - -#include -#include -#include - -struct SkEncodedInfo { -public: - class ICCProfile { - public: - static std::unique_ptr Make(sk_sp); - static std::unique_ptr Make(const skcms_ICCProfile&); - - const skcms_ICCProfile* profile() const { return &fProfile; } - private: - ICCProfile(const skcms_ICCProfile&, sk_sp = nullptr); - - skcms_ICCProfile fProfile; - sk_sp fData; - }; - - enum Alpha { - kOpaque_Alpha, - kUnpremul_Alpha, - - // Each pixel is either fully opaque or fully transparent. - // There is no difference between requesting kPremul or kUnpremul. - kBinary_Alpha, - }; - - /* - * We strive to make the number of components per pixel obvious through - * our naming conventions. - * Ex: kRGB has 3 components. kRGBA has 4 components. - * - * This sometimes results in redundant Alpha and Color information. - * Ex: kRGB images must also be kOpaque. - */ - enum Color { - // PNG, WBMP - kGray_Color, - - // PNG - kGrayAlpha_Color, - - // PNG with Skia-specific sBIT - // Like kGrayAlpha, except this expects to be treated as - // kAlpha_8_SkColorType, which ignores the gray component. If - // decoded to full color (e.g. kN32), the gray component is respected - // (so it can share code with kGrayAlpha). - kXAlpha_Color, - - // PNG - // 565 images may be encoded to PNG by specifying the number of - // significant bits for each channel. This is a strange 565 - // representation because the image is still encoded with 8 bits per - // component. - k565_Color, - - // PNG, GIF, BMP - kPalette_Color, - - // PNG, RAW - kRGB_Color, - kRGBA_Color, - - // BMP - kBGR_Color, - kBGRX_Color, - kBGRA_Color, - - // JPEG, WEBP - kYUV_Color, - - // WEBP - kYUVA_Color, - - // JPEG - // Photoshop actually writes inverted CMYK data into JPEGs, where zero - // represents 100% ink coverage. For this reason, we treat CMYK JPEGs - // as having inverted CMYK. libjpeg-turbo warns that this may break - // other applications, but the CMYK JPEGs we see on the web expect to - // be treated as inverted CMYK. - kInvertedCMYK_Color, - kYCCK_Color, - }; - - static SkEncodedInfo Make(int width, int height, Color color, Alpha alpha, - int bitsPerComponent) { - return Make(width, height, color, alpha, bitsPerComponent, nullptr); - } - - static SkEncodedInfo Make(int width, int height, Color color, - Alpha alpha, int bitsPerComponent, std::unique_ptr profile) { - return Make(width, height, color, alpha, /*bitsPerComponent*/ bitsPerComponent, - std::move(profile), /*colorDepth*/ bitsPerComponent); - } - - static SkEncodedInfo Make(int width, int height, Color color, - Alpha alpha, int bitsPerComponent, std::unique_ptr profile, - int colorDepth) { - SkASSERT(1 == bitsPerComponent || - 2 == bitsPerComponent || - 4 == bitsPerComponent || - 8 == bitsPerComponent || - 16 == bitsPerComponent); - - switch (color) { - case kGray_Color: - SkASSERT(kOpaque_Alpha == alpha); - break; - case kGrayAlpha_Color: - SkASSERT(kOpaque_Alpha != alpha); - break; - case kPalette_Color: - SkASSERT(16 != bitsPerComponent); - break; - case kRGB_Color: - case kBGR_Color: - case kBGRX_Color: - SkASSERT(kOpaque_Alpha == alpha); - SkASSERT(bitsPerComponent >= 8); - break; - case kYUV_Color: - case kInvertedCMYK_Color: - case kYCCK_Color: - SkASSERT(kOpaque_Alpha == alpha); - SkASSERT(8 == bitsPerComponent); - break; - case kRGBA_Color: - SkASSERT(bitsPerComponent >= 8); - break; - case kBGRA_Color: - case kYUVA_Color: - SkASSERT(8 == bitsPerComponent); - break; - case kXAlpha_Color: - SkASSERT(kUnpremul_Alpha == alpha); - SkASSERT(8 == bitsPerComponent); - break; - case k565_Color: - SkASSERT(kOpaque_Alpha == alpha); - SkASSERT(8 == bitsPerComponent); - break; - default: - SkASSERT(false); - break; - } - - return SkEncodedInfo(width, height, color, alpha, - bitsPerComponent, colorDepth, std::move(profile)); - } - - /* - * Returns a recommended SkImageInfo. - * - * TODO: Leave this up to the client. - */ - SkImageInfo makeImageInfo() const { - auto ct = kGray_Color == fColor ? kGray_8_SkColorType : - kXAlpha_Color == fColor ? kAlpha_8_SkColorType : - k565_Color == fColor ? kRGB_565_SkColorType : - kN32_SkColorType ; - auto alpha = kOpaque_Alpha == fAlpha ? kOpaque_SkAlphaType - : kUnpremul_SkAlphaType; - sk_sp cs = fProfile ? SkColorSpace::Make(*fProfile->profile()) - : nullptr; - if (!cs) { - cs = SkColorSpace::MakeSRGB(); - } - return SkImageInfo::Make(fWidth, fHeight, ct, alpha, std::move(cs)); - } - - int width() const { return fWidth; } - int height() const { return fHeight; } - Color color() const { return fColor; } - Alpha alpha() const { return fAlpha; } - bool opaque() const { return fAlpha == kOpaque_Alpha; } - const skcms_ICCProfile* profile() const { - if (!fProfile) return nullptr; - return fProfile->profile(); - } - - uint8_t bitsPerComponent() const { return fBitsPerComponent; } - - uint8_t bitsPerPixel() const { - switch (fColor) { - case kGray_Color: - return fBitsPerComponent; - case kXAlpha_Color: - case kGrayAlpha_Color: - return 2 * fBitsPerComponent; - case kPalette_Color: - return fBitsPerComponent; - case kRGB_Color: - case kBGR_Color: - case kYUV_Color: - case k565_Color: - return 3 * fBitsPerComponent; - case kRGBA_Color: - case kBGRA_Color: - case kBGRX_Color: - case kYUVA_Color: - case kInvertedCMYK_Color: - case kYCCK_Color: - return 4 * fBitsPerComponent; - default: - SkASSERT(false); - return 0; - } - } - - SkEncodedInfo(const SkEncodedInfo& orig) = delete; - SkEncodedInfo& operator=(const SkEncodedInfo&) = delete; - - SkEncodedInfo(SkEncodedInfo&& orig) = default; - SkEncodedInfo& operator=(SkEncodedInfo&&) = default; - - // Explicit copy method, to avoid accidental copying. - SkEncodedInfo copy() const { - auto copy = SkEncodedInfo::Make( - fWidth, fHeight, fColor, fAlpha, fBitsPerComponent, nullptr, fColorDepth); - if (fProfile) { - copy.fProfile = std::make_unique(*fProfile); - } - return copy; - } - - // Return number of bits of R/G/B channel - uint8_t getColorDepth() const { - return fColorDepth; - } - -private: - SkEncodedInfo(int width, int height, Color color, Alpha alpha, - uint8_t bitsPerComponent, uint8_t colorDepth, std::unique_ptr profile) - : fWidth(width) - , fHeight(height) - , fColor(color) - , fAlpha(alpha) - , fBitsPerComponent(bitsPerComponent) - , fColorDepth(colorDepth) - , fProfile(std::move(profile)) - {} - - int fWidth; - int fHeight; - Color fColor; - Alpha fAlpha; - uint8_t fBitsPerComponent; - uint8_t fColorDepth; - std::unique_ptr fProfile; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFixed.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFixed.h deleted file mode 100644 index e34c19f2ac8671..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFixed.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFixed_DEFINED -#define SkFixed_DEFINED - -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/private/SkSafe_math.h" -#include "include/private/SkTPin.h" -#include "include/private/SkTo.h" - -/** \file SkFixed.h - - Types and macros for 16.16 fixed point -*/ - -/** 32 bit signed integer used to represent fractions values with 16 bits to the right of the decimal point -*/ -typedef int32_t SkFixed; -#define SK_Fixed1 (1 << 16) -#define SK_FixedHalf (1 << 15) -#define SK_FixedQuarter (1 << 14) -#define SK_FixedMax (0x7FFFFFFF) -#define SK_FixedMin (-SK_FixedMax) -#define SK_FixedPI (0x3243F) -#define SK_FixedSqrt2 (92682) -#define SK_FixedTanPIOver8 (0x6A0A) -#define SK_FixedRoot2Over2 (0xB505) - -// NOTE: SkFixedToFloat is exact. SkFloatToFixed seems to lack a rounding step. For all fixed-point -// values, this version is as accurate as possible for (fixed -> float -> fixed). Rounding reduces -// accuracy if the intermediate floats are in the range that only holds integers (adding 0.5f to an -// odd integer then snaps to nearest even). Using double for the rounding math gives maximum -// accuracy for (float -> fixed -> float), but that's usually overkill. -#define SkFixedToFloat(x) ((x) * 1.52587890625e-5f) -#define SkFloatToFixed(x) sk_float_saturate2int((x) * SK_Fixed1) - -#ifdef SK_DEBUG - static inline SkFixed SkFloatToFixed_Check(float x) { - int64_t n64 = (int64_t)(x * SK_Fixed1); - SkFixed n32 = (SkFixed)n64; - SkASSERT(n64 == n32); - return n32; - } -#else - #define SkFloatToFixed_Check(x) SkFloatToFixed(x) -#endif - -#define SkFixedToDouble(x) ((x) * 1.52587890625e-5) -#define SkDoubleToFixed(x) ((SkFixed)((x) * SK_Fixed1)) - -/** Converts an integer to a SkFixed, asserting that the result does not overflow - a 32 bit signed integer -*/ -#ifdef SK_DEBUG - inline SkFixed SkIntToFixed(int n) - { - SkASSERT(n >= -32768 && n <= 32767); - // Left shifting a negative value has undefined behavior in C, so we cast to unsigned before - // shifting. - return (SkFixed)( (unsigned)n << 16 ); - } -#else - // Left shifting a negative value has undefined behavior in C, so we cast to unsigned before - // shifting. Then we force the cast to SkFixed to ensure that the answer is signed (like the - // debug version). - #define SkIntToFixed(n) (SkFixed)((unsigned)(n) << 16) -#endif - -#define SkFixedRoundToInt(x) (((x) + SK_FixedHalf) >> 16) -#define SkFixedCeilToInt(x) (((x) + SK_Fixed1 - 1) >> 16) -#define SkFixedFloorToInt(x) ((x) >> 16) - -static inline SkFixed SkFixedRoundToFixed(SkFixed x) { - return (SkFixed)( (uint32_t)(x + SK_FixedHalf) & 0xFFFF0000 ); -} -static inline SkFixed SkFixedCeilToFixed(SkFixed x) { - return (SkFixed)( (uint32_t)(x + SK_Fixed1 - 1) & 0xFFFF0000 ); -} -static inline SkFixed SkFixedFloorToFixed(SkFixed x) { - return (SkFixed)( (uint32_t)x & 0xFFFF0000 ); -} - -#define SkFixedAbs(x) SkAbs32(x) -#define SkFixedAve(a, b) (((a) + (b)) >> 1) - -// The divide may exceed 32 bits. Clamp to a signed 32 bit result. -#define SkFixedDiv(numer, denom) \ - SkToS32(SkTPin((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_MinS32, SK_MaxS32)) - -static inline SkFixed SkFixedMul(SkFixed a, SkFixed b) { - return (SkFixed)((int64_t)a * b >> 16); -} - -/////////////////////////////////////////////////////////////////////////////// -// Platform-specific alternatives to our portable versions. - -// The VCVT float-to-fixed instruction is part of the VFPv3 instruction set. -#if defined(__ARM_VFPV3__) - /* This does not handle NaN or other obscurities, but is faster than - than (int)(x*65536). When built on Android with -Os, needs forcing - to inline or we lose the speed benefit. - */ - SK_ALWAYS_INLINE SkFixed SkFloatToFixed_arm(float x) - { - int32_t y; - asm("vcvt.s32.f32 %0, %0, #16": "+w"(x)); - memcpy(&y, &x, sizeof(y)); - return y; - } - #undef SkFloatToFixed - #define SkFloatToFixed(x) SkFloatToFixed_arm(x) -#endif - -/////////////////////////////////////////////////////////////////////////////// - -#define SkFixedToScalar(x) SkFixedToFloat(x) -#define SkScalarToFixed(x) SkFloatToFixed(x) - -/////////////////////////////////////////////////////////////////////////////// - -typedef int64_t SkFixed3232; // 32.32 - -#define SkFixed3232Max SK_MaxS64 -#define SkFixed3232Min (-SkFixed3232Max) - -#define SkIntToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 32)) -#define SkFixed3232ToInt(x) ((int)((x) >> 32)) -#define SkFixedToFixed3232(x) (SkLeftShift((SkFixed3232)(x), 16)) -#define SkFixed3232ToFixed(x) ((SkFixed)((x) >> 16)) -#define SkFloatToFixed3232(x) sk_float_saturate2int64((x) * (65536.0f * 65536.0f)) -#define SkFixed3232ToFloat(x) (x * (1 / (65536.0f * 65536.0f))) - -#define SkScalarToFixed3232(x) SkFloatToFixed3232(x) - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatBits.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatBits.h deleted file mode 100644 index 89eea4b9e3495e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatBits.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2008 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFloatBits_DEFINED -#define SkFloatBits_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkSafe_math.h" - -#include - -/** Convert a sign-bit int (i.e. float interpreted as int) into a 2s compliement - int. This also converts -0 (0x80000000) to 0. Doing this to a float allows - it to be compared using normal C operators (<, <=, etc.) -*/ -static inline int32_t SkSignBitTo2sCompliment(int32_t x) { - if (x < 0) { - x &= 0x7FFFFFFF; - x = -x; - } - return x; -} - -/** Convert a 2s compliment int to a sign-bit (i.e. int interpreted as float). - This undoes the result of SkSignBitTo2sCompliment(). - */ -static inline int32_t Sk2sComplimentToSignBit(int32_t x) { - int sign = x >> 31; - // make x positive - x = (x ^ sign) - sign; - // set the sign bit as needed - x |= SkLeftShift(sign, 31); - return x; -} - -union SkFloatIntUnion { - float fFloat; - int32_t fSignBitInt; -}; - -// Helper to see a float as its bit pattern (w/o aliasing warnings) -static inline int32_t SkFloat2Bits(float x) { - SkFloatIntUnion data; - data.fFloat = x; - return data.fSignBitInt; -} - -// Helper to see a bit pattern as a float (w/o aliasing warnings) -static inline float SkBits2Float(int32_t floatAsBits) { - SkFloatIntUnion data; - data.fSignBitInt = floatAsBits; - return data.fFloat; -} - -constexpr int32_t gFloatBits_exponent_mask = 0x7F800000; -constexpr int32_t gFloatBits_matissa_mask = 0x007FFFFF; - -static inline bool SkFloatBits_IsFinite(int32_t bits) { - return (bits & gFloatBits_exponent_mask) != gFloatBits_exponent_mask; -} - -static inline bool SkFloatBits_IsInf(int32_t bits) { - return ((bits & gFloatBits_exponent_mask) == gFloatBits_exponent_mask) && - (bits & gFloatBits_matissa_mask) == 0; -} - -/** Return the float as a 2s compliment int. Just to be used to compare floats - to each other or against positive float-bit-constants (like 0). This does - not return the int equivalent of the float, just something cheaper for - compares-only. - */ -static inline int32_t SkFloatAs2sCompliment(float x) { - return SkSignBitTo2sCompliment(SkFloat2Bits(x)); -} - -/** Return the 2s compliment int as a float. This undos the result of - SkFloatAs2sCompliment - */ -static inline float Sk2sComplimentAsFloat(int32_t x) { - return SkBits2Float(Sk2sComplimentToSignBit(x)); -} - -// Scalar wrappers for float-bit routines - -#define SkScalarAs2sCompliment(x) SkFloatAs2sCompliment(x) - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatingPoint.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatingPoint.h deleted file mode 100644 index 8135abbfe1952a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkFloatingPoint.h +++ /dev/null @@ -1,222 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkFloatingPoint_DEFINED -#define SkFloatingPoint_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkFloatBits.h" -#include "include/private/SkSafe_math.h" -#include -#include -#include -#include -#include - -constexpr float SK_FloatSqrt2 = 1.41421356f; -constexpr float SK_FloatPI = 3.14159265f; -constexpr double SK_DoublePI = 3.14159265358979323846264338327950288; - -// C++98 cmath std::pow seems to be the earliest portable way to get float pow. -// However, on Linux including cmath undefines isfinite. -// http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14608 -static inline float sk_float_pow(float base, float exp) { - return powf(base, exp); -} - -#define sk_float_sqrt(x) sqrtf(x) -#define sk_float_sin(x) sinf(x) -#define sk_float_cos(x) cosf(x) -#define sk_float_tan(x) tanf(x) -#define sk_float_floor(x) floorf(x) -#define sk_float_ceil(x) ceilf(x) -#define sk_float_trunc(x) truncf(x) -#ifdef SK_BUILD_FOR_MAC -# define sk_float_acos(x) static_cast(acos(x)) -# define sk_float_asin(x) static_cast(asin(x)) -#else -# define sk_float_acos(x) acosf(x) -# define sk_float_asin(x) asinf(x) -#endif -#define sk_float_atan2(y,x) atan2f(y,x) -#define sk_float_abs(x) fabsf(x) -#define sk_float_copysign(x, y) copysignf(x, y) -#define sk_float_mod(x,y) fmodf(x,y) -#define sk_float_exp(x) expf(x) -#define sk_float_log(x) logf(x) - -constexpr float sk_float_degrees_to_radians(float degrees) { - return degrees * (SK_FloatPI / 180); -} - -constexpr float sk_float_radians_to_degrees(float radians) { - return radians * (180 / SK_FloatPI); -} - -// floor(double+0.5) vs. floorf(float+0.5f) give comparable performance, but upcasting to double -// means tricky values like 0.49999997 and 2^24 get rounded correctly. If these were rounded -// as floatf(x + .5f), they would be 1 higher than expected. -#define sk_float_round(x) (float)sk_double_round((double)(x)) - -// can't find log2f on android, but maybe that just a tool bug? -#ifdef SK_BUILD_FOR_ANDROID - static inline float sk_float_log2(float x) { - const double inv_ln_2 = 1.44269504088896; - return (float)(log(x) * inv_ln_2); - } -#else - #define sk_float_log2(x) log2f(x) -#endif - -static inline bool sk_float_isfinite(float x) { - return SkFloatBits_IsFinite(SkFloat2Bits(x)); -} - -static inline bool sk_floats_are_finite(float a, float b) { - return sk_float_isfinite(a) && sk_float_isfinite(b); -} - -static inline bool sk_floats_are_finite(const float array[], int count) { - float prod = 0; - for (int i = 0; i < count; ++i) { - prod *= array[i]; - } - // At this point, prod will either be NaN or 0 - return prod == 0; // if prod is NaN, this check will return false -} - -static inline bool sk_float_isinf(float x) { - return SkFloatBits_IsInf(SkFloat2Bits(x)); -} - -static inline bool sk_float_isnan(float x) { - return !(x == x); -} - -#define sk_double_isnan(a) sk_float_isnan(a) - -#define SK_MaxS32FitsInFloat 2147483520 -#define SK_MinS32FitsInFloat -SK_MaxS32FitsInFloat - -#define SK_MaxS64FitsInFloat (SK_MaxS64 >> (63-24) << (63-24)) // 0x7fffff8000000000 -#define SK_MinS64FitsInFloat -SK_MaxS64FitsInFloat - -/** - * Return the closest int for the given float. Returns SK_MaxS32FitsInFloat for NaN. - */ -static inline int sk_float_saturate2int(float x) { - x = x < SK_MaxS32FitsInFloat ? x : SK_MaxS32FitsInFloat; - x = x > SK_MinS32FitsInFloat ? x : SK_MinS32FitsInFloat; - return (int)x; -} - -/** - * Return the closest int for the given double. Returns SK_MaxS32 for NaN. - */ -static inline int sk_double_saturate2int(double x) { - x = x < SK_MaxS32 ? x : SK_MaxS32; - x = x > SK_MinS32 ? x : SK_MinS32; - return (int)x; -} - -/** - * Return the closest int64_t for the given float. Returns SK_MaxS64FitsInFloat for NaN. - */ -static inline int64_t sk_float_saturate2int64(float x) { - x = x < SK_MaxS64FitsInFloat ? x : SK_MaxS64FitsInFloat; - x = x > SK_MinS64FitsInFloat ? x : SK_MinS64FitsInFloat; - return (int64_t)x; -} - -#define sk_float_floor2int(x) sk_float_saturate2int(sk_float_floor(x)) -#define sk_float_round2int(x) sk_float_saturate2int(sk_float_round(x)) -#define sk_float_ceil2int(x) sk_float_saturate2int(sk_float_ceil(x)) - -#define sk_float_floor2int_no_saturate(x) (int)sk_float_floor(x) -#define sk_float_round2int_no_saturate(x) (int)sk_float_round(x) -#define sk_float_ceil2int_no_saturate(x) (int)sk_float_ceil(x) - -#define sk_double_floor(x) floor(x) -#define sk_double_round(x) floor((x) + 0.5) -#define sk_double_ceil(x) ceil(x) -#define sk_double_floor2int(x) (int)sk_double_floor(x) -#define sk_double_round2int(x) (int)sk_double_round(x) -#define sk_double_ceil2int(x) (int)sk_double_ceil(x) - -// Cast double to float, ignoring any warning about too-large finite values being cast to float. -// Clang thinks this is undefined, but it's actually implementation defined to return either -// the largest float or infinity (one of the two bracketing representable floats). Good enough! -SK_ATTRIBUTE(no_sanitize("float-cast-overflow")) -static inline float sk_double_to_float(double x) { - return static_cast(x); -} - -#define SK_FloatNaN std::numeric_limits::quiet_NaN() -#define SK_FloatInfinity (+std::numeric_limits::infinity()) -#define SK_FloatNegativeInfinity (-std::numeric_limits::infinity()) - -#define SK_DoubleNaN std::numeric_limits::quiet_NaN() - -// Returns false if any of the floats are outside of [0...1] -// Returns true if count is 0 -bool sk_floats_are_unit(const float array[], size_t count); - -static inline float sk_float_rsqrt_portable(float x) { return 1.0f / sk_float_sqrt(x); } -static inline float sk_float_rsqrt (float x) { return 1.0f / sk_float_sqrt(x); } - -// Returns the log2 of the provided value, were that value to be rounded up to the next power of 2. -// Returns 0 if value <= 0: -// Never returns a negative number, even if value is NaN. -// -// sk_float_nextlog2((-inf..1]) -> 0 -// sk_float_nextlog2((1..2]) -> 1 -// sk_float_nextlog2((2..4]) -> 2 -// sk_float_nextlog2((4..8]) -> 3 -// ... -static inline int sk_float_nextlog2(float x) { - uint32_t bits = (uint32_t)SkFloat2Bits(x); - bits += (1u << 23) - 1u; // Increment the exponent for non-powers-of-2. - int exp = ((int32_t)bits >> 23) - 127; - return exp & ~(exp >> 31); // Return 0 for negative or denormalized floats, and exponents < 0. -} - -// This is the number of significant digits we can print in a string such that when we read that -// string back we get the floating point number we expect. The minimum value C requires is 6, but -// most compilers support 9 -#ifdef FLT_DECIMAL_DIG -#define SK_FLT_DECIMAL_DIG FLT_DECIMAL_DIG -#else -#define SK_FLT_DECIMAL_DIG 9 -#endif - -// IEEE defines how float divide behaves for non-finite values and zero-denoms, but C does not -// so we have a helper that suppresses the possible undefined-behavior warnings. - -SK_ATTRIBUTE(no_sanitize("float-divide-by-zero")) -static inline float sk_ieee_float_divide(float numer, float denom) { - return numer / denom; -} - -SK_ATTRIBUTE(no_sanitize("float-divide-by-zero")) -static inline double sk_ieee_double_divide(double numer, double denom) { - return numer / denom; -} - -// While we clean up divide by zero, we'll replace places that do divide by zero with this TODO. -static inline float sk_ieee_float_divide_TODO_IS_DIVIDE_BY_ZERO_SAFE_HERE(float n, float d) { - return sk_ieee_float_divide(n,d); -} - -static inline float sk_fmaf(float f, float m, float a) { -#if defined(FP_FAST_FMA) - return std::fmaf(f,m,a); -#else - return f*m+a; -#endif -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkHalf.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkHalf.h deleted file mode 100644 index 0888869607db7c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkHalf.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2014 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkHalf_DEFINED -#define SkHalf_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkVx.h" - -// 16-bit floating point value -// format is 1 bit sign, 5 bits exponent, 10 bits mantissa -// only used for storage -typedef uint16_t SkHalf; - -static constexpr uint16_t SK_HalfMin = 0x0400; // 2^-14 (minimum positive normal value) -static constexpr uint16_t SK_HalfMax = 0x7bff; // 65504 -static constexpr uint16_t SK_HalfEpsilon = 0x1400; // 2^-10 -static constexpr uint16_t SK_Half1 = 0x3C00; // 1 - -// convert between half and single precision floating point -float SkHalfToFloat(SkHalf h); -SkHalf SkFloatToHalf(float f); - -// Convert between half and single precision floating point, -// assuming inputs and outputs are both finite, and may -// flush values which would be denormal half floats to zero. -static inline skvx::float4 SkHalfToFloat_finite_ftz(uint64_t rgba) { - return skvx::from_half(skvx::half4::Load(&rgba)); -} -static inline skvx::half4 SkFloatToHalf_finite_ftz(const skvx::float4& c) { - return skvx::to_half(c); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkIDChangeListener.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkIDChangeListener.h deleted file mode 100644 index f7a5900e0e1ff3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkIDChangeListener.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkIDChangeListener_DEFINED -#define SkIDChangeListener_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/private/SkMutex.h" -#include "include/private/SkTDArray.h" - -#include - -/** - * Used to be notified when a gen/unique ID is invalidated, typically to preemptively purge - * associated items from a cache that are no longer reachable. The listener can - * be marked for deregistration if the cached item is remove before the listener is - * triggered. This prevents unbounded listener growth when cache items are routinely - * removed before the gen ID/unique ID is invalidated. - */ -class SkIDChangeListener : public SkRefCnt { -public: - SkIDChangeListener(); - - ~SkIDChangeListener() override; - - virtual void changed() = 0; - - /** - * Mark the listener is no longer needed. It should be removed and changed() should not be - * called. - */ - void markShouldDeregister() { fShouldDeregister.store(true, std::memory_order_relaxed); } - - /** Indicates whether markShouldDeregister was called. */ - bool shouldDeregister() { return fShouldDeregister.load(std::memory_order_acquire); } - - /** Manages a list of SkIDChangeListeners. */ - class List { - public: - List(); - - ~List(); - - /** - * Add a new listener to the list. It must not already be deregistered. Also clears out - * previously deregistered listeners. - */ - void add(sk_sp listener) SK_EXCLUDES(fMutex); - - /** - * The number of registered listeners (including deregisterd listeners that are yet-to-be - * removed. - */ - int count() const SK_EXCLUDES(fMutex); - - /** Calls changed() on all listeners that haven't been deregistered and resets the list. */ - void changed() SK_EXCLUDES(fMutex); - - /** Resets without calling changed() on the listeners. */ - void reset() SK_EXCLUDES(fMutex); - - private: - mutable SkMutex fMutex; - SkTDArray fListeners SK_GUARDED_BY(fMutex); // pointers are reffed - }; - -private: - std::atomic fShouldDeregister; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkImageInfoPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkImageInfoPriv.h deleted file mode 100644 index 70b9d715f06b63..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkImageInfoPriv.h +++ /dev/null @@ -1,199 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkImageInfoPriv_DEFINED -#define SkImageInfoPriv_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkImageInfo.h" - -static inline uint32_t SkColorTypeChannelFlags(SkColorType ct) { - switch (ct) { - case kUnknown_SkColorType: return 0; - case kAlpha_8_SkColorType: return kAlpha_SkColorChannelFlag; - case kRGB_565_SkColorType: return kRGB_SkColorChannelFlags; - case kARGB_4444_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGBA_8888_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGB_888x_SkColorType: return kRGB_SkColorChannelFlags; - case kBGRA_8888_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGBA_1010102_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGB_101010x_SkColorType: return kRGB_SkColorChannelFlags; - case kBGRA_1010102_SkColorType: return kRGBA_SkColorChannelFlags; - case kBGR_101010x_SkColorType: return kRGB_SkColorChannelFlags; - case kGray_8_SkColorType: return kGray_SkColorChannelFlag; - case kRGBA_F16Norm_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGBA_F16_SkColorType: return kRGBA_SkColorChannelFlags; - case kRGBA_F32_SkColorType: return kRGBA_SkColorChannelFlags; - case kR8G8_unorm_SkColorType: return kRG_SkColorChannelFlags; - case kA16_unorm_SkColorType: return kAlpha_SkColorChannelFlag; - case kR16G16_unorm_SkColorType: return kRG_SkColorChannelFlags; - case kA16_float_SkColorType: return kAlpha_SkColorChannelFlag; - case kR16G16_float_SkColorType: return kRG_SkColorChannelFlags; - case kR16G16B16A16_unorm_SkColorType: return kRGBA_SkColorChannelFlags; - case kSRGBA_8888_SkColorType: return kRGBA_SkColorChannelFlags; - case kR8_unorm_SkColorType: return kRed_SkColorChannelFlag; - } - SkUNREACHABLE; -} - -static inline bool SkColorTypeIsAlphaOnly(SkColorType ct) { - return SkColorTypeChannelFlags(ct) == kAlpha_SkColorChannelFlag; -} - -static inline bool SkAlphaTypeIsValid(unsigned value) { - return value <= kLastEnum_SkAlphaType; -} - -static int SkColorTypeShiftPerPixel(SkColorType ct) { - switch (ct) { - case kUnknown_SkColorType: return 0; - case kAlpha_8_SkColorType: return 0; - case kRGB_565_SkColorType: return 1; - case kARGB_4444_SkColorType: return 1; - case kRGBA_8888_SkColorType: return 2; - case kRGB_888x_SkColorType: return 2; - case kBGRA_8888_SkColorType: return 2; - case kRGBA_1010102_SkColorType: return 2; - case kRGB_101010x_SkColorType: return 2; - case kBGRA_1010102_SkColorType: return 2; - case kBGR_101010x_SkColorType: return 2; - case kGray_8_SkColorType: return 0; - case kRGBA_F16Norm_SkColorType: return 3; - case kRGBA_F16_SkColorType: return 3; - case kRGBA_F32_SkColorType: return 4; - case kR8G8_unorm_SkColorType: return 1; - case kA16_unorm_SkColorType: return 1; - case kR16G16_unorm_SkColorType: return 2; - case kA16_float_SkColorType: return 1; - case kR16G16_float_SkColorType: return 2; - case kR16G16B16A16_unorm_SkColorType: return 3; - case kSRGBA_8888_SkColorType: return 2; - case kR8_unorm_SkColorType: return 0; - } - SkUNREACHABLE; -} - -static inline size_t SkColorTypeMinRowBytes(SkColorType ct, int width) { - return (size_t)(width * SkColorTypeBytesPerPixel(ct)); -} - -static inline bool SkColorTypeIsValid(unsigned value) { - return value <= kLastEnum_SkColorType; -} - -static inline size_t SkColorTypeComputeOffset(SkColorType ct, int x, int y, size_t rowBytes) { - if (kUnknown_SkColorType == ct) { - return 0; - } - return (size_t)y * rowBytes + ((size_t)x << SkColorTypeShiftPerPixel(ct)); -} - -static inline bool SkColorTypeIsNormalized(SkColorType ct) { - switch (ct) { - case kUnknown_SkColorType: - case kAlpha_8_SkColorType: - case kRGB_565_SkColorType: - case kARGB_4444_SkColorType: - case kRGBA_8888_SkColorType: - case kRGB_888x_SkColorType: - case kBGRA_8888_SkColorType: - case kRGBA_1010102_SkColorType: - case kRGB_101010x_SkColorType: - case kBGRA_1010102_SkColorType: - case kBGR_101010x_SkColorType: - case kGray_8_SkColorType: - case kRGBA_F16Norm_SkColorType: - case kR8G8_unorm_SkColorType: - case kA16_unorm_SkColorType: - case kA16_float_SkColorType: /*subtle... alpha is always [0,1]*/ - case kR16G16_unorm_SkColorType: - case kR16G16B16A16_unorm_SkColorType: - case kSRGBA_8888_SkColorType: - case kR8_unorm_SkColorType: - return true; - - case kRGBA_F16_SkColorType: - case kRGBA_F32_SkColorType: - case kR16G16_float_SkColorType: - return false; - } - SkUNREACHABLE; -} - -static inline int SkColorTypeMaxBitsPerChannel(SkColorType ct) { - switch (ct) { - case kUnknown_SkColorType: - return 0; - - case kARGB_4444_SkColorType: - return 4; - - case kRGB_565_SkColorType: - return 6; - - case kAlpha_8_SkColorType: - case kRGBA_8888_SkColorType: - case kRGB_888x_SkColorType: - case kBGRA_8888_SkColorType: - case kGray_8_SkColorType: - case kR8G8_unorm_SkColorType: - case kSRGBA_8888_SkColorType: - case kR8_unorm_SkColorType: - return 8; - - case kRGBA_1010102_SkColorType: - case kRGB_101010x_SkColorType: - case kBGRA_1010102_SkColorType: - case kBGR_101010x_SkColorType: - return 10; - - case kRGBA_F16Norm_SkColorType: - case kA16_unorm_SkColorType: - case kA16_float_SkColorType: - case kR16G16_unorm_SkColorType: - case kR16G16B16A16_unorm_SkColorType: - case kRGBA_F16_SkColorType: - case kR16G16_float_SkColorType: - return 16; - - case kRGBA_F32_SkColorType: - return 32; - } - SkUNREACHABLE; -} - -/** - * Returns true if |info| contains a valid colorType and alphaType. - */ -static inline bool SkColorInfoIsValid(const SkColorInfo& info) { - return info.colorType() != kUnknown_SkColorType && info.alphaType() != kUnknown_SkAlphaType; -} - -/** - * Returns true if |info| contains a valid combination of width, height and colorInfo. - */ -static inline bool SkImageInfoIsValid(const SkImageInfo& info) { - if (info.width() <= 0 || info.height() <= 0) { - return false; - } - - const int kMaxDimension = SK_MaxS32 >> 2; - if (info.width() > kMaxDimension || info.height() > kMaxDimension) { - return false; - } - - return SkColorInfoIsValid(info.colorInfo()); -} - -/** - * Returns true if Skia has defined a pixel conversion from the |src| to the |dst|. - * Returns false otherwise. - */ -static inline bool SkImageInfoValidConversion(const SkImageInfo& dst, const SkImageInfo& src) { - return SkImageInfoIsValid(dst) && SkImageInfoIsValid(src); -} -#endif // SkImageInfoPriv_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMacros.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMacros.h deleted file mode 100644 index 308c5d05fd4a73..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMacros.h +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkMacros_DEFINED -#define SkMacros_DEFINED - -#include - -/* - * Usage: SK_MACRO_CONCAT(a, b) to construct the symbol ab - * - * SK_MACRO_CONCAT_IMPL_PRIV just exists to make this work. Do not use directly - * - */ -#define SK_MACRO_CONCAT(X, Y) SK_MACRO_CONCAT_IMPL_PRIV(X, Y) -#define SK_MACRO_CONCAT_IMPL_PRIV(X, Y) X ## Y - -/* - * Usage: SK_MACRO_APPEND_LINE(foo) to make foo123, where 123 is the current - * line number. Easy way to construct - * unique names for local functions or - * variables. - */ -#define SK_MACRO_APPEND_LINE(name) SK_MACRO_CONCAT(name, __LINE__) - -#define SK_MACRO_APPEND_COUNTER(name) SK_MACRO_CONCAT(name, __COUNTER__) - -//////////////////////////////////////////////////////////////////////////////// - -// Can be used to bracket data types that must be dense/packed, e.g. hash keys. -#if defined(__clang__) // This should work on GCC too, but GCC diagnostic pop didn't seem to work! - #define SK_BEGIN_REQUIRE_DENSE _Pragma("GCC diagnostic push") \ - _Pragma("GCC diagnostic error \"-Wpadded\"") - #define SK_END_REQUIRE_DENSE _Pragma("GCC diagnostic pop") -#else - #define SK_BEGIN_REQUIRE_DENSE - #define SK_END_REQUIRE_DENSE -#endif - -#define SK_INIT_TO_AVOID_WARNING = 0 - -//////////////////////////////////////////////////////////////////////////////// - -/** - * Defines overloaded bitwise operators to make it easier to use an enum as a - * bitfield. - */ -#define SK_MAKE_BITFIELD_OPS(X) \ - inline X operator ~(X a) { \ - using U = std::underlying_type_t; \ - return (X) (~static_cast(a)); \ - } \ - inline X operator |(X a, X b) { \ - using U = std::underlying_type_t; \ - return (X) (static_cast(a) | static_cast(b)); \ - } \ - inline X& operator |=(X& a, X b) { \ - return (a = a | b); \ - } \ - inline X operator &(X a, X b) { \ - using U = std::underlying_type_t; \ - return (X) (static_cast(a) & static_cast(b)); \ - } \ - inline X& operator &=(X& a, X b) { \ - return (a = a & b); \ - } - -#define SK_DECL_BITFIELD_OPS_FRIENDS(X) \ - friend X operator ~(X a); \ - friend X operator |(X a, X b); \ - friend X& operator |=(X& a, X b); \ - \ - friend X operator &(X a, X b); \ - friend X& operator &=(X& a, X b); - -#endif // SkMacros_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMalloc.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMalloc.h deleted file mode 100644 index 206bf14e2f8778..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMalloc.h +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMalloc_DEFINED -#define SkMalloc_DEFINED - -#include -#include - -#include "include/core/SkTypes.h" - -/* - memory wrappers to be implemented by the porting layer (platform) -*/ - - -/** Free memory returned by sk_malloc(). It is safe to pass null. */ -SK_API extern void sk_free(void*); - -/** - * Called internally if we run out of memory. The platform implementation must - * not return, but should either throw an exception or otherwise exit. - */ -SK_API extern void sk_out_of_memory(void); - -enum { - /** - * If this bit is set, the returned buffer must be zero-initialized. If this bit is not set - * the buffer can be uninitialized. - */ - SK_MALLOC_ZERO_INITIALIZE = 1 << 0, - - /** - * If this bit is set, the implementation must throw/crash/quit if the request cannot - * be fulfilled. If this bit is not set, then it should return nullptr on failure. - */ - SK_MALLOC_THROW = 1 << 1, -}; -/** - * Return a block of memory (at least 4-byte aligned) of at least the specified size. - * If the requested memory cannot be returned, either return nullptr or throw/exit, depending - * on the SK_MALLOC_THROW bit. If the allocation succeeds, the memory will be zero-initialized - * if the SK_MALLOC_ZERO_INITIALIZE bit was set. - * - * To free the memory, call sk_free() - */ -SK_API extern void* sk_malloc_flags(size_t size, unsigned flags); - -/** Same as standard realloc(), but this one never returns null on failure. It will throw - * an exception if it fails. - */ -SK_API extern void* sk_realloc_throw(void* buffer, size_t size); - -static inline void* sk_malloc_throw(size_t size) { - return sk_malloc_flags(size, SK_MALLOC_THROW); -} - -static inline void* sk_calloc_throw(size_t size) { - return sk_malloc_flags(size, SK_MALLOC_THROW | SK_MALLOC_ZERO_INITIALIZE); -} - -static inline void* sk_calloc_canfail(size_t size) { -#if defined(SK_BUILD_FOR_FUZZER) - // To reduce the chance of OOM, pretend we can't allocate more than 200kb. - if (size > 200000) { - return nullptr; - } -#endif - return sk_malloc_flags(size, SK_MALLOC_ZERO_INITIALIZE); -} - -// Performs a safe multiply count * elemSize, checking for overflow -SK_API extern void* sk_calloc_throw(size_t count, size_t elemSize); -SK_API extern void* sk_malloc_throw(size_t count, size_t elemSize); -SK_API extern void* sk_realloc_throw(void* buffer, size_t count, size_t elemSize); - -// Returns the true usable size provided by the underlying allocator, or 0 if -// querying the allocation size is not supported. -SK_API extern size_t sk_malloc_usable_size(void* buffer); - -/** - * These variants return nullptr on failure - */ -static inline void* sk_malloc_canfail(size_t size) { -#if defined(SK_BUILD_FOR_FUZZER) - // To reduce the chance of OOM, pretend we can't allocate more than 200kb. - if (size > 200000) { - return nullptr; - } -#endif - return sk_malloc_flags(size, 0); -} -SK_API extern void* sk_malloc_canfail(size_t count, size_t elemSize); - -// bzero is safer than memset, but we can't rely on it, so... sk_bzero() -static inline void sk_bzero(void* buffer, size_t size) { - // Please c.f. sk_careful_memcpy. It's undefined behavior to call memset(null, 0, 0). - if (size) { - memset(buffer, 0, size); - } -} - -/** - * sk_careful_memcpy() is just like memcpy(), but guards against undefined behavior. - * - * It is undefined behavior to call memcpy() with null dst or src, even if len is 0. - * If an optimizer is "smart" enough, it can exploit this to do unexpected things. - * memcpy(dst, src, 0); - * if (src) { - * printf("%x\n", *src); - * } - * In this code the compiler can assume src is not null and omit the if (src) {...} check, - * unconditionally running the printf, crashing the program if src really is null. - * Of the compilers we pay attention to only GCC performs this optimization in practice. - */ -static inline void* sk_careful_memcpy(void* dst, const void* src, size_t len) { - // When we pass >0 len we had better already be passing valid pointers. - // So we just need to skip calling memcpy when len == 0. - if (len) { - memcpy(dst,src,len); - } - return dst; -} - -static inline void* sk_careful_memmove(void* dst, const void* src, size_t len) { - // When we pass >0 len we had better already be passing valid pointers. - // So we just need to skip calling memcpy when len == 0. - if (len) { - memmove(dst,src,len); - } - return dst; -} - -static inline int sk_careful_memcmp(const void* a, const void* b, size_t len) { - // When we pass >0 len we had better already be passing valid pointers. - // So we just need to skip calling memcmp when len == 0. - if (len == 0) { - return 0; // we treat zero-length buffers as "equal" - } - return memcmp(a, b, len); -} - -#endif // SkMalloc_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMutex.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMutex.h deleted file mode 100644 index b7cdceb1e1d8df..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkMutex.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkMutex_DEFINED -#define SkMutex_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkMacros.h" -#include "include/private/SkSemaphore.h" -#include "include/private/SkThreadAnnotations.h" -#include "include/private/SkThreadID.h" - -class SK_CAPABILITY("mutex") SkMutex { -public: - constexpr SkMutex() = default; - - ~SkMutex() { - this->assertNotHeld(); - } - - void acquire() SK_ACQUIRE() { - fSemaphore.wait(); - SkDEBUGCODE(fOwner = SkGetThreadID();) - } - - void release() SK_RELEASE_CAPABILITY() { - this->assertHeld(); - SkDEBUGCODE(fOwner = kIllegalThreadID;) - fSemaphore.signal(); - } - - void assertHeld() SK_ASSERT_CAPABILITY(this) { - SkASSERT(fOwner == SkGetThreadID()); - } - - void assertNotHeld() { - SkASSERT(fOwner == kIllegalThreadID); - } - -private: - SkSemaphore fSemaphore{1}; - SkDEBUGCODE(SkThreadID fOwner{kIllegalThreadID};) -}; - -class SK_SCOPED_CAPABILITY SkAutoMutexExclusive { -public: - SkAutoMutexExclusive(SkMutex& mutex) SK_ACQUIRE(mutex) : fMutex(mutex) { fMutex.acquire(); } - ~SkAutoMutexExclusive() SK_RELEASE_CAPABILITY() { fMutex.release(); } - - SkAutoMutexExclusive(const SkAutoMutexExclusive&) = delete; - SkAutoMutexExclusive(SkAutoMutexExclusive&&) = delete; - - SkAutoMutexExclusive& operator=(const SkAutoMutexExclusive&) = delete; - SkAutoMutexExclusive& operator=(SkAutoMutexExclusive&&) = delete; - -private: - SkMutex& fMutex; -}; - -#endif // SkMutex_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkNoncopyable.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkNoncopyable.h deleted file mode 100644 index bda5d50bb68041..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkNoncopyable.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkNoncopyable_DEFINED -#define SkNoncopyable_DEFINED - -#include "include/core/SkTypes.h" - -/** \class SkNoncopyable - - SkNoncopyable is the base class for objects that do not want to - be copied. It hides its copy-constructor and its assignment-operator. -*/ -class SK_API SkNoncopyable { -public: - SkNoncopyable() = default; - - SkNoncopyable(SkNoncopyable&&) = default; - SkNoncopyable& operator =(SkNoncopyable&&) = default; - -private: - SkNoncopyable(const SkNoncopyable&) = delete; - SkNoncopyable& operator=(const SkNoncopyable&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOnce.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOnce.h deleted file mode 100644 index edf3e833582b54..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOnce.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOnce_DEFINED -#define SkOnce_DEFINED - -#include "include/private/SkThreadAnnotations.h" -#include -#include - -// SkOnce provides call-once guarantees for Skia, much like std::once_flag/std::call_once(). -// -// There should be no particularly error-prone gotcha use cases when using SkOnce. -// It works correctly as a class member, a local, a global, a function-scoped static, whatever. - -class SkOnce { -public: - constexpr SkOnce() = default; - - template - void operator()(Fn&& fn, Args&&... args) { - auto state = fState.load(std::memory_order_acquire); - - if (state == Done) { - return; - } - - // If it looks like no one has started calling fn(), try to claim that job. - if (state == NotStarted && fState.compare_exchange_strong(state, Claimed, - std::memory_order_relaxed, - std::memory_order_relaxed)) { - // Great! We'll run fn() then notify the other threads by releasing Done into fState. - fn(std::forward(args)...); - return fState.store(Done, std::memory_order_release); - } - - // Some other thread is calling fn(). - // We'll just spin here acquiring until it releases Done into fState. - SK_POTENTIALLY_BLOCKING_REGION_BEGIN; - while (fState.load(std::memory_order_acquire) != Done) { /*spin*/ } - SK_POTENTIALLY_BLOCKING_REGION_END; - } - -private: - enum State : uint8_t { NotStarted, Claimed, Done}; - std::atomic fState{NotStarted}; -}; - -#endif // SkOnce_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOpts_spi.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOpts_spi.h deleted file mode 100644 index e57dc1433ff50d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkOpts_spi.h +++ /dev/null @@ -1,21 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOpts_spi_DEFINED -#define SkOpts_spi_DEFINED - -#include "include/core/SkTypes.h" - -// These are exposed as SK_SPI (e.g. SkParagraph), the rest of SkOpts is -// declared in src/core - -namespace SkOpts { - // The fastest high quality 32-bit hash we can provide on this platform. - extern uint32_t SK_SPI (*hash_fn)(const void* data, size_t bytes, uint32_t seed); -} // namespace SkOpts - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkPathRef.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkPathRef.h deleted file mode 100644 index e72651dce78426..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkPathRef.h +++ /dev/null @@ -1,522 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPathRef_DEFINED -#define SkPathRef_DEFINED - -#include "include/core/SkMatrix.h" -#include "include/core/SkPoint.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkIDChangeListener.h" -#include "include/private/SkMutex.h" -#include "include/private/SkTDArray.h" -#include "include/private/SkTemplates.h" -#include "include/private/SkTo.h" - -#include -#include -#include - -class SkRBuffer; -class SkWBuffer; -class SkRRect; - -enum class SkPathConvexity { - kConvex, - kConcave, - kUnknown, -}; - -enum class SkPathFirstDirection { - kCW, // == SkPathDirection::kCW - kCCW, // == SkPathDirection::kCCW - kUnknown, -}; - -// These are computed from a stream of verbs -struct SkPathVerbAnalysis { - bool valid; - int points, weights; - unsigned segmentMask; -}; -SkPathVerbAnalysis sk_path_analyze_verbs(const uint8_t verbs[], int count); - - -/** - * Holds the path verbs and points. It is versioned by a generation ID. None of its public methods - * modify the contents. To modify or append to the verbs/points wrap the SkPathRef in an - * SkPathRef::Editor object. Installing the editor resets the generation ID. It also performs - * copy-on-write if the SkPathRef is shared by multiple SkPaths. The caller passes the Editor's - * constructor a pointer to a sk_sp, which may be updated to point to a new SkPathRef - * after the editor's constructor returns. - * - * The points and verbs are stored in a single allocation. The points are at the begining of the - * allocation while the verbs are stored at end of the allocation, in reverse order. Thus the points - * and verbs both grow into the middle of the allocation until the meet. To access verb i in the - * verb array use ref.verbs()[~i] (because verbs() returns a pointer just beyond the first - * logical verb or the last verb in memory). - */ - -class SK_API SkPathRef final : public SkNVRefCnt { -public: - SkPathRef(SkTDArray points, SkTDArray verbs, SkTDArray weights, - unsigned segmentMask) - : fPoints(std::move(points)) - , fVerbs(std::move(verbs)) - , fConicWeights(std::move(weights)) - { - fBoundsIsDirty = true; // this also invalidates fIsFinite - fGenerationID = 0; // recompute - fSegmentMask = segmentMask; - fIsOval = false; - fIsRRect = false; - // The next two values don't matter unless fIsOval or fIsRRect are true. - fRRectOrOvalIsCCW = false; - fRRectOrOvalStartIdx = 0xAC; - SkDEBUGCODE(fEditorsAttached.store(0);) - - this->computeBounds(); // do this now, before we worry about multiple owners/threads - SkDEBUGCODE(this->validate();) - } - - class Editor { - public: - Editor(sk_sp* pathRef, - int incReserveVerbs = 0, - int incReservePoints = 0); - - ~Editor() { SkDEBUGCODE(fPathRef->fEditorsAttached--;) } - - /** - * Returns the array of points. - */ - SkPoint* writablePoints() { return fPathRef->getWritablePoints(); } - const SkPoint* points() const { return fPathRef->points(); } - - /** - * Gets the ith point. Shortcut for this->points() + i - */ - SkPoint* atPoint(int i) { return fPathRef->getWritablePoints() + i; } - const SkPoint* atPoint(int i) const { return &fPathRef->fPoints[i]; } - - /** - * Adds the verb and allocates space for the number of points indicated by the verb. The - * return value is a pointer to where the points for the verb should be written. - * 'weight' is only used if 'verb' is kConic_Verb - */ - SkPoint* growForVerb(int /*SkPath::Verb*/ verb, SkScalar weight = 0) { - SkDEBUGCODE(fPathRef->validate();) - return fPathRef->growForVerb(verb, weight); - } - - /** - * Allocates space for multiple instances of a particular verb and the - * requisite points & weights. - * The return pointer points at the first new point (indexed normally []). - * If 'verb' is kConic_Verb, 'weights' will return a pointer to the - * space for the conic weights (indexed normally). - */ - SkPoint* growForRepeatedVerb(int /*SkPath::Verb*/ verb, - int numVbs, - SkScalar** weights = nullptr) { - return fPathRef->growForRepeatedVerb(verb, numVbs, weights); - } - - /** - * Concatenates all verbs from 'path' onto the pathRef's verbs array. Increases the point - * count by the number of points in 'path', and the conic weight count by the number of - * conics in 'path'. - * - * Returns pointers to the uninitialized points and conic weights data. - */ - std::tuple growForVerbsInPath(const SkPathRef& path) { - return fPathRef->growForVerbsInPath(path); - } - - /** - * Resets the path ref to a new verb and point count. The new verbs and points are - * uninitialized. - */ - void resetToSize(int newVerbCnt, int newPointCnt, int newConicCount) { - fPathRef->resetToSize(newVerbCnt, newPointCnt, newConicCount); - } - - /** - * Gets the path ref that is wrapped in the Editor. - */ - SkPathRef* pathRef() { return fPathRef; } - - void setIsOval(bool isOval, bool isCCW, unsigned start) { - fPathRef->setIsOval(isOval, isCCW, start); - } - - void setIsRRect(bool isRRect, bool isCCW, unsigned start) { - fPathRef->setIsRRect(isRRect, isCCW, start); - } - - void setBounds(const SkRect& rect) { fPathRef->setBounds(rect); } - - private: - SkPathRef* fPathRef; - }; - - class SK_API Iter { - public: - Iter(); - Iter(const SkPathRef&); - - void setPathRef(const SkPathRef&); - - /** Return the next verb in this iteration of the path. When all - segments have been visited, return kDone_Verb. - - If any point in the path is non-finite, return kDone_Verb immediately. - - @param pts The points representing the current verb and/or segment - This must not be NULL. - @return The verb for the current segment - */ - uint8_t next(SkPoint pts[4]); - uint8_t peek() const; - - SkScalar conicWeight() const { return *fConicWeights; } - - private: - const SkPoint* fPts; - const uint8_t* fVerbs; - const uint8_t* fVerbStop; - const SkScalar* fConicWeights; - }; - -public: - /** - * Gets a path ref with no verbs or points. - */ - static SkPathRef* CreateEmpty(); - - /** - * Returns true if all of the points in this path are finite, meaning there - * are no infinities and no NaNs. - */ - bool isFinite() const { - if (fBoundsIsDirty) { - this->computeBounds(); - } - return SkToBool(fIsFinite); - } - - /** - * Returns a mask, where each bit corresponding to a SegmentMask is - * set if the path contains 1 or more segments of that type. - * Returns 0 for an empty path (no segments). - */ - uint32_t getSegmentMasks() const { return fSegmentMask; } - - /** Returns true if the path is an oval. - * - * @param rect returns the bounding rect of this oval. It's a circle - * if the height and width are the same. - * @param isCCW is the oval CCW (or CW if false). - * @param start indicates where the contour starts on the oval (see - * SkPath::addOval for intepretation of the index). - * - * @return true if this path is an oval. - * Tracking whether a path is an oval is considered an - * optimization for performance and so some paths that are in - * fact ovals can report false. - */ - bool isOval(SkRect* rect, bool* isCCW, unsigned* start) const { - if (fIsOval) { - if (rect) { - *rect = this->getBounds(); - } - if (isCCW) { - *isCCW = SkToBool(fRRectOrOvalIsCCW); - } - if (start) { - *start = fRRectOrOvalStartIdx; - } - } - - return SkToBool(fIsOval); - } - - bool isRRect(SkRRect* rrect, bool* isCCW, unsigned* start) const; - - bool hasComputedBounds() const { - return !fBoundsIsDirty; - } - - /** Returns the bounds of the path's points. If the path contains 0 or 1 - points, the bounds is set to (0,0,0,0), and isEmpty() will return true. - Note: this bounds may be larger than the actual shape, since curves - do not extend as far as their control points. - */ - const SkRect& getBounds() const { - if (fBoundsIsDirty) { - this->computeBounds(); - } - return fBounds; - } - - SkRRect getRRect() const; - - /** - * Transforms a path ref by a matrix, allocating a new one only if necessary. - */ - static void CreateTransformedCopy(sk_sp* dst, - const SkPathRef& src, - const SkMatrix& matrix); - - // static SkPathRef* CreateFromBuffer(SkRBuffer* buffer); - - /** - * Rollsback a path ref to zero verbs and points with the assumption that the path ref will be - * repopulated with approximately the same number of verbs and points. A new path ref is created - * only if necessary. - */ - static void Rewind(sk_sp* pathRef); - - ~SkPathRef(); - int countPoints() const { return fPoints.size(); } - int countVerbs() const { return fVerbs.size(); } - int countWeights() const { return fConicWeights.size(); } - - size_t approximateBytesUsed() const; - - /** - * Returns a pointer one beyond the first logical verb (last verb in memory order). - */ - const uint8_t* verbsBegin() const { return fVerbs.begin(); } - - /** - * Returns a const pointer to the first verb in memory (which is the last logical verb). - */ - const uint8_t* verbsEnd() const { return fVerbs.end(); } - - /** - * Returns a const pointer to the first point. - */ - const SkPoint* points() const { return fPoints.begin(); } - - /** - * Shortcut for this->points() + this->countPoints() - */ - const SkPoint* pointsEnd() const { return this->points() + this->countPoints(); } - - const SkScalar* conicWeights() const { return fConicWeights.begin(); } - const SkScalar* conicWeightsEnd() const { return fConicWeights.end(); } - - /** - * Convenience methods for getting to a verb or point by index. - */ - uint8_t atVerb(int index) const { return fVerbs[index]; } - const SkPoint& atPoint(int index) const { return fPoints[index]; } - - bool operator== (const SkPathRef& ref) const; - - /** - * Writes the path points and verbs to a buffer. - */ - void writeToBuffer(SkWBuffer* buffer) const; - - /** - * Gets the number of bytes that would be written in writeBuffer() - */ - uint32_t writeSize() const; - - void interpolate(const SkPathRef& ending, SkScalar weight, SkPathRef* out) const; - - /** - * Gets an ID that uniquely identifies the contents of the path ref. If two path refs have the - * same ID then they have the same verbs and points. However, two path refs may have the same - * contents but different genIDs. - */ - uint32_t genID() const; - - void addGenIDChangeListener(sk_sp); // Threadsafe. - int genIDChangeListenerCount(); // Threadsafe - - bool dataMatchesVerbs() const; - bool isValid() const; - SkDEBUGCODE(void validate() const { SkASSERT(this->isValid()); } ) - -private: - enum SerializationOffsets { - kLegacyRRectOrOvalStartIdx_SerializationShift = 28, // requires 3 bits, ignored. - kLegacyRRectOrOvalIsCCW_SerializationShift = 27, // requires 1 bit, ignored. - kLegacyIsRRect_SerializationShift = 26, // requires 1 bit, ignored. - kIsFinite_SerializationShift = 25, // requires 1 bit - kLegacyIsOval_SerializationShift = 24, // requires 1 bit, ignored. - kSegmentMask_SerializationShift = 0 // requires 4 bits (deprecated) - }; - - SkPathRef() { - fBoundsIsDirty = true; // this also invalidates fIsFinite - fGenerationID = kEmptyGenID; - fSegmentMask = 0; - fIsOval = false; - fIsRRect = false; - // The next two values don't matter unless fIsOval or fIsRRect are true. - fRRectOrOvalIsCCW = false; - fRRectOrOvalStartIdx = 0xAC; - SkDEBUGCODE(fEditorsAttached.store(0);) - SkDEBUGCODE(this->validate();) - } - - void copy(const SkPathRef& ref, int additionalReserveVerbs, int additionalReservePoints); - - // Return true if the computed bounds are finite. - static bool ComputePtBounds(SkRect* bounds, const SkPathRef& ref) { - return bounds->setBoundsCheck(ref.points(), ref.countPoints()); - } - - // called, if dirty, by getBounds() - void computeBounds() const { - SkDEBUGCODE(this->validate();) - // TODO(mtklein): remove fBoundsIsDirty and fIsFinite, - // using an inverted rect instead of fBoundsIsDirty and always recalculating fIsFinite. - SkASSERT(fBoundsIsDirty); - - fIsFinite = ComputePtBounds(&fBounds, *this); - fBoundsIsDirty = false; - } - - void setBounds(const SkRect& rect) { - SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom); - fBounds = rect; - fBoundsIsDirty = false; - fIsFinite = fBounds.isFinite(); - } - - /** Makes additional room but does not change the counts or change the genID */ - void incReserve(int additionalVerbs, int additionalPoints) { - SkDEBUGCODE(this->validate();) - fPoints.reserve(fPoints.size() + additionalPoints); - fVerbs.reserve(fVerbs.size() + additionalVerbs); - SkDEBUGCODE(this->validate();) - } - - /** Resets the path ref with verbCount verbs and pointCount points, all uninitialized. Also - * allocates space for reserveVerb additional verbs and reservePoints additional points.*/ - void resetToSize(int verbCount, int pointCount, int conicCount, - int reserveVerbs = 0, int reservePoints = 0) { - SkDEBUGCODE(this->validate();) - this->callGenIDChangeListeners(); - fBoundsIsDirty = true; // this also invalidates fIsFinite - fGenerationID = 0; - - fSegmentMask = 0; - fIsOval = false; - fIsRRect = false; - - fPoints.reserve(pointCount + reservePoints); - fPoints.resize(pointCount); - fVerbs.reserve(verbCount + reserveVerbs); - fVerbs.resize(verbCount); - fConicWeights.resize(conicCount); - SkDEBUGCODE(this->validate();) - } - - /** - * Increases the verb count by numVbs and point count by the required amount. - * The new points are uninitialized. All the new verbs are set to the specified - * verb. If 'verb' is kConic_Verb, 'weights' will return a pointer to the - * uninitialized conic weights. - */ - SkPoint* growForRepeatedVerb(int /*SkPath::Verb*/ verb, int numVbs, SkScalar** weights); - - /** - * Increases the verb count 1, records the new verb, and creates room for the requisite number - * of additional points. A pointer to the first point is returned. Any new points are - * uninitialized. - */ - SkPoint* growForVerb(int /*SkPath::Verb*/ verb, SkScalar weight); - - /** - * Concatenates all verbs from 'path' onto our own verbs array. Increases the point count by the - * number of points in 'path', and the conic weight count by the number of conics in 'path'. - * - * Returns pointers to the uninitialized points and conic weights data. - */ - std::tuple growForVerbsInPath(const SkPathRef& path); - - /** - * Private, non-const-ptr version of the public function verbsMemBegin(). - */ - uint8_t* verbsBeginWritable() { return fVerbs.begin(); } - - /** - * Called the first time someone calls CreateEmpty to actually create the singleton. - */ - friend SkPathRef* sk_create_empty_pathref(); - - void setIsOval(bool isOval, bool isCCW, unsigned start) { - fIsOval = isOval; - fRRectOrOvalIsCCW = isCCW; - fRRectOrOvalStartIdx = SkToU8(start); - } - - void setIsRRect(bool isRRect, bool isCCW, unsigned start) { - fIsRRect = isRRect; - fRRectOrOvalIsCCW = isCCW; - fRRectOrOvalStartIdx = SkToU8(start); - } - - // called only by the editor. Note that this is not a const function. - SkPoint* getWritablePoints() { - SkDEBUGCODE(this->validate();) - fIsOval = false; - fIsRRect = false; - return fPoints.begin(); - } - - const SkPoint* getPoints() const { - SkDEBUGCODE(this->validate();) - return fPoints.begin(); - } - - void callGenIDChangeListeners(); - - enum { - kMinSize = 256, - }; - - mutable SkRect fBounds; - - SkTDArray fPoints; - SkTDArray fVerbs; - SkTDArray fConicWeights; - - enum { - kEmptyGenID = 1, // GenID reserved for path ref with zero points and zero verbs. - }; - mutable uint32_t fGenerationID; - SkDEBUGCODE(std::atomic fEditorsAttached;) // assert only one editor in use at any time. - - SkIDChangeListener::List fGenIDChangeListeners; - - mutable uint8_t fBoundsIsDirty; - mutable bool fIsFinite; // only meaningful if bounds are valid - - bool fIsOval; - bool fIsRRect; - // Both the circle and rrect special cases have a notion of direction and starting point - // The next two variables store that information for either. - bool fRRectOrOvalIsCCW; - uint8_t fRRectOrOvalStartIdx; - uint8_t fSegmentMask; - - friend class PathRefTest_Private; - friend class ForceIsRRect_Private; // unit test isRRect - friend class SkPath; - friend class SkPathBuilder; - friend class SkPathPriv; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLDefines.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLDefines.h deleted file mode 100644 index 6e50a5b2625948..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLDefines.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DEFINES -#define SKSL_DEFINES - -#include - -#include "include/core/SkTypes.h" -#include "include/private/SkTArray.h" - -using SKSL_INT = int64_t; -using SKSL_FLOAT = float; - -namespace SkSL { - -class Expression; -class Statement; - -using ComponentArray = SkSTArray<4, int8_t>; // for Swizzles - -class ExpressionArray : public SkSTArray<2, std::unique_ptr> { -public: - using SkSTArray::SkSTArray; - - /** Returns a new ExpressionArray containing a clone of every element. */ - ExpressionArray clone() const; -}; - -using StatementArray = SkSTArray<2, std::unique_ptr>; - -// Functions larger than this (measured in IR nodes) will not be inlined. This growth factor -// accounts for the number of calls being inlined--i.e., a function called five times (that is, with -// five inlining opportunities) would be considered 5x larger than if it were called once. This -// default threshold value is arbitrary, but tends to work well in practice. -static constexpr int kDefaultInlineThreshold = 50; - -// A hard upper limit on the number of variable slots allowed in a function/global scope. -// This is an arbitrary limit, but is needed to prevent code generation from taking unbounded -// amounts of time or space. -static constexpr int kVariableSlotLimit = 100000; - -// The SwizzleComponent namespace is used both by the SkSL::Swizzle expression, and the DSL swizzle. -// This namespace is injected into SkSL::dsl so that `using namespace SkSL::dsl` enables DSL code -// like `Swizzle(var, X, Y, ONE)` to compile without any extra qualifications. -namespace SwizzleComponent { - -enum Type : int8_t { - X = 0, Y = 1, Z = 2, W = 3, - R = 4, G = 5, B = 6, A = 7, - S = 8, T = 9, P = 10, Q = 11, - UL = 12, UT = 13, UR = 14, UB = 15, - ZERO, - ONE -}; - -} // namespace SwizzleComponent -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLIRNode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLIRNode.h deleted file mode 100644 index c11a56614c42be..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLIRNode.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_IRNODE -#define SKSL_IRNODE - -#include "include/private/SkSLString.h" -#include "include/private/SkTArray.h" -#include "include/sksl/SkSLPosition.h" -#include "src/sksl/SkSLLexer.h" -#include "src/sksl/SkSLModifiersPool.h" -#include "src/sksl/SkSLPool.h" - -#include -#include -#include -#include - -namespace SkSL { - -class Expression; -class FunctionDeclaration; -class FunctionDefinition; -class Statement; -class Symbol; -class SymbolTable; -class Type; -class Variable; -class VariableReference; -enum class VariableRefKind : int8_t; -enum class VariableStorage : int8_t; - -/** - * Represents a node in the intermediate representation (IR) tree. The IR is a fully-resolved - * version of the program (all types determined, everything validated), ready for code generation. - */ -class IRNode : public Poolable { -public: - virtual ~IRNode() {} - - virtual std::string description() const = 0; - - // No copy construction or assignment - IRNode(const IRNode&) = delete; - IRNode& operator=(const IRNode&) = delete; - - // position of this element within the program being compiled, for error reporting purposes - Position fPosition; - -protected: - IRNode(Position position, int kind) - : fPosition(position) - , fKind(kind) {} - - int fKind; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLLayout.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLLayout.h deleted file mode 100644 index 1b00f0e7c67ed1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLLayout.h +++ /dev/null @@ -1,144 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_LAYOUT -#define SKSL_LAYOUT - -#include "include/private/SkSLString.h" - -namespace SkSL { - -/** - * Represents a layout block appearing before a variable declaration, as in: - * - * layout (location = 0) int x; - */ -struct Layout { - enum Flag { - kOriginUpperLeft_Flag = 1 << 0, - kPushConstant_Flag = 1 << 1, - kBlendSupportAllEquations_Flag = 1 << 2, - kColor_Flag = 1 << 3, - - // These flags indicate if the qualifier appeared, regardless of the accompanying value. - kLocation_Flag = 1 << 4, - kOffset_Flag = 1 << 5, - kBinding_Flag = 1 << 6, - kIndex_Flag = 1 << 7, - kSet_Flag = 1 << 8, - kBuiltin_Flag = 1 << 9, - kInputAttachmentIndex_Flag = 1 << 10, - }; - - Layout(int flags, int location, int offset, int binding, int index, int set, int builtin, - int inputAttachmentIndex) - : fFlags(flags) - , fLocation(location) - , fOffset(offset) - , fBinding(binding) - , fIndex(index) - , fSet(set) - , fBuiltin(builtin) - , fInputAttachmentIndex(inputAttachmentIndex) {} - - Layout() - : fFlags(0) - , fLocation(-1) - , fOffset(-1) - , fBinding(-1) - , fIndex(-1) - , fSet(-1) - , fBuiltin(-1) - , fInputAttachmentIndex(-1) {} - - static Layout builtin(int builtin) { - Layout result; - result.fBuiltin = builtin; - return result; - } - - std::string description() const { - std::string result; - auto separator = [firstSeparator = true]() mutable -> std::string { - if (firstSeparator) { - firstSeparator = false; - return ""; - } else { - return ", "; - }}; - if (fLocation >= 0) { - result += separator() + "location = " + std::to_string(fLocation); - } - if (fOffset >= 0) { - result += separator() + "offset = " + std::to_string(fOffset); - } - if (fBinding >= 0) { - result += separator() + "binding = " + std::to_string(fBinding); - } - if (fIndex >= 0) { - result += separator() + "index = " + std::to_string(fIndex); - } - if (fSet >= 0) { - result += separator() + "set = " + std::to_string(fSet); - } - if (fBuiltin >= 0) { - result += separator() + "builtin = " + std::to_string(fBuiltin); - } - if (fInputAttachmentIndex >= 0) { - result += separator() + "input_attachment_index = " + - std::to_string(fInputAttachmentIndex); - } - if (fFlags & kOriginUpperLeft_Flag) { - result += separator() + "origin_upper_left"; - } - if (fFlags & kBlendSupportAllEquations_Flag) { - result += separator() + "blend_support_all_equations"; - } - if (fFlags & kPushConstant_Flag) { - result += separator() + "push_constant"; - } - if (fFlags & kColor_Flag) { - result += separator() + "color"; - } - if (result.size() > 0) { - result = "layout (" + result + ")"; - } - return result; - } - - bool operator==(const Layout& other) const { - return fFlags == other.fFlags && - fLocation == other.fLocation && - fOffset == other.fOffset && - fBinding == other.fBinding && - fIndex == other.fIndex && - fSet == other.fSet && - fBuiltin == other.fBuiltin && - fInputAttachmentIndex == other.fInputAttachmentIndex; - } - - bool operator!=(const Layout& other) const { - return !(*this == other); - } - - int fFlags; - int fLocation; - int fOffset; - int fBinding; - int fIndex; - int fSet; - // builtin comes from SPIR-V and identifies which particular builtin value this object - // represents. - int fBuiltin; - // input_attachment_index comes from Vulkan/SPIR-V to connect a shader variable to the a - // corresponding attachment on the subpass in which the shader is being used. - int fInputAttachmentIndex; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLModifiers.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLModifiers.h deleted file mode 100644 index 732810b7da71c8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLModifiers.h +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_MODIFIERS -#define SKSL_MODIFIERS - -#include "include/private/SkSLLayout.h" - -#include -#include -#include - -namespace SkSL { - -class Context; -class Position; - -/** - * A set of modifier keywords (in, out, uniform, etc.) appearing before a declaration. - */ -struct Modifiers { - /** - * OpenGL requires modifiers to be in a strict order: - * - invariant-qualifier: (invariant) - * - interpolation-qualifier: flat, noperspective, (smooth) - * - storage-qualifier: const, uniform - * - parameter-qualifier: in, out, inout - * - precision-qualifier: highp, mediump, lowp - * - * SkSL does not have `invariant` or `smooth`. - */ - - enum Flag { - kNo_Flag = 0, - // Real GLSL modifiers - kFlat_Flag = 1 << 0, - kNoPerspective_Flag = 1 << 1, - kConst_Flag = 1 << 2, - kUniform_Flag = 1 << 3, - kIn_Flag = 1 << 4, - kOut_Flag = 1 << 5, - kHighp_Flag = 1 << 6, - kMediump_Flag = 1 << 7, - kLowp_Flag = 1 << 8, - kReadOnly_Flag = 1 << 9, - kWriteOnly_Flag = 1 << 10, - kBuffer_Flag = 1 << 11, - // We use the Metal name for this one (corresponds to the GLSL 'shared' modifier) - kThreadgroup_Flag = 1 << 12, - // SkSL extensions, not present in GLSL - kExport_Flag = 1 << 13, - kES3_Flag = 1 << 14, - kPure_Flag = 1 << 15, - kInline_Flag = 1 << 16, - kNoInline_Flag = 1 << 17, - }; - - Modifiers() - : fLayout(Layout()) - , fFlags(0) {} - - Modifiers(const Layout& layout, int flags) - : fLayout(layout) - , fFlags(flags) {} - - std::string description() const { - return fLayout.description() + DescribeFlags(fFlags) + " "; - } - - static std::string DescribeFlags(int flags) { - // SkSL extensions - std::string result; - if (flags & kExport_Flag) { - result += "$export "; - } - if (flags & kES3_Flag) { - result += "$es3 "; - } - if (flags & kPure_Flag) { - result += "$pure "; - } - if (flags & kInline_Flag) { - result += "inline "; - } - if (flags & kNoInline_Flag) { - result += "noinline "; - } - - // Real GLSL qualifiers (must be specified in order in GLSL 4.1 and below) - if (flags & kFlat_Flag) { - result += "flat "; - } - if (flags & kNoPerspective_Flag) { - result += "noperspective "; - } - if (flags & kConst_Flag) { - result += "const "; - } - if (flags & kUniform_Flag) { - result += "uniform "; - } - if ((flags & kIn_Flag) && (flags & kOut_Flag)) { - result += "inout "; - } else if (flags & kIn_Flag) { - result += "in "; - } else if (flags & kOut_Flag) { - result += "out "; - } - if (flags & kHighp_Flag) { - result += "highp "; - } - if (flags & kMediump_Flag) { - result += "mediump "; - } - if (flags & kLowp_Flag) { - result += "lowp "; - } - if (flags & kReadOnly_Flag) { - result += "readonly "; - } - if (flags & kWriteOnly_Flag) { - result += "writeonly "; - } - if (flags & kBuffer_Flag) { - result += "buffer "; - } - - // We're using a non-GLSL name for this one; the GLSL equivalent is "shared" - if (flags & kThreadgroup_Flag) { - result += "threadgroup "; - } - - if (!result.empty()) { - result.pop_back(); - } - return result; - } - - bool operator==(const Modifiers& other) const { - return fLayout == other.fLayout && fFlags == other.fFlags; - } - - bool operator!=(const Modifiers& other) const { - return !(*this == other); - } - - /** - * Verifies that only permitted modifiers and layout flags are included. Reports errors and - * returns false in the event of a violation. - */ - bool checkPermitted(const Context& context, - Position pos, - int permittedModifierFlags, - int permittedLayoutFlags) const; - - Layout fLayout; - int fFlags; -}; - -} // namespace SkSL - -namespace std { - -template <> -struct hash { - size_t operator()(const SkSL::Modifiers& key) const { - return (size_t) key.fFlags ^ ((size_t) key.fLayout.fFlags << 8) ^ - ((size_t) key.fLayout.fBuiltin << 16); - } -}; - -} // namespace std - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramElement.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramElement.h deleted file mode 100644 index 8eb0a31aadab6b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramElement.h +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_PROGRAMELEMENT -#define SKSL_PROGRAMELEMENT - -#include "include/private/SkSLIRNode.h" - -#include - -namespace SkSL { - -/** - * Represents a top-level element (e.g. function or global variable) in a program. - */ -class ProgramElement : public IRNode { -public: - enum class Kind { - kExtension = 0, - kFunction, - kFunctionPrototype, - kGlobalVar, - kInterfaceBlock, - kModifiers, - kStructDefinition, - - kFirst = kExtension, - kLast = kStructDefinition - }; - - ProgramElement(Position pos, Kind kind) - : INHERITED(pos, (int) kind) { - SkASSERT(kind >= Kind::kFirst && kind <= Kind::kLast); - } - - Kind kind() const { - return (Kind) fKind; - } - - /** - * Use is to check the type of a program element. - * e.g. replace `el.kind() == ProgramElement::Kind::kExtension` with `el.is()`. - */ - template - bool is() const { - return this->kind() == T::kProgramElementKind; - } - - /** - * Use as to downcast program elements. e.g. replace `(Extension&) el` with - * `el.as()`. - */ - template - const T& as() const { - SkASSERT(this->is()); - return static_cast(*this); - } - - template - T& as() { - SkASSERT(this->is()); - return static_cast(*this); - } - - virtual std::unique_ptr clone() const = 0; - -private: - using INHERITED = IRNode; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramKind.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramKind.h deleted file mode 100644 index c240cb7376e602..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLProgramKind.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSLProgramKind_DEFINED -#define SkSLProgramKind_DEFINED - -#include - -namespace SkSL { - -/** - * SkSL supports several different program kinds. - */ -enum class ProgramKind : int8_t { - kFragment, - kVertex, - kCompute, - kGraphiteFragment, - kGraphiteVertex, - kRuntimeColorFilter, // Runtime effect only suitable as SkColorFilter - kRuntimeShader, // " " " " " SkShader - kRuntimeBlender, // " " " " " SkBlender - kPrivateRuntimeShader, // Runtime shader with public restrictions lifted - kMeshVertex, // Vertex portion of a custom mesh - kMeshFragment, // Fragment " " " " " - kGeneric, -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSampleUsage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSampleUsage.h deleted file mode 100644 index a8d67a025a82db..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSampleUsage.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSLSampleUsage_DEFINED -#define SkSLSampleUsage_DEFINED - -#include "include/core/SkTypes.h" - -#include - -namespace SkSL { - -/** - * Represents all of the ways that a fragment processor is sampled by its parent. - */ -class SampleUsage { -public: - enum class Kind { - // Child is never sampled - kNone, - // Child is only sampled at the same coordinates as the parent - kPassThrough, - // Child is sampled with a matrix whose value is uniform - kUniformMatrix, - // Child is sampled with sk_FragCoord.xy - kFragCoord, - // Child is sampled using explicit coordinates - kExplicit, - }; - - // Make a SampleUsage that corresponds to no sampling of the child at all - SampleUsage() = default; - - SampleUsage(Kind kind, bool hasPerspective) : fKind(kind), fHasPerspective(hasPerspective) { - if (kind != Kind::kUniformMatrix) { - SkASSERT(!fHasPerspective); - } - } - - // Child is sampled with a matrix whose value is uniform. The name is fixed. - static SampleUsage UniformMatrix(bool hasPerspective) { - return SampleUsage(Kind::kUniformMatrix, hasPerspective); - } - - static SampleUsage Explicit() { - return SampleUsage(Kind::kExplicit, false); - } - - static SampleUsage PassThrough() { - return SampleUsage(Kind::kPassThrough, false); - } - - static SampleUsage FragCoord() { return SampleUsage(Kind::kFragCoord, false); } - - bool operator==(const SampleUsage& that) const { - return fKind == that.fKind && fHasPerspective == that.fHasPerspective; - } - - bool operator!=(const SampleUsage& that) const { return !(*this == that); } - - // Arbitrary name used by all uniform sampling matrices - static const char* MatrixUniformName() { return "matrix"; } - - SampleUsage merge(const SampleUsage& other); - - Kind kind() const { return fKind; } - - bool hasPerspective() const { return fHasPerspective; } - - bool isSampled() const { return fKind != Kind::kNone; } - bool isPassThrough() const { return fKind == Kind::kPassThrough; } - bool isExplicit() const { return fKind == Kind::kExplicit; } - bool isUniformMatrix() const { return fKind == Kind::kUniformMatrix; } - bool isFragCoord() const { return fKind == Kind::kFragCoord; } - - std::string constructor() const; - -private: - Kind fKind = Kind::kNone; - bool fHasPerspective = false; // Only valid if fKind is kUniformMatrix -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLStatement.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLStatement.h deleted file mode 100644 index 43a1fdc8f37577..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLStatement.h +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_STATEMENT -#define SKSL_STATEMENT - -#include "include/private/SkSLIRNode.h" -#include "include/private/SkSLSymbol.h" - -namespace SkSL { - -/** - * Abstract supertype of all statements. - */ -class Statement : public IRNode { -public: - enum Kind { - kBlock = (int) Symbol::Kind::kLast + 1, - kBreak, - kContinue, - kDiscard, - kDo, - kExpression, - kFor, - kIf, - kNop, - kReturn, - kSwitch, - kSwitchCase, - kVarDeclaration, - - kFirst = kBlock, - kLast = kVarDeclaration, - }; - - Statement(Position pos, Kind kind) - : INHERITED(pos, (int) kind) { - SkASSERT(kind >= Kind::kFirst && kind <= Kind::kLast); - } - - Kind kind() const { - return (Kind) fKind; - } - - /** - * Use is to check the type of a statement. - * e.g. replace `s.kind() == Statement::Kind::kReturn` with `s.is()`. - */ - template - bool is() const { - return this->fKind == T::kStatementKind; - } - - /** - * Use as to downcast statements. - * e.g. replace `(ReturnStatement&) s` with `s.as()`. - */ - template - const T& as() const { - SkASSERT(this->is()); - return static_cast(*this); - } - - template - T& as() { - SkASSERT(this->is()); - return static_cast(*this); - } - - virtual bool isEmpty() const { - return false; - } - - virtual std::unique_ptr clone() const = 0; - -private: - using INHERITED = IRNode; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLString.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLString.h deleted file mode 100644 index 4458a2f0f5b451..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLString.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_STRING -#define SKSL_STRING - -#include "include/core/SkTypes.h" -#include "include/private/SkSLDefines.h" - -#include -#include -#include - -namespace SkSL { - -bool stod(std::string_view s, SKSL_FLOAT* value); -bool stoi(std::string_view s, SKSL_INT* value); - -namespace String { - -std::string printf(const char* fmt, ...) SK_PRINTF_LIKE(1, 2); -void appendf(std::string* str, const char* fmt, ...) SK_PRINTF_LIKE(2, 3); -void vappendf(std::string* str, const char* fmt, va_list va) SK_PRINTF_LIKE(2, 0); - -} // namespace String -} // namespace SkSL - -namespace skstd { - -// We use a custom to_string(float|double) which ignores locale settings and writes `1.0` instead -// of `1.00000`. -std::string to_string(float value); -std::string to_string(double value); - -} // namespace skstd - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSymbol.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSymbol.h deleted file mode 100644 index d7b40c8d11ae76..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSLSymbol.h +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_SYMBOL -#define SKSL_SYMBOL - -#include "include/private/SkSLIRNode.h" -#include "include/private/SkSLProgramElement.h" - -namespace SkSL { - -/** - * Represents a symboltable entry. - */ -class Symbol : public IRNode { -public: - enum class Kind { - kExternal = (int) ProgramElement::Kind::kLast + 1, - kField, - kFunctionDeclaration, - kType, - kVariable, - - kFirst = kExternal, - kLast = kVariable - }; - - Symbol(Position pos, Kind kind, std::string_view name, const Type* type = nullptr) - : INHERITED(pos, (int) kind) - , fName(name) - , fType(type) { - SkASSERT(kind >= Kind::kFirst && kind <= Kind::kLast); - } - - ~Symbol() override {} - - const Type& type() const { - SkASSERT(fType); - return *fType; - } - - Kind kind() const { - return (Kind) fKind; - } - - std::string_view name() const { - return fName; - } - - /** - * Don't call this directly--use SymbolTable::renameSymbol instead! - */ - void setName(std::string_view newName) { - fName = newName; - } - - /** - * Use is to check the type of a symbol. - * e.g. replace `sym.kind() == Symbol::Kind::kVariable` with `sym.is()`. - */ - template - bool is() const { - return this->kind() == T::kSymbolKind; - } - - /** - * Use as to downcast symbols. e.g. replace `(Variable&) sym` with `sym.as()`. - */ - template - const T& as() const { - SkASSERT(this->is()); - return static_cast(*this); - } - - template - T& as() { - SkASSERT(this->is()); - return static_cast(*this); - } - -private: - std::string_view fName; - const Type* fType; - - using INHERITED = IRNode; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe32.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe32.h deleted file mode 100644 index 7e59f2b0040ad7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe32.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSafe32_DEFINED -#define SkSafe32_DEFINED - -#include "include/core/SkTypes.h" - -static constexpr int32_t Sk64_pin_to_s32(int64_t x) { - return x < SK_MinS32 ? SK_MinS32 : (x > SK_MaxS32 ? SK_MaxS32 : (int32_t)x); -} - -static constexpr int32_t Sk32_sat_add(int32_t a, int32_t b) { - return Sk64_pin_to_s32((int64_t)a + (int64_t)b); -} - -static constexpr int32_t Sk32_sat_sub(int32_t a, int32_t b) { - return Sk64_pin_to_s32((int64_t)a - (int64_t)b); -} - -// To avoid UBSAN complaints about 2's compliment overflows -// -static constexpr int32_t Sk32_can_overflow_add(int32_t a, int32_t b) { - return (int32_t)((uint32_t)a + (uint32_t)b); -} -static constexpr int32_t Sk32_can_overflow_sub(int32_t a, int32_t b) { - return (int32_t)((uint32_t)a - (uint32_t)b); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe_math.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe_math.h deleted file mode 100644 index 144b28a4a3b3ae..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSafe_math.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSafe_math_DEFINED -#define SkSafe_math_DEFINED - -// This file protects against known bugs in ucrt\math.h. -// Namely, that header defines inline methods without marking them static, -// which makes it very easy to cause ODR violations and ensuing chaos. -// -// TODO: other headers? Here are some potential problem headers: -// $ grep -R __inline * | grep -v static | cut -f 1 -d: | sort | uniq -// corecrt.h -// corecrt_stdio_config.h -// ctype.h -// fenv.h -// locale.h -// malloc.h -// math.h -// tchar.h -// wchar.h -// I took a quick look through other headers outside math.h. -// Nothing looks anywhere near as likely to be used by Skia as math.h. - -#if defined(_MSC_VER) && !defined(_INC_MATH) - // Our strategy here is to simply inject "static" into the headers - // where it should have been written, just before __inline. - // - // Most inline-but-not-static methods in math.h are 32-bit only, - // but not all of them (see frexpf, hypothf, ldexpf...). So to - // be safe, 32- and 64-bit builds both get this treatment. - - #define __inline static __inline - #include - #undef __inline - - #if !defined(_INC_MATH) - #error Hmm. Looks like math.h has changed its header guards. - #endif - - #define INC_MATH_IS_SAFE_NOW - -#else - #include - -#endif - -#endif//SkSafe_math_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSemaphore.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSemaphore.h deleted file mode 100644 index d7318be577919c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSemaphore.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSemaphore_DEFINED -#define SkSemaphore_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkOnce.h" -#include "include/private/SkThreadAnnotations.h" -#include -#include - -class SkSemaphore { -public: - constexpr SkSemaphore(int count = 0) : fCount(count), fOSSemaphore(nullptr) {} - - // Cleanup the underlying OS semaphore. - SK_SPI ~SkSemaphore(); - - // Increment the counter n times. - // Generally it's better to call signal(n) instead of signal() n times. - void signal(int n = 1); - - // Decrement the counter by 1, - // then if the counter is < 0, sleep this thread until the counter is >= 0. - void wait(); - - // If the counter is positive, decrement it by 1 and return true, otherwise return false. - SK_SPI bool try_wait(); - -private: - // This implementation follows the general strategy of - // 'A Lightweight Semaphore with Partial Spinning' - // found here - // http://preshing.com/20150316/semaphores-are-surprisingly-versatile/ - // That article (and entire blog) are very much worth reading. - // - // We wrap an OS-provided semaphore with a user-space atomic counter that - // lets us avoid interacting with the OS semaphore unless strictly required: - // moving the count from >=0 to <0 or vice-versa, i.e. sleeping or waking threads. - struct OSSemaphore; - - SK_SPI void osSignal(int n); - SK_SPI void osWait(); - - std::atomic fCount; - SkOnce fOSSemaphoreOnce; - OSSemaphore* fOSSemaphore; -}; - -inline void SkSemaphore::signal(int n) { - int prev = fCount.fetch_add(n, std::memory_order_release); - - // We only want to call the OS semaphore when our logical count crosses - // from <0 to >=0 (when we need to wake sleeping threads). - // - // This is easiest to think about with specific examples of prev and n. - // If n == 5 and prev == -3, there are 3 threads sleeping and we signal - // std::min(-(-3), 5) == 3 times on the OS semaphore, leaving the count at 2. - // - // If prev >= 0, no threads are waiting, std::min(-prev, n) is always <= 0, - // so we don't call the OS semaphore, leaving the count at (prev + n). - int toSignal = std::min(-prev, n); - if (toSignal > 0) { - this->osSignal(toSignal); - } -} - -inline void SkSemaphore::wait() { - // Since this fetches the value before the subtract, zero and below means that there are no - // resources left, so the thread needs to wait. - if (fCount.fetch_sub(1, std::memory_order_acquire) <= 0) { - SK_POTENTIALLY_BLOCKING_REGION_BEGIN; - this->osWait(); - SK_POTENTIALLY_BLOCKING_REGION_END; - } -} - -#endif//SkSemaphore_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkShadowFlags.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkShadowFlags.h deleted file mode 100644 index 99ed6cb8a03f1a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkShadowFlags.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkShadowFlags_DEFINED -#define SkShadowFlags_DEFINED - -// A set of flags shared between the SkAmbientShadowMaskFilter and the SkSpotShadowMaskFilter -enum SkShadowFlags { - kNone_ShadowFlag = 0x00, - /** The occluding object is not opaque. Knowing that the occluder is opaque allows - * us to cull shadow geometry behind it and improve performance. */ - kTransparentOccluder_ShadowFlag = 0x01, - /** Don't try to use analytic shadows. */ - kGeometricOnly_ShadowFlag = 0x02, - /** Light position represents a direction, light radius is blur radius at elevation 1 */ - kDirectionalLight_ShadowFlag = 0x04, - /** Concave paths will only use blur to generate the shadow */ - kConcaveBlurOnly_ShadowFlag = 0x08, - /** mask for all shadow flags */ - kAll_ShadowFlag = 0x0F -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSpinlock.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSpinlock.h deleted file mode 100644 index e1d5011681e5f0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkSpinlock.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSpinlock_DEFINED -#define SkSpinlock_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkThreadAnnotations.h" -#include - -class SK_CAPABILITY("mutex") SkSpinlock { -public: - constexpr SkSpinlock() = default; - - void acquire() SK_ACQUIRE() { - // To act as a mutex, we need an acquire barrier when we acquire the lock. - if (fLocked.exchange(true, std::memory_order_acquire)) { - // Lock was contended. Fall back to an out-of-line spin loop. - this->contendedAcquire(); - } - } - - // Acquire the lock or fail (quickly). Lets the caller decide to do something other than wait. - bool tryAcquire() SK_TRY_ACQUIRE(true) { - // To act as a mutex, we need an acquire barrier when we acquire the lock. - if (fLocked.exchange(true, std::memory_order_acquire)) { - // Lock was contended. Let the caller decide what to do. - return false; - } - return true; - } - - void release() SK_RELEASE_CAPABILITY() { - // To act as a mutex, we need a release barrier when we release the lock. - fLocked.store(false, std::memory_order_release); - } - -private: - SK_API void contendedAcquire(); - - std::atomic fLocked{false}; -}; - -class SK_SCOPED_CAPABILITY SkAutoSpinlock { -public: - SkAutoSpinlock(SkSpinlock& mutex) SK_ACQUIRE(mutex) : fSpinlock(mutex) { fSpinlock.acquire(); } - ~SkAutoSpinlock() SK_RELEASE_CAPABILITY() { fSpinlock.release(); } - -private: - SkSpinlock& fSpinlock; -}; - -#endif//SkSpinlock_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkStringView.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkStringView.h deleted file mode 100644 index bf2f3da25eb604..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkStringView.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkStringView_DEFINED -#define SkStringView_DEFINED - -#include -#include - -namespace skstd { - -// C++20 additions -inline constexpr bool starts_with(std::string_view str, std::string_view prefix) { - if (prefix.length() > str.length()) { - return false; - } - return prefix.length() == 0 || !memcmp(str.data(), prefix.data(), prefix.length()); -} - -inline constexpr bool starts_with(std::string_view str, std::string_view::value_type c) { - return !str.empty() && str.front() == c; -} - -inline constexpr bool ends_with(std::string_view str, std::string_view suffix) { - if (suffix.length() > str.length()) { - return false; - } - return suffix.length() == 0 || !memcmp(str.data() + str.length() - suffix.length(), - suffix.data(), suffix.length()); -} - -inline constexpr bool ends_with(std::string_view str, std::string_view::value_type c) { - return !str.empty() && str.back() == c; -} - -// C++23 additions -inline constexpr bool contains(std::string_view str, std::string_view needle) { - return str.find(needle) != std::string_view::npos; -} - -inline constexpr bool contains(std::string_view str, std::string_view::value_type c) { - return str.find(c) != std::string_view::npos; -} - -} // namespace skstd - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTArray.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTArray.h deleted file mode 100644 index 5082669c4f3d6d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTArray.h +++ /dev/null @@ -1,655 +0,0 @@ -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTArray_DEFINED -#define SkTArray_DEFINED - -#include "include/core/SkMath.h" -#include "include/core/SkTypes.h" -#include "include/private/SkMalloc.h" -#include "include/private/SkSafe32.h" -#include "include/private/SkTLogic.h" -#include "include/private/SkTemplates.h" -#include "include/private/SkTo.h" - -#include -#include -#include -#include -#include -#include - -/** SkTArray implements a typical, mostly std::vector-like array. - Each T will be default-initialized on allocation, and ~T will be called on destruction. - - MEM_MOVE controls the behavior when a T needs to be moved (e.g. when the array is resized) - - true: T will be bit-copied via memcpy. - - false: T will be moved via move-constructors. - - Modern implementations of std::vector will generally provide similar performance - characteristics when used with appropriate care. Consider using std::vector in new code. -*/ -template ::value> class SkTArray { -private: - enum ReallocType { kExactFit, kGrowing, kShrinking }; - -public: - using value_type = T; - - /** - * Creates an empty array with no initial storage - */ - SkTArray() { this->init(0); } - - /** - * Creates an empty array that will preallocate space for reserveCount - * elements. - */ - explicit SkTArray(int reserveCount) : SkTArray() { this->reserve_back(reserveCount); } - - /** - * Copies one array to another. The new array will be heap allocated. - */ - SkTArray(const SkTArray& that) - : SkTArray(that.fItemArray, that.fCount) {} - - SkTArray(SkTArray&& that) { - if (that.fOwnMemory) { - fItemArray = that.fItemArray; - fCount = that.fCount; - fAllocCount = that.fAllocCount; - fOwnMemory = true; - fReserved = that.fReserved; - - that.fItemArray = nullptr; - that.fCount = 0; - that.fAllocCount = 0; - that.fOwnMemory = true; - that.fReserved = false; - } else { - this->init(that.fCount); - that.move(fItemArray); - that.fCount = 0; - } - } - - /** - * Creates a SkTArray by copying contents of a standard C array. The new - * array will be heap allocated. Be careful not to use this constructor - * when you really want the (void*, int) version. - */ - SkTArray(const T* array, int count) { - this->init(count); - this->copy(array); - } - /** - * Creates a SkTArray by copying contents of an initializer list. - */ - SkTArray(std::initializer_list data) - : SkTArray(data.begin(), data.size()) {} - - SkTArray& operator=(const SkTArray& that) { - if (this == &that) { - return *this; - } - for (int i = 0; i < this->count(); ++i) { - fItemArray[i].~T(); - } - fCount = 0; - this->checkRealloc(that.count(), kExactFit); - fCount = that.fCount; - this->copy(that.fItemArray); - return *this; - } - SkTArray& operator=(SkTArray&& that) { - if (this == &that) { - return *this; - } - for (int i = 0; i < this->count(); ++i) { - fItemArray[i].~T(); - } - fCount = 0; - this->checkRealloc(that.count(), kExactFit); - fCount = that.fCount; - that.move(fItemArray); - that.fCount = 0; - return *this; - } - - ~SkTArray() { - for (int i = 0; i < this->count(); ++i) { - fItemArray[i].~T(); - } - if (fOwnMemory) { - sk_free(fItemArray); - } - } - - /** - * Resets to count() == 0 and resets any reserve count. - */ - void reset() { - this->pop_back_n(fCount); - fReserved = false; - } - - /** - * Resets to count() = n newly constructed T objects and resets any reserve count. - */ - void reset(int n) { - SkASSERT(n >= 0); - for (int i = 0; i < this->count(); ++i) { - fItemArray[i].~T(); - } - // Set fCount to 0 before calling checkRealloc so that no elements are moved. - fCount = 0; - this->checkRealloc(n, kExactFit); - fCount = n; - for (int i = 0; i < this->count(); ++i) { - new (fItemArray + i) T; - } - fReserved = false; - } - - /** - * Resets to a copy of a C array and resets any reserve count. - */ - void reset(const T* array, int count) { - for (int i = 0; i < this->count(); ++i) { - fItemArray[i].~T(); - } - fCount = 0; - this->checkRealloc(count, kExactFit); - fCount = count; - this->copy(array); - fReserved = false; - } - - /** - * Ensures there is enough reserved space for n additional elements. The is guaranteed at least - * until the array size grows above n and subsequently shrinks below n, any version of reset() - * is called, or reserve_back() is called again. - */ - void reserve_back(int n) { - SkASSERT(n >= 0); - if (n > 0) { - this->checkRealloc(n, kExactFit); - fReserved = fOwnMemory; - } else { - fReserved = false; - } - } - - void removeShuffle(int n) { - SkASSERT(n < this->count()); - int newCount = fCount - 1; - fCount = newCount; - fItemArray[n].~T(); - if (n != newCount) { - this->move(n, newCount); - } - } - - /** - * Number of elements in the array. - */ - int count() const { return fCount; } - - /** - * Is the array empty. - */ - bool empty() const { return !fCount; } - - /** - * Adds 1 new default-initialized T value and returns it by reference. Note - * the reference only remains valid until the next call that adds or removes - * elements. - */ - T& push_back() { - void* newT = this->push_back_raw(1); - return *new (newT) T; - } - - /** - * Version of above that uses a copy constructor to initialize the new item - */ - T& push_back(const T& t) { - void* newT = this->push_back_raw(1); - return *new (newT) T(t); - } - - /** - * Version of above that uses a move constructor to initialize the new item - */ - T& push_back(T&& t) { - void* newT = this->push_back_raw(1); - return *new (newT) T(std::move(t)); - } - - /** - * Construct a new T at the back of this array. - */ - template T& emplace_back(Args&&... args) { - void* newT = this->push_back_raw(1); - return *new (newT) T(std::forward(args)...); - } - - /** - * Allocates n more default-initialized T values, and returns the address of - * the start of that new range. Note: this address is only valid until the - * next API call made on the array that might add or remove elements. - */ - T* push_back_n(int n) { - SkASSERT(n >= 0); - void* newTs = this->push_back_raw(n); - for (int i = 0; i < n; ++i) { - new (static_cast(newTs) + i * sizeof(T)) T; - } - return static_cast(newTs); - } - - /** - * Version of above that uses a copy constructor to initialize all n items - * to the same T. - */ - T* push_back_n(int n, const T& t) { - SkASSERT(n >= 0); - void* newTs = this->push_back_raw(n); - for (int i = 0; i < n; ++i) { - new (static_cast(newTs) + i * sizeof(T)) T(t); - } - return static_cast(newTs); - } - - /** - * Version of above that uses a copy constructor to initialize the n items - * to separate T values. - */ - T* push_back_n(int n, const T t[]) { - SkASSERT(n >= 0); - this->checkRealloc(n, kGrowing); - for (int i = 0; i < n; ++i) { - new (fItemArray + fCount + i) T(t[i]); - } - fCount += n; - return fItemArray + fCount - n; - } - - /** - * Version of above that uses the move constructor to set n items. - */ - T* move_back_n(int n, T* t) { - SkASSERT(n >= 0); - this->checkRealloc(n, kGrowing); - for (int i = 0; i < n; ++i) { - new (fItemArray + fCount + i) T(std::move(t[i])); - } - fCount += n; - return fItemArray + fCount - n; - } - - /** - * Removes the last element. Not safe to call when count() == 0. - */ - void pop_back() { - SkASSERT(fCount > 0); - --fCount; - fItemArray[fCount].~T(); - this->checkRealloc(0, kShrinking); - } - - /** - * Removes the last n elements. Not safe to call when count() < n. - */ - void pop_back_n(int n) { - SkASSERT(n >= 0); - SkASSERT(this->count() >= n); - fCount -= n; - for (int i = 0; i < n; ++i) { - fItemArray[fCount + i].~T(); - } - this->checkRealloc(0, kShrinking); - } - - /** - * Pushes or pops from the back to resize. Pushes will be default - * initialized. - */ - void resize_back(int newCount) { - SkASSERT(newCount >= 0); - - if (newCount > this->count()) { - this->push_back_n(newCount - fCount); - } else if (newCount < this->count()) { - this->pop_back_n(fCount - newCount); - } - } - - /** Swaps the contents of this array with that array. Does a pointer swap if possible, - otherwise copies the T values. */ - void swap(SkTArray& that) { - using std::swap; - if (this == &that) { - return; - } - if (fOwnMemory && that.fOwnMemory) { - swap(fItemArray, that.fItemArray); - - auto count = fCount; - fCount = that.fCount; - that.fCount = count; - - auto allocCount = fAllocCount; - fAllocCount = that.fAllocCount; - that.fAllocCount = allocCount; - } else { - // This could be more optimal... - SkTArray copy(std::move(that)); - that = std::move(*this); - *this = std::move(copy); - } - } - - T* begin() { - return fItemArray; - } - const T* begin() const { - return fItemArray; - } - T* end() { - return fItemArray ? fItemArray + fCount : nullptr; - } - const T* end() const { - return fItemArray ? fItemArray + fCount : nullptr; - } - T* data() { return fItemArray; } - const T* data() const { return fItemArray; } - size_t size() const { return (size_t)fCount; } - void resize(size_t count) { this->resize_back((int)count); } - - /** - * Get the i^th element. - */ - T& operator[] (int i) { - SkASSERT(i < this->count()); - SkASSERT(i >= 0); - return fItemArray[i]; - } - - const T& operator[] (int i) const { - SkASSERT(i < this->count()); - SkASSERT(i >= 0); - return fItemArray[i]; - } - - T& at(int i) { return (*this)[i]; } - const T& at(int i) const { return (*this)[i]; } - - /** - * equivalent to operator[](0) - */ - T& front() { SkASSERT(fCount > 0); return fItemArray[0];} - - const T& front() const { SkASSERT(fCount > 0); return fItemArray[0];} - - /** - * equivalent to operator[](count() - 1) - */ - T& back() { SkASSERT(fCount); return fItemArray[fCount - 1];} - - const T& back() const { SkASSERT(fCount > 0); return fItemArray[fCount - 1];} - - /** - * equivalent to operator[](count()-1-i) - */ - T& fromBack(int i) { - SkASSERT(i >= 0); - SkASSERT(i < this->count()); - return fItemArray[fCount - i - 1]; - } - - const T& fromBack(int i) const { - SkASSERT(i >= 0); - SkASSERT(i < this->count()); - return fItemArray[fCount - i - 1]; - } - - bool operator==(const SkTArray& right) const { - int leftCount = this->count(); - if (leftCount != right.count()) { - return false; - } - for (int index = 0; index < leftCount; ++index) { - if (fItemArray[index] != right.fItemArray[index]) { - return false; - } - } - return true; - } - - bool operator!=(const SkTArray& right) const { - return !(*this == right); - } - - int capacity() const { - return fAllocCount; - } - -protected: - /** - * Creates an empty array that will use the passed storage block until it - * is insufficiently large to hold the entire array. - */ - template - SkTArray(SkAlignedSTStorage* storage) { - this->initWithPreallocatedStorage(0, storage->get(), N); - } - - /** - * Copy a C array, using preallocated storage if preAllocCount >= - * count. Otherwise storage will only be used when array shrinks - * to fit. - */ - template - SkTArray(const T* array, int count, SkAlignedSTStorage* storage) { - this->initWithPreallocatedStorage(count, storage->get(), N); - this->copy(array); - } - -private: - // We disable Control-Flow Integrity sanitization (go/cfi) when casting item-array buffers. - // CFI flags this code as dangerous because we are casting `buffer` to a T* while the buffer's - // contents might still be uninitialized memory. When T has a vtable, this is especially risky - // because we could hypothetically access a virtual method on fItemArray and jump to an - // unpredictable location in memory. Of course, SkTArray won't actually use fItemArray in this - // way, and we don't want to construct a T before the user requests one. There's no real risk - // here, so disable CFI when doing these casts. - SK_ATTRIBUTE(no_sanitize("cfi")) - static T* TCast(void* buffer) { - return (T*)buffer; - } - - void init(int count) { - fCount = SkToU32(count); - if (!count) { - fAllocCount = 0; - fItemArray = nullptr; - } else { - fAllocCount = SkToU32(std::max(count, kMinHeapAllocCount)); - fItemArray = TCast(sk_malloc_throw((size_t)fAllocCount, sizeof(T))); - } - fOwnMemory = true; - fReserved = false; - } - - void initWithPreallocatedStorage(int count, void* preallocStorage, int preallocCount) { - SkASSERT(count >= 0); - SkASSERT(preallocCount > 0); - SkASSERT(preallocStorage); - fCount = SkToU32(count); - fItemArray = nullptr; - fReserved = false; - if (count > preallocCount) { - fAllocCount = SkToU32(std::max(count, kMinHeapAllocCount)); - fItemArray = TCast(sk_malloc_throw(fAllocCount, sizeof(T))); - fOwnMemory = true; - } else { - fAllocCount = SkToU32(preallocCount); - fItemArray = TCast(preallocStorage); - fOwnMemory = false; - } - } - - /** In the following move and copy methods, 'dst' is assumed to be uninitialized raw storage. - * In the following move methods, 'src' is destroyed leaving behind uninitialized raw storage. - */ - void copy(const T* src) { - // Some types may be trivially copyable, in which case we *could* use memcopy; but - // MEM_MOVE == true implies that the type is trivially movable, and not necessarily - // trivially copyable (think sk_sp<>). So short of adding another template arg, we - // must be conservative and use copy construction. - for (int i = 0; i < this->count(); ++i) { - new (fItemArray + i) T(src[i]); - } - } - - template std::enable_if_t move(int dst, int src) { - memcpy(static_cast(&fItemArray[dst]), - static_cast(&fItemArray[src]), - sizeof(T)); - } - template std::enable_if_t move(void* dst) { - sk_careful_memcpy(dst, fItemArray, fCount * sizeof(T)); - } - - template std::enable_if_t move(int dst, int src) { - new (&fItemArray[dst]) T(std::move(fItemArray[src])); - fItemArray[src].~T(); - } - template std::enable_if_t move(void* dst) { - for (int i = 0; i < this->count(); ++i) { - new (static_cast(dst) + sizeof(T) * (size_t)i) T(std::move(fItemArray[i])); - fItemArray[i].~T(); - } - } - - static constexpr int kMinHeapAllocCount = 8; - - // Helper function that makes space for n objects, adjusts the count, but does not initialize - // the new objects. - void* push_back_raw(int n) { - this->checkRealloc(n, kGrowing); - void* ptr = fItemArray + fCount; - fCount += n; - return ptr; - } - - void checkRealloc(int delta, ReallocType reallocType) { - SkASSERT(fCount >= 0); - SkASSERT(fAllocCount >= 0); - SkASSERT(-delta <= this->count()); - - // Move into 64bit math temporarily, to avoid local overflows - int64_t newCount = fCount + delta; - - // We allow fAllocCount to be in the range [newCount, 3*newCount]. We also never shrink - // when we're currently using preallocated memory, would allocate less than - // kMinHeapAllocCount, or a reserve count was specified that has yet to be exceeded. - bool mustGrow = newCount > fAllocCount; - bool shouldShrink = fAllocCount > 3 * newCount && fOwnMemory && !fReserved; - if (!mustGrow && !shouldShrink) { - return; - } - - int64_t newAllocCount = newCount; - if (reallocType != kExactFit) { - // Whether we're growing or shrinking, leave at least 50% extra space for future growth. - newAllocCount += ((newCount + 1) >> 1); - // Align the new allocation count to kMinHeapAllocCount. - static_assert(SkIsPow2(kMinHeapAllocCount), "min alloc count not power of two."); - newAllocCount = (newAllocCount + (kMinHeapAllocCount - 1)) & ~(kMinHeapAllocCount - 1); - } - - // At small sizes the old and new alloc count can both be kMinHeapAllocCount. - if (newAllocCount == fAllocCount) { - return; - } - - fAllocCount = SkToU32(Sk64_pin_to_s32(newAllocCount)); - SkASSERT(fAllocCount >= newCount); - T* newItemArray = TCast(sk_malloc_throw((size_t)fAllocCount, sizeof(T))); - this->move(newItemArray); - if (fOwnMemory) { - sk_free(fItemArray); - } - fItemArray = newItemArray; - fOwnMemory = true; - fReserved = false; - } - - T* fItemArray; - uint32_t fOwnMemory : 1; - uint32_t fCount : 31; - uint32_t fReserved : 1; - uint32_t fAllocCount : 31; -}; - -template static inline void swap(SkTArray& a, SkTArray& b) { - a.swap(b); -} - -template constexpr int SkTArray::kMinHeapAllocCount; - -/** - * Subclass of SkTArray that contains a preallocated memory block for the array. - */ -template ::value> -class SkSTArray : private SkAlignedSTStorage, public SkTArray { -private: - using STORAGE = SkAlignedSTStorage; - using INHERITED = SkTArray; - -public: - SkSTArray() - : STORAGE{}, INHERITED(static_cast(this)) {} - - SkSTArray(const T* array, int count) - : STORAGE{}, INHERITED(array, count, static_cast(this)) {} - - SkSTArray(std::initializer_list data) - : SkSTArray(data.begin(), data.size()) {} - - explicit SkSTArray(int reserveCount) - : SkSTArray() { - this->reserve_back(reserveCount); - } - - SkSTArray (const SkSTArray& that) : SkSTArray() { *this = that; } - explicit SkSTArray(const INHERITED& that) : SkSTArray() { *this = that; } - SkSTArray ( SkSTArray&& that) : SkSTArray() { *this = std::move(that); } - explicit SkSTArray( INHERITED&& that) : SkSTArray() { *this = std::move(that); } - - SkSTArray& operator=(const SkSTArray& that) { - INHERITED::operator=(that); - return *this; - } - SkSTArray& operator=(const INHERITED& that) { - INHERITED::operator=(that); - return *this; - } - - SkSTArray& operator=(SkSTArray&& that) { - INHERITED::operator=(std::move(that)); - return *this; - } - SkSTArray& operator=(INHERITED&& that) { - INHERITED::operator=(std::move(that)); - return *this; - } -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTDArray.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTDArray.h deleted file mode 100644 index 1b56266535a568..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTDArray.h +++ /dev/null @@ -1,273 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTDArray_DEFINED -#define SkTDArray_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkMalloc.h" -#include "include/private/SkTo.h" - -#include -#include -#include -#include -#include -#include - -class SK_SPI SkTDStorage { -public: - explicit SkTDStorage(int sizeOfT); - SkTDStorage(const void* src, int count, int sizeOfT); - - // Copy - SkTDStorage(const SkTDStorage& that); - SkTDStorage& operator= (const SkTDStorage& that); - - // Move - SkTDStorage(SkTDStorage&& that); - SkTDStorage& operator= (SkTDStorage&& that); - - ~SkTDStorage(); - - void reset(); - void swap(SkTDStorage& that); - - // Size routines - bool empty() const { return fCount == 0; } - void clear() { fCount = 0; } - int size() const { return fCount; } - void resize(int newCount); - size_t size_bytes() const { return this->bytes(fCount); } - - // Capacity routines - int capacity() const { return fReserve; } - void reserve(int newReserve); - void shrink_to_fit(); - - void* data() { return fStorage; } - const void* data() const { return fStorage; } - - // Deletion routines - void erase(int index, int count); - // Removes the entry at 'index' and replaces it with the last array element - void removeShuffle(int index); - - // Insertion routines - void* prepend(); - - void append(); - void append(int count); - void* append(const void* src, int count); - - void* insert(int index); - void* insert(int index, int count, const void* src); - - void pop_back() { - SkASSERT(fCount > 0); - fCount--; - } - - friend bool operator==(const SkTDStorage& a, const SkTDStorage& b); - friend bool operator!=(const SkTDStorage& a, const SkTDStorage& b) { - return !(a == b); - } - -private: - size_t bytes(int n) const { return SkToSizeT(n * fSizeOfT); } - void* address(int n) { return fStorage + this->bytes(n); } - - // Adds delta to fCount. Crash if outside [0, INT_MAX] - int calculateSizeOrDie(int delta); - - // Move the tail of the array defined by the indexes tailStart and tailEnd to dstIndex. The - // elements at dstIndex are overwritten by the tail. - void moveTail(int dstIndex, int tailStart, int tailEnd); - - // Copy src into the array at dstIndex. - void copySrc(int dstIndex, const void* src, int count); - - const int fSizeOfT; - std::byte* fStorage{nullptr}; - int fReserve{0}; // size of the allocation in fArray (#elements) - int fCount{0}; // logical number of elements (fCount <= fReserve) -}; - -static inline void swap(SkTDStorage& a, SkTDStorage& b) { - a.swap(b); -} - -// SkTDArray implements a std::vector-like array for raw data-only objects that do not require -// construction or destruction. The constructor and destructor for T will not be called; T objects -// will always be moved via raw memcpy. Newly created T objects will contain uninitialized memory. -template class SkTDArray { -public: - SkTDArray() : fStorage{sizeof(T)} {} - SkTDArray(const T src[], int count) : fStorage{src, count, sizeof(T)} { } - SkTDArray(const std::initializer_list& list) : SkTDArray(list.begin(), list.size()) {} - - // Copy - SkTDArray(const SkTDArray& src) : SkTDArray(src.data(), src.size()) {} - SkTDArray& operator=(const SkTDArray& src) { - fStorage = src.fStorage; - return *this; - } - - // Move - SkTDArray(SkTDArray&& src) : fStorage{std::move(src.fStorage)} {} - SkTDArray& operator=(SkTDArray&& src) { - fStorage = std::move(src.fStorage); - return *this; - } - - friend bool operator==(const SkTDArray& a, const SkTDArray& b) { - return a.fStorage == b.fStorage; - } - friend bool operator!=(const SkTDArray& a, const SkTDArray& b) { return !(a == b); } - - void swap(SkTDArray& that) { - using std::swap; - swap(fStorage, that.fStorage); - } - - bool empty() const { return fStorage.empty(); } - - // Return the number of elements in the array - int size() const { return fStorage.size(); } - - // Return the total number of elements allocated. - // Note: capacity() - size() gives you the number of elements you can add without causing an - // allocation. - int capacity() const { return fStorage.capacity(); } - - // return the number of bytes in the array: count * sizeof(T) - size_t size_bytes() const { return fStorage.size_bytes(); } - - T* data() { return static_cast(fStorage.data()); } - const T* data() const { return static_cast(fStorage.data()); } - T* begin() { return this->data(); } - const T* begin() const { return this->data(); } - T* end() { return this->data() + this->size(); } - const T* end() const { return this->data() + this->size(); } - - T& operator[](int index) { - SkASSERT(index < this->size()); - return this->data()[index]; - } - const T& operator[](int index) const { - SkASSERT(index < this->size()); - return this->data()[index]; - } - - const T& back() const { - SkASSERT(this->size() > 0); - return this->data()[this->size() - 1]; - } - T& back() { - SkASSERT(this->size() > 0); - return this->data()[this->size() - 1]; - } - - void reset() { - fStorage.reset(); - } - - void clear() { - fStorage.clear(); - } - - // Sets the number of elements in the array. - // If the array does not have space for count elements, it will increase - // the storage allocated to some amount greater than that required. - // It will never shrink the storage. - void resize(int count) { - fStorage.resize(count); - } - - void reserve(size_t n) { - fStorage.reserve(n); - } - - T* append() { - fStorage.append(); - return this->end() - 1; - } - T* append(int count) { - fStorage.append(count); - return this->end() - count; - } - T* append(int count, const T* src) { - return static_cast(fStorage.append(src, count)); - } - - T* insert(int index) { - return static_cast(fStorage.insert(index)); - } - T* insert(int index, int count, const T* src = nullptr) { - return static_cast(fStorage.insert(index, count, src)); - } - - void remove(int index, int count = 1) { - fStorage.erase(index, count); - } - - void removeShuffle(int index) { - fStorage.removeShuffle(index); - } - - int find(const T& elem) const { - const T* iter = this->begin(); - const T* stop = this->end(); - - for (; iter < stop; iter++) { - if (*iter == elem) { - return SkToInt(iter - this->begin()); - } - } - return -1; - } - - // routines to treat the array like a stack - void push_back(const T& v) { - this->append(); - this->back() = v; - } - void pop_back() { fStorage.pop_back(); } - - void deleteAll() { - for (T p : *this) { - delete p; - } - this->reset(); - } - - void freeAll() { - for (T p : *this) { - sk_free(p); - } - - this->reset(); - } - - void unrefAll() { - for (T p : *this) { - p->unref(); - } - this->reset(); - } - - void shrink_to_fit() { - fStorage.shrink_to_fit(); - } - -private: - SkTDStorage fStorage; -}; - -template static inline void swap(SkTDArray& a, SkTDArray& b) { a.swap(b); } - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTFitsIn.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTFitsIn.h deleted file mode 100644 index a912f13e08c01d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTFitsIn.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTFitsIn_DEFINED -#define SkTFitsIn_DEFINED - -#include -#include -#include - -/** - * std::underlying_type is only defined for enums. For integral types, we just want the type. - */ -template -struct sk_strip_enum { - typedef T type; -}; - -template -struct sk_strip_enum::value>::type> { - typedef typename std::underlying_type::type type; -}; - - -/** - * In C++ an unsigned to signed cast where the source value cannot be represented in the destination - * type results in an implementation defined destination value. Unlike C, C++ does not allow a trap. - * This makes "(S)(D)s == s" a possibly useful test. However, there are two cases where this is - * incorrect: - * - * when testing if a value of a smaller signed type can be represented in a larger unsigned type - * (int8_t)(uint16_t)-1 == -1 => (int8_t)0xFFFF == -1 => [implementation defined] == -1 - * - * when testing if a value of a larger unsigned type can be represented in a smaller signed type - * (uint16_t)(int8_t)0xFFFF == 0xFFFF => (uint16_t)-1 == 0xFFFF => 0xFFFF == 0xFFFF => true. - * - * Consider the cases: - * u = unsigned, less digits - * U = unsigned, more digits - * s = signed, less digits - * S = signed, more digits - * v is the value we're considering. - * - * u -> U: (u)(U)v == v, trivially true - * U -> u: (U)(u)v == v, both casts well defined, test works - * s -> S: (s)(S)v == v, trivially true - * S -> s: (S)(s)v == v, first cast implementation value, second cast defined, test works - * s -> U: (s)(U)v == v, *this is bad*, the second cast results in implementation defined value - * S -> u: (S)(u)v == v, the second cast is required to prevent promotion of rhs to unsigned - * u -> S: (u)(S)v == v, trivially true - * U -> s: (U)(s)v == v, *this is bad*, - * first cast results in implementation defined value, - * second cast is defined. However, this creates false positives - * uint16_t x = 0xFFFF - * (uint16_t)(int8_t)x == x - * => (uint16_t)-1 == x - * => 0xFFFF == x - * => true - * - * So for the eight cases three are trivially true, three more are valid casts, and two are special. - * The two 'full' checks which otherwise require two comparisons are valid cast checks. - * The two remaining checks s -> U [v >= 0] and U -> s [v <= max(s)] can be done with one op. - */ - -template -static constexpr inline -typename std::enable_if<(std::is_integral::value || std::is_enum::value) && - (std::is_integral::value || std::is_enum::value), bool>::type -/*bool*/ SkTFitsIn(S src) { - // SkTFitsIn() is used in public headers, so needs to be written targeting at most C++11. - return - - // E.g. (int8_t)(uint8_t) int8_t(-1) == -1, but the uint8_t == 255, not -1. - (std::is_signed::value && std::is_unsigned::value && sizeof(S) <= sizeof(D)) ? - (S)0 <= src : - - // E.g. (uint8_t)(int8_t) uint8_t(255) == 255, but the int8_t == -1. - (std::is_signed::value && std::is_unsigned::value && sizeof(D) <= sizeof(S)) ? - src <= (S)std::numeric_limits::type>::max() : - -#if !defined(SK_DEBUG) && !defined(__MSVC_RUNTIME_CHECKS ) - // Correct (simple) version. This trips up MSVC's /RTCc run-time checking. - (S)(D)src == src; -#else - // More complex version that's safe with /RTCc. Used in all debug builds, for coverage. - (std::is_signed::value) ? - (intmax_t)src >= (intmax_t)std::numeric_limits::type>::min() && - (intmax_t)src <= (intmax_t)std::numeric_limits::type>::max() : - - // std::is_unsigned ? - (uintmax_t)src <= (uintmax_t)std::numeric_limits::type>::max(); -#endif -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTHash.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTHash.h deleted file mode 100644 index 7fe6d33c70c84a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTHash.h +++ /dev/null @@ -1,591 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTHash_DEFINED -#define SkTHash_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkChecksum.h" -#include "include/private/SkTemplates.h" - -#include -#include -#include - -// Before trying to use SkTHashTable, look below to see if SkTHashMap or SkTHashSet works for you. -// They're easier to use, usually perform the same, and have fewer sharp edges. - -// T and K are treated as ordinary copyable C++ types. -// Traits must have: -// - static K GetKey(T) -// - static uint32_t Hash(K) -// If the key is large and stored inside T, you may want to make K a const&. -// Similarly, if T is large you might want it to be a pointer. -template -class SkTHashTable { -public: - SkTHashTable() = default; - ~SkTHashTable() = default; - - SkTHashTable(const SkTHashTable& that) { *this = that; } - SkTHashTable( SkTHashTable&& that) { *this = std::move(that); } - - SkTHashTable& operator=(const SkTHashTable& that) { - if (this != &that) { - fCount = that.fCount; - fCapacity = that.fCapacity; - fSlots.reset(that.fCapacity); - for (int i = 0; i < fCapacity; i++) { - fSlots[i] = that.fSlots[i]; - } - } - return *this; - } - - SkTHashTable& operator=(SkTHashTable&& that) { - if (this != &that) { - fCount = that.fCount; - fCapacity = that.fCapacity; - fSlots = std::move(that.fSlots); - - that.fCount = that.fCapacity = 0; - } - return *this; - } - - // Clear the table. - void reset() { *this = SkTHashTable(); } - - // How many entries are in the table? - int count() const { return fCount; } - - // How many slots does the table contain? (Note that unlike an array, hash tables can grow - // before reaching 100% capacity.) - int capacity() const { return fCapacity; } - - // Approximately how many bytes of memory do we use beyond sizeof(*this)? - size_t approxBytesUsed() const { return fCapacity * sizeof(Slot); } - - // !!!!!!!!!!!!!!!!! CAUTION !!!!!!!!!!!!!!!!! - // set(), find() and foreach() all allow mutable access to table entries. - // If you change an entry so that it no longer has the same key, all hell - // will break loose. Do not do that! - // - // Please prefer to use SkTHashMap or SkTHashSet, which do not have this danger. - - // The pointers returned by set() and find() are valid only until the next call to set(). - // The pointers you receive in foreach() are only valid for its duration. - - // Copy val into the hash table, returning a pointer to the copy now in the table. - // If there already is an entry in the table with the same key, we overwrite it. - T* set(T val) { - if (4 * fCount >= 3 * fCapacity) { - this->resize(fCapacity > 0 ? fCapacity * 2 : 4); - } - return this->uncheckedSet(std::move(val)); - } - - // If there is an entry in the table with this key, return a pointer to it. If not, null. - T* find(const K& key) const { - uint32_t hash = Hash(key); - int index = hash & (fCapacity-1); - for (int n = 0; n < fCapacity; n++) { - Slot& s = fSlots[index]; - if (s.empty()) { - return nullptr; - } - if (hash == s.fHash && key == Traits::GetKey(*s)) { - return &*s; - } - index = this->next(index); - } - SkASSERT(fCapacity == 0); - return nullptr; - } - - // If there is an entry in the table with this key, return it. If not, null. - // This only works for pointer type T, and cannot be used to find an nullptr entry. - T findOrNull(const K& key) const { - if (T* p = this->find(key)) { - return *p; - } - return nullptr; - } - - // Remove the value with this key from the hash table. - void remove(const K& key) { - SkASSERT(this->find(key)); - - uint32_t hash = Hash(key); - int index = hash & (fCapacity-1); - for (int n = 0; n < fCapacity; n++) { - Slot& s = fSlots[index]; - SkASSERT(s.has_value()); - if (hash == s.fHash && key == Traits::GetKey(*s)) { - this->removeSlot(index); - if (4 * fCount <= fCapacity && fCapacity > 4) { - this->resize(fCapacity / 2); - } - return; - } - index = this->next(index); - } - } - - // Hash tables will automatically resize themselves when set() and remove() are called, but - // resize() can be called to manually grow capacity before a bulk insertion. - void resize(int capacity) { - SkASSERT(capacity >= fCount); - int oldCapacity = fCapacity; - SkDEBUGCODE(int oldCount = fCount); - - fCount = 0; - fCapacity = capacity; - SkAutoTArray oldSlots = std::move(fSlots); - fSlots = SkAutoTArray(capacity); - - for (int i = 0; i < oldCapacity; i++) { - Slot& s = oldSlots[i]; - if (s.has_value()) { - this->uncheckedSet(*std::move(s)); - } - } - SkASSERT(fCount == oldCount); - } - - // Call fn on every entry in the table. You may mutate the entries, but be very careful. - template // f(T*) - void foreach(Fn&& fn) { - for (int i = 0; i < fCapacity; i++) { - if (fSlots[i].has_value()) { - fn(&*fSlots[i]); - } - } - } - - // Call fn on every entry in the table. You may not mutate anything. - template // f(T) or f(const T&) - void foreach(Fn&& fn) const { - for (int i = 0; i < fCapacity; i++) { - if (fSlots[i].has_value()) { - fn(*fSlots[i]); - } - } - } - - // A basic iterator-like class which disallows mutation; sufficient for range-based for loops. - // Intended for use by SkTHashMap and SkTHashSet via begin() and end(). - // Adding or removing elements may invalidate all iterators. - template - class Iter { - public: - using TTable = SkTHashTable; - - Iter(const TTable* table, int slot) : fTable(table), fSlot(slot) {} - - static Iter MakeBegin(const TTable* table) { - return Iter{table, table->firstPopulatedSlot()}; - } - - static Iter MakeEnd(const TTable* table) { - return Iter{table, table->capacity()}; - } - - const SlotVal& operator*() const { - return *fTable->slot(fSlot); - } - - const SlotVal* operator->() const { - return fTable->slot(fSlot); - } - - bool operator==(const Iter& that) const { - // Iterators from different tables shouldn't be compared against each other. - SkASSERT(fTable == that.fTable); - return fSlot == that.fSlot; - } - - bool operator!=(const Iter& that) const { - return !(*this == that); - } - - Iter& operator++() { - fSlot = fTable->nextPopulatedSlot(fSlot); - return *this; - } - - Iter operator++(int) { - Iter old = *this; - this->operator++(); - return old; - } - - protected: - const TTable* fTable; - int fSlot; - }; - -private: - // Finds the first non-empty slot for an iterator. - int firstPopulatedSlot() const { - for (int i = 0; i < fCapacity; i++) { - if (fSlots[i].has_value()) { - return i; - } - } - return fCapacity; - } - - // Increments an iterator's slot. - int nextPopulatedSlot(int currentSlot) const { - for (int i = currentSlot + 1; i < fCapacity; i++) { - if (fSlots[i].has_value()) { - return i; - } - } - return fCapacity; - } - - // Reads from an iterator's slot. - const T* slot(int i) const { - SkASSERT(fSlots[i].has_value()); - return &*fSlots[i]; - } - - T* uncheckedSet(T&& val) { - const K& key = Traits::GetKey(val); - SkASSERT(key == key); - uint32_t hash = Hash(key); - int index = hash & (fCapacity-1); - for (int n = 0; n < fCapacity; n++) { - Slot& s = fSlots[index]; - if (s.empty()) { - // New entry. - s.emplace(std::move(val), hash); - fCount++; - return &*s; - } - if (hash == s.fHash && key == Traits::GetKey(*s)) { - // Overwrite previous entry. - // Note: this triggers extra copies when adding the same value repeatedly. - s.emplace(std::move(val), hash); - return &*s; - } - - index = this->next(index); - } - SkASSERT(false); - return nullptr; - } - - void removeSlot(int index) { - fCount--; - - // Rearrange elements to restore the invariants for linear probing. - for (;;) { - Slot& emptySlot = fSlots[index]; - int emptyIndex = index; - int originalIndex; - // Look for an element that can be moved into the empty slot. - // If the empty slot is in between where an element landed, and its native slot, then - // move it to the empty slot. Don't move it if its native slot is in between where - // the element landed and the empty slot. - // [native] <= [empty] < [candidate] == GOOD, can move candidate to empty slot - // [empty] < [native] < [candidate] == BAD, need to leave candidate where it is - do { - index = this->next(index); - Slot& s = fSlots[index]; - if (s.empty()) { - // We're done shuffling elements around. Clear the last empty slot. - emptySlot.reset(); - return; - } - originalIndex = s.fHash & (fCapacity - 1); - } while ((index <= originalIndex && originalIndex < emptyIndex) - || (originalIndex < emptyIndex && emptyIndex < index) - || (emptyIndex < index && index <= originalIndex)); - // Move the element to the empty slot. - Slot& moveFrom = fSlots[index]; - emptySlot = std::move(moveFrom); - } - } - - int next(int index) const { - index--; - if (index < 0) { index += fCapacity; } - return index; - } - - static uint32_t Hash(const K& key) { - uint32_t hash = Traits::Hash(key) & 0xffffffff; - return hash ? hash : 1; // We reserve hash 0 to mark empty. - } - - class Slot { - public: - Slot() = default; - ~Slot() { this->reset(); } - - Slot(const Slot& that) { *this = that; } - Slot& operator=(const Slot& that) { - if (this == &that) { - return *this; - } - if (fHash) { - if (that.fHash) { - fVal.fStorage = that.fVal.fStorage; - fHash = that.fHash; - } else { - this->reset(); - } - } else { - if (that.fHash) { - new (&fVal.fStorage) T(that.fVal.fStorage); - fHash = that.fHash; - } else { - // do nothing, no value on either side - } - } - return *this; - } - - Slot(Slot&& that) { *this = std::move(that); } - Slot& operator=(Slot&& that) { - if (this == &that) { - return *this; - } - if (fHash) { - if (that.fHash) { - fVal.fStorage = std::move(that.fVal.fStorage); - fHash = that.fHash; - } else { - this->reset(); - } - } else { - if (that.fHash) { - new (&fVal.fStorage) T(std::move(that.fVal.fStorage)); - fHash = that.fHash; - } else { - // do nothing, no value on either side - } - } - return *this; - } - - T& operator*() & { return fVal.fStorage; } - const T& operator*() const& { return fVal.fStorage; } - T&& operator*() && { return std::move(fVal.fStorage); } - const T&& operator*() const&& { return std::move(fVal.fStorage); } - - Slot& emplace(T&& v, uint32_t h) { - this->reset(); - new (&fVal.fStorage) T(std::move(v)); - fHash = h; - return *this; - } - - bool has_value() const { return fHash != 0; } - explicit operator bool() const { return this->has_value(); } - bool empty() const { return !this->has_value(); } - - void reset() { - if (fHash) { - fVal.fStorage.~T(); - fHash = 0; - } - } - - uint32_t fHash = 0; - - private: - union Storage { - T fStorage; - Storage() {} - ~Storage() {} - } fVal; - }; - - int fCount = 0, - fCapacity = 0; - SkAutoTArray fSlots; -}; - -// Maps K->V. A more user-friendly wrapper around SkTHashTable, suitable for most use cases. -// K and V are treated as ordinary copyable C++ types, with no assumed relationship between the two. -template -class SkTHashMap { -public: - // Allow default construction and assignment. - SkTHashMap() = default; - - SkTHashMap(SkTHashMap&& that) = default; - SkTHashMap(const SkTHashMap& that) = default; - - SkTHashMap& operator=(SkTHashMap&& that) = default; - SkTHashMap& operator=(const SkTHashMap& that) = default; - - // Construct with an initializer list of key-value pairs. - struct Pair : public std::pair { - using std::pair::pair; - static const K& GetKey(const Pair& p) { return p.first; } - static auto Hash(const K& key) { return HashK()(key); } - }; - - SkTHashMap(std::initializer_list pairs) { - fTable.resize(pairs.size() * 5 / 3); - for (const Pair& p : pairs) { - fTable.set(p); - } - } - - // Clear the map. - void reset() { fTable.reset(); } - - // How many key/value pairs are in the table? - int count() const { return fTable.count(); } - - // Is empty? - bool empty() const { return fTable.count() == 0; } - - // Approximately how many bytes of memory do we use beyond sizeof(*this)? - size_t approxBytesUsed() const { return fTable.approxBytesUsed(); } - - // N.B. The pointers returned by set() and find() are valid only until the next call to set(). - - // Set key to val in the table, replacing any previous value with the same key. - // We copy both key and val, and return a pointer to the value copy now in the table. - V* set(K key, V val) { - Pair* out = fTable.set({std::move(key), std::move(val)}); - return &out->second; - } - - // If there is key/value entry in the table with this key, return a pointer to the value. - // If not, return null. - V* find(const K& key) const { - if (Pair* p = fTable.find(key)) { - return &p->second; - } - return nullptr; - } - - V& operator[](const K& key) { - if (V* val = this->find(key)) { - return *val; - } - return *this->set(key, V{}); - } - - // Remove the key/value entry in the table with this key. - void remove(const K& key) { - SkASSERT(this->find(key)); - fTable.remove(key); - } - - // Call fn on every key/value pair in the table. You may mutate the value but not the key. - template // f(K, V*) or f(const K&, V*) - void foreach(Fn&& fn) { - fTable.foreach([&fn](Pair* p){ fn(p->first, &p->second); }); - } - - // Call fn on every key/value pair in the table. You may not mutate anything. - template // f(K, V), f(const K&, V), f(K, const V&) or f(const K&, const V&). - void foreach(Fn&& fn) const { - fTable.foreach([&fn](const Pair& p){ fn(p.first, p.second); }); - } - - // Dereferencing an iterator gives back a key-value pair, suitable for structured binding. - using Iter = typename SkTHashTable::template Iter>; - - Iter begin() const { - return Iter::MakeBegin(&fTable); - } - - Iter end() const { - return Iter::MakeEnd(&fTable); - } - -private: - SkTHashTable fTable; -}; - -// A set of T. T is treated as an ordinary copyable C++ type. -template -class SkTHashSet { -public: - // Allow default construction and assignment. - SkTHashSet() = default; - - SkTHashSet(SkTHashSet&& that) = default; - SkTHashSet(const SkTHashSet& that) = default; - - SkTHashSet& operator=(SkTHashSet&& that) = default; - SkTHashSet& operator=(const SkTHashSet& that) = default; - - // Construct with an initializer list of Ts. - SkTHashSet(std::initializer_list vals) { - fTable.resize(vals.size() * 5 / 3); - for (const T& val : vals) { - fTable.set(val); - } - } - - // Clear the set. - void reset() { fTable.reset(); } - - // How many items are in the set? - int count() const { return fTable.count(); } - - // Is empty? - bool empty() const { return fTable.count() == 0; } - - // Approximately how many bytes of memory do we use beyond sizeof(*this)? - size_t approxBytesUsed() const { return fTable.approxBytesUsed(); } - - // Copy an item into the set. - void add(T item) { fTable.set(std::move(item)); } - - // Is this item in the set? - bool contains(const T& item) const { return SkToBool(this->find(item)); } - - // If an item equal to this is in the set, return a pointer to it, otherwise null. - // This pointer remains valid until the next call to add(). - const T* find(const T& item) const { return fTable.find(item); } - - // Remove the item in the set equal to this. - void remove(const T& item) { - SkASSERT(this->contains(item)); - fTable.remove(item); - } - - // Call fn on every item in the set. You may not mutate anything. - template // f(T), f(const T&) - void foreach (Fn&& fn) const { - fTable.foreach(fn); - } - -private: - struct Traits { - static const T& GetKey(const T& item) { return item; } - static auto Hash(const T& item) { return HashT()(item); } - }; - -public: - using Iter = typename SkTHashTable::template Iter; - - Iter begin() const { - return Iter::MakeBegin(&fTable); - } - - Iter end() const { - return Iter::MakeEnd(&fTable); - } - -private: - SkTHashTable fTable; -}; - -#endif//SkTHash_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTLogic.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTLogic.h deleted file mode 100644 index dce0dc804becdc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTLogic.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - * - * - * This header provides some std:: features early in the skstd namespace - * and several Skia-specific additions in the sknonstd namespace. - */ - -#ifndef SkTLogic_DEFINED -#define SkTLogic_DEFINED - -#include -#include -#include "include/private/SkTo.h" - -// The sknonstd namespace contains things we would like to be proposed and feel std-ish. -namespace sknonstd { - -// The name 'copy' here is fraught with peril. In this case it means 'append', not 'overwrite'. -// Alternate proposed names are 'propagate', 'augment', or 'append' (and 'add', but already taken). -// std::experimental::propagate_const already exists for other purposes in TSv2. -// These also follow the pattern used by boost. -template struct copy_const { - using type = std::conditional_t::value, std::add_const_t, D>; -}; -template using copy_const_t = typename copy_const::type; - -template struct copy_volatile { - using type = std::conditional_t::value, std::add_volatile_t, D>; -}; -template using copy_volatile_t = typename copy_volatile::type; - -template struct copy_cv { - using type = copy_volatile_t, S>; -}; -template using copy_cv_t = typename copy_cv::type; - -// The name 'same' here means 'overwrite'. -// Alternate proposed names are 'replace', 'transfer', or 'qualify_from'. -// same_xxx can be written as copy_xxx, S> -template using same_const = copy_const, S>; -template using same_const_t = typename same_const::type; -template using same_volatile =copy_volatile,S>; -template using same_volatile_t = typename same_volatile::type; -template using same_cv = copy_cv, S>; -template using same_cv_t = typename same_cv::type; - -} // namespace sknonstd - -template -constexpr int SkCount(const Container& c) { return SkTo(std::size(c)); } - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTPin.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTPin.h deleted file mode 100644 index c824c4464037e9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTPin.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTPin_DEFINED -#define SkTPin_DEFINED - -#include - -/** @return x pinned (clamped) between lo and hi, inclusively. - - Unlike std::clamp(), SkTPin() always returns a value between lo and hi. - If x is NaN, SkTPin() returns lo but std::clamp() returns NaN. -*/ -template -static constexpr const T& SkTPin(const T& x, const T& lo, const T& hi) { - return std::max(lo, std::min(x, hi)); -} - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTemplates.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTemplates.h deleted file mode 100644 index 16b0e0e586a29d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTemplates.h +++ /dev/null @@ -1,451 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTemplates_DEFINED -#define SkTemplates_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkMalloc.h" -#include "include/private/SkTLogic.h" - -#include -#include -#include -#include -#include -#include -#include - -/** \file SkTemplates.h - - This file contains light-weight template classes for type-safe and exception-safe - resource management. -*/ - -/** - * Marks a local variable as known to be unused (to avoid warnings). - * Note that this does *not* prevent the local variable from being optimized away. - */ -template inline void sk_ignore_unused_variable(const T&) { } - -/** - * Returns a pointer to a D which comes immediately after S[count]. - */ -template inline D* SkTAfter(S* ptr, size_t count = 1) { - return reinterpret_cast(ptr + count); -} - -/** - * Returns a pointer to a D which comes byteOffset bytes after S. - */ -template inline D* SkTAddOffset(S* ptr, ptrdiff_t byteOffset) { - // The intermediate char* has the same cv-ness as D as this produces better error messages. - // This relies on the fact that reinterpret_cast can add constness, but cannot remove it. - return reinterpret_cast(reinterpret_cast*>(ptr) + byteOffset); -} - -// TODO: when C++17 the language is available, use template -template struct SkFunctionWrapper { - template - auto operator()(Args&&... args) const -> decltype(P(std::forward(args)...)) { - return P(std::forward(args)...); - } -}; - -/** \class SkAutoTCallVProc - - Call a function when this goes out of scope. The template uses two - parameters, the object, and a function that is to be called in the destructor. - If release() is called, the object reference is set to null. If the object - reference is null when the destructor is called, we do not call the - function. -*/ -template class SkAutoTCallVProc - : public std::unique_ptr, P>> { - using inherited = std::unique_ptr, P>>; -public: - using inherited::inherited; - SkAutoTCallVProc(const SkAutoTCallVProc&) = delete; - SkAutoTCallVProc(SkAutoTCallVProc&& that) : inherited(std::move(that)) {} - - operator T*() const { return this->get(); } -}; - -/** Allocate an array of T elements, and free the array in the destructor - */ -template class SkAutoTArray { -public: - SkAutoTArray() {} - /** Allocate count number of T elements - */ - explicit SkAutoTArray(int count) { - SkASSERT(count >= 0); - if (count) { - fArray.reset(new T[count]); - } - SkDEBUGCODE(fCount = count;) - } - - SkAutoTArray(SkAutoTArray&& other) : fArray(std::move(other.fArray)) { - SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;) - } - SkAutoTArray& operator=(SkAutoTArray&& other) { - if (this != &other) { - fArray = std::move(other.fArray); - SkDEBUGCODE(fCount = other.fCount; other.fCount = 0;) - } - return *this; - } - - /** Reallocates given a new count. Reallocation occurs even if new count equals old count. - */ - void reset(int count = 0) { *this = SkAutoTArray(count); } - - /** Return the array of T elements. Will be NULL if count == 0 - */ - T* get() const { return fArray.get(); } - - /** Return the nth element in the array - */ - T& operator[](int index) const { - SkASSERT((unsigned)index < (unsigned)fCount); - return fArray[index]; - } - - /** Aliases matching other types, like std::vector. */ - const T* data() const { return fArray.get(); } - T* data() { return fArray.get(); } - -private: - std::unique_ptr fArray; - SkDEBUGCODE(int fCount = 0;) -}; - -/** Wraps SkAutoTArray, with room for kCountRequested elements preallocated. - */ -template class SkAutoSTArray { -public: - SkAutoSTArray(SkAutoSTArray&&) = delete; - SkAutoSTArray(const SkAutoSTArray&) = delete; - SkAutoSTArray& operator=(SkAutoSTArray&&) = delete; - SkAutoSTArray& operator=(const SkAutoSTArray&) = delete; - - /** Initialize with no objects */ - SkAutoSTArray() { - fArray = nullptr; - fCount = 0; - } - - /** Allocate count number of T elements - */ - SkAutoSTArray(int count) { - fArray = nullptr; - fCount = 0; - this->reset(count); - } - - ~SkAutoSTArray() { - this->reset(0); - } - - /** Destroys previous objects in the array and default constructs count number of objects */ - void reset(int count) { - T* start = fArray; - T* iter = start + fCount; - while (iter > start) { - (--iter)->~T(); - } - - SkASSERT(count >= 0); - if (fCount != count) { - if (fCount > kCount) { - // 'fArray' was allocated last time so free it now - SkASSERT((T*) fStorage != fArray); - sk_free(fArray); - } - - if (count > kCount) { - fArray = (T*) sk_malloc_throw(count, sizeof(T)); - } else if (count > 0) { - fArray = (T*) fStorage; - } else { - fArray = nullptr; - } - - fCount = count; - } - - iter = fArray; - T* stop = fArray + count; - while (iter < stop) { - new (iter++) T; - } - } - - /** Return the number of T elements in the array - */ - int count() const { return fCount; } - - /** Return the array of T elements. Will be NULL if count == 0 - */ - T* get() const { return fArray; } - - T* begin() { return fArray; } - - const T* begin() const { return fArray; } - - T* end() { return fArray + fCount; } - - const T* end() const { return fArray + fCount; } - - /** Return the nth element in the array - */ - T& operator[](int index) const { - SkASSERT(index < fCount); - return fArray[index]; - } - - /** Aliases matching other types, like std::vector. */ - const T* data() const { return fArray; } - T* data() { return fArray; } - size_t size() const { return fCount; } - -private: -#if defined(SK_BUILD_FOR_GOOGLE3) - // Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max, but some functions - // have multiple large stack allocations. - static const int kMaxBytes = 4 * 1024; - static const int kCount = kCountRequested * sizeof(T) > kMaxBytes - ? kMaxBytes / sizeof(T) - : kCountRequested; -#else - static const int kCount = kCountRequested; -#endif - - int fCount; - T* fArray; - // since we come right after fArray, fStorage should be properly aligned - char fStorage[kCount * sizeof(T)]; -}; - -/** Manages an array of T elements, freeing the array in the destructor. - * Does NOT call any constructors/destructors on T (T must be POD). - */ -template ::value && - std::is_trivially_destructible::value>> -class SkAutoTMalloc { -public: - /** Takes ownership of the ptr. The ptr must be a value which can be passed to sk_free. */ - explicit SkAutoTMalloc(T* ptr = nullptr) : fPtr(ptr) {} - - /** Allocates space for 'count' Ts. */ - explicit SkAutoTMalloc(size_t count) - : fPtr(count ? (T*)sk_malloc_throw(count, sizeof(T)) : nullptr) {} - - SkAutoTMalloc(SkAutoTMalloc&&) = default; - SkAutoTMalloc& operator=(SkAutoTMalloc&&) = default; - - /** Resize the memory area pointed to by the current ptr preserving contents. */ - void realloc(size_t count) { - fPtr.reset(count ? (T*)sk_realloc_throw(fPtr.release(), count * sizeof(T)) : nullptr); - } - - /** Resize the memory area pointed to by the current ptr without preserving contents. */ - T* reset(size_t count = 0) { - fPtr.reset(count ? (T*)sk_malloc_throw(count, sizeof(T)) : nullptr); - return this->get(); - } - - T* get() const { return fPtr.get(); } - - operator T*() { return fPtr.get(); } - - operator const T*() const { return fPtr.get(); } - - T& operator[](int index) { return fPtr.get()[index]; } - - const T& operator[](int index) const { return fPtr.get()[index]; } - - /** Aliases matching other types, like std::vector. */ - const T* data() const { return fPtr.get(); } - T* data() { return fPtr.get(); } - - /** - * Transfer ownership of the ptr to the caller, setting the internal - * pointer to NULL. Note that this differs from get(), which also returns - * the pointer, but it does not transfer ownership. - */ - T* release() { return fPtr.release(); } - -private: - std::unique_ptr> fPtr; -}; - -template ::value && - std::is_trivially_destructible::value>> -class SkAutoSTMalloc { -public: - SkAutoSTMalloc() : fPtr(fTStorage) {} - - SkAutoSTMalloc(size_t count) { - if (count > kCount) { - fPtr = (T*)sk_malloc_throw(count, sizeof(T)); - } else if (count) { - fPtr = fTStorage; - } else { - fPtr = nullptr; - } - } - - SkAutoSTMalloc(SkAutoSTMalloc&&) = delete; - SkAutoSTMalloc(const SkAutoSTMalloc&) = delete; - SkAutoSTMalloc& operator=(SkAutoSTMalloc&&) = delete; - SkAutoSTMalloc& operator=(const SkAutoSTMalloc&) = delete; - - ~SkAutoSTMalloc() { - if (fPtr != fTStorage) { - sk_free(fPtr); - } - } - - // doesn't preserve contents - T* reset(size_t count) { - if (fPtr != fTStorage) { - sk_free(fPtr); - } - if (count > kCount) { - fPtr = (T*)sk_malloc_throw(count, sizeof(T)); - } else if (count) { - fPtr = fTStorage; - } else { - fPtr = nullptr; - } - return fPtr; - } - - T* get() const { return fPtr; } - - operator T*() { - return fPtr; - } - - operator const T*() const { - return fPtr; - } - - T& operator[](int index) { - return fPtr[index]; - } - - const T& operator[](int index) const { - return fPtr[index]; - } - - /** Aliases matching other types, like std::vector. */ - const T* data() const { return fPtr; } - T* data() { return fPtr; } - - // Reallocs the array, can be used to shrink the allocation. Makes no attempt to be intelligent - void realloc(size_t count) { - if (count > kCount) { - if (fPtr == fTStorage) { - fPtr = (T*)sk_malloc_throw(count, sizeof(T)); - memcpy((void*)fPtr, fTStorage, kCount * sizeof(T)); - } else { - fPtr = (T*)sk_realloc_throw(fPtr, count, sizeof(T)); - } - } else if (count) { - if (fPtr != fTStorage) { - fPtr = (T*)sk_realloc_throw(fPtr, count, sizeof(T)); - } - } else { - this->reset(0); - } - } - -private: - // Since we use uint32_t storage, we might be able to get more elements for free. - static const size_t kCountWithPadding = SkAlign4(kCountRequested*sizeof(T)) / sizeof(T); -#if defined(SK_BUILD_FOR_GOOGLE3) - // Stack frame size is limited for SK_BUILD_FOR_GOOGLE3. 4k is less than the actual max, but some functions - // have multiple large stack allocations. - static const size_t kMaxBytes = 4 * 1024; - static const size_t kCount = kCountRequested * sizeof(T) > kMaxBytes - ? kMaxBytes / sizeof(T) - : kCountWithPadding; -#else - static const size_t kCount = kCountWithPadding; -#endif - - T* fPtr; - union { - uint32_t fStorage32[SkAlign4(kCount*sizeof(T)) >> 2]; - T fTStorage[1]; // do NOT want to invoke T::T() - }; -}; - -////////////////////////////////////////////////////////////////////////////////////////////////// - -template class SkAlignedSTStorage { -public: - SkAlignedSTStorage() {} - SkAlignedSTStorage(SkAlignedSTStorage&&) = delete; - SkAlignedSTStorage(const SkAlignedSTStorage&) = delete; - SkAlignedSTStorage& operator=(SkAlignedSTStorage&&) = delete; - SkAlignedSTStorage& operator=(const SkAlignedSTStorage&) = delete; - - /** - * Returns void* because this object does not initialize the - * memory. Use placement new for types that require a constructor. - */ - void* get() { return fStorage; } - const void* get() const { return fStorage; } -private: - alignas(T) char fStorage[sizeof(T)*N]; -}; - -using SkAutoFree = std::unique_ptr>; - -template -constexpr auto SkMakeArrayFromIndexSequence(C c, std::index_sequence is) --> std::array())), sizeof...(Is)> { - return {{ c(Is)... }}; -} - -template constexpr auto SkMakeArray(C c) --> std::array::value_type>())), N> { - return SkMakeArrayFromIndexSequence(c, std::make_index_sequence{}); -} - -/** - * Trait for identifying types which are relocatable via memcpy, for container optimizations. - * - */ -template -struct sk_has_trivially_relocatable_member : std::false_type {}; - -// Types can declare themselves trivially relocatable with a public -// using sk_is_trivially_relocatable = std::true_type; -template -struct sk_has_trivially_relocatable_member> - : T::sk_is_trivially_relocatable {}; - -// By default, all trivially copyable types are trivially relocatable. -template -struct sk_is_trivially_relocatable - : std::disjunction, sk_has_trivially_relocatable_member ->{}; - -// Here be some dragons: while technically not guaranteed, we count on all sane unique_ptr -// implementations to be trivially relocatable. -template -struct sk_is_trivially_relocatable> : std::true_type {}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadAnnotations.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadAnnotations.h deleted file mode 100644 index fc2a4aacee6ff7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadAnnotations.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkThreadAnnotations_DEFINED -#define SkThreadAnnotations_DEFINED - -// The bulk of this code is cribbed from: -// http://clang.llvm.org/docs/ThreadSafetyAnalysis.html - -#if defined(__clang__) && (!defined(SWIG)) -#define SK_THREAD_ANNOTATION_ATTRIBUTE(x) __attribute__((x)) -#else -#define SK_THREAD_ANNOTATION_ATTRIBUTE(x) // no-op -#endif - -#define SK_CAPABILITY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(capability(x)) - -#define SK_SCOPED_CAPABILITY \ - SK_THREAD_ANNOTATION_ATTRIBUTE(scoped_lockable) - -#define SK_GUARDED_BY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(guarded_by(x)) - -#define SK_PT_GUARDED_BY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(pt_guarded_by(x)) - -#define SK_ACQUIRED_BEFORE(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(acquired_before(__VA_ARGS__)) - -#define SK_ACQUIRED_AFTER(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(acquired_after(__VA_ARGS__)) - -#define SK_REQUIRES(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(requires_capability(__VA_ARGS__)) - -#define SK_REQUIRES_SHARED(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(requires_shared_capability(__VA_ARGS__)) - -#define SK_ACQUIRE(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(acquire_capability(__VA_ARGS__)) - -#define SK_ACQUIRE_SHARED(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(acquire_shared_capability(__VA_ARGS__)) - -// Would be SK_RELEASE, but that is already in use as SK_DEBUG vs. SK_RELEASE. -#define SK_RELEASE_CAPABILITY(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(release_capability(__VA_ARGS__)) - -// For symmetry with SK_RELEASE_CAPABILITY. -#define SK_RELEASE_SHARED_CAPABILITY(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(release_shared_capability(__VA_ARGS__)) - -#define SK_TRY_ACQUIRE(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_capability(__VA_ARGS__)) - -#define SK_TRY_ACQUIRE_SHARED(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(try_acquire_shared_capability(__VA_ARGS__)) - -#define SK_EXCLUDES(...) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(locks_excluded(__VA_ARGS__)) - -#define SK_ASSERT_CAPABILITY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(assert_capability(x)) - -#define SK_ASSERT_SHARED_CAPABILITY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(assert_shared_capability(x)) - -#define SK_RETURN_CAPABILITY(x) \ - SK_THREAD_ANNOTATION_ATTRIBUTE(lock_returned(x)) - -#define SK_NO_THREAD_SAFETY_ANALYSIS \ - SK_THREAD_ANNOTATION_ATTRIBUTE(no_thread_safety_analysis) - -#if defined(SK_BUILD_FOR_GOOGLE3) && !defined(SK_BUILD_FOR_WASM_IN_GOOGLE3) - extern "C" { - void __google_cxa_guard_acquire_begin(void); - void __google_cxa_guard_acquire_end (void); - } - #define SK_POTENTIALLY_BLOCKING_REGION_BEGIN __google_cxa_guard_acquire_begin() - #define SK_POTENTIALLY_BLOCKING_REGION_END __google_cxa_guard_acquire_end() -#else - #define SK_POTENTIALLY_BLOCKING_REGION_BEGIN - #define SK_POTENTIALLY_BLOCKING_REGION_END -#endif - -#endif // SkThreadAnnotations_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadID.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadID.h deleted file mode 100644 index e14388b3de5bda..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkThreadID.h +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkThreadID_DEFINED -#define SkThreadID_DEFINED - -#include "include/core/SkTypes.h" - -typedef int64_t SkThreadID; - -// SkMutex.h uses SkGetThredID in debug only code. -SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID(); - -const SkThreadID kIllegalThreadID = 0; - -#endif // SkThreadID_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTo.h deleted file mode 100644 index d788f7b269dad5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkTo.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkTo_DEFINED -#define SkTo_DEFINED - -#include "include/core/SkTypes.h" -#include "include/private/SkTFitsIn.h" - -template constexpr D SkTo(S s) { - return SkASSERT(SkTFitsIn(s)), - static_cast(s); -} - -template constexpr int8_t SkToS8(S x) { return SkTo(x); } -template constexpr uint8_t SkToU8(S x) { return SkTo(x); } -template constexpr int16_t SkToS16(S x) { return SkTo(x); } -template constexpr uint16_t SkToU16(S x) { return SkTo(x); } -template constexpr int32_t SkToS32(S x) { return SkTo(x); } -template constexpr uint32_t SkToU32(S x) { return SkTo(x); } -template constexpr int SkToInt(S x) { return SkTo(x); } -template constexpr unsigned SkToUInt(S x) { return SkTo(x); } -template constexpr size_t SkToSizeT(S x) { return SkTo(x); } - -#endif // SkTo_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkUniquePaintParamsID.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkUniquePaintParamsID.h deleted file mode 100644 index 2cd89fd2f4df5c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkUniquePaintParamsID.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkUniquePaintParamsID_DEFINED -#define SkUniquePaintParamsID_DEFINED - -#include "include/core/SkTypes.h" - -// This class boils down to a unique uint that can be used instead of a variable length -// key derived from a PaintParams. -class SkUniquePaintParamsID { -public: - explicit SkUniquePaintParamsID(uint32_t id) : fID(id) { - SkASSERT(id != SK_InvalidUniqueID); - } - - static SkUniquePaintParamsID InvalidID() { return SkUniquePaintParamsID(); } - - SkUniquePaintParamsID() : fID(SK_InvalidUniqueID) {} - - bool operator==(const SkUniquePaintParamsID &that) const { return fID == that.fID; } - bool operator!=(const SkUniquePaintParamsID &that) const { return !(*this == that); } - - bool isValid() const { return fID != SK_InvalidUniqueID; } - uint32_t asUInt() const { return fID; } - -private: - uint32_t fID; -}; - -#endif // SkUniquePaintParamsID_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkVx.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkVx.h deleted file mode 100644 index 74cdabffe2d0c4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkVx.h +++ /dev/null @@ -1,1026 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKVX_DEFINED -#define SKVX_DEFINED - -// skvx::Vec are SIMD vectors of N T's, a v1.5 successor to SkNx. -// -// This time we're leaning a bit less on platform-specific intrinsics and a bit -// more on Clang/GCC vector extensions, but still keeping the option open to -// drop in platform-specific intrinsics, actually more easily than before. -// -// We've also fixed a few of the caveats that used to make SkNx awkward to work -// with across translation units. skvx::Vec always has N*sizeof(T) size -// and alignment and is safe to use across translation units freely. -// (Ideally we'd only align to T, but that tanks ARMv7 NEON codegen.) - -// Please try to keep this file independent of Skia headers. -#include // std::min, std::max -#include // assert() -#include // ceilf, floorf, truncf, roundf, sqrtf, etc. -#include // intXX_t -#include // memcpy() -#include // std::initializer_list -#include // std::index_sequence - -// Users may disable SIMD with SKNX_NO_SIMD, which may be set via compiler flags. -// The gn build has no option which sets SKNX_NO_SIMD. -// Use SKVX_USE_SIMD internally to avoid confusing double negation. -// Do not use 'defined' in a macro expansion. -#if !defined(SKNX_NO_SIMD) - #define SKVX_USE_SIMD 1 -#else - #define SKVX_USE_SIMD 0 -#endif - -#if SKVX_USE_SIMD - #if defined(__SSE__) || defined(__AVX__) || defined(__AVX2__) - #include - #elif defined(__ARM_NEON) - #include - #elif defined(__wasm_simd128__) - #include - #endif -#endif - -// To avoid ODR violations, all methods must be force-inlined... -#if defined(_MSC_VER) - #define SKVX_ALWAYS_INLINE __forceinline -#else - #define SKVX_ALWAYS_INLINE __attribute__((always_inline)) -#endif - -// ... and all standalone functions must be static. Please use these helpers: -#define SI static inline -#define SIT template < typename T> SI -#define SIN template SI -#define SINT template SI -#define SINTU template ::value>> SI - -namespace skvx { - -template -struct alignas(N*sizeof(T)) Vec; - -template -SI Vec shuffle(const Vec&); - -template -SI D bit_pun(const S&); - -// All Vec have the same simple memory layout, the same as `T vec[N]`. -template -struct alignas(N*sizeof(T)) VecStorage { - SKVX_ALWAYS_INLINE VecStorage() = default; - SKVX_ALWAYS_INLINE VecStorage(T s) : lo(s), hi(s) {} - - Vec lo, hi; -}; - -template -struct VecStorage<4,T> { - SKVX_ALWAYS_INLINE VecStorage() = default; - SKVX_ALWAYS_INLINE VecStorage(T s) : lo(s), hi(s) {} - SKVX_ALWAYS_INLINE VecStorage(T x, T y, T z, T w) : lo(x,y), hi(z, w) {} - SKVX_ALWAYS_INLINE VecStorage(Vec<2,T> xy, T z, T w) : lo(xy), hi(z,w) {} - SKVX_ALWAYS_INLINE VecStorage(T x, T y, Vec<2,T> zw) : lo(x,y), hi(zw) {} - SKVX_ALWAYS_INLINE VecStorage(Vec<2,T> xy, Vec<2,T> zw) : lo(xy), hi(zw) {} - - SKVX_ALWAYS_INLINE Vec<2,T>& xy() { return lo; } - SKVX_ALWAYS_INLINE Vec<2,T>& zw() { return hi; } - SKVX_ALWAYS_INLINE T& x() { return lo.lo.val; } - SKVX_ALWAYS_INLINE T& y() { return lo.hi.val; } - SKVX_ALWAYS_INLINE T& z() { return hi.lo.val; } - SKVX_ALWAYS_INLINE T& w() { return hi.hi.val; } - - SKVX_ALWAYS_INLINE Vec<2,T> xy() const { return lo; } - SKVX_ALWAYS_INLINE Vec<2,T> zw() const { return hi; } - SKVX_ALWAYS_INLINE T x() const { return lo.lo.val; } - SKVX_ALWAYS_INLINE T y() const { return lo.hi.val; } - SKVX_ALWAYS_INLINE T z() const { return hi.lo.val; } - SKVX_ALWAYS_INLINE T w() const { return hi.hi.val; } - - // Exchange-based swizzles. These should take 1 cycle on NEON and 3 (pipelined) cycles on SSE. - SKVX_ALWAYS_INLINE Vec<4,T> yxwz() const { return shuffle<1,0,3,2>(bit_pun>(*this)); } - SKVX_ALWAYS_INLINE Vec<4,T> zwxy() const { return shuffle<2,3,0,1>(bit_pun>(*this)); } - - Vec<2,T> lo, hi; -}; - -template -struct VecStorage<2,T> { - SKVX_ALWAYS_INLINE VecStorage() = default; - SKVX_ALWAYS_INLINE VecStorage(T s) : lo(s), hi(s) {} - SKVX_ALWAYS_INLINE VecStorage(T x, T y) : lo(x), hi(y) {} - - SKVX_ALWAYS_INLINE T& x() { return lo.val; } - SKVX_ALWAYS_INLINE T& y() { return hi.val; } - - SKVX_ALWAYS_INLINE T x() const { return lo.val; } - SKVX_ALWAYS_INLINE T y() const { return hi.val; } - - // This exchange-based swizzle should take 1 cycle on NEON and 3 (pipelined) cycles on SSE. - SKVX_ALWAYS_INLINE Vec<2,T> yx() const { return shuffle<1,0>(bit_pun>(*this)); } - - SKVX_ALWAYS_INLINE Vec<4,T> xyxy() const { - return Vec<4,T>(bit_pun>(*this), bit_pun>(*this)); - } - - Vec<1,T> lo, hi; -}; - -template -struct alignas(N*sizeof(T)) Vec : public VecStorage { - static_assert((N & (N-1)) == 0, "N must be a power of 2."); - static_assert(sizeof(T) >= alignof(T), "What kind of unusual T is this?"); - - // Methods belong here in the class declaration of Vec only if: - // - they must be here, like constructors or operator[]; - // - they'll definitely never want a specialized implementation. - // Other operations on Vec should be defined outside the type. - - SKVX_ALWAYS_INLINE Vec() = default; - - using VecStorage::VecStorage; - - // NOTE: Vec{x} produces x000..., whereas Vec(x) produces xxxx.... since this constructor fills - // unspecified lanes with 0s, whereas the single T constructor fills all lanes with the value. - SKVX_ALWAYS_INLINE Vec(std::initializer_list xs) { - T vals[N] = {0}; - memcpy(vals, xs.begin(), std::min(xs.size(), (size_t)N)*sizeof(T)); - - this->lo = Vec::Load(vals + 0); - this->hi = Vec::Load(vals + N/2); - } - - SKVX_ALWAYS_INLINE T operator[](int i) const { return ilo[i] : this->hi[i-N/2]; } - SKVX_ALWAYS_INLINE T& operator[](int i) { return ilo[i] : this->hi[i-N/2]; } - - SKVX_ALWAYS_INLINE static Vec Load(const void* ptr) { - Vec v; - memcpy(&v, ptr, sizeof(Vec)); - return v; - } - SKVX_ALWAYS_INLINE void store(void* ptr) const { - memcpy(ptr, this, sizeof(Vec)); - } -}; - -template -struct Vec<1,T> { - T val; - - SKVX_ALWAYS_INLINE Vec() = default; - - Vec(T s) : val(s) {} - - SKVX_ALWAYS_INLINE Vec(std::initializer_list xs) : val(xs.size() ? *xs.begin() : 0) {} - - SKVX_ALWAYS_INLINE T operator[](int) const { return val; } - SKVX_ALWAYS_INLINE T& operator[](int) { return val; } - - SKVX_ALWAYS_INLINE static Vec Load(const void* ptr) { - Vec v; - memcpy(&v, ptr, sizeof(Vec)); - return v; - } - SKVX_ALWAYS_INLINE void store(void* ptr) const { - memcpy(ptr, this, sizeof(Vec)); - } -}; - -template -SI D bit_pun(const S& s) { - static_assert(sizeof(D) == sizeof(S)); - D d; - memcpy(&d, &s, sizeof(D)); - return d; -} - -// Translate from a value type T to its corresponding Mask, the result of a comparison. -template struct Mask { using type = T; }; -template <> struct Mask { using type = int32_t; }; -template <> struct Mask { using type = int64_t; }; -template using M = typename Mask::type; - -// Join two Vec into one Vec<2N,T>. -SINT Vec<2*N,T> join(const Vec& lo, const Vec& hi) { - Vec<2*N,T> v; - v.lo = lo; - v.hi = hi; - return v; -} - -// We have three strategies for implementing Vec operations: -// 1) lean on Clang/GCC vector extensions when available; -// 2) use map() to apply a scalar function lane-wise; -// 3) recurse on lo/hi to scalar portable implementations. -// We can slot in platform-specific implementations as overloads for particular Vec, -// or often integrate them directly into the recursion of style 3), allowing fine control. - -#if SKVX_USE_SIMD && (defined(__clang__) || defined(__GNUC__)) - - // VExt types have the same size as Vec and support most operations directly. - #if defined(__clang__) - template - using VExt = T __attribute__((ext_vector_type(N))); - - #elif defined(__GNUC__) - template - struct VExtHelper { - typedef T __attribute__((vector_size(N*sizeof(T)))) type; - }; - - template - using VExt = typename VExtHelper::type; - - // For some reason some (new!) versions of GCC cannot seem to deduce N in the generic - // to_vec() below for N=4 and T=float. This workaround seems to help... - SI Vec<4,float> to_vec(VExt<4,float> v) { return bit_pun>(v); } - #endif - - SINT VExt to_vext(const Vec& v) { return bit_pun>(v); } - SINT Vec to_vec(const VExt& v) { return bit_pun>(v); } - - SINT Vec operator+(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) + to_vext(y)); - } - SINT Vec operator-(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) - to_vext(y)); - } - SINT Vec operator*(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) * to_vext(y)); - } - SINT Vec operator/(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) / to_vext(y)); - } - - SINT Vec operator^(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) ^ to_vext(y)); - } - SINT Vec operator&(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) & to_vext(y)); - } - SINT Vec operator|(const Vec& x, const Vec& y) { - return to_vec(to_vext(x) | to_vext(y)); - } - - SINT Vec operator!(const Vec& x) { return to_vec(!to_vext(x)); } - SINT Vec operator-(const Vec& x) { return to_vec(-to_vext(x)); } - SINT Vec operator~(const Vec& x) { return to_vec(~to_vext(x)); } - - SINT Vec operator<<(const Vec& x, int k) { return to_vec(to_vext(x) << k); } - SINT Vec operator>>(const Vec& x, int k) { return to_vec(to_vext(x) >> k); } - - SINT Vec> operator==(const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) == to_vext(y)); - } - SINT Vec> operator!=(const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) != to_vext(y)); - } - SINT Vec> operator<=(const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) <= to_vext(y)); - } - SINT Vec> operator>=(const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) >= to_vext(y)); - } - SINT Vec> operator< (const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) < to_vext(y)); - } - SINT Vec> operator> (const Vec& x, const Vec& y) { - return bit_pun>>(to_vext(x) > to_vext(y)); - } - -#else - - // Either SKNX_NO_SIMD is defined, or Clang/GCC vector extensions are not available. - // We'll implement things portably with N==1 scalar implementations and recursion onto them. - - // N == 1 scalar implementations. - SIT Vec<1,T> operator+(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val + y.val; } - SIT Vec<1,T> operator-(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val - y.val; } - SIT Vec<1,T> operator*(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val * y.val; } - SIT Vec<1,T> operator/(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val / y.val; } - - SIT Vec<1,T> operator^(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val ^ y.val; } - SIT Vec<1,T> operator&(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val & y.val; } - SIT Vec<1,T> operator|(const Vec<1,T>& x, const Vec<1,T>& y) { return x.val | y.val; } - - SIT Vec<1,T> operator!(const Vec<1,T>& x) { return !x.val; } - SIT Vec<1,T> operator-(const Vec<1,T>& x) { return -x.val; } - SIT Vec<1,T> operator~(const Vec<1,T>& x) { return ~x.val; } - - SIT Vec<1,T> operator<<(const Vec<1,T>& x, int k) { return x.val << k; } - SIT Vec<1,T> operator>>(const Vec<1,T>& x, int k) { return x.val >> k; } - - SIT Vec<1,M> operator==(const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val == y.val ? ~0 : 0; - } - SIT Vec<1,M> operator!=(const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val != y.val ? ~0 : 0; - } - SIT Vec<1,M> operator<=(const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val <= y.val ? ~0 : 0; - } - SIT Vec<1,M> operator>=(const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val >= y.val ? ~0 : 0; - } - SIT Vec<1,M> operator< (const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val < y.val ? ~0 : 0; - } - SIT Vec<1,M> operator> (const Vec<1,T>& x, const Vec<1,T>& y) { - return x.val > y.val ? ~0 : 0; - } - - // Recurse on lo/hi down to N==1 scalar implementations. - SINT Vec operator+(const Vec& x, const Vec& y) { - return join(x.lo + y.lo, x.hi + y.hi); - } - SINT Vec operator-(const Vec& x, const Vec& y) { - return join(x.lo - y.lo, x.hi - y.hi); - } - SINT Vec operator*(const Vec& x, const Vec& y) { - return join(x.lo * y.lo, x.hi * y.hi); - } - SINT Vec operator/(const Vec& x, const Vec& y) { - return join(x.lo / y.lo, x.hi / y.hi); - } - - SINT Vec operator^(const Vec& x, const Vec& y) { - return join(x.lo ^ y.lo, x.hi ^ y.hi); - } - SINT Vec operator&(const Vec& x, const Vec& y) { - return join(x.lo & y.lo, x.hi & y.hi); - } - SINT Vec operator|(const Vec& x, const Vec& y) { - return join(x.lo | y.lo, x.hi | y.hi); - } - - SINT Vec operator!(const Vec& x) { return join(!x.lo, !x.hi); } - SINT Vec operator-(const Vec& x) { return join(-x.lo, -x.hi); } - SINT Vec operator~(const Vec& x) { return join(~x.lo, ~x.hi); } - - SINT Vec operator<<(const Vec& x, int k) { return join(x.lo << k, x.hi << k); } - SINT Vec operator>>(const Vec& x, int k) { return join(x.lo >> k, x.hi >> k); } - - SINT Vec> operator==(const Vec& x, const Vec& y) { - return join(x.lo == y.lo, x.hi == y.hi); - } - SINT Vec> operator!=(const Vec& x, const Vec& y) { - return join(x.lo != y.lo, x.hi != y.hi); - } - SINT Vec> operator<=(const Vec& x, const Vec& y) { - return join(x.lo <= y.lo, x.hi <= y.hi); - } - SINT Vec> operator>=(const Vec& x, const Vec& y) { - return join(x.lo >= y.lo, x.hi >= y.hi); - } - SINT Vec> operator< (const Vec& x, const Vec& y) { - return join(x.lo < y.lo, x.hi < y.hi); - } - SINT Vec> operator> (const Vec& x, const Vec& y) { - return join(x.lo > y.lo, x.hi > y.hi); - } -#endif - -// Scalar/vector operations splat the scalar to a vector. -SINTU Vec operator+ (U x, const Vec& y) { return Vec(x) + y; } -SINTU Vec operator- (U x, const Vec& y) { return Vec(x) - y; } -SINTU Vec operator* (U x, const Vec& y) { return Vec(x) * y; } -SINTU Vec operator/ (U x, const Vec& y) { return Vec(x) / y; } -SINTU Vec operator^ (U x, const Vec& y) { return Vec(x) ^ y; } -SINTU Vec operator& (U x, const Vec& y) { return Vec(x) & y; } -SINTU Vec operator| (U x, const Vec& y) { return Vec(x) | y; } -SINTU Vec> operator==(U x, const Vec& y) { return Vec(x) == y; } -SINTU Vec> operator!=(U x, const Vec& y) { return Vec(x) != y; } -SINTU Vec> operator<=(U x, const Vec& y) { return Vec(x) <= y; } -SINTU Vec> operator>=(U x, const Vec& y) { return Vec(x) >= y; } -SINTU Vec> operator< (U x, const Vec& y) { return Vec(x) < y; } -SINTU Vec> operator> (U x, const Vec& y) { return Vec(x) > y; } - -SINTU Vec operator+ (const Vec& x, U y) { return x + Vec(y); } -SINTU Vec operator- (const Vec& x, U y) { return x - Vec(y); } -SINTU Vec operator* (const Vec& x, U y) { return x * Vec(y); } -SINTU Vec operator/ (const Vec& x, U y) { return x / Vec(y); } -SINTU Vec operator^ (const Vec& x, U y) { return x ^ Vec(y); } -SINTU Vec operator& (const Vec& x, U y) { return x & Vec(y); } -SINTU Vec operator| (const Vec& x, U y) { return x | Vec(y); } -SINTU Vec> operator==(const Vec& x, U y) { return x == Vec(y); } -SINTU Vec> operator!=(const Vec& x, U y) { return x != Vec(y); } -SINTU Vec> operator<=(const Vec& x, U y) { return x <= Vec(y); } -SINTU Vec> operator>=(const Vec& x, U y) { return x >= Vec(y); } -SINTU Vec> operator< (const Vec& x, U y) { return x < Vec(y); } -SINTU Vec> operator> (const Vec& x, U y) { return x > Vec(y); } - -SINT Vec& operator+=(Vec& x, const Vec& y) { return (x = x + y); } -SINT Vec& operator-=(Vec& x, const Vec& y) { return (x = x - y); } -SINT Vec& operator*=(Vec& x, const Vec& y) { return (x = x * y); } -SINT Vec& operator/=(Vec& x, const Vec& y) { return (x = x / y); } -SINT Vec& operator^=(Vec& x, const Vec& y) { return (x = x ^ y); } -SINT Vec& operator&=(Vec& x, const Vec& y) { return (x = x & y); } -SINT Vec& operator|=(Vec& x, const Vec& y) { return (x = x | y); } - -SINTU Vec& operator+=(Vec& x, U y) { return (x = x + Vec(y)); } -SINTU Vec& operator-=(Vec& x, U y) { return (x = x - Vec(y)); } -SINTU Vec& operator*=(Vec& x, U y) { return (x = x * Vec(y)); } -SINTU Vec& operator/=(Vec& x, U y) { return (x = x / Vec(y)); } -SINTU Vec& operator^=(Vec& x, U y) { return (x = x ^ Vec(y)); } -SINTU Vec& operator&=(Vec& x, U y) { return (x = x & Vec(y)); } -SINTU Vec& operator|=(Vec& x, U y) { return (x = x | Vec(y)); } - -SINT Vec& operator<<=(Vec& x, int bits) { return (x = x << bits); } -SINT Vec& operator>>=(Vec& x, int bits) { return (x = x >> bits); } - -// Some operations we want are not expressible with Clang/GCC vector extensions. - -// Clang can reason about naive_if_then_else() and optimize through it better -// than if_then_else(), so it's sometimes useful to call it directly when we -// think an entire expression should optimize away, e.g. min()/max(). -SINT Vec naive_if_then_else(const Vec>& cond, const Vec& t, const Vec& e) { - return bit_pun>(( cond & bit_pun>>(t)) | - (~cond & bit_pun>>(e)) ); -} - -SIT Vec<1,T> if_then_else(const Vec<1,M>& cond, const Vec<1,T>& t, const Vec<1,T>& e) { - // In practice this scalar implementation is unlikely to be used. See next if_then_else(). - return bit_pun>(( cond & bit_pun>>(t)) | - (~cond & bit_pun>>(e)) ); -} -SINT Vec if_then_else(const Vec>& cond, const Vec& t, const Vec& e) { - // Specializations inline here so they can generalize what types the apply to. -#if SKVX_USE_SIMD && defined(__AVX2__) - if constexpr (N*sizeof(T) == 32) { - return bit_pun>(_mm256_blendv_epi8(bit_pun<__m256i>(e), - bit_pun<__m256i>(t), - bit_pun<__m256i>(cond))); - } -#endif -#if SKVX_USE_SIMD && defined(__SSE4_1__) - if constexpr (N*sizeof(T) == 16) { - return bit_pun>(_mm_blendv_epi8(bit_pun<__m128i>(e), - bit_pun<__m128i>(t), - bit_pun<__m128i>(cond))); - } -#endif -#if SKVX_USE_SIMD && defined(__ARM_NEON) - if constexpr (N*sizeof(T) == 16) { - return bit_pun>(vbslq_u8(bit_pun(cond), - bit_pun(t), - bit_pun(e))); - } -#endif - // Recurse for large vectors to try to hit the specializations above. - if constexpr (N*sizeof(T) > 16) { - return join(if_then_else(cond.lo, t.lo, e.lo), - if_then_else(cond.hi, t.hi, e.hi)); - } - // This default can lead to better code than the recursing onto scalars. - return naive_if_then_else(cond, t, e); -} - -SIT bool any(const Vec<1,T>& x) { return x.val != 0; } -SINT bool any(const Vec& x) { - // For any(), the _mm_testz intrinsics are correct and don't require comparing 'x' to 0, so it's - // lower latency compared to _mm_movemask + _mm_compneq on plain SSE. -#if SKVX_USE_SIMD && defined(__AVX2__) - if constexpr (N*sizeof(T) == 32) { - return !_mm256_testz_si256(bit_pun<__m256i>(x), _mm256_set1_epi32(-1)); - } -#endif -#if SKVX_USE_SIMD && defined(__SSE_4_1__) - if constexpr (N*sizeof(T) == 16) { - return !_mm_testz_si128(bit_pun<__m128i>(x), _mm_set1_epi32(-1)); - } -#endif -#if SKVX_USE_SIMD && defined(__SSE__) - if constexpr (N*sizeof(T) == 16) { - // On SSE, movemask checks only the MSB in each lane, which is fine if the lanes were set - // directly from a comparison op (which sets all bits to 1 when true), but skvx::Vec<> - // treats any non-zero value as true, so we have to compare 'x' to 0 before calling movemask - return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) != 0b0000; - } -#endif -#if SKVX_USE_SIMD && defined(__aarch64__) - // On 64-bit NEON, take the max across lanes, which will be non-zero if any lane was true. - // The specific lane-size doesn't really matter in this case since it's really any set bit - // that we're looking for. - if constexpr (N*sizeof(T) == 8 ) { return vmaxv_u8 (bit_pun (x)) > 0; } - if constexpr (N*sizeof(T) == 16) { return vmaxvq_u8(bit_pun(x)) > 0; } -#endif -#if SKVX_USE_SIMD && defined(__wasm_simd128__) - if constexpr (N == 4 && sizeof(T) == 4) { - return wasm_i32x4_any_true(bit_pun>(x)); - } -#endif - return any(x.lo) - || any(x.hi); -} - -SIT bool all(const Vec<1,T>& x) { return x.val != 0; } -SINT bool all(const Vec& x) { -// Unlike any(), we have to respect the lane layout, or we'll miss cases where a -// true lane has a mix of 0 and 1 bits. -#if SKVX_USE_SIMD && defined(__SSE__) - // Unfortunately, the _mm_testc intrinsics don't let us avoid the comparison to 0 for all()'s - // correctness, so always just use the plain SSE version. - if constexpr (N == 4 && sizeof(T) == 4) { - return _mm_movemask_ps(_mm_cmpneq_ps(bit_pun<__m128>(x), _mm_set1_ps(0))) == 0b1111; - } -#endif -#if SKVX_USE_SIMD && defined(__aarch64__) - // On 64-bit NEON, take the min across the lanes, which will be non-zero if all lanes are != 0. - if constexpr (sizeof(T)==1 && N==8) {return vminv_u8 (bit_pun (x)) > 0;} - if constexpr (sizeof(T)==1 && N==16) {return vminvq_u8 (bit_pun(x)) > 0;} - if constexpr (sizeof(T)==2 && N==4) {return vminv_u16 (bit_pun(x)) > 0;} - if constexpr (sizeof(T)==2 && N==8) {return vminvq_u16(bit_pun(x)) > 0;} - if constexpr (sizeof(T)==4 && N==2) {return vminv_u32 (bit_pun(x)) > 0;} - if constexpr (sizeof(T)==4 && N==4) {return vminvq_u32(bit_pun(x)) > 0;} -#endif -#if SKVX_USE_SIMD && defined(__wasm_simd128__) - if constexpr (N == 4 && sizeof(T) == 4) { - return wasm_i32x4_all_true(bit_pun>(x)); - } -#endif - return all(x.lo) - && all(x.hi); -} - -// cast() Vec to Vec, as if applying a C-cast to each lane. -// TODO: implement with map()? -template -SI Vec<1,D> cast(const Vec<1,S>& src) { return (D)src.val; } - -template -SI Vec cast(const Vec& src) { -#if SKVX_USE_SIMD && defined(__clang__) - return to_vec(__builtin_convertvector(to_vext(src), VExt)); -#else - return join(cast(src.lo), cast(src.hi)); -#endif -} - -// min/max match logic of std::min/std::max, which is important when NaN is involved. -SIT T min(const Vec<1,T>& x) { return x.val; } -SIT T max(const Vec<1,T>& x) { return x.val; } -SINT T min(const Vec& x) { return std::min(min(x.lo), min(x.hi)); } -SINT T max(const Vec& x) { return std::max(max(x.lo), max(x.hi)); } - -SINT Vec min(const Vec& x, const Vec& y) { return naive_if_then_else(y < x, y, x); } -SINT Vec max(const Vec& x, const Vec& y) { return naive_if_then_else(x < y, y, x); } - -SINTU Vec min(const Vec& x, U y) { return min(x, Vec(y)); } -SINTU Vec max(const Vec& x, U y) { return max(x, Vec(y)); } -SINTU Vec min(U x, const Vec& y) { return min(Vec(x), y); } -SINTU Vec max(U x, const Vec& y) { return max(Vec(x), y); } - -// pin matches the logic of SkTPin, which is important when NaN is involved. It always returns -// values in the range lo..hi, and if x is NaN, it returns lo. -SINT Vec pin(const Vec& x, const Vec& lo, const Vec& hi) { - return max(lo, min(x, hi)); -} - -// Shuffle values from a vector pretty arbitrarily: -// skvx::Vec<4,float> rgba = {R,G,B,A}; -// shuffle<2,1,0,3> (rgba) ~> {B,G,R,A} -// shuffle<2,1> (rgba) ~> {B,G} -// shuffle<2,1,2,1,2,1,2,1>(rgba) ~> {B,G,B,G,B,G,B,G} -// shuffle<3,3,3,3> (rgba) ~> {A,A,A,A} -// The only real restriction is that the output also be a legal N=power-of-two sknx::Vec. -template -SI Vec shuffle(const Vec& x) { -#if SKVX_USE_SIMD && defined(__clang__) - // TODO: can we just always use { x[Ix]... }? - return to_vec(__builtin_shufflevector(to_vext(x), to_vext(x), Ix...)); -#else - return { x[Ix]... }; -#endif -} - -// Call map(fn, x) for a vector with fn() applied to each lane of x, { fn(x[0]), fn(x[1]), ... }, -// or map(fn, x,y) for a vector of fn(x[i], y[i]), etc. - -template -SI auto map(std::index_sequence, - Fn&& fn, const Args&... args) -> skvx::Vec { - auto lane = [&](size_t i) -#if defined(__clang__) - // CFI, specifically -fsanitize=cfi-icall, seems to give a false positive here, - // with errors like "control flow integrity check for type 'float (float) - // noexcept' failed during indirect function call... note: sqrtf.cfi_jt defined - // here". But we can be quite sure fn is the right type: it's all inferred! - // So, stifle CFI in this function. - __attribute__((no_sanitize("cfi"))) -#endif - { return fn(args[i]...); }; - - return { lane(I)... }; -} - -template -auto map(Fn&& fn, const Vec& first, const Rest&... rest) { - // Derive an {0...N-1} index_sequence from the size of the first arg: N lanes in, N lanes out. - return map(std::make_index_sequence{}, fn, first,rest...); -} - -SIN Vec ceil(const Vec& x) { return map( ceilf, x); } -SIN Vec floor(const Vec& x) { return map(floorf, x); } -SIN Vec trunc(const Vec& x) { return map(truncf, x); } -SIN Vec round(const Vec& x) { return map(roundf, x); } -SIN Vec sqrt(const Vec& x) { return map( sqrtf, x); } -SIN Vec abs(const Vec& x) { return map( fabsf, x); } -SIN Vec fma(const Vec& x, - const Vec& y, - const Vec& z) { - // I don't understand why Clang's codegen is terrible if we write map(fmaf, x,y,z) directly. - auto fn = [](float x, float y, float z) { return fmaf(x,y,z); }; - return map(fn, x,y,z); -} - -SI Vec<1,int> lrint(const Vec<1,float>& x) { - return (int)lrintf(x.val); -} -SIN Vec lrint(const Vec& x) { -#if SKVX_USE_SIMD && defined(__AVX__) - if constexpr (N == 8) { - return bit_pun>(_mm256_cvtps_epi32(bit_pun<__m256>(x))); - } -#endif -#if SKVX_USE_SIMD && defined(__SSE__) - if constexpr (N == 4) { - return bit_pun>(_mm_cvtps_epi32(bit_pun<__m128>(x))); - } -#endif - return join(lrint(x.lo), - lrint(x.hi)); -} - -SIN Vec fract(const Vec& x) { return x - floor(x); } - -// Assumes inputs are finite and treat/flush denorm half floats as/to zero. -// Key constants to watch for: -// - a float is 32-bit, 1-8-23 sign-exponent-mantissa, with 127 exponent bias; -// - a half is 16-bit, 1-5-10 sign-exponent-mantissa, with 15 exponent bias. -SIN Vec to_half_finite_ftz(const Vec& x) { - Vec sem = bit_pun>(x), - s = sem & 0x8000'0000, - em = sem ^ s, - is_norm = em > 0x387f'd000, // halfway between largest f16 denorm and smallest norm - norm = (em>>13) - ((127-15)<<10); - return cast((s>>16) | (is_norm & norm)); -} -SIN Vec from_half_finite_ftz(const Vec& x) { - Vec wide = cast(x), - s = wide & 0x8000, - em = wide ^ s, - is_norm = em > 0x3ff, - norm = (em<<13) + ((127-15)<<23); - return bit_pun>((s<<16) | (is_norm & norm)); -} - -// Like if_then_else(), these N=1 base cases won't actually be used unless explicitly called. -SI Vec<1,uint16_t> to_half(const Vec<1,float>& x) { return to_half_finite_ftz(x); } -SI Vec<1,float> from_half(const Vec<1,uint16_t>& x) { return from_half_finite_ftz(x); } - -SIN Vec to_half(const Vec& x) { -#if SKVX_USE_SIMD && defined(__F16C__) - if constexpr (N == 8) { - return bit_pun>(_mm256_cvtps_ph(bit_pun<__m256>(x), - _MM_FROUND_TO_NEAREST_INT)); - } -#endif -#if SKVX_USE_SIMD && defined(__aarch64__) - if constexpr (N == 4) { - return bit_pun>(vcvt_f16_f32(bit_pun(x))); - - } -#endif - if constexpr (N > 4) { - return join(to_half(x.lo), - to_half(x.hi)); - } - return to_half_finite_ftz(x); -} - -SIN Vec from_half(const Vec& x) { -#if SKVX_USE_SIMD && defined(__F16C__) - if constexpr (N == 8) { - return bit_pun>(_mm256_cvtph_ps(bit_pun<__m128i>(x))); - } -#endif -#if SKVX_USE_SIMD && defined(__aarch64__) - if constexpr (N == 4) { - return bit_pun>(vcvt_f32_f16(bit_pun(x))); - } -#endif - if constexpr (N > 4) { - return join(from_half(x.lo), - from_half(x.hi)); - } - return from_half_finite_ftz(x); -} - -// div255(x) = (x + 127) / 255 is a bit-exact rounding divide-by-255, packing down to 8-bit. -SIN Vec div255(const Vec& x) { - return cast( (x+127)/255 ); -} - -// approx_scale(x,y) approximates div255(cast(x)*cast(y)) within a bit, -// and is always perfect when x or y is 0 or 255. -SIN Vec approx_scale(const Vec& x, const Vec& y) { - // All of (x*y+x)/256, (x*y+y)/256, and (x*y+255)/256 meet the criteria above. - // We happen to have historically picked (x*y+x)/256. - auto X = cast(x), - Y = cast(y); - return cast( (X*Y+X)/256 ); -} - -// saturated_add(x,y) sums values and clamps to the maximum value instead of overflowing. -SINT std::enable_if_t, Vec> saturated_add(const Vec& x, - const Vec& y) { -#if SKVX_USE_SIMD && (defined(__SSE__) || defined(__ARM_NEON)) - // Both SSE and ARM have 16-lane saturated adds, so use intrinsics for those and recurse down - // or join up to take advantage. - if constexpr (N == 16 && sizeof(T) == 1) { - #if defined(__SSE__) - return bit_pun>(_mm_adds_epu8(bit_pun<__m128i>(x), bit_pun<__m128i>(y))); - #else // __ARM_NEON - return bit_pun>(vqaddq_u8(bit_pun(x), bit_pun(y))); - #endif - } else if constexpr (N < 16 && sizeof(T) == 1) { - return saturated_add(join(x,x), join(y,y)).lo; - } else if constexpr (sizeof(T) == 1) { - return join(saturated_add(x.lo, y.lo), saturated_add(x.hi, y.hi)); - } -#endif - // Otherwise saturate manually - auto sum = x + y; - return if_then_else(sum < x, Vec(std::numeric_limits::max()), sum); -} - -// The ScaledDividerU32 takes a divisor > 1, and creates a function divide(numerator) that -// calculates a numerator / denominator. For this to be rounded properly, numerator should have -// half added in: -// divide(numerator + half) == floor(numerator/denominator + 1/2). -// -// This gives an answer within +/- 1 from the true value. -// -// Derivation of half: -// numerator/denominator + 1/2 = (numerator + half) / d -// numerator + denominator / 2 = numerator + half -// half = denominator / 2. -// -// Because half is divided by 2, that division must also be rounded. -// half == denominator / 2 = (denominator + 1) / 2. -// -// The divisorFactor is just a scaled value: -// divisorFactor = (1 / divisor) * 2 ^ 32. -// The maximum that can be divided and rounded is UINT_MAX - half. -class ScaledDividerU32 { -public: - explicit ScaledDividerU32(uint32_t divisor) - : fDivisorFactor{(uint32_t)(std::round((1.0 / divisor) * (1ull << 32)))} - , fHalf{(divisor + 1) >> 1} { - assert(divisor > 1); - } - - Vec<4, uint32_t> divide(const Vec<4, uint32_t>& numerator) const { -#if SKVX_USE_SIMD && defined(__ARM_NEON) - uint64x2_t hi = vmull_n_u32(vget_high_u32(to_vext(numerator)), fDivisorFactor); - uint64x2_t lo = vmull_n_u32(vget_low_u32(to_vext(numerator)), fDivisorFactor); - - return to_vec<4, uint32_t>(vcombine_u32(vshrn_n_u64(lo,32), vshrn_n_u64(hi,32))); -#else - return cast((cast(numerator) * fDivisorFactor) >> 32); -#endif - } - - uint32_t half() const { return fHalf; } - -private: - const uint32_t fDivisorFactor; - const uint32_t fHalf; -}; - - -SIN Vec mull(const Vec& x, - const Vec& y) { -#if SKVX_USE_SIMD && defined(__ARM_NEON) - // With NEON we can do eight u8*u8 -> u16 in one instruction, vmull_u8 (read, mul-long). - if constexpr (N == 8) { - return to_vec<8,uint16_t>(vmull_u8(to_vext(x), to_vext(y))); - } else if constexpr (N < 8) { - return mull(join(x,x), join(y,y)).lo; - } else { // N > 8 - return join(mull(x.lo, y.lo), mull(x.hi, y.hi)); - } -#else - return cast(x) * cast(y); -#endif -} - -SIN Vec mull(const Vec& x, - const Vec& y) { -#if SKVX_USE_SIMD && defined(__ARM_NEON) - // NEON can do four u16*u16 -> u32 in one instruction, vmull_u16 - if constexpr (N == 4) { - return to_vec<4,uint32_t>(vmull_u16(to_vext(x), to_vext(y))); - } else if constexpr (N < 4) { - return mull(join(x,x), join(y,y)).lo; - } else { // N > 4 - return join(mull(x.lo, y.lo), mull(x.hi, y.hi)); - } -#else - return cast(x) * cast(y); -#endif -} - -SIN Vec mulhi(const Vec& x, - const Vec& y) { -#if SKVX_USE_SIMD && defined(__SSE__) - // Use _mm_mulhi_epu16 for 8xuint16_t and join or split to get there. - if constexpr (N == 8) { - return bit_pun>(_mm_mulhi_epu16(bit_pun<__m128i>(x), bit_pun<__m128i>(y))); - } else if constexpr (N < 8) { - return mulhi(join(x,x), join(y,y)).lo; - } else { // N > 8 - return join(mulhi(x.lo, y.lo), mulhi(x.hi, y.hi)); - } -#else - return skvx::cast(mull(x, y) >> 16); -#endif -} - -SINT T dot(const Vec& a, const Vec& b) { - auto ab = a*b; - if constexpr (N == 2) { - return ab[0] + ab[1]; - } else if constexpr (N == 4) { - return ab[0] + ab[1] + ab[2] + ab[3]; - } else { - T sum = ab[0]; - for (int i = 1; i < N; ++i) { - sum += ab[i]; - } - return sum; - } -} - -SI float cross(const Vec<2, float>& a, const Vec<2, float>& b) { - auto x = a * shuffle<1,0>(b); - return x[0] - x[1]; -} - -// De-interleaving load of 4 vectors. -// -// WARNING: These are really only supported well on NEON. Consider restructuring your data before -// resorting to these methods. -SIT void strided_load4(const T* v, - Vec<1,T>& a, - Vec<1,T>& b, - Vec<1,T>& c, - Vec<1,T>& d) { - a.val = v[0]; - b.val = v[1]; - c.val = v[2]; - d.val = v[3]; -} -SINT void strided_load4(const T* v, - Vec& a, - Vec& b, - Vec& c, - Vec& d) { - strided_load4(v, a.lo, b.lo, c.lo, d.lo); - strided_load4(v + 4*(N/2), a.hi, b.hi, c.hi, d.hi); -} -#if SKVX_USE_SIMD && defined(__ARM_NEON) -#define IMPL_LOAD4_TRANSPOSED(N, T, VLD) \ -SI void strided_load4(const T* v, \ - Vec& a, \ - Vec& b, \ - Vec& c, \ - Vec& d) { \ - auto mat = VLD(v); \ - a = bit_pun>(mat.val[0]); \ - b = bit_pun>(mat.val[1]); \ - c = bit_pun>(mat.val[2]); \ - d = bit_pun>(mat.val[3]); \ -} -IMPL_LOAD4_TRANSPOSED(2, uint32_t, vld4_u32) -IMPL_LOAD4_TRANSPOSED(4, uint16_t, vld4_u16) -IMPL_LOAD4_TRANSPOSED(8, uint8_t, vld4_u8) -IMPL_LOAD4_TRANSPOSED(2, int32_t, vld4_s32) -IMPL_LOAD4_TRANSPOSED(4, int16_t, vld4_s16) -IMPL_LOAD4_TRANSPOSED(8, int8_t, vld4_s8) -IMPL_LOAD4_TRANSPOSED(2, float, vld4_f32) -IMPL_LOAD4_TRANSPOSED(4, uint32_t, vld4q_u32) -IMPL_LOAD4_TRANSPOSED(8, uint16_t, vld4q_u16) -IMPL_LOAD4_TRANSPOSED(16, uint8_t, vld4q_u8) -IMPL_LOAD4_TRANSPOSED(4, int32_t, vld4q_s32) -IMPL_LOAD4_TRANSPOSED(8, int16_t, vld4q_s16) -IMPL_LOAD4_TRANSPOSED(16, int8_t, vld4q_s8) -IMPL_LOAD4_TRANSPOSED(4, float, vld4q_f32) -#undef IMPL_LOAD4_TRANSPOSED - -#elif SKVX_USE_SIMD && defined(__SSE__) - -SI void strided_load4(const float* v, - Vec<4,float>& a, - Vec<4,float>& b, - Vec<4,float>& c, - Vec<4,float>& d) { - __m128 a_ = _mm_loadu_ps(v); - __m128 b_ = _mm_loadu_ps(v+4); - __m128 c_ = _mm_loadu_ps(v+8); - __m128 d_ = _mm_loadu_ps(v+12); - _MM_TRANSPOSE4_PS(a_, b_, c_, d_); - a = bit_pun>(a_); - b = bit_pun>(b_); - c = bit_pun>(c_); - d = bit_pun>(d_); -} -#endif - -// De-interleaving load of 2 vectors. -// -// WARNING: These are really only supported well on NEON. Consider restructuring your data before -// resorting to these methods. -SIT void strided_load2(const T* v, Vec<1,T>& a, Vec<1,T>& b) { - a.val = v[0]; - b.val = v[1]; -} -SINT void strided_load2(const T* v, Vec& a, Vec& b) { - strided_load2(v, a.lo, b.lo); - strided_load2(v + 2*(N/2), a.hi, b.hi); -} -#if SKVX_USE_SIMD && defined(__ARM_NEON) -#define IMPL_LOAD2_TRANSPOSED(N, T, VLD) \ -SI void strided_load2(const T* v, Vec& a, Vec& b) { \ - auto mat = VLD(v); \ - a = bit_pun>(mat.val[0]); \ - b = bit_pun>(mat.val[1]); \ -} -IMPL_LOAD2_TRANSPOSED(2, uint32_t, vld2_u32) -IMPL_LOAD2_TRANSPOSED(4, uint16_t, vld2_u16) -IMPL_LOAD2_TRANSPOSED(8, uint8_t, vld2_u8) -IMPL_LOAD2_TRANSPOSED(2, int32_t, vld2_s32) -IMPL_LOAD2_TRANSPOSED(4, int16_t, vld2_s16) -IMPL_LOAD2_TRANSPOSED(8, int8_t, vld2_s8) -IMPL_LOAD2_TRANSPOSED(2, float, vld2_f32) -IMPL_LOAD2_TRANSPOSED(4, uint32_t, vld2q_u32) -IMPL_LOAD2_TRANSPOSED(8, uint16_t, vld2q_u16) -IMPL_LOAD2_TRANSPOSED(16, uint8_t, vld2q_u8) -IMPL_LOAD2_TRANSPOSED(4, int32_t, vld2q_s32) -IMPL_LOAD2_TRANSPOSED(8, int16_t, vld2q_s16) -IMPL_LOAD2_TRANSPOSED(16, int8_t, vld2q_s8) -IMPL_LOAD2_TRANSPOSED(4, float, vld2q_f32) -#undef IMPL_LOAD2_TRANSPOSED -#endif - -// Define commonly used aliases -using float2 = Vec< 2, float>; -using float4 = Vec< 4, float>; -using float8 = Vec< 8, float>; - -using double2 = Vec< 2, double>; -using double4 = Vec< 4, double>; -using double8 = Vec< 8, double>; - -using byte2 = Vec< 2, uint8_t>; -using byte4 = Vec< 4, uint8_t>; -using byte8 = Vec< 8, uint8_t>; -using byte16 = Vec<16, uint8_t>; - -using int2 = Vec< 2, int32_t>; -using int4 = Vec< 4, int32_t>; -using int8 = Vec< 8, int32_t>; - -using uint2 = Vec< 2, uint32_t>; -using uint4 = Vec< 4, uint32_t>; -using uint8 = Vec< 8, uint32_t>; - -using long2 = Vec< 2, int64_t>; -using long4 = Vec< 4, int64_t>; -using long8 = Vec< 8, int64_t>; - -// Use with from_half and to_half to convert between floatX, and use these for storage. -using half2 = Vec< 2, uint16_t>; -using half4 = Vec< 4, uint16_t>; -using half8 = Vec< 8, uint16_t>; - -} // namespace skvx - -#undef SINTU -#undef SINT -#undef SIN -#undef SIT -#undef SI -#undef SKVX_ALWAYS_INLINE -#undef SKVX_USE_SIMD - -#endif//SKVX_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkWeakRefCnt.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkWeakRefCnt.h deleted file mode 100644 index 2b577342f4cd27..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/SkWeakRefCnt.h +++ /dev/null @@ -1,170 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkWeakRefCnt_DEFINED -#define SkWeakRefCnt_DEFINED - -#include "include/core/SkRefCnt.h" -#include - -/** \class SkWeakRefCnt - - SkWeakRefCnt is the base class for objects that may be shared by multiple - objects. When an existing strong owner wants to share a reference, it calls - ref(). When a strong owner wants to release its reference, it calls - unref(). When the shared object's strong reference count goes to zero as - the result of an unref() call, its (virtual) weak_dispose method is called. - It is an error for the destructor to be called explicitly (or via the - object going out of scope on the stack or calling delete) if - getRefCnt() > 1. - - In addition to strong ownership, an owner may instead obtain a weak - reference by calling weak_ref(). A call to weak_ref() must be balanced by a - call to weak_unref(). To obtain a strong reference from a weak reference, - call try_ref(). If try_ref() returns true, the owner's pointer is now also - a strong reference on which unref() must be called. Note that this does not - affect the original weak reference, weak_unref() must still be called. When - the weak reference count goes to zero, the object is deleted. While the - weak reference count is positive and the strong reference count is zero the - object still exists, but will be in the disposed state. It is up to the - object to define what this means. - - Note that a strong reference implicitly implies a weak reference. As a - result, it is allowable for the owner of a strong ref to call try_ref(). - This will have the same effect as calling ref(), but may be more expensive. - - Example: - - SkWeakRefCnt myRef = strongRef.weak_ref(); - ... // strongRef.unref() may or may not be called - if (myRef.try_ref()) { - ... // use myRef - myRef.unref(); - } else { - // myRef is in the disposed state - } - myRef.weak_unref(); -*/ -class SK_API SkWeakRefCnt : public SkRefCnt { -public: - /** Default construct, initializing the reference counts to 1. - The strong references collectively hold one weak reference. When the - strong reference count goes to zero, the collectively held weak - reference is released. - */ - SkWeakRefCnt() : SkRefCnt(), fWeakCnt(1) {} - - /** Destruct, asserting that the weak reference count is 1. - */ - ~SkWeakRefCnt() override { -#ifdef SK_DEBUG - SkASSERT(getWeakCnt() == 1); - fWeakCnt.store(0, std::memory_order_relaxed); -#endif - } - -#ifdef SK_DEBUG - /** Return the weak reference count. */ - int32_t getWeakCnt() const { - return fWeakCnt.load(std::memory_order_relaxed); - } -#endif - -private: - /** If fRefCnt is 0, returns 0. - * Otherwise increments fRefCnt, acquires, and returns the old value. - */ - int32_t atomic_conditional_acquire_strong_ref() const { - int32_t prev = fRefCnt.load(std::memory_order_relaxed); - do { - if (0 == prev) { - break; - } - } while(!fRefCnt.compare_exchange_weak(prev, prev+1, std::memory_order_acquire, - std::memory_order_relaxed)); - return prev; - } - -public: - /** Creates a strong reference from a weak reference, if possible. The - caller must already be an owner. If try_ref() returns true the owner - is in posession of an additional strong reference. Both the original - reference and new reference must be properly unreferenced. If try_ref() - returns false, no strong reference could be created and the owner's - reference is in the same state as before the call. - */ - bool SK_WARN_UNUSED_RESULT try_ref() const { - if (atomic_conditional_acquire_strong_ref() != 0) { - // Acquire barrier (L/SL), if not provided above. - // Prevents subsequent code from happening before the increment. - return true; - } - return false; - } - - /** Increment the weak reference count. Must be balanced by a call to - weak_unref(). - */ - void weak_ref() const { - SkASSERT(getRefCnt() > 0); - SkASSERT(getWeakCnt() > 0); - // No barrier required. - (void)fWeakCnt.fetch_add(+1, std::memory_order_relaxed); - } - - /** Decrement the weak reference count. If the weak reference count is 1 - before the decrement, then call delete on the object. Note that if this - is the case, then the object needs to have been allocated via new, and - not on the stack. - */ - void weak_unref() const { - SkASSERT(getWeakCnt() > 0); - // A release here acts in place of all releases we "should" have been doing in ref(). - if (1 == fWeakCnt.fetch_add(-1, std::memory_order_acq_rel)) { - // Like try_ref(), the acquire is only needed on success, to make sure - // code in internal_dispose() doesn't happen before the decrement. -#ifdef SK_DEBUG - // so our destructor won't complain - fWeakCnt.store(1, std::memory_order_relaxed); -#endif - this->INHERITED::internal_dispose(); - } - } - - /** Returns true if there are no strong references to the object. When this - is the case all future calls to try_ref() will return false. - */ - bool weak_expired() const { - return fRefCnt.load(std::memory_order_relaxed) == 0; - } - -protected: - /** Called when the strong reference count goes to zero. This allows the - object to free any resources it may be holding. Weak references may - still exist and their level of allowed access to the object is defined - by the object's class. - */ - virtual void weak_dispose() const { - } - -private: - /** Called when the strong reference count goes to zero. Calls weak_dispose - on the object and releases the implicit weak reference held - collectively by the strong references. - */ - void internal_dispose() const override { - weak_dispose(); - weak_unref(); - } - - /* Invariant: fWeakCnt = #weak + (fRefCnt > 0 ? 1 : 0) */ - mutable std::atomic fWeakCnt; - - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/GrSlug.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/GrSlug.h deleted file mode 100644 index 56841c5b993faa..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/GrSlug.h +++ /dev/null @@ -1,16 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrSlug_DEFINED -#define GrSlug_DEFINED - -#include "include/private/chromium/Slug.h" - -// TODO: Update Chrome to use sktext::gpu classes and remove these -using GrSlug = sktext::gpu::Slug; - -#endif // GrSlug_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h deleted file mode 100644 index 55568b9af75a97..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/SkChromeRemoteGlyphCache.h +++ /dev/null @@ -1,152 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkChromeRemoteGlyphCache_DEFINED -#define SkChromeRemoteGlyphCache_DEFINED - -#include -#include - -#include "include/core/SkData.h" -#include "include/core/SkRefCnt.h" -#include "include/utils/SkNoDrawCanvas.h" - -struct SkPackedGlyphID; -class SkAutoDescriptor; -class SkStrikeCache; -class SkStrikeClientImpl; -class SkStrikeServer; -class SkStrikeServerImpl; -class SkTypeface; -namespace sktext::gpu { class Slug; } - -using SkDiscardableHandleId = uint32_t; -// This class is not thread-safe. -class SkStrikeServer { -public: - // An interface used by the server to create handles for pinning SkStrike - // entries on the remote client. - class DiscardableHandleManager { - public: - SK_SPI virtual ~DiscardableHandleManager() = default; - - // Creates a new *locked* handle and returns a unique ID that can be used to identify - // it on the remote client. - SK_SPI virtual SkDiscardableHandleId createHandle() = 0; - - // Returns true if the handle could be successfully locked. The server can - // assume it will remain locked until the next set of serialized entries is - // pulled from the SkStrikeServer. - // If returns false, the cache entry mapped to the handle has been deleted - // on the client. Any subsequent attempts to lock the same handle are not - // allowed. - SK_SPI virtual bool lockHandle(SkDiscardableHandleId) = 0; - - // Returns true if a handle has been deleted on the remote client. It is - // invalid to use a handle id again with this manager once this returns true. - SK_SPI virtual bool isHandleDeleted(SkDiscardableHandleId) = 0; - }; - - SK_SPI explicit SkStrikeServer(DiscardableHandleManager* discardableHandleManager); - SK_SPI ~SkStrikeServer(); - - // Create an analysis SkCanvas used to populate the SkStrikeServer with ops - // which will be serialized and rendered using the SkStrikeClient. - SK_API std::unique_ptr makeAnalysisCanvas(int width, int height, - const SkSurfaceProps& props, - sk_sp colorSpace, - bool DFTSupport, - bool DFTPerspSupport = true); - - // Serializes the typeface to be transmitted using this server. - SK_SPI sk_sp serializeTypeface(SkTypeface*); - - // Serializes the strike data captured using a canvas returned by ::makeAnalysisCanvas. Any - // handles locked using the DiscardableHandleManager will be assumed to be - // unlocked after this call. - SK_SPI void writeStrikeData(std::vector* memory); - - // Testing helpers - void setMaxEntriesInDescriptorMapForTesting(size_t count); - size_t remoteStrikeMapSizeForTesting() const; - -private: - SkStrikeServerImpl* impl(); - - std::unique_ptr fImpl; -}; - -class SkStrikeClient { -public: - // This enum is used in histogram reporting in chromium. Please don't re-order the list of - // entries, and consider it to be append-only. - enum CacheMissType : uint32_t { - // Hard failures where no fallback could be found. - kFontMetrics = 0, - kGlyphMetrics = 1, - kGlyphImage = 2, - kGlyphPath = 3, - - // (DEPRECATED) The original glyph could not be found and a fallback was used. - kGlyphMetricsFallback = 4, - kGlyphPathFallback = 5, - - kGlyphDrawable = 6, - kLast = kGlyphDrawable - }; - - // An interface to delete handles that may be pinned by the remote server. - class DiscardableHandleManager : public SkRefCnt { - public: - ~DiscardableHandleManager() override = default; - - // Returns true if the handle was unlocked and can be safely deleted. Once - // successful, subsequent attempts to delete the same handle are invalid. - virtual bool deleteHandle(SkDiscardableHandleId) = 0; - - virtual void assertHandleValid(SkDiscardableHandleId) {} - - virtual void notifyCacheMiss(CacheMissType type, int fontSize) = 0; - - struct ReadFailureData { - size_t memorySize; - size_t bytesRead; - uint64_t typefaceSize; - uint64_t strikeCount; - uint64_t glyphImagesCount; - uint64_t glyphPathsCount; - }; - virtual void notifyReadFailure(const ReadFailureData& data) {} - }; - - SK_SPI explicit SkStrikeClient(sk_sp, - bool isLogging = true, - SkStrikeCache* strikeCache = nullptr); - SK_SPI ~SkStrikeClient(); - - // Deserializes the typeface previously serialized using the SkStrikeServer. Returns null if the - // data is invalid. - SK_SPI sk_sp deserializeTypeface(const void* data, size_t length); - - // Deserializes the strike data from a SkStrikeServer. All messages generated - // from a server when serializing the ops must be deserialized before the op - // is rasterized. - // Returns false if the data is invalid. - SK_SPI bool readStrikeData(const volatile void* memory, size_t memorySize); - - // Given a descriptor re-write the Rec mapping the typefaceID from the renderer to the - // corresponding typefaceID on the GPU. - SK_SPI bool translateTypefaceID(SkAutoDescriptor* descriptor) const; - - // Given a buffer, unflatten into a slug making sure to do the typefaceID translation from - // renderer to GPU. Returns nullptr if there was a problem. - sk_sp deserializeSlug(const void* data, size_t size) const; - -private: - std::unique_ptr fImpl; -}; -#endif // SkChromeRemoteGlyphCache_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/Slug.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/Slug.h deleted file mode 100644 index 0f4d9773db7765..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/chromium/Slug.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef sktext_gpu_Slug_DEFINED -#define sktext_gpu_Slug_DEFINED - -#include "include/core/SkData.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" - -class SkCanvas; -class SkMatrix; -class SkPaint; -class SkTextBlob; -class SkReadBuffer; -class SkStrikeClient; -class SkWriteBuffer; - -namespace sktext::gpu { - -// You can use Slug to simulate drawTextBlob by defining the following at compile time. -// SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG -// You can use Slug serialization to simulate drawTextBlob by defining the following: -// SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG_SERIALIZE -// For Skia, add this to your args.gn file. -// extra_cflags = ["-D", "SK_EXPERIMENTAL_SIMULATE_DRAWGLYPHRUNLIST_WITH_SLUG"] - -// Slug encapsulates an SkTextBlob at a specific origin, using a specific paint. It can be -// manipulated using matrix and clip changes to the canvas. If the canvas is transformed, then -// the Slug will also transform with smaller glyphs using bi-linear interpolation to render. You -// can think of a Slug as making a rubber stamp out of a SkTextBlob. -class SK_API Slug : public SkRefCnt { -public: - // Return nullptr if the blob would not draw. This is not because of clipping, but because of - // some paint optimization. The Slug is captured as if drawn using drawTextBlob. - static sk_sp ConvertBlob( - SkCanvas* canvas, const SkTextBlob& blob, SkPoint origin, const SkPaint& paint); - - // Serialize the slug. - sk_sp serialize() const; - size_t serialize(void* buffer, size_t size) const; - - // Set the client parameter to the appropriate SkStrikeClient when typeface ID translation - // is needed. - static sk_sp Deserialize( - const void* data, size_t size, const SkStrikeClient* client = nullptr); - static sk_sp MakeFromBuffer(SkReadBuffer& buffer); - - - // Draw the Slug obeying the canvas's mapping and clipping. - void draw(SkCanvas* canvas) const; - - virtual SkRect sourceBounds() const = 0; - virtual SkRect sourceBoundsWithOrigin () const = 0; - - // The paint passed into ConvertBlob; this paint is used instead of the paint resulting from - // the call to aboutToDraw because when we call draw(), the initial paint is needed to call - // aboutToDraw again to get the layer right. - virtual const SkPaint& initialPaint() const = 0; - - virtual void doFlatten(SkWriteBuffer&) const = 0; - - uint32_t uniqueID() const { return fUniqueID; } - -private: - static uint32_t NextUniqueID(); - const uint32_t fUniqueID{NextUniqueID()}; -}; - -} // namespace sktext::gpu - -#endif // sktext_gpu_Slug_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h deleted file mode 100644 index 847e76f23252ec..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrContext_Base.h +++ /dev/null @@ -1,99 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrContext_Base_DEFINED -#define GrContext_Base_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/GrBackendSurface.h" -#include "include/gpu/GrContextOptions.h" -#include "include/gpu/GrTypes.h" - -class GrBaseContextPriv; -class GrCaps; -class GrContextThreadSafeProxy; -class GrDirectContext; -class GrImageContext; -class GrRecordingContext; - -class GrContext_Base : public SkRefCnt { -public: - ~GrContext_Base() override; - - /* - * Safely downcast to a GrDirectContext. - */ - virtual GrDirectContext* asDirectContext() { return nullptr; } - - /* - * The 3D API backing this context - */ - SK_API GrBackendApi backend() const; - - /* - * Retrieve the default GrBackendFormat for a given SkColorType and renderability. - * It is guaranteed that this backend format will be the one used by the GrContext - * SkColorType and SkSurfaceCharacterization-based createBackendTexture methods. - * - * The caller should check that the returned format is valid. - */ - SK_API GrBackendFormat defaultBackendFormat(SkColorType, GrRenderable) const; - - SK_API GrBackendFormat compressedBackendFormat(SkImage::CompressionType) const; - - /** - * Gets the maximum supported sample count for a color type. 1 is returned if only non-MSAA - * rendering is supported for the color type. 0 is returned if rendering to this color type - * is not supported at all. - */ - SK_API int maxSurfaceSampleCountForColorType(SkColorType colorType) const; - - // TODO: When the public version is gone, rename to refThreadSafeProxy and add raw ptr ver. - sk_sp threadSafeProxy(); - - // Provides access to functions that aren't part of the public API. - GrBaseContextPriv priv(); - const GrBaseContextPriv priv() const; // NOLINT(readability-const-return-type) - -protected: - friend class GrBaseContextPriv; // for hidden functions - - GrContext_Base(sk_sp); - - virtual bool init(); - - /** - * An identifier for this context. The id is used by all compatible contexts. For example, - * if SkImages are created on one thread using an image creation context, then fed into a - * DDL Recorder on second thread (which has a recording context) and finally replayed on - * a third thread with a direct context, then all three contexts will report the same id. - * It is an error for an image to be used with contexts that report different ids. - */ - uint32_t contextID() const; - - bool matches(GrContext_Base* candidate) const { - return candidate && candidate->contextID() == this->contextID(); - } - - /* - * The options in effect for this context - */ - const GrContextOptions& options() const; - - const GrCaps* caps() const; - sk_sp refCaps() const; - - virtual GrImageContext* asImageContext() { return nullptr; } - virtual GrRecordingContext* asRecordingContext() { return nullptr; } - - sk_sp fThreadSafeProxy; - -private: - using INHERITED = SkRefCnt; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h deleted file mode 100644 index 049c07bff63be3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrD3DTypesMinimal.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrD3DTypesMinimal_DEFINED -#define GrD3DTypesMinimal_DEFINED - -// Minimal definitions of Direct3D types, without including d3d12.h - -#include "include/core/SkRefCnt.h" - -#include - -#include "include/gpu/GrTypes.h" - -struct ID3D12Resource; -class GrD3DResourceState; -typedef int GrD3DResourceStateEnum; -struct GrD3DSurfaceInfo; -struct GrD3DTextureResourceInfo; -struct GrD3DTextureResourceSpec; -struct GrD3DFenceInfo; - -// This struct is to used to store the the actual information about the Direct3D backend image on -// GrBackendTexture and GrBackendRenderTarget. When a client calls getD3DTextureInfo on a -// GrBackendTexture/RenderTarget, we use the GrD3DBackendSurfaceInfo to create a snapshot -// GrD3DTextureResourceInfo object. Internally, this uses a ref count GrD3DResourceState object to -// track the current D3D12_RESOURCE_STATES which can be shared with an internal GrD3DTextureResource -// so that state updates can be seen by all users of the texture. -struct GrD3DBackendSurfaceInfo { - GrD3DBackendSurfaceInfo(const GrD3DTextureResourceInfo& info, GrD3DResourceState* state); - - void cleanup(); - - GrD3DBackendSurfaceInfo& operator=(const GrD3DBackendSurfaceInfo&) = delete; - - // Assigns the passed in GrD3DBackendSurfaceInfo to this object. if isValid is true we will also - // attempt to unref the old fLayout on this object. - void assign(const GrD3DBackendSurfaceInfo&, bool isValid); - - void setResourceState(GrD3DResourceStateEnum state); - - sk_sp getGrD3DResourceState() const; - - GrD3DTextureResourceInfo snapTextureResourceInfo() const; - - bool isProtected() const; -#if GR_TEST_UTILS - bool operator==(const GrD3DBackendSurfaceInfo& that) const; -#endif - -private: - GrD3DTextureResourceInfo* fTextureResourceInfo; - GrD3DResourceState* fResourceState; -}; - -struct GrD3DTextureResourceSpecHolder { -public: - GrD3DTextureResourceSpecHolder(const GrD3DSurfaceInfo&); - - void cleanup(); - - GrD3DSurfaceInfo getSurfaceInfo(uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected) const; - -private: - GrD3DTextureResourceSpec* fSpec; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h deleted file mode 100644 index 5eacf2ea2d2639..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrDawnTypesPriv.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrDawnTypesPriv_DEFINED -#define GrDawnTypesPriv_DEFINED - -#include "include/gpu/dawn/GrDawnTypes.h" - -struct GrDawnTextureSpec { - GrDawnTextureSpec() {} - GrDawnTextureSpec(const GrDawnSurfaceInfo& info) : fFormat(info.fFormat) {} - - wgpu::TextureFormat fFormat; -}; - -GrDawnSurfaceInfo GrDawnTextureSpecToSurfaceInfo(const GrDawnTextureSpec& dawnSpec, - uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected); - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h deleted file mode 100644 index e951fbd17cfa5e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrGLTypesPriv.h +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#include "include/core/SkRefCnt.h" -#include "include/gpu/gl/GrGLTypes.h" - -#ifndef GrGLTypesPriv_DEFINED -#define GrGLTypesPriv_DEFINED - -static constexpr int kGrGLColorFormatCount = static_cast(GrGLFormat::kLastColorFormat) + 1; - -class GrGLTextureParameters : public SkNVRefCnt { -public: - // We currently consider texture parameters invalid on all textures - // GrContext::resetContext(). We use this type to track whether instances of - // GrGLTextureParameters were updated before or after the most recent resetContext(). At 10 - // resets / frame and 60fps a 64bit timestamp will overflow in about a billion years. - // TODO: Require clients to use GrBackendTexture::glTextureParametersModified() to invalidate - // texture parameters and get rid of timestamp checking. - using ResetTimestamp = uint64_t; - - // This initializes the params to have an expired timestamp. They'll be considered invalid the - // first time the texture is used unless set() is called. - GrGLTextureParameters() = default; - - // This is texture parameter state that is overridden when a non-zero sampler object is bound. - struct SamplerOverriddenState { - SamplerOverriddenState(); - void invalidate(); - - GrGLenum fMinFilter; - GrGLenum fMagFilter; - GrGLenum fWrapS; - GrGLenum fWrapT; - GrGLfloat fMinLOD; - GrGLfloat fMaxLOD; - GrGLfloat fMaxAniso; - // We always want the border color to be transparent black, so no need to store 4 floats. - // Just track if it's been invalidated and no longer the default - bool fBorderColorInvalid; - }; - - // Texture parameter state that is not overridden by a bound sampler object. - struct NonsamplerState { - NonsamplerState(); - void invalidate(); - - GrGLint fBaseMipMapLevel; - GrGLint fMaxMipmapLevel; - bool fSwizzleIsRGBA; - }; - - void invalidate(); - - ResetTimestamp resetTimestamp() const { return fResetTimestamp; } - const SamplerOverriddenState& samplerOverriddenState() const { return fSamplerOverriddenState; } - const NonsamplerState& nonsamplerState() const { return fNonsamplerState; } - - // SamplerOverriddenState is optional because we don't track it when we're using sampler - // objects. - void set(const SamplerOverriddenState* samplerState, - const NonsamplerState& nonsamplerState, - ResetTimestamp currTimestamp); - -private: - static constexpr ResetTimestamp kExpiredTimestamp = 0; - - SamplerOverriddenState fSamplerOverriddenState; - NonsamplerState fNonsamplerState; - ResetTimestamp fResetTimestamp = kExpiredTimestamp; -}; - -class GrGLBackendTextureInfo { -public: - GrGLBackendTextureInfo(const GrGLTextureInfo& info, GrGLTextureParameters* params) - : fInfo(info), fParams(params) {} - GrGLBackendTextureInfo(const GrGLBackendTextureInfo&) = delete; - GrGLBackendTextureInfo& operator=(const GrGLBackendTextureInfo&) = delete; - const GrGLTextureInfo& info() const { return fInfo; } - GrGLTextureParameters* parameters() const { return fParams; } - sk_sp refParameters() const { return sk_ref_sp(fParams); } - - void cleanup(); - void assign(const GrGLBackendTextureInfo&, bool thisIsValid); - -private: - GrGLTextureInfo fInfo; - GrGLTextureParameters* fParams; -}; - -struct GrGLTextureSpec { - GrGLTextureSpec() : fTarget(0), fFormat(0) {} - GrGLTextureSpec(const GrGLSurfaceInfo& info) : fTarget(info.fTarget), fFormat(info.fFormat) {} - - GrGLenum fTarget; - GrGLenum fFormat; -}; - -GrGLSurfaceInfo GrGLTextureSpecToSurfaceInfo(const GrGLTextureSpec& glSpec, - uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrImageContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrImageContext.h deleted file mode 100644 index 5a1a7a32d6241b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrImageContext.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrImageContext_DEFINED -#define GrImageContext_DEFINED - -#include "include/private/SingleOwner.h" -#include "include/private/gpu/ganesh/GrContext_Base.h" - -class GrImageContextPriv; - -// This is now just a view on a ThreadSafeProxy, that SkImages can attempt to -// downcast to a GrDirectContext as a backdoor to some operations. Once we remove the backdoors, -// this goes away and SkImages just hold ThreadSafeProxies. -class GrImageContext : public GrContext_Base { -public: - ~GrImageContext() override; - - // Provides access to functions that aren't part of the public API. - GrImageContextPriv priv(); - const GrImageContextPriv priv() const; // NOLINT(readability-const-return-type) - -protected: - friend class GrImageContextPriv; // for hidden functions - - GrImageContext(sk_sp); - - SK_API virtual void abandonContext(); - SK_API virtual bool abandoned(); - - /** This is only useful for debug purposes */ - skgpu::SingleOwner* singleOwner() const { return &fSingleOwner; } - - GrImageContext* asImageContext() override { return this; } - -private: - // When making promise images, we currently need a placeholder GrImageContext instance to give - // to the SkImage that has no real power, just a wrapper around the ThreadSafeProxy. - // TODO: De-power SkImage to ThreadSafeProxy or at least figure out a way to share one instance. - static sk_sp MakeForPromiseImage(sk_sp); - - // In debug builds we guard against improper thread handling - // This guard is passed to the GrDrawingManager and, from there to all the - // GrSurfaceDrawContexts. It is also passed to the GrResourceProvider and SkGpuDevice. - // TODO: Move this down to GrRecordingContext. - mutable skgpu::SingleOwner fSingleOwner; - - using INHERITED = GrContext_Base; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h deleted file mode 100644 index fc72c7fd93bed2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMockTypesPriv.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrMockTypesPriv_DEFINED -#define GrMockTypesPriv_DEFINED - -#include "include/gpu/mock/GrMockTypes.h" - -struct GrMockTextureSpec { - GrMockTextureSpec() - : fColorType(GrColorType::kUnknown) - , fCompressionType(SkImage::CompressionType::kNone) {} - GrMockTextureSpec(const GrMockSurfaceInfo& info) - : fColorType(info.fColorType) - , fCompressionType(info.fCompressionType) {} - - GrColorType fColorType = GrColorType::kUnknown; - SkImage::CompressionType fCompressionType = SkImage::CompressionType::kNone; -}; - -GrMockSurfaceInfo GrMockTextureSpecToSurfaceInfo(const GrMockTextureSpec& mockSpec, - uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected); - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h deleted file mode 100644 index 550d01760f946a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrMtlTypesPriv.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrMtlTypesPriv_DEFINED -#define GrMtlTypesPriv_DEFINED - -#include "include/gpu/GrTypes.h" -#include "include/gpu/mtl/GrMtlTypes.h" - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __APPLE__ - -#include - -#if defined(SK_BUILD_FOR_MAC) -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 -#define GR_METAL_SDK_VERSION 230 -#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101500 -#define GR_METAL_SDK_VERSION 220 -#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 101400 -#define GR_METAL_SDK_VERSION 210 -#else -#error Must use at least 10.14 SDK to build Metal backend for MacOS -#endif -#else -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 || __TV_OS_VERSION_MAX_ALLOWED >= 140000 -#define GR_METAL_SDK_VERSION 230 -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 || __TV_OS_VERSION_MAX_ALLOWED >= 130000 -#define GR_METAL_SDK_VERSION 220 -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 120000 || __TV_OS_VERSION_MAX_ALLOWED >= 120000 -#define GR_METAL_SDK_VERSION 210 -#else -#error Must use at least 12.00 SDK to build Metal backend for iOS -#endif -#endif - -#if __has_feature(objc_arc) && __has_attribute(objc_externally_retained) -#define GR_NORETAIN __attribute__((objc_externally_retained)) -#define GR_NORETAIN_BEGIN \ - _Pragma("clang attribute push (__attribute__((objc_externally_retained)), apply_to=any(function,objc_method))") -#define GR_NORETAIN_END _Pragma("clang attribute pop") -#else -#define GR_NORETAIN -#define GR_NORETAIN_BEGIN -#define GR_NORETAIN_END -#endif - -struct GrMtlTextureSpec { - GrMtlTextureSpec() - : fFormat(0) - , fUsage(0) - , fStorageMode(0) {} - GrMtlTextureSpec(const GrMtlSurfaceInfo& info) - : fFormat(info.fFormat) - , fUsage(info.fUsage) - , fStorageMode(info.fStorageMode) {} - - GrMTLPixelFormat fFormat; - GrMTLTextureUsage fUsage; - GrMTLStorageMode fStorageMode; -}; - -GrMtlSurfaceInfo GrMtlTextureSpecToSurfaceInfo(const GrMtlTextureSpec& mtlSpec, - uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected); - -#endif // __APPLE__ - -#endif // GrMtlTypesPriv_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h deleted file mode 100644 index b663ff2b193eec..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrTypesPriv.h +++ /dev/null @@ -1,1017 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrTypesPriv_DEFINED -#define GrTypesPriv_DEFINED - -#include -#include "include/core/SkImage.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkPath.h" -#include "include/core/SkRefCnt.h" -#include "include/gpu/GrTypes.h" -#include "include/private/SkImageInfoPriv.h" -#include "include/private/SkMacros.h" - -class GrBackendFormat; -class GrCaps; -class GrSurfaceProxy; - -// The old libstdc++ uses the draft name "monotonic_clock" rather than "steady_clock". This might -// not actually be monotonic, depending on how libstdc++ was built. However, this is only currently -// used for idle resource purging so it shouldn't cause a correctness problem. -#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20130000) -using GrStdSteadyClock = std::chrono::monotonic_clock; -#else -using GrStdSteadyClock = std::chrono::steady_clock; -#endif - -/** - * divide, rounding up - */ - -static inline constexpr size_t GrSizeDivRoundUp(size_t x, size_t y) { return (x + (y - 1)) / y; } - -/** - * Geometric primitives used for drawing. - */ -enum class GrPrimitiveType : uint8_t { - kTriangles, - kTriangleStrip, - kPoints, - kLines, // 1 pix wide only - kLineStrip, // 1 pix wide only -}; -static constexpr int kNumGrPrimitiveTypes = (int)GrPrimitiveType::kLineStrip + 1; - -static constexpr bool GrIsPrimTypeLines(GrPrimitiveType type) { - return GrPrimitiveType::kLines == type || GrPrimitiveType::kLineStrip == type; -} - -enum class GrPrimitiveRestart : bool { - kNo = false, - kYes = true -}; - -/** - * Should a created surface be texturable? - */ -enum class GrTexturable : bool { - kNo = false, - kYes = true -}; - -// A DDL recorder has its own proxy provider and proxy cache. This enum indicates if -// a given proxy provider is one of these special ones. -enum class GrDDLProvider : bool { - kNo = false, - kYes = true -}; - -/** Ownership rules for external GPU resources imported into Skia. */ -enum GrWrapOwnership { - /** Skia will assume the client will keep the resource alive and Skia will not free it. */ - kBorrow_GrWrapOwnership, - - /** Skia will assume ownership of the resource and free it. */ - kAdopt_GrWrapOwnership, -}; - -enum class GrWrapCacheable : bool { - /** - * The wrapped resource will be removed from the cache as soon as it becomes purgeable. It may - * still be assigned and found by a unique key, but the presence of the key will not be used to - * keep the resource alive when it has no references. - */ - kNo = false, - /** - * The wrapped resource is allowed to remain in the GrResourceCache when it has no references - * but has a unique key. Such resources should only be given unique keys when it is known that - * the key will eventually be removed from the resource or invalidated via the message bus. - */ - kYes = true -}; - -enum class GrBudgetedType : uint8_t { - /** The resource is budgeted and is subject to purging under budget pressure. */ - kBudgeted, - /** - * The resource is unbudgeted and is purged as soon as it has no refs regardless of whether - * it has a unique or scratch key. - */ - kUnbudgetedUncacheable, - /** - * The resource is unbudgeted and is allowed to remain in the cache with no refs if it - * has a unique key. Scratch keys are ignored. - */ - kUnbudgetedCacheable, -}; - -enum class GrScissorTest : bool { - kDisabled = false, - kEnabled = true -}; - -/* - * Used to say whether texture is backed by memory. - */ -enum class GrMemoryless : bool { - /** - * The texture will be allocated normally and will affect memory budgets. - */ - kNo = false, - /** - * The texture will be not use GPU memory and will not affect memory budgets. - */ - kYes = true -}; - -struct GrMipLevel { - const void* fPixels = nullptr; - size_t fRowBytes = 0; - // This may be used to keep fPixels from being freed while a GrMipLevel exists. - sk_sp fOptionalStorage; - - static_assert(::sk_is_trivially_relocatable::value); - static_assert(::sk_is_trivially_relocatable::value); - - using sk_is_trivially_relocatable = std::true_type; -}; - -enum class GrSemaphoreWrapType { - kWillSignal, - kWillWait, -}; - -/** - * This enum is used to specify the load operation to be used when an OpsTask/GrOpsRenderPass - * begins execution. - */ -enum class GrLoadOp { - kLoad, - kClear, - kDiscard, -}; - -/** - * This enum is used to specify the store operation to be used when an OpsTask/GrOpsRenderPass - * ends execution. - */ -enum class GrStoreOp { - kStore, - kDiscard, -}; - -/** - * Used to control antialiasing in draw calls. - */ -enum class GrAA : bool { - kNo = false, - kYes = true -}; - -enum class GrFillRule : bool { - kNonzero, - kEvenOdd -}; - -inline GrFillRule GrFillRuleForPathFillType(SkPathFillType fillType) { - switch (fillType) { - case SkPathFillType::kWinding: - case SkPathFillType::kInverseWinding: - return GrFillRule::kNonzero; - case SkPathFillType::kEvenOdd: - case SkPathFillType::kInverseEvenOdd: - return GrFillRule::kEvenOdd; - } - SkUNREACHABLE; -} - -inline GrFillRule GrFillRuleForSkPath(const SkPath& path) { - return GrFillRuleForPathFillType(path.getFillType()); -} - -/** This enum indicates the type of antialiasing to be performed. */ -enum class GrAAType : unsigned { - /** No antialiasing */ - kNone, - /** Use fragment shader code to blend with a fractional pixel coverage. */ - kCoverage, - /** Use normal MSAA. */ - kMSAA, - - kLast = kMSAA -}; -static const int kGrAATypeCount = static_cast(GrAAType::kLast) + 1; - -static constexpr bool GrAATypeIsHW(GrAAType type) { - switch (type) { - case GrAAType::kNone: - return false; - case GrAAType::kCoverage: - return false; - case GrAAType::kMSAA: - return true; - } - SkUNREACHABLE; -} - -/** - * Some pixel configs are inherently clamped to [0,1], some are allowed to go outside that range, - * and some are FP but manually clamped in the XP. - */ -enum class GrClampType { - kAuto, // Normalized, fixed-point configs - kManual, // Clamped FP configs - kNone, // Normal (unclamped) FP configs -}; - -/** - * A number of rectangle/quadrilateral drawing APIs can control anti-aliasing on a per edge basis. - * These masks specify which edges are AA'ed. The intent for this is to support tiling with seamless - * boundaries, where the inner edges are non-AA and the outer edges are AA. Regular rectangle draws - * simply use kAll or kNone depending on if they want anti-aliasing or not. - * - * In APIs that support per-edge AA, GrQuadAAFlags is the only AA-control parameter that is - * provided (compared to the typical GrAA parameter). kNone is equivalent to GrAA::kNo, and any - * other set of edge flags would require GrAA::kYes (with rendering output dependent on how that - * maps to GrAAType for a given SurfaceDrawContext). - * - * These values are identical to SkCanvas::QuadAAFlags. - */ -enum class GrQuadAAFlags { - kLeft = 0b0001, - kTop = 0b0010, - kRight = 0b0100, - kBottom = 0b1000, - - kNone = 0b0000, - kAll = 0b1111, -}; - -GR_MAKE_BITFIELD_CLASS_OPS(GrQuadAAFlags) - -static inline GrQuadAAFlags SkToGrQuadAAFlags(unsigned flags) { - return static_cast(flags); -} - -/** - * The type of texture. Backends other than GL currently only use the 2D value but the type must - * still be known at the API-neutral layer as it used to determine whether MIP maps, renderability, - * and sampling parameters are legal for proxies that will be instantiated with wrapped textures. - */ -enum class GrTextureType { - kNone, - k2D, - /* Rectangle uses unnormalized texture coordinates. */ - kRectangle, - kExternal -}; - -enum GrShaderType { - kVertex_GrShaderType, - kFragment_GrShaderType, - - kLastkFragment_GrShaderType = kFragment_GrShaderType -}; -static const int kGrShaderTypeCount = kLastkFragment_GrShaderType + 1; - -enum GrShaderFlags { - kNone_GrShaderFlags = 0, - kVertex_GrShaderFlag = 1 << 0, - kFragment_GrShaderFlag = 1 << 1 -}; -SK_MAKE_BITFIELD_OPS(GrShaderFlags) - -/** Rectangle and external textures only support the clamp wrap mode and do not support - * MIP maps. - */ -static inline bool GrTextureTypeHasRestrictedSampling(GrTextureType type) { - switch (type) { - case GrTextureType::k2D: - return false; - case GrTextureType::kRectangle: - return true; - case GrTextureType::kExternal: - return true; - default: - SK_ABORT("Unexpected texture type"); - } -} - -////////////////////////////////////////////////////////////////////////////// - -/** - * Types used to describe format of vertices in arrays. - */ -enum GrVertexAttribType { - kFloat_GrVertexAttribType = 0, - kFloat2_GrVertexAttribType, - kFloat3_GrVertexAttribType, - kFloat4_GrVertexAttribType, - kHalf_GrVertexAttribType, - kHalf2_GrVertexAttribType, - kHalf4_GrVertexAttribType, - - kInt2_GrVertexAttribType, // vector of 2 32-bit ints - kInt3_GrVertexAttribType, // vector of 3 32-bit ints - kInt4_GrVertexAttribType, // vector of 4 32-bit ints - - - kByte_GrVertexAttribType, // signed byte - kByte2_GrVertexAttribType, // vector of 2 8-bit signed bytes - kByte4_GrVertexAttribType, // vector of 4 8-bit signed bytes - kUByte_GrVertexAttribType, // unsigned byte - kUByte2_GrVertexAttribType, // vector of 2 8-bit unsigned bytes - kUByte4_GrVertexAttribType, // vector of 4 8-bit unsigned bytes - - kUByte_norm_GrVertexAttribType, // unsigned byte, e.g. coverage, 0 -> 0.0f, 255 -> 1.0f. - kUByte4_norm_GrVertexAttribType, // vector of 4 unsigned bytes, e.g. colors, 0 -> 0.0f, - // 255 -> 1.0f. - - kShort2_GrVertexAttribType, // vector of 2 16-bit shorts. - kShort4_GrVertexAttribType, // vector of 4 16-bit shorts. - - kUShort2_GrVertexAttribType, // vector of 2 unsigned shorts. 0 -> 0, 65535 -> 65535. - kUShort2_norm_GrVertexAttribType, // vector of 2 unsigned shorts. 0 -> 0.0f, 65535 -> 1.0f. - - kInt_GrVertexAttribType, - kUInt_GrVertexAttribType, - - kUShort_norm_GrVertexAttribType, - - kUShort4_norm_GrVertexAttribType, // vector of 4 unsigned shorts. 0 -> 0.0f, 65535 -> 1.0f. - - kLast_GrVertexAttribType = kUShort4_norm_GrVertexAttribType -}; -static const int kGrVertexAttribTypeCount = kLast_GrVertexAttribType + 1; - -////////////////////////////////////////////////////////////////////////////// - -/** - * We have coverage effects that clip rendering to the edge of some geometric primitive. - * This enum specifies how that clipping is performed. Not all factories that take a - * GrClipEdgeType will succeed with all values and it is up to the caller to verify success. - */ -enum class GrClipEdgeType { - kFillBW, - kFillAA, - kInverseFillBW, - kInverseFillAA, - - kLast = kInverseFillAA -}; -static const int kGrClipEdgeTypeCnt = (int) GrClipEdgeType::kLast + 1; - -static constexpr bool GrClipEdgeTypeIsFill(const GrClipEdgeType edgeType) { - return (GrClipEdgeType::kFillAA == edgeType || GrClipEdgeType::kFillBW == edgeType); -} - -static constexpr bool GrClipEdgeTypeIsInverseFill(const GrClipEdgeType edgeType) { - return (GrClipEdgeType::kInverseFillAA == edgeType || - GrClipEdgeType::kInverseFillBW == edgeType); -} - -static constexpr bool GrClipEdgeTypeIsAA(const GrClipEdgeType edgeType) { - return (GrClipEdgeType::kFillBW != edgeType && - GrClipEdgeType::kInverseFillBW != edgeType); -} - -static inline GrClipEdgeType GrInvertClipEdgeType(const GrClipEdgeType edgeType) { - switch (edgeType) { - case GrClipEdgeType::kFillBW: - return GrClipEdgeType::kInverseFillBW; - case GrClipEdgeType::kFillAA: - return GrClipEdgeType::kInverseFillAA; - case GrClipEdgeType::kInverseFillBW: - return GrClipEdgeType::kFillBW; - case GrClipEdgeType::kInverseFillAA: - return GrClipEdgeType::kFillAA; - } - SkUNREACHABLE; -} - -/** - * Indicates the type of pending IO operations that can be recorded for gpu resources. - */ -enum GrIOType { - kRead_GrIOType, - kWrite_GrIOType, - kRW_GrIOType -}; - -/** - * Indicates the type of data that a GPU buffer will be used for. - */ -enum class GrGpuBufferType { - kVertex, - kIndex, - kDrawIndirect, - kXferCpuToGpu, - kXferGpuToCpu, - kUniform, -}; -static const constexpr int kGrGpuBufferTypeCount = static_cast(GrGpuBufferType::kUniform) + 1; - -/** - * Provides a performance hint regarding the frequency at which a data store will be accessed. - */ -enum GrAccessPattern { - /** Data store will be respecified repeatedly and used many times. */ - kDynamic_GrAccessPattern, - /** Data store will be specified once and used many times. (Thus disqualified from caching.) */ - kStatic_GrAccessPattern, - /** Data store will be specified once and used at most a few times. (Also can't be cached.) */ - kStream_GrAccessPattern, - - kLast_GrAccessPattern = kStream_GrAccessPattern -}; - -// Flags shared between the GrSurface & GrSurfaceProxy class hierarchies -enum class GrInternalSurfaceFlags { - kNone = 0, - - // Texture-level - - // Means the pixels in the texture are read-only. Cannot also be a GrRenderTarget[Proxy]. - kReadOnly = 1 << 0, - - // RT-level - - // This flag is for use with GL only. It tells us that the internal render target wraps FBO 0. - kGLRTFBOIDIs0 = 1 << 1, - - // This means the render target is multisampled, and internally holds a non-msaa texture for - // resolving into. The render target resolves itself by blitting into this internal texture. - // (asTexture() might or might not return the internal texture, but if it does, we always - // resolve the render target before accessing this texture's data.) - kRequiresManualMSAAResolve = 1 << 2, - - // This means the pixels in the render target are write-only. This is used for Dawn and Metal - // swap chain targets which can be rendered to, but not read or copied. - kFramebufferOnly = 1 << 3, - - // This is a Vulkan only flag. If set the surface can be used as an input attachment in a - // shader. This is used for doing in shader blending where we want to sample from the same - // image we are drawing to. - kVkRTSupportsInputAttachment = 1 << 4, -}; - -GR_MAKE_BITFIELD_CLASS_OPS(GrInternalSurfaceFlags) - -// 'GR_MAKE_BITFIELD_CLASS_OPS' defines the & operator on GrInternalSurfaceFlags to return bool. -// We want to find the bitwise & with these masks, so we declare them as ints. -constexpr static int kGrInternalTextureFlagsMask = static_cast( - GrInternalSurfaceFlags::kReadOnly); - -// We don't include kVkRTSupportsInputAttachment in this mask since we check it manually. We don't -// require that both the surface and proxy have matching values for this flag. Instead we require -// if the proxy has it set then the surface must also have it set. All other flags listed here must -// match on the proxy and surface. -// TODO: Add back kFramebufferOnly flag here once we update SkSurfaceCharacterization to take it -// as a flag. skbug.com/10672 -constexpr static int kGrInternalRenderTargetFlagsMask = static_cast( - GrInternalSurfaceFlags::kGLRTFBOIDIs0 | - GrInternalSurfaceFlags::kRequiresManualMSAAResolve/* | - GrInternalSurfaceFlags::kFramebufferOnly*/); - -constexpr static int kGrInternalTextureRenderTargetFlagsMask = - kGrInternalTextureFlagsMask | kGrInternalRenderTargetFlagsMask; - -#ifdef SK_DEBUG -// Takes a pointer to a GrCaps, and will suppress prints if required -#define GrCapsDebugf(caps, ...) if (!(caps)->suppressPrints()) SkDebugf(__VA_ARGS__) -#else -#define GrCapsDebugf(caps, ...) do {} while (0) -#endif - -/** - * Specifies if the holder owns the backend, OpenGL or Vulkan, object. - */ -enum class GrBackendObjectOwnership : bool { - /** Holder does not destroy the backend object. */ - kBorrowed = false, - /** Holder destroys the backend object. */ - kOwned = true -}; - -/* - * Object for CPU-GPU synchronization - */ -typedef uint64_t GrFence; - -/** - * Used to include or exclude specific GPU path renderers for testing purposes. - */ -enum class GpuPathRenderers { - kNone = 0, // Always use software masks and/or DefaultPathRenderer. - kDashLine = 1 << 0, - kAtlas = 1 << 1, - kTessellation = 1 << 2, - kCoverageCounting = 1 << 3, - kAAHairline = 1 << 4, - kAAConvex = 1 << 5, - kAALinearizing = 1 << 6, - kSmall = 1 << 7, - kTriangulating = 1 << 8, - kDefault = ((1 << 9) - 1) // All path renderers. -}; - -/** - * Used to describe the current state of Mips on a GrTexture - */ -enum class GrMipmapStatus { - kNotAllocated, // Mips have not been allocated - kDirty, // Mips are allocated but the full mip tree does not have valid data - kValid, // All levels fully allocated and have valid data in them -}; - -GR_MAKE_BITFIELD_CLASS_OPS(GpuPathRenderers) - -/** - * Like SkColorType this describes a layout of pixel data in CPU memory. It specifies the channels, - * their type, and width. This exists so that the GPU backend can have private types that have no - * analog in the public facing SkColorType enum and omit types not implemented in the GPU backend. - * It does not refer to a texture format and the mapping to texture formats may be many-to-many. - * It does not specify the sRGB encoding of the stored values. The components are listed in order of - * where they appear in memory. In other words the first component listed is in the low bits and - * the last component in the high bits. - */ -enum class GrColorType { - kUnknown, - kAlpha_8, - kBGR_565, - kABGR_4444, // This name differs from SkColorType. kARGB_4444_SkColorType is misnamed. - kRGBA_8888, - kRGBA_8888_SRGB, - kRGB_888x, - kRG_88, - kBGRA_8888, - kRGBA_1010102, - kBGRA_1010102, - kGray_8, - kGrayAlpha_88, - kAlpha_F16, - kRGBA_F16, - kRGBA_F16_Clamped, - kRGBA_F32, - - kAlpha_16, - kRG_1616, - kRG_F16, - kRGBA_16161616, - - // Unusual types that come up after reading back in cases where we are reassigning the meaning - // of a texture format's channels to use for a particular color format but have to read back the - // data to a full RGBA quadruple. (e.g. using a R8 texture format as A8 color type but the API - // only supports reading to RGBA8.) None of these have SkColorType equivalents. - kAlpha_8xxx, - kAlpha_F32xxx, - kGray_8xxx, - kR_8xxx, - - // Types used to initialize backend textures. - kRGB_888, - kR_8, - kR_16, - kR_F16, - kGray_F16, - kBGRA_4444, - kARGB_4444, - - kLast = kARGB_4444 -}; - -static const int kGrColorTypeCnt = static_cast(GrColorType::kLast) + 1; - -static constexpr SkColorType GrColorTypeToSkColorType(GrColorType ct) { - switch (ct) { - case GrColorType::kUnknown: return kUnknown_SkColorType; - case GrColorType::kAlpha_8: return kAlpha_8_SkColorType; - case GrColorType::kBGR_565: return kRGB_565_SkColorType; - case GrColorType::kABGR_4444: return kARGB_4444_SkColorType; - case GrColorType::kRGBA_8888: return kRGBA_8888_SkColorType; - case GrColorType::kRGBA_8888_SRGB: return kSRGBA_8888_SkColorType; - case GrColorType::kRGB_888x: return kRGB_888x_SkColorType; - case GrColorType::kRG_88: return kR8G8_unorm_SkColorType; - case GrColorType::kBGRA_8888: return kBGRA_8888_SkColorType; - case GrColorType::kRGBA_1010102: return kRGBA_1010102_SkColorType; - case GrColorType::kBGRA_1010102: return kBGRA_1010102_SkColorType; - case GrColorType::kGray_8: return kGray_8_SkColorType; - case GrColorType::kGrayAlpha_88: return kUnknown_SkColorType; - case GrColorType::kAlpha_F16: return kA16_float_SkColorType; - case GrColorType::kRGBA_F16: return kRGBA_F16_SkColorType; - case GrColorType::kRGBA_F16_Clamped: return kRGBA_F16Norm_SkColorType; - case GrColorType::kRGBA_F32: return kRGBA_F32_SkColorType; - case GrColorType::kAlpha_8xxx: return kUnknown_SkColorType; - case GrColorType::kAlpha_F32xxx: return kUnknown_SkColorType; - case GrColorType::kGray_8xxx: return kUnknown_SkColorType; - case GrColorType::kR_8xxx: return kUnknown_SkColorType; - case GrColorType::kAlpha_16: return kA16_unorm_SkColorType; - case GrColorType::kRG_1616: return kR16G16_unorm_SkColorType; - case GrColorType::kRGBA_16161616: return kR16G16B16A16_unorm_SkColorType; - case GrColorType::kRG_F16: return kR16G16_float_SkColorType; - case GrColorType::kRGB_888: return kUnknown_SkColorType; - case GrColorType::kR_8: return kR8_unorm_SkColorType; - case GrColorType::kR_16: return kUnknown_SkColorType; - case GrColorType::kR_F16: return kUnknown_SkColorType; - case GrColorType::kGray_F16: return kUnknown_SkColorType; - case GrColorType::kARGB_4444: return kUnknown_SkColorType; - case GrColorType::kBGRA_4444: return kUnknown_SkColorType; - } - SkUNREACHABLE; -} - -static constexpr GrColorType SkColorTypeToGrColorType(SkColorType ct) { - switch (ct) { - case kUnknown_SkColorType: return GrColorType::kUnknown; - case kAlpha_8_SkColorType: return GrColorType::kAlpha_8; - case kRGB_565_SkColorType: return GrColorType::kBGR_565; - case kARGB_4444_SkColorType: return GrColorType::kABGR_4444; - case kRGBA_8888_SkColorType: return GrColorType::kRGBA_8888; - case kSRGBA_8888_SkColorType: return GrColorType::kRGBA_8888_SRGB; - case kRGB_888x_SkColorType: return GrColorType::kRGB_888x; - case kBGRA_8888_SkColorType: return GrColorType::kBGRA_8888; - case kGray_8_SkColorType: return GrColorType::kGray_8; - case kRGBA_F16Norm_SkColorType: return GrColorType::kRGBA_F16_Clamped; - case kRGBA_F16_SkColorType: return GrColorType::kRGBA_F16; - case kRGBA_1010102_SkColorType: return GrColorType::kRGBA_1010102; - case kRGB_101010x_SkColorType: return GrColorType::kUnknown; - case kBGRA_1010102_SkColorType: return GrColorType::kBGRA_1010102; - case kBGR_101010x_SkColorType: return GrColorType::kUnknown; - case kRGBA_F32_SkColorType: return GrColorType::kRGBA_F32; - case kR8G8_unorm_SkColorType: return GrColorType::kRG_88; - case kA16_unorm_SkColorType: return GrColorType::kAlpha_16; - case kR16G16_unorm_SkColorType: return GrColorType::kRG_1616; - case kA16_float_SkColorType: return GrColorType::kAlpha_F16; - case kR16G16_float_SkColorType: return GrColorType::kRG_F16; - case kR16G16B16A16_unorm_SkColorType: return GrColorType::kRGBA_16161616; - case kR8_unorm_SkColorType: return GrColorType::kR_8; - } - SkUNREACHABLE; -} - -static constexpr uint32_t GrColorTypeChannelFlags(GrColorType ct) { - switch (ct) { - case GrColorType::kUnknown: return 0; - case GrColorType::kAlpha_8: return kAlpha_SkColorChannelFlag; - case GrColorType::kBGR_565: return kRGB_SkColorChannelFlags; - case GrColorType::kABGR_4444: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGBA_8888: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGBA_8888_SRGB: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGB_888x: return kRGB_SkColorChannelFlags; - case GrColorType::kRG_88: return kRG_SkColorChannelFlags; - case GrColorType::kBGRA_8888: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGBA_1010102: return kRGBA_SkColorChannelFlags; - case GrColorType::kBGRA_1010102: return kRGBA_SkColorChannelFlags; - case GrColorType::kGray_8: return kGray_SkColorChannelFlag; - case GrColorType::kGrayAlpha_88: return kGrayAlpha_SkColorChannelFlags; - case GrColorType::kAlpha_F16: return kAlpha_SkColorChannelFlag; - case GrColorType::kRGBA_F16: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGBA_F16_Clamped: return kRGBA_SkColorChannelFlags; - case GrColorType::kRGBA_F32: return kRGBA_SkColorChannelFlags; - case GrColorType::kAlpha_8xxx: return kAlpha_SkColorChannelFlag; - case GrColorType::kAlpha_F32xxx: return kAlpha_SkColorChannelFlag; - case GrColorType::kGray_8xxx: return kGray_SkColorChannelFlag; - case GrColorType::kR_8xxx: return kRed_SkColorChannelFlag; - case GrColorType::kAlpha_16: return kAlpha_SkColorChannelFlag; - case GrColorType::kRG_1616: return kRG_SkColorChannelFlags; - case GrColorType::kRGBA_16161616: return kRGBA_SkColorChannelFlags; - case GrColorType::kRG_F16: return kRG_SkColorChannelFlags; - case GrColorType::kRGB_888: return kRGB_SkColorChannelFlags; - case GrColorType::kR_8: return kRed_SkColorChannelFlag; - case GrColorType::kR_16: return kRed_SkColorChannelFlag; - case GrColorType::kR_F16: return kRed_SkColorChannelFlag; - case GrColorType::kGray_F16: return kGray_SkColorChannelFlag; - case GrColorType::kARGB_4444: return kRGBA_SkColorChannelFlags; - case GrColorType::kBGRA_4444: return kRGBA_SkColorChannelFlags; - } - SkUNREACHABLE; -} - -/** - * Describes the encoding of channel data in a GrColorType. - */ -enum class GrColorTypeEncoding { - kUnorm, - kSRGBUnorm, - // kSnorm, - kFloat, - // kSint - // kUint -}; - -/** - * Describes a GrColorType by how many bits are used for each color component and how they are - * encoded. Currently all the non-zero channels share a single GrColorTypeEncoding. This could be - * expanded to store separate encodings and to indicate which bits belong to which components. - */ -class GrColorFormatDesc { -public: - static constexpr GrColorFormatDesc MakeRGBA(int rgba, GrColorTypeEncoding e) { - return {rgba, rgba, rgba, rgba, 0, e}; - } - - static constexpr GrColorFormatDesc MakeRGBA(int rgb, int a, GrColorTypeEncoding e) { - return {rgb, rgb, rgb, a, 0, e}; - } - - static constexpr GrColorFormatDesc MakeRGB(int rgb, GrColorTypeEncoding e) { - return {rgb, rgb, rgb, 0, 0, e}; - } - - static constexpr GrColorFormatDesc MakeRGB(int r, int g, int b, GrColorTypeEncoding e) { - return {r, g, b, 0, 0, e}; - } - - static constexpr GrColorFormatDesc MakeAlpha(int a, GrColorTypeEncoding e) { - return {0, 0, 0, a, 0, e}; - } - - static constexpr GrColorFormatDesc MakeR(int r, GrColorTypeEncoding e) { - return {r, 0, 0, 0, 0, e}; - } - - static constexpr GrColorFormatDesc MakeRG(int rg, GrColorTypeEncoding e) { - return {rg, rg, 0, 0, 0, e}; - } - - static constexpr GrColorFormatDesc MakeGray(int grayBits, GrColorTypeEncoding e) { - return {0, 0, 0, 0, grayBits, e}; - } - - static constexpr GrColorFormatDesc MakeGrayAlpha(int grayAlpha, GrColorTypeEncoding e) { - return {0, 0, 0, 0, grayAlpha, e}; - } - - static constexpr GrColorFormatDesc MakeInvalid() { return {}; } - - constexpr int r() const { return fRBits; } - constexpr int g() const { return fGBits; } - constexpr int b() const { return fBBits; } - constexpr int a() const { return fABits; } - constexpr int operator[](int c) const { - switch (c) { - case 0: return this->r(); - case 1: return this->g(); - case 2: return this->b(); - case 3: return this->a(); - } - SkUNREACHABLE; - } - - constexpr int gray() const { return fGrayBits; } - - constexpr GrColorTypeEncoding encoding() const { return fEncoding; } - -private: - int fRBits = 0; - int fGBits = 0; - int fBBits = 0; - int fABits = 0; - int fGrayBits = 0; - GrColorTypeEncoding fEncoding = GrColorTypeEncoding::kUnorm; - - constexpr GrColorFormatDesc() = default; - - constexpr GrColorFormatDesc(int r, int g, int b, int a, int gray, GrColorTypeEncoding encoding) - : fRBits(r), fGBits(g), fBBits(b), fABits(a), fGrayBits(gray), fEncoding(encoding) { - SkASSERT(r >= 0 && g >= 0 && b >= 0 && a >= 0 && gray >= 0); - SkASSERT(!gray || (!r && !g && !b)); - SkASSERT(r || g || b || a || gray); - } -}; - -static constexpr GrColorFormatDesc GrGetColorTypeDesc(GrColorType ct) { - switch (ct) { - case GrColorType::kUnknown: - return GrColorFormatDesc::MakeInvalid(); - case GrColorType::kAlpha_8: - return GrColorFormatDesc::MakeAlpha(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kBGR_565: - return GrColorFormatDesc::MakeRGB(5, 6, 5, GrColorTypeEncoding::kUnorm); - case GrColorType::kABGR_4444: - return GrColorFormatDesc::MakeRGBA(4, GrColorTypeEncoding::kUnorm); - case GrColorType::kRGBA_8888: - return GrColorFormatDesc::MakeRGBA(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kRGBA_8888_SRGB: - return GrColorFormatDesc::MakeRGBA(8, GrColorTypeEncoding::kSRGBUnorm); - case GrColorType::kRGB_888x: - return GrColorFormatDesc::MakeRGB(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kRG_88: - return GrColorFormatDesc::MakeRG(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kBGRA_8888: - return GrColorFormatDesc::MakeRGBA(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kRGBA_1010102: - return GrColorFormatDesc::MakeRGBA(10, 2, GrColorTypeEncoding::kUnorm); - case GrColorType::kBGRA_1010102: - return GrColorFormatDesc::MakeRGBA(10, 2, GrColorTypeEncoding::kUnorm); - case GrColorType::kGray_8: - return GrColorFormatDesc::MakeGray(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kGrayAlpha_88: - return GrColorFormatDesc::MakeGrayAlpha(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kAlpha_F16: - return GrColorFormatDesc::MakeAlpha(16, GrColorTypeEncoding::kFloat); - case GrColorType::kRGBA_F16: - return GrColorFormatDesc::MakeRGBA(16, GrColorTypeEncoding::kFloat); - case GrColorType::kRGBA_F16_Clamped: - return GrColorFormatDesc::MakeRGBA(16, GrColorTypeEncoding::kFloat); - case GrColorType::kRGBA_F32: - return GrColorFormatDesc::MakeRGBA(32, GrColorTypeEncoding::kFloat); - case GrColorType::kAlpha_8xxx: - return GrColorFormatDesc::MakeAlpha(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kAlpha_F32xxx: - return GrColorFormatDesc::MakeAlpha(32, GrColorTypeEncoding::kFloat); - case GrColorType::kGray_8xxx: - return GrColorFormatDesc::MakeGray(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kR_8xxx: - return GrColorFormatDesc::MakeR(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kAlpha_16: - return GrColorFormatDesc::MakeAlpha(16, GrColorTypeEncoding::kUnorm); - case GrColorType::kRG_1616: - return GrColorFormatDesc::MakeRG(16, GrColorTypeEncoding::kUnorm); - case GrColorType::kRGBA_16161616: - return GrColorFormatDesc::MakeRGBA(16, GrColorTypeEncoding::kUnorm); - case GrColorType::kRG_F16: - return GrColorFormatDesc::MakeRG(16, GrColorTypeEncoding::kFloat); - case GrColorType::kRGB_888: - return GrColorFormatDesc::MakeRGB(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kR_8: - return GrColorFormatDesc::MakeR(8, GrColorTypeEncoding::kUnorm); - case GrColorType::kR_16: - return GrColorFormatDesc::MakeR(16, GrColorTypeEncoding::kUnorm); - case GrColorType::kR_F16: - return GrColorFormatDesc::MakeR(16, GrColorTypeEncoding::kFloat); - case GrColorType::kGray_F16: - return GrColorFormatDesc::MakeGray(16, GrColorTypeEncoding::kFloat); - case GrColorType::kARGB_4444: - return GrColorFormatDesc::MakeRGBA(4, GrColorTypeEncoding::kUnorm); - case GrColorType::kBGRA_4444: - return GrColorFormatDesc::MakeRGBA(4, GrColorTypeEncoding::kUnorm); - } - SkUNREACHABLE; -} - -static constexpr GrClampType GrColorTypeClampType(GrColorType colorType) { - if (GrGetColorTypeDesc(colorType).encoding() == GrColorTypeEncoding::kUnorm || - GrGetColorTypeDesc(colorType).encoding() == GrColorTypeEncoding::kSRGBUnorm) { - return GrClampType::kAuto; - } - return GrColorType::kRGBA_F16_Clamped == colorType ? GrClampType::kManual : GrClampType::kNone; -} - -// Consider a color type "wider" than n if it has more than n bits for any its representable -// channels. -static constexpr bool GrColorTypeIsWiderThan(GrColorType colorType, int n) { - SkASSERT(n > 0); - auto desc = GrGetColorTypeDesc(colorType); - return (desc.r() && desc.r() > n )|| - (desc.g() && desc.g() > n) || - (desc.b() && desc.b() > n) || - (desc.a() && desc.a() > n) || - (desc.gray() && desc.gray() > n); -} - -static constexpr bool GrColorTypeIsAlphaOnly(GrColorType ct) { - return GrColorTypeChannelFlags(ct) == kAlpha_SkColorChannelFlag; -} - -static constexpr bool GrColorTypeHasAlpha(GrColorType ct) { - return GrColorTypeChannelFlags(ct) & kAlpha_SkColorChannelFlag; -} - -static constexpr size_t GrColorTypeBytesPerPixel(GrColorType ct) { - switch (ct) { - case GrColorType::kUnknown: return 0; - case GrColorType::kAlpha_8: return 1; - case GrColorType::kBGR_565: return 2; - case GrColorType::kABGR_4444: return 2; - case GrColorType::kRGBA_8888: return 4; - case GrColorType::kRGBA_8888_SRGB: return 4; - case GrColorType::kRGB_888x: return 4; - case GrColorType::kRG_88: return 2; - case GrColorType::kBGRA_8888: return 4; - case GrColorType::kRGBA_1010102: return 4; - case GrColorType::kBGRA_1010102: return 4; - case GrColorType::kGray_8: return 1; - case GrColorType::kGrayAlpha_88: return 2; - case GrColorType::kAlpha_F16: return 2; - case GrColorType::kRGBA_F16: return 8; - case GrColorType::kRGBA_F16_Clamped: return 8; - case GrColorType::kRGBA_F32: return 16; - case GrColorType::kAlpha_8xxx: return 4; - case GrColorType::kAlpha_F32xxx: return 16; - case GrColorType::kGray_8xxx: return 4; - case GrColorType::kR_8xxx: return 4; - case GrColorType::kAlpha_16: return 2; - case GrColorType::kRG_1616: return 4; - case GrColorType::kRGBA_16161616: return 8; - case GrColorType::kRG_F16: return 4; - case GrColorType::kRGB_888: return 3; - case GrColorType::kR_8: return 1; - case GrColorType::kR_16: return 2; - case GrColorType::kR_F16: return 2; - case GrColorType::kGray_F16: return 2; - case GrColorType::kARGB_4444: return 2; - case GrColorType::kBGRA_4444: return 2; - } - SkUNREACHABLE; -} - -// In general we try to not mix CompressionType and ColorType, but currently SkImage still requires -// an SkColorType even for CompressedTypes so we need some conversion. -static constexpr SkColorType GrCompressionTypeToSkColorType(SkImage::CompressionType compression) { - switch (compression) { - case SkImage::CompressionType::kNone: return kUnknown_SkColorType; - case SkImage::CompressionType::kETC2_RGB8_UNORM: return kRGB_888x_SkColorType; - case SkImage::CompressionType::kBC1_RGB8_UNORM: return kRGB_888x_SkColorType; - case SkImage::CompressionType::kBC1_RGBA8_UNORM: return kRGBA_8888_SkColorType; - } - - SkUNREACHABLE; -} - -enum class GrDstSampleFlags { - kNone = 0, - kRequiresTextureBarrier = 1 << 0, - kAsInputAttachment = 1 << 1, -}; -GR_MAKE_BITFIELD_CLASS_OPS(GrDstSampleFlags) - -using GrVisitProxyFunc = std::function; - -#if defined(SK_DEBUG) || GR_TEST_UTILS || defined(SK_ENABLE_DUMP_GPU) -static constexpr const char* GrBackendApiToStr(GrBackendApi api) { - switch (api) { - case GrBackendApi::kOpenGL: return "OpenGL"; - case GrBackendApi::kVulkan: return "Vulkan"; - case GrBackendApi::kMetal: return "Metal"; - case GrBackendApi::kDirect3D: return "Direct3D"; - case GrBackendApi::kDawn: return "Dawn"; - case GrBackendApi::kMock: return "Mock"; - } - SkUNREACHABLE; -} - -static constexpr const char* GrColorTypeToStr(GrColorType ct) { - switch (ct) { - case GrColorType::kUnknown: return "kUnknown"; - case GrColorType::kAlpha_8: return "kAlpha_8"; - case GrColorType::kBGR_565: return "kRGB_565"; - case GrColorType::kABGR_4444: return "kABGR_4444"; - case GrColorType::kRGBA_8888: return "kRGBA_8888"; - case GrColorType::kRGBA_8888_SRGB: return "kRGBA_8888_SRGB"; - case GrColorType::kRGB_888x: return "kRGB_888x"; - case GrColorType::kRG_88: return "kRG_88"; - case GrColorType::kBGRA_8888: return "kBGRA_8888"; - case GrColorType::kRGBA_1010102: return "kRGBA_1010102"; - case GrColorType::kBGRA_1010102: return "kBGRA_1010102"; - case GrColorType::kGray_8: return "kGray_8"; - case GrColorType::kGrayAlpha_88: return "kGrayAlpha_88"; - case GrColorType::kAlpha_F16: return "kAlpha_F16"; - case GrColorType::kRGBA_F16: return "kRGBA_F16"; - case GrColorType::kRGBA_F16_Clamped: return "kRGBA_F16_Clamped"; - case GrColorType::kRGBA_F32: return "kRGBA_F32"; - case GrColorType::kAlpha_8xxx: return "kAlpha_8xxx"; - case GrColorType::kAlpha_F32xxx: return "kAlpha_F32xxx"; - case GrColorType::kGray_8xxx: return "kGray_8xxx"; - case GrColorType::kR_8xxx: return "kR_8xxx"; - case GrColorType::kAlpha_16: return "kAlpha_16"; - case GrColorType::kRG_1616: return "kRG_1616"; - case GrColorType::kRGBA_16161616: return "kRGBA_16161616"; - case GrColorType::kRG_F16: return "kRG_F16"; - case GrColorType::kRGB_888: return "kRGB_888"; - case GrColorType::kR_8: return "kR_8"; - case GrColorType::kR_16: return "kR_16"; - case GrColorType::kR_F16: return "kR_F16"; - case GrColorType::kGray_F16: return "kGray_F16"; - case GrColorType::kARGB_4444: return "kARGB_4444"; - case GrColorType::kBGRA_4444: return "kBGRA_4444"; - } - SkUNREACHABLE; -} - -static constexpr const char* GrCompressionTypeToStr(SkImage::CompressionType compression) { - switch (compression) { - case SkImage::CompressionType::kNone: return "kNone"; - case SkImage::CompressionType::kETC2_RGB8_UNORM: return "kETC2_RGB8_UNORM"; - case SkImage::CompressionType::kBC1_RGB8_UNORM: return "kBC1_RGB8_UNORM"; - case SkImage::CompressionType::kBC1_RGBA8_UNORM: return "kBC1_RGBA8_UNORM"; - } - SkUNREACHABLE; -} - -static constexpr const char* GrSurfaceOriginToStr(GrSurfaceOrigin origin) { - switch (origin) { - case kTopLeft_GrSurfaceOrigin: return "kTopLeft"; - case kBottomLeft_GrSurfaceOrigin: return "kBottomLeft"; - } - SkUNREACHABLE; -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h deleted file mode 100644 index a68d467dd8c928..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/ganesh/GrVkTypesPriv.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef GrVkTypesPriv_DEFINED -#define GrVkTypesPriv_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/gpu/vk/GrVkTypes.h" - -namespace skgpu { -class MutableTextureStateRef; -} - - -// This struct is to used to store the the actual information about the vulkan backend image on the -// GrBackendTexture and GrBackendRenderTarget. When a client calls getVkImageInfo on a -// GrBackendTexture/RenderTarget, we use the GrVkBackendSurfaceInfo to create a snapshot -// GrVkImgeInfo object. Internally, this uses a ref count GrVkImageLayout object to track the -// current VkImageLayout which can be shared with an internal GrVkImage so that layout updates can -// be seen by all users of the image. -struct GrVkBackendSurfaceInfo { - GrVkBackendSurfaceInfo(GrVkImageInfo info) : fImageInfo(info) {} - - void cleanup(); - - GrVkBackendSurfaceInfo& operator=(const GrVkBackendSurfaceInfo&) = delete; - - // Assigns the passed in GrVkBackendSurfaceInfo to this object. if isValid is true we will also - // attempt to unref the old fLayout on this object. - void assign(const GrVkBackendSurfaceInfo&, bool isValid); - - GrVkImageInfo snapImageInfo(const skgpu::MutableTextureStateRef*) const; - - bool isProtected() const { return fImageInfo.fProtected == GrProtected::kYes; } -#if GR_TEST_UTILS - bool operator==(const GrVkBackendSurfaceInfo& that) const; -#endif - -private: - GrVkImageInfo fImageInfo; -}; - -struct GrVkImageSpec { - GrVkImageSpec() - : fImageTiling(VK_IMAGE_TILING_OPTIMAL) - , fFormat(VK_FORMAT_UNDEFINED) - , fImageUsageFlags(0) - , fSharingMode(VK_SHARING_MODE_EXCLUSIVE) {} - - GrVkImageSpec(const GrVkSurfaceInfo& info) - : fImageTiling(info.fImageTiling) - , fFormat(info.fFormat) - , fImageUsageFlags(info.fImageUsageFlags) - , fYcbcrConversionInfo(info.fYcbcrConversionInfo) - , fSharingMode(info.fSharingMode) {} - - VkImageTiling fImageTiling; - VkFormat fFormat; - VkImageUsageFlags fImageUsageFlags; - GrVkYcbcrConversionInfo fYcbcrConversionInfo; - VkSharingMode fSharingMode; -}; - -GrVkSurfaceInfo GrVkImageSpecToSurfaceInfo(const GrVkImageSpec& vkSpec, - uint32_t sampleCount, - uint32_t levelCount, - GrProtected isProtected); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h deleted file mode 100644 index 697628a84d939f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/MtlTypesPriv.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_MtlTypesPriv_DEFINED -#define skgpu_graphite_MtlTypesPriv_DEFINED - -#include "include/gpu/graphite/GraphiteTypes.h" -#include "include/gpu/graphite/mtl/MtlTypes.h" - -/////////////////////////////////////////////////////////////////////////////// - -#ifdef __APPLE__ - -#include - -// We're using the MSL version as shorthand for the Metal SDK version here -#if defined(SK_BUILD_FOR_MAC) -#if __MAC_OS_X_VERSION_MAX_ALLOWED >= 110000 -#define GR_METAL_SDK_VERSION 230 -#elif __MAC_OS_X_VERSION_MAX_ALLOWED >= 120000 -#define GR_METAL_SDK_VERSION 240 -#else -#error Must use at least 11.00 SDK to build Metal backend for MacOS -#endif -#else -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 || __TV_OS_VERSION_MAX_ALLOWED >= 140000 -#define GR_METAL_SDK_VERSION 230 -#elif __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 || __TV_OS_VERSION_MAX_ALLOWED >= 150000 -#define GR_METAL_SDK_VERSION 240 -#else -#error Must use at least 14.00 SDK to build Metal backend for iOS -#endif -#endif - -#endif // __APPLE__ - -namespace skgpu::graphite { - -struct MtlTextureSpec { - MtlTextureSpec() - : fFormat(0) - , fUsage(0) - , fStorageMode(0) - , fFramebufferOnly(false) {} - MtlTextureSpec(const MtlTextureInfo& info) - : fFormat(info.fFormat) - , fUsage(info.fUsage) - , fStorageMode(info.fStorageMode) - , fFramebufferOnly(info.fFramebufferOnly) {} - - bool operator==(const MtlTextureSpec& that) const { - return fFormat == that.fFormat && - fUsage == that.fUsage && - fStorageMode == that.fStorageMode && - fFramebufferOnly == that.fFramebufferOnly; - } - - MtlPixelFormat fFormat; - MtlTextureUsage fUsage; - MtlStorageMode fStorageMode; - bool fFramebufferOnly; -}; - -MtlTextureInfo MtlTextureSpecToTextureInfo(const MtlTextureSpec& mtlSpec, - uint32_t sampleCount, - uint32_t levelCount); - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_MtlTypesPriv_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h deleted file mode 100644 index e0703d7ef1c86b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/graphite/VulkanGraphiteTypesPriv.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_graphite_VulkanGraphiteTypesPriv_DEFINED -#define skgpu_graphite_VulkanGraphiteTypesPriv_DEFINED - -#include "include/gpu/graphite/vk/VulkanGraphiteTypes.h" - -namespace skgpu::graphite { - -struct VulkanTextureSpec { - VulkanTextureSpec() - : fFlags(0) - , fFormat(VK_FORMAT_UNDEFINED) - , fImageTiling(VK_IMAGE_TILING_OPTIMAL) - , fImageUsageFlags(0) - , fSharingMode(VK_SHARING_MODE_EXCLUSIVE) - , fCurrentQueueFamily(VK_QUEUE_FAMILY_IGNORED) - , fImageLayout(VK_IMAGE_LAYOUT_UNDEFINED) - , fAspectMask(VK_IMAGE_ASPECT_COLOR_BIT) {} - VulkanTextureSpec(const VulkanTextureInfo& info) - : fFlags(info.fFlags) - , fFormat(info.fFormat) - , fImageTiling(info.fImageTiling) - , fImageUsageFlags(info.fImageUsageFlags) - , fSharingMode(info.fSharingMode) - , fCurrentQueueFamily(info.fCurrentQueueFamily) - , fImageLayout(info.fImageLayout) - , fAspectMask(info.fAspectMask) {} - - bool operator==(const VulkanTextureSpec& that) const { - return fFlags == that.fFlags && - fFormat == that.fFormat && - fImageTiling == that.fImageTiling && - fImageUsageFlags == that.fImageUsageFlags && - fSharingMode == that.fSharingMode && - fCurrentQueueFamily == that.fCurrentQueueFamily && - fImageLayout == that.fImageLayout && - fAspectMask == that.fAspectMask; - } - - VkImageCreateFlags fFlags; - VkFormat fFormat; - VkImageTiling fImageTiling; - VkImageUsageFlags fImageUsageFlags; - VkSharingMode fSharingMode; - uint32_t fCurrentQueueFamily; - VkImageLayout fImageLayout; - VkImageAspectFlags fAspectMask; - // GrVkYcbcrConversionInfo fYcbcrConversionInfo; -}; - -VulkanTextureInfo VulkanTextureSpecToTextureInfo(const VulkanTextureSpec& vkSpec, - uint32_t sampleCount, - uint32_t levelCount); - -} // namespace skgpu::graphite - -#endif // skgpu_graphite_VulkanGraphiteTypesPriv_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/SkiaVulkan.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/SkiaVulkan.h deleted file mode 100644 index c0a9b03bdaa026..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/SkiaVulkan.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkiaVulkan_DEFINED -#define SkiaVulkan_DEFINED - -#include "include/core/SkTypes.h" - -#if SKIA_IMPLEMENTATION || !defined(SK_VULKAN) -#include "include/third_party/vulkan/vulkan/vulkan_core.h" -#else -// For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan -// headers stay up to date for our needs -#include -#endif - -#ifdef SK_BUILD_FOR_ANDROID -// This is needed to get android extensions for external memory -#if SKIA_IMPLEMENTATION || !defined(SK_VULKAN) -#include "include/third_party/vulkan/vulkan/vulkan_android.h" -#else -// For google3 builds we don't set SKIA_IMPLEMENTATION so we need to make sure that the vulkan -// headers stay up to date for our needs -#include -#endif -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h deleted file mode 100644 index e99869ca1a0c6f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/private/gpu/vk/VulkanTypesPriv.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright 2022 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef skgpu_VulkanTypesPriv_DEFINED -#define skgpu_VulkanTypesPriv_DEFINED - -#include "include/gpu/vk/VulkanTypes.h" - -#include - -namespace skgpu { - -class VulkanMutableTextureState { -public: - VulkanMutableTextureState(VkImageLayout layout, uint32_t queueFamilyIndex) - : fLayout(layout) - , fQueueFamilyIndex(queueFamilyIndex) {} - - VulkanMutableTextureState& operator=(const VulkanMutableTextureState& that) { - fLayout = that.getImageLayout(); - fQueueFamilyIndex = that.getQueueFamilyIndex(); - return *this; - } - - void setImageLayout(VkImageLayout layout) { - // Defaulting to use std::memory_order_seq_cst - fLayout.store(layout); - } - - VkImageLayout getImageLayout() const { - // Defaulting to use std::memory_order_seq_cst - return fLayout.load(); - } - - void setQueueFamilyIndex(uint32_t queueFamilyIndex) { - // Defaulting to use std::memory_order_seq_cst - fQueueFamilyIndex.store(queueFamilyIndex); - } - - uint32_t getQueueFamilyIndex() const { - // Defaulting to use std::memory_order_seq_cst - return fQueueFamilyIndex.load(); - } - -private: - std::atomic fLayout; - std::atomic fQueueFamilyIndex; -}; - -} // namespace skgpu - -#endif // skgpu_VulkanGraphiteTypesPriv_DEFINED - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSL.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSL.h deleted file mode 100644 index 6b9ebd4727730a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSL.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL -#define SKSL_DSL - -#include "include/sksl/DSLBlock.h" -#include "include/sksl/DSLCore.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLFunction.h" -#include "include/sksl/DSLType.h" - -namespace SkSL { - -namespace dsl { - -using Block = DSLBlock; -using Case = DSLCase; -using Expression = DSLExpression; -using Field = DSLField; -using Function = DSLFunction; -using GlobalVar = DSLGlobalVar; -using Layout = DSLLayout; -using Modifiers = DSLModifiers; -using Parameter = DSLParameter; -using Statement = DSLStatement; -using Var = DSLVar; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLBlock.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLBlock.h deleted file mode 100644 index 959ea2235bacd4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLBlock.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_BLOCK -#define SKSL_DSL_BLOCK - -#include "include/private/SkSLDefines.h" -#include "include/private/SkTArray.h" -#include "include/sksl/DSLStatement.h" -#include "include/sksl/SkSLPosition.h" - -#include - -namespace SkSL { - -class Block; -class SymbolTable; - -namespace dsl { - -class DSLBlock { -public: - template - DSLBlock(Statements... statements) { - fStatements.reserve_back(sizeof...(statements)); - ((void)fStatements.push_back(DSLStatement(statements.release()).release()), ...); - } - - DSLBlock(SkSL::StatementArray statements, std::shared_ptr symbols = nullptr, - Position pos = {}); - - DSLBlock(SkTArray statements, std::shared_ptr symbols = nullptr, - Position pos = {}); - - DSLBlock(DSLBlock&& other) = default; - DSLBlock& operator=(DSLBlock&& other) = default; - - ~DSLBlock() = default; - - void append(DSLStatement stmt); - - std::unique_ptr release(); - -private: - SkSL::StatementArray fStatements; - std::shared_ptr fSymbols; - Position fPosition; -}; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCase.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCase.h deleted file mode 100644 index 16780e644a2c99..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCase.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_CASE -#define SKSL_DSL_CASE - -#include "include/private/SkSLDefines.h" -#include "include/private/SkTArray.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLStatement.h" -#include "include/sksl/SkSLPosition.h" - -#include - -namespace SkSL { - -namespace dsl { - -class DSLCase { -public: - // An empty expression means 'default:'. - template - DSLCase(DSLExpression value, Statements... statements) - : fValue(std::move(value)) { - fStatements.reserve_back(sizeof...(statements)); - ((void)fStatements.push_back(DSLStatement(std::move(statements)).release()), ...); - } - - DSLCase(DSLExpression value, SkTArray statements, - Position pos = {}); - - DSLCase(DSLExpression value, SkSL::StatementArray statements, - Position pos = {}); - - DSLCase(DSLCase&&); - - ~DSLCase(); - - DSLCase& operator=(DSLCase&&); - - void append(DSLStatement stmt); - -private: - DSLExpression fValue; - SkSL::StatementArray fStatements; - Position fPosition; - - friend class DSLCore; - - template - friend DSLStatement Switch(DSLExpression value, Cases... cases); -}; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCore.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCore.h deleted file mode 100644 index 72441d4dee15a7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLCore.h +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_CORE -#define SKSL_DSL_CORE - -#include "include/private/SkSLDefines.h" -#include "include/private/SkSLProgramKind.h" -#include "include/private/SkTArray.h" -#include "include/sksl/DSLCase.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLStatement.h" -#include "include/sksl/DSLVar.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include -#include -#include - -namespace SkSL { - -class Compiler; -class ErrorReporter; -struct Program; -struct ProgramSettings; - -namespace dsl { - -class DSLField; -class DSLModifiers; - -// When users import the DSL namespace via `using namespace SkSL::dsl`, we want the SwizzleComponent -// Type enum to come into scope as well, so `Swizzle(var, X, Y, ONE)` can work as expected. -// `namespace SkSL::SwizzleComponent` contains only an `enum Type`; this `using namespace` directive -// shouldn't pollute the SkSL::dsl namespace with anything else. -using namespace SkSL::SwizzleComponent; - -/** - * Starts DSL output on the current thread using the specified compiler. This must be called - * prior to any other DSL functions. - */ -void Start(SkSL::Compiler* compiler, SkSL::ProgramKind kind = SkSL::ProgramKind::kFragment); - -void Start(SkSL::Compiler* compiler, SkSL::ProgramKind kind, const SkSL::ProgramSettings& settings); - -/** - * Signals the end of DSL output. This must be called sometime between a call to Start() and the - * termination of the thread. - */ -void End(); - -/** - * Returns all global elements (functions and global variables) as a self-contained Program. The - * optional source string is retained as the program's source. DSL programs do not normally have - * sources, but when a DSL program is produced from parsed program text (as in Parser), it may be - * important to retain it so that any std::string_views derived from it remain valid. - */ -std::unique_ptr ReleaseProgram(std::unique_ptr source = nullptr); - -/** - * Returns the ErrorReporter which will be notified of any errors that occur during DSL calls. The - * default error reporter aborts on any error. - */ -ErrorReporter& GetErrorReporter(); - -/** - * Installs an ErrorReporter which will be notified of any errors that occur during DSL calls. - */ -void SetErrorReporter(ErrorReporter* errorReporter); - -DSLGlobalVar sk_FragColor(); - -DSLGlobalVar sk_FragCoord(); - -DSLExpression sk_Position(); - -/** - * #extension : enable - */ -void AddExtension(std::string_view name, Position pos = {}); - -/** - * break; - */ -DSLStatement Break(Position pos = {}); - -/** - * continue; - */ -DSLStatement Continue(Position pos = {}); - -/** - * Adds a modifiers declaration to the current program. - */ -void Declare(const DSLModifiers& modifiers, Position pos = {}); - -/** - * Creates a local variable declaration statement. - */ -DSLStatement Declare(DSLVar& var, Position pos = {}); - -/** - * Creates a local variable declaration statement containing multiple variables. - */ -DSLStatement Declare(SkTArray& vars, Position pos = {}); - -/** - * Declares a global variable. - */ -void Declare(DSLGlobalVar& var, Position pos = {}); - -/** - * Declares a set of global variables. - */ -void Declare(SkTArray& vars, Position pos = {}); - -/** - * default: statements - */ -template -DSLCase Default(Statements... statements) { - return DSLCase(DSLExpression(), std::move(statements)...); -} - -/** - * discard; - */ -DSLStatement Discard(Position pos = {}); - -/** - * do stmt; while (test); - */ -DSLStatement Do(DSLStatement stmt, DSLExpression test, Position pos = {}); - -/** - * for (initializer; test; next) stmt; - */ -DSLStatement For(DSLStatement initializer, DSLExpression test, DSLExpression next, - DSLStatement stmt, Position pos = {}, ForLoopPositions positions = {}); - -/** - * if (test) ifTrue; [else ifFalse;] - */ -DSLStatement If(DSLExpression test, DSLStatement ifTrue, DSLStatement ifFalse = DSLStatement(), - Position pos = {}); - -DSLGlobalVar InterfaceBlock(const DSLModifiers& modifiers, std::string_view typeName, - SkTArray fields, std::string_view varName = "", - int arraySize = 0, Position pos = {}); - -/** - * return [value]; - */ -DSLStatement Return(DSLExpression value = DSLExpression(), - Position pos = {}); - -/** - * test ? ifTrue : ifFalse - */ -DSLExpression Select(DSLExpression test, DSLExpression ifTrue, DSLExpression ifFalse, - Position = {}); - -DSLStatement StaticIf(DSLExpression test, DSLStatement ifTrue, - DSLStatement ifFalse = DSLStatement(), - Position pos = {}); - -// Internal use only -DSLStatement StaticSwitch(DSLExpression value, SkTArray cases, Position pos = {}); - -/** - * @switch (value) { cases } - */ -template -DSLStatement StaticSwitch(DSLExpression value, Cases... cases) { - SkTArray caseArray; - caseArray.reserve_back(sizeof...(cases)); - (caseArray.push_back(std::move(cases)), ...); - return StaticSwitch(std::move(value), std::move(caseArray), Position{}); -} - -// Internal use only -DSLStatement Switch(DSLExpression value, SkTArray cases, Position pos = {}); - -/** - * switch (value) { cases } - */ -template -DSLStatement Switch(DSLExpression value, Cases... cases) { - SkTArray caseArray; - caseArray.reserve_back(sizeof...(cases)); - (caseArray.push_back(std::move(cases)), ...); - return Switch(std::move(value), std::move(caseArray), Position{}); -} - -/** - * while (test) stmt; - */ -DSLStatement While(DSLExpression test, DSLStatement stmt, - Position pos = {}); - -/** - * expression.xyz1 - */ -DSLExpression Swizzle(DSLExpression base, - SkSL::SwizzleComponent::Type a, - Position pos = {}, - Position maskPos = {}); - -DSLExpression Swizzle(DSLExpression base, - SkSL::SwizzleComponent::Type a, - SkSL::SwizzleComponent::Type b, - Position pos = {}, - Position maskPos = {}); - -DSLExpression Swizzle(DSLExpression base, - SkSL::SwizzleComponent::Type a, - SkSL::SwizzleComponent::Type b, - SkSL::SwizzleComponent::Type c, - Position pos = {}, - Position maskPos = {}); - -DSLExpression Swizzle(DSLExpression base, - SkSL::SwizzleComponent::Type a, - SkSL::SwizzleComponent::Type b, - SkSL::SwizzleComponent::Type c, - SkSL::SwizzleComponent::Type d, - Position pos = {}, - Position maskPos = {}); - -/** - * Returns the absolute value of x. If x is a vector, operates componentwise. - */ -DSLExpression Abs(DSLExpression x, Position pos = {}); - -/** - * Returns true if all of the components of boolean vector x are true. - */ -DSLExpression All(DSLExpression x, Position pos = {}); - -/** - * Returns true if any of the components of boolean vector x are true. - */ -DSLExpression Any(DSLExpression x, Position pos = {}); - -/** - * Returns the arctangent of y over x. Operates componentwise on vectors. - */ -DSLExpression Atan(DSLExpression y_over_x, Position pos = {}); -DSLExpression Atan(DSLExpression y, DSLExpression x, Position pos = {}); - -/** - * Returns x rounded towards positive infinity. If x is a vector, operates componentwise. - */ -DSLExpression Ceil(DSLExpression x, Position pos = {}); - -/** - * Returns x clamped to between min and max. If x is a vector, operates componentwise. - */ -DSLExpression Clamp(DSLExpression x, DSLExpression min, DSLExpression max, - Position pos = {}); - -/** - * Returns the cosine of x. If x is a vector, operates componentwise. - */ -DSLExpression Cos(DSLExpression x, Position pos = {}); - -/** - * Returns the cross product of x and y. - */ -DSLExpression Cross(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns x converted from radians to degrees. If x is a vector, operates componentwise. - */ -DSLExpression Degrees(DSLExpression x, Position pos = {}); - -/** - * Returns the distance between x and y. - */ -DSLExpression Distance(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns the dot product of x and y. - */ -DSLExpression Dot(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are equal to the corresponding - * components of y. - */ -DSLExpression Equal(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns e^x. If x is a vector, operates componentwise. - */ -DSLExpression Exp(DSLExpression x, Position pos = {}); - -/** - * Returns 2^x. If x is a vector, operates componentwise. - */ -DSLExpression Exp2(DSLExpression x, Position pos = {}); - -/** - * If dot(i, nref) >= 0, returns n, otherwise returns -n. - */ -DSLExpression Faceforward(DSLExpression n, DSLExpression i, DSLExpression nref, - Position pos = {}); - -/** - * Returns x rounded towards negative infinity. If x is a vector, operates componentwise. - */ -DSLExpression Floor(DSLExpression x, Position pos = {}); - -/** - * Returns the fractional part of x. If x is a vector, operates componentwise. - */ -DSLExpression Fract(DSLExpression x, Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are greater than the corresponding - * components of y. - */ -DSLExpression GreaterThan(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are greater than or equal to the - * corresponding components of y. - */ -DSLExpression GreaterThanEqual(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns the 1/sqrt(x). If x is a vector, operates componentwise. - */ -DSLExpression Inversesqrt(DSLExpression x, Position pos = {}); - -/** - * Returns the inverse of the matrix x. - */ -DSLExpression Inverse(DSLExpression x, Position pos = {}); - -/** - * Returns the length of the vector x. - */ -DSLExpression Length(DSLExpression x, Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are less than the corresponding - * components of y. - */ -DSLExpression LessThan(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are less than or equal to the - * corresponding components of y. - */ -DSLExpression LessThanEqual(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns the log base e of x. If x is a vector, operates componentwise. - */ -DSLExpression Log(DSLExpression x, Position pos = {}); - -/** - * Returns the log base 2 of x. If x is a vector, operates componentwise. - */ -DSLExpression Log2(DSLExpression x, Position pos = {}); - -/** - * Returns the larger (closer to positive infinity) of x and y. If x is a vector, operates - * componentwise. y may be either a vector of the same dimensions as x, or a scalar. - */ -DSLExpression Max(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns the smaller (closer to negative infinity) of x and y. If x is a vector, operates - * componentwise. y may be either a vector of the same dimensions as x, or a scalar. - */ -DSLExpression Min(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns a linear intepolation between x and y at position a, where a=0 results in x and a=1 - * results in y. If x and y are vectors, operates componentwise. a may be either a vector of the - * same dimensions as x and y, or a scalar. - */ -DSLExpression Mix(DSLExpression x, DSLExpression y, DSLExpression a, - Position pos = {}); - -/** - * Returns x modulo y. If x is a vector, operates componentwise. y may be either a vector of the - * same dimensions as x, or a scalar. - */ -DSLExpression Mod(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns the vector x normalized to a length of 1. - */ -DSLExpression Normalize(DSLExpression x, Position pos = {}); - -/** - * Returns a boolean vector indicating whether components of x are not equal to the corresponding - * components of y. - */ -DSLExpression NotEqual(DSLExpression x, DSLExpression y, - Position pos = {}); - -/** - * Returns x raised to the power y. If x is a vector, operates componentwise. y may be either a - * vector of the same dimensions as x, or a scalar. - */ -DSLExpression Pow(DSLExpression x, DSLExpression y, Position pos = {}); - -/** - * Returns x converted from degrees to radians. If x is a vector, operates componentwise. - */ -DSLExpression Radians(DSLExpression x, Position pos = {}); - -/** - * Returns i reflected from a surface with normal n. - */ -DSLExpression Reflect(DSLExpression i, DSLExpression n, Position pos = {}); - -/** - * Returns i refracted across a surface with normal n and ratio of indices of refraction eta. - */ -DSLExpression Refract(DSLExpression i, DSLExpression n, DSLExpression eta, - Position pos = {}); - -/** - * Returns x, rounded to the nearest integer. If x is a vector, operates componentwise. - */ -DSLExpression Round(DSLExpression x, Position pos = {}); - -/** - * Returns x clamped to the range [0, 1]. If x is a vector, operates componentwise. - */ -DSLExpression Saturate(DSLExpression x, Position pos = {}); - -/** - * Returns -1, 0, or 1 depending on whether x is negative, zero, or positive, respectively. If x is - * a vector, operates componentwise. - */ -DSLExpression Sign(DSLExpression x, Position pos = {}); - -/** - * Returns the sine of x. If x is a vector, operates componentwise. - */ -DSLExpression Sin(DSLExpression x, Position pos = {}); - -/** - * Returns a smooth interpolation between 0 (at x=edge1) and 1 (at x=edge2). If x is a vector, - * operates componentwise. edge1 and edge2 may either be both vectors of the same dimensions as x or - * scalars. - */ -DSLExpression Smoothstep(DSLExpression edge1, DSLExpression edge2, DSLExpression x, - Position pos = {}); - -/** - * Returns the square root of x. If x is a vector, operates componentwise. - */ -DSLExpression Sqrt(DSLExpression x, Position pos = {}); - -/** - * Returns 0 if x < edge or 1 if x >= edge. If x is a vector, operates componentwise. edge may be - * either a vector of the same dimensions as x, or a scalar. - */ -DSLExpression Step(DSLExpression edge, DSLExpression x, Position pos = {}); - -/** - * Returns the tangent of x. If x is a vector, operates componentwise. - */ -DSLExpression Tan(DSLExpression x, Position pos = {}); - -/** - * Returns x converted from premultipled to unpremultiplied alpha. - */ -DSLExpression Unpremul(DSLExpression x, Position pos = {}); - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLExpression.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLExpression.h deleted file mode 100644 index bdb5f2fe246916..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLExpression.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_EXPRESSION -#define SKSL_DSL_EXPRESSION - -#include "include/private/SkTArray.h" -#include "include/sksl/SkSLOperator.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include -#include -#include -#include - -#if defined(__has_cpp_attribute) && __has_cpp_attribute(clang::reinitializes) -#define SK_CLANG_REINITIALIZES [[clang::reinitializes]] -#else -#define SK_CLANG_REINITIALIZES -#endif - -namespace SkSL { - -class Expression; -class ExpressionArray; - -namespace dsl { - -class DSLType; -class DSLVarBase; - -/** - * Represents an expression such as 'cos(x)' or 'a + b'. - */ -class DSLExpression { -public: - DSLExpression(const DSLExpression&) = delete; - - DSLExpression(DSLExpression&&); - - DSLExpression(); - - /** - * Creates an expression representing a literal float. - */ - DSLExpression(float value, Position pos = {}); - - /** - * Creates an expression representing a literal float. - */ - DSLExpression(double value, Position pos = {}) - : DSLExpression((float) value) {} - - /** - * Creates an expression representing a literal int. - */ - DSLExpression(int value, Position pos = {}); - - /** - * Creates an expression representing a literal int. - */ - DSLExpression(int64_t value, Position pos = {}); - - /** - * Creates an expression representing a literal uint. - */ - DSLExpression(unsigned int value, Position pos = {}); - - /** - * Creates an expression representing a literal bool. - */ - DSLExpression(bool value, Position pos = {}); - - /** - * Creates an expression representing a variable reference. - */ - DSLExpression(DSLVarBase& var, Position pos = {}); - - DSLExpression(DSLVarBase&& var, Position pos = {}); - - // If expression is null, returns Poison - explicit DSLExpression(std::unique_ptr expression, Position pos = {}); - - static DSLExpression Poison(Position pos = {}); - - ~DSLExpression(); - - DSLType type() const; - - std::string description() const; - - Position position() const; - - void setPosition(Position pos); - - /** - * Performs assignment, like the '=' operator. - */ - DSLExpression assign(DSLExpression other); - - DSLExpression x(Position pos = {}); - - DSLExpression y(Position pos = {}); - - DSLExpression z(Position pos = {}); - - DSLExpression w(Position pos = {}); - - DSLExpression r(Position pos = {}); - - DSLExpression g(Position pos = {}); - - DSLExpression b(Position pos = {}); - - DSLExpression a(Position pos = {}); - - /** - * Creates an SkSL struct field access expression. - */ - DSLExpression field(std::string_view name, Position pos = {}); - - /** - * Creates an SkSL array index expression. - */ - DSLExpression operator[](DSLExpression index); - - DSLExpression operator()(SkTArray args, Position pos = {}); - - DSLExpression operator()(ExpressionArray args, Position pos = {}); - - /** - * Invokes a prefix operator. - */ - DSLExpression prefix(Operator::Kind op, Position pos); - - /** - * Invokes a postfix operator. - */ - DSLExpression postfix(Operator::Kind op, Position pos); - - /** - * Invokes a binary operator. - */ - DSLExpression binary(Operator::Kind op, DSLExpression right, Position pos); - - /** - * Equivalent to operator[]. - */ - DSLExpression index(DSLExpression index, Position pos); - - /** - * Returns true if this object contains an expression. DSLExpressions which were created with - * the empty constructor or which have already been release()ed do not have a value. - * DSLExpressions created with errors are still considered to have a value (but contain poison). - */ - bool hasValue() const { - return fExpression != nullptr; - } - - /** - * Returns true if this object contains an expression which is not poison. - */ - bool isValid() const; - - SK_CLANG_REINITIALIZES void swap(DSLExpression& other); - - /** - * Invalidates this object and returns the SkSL expression it represents. It is an error to call - * this on an invalid DSLExpression. - */ - std::unique_ptr release(); - -private: - /** - * Calls release if this expression has a value, otherwise returns null. - */ - std::unique_ptr releaseIfPossible(); - - std::unique_ptr fExpression; - - friend DSLExpression SampleChild(int index, DSLExpression coords); - - friend class DSLCore; - friend class DSLVarBase; - friend class DSLWriter; -}; - -DSLExpression operator+(DSLExpression left, DSLExpression right); -DSLExpression operator+(DSLExpression expr); -DSLExpression operator+=(DSLExpression left, DSLExpression right); -DSLExpression operator-(DSLExpression left, DSLExpression right); -DSLExpression operator-(DSLExpression expr); -DSLExpression operator-=(DSLExpression left, DSLExpression right); -DSLExpression operator*(DSLExpression left, DSLExpression right); -DSLExpression operator*=(DSLExpression left, DSLExpression right); -DSLExpression operator/(DSLExpression left, DSLExpression right); -DSLExpression operator/=(DSLExpression left, DSLExpression right); -DSLExpression operator%(DSLExpression left, DSLExpression right); -DSLExpression operator%=(DSLExpression left, DSLExpression right); -DSLExpression operator<<(DSLExpression left, DSLExpression right); -DSLExpression operator<<=(DSLExpression left, DSLExpression right); -DSLExpression operator>>(DSLExpression left, DSLExpression right); -DSLExpression operator>>=(DSLExpression left, DSLExpression right); -DSLExpression operator&&(DSLExpression left, DSLExpression right); -DSLExpression operator||(DSLExpression left, DSLExpression right); -DSLExpression operator&(DSLExpression left, DSLExpression right); -DSLExpression operator&=(DSLExpression left, DSLExpression right); -DSLExpression operator|(DSLExpression left, DSLExpression right); -DSLExpression operator|=(DSLExpression left, DSLExpression right); -DSLExpression operator^(DSLExpression left, DSLExpression right); -DSLExpression operator^=(DSLExpression left, DSLExpression right); -DSLExpression LogicalXor(DSLExpression left, DSLExpression right); -DSLExpression operator,(DSLExpression left, DSLExpression right); -DSLExpression operator==(DSLExpression left, DSLExpression right); -DSLExpression operator!=(DSLExpression left, DSLExpression right); -DSLExpression operator>(DSLExpression left, DSLExpression right); -DSLExpression operator<(DSLExpression left, DSLExpression right); -DSLExpression operator>=(DSLExpression left, DSLExpression right); -DSLExpression operator<=(DSLExpression left, DSLExpression right); -DSLExpression operator!(DSLExpression expr); -DSLExpression operator~(DSLExpression expr); -DSLExpression operator++(DSLExpression expr); -DSLExpression operator++(DSLExpression expr, int); -DSLExpression operator--(DSLExpression expr); -DSLExpression operator--(DSLExpression expr, int); - -} // namespace dsl - -} // namespace SkSL - -template struct sk_is_trivially_relocatable; - -template <> -struct sk_is_trivially_relocatable : std::true_type {}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLFunction.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLFunction.h deleted file mode 100644 index de7b8f1fbcb6dc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLFunction.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_FUNCTION -#define SKSL_DSL_FUNCTION - -#include "include/private/SkSLDefines.h" -#include "include/private/SkTArray.h" -#include "include/sksl/DSLBlock.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLModifiers.h" -#include "include/sksl/DSLStatement.h" -#include "include/sksl/DSLVar.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include - -namespace SkSL { - -class FunctionDeclaration; - -namespace dsl { - -class DSLType; - -class DSLFunction { -public: - template - DSLFunction(const DSLType& returnType, std::string_view name, Parameters&... parameters) - : DSLFunction(DSLModifiers(), returnType, name, parameters...) {} - - template - DSLFunction(const DSLModifiers& modifiers, const DSLType& returnType, std::string_view name, - Parameters&... parameters) { - SkTArray parameterArray; - parameterArray.reserve_back(sizeof...(parameters)); - (parameterArray.push_back(¶meters), ...); - - // We can't have a default parameter and a template parameter pack at the same time, so - // unfortunately we can't capture position from this overload. - this->init(modifiers, returnType, name, std::move(parameterArray), Position()); - } - - DSLFunction(std::string_view name, const DSLModifiers& modifiers, const DSLType& returnType, - SkTArray parameters, Position pos = {}) { - this->init(modifiers, returnType, name, std::move(parameters), pos); - } - - DSLFunction(SkSL::FunctionDeclaration* decl) - : fDecl(decl) {} - - virtual ~DSLFunction() = default; - - template - void define(Stmt... stmts) { - DSLBlock block = DSLBlock(DSLStatement(std::move(stmts))...); - this->define(std::move(block)); - } - - void define(DSLBlock block, Position pos = {}); - - void prototype(); - - /** - * Invokes the function with the given arguments. - */ - template - DSLExpression operator()(Args&&... args) { - ExpressionArray argArray; - argArray.reserve_back(sizeof...(args)); - this->collectArgs(argArray, std::forward(args)...); - return this->call(std::move(argArray)); - } - - /** - * Invokes the function with the given arguments. - */ - DSLExpression call(SkTArray args, Position pos = {}); - - DSLExpression call(ExpressionArray args, Position pos = {}); - -private: - void collectArgs(ExpressionArray& args) {} - - template - void collectArgs(ExpressionArray& args, DSLVar& var, RemainingArgs&&... remaining) { - args.push_back(DSLExpression(var).release()); - collectArgs(args, std::forward(remaining)...); - } - - template - void collectArgs(ExpressionArray& args, DSLExpression expr, RemainingArgs&&... remaining) { - args.push_back(expr.release()); - collectArgs(args, std::forward(remaining)...); - } - - void init(DSLModifiers modifiers, const DSLType& returnType, std::string_view name, - SkTArray params, Position pos); - - SkSL::FunctionDeclaration* fDecl = nullptr; - SkSL::Position fPosition; -}; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLLayout.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLLayout.h deleted file mode 100644 index a1c963a74eacd9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLLayout.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_LAYOUT -#define SKSL_DSL_LAYOUT - -#include "include/private/SkSLLayout.h" -#include "include/sksl/SkSLPosition.h" - -namespace SkSL { - -namespace dsl { - -class DSLLayout { -public: - DSLLayout() {} - - DSLLayout& originUpperLeft(Position pos = {}) { - return this->flag(SkSL::Layout::kOriginUpperLeft_Flag, "origin_upper_left", pos); - } - - DSLLayout& pushConstant(Position pos = {}) { - return this->flag(SkSL::Layout::kPushConstant_Flag, "push_constant", pos); - } - - DSLLayout& blendSupportAllEquations(Position pos = {}) { - return this->flag(SkSL::Layout::kBlendSupportAllEquations_Flag, - "blend_support_all_equations", pos); - } - - DSLLayout& color(Position pos = {}) { - return this->flag(SkSL::Layout::kColor_Flag, "color", pos); - } - - DSLLayout& location(int location, Position pos = {}) { - return this->intValue(&fSkSLLayout.fLocation, location, SkSL::Layout::kLocation_Flag, - "location", pos); - } - - DSLLayout& offset(int offset, Position pos = {}) { - return this->intValue(&fSkSLLayout.fOffset, offset, SkSL::Layout::kOffset_Flag, "offset", - pos); - } - - DSLLayout& binding(int binding, Position pos = {}) { - return this->intValue(&fSkSLLayout.fBinding, binding, SkSL::Layout::kBinding_Flag, - "binding", pos); - } - - DSLLayout& index(int index, Position pos = {}) { - return this->intValue(&fSkSLLayout.fIndex, index, SkSL::Layout::kIndex_Flag, "index", pos); - } - - DSLLayout& set(int set, Position pos = {}) { - return this->intValue(&fSkSLLayout.fSet, set, SkSL::Layout::kSet_Flag, "set", pos); - } - - DSLLayout& builtin(int builtin, Position pos = {}) { - return this->intValue(&fSkSLLayout.fBuiltin, builtin, SkSL::Layout::kBuiltin_Flag, - "builtin", pos); - } - - DSLLayout& inputAttachmentIndex(int inputAttachmentIndex, - Position pos = {}) { - return this->intValue(&fSkSLLayout.fInputAttachmentIndex, inputAttachmentIndex, - SkSL::Layout::kInputAttachmentIndex_Flag, "input_attachment_index", - pos); - } - -private: - explicit DSLLayout(SkSL::Layout skslLayout) - : fSkSLLayout(skslLayout) {} - - DSLLayout& flag(SkSL::Layout::Flag mask, const char* name, Position pos); - - DSLLayout& intValue(int* target, int value, SkSL::Layout::Flag flag, const char* name, - Position pos); - - SkSL::Layout fSkSLLayout; - - friend class DSLModifiers; -}; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLModifiers.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLModifiers.h deleted file mode 100644 index 01fb0623376d8a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLModifiers.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_MODIFIERS -#define SKSL_DSL_MODIFIERS - -#include "include/core/SkSpan.h" -#include "include/private/SkSLModifiers.h" -#include "include/sksl/DSLLayout.h" - -namespace SkSL { - -namespace dsl { - -class DSLField; -class DSLType; - -enum Modifier { - kNo_Modifier = SkSL::Modifiers::kNo_Flag, - kConst_Modifier = SkSL::Modifiers::kConst_Flag, - kIn_Modifier = SkSL::Modifiers::kIn_Flag, - kOut_Modifier = SkSL::Modifiers::kOut_Flag, - kInOut_Modifier = SkSL::Modifiers::kIn_Flag | SkSL::Modifiers::kOut_Flag, - kUniform_Modifier = SkSL::Modifiers::kUniform_Flag, - kFlat_Modifier = SkSL::Modifiers::kFlat_Flag, - kNoPerspective_Modifier = SkSL::Modifiers::kNoPerspective_Flag, -}; - -class DSLModifiers { -public: - DSLModifiers(int flags = 0, Position pos = {}) - : DSLModifiers(DSLLayout(), flags, pos) {} - - DSLModifiers(DSLLayout layout, int flags = 0, Position pos = {}) - : fModifiers(layout.fSkSLLayout, flags) - , fPosition(pos) {} - - int& flags() { - return fModifiers.fFlags; - } - - const int& flags() const { - return fModifiers.fFlags; - } - - DSLLayout layout() const { - return DSLLayout(fModifiers.fLayout); - } - -private: - SkSL::Modifiers fModifiers; - Position fPosition; - - friend DSLType Struct(std::string_view name, SkSpan fields, Position pos); - friend class DSLCore; - friend class DSLFunction; - friend class DSLType; - friend class DSLWriter; -}; - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLStatement.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLStatement.h deleted file mode 100644 index 391e911d3aac99..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLStatement.h +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_STATEMENT -#define SKSL_DSL_STATEMENT - -#include "include/core/SkTypes.h" -#include "include/private/SkSLStatement.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include - -namespace SkSL { - -class Expression; - -namespace dsl { - -class DSLBlock; -class DSLExpression; - -class DSLStatement { -public: - DSLStatement(); - - DSLStatement(DSLExpression expr); - - DSLStatement(DSLBlock block); - - DSLStatement(DSLStatement&&) = default; - - DSLStatement(std::unique_ptr expr); - - DSLStatement(std::unique_ptr stmt, Position pos); - - DSLStatement(std::unique_ptr stmt); - - ~DSLStatement(); - - DSLStatement& operator=(DSLStatement&& other) = default; - - Position position() { - SkASSERT(this->hasValue()); - return fStatement->fPosition; - } - - void setPosition(Position pos) { - SkASSERT(this->hasValue()); - fStatement->fPosition = pos; - } - - bool hasValue() { return fStatement != nullptr; } - - std::unique_ptr release() { - SkASSERT(this->hasValue()); - return std::move(fStatement); - } - -private: - std::unique_ptr releaseIfPossible() { - return std::move(fStatement); - } - - std::unique_ptr fStatement; - - friend class DSLCore; - friend class DSLWriter; - friend DSLStatement operator,(DSLStatement left, DSLStatement right); -}; - -DSLStatement operator,(DSLStatement left, DSLStatement right); - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLSymbols.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLSymbols.h deleted file mode 100644 index dfd45d1b34280c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLSymbols.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_SYMBOLS -#define SKSL_DSL_SYMBOLS - -#include "include/sksl/DSLExpression.h" - -#include -#include - -namespace SkSL { - -class Position; -class SymbolTable; - -namespace dsl { - -class DSLVarBase; - -// This header provides methods for manually managing symbol tables in DSL code. They should not be -// used by normal hand-written DSL code, where we rely on C++ to manage symbols, but are instead -// needed when DSL objects are being constructed programmatically (as in Parser). - -/** - * Pushes a new symbol table onto the symbol table stack. - */ -void PushSymbolTable(); - -/** - * Pops the top symbol table from the stack. As symbol tables are shared pointers, this will only - * destroy the symbol table if it was never attached to anything (e.g. passed into a Block - * constructor). - */ -void PopSymbolTable(); - -/** - * Returns the current symbol table. Outside of SkSL itself, this is an opaque pointer, used only - * for passing it to DSL methods that require it. - */ -std::shared_ptr CurrentSymbolTable(); - -/** - * Returns an expression referring to the named symbol. - */ -DSLExpression Symbol(std::string_view name, Position pos = {}); - -/** - * Adds a variable to the current symbol table. - */ -void AddToSymbolTable(DSLVarBase& var, Position pos = {}); - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLType.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLType.h deleted file mode 100644 index d15e01b3a3eacf..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLType.h +++ /dev/null @@ -1,271 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_TYPE -#define SKSL_DSL_TYPE - -#include "include/core/SkSpan.h" -#include "include/core/SkTypes.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLModifiers.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include -#include - -namespace SkSL { - -class Compiler; -class Type; - -namespace dsl { - -class DSLField; -class DSLVarBase; - -enum TypeConstant : uint8_t { - kBool_Type, - kBool2_Type, - kBool3_Type, - kBool4_Type, - kHalf_Type, - kHalf2_Type, - kHalf3_Type, - kHalf4_Type, - kHalf2x2_Type, - kHalf3x2_Type, - kHalf4x2_Type, - kHalf2x3_Type, - kHalf3x3_Type, - kHalf4x3_Type, - kHalf2x4_Type, - kHalf3x4_Type, - kHalf4x4_Type, - kFloat_Type, - kFloat2_Type, - kFloat3_Type, - kFloat4_Type, - kFragmentProcessor_Type, - kFloat2x2_Type, - kFloat3x2_Type, - kFloat4x2_Type, - kFloat2x3_Type, - kFloat3x3_Type, - kFloat4x3_Type, - kFloat2x4_Type, - kFloat3x4_Type, - kFloat4x4_Type, - kInt_Type, - kInt2_Type, - kInt3_Type, - kInt4_Type, - kShader_Type, - kShort_Type, - kShort2_Type, - kShort3_Type, - kShort4_Type, - kUInt_Type, - kUInt2_Type, - kUInt3_Type, - kUInt4_Type, - kUShort_Type, - kUShort2_Type, - kUShort3_Type, - kUShort4_Type, - kVoid_Type, - kPoison_Type, -}; - -class DSLType { -public: - DSLType(TypeConstant tc, Position pos = {}); - - DSLType(const SkSL::Type* type, Position pos = {}); - - DSLType(std::string_view name, Position pos = {}); - - DSLType(std::string_view name, - DSLModifiers* modifiers, - Position pos = {}); - - /** - * Returns true if the SkSL type is non-null. - */ - bool hasValue() const { return fSkSLType != nullptr; } - - /** - * Returns true if this type is a bool. - */ - bool isBoolean() const; - - /** - * Returns true if this is a numeric scalar type. - */ - bool isNumber() const; - - /** - * Returns true if this is a floating-point scalar type (float or half). - */ - bool isFloat() const; - - /** - * Returns true if this is a signed scalar type (int or short). - */ - bool isSigned() const; - - /** - * Returns true if this is an unsigned scalar type (uint or ushort). - */ - bool isUnsigned() const; - - /** - * Returns true if this is a signed or unsigned integer. - */ - bool isInteger() const; - - /** - * Returns true if this is a scalar type. - */ - bool isScalar() const; - - /** - * Returns true if this is a vector type. - */ - bool isVector() const; - - /** - * Returns true if this is a matrix type. - */ - bool isMatrix() const; - - /** - * Returns true if this is a array type. - */ - bool isArray() const; - - /** - * Returns true if this is a struct type. - */ - bool isStruct() const; - - /** - * Returns true if this is a Skia object type (shader, colorFilter, blender). - */ - bool isEffectChild() const; - - template - static DSLExpression Construct(DSLType type, DSLVarBase& var, Args&&... args) { - DSLExpression argArray[] = {var, args...}; - return Construct(type, SkSpan(argArray)); - } - - template - static DSLExpression Construct(DSLType type, DSLExpression expr, Args&&... args) { - DSLExpression argArray[] = {std::move(expr), std::move(args)...}; - return Construct(type, SkSpan(argArray)); - } - - static DSLExpression Construct(DSLType type, SkSpan argArray); - -private: - const SkSL::Type& skslType() const { - SkASSERT(fSkSLType); - return *fSkSLType; - } - - const SkSL::Type* fSkSLType = nullptr; - - friend DSLType Array(const DSLType& base, int count, Position pos); - friend DSLType Struct(std::string_view name, SkSpan fields, Position pos); - friend DSLType UnsizedArray(const DSLType& base, Position pos); - friend class DSLCore; - friend class DSLFunction; - friend class DSLVarBase; - friend class DSLWriter; - friend class SkSL::Compiler; -}; - -#define TYPE(T) \ - template \ - DSLExpression T(Args&&... args) { \ - return DSLType::Construct(k ## T ## _Type, std::forward(args)...); \ - } - -#define VECTOR_TYPE(T) \ - TYPE(T) \ - TYPE(T ## 2) \ - TYPE(T ## 3) \ - TYPE(T ## 4) - -#define MATRIX_TYPE(T) \ - TYPE(T ## 2x2) \ - TYPE(T ## 3x2) \ - TYPE(T ## 4x2) \ - TYPE(T ## 2x3) \ - TYPE(T ## 3x3) \ - TYPE(T ## 4x3) \ - TYPE(T ## 2x4) \ - TYPE(T ## 3x4) \ - TYPE(T ## 4x4) - -VECTOR_TYPE(Bool) -VECTOR_TYPE(Float) -VECTOR_TYPE(Half) -VECTOR_TYPE(Int) -VECTOR_TYPE(UInt) -VECTOR_TYPE(Short) -VECTOR_TYPE(UShort) - -MATRIX_TYPE(Float) -MATRIX_TYPE(Half) - -#undef TYPE -#undef VECTOR_TYPE -#undef MATRIX_TYPE - -DSLType Array(const DSLType& base, int count, Position pos = {}); - -DSLType UnsizedArray(const DSLType& base, Position pos = {}); - -class DSLField { -public: - DSLField(const DSLType type, std::string_view name, - Position pos = {}) - : DSLField(DSLModifiers(), type, name, pos) {} - - DSLField(const DSLModifiers& modifiers, const DSLType type, std::string_view name, - Position pos = {}) - : fModifiers(modifiers) - , fType(type) - , fName(name) - , fPosition(pos) {} - -private: - DSLModifiers fModifiers; - const DSLType fType; - std::string_view fName; - Position fPosition; - - friend class DSLCore; - friend DSLType Struct(std::string_view name, SkSpan fields, Position pos); -}; - -DSLType Struct(std::string_view name, SkSpan fields, - Position pos = {}); - -template -DSLType Struct(std::string_view name, Field... fields) { - DSLField fieldTypes[] = {std::move(fields)...}; - return Struct(name, SkSpan(fieldTypes), Position()); -} - -} // namespace dsl - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLVar.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLVar.h deleted file mode 100644 index f052a525e355df..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/DSLVar.h +++ /dev/null @@ -1,231 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DSL_VAR -#define SKSL_DSL_VAR - -#include "include/private/SkSLStatement.h" -#include "include/sksl/DSLExpression.h" -#include "include/sksl/DSLModifiers.h" -#include "include/sksl/DSLType.h" -#include "include/sksl/SkSLPosition.h" - -#include -#include -#include -#include - -namespace SkSL { - -class Expression; -class ExpressionArray; -class Variable; -enum class VariableStorage : int8_t; - -namespace dsl { - -class DSLVarBase { -public: - /** - * Constructs a new variable with the specified type and name. - */ - DSLVarBase(VariableStorage storage, DSLType type, std::string_view name, - DSLExpression initialValue, Position pos, Position namePos); - - DSLVarBase(VariableStorage storage, const DSLModifiers& modifiers, DSLType type, - std::string_view name, DSLExpression initialValue, Position pos, Position namePos); - - DSLVarBase(DSLVarBase&&) = default; - - std::string_view name() const { - return fName; - } - - const DSLModifiers& modifiers() const { - return fModifiers; - } - - VariableStorage storage() const { - return fStorage; - } - - DSLExpression x() { - return DSLExpression(*this).x(); - } - - DSLExpression y() { - return DSLExpression(*this).y(); - } - - DSLExpression z() { - return DSLExpression(*this).z(); - } - - DSLExpression w() { - return DSLExpression(*this).w(); - } - - DSLExpression r() { - return DSLExpression(*this).r(); - } - - DSLExpression g() { - return DSLExpression(*this).g(); - } - - DSLExpression b() { - return DSLExpression(*this).b(); - } - - DSLExpression a() { - return DSLExpression(*this).a(); - } - - DSLExpression field(std::string_view name) { - return DSLExpression(*this).field(name); - } - - DSLExpression operator[](DSLExpression&& index); - - DSLExpression operator++() { - return ++DSLExpression(*this); - } - - DSLExpression operator++(int) { - return DSLExpression(*this)++; - } - - DSLExpression operator--() { - return --DSLExpression(*this); - } - - DSLExpression operator--(int) { - return DSLExpression(*this)--; - } - - template DSLExpression assign(T&& param) { - return this->assignExpression(DSLExpression(std::forward(param))); - } - -protected: - /** - * Creates an empty, unpopulated var. Can be replaced with a real var later via `swap`. - */ - DSLVarBase(VariableStorage storage) : fType(kVoid_Type), fStorage(storage) {} - - DSLExpression assignExpression(DSLExpression other); - - void swap(DSLVarBase& other); - - DSLModifiers fModifiers; - // We only need to keep track of the type here so that we can create the SkSL::Variable. For - // predefined variables this field is unnecessary, so we don't bother tracking it and just set - // it to kVoid; in other words, you shouldn't generally be relying on this field to be correct. - // If you need to determine the variable's type, look at DSLWriter::Var(...)->type() instead. - DSLType fType; - std::unique_ptr fDeclaration; - SkSL::Variable* fVar = nullptr; - Position fNamePosition; - std::string_view fName; - DSLExpression fInitialValue; - Position fPosition; - VariableStorage fStorage; - bool fInitialized = false; - - friend class DSLCore; - friend class DSLFunction; - friend class DSLWriter; -}; - -/** - * A local variable. - */ -class DSLVar : public DSLVarBase { -public: - DSLVar(); - - DSLVar(DSLType type, std::string_view name, DSLExpression initialValue = DSLExpression(), - Position pos = {}, Position namePos = {}); - - DSLVar(const DSLModifiers& modifiers, DSLType type, std::string_view name, - DSLExpression initialValue = DSLExpression(), Position pos = {}, Position namePos = {}); - - DSLVar(DSLVar&&) = default; - - void swap(DSLVar& other); - -private: - using INHERITED = DSLVarBase; -}; - -/** - * A global variable. - */ -class DSLGlobalVar : public DSLVarBase { -public: - DSLGlobalVar(); - - DSLGlobalVar(DSLType type, std::string_view name, DSLExpression initialValue = DSLExpression(), - Position pos = {}, Position namePos = {}); - - DSLGlobalVar(const DSLModifiers& modifiers, DSLType type, std::string_view name, - DSLExpression initialValue = DSLExpression(), - Position pos = {}, Position namePos = {}); - - DSLGlobalVar(const char* name); - - DSLGlobalVar(DSLGlobalVar&&) = default; - - void swap(DSLGlobalVar& other); - - /** - * Implements the following method calls: - * half4 shader::eval(float2 coords); - * half4 colorFilter::eval(half4 input); - */ - DSLExpression eval(DSLExpression x, Position pos = {}); - - /** - * Implements the following method call: - * half4 blender::eval(half4 src, half4 dst); - */ - DSLExpression eval(DSLExpression x, DSLExpression y, Position pos = {}); - -private: - DSLExpression eval(ExpressionArray args, Position pos); - - std::unique_ptr methodCall(std::string_view methodName, Position pos); - - using INHERITED = DSLVarBase; -}; - -/** - * A function parameter. - */ -class DSLParameter : public DSLVarBase { -public: - DSLParameter(); - - DSLParameter(DSLType type, std::string_view name, Position pos = {}, Position namePos = {}); - - DSLParameter(const DSLModifiers& modifiers, DSLType type, std::string_view name, - Position pos = {}, Position namePos = {}); - - DSLParameter(DSLParameter&&) = default; - - void swap(DSLParameter& other); - -private: - using INHERITED = DSLVarBase; -}; - -} // namespace dsl - -} // namespace SkSL - - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLDebugTrace.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLDebugTrace.h deleted file mode 100644 index 9c5eafbc94ed57..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLDebugTrace.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_DEBUG_TRACE -#define SKSL_DEBUG_TRACE - -#include "include/core/SkRefCnt.h" - -class SkWStream; - -namespace SkSL { - -class DebugTrace : public SkRefCnt { -public: - /** Serializes a debug trace to JSON which can be parsed by our debugger. */ - virtual void writeTrace(SkWStream* w) const = 0; - - /** Generates a human-readable dump of the debug trace. */ - virtual void dump(SkWStream* o) const = 0; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLErrorReporter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLErrorReporter.h deleted file mode 100644 index 4abf4631b8b170..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLErrorReporter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_ERROR_REPORTER -#define SKSL_ERROR_REPORTER - -#include "include/core/SkTypes.h" - -#include - -namespace SkSL { - -class Position; - -/** - * Class which is notified in the event of an error. - */ -class ErrorReporter { -public: - ErrorReporter() {} - - virtual ~ErrorReporter() {} - - void error(Position position, std::string_view msg); - - std::string_view source() const { return fSource; } - - void setSource(std::string_view source) { fSource = source; } - - int errorCount() const { - return fErrorCount; - } - - void resetErrorCount() { - fErrorCount = 0; - } - -protected: - /** - * Called when an error is reported. - */ - virtual void handleError(std::string_view msg, Position position) = 0; - -private: - Position position(int offset) const; - - std::string_view fSource; - int fErrorCount = 0; -}; - -/** - * Error reporter for tests that need an SkSL context; aborts immediately if an error is reported. - */ -class TestingOnly_AbortErrorReporter : public ErrorReporter { -public: - void handleError(std::string_view msg, Position pos) override; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLOperator.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLOperator.h deleted file mode 100644 index 1e47dce618856a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLOperator.h +++ /dev/null @@ -1,154 +0,0 @@ -/* - * Copyright 2021 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_OPERATOR -#define SKSL_OPERATOR - -#include -#include - -namespace SkSL { - -class Context; -class Type; - -enum class OperatorKind : uint8_t { - PLUS, - MINUS, - STAR, - SLASH, - PERCENT, - SHL, - SHR, - LOGICALNOT, - LOGICALAND, - LOGICALOR, - LOGICALXOR, - BITWISENOT, - BITWISEAND, - BITWISEOR, - BITWISEXOR, - EQ, - EQEQ, - NEQ, - LT, - GT, - LTEQ, - GTEQ, - PLUSEQ, - MINUSEQ, - STAREQ, - SLASHEQ, - PERCENTEQ, - SHLEQ, - SHREQ, - BITWISEANDEQ, - BITWISEOREQ, - BITWISEXOREQ, - PLUSPLUS, - MINUSMINUS, - COMMA -}; - -enum class OperatorPrecedence : uint8_t { - kParentheses = 1, - kPostfix = 2, - kPrefix = 3, - kMultiplicative = 4, - kAdditive = 5, - kShift = 6, - kRelational = 7, - kEquality = 8, - kBitwiseAnd = 9, - kBitwiseXor = 10, - kBitwiseOr = 11, - kLogicalAnd = 12, - kLogicalXor = 13, - kLogicalOr = 14, - kTernary = 15, - kAssignment = 16, - kSequence = 17, - kTopLevel = kSequence -}; - -class Operator { -public: - using Kind = OperatorKind; - - Operator(Kind op) : fKind(op) {} - - Kind kind() const { return fKind; } - - bool isEquality() const { - return fKind == Kind::EQEQ || fKind == Kind::NEQ; - } - - OperatorPrecedence getBinaryPrecedence() const; - - // Returns the operator name surrounded by the expected whitespace for a tidy binary expression. - const char* operatorName() const; - - // Returns the operator name without any surrounding whitespace. - std::string_view tightOperatorName() const; - - // Returns true if op is '=' or any compound assignment operator ('+=', '-=', etc.) - bool isAssignment() const; - - // Given a compound assignment operator, returns the non-assignment version of the operator - // (e.g. '+=' becomes '+') - Operator removeAssignment() const; - - /** - * Defines the set of relational (comparison) operators: - * < <= > >= - */ - bool isRelational() const; - - /** - * Defines the set of operators which are only valid on integral types: - * << <<= >> >>= & &= | |= ^ ^= % %= - */ - bool isOnlyValidForIntegralTypes() const; - - /** - * Defines the set of operators which perform vector/matrix math. - * + += - -= * *= / /= % %= << <<= >> >>= & &= | |= ^ ^= - */ - bool isValidForMatrixOrVector() const; - - /* - * Defines the set of operators allowed by The OpenGL ES Shading Language 1.00, Section 5.1. - * The set of illegal (reserved) operators are the ones that only make sense with integral - * types. This is not a coincidence: It's because ES2 doesn't require 'int' to be anything but - * syntactic sugar for floats with truncation after each operation. - */ - bool isAllowedInStrictES2Mode() const { - return !this->isOnlyValidForIntegralTypes(); - } - - /** - * Determines the operand and result types of a binary expression. Returns true if the - * expression is legal, false otherwise. If false, the values of the out parameters are - * undefined. - */ - bool determineBinaryType(const Context& context, - const Type& left, - const Type& right, - const Type** outLeftType, - const Type** outRightType, - const Type** outResultType) const; - -private: - bool isOperator() const; - bool isMatrixMultiply(const Type& left, const Type& right) const; - - Kind fKind; -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLPosition.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLPosition.h deleted file mode 100644 index 5f8e80a607b8fe..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLPosition.h +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright 2021 Google LLC. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SKSL_POSITION -#define SKSL_POSITION - -#include "include/core/SkTypes.h" - -#include -#include - -namespace SkSL { - -class Position { -public: - Position() - : fStartOffset(-1) - , fLength(0) {} - - static Position Range(int startOffset, int endOffset) { - SkASSERT(startOffset <= endOffset); - SkASSERT(startOffset <= 0xFFFFFF); - int length = endOffset - startOffset; - Position result; - result.fStartOffset = startOffset; - result.fLength = length <= 0xFF ? length : 0xFF; - return result; - } - - bool valid() const { - return fStartOffset != -1; - } - - int line(std::string_view source) const; - - int startOffset() const { - SkASSERT(this->valid()); - return fStartOffset; - } - - int endOffset() const { - SkASSERT(this->valid()); - return fStartOffset + fLength; - } - - // Returns the position from this through, and including the entirety of, end. - Position rangeThrough(Position end) const { - if (fStartOffset == -1 || end.fStartOffset == -1) { - return *this; - } - SkASSERTF(this->startOffset() <= end.startOffset() && this->endOffset() <= end.endOffset(), - "Invalid range: (%d-%d) - (%d-%d)\n", this->startOffset(), this->endOffset(), - end.startOffset(), end.endOffset()); - return Range(this->startOffset(), end.endOffset()); - } - - // Returns a position representing the character immediately after this position - Position after() const { - int endOffset = this->endOffset(); - return Range(endOffset, endOffset + 1); - } - - bool operator==(const Position& other) const { - return fStartOffset == other.fStartOffset && fLength == other.fLength; - } - - bool operator!=(const Position& other) const { - return !(*this == other); - } - - bool operator>(const Position& other) const { - return fStartOffset > other.fStartOffset; - } - - bool operator>=(const Position& other) const { - return fStartOffset >= other.fStartOffset; - } - - bool operator<(const Position& other) const { - return fStartOffset < other.fStartOffset; - } - - bool operator<=(const Position& other) const { - return fStartOffset <= other.fStartOffset; - } - -private: - int32_t fStartOffset : 24; - uint32_t fLength : 8; -}; - -struct ForLoopPositions { - Position initPosition = Position(); - Position conditionPosition = Position(); - Position nextPosition = Position(); -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLVersion.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLVersion.h deleted file mode 100644 index ad059d580ef899..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/sksl/SkSLVersion.h +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2022 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSLVersion_DEFINED -#define SkSLVersion_DEFINED - -namespace SkSL { - -enum class Version { - /** - * Desktop GLSL 1.10, GLSL ES 1.00, WebGL 1.0 - */ - k100, - - /** - * Desktop GLSL 3.30, GLSL ES 3.00, WebGL 2.0 - */ - k300, -}; - -} // namespace SkSL - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/svg/SkSVGCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/svg/SkSVGCanvas.h deleted file mode 100644 index d4c38ea01773a7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/svg/SkSVGCanvas.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGCanvas_DEFINED -#define SkSVGCanvas_DEFINED - -#include "include/core/SkTypes.h" - -#include -#include - -class SkCanvas; -class SkWStream; -struct SkRect; - -class SK_API SkSVGCanvas { -public: - enum { - kConvertTextToPaths_Flag = 0x01, // emit text as s - kNoPrettyXML_Flag = 0x02, // suppress newlines and tabs in output - kRelativePathEncoding_Flag = 0x04, // use relative commands for path encoding - }; - - /** - * Returns a new canvas that will generate SVG commands from its draw calls, and send - * them to the provided stream. Ownership of the stream is not transfered, and it must - * remain valid for the lifetime of the returned canvas. - * - * The canvas may buffer some drawing calls, so the output is not guaranteed to be valid - * or complete until the canvas instance is deleted. - * - * The 'bounds' parameter defines an initial SVG viewport (viewBox attribute on the root - * SVG element). - */ - static std::unique_ptr Make(const SkRect& bounds, SkWStream*, uint32_t flags = 0); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h deleted file mode 100644 index 18b913abc6ad9e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vk_platform.h +++ /dev/null @@ -1,84 +0,0 @@ -// -// File: vk_platform.h -// -/* -** Copyright 2014-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - - -#ifndef VK_PLATFORM_H_ -#define VK_PLATFORM_H_ - -#ifdef __cplusplus -extern "C" -{ -#endif // __cplusplus - -/* -*************************************************************************************************** -* Platform-specific directives and type declarations -*************************************************************************************************** -*/ - -/* Platform-specific calling convention macros. - * - * Platforms should define these so that Vulkan clients call Vulkan commands - * with the same calling conventions that the Vulkan implementation expects. - * - * VKAPI_ATTR - Placed before the return type in function declarations. - * Useful for C++11 and GCC/Clang-style function attribute syntax. - * VKAPI_CALL - Placed after the return type in function declarations. - * Useful for MSVC-style calling convention syntax. - * VKAPI_PTR - Placed between the '(' and '*' in function pointer types. - * - * Function declaration: VKAPI_ATTR void VKAPI_CALL vkCommand(void); - * Function pointer type: typedef void (VKAPI_PTR *PFN_vkCommand)(void); - */ -#if defined(_WIN32) - // On Windows, Vulkan commands use the stdcall convention - #define VKAPI_ATTR - #define VKAPI_CALL __stdcall - #define VKAPI_PTR VKAPI_CALL -#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH < 7 - #error "Vulkan isn't supported for the 'armeabi' NDK ABI" -#elif defined(__ANDROID__) && defined(__ARM_ARCH) && __ARM_ARCH >= 7 && defined(__ARM_32BIT_STATE) - // On Android 32-bit ARM targets, Vulkan functions use the "hardfloat" - // calling convention, i.e. float parameters are passed in registers. This - // is true even if the rest of the application passes floats on the stack, - // as it does by default when compiling for the armeabi-v7a NDK ABI. - #define VKAPI_ATTR __attribute__((pcs("aapcs-vfp"))) - #define VKAPI_CALL - #define VKAPI_PTR VKAPI_ATTR -#else - // On other platforms, use the default calling convention - #define VKAPI_ATTR - #define VKAPI_CALL - #define VKAPI_PTR -#endif - -#if !defined(VK_NO_STDDEF_H) - #include -#endif // !defined(VK_NO_STDDEF_H) - -#if !defined(VK_NO_STDINT_H) - #if defined(_MSC_VER) && (_MSC_VER < 1600) - typedef signed __int8 int8_t; - typedef unsigned __int8 uint8_t; - typedef signed __int16 int16_t; - typedef unsigned __int16 uint16_t; - typedef signed __int32 int32_t; - typedef unsigned __int32 uint32_t; - typedef signed __int64 int64_t; - typedef unsigned __int64 uint64_t; - #else - #include - #endif -#endif // !defined(VK_NO_STDINT_H) - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h deleted file mode 100644 index b187c9c178b6ca..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan.h +++ /dev/null @@ -1,93 +0,0 @@ -#ifndef VULKAN_H_ -#define VULKAN_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -#include "vk_platform.h" -#include "vulkan_core.h" - -#ifdef VK_USE_PLATFORM_ANDROID_KHR -#include "vulkan_android.h" -#endif - -#ifdef VK_USE_PLATFORM_FUCHSIA -#include -#include "vulkan_fuchsia.h" -#endif - -#ifdef VK_USE_PLATFORM_IOS_MVK -#include "vulkan_ios.h" -#endif - - -#ifdef VK_USE_PLATFORM_MACOS_MVK -#include "vulkan_macos.h" -#endif - -#ifdef VK_USE_PLATFORM_METAL_EXT -#include "vulkan_metal.h" -#endif - -#ifdef VK_USE_PLATFORM_VI_NN -#include "vulkan_vi.h" -#endif - - -#ifdef VK_USE_PLATFORM_WAYLAND_KHR -#include -#include "vulkan_wayland.h" -#endif - - -#ifdef VK_USE_PLATFORM_WIN32_KHR -#include -#include "vulkan_win32.h" -#endif - - -#ifdef VK_USE_PLATFORM_XCB_KHR -#include -#include "vulkan_xcb.h" -#endif - - -#ifdef VK_USE_PLATFORM_XLIB_KHR -#include -#include "vulkan_xlib.h" -#endif - - -#ifdef VK_USE_PLATFORM_DIRECTFB_EXT -#include -#include "vulkan_directfb.h" -#endif - - -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT -#include -#include -#include "vulkan_xlib_xrandr.h" -#endif - - -#ifdef VK_USE_PLATFORM_GGP -#include -#include "vulkan_ggp.h" -#endif - - -#ifdef VK_USE_PLATFORM_SCREEN_QNX -#include -#include "vulkan_screen.h" -#endif - - -#ifdef VK_ENABLE_BETA_EXTENSIONS -#include "vulkan_beta.h" -#endif - -#endif // VULKAN_H_ diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h deleted file mode 100644 index 2160e3e7c602ff..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_android.h +++ /dev/null @@ -1,112 +0,0 @@ -#ifndef VULKAN_ANDROID_H_ -#define VULKAN_ANDROID_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_KHR_android_surface 1 -struct ANativeWindow; -#define VK_KHR_ANDROID_SURFACE_SPEC_VERSION 6 -#define VK_KHR_ANDROID_SURFACE_EXTENSION_NAME "VK_KHR_android_surface" -typedef VkFlags VkAndroidSurfaceCreateFlagsKHR; -typedef struct VkAndroidSurfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkAndroidSurfaceCreateFlagsKHR flags; - struct ANativeWindow* window; -} VkAndroidSurfaceCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateAndroidSurfaceKHR)(VkInstance instance, const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateAndroidSurfaceKHR( - VkInstance instance, - const VkAndroidSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); -#endif - - -#define VK_ANDROID_external_memory_android_hardware_buffer 1 -struct AHardwareBuffer; -#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_SPEC_VERSION 3 -#define VK_ANDROID_EXTERNAL_MEMORY_ANDROID_HARDWARE_BUFFER_EXTENSION_NAME "VK_ANDROID_external_memory_android_hardware_buffer" -typedef struct VkAndroidHardwareBufferUsageANDROID { - VkStructureType sType; - void* pNext; - uint64_t androidHardwareBufferUsage; -} VkAndroidHardwareBufferUsageANDROID; - -typedef struct VkAndroidHardwareBufferPropertiesANDROID { - VkStructureType sType; - void* pNext; - VkDeviceSize allocationSize; - uint32_t memoryTypeBits; -} VkAndroidHardwareBufferPropertiesANDROID; - -typedef struct VkAndroidHardwareBufferFormatPropertiesANDROID { - VkStructureType sType; - void* pNext; - VkFormat format; - uint64_t externalFormat; - VkFormatFeatureFlags formatFeatures; - VkComponentMapping samplerYcbcrConversionComponents; - VkSamplerYcbcrModelConversion suggestedYcbcrModel; - VkSamplerYcbcrRange suggestedYcbcrRange; - VkChromaLocation suggestedXChromaOffset; - VkChromaLocation suggestedYChromaOffset; -} VkAndroidHardwareBufferFormatPropertiesANDROID; - -typedef struct VkImportAndroidHardwareBufferInfoANDROID { - VkStructureType sType; - const void* pNext; - struct AHardwareBuffer* buffer; -} VkImportAndroidHardwareBufferInfoANDROID; - -typedef struct VkMemoryGetAndroidHardwareBufferInfoANDROID { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; -} VkMemoryGetAndroidHardwareBufferInfoANDROID; - -typedef struct VkExternalFormatANDROID { - VkStructureType sType; - void* pNext; - uint64_t externalFormat; -} VkExternalFormatANDROID; - -typedef VkResult (VKAPI_PTR *PFN_vkGetAndroidHardwareBufferPropertiesANDROID)(VkDevice device, const struct AHardwareBuffer* buffer, VkAndroidHardwareBufferPropertiesANDROID* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryAndroidHardwareBufferANDROID)(VkDevice device, const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, struct AHardwareBuffer** pBuffer); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetAndroidHardwareBufferPropertiesANDROID( - VkDevice device, - const struct AHardwareBuffer* buffer, - VkAndroidHardwareBufferPropertiesANDROID* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryAndroidHardwareBufferANDROID( - VkDevice device, - const VkMemoryGetAndroidHardwareBufferInfoANDROID* pInfo, - struct AHardwareBuffer** pBuffer); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h deleted file mode 100644 index 3b4fe629ce746f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_core.h +++ /dev/null @@ -1,12620 +0,0 @@ -#ifndef VULKAN_CORE_H_ -#define VULKAN_CORE_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_VERSION_1_0 1 -#include "vk_platform.h" - -#define VK_DEFINE_HANDLE(object) typedef struct object##_T* object; - - -#ifndef VK_USE_64_BIT_PTR_DEFINES - #if defined(__LP64__) || defined(_WIN64) || (defined(__x86_64__) && !defined(__ILP32__) ) || defined(_M_X64) || defined(__ia64) || defined (_M_IA64) || defined(__aarch64__) || defined(__powerpc64__) - #define VK_USE_64_BIT_PTR_DEFINES 1 - #else - #define VK_USE_64_BIT_PTR_DEFINES 0 - #endif -#endif - - -#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE - #if (VK_USE_64_BIT_PTR_DEFINES==1) - #if __cplusplus >= 201103L || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201103L)) - #define VK_NULL_HANDLE nullptr - #else - #define VK_NULL_HANDLE ((void*)0) - #endif - #else - #define VK_NULL_HANDLE 0ULL - #endif -#endif -#ifndef VK_NULL_HANDLE - #define VK_NULL_HANDLE 0 -#endif - - -#ifndef VK_DEFINE_NON_DISPATCHABLE_HANDLE - #if (VK_USE_64_BIT_PTR_DEFINES==1) - #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef struct object##_T *object; - #else - #define VK_DEFINE_NON_DISPATCHABLE_HANDLE(object) typedef uint64_t object; - #endif -#endif - -// DEPRECATED: This define is deprecated. VK_MAKE_API_VERSION should be used instead. -#define VK_MAKE_VERSION(major, minor, patch) \ - ((((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) - -// DEPRECATED: This define has been removed. Specific version defines (e.g. VK_API_VERSION_1_0), or the VK_MAKE_VERSION macro, should be used instead. -//#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 0) // Patch version should always be set to 0 - -#define VK_MAKE_API_VERSION(variant, major, minor, patch) \ - ((((uint32_t)(variant)) << 29) | (((uint32_t)(major)) << 22) | (((uint32_t)(minor)) << 12) | ((uint32_t)(patch))) - -// Vulkan 1.0 version number -#define VK_API_VERSION_1_0 VK_MAKE_API_VERSION(0, 1, 0, 0)// Patch version should always be set to 0 - -// Version of this file -#define VK_HEADER_VERSION 176 - -// Complete version of this file -#define VK_HEADER_VERSION_COMPLETE VK_MAKE_API_VERSION(0, 1, 2, VK_HEADER_VERSION) - -// DEPRECATED: This define is deprecated. VK_API_VERSION_MAJOR should be used instead. -#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22) - -// DEPRECATED: This define is deprecated. VK_API_VERSION_MINOR should be used instead. -#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) - -// DEPRECATED: This define is deprecated. VK_API_VERSION_PATCH should be used instead. -#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) - -#define VK_API_VERSION_VARIANT(version) ((uint32_t)(version) >> 29) -#define VK_API_VERSION_MAJOR(version) (((uint32_t)(version) >> 22) & 0x7FU) -#define VK_API_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3FFU) -#define VK_API_VERSION_PATCH(version) ((uint32_t)(version) & 0xFFFU) -typedef uint32_t VkBool32; -typedef uint64_t VkDeviceAddress; -typedef uint64_t VkDeviceSize; -typedef uint32_t VkFlags; -typedef uint32_t VkSampleMask; -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImage) -VK_DEFINE_HANDLE(VkInstance) -VK_DEFINE_HANDLE(VkPhysicalDevice) -VK_DEFINE_HANDLE(VkDevice) -VK_DEFINE_HANDLE(VkQueue) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSemaphore) -VK_DEFINE_HANDLE(VkCommandBuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFence) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeviceMemory) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkEvent) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkQueryPool) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkBufferView) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkImageView) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkShaderModule) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineCache) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipelineLayout) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPipeline) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkRenderPass) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSetLayout) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSampler) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorSet) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorPool) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkFramebuffer) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkCommandPool) -#define VK_ATTACHMENT_UNUSED (~0U) -#define VK_FALSE 0U -#define VK_LOD_CLAMP_NONE 1000.0F -#define VK_QUEUE_FAMILY_IGNORED (~0U) -#define VK_REMAINING_ARRAY_LAYERS (~0U) -#define VK_REMAINING_MIP_LEVELS (~0U) -#define VK_SUBPASS_EXTERNAL (~0U) -#define VK_TRUE 1U -#define VK_WHOLE_SIZE (~0ULL) -#define VK_MAX_MEMORY_TYPES 32U -#define VK_MAX_MEMORY_HEAPS 16U -#define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256U -#define VK_UUID_SIZE 16U -#define VK_MAX_EXTENSION_NAME_SIZE 256U -#define VK_MAX_DESCRIPTION_SIZE 256U - -typedef enum VkResult { - VK_SUCCESS = 0, - VK_NOT_READY = 1, - VK_TIMEOUT = 2, - VK_EVENT_SET = 3, - VK_EVENT_RESET = 4, - VK_INCOMPLETE = 5, - VK_ERROR_OUT_OF_HOST_MEMORY = -1, - VK_ERROR_OUT_OF_DEVICE_MEMORY = -2, - VK_ERROR_INITIALIZATION_FAILED = -3, - VK_ERROR_DEVICE_LOST = -4, - VK_ERROR_MEMORY_MAP_FAILED = -5, - VK_ERROR_LAYER_NOT_PRESENT = -6, - VK_ERROR_EXTENSION_NOT_PRESENT = -7, - VK_ERROR_FEATURE_NOT_PRESENT = -8, - VK_ERROR_INCOMPATIBLE_DRIVER = -9, - VK_ERROR_TOO_MANY_OBJECTS = -10, - VK_ERROR_FORMAT_NOT_SUPPORTED = -11, - VK_ERROR_FRAGMENTED_POOL = -12, - VK_ERROR_UNKNOWN = -13, - VK_ERROR_OUT_OF_POOL_MEMORY = -1000069000, - VK_ERROR_INVALID_EXTERNAL_HANDLE = -1000072003, - VK_ERROR_FRAGMENTATION = -1000161000, - VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS = -1000257000, - VK_ERROR_SURFACE_LOST_KHR = -1000000000, - VK_ERROR_NATIVE_WINDOW_IN_USE_KHR = -1000000001, - VK_SUBOPTIMAL_KHR = 1000001003, - VK_ERROR_OUT_OF_DATE_KHR = -1000001004, - VK_ERROR_INCOMPATIBLE_DISPLAY_KHR = -1000003001, - VK_ERROR_VALIDATION_FAILED_EXT = -1000011001, - VK_ERROR_INVALID_SHADER_NV = -1000012000, - VK_ERROR_INVALID_DRM_FORMAT_MODIFIER_PLANE_LAYOUT_EXT = -1000158000, - VK_ERROR_NOT_PERMITTED_EXT = -1000174001, - VK_ERROR_FULL_SCREEN_EXCLUSIVE_MODE_LOST_EXT = -1000255000, - VK_THREAD_IDLE_KHR = 1000268000, - VK_THREAD_DONE_KHR = 1000268001, - VK_OPERATION_DEFERRED_KHR = 1000268002, - VK_OPERATION_NOT_DEFERRED_KHR = 1000268003, - VK_PIPELINE_COMPILE_REQUIRED_EXT = 1000297000, - VK_ERROR_OUT_OF_POOL_MEMORY_KHR = VK_ERROR_OUT_OF_POOL_MEMORY, - VK_ERROR_INVALID_EXTERNAL_HANDLE_KHR = VK_ERROR_INVALID_EXTERNAL_HANDLE, - VK_ERROR_FRAGMENTATION_EXT = VK_ERROR_FRAGMENTATION, - VK_ERROR_INVALID_DEVICE_ADDRESS_EXT = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, - VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS_KHR = VK_ERROR_INVALID_OPAQUE_CAPTURE_ADDRESS, - VK_ERROR_PIPELINE_COMPILE_REQUIRED_EXT = VK_PIPELINE_COMPILE_REQUIRED_EXT, - VK_RESULT_MAX_ENUM = 0x7FFFFFFF -} VkResult; - -typedef enum VkStructureType { - VK_STRUCTURE_TYPE_APPLICATION_INFO = 0, - VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO = 1, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO = 2, - VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO = 3, - VK_STRUCTURE_TYPE_SUBMIT_INFO = 4, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_INFO = 5, - VK_STRUCTURE_TYPE_MAPPED_MEMORY_RANGE = 6, - VK_STRUCTURE_TYPE_BIND_SPARSE_INFO = 7, - VK_STRUCTURE_TYPE_FENCE_CREATE_INFO = 8, - VK_STRUCTURE_TYPE_SEMAPHORE_CREATE_INFO = 9, - VK_STRUCTURE_TYPE_EVENT_CREATE_INFO = 10, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO = 11, - VK_STRUCTURE_TYPE_BUFFER_CREATE_INFO = 12, - VK_STRUCTURE_TYPE_BUFFER_VIEW_CREATE_INFO = 13, - VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO = 14, - VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO = 15, - VK_STRUCTURE_TYPE_SHADER_MODULE_CREATE_INFO = 16, - VK_STRUCTURE_TYPE_PIPELINE_CACHE_CREATE_INFO = 17, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_CREATE_INFO = 18, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_STATE_CREATE_INFO = 19, - VK_STRUCTURE_TYPE_PIPELINE_INPUT_ASSEMBLY_STATE_CREATE_INFO = 20, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_STATE_CREATE_INFO = 21, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_STATE_CREATE_INFO = 22, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_CREATE_INFO = 23, - VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO = 24, - VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO = 25, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_STATE_CREATE_INFO = 26, - VK_STRUCTURE_TYPE_PIPELINE_DYNAMIC_STATE_CREATE_INFO = 27, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_CREATE_INFO = 28, - VK_STRUCTURE_TYPE_COMPUTE_PIPELINE_CREATE_INFO = 29, - VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO = 30, - VK_STRUCTURE_TYPE_SAMPLER_CREATE_INFO = 31, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_CREATE_INFO = 32, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO = 33, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_ALLOCATE_INFO = 34, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET = 35, - VK_STRUCTURE_TYPE_COPY_DESCRIPTOR_SET = 36, - VK_STRUCTURE_TYPE_FRAMEBUFFER_CREATE_INFO = 37, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO = 38, - VK_STRUCTURE_TYPE_COMMAND_POOL_CREATE_INFO = 39, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_ALLOCATE_INFO = 40, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_INFO = 41, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_BEGIN_INFO = 42, - VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO = 43, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER = 44, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER = 45, - VK_STRUCTURE_TYPE_MEMORY_BARRIER = 46, - VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO = 47, - VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO = 48, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_PROPERTIES = 1000094000, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO = 1000157000, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO = 1000157001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES = 1000083000, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS = 1000127000, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO = 1000127001, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO = 1000060000, - VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO = 1000060003, - VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO = 1000060004, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO = 1000060005, - VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO = 1000060006, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO = 1000060013, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO = 1000060014, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES = 1000070000, - VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO = 1000070001, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2 = 1000146000, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2 = 1000146001, - VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2 = 1000146002, - VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2 = 1000146003, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2 = 1000146004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2 = 1000059000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2 = 1000059001, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2 = 1000059002, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2 = 1000059003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2 = 1000059004, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2 = 1000059005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2 = 1000059006, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2 = 1000059007, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2 = 1000059008, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES = 1000117000, - VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO = 1000117001, - VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO = 1000117002, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO = 1000117003, - VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO = 1000053000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES = 1000053001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES = 1000053002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES = 1000120000, - VK_STRUCTURE_TYPE_PROTECTED_SUBMIT_INFO = 1000145000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_FEATURES = 1000145001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROTECTED_MEMORY_PROPERTIES = 1000145002, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_INFO_2 = 1000145003, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO = 1000156000, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO = 1000156001, - VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO = 1000156002, - VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO = 1000156003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES = 1000156004, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES = 1000156005, - VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO = 1000085000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO = 1000071000, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES = 1000071001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO = 1000071002, - VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES = 1000071003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES = 1000071004, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO = 1000072000, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO = 1000072001, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO = 1000072002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO = 1000112000, - VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES = 1000112001, - VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO = 1000113000, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO = 1000077000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO = 1000076000, - VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES = 1000076001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES = 1000168000, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT = 1000168001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES = 1000063000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_FEATURES = 49, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_1_PROPERTIES = 50, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_FEATURES = 51, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_1_2_PROPERTIES = 52, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO = 1000147000, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2 = 1000109000, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2 = 1000109001, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2 = 1000109002, - VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2 = 1000109003, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2 = 1000109004, - VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO = 1000109005, - VK_STRUCTURE_TYPE_SUBPASS_END_INFO = 1000109006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES = 1000177000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES = 1000196000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES = 1000180000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES = 1000082000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES = 1000197000, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO = 1000161000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES = 1000161001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES = 1000161002, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO = 1000161003, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT = 1000161004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES = 1000199000, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE = 1000199001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES = 1000221000, - VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO = 1000246000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES = 1000130000, - VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO = 1000130001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES = 1000211000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES = 1000108000, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO = 1000108001, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO = 1000108002, - VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO = 1000108003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES = 1000253000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES = 1000175000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES = 1000241000, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT = 1000241001, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT = 1000241002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES = 1000261000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES = 1000207000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES = 1000207001, - VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO = 1000207002, - VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO = 1000207003, - VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO = 1000207004, - VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO = 1000207005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES = 1000257000, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO = 1000244001, - VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO = 1000257002, - VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO = 1000257003, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO = 1000257004, - VK_STRUCTURE_TYPE_SWAPCHAIN_CREATE_INFO_KHR = 1000001000, - VK_STRUCTURE_TYPE_PRESENT_INFO_KHR = 1000001001, - VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_CAPABILITIES_KHR = 1000060007, - VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR = 1000060008, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR = 1000060009, - VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR = 1000060010, - VK_STRUCTURE_TYPE_DEVICE_GROUP_PRESENT_INFO_KHR = 1000060011, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SWAPCHAIN_CREATE_INFO_KHR = 1000060012, - VK_STRUCTURE_TYPE_DISPLAY_MODE_CREATE_INFO_KHR = 1000002000, - VK_STRUCTURE_TYPE_DISPLAY_SURFACE_CREATE_INFO_KHR = 1000002001, - VK_STRUCTURE_TYPE_DISPLAY_PRESENT_INFO_KHR = 1000003000, - VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR = 1000004000, - VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR = 1000005000, - VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR = 1000006000, - VK_STRUCTURE_TYPE_ANDROID_SURFACE_CREATE_INFO_KHR = 1000008000, - VK_STRUCTURE_TYPE_WIN32_SURFACE_CREATE_INFO_KHR = 1000009000, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT = 1000011000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_RASTERIZATION_ORDER_AMD = 1000018000, - VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_NAME_INFO_EXT = 1000022000, - VK_STRUCTURE_TYPE_DEBUG_MARKER_OBJECT_TAG_INFO_EXT = 1000022001, - VK_STRUCTURE_TYPE_DEBUG_MARKER_MARKER_INFO_EXT = 1000022002, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_PROFILE_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_CAPABILITIES_KHR = 1000023001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_PICTURE_RESOURCE_KHR = 1000023002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_GET_MEMORY_PROPERTIES_KHR = 1000023003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_BIND_MEMORY_KHR = 1000023004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_SESSION_CREATE_INFO_KHR = 1000023005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_CREATE_INFO_KHR = 1000023006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_SESSION_PARAMETERS_UPDATE_INFO_KHR = 1000023007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_BEGIN_CODING_INFO_KHR = 1000023008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_END_CODING_INFO_KHR = 1000023009, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_CODING_CONTROL_INFO_KHR = 1000023010, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_REFERENCE_SLOT_KHR = 1000023011, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_QUEUE_FAMILY_PROPERTIES_2_KHR = 1000023012, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_PROFILES_KHR = 1000023013, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VIDEO_FORMAT_INFO_KHR = 1000023014, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_FORMAT_PROPERTIES_KHR = 1000023015, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_INFO_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_INFO_KHR = 1000299000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_RATE_CONTROL_INFO_KHR = 1000299001, -#endif - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_IMAGE_CREATE_INFO_NV = 1000026000, - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_BUFFER_CREATE_INFO_NV = 1000026001, - VK_STRUCTURE_TYPE_DEDICATED_ALLOCATION_MEMORY_ALLOCATE_INFO_NV = 1000026002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_FEATURES_EXT = 1000028000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TRANSFORM_FEEDBACK_PROPERTIES_EXT = 1000028001, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_STATE_STREAM_CREATE_INFO_EXT = 1000028002, - VK_STRUCTURE_TYPE_IMAGE_VIEW_HANDLE_INFO_NVX = 1000030000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_ADDRESS_PROPERTIES_NVX = 1000030001, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_CAPABILITIES_EXT = 1000038000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_CREATE_INFO_EXT = 1000038001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000038002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000038003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_VCL_FRAME_INFO_EXT = 1000038004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_DPB_SLOT_INFO_EXT = 1000038005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_NALU_SLICE_EXT = 1000038006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_EMIT_PICTURE_PARAMETERS_EXT = 1000038007, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_PROFILE_EXT = 1000038008, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_CAPABILITIES_EXT = 1000040000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_CREATE_INFO_EXT = 1000040001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PICTURE_INFO_EXT = 1000040002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_MVC_EXT = 1000040003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_PROFILE_EXT = 1000040004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000040005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_SESSION_PARAMETERS_ADD_INFO_EXT = 1000040006, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H264_DPB_SLOT_INFO_EXT = 1000040007, -#endif - VK_STRUCTURE_TYPE_TEXTURE_LOD_GATHER_FORMAT_PROPERTIES_AMD = 1000041000, - VK_STRUCTURE_TYPE_STREAM_DESCRIPTOR_SURFACE_CREATE_INFO_GGP = 1000049000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CORNER_SAMPLED_IMAGE_FEATURES_NV = 1000050000, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_NV = 1000056000, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_NV = 1000056001, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057000, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_NV = 1000057001, - VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_NV = 1000058000, - VK_STRUCTURE_TYPE_VALIDATION_FLAGS_EXT = 1000061000, - VK_STRUCTURE_TYPE_VI_SURFACE_CREATE_INFO_NN = 1000062000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXTURE_COMPRESSION_ASTC_HDR_FEATURES_EXT = 1000066000, - VK_STRUCTURE_TYPE_IMAGE_VIEW_ASTC_DECODE_MODE_EXT = 1000067000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ASTC_DECODE_FEATURES_EXT = 1000067001, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073000, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_WIN32_HANDLE_INFO_KHR = 1000073001, - VK_STRUCTURE_TYPE_MEMORY_WIN32_HANDLE_PROPERTIES_KHR = 1000073002, - VK_STRUCTURE_TYPE_MEMORY_GET_WIN32_HANDLE_INFO_KHR = 1000073003, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_FD_INFO_KHR = 1000074000, - VK_STRUCTURE_TYPE_MEMORY_FD_PROPERTIES_KHR = 1000074001, - VK_STRUCTURE_TYPE_MEMORY_GET_FD_INFO_KHR = 1000074002, - VK_STRUCTURE_TYPE_WIN32_KEYED_MUTEX_ACQUIRE_RELEASE_INFO_KHR = 1000075000, - VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078000, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_WIN32_HANDLE_INFO_KHR = 1000078001, - VK_STRUCTURE_TYPE_D3D12_FENCE_SUBMIT_INFO_KHR = 1000078002, - VK_STRUCTURE_TYPE_SEMAPHORE_GET_WIN32_HANDLE_INFO_KHR = 1000078003, - VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_FD_INFO_KHR = 1000079000, - VK_STRUCTURE_TYPE_SEMAPHORE_GET_FD_INFO_KHR = 1000079001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PUSH_DESCRIPTOR_PROPERTIES_KHR = 1000080000, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_CONDITIONAL_RENDERING_INFO_EXT = 1000081000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONDITIONAL_RENDERING_FEATURES_EXT = 1000081001, - VK_STRUCTURE_TYPE_CONDITIONAL_RENDERING_BEGIN_INFO_EXT = 1000081002, - VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR = 1000084000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_W_SCALING_STATE_CREATE_INFO_NV = 1000087000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT = 1000090000, - VK_STRUCTURE_TYPE_DISPLAY_POWER_INFO_EXT = 1000091000, - VK_STRUCTURE_TYPE_DEVICE_EVENT_INFO_EXT = 1000091001, - VK_STRUCTURE_TYPE_DISPLAY_EVENT_INFO_EXT = 1000091002, - VK_STRUCTURE_TYPE_SWAPCHAIN_COUNTER_CREATE_INFO_EXT = 1000091003, - VK_STRUCTURE_TYPE_PRESENT_TIMES_INFO_GOOGLE = 1000092000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PER_VIEW_ATTRIBUTES_PROPERTIES_NVX = 1000097000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SWIZZLE_STATE_CREATE_INFO_NV = 1000098000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DISCARD_RECTANGLE_PROPERTIES_EXT = 1000099000, - VK_STRUCTURE_TYPE_PIPELINE_DISCARD_RECTANGLE_STATE_CREATE_INFO_EXT = 1000099001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CONSERVATIVE_RASTERIZATION_PROPERTIES_EXT = 1000101000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_CONSERVATIVE_STATE_CREATE_INFO_EXT = 1000101001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_CLIP_ENABLE_FEATURES_EXT = 1000102000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_DEPTH_CLIP_STATE_CREATE_INFO_EXT = 1000102001, - VK_STRUCTURE_TYPE_HDR_METADATA_EXT = 1000105000, - VK_STRUCTURE_TYPE_SHARED_PRESENT_SURFACE_CAPABILITIES_KHR = 1000111000, - VK_STRUCTURE_TYPE_IMPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114000, - VK_STRUCTURE_TYPE_EXPORT_FENCE_WIN32_HANDLE_INFO_KHR = 1000114001, - VK_STRUCTURE_TYPE_FENCE_GET_WIN32_HANDLE_INFO_KHR = 1000114002, - VK_STRUCTURE_TYPE_IMPORT_FENCE_FD_INFO_KHR = 1000115000, - VK_STRUCTURE_TYPE_FENCE_GET_FD_INFO_KHR = 1000115001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_FEATURES_KHR = 1000116000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PERFORMANCE_QUERY_PROPERTIES_KHR = 1000116001, - VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_CREATE_INFO_KHR = 1000116002, - VK_STRUCTURE_TYPE_PERFORMANCE_QUERY_SUBMIT_INFO_KHR = 1000116003, - VK_STRUCTURE_TYPE_ACQUIRE_PROFILING_LOCK_INFO_KHR = 1000116004, - VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_KHR = 1000116005, - VK_STRUCTURE_TYPE_PERFORMANCE_COUNTER_DESCRIPTION_KHR = 1000116006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SURFACE_INFO_2_KHR = 1000119000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR = 1000119001, - VK_STRUCTURE_TYPE_SURFACE_FORMAT_2_KHR = 1000119002, - VK_STRUCTURE_TYPE_DISPLAY_PROPERTIES_2_KHR = 1000121000, - VK_STRUCTURE_TYPE_DISPLAY_PLANE_PROPERTIES_2_KHR = 1000121001, - VK_STRUCTURE_TYPE_DISPLAY_MODE_PROPERTIES_2_KHR = 1000121002, - VK_STRUCTURE_TYPE_DISPLAY_PLANE_INFO_2_KHR = 1000121003, - VK_STRUCTURE_TYPE_DISPLAY_PLANE_CAPABILITIES_2_KHR = 1000121004, - VK_STRUCTURE_TYPE_IOS_SURFACE_CREATE_INFO_MVK = 1000122000, - VK_STRUCTURE_TYPE_MACOS_SURFACE_CREATE_INFO_MVK = 1000123000, - VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_NAME_INFO_EXT = 1000128000, - VK_STRUCTURE_TYPE_DEBUG_UTILS_OBJECT_TAG_INFO_EXT = 1000128001, - VK_STRUCTURE_TYPE_DEBUG_UTILS_LABEL_EXT = 1000128002, - VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CALLBACK_DATA_EXT = 1000128003, - VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT = 1000128004, - VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_USAGE_ANDROID = 1000129000, - VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_PROPERTIES_ANDROID = 1000129001, - VK_STRUCTURE_TYPE_ANDROID_HARDWARE_BUFFER_FORMAT_PROPERTIES_ANDROID = 1000129002, - VK_STRUCTURE_TYPE_IMPORT_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129003, - VK_STRUCTURE_TYPE_MEMORY_GET_ANDROID_HARDWARE_BUFFER_INFO_ANDROID = 1000129004, - VK_STRUCTURE_TYPE_EXTERNAL_FORMAT_ANDROID = 1000129005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_FEATURES_EXT = 1000138000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INLINE_UNIFORM_BLOCK_PROPERTIES_EXT = 1000138001, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_INLINE_UNIFORM_BLOCK_EXT = 1000138002, - VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_INLINE_UNIFORM_BLOCK_CREATE_INFO_EXT = 1000138003, - VK_STRUCTURE_TYPE_SAMPLE_LOCATIONS_INFO_EXT = 1000143000, - VK_STRUCTURE_TYPE_RENDER_PASS_SAMPLE_LOCATIONS_BEGIN_INFO_EXT = 1000143001, - VK_STRUCTURE_TYPE_PIPELINE_SAMPLE_LOCATIONS_STATE_CREATE_INFO_EXT = 1000143002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLE_LOCATIONS_PROPERTIES_EXT = 1000143003, - VK_STRUCTURE_TYPE_MULTISAMPLE_PROPERTIES_EXT = 1000143004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_FEATURES_EXT = 1000148000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BLEND_OPERATION_ADVANCED_PROPERTIES_EXT = 1000148001, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_BLEND_ADVANCED_STATE_CREATE_INFO_EXT = 1000148002, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_TO_COLOR_STATE_CREATE_INFO_NV = 1000149000, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_KHR = 1000150007, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_GEOMETRY_INFO_KHR = 1000150000, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_DEVICE_ADDRESS_INFO_KHR = 1000150002, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_AABBS_DATA_KHR = 1000150003, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_INSTANCES_DATA_KHR = 1000150004, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_TRIANGLES_DATA_KHR = 1000150005, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_GEOMETRY_KHR = 1000150006, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_VERSION_INFO_KHR = 1000150009, - VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_INFO_KHR = 1000150010, - VK_STRUCTURE_TYPE_COPY_ACCELERATION_STRUCTURE_TO_MEMORY_INFO_KHR = 1000150011, - VK_STRUCTURE_TYPE_COPY_MEMORY_TO_ACCELERATION_STRUCTURE_INFO_KHR = 1000150012, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_FEATURES_KHR = 1000150013, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ACCELERATION_STRUCTURE_PROPERTIES_KHR = 1000150014, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_KHR = 1000150017, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_BUILD_SIZES_INFO_KHR = 1000150020, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_FEATURES_KHR = 1000347000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PIPELINE_PROPERTIES_KHR = 1000347001, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_KHR = 1000150015, - VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_KHR = 1000150016, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_INTERFACE_CREATE_INFO_KHR = 1000150018, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_QUERY_FEATURES_KHR = 1000348013, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_MODULATION_STATE_CREATE_INFO_NV = 1000152000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_FEATURES_NV = 1000154000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SM_BUILTINS_PROPERTIES_NV = 1000154001, - VK_STRUCTURE_TYPE_DRM_FORMAT_MODIFIER_PROPERTIES_LIST_EXT = 1000158000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_DRM_FORMAT_MODIFIER_INFO_EXT = 1000158002, - VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_LIST_CREATE_INFO_EXT = 1000158003, - VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_EXPLICIT_CREATE_INFO_EXT = 1000158004, - VK_STRUCTURE_TYPE_IMAGE_DRM_FORMAT_MODIFIER_PROPERTIES_EXT = 1000158005, - VK_STRUCTURE_TYPE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160000, - VK_STRUCTURE_TYPE_SHADER_MODULE_VALIDATION_CACHE_CREATE_INFO_EXT = 1000160001, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_FEATURES_KHR = 1000163000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PORTABILITY_SUBSET_PROPERTIES_KHR = 1000163001, -#endif - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_SHADING_RATE_IMAGE_STATE_CREATE_INFO_NV = 1000164000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_FEATURES_NV = 1000164001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADING_RATE_IMAGE_PROPERTIES_NV = 1000164002, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_COARSE_SAMPLE_ORDER_STATE_CREATE_INFO_NV = 1000164005, - VK_STRUCTURE_TYPE_RAY_TRACING_PIPELINE_CREATE_INFO_NV = 1000165000, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_CREATE_INFO_NV = 1000165001, - VK_STRUCTURE_TYPE_GEOMETRY_NV = 1000165003, - VK_STRUCTURE_TYPE_GEOMETRY_TRIANGLES_NV = 1000165004, - VK_STRUCTURE_TYPE_GEOMETRY_AABB_NV = 1000165005, - VK_STRUCTURE_TYPE_BIND_ACCELERATION_STRUCTURE_MEMORY_INFO_NV = 1000165006, - VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET_ACCELERATION_STRUCTURE_NV = 1000165007, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_INFO_NV = 1000165008, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_RAY_TRACING_PROPERTIES_NV = 1000165009, - VK_STRUCTURE_TYPE_RAY_TRACING_SHADER_GROUP_CREATE_INFO_NV = 1000165011, - VK_STRUCTURE_TYPE_ACCELERATION_STRUCTURE_INFO_NV = 1000165012, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_REPRESENTATIVE_FRAGMENT_TEST_FEATURES_NV = 1000166000, - VK_STRUCTURE_TYPE_PIPELINE_REPRESENTATIVE_FRAGMENT_TEST_STATE_CREATE_INFO_NV = 1000166001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_VIEW_IMAGE_FORMAT_INFO_EXT = 1000170000, - VK_STRUCTURE_TYPE_FILTER_CUBIC_IMAGE_VIEW_IMAGE_FORMAT_PROPERTIES_EXT = 1000170001, - VK_STRUCTURE_TYPE_DEVICE_QUEUE_GLOBAL_PRIORITY_CREATE_INFO_EXT = 1000174000, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_HOST_POINTER_INFO_EXT = 1000178000, - VK_STRUCTURE_TYPE_MEMORY_HOST_POINTER_PROPERTIES_EXT = 1000178001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_MEMORY_HOST_PROPERTIES_EXT = 1000178002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CLOCK_FEATURES_KHR = 1000181000, - VK_STRUCTURE_TYPE_PIPELINE_COMPILER_CONTROL_CREATE_INFO_AMD = 1000183000, - VK_STRUCTURE_TYPE_CALIBRATED_TIMESTAMP_INFO_EXT = 1000184000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_AMD = 1000185000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_CAPABILITIES_EXT = 1000187000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_CREATE_INFO_EXT = 1000187001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_CREATE_INFO_EXT = 1000187002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_SESSION_PARAMETERS_ADD_INFO_EXT = 1000187003, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PROFILE_EXT = 1000187004, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_PICTURE_INFO_EXT = 1000187005, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_STRUCTURE_TYPE_VIDEO_DECODE_H265_DPB_SLOT_INFO_EXT = 1000187006, -#endif - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OVERALLOCATION_CREATE_INFO_AMD = 1000189000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_PROPERTIES_EXT = 1000190000, - VK_STRUCTURE_TYPE_PIPELINE_VERTEX_INPUT_DIVISOR_STATE_CREATE_INFO_EXT = 1000190001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_ATTRIBUTE_DIVISOR_FEATURES_EXT = 1000190002, - VK_STRUCTURE_TYPE_PRESENT_FRAME_TOKEN_GGP = 1000191000, - VK_STRUCTURE_TYPE_PIPELINE_CREATION_FEEDBACK_CREATE_INFO_EXT = 1000192000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COMPUTE_SHADER_DERIVATIVES_FEATURES_NV = 1000201000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_FEATURES_NV = 1000202000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MESH_SHADER_PROPERTIES_NV = 1000202001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_BARYCENTRIC_FEATURES_NV = 1000203000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_FOOTPRINT_FEATURES_NV = 1000204000, - VK_STRUCTURE_TYPE_PIPELINE_VIEWPORT_EXCLUSIVE_SCISSOR_STATE_CREATE_INFO_NV = 1000205000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXCLUSIVE_SCISSOR_FEATURES_NV = 1000205002, - VK_STRUCTURE_TYPE_CHECKPOINT_DATA_NV = 1000206000, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_NV = 1000206001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_INTEGER_FUNCTIONS_2_FEATURES_INTEL = 1000209000, - VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL = 1000210000, - VK_STRUCTURE_TYPE_INITIALIZE_PERFORMANCE_API_INFO_INTEL = 1000210001, - VK_STRUCTURE_TYPE_PERFORMANCE_MARKER_INFO_INTEL = 1000210002, - VK_STRUCTURE_TYPE_PERFORMANCE_STREAM_MARKER_INFO_INTEL = 1000210003, - VK_STRUCTURE_TYPE_PERFORMANCE_OVERRIDE_INFO_INTEL = 1000210004, - VK_STRUCTURE_TYPE_PERFORMANCE_CONFIGURATION_ACQUIRE_INFO_INTEL = 1000210005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PCI_BUS_INFO_PROPERTIES_EXT = 1000212000, - VK_STRUCTURE_TYPE_DISPLAY_NATIVE_HDR_SURFACE_CAPABILITIES_AMD = 1000213000, - VK_STRUCTURE_TYPE_SWAPCHAIN_DISPLAY_NATIVE_HDR_CREATE_INFO_AMD = 1000213001, - VK_STRUCTURE_TYPE_IMAGEPIPE_SURFACE_CREATE_INFO_FUCHSIA = 1000214000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_TERMINATE_INVOCATION_FEATURES_KHR = 1000215000, - VK_STRUCTURE_TYPE_METAL_SURFACE_CREATE_INFO_EXT = 1000217000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_FEATURES_EXT = 1000218000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_PROPERTIES_EXT = 1000218001, - VK_STRUCTURE_TYPE_RENDER_PASS_FRAGMENT_DENSITY_MAP_CREATE_INFO_EXT = 1000218002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_PROPERTIES_EXT = 1000225000, - VK_STRUCTURE_TYPE_PIPELINE_SHADER_STAGE_REQUIRED_SUBGROUP_SIZE_CREATE_INFO_EXT = 1000225001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SUBGROUP_SIZE_CONTROL_FEATURES_EXT = 1000225002, - VK_STRUCTURE_TYPE_FRAGMENT_SHADING_RATE_ATTACHMENT_INFO_KHR = 1000226000, - VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_STATE_CREATE_INFO_KHR = 1000226001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_PROPERTIES_KHR = 1000226002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_FEATURES_KHR = 1000226003, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_KHR = 1000226004, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_CORE_PROPERTIES_2_AMD = 1000227000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COHERENT_MEMORY_FEATURES_AMD = 1000229000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_IMAGE_ATOMIC_INT64_FEATURES_EXT = 1000234000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_BUDGET_PROPERTIES_EXT = 1000237000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PRIORITY_FEATURES_EXT = 1000238000, - VK_STRUCTURE_TYPE_MEMORY_PRIORITY_ALLOCATE_INFO_EXT = 1000238001, - VK_STRUCTURE_TYPE_SURFACE_PROTECTED_CAPABILITIES_KHR = 1000239000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEDICATED_ALLOCATION_IMAGE_ALIASING_FEATURES_NV = 1000240000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT = 1000244000, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_CREATE_INFO_EXT = 1000244002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TOOL_PROPERTIES_EXT = 1000245000, - VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT = 1000247000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_FEATURES_NV = 1000249000, - VK_STRUCTURE_TYPE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COOPERATIVE_MATRIX_PROPERTIES_NV = 1000249002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COVERAGE_REDUCTION_MODE_FEATURES_NV = 1000250000, - VK_STRUCTURE_TYPE_PIPELINE_COVERAGE_REDUCTION_STATE_CREATE_INFO_NV = 1000250001, - VK_STRUCTURE_TYPE_FRAMEBUFFER_MIXED_SAMPLES_COMBINATION_NV = 1000250002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADER_INTERLOCK_FEATURES_EXT = 1000251000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_IMAGE_ARRAYS_FEATURES_EXT = 1000252000, - VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_INFO_EXT = 1000255000, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_FULL_SCREEN_EXCLUSIVE_EXT = 1000255002, - VK_STRUCTURE_TYPE_SURFACE_FULL_SCREEN_EXCLUSIVE_WIN32_INFO_EXT = 1000255001, - VK_STRUCTURE_TYPE_HEADLESS_SURFACE_CREATE_INFO_EXT = 1000256000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_FEATURES_EXT = 1000259000, - VK_STRUCTURE_TYPE_PIPELINE_RASTERIZATION_LINE_STATE_CREATE_INFO_EXT = 1000259001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_LINE_RASTERIZATION_PROPERTIES_EXT = 1000259002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_FLOAT_FEATURES_EXT = 1000260000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INDEX_TYPE_UINT8_FEATURES_EXT = 1000265000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_FEATURES_EXT = 1000267000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR = 1000269000, - VK_STRUCTURE_TYPE_PIPELINE_INFO_KHR = 1000269001, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_PROPERTIES_KHR = 1000269002, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INFO_KHR = 1000269003, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_STATISTIC_KHR = 1000269004, - VK_STRUCTURE_TYPE_PIPELINE_EXECUTABLE_INTERNAL_REPRESENTATION_KHR = 1000269005, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DEMOTE_TO_HELPER_INVOCATION_FEATURES_EXT = 1000276000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_PROPERTIES_NV = 1000277000, - VK_STRUCTURE_TYPE_GRAPHICS_SHADER_GROUP_CREATE_INFO_NV = 1000277001, - VK_STRUCTURE_TYPE_GRAPHICS_PIPELINE_SHADER_GROUPS_CREATE_INFO_NV = 1000277002, - VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_TOKEN_NV = 1000277003, - VK_STRUCTURE_TYPE_INDIRECT_COMMANDS_LAYOUT_CREATE_INFO_NV = 1000277004, - VK_STRUCTURE_TYPE_GENERATED_COMMANDS_INFO_NV = 1000277005, - VK_STRUCTURE_TYPE_GENERATED_COMMANDS_MEMORY_REQUIREMENTS_INFO_NV = 1000277006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV = 1000277007, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_INHERITED_VIEWPORT_SCISSOR_FEATURES_NV = 1000278000, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_VIEWPORT_SCISSOR_INFO_NV = 1000278001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_FEATURES_EXT = 1000281000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TEXEL_BUFFER_ALIGNMENT_PROPERTIES_EXT = 1000281001, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_INHERITANCE_RENDER_PASS_TRANSFORM_INFO_QCOM = 1000282000, - VK_STRUCTURE_TYPE_RENDER_PASS_TRANSFORM_BEGIN_INFO_QCOM = 1000282001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_MEMORY_REPORT_FEATURES_EXT = 1000284000, - VK_STRUCTURE_TYPE_DEVICE_DEVICE_MEMORY_REPORT_CREATE_INFO_EXT = 1000284001, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_REPORT_CALLBACK_DATA_EXT = 1000284002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT = 1000286000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_PROPERTIES_EXT = 1000286001, - VK_STRUCTURE_TYPE_SAMPLER_CUSTOM_BORDER_COLOR_CREATE_INFO_EXT = 1000287000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_PROPERTIES_EXT = 1000287001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_CUSTOM_BORDER_COLOR_FEATURES_EXT = 1000287002, - VK_STRUCTURE_TYPE_PIPELINE_LIBRARY_CREATE_INFO_KHR = 1000290000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PRIVATE_DATA_FEATURES_EXT = 1000295000, - VK_STRUCTURE_TYPE_DEVICE_PRIVATE_DATA_CREATE_INFO_EXT = 1000295001, - VK_STRUCTURE_TYPE_PRIVATE_DATA_SLOT_CREATE_INFO_EXT = 1000295002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_CREATION_CACHE_CONTROL_FEATURES_EXT = 1000297000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DIAGNOSTICS_CONFIG_FEATURES_NV = 1000300000, - VK_STRUCTURE_TYPE_DEVICE_DIAGNOSTICS_CONFIG_CREATE_INFO_NV = 1000300001, - VK_STRUCTURE_TYPE_MEMORY_BARRIER_2_KHR = 1000314000, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER_2_KHR = 1000314001, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER_2_KHR = 1000314002, - VK_STRUCTURE_TYPE_DEPENDENCY_INFO_KHR = 1000314003, - VK_STRUCTURE_TYPE_SUBMIT_INFO_2_KHR = 1000314004, - VK_STRUCTURE_TYPE_SEMAPHORE_SUBMIT_INFO_KHR = 1000314005, - VK_STRUCTURE_TYPE_COMMAND_BUFFER_SUBMIT_INFO_KHR = 1000314006, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SYNCHRONIZATION_2_FEATURES_KHR = 1000314007, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_CHECKPOINT_PROPERTIES_2_NV = 1000314008, - VK_STRUCTURE_TYPE_CHECKPOINT_DATA_2_NV = 1000314009, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ZERO_INITIALIZE_WORKGROUP_MEMORY_FEATURES_KHR = 1000325000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_PROPERTIES_NV = 1000326000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_SHADING_RATE_ENUMS_FEATURES_NV = 1000326001, - VK_STRUCTURE_TYPE_PIPELINE_FRAGMENT_SHADING_RATE_ENUM_STATE_CREATE_INFO_NV = 1000326002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_YCBCR_2_PLANE_444_FORMATS_FEATURES_EXT = 1000330000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_FEATURES_EXT = 1000332000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FRAGMENT_DENSITY_MAP_2_PROPERTIES_EXT = 1000332001, - VK_STRUCTURE_TYPE_COPY_COMMAND_TRANSFORM_INFO_QCOM = 1000333000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_ROBUSTNESS_FEATURES_EXT = 1000335000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_FEATURES_KHR = 1000336000, - VK_STRUCTURE_TYPE_COPY_BUFFER_INFO_2_KHR = 1000337000, - VK_STRUCTURE_TYPE_COPY_IMAGE_INFO_2_KHR = 1000337001, - VK_STRUCTURE_TYPE_COPY_BUFFER_TO_IMAGE_INFO_2_KHR = 1000337002, - VK_STRUCTURE_TYPE_COPY_IMAGE_TO_BUFFER_INFO_2_KHR = 1000337003, - VK_STRUCTURE_TYPE_BLIT_IMAGE_INFO_2_KHR = 1000337004, - VK_STRUCTURE_TYPE_RESOLVE_IMAGE_INFO_2_KHR = 1000337005, - VK_STRUCTURE_TYPE_BUFFER_COPY_2_KHR = 1000337006, - VK_STRUCTURE_TYPE_IMAGE_COPY_2_KHR = 1000337007, - VK_STRUCTURE_TYPE_IMAGE_BLIT_2_KHR = 1000337008, - VK_STRUCTURE_TYPE_BUFFER_IMAGE_COPY_2_KHR = 1000337009, - VK_STRUCTURE_TYPE_IMAGE_RESOLVE_2_KHR = 1000337010, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_4444_FORMATS_FEATURES_EXT = 1000340000, - VK_STRUCTURE_TYPE_DIRECTFB_SURFACE_CREATE_INFO_EXT = 1000346000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MUTABLE_DESCRIPTOR_TYPE_FEATURES_VALVE = 1000351000, - VK_STRUCTURE_TYPE_MUTABLE_DESCRIPTOR_TYPE_CREATE_INFO_VALVE = 1000351002, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VERTEX_INPUT_DYNAMIC_STATE_FEATURES_EXT = 1000352000, - VK_STRUCTURE_TYPE_VERTEX_INPUT_BINDING_DESCRIPTION_2_EXT = 1000352001, - VK_STRUCTURE_TYPE_VERTEX_INPUT_ATTRIBUTE_DESCRIPTION_2_EXT = 1000352002, - VK_STRUCTURE_TYPE_IMPORT_MEMORY_ZIRCON_HANDLE_INFO_FUCHSIA = 1000364000, - VK_STRUCTURE_TYPE_MEMORY_ZIRCON_HANDLE_PROPERTIES_FUCHSIA = 1000364001, - VK_STRUCTURE_TYPE_MEMORY_GET_ZIRCON_HANDLE_INFO_FUCHSIA = 1000364002, - VK_STRUCTURE_TYPE_IMPORT_SEMAPHORE_ZIRCON_HANDLE_INFO_FUCHSIA = 1000365000, - VK_STRUCTURE_TYPE_SEMAPHORE_GET_ZIRCON_HANDLE_INFO_FUCHSIA = 1000365001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTENDED_DYNAMIC_STATE_2_FEATURES_EXT = 1000377000, - VK_STRUCTURE_TYPE_SCREEN_SURFACE_CREATE_INFO_QNX = 1000378000, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_COLOR_WRITE_ENABLE_FEATURES_EXT = 1000381000, - VK_STRUCTURE_TYPE_PIPELINE_COLOR_WRITE_CREATE_INFO_EXT = 1000381001, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETER_FEATURES = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_DRAW_PARAMETERS_FEATURES, - VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DEBUG_REPORT_CALLBACK_CREATE_INFO_EXT, - VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_MULTIVIEW_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PROPERTIES_2, - VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGE_FORMAT_INFO_2, - VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_QUEUE_FAMILY_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MEMORY_PROPERTIES_2, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_FORMAT_PROPERTIES_2, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SPARSE_IMAGE_FORMAT_INFO_2, - VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_ALLOCATE_FLAGS_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_RENDER_PASS_BEGIN_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_COMMAND_BUFFER_BEGIN_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_SUBMIT_INFO, - VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_BIND_SPARSE_INFO, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_DEVICE_GROUP_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_DEVICE_GROUP_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_GROUP_PROPERTIES, - VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_GROUP_DEVICE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_BUFFER_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_BUFFER_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_BUFFER_CREATE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_MEMORY_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_SEMAPHORE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_SEMAPHORE_PROPERTIES, - VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_SEMAPHORE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT16_INT8_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_FLOAT16_INT8_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_16BIT_STORAGE_FEATURES, - VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_CREATE_INFO, - VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES2_EXT = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_EXT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_IMAGELESS_FRAMEBUFFER_FEATURES, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENTS_CREATE_INFO, - VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO_KHR = VK_STRUCTURE_TYPE_FRAMEBUFFER_ATTACHMENT_IMAGE_INFO, - VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_ATTACHMENT_BEGIN_INFO, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_2, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_2, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_2, - VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2_KHR = VK_STRUCTURE_TYPE_SUBPASS_DEPENDENCY_2, - VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO_2, - VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_BEGIN_INFO, - VK_STRUCTURE_TYPE_SUBPASS_END_INFO_KHR = VK_STRUCTURE_TYPE_SUBPASS_END_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_FENCE_INFO, - VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_EXTERNAL_FENCE_PROPERTIES, - VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_EXPORT_FENCE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_POINT_CLIPPING_PROPERTIES, - VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_RENDER_PASS_INPUT_ATTACHMENT_ASPECT_CREATE_INFO, - VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_PIPELINE_TESSELLATION_DOMAIN_ORIGIN_STATE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTER_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VARIABLE_POINTERS_FEATURES_KHR, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_REQUIREMENTS, - VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_DEDICATED_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_FILTER_MINMAX_PROPERTIES, - VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_SAMPLER_REDUCTION_MODE_CREATE_INFO, - VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_BUFFER_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2_KHR = VK_STRUCTURE_TYPE_IMAGE_SPARSE_MEMORY_REQUIREMENTS_INFO_2, - VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_MEMORY_REQUIREMENTS_2, - VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2_KHR = VK_STRUCTURE_TYPE_SPARSE_IMAGE_MEMORY_REQUIREMENTS_2, - VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_FORMAT_LIST_CREATE_INFO, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_CREATE_INFO, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_PLANE_MEMORY_INFO, - VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO_KHR = VK_STRUCTURE_TYPE_IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SAMPLER_YCBCR_CONVERSION_FEATURES, - VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES_KHR = VK_STRUCTURE_TYPE_SAMPLER_YCBCR_CONVERSION_IMAGE_FORMAT_PROPERTIES, - VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_BUFFER_MEMORY_INFO, - VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO_KHR = VK_STRUCTURE_TYPE_BIND_IMAGE_MEMORY_INFO, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_BINDING_FLAGS_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DESCRIPTOR_INDEXING_PROPERTIES, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT_EXT = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_VARIABLE_DESCRIPTOR_COUNT_LAYOUT_SUPPORT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MAINTENANCE_3_PROPERTIES, - VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT_KHR = VK_STRUCTURE_TYPE_DESCRIPTOR_SET_LAYOUT_SUPPORT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_SUBGROUP_EXTENDED_TYPES_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_8BIT_STORAGE_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SHADER_ATOMIC_INT64_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DRIVER_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FLOAT_CONTROLS_PROPERTIES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEPTH_STENCIL_RESOLVE_PROPERTIES, - VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR = VK_STRUCTURE_TYPE_SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_TIMELINE_SEMAPHORE_PROPERTIES, - VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_TYPE_CREATE_INFO, - VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO_KHR = VK_STRUCTURE_TYPE_TIMELINE_SEMAPHORE_SUBMIT_INFO, - VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_WAIT_INFO, - VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO_KHR = VK_STRUCTURE_TYPE_SEMAPHORE_SIGNAL_INFO, - VK_STRUCTURE_TYPE_QUERY_POOL_CREATE_INFO_INTEL = VK_STRUCTURE_TYPE_QUERY_POOL_PERFORMANCE_QUERY_CREATE_INFO_INTEL, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_VULKAN_MEMORY_MODEL_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SCALAR_BLOCK_LAYOUT_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_SEPARATE_DEPTH_STENCIL_LAYOUTS_FEATURES, - VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_REFERENCE_STENCIL_LAYOUT, - VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR = VK_STRUCTURE_TYPE_ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_ADDRESS_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_EXT, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_EXT = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO_EXT = VK_STRUCTURE_TYPE_IMAGE_STENCIL_USAGE_CREATE_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_UNIFORM_BUFFER_STANDARD_LAYOUT_FEATURES, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES_KHR = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_BUFFER_DEVICE_ADDRESS_FEATURES, - VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_DEVICE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO_KHR = VK_STRUCTURE_TYPE_BUFFER_OPAQUE_CAPTURE_ADDRESS_CREATE_INFO, - VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO_KHR = VK_STRUCTURE_TYPE_MEMORY_OPAQUE_CAPTURE_ADDRESS_ALLOCATE_INFO, - VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO_KHR = VK_STRUCTURE_TYPE_DEVICE_MEMORY_OPAQUE_CAPTURE_ADDRESS_INFO, - VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES, - VK_STRUCTURE_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkStructureType; - -typedef enum VkImageLayout { - VK_IMAGE_LAYOUT_UNDEFINED = 0, - VK_IMAGE_LAYOUT_GENERAL = 1, - VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL = 2, - VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL = 3, - VK_IMAGE_LAYOUT_DEPTH_STENCIL_READ_ONLY_OPTIMAL = 4, - VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL = 5, - VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL = 6, - VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL = 7, - VK_IMAGE_LAYOUT_PREINITIALIZED = 8, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL = 1000117000, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL = 1000117001, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL = 1000241000, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL = 1000241001, - VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL = 1000241002, - VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL = 1000241003, - VK_IMAGE_LAYOUT_PRESENT_SRC_KHR = 1000001002, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_DECODE_DST_KHR = 1000024000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_DECODE_SRC_KHR = 1000024001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_DECODE_DPB_KHR = 1000024002, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_ENCODE_DST_KHR = 1000299000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_ENCODE_SRC_KHR = 1000299001, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_LAYOUT_VIDEO_ENCODE_DPB_KHR = 1000299002, -#endif - VK_IMAGE_LAYOUT_SHARED_PRESENT_KHR = 1000111000, - VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV = 1000164003, - VK_IMAGE_LAYOUT_FRAGMENT_DENSITY_MAP_OPTIMAL_EXT = 1000218000, - VK_IMAGE_LAYOUT_READ_ONLY_OPTIMAL_KHR = 1000314000, - VK_IMAGE_LAYOUT_ATTACHMENT_OPTIMAL_KHR = 1000314001, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_STENCIL_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_STENCIL_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_FRAGMENT_SHADING_RATE_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_SHADING_RATE_OPTIMAL_NV, - VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_DEPTH_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_ATTACHMENT_OPTIMAL, - VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL_KHR = VK_IMAGE_LAYOUT_STENCIL_READ_ONLY_OPTIMAL, - VK_IMAGE_LAYOUT_MAX_ENUM = 0x7FFFFFFF -} VkImageLayout; - -typedef enum VkObjectType { - VK_OBJECT_TYPE_UNKNOWN = 0, - VK_OBJECT_TYPE_INSTANCE = 1, - VK_OBJECT_TYPE_PHYSICAL_DEVICE = 2, - VK_OBJECT_TYPE_DEVICE = 3, - VK_OBJECT_TYPE_QUEUE = 4, - VK_OBJECT_TYPE_SEMAPHORE = 5, - VK_OBJECT_TYPE_COMMAND_BUFFER = 6, - VK_OBJECT_TYPE_FENCE = 7, - VK_OBJECT_TYPE_DEVICE_MEMORY = 8, - VK_OBJECT_TYPE_BUFFER = 9, - VK_OBJECT_TYPE_IMAGE = 10, - VK_OBJECT_TYPE_EVENT = 11, - VK_OBJECT_TYPE_QUERY_POOL = 12, - VK_OBJECT_TYPE_BUFFER_VIEW = 13, - VK_OBJECT_TYPE_IMAGE_VIEW = 14, - VK_OBJECT_TYPE_SHADER_MODULE = 15, - VK_OBJECT_TYPE_PIPELINE_CACHE = 16, - VK_OBJECT_TYPE_PIPELINE_LAYOUT = 17, - VK_OBJECT_TYPE_RENDER_PASS = 18, - VK_OBJECT_TYPE_PIPELINE = 19, - VK_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT = 20, - VK_OBJECT_TYPE_SAMPLER = 21, - VK_OBJECT_TYPE_DESCRIPTOR_POOL = 22, - VK_OBJECT_TYPE_DESCRIPTOR_SET = 23, - VK_OBJECT_TYPE_FRAMEBUFFER = 24, - VK_OBJECT_TYPE_COMMAND_POOL = 25, - VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION = 1000156000, - VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE = 1000085000, - VK_OBJECT_TYPE_SURFACE_KHR = 1000000000, - VK_OBJECT_TYPE_SWAPCHAIN_KHR = 1000001000, - VK_OBJECT_TYPE_DISPLAY_KHR = 1000002000, - VK_OBJECT_TYPE_DISPLAY_MODE_KHR = 1000002001, - VK_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT = 1000011000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_OBJECT_TYPE_VIDEO_SESSION_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_OBJECT_TYPE_VIDEO_SESSION_PARAMETERS_KHR = 1000023001, -#endif - VK_OBJECT_TYPE_DEBUG_UTILS_MESSENGER_EXT = 1000128000, - VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, - VK_OBJECT_TYPE_VALIDATION_CACHE_EXT = 1000160000, - VK_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, - VK_OBJECT_TYPE_PERFORMANCE_CONFIGURATION_INTEL = 1000210000, - VK_OBJECT_TYPE_DEFERRED_OPERATION_KHR = 1000268000, - VK_OBJECT_TYPE_INDIRECT_COMMANDS_LAYOUT_NV = 1000277000, - VK_OBJECT_TYPE_PRIVATE_DATA_SLOT_EXT = 1000295000, - VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR = VK_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE, - VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR = VK_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION, - VK_OBJECT_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkObjectType; - -typedef enum VkVendorId { - VK_VENDOR_ID_VIV = 0x10001, - VK_VENDOR_ID_VSI = 0x10002, - VK_VENDOR_ID_KAZAN = 0x10003, - VK_VENDOR_ID_CODEPLAY = 0x10004, - VK_VENDOR_ID_MESA = 0x10005, - VK_VENDOR_ID_POCL = 0x10006, - VK_VENDOR_ID_MAX_ENUM = 0x7FFFFFFF -} VkVendorId; - -typedef enum VkPipelineCacheHeaderVersion { - VK_PIPELINE_CACHE_HEADER_VERSION_ONE = 1, - VK_PIPELINE_CACHE_HEADER_VERSION_MAX_ENUM = 0x7FFFFFFF -} VkPipelineCacheHeaderVersion; - -typedef enum VkSystemAllocationScope { - VK_SYSTEM_ALLOCATION_SCOPE_COMMAND = 0, - VK_SYSTEM_ALLOCATION_SCOPE_OBJECT = 1, - VK_SYSTEM_ALLOCATION_SCOPE_CACHE = 2, - VK_SYSTEM_ALLOCATION_SCOPE_DEVICE = 3, - VK_SYSTEM_ALLOCATION_SCOPE_INSTANCE = 4, - VK_SYSTEM_ALLOCATION_SCOPE_MAX_ENUM = 0x7FFFFFFF -} VkSystemAllocationScope; - -typedef enum VkInternalAllocationType { - VK_INTERNAL_ALLOCATION_TYPE_EXECUTABLE = 0, - VK_INTERNAL_ALLOCATION_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkInternalAllocationType; - -typedef enum VkFormat { - VK_FORMAT_UNDEFINED = 0, - VK_FORMAT_R4G4_UNORM_PACK8 = 1, - VK_FORMAT_R4G4B4A4_UNORM_PACK16 = 2, - VK_FORMAT_B4G4R4A4_UNORM_PACK16 = 3, - VK_FORMAT_R5G6B5_UNORM_PACK16 = 4, - VK_FORMAT_B5G6R5_UNORM_PACK16 = 5, - VK_FORMAT_R5G5B5A1_UNORM_PACK16 = 6, - VK_FORMAT_B5G5R5A1_UNORM_PACK16 = 7, - VK_FORMAT_A1R5G5B5_UNORM_PACK16 = 8, - VK_FORMAT_R8_UNORM = 9, - VK_FORMAT_R8_SNORM = 10, - VK_FORMAT_R8_USCALED = 11, - VK_FORMAT_R8_SSCALED = 12, - VK_FORMAT_R8_UINT = 13, - VK_FORMAT_R8_SINT = 14, - VK_FORMAT_R8_SRGB = 15, - VK_FORMAT_R8G8_UNORM = 16, - VK_FORMAT_R8G8_SNORM = 17, - VK_FORMAT_R8G8_USCALED = 18, - VK_FORMAT_R8G8_SSCALED = 19, - VK_FORMAT_R8G8_UINT = 20, - VK_FORMAT_R8G8_SINT = 21, - VK_FORMAT_R8G8_SRGB = 22, - VK_FORMAT_R8G8B8_UNORM = 23, - VK_FORMAT_R8G8B8_SNORM = 24, - VK_FORMAT_R8G8B8_USCALED = 25, - VK_FORMAT_R8G8B8_SSCALED = 26, - VK_FORMAT_R8G8B8_UINT = 27, - VK_FORMAT_R8G8B8_SINT = 28, - VK_FORMAT_R8G8B8_SRGB = 29, - VK_FORMAT_B8G8R8_UNORM = 30, - VK_FORMAT_B8G8R8_SNORM = 31, - VK_FORMAT_B8G8R8_USCALED = 32, - VK_FORMAT_B8G8R8_SSCALED = 33, - VK_FORMAT_B8G8R8_UINT = 34, - VK_FORMAT_B8G8R8_SINT = 35, - VK_FORMAT_B8G8R8_SRGB = 36, - VK_FORMAT_R8G8B8A8_UNORM = 37, - VK_FORMAT_R8G8B8A8_SNORM = 38, - VK_FORMAT_R8G8B8A8_USCALED = 39, - VK_FORMAT_R8G8B8A8_SSCALED = 40, - VK_FORMAT_R8G8B8A8_UINT = 41, - VK_FORMAT_R8G8B8A8_SINT = 42, - VK_FORMAT_R8G8B8A8_SRGB = 43, - VK_FORMAT_B8G8R8A8_UNORM = 44, - VK_FORMAT_B8G8R8A8_SNORM = 45, - VK_FORMAT_B8G8R8A8_USCALED = 46, - VK_FORMAT_B8G8R8A8_SSCALED = 47, - VK_FORMAT_B8G8R8A8_UINT = 48, - VK_FORMAT_B8G8R8A8_SINT = 49, - VK_FORMAT_B8G8R8A8_SRGB = 50, - VK_FORMAT_A8B8G8R8_UNORM_PACK32 = 51, - VK_FORMAT_A8B8G8R8_SNORM_PACK32 = 52, - VK_FORMAT_A8B8G8R8_USCALED_PACK32 = 53, - VK_FORMAT_A8B8G8R8_SSCALED_PACK32 = 54, - VK_FORMAT_A8B8G8R8_UINT_PACK32 = 55, - VK_FORMAT_A8B8G8R8_SINT_PACK32 = 56, - VK_FORMAT_A8B8G8R8_SRGB_PACK32 = 57, - VK_FORMAT_A2R10G10B10_UNORM_PACK32 = 58, - VK_FORMAT_A2R10G10B10_SNORM_PACK32 = 59, - VK_FORMAT_A2R10G10B10_USCALED_PACK32 = 60, - VK_FORMAT_A2R10G10B10_SSCALED_PACK32 = 61, - VK_FORMAT_A2R10G10B10_UINT_PACK32 = 62, - VK_FORMAT_A2R10G10B10_SINT_PACK32 = 63, - VK_FORMAT_A2B10G10R10_UNORM_PACK32 = 64, - VK_FORMAT_A2B10G10R10_SNORM_PACK32 = 65, - VK_FORMAT_A2B10G10R10_USCALED_PACK32 = 66, - VK_FORMAT_A2B10G10R10_SSCALED_PACK32 = 67, - VK_FORMAT_A2B10G10R10_UINT_PACK32 = 68, - VK_FORMAT_A2B10G10R10_SINT_PACK32 = 69, - VK_FORMAT_R16_UNORM = 70, - VK_FORMAT_R16_SNORM = 71, - VK_FORMAT_R16_USCALED = 72, - VK_FORMAT_R16_SSCALED = 73, - VK_FORMAT_R16_UINT = 74, - VK_FORMAT_R16_SINT = 75, - VK_FORMAT_R16_SFLOAT = 76, - VK_FORMAT_R16G16_UNORM = 77, - VK_FORMAT_R16G16_SNORM = 78, - VK_FORMAT_R16G16_USCALED = 79, - VK_FORMAT_R16G16_SSCALED = 80, - VK_FORMAT_R16G16_UINT = 81, - VK_FORMAT_R16G16_SINT = 82, - VK_FORMAT_R16G16_SFLOAT = 83, - VK_FORMAT_R16G16B16_UNORM = 84, - VK_FORMAT_R16G16B16_SNORM = 85, - VK_FORMAT_R16G16B16_USCALED = 86, - VK_FORMAT_R16G16B16_SSCALED = 87, - VK_FORMAT_R16G16B16_UINT = 88, - VK_FORMAT_R16G16B16_SINT = 89, - VK_FORMAT_R16G16B16_SFLOAT = 90, - VK_FORMAT_R16G16B16A16_UNORM = 91, - VK_FORMAT_R16G16B16A16_SNORM = 92, - VK_FORMAT_R16G16B16A16_USCALED = 93, - VK_FORMAT_R16G16B16A16_SSCALED = 94, - VK_FORMAT_R16G16B16A16_UINT = 95, - VK_FORMAT_R16G16B16A16_SINT = 96, - VK_FORMAT_R16G16B16A16_SFLOAT = 97, - VK_FORMAT_R32_UINT = 98, - VK_FORMAT_R32_SINT = 99, - VK_FORMAT_R32_SFLOAT = 100, - VK_FORMAT_R32G32_UINT = 101, - VK_FORMAT_R32G32_SINT = 102, - VK_FORMAT_R32G32_SFLOAT = 103, - VK_FORMAT_R32G32B32_UINT = 104, - VK_FORMAT_R32G32B32_SINT = 105, - VK_FORMAT_R32G32B32_SFLOAT = 106, - VK_FORMAT_R32G32B32A32_UINT = 107, - VK_FORMAT_R32G32B32A32_SINT = 108, - VK_FORMAT_R32G32B32A32_SFLOAT = 109, - VK_FORMAT_R64_UINT = 110, - VK_FORMAT_R64_SINT = 111, - VK_FORMAT_R64_SFLOAT = 112, - VK_FORMAT_R64G64_UINT = 113, - VK_FORMAT_R64G64_SINT = 114, - VK_FORMAT_R64G64_SFLOAT = 115, - VK_FORMAT_R64G64B64_UINT = 116, - VK_FORMAT_R64G64B64_SINT = 117, - VK_FORMAT_R64G64B64_SFLOAT = 118, - VK_FORMAT_R64G64B64A64_UINT = 119, - VK_FORMAT_R64G64B64A64_SINT = 120, - VK_FORMAT_R64G64B64A64_SFLOAT = 121, - VK_FORMAT_B10G11R11_UFLOAT_PACK32 = 122, - VK_FORMAT_E5B9G9R9_UFLOAT_PACK32 = 123, - VK_FORMAT_D16_UNORM = 124, - VK_FORMAT_X8_D24_UNORM_PACK32 = 125, - VK_FORMAT_D32_SFLOAT = 126, - VK_FORMAT_S8_UINT = 127, - VK_FORMAT_D16_UNORM_S8_UINT = 128, - VK_FORMAT_D24_UNORM_S8_UINT = 129, - VK_FORMAT_D32_SFLOAT_S8_UINT = 130, - VK_FORMAT_BC1_RGB_UNORM_BLOCK = 131, - VK_FORMAT_BC1_RGB_SRGB_BLOCK = 132, - VK_FORMAT_BC1_RGBA_UNORM_BLOCK = 133, - VK_FORMAT_BC1_RGBA_SRGB_BLOCK = 134, - VK_FORMAT_BC2_UNORM_BLOCK = 135, - VK_FORMAT_BC2_SRGB_BLOCK = 136, - VK_FORMAT_BC3_UNORM_BLOCK = 137, - VK_FORMAT_BC3_SRGB_BLOCK = 138, - VK_FORMAT_BC4_UNORM_BLOCK = 139, - VK_FORMAT_BC4_SNORM_BLOCK = 140, - VK_FORMAT_BC5_UNORM_BLOCK = 141, - VK_FORMAT_BC5_SNORM_BLOCK = 142, - VK_FORMAT_BC6H_UFLOAT_BLOCK = 143, - VK_FORMAT_BC6H_SFLOAT_BLOCK = 144, - VK_FORMAT_BC7_UNORM_BLOCK = 145, - VK_FORMAT_BC7_SRGB_BLOCK = 146, - VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK = 147, - VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK = 148, - VK_FORMAT_ETC2_R8G8B8A1_UNORM_BLOCK = 149, - VK_FORMAT_ETC2_R8G8B8A1_SRGB_BLOCK = 150, - VK_FORMAT_ETC2_R8G8B8A8_UNORM_BLOCK = 151, - VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK = 152, - VK_FORMAT_EAC_R11_UNORM_BLOCK = 153, - VK_FORMAT_EAC_R11_SNORM_BLOCK = 154, - VK_FORMAT_EAC_R11G11_UNORM_BLOCK = 155, - VK_FORMAT_EAC_R11G11_SNORM_BLOCK = 156, - VK_FORMAT_ASTC_4x4_UNORM_BLOCK = 157, - VK_FORMAT_ASTC_4x4_SRGB_BLOCK = 158, - VK_FORMAT_ASTC_5x4_UNORM_BLOCK = 159, - VK_FORMAT_ASTC_5x4_SRGB_BLOCK = 160, - VK_FORMAT_ASTC_5x5_UNORM_BLOCK = 161, - VK_FORMAT_ASTC_5x5_SRGB_BLOCK = 162, - VK_FORMAT_ASTC_6x5_UNORM_BLOCK = 163, - VK_FORMAT_ASTC_6x5_SRGB_BLOCK = 164, - VK_FORMAT_ASTC_6x6_UNORM_BLOCK = 165, - VK_FORMAT_ASTC_6x6_SRGB_BLOCK = 166, - VK_FORMAT_ASTC_8x5_UNORM_BLOCK = 167, - VK_FORMAT_ASTC_8x5_SRGB_BLOCK = 168, - VK_FORMAT_ASTC_8x6_UNORM_BLOCK = 169, - VK_FORMAT_ASTC_8x6_SRGB_BLOCK = 170, - VK_FORMAT_ASTC_8x8_UNORM_BLOCK = 171, - VK_FORMAT_ASTC_8x8_SRGB_BLOCK = 172, - VK_FORMAT_ASTC_10x5_UNORM_BLOCK = 173, - VK_FORMAT_ASTC_10x5_SRGB_BLOCK = 174, - VK_FORMAT_ASTC_10x6_UNORM_BLOCK = 175, - VK_FORMAT_ASTC_10x6_SRGB_BLOCK = 176, - VK_FORMAT_ASTC_10x8_UNORM_BLOCK = 177, - VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178, - VK_FORMAT_ASTC_10x10_UNORM_BLOCK = 179, - VK_FORMAT_ASTC_10x10_SRGB_BLOCK = 180, - VK_FORMAT_ASTC_12x10_UNORM_BLOCK = 181, - VK_FORMAT_ASTC_12x10_SRGB_BLOCK = 182, - VK_FORMAT_ASTC_12x12_UNORM_BLOCK = 183, - VK_FORMAT_ASTC_12x12_SRGB_BLOCK = 184, - VK_FORMAT_G8B8G8R8_422_UNORM = 1000156000, - VK_FORMAT_B8G8R8G8_422_UNORM = 1000156001, - VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM = 1000156002, - VK_FORMAT_G8_B8R8_2PLANE_420_UNORM = 1000156003, - VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM = 1000156004, - VK_FORMAT_G8_B8R8_2PLANE_422_UNORM = 1000156005, - VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM = 1000156006, - VK_FORMAT_R10X6_UNORM_PACK16 = 1000156007, - VK_FORMAT_R10X6G10X6_UNORM_2PACK16 = 1000156008, - VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16 = 1000156009, - VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16 = 1000156010, - VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16 = 1000156011, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16 = 1000156012, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16 = 1000156013, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16 = 1000156014, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16 = 1000156015, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16 = 1000156016, - VK_FORMAT_R12X4_UNORM_PACK16 = 1000156017, - VK_FORMAT_R12X4G12X4_UNORM_2PACK16 = 1000156018, - VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16 = 1000156019, - VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16 = 1000156020, - VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16 = 1000156021, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16 = 1000156022, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16 = 1000156023, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16 = 1000156024, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16 = 1000156025, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16 = 1000156026, - VK_FORMAT_G16B16G16R16_422_UNORM = 1000156027, - VK_FORMAT_B16G16R16G16_422_UNORM = 1000156028, - VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM = 1000156029, - VK_FORMAT_G16_B16R16_2PLANE_420_UNORM = 1000156030, - VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM = 1000156031, - VK_FORMAT_G16_B16R16_2PLANE_422_UNORM = 1000156032, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM = 1000156033, - VK_FORMAT_PVRTC1_2BPP_UNORM_BLOCK_IMG = 1000054000, - VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG = 1000054001, - VK_FORMAT_PVRTC2_2BPP_UNORM_BLOCK_IMG = 1000054002, - VK_FORMAT_PVRTC2_4BPP_UNORM_BLOCK_IMG = 1000054003, - VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG = 1000054004, - VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG = 1000054005, - VK_FORMAT_PVRTC2_2BPP_SRGB_BLOCK_IMG = 1000054006, - VK_FORMAT_PVRTC2_4BPP_SRGB_BLOCK_IMG = 1000054007, - VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT = 1000066000, - VK_FORMAT_ASTC_5x4_SFLOAT_BLOCK_EXT = 1000066001, - VK_FORMAT_ASTC_5x5_SFLOAT_BLOCK_EXT = 1000066002, - VK_FORMAT_ASTC_6x5_SFLOAT_BLOCK_EXT = 1000066003, - VK_FORMAT_ASTC_6x6_SFLOAT_BLOCK_EXT = 1000066004, - VK_FORMAT_ASTC_8x5_SFLOAT_BLOCK_EXT = 1000066005, - VK_FORMAT_ASTC_8x6_SFLOAT_BLOCK_EXT = 1000066006, - VK_FORMAT_ASTC_8x8_SFLOAT_BLOCK_EXT = 1000066007, - VK_FORMAT_ASTC_10x5_SFLOAT_BLOCK_EXT = 1000066008, - VK_FORMAT_ASTC_10x6_SFLOAT_BLOCK_EXT = 1000066009, - VK_FORMAT_ASTC_10x8_SFLOAT_BLOCK_EXT = 1000066010, - VK_FORMAT_ASTC_10x10_SFLOAT_BLOCK_EXT = 1000066011, - VK_FORMAT_ASTC_12x10_SFLOAT_BLOCK_EXT = 1000066012, - VK_FORMAT_ASTC_12x12_SFLOAT_BLOCK_EXT = 1000066013, - VK_FORMAT_G8_B8R8_2PLANE_444_UNORM_EXT = 1000330000, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_444_UNORM_3PACK16_EXT = 1000330001, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_444_UNORM_3PACK16_EXT = 1000330002, - VK_FORMAT_G16_B16R16_2PLANE_444_UNORM_EXT = 1000330003, - VK_FORMAT_A4R4G4B4_UNORM_PACK16_EXT = 1000340000, - VK_FORMAT_A4B4G4R4_UNORM_PACK16_EXT = 1000340001, - VK_FORMAT_G8B8G8R8_422_UNORM_KHR = VK_FORMAT_G8B8G8R8_422_UNORM, - VK_FORMAT_B8G8R8G8_422_UNORM_KHR = VK_FORMAT_B8G8R8G8_422_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_420_UNORM, - VK_FORMAT_G8_B8R8_2PLANE_420_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_420_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_422_UNORM, - VK_FORMAT_G8_B8R8_2PLANE_422_UNORM_KHR = VK_FORMAT_G8_B8R8_2PLANE_422_UNORM, - VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM_KHR = VK_FORMAT_G8_B8_R8_3PLANE_444_UNORM, - VK_FORMAT_R10X6_UNORM_PACK16_KHR = VK_FORMAT_R10X6_UNORM_PACK16, - VK_FORMAT_R10X6G10X6_UNORM_2PACK16_KHR = VK_FORMAT_R10X6G10X6_UNORM_2PACK16, - VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16_KHR = VK_FORMAT_R10X6G10X6B10X6A10X6_UNORM_4PACK16, - VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_G10X6B10X6G10X6R10X6_422_UNORM_4PACK16, - VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16_KHR = VK_FORMAT_B10X6G10X6R10X6G10X6_422_UNORM_4PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_420_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_420_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_422_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6R10X6_2PLANE_422_UNORM_3PACK16, - VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G10X6_B10X6_R10X6_3PLANE_444_UNORM_3PACK16, - VK_FORMAT_R12X4_UNORM_PACK16_KHR = VK_FORMAT_R12X4_UNORM_PACK16, - VK_FORMAT_R12X4G12X4_UNORM_2PACK16_KHR = VK_FORMAT_R12X4G12X4_UNORM_2PACK16, - VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16_KHR = VK_FORMAT_R12X4G12X4B12X4A12X4_UNORM_4PACK16, - VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_G12X4B12X4G12X4R12X4_422_UNORM_4PACK16, - VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16_KHR = VK_FORMAT_B12X4G12X4R12X4G12X4_422_UNORM_4PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_420_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_420_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_422_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4R12X4_2PLANE_422_UNORM_3PACK16, - VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16_KHR = VK_FORMAT_G12X4_B12X4_R12X4_3PLANE_444_UNORM_3PACK16, - VK_FORMAT_G16B16G16R16_422_UNORM_KHR = VK_FORMAT_G16B16G16R16_422_UNORM, - VK_FORMAT_B16G16R16G16_422_UNORM_KHR = VK_FORMAT_B16G16R16G16_422_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_420_UNORM, - VK_FORMAT_G16_B16R16_2PLANE_420_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_420_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_422_UNORM, - VK_FORMAT_G16_B16R16_2PLANE_422_UNORM_KHR = VK_FORMAT_G16_B16R16_2PLANE_422_UNORM, - VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM_KHR = VK_FORMAT_G16_B16_R16_3PLANE_444_UNORM, - VK_FORMAT_MAX_ENUM = 0x7FFFFFFF -} VkFormat; - -typedef enum VkImageTiling { - VK_IMAGE_TILING_OPTIMAL = 0, - VK_IMAGE_TILING_LINEAR = 1, - VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT = 1000158000, - VK_IMAGE_TILING_MAX_ENUM = 0x7FFFFFFF -} VkImageTiling; - -typedef enum VkImageType { - VK_IMAGE_TYPE_1D = 0, - VK_IMAGE_TYPE_2D = 1, - VK_IMAGE_TYPE_3D = 2, - VK_IMAGE_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkImageType; - -typedef enum VkPhysicalDeviceType { - VK_PHYSICAL_DEVICE_TYPE_OTHER = 0, - VK_PHYSICAL_DEVICE_TYPE_INTEGRATED_GPU = 1, - VK_PHYSICAL_DEVICE_TYPE_DISCRETE_GPU = 2, - VK_PHYSICAL_DEVICE_TYPE_VIRTUAL_GPU = 3, - VK_PHYSICAL_DEVICE_TYPE_CPU = 4, - VK_PHYSICAL_DEVICE_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkPhysicalDeviceType; - -typedef enum VkQueryType { - VK_QUERY_TYPE_OCCLUSION = 0, - VK_QUERY_TYPE_PIPELINE_STATISTICS = 1, - VK_QUERY_TYPE_TIMESTAMP = 2, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUERY_TYPE_RESULT_STATUS_ONLY_KHR = 1000023000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUERY_TYPE_VIDEO_ENCODE_BITSTREAM_BUFFER_RANGE_KHR = 1000299000, -#endif - VK_QUERY_TYPE_TRANSFORM_FEEDBACK_STREAM_EXT = 1000028004, - VK_QUERY_TYPE_PERFORMANCE_QUERY_KHR = 1000116000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_KHR = 1000150000, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_SERIALIZATION_SIZE_KHR = 1000150001, - VK_QUERY_TYPE_ACCELERATION_STRUCTURE_COMPACTED_SIZE_NV = 1000165000, - VK_QUERY_TYPE_PERFORMANCE_QUERY_INTEL = 1000210000, - VK_QUERY_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkQueryType; - -typedef enum VkSharingMode { - VK_SHARING_MODE_EXCLUSIVE = 0, - VK_SHARING_MODE_CONCURRENT = 1, - VK_SHARING_MODE_MAX_ENUM = 0x7FFFFFFF -} VkSharingMode; - -typedef enum VkComponentSwizzle { - VK_COMPONENT_SWIZZLE_IDENTITY = 0, - VK_COMPONENT_SWIZZLE_ZERO = 1, - VK_COMPONENT_SWIZZLE_ONE = 2, - VK_COMPONENT_SWIZZLE_R = 3, - VK_COMPONENT_SWIZZLE_G = 4, - VK_COMPONENT_SWIZZLE_B = 5, - VK_COMPONENT_SWIZZLE_A = 6, - VK_COMPONENT_SWIZZLE_MAX_ENUM = 0x7FFFFFFF -} VkComponentSwizzle; - -typedef enum VkImageViewType { - VK_IMAGE_VIEW_TYPE_1D = 0, - VK_IMAGE_VIEW_TYPE_2D = 1, - VK_IMAGE_VIEW_TYPE_3D = 2, - VK_IMAGE_VIEW_TYPE_CUBE = 3, - VK_IMAGE_VIEW_TYPE_1D_ARRAY = 4, - VK_IMAGE_VIEW_TYPE_2D_ARRAY = 5, - VK_IMAGE_VIEW_TYPE_CUBE_ARRAY = 6, - VK_IMAGE_VIEW_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkImageViewType; - -typedef enum VkBlendFactor { - VK_BLEND_FACTOR_ZERO = 0, - VK_BLEND_FACTOR_ONE = 1, - VK_BLEND_FACTOR_SRC_COLOR = 2, - VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, - VK_BLEND_FACTOR_DST_COLOR = 4, - VK_BLEND_FACTOR_ONE_MINUS_DST_COLOR = 5, - VK_BLEND_FACTOR_SRC_ALPHA = 6, - VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA = 7, - VK_BLEND_FACTOR_DST_ALPHA = 8, - VK_BLEND_FACTOR_ONE_MINUS_DST_ALPHA = 9, - VK_BLEND_FACTOR_CONSTANT_COLOR = 10, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_COLOR = 11, - VK_BLEND_FACTOR_CONSTANT_ALPHA = 12, - VK_BLEND_FACTOR_ONE_MINUS_CONSTANT_ALPHA = 13, - VK_BLEND_FACTOR_SRC_ALPHA_SATURATE = 14, - VK_BLEND_FACTOR_SRC1_COLOR = 15, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_COLOR = 16, - VK_BLEND_FACTOR_SRC1_ALPHA = 17, - VK_BLEND_FACTOR_ONE_MINUS_SRC1_ALPHA = 18, - VK_BLEND_FACTOR_MAX_ENUM = 0x7FFFFFFF -} VkBlendFactor; - -typedef enum VkBlendOp { - VK_BLEND_OP_ADD = 0, - VK_BLEND_OP_SUBTRACT = 1, - VK_BLEND_OP_REVERSE_SUBTRACT = 2, - VK_BLEND_OP_MIN = 3, - VK_BLEND_OP_MAX = 4, - VK_BLEND_OP_ZERO_EXT = 1000148000, - VK_BLEND_OP_SRC_EXT = 1000148001, - VK_BLEND_OP_DST_EXT = 1000148002, - VK_BLEND_OP_SRC_OVER_EXT = 1000148003, - VK_BLEND_OP_DST_OVER_EXT = 1000148004, - VK_BLEND_OP_SRC_IN_EXT = 1000148005, - VK_BLEND_OP_DST_IN_EXT = 1000148006, - VK_BLEND_OP_SRC_OUT_EXT = 1000148007, - VK_BLEND_OP_DST_OUT_EXT = 1000148008, - VK_BLEND_OP_SRC_ATOP_EXT = 1000148009, - VK_BLEND_OP_DST_ATOP_EXT = 1000148010, - VK_BLEND_OP_XOR_EXT = 1000148011, - VK_BLEND_OP_MULTIPLY_EXT = 1000148012, - VK_BLEND_OP_SCREEN_EXT = 1000148013, - VK_BLEND_OP_OVERLAY_EXT = 1000148014, - VK_BLEND_OP_DARKEN_EXT = 1000148015, - VK_BLEND_OP_LIGHTEN_EXT = 1000148016, - VK_BLEND_OP_COLORDODGE_EXT = 1000148017, - VK_BLEND_OP_COLORBURN_EXT = 1000148018, - VK_BLEND_OP_HARDLIGHT_EXT = 1000148019, - VK_BLEND_OP_SOFTLIGHT_EXT = 1000148020, - VK_BLEND_OP_DIFFERENCE_EXT = 1000148021, - VK_BLEND_OP_EXCLUSION_EXT = 1000148022, - VK_BLEND_OP_INVERT_EXT = 1000148023, - VK_BLEND_OP_INVERT_RGB_EXT = 1000148024, - VK_BLEND_OP_LINEARDODGE_EXT = 1000148025, - VK_BLEND_OP_LINEARBURN_EXT = 1000148026, - VK_BLEND_OP_VIVIDLIGHT_EXT = 1000148027, - VK_BLEND_OP_LINEARLIGHT_EXT = 1000148028, - VK_BLEND_OP_PINLIGHT_EXT = 1000148029, - VK_BLEND_OP_HARDMIX_EXT = 1000148030, - VK_BLEND_OP_HSL_HUE_EXT = 1000148031, - VK_BLEND_OP_HSL_SATURATION_EXT = 1000148032, - VK_BLEND_OP_HSL_COLOR_EXT = 1000148033, - VK_BLEND_OP_HSL_LUMINOSITY_EXT = 1000148034, - VK_BLEND_OP_PLUS_EXT = 1000148035, - VK_BLEND_OP_PLUS_CLAMPED_EXT = 1000148036, - VK_BLEND_OP_PLUS_CLAMPED_ALPHA_EXT = 1000148037, - VK_BLEND_OP_PLUS_DARKER_EXT = 1000148038, - VK_BLEND_OP_MINUS_EXT = 1000148039, - VK_BLEND_OP_MINUS_CLAMPED_EXT = 1000148040, - VK_BLEND_OP_CONTRAST_EXT = 1000148041, - VK_BLEND_OP_INVERT_OVG_EXT = 1000148042, - VK_BLEND_OP_RED_EXT = 1000148043, - VK_BLEND_OP_GREEN_EXT = 1000148044, - VK_BLEND_OP_BLUE_EXT = 1000148045, - VK_BLEND_OP_MAX_ENUM = 0x7FFFFFFF -} VkBlendOp; - -typedef enum VkCompareOp { - VK_COMPARE_OP_NEVER = 0, - VK_COMPARE_OP_LESS = 1, - VK_COMPARE_OP_EQUAL = 2, - VK_COMPARE_OP_LESS_OR_EQUAL = 3, - VK_COMPARE_OP_GREATER = 4, - VK_COMPARE_OP_NOT_EQUAL = 5, - VK_COMPARE_OP_GREATER_OR_EQUAL = 6, - VK_COMPARE_OP_ALWAYS = 7, - VK_COMPARE_OP_MAX_ENUM = 0x7FFFFFFF -} VkCompareOp; - -typedef enum VkDynamicState { - VK_DYNAMIC_STATE_VIEWPORT = 0, - VK_DYNAMIC_STATE_SCISSOR = 1, - VK_DYNAMIC_STATE_LINE_WIDTH = 2, - VK_DYNAMIC_STATE_DEPTH_BIAS = 3, - VK_DYNAMIC_STATE_BLEND_CONSTANTS = 4, - VK_DYNAMIC_STATE_DEPTH_BOUNDS = 5, - VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK = 6, - VK_DYNAMIC_STATE_STENCIL_WRITE_MASK = 7, - VK_DYNAMIC_STATE_STENCIL_REFERENCE = 8, - VK_DYNAMIC_STATE_VIEWPORT_W_SCALING_NV = 1000087000, - VK_DYNAMIC_STATE_DISCARD_RECTANGLE_EXT = 1000099000, - VK_DYNAMIC_STATE_SAMPLE_LOCATIONS_EXT = 1000143000, - VK_DYNAMIC_STATE_RAY_TRACING_PIPELINE_STACK_SIZE_KHR = 1000347000, - VK_DYNAMIC_STATE_VIEWPORT_SHADING_RATE_PALETTE_NV = 1000164004, - VK_DYNAMIC_STATE_VIEWPORT_COARSE_SAMPLE_ORDER_NV = 1000164006, - VK_DYNAMIC_STATE_EXCLUSIVE_SCISSOR_NV = 1000205001, - VK_DYNAMIC_STATE_FRAGMENT_SHADING_RATE_KHR = 1000226000, - VK_DYNAMIC_STATE_LINE_STIPPLE_EXT = 1000259000, - VK_DYNAMIC_STATE_CULL_MODE_EXT = 1000267000, - VK_DYNAMIC_STATE_FRONT_FACE_EXT = 1000267001, - VK_DYNAMIC_STATE_PRIMITIVE_TOPOLOGY_EXT = 1000267002, - VK_DYNAMIC_STATE_VIEWPORT_WITH_COUNT_EXT = 1000267003, - VK_DYNAMIC_STATE_SCISSOR_WITH_COUNT_EXT = 1000267004, - VK_DYNAMIC_STATE_VERTEX_INPUT_BINDING_STRIDE_EXT = 1000267005, - VK_DYNAMIC_STATE_DEPTH_TEST_ENABLE_EXT = 1000267006, - VK_DYNAMIC_STATE_DEPTH_WRITE_ENABLE_EXT = 1000267007, - VK_DYNAMIC_STATE_DEPTH_COMPARE_OP_EXT = 1000267008, - VK_DYNAMIC_STATE_DEPTH_BOUNDS_TEST_ENABLE_EXT = 1000267009, - VK_DYNAMIC_STATE_STENCIL_TEST_ENABLE_EXT = 1000267010, - VK_DYNAMIC_STATE_STENCIL_OP_EXT = 1000267011, - VK_DYNAMIC_STATE_VERTEX_INPUT_EXT = 1000352000, - VK_DYNAMIC_STATE_PATCH_CONTROL_POINTS_EXT = 1000377000, - VK_DYNAMIC_STATE_RASTERIZER_DISCARD_ENABLE_EXT = 1000377001, - VK_DYNAMIC_STATE_DEPTH_BIAS_ENABLE_EXT = 1000377002, - VK_DYNAMIC_STATE_LOGIC_OP_EXT = 1000377003, - VK_DYNAMIC_STATE_PRIMITIVE_RESTART_ENABLE_EXT = 1000377004, - VK_DYNAMIC_STATE_COLOR_WRITE_ENABLE_EXT = 1000381000, - VK_DYNAMIC_STATE_MAX_ENUM = 0x7FFFFFFF -} VkDynamicState; - -typedef enum VkFrontFace { - VK_FRONT_FACE_COUNTER_CLOCKWISE = 0, - VK_FRONT_FACE_CLOCKWISE = 1, - VK_FRONT_FACE_MAX_ENUM = 0x7FFFFFFF -} VkFrontFace; - -typedef enum VkVertexInputRate { - VK_VERTEX_INPUT_RATE_VERTEX = 0, - VK_VERTEX_INPUT_RATE_INSTANCE = 1, - VK_VERTEX_INPUT_RATE_MAX_ENUM = 0x7FFFFFFF -} VkVertexInputRate; - -typedef enum VkPrimitiveTopology { - VK_PRIMITIVE_TOPOLOGY_POINT_LIST = 0, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST = 1, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP = 2, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST = 3, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP = 4, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_FAN = 5, - VK_PRIMITIVE_TOPOLOGY_LINE_LIST_WITH_ADJACENCY = 6, - VK_PRIMITIVE_TOPOLOGY_LINE_STRIP_WITH_ADJACENCY = 7, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST_WITH_ADJACENCY = 8, - VK_PRIMITIVE_TOPOLOGY_TRIANGLE_STRIP_WITH_ADJACENCY = 9, - VK_PRIMITIVE_TOPOLOGY_PATCH_LIST = 10, - VK_PRIMITIVE_TOPOLOGY_MAX_ENUM = 0x7FFFFFFF -} VkPrimitiveTopology; - -typedef enum VkPolygonMode { - VK_POLYGON_MODE_FILL = 0, - VK_POLYGON_MODE_LINE = 1, - VK_POLYGON_MODE_POINT = 2, - VK_POLYGON_MODE_FILL_RECTANGLE_NV = 1000153000, - VK_POLYGON_MODE_MAX_ENUM = 0x7FFFFFFF -} VkPolygonMode; - -typedef enum VkStencilOp { - VK_STENCIL_OP_KEEP = 0, - VK_STENCIL_OP_ZERO = 1, - VK_STENCIL_OP_REPLACE = 2, - VK_STENCIL_OP_INCREMENT_AND_CLAMP = 3, - VK_STENCIL_OP_DECREMENT_AND_CLAMP = 4, - VK_STENCIL_OP_INVERT = 5, - VK_STENCIL_OP_INCREMENT_AND_WRAP = 6, - VK_STENCIL_OP_DECREMENT_AND_WRAP = 7, - VK_STENCIL_OP_MAX_ENUM = 0x7FFFFFFF -} VkStencilOp; - -typedef enum VkLogicOp { - VK_LOGIC_OP_CLEAR = 0, - VK_LOGIC_OP_AND = 1, - VK_LOGIC_OP_AND_REVERSE = 2, - VK_LOGIC_OP_COPY = 3, - VK_LOGIC_OP_AND_INVERTED = 4, - VK_LOGIC_OP_NO_OP = 5, - VK_LOGIC_OP_XOR = 6, - VK_LOGIC_OP_OR = 7, - VK_LOGIC_OP_NOR = 8, - VK_LOGIC_OP_EQUIVALENT = 9, - VK_LOGIC_OP_INVERT = 10, - VK_LOGIC_OP_OR_REVERSE = 11, - VK_LOGIC_OP_COPY_INVERTED = 12, - VK_LOGIC_OP_OR_INVERTED = 13, - VK_LOGIC_OP_NAND = 14, - VK_LOGIC_OP_SET = 15, - VK_LOGIC_OP_MAX_ENUM = 0x7FFFFFFF -} VkLogicOp; - -typedef enum VkBorderColor { - VK_BORDER_COLOR_FLOAT_TRANSPARENT_BLACK = 0, - VK_BORDER_COLOR_INT_TRANSPARENT_BLACK = 1, - VK_BORDER_COLOR_FLOAT_OPAQUE_BLACK = 2, - VK_BORDER_COLOR_INT_OPAQUE_BLACK = 3, - VK_BORDER_COLOR_FLOAT_OPAQUE_WHITE = 4, - VK_BORDER_COLOR_INT_OPAQUE_WHITE = 5, - VK_BORDER_COLOR_FLOAT_CUSTOM_EXT = 1000287003, - VK_BORDER_COLOR_INT_CUSTOM_EXT = 1000287004, - VK_BORDER_COLOR_MAX_ENUM = 0x7FFFFFFF -} VkBorderColor; - -typedef enum VkFilter { - VK_FILTER_NEAREST = 0, - VK_FILTER_LINEAR = 1, - VK_FILTER_CUBIC_IMG = 1000015000, - VK_FILTER_CUBIC_EXT = VK_FILTER_CUBIC_IMG, - VK_FILTER_MAX_ENUM = 0x7FFFFFFF -} VkFilter; - -typedef enum VkSamplerAddressMode { - VK_SAMPLER_ADDRESS_MODE_REPEAT = 0, - VK_SAMPLER_ADDRESS_MODE_MIRRORED_REPEAT = 1, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_EDGE = 2, - VK_SAMPLER_ADDRESS_MODE_CLAMP_TO_BORDER = 3, - VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE = 4, - VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE_KHR = VK_SAMPLER_ADDRESS_MODE_MIRROR_CLAMP_TO_EDGE, - VK_SAMPLER_ADDRESS_MODE_MAX_ENUM = 0x7FFFFFFF -} VkSamplerAddressMode; - -typedef enum VkSamplerMipmapMode { - VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, - VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, - VK_SAMPLER_MIPMAP_MODE_MAX_ENUM = 0x7FFFFFFF -} VkSamplerMipmapMode; - -typedef enum VkDescriptorType { - VK_DESCRIPTOR_TYPE_SAMPLER = 0, - VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER = 1, - VK_DESCRIPTOR_TYPE_SAMPLED_IMAGE = 2, - VK_DESCRIPTOR_TYPE_STORAGE_IMAGE = 3, - VK_DESCRIPTOR_TYPE_UNIFORM_TEXEL_BUFFER = 4, - VK_DESCRIPTOR_TYPE_STORAGE_TEXEL_BUFFER = 5, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER = 6, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER = 7, - VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER_DYNAMIC = 8, - VK_DESCRIPTOR_TYPE_STORAGE_BUFFER_DYNAMIC = 9, - VK_DESCRIPTOR_TYPE_INPUT_ATTACHMENT = 10, - VK_DESCRIPTOR_TYPE_INLINE_UNIFORM_BLOCK_EXT = 1000138000, - VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_KHR = 1000150000, - VK_DESCRIPTOR_TYPE_ACCELERATION_STRUCTURE_NV = 1000165000, - VK_DESCRIPTOR_TYPE_MUTABLE_VALVE = 1000351000, - VK_DESCRIPTOR_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkDescriptorType; - -typedef enum VkAttachmentLoadOp { - VK_ATTACHMENT_LOAD_OP_LOAD = 0, - VK_ATTACHMENT_LOAD_OP_CLEAR = 1, - VK_ATTACHMENT_LOAD_OP_DONT_CARE = 2, - VK_ATTACHMENT_LOAD_OP_MAX_ENUM = 0x7FFFFFFF -} VkAttachmentLoadOp; - -typedef enum VkAttachmentStoreOp { - VK_ATTACHMENT_STORE_OP_STORE = 0, - VK_ATTACHMENT_STORE_OP_DONT_CARE = 1, - VK_ATTACHMENT_STORE_OP_NONE_QCOM = 1000301000, - VK_ATTACHMENT_STORE_OP_MAX_ENUM = 0x7FFFFFFF -} VkAttachmentStoreOp; - -typedef enum VkPipelineBindPoint { - VK_PIPELINE_BIND_POINT_GRAPHICS = 0, - VK_PIPELINE_BIND_POINT_COMPUTE = 1, - VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR = 1000165000, - VK_PIPELINE_BIND_POINT_RAY_TRACING_NV = VK_PIPELINE_BIND_POINT_RAY_TRACING_KHR, - VK_PIPELINE_BIND_POINT_MAX_ENUM = 0x7FFFFFFF -} VkPipelineBindPoint; - -typedef enum VkCommandBufferLevel { - VK_COMMAND_BUFFER_LEVEL_PRIMARY = 0, - VK_COMMAND_BUFFER_LEVEL_SECONDARY = 1, - VK_COMMAND_BUFFER_LEVEL_MAX_ENUM = 0x7FFFFFFF -} VkCommandBufferLevel; - -typedef enum VkIndexType { - VK_INDEX_TYPE_UINT16 = 0, - VK_INDEX_TYPE_UINT32 = 1, - VK_INDEX_TYPE_NONE_KHR = 1000165000, - VK_INDEX_TYPE_UINT8_EXT = 1000265000, - VK_INDEX_TYPE_NONE_NV = VK_INDEX_TYPE_NONE_KHR, - VK_INDEX_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkIndexType; - -typedef enum VkSubpassContents { - VK_SUBPASS_CONTENTS_INLINE = 0, - VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS = 1, - VK_SUBPASS_CONTENTS_MAX_ENUM = 0x7FFFFFFF -} VkSubpassContents; - -typedef enum VkAccessFlagBits { - VK_ACCESS_INDIRECT_COMMAND_READ_BIT = 0x00000001, - VK_ACCESS_INDEX_READ_BIT = 0x00000002, - VK_ACCESS_VERTEX_ATTRIBUTE_READ_BIT = 0x00000004, - VK_ACCESS_UNIFORM_READ_BIT = 0x00000008, - VK_ACCESS_INPUT_ATTACHMENT_READ_BIT = 0x00000010, - VK_ACCESS_SHADER_READ_BIT = 0x00000020, - VK_ACCESS_SHADER_WRITE_BIT = 0x00000040, - VK_ACCESS_COLOR_ATTACHMENT_READ_BIT = 0x00000080, - VK_ACCESS_COLOR_ATTACHMENT_WRITE_BIT = 0x00000100, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_READ_BIT = 0x00000200, - VK_ACCESS_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT = 0x00000400, - VK_ACCESS_TRANSFER_READ_BIT = 0x00000800, - VK_ACCESS_TRANSFER_WRITE_BIT = 0x00001000, - VK_ACCESS_HOST_READ_BIT = 0x00002000, - VK_ACCESS_HOST_WRITE_BIT = 0x00004000, - VK_ACCESS_MEMORY_READ_BIT = 0x00008000, - VK_ACCESS_MEMORY_WRITE_BIT = 0x00010000, - VK_ACCESS_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = 0x02000000, - VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = 0x04000000, - VK_ACCESS_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = 0x08000000, - VK_ACCESS_CONDITIONAL_RENDERING_READ_BIT_EXT = 0x00100000, - VK_ACCESS_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000, - VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR = 0x00200000, - VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR = 0x00400000, - VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV = 0x00800000, - VK_ACCESS_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000, - VK_ACCESS_COMMAND_PREPROCESS_READ_BIT_NV = 0x00020000, - VK_ACCESS_COMMAND_PREPROCESS_WRITE_BIT_NV = 0x00040000, - VK_ACCESS_NONE_KHR = 0, - VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_READ_BIT_KHR, - VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_NV = VK_ACCESS_ACCELERATION_STRUCTURE_WRITE_BIT_KHR, - VK_ACCESS_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR = VK_ACCESS_SHADING_RATE_IMAGE_READ_BIT_NV, - VK_ACCESS_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkAccessFlagBits; -typedef VkFlags VkAccessFlags; - -typedef enum VkImageAspectFlagBits { - VK_IMAGE_ASPECT_COLOR_BIT = 0x00000001, - VK_IMAGE_ASPECT_DEPTH_BIT = 0x00000002, - VK_IMAGE_ASPECT_STENCIL_BIT = 0x00000004, - VK_IMAGE_ASPECT_METADATA_BIT = 0x00000008, - VK_IMAGE_ASPECT_PLANE_0_BIT = 0x00000010, - VK_IMAGE_ASPECT_PLANE_1_BIT = 0x00000020, - VK_IMAGE_ASPECT_PLANE_2_BIT = 0x00000040, - VK_IMAGE_ASPECT_MEMORY_PLANE_0_BIT_EXT = 0x00000080, - VK_IMAGE_ASPECT_MEMORY_PLANE_1_BIT_EXT = 0x00000100, - VK_IMAGE_ASPECT_MEMORY_PLANE_2_BIT_EXT = 0x00000200, - VK_IMAGE_ASPECT_MEMORY_PLANE_3_BIT_EXT = 0x00000400, - VK_IMAGE_ASPECT_PLANE_0_BIT_KHR = VK_IMAGE_ASPECT_PLANE_0_BIT, - VK_IMAGE_ASPECT_PLANE_1_BIT_KHR = VK_IMAGE_ASPECT_PLANE_1_BIT, - VK_IMAGE_ASPECT_PLANE_2_BIT_KHR = VK_IMAGE_ASPECT_PLANE_2_BIT, - VK_IMAGE_ASPECT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkImageAspectFlagBits; -typedef VkFlags VkImageAspectFlags; - -typedef enum VkFormatFeatureFlagBits { - VK_FORMAT_FEATURE_SAMPLED_IMAGE_BIT = 0x00000001, - VK_FORMAT_FEATURE_STORAGE_IMAGE_BIT = 0x00000002, - VK_FORMAT_FEATURE_STORAGE_IMAGE_ATOMIC_BIT = 0x00000004, - VK_FORMAT_FEATURE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000008, - VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_BIT = 0x00000010, - VK_FORMAT_FEATURE_STORAGE_TEXEL_BUFFER_ATOMIC_BIT = 0x00000020, - VK_FORMAT_FEATURE_VERTEX_BUFFER_BIT = 0x00000040, - VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BIT = 0x00000080, - VK_FORMAT_FEATURE_COLOR_ATTACHMENT_BLEND_BIT = 0x00000100, - VK_FORMAT_FEATURE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000200, - VK_FORMAT_FEATURE_BLIT_SRC_BIT = 0x00000400, - VK_FORMAT_FEATURE_BLIT_DST_BIT = 0x00000800, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_LINEAR_BIT = 0x00001000, - VK_FORMAT_FEATURE_TRANSFER_SRC_BIT = 0x00004000, - VK_FORMAT_FEATURE_TRANSFER_DST_BIT = 0x00008000, - VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT = 0x00020000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT = 0x00040000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT = 0x00080000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT = 0x00100000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT = 0x00200000, - VK_FORMAT_FEATURE_DISJOINT_BIT = 0x00400000, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT = 0x00800000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT = 0x00010000, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG = 0x00002000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_FORMAT_FEATURE_VIDEO_DECODE_OUTPUT_BIT_KHR = 0x02000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_FORMAT_FEATURE_VIDEO_DECODE_DPB_BIT_KHR = 0x04000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_FORMAT_FEATURE_VIDEO_ENCODE_INPUT_BIT_KHR = 0x08000000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_FORMAT_FEATURE_VIDEO_ENCODE_DPB_BIT_KHR = 0x10000000, -#endif - VK_FORMAT_FEATURE_ACCELERATION_STRUCTURE_VERTEX_BUFFER_BIT_KHR = 0x20000000, - VK_FORMAT_FEATURE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x01000000, - VK_FORMAT_FEATURE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x40000000, - VK_FORMAT_FEATURE_TRANSFER_SRC_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_SRC_BIT, - VK_FORMAT_FEATURE_TRANSFER_DST_BIT_KHR = VK_FORMAT_FEATURE_TRANSFER_DST_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT_EXT = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_MINMAX_BIT, - VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_MIDPOINT_CHROMA_SAMPLES_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_LINEAR_FILTER_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_SEPARATE_RECONSTRUCTION_FILTER_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT_KHR = VK_FORMAT_FEATURE_SAMPLED_IMAGE_YCBCR_CONVERSION_CHROMA_RECONSTRUCTION_EXPLICIT_FORCEABLE_BIT, - VK_FORMAT_FEATURE_DISJOINT_BIT_KHR = VK_FORMAT_FEATURE_DISJOINT_BIT, - VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT_KHR = VK_FORMAT_FEATURE_COSITED_CHROMA_SAMPLES_BIT, - VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_EXT = VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG, - VK_FORMAT_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkFormatFeatureFlagBits; -typedef VkFlags VkFormatFeatureFlags; - -typedef enum VkImageCreateFlagBits { - VK_IMAGE_CREATE_SPARSE_BINDING_BIT = 0x00000001, - VK_IMAGE_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, - VK_IMAGE_CREATE_SPARSE_ALIASED_BIT = 0x00000004, - VK_IMAGE_CREATE_MUTABLE_FORMAT_BIT = 0x00000008, - VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT = 0x00000010, - VK_IMAGE_CREATE_ALIAS_BIT = 0x00000400, - VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT = 0x00000040, - VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT = 0x00000020, - VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT = 0x00000080, - VK_IMAGE_CREATE_EXTENDED_USAGE_BIT = 0x00000100, - VK_IMAGE_CREATE_PROTECTED_BIT = 0x00000800, - VK_IMAGE_CREATE_DISJOINT_BIT = 0x00000200, - VK_IMAGE_CREATE_CORNER_SAMPLED_BIT_NV = 0x00002000, - VK_IMAGE_CREATE_SAMPLE_LOCATIONS_COMPATIBLE_DEPTH_BIT_EXT = 0x00001000, - VK_IMAGE_CREATE_SUBSAMPLED_BIT_EXT = 0x00004000, - VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = VK_IMAGE_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT, - VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_2D_ARRAY_COMPATIBLE_BIT, - VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT_KHR = VK_IMAGE_CREATE_BLOCK_TEXEL_VIEW_COMPATIBLE_BIT, - VK_IMAGE_CREATE_EXTENDED_USAGE_BIT_KHR = VK_IMAGE_CREATE_EXTENDED_USAGE_BIT, - VK_IMAGE_CREATE_DISJOINT_BIT_KHR = VK_IMAGE_CREATE_DISJOINT_BIT, - VK_IMAGE_CREATE_ALIAS_BIT_KHR = VK_IMAGE_CREATE_ALIAS_BIT, - VK_IMAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkImageCreateFlagBits; -typedef VkFlags VkImageCreateFlags; - -typedef enum VkSampleCountFlagBits { - VK_SAMPLE_COUNT_1_BIT = 0x00000001, - VK_SAMPLE_COUNT_2_BIT = 0x00000002, - VK_SAMPLE_COUNT_4_BIT = 0x00000004, - VK_SAMPLE_COUNT_8_BIT = 0x00000008, - VK_SAMPLE_COUNT_16_BIT = 0x00000010, - VK_SAMPLE_COUNT_32_BIT = 0x00000020, - VK_SAMPLE_COUNT_64_BIT = 0x00000040, - VK_SAMPLE_COUNT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSampleCountFlagBits; -typedef VkFlags VkSampleCountFlags; - -typedef enum VkImageUsageFlagBits { - VK_IMAGE_USAGE_TRANSFER_SRC_BIT = 0x00000001, - VK_IMAGE_USAGE_TRANSFER_DST_BIT = 0x00000002, - VK_IMAGE_USAGE_SAMPLED_BIT = 0x00000004, - VK_IMAGE_USAGE_STORAGE_BIT = 0x00000008, - VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT = 0x00000010, - VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT = 0x00000020, - VK_IMAGE_USAGE_TRANSIENT_ATTACHMENT_BIT = 0x00000040, - VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT = 0x00000080, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00000400, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00000800, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_DECODE_DPB_BIT_KHR = 0x00001000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_ENCODE_DST_BIT_KHR = 0x00002000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_ENCODE_SRC_BIT_KHR = 0x00004000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_IMAGE_USAGE_VIDEO_ENCODE_DPB_BIT_KHR = 0x00008000, -#endif - VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00000100, - VK_IMAGE_USAGE_FRAGMENT_DENSITY_MAP_BIT_EXT = 0x00000200, - VK_IMAGE_USAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_IMAGE_USAGE_SHADING_RATE_IMAGE_BIT_NV, - VK_IMAGE_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkImageUsageFlagBits; -typedef VkFlags VkImageUsageFlags; -typedef VkFlags VkInstanceCreateFlags; - -typedef enum VkMemoryHeapFlagBits { - VK_MEMORY_HEAP_DEVICE_LOCAL_BIT = 0x00000001, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT = 0x00000002, - VK_MEMORY_HEAP_MULTI_INSTANCE_BIT_KHR = VK_MEMORY_HEAP_MULTI_INSTANCE_BIT, - VK_MEMORY_HEAP_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkMemoryHeapFlagBits; -typedef VkFlags VkMemoryHeapFlags; - -typedef enum VkMemoryPropertyFlagBits { - VK_MEMORY_PROPERTY_DEVICE_LOCAL_BIT = 0x00000001, - VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT = 0x00000002, - VK_MEMORY_PROPERTY_HOST_COHERENT_BIT = 0x00000004, - VK_MEMORY_PROPERTY_HOST_CACHED_BIT = 0x00000008, - VK_MEMORY_PROPERTY_LAZILY_ALLOCATED_BIT = 0x00000010, - VK_MEMORY_PROPERTY_PROTECTED_BIT = 0x00000020, - VK_MEMORY_PROPERTY_DEVICE_COHERENT_BIT_AMD = 0x00000040, - VK_MEMORY_PROPERTY_DEVICE_UNCACHED_BIT_AMD = 0x00000080, - VK_MEMORY_PROPERTY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkMemoryPropertyFlagBits; -typedef VkFlags VkMemoryPropertyFlags; - -typedef enum VkQueueFlagBits { - VK_QUEUE_GRAPHICS_BIT = 0x00000001, - VK_QUEUE_COMPUTE_BIT = 0x00000002, - VK_QUEUE_TRANSFER_BIT = 0x00000004, - VK_QUEUE_SPARSE_BINDING_BIT = 0x00000008, - VK_QUEUE_PROTECTED_BIT = 0x00000010, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUEUE_VIDEO_DECODE_BIT_KHR = 0x00000020, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUEUE_VIDEO_ENCODE_BIT_KHR = 0x00000040, -#endif - VK_QUEUE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkQueueFlagBits; -typedef VkFlags VkQueueFlags; -typedef VkFlags VkDeviceCreateFlags; - -typedef enum VkDeviceQueueCreateFlagBits { - VK_DEVICE_QUEUE_CREATE_PROTECTED_BIT = 0x00000001, - VK_DEVICE_QUEUE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkDeviceQueueCreateFlagBits; -typedef VkFlags VkDeviceQueueCreateFlags; - -typedef enum VkPipelineStageFlagBits { - VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT = 0x00000001, - VK_PIPELINE_STAGE_DRAW_INDIRECT_BIT = 0x00000002, - VK_PIPELINE_STAGE_VERTEX_INPUT_BIT = 0x00000004, - VK_PIPELINE_STAGE_VERTEX_SHADER_BIT = 0x00000008, - VK_PIPELINE_STAGE_TESSELLATION_CONTROL_SHADER_BIT = 0x00000010, - VK_PIPELINE_STAGE_TESSELLATION_EVALUATION_SHADER_BIT = 0x00000020, - VK_PIPELINE_STAGE_GEOMETRY_SHADER_BIT = 0x00000040, - VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT = 0x00000080, - VK_PIPELINE_STAGE_EARLY_FRAGMENT_TESTS_BIT = 0x00000100, - VK_PIPELINE_STAGE_LATE_FRAGMENT_TESTS_BIT = 0x00000200, - VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT = 0x00000400, - VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT = 0x00000800, - VK_PIPELINE_STAGE_TRANSFER_BIT = 0x00001000, - VK_PIPELINE_STAGE_BOTTOM_OF_PIPE_BIT = 0x00002000, - VK_PIPELINE_STAGE_HOST_BIT = 0x00004000, - VK_PIPELINE_STAGE_ALL_GRAPHICS_BIT = 0x00008000, - VK_PIPELINE_STAGE_ALL_COMMANDS_BIT = 0x00010000, - VK_PIPELINE_STAGE_TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000, - VK_PIPELINE_STAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000, - VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR = 0x02000000, - VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR = 0x00200000, - VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV = 0x00400000, - VK_PIPELINE_STAGE_TASK_SHADER_BIT_NV = 0x00080000, - VK_PIPELINE_STAGE_MESH_SHADER_BIT_NV = 0x00100000, - VK_PIPELINE_STAGE_FRAGMENT_DENSITY_PROCESS_BIT_EXT = 0x00800000, - VK_PIPELINE_STAGE_COMMAND_PREPROCESS_BIT_NV = 0x00020000, - VK_PIPELINE_STAGE_NONE_KHR = 0, - VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_NV = VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR, - VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_NV = VK_PIPELINE_STAGE_ACCELERATION_STRUCTURE_BUILD_BIT_KHR, - VK_PIPELINE_STAGE_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = VK_PIPELINE_STAGE_SHADING_RATE_IMAGE_BIT_NV, - VK_PIPELINE_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkPipelineStageFlagBits; -typedef VkFlags VkPipelineStageFlags; -typedef VkFlags VkMemoryMapFlags; - -typedef enum VkSparseMemoryBindFlagBits { - VK_SPARSE_MEMORY_BIND_METADATA_BIT = 0x00000001, - VK_SPARSE_MEMORY_BIND_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSparseMemoryBindFlagBits; -typedef VkFlags VkSparseMemoryBindFlags; - -typedef enum VkSparseImageFormatFlagBits { - VK_SPARSE_IMAGE_FORMAT_SINGLE_MIPTAIL_BIT = 0x00000001, - VK_SPARSE_IMAGE_FORMAT_ALIGNED_MIP_SIZE_BIT = 0x00000002, - VK_SPARSE_IMAGE_FORMAT_NONSTANDARD_BLOCK_SIZE_BIT = 0x00000004, - VK_SPARSE_IMAGE_FORMAT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSparseImageFormatFlagBits; -typedef VkFlags VkSparseImageFormatFlags; - -typedef enum VkFenceCreateFlagBits { - VK_FENCE_CREATE_SIGNALED_BIT = 0x00000001, - VK_FENCE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkFenceCreateFlagBits; -typedef VkFlags VkFenceCreateFlags; -typedef VkFlags VkSemaphoreCreateFlags; - -typedef enum VkEventCreateFlagBits { - VK_EVENT_CREATE_DEVICE_ONLY_BIT_KHR = 0x00000001, - VK_EVENT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkEventCreateFlagBits; -typedef VkFlags VkEventCreateFlags; - -typedef enum VkQueryPipelineStatisticFlagBits { - VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_VERTICES_BIT = 0x00000001, - VK_QUERY_PIPELINE_STATISTIC_INPUT_ASSEMBLY_PRIMITIVES_BIT = 0x00000002, - VK_QUERY_PIPELINE_STATISTIC_VERTEX_SHADER_INVOCATIONS_BIT = 0x00000004, - VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_INVOCATIONS_BIT = 0x00000008, - VK_QUERY_PIPELINE_STATISTIC_GEOMETRY_SHADER_PRIMITIVES_BIT = 0x00000010, - VK_QUERY_PIPELINE_STATISTIC_CLIPPING_INVOCATIONS_BIT = 0x00000020, - VK_QUERY_PIPELINE_STATISTIC_CLIPPING_PRIMITIVES_BIT = 0x00000040, - VK_QUERY_PIPELINE_STATISTIC_FRAGMENT_SHADER_INVOCATIONS_BIT = 0x00000080, - VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_CONTROL_SHADER_PATCHES_BIT = 0x00000100, - VK_QUERY_PIPELINE_STATISTIC_TESSELLATION_EVALUATION_SHADER_INVOCATIONS_BIT = 0x00000200, - VK_QUERY_PIPELINE_STATISTIC_COMPUTE_SHADER_INVOCATIONS_BIT = 0x00000400, - VK_QUERY_PIPELINE_STATISTIC_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkQueryPipelineStatisticFlagBits; -typedef VkFlags VkQueryPipelineStatisticFlags; -typedef VkFlags VkQueryPoolCreateFlags; - -typedef enum VkQueryResultFlagBits { - VK_QUERY_RESULT_64_BIT = 0x00000001, - VK_QUERY_RESULT_WAIT_BIT = 0x00000002, - VK_QUERY_RESULT_WITH_AVAILABILITY_BIT = 0x00000004, - VK_QUERY_RESULT_PARTIAL_BIT = 0x00000008, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_QUERY_RESULT_WITH_STATUS_BIT_KHR = 0x00000010, -#endif - VK_QUERY_RESULT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkQueryResultFlagBits; -typedef VkFlags VkQueryResultFlags; - -typedef enum VkBufferCreateFlagBits { - VK_BUFFER_CREATE_SPARSE_BINDING_BIT = 0x00000001, - VK_BUFFER_CREATE_SPARSE_RESIDENCY_BIT = 0x00000002, - VK_BUFFER_CREATE_SPARSE_ALIASED_BIT = 0x00000004, - VK_BUFFER_CREATE_PROTECTED_BIT = 0x00000008, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000010, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_EXT = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_BUFFER_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_BUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkBufferCreateFlagBits; -typedef VkFlags VkBufferCreateFlags; - -typedef enum VkBufferUsageFlagBits { - VK_BUFFER_USAGE_TRANSFER_SRC_BIT = 0x00000001, - VK_BUFFER_USAGE_TRANSFER_DST_BIT = 0x00000002, - VK_BUFFER_USAGE_UNIFORM_TEXEL_BUFFER_BIT = 0x00000004, - VK_BUFFER_USAGE_STORAGE_TEXEL_BUFFER_BIT = 0x00000008, - VK_BUFFER_USAGE_UNIFORM_BUFFER_BIT = 0x00000010, - VK_BUFFER_USAGE_STORAGE_BUFFER_BIT = 0x00000020, - VK_BUFFER_USAGE_INDEX_BUFFER_BIT = 0x00000040, - VK_BUFFER_USAGE_VERTEX_BUFFER_BIT = 0x00000080, - VK_BUFFER_USAGE_INDIRECT_BUFFER_BIT = 0x00000100, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT = 0x00020000, -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_BUFFER_USAGE_VIDEO_DECODE_SRC_BIT_KHR = 0x00002000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_BUFFER_USAGE_VIDEO_DECODE_DST_BIT_KHR = 0x00004000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_BUFFER_USAGE_VIDEO_ENCODE_DST_BIT_KHR = 0x00008000, -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS - VK_BUFFER_USAGE_VIDEO_ENCODE_SRC_BIT_KHR = 0x00010000, -#endif - VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_BUFFER_BIT_EXT = 0x00000800, - VK_BUFFER_USAGE_TRANSFORM_FEEDBACK_COUNTER_BUFFER_BIT_EXT = 0x00001000, - VK_BUFFER_USAGE_CONDITIONAL_RENDERING_BIT_EXT = 0x00000200, - VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_BUILD_INPUT_READ_ONLY_BIT_KHR = 0x00080000, - VK_BUFFER_USAGE_ACCELERATION_STRUCTURE_STORAGE_BIT_KHR = 0x00100000, - VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR = 0x00000400, - VK_BUFFER_USAGE_RAY_TRACING_BIT_NV = VK_BUFFER_USAGE_SHADER_BINDING_TABLE_BIT_KHR, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_EXT = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT_KHR = VK_BUFFER_USAGE_SHADER_DEVICE_ADDRESS_BIT, - VK_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkBufferUsageFlagBits; -typedef VkFlags VkBufferUsageFlags; -typedef VkFlags VkBufferViewCreateFlags; - -typedef enum VkImageViewCreateFlagBits { - VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DYNAMIC_BIT_EXT = 0x00000001, - VK_IMAGE_VIEW_CREATE_FRAGMENT_DENSITY_MAP_DEFERRED_BIT_EXT = 0x00000002, - VK_IMAGE_VIEW_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkImageViewCreateFlagBits; -typedef VkFlags VkImageViewCreateFlags; - -typedef enum VkShaderModuleCreateFlagBits { - VK_SHADER_MODULE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkShaderModuleCreateFlagBits; -typedef VkFlags VkShaderModuleCreateFlags; - -typedef enum VkPipelineCacheCreateFlagBits { - VK_PIPELINE_CACHE_CREATE_EXTERNALLY_SYNCHRONIZED_BIT_EXT = 0x00000001, - VK_PIPELINE_CACHE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkPipelineCacheCreateFlagBits; -typedef VkFlags VkPipelineCacheCreateFlags; - -typedef enum VkColorComponentFlagBits { - VK_COLOR_COMPONENT_R_BIT = 0x00000001, - VK_COLOR_COMPONENT_G_BIT = 0x00000002, - VK_COLOR_COMPONENT_B_BIT = 0x00000004, - VK_COLOR_COMPONENT_A_BIT = 0x00000008, - VK_COLOR_COMPONENT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkColorComponentFlagBits; -typedef VkFlags VkColorComponentFlags; - -typedef enum VkPipelineCreateFlagBits { - VK_PIPELINE_CREATE_DISABLE_OPTIMIZATION_BIT = 0x00000001, - VK_PIPELINE_CREATE_ALLOW_DERIVATIVES_BIT = 0x00000002, - VK_PIPELINE_CREATE_DERIVATIVE_BIT = 0x00000004, - VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT = 0x00000008, - VK_PIPELINE_CREATE_DISPATCH_BASE_BIT = 0x00000010, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_ANY_HIT_SHADERS_BIT_KHR = 0x00004000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_CLOSEST_HIT_SHADERS_BIT_KHR = 0x00008000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_MISS_SHADERS_BIT_KHR = 0x00010000, - VK_PIPELINE_CREATE_RAY_TRACING_NO_NULL_INTERSECTION_SHADERS_BIT_KHR = 0x00020000, - VK_PIPELINE_CREATE_RAY_TRACING_SKIP_TRIANGLES_BIT_KHR = 0x00001000, - VK_PIPELINE_CREATE_RAY_TRACING_SKIP_AABBS_BIT_KHR = 0x00002000, - VK_PIPELINE_CREATE_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR = 0x00080000, - VK_PIPELINE_CREATE_DEFER_COMPILE_BIT_NV = 0x00000020, - VK_PIPELINE_CREATE_CAPTURE_STATISTICS_BIT_KHR = 0x00000040, - VK_PIPELINE_CREATE_CAPTURE_INTERNAL_REPRESENTATIONS_BIT_KHR = 0x00000080, - VK_PIPELINE_CREATE_INDIRECT_BINDABLE_BIT_NV = 0x00040000, - VK_PIPELINE_CREATE_LIBRARY_BIT_KHR = 0x00000800, - VK_PIPELINE_CREATE_FAIL_ON_PIPELINE_COMPILE_REQUIRED_BIT_EXT = 0x00000100, - VK_PIPELINE_CREATE_EARLY_RETURN_ON_FAILURE_BIT_EXT = 0x00000200, - VK_PIPELINE_CREATE_DISPATCH_BASE = VK_PIPELINE_CREATE_DISPATCH_BASE_BIT, - VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT_KHR = VK_PIPELINE_CREATE_VIEW_INDEX_FROM_DEVICE_INDEX_BIT, - VK_PIPELINE_CREATE_DISPATCH_BASE_KHR = VK_PIPELINE_CREATE_DISPATCH_BASE, - VK_PIPELINE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkPipelineCreateFlagBits; -typedef VkFlags VkPipelineCreateFlags; - -typedef enum VkPipelineShaderStageCreateFlagBits { - VK_PIPELINE_SHADER_STAGE_CREATE_ALLOW_VARYING_SUBGROUP_SIZE_BIT_EXT = 0x00000001, - VK_PIPELINE_SHADER_STAGE_CREATE_REQUIRE_FULL_SUBGROUPS_BIT_EXT = 0x00000002, - VK_PIPELINE_SHADER_STAGE_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkPipelineShaderStageCreateFlagBits; -typedef VkFlags VkPipelineShaderStageCreateFlags; - -typedef enum VkShaderStageFlagBits { - VK_SHADER_STAGE_VERTEX_BIT = 0x00000001, - VK_SHADER_STAGE_TESSELLATION_CONTROL_BIT = 0x00000002, - VK_SHADER_STAGE_TESSELLATION_EVALUATION_BIT = 0x00000004, - VK_SHADER_STAGE_GEOMETRY_BIT = 0x00000008, - VK_SHADER_STAGE_FRAGMENT_BIT = 0x00000010, - VK_SHADER_STAGE_COMPUTE_BIT = 0x00000020, - VK_SHADER_STAGE_ALL_GRAPHICS = 0x0000001F, - VK_SHADER_STAGE_ALL = 0x7FFFFFFF, - VK_SHADER_STAGE_RAYGEN_BIT_KHR = 0x00000100, - VK_SHADER_STAGE_ANY_HIT_BIT_KHR = 0x00000200, - VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR = 0x00000400, - VK_SHADER_STAGE_MISS_BIT_KHR = 0x00000800, - VK_SHADER_STAGE_INTERSECTION_BIT_KHR = 0x00001000, - VK_SHADER_STAGE_CALLABLE_BIT_KHR = 0x00002000, - VK_SHADER_STAGE_TASK_BIT_NV = 0x00000040, - VK_SHADER_STAGE_MESH_BIT_NV = 0x00000080, - VK_SHADER_STAGE_RAYGEN_BIT_NV = VK_SHADER_STAGE_RAYGEN_BIT_KHR, - VK_SHADER_STAGE_ANY_HIT_BIT_NV = VK_SHADER_STAGE_ANY_HIT_BIT_KHR, - VK_SHADER_STAGE_CLOSEST_HIT_BIT_NV = VK_SHADER_STAGE_CLOSEST_HIT_BIT_KHR, - VK_SHADER_STAGE_MISS_BIT_NV = VK_SHADER_STAGE_MISS_BIT_KHR, - VK_SHADER_STAGE_INTERSECTION_BIT_NV = VK_SHADER_STAGE_INTERSECTION_BIT_KHR, - VK_SHADER_STAGE_CALLABLE_BIT_NV = VK_SHADER_STAGE_CALLABLE_BIT_KHR, - VK_SHADER_STAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkShaderStageFlagBits; - -typedef enum VkCullModeFlagBits { - VK_CULL_MODE_NONE = 0, - VK_CULL_MODE_FRONT_BIT = 0x00000001, - VK_CULL_MODE_BACK_BIT = 0x00000002, - VK_CULL_MODE_FRONT_AND_BACK = 0x00000003, - VK_CULL_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkCullModeFlagBits; -typedef VkFlags VkCullModeFlags; -typedef VkFlags VkPipelineVertexInputStateCreateFlags; -typedef VkFlags VkPipelineInputAssemblyStateCreateFlags; -typedef VkFlags VkPipelineTessellationStateCreateFlags; -typedef VkFlags VkPipelineViewportStateCreateFlags; -typedef VkFlags VkPipelineRasterizationStateCreateFlags; -typedef VkFlags VkPipelineMultisampleStateCreateFlags; -typedef VkFlags VkPipelineDepthStencilStateCreateFlags; -typedef VkFlags VkPipelineColorBlendStateCreateFlags; -typedef VkFlags VkPipelineDynamicStateCreateFlags; -typedef VkFlags VkPipelineLayoutCreateFlags; -typedef VkFlags VkShaderStageFlags; - -typedef enum VkSamplerCreateFlagBits { - VK_SAMPLER_CREATE_SUBSAMPLED_BIT_EXT = 0x00000001, - VK_SAMPLER_CREATE_SUBSAMPLED_COARSE_RECONSTRUCTION_BIT_EXT = 0x00000002, - VK_SAMPLER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSamplerCreateFlagBits; -typedef VkFlags VkSamplerCreateFlags; - -typedef enum VkDescriptorPoolCreateFlagBits { - VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT = 0x00000001, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT = 0x00000002, - VK_DESCRIPTOR_POOL_CREATE_HOST_ONLY_BIT_VALVE = 0x00000004, - VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_POOL_CREATE_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkDescriptorPoolCreateFlagBits; -typedef VkFlags VkDescriptorPoolCreateFlags; -typedef VkFlags VkDescriptorPoolResetFlags; - -typedef enum VkDescriptorSetLayoutCreateFlagBits { - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT = 0x00000002, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_PUSH_DESCRIPTOR_BIT_KHR = 0x00000001, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_HOST_ONLY_POOL_BIT_VALVE = 0x00000004, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT_EXT = VK_DESCRIPTOR_SET_LAYOUT_CREATE_UPDATE_AFTER_BIND_POOL_BIT, - VK_DESCRIPTOR_SET_LAYOUT_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkDescriptorSetLayoutCreateFlagBits; -typedef VkFlags VkDescriptorSetLayoutCreateFlags; - -typedef enum VkAttachmentDescriptionFlagBits { - VK_ATTACHMENT_DESCRIPTION_MAY_ALIAS_BIT = 0x00000001, - VK_ATTACHMENT_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkAttachmentDescriptionFlagBits; -typedef VkFlags VkAttachmentDescriptionFlags; - -typedef enum VkDependencyFlagBits { - VK_DEPENDENCY_BY_REGION_BIT = 0x00000001, - VK_DEPENDENCY_DEVICE_GROUP_BIT = 0x00000004, - VK_DEPENDENCY_VIEW_LOCAL_BIT = 0x00000002, - VK_DEPENDENCY_VIEW_LOCAL_BIT_KHR = VK_DEPENDENCY_VIEW_LOCAL_BIT, - VK_DEPENDENCY_DEVICE_GROUP_BIT_KHR = VK_DEPENDENCY_DEVICE_GROUP_BIT, - VK_DEPENDENCY_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkDependencyFlagBits; -typedef VkFlags VkDependencyFlags; - -typedef enum VkFramebufferCreateFlagBits { - VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT = 0x00000001, - VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT_KHR = VK_FRAMEBUFFER_CREATE_IMAGELESS_BIT, - VK_FRAMEBUFFER_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkFramebufferCreateFlagBits; -typedef VkFlags VkFramebufferCreateFlags; - -typedef enum VkRenderPassCreateFlagBits { - VK_RENDER_PASS_CREATE_TRANSFORM_BIT_QCOM = 0x00000002, - VK_RENDER_PASS_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkRenderPassCreateFlagBits; -typedef VkFlags VkRenderPassCreateFlags; - -typedef enum VkSubpassDescriptionFlagBits { - VK_SUBPASS_DESCRIPTION_PER_VIEW_ATTRIBUTES_BIT_NVX = 0x00000001, - VK_SUBPASS_DESCRIPTION_PER_VIEW_POSITION_X_ONLY_BIT_NVX = 0x00000002, - VK_SUBPASS_DESCRIPTION_FRAGMENT_REGION_BIT_QCOM = 0x00000004, - VK_SUBPASS_DESCRIPTION_SHADER_RESOLVE_BIT_QCOM = 0x00000008, - VK_SUBPASS_DESCRIPTION_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSubpassDescriptionFlagBits; -typedef VkFlags VkSubpassDescriptionFlags; - -typedef enum VkCommandPoolCreateFlagBits { - VK_COMMAND_POOL_CREATE_TRANSIENT_BIT = 0x00000001, - VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT = 0x00000002, - VK_COMMAND_POOL_CREATE_PROTECTED_BIT = 0x00000004, - VK_COMMAND_POOL_CREATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkCommandPoolCreateFlagBits; -typedef VkFlags VkCommandPoolCreateFlags; - -typedef enum VkCommandPoolResetFlagBits { - VK_COMMAND_POOL_RESET_RELEASE_RESOURCES_BIT = 0x00000001, - VK_COMMAND_POOL_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkCommandPoolResetFlagBits; -typedef VkFlags VkCommandPoolResetFlags; - -typedef enum VkCommandBufferUsageFlagBits { - VK_COMMAND_BUFFER_USAGE_ONE_TIME_SUBMIT_BIT = 0x00000001, - VK_COMMAND_BUFFER_USAGE_RENDER_PASS_CONTINUE_BIT = 0x00000002, - VK_COMMAND_BUFFER_USAGE_SIMULTANEOUS_USE_BIT = 0x00000004, - VK_COMMAND_BUFFER_USAGE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkCommandBufferUsageFlagBits; -typedef VkFlags VkCommandBufferUsageFlags; - -typedef enum VkQueryControlFlagBits { - VK_QUERY_CONTROL_PRECISE_BIT = 0x00000001, - VK_QUERY_CONTROL_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkQueryControlFlagBits; -typedef VkFlags VkQueryControlFlags; - -typedef enum VkCommandBufferResetFlagBits { - VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT = 0x00000001, - VK_COMMAND_BUFFER_RESET_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkCommandBufferResetFlagBits; -typedef VkFlags VkCommandBufferResetFlags; - -typedef enum VkStencilFaceFlagBits { - VK_STENCIL_FACE_FRONT_BIT = 0x00000001, - VK_STENCIL_FACE_BACK_BIT = 0x00000002, - VK_STENCIL_FACE_FRONT_AND_BACK = 0x00000003, - VK_STENCIL_FRONT_AND_BACK = VK_STENCIL_FACE_FRONT_AND_BACK, - VK_STENCIL_FACE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkStencilFaceFlagBits; -typedef VkFlags VkStencilFaceFlags; -typedef struct VkExtent2D { - uint32_t width; - uint32_t height; -} VkExtent2D; - -typedef struct VkExtent3D { - uint32_t width; - uint32_t height; - uint32_t depth; -} VkExtent3D; - -typedef struct VkOffset2D { - int32_t x; - int32_t y; -} VkOffset2D; - -typedef struct VkOffset3D { - int32_t x; - int32_t y; - int32_t z; -} VkOffset3D; - -typedef struct VkRect2D { - VkOffset2D offset; - VkExtent2D extent; -} VkRect2D; - -typedef struct VkBaseInStructure { - VkStructureType sType; - const struct VkBaseInStructure* pNext; -} VkBaseInStructure; - -typedef struct VkBaseOutStructure { - VkStructureType sType; - struct VkBaseOutStructure* pNext; -} VkBaseOutStructure; - -typedef struct VkBufferMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize size; -} VkBufferMemoryBarrier; - -typedef struct VkDispatchIndirectCommand { - uint32_t x; - uint32_t y; - uint32_t z; -} VkDispatchIndirectCommand; - -typedef struct VkDrawIndexedIndirectCommand { - uint32_t indexCount; - uint32_t instanceCount; - uint32_t firstIndex; - int32_t vertexOffset; - uint32_t firstInstance; -} VkDrawIndexedIndirectCommand; - -typedef struct VkDrawIndirectCommand { - uint32_t vertexCount; - uint32_t instanceCount; - uint32_t firstVertex; - uint32_t firstInstance; -} VkDrawIndirectCommand; - -typedef struct VkImageSubresourceRange { - VkImageAspectFlags aspectMask; - uint32_t baseMipLevel; - uint32_t levelCount; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceRange; - -typedef struct VkImageMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier; - -typedef struct VkMemoryBarrier { - VkStructureType sType; - const void* pNext; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; -} VkMemoryBarrier; - -typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)( - void* pUserData, - size_t size, - size_t alignment, - VkSystemAllocationScope allocationScope); - -typedef void (VKAPI_PTR *PFN_vkFreeFunction)( - void* pUserData, - void* pMemory); - -typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)( - void* pUserData, - size_t size, - VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope); - -typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)( - void* pUserData, - size_t size, - VkInternalAllocationType allocationType, - VkSystemAllocationScope allocationScope); - -typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)( - void* pUserData, - void* pOriginal, - size_t size, - size_t alignment, - VkSystemAllocationScope allocationScope); - -typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); -typedef struct VkAllocationCallbacks { - void* pUserData; - PFN_vkAllocationFunction pfnAllocation; - PFN_vkReallocationFunction pfnReallocation; - PFN_vkFreeFunction pfnFree; - PFN_vkInternalAllocationNotification pfnInternalAllocation; - PFN_vkInternalFreeNotification pfnInternalFree; -} VkAllocationCallbacks; - -typedef struct VkApplicationInfo { - VkStructureType sType; - const void* pNext; - const char* pApplicationName; - uint32_t applicationVersion; - const char* pEngineName; - uint32_t engineVersion; - uint32_t apiVersion; -} VkApplicationInfo; - -typedef struct VkFormatProperties { - VkFormatFeatureFlags linearTilingFeatures; - VkFormatFeatureFlags optimalTilingFeatures; - VkFormatFeatureFlags bufferFeatures; -} VkFormatProperties; - -typedef struct VkImageFormatProperties { - VkExtent3D maxExtent; - uint32_t maxMipLevels; - uint32_t maxArrayLayers; - VkSampleCountFlags sampleCounts; - VkDeviceSize maxResourceSize; -} VkImageFormatProperties; - -typedef struct VkInstanceCreateInfo { - VkStructureType sType; - const void* pNext; - VkInstanceCreateFlags flags; - const VkApplicationInfo* pApplicationInfo; - uint32_t enabledLayerCount; - const char* const* ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char* const* ppEnabledExtensionNames; -} VkInstanceCreateInfo; - -typedef struct VkMemoryHeap { - VkDeviceSize size; - VkMemoryHeapFlags flags; -} VkMemoryHeap; - -typedef struct VkMemoryType { - VkMemoryPropertyFlags propertyFlags; - uint32_t heapIndex; -} VkMemoryType; - -typedef struct VkPhysicalDeviceFeatures { - VkBool32 robustBufferAccess; - VkBool32 fullDrawIndexUint32; - VkBool32 imageCubeArray; - VkBool32 independentBlend; - VkBool32 geometryShader; - VkBool32 tessellationShader; - VkBool32 sampleRateShading; - VkBool32 dualSrcBlend; - VkBool32 logicOp; - VkBool32 multiDrawIndirect; - VkBool32 drawIndirectFirstInstance; - VkBool32 depthClamp; - VkBool32 depthBiasClamp; - VkBool32 fillModeNonSolid; - VkBool32 depthBounds; - VkBool32 wideLines; - VkBool32 largePoints; - VkBool32 alphaToOne; - VkBool32 multiViewport; - VkBool32 samplerAnisotropy; - VkBool32 textureCompressionETC2; - VkBool32 textureCompressionASTC_LDR; - VkBool32 textureCompressionBC; - VkBool32 occlusionQueryPrecise; - VkBool32 pipelineStatisticsQuery; - VkBool32 vertexPipelineStoresAndAtomics; - VkBool32 fragmentStoresAndAtomics; - VkBool32 shaderTessellationAndGeometryPointSize; - VkBool32 shaderImageGatherExtended; - VkBool32 shaderStorageImageExtendedFormats; - VkBool32 shaderStorageImageMultisample; - VkBool32 shaderStorageImageReadWithoutFormat; - VkBool32 shaderStorageImageWriteWithoutFormat; - VkBool32 shaderUniformBufferArrayDynamicIndexing; - VkBool32 shaderSampledImageArrayDynamicIndexing; - VkBool32 shaderStorageBufferArrayDynamicIndexing; - VkBool32 shaderStorageImageArrayDynamicIndexing; - VkBool32 shaderClipDistance; - VkBool32 shaderCullDistance; - VkBool32 shaderFloat64; - VkBool32 shaderInt64; - VkBool32 shaderInt16; - VkBool32 shaderResourceResidency; - VkBool32 shaderResourceMinLod; - VkBool32 sparseBinding; - VkBool32 sparseResidencyBuffer; - VkBool32 sparseResidencyImage2D; - VkBool32 sparseResidencyImage3D; - VkBool32 sparseResidency2Samples; - VkBool32 sparseResidency4Samples; - VkBool32 sparseResidency8Samples; - VkBool32 sparseResidency16Samples; - VkBool32 sparseResidencyAliased; - VkBool32 variableMultisampleRate; - VkBool32 inheritedQueries; -} VkPhysicalDeviceFeatures; - -typedef struct VkPhysicalDeviceLimits { - uint32_t maxImageDimension1D; - uint32_t maxImageDimension2D; - uint32_t maxImageDimension3D; - uint32_t maxImageDimensionCube; - uint32_t maxImageArrayLayers; - uint32_t maxTexelBufferElements; - uint32_t maxUniformBufferRange; - uint32_t maxStorageBufferRange; - uint32_t maxPushConstantsSize; - uint32_t maxMemoryAllocationCount; - uint32_t maxSamplerAllocationCount; - VkDeviceSize bufferImageGranularity; - VkDeviceSize sparseAddressSpaceSize; - uint32_t maxBoundDescriptorSets; - uint32_t maxPerStageDescriptorSamplers; - uint32_t maxPerStageDescriptorUniformBuffers; - uint32_t maxPerStageDescriptorStorageBuffers; - uint32_t maxPerStageDescriptorSampledImages; - uint32_t maxPerStageDescriptorStorageImages; - uint32_t maxPerStageDescriptorInputAttachments; - uint32_t maxPerStageResources; - uint32_t maxDescriptorSetSamplers; - uint32_t maxDescriptorSetUniformBuffers; - uint32_t maxDescriptorSetUniformBuffersDynamic; - uint32_t maxDescriptorSetStorageBuffers; - uint32_t maxDescriptorSetStorageBuffersDynamic; - uint32_t maxDescriptorSetSampledImages; - uint32_t maxDescriptorSetStorageImages; - uint32_t maxDescriptorSetInputAttachments; - uint32_t maxVertexInputAttributes; - uint32_t maxVertexInputBindings; - uint32_t maxVertexInputAttributeOffset; - uint32_t maxVertexInputBindingStride; - uint32_t maxVertexOutputComponents; - uint32_t maxTessellationGenerationLevel; - uint32_t maxTessellationPatchSize; - uint32_t maxTessellationControlPerVertexInputComponents; - uint32_t maxTessellationControlPerVertexOutputComponents; - uint32_t maxTessellationControlPerPatchOutputComponents; - uint32_t maxTessellationControlTotalOutputComponents; - uint32_t maxTessellationEvaluationInputComponents; - uint32_t maxTessellationEvaluationOutputComponents; - uint32_t maxGeometryShaderInvocations; - uint32_t maxGeometryInputComponents; - uint32_t maxGeometryOutputComponents; - uint32_t maxGeometryOutputVertices; - uint32_t maxGeometryTotalOutputComponents; - uint32_t maxFragmentInputComponents; - uint32_t maxFragmentOutputAttachments; - uint32_t maxFragmentDualSrcAttachments; - uint32_t maxFragmentCombinedOutputResources; - uint32_t maxComputeSharedMemorySize; - uint32_t maxComputeWorkGroupCount[3]; - uint32_t maxComputeWorkGroupInvocations; - uint32_t maxComputeWorkGroupSize[3]; - uint32_t subPixelPrecisionBits; - uint32_t subTexelPrecisionBits; - uint32_t mipmapPrecisionBits; - uint32_t maxDrawIndexedIndexValue; - uint32_t maxDrawIndirectCount; - float maxSamplerLodBias; - float maxSamplerAnisotropy; - uint32_t maxViewports; - uint32_t maxViewportDimensions[2]; - float viewportBoundsRange[2]; - uint32_t viewportSubPixelBits; - size_t minMemoryMapAlignment; - VkDeviceSize minTexelBufferOffsetAlignment; - VkDeviceSize minUniformBufferOffsetAlignment; - VkDeviceSize minStorageBufferOffsetAlignment; - int32_t minTexelOffset; - uint32_t maxTexelOffset; - int32_t minTexelGatherOffset; - uint32_t maxTexelGatherOffset; - float minInterpolationOffset; - float maxInterpolationOffset; - uint32_t subPixelInterpolationOffsetBits; - uint32_t maxFramebufferWidth; - uint32_t maxFramebufferHeight; - uint32_t maxFramebufferLayers; - VkSampleCountFlags framebufferColorSampleCounts; - VkSampleCountFlags framebufferDepthSampleCounts; - VkSampleCountFlags framebufferStencilSampleCounts; - VkSampleCountFlags framebufferNoAttachmentsSampleCounts; - uint32_t maxColorAttachments; - VkSampleCountFlags sampledImageColorSampleCounts; - VkSampleCountFlags sampledImageIntegerSampleCounts; - VkSampleCountFlags sampledImageDepthSampleCounts; - VkSampleCountFlags sampledImageStencilSampleCounts; - VkSampleCountFlags storageImageSampleCounts; - uint32_t maxSampleMaskWords; - VkBool32 timestampComputeAndGraphics; - float timestampPeriod; - uint32_t maxClipDistances; - uint32_t maxCullDistances; - uint32_t maxCombinedClipAndCullDistances; - uint32_t discreteQueuePriorities; - float pointSizeRange[2]; - float lineWidthRange[2]; - float pointSizeGranularity; - float lineWidthGranularity; - VkBool32 strictLines; - VkBool32 standardSampleLocations; - VkDeviceSize optimalBufferCopyOffsetAlignment; - VkDeviceSize optimalBufferCopyRowPitchAlignment; - VkDeviceSize nonCoherentAtomSize; -} VkPhysicalDeviceLimits; - -typedef struct VkPhysicalDeviceMemoryProperties { - uint32_t memoryTypeCount; - VkMemoryType memoryTypes[VK_MAX_MEMORY_TYPES]; - uint32_t memoryHeapCount; - VkMemoryHeap memoryHeaps[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryProperties; - -typedef struct VkPhysicalDeviceSparseProperties { - VkBool32 residencyStandard2DBlockShape; - VkBool32 residencyStandard2DMultisampleBlockShape; - VkBool32 residencyStandard3DBlockShape; - VkBool32 residencyAlignedMipSize; - VkBool32 residencyNonResidentStrict; -} VkPhysicalDeviceSparseProperties; - -typedef struct VkPhysicalDeviceProperties { - uint32_t apiVersion; - uint32_t driverVersion; - uint32_t vendorID; - uint32_t deviceID; - VkPhysicalDeviceType deviceType; - char deviceName[VK_MAX_PHYSICAL_DEVICE_NAME_SIZE]; - uint8_t pipelineCacheUUID[VK_UUID_SIZE]; - VkPhysicalDeviceLimits limits; - VkPhysicalDeviceSparseProperties sparseProperties; -} VkPhysicalDeviceProperties; - -typedef struct VkQueueFamilyProperties { - VkQueueFlags queueFlags; - uint32_t queueCount; - uint32_t timestampValidBits; - VkExtent3D minImageTransferGranularity; -} VkQueueFamilyProperties; - -typedef struct VkDeviceQueueCreateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueCount; - const float* pQueuePriorities; -} VkDeviceQueueCreateInfo; - -typedef struct VkDeviceCreateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceCreateFlags flags; - uint32_t queueCreateInfoCount; - const VkDeviceQueueCreateInfo* pQueueCreateInfos; - uint32_t enabledLayerCount; - const char* const* ppEnabledLayerNames; - uint32_t enabledExtensionCount; - const char* const* ppEnabledExtensionNames; - const VkPhysicalDeviceFeatures* pEnabledFeatures; -} VkDeviceCreateInfo; - -typedef struct VkExtensionProperties { - char extensionName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; -} VkExtensionProperties; - -typedef struct VkLayerProperties { - char layerName[VK_MAX_EXTENSION_NAME_SIZE]; - uint32_t specVersion; - uint32_t implementationVersion; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkLayerProperties; - -typedef struct VkSubmitInfo { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore* pWaitSemaphores; - const VkPipelineStageFlags* pWaitDstStageMask; - uint32_t commandBufferCount; - const VkCommandBuffer* pCommandBuffers; - uint32_t signalSemaphoreCount; - const VkSemaphore* pSignalSemaphores; -} VkSubmitInfo; - -typedef struct VkMappedMemoryRange { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; - VkDeviceSize offset; - VkDeviceSize size; -} VkMappedMemoryRange; - -typedef struct VkMemoryAllocateInfo { - VkStructureType sType; - const void* pNext; - VkDeviceSize allocationSize; - uint32_t memoryTypeIndex; -} VkMemoryAllocateInfo; - -typedef struct VkMemoryRequirements { - VkDeviceSize size; - VkDeviceSize alignment; - uint32_t memoryTypeBits; -} VkMemoryRequirements; - -typedef struct VkSparseMemoryBind { - VkDeviceSize resourceOffset; - VkDeviceSize size; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseMemoryBind; - -typedef struct VkSparseBufferMemoryBindInfo { - VkBuffer buffer; - uint32_t bindCount; - const VkSparseMemoryBind* pBinds; -} VkSparseBufferMemoryBindInfo; - -typedef struct VkSparseImageOpaqueMemoryBindInfo { - VkImage image; - uint32_t bindCount; - const VkSparseMemoryBind* pBinds; -} VkSparseImageOpaqueMemoryBindInfo; - -typedef struct VkImageSubresource { - VkImageAspectFlags aspectMask; - uint32_t mipLevel; - uint32_t arrayLayer; -} VkImageSubresource; - -typedef struct VkSparseImageMemoryBind { - VkImageSubresource subresource; - VkOffset3D offset; - VkExtent3D extent; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - VkSparseMemoryBindFlags flags; -} VkSparseImageMemoryBind; - -typedef struct VkSparseImageMemoryBindInfo { - VkImage image; - uint32_t bindCount; - const VkSparseImageMemoryBind* pBinds; -} VkSparseImageMemoryBindInfo; - -typedef struct VkBindSparseInfo { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore* pWaitSemaphores; - uint32_t bufferBindCount; - const VkSparseBufferMemoryBindInfo* pBufferBinds; - uint32_t imageOpaqueBindCount; - const VkSparseImageOpaqueMemoryBindInfo* pImageOpaqueBinds; - uint32_t imageBindCount; - const VkSparseImageMemoryBindInfo* pImageBinds; - uint32_t signalSemaphoreCount; - const VkSemaphore* pSignalSemaphores; -} VkBindSparseInfo; - -typedef struct VkSparseImageFormatProperties { - VkImageAspectFlags aspectMask; - VkExtent3D imageGranularity; - VkSparseImageFormatFlags flags; -} VkSparseImageFormatProperties; - -typedef struct VkSparseImageMemoryRequirements { - VkSparseImageFormatProperties formatProperties; - uint32_t imageMipTailFirstLod; - VkDeviceSize imageMipTailSize; - VkDeviceSize imageMipTailOffset; - VkDeviceSize imageMipTailStride; -} VkSparseImageMemoryRequirements; - -typedef struct VkFenceCreateInfo { - VkStructureType sType; - const void* pNext; - VkFenceCreateFlags flags; -} VkFenceCreateInfo; - -typedef struct VkSemaphoreCreateInfo { - VkStructureType sType; - const void* pNext; - VkSemaphoreCreateFlags flags; -} VkSemaphoreCreateInfo; - -typedef struct VkEventCreateInfo { - VkStructureType sType; - const void* pNext; - VkEventCreateFlags flags; -} VkEventCreateInfo; - -typedef struct VkQueryPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkQueryPoolCreateFlags flags; - VkQueryType queryType; - uint32_t queryCount; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkQueryPoolCreateInfo; - -typedef struct VkBufferCreateInfo { - VkStructureType sType; - const void* pNext; - VkBufferCreateFlags flags; - VkDeviceSize size; - VkBufferUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; -} VkBufferCreateInfo; - -typedef struct VkBufferViewCreateInfo { - VkStructureType sType; - const void* pNext; - VkBufferViewCreateFlags flags; - VkBuffer buffer; - VkFormat format; - VkDeviceSize offset; - VkDeviceSize range; -} VkBufferViewCreateInfo; - -typedef struct VkImageCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageCreateFlags flags; - VkImageType imageType; - VkFormat format; - VkExtent3D extent; - uint32_t mipLevels; - uint32_t arrayLayers; - VkSampleCountFlagBits samples; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; - VkImageLayout initialLayout; -} VkImageCreateInfo; - -typedef struct VkSubresourceLayout { - VkDeviceSize offset; - VkDeviceSize size; - VkDeviceSize rowPitch; - VkDeviceSize arrayPitch; - VkDeviceSize depthPitch; -} VkSubresourceLayout; - -typedef struct VkComponentMapping { - VkComponentSwizzle r; - VkComponentSwizzle g; - VkComponentSwizzle b; - VkComponentSwizzle a; -} VkComponentMapping; - -typedef struct VkImageViewCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageViewCreateFlags flags; - VkImage image; - VkImageViewType viewType; - VkFormat format; - VkComponentMapping components; - VkImageSubresourceRange subresourceRange; -} VkImageViewCreateInfo; - -typedef struct VkShaderModuleCreateInfo { - VkStructureType sType; - const void* pNext; - VkShaderModuleCreateFlags flags; - size_t codeSize; - const uint32_t* pCode; -} VkShaderModuleCreateInfo; - -typedef struct VkPipelineCacheCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCacheCreateFlags flags; - size_t initialDataSize; - const void* pInitialData; -} VkPipelineCacheCreateInfo; - -typedef struct VkSpecializationMapEntry { - uint32_t constantID; - uint32_t offset; - size_t size; -} VkSpecializationMapEntry; - -typedef struct VkSpecializationInfo { - uint32_t mapEntryCount; - const VkSpecializationMapEntry* pMapEntries; - size_t dataSize; - const void* pData; -} VkSpecializationInfo; - -typedef struct VkPipelineShaderStageCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineShaderStageCreateFlags flags; - VkShaderStageFlagBits stage; - VkShaderModule module; - const char* pName; - const VkSpecializationInfo* pSpecializationInfo; -} VkPipelineShaderStageCreateInfo; - -typedef struct VkComputePipelineCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - VkPipelineShaderStageCreateInfo stage; - VkPipelineLayout layout; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkComputePipelineCreateInfo; - -typedef struct VkVertexInputBindingDescription { - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; -} VkVertexInputBindingDescription; - -typedef struct VkVertexInputAttributeDescription { - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription; - -typedef struct VkPipelineVertexInputStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineVertexInputStateCreateFlags flags; - uint32_t vertexBindingDescriptionCount; - const VkVertexInputBindingDescription* pVertexBindingDescriptions; - uint32_t vertexAttributeDescriptionCount; - const VkVertexInputAttributeDescription* pVertexAttributeDescriptions; -} VkPipelineVertexInputStateCreateInfo; - -typedef struct VkPipelineInputAssemblyStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineInputAssemblyStateCreateFlags flags; - VkPrimitiveTopology topology; - VkBool32 primitiveRestartEnable; -} VkPipelineInputAssemblyStateCreateInfo; - -typedef struct VkPipelineTessellationStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineTessellationStateCreateFlags flags; - uint32_t patchControlPoints; -} VkPipelineTessellationStateCreateInfo; - -typedef struct VkViewport { - float x; - float y; - float width; - float height; - float minDepth; - float maxDepth; -} VkViewport; - -typedef struct VkPipelineViewportStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineViewportStateCreateFlags flags; - uint32_t viewportCount; - const VkViewport* pViewports; - uint32_t scissorCount; - const VkRect2D* pScissors; -} VkPipelineViewportStateCreateInfo; - -typedef struct VkPipelineRasterizationStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineRasterizationStateCreateFlags flags; - VkBool32 depthClampEnable; - VkBool32 rasterizerDiscardEnable; - VkPolygonMode polygonMode; - VkCullModeFlags cullMode; - VkFrontFace frontFace; - VkBool32 depthBiasEnable; - float depthBiasConstantFactor; - float depthBiasClamp; - float depthBiasSlopeFactor; - float lineWidth; -} VkPipelineRasterizationStateCreateInfo; - -typedef struct VkPipelineMultisampleStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineMultisampleStateCreateFlags flags; - VkSampleCountFlagBits rasterizationSamples; - VkBool32 sampleShadingEnable; - float minSampleShading; - const VkSampleMask* pSampleMask; - VkBool32 alphaToCoverageEnable; - VkBool32 alphaToOneEnable; -} VkPipelineMultisampleStateCreateInfo; - -typedef struct VkStencilOpState { - VkStencilOp failOp; - VkStencilOp passOp; - VkStencilOp depthFailOp; - VkCompareOp compareOp; - uint32_t compareMask; - uint32_t writeMask; - uint32_t reference; -} VkStencilOpState; - -typedef struct VkPipelineDepthStencilStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineDepthStencilStateCreateFlags flags; - VkBool32 depthTestEnable; - VkBool32 depthWriteEnable; - VkCompareOp depthCompareOp; - VkBool32 depthBoundsTestEnable; - VkBool32 stencilTestEnable; - VkStencilOpState front; - VkStencilOpState back; - float minDepthBounds; - float maxDepthBounds; -} VkPipelineDepthStencilStateCreateInfo; - -typedef struct VkPipelineColorBlendAttachmentState { - VkBool32 blendEnable; - VkBlendFactor srcColorBlendFactor; - VkBlendFactor dstColorBlendFactor; - VkBlendOp colorBlendOp; - VkBlendFactor srcAlphaBlendFactor; - VkBlendFactor dstAlphaBlendFactor; - VkBlendOp alphaBlendOp; - VkColorComponentFlags colorWriteMask; -} VkPipelineColorBlendAttachmentState; - -typedef struct VkPipelineColorBlendStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineColorBlendStateCreateFlags flags; - VkBool32 logicOpEnable; - VkLogicOp logicOp; - uint32_t attachmentCount; - const VkPipelineColorBlendAttachmentState* pAttachments; - float blendConstants[4]; -} VkPipelineColorBlendStateCreateInfo; - -typedef struct VkPipelineDynamicStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineDynamicStateCreateFlags flags; - uint32_t dynamicStateCount; - const VkDynamicState* pDynamicStates; -} VkPipelineDynamicStateCreateInfo; - -typedef struct VkGraphicsPipelineCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo* pStages; - const VkPipelineVertexInputStateCreateInfo* pVertexInputState; - const VkPipelineInputAssemblyStateCreateInfo* pInputAssemblyState; - const VkPipelineTessellationStateCreateInfo* pTessellationState; - const VkPipelineViewportStateCreateInfo* pViewportState; - const VkPipelineRasterizationStateCreateInfo* pRasterizationState; - const VkPipelineMultisampleStateCreateInfo* pMultisampleState; - const VkPipelineDepthStencilStateCreateInfo* pDepthStencilState; - const VkPipelineColorBlendStateCreateInfo* pColorBlendState; - const VkPipelineDynamicStateCreateInfo* pDynamicState; - VkPipelineLayout layout; - VkRenderPass renderPass; - uint32_t subpass; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkGraphicsPipelineCreateInfo; - -typedef struct VkPushConstantRange { - VkShaderStageFlags stageFlags; - uint32_t offset; - uint32_t size; -} VkPushConstantRange; - -typedef struct VkPipelineLayoutCreateInfo { - VkStructureType sType; - const void* pNext; - VkPipelineLayoutCreateFlags flags; - uint32_t setLayoutCount; - const VkDescriptorSetLayout* pSetLayouts; - uint32_t pushConstantRangeCount; - const VkPushConstantRange* pPushConstantRanges; -} VkPipelineLayoutCreateInfo; - -typedef struct VkSamplerCreateInfo { - VkStructureType sType; - const void* pNext; - VkSamplerCreateFlags flags; - VkFilter magFilter; - VkFilter minFilter; - VkSamplerMipmapMode mipmapMode; - VkSamplerAddressMode addressModeU; - VkSamplerAddressMode addressModeV; - VkSamplerAddressMode addressModeW; - float mipLodBias; - VkBool32 anisotropyEnable; - float maxAnisotropy; - VkBool32 compareEnable; - VkCompareOp compareOp; - float minLod; - float maxLod; - VkBorderColor borderColor; - VkBool32 unnormalizedCoordinates; -} VkSamplerCreateInfo; - -typedef struct VkCopyDescriptorSet { - VkStructureType sType; - const void* pNext; - VkDescriptorSet srcSet; - uint32_t srcBinding; - uint32_t srcArrayElement; - VkDescriptorSet dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; -} VkCopyDescriptorSet; - -typedef struct VkDescriptorBufferInfo { - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize range; -} VkDescriptorBufferInfo; - -typedef struct VkDescriptorImageInfo { - VkSampler sampler; - VkImageView imageView; - VkImageLayout imageLayout; -} VkDescriptorImageInfo; - -typedef struct VkDescriptorPoolSize { - VkDescriptorType type; - uint32_t descriptorCount; -} VkDescriptorPoolSize; - -typedef struct VkDescriptorPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorPoolCreateFlags flags; - uint32_t maxSets; - uint32_t poolSizeCount; - const VkDescriptorPoolSize* pPoolSizes; -} VkDescriptorPoolCreateInfo; - -typedef struct VkDescriptorSetAllocateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorPool descriptorPool; - uint32_t descriptorSetCount; - const VkDescriptorSetLayout* pSetLayouts; -} VkDescriptorSetAllocateInfo; - -typedef struct VkDescriptorSetLayoutBinding { - uint32_t binding; - VkDescriptorType descriptorType; - uint32_t descriptorCount; - VkShaderStageFlags stageFlags; - const VkSampler* pImmutableSamplers; -} VkDescriptorSetLayoutBinding; - -typedef struct VkDescriptorSetLayoutCreateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorSetLayoutCreateFlags flags; - uint32_t bindingCount; - const VkDescriptorSetLayoutBinding* pBindings; -} VkDescriptorSetLayoutCreateInfo; - -typedef struct VkWriteDescriptorSet { - VkStructureType sType; - const void* pNext; - VkDescriptorSet dstSet; - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - const VkDescriptorImageInfo* pImageInfo; - const VkDescriptorBufferInfo* pBufferInfo; - const VkBufferView* pTexelBufferView; -} VkWriteDescriptorSet; - -typedef struct VkAttachmentDescription { - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription; - -typedef struct VkAttachmentReference { - uint32_t attachment; - VkImageLayout layout; -} VkAttachmentReference; - -typedef struct VkFramebufferCreateInfo { - VkStructureType sType; - const void* pNext; - VkFramebufferCreateFlags flags; - VkRenderPass renderPass; - uint32_t attachmentCount; - const VkImageView* pAttachments; - uint32_t width; - uint32_t height; - uint32_t layers; -} VkFramebufferCreateInfo; - -typedef struct VkSubpassDescription { - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t inputAttachmentCount; - const VkAttachmentReference* pInputAttachments; - uint32_t colorAttachmentCount; - const VkAttachmentReference* pColorAttachments; - const VkAttachmentReference* pResolveAttachments; - const VkAttachmentReference* pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - const uint32_t* pPreserveAttachments; -} VkSubpassDescription; - -typedef struct VkSubpassDependency { - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; -} VkSubpassDependency; - -typedef struct VkRenderPassCreateInfo { - VkStructureType sType; - const void* pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - const VkAttachmentDescription* pAttachments; - uint32_t subpassCount; - const VkSubpassDescription* pSubpasses; - uint32_t dependencyCount; - const VkSubpassDependency* pDependencies; -} VkRenderPassCreateInfo; - -typedef struct VkCommandPoolCreateInfo { - VkStructureType sType; - const void* pNext; - VkCommandPoolCreateFlags flags; - uint32_t queueFamilyIndex; -} VkCommandPoolCreateInfo; - -typedef struct VkCommandBufferAllocateInfo { - VkStructureType sType; - const void* pNext; - VkCommandPool commandPool; - VkCommandBufferLevel level; - uint32_t commandBufferCount; -} VkCommandBufferAllocateInfo; - -typedef struct VkCommandBufferInheritanceInfo { - VkStructureType sType; - const void* pNext; - VkRenderPass renderPass; - uint32_t subpass; - VkFramebuffer framebuffer; - VkBool32 occlusionQueryEnable; - VkQueryControlFlags queryFlags; - VkQueryPipelineStatisticFlags pipelineStatistics; -} VkCommandBufferInheritanceInfo; - -typedef struct VkCommandBufferBeginInfo { - VkStructureType sType; - const void* pNext; - VkCommandBufferUsageFlags flags; - const VkCommandBufferInheritanceInfo* pInheritanceInfo; -} VkCommandBufferBeginInfo; - -typedef struct VkBufferCopy { - VkDeviceSize srcOffset; - VkDeviceSize dstOffset; - VkDeviceSize size; -} VkBufferCopy; - -typedef struct VkImageSubresourceLayers { - VkImageAspectFlags aspectMask; - uint32_t mipLevel; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkImageSubresourceLayers; - -typedef struct VkBufferImageCopy { - VkDeviceSize bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy; - -typedef union VkClearColorValue { - float float32[4]; - int32_t int32[4]; - uint32_t uint32[4]; -} VkClearColorValue; - -typedef struct VkClearDepthStencilValue { - float depth; - uint32_t stencil; -} VkClearDepthStencilValue; - -typedef union VkClearValue { - VkClearColorValue color; - VkClearDepthStencilValue depthStencil; -} VkClearValue; - -typedef struct VkClearAttachment { - VkImageAspectFlags aspectMask; - uint32_t colorAttachment; - VkClearValue clearValue; -} VkClearAttachment; - -typedef struct VkClearRect { - VkRect2D rect; - uint32_t baseArrayLayer; - uint32_t layerCount; -} VkClearRect; - -typedef struct VkImageBlit { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit; - -typedef struct VkImageCopy { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy; - -typedef struct VkImageResolve { - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve; - -typedef struct VkRenderPassBeginInfo { - VkStructureType sType; - const void* pNext; - VkRenderPass renderPass; - VkFramebuffer framebuffer; - VkRect2D renderArea; - uint32_t clearValueCount; - const VkClearValue* pClearValues; -} VkRenderPassBeginInfo; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateInstance)(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance); -typedef void (VKAPI_PTR *PFN_vkDestroyInstance)(VkInstance instance, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDevices)(VkInstance instance, uint32_t* pPhysicalDeviceCount, VkPhysicalDevice* pPhysicalDevices); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures* pFeatures); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties* pFormatProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkImageFormatProperties* pImageFormatProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties* pProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties* pQueueFamilyProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties* pMemoryProperties); -typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetInstanceProcAddr)(VkInstance instance, const char* pName); -typedef PFN_vkVoidFunction (VKAPI_PTR *PFN_vkGetDeviceProcAddr)(VkDevice device, const char* pName); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDevice)(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDevice* pDevice); -typedef void (VKAPI_PTR *PFN_vkDestroyDevice)(VkDevice device, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceExtensionProperties)(const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceExtensionProperties)(VkPhysicalDevice physicalDevice, const char* pLayerName, uint32_t* pPropertyCount, VkExtensionProperties* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceLayerProperties)(uint32_t* pPropertyCount, VkLayerProperties* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateDeviceLayerProperties)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkLayerProperties* pProperties); -typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue)(VkDevice device, uint32_t queueFamilyIndex, uint32_t queueIndex, VkQueue* pQueue); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo* pSubmits, VkFence fence); -typedef VkResult (VKAPI_PTR *PFN_vkQueueWaitIdle)(VkQueue queue); -typedef VkResult (VKAPI_PTR *PFN_vkDeviceWaitIdle)(VkDevice device); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateMemory)(VkDevice device, const VkMemoryAllocateInfo* pAllocateInfo, const VkAllocationCallbacks* pAllocator, VkDeviceMemory* pMemory); -typedef void (VKAPI_PTR *PFN_vkFreeMemory)(VkDevice device, VkDeviceMemory memory, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkMapMemory)(VkDevice device, VkDeviceMemory memory, VkDeviceSize offset, VkDeviceSize size, VkMemoryMapFlags flags, void** ppData); -typedef void (VKAPI_PTR *PFN_vkUnmapMemory)(VkDevice device, VkDeviceMemory memory); -typedef VkResult (VKAPI_PTR *PFN_vkFlushMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); -typedef VkResult (VKAPI_PTR *PFN_vkInvalidateMappedMemoryRanges)(VkDevice device, uint32_t memoryRangeCount, const VkMappedMemoryRange* pMemoryRanges); -typedef void (VKAPI_PTR *PFN_vkGetDeviceMemoryCommitment)(VkDevice device, VkDeviceMemory memory, VkDeviceSize* pCommittedMemoryInBytes); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory)(VkDevice device, VkBuffer buffer, VkDeviceMemory memory, VkDeviceSize memoryOffset); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory)(VkDevice device, VkImage image, VkDeviceMemory memory, VkDeviceSize memoryOffset); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements)(VkDevice device, VkBuffer buffer, VkMemoryRequirements* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements)(VkDevice device, VkImage image, VkMemoryRequirements* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements)(VkDevice device, VkImage image, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements* pSparseMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkSampleCountFlagBits samples, VkImageUsageFlags usage, VkImageTiling tiling, uint32_t* pPropertyCount, VkSparseImageFormatProperties* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkQueueBindSparse)(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo* pBindInfo, VkFence fence); -typedef VkResult (VKAPI_PTR *PFN_vkCreateFence)(VkDevice device, const VkFenceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); -typedef void (VKAPI_PTR *PFN_vkDestroyFence)(VkDevice device, VkFence fence, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkResetFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences); -typedef VkResult (VKAPI_PTR *PFN_vkGetFenceStatus)(VkDevice device, VkFence fence); -typedef VkResult (VKAPI_PTR *PFN_vkWaitForFences)(VkDevice device, uint32_t fenceCount, const VkFence* pFences, VkBool32 waitAll, uint64_t timeout); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSemaphore)(VkDevice device, const VkSemaphoreCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSemaphore* pSemaphore); -typedef void (VKAPI_PTR *PFN_vkDestroySemaphore)(VkDevice device, VkSemaphore semaphore, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateEvent)(VkDevice device, const VkEventCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkEvent* pEvent); -typedef void (VKAPI_PTR *PFN_vkDestroyEvent)(VkDevice device, VkEvent event, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetEventStatus)(VkDevice device, VkEvent event); -typedef VkResult (VKAPI_PTR *PFN_vkSetEvent)(VkDevice device, VkEvent event); -typedef VkResult (VKAPI_PTR *PFN_vkResetEvent)(VkDevice device, VkEvent event); -typedef VkResult (VKAPI_PTR *PFN_vkCreateQueryPool)(VkDevice device, const VkQueryPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkQueryPool* pQueryPool); -typedef void (VKAPI_PTR *PFN_vkDestroyQueryPool)(VkDevice device, VkQueryPool queryPool, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetQueryPoolResults)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void* pData, VkDeviceSize stride, VkQueryResultFlags flags); -typedef VkResult (VKAPI_PTR *PFN_vkCreateBuffer)(VkDevice device, const VkBufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBuffer* pBuffer); -typedef void (VKAPI_PTR *PFN_vkDestroyBuffer)(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateBufferView)(VkDevice device, const VkBufferViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkBufferView* pView); -typedef void (VKAPI_PTR *PFN_vkDestroyBufferView)(VkDevice device, VkBufferView bufferView, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateImage)(VkDevice device, const VkImageCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImage* pImage); -typedef void (VKAPI_PTR *PFN_vkDestroyImage)(VkDevice device, VkImage image, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkGetImageSubresourceLayout)(VkDevice device, VkImage image, const VkImageSubresource* pSubresource, VkSubresourceLayout* pLayout); -typedef VkResult (VKAPI_PTR *PFN_vkCreateImageView)(VkDevice device, const VkImageViewCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkImageView* pView); -typedef void (VKAPI_PTR *PFN_vkDestroyImageView)(VkDevice device, VkImageView imageView, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateShaderModule)(VkDevice device, const VkShaderModuleCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkShaderModule* pShaderModule); -typedef void (VKAPI_PTR *PFN_vkDestroyShaderModule)(VkDevice device, VkShaderModule shaderModule, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineCache)(VkDevice device, const VkPipelineCacheCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineCache* pPipelineCache); -typedef void (VKAPI_PTR *PFN_vkDestroyPipelineCache)(VkDevice device, VkPipelineCache pipelineCache, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineCacheData)(VkDevice device, VkPipelineCache pipelineCache, size_t* pDataSize, void* pData); -typedef VkResult (VKAPI_PTR *PFN_vkMergePipelineCaches)(VkDevice device, VkPipelineCache dstCache, uint32_t srcCacheCount, const VkPipelineCache* pSrcCaches); -typedef VkResult (VKAPI_PTR *PFN_vkCreateGraphicsPipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkGraphicsPipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); -typedef VkResult (VKAPI_PTR *PFN_vkCreateComputePipelines)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkComputePipelineCreateInfo* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); -typedef void (VKAPI_PTR *PFN_vkDestroyPipeline)(VkDevice device, VkPipeline pipeline, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreatePipelineLayout)(VkDevice device, const VkPipelineLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPipelineLayout* pPipelineLayout); -typedef void (VKAPI_PTR *PFN_vkDestroyPipelineLayout)(VkDevice device, VkPipelineLayout pipelineLayout, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSampler)(VkDevice device, const VkSamplerCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSampler* pSampler); -typedef void (VKAPI_PTR *PFN_vkDestroySampler)(VkDevice device, VkSampler sampler, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorSetLayout)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorSetLayout* pSetLayout); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorSetLayout)(VkDevice device, VkDescriptorSetLayout descriptorSetLayout, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorPool)(VkDevice device, const VkDescriptorPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorPool* pDescriptorPool); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkResetDescriptorPool)(VkDevice device, VkDescriptorPool descriptorPool, VkDescriptorPoolResetFlags flags); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateDescriptorSets)(VkDevice device, const VkDescriptorSetAllocateInfo* pAllocateInfo, VkDescriptorSet* pDescriptorSets); -typedef VkResult (VKAPI_PTR *PFN_vkFreeDescriptorSets)(VkDevice device, VkDescriptorPool descriptorPool, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSets)(VkDevice device, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites, uint32_t descriptorCopyCount, const VkCopyDescriptorSet* pDescriptorCopies); -typedef VkResult (VKAPI_PTR *PFN_vkCreateFramebuffer)(VkDevice device, const VkFramebufferCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkFramebuffer* pFramebuffer); -typedef void (VKAPI_PTR *PFN_vkDestroyFramebuffer)(VkDevice device, VkFramebuffer framebuffer, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass)(VkDevice device, const VkRenderPassCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); -typedef void (VKAPI_PTR *PFN_vkDestroyRenderPass)(VkDevice device, VkRenderPass renderPass, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkGetRenderAreaGranularity)(VkDevice device, VkRenderPass renderPass, VkExtent2D* pGranularity); -typedef VkResult (VKAPI_PTR *PFN_vkCreateCommandPool)(VkDevice device, const VkCommandPoolCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkCommandPool* pCommandPool); -typedef void (VKAPI_PTR *PFN_vkDestroyCommandPool)(VkDevice device, VkCommandPool commandPool, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkResetCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolResetFlags flags); -typedef VkResult (VKAPI_PTR *PFN_vkAllocateCommandBuffers)(VkDevice device, const VkCommandBufferAllocateInfo* pAllocateInfo, VkCommandBuffer* pCommandBuffers); -typedef void (VKAPI_PTR *PFN_vkFreeCommandBuffers)(VkDevice device, VkCommandPool commandPool, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); -typedef VkResult (VKAPI_PTR *PFN_vkBeginCommandBuffer)(VkCommandBuffer commandBuffer, const VkCommandBufferBeginInfo* pBeginInfo); -typedef VkResult (VKAPI_PTR *PFN_vkEndCommandBuffer)(VkCommandBuffer commandBuffer); -typedef VkResult (VKAPI_PTR *PFN_vkResetCommandBuffer)(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags); -typedef void (VKAPI_PTR *PFN_vkCmdBindPipeline)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewport)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewport* pViewports); -typedef void (VKAPI_PTR *PFN_vkCmdSetScissor)(VkCommandBuffer commandBuffer, uint32_t firstScissor, uint32_t scissorCount, const VkRect2D* pScissors); -typedef void (VKAPI_PTR *PFN_vkCmdSetLineWidth)(VkCommandBuffer commandBuffer, float lineWidth); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBias)(VkCommandBuffer commandBuffer, float depthBiasConstantFactor, float depthBiasClamp, float depthBiasSlopeFactor); -typedef void (VKAPI_PTR *PFN_vkCmdSetBlendConstants)(VkCommandBuffer commandBuffer, const float blendConstants[4]); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBounds)(VkCommandBuffer commandBuffer, float minDepthBounds, float maxDepthBounds); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilCompareMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t compareMask); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilWriteMask)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t writeMask); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilReference)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, uint32_t reference); -typedef void (VKAPI_PTR *PFN_vkCmdBindDescriptorSets)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t firstSet, uint32_t descriptorSetCount, const VkDescriptorSet* pDescriptorSets, uint32_t dynamicOffsetCount, const uint32_t* pDynamicOffsets); -typedef void (VKAPI_PTR *PFN_vkCmdBindIndexBuffer)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkIndexType indexType); -typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets); -typedef void (VKAPI_PTR *PFN_vkCmdDraw)(VkCommandBuffer commandBuffer, uint32_t vertexCount, uint32_t instanceCount, uint32_t firstVertex, uint32_t firstInstance); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexed)(VkCommandBuffer commandBuffer, uint32_t indexCount, uint32_t instanceCount, uint32_t firstIndex, int32_t vertexOffset, uint32_t firstInstance); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDispatch)(VkCommandBuffer commandBuffer, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchIndirect)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferCopy* pRegions); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageCopy* pRegions); -typedef void (VKAPI_PTR *PFN_vkCmdBlitImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageBlit* pRegions, VkFilter filter); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage)(VkCommandBuffer commandBuffer, VkBuffer srcBuffer, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkBufferImageCopy* pRegions); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkBuffer dstBuffer, uint32_t regionCount, const VkBufferImageCopy* pRegions); -typedef void (VKAPI_PTR *PFN_vkCmdUpdateBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize dataSize, const void* pData); -typedef void (VKAPI_PTR *PFN_vkCmdFillBuffer)(VkCommandBuffer commandBuffer, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize size, uint32_t data); -typedef void (VKAPI_PTR *PFN_vkCmdClearColorImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearColorValue* pColor, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); -typedef void (VKAPI_PTR *PFN_vkCmdClearDepthStencilImage)(VkCommandBuffer commandBuffer, VkImage image, VkImageLayout imageLayout, const VkClearDepthStencilValue* pDepthStencil, uint32_t rangeCount, const VkImageSubresourceRange* pRanges); -typedef void (VKAPI_PTR *PFN_vkCmdClearAttachments)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkClearAttachment* pAttachments, uint32_t rectCount, const VkClearRect* pRects); -typedef void (VKAPI_PTR *PFN_vkCmdResolveImage)(VkCommandBuffer commandBuffer, VkImage srcImage, VkImageLayout srcImageLayout, VkImage dstImage, VkImageLayout dstImageLayout, uint32_t regionCount, const VkImageResolve* pRegions); -typedef void (VKAPI_PTR *PFN_vkCmdSetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -typedef void (VKAPI_PTR *PFN_vkCmdResetEvent)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags stageMask); -typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); -typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier)(VkCommandBuffer commandBuffer, VkPipelineStageFlags srcStageMask, VkPipelineStageFlags dstStageMask, VkDependencyFlags dependencyFlags, uint32_t memoryBarrierCount, const VkMemoryBarrier* pMemoryBarriers, uint32_t bufferMemoryBarrierCount, const VkBufferMemoryBarrier* pBufferMemoryBarriers, uint32_t imageMemoryBarrierCount, const VkImageMemoryBarrier* pImageMemoryBarriers); -typedef void (VKAPI_PTR *PFN_vkCmdBeginQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags); -typedef void (VKAPI_PTR *PFN_vkCmdEndQuery)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query); -typedef void (VKAPI_PTR *PFN_vkCmdResetQueryPool)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkQueryPool queryPool, uint32_t query); -typedef void (VKAPI_PTR *PFN_vkCmdCopyQueryPoolResults)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, VkBuffer dstBuffer, VkDeviceSize dstOffset, VkDeviceSize stride, VkQueryResultFlags flags); -typedef void (VKAPI_PTR *PFN_vkCmdPushConstants)(VkCommandBuffer commandBuffer, VkPipelineLayout layout, VkShaderStageFlags stageFlags, uint32_t offset, uint32_t size, const void* pValues); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, VkSubpassContents contents); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass)(VkCommandBuffer commandBuffer, VkSubpassContents contents); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass)(VkCommandBuffer commandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdExecuteCommands)(VkCommandBuffer commandBuffer, uint32_t commandBufferCount, const VkCommandBuffer* pCommandBuffers); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance( - const VkInstanceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkInstance* pInstance); - -VKAPI_ATTR void VKAPI_CALL vkDestroyInstance( - VkInstance instance, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDevices( - VkInstance instance, - uint32_t* pPhysicalDeviceCount, - VkPhysicalDevice* pPhysicalDevices); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures* pFeatures); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkFormatProperties* pFormatProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkImageType type, - VkImageTiling tiling, - VkImageUsageFlags usage, - VkImageCreateFlags flags, - VkImageFormatProperties* pImageFormatProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties* pProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties( - VkPhysicalDevice physicalDevice, - uint32_t* pQueueFamilyPropertyCount, - VkQueueFamilyProperties* pQueueFamilyProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties* pMemoryProperties); - -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr( - VkInstance instance, - const char* pName); - -VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr( - VkDevice device, - const char* pName); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDevice( - VkPhysicalDevice physicalDevice, - const VkDeviceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDevice* pDevice); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDevice( - VkDevice device, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceExtensionProperties( - const char* pLayerName, - uint32_t* pPropertyCount, - VkExtensionProperties* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceExtensionProperties( - VkPhysicalDevice physicalDevice, - const char* pLayerName, - uint32_t* pPropertyCount, - VkExtensionProperties* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceLayerProperties( - uint32_t* pPropertyCount, - VkLayerProperties* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateDeviceLayerProperties( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkLayerProperties* pProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue( - VkDevice device, - uint32_t queueFamilyIndex, - uint32_t queueIndex, - VkQueue* pQueue); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit( - VkQueue queue, - uint32_t submitCount, - const VkSubmitInfo* pSubmits, - VkFence fence); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueWaitIdle( - VkQueue queue); - -VKAPI_ATTR VkResult VKAPI_CALL vkDeviceWaitIdle( - VkDevice device); - -VKAPI_ATTR VkResult VKAPI_CALL vkAllocateMemory( - VkDevice device, - const VkMemoryAllocateInfo* pAllocateInfo, - const VkAllocationCallbacks* pAllocator, - VkDeviceMemory* pMemory); - -VKAPI_ATTR void VKAPI_CALL vkFreeMemory( - VkDevice device, - VkDeviceMemory memory, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkMapMemory( - VkDevice device, - VkDeviceMemory memory, - VkDeviceSize offset, - VkDeviceSize size, - VkMemoryMapFlags flags, - void** ppData); - -VKAPI_ATTR void VKAPI_CALL vkUnmapMemory( - VkDevice device, - VkDeviceMemory memory); - -VKAPI_ATTR VkResult VKAPI_CALL vkFlushMappedMemoryRanges( - VkDevice device, - uint32_t memoryRangeCount, - const VkMappedMemoryRange* pMemoryRanges); - -VKAPI_ATTR VkResult VKAPI_CALL vkInvalidateMappedMemoryRanges( - VkDevice device, - uint32_t memoryRangeCount, - const VkMappedMemoryRange* pMemoryRanges); - -VKAPI_ATTR void VKAPI_CALL vkGetDeviceMemoryCommitment( - VkDevice device, - VkDeviceMemory memory, - VkDeviceSize* pCommittedMemoryInBytes); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory( - VkDevice device, - VkBuffer buffer, - VkDeviceMemory memory, - VkDeviceSize memoryOffset); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory( - VkDevice device, - VkImage image, - VkDeviceMemory memory, - VkDeviceSize memoryOffset); - -VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements( - VkDevice device, - VkBuffer buffer, - VkMemoryRequirements* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements( - VkDevice device, - VkImage image, - VkMemoryRequirements* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements( - VkDevice device, - VkImage image, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements* pSparseMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkImageType type, - VkSampleCountFlagBits samples, - VkImageUsageFlags usage, - VkImageTiling tiling, - uint32_t* pPropertyCount, - VkSparseImageFormatProperties* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueBindSparse( - VkQueue queue, - uint32_t bindInfoCount, - const VkBindSparseInfo* pBindInfo, - VkFence fence); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateFence( - VkDevice device, - const VkFenceCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkFence* pFence); - -VKAPI_ATTR void VKAPI_CALL vkDestroyFence( - VkDevice device, - VkFence fence, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkResetFences( - VkDevice device, - uint32_t fenceCount, - const VkFence* pFences); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceStatus( - VkDevice device, - VkFence fence); - -VKAPI_ATTR VkResult VKAPI_CALL vkWaitForFences( - VkDevice device, - uint32_t fenceCount, - const VkFence* pFences, - VkBool32 waitAll, - uint64_t timeout); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSemaphore( - VkDevice device, - const VkSemaphoreCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSemaphore* pSemaphore); - -VKAPI_ATTR void VKAPI_CALL vkDestroySemaphore( - VkDevice device, - VkSemaphore semaphore, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateEvent( - VkDevice device, - const VkEventCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkEvent* pEvent); - -VKAPI_ATTR void VKAPI_CALL vkDestroyEvent( - VkDevice device, - VkEvent event, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetEventStatus( - VkDevice device, - VkEvent event); - -VKAPI_ATTR VkResult VKAPI_CALL vkSetEvent( - VkDevice device, - VkEvent event); - -VKAPI_ATTR VkResult VKAPI_CALL vkResetEvent( - VkDevice device, - VkEvent event); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateQueryPool( - VkDevice device, - const VkQueryPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkQueryPool* pQueryPool); - -VKAPI_ATTR void VKAPI_CALL vkDestroyQueryPool( - VkDevice device, - VkQueryPool queryPool, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetQueryPoolResults( - VkDevice device, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount, - size_t dataSize, - void* pData, - VkDeviceSize stride, - VkQueryResultFlags flags); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateBuffer( - VkDevice device, - const VkBufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkBuffer* pBuffer); - -VKAPI_ATTR void VKAPI_CALL vkDestroyBuffer( - VkDevice device, - VkBuffer buffer, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateBufferView( - VkDevice device, - const VkBufferViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkBufferView* pView); - -VKAPI_ATTR void VKAPI_CALL vkDestroyBufferView( - VkDevice device, - VkBufferView bufferView, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateImage( - VkDevice device, - const VkImageCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkImage* pImage); - -VKAPI_ATTR void VKAPI_CALL vkDestroyImage( - VkDevice device, - VkImage image, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkGetImageSubresourceLayout( - VkDevice device, - VkImage image, - const VkImageSubresource* pSubresource, - VkSubresourceLayout* pLayout); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateImageView( - VkDevice device, - const VkImageViewCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkImageView* pView); - -VKAPI_ATTR void VKAPI_CALL vkDestroyImageView( - VkDevice device, - VkImageView imageView, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateShaderModule( - VkDevice device, - const VkShaderModuleCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkShaderModule* pShaderModule); - -VKAPI_ATTR void VKAPI_CALL vkDestroyShaderModule( - VkDevice device, - VkShaderModule shaderModule, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineCache( - VkDevice device, - const VkPipelineCacheCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPipelineCache* pPipelineCache); - -VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineCache( - VkDevice device, - VkPipelineCache pipelineCache, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineCacheData( - VkDevice device, - VkPipelineCache pipelineCache, - size_t* pDataSize, - void* pData); - -VKAPI_ATTR VkResult VKAPI_CALL vkMergePipelineCaches( - VkDevice device, - VkPipelineCache dstCache, - uint32_t srcCacheCount, - const VkPipelineCache* pSrcCaches); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateGraphicsPipelines( - VkDevice device, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkGraphicsPipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateComputePipelines( - VkDevice device, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkComputePipelineCreateInfo* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); - -VKAPI_ATTR void VKAPI_CALL vkDestroyPipeline( - VkDevice device, - VkPipeline pipeline, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreatePipelineLayout( - VkDevice device, - const VkPipelineLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPipelineLayout* pPipelineLayout); - -VKAPI_ATTR void VKAPI_CALL vkDestroyPipelineLayout( - VkDevice device, - VkPipelineLayout pipelineLayout, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSampler( - VkDevice device, - const VkSamplerCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSampler* pSampler); - -VKAPI_ATTR void VKAPI_CALL vkDestroySampler( - VkDevice device, - VkSampler sampler, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorSetLayout( - VkDevice device, - const VkDescriptorSetLayoutCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorSetLayout* pSetLayout); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorSetLayout( - VkDevice device, - VkDescriptorSetLayout descriptorSetLayout, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorPool( - VkDevice device, - const VkDescriptorPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorPool* pDescriptorPool); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorPool( - VkDevice device, - VkDescriptorPool descriptorPool, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkResetDescriptorPool( - VkDevice device, - VkDescriptorPool descriptorPool, - VkDescriptorPoolResetFlags flags); - -VKAPI_ATTR VkResult VKAPI_CALL vkAllocateDescriptorSets( - VkDevice device, - const VkDescriptorSetAllocateInfo* pAllocateInfo, - VkDescriptorSet* pDescriptorSets); - -VKAPI_ATTR VkResult VKAPI_CALL vkFreeDescriptorSets( - VkDevice device, - VkDescriptorPool descriptorPool, - uint32_t descriptorSetCount, - const VkDescriptorSet* pDescriptorSets); - -VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSets( - VkDevice device, - uint32_t descriptorWriteCount, - const VkWriteDescriptorSet* pDescriptorWrites, - uint32_t descriptorCopyCount, - const VkCopyDescriptorSet* pDescriptorCopies); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateFramebuffer( - VkDevice device, - const VkFramebufferCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkFramebuffer* pFramebuffer); - -VKAPI_ATTR void VKAPI_CALL vkDestroyFramebuffer( - VkDevice device, - VkFramebuffer framebuffer, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass( - VkDevice device, - const VkRenderPassCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkRenderPass* pRenderPass); - -VKAPI_ATTR void VKAPI_CALL vkDestroyRenderPass( - VkDevice device, - VkRenderPass renderPass, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkGetRenderAreaGranularity( - VkDevice device, - VkRenderPass renderPass, - VkExtent2D* pGranularity); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateCommandPool( - VkDevice device, - const VkCommandPoolCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkCommandPool* pCommandPool); - -VKAPI_ATTR void VKAPI_CALL vkDestroyCommandPool( - VkDevice device, - VkCommandPool commandPool, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandPool( - VkDevice device, - VkCommandPool commandPool, - VkCommandPoolResetFlags flags); - -VKAPI_ATTR VkResult VKAPI_CALL vkAllocateCommandBuffers( - VkDevice device, - const VkCommandBufferAllocateInfo* pAllocateInfo, - VkCommandBuffer* pCommandBuffers); - -VKAPI_ATTR void VKAPI_CALL vkFreeCommandBuffers( - VkDevice device, - VkCommandPool commandPool, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers); - -VKAPI_ATTR VkResult VKAPI_CALL vkBeginCommandBuffer( - VkCommandBuffer commandBuffer, - const VkCommandBufferBeginInfo* pBeginInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkEndCommandBuffer( - VkCommandBuffer commandBuffer); - -VKAPI_ATTR VkResult VKAPI_CALL vkResetCommandBuffer( - VkCommandBuffer commandBuffer, - VkCommandBufferResetFlags flags); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindPipeline( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetViewport( - VkCommandBuffer commandBuffer, - uint32_t firstViewport, - uint32_t viewportCount, - const VkViewport* pViewports); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetScissor( - VkCommandBuffer commandBuffer, - uint32_t firstScissor, - uint32_t scissorCount, - const VkRect2D* pScissors); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetLineWidth( - VkCommandBuffer commandBuffer, - float lineWidth); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBias( - VkCommandBuffer commandBuffer, - float depthBiasConstantFactor, - float depthBiasClamp, - float depthBiasSlopeFactor); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetBlendConstants( - VkCommandBuffer commandBuffer, - const float blendConstants[4]); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBounds( - VkCommandBuffer commandBuffer, - float minDepthBounds, - float maxDepthBounds); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilCompareMask( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t compareMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilWriteMask( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t writeMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilReference( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - uint32_t reference); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindDescriptorSets( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipelineLayout layout, - uint32_t firstSet, - uint32_t descriptorSetCount, - const VkDescriptorSet* pDescriptorSets, - uint32_t dynamicOffsetCount, - const uint32_t* pDynamicOffsets); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindIndexBuffer( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkIndexType indexType); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers( - VkCommandBuffer commandBuffer, - uint32_t firstBinding, - uint32_t bindingCount, - const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets); - -VKAPI_ATTR void VKAPI_CALL vkCmdDraw( - VkCommandBuffer commandBuffer, - uint32_t vertexCount, - uint32_t instanceCount, - uint32_t firstVertex, - uint32_t firstInstance); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexed( - VkCommandBuffer commandBuffer, - uint32_t indexCount, - uint32_t instanceCount, - uint32_t firstIndex, - int32_t vertexOffset, - uint32_t firstInstance); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDispatch( - VkCommandBuffer commandBuffer, - uint32_t groupCountX, - uint32_t groupCountY, - uint32_t groupCountZ); - -VKAPI_ATTR void VKAPI_CALL vkCmdDispatchIndirect( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer( - VkCommandBuffer commandBuffer, - VkBuffer srcBuffer, - VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferCopy* pRegions); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageCopy* pRegions); - -VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageBlit* pRegions, - VkFilter filter); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage( - VkCommandBuffer commandBuffer, - VkBuffer srcBuffer, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkBufferImageCopy* pRegions); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkBuffer dstBuffer, - uint32_t regionCount, - const VkBufferImageCopy* pRegions); - -VKAPI_ATTR void VKAPI_CALL vkCmdUpdateBuffer( - VkCommandBuffer commandBuffer, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize dataSize, - const void* pData); - -VKAPI_ATTR void VKAPI_CALL vkCmdFillBuffer( - VkCommandBuffer commandBuffer, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize size, - uint32_t data); - -VKAPI_ATTR void VKAPI_CALL vkCmdClearColorImage( - VkCommandBuffer commandBuffer, - VkImage image, - VkImageLayout imageLayout, - const VkClearColorValue* pColor, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); - -VKAPI_ATTR void VKAPI_CALL vkCmdClearDepthStencilImage( - VkCommandBuffer commandBuffer, - VkImage image, - VkImageLayout imageLayout, - const VkClearDepthStencilValue* pDepthStencil, - uint32_t rangeCount, - const VkImageSubresourceRange* pRanges); - -VKAPI_ATTR void VKAPI_CALL vkCmdClearAttachments( - VkCommandBuffer commandBuffer, - uint32_t attachmentCount, - const VkClearAttachment* pAttachments, - uint32_t rectCount, - const VkClearRect* pRects); - -VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage( - VkCommandBuffer commandBuffer, - VkImage srcImage, - VkImageLayout srcImageLayout, - VkImage dstImage, - VkImageLayout dstImageLayout, - uint32_t regionCount, - const VkImageResolve* pRegions); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent( - VkCommandBuffer commandBuffer, - VkEvent event, - VkPipelineStageFlags stageMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent( - VkCommandBuffer commandBuffer, - VkEvent event, - VkPipelineStageFlags stageMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents( - VkCommandBuffer commandBuffer, - uint32_t eventCount, - const VkEvent* pEvents, - VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, - uint32_t memoryBarrierCount, - const VkMemoryBarrier* pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier* pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers); - -VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier( - VkCommandBuffer commandBuffer, - VkPipelineStageFlags srcStageMask, - VkPipelineStageFlags dstStageMask, - VkDependencyFlags dependencyFlags, - uint32_t memoryBarrierCount, - const VkMemoryBarrier* pMemoryBarriers, - uint32_t bufferMemoryBarrierCount, - const VkBufferMemoryBarrier* pBufferMemoryBarriers, - uint32_t imageMemoryBarrierCount, - const VkImageMemoryBarrier* pImageMemoryBarriers); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginQuery( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query, - VkQueryControlFlags flags); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndQuery( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query); - -VKAPI_ATTR void VKAPI_CALL vkCmdResetQueryPool( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount); - -VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp( - VkCommandBuffer commandBuffer, - VkPipelineStageFlagBits pipelineStage, - VkQueryPool queryPool, - uint32_t query); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyQueryPoolResults( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - VkDeviceSize stride, - VkQueryResultFlags flags); - -VKAPI_ATTR void VKAPI_CALL vkCmdPushConstants( - VkCommandBuffer commandBuffer, - VkPipelineLayout layout, - VkShaderStageFlags stageFlags, - uint32_t offset, - uint32_t size, - const void* pValues); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass( - VkCommandBuffer commandBuffer, - const VkRenderPassBeginInfo* pRenderPassBegin, - VkSubpassContents contents); - -VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass( - VkCommandBuffer commandBuffer, - VkSubpassContents contents); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass( - VkCommandBuffer commandBuffer); - -VKAPI_ATTR void VKAPI_CALL vkCmdExecuteCommands( - VkCommandBuffer commandBuffer, - uint32_t commandBufferCount, - const VkCommandBuffer* pCommandBuffers); -#endif - - -#define VK_VERSION_1_1 1 -// Vulkan 1.1 version number -#define VK_API_VERSION_1_1 VK_MAKE_API_VERSION(0, 1, 1, 0)// Patch version should always be set to 0 - -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSamplerYcbcrConversion) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDescriptorUpdateTemplate) -#define VK_MAX_DEVICE_GROUP_SIZE 32U -#define VK_LUID_SIZE 8U -#define VK_QUEUE_FAMILY_EXTERNAL (~1U) - -typedef enum VkPointClippingBehavior { - VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES = 0, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY = 1, - VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES_KHR = VK_POINT_CLIPPING_BEHAVIOR_ALL_CLIP_PLANES, - VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY_KHR = VK_POINT_CLIPPING_BEHAVIOR_USER_CLIP_PLANES_ONLY, - VK_POINT_CLIPPING_BEHAVIOR_MAX_ENUM = 0x7FFFFFFF -} VkPointClippingBehavior; - -typedef enum VkTessellationDomainOrigin { - VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT = 0, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT = 1, - VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_UPPER_LEFT, - VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT_KHR = VK_TESSELLATION_DOMAIN_ORIGIN_LOWER_LEFT, - VK_TESSELLATION_DOMAIN_ORIGIN_MAX_ENUM = 0x7FFFFFFF -} VkTessellationDomainOrigin; - -typedef enum VkSamplerYcbcrModelConversion { - VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY = 0, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY = 1, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709 = 2, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601 = 3, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020 = 4, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_RGB_IDENTITY, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_IDENTITY, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_709, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_601, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020_KHR = VK_SAMPLER_YCBCR_MODEL_CONVERSION_YCBCR_2020, - VK_SAMPLER_YCBCR_MODEL_CONVERSION_MAX_ENUM = 0x7FFFFFFF -} VkSamplerYcbcrModelConversion; - -typedef enum VkSamplerYcbcrRange { - VK_SAMPLER_YCBCR_RANGE_ITU_FULL = 0, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW = 1, - VK_SAMPLER_YCBCR_RANGE_ITU_FULL_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_FULL, - VK_SAMPLER_YCBCR_RANGE_ITU_NARROW_KHR = VK_SAMPLER_YCBCR_RANGE_ITU_NARROW, - VK_SAMPLER_YCBCR_RANGE_MAX_ENUM = 0x7FFFFFFF -} VkSamplerYcbcrRange; - -typedef enum VkChromaLocation { - VK_CHROMA_LOCATION_COSITED_EVEN = 0, - VK_CHROMA_LOCATION_MIDPOINT = 1, - VK_CHROMA_LOCATION_COSITED_EVEN_KHR = VK_CHROMA_LOCATION_COSITED_EVEN, - VK_CHROMA_LOCATION_MIDPOINT_KHR = VK_CHROMA_LOCATION_MIDPOINT, - VK_CHROMA_LOCATION_MAX_ENUM = 0x7FFFFFFF -} VkChromaLocation; - -typedef enum VkDescriptorUpdateTemplateType { - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET = 0, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_PUSH_DESCRIPTORS_KHR = 1, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET_KHR = VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_DESCRIPTOR_SET, - VK_DESCRIPTOR_UPDATE_TEMPLATE_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkDescriptorUpdateTemplateType; - -typedef enum VkSubgroupFeatureFlagBits { - VK_SUBGROUP_FEATURE_BASIC_BIT = 0x00000001, - VK_SUBGROUP_FEATURE_VOTE_BIT = 0x00000002, - VK_SUBGROUP_FEATURE_ARITHMETIC_BIT = 0x00000004, - VK_SUBGROUP_FEATURE_BALLOT_BIT = 0x00000008, - VK_SUBGROUP_FEATURE_SHUFFLE_BIT = 0x00000010, - VK_SUBGROUP_FEATURE_SHUFFLE_RELATIVE_BIT = 0x00000020, - VK_SUBGROUP_FEATURE_CLUSTERED_BIT = 0x00000040, - VK_SUBGROUP_FEATURE_QUAD_BIT = 0x00000080, - VK_SUBGROUP_FEATURE_PARTITIONED_BIT_NV = 0x00000100, - VK_SUBGROUP_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSubgroupFeatureFlagBits; -typedef VkFlags VkSubgroupFeatureFlags; - -typedef enum VkPeerMemoryFeatureFlagBits { - VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT = 0x00000001, - VK_PEER_MEMORY_FEATURE_COPY_DST_BIT = 0x00000002, - VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT = 0x00000004, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT = 0x00000008, - VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_SRC_BIT, - VK_PEER_MEMORY_FEATURE_COPY_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_COPY_DST_BIT, - VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_SRC_BIT, - VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT_KHR = VK_PEER_MEMORY_FEATURE_GENERIC_DST_BIT, - VK_PEER_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkPeerMemoryFeatureFlagBits; -typedef VkFlags VkPeerMemoryFeatureFlags; - -typedef enum VkMemoryAllocateFlagBits { - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT = 0x00000001, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT = 0x00000002, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT = 0x00000004, - VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_MASK_BIT, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_BIT, - VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = VK_MEMORY_ALLOCATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT, - VK_MEMORY_ALLOCATE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkMemoryAllocateFlagBits; -typedef VkFlags VkMemoryAllocateFlags; -typedef VkFlags VkCommandPoolTrimFlags; -typedef VkFlags VkDescriptorUpdateTemplateCreateFlags; - -typedef enum VkExternalMemoryHandleTypeFlagBits { - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT = 0x00000008, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT = 0x00000010, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT = 0x00000020, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT = 0x00000040, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT = 0x00000200, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID = 0x00000400, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT = 0x00000080, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_MAPPED_FOREIGN_MEMORY_BIT_EXT = 0x00000100, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_ZIRCON_VMO_BIT_FUCHSIA = 0x00000800, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_TEXTURE_KMT_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_HEAP_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT_KHR = VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D12_RESOURCE_BIT, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalMemoryHandleTypeFlagBits; -typedef VkFlags VkExternalMemoryHandleTypeFlags; - -typedef enum VkExternalMemoryFeatureFlagBits { - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT = 0x00000001, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT = 0x00000004, - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalMemoryFeatureFlagBits; -typedef VkFlags VkExternalMemoryFeatureFlags; - -typedef enum VkExternalFenceHandleTypeFlagBits { - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000008, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_FENCE_HANDLE_TYPE_SYNC_FD_BIT, - VK_EXTERNAL_FENCE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalFenceHandleTypeFlagBits; -typedef VkFlags VkExternalFenceHandleTypeFlags; - -typedef enum VkExternalFenceFeatureFlagBits { - VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT = 0x00000001, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_FENCE_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_FENCE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalFenceFeatureFlagBits; -typedef VkFlags VkExternalFenceFeatureFlags; - -typedef enum VkFenceImportFlagBits { - VK_FENCE_IMPORT_TEMPORARY_BIT = 0x00000001, - VK_FENCE_IMPORT_TEMPORARY_BIT_KHR = VK_FENCE_IMPORT_TEMPORARY_BIT, - VK_FENCE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkFenceImportFlagBits; -typedef VkFlags VkFenceImportFlags; - -typedef enum VkSemaphoreImportFlagBits { - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT = 0x00000001, - VK_SEMAPHORE_IMPORT_TEMPORARY_BIT_KHR = VK_SEMAPHORE_IMPORT_TEMPORARY_BIT, - VK_SEMAPHORE_IMPORT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSemaphoreImportFlagBits; -typedef VkFlags VkSemaphoreImportFlags; - -typedef enum VkExternalSemaphoreHandleTypeFlagBits { - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT = 0x00000001, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT = 0x00000002, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT = 0x00000004, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT = 0x00000008, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT = 0x00000010, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_ZIRCON_EVENT_BIT_FUCHSIA = 0x00000080, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D11_FENCE_BIT = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_FD_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_D3D12_FENCE_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT_KHR = VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_SYNC_FD_BIT, - VK_EXTERNAL_SEMAPHORE_HANDLE_TYPE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalSemaphoreHandleTypeFlagBits; -typedef VkFlags VkExternalSemaphoreHandleTypeFlags; - -typedef enum VkExternalSemaphoreFeatureFlagBits { - VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT = 0x00000001, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT = 0x00000002, - VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_EXPORTABLE_BIT, - VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT_KHR = VK_EXTERNAL_SEMAPHORE_FEATURE_IMPORTABLE_BIT, - VK_EXTERNAL_SEMAPHORE_FEATURE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkExternalSemaphoreFeatureFlagBits; -typedef VkFlags VkExternalSemaphoreFeatureFlags; -typedef struct VkPhysicalDeviceSubgroupProperties { - VkStructureType sType; - void* pNext; - uint32_t subgroupSize; - VkShaderStageFlags supportedStages; - VkSubgroupFeatureFlags supportedOperations; - VkBool32 quadOperationsInAllStages; -} VkPhysicalDeviceSubgroupProperties; - -typedef struct VkBindBufferMemoryInfo { - VkStructureType sType; - const void* pNext; - VkBuffer buffer; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; -} VkBindBufferMemoryInfo; - -typedef struct VkBindImageMemoryInfo { - VkStructureType sType; - const void* pNext; - VkImage image; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; -} VkBindImageMemoryInfo; - -typedef struct VkPhysicalDevice16BitStorageFeatures { - VkStructureType sType; - void* pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; -} VkPhysicalDevice16BitStorageFeatures; - -typedef struct VkMemoryDedicatedRequirements { - VkStructureType sType; - void* pNext; - VkBool32 prefersDedicatedAllocation; - VkBool32 requiresDedicatedAllocation; -} VkMemoryDedicatedRequirements; - -typedef struct VkMemoryDedicatedAllocateInfo { - VkStructureType sType; - const void* pNext; - VkImage image; - VkBuffer buffer; -} VkMemoryDedicatedAllocateInfo; - -typedef struct VkMemoryAllocateFlagsInfo { - VkStructureType sType; - const void* pNext; - VkMemoryAllocateFlags flags; - uint32_t deviceMask; -} VkMemoryAllocateFlagsInfo; - -typedef struct VkDeviceGroupRenderPassBeginInfo { - VkStructureType sType; - const void* pNext; - uint32_t deviceMask; - uint32_t deviceRenderAreaCount; - const VkRect2D* pDeviceRenderAreas; -} VkDeviceGroupRenderPassBeginInfo; - -typedef struct VkDeviceGroupCommandBufferBeginInfo { - VkStructureType sType; - const void* pNext; - uint32_t deviceMask; -} VkDeviceGroupCommandBufferBeginInfo; - -typedef struct VkDeviceGroupSubmitInfo { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const uint32_t* pWaitSemaphoreDeviceIndices; - uint32_t commandBufferCount; - const uint32_t* pCommandBufferDeviceMasks; - uint32_t signalSemaphoreCount; - const uint32_t* pSignalSemaphoreDeviceIndices; -} VkDeviceGroupSubmitInfo; - -typedef struct VkDeviceGroupBindSparseInfo { - VkStructureType sType; - const void* pNext; - uint32_t resourceDeviceIndex; - uint32_t memoryDeviceIndex; -} VkDeviceGroupBindSparseInfo; - -typedef struct VkBindBufferMemoryDeviceGroupInfo { - VkStructureType sType; - const void* pNext; - uint32_t deviceIndexCount; - const uint32_t* pDeviceIndices; -} VkBindBufferMemoryDeviceGroupInfo; - -typedef struct VkBindImageMemoryDeviceGroupInfo { - VkStructureType sType; - const void* pNext; - uint32_t deviceIndexCount; - const uint32_t* pDeviceIndices; - uint32_t splitInstanceBindRegionCount; - const VkRect2D* pSplitInstanceBindRegions; -} VkBindImageMemoryDeviceGroupInfo; - -typedef struct VkPhysicalDeviceGroupProperties { - VkStructureType sType; - void* pNext; - uint32_t physicalDeviceCount; - VkPhysicalDevice physicalDevices[VK_MAX_DEVICE_GROUP_SIZE]; - VkBool32 subsetAllocation; -} VkPhysicalDeviceGroupProperties; - -typedef struct VkDeviceGroupDeviceCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t physicalDeviceCount; - const VkPhysicalDevice* pPhysicalDevices; -} VkDeviceGroupDeviceCreateInfo; - -typedef struct VkBufferMemoryRequirementsInfo2 { - VkStructureType sType; - const void* pNext; - VkBuffer buffer; -} VkBufferMemoryRequirementsInfo2; - -typedef struct VkImageMemoryRequirementsInfo2 { - VkStructureType sType; - const void* pNext; - VkImage image; -} VkImageMemoryRequirementsInfo2; - -typedef struct VkImageSparseMemoryRequirementsInfo2 { - VkStructureType sType; - const void* pNext; - VkImage image; -} VkImageSparseMemoryRequirementsInfo2; - -typedef struct VkMemoryRequirements2 { - VkStructureType sType; - void* pNext; - VkMemoryRequirements memoryRequirements; -} VkMemoryRequirements2; - -typedef struct VkSparseImageMemoryRequirements2 { - VkStructureType sType; - void* pNext; - VkSparseImageMemoryRequirements memoryRequirements; -} VkSparseImageMemoryRequirements2; - -typedef struct VkPhysicalDeviceFeatures2 { - VkStructureType sType; - void* pNext; - VkPhysicalDeviceFeatures features; -} VkPhysicalDeviceFeatures2; - -typedef struct VkPhysicalDeviceProperties2 { - VkStructureType sType; - void* pNext; - VkPhysicalDeviceProperties properties; -} VkPhysicalDeviceProperties2; - -typedef struct VkFormatProperties2 { - VkStructureType sType; - void* pNext; - VkFormatProperties formatProperties; -} VkFormatProperties2; - -typedef struct VkImageFormatProperties2 { - VkStructureType sType; - void* pNext; - VkImageFormatProperties imageFormatProperties; -} VkImageFormatProperties2; - -typedef struct VkPhysicalDeviceImageFormatInfo2 { - VkStructureType sType; - const void* pNext; - VkFormat format; - VkImageType type; - VkImageTiling tiling; - VkImageUsageFlags usage; - VkImageCreateFlags flags; -} VkPhysicalDeviceImageFormatInfo2; - -typedef struct VkQueueFamilyProperties2 { - VkStructureType sType; - void* pNext; - VkQueueFamilyProperties queueFamilyProperties; -} VkQueueFamilyProperties2; - -typedef struct VkPhysicalDeviceMemoryProperties2 { - VkStructureType sType; - void* pNext; - VkPhysicalDeviceMemoryProperties memoryProperties; -} VkPhysicalDeviceMemoryProperties2; - -typedef struct VkSparseImageFormatProperties2 { - VkStructureType sType; - void* pNext; - VkSparseImageFormatProperties properties; -} VkSparseImageFormatProperties2; - -typedef struct VkPhysicalDeviceSparseImageFormatInfo2 { - VkStructureType sType; - const void* pNext; - VkFormat format; - VkImageType type; - VkSampleCountFlagBits samples; - VkImageUsageFlags usage; - VkImageTiling tiling; -} VkPhysicalDeviceSparseImageFormatInfo2; - -typedef struct VkPhysicalDevicePointClippingProperties { - VkStructureType sType; - void* pNext; - VkPointClippingBehavior pointClippingBehavior; -} VkPhysicalDevicePointClippingProperties; - -typedef struct VkInputAttachmentAspectReference { - uint32_t subpass; - uint32_t inputAttachmentIndex; - VkImageAspectFlags aspectMask; -} VkInputAttachmentAspectReference; - -typedef struct VkRenderPassInputAttachmentAspectCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t aspectReferenceCount; - const VkInputAttachmentAspectReference* pAspectReferences; -} VkRenderPassInputAttachmentAspectCreateInfo; - -typedef struct VkImageViewUsageCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageUsageFlags usage; -} VkImageViewUsageCreateInfo; - -typedef struct VkPipelineTessellationDomainOriginStateCreateInfo { - VkStructureType sType; - const void* pNext; - VkTessellationDomainOrigin domainOrigin; -} VkPipelineTessellationDomainOriginStateCreateInfo; - -typedef struct VkRenderPassMultiviewCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t subpassCount; - const uint32_t* pViewMasks; - uint32_t dependencyCount; - const int32_t* pViewOffsets; - uint32_t correlationMaskCount; - const uint32_t* pCorrelationMasks; -} VkRenderPassMultiviewCreateInfo; - -typedef struct VkPhysicalDeviceMultiviewFeatures { - VkStructureType sType; - void* pNext; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; -} VkPhysicalDeviceMultiviewFeatures; - -typedef struct VkPhysicalDeviceMultiviewProperties { - VkStructureType sType; - void* pNext; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; -} VkPhysicalDeviceMultiviewProperties; - -typedef struct VkPhysicalDeviceVariablePointersFeatures { - VkStructureType sType; - void* pNext; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; -} VkPhysicalDeviceVariablePointersFeatures; - -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointerFeatures; - -typedef struct VkPhysicalDeviceProtectedMemoryFeatures { - VkStructureType sType; - void* pNext; - VkBool32 protectedMemory; -} VkPhysicalDeviceProtectedMemoryFeatures; - -typedef struct VkPhysicalDeviceProtectedMemoryProperties { - VkStructureType sType; - void* pNext; - VkBool32 protectedNoFault; -} VkPhysicalDeviceProtectedMemoryProperties; - -typedef struct VkDeviceQueueInfo2 { - VkStructureType sType; - const void* pNext; - VkDeviceQueueCreateFlags flags; - uint32_t queueFamilyIndex; - uint32_t queueIndex; -} VkDeviceQueueInfo2; - -typedef struct VkProtectedSubmitInfo { - VkStructureType sType; - const void* pNext; - VkBool32 protectedSubmit; -} VkProtectedSubmitInfo; - -typedef struct VkSamplerYcbcrConversionCreateInfo { - VkStructureType sType; - const void* pNext; - VkFormat format; - VkSamplerYcbcrModelConversion ycbcrModel; - VkSamplerYcbcrRange ycbcrRange; - VkComponentMapping components; - VkChromaLocation xChromaOffset; - VkChromaLocation yChromaOffset; - VkFilter chromaFilter; - VkBool32 forceExplicitReconstruction; -} VkSamplerYcbcrConversionCreateInfo; - -typedef struct VkSamplerYcbcrConversionInfo { - VkStructureType sType; - const void* pNext; - VkSamplerYcbcrConversion conversion; -} VkSamplerYcbcrConversionInfo; - -typedef struct VkBindImagePlaneMemoryInfo { - VkStructureType sType; - const void* pNext; - VkImageAspectFlagBits planeAspect; -} VkBindImagePlaneMemoryInfo; - -typedef struct VkImagePlaneMemoryRequirementsInfo { - VkStructureType sType; - const void* pNext; - VkImageAspectFlagBits planeAspect; -} VkImagePlaneMemoryRequirementsInfo; - -typedef struct VkPhysicalDeviceSamplerYcbcrConversionFeatures { - VkStructureType sType; - void* pNext; - VkBool32 samplerYcbcrConversion; -} VkPhysicalDeviceSamplerYcbcrConversionFeatures; - -typedef struct VkSamplerYcbcrConversionImageFormatProperties { - VkStructureType sType; - void* pNext; - uint32_t combinedImageSamplerDescriptorCount; -} VkSamplerYcbcrConversionImageFormatProperties; - -typedef struct VkDescriptorUpdateTemplateEntry { - uint32_t dstBinding; - uint32_t dstArrayElement; - uint32_t descriptorCount; - VkDescriptorType descriptorType; - size_t offset; - size_t stride; -} VkDescriptorUpdateTemplateEntry; - -typedef struct VkDescriptorUpdateTemplateCreateInfo { - VkStructureType sType; - const void* pNext; - VkDescriptorUpdateTemplateCreateFlags flags; - uint32_t descriptorUpdateEntryCount; - const VkDescriptorUpdateTemplateEntry* pDescriptorUpdateEntries; - VkDescriptorUpdateTemplateType templateType; - VkDescriptorSetLayout descriptorSetLayout; - VkPipelineBindPoint pipelineBindPoint; - VkPipelineLayout pipelineLayout; - uint32_t set; -} VkDescriptorUpdateTemplateCreateInfo; - -typedef struct VkExternalMemoryProperties { - VkExternalMemoryFeatureFlags externalMemoryFeatures; - VkExternalMemoryHandleTypeFlags exportFromImportedHandleTypes; - VkExternalMemoryHandleTypeFlags compatibleHandleTypes; -} VkExternalMemoryProperties; - -typedef struct VkPhysicalDeviceExternalImageFormatInfo { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalImageFormatInfo; - -typedef struct VkExternalImageFormatProperties { - VkStructureType sType; - void* pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalImageFormatProperties; - -typedef struct VkPhysicalDeviceExternalBufferInfo { - VkStructureType sType; - const void* pNext; - VkBufferCreateFlags flags; - VkBufferUsageFlags usage; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalBufferInfo; - -typedef struct VkExternalBufferProperties { - VkStructureType sType; - void* pNext; - VkExternalMemoryProperties externalMemoryProperties; -} VkExternalBufferProperties; - -typedef struct VkPhysicalDeviceIDProperties { - VkStructureType sType; - void* pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; -} VkPhysicalDeviceIDProperties; - -typedef struct VkExternalMemoryImageCreateInfo { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryImageCreateInfo; - -typedef struct VkExternalMemoryBufferCreateInfo { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExternalMemoryBufferCreateInfo; - -typedef struct VkExportMemoryAllocateInfo { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlags handleTypes; -} VkExportMemoryAllocateInfo; - -typedef struct VkPhysicalDeviceExternalFenceInfo { - VkStructureType sType; - const void* pNext; - VkExternalFenceHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalFenceInfo; - -typedef struct VkExternalFenceProperties { - VkStructureType sType; - void* pNext; - VkExternalFenceHandleTypeFlags exportFromImportedHandleTypes; - VkExternalFenceHandleTypeFlags compatibleHandleTypes; - VkExternalFenceFeatureFlags externalFenceFeatures; -} VkExternalFenceProperties; - -typedef struct VkExportFenceCreateInfo { - VkStructureType sType; - const void* pNext; - VkExternalFenceHandleTypeFlags handleTypes; -} VkExportFenceCreateInfo; - -typedef struct VkExportSemaphoreCreateInfo { - VkStructureType sType; - const void* pNext; - VkExternalSemaphoreHandleTypeFlags handleTypes; -} VkExportSemaphoreCreateInfo; - -typedef struct VkPhysicalDeviceExternalSemaphoreInfo { - VkStructureType sType; - const void* pNext; - VkExternalSemaphoreHandleTypeFlagBits handleType; -} VkPhysicalDeviceExternalSemaphoreInfo; - -typedef struct VkExternalSemaphoreProperties { - VkStructureType sType; - void* pNext; - VkExternalSemaphoreHandleTypeFlags exportFromImportedHandleTypes; - VkExternalSemaphoreHandleTypeFlags compatibleHandleTypes; - VkExternalSemaphoreFeatureFlags externalSemaphoreFeatures; -} VkExternalSemaphoreProperties; - -typedef struct VkPhysicalDeviceMaintenance3Properties { - VkStructureType sType; - void* pNext; - uint32_t maxPerSetDescriptors; - VkDeviceSize maxMemoryAllocationSize; -} VkPhysicalDeviceMaintenance3Properties; - -typedef struct VkDescriptorSetLayoutSupport { - VkStructureType sType; - void* pNext; - VkBool32 supported; -} VkDescriptorSetLayoutSupport; - -typedef struct VkPhysicalDeviceShaderDrawParametersFeatures { - VkStructureType sType; - void* pNext; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceShaderDrawParametersFeatures; - -typedef VkPhysicalDeviceShaderDrawParametersFeatures VkPhysicalDeviceShaderDrawParameterFeatures; - -typedef VkResult (VKAPI_PTR *PFN_vkEnumerateInstanceVersion)(uint32_t* pApiVersion); -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos); -typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeatures)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures); -typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMask)(VkCommandBuffer commandBuffer, uint32_t deviceMask); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchBase)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroups)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties); -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2)(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2)(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties); -typedef void (VKAPI_PTR *PFN_vkTrimCommandPool)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); -typedef void (VKAPI_PTR *PFN_vkGetDeviceQueue2)(VkDevice device, const VkDeviceQueueInfo2* pQueueInfo, VkQueue* pQueue); -typedef VkResult (VKAPI_PTR *PFN_vkCreateSamplerYcbcrConversion)(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion); -typedef void (VKAPI_PTR *PFN_vkDestroySamplerYcbcrConversion)(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplate)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplate)(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplate)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFenceProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphoreProperties)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties); -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSupport)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkEnumerateInstanceVersion( - uint32_t* pApiVersion); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2( - VkDevice device, - uint32_t bindInfoCount, - const VkBindBufferMemoryInfo* pBindInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2( - VkDevice device, - uint32_t bindInfoCount, - const VkBindImageMemoryInfo* pBindInfos); - -VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeatures( - VkDevice device, - uint32_t heapIndex, - uint32_t localDeviceIndex, - uint32_t remoteDeviceIndex, - VkPeerMemoryFeatureFlags* pPeerMemoryFeatures); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMask( - VkCommandBuffer commandBuffer, - uint32_t deviceMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBase( - VkCommandBuffer commandBuffer, - uint32_t baseGroupX, - uint32_t baseGroupY, - uint32_t baseGroupZ, - uint32_t groupCountX, - uint32_t groupCountY, - uint32_t groupCountZ); - -VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroups( - VkInstance instance, - uint32_t* pPhysicalDeviceGroupCount, - VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2( - VkDevice device, - const VkImageMemoryRequirementsInfo2* pInfo, - VkMemoryRequirements2* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2( - VkDevice device, - const VkBufferMemoryRequirementsInfo2* pInfo, - VkMemoryRequirements2* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2( - VkDevice device, - const VkImageSparseMemoryRequirementsInfo2* pInfo, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures2* pFeatures); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties2* pProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkFormatProperties2* pFormatProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, - VkImageFormatProperties2* pImageFormatProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2( - VkPhysicalDevice physicalDevice, - uint32_t* pQueueFamilyPropertyCount, - VkQueueFamilyProperties2* pQueueFamilyProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties2* pMemoryProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, - uint32_t* pPropertyCount, - VkSparseImageFormatProperties2* pProperties); - -VKAPI_ATTR void VKAPI_CALL vkTrimCommandPool( - VkDevice device, - VkCommandPool commandPool, - VkCommandPoolTrimFlags flags); - -VKAPI_ATTR void VKAPI_CALL vkGetDeviceQueue2( - VkDevice device, - const VkDeviceQueueInfo2* pQueueInfo, - VkQueue* pQueue); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversion( - VkDevice device, - const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSamplerYcbcrConversion* pYcbcrConversion); - -VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversion( - VkDevice device, - VkSamplerYcbcrConversion ycbcrConversion, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplate( - VkDevice device, - const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplate( - VkDevice device, - VkDescriptorUpdateTemplate descriptorUpdateTemplate, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplate( - VkDevice device, - VkDescriptorSet descriptorSet, - VkDescriptorUpdateTemplate descriptorUpdateTemplate, - const void* pData); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferProperties( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, - VkExternalBufferProperties* pExternalBufferProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFenceProperties( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, - VkExternalFenceProperties* pExternalFenceProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphoreProperties( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, - VkExternalSemaphoreProperties* pExternalSemaphoreProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport( - VkDevice device, - const VkDescriptorSetLayoutCreateInfo* pCreateInfo, - VkDescriptorSetLayoutSupport* pSupport); -#endif - - -#define VK_VERSION_1_2 1 -// Vulkan 1.2 version number -#define VK_API_VERSION_1_2 VK_MAKE_API_VERSION(0, 1, 2, 0)// Patch version should always be set to 0 - -#define VK_MAX_DRIVER_NAME_SIZE 256U -#define VK_MAX_DRIVER_INFO_SIZE 256U - -typedef enum VkDriverId { - VK_DRIVER_ID_AMD_PROPRIETARY = 1, - VK_DRIVER_ID_AMD_OPEN_SOURCE = 2, - VK_DRIVER_ID_MESA_RADV = 3, - VK_DRIVER_ID_NVIDIA_PROPRIETARY = 4, - VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS = 5, - VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA = 6, - VK_DRIVER_ID_IMAGINATION_PROPRIETARY = 7, - VK_DRIVER_ID_QUALCOMM_PROPRIETARY = 8, - VK_DRIVER_ID_ARM_PROPRIETARY = 9, - VK_DRIVER_ID_GOOGLE_SWIFTSHADER = 10, - VK_DRIVER_ID_GGP_PROPRIETARY = 11, - VK_DRIVER_ID_BROADCOM_PROPRIETARY = 12, - VK_DRIVER_ID_MESA_LLVMPIPE = 13, - VK_DRIVER_ID_MOLTENVK = 14, - VK_DRIVER_ID_COREAVI_PROPRIETARY = 15, - VK_DRIVER_ID_AMD_PROPRIETARY_KHR = VK_DRIVER_ID_AMD_PROPRIETARY, - VK_DRIVER_ID_AMD_OPEN_SOURCE_KHR = VK_DRIVER_ID_AMD_OPEN_SOURCE, - VK_DRIVER_ID_MESA_RADV_KHR = VK_DRIVER_ID_MESA_RADV, - VK_DRIVER_ID_NVIDIA_PROPRIETARY_KHR = VK_DRIVER_ID_NVIDIA_PROPRIETARY, - VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS_KHR = VK_DRIVER_ID_INTEL_PROPRIETARY_WINDOWS, - VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA_KHR = VK_DRIVER_ID_INTEL_OPEN_SOURCE_MESA, - VK_DRIVER_ID_IMAGINATION_PROPRIETARY_KHR = VK_DRIVER_ID_IMAGINATION_PROPRIETARY, - VK_DRIVER_ID_QUALCOMM_PROPRIETARY_KHR = VK_DRIVER_ID_QUALCOMM_PROPRIETARY, - VK_DRIVER_ID_ARM_PROPRIETARY_KHR = VK_DRIVER_ID_ARM_PROPRIETARY, - VK_DRIVER_ID_GOOGLE_SWIFTSHADER_KHR = VK_DRIVER_ID_GOOGLE_SWIFTSHADER, - VK_DRIVER_ID_GGP_PROPRIETARY_KHR = VK_DRIVER_ID_GGP_PROPRIETARY, - VK_DRIVER_ID_BROADCOM_PROPRIETARY_KHR = VK_DRIVER_ID_BROADCOM_PROPRIETARY, - VK_DRIVER_ID_MAX_ENUM = 0x7FFFFFFF -} VkDriverId; - -typedef enum VkShaderFloatControlsIndependence { - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY = 0, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL = 1, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE = 2, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_32_BIT_ONLY, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_ALL, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE_KHR = VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_NONE, - VK_SHADER_FLOAT_CONTROLS_INDEPENDENCE_MAX_ENUM = 0x7FFFFFFF -} VkShaderFloatControlsIndependence; - -typedef enum VkSamplerReductionMode { - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE = 0, - VK_SAMPLER_REDUCTION_MODE_MIN = 1, - VK_SAMPLER_REDUCTION_MODE_MAX = 2, - VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE_EXT = VK_SAMPLER_REDUCTION_MODE_WEIGHTED_AVERAGE, - VK_SAMPLER_REDUCTION_MODE_MIN_EXT = VK_SAMPLER_REDUCTION_MODE_MIN, - VK_SAMPLER_REDUCTION_MODE_MAX_EXT = VK_SAMPLER_REDUCTION_MODE_MAX, - VK_SAMPLER_REDUCTION_MODE_MAX_ENUM = 0x7FFFFFFF -} VkSamplerReductionMode; - -typedef enum VkSemaphoreType { - VK_SEMAPHORE_TYPE_BINARY = 0, - VK_SEMAPHORE_TYPE_TIMELINE = 1, - VK_SEMAPHORE_TYPE_BINARY_KHR = VK_SEMAPHORE_TYPE_BINARY, - VK_SEMAPHORE_TYPE_TIMELINE_KHR = VK_SEMAPHORE_TYPE_TIMELINE, - VK_SEMAPHORE_TYPE_MAX_ENUM = 0x7FFFFFFF -} VkSemaphoreType; - -typedef enum VkResolveModeFlagBits { - VK_RESOLVE_MODE_NONE = 0, - VK_RESOLVE_MODE_SAMPLE_ZERO_BIT = 0x00000001, - VK_RESOLVE_MODE_AVERAGE_BIT = 0x00000002, - VK_RESOLVE_MODE_MIN_BIT = 0x00000004, - VK_RESOLVE_MODE_MAX_BIT = 0x00000008, - VK_RESOLVE_MODE_NONE_KHR = VK_RESOLVE_MODE_NONE, - VK_RESOLVE_MODE_SAMPLE_ZERO_BIT_KHR = VK_RESOLVE_MODE_SAMPLE_ZERO_BIT, - VK_RESOLVE_MODE_AVERAGE_BIT_KHR = VK_RESOLVE_MODE_AVERAGE_BIT, - VK_RESOLVE_MODE_MIN_BIT_KHR = VK_RESOLVE_MODE_MIN_BIT, - VK_RESOLVE_MODE_MAX_BIT_KHR = VK_RESOLVE_MODE_MAX_BIT, - VK_RESOLVE_MODE_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkResolveModeFlagBits; -typedef VkFlags VkResolveModeFlags; - -typedef enum VkDescriptorBindingFlagBits { - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT = 0x00000001, - VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT = 0x00000002, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT = 0x00000004, - VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT = 0x00000008, - VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_AFTER_BIND_BIT, - VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT_EXT = VK_DESCRIPTOR_BINDING_UPDATE_UNUSED_WHILE_PENDING_BIT, - VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT_EXT = VK_DESCRIPTOR_BINDING_PARTIALLY_BOUND_BIT, - VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT_EXT = VK_DESCRIPTOR_BINDING_VARIABLE_DESCRIPTOR_COUNT_BIT, - VK_DESCRIPTOR_BINDING_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkDescriptorBindingFlagBits; -typedef VkFlags VkDescriptorBindingFlags; - -typedef enum VkSemaphoreWaitFlagBits { - VK_SEMAPHORE_WAIT_ANY_BIT = 0x00000001, - VK_SEMAPHORE_WAIT_ANY_BIT_KHR = VK_SEMAPHORE_WAIT_ANY_BIT, - VK_SEMAPHORE_WAIT_FLAG_BITS_MAX_ENUM = 0x7FFFFFFF -} VkSemaphoreWaitFlagBits; -typedef VkFlags VkSemaphoreWaitFlags; -typedef struct VkPhysicalDeviceVulkan11Features { - VkStructureType sType; - void* pNext; - VkBool32 storageBuffer16BitAccess; - VkBool32 uniformAndStorageBuffer16BitAccess; - VkBool32 storagePushConstant16; - VkBool32 storageInputOutput16; - VkBool32 multiview; - VkBool32 multiviewGeometryShader; - VkBool32 multiviewTessellationShader; - VkBool32 variablePointersStorageBuffer; - VkBool32 variablePointers; - VkBool32 protectedMemory; - VkBool32 samplerYcbcrConversion; - VkBool32 shaderDrawParameters; -} VkPhysicalDeviceVulkan11Features; - -typedef struct VkPhysicalDeviceVulkan11Properties { - VkStructureType sType; - void* pNext; - uint8_t deviceUUID[VK_UUID_SIZE]; - uint8_t driverUUID[VK_UUID_SIZE]; - uint8_t deviceLUID[VK_LUID_SIZE]; - uint32_t deviceNodeMask; - VkBool32 deviceLUIDValid; - uint32_t subgroupSize; - VkShaderStageFlags subgroupSupportedStages; - VkSubgroupFeatureFlags subgroupSupportedOperations; - VkBool32 subgroupQuadOperationsInAllStages; - VkPointClippingBehavior pointClippingBehavior; - uint32_t maxMultiviewViewCount; - uint32_t maxMultiviewInstanceIndex; - VkBool32 protectedNoFault; - uint32_t maxPerSetDescriptors; - VkDeviceSize maxMemoryAllocationSize; -} VkPhysicalDeviceVulkan11Properties; - -typedef struct VkPhysicalDeviceVulkan12Features { - VkStructureType sType; - void* pNext; - VkBool32 samplerMirrorClampToEdge; - VkBool32 drawIndirectCount; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; - VkBool32 descriptorIndexing; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; - VkBool32 samplerFilterMinmax; - VkBool32 scalarBlockLayout; - VkBool32 imagelessFramebuffer; - VkBool32 uniformBufferStandardLayout; - VkBool32 shaderSubgroupExtendedTypes; - VkBool32 separateDepthStencilLayouts; - VkBool32 hostQueryReset; - VkBool32 timelineSemaphore; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; - VkBool32 shaderOutputViewportIndex; - VkBool32 shaderOutputLayer; - VkBool32 subgroupBroadcastDynamicId; -} VkPhysicalDeviceVulkan12Features; - -typedef struct VkConformanceVersion { - uint8_t major; - uint8_t minor; - uint8_t subminor; - uint8_t patch; -} VkConformanceVersion; - -typedef struct VkPhysicalDeviceVulkan12Properties { - VkStructureType sType; - void* pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; - uint64_t maxTimelineSemaphoreValueDifference; - VkSampleCountFlags framebufferIntegerColorSampleCounts; -} VkPhysicalDeviceVulkan12Properties; - -typedef struct VkImageFormatListCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t viewFormatCount; - const VkFormat* pViewFormats; -} VkImageFormatListCreateInfo; - -typedef struct VkAttachmentDescription2 { - VkStructureType sType; - const void* pNext; - VkAttachmentDescriptionFlags flags; - VkFormat format; - VkSampleCountFlagBits samples; - VkAttachmentLoadOp loadOp; - VkAttachmentStoreOp storeOp; - VkAttachmentLoadOp stencilLoadOp; - VkAttachmentStoreOp stencilStoreOp; - VkImageLayout initialLayout; - VkImageLayout finalLayout; -} VkAttachmentDescription2; - -typedef struct VkAttachmentReference2 { - VkStructureType sType; - const void* pNext; - uint32_t attachment; - VkImageLayout layout; - VkImageAspectFlags aspectMask; -} VkAttachmentReference2; - -typedef struct VkSubpassDescription2 { - VkStructureType sType; - const void* pNext; - VkSubpassDescriptionFlags flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t viewMask; - uint32_t inputAttachmentCount; - const VkAttachmentReference2* pInputAttachments; - uint32_t colorAttachmentCount; - const VkAttachmentReference2* pColorAttachments; - const VkAttachmentReference2* pResolveAttachments; - const VkAttachmentReference2* pDepthStencilAttachment; - uint32_t preserveAttachmentCount; - const uint32_t* pPreserveAttachments; -} VkSubpassDescription2; - -typedef struct VkSubpassDependency2 { - VkStructureType sType; - const void* pNext; - uint32_t srcSubpass; - uint32_t dstSubpass; - VkPipelineStageFlags srcStageMask; - VkPipelineStageFlags dstStageMask; - VkAccessFlags srcAccessMask; - VkAccessFlags dstAccessMask; - VkDependencyFlags dependencyFlags; - int32_t viewOffset; -} VkSubpassDependency2; - -typedef struct VkRenderPassCreateInfo2 { - VkStructureType sType; - const void* pNext; - VkRenderPassCreateFlags flags; - uint32_t attachmentCount; - const VkAttachmentDescription2* pAttachments; - uint32_t subpassCount; - const VkSubpassDescription2* pSubpasses; - uint32_t dependencyCount; - const VkSubpassDependency2* pDependencies; - uint32_t correlatedViewMaskCount; - const uint32_t* pCorrelatedViewMasks; -} VkRenderPassCreateInfo2; - -typedef struct VkSubpassBeginInfo { - VkStructureType sType; - const void* pNext; - VkSubpassContents contents; -} VkSubpassBeginInfo; - -typedef struct VkSubpassEndInfo { - VkStructureType sType; - const void* pNext; -} VkSubpassEndInfo; - -typedef struct VkPhysicalDevice8BitStorageFeatures { - VkStructureType sType; - void* pNext; - VkBool32 storageBuffer8BitAccess; - VkBool32 uniformAndStorageBuffer8BitAccess; - VkBool32 storagePushConstant8; -} VkPhysicalDevice8BitStorageFeatures; - -typedef struct VkPhysicalDeviceDriverProperties { - VkStructureType sType; - void* pNext; - VkDriverId driverID; - char driverName[VK_MAX_DRIVER_NAME_SIZE]; - char driverInfo[VK_MAX_DRIVER_INFO_SIZE]; - VkConformanceVersion conformanceVersion; -} VkPhysicalDeviceDriverProperties; - -typedef struct VkPhysicalDeviceShaderAtomicInt64Features { - VkStructureType sType; - void* pNext; - VkBool32 shaderBufferInt64Atomics; - VkBool32 shaderSharedInt64Atomics; -} VkPhysicalDeviceShaderAtomicInt64Features; - -typedef struct VkPhysicalDeviceShaderFloat16Int8Features { - VkStructureType sType; - void* pNext; - VkBool32 shaderFloat16; - VkBool32 shaderInt8; -} VkPhysicalDeviceShaderFloat16Int8Features; - -typedef struct VkPhysicalDeviceFloatControlsProperties { - VkStructureType sType; - void* pNext; - VkShaderFloatControlsIndependence denormBehaviorIndependence; - VkShaderFloatControlsIndependence roundingModeIndependence; - VkBool32 shaderSignedZeroInfNanPreserveFloat16; - VkBool32 shaderSignedZeroInfNanPreserveFloat32; - VkBool32 shaderSignedZeroInfNanPreserveFloat64; - VkBool32 shaderDenormPreserveFloat16; - VkBool32 shaderDenormPreserveFloat32; - VkBool32 shaderDenormPreserveFloat64; - VkBool32 shaderDenormFlushToZeroFloat16; - VkBool32 shaderDenormFlushToZeroFloat32; - VkBool32 shaderDenormFlushToZeroFloat64; - VkBool32 shaderRoundingModeRTEFloat16; - VkBool32 shaderRoundingModeRTEFloat32; - VkBool32 shaderRoundingModeRTEFloat64; - VkBool32 shaderRoundingModeRTZFloat16; - VkBool32 shaderRoundingModeRTZFloat32; - VkBool32 shaderRoundingModeRTZFloat64; -} VkPhysicalDeviceFloatControlsProperties; - -typedef struct VkDescriptorSetLayoutBindingFlagsCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t bindingCount; - const VkDescriptorBindingFlags* pBindingFlags; -} VkDescriptorSetLayoutBindingFlagsCreateInfo; - -typedef struct VkPhysicalDeviceDescriptorIndexingFeatures { - VkStructureType sType; - void* pNext; - VkBool32 shaderInputAttachmentArrayDynamicIndexing; - VkBool32 shaderUniformTexelBufferArrayDynamicIndexing; - VkBool32 shaderStorageTexelBufferArrayDynamicIndexing; - VkBool32 shaderUniformBufferArrayNonUniformIndexing; - VkBool32 shaderSampledImageArrayNonUniformIndexing; - VkBool32 shaderStorageBufferArrayNonUniformIndexing; - VkBool32 shaderStorageImageArrayNonUniformIndexing; - VkBool32 shaderInputAttachmentArrayNonUniformIndexing; - VkBool32 shaderUniformTexelBufferArrayNonUniformIndexing; - VkBool32 shaderStorageTexelBufferArrayNonUniformIndexing; - VkBool32 descriptorBindingUniformBufferUpdateAfterBind; - VkBool32 descriptorBindingSampledImageUpdateAfterBind; - VkBool32 descriptorBindingStorageImageUpdateAfterBind; - VkBool32 descriptorBindingStorageBufferUpdateAfterBind; - VkBool32 descriptorBindingUniformTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingStorageTexelBufferUpdateAfterBind; - VkBool32 descriptorBindingUpdateUnusedWhilePending; - VkBool32 descriptorBindingPartiallyBound; - VkBool32 descriptorBindingVariableDescriptorCount; - VkBool32 runtimeDescriptorArray; -} VkPhysicalDeviceDescriptorIndexingFeatures; - -typedef struct VkPhysicalDeviceDescriptorIndexingProperties { - VkStructureType sType; - void* pNext; - uint32_t maxUpdateAfterBindDescriptorsInAllPools; - VkBool32 shaderUniformBufferArrayNonUniformIndexingNative; - VkBool32 shaderSampledImageArrayNonUniformIndexingNative; - VkBool32 shaderStorageBufferArrayNonUniformIndexingNative; - VkBool32 shaderStorageImageArrayNonUniformIndexingNative; - VkBool32 shaderInputAttachmentArrayNonUniformIndexingNative; - VkBool32 robustBufferAccessUpdateAfterBind; - VkBool32 quadDivergentImplicitLod; - uint32_t maxPerStageDescriptorUpdateAfterBindSamplers; - uint32_t maxPerStageDescriptorUpdateAfterBindUniformBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageBuffers; - uint32_t maxPerStageDescriptorUpdateAfterBindSampledImages; - uint32_t maxPerStageDescriptorUpdateAfterBindStorageImages; - uint32_t maxPerStageDescriptorUpdateAfterBindInputAttachments; - uint32_t maxPerStageUpdateAfterBindResources; - uint32_t maxDescriptorSetUpdateAfterBindSamplers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffers; - uint32_t maxDescriptorSetUpdateAfterBindUniformBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffers; - uint32_t maxDescriptorSetUpdateAfterBindStorageBuffersDynamic; - uint32_t maxDescriptorSetUpdateAfterBindSampledImages; - uint32_t maxDescriptorSetUpdateAfterBindStorageImages; - uint32_t maxDescriptorSetUpdateAfterBindInputAttachments; -} VkPhysicalDeviceDescriptorIndexingProperties; - -typedef struct VkDescriptorSetVariableDescriptorCountAllocateInfo { - VkStructureType sType; - const void* pNext; - uint32_t descriptorSetCount; - const uint32_t* pDescriptorCounts; -} VkDescriptorSetVariableDescriptorCountAllocateInfo; - -typedef struct VkDescriptorSetVariableDescriptorCountLayoutSupport { - VkStructureType sType; - void* pNext; - uint32_t maxVariableDescriptorCount; -} VkDescriptorSetVariableDescriptorCountLayoutSupport; - -typedef struct VkSubpassDescriptionDepthStencilResolve { - VkStructureType sType; - const void* pNext; - VkResolveModeFlagBits depthResolveMode; - VkResolveModeFlagBits stencilResolveMode; - const VkAttachmentReference2* pDepthStencilResolveAttachment; -} VkSubpassDescriptionDepthStencilResolve; - -typedef struct VkPhysicalDeviceDepthStencilResolveProperties { - VkStructureType sType; - void* pNext; - VkResolveModeFlags supportedDepthResolveModes; - VkResolveModeFlags supportedStencilResolveModes; - VkBool32 independentResolveNone; - VkBool32 independentResolve; -} VkPhysicalDeviceDepthStencilResolveProperties; - -typedef struct VkPhysicalDeviceScalarBlockLayoutFeatures { - VkStructureType sType; - void* pNext; - VkBool32 scalarBlockLayout; -} VkPhysicalDeviceScalarBlockLayoutFeatures; - -typedef struct VkImageStencilUsageCreateInfo { - VkStructureType sType; - const void* pNext; - VkImageUsageFlags stencilUsage; -} VkImageStencilUsageCreateInfo; - -typedef struct VkSamplerReductionModeCreateInfo { - VkStructureType sType; - const void* pNext; - VkSamplerReductionMode reductionMode; -} VkSamplerReductionModeCreateInfo; - -typedef struct VkPhysicalDeviceSamplerFilterMinmaxProperties { - VkStructureType sType; - void* pNext; - VkBool32 filterMinmaxSingleComponentFormats; - VkBool32 filterMinmaxImageComponentMapping; -} VkPhysicalDeviceSamplerFilterMinmaxProperties; - -typedef struct VkPhysicalDeviceVulkanMemoryModelFeatures { - VkStructureType sType; - void* pNext; - VkBool32 vulkanMemoryModel; - VkBool32 vulkanMemoryModelDeviceScope; - VkBool32 vulkanMemoryModelAvailabilityVisibilityChains; -} VkPhysicalDeviceVulkanMemoryModelFeatures; - -typedef struct VkPhysicalDeviceImagelessFramebufferFeatures { - VkStructureType sType; - void* pNext; - VkBool32 imagelessFramebuffer; -} VkPhysicalDeviceImagelessFramebufferFeatures; - -typedef struct VkFramebufferAttachmentImageInfo { - VkStructureType sType; - const void* pNext; - VkImageCreateFlags flags; - VkImageUsageFlags usage; - uint32_t width; - uint32_t height; - uint32_t layerCount; - uint32_t viewFormatCount; - const VkFormat* pViewFormats; -} VkFramebufferAttachmentImageInfo; - -typedef struct VkFramebufferAttachmentsCreateInfo { - VkStructureType sType; - const void* pNext; - uint32_t attachmentImageInfoCount; - const VkFramebufferAttachmentImageInfo* pAttachmentImageInfos; -} VkFramebufferAttachmentsCreateInfo; - -typedef struct VkRenderPassAttachmentBeginInfo { - VkStructureType sType; - const void* pNext; - uint32_t attachmentCount; - const VkImageView* pAttachments; -} VkRenderPassAttachmentBeginInfo; - -typedef struct VkPhysicalDeviceUniformBufferStandardLayoutFeatures { - VkStructureType sType; - void* pNext; - VkBool32 uniformBufferStandardLayout; -} VkPhysicalDeviceUniformBufferStandardLayoutFeatures; - -typedef struct VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures { - VkStructureType sType; - void* pNext; - VkBool32 shaderSubgroupExtendedTypes; -} VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures; - -typedef struct VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures { - VkStructureType sType; - void* pNext; - VkBool32 separateDepthStencilLayouts; -} VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures; - -typedef struct VkAttachmentReferenceStencilLayout { - VkStructureType sType; - void* pNext; - VkImageLayout stencilLayout; -} VkAttachmentReferenceStencilLayout; - -typedef struct VkAttachmentDescriptionStencilLayout { - VkStructureType sType; - void* pNext; - VkImageLayout stencilInitialLayout; - VkImageLayout stencilFinalLayout; -} VkAttachmentDescriptionStencilLayout; - -typedef struct VkPhysicalDeviceHostQueryResetFeatures { - VkStructureType sType; - void* pNext; - VkBool32 hostQueryReset; -} VkPhysicalDeviceHostQueryResetFeatures; - -typedef struct VkPhysicalDeviceTimelineSemaphoreFeatures { - VkStructureType sType; - void* pNext; - VkBool32 timelineSemaphore; -} VkPhysicalDeviceTimelineSemaphoreFeatures; - -typedef struct VkPhysicalDeviceTimelineSemaphoreProperties { - VkStructureType sType; - void* pNext; - uint64_t maxTimelineSemaphoreValueDifference; -} VkPhysicalDeviceTimelineSemaphoreProperties; - -typedef struct VkSemaphoreTypeCreateInfo { - VkStructureType sType; - const void* pNext; - VkSemaphoreType semaphoreType; - uint64_t initialValue; -} VkSemaphoreTypeCreateInfo; - -typedef struct VkTimelineSemaphoreSubmitInfo { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreValueCount; - const uint64_t* pWaitSemaphoreValues; - uint32_t signalSemaphoreValueCount; - const uint64_t* pSignalSemaphoreValues; -} VkTimelineSemaphoreSubmitInfo; - -typedef struct VkSemaphoreWaitInfo { - VkStructureType sType; - const void* pNext; - VkSemaphoreWaitFlags flags; - uint32_t semaphoreCount; - const VkSemaphore* pSemaphores; - const uint64_t* pValues; -} VkSemaphoreWaitInfo; - -typedef struct VkSemaphoreSignalInfo { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - uint64_t value; -} VkSemaphoreSignalInfo; - -typedef struct VkPhysicalDeviceBufferDeviceAddressFeatures { - VkStructureType sType; - void* pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeatures; - -typedef struct VkBufferDeviceAddressInfo { - VkStructureType sType; - const void* pNext; - VkBuffer buffer; -} VkBufferDeviceAddressInfo; - -typedef struct VkBufferOpaqueCaptureAddressCreateInfo { - VkStructureType sType; - const void* pNext; - uint64_t opaqueCaptureAddress; -} VkBufferOpaqueCaptureAddressCreateInfo; - -typedef struct VkMemoryOpaqueCaptureAddressAllocateInfo { - VkStructureType sType; - const void* pNext; - uint64_t opaqueCaptureAddress; -} VkMemoryOpaqueCaptureAddressAllocateInfo; - -typedef struct VkDeviceMemoryOpaqueCaptureAddressInfo { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; -} VkDeviceMemoryOpaqueCaptureAddressInfo; - -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCount)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass2)(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass2)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass2)(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass2)(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo); -typedef void (VKAPI_PTR *PFN_vkResetQueryPool)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreCounterValue)(VkDevice device, VkSemaphore semaphore, uint64_t* pValue); -typedef VkResult (VKAPI_PTR *PFN_vkWaitSemaphores)(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout); -typedef VkResult (VKAPI_PTR *PFN_vkSignalSemaphore)(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddress)(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); -typedef uint64_t (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureAddress)(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); -typedef uint64_t (VKAPI_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddress)(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCount( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCount( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2( - VkDevice device, - const VkRenderPassCreateInfo2* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkRenderPass* pRenderPass); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2( - VkCommandBuffer commandBuffer, - const VkRenderPassBeginInfo* pRenderPassBegin, - const VkSubpassBeginInfo* pSubpassBeginInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2( - VkCommandBuffer commandBuffer, - const VkSubpassBeginInfo* pSubpassBeginInfo, - const VkSubpassEndInfo* pSubpassEndInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2( - VkCommandBuffer commandBuffer, - const VkSubpassEndInfo* pSubpassEndInfo); - -VKAPI_ATTR void VKAPI_CALL vkResetQueryPool( - VkDevice device, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValue( - VkDevice device, - VkSemaphore semaphore, - uint64_t* pValue); - -VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphores( - VkDevice device, - const VkSemaphoreWaitInfo* pWaitInfo, - uint64_t timeout); - -VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphore( - VkDevice device, - const VkSemaphoreSignalInfo* pSignalInfo); - -VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddress( - VkDevice device, - const VkBufferDeviceAddressInfo* pInfo); - -VKAPI_ATTR uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddress( - VkDevice device, - const VkBufferDeviceAddressInfo* pInfo); - -VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddress( - VkDevice device, - const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); -#endif - - -#define VK_KHR_surface 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSurfaceKHR) -#define VK_KHR_SURFACE_SPEC_VERSION 25 -#define VK_KHR_SURFACE_EXTENSION_NAME "VK_KHR_surface" - -typedef enum VkPresentModeKHR { - VK_PRESENT_MODE_IMMEDIATE_KHR = 0, - VK_PRESENT_MODE_MAILBOX_KHR = 1, - VK_PRESENT_MODE_FIFO_KHR = 2, - VK_PRESENT_MODE_FIFO_RELAXED_KHR = 3, - VK_PRESENT_MODE_SHARED_DEMAND_REFRESH_KHR = 1000111000, - VK_PRESENT_MODE_SHARED_CONTINUOUS_REFRESH_KHR = 1000111001, - VK_PRESENT_MODE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPresentModeKHR; - -typedef enum VkColorSpaceKHR { - VK_COLOR_SPACE_SRGB_NONLINEAR_KHR = 0, - VK_COLOR_SPACE_DISPLAY_P3_NONLINEAR_EXT = 1000104001, - VK_COLOR_SPACE_EXTENDED_SRGB_LINEAR_EXT = 1000104002, - VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT = 1000104003, - VK_COLOR_SPACE_DCI_P3_NONLINEAR_EXT = 1000104004, - VK_COLOR_SPACE_BT709_LINEAR_EXT = 1000104005, - VK_COLOR_SPACE_BT709_NONLINEAR_EXT = 1000104006, - VK_COLOR_SPACE_BT2020_LINEAR_EXT = 1000104007, - VK_COLOR_SPACE_HDR10_ST2084_EXT = 1000104008, - VK_COLOR_SPACE_DOLBYVISION_EXT = 1000104009, - VK_COLOR_SPACE_HDR10_HLG_EXT = 1000104010, - VK_COLOR_SPACE_ADOBERGB_LINEAR_EXT = 1000104011, - VK_COLOR_SPACE_ADOBERGB_NONLINEAR_EXT = 1000104012, - VK_COLOR_SPACE_PASS_THROUGH_EXT = 1000104013, - VK_COLOR_SPACE_EXTENDED_SRGB_NONLINEAR_EXT = 1000104014, - VK_COLOR_SPACE_DISPLAY_NATIVE_AMD = 1000213000, - VK_COLORSPACE_SRGB_NONLINEAR_KHR = VK_COLOR_SPACE_SRGB_NONLINEAR_KHR, - VK_COLOR_SPACE_DCI_P3_LINEAR_EXT = VK_COLOR_SPACE_DISPLAY_P3_LINEAR_EXT, - VK_COLOR_SPACE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkColorSpaceKHR; - -typedef enum VkSurfaceTransformFlagBitsKHR { - VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR = 0x00000001, - VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR = 0x00000002, - VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR = 0x00000004, - VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR = 0x00000008, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR = 0x00000010, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR = 0x00000020, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR = 0x00000040, - VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR = 0x00000080, - VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR = 0x00000100, - VK_SURFACE_TRANSFORM_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkSurfaceTransformFlagBitsKHR; - -typedef enum VkCompositeAlphaFlagBitsKHR { - VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, - VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR = 0x00000002, - VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR = 0x00000004, - VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR = 0x00000008, - VK_COMPOSITE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkCompositeAlphaFlagBitsKHR; -typedef VkFlags VkCompositeAlphaFlagsKHR; -typedef VkFlags VkSurfaceTransformFlagsKHR; -typedef struct VkSurfaceCapabilitiesKHR { - uint32_t minImageCount; - uint32_t maxImageCount; - VkExtent2D currentExtent; - VkExtent2D minImageExtent; - VkExtent2D maxImageExtent; - uint32_t maxImageArrayLayers; - VkSurfaceTransformFlagsKHR supportedTransforms; - VkSurfaceTransformFlagBitsKHR currentTransform; - VkCompositeAlphaFlagsKHR supportedCompositeAlpha; - VkImageUsageFlags supportedUsageFlags; -} VkSurfaceCapabilitiesKHR; - -typedef struct VkSurfaceFormatKHR { - VkFormat format; - VkColorSpaceKHR colorSpace; -} VkSurfaceFormatKHR; - -typedef void (VKAPI_PTR *PFN_vkDestroySurfaceKHR)(VkInstance instance, VkSurfaceKHR surface, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, VkSurfaceKHR surface, VkBool32* pSupported); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormatsKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pSurfaceFormatCount, VkSurfaceFormatKHR* pSurfaceFormats); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkDestroySurfaceKHR( - VkInstance instance, - VkSurfaceKHR surface, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - VkSurfaceKHR surface, - VkBool32* pSupported); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR* pSurfaceCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormatsKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t* pSurfaceFormatCount, - VkSurfaceFormatKHR* pSurfaceFormats); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t* pPresentModeCount, - VkPresentModeKHR* pPresentModes); -#endif - - -#define VK_KHR_swapchain 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkSwapchainKHR) -#define VK_KHR_SWAPCHAIN_SPEC_VERSION 70 -#define VK_KHR_SWAPCHAIN_EXTENSION_NAME "VK_KHR_swapchain" - -typedef enum VkSwapchainCreateFlagBitsKHR { - VK_SWAPCHAIN_CREATE_SPLIT_INSTANCE_BIND_REGIONS_BIT_KHR = 0x00000001, - VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR = 0x00000002, - VK_SWAPCHAIN_CREATE_MUTABLE_FORMAT_BIT_KHR = 0x00000004, - VK_SWAPCHAIN_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkSwapchainCreateFlagBitsKHR; -typedef VkFlags VkSwapchainCreateFlagsKHR; - -typedef enum VkDeviceGroupPresentModeFlagBitsKHR { - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR = 0x00000001, - VK_DEVICE_GROUP_PRESENT_MODE_REMOTE_BIT_KHR = 0x00000002, - VK_DEVICE_GROUP_PRESENT_MODE_SUM_BIT_KHR = 0x00000004, - VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_MULTI_DEVICE_BIT_KHR = 0x00000008, - VK_DEVICE_GROUP_PRESENT_MODE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkDeviceGroupPresentModeFlagBitsKHR; -typedef VkFlags VkDeviceGroupPresentModeFlagsKHR; -typedef struct VkSwapchainCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkSwapchainCreateFlagsKHR flags; - VkSurfaceKHR surface; - uint32_t minImageCount; - VkFormat imageFormat; - VkColorSpaceKHR imageColorSpace; - VkExtent2D imageExtent; - uint32_t imageArrayLayers; - VkImageUsageFlags imageUsage; - VkSharingMode imageSharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; - VkSurfaceTransformFlagBitsKHR preTransform; - VkCompositeAlphaFlagBitsKHR compositeAlpha; - VkPresentModeKHR presentMode; - VkBool32 clipped; - VkSwapchainKHR oldSwapchain; -} VkSwapchainCreateInfoKHR; - -typedef struct VkPresentInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreCount; - const VkSemaphore* pWaitSemaphores; - uint32_t swapchainCount; - const VkSwapchainKHR* pSwapchains; - const uint32_t* pImageIndices; - VkResult* pResults; -} VkPresentInfoKHR; - -typedef struct VkImageSwapchainCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkSwapchainKHR swapchain; -} VkImageSwapchainCreateInfoKHR; - -typedef struct VkBindImageMemorySwapchainInfoKHR { - VkStructureType sType; - const void* pNext; - VkSwapchainKHR swapchain; - uint32_t imageIndex; -} VkBindImageMemorySwapchainInfoKHR; - -typedef struct VkAcquireNextImageInfoKHR { - VkStructureType sType; - const void* pNext; - VkSwapchainKHR swapchain; - uint64_t timeout; - VkSemaphore semaphore; - VkFence fence; - uint32_t deviceMask; -} VkAcquireNextImageInfoKHR; - -typedef struct VkDeviceGroupPresentCapabilitiesKHR { - VkStructureType sType; - const void* pNext; - uint32_t presentMask[VK_MAX_DEVICE_GROUP_SIZE]; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupPresentCapabilitiesKHR; - -typedef struct VkDeviceGroupPresentInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t swapchainCount; - const uint32_t* pDeviceMasks; - VkDeviceGroupPresentModeFlagBitsKHR mode; -} VkDeviceGroupPresentInfoKHR; - -typedef struct VkDeviceGroupSwapchainCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkDeviceGroupPresentModeFlagsKHR modes; -} VkDeviceGroupSwapchainCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateSwapchainKHR)(VkDevice device, const VkSwapchainCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchain); -typedef void (VKAPI_PTR *PFN_vkDestroySwapchainKHR)(VkDevice device, VkSwapchainKHR swapchain, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainImagesKHR)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pSwapchainImageCount, VkImage* pSwapchainImages); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImageKHR)(VkDevice device, VkSwapchainKHR swapchain, uint64_t timeout, VkSemaphore semaphore, VkFence fence, uint32_t* pImageIndex); -typedef VkResult (VKAPI_PTR *PFN_vkQueuePresentKHR)(VkQueue queue, const VkPresentInfoKHR* pPresentInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupPresentCapabilitiesKHR)(VkDevice device, VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModesKHR)(VkDevice device, VkSurfaceKHR surface, VkDeviceGroupPresentModeFlagsKHR* pModes); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDevicePresentRectanglesKHR)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, uint32_t* pRectCount, VkRect2D* pRects); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireNextImage2KHR)(VkDevice device, const VkAcquireNextImageInfoKHR* pAcquireInfo, uint32_t* pImageIndex); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSwapchainKHR( - VkDevice device, - const VkSwapchainCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSwapchainKHR* pSwapchain); - -VKAPI_ATTR void VKAPI_CALL vkDestroySwapchainKHR( - VkDevice device, - VkSwapchainKHR swapchain, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainImagesKHR( - VkDevice device, - VkSwapchainKHR swapchain, - uint32_t* pSwapchainImageCount, - VkImage* pSwapchainImages); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImageKHR( - VkDevice device, - VkSwapchainKHR swapchain, - uint64_t timeout, - VkSemaphore semaphore, - VkFence fence, - uint32_t* pImageIndex); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueuePresentKHR( - VkQueue queue, - const VkPresentInfoKHR* pPresentInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupPresentCapabilitiesKHR( - VkDevice device, - VkDeviceGroupPresentCapabilitiesKHR* pDeviceGroupPresentCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModesKHR( - VkDevice device, - VkSurfaceKHR surface, - VkDeviceGroupPresentModeFlagsKHR* pModes); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDevicePresentRectanglesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t* pRectCount, - VkRect2D* pRects); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireNextImage2KHR( - VkDevice device, - const VkAcquireNextImageInfoKHR* pAcquireInfo, - uint32_t* pImageIndex); -#endif - - -#define VK_KHR_display 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayKHR) -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDisplayModeKHR) -#define VK_KHR_DISPLAY_SPEC_VERSION 23 -#define VK_KHR_DISPLAY_EXTENSION_NAME "VK_KHR_display" -typedef VkFlags VkDisplayModeCreateFlagsKHR; - -typedef enum VkDisplayPlaneAlphaFlagBitsKHR { - VK_DISPLAY_PLANE_ALPHA_OPAQUE_BIT_KHR = 0x00000001, - VK_DISPLAY_PLANE_ALPHA_GLOBAL_BIT_KHR = 0x00000002, - VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_BIT_KHR = 0x00000004, - VK_DISPLAY_PLANE_ALPHA_PER_PIXEL_PREMULTIPLIED_BIT_KHR = 0x00000008, - VK_DISPLAY_PLANE_ALPHA_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkDisplayPlaneAlphaFlagBitsKHR; -typedef VkFlags VkDisplayPlaneAlphaFlagsKHR; -typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; -typedef struct VkDisplayModeParametersKHR { - VkExtent2D visibleRegion; - uint32_t refreshRate; -} VkDisplayModeParametersKHR; - -typedef struct VkDisplayModeCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkDisplayModeCreateFlagsKHR flags; - VkDisplayModeParametersKHR parameters; -} VkDisplayModeCreateInfoKHR; - -typedef struct VkDisplayModePropertiesKHR { - VkDisplayModeKHR displayMode; - VkDisplayModeParametersKHR parameters; -} VkDisplayModePropertiesKHR; - -typedef struct VkDisplayPlaneCapabilitiesKHR { - VkDisplayPlaneAlphaFlagsKHR supportedAlpha; - VkOffset2D minSrcPosition; - VkOffset2D maxSrcPosition; - VkExtent2D minSrcExtent; - VkExtent2D maxSrcExtent; - VkOffset2D minDstPosition; - VkOffset2D maxDstPosition; - VkExtent2D minDstExtent; - VkExtent2D maxDstExtent; -} VkDisplayPlaneCapabilitiesKHR; - -typedef struct VkDisplayPlanePropertiesKHR { - VkDisplayKHR currentDisplay; - uint32_t currentStackIndex; -} VkDisplayPlanePropertiesKHR; - -typedef struct VkDisplayPropertiesKHR { - VkDisplayKHR display; - const char* displayName; - VkExtent2D physicalDimensions; - VkExtent2D physicalResolution; - VkSurfaceTransformFlagsKHR supportedTransforms; - VkBool32 planeReorderPossible; - VkBool32 persistentContent; -} VkDisplayPropertiesKHR; - -typedef struct VkDisplaySurfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkDisplaySurfaceCreateFlagsKHR flags; - VkDisplayModeKHR displayMode; - uint32_t planeIndex; - uint32_t planeStackIndex; - VkSurfaceTransformFlagBitsKHR transform; - float globalAlpha; - VkDisplayPlaneAlphaFlagBitsKHR alphaMode; - VkExtent2D imageExtent; -} VkDisplaySurfaceCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPropertiesKHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlanePropertiesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlanePropertiesKHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneSupportedDisplaysKHR)(VkPhysicalDevice physicalDevice, uint32_t planeIndex, uint32_t* pDisplayCount, VkDisplayKHR* pDisplays); -typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModePropertiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModePropertiesKHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayModeKHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, const VkDisplayModeCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDisplayModeKHR* pMode); -typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilitiesKHR)(VkPhysicalDevice physicalDevice, VkDisplayModeKHR mode, uint32_t planeIndex, VkDisplayPlaneCapabilitiesKHR* pCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDisplayPlaneSurfaceKHR)(VkInstance instance, const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPropertiesKHR( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkDisplayPropertiesKHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlanePropertiesKHR( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkDisplayPlanePropertiesKHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneSupportedDisplaysKHR( - VkPhysicalDevice physicalDevice, - uint32_t planeIndex, - uint32_t* pDisplayCount, - VkDisplayKHR* pDisplays); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModePropertiesKHR( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display, - uint32_t* pPropertyCount, - VkDisplayModePropertiesKHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayModeKHR( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDisplayModeKHR* pMode); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - VkDisplayModeKHR mode, - uint32_t planeIndex, - VkDisplayPlaneCapabilitiesKHR* pCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDisplayPlaneSurfaceKHR( - VkInstance instance, - const VkDisplaySurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); -#endif - - -#define VK_KHR_display_swapchain 1 -#define VK_KHR_DISPLAY_SWAPCHAIN_SPEC_VERSION 10 -#define VK_KHR_DISPLAY_SWAPCHAIN_EXTENSION_NAME "VK_KHR_display_swapchain" -typedef struct VkDisplayPresentInfoKHR { - VkStructureType sType; - const void* pNext; - VkRect2D srcRect; - VkRect2D dstRect; - VkBool32 persistent; -} VkDisplayPresentInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateSharedSwapchainsKHR)(VkDevice device, uint32_t swapchainCount, const VkSwapchainCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkSwapchainKHR* pSwapchains); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSharedSwapchainsKHR( - VkDevice device, - uint32_t swapchainCount, - const VkSwapchainCreateInfoKHR* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkSwapchainKHR* pSwapchains); -#endif - - -#define VK_KHR_sampler_mirror_clamp_to_edge 1 -#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_SPEC_VERSION 3 -#define VK_KHR_SAMPLER_MIRROR_CLAMP_TO_EDGE_EXTENSION_NAME "VK_KHR_sampler_mirror_clamp_to_edge" - - -#define VK_KHR_multiview 1 -#define VK_KHR_MULTIVIEW_SPEC_VERSION 1 -#define VK_KHR_MULTIVIEW_EXTENSION_NAME "VK_KHR_multiview" -typedef VkRenderPassMultiviewCreateInfo VkRenderPassMultiviewCreateInfoKHR; - -typedef VkPhysicalDeviceMultiviewFeatures VkPhysicalDeviceMultiviewFeaturesKHR; - -typedef VkPhysicalDeviceMultiviewProperties VkPhysicalDeviceMultiviewPropertiesKHR; - - - -#define VK_KHR_get_physical_device_properties2 1 -#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_SPEC_VERSION 2 -#define VK_KHR_GET_PHYSICAL_DEVICE_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_physical_device_properties2" -typedef VkPhysicalDeviceFeatures2 VkPhysicalDeviceFeatures2KHR; - -typedef VkPhysicalDeviceProperties2 VkPhysicalDeviceProperties2KHR; - -typedef VkFormatProperties2 VkFormatProperties2KHR; - -typedef VkImageFormatProperties2 VkImageFormatProperties2KHR; - -typedef VkPhysicalDeviceImageFormatInfo2 VkPhysicalDeviceImageFormatInfo2KHR; - -typedef VkQueueFamilyProperties2 VkQueueFamilyProperties2KHR; - -typedef VkPhysicalDeviceMemoryProperties2 VkPhysicalDeviceMemoryProperties2KHR; - -typedef VkSparseImageFormatProperties2 VkSparseImageFormatProperties2KHR; - -typedef VkPhysicalDeviceSparseImageFormatInfo2 VkPhysicalDeviceSparseImageFormatInfo2KHR; - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFeatures2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceFeatures2* pFeatures); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2* pProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceFormatProperties2KHR)(VkPhysicalDevice physicalDevice, VkFormat format, VkFormatProperties2* pFormatProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, VkImageFormatProperties2* pImageFormatProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pQueueFamilyPropertyCount, VkQueueFamilyProperties2* pQueueFamilyProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMemoryProperties2KHR)(VkPhysicalDevice physicalDevice, VkPhysicalDeviceMemoryProperties2* pMemoryProperties); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceSparseImageFormatProperties2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, uint32_t* pPropertyCount, VkSparseImageFormatProperties2* pProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFeatures2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceFeatures2* pFeatures); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceProperties2* pProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkFormatProperties2* pFormatProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceImageFormatInfo2* pImageFormatInfo, - VkImageFormatProperties2* pImageFormatProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyProperties2KHR( - VkPhysicalDevice physicalDevice, - uint32_t* pQueueFamilyPropertyCount, - VkQueueFamilyProperties2* pQueueFamilyProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMemoryProperties2KHR( - VkPhysicalDevice physicalDevice, - VkPhysicalDeviceMemoryProperties2* pMemoryProperties); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceSparseImageFormatProperties2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSparseImageFormatInfo2* pFormatInfo, - uint32_t* pPropertyCount, - VkSparseImageFormatProperties2* pProperties); -#endif - - -#define VK_KHR_device_group 1 -#define VK_KHR_DEVICE_GROUP_SPEC_VERSION 4 -#define VK_KHR_DEVICE_GROUP_EXTENSION_NAME "VK_KHR_device_group" -typedef VkPeerMemoryFeatureFlags VkPeerMemoryFeatureFlagsKHR; - -typedef VkPeerMemoryFeatureFlagBits VkPeerMemoryFeatureFlagBitsKHR; - -typedef VkMemoryAllocateFlags VkMemoryAllocateFlagsKHR; - -typedef VkMemoryAllocateFlagBits VkMemoryAllocateFlagBitsKHR; - -typedef VkMemoryAllocateFlagsInfo VkMemoryAllocateFlagsInfoKHR; - -typedef VkDeviceGroupRenderPassBeginInfo VkDeviceGroupRenderPassBeginInfoKHR; - -typedef VkDeviceGroupCommandBufferBeginInfo VkDeviceGroupCommandBufferBeginInfoKHR; - -typedef VkDeviceGroupSubmitInfo VkDeviceGroupSubmitInfoKHR; - -typedef VkDeviceGroupBindSparseInfo VkDeviceGroupBindSparseInfoKHR; - -typedef VkBindBufferMemoryDeviceGroupInfo VkBindBufferMemoryDeviceGroupInfoKHR; - -typedef VkBindImageMemoryDeviceGroupInfo VkBindImageMemoryDeviceGroupInfoKHR; - -typedef void (VKAPI_PTR *PFN_vkGetDeviceGroupPeerMemoryFeaturesKHR)(VkDevice device, uint32_t heapIndex, uint32_t localDeviceIndex, uint32_t remoteDeviceIndex, VkPeerMemoryFeatureFlags* pPeerMemoryFeatures); -typedef void (VKAPI_PTR *PFN_vkCmdSetDeviceMaskKHR)(VkCommandBuffer commandBuffer, uint32_t deviceMask); -typedef void (VKAPI_PTR *PFN_vkCmdDispatchBaseKHR)(VkCommandBuffer commandBuffer, uint32_t baseGroupX, uint32_t baseGroupY, uint32_t baseGroupZ, uint32_t groupCountX, uint32_t groupCountY, uint32_t groupCountZ); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetDeviceGroupPeerMemoryFeaturesKHR( - VkDevice device, - uint32_t heapIndex, - uint32_t localDeviceIndex, - uint32_t remoteDeviceIndex, - VkPeerMemoryFeatureFlags* pPeerMemoryFeatures); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDeviceMaskKHR( - VkCommandBuffer commandBuffer, - uint32_t deviceMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdDispatchBaseKHR( - VkCommandBuffer commandBuffer, - uint32_t baseGroupX, - uint32_t baseGroupY, - uint32_t baseGroupZ, - uint32_t groupCountX, - uint32_t groupCountY, - uint32_t groupCountZ); -#endif - - -#define VK_KHR_shader_draw_parameters 1 -#define VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION 1 -#define VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME "VK_KHR_shader_draw_parameters" - - -#define VK_KHR_maintenance1 1 -#define VK_KHR_MAINTENANCE1_SPEC_VERSION 2 -#define VK_KHR_MAINTENANCE1_EXTENSION_NAME "VK_KHR_maintenance1" -typedef VkCommandPoolTrimFlags VkCommandPoolTrimFlagsKHR; - -typedef void (VKAPI_PTR *PFN_vkTrimCommandPoolKHR)(VkDevice device, VkCommandPool commandPool, VkCommandPoolTrimFlags flags); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkTrimCommandPoolKHR( - VkDevice device, - VkCommandPool commandPool, - VkCommandPoolTrimFlags flags); -#endif - - -#define VK_KHR_device_group_creation 1 -#define VK_KHR_DEVICE_GROUP_CREATION_SPEC_VERSION 1 -#define VK_KHR_DEVICE_GROUP_CREATION_EXTENSION_NAME "VK_KHR_device_group_creation" -#define VK_MAX_DEVICE_GROUP_SIZE_KHR VK_MAX_DEVICE_GROUP_SIZE -typedef VkPhysicalDeviceGroupProperties VkPhysicalDeviceGroupPropertiesKHR; - -typedef VkDeviceGroupDeviceCreateInfo VkDeviceGroupDeviceCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceGroupsKHR)(VkInstance instance, uint32_t* pPhysicalDeviceGroupCount, VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceGroupsKHR( - VkInstance instance, - uint32_t* pPhysicalDeviceGroupCount, - VkPhysicalDeviceGroupProperties* pPhysicalDeviceGroupProperties); -#endif - - -#define VK_KHR_external_memory_capabilities 1 -#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_memory_capabilities" -#define VK_LUID_SIZE_KHR VK_LUID_SIZE -typedef VkExternalMemoryHandleTypeFlags VkExternalMemoryHandleTypeFlagsKHR; - -typedef VkExternalMemoryHandleTypeFlagBits VkExternalMemoryHandleTypeFlagBitsKHR; - -typedef VkExternalMemoryFeatureFlags VkExternalMemoryFeatureFlagsKHR; - -typedef VkExternalMemoryFeatureFlagBits VkExternalMemoryFeatureFlagBitsKHR; - -typedef VkExternalMemoryProperties VkExternalMemoryPropertiesKHR; - -typedef VkPhysicalDeviceExternalImageFormatInfo VkPhysicalDeviceExternalImageFormatInfoKHR; - -typedef VkExternalImageFormatProperties VkExternalImageFormatPropertiesKHR; - -typedef VkPhysicalDeviceExternalBufferInfo VkPhysicalDeviceExternalBufferInfoKHR; - -typedef VkExternalBufferProperties VkExternalBufferPropertiesKHR; - -typedef VkPhysicalDeviceIDProperties VkPhysicalDeviceIDPropertiesKHR; - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalBufferPropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, VkExternalBufferProperties* pExternalBufferProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalBufferPropertiesKHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalBufferInfo* pExternalBufferInfo, - VkExternalBufferProperties* pExternalBufferProperties); -#endif - - -#define VK_KHR_external_memory 1 -#define VK_KHR_EXTERNAL_MEMORY_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_EXTENSION_NAME "VK_KHR_external_memory" -#define VK_QUEUE_FAMILY_EXTERNAL_KHR VK_QUEUE_FAMILY_EXTERNAL -typedef VkExternalMemoryImageCreateInfo VkExternalMemoryImageCreateInfoKHR; - -typedef VkExternalMemoryBufferCreateInfo VkExternalMemoryBufferCreateInfoKHR; - -typedef VkExportMemoryAllocateInfo VkExportMemoryAllocateInfoKHR; - - - -#define VK_KHR_external_memory_fd 1 -#define VK_KHR_EXTERNAL_MEMORY_FD_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_FD_EXTENSION_NAME "VK_KHR_external_memory_fd" -typedef struct VkImportMemoryFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - int fd; -} VkImportMemoryFdInfoKHR; - -typedef struct VkMemoryFdPropertiesKHR { - VkStructureType sType; - void* pNext; - uint32_t memoryTypeBits; -} VkMemoryFdPropertiesKHR; - -typedef struct VkMemoryGetFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkMemoryGetFdInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdKHR)(VkDevice device, const VkMemoryGetFdInfoKHR* pGetFdInfo, int* pFd); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryFdPropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, int fd, VkMemoryFdPropertiesKHR* pMemoryFdProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdKHR( - VkDevice device, - const VkMemoryGetFdInfoKHR* pGetFdInfo, - int* pFd); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryFdPropertiesKHR( - VkDevice device, - VkExternalMemoryHandleTypeFlagBits handleType, - int fd, - VkMemoryFdPropertiesKHR* pMemoryFdProperties); -#endif - - -#define VK_KHR_external_semaphore_capabilities 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_semaphore_capabilities" -typedef VkExternalSemaphoreHandleTypeFlags VkExternalSemaphoreHandleTypeFlagsKHR; - -typedef VkExternalSemaphoreHandleTypeFlagBits VkExternalSemaphoreHandleTypeFlagBitsKHR; - -typedef VkExternalSemaphoreFeatureFlags VkExternalSemaphoreFeatureFlagsKHR; - -typedef VkExternalSemaphoreFeatureFlagBits VkExternalSemaphoreFeatureFlagBitsKHR; - -typedef VkPhysicalDeviceExternalSemaphoreInfo VkPhysicalDeviceExternalSemaphoreInfoKHR; - -typedef VkExternalSemaphoreProperties VkExternalSemaphorePropertiesKHR; - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, VkExternalSemaphoreProperties* pExternalSemaphoreProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalSemaphorePropertiesKHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalSemaphoreInfo* pExternalSemaphoreInfo, - VkExternalSemaphoreProperties* pExternalSemaphoreProperties); -#endif - - -#define VK_KHR_external_semaphore 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_EXTENSION_NAME "VK_KHR_external_semaphore" -typedef VkSemaphoreImportFlags VkSemaphoreImportFlagsKHR; - -typedef VkSemaphoreImportFlagBits VkSemaphoreImportFlagBitsKHR; - -typedef VkExportSemaphoreCreateInfo VkExportSemaphoreCreateInfoKHR; - - - -#define VK_KHR_external_semaphore_fd 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_FD_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_FD_EXTENSION_NAME "VK_KHR_external_semaphore_fd" -typedef struct VkImportSemaphoreFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkSemaphoreImportFlags flags; - VkExternalSemaphoreHandleTypeFlagBits handleType; - int fd; -} VkImportSemaphoreFdInfoKHR; - -typedef struct VkSemaphoreGetFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkExternalSemaphoreHandleTypeFlagBits handleType; -} VkSemaphoreGetFdInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreFdKHR)(VkDevice device, const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreFdKHR)(VkDevice device, const VkSemaphoreGetFdInfoKHR* pGetFdInfo, int* pFd); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreFdKHR( - VkDevice device, - const VkImportSemaphoreFdInfoKHR* pImportSemaphoreFdInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreFdKHR( - VkDevice device, - const VkSemaphoreGetFdInfoKHR* pGetFdInfo, - int* pFd); -#endif - - -#define VK_KHR_push_descriptor 1 -#define VK_KHR_PUSH_DESCRIPTOR_SPEC_VERSION 2 -#define VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME "VK_KHR_push_descriptor" -typedef struct VkPhysicalDevicePushDescriptorPropertiesKHR { - VkStructureType sType; - void* pNext; - uint32_t maxPushDescriptors; -} VkPhysicalDevicePushDescriptorPropertiesKHR; - -typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetKHR)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipelineLayout layout, uint32_t set, uint32_t descriptorWriteCount, const VkWriteDescriptorSet* pDescriptorWrites); -typedef void (VKAPI_PTR *PFN_vkCmdPushDescriptorSetWithTemplateKHR)(VkCommandBuffer commandBuffer, VkDescriptorUpdateTemplate descriptorUpdateTemplate, VkPipelineLayout layout, uint32_t set, const void* pData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetKHR( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipelineLayout layout, - uint32_t set, - uint32_t descriptorWriteCount, - const VkWriteDescriptorSet* pDescriptorWrites); - -VKAPI_ATTR void VKAPI_CALL vkCmdPushDescriptorSetWithTemplateKHR( - VkCommandBuffer commandBuffer, - VkDescriptorUpdateTemplate descriptorUpdateTemplate, - VkPipelineLayout layout, - uint32_t set, - const void* pData); -#endif - - -#define VK_KHR_shader_float16_int8 1 -#define VK_KHR_SHADER_FLOAT16_INT8_SPEC_VERSION 1 -#define VK_KHR_SHADER_FLOAT16_INT8_EXTENSION_NAME "VK_KHR_shader_float16_int8" -typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceShaderFloat16Int8FeaturesKHR; - -typedef VkPhysicalDeviceShaderFloat16Int8Features VkPhysicalDeviceFloat16Int8FeaturesKHR; - - - -#define VK_KHR_16bit_storage 1 -#define VK_KHR_16BIT_STORAGE_SPEC_VERSION 1 -#define VK_KHR_16BIT_STORAGE_EXTENSION_NAME "VK_KHR_16bit_storage" -typedef VkPhysicalDevice16BitStorageFeatures VkPhysicalDevice16BitStorageFeaturesKHR; - - - -#define VK_KHR_incremental_present 1 -#define VK_KHR_INCREMENTAL_PRESENT_SPEC_VERSION 2 -#define VK_KHR_INCREMENTAL_PRESENT_EXTENSION_NAME "VK_KHR_incremental_present" -typedef struct VkRectLayerKHR { - VkOffset2D offset; - VkExtent2D extent; - uint32_t layer; -} VkRectLayerKHR; - -typedef struct VkPresentRegionKHR { - uint32_t rectangleCount; - const VkRectLayerKHR* pRectangles; -} VkPresentRegionKHR; - -typedef struct VkPresentRegionsKHR { - VkStructureType sType; - const void* pNext; - uint32_t swapchainCount; - const VkPresentRegionKHR* pRegions; -} VkPresentRegionsKHR; - - - -#define VK_KHR_descriptor_update_template 1 -typedef VkDescriptorUpdateTemplate VkDescriptorUpdateTemplateKHR; - -#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_SPEC_VERSION 1 -#define VK_KHR_DESCRIPTOR_UPDATE_TEMPLATE_EXTENSION_NAME "VK_KHR_descriptor_update_template" -typedef VkDescriptorUpdateTemplateType VkDescriptorUpdateTemplateTypeKHR; - -typedef VkDescriptorUpdateTemplateCreateFlags VkDescriptorUpdateTemplateCreateFlagsKHR; - -typedef VkDescriptorUpdateTemplateEntry VkDescriptorUpdateTemplateEntryKHR; - -typedef VkDescriptorUpdateTemplateCreateInfo VkDescriptorUpdateTemplateCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateDescriptorUpdateTemplateKHR)(VkDevice device, const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); -typedef void (VKAPI_PTR *PFN_vkDestroyDescriptorUpdateTemplateKHR)(VkDevice device, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkUpdateDescriptorSetWithTemplateKHR)(VkDevice device, VkDescriptorSet descriptorSet, VkDescriptorUpdateTemplate descriptorUpdateTemplate, const void* pData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDescriptorUpdateTemplateKHR( - VkDevice device, - const VkDescriptorUpdateTemplateCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDescriptorUpdateTemplate* pDescriptorUpdateTemplate); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDescriptorUpdateTemplateKHR( - VkDevice device, - VkDescriptorUpdateTemplate descriptorUpdateTemplate, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkUpdateDescriptorSetWithTemplateKHR( - VkDevice device, - VkDescriptorSet descriptorSet, - VkDescriptorUpdateTemplate descriptorUpdateTemplate, - const void* pData); -#endif - - -#define VK_KHR_imageless_framebuffer 1 -#define VK_KHR_IMAGELESS_FRAMEBUFFER_SPEC_VERSION 1 -#define VK_KHR_IMAGELESS_FRAMEBUFFER_EXTENSION_NAME "VK_KHR_imageless_framebuffer" -typedef VkPhysicalDeviceImagelessFramebufferFeatures VkPhysicalDeviceImagelessFramebufferFeaturesKHR; - -typedef VkFramebufferAttachmentsCreateInfo VkFramebufferAttachmentsCreateInfoKHR; - -typedef VkFramebufferAttachmentImageInfo VkFramebufferAttachmentImageInfoKHR; - -typedef VkRenderPassAttachmentBeginInfo VkRenderPassAttachmentBeginInfoKHR; - - - -#define VK_KHR_create_renderpass2 1 -#define VK_KHR_CREATE_RENDERPASS_2_SPEC_VERSION 1 -#define VK_KHR_CREATE_RENDERPASS_2_EXTENSION_NAME "VK_KHR_create_renderpass2" -typedef VkRenderPassCreateInfo2 VkRenderPassCreateInfo2KHR; - -typedef VkAttachmentDescription2 VkAttachmentDescription2KHR; - -typedef VkAttachmentReference2 VkAttachmentReference2KHR; - -typedef VkSubpassDescription2 VkSubpassDescription2KHR; - -typedef VkSubpassDependency2 VkSubpassDependency2KHR; - -typedef VkSubpassBeginInfo VkSubpassBeginInfoKHR; - -typedef VkSubpassEndInfo VkSubpassEndInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateRenderPass2KHR)(VkDevice device, const VkRenderPassCreateInfo2* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkRenderPass* pRenderPass); -typedef void (VKAPI_PTR *PFN_vkCmdBeginRenderPass2KHR)(VkCommandBuffer commandBuffer, const VkRenderPassBeginInfo* pRenderPassBegin, const VkSubpassBeginInfo* pSubpassBeginInfo); -typedef void (VKAPI_PTR *PFN_vkCmdNextSubpass2KHR)(VkCommandBuffer commandBuffer, const VkSubpassBeginInfo* pSubpassBeginInfo, const VkSubpassEndInfo* pSubpassEndInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndRenderPass2KHR)(VkCommandBuffer commandBuffer, const VkSubpassEndInfo* pSubpassEndInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateRenderPass2KHR( - VkDevice device, - const VkRenderPassCreateInfo2* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkRenderPass* pRenderPass); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginRenderPass2KHR( - VkCommandBuffer commandBuffer, - const VkRenderPassBeginInfo* pRenderPassBegin, - const VkSubpassBeginInfo* pSubpassBeginInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdNextSubpass2KHR( - VkCommandBuffer commandBuffer, - const VkSubpassBeginInfo* pSubpassBeginInfo, - const VkSubpassEndInfo* pSubpassEndInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndRenderPass2KHR( - VkCommandBuffer commandBuffer, - const VkSubpassEndInfo* pSubpassEndInfo); -#endif - - -#define VK_KHR_shared_presentable_image 1 -#define VK_KHR_SHARED_PRESENTABLE_IMAGE_SPEC_VERSION 1 -#define VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME "VK_KHR_shared_presentable_image" -typedef struct VkSharedPresentSurfaceCapabilitiesKHR { - VkStructureType sType; - void* pNext; - VkImageUsageFlags sharedPresentSupportedUsageFlags; -} VkSharedPresentSurfaceCapabilitiesKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainStatusKHR)(VkDevice device, VkSwapchainKHR swapchain); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainStatusKHR( - VkDevice device, - VkSwapchainKHR swapchain); -#endif - - -#define VK_KHR_external_fence_capabilities 1 -#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_CAPABILITIES_EXTENSION_NAME "VK_KHR_external_fence_capabilities" -typedef VkExternalFenceHandleTypeFlags VkExternalFenceHandleTypeFlagsKHR; - -typedef VkExternalFenceHandleTypeFlagBits VkExternalFenceHandleTypeFlagBitsKHR; - -typedef VkExternalFenceFeatureFlags VkExternalFenceFeatureFlagsKHR; - -typedef VkExternalFenceFeatureFlagBits VkExternalFenceFeatureFlagBitsKHR; - -typedef VkPhysicalDeviceExternalFenceInfo VkPhysicalDeviceExternalFenceInfoKHR; - -typedef VkExternalFenceProperties VkExternalFencePropertiesKHR; - -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalFencePropertiesKHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, VkExternalFenceProperties* pExternalFenceProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceExternalFencePropertiesKHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalFenceInfo* pExternalFenceInfo, - VkExternalFenceProperties* pExternalFenceProperties); -#endif - - -#define VK_KHR_external_fence 1 -#define VK_KHR_EXTERNAL_FENCE_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_EXTENSION_NAME "VK_KHR_external_fence" -typedef VkFenceImportFlags VkFenceImportFlagsKHR; - -typedef VkFenceImportFlagBits VkFenceImportFlagBitsKHR; - -typedef VkExportFenceCreateInfo VkExportFenceCreateInfoKHR; - - - -#define VK_KHR_external_fence_fd 1 -#define VK_KHR_EXTERNAL_FENCE_FD_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_FD_EXTENSION_NAME "VK_KHR_external_fence_fd" -typedef struct VkImportFenceFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkFence fence; - VkFenceImportFlags flags; - VkExternalFenceHandleTypeFlagBits handleType; - int fd; -} VkImportFenceFdInfoKHR; - -typedef struct VkFenceGetFdInfoKHR { - VkStructureType sType; - const void* pNext; - VkFence fence; - VkExternalFenceHandleTypeFlagBits handleType; -} VkFenceGetFdInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkImportFenceFdKHR)(VkDevice device, const VkImportFenceFdInfoKHR* pImportFenceFdInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetFenceFdKHR)(VkDevice device, const VkFenceGetFdInfoKHR* pGetFdInfo, int* pFd); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceFdKHR( - VkDevice device, - const VkImportFenceFdInfoKHR* pImportFenceFdInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceFdKHR( - VkDevice device, - const VkFenceGetFdInfoKHR* pGetFdInfo, - int* pFd); -#endif - - -#define VK_KHR_performance_query 1 -#define VK_KHR_PERFORMANCE_QUERY_SPEC_VERSION 1 -#define VK_KHR_PERFORMANCE_QUERY_EXTENSION_NAME "VK_KHR_performance_query" - -typedef enum VkPerformanceCounterUnitKHR { - VK_PERFORMANCE_COUNTER_UNIT_GENERIC_KHR = 0, - VK_PERFORMANCE_COUNTER_UNIT_PERCENTAGE_KHR = 1, - VK_PERFORMANCE_COUNTER_UNIT_NANOSECONDS_KHR = 2, - VK_PERFORMANCE_COUNTER_UNIT_BYTES_KHR = 3, - VK_PERFORMANCE_COUNTER_UNIT_BYTES_PER_SECOND_KHR = 4, - VK_PERFORMANCE_COUNTER_UNIT_KELVIN_KHR = 5, - VK_PERFORMANCE_COUNTER_UNIT_WATTS_KHR = 6, - VK_PERFORMANCE_COUNTER_UNIT_VOLTS_KHR = 7, - VK_PERFORMANCE_COUNTER_UNIT_AMPS_KHR = 8, - VK_PERFORMANCE_COUNTER_UNIT_HERTZ_KHR = 9, - VK_PERFORMANCE_COUNTER_UNIT_CYCLES_KHR = 10, - VK_PERFORMANCE_COUNTER_UNIT_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPerformanceCounterUnitKHR; - -typedef enum VkPerformanceCounterScopeKHR { - VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR = 0, - VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR = 1, - VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR = 2, - VK_QUERY_SCOPE_COMMAND_BUFFER_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_BUFFER_KHR, - VK_QUERY_SCOPE_RENDER_PASS_KHR = VK_PERFORMANCE_COUNTER_SCOPE_RENDER_PASS_KHR, - VK_QUERY_SCOPE_COMMAND_KHR = VK_PERFORMANCE_COUNTER_SCOPE_COMMAND_KHR, - VK_PERFORMANCE_COUNTER_SCOPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPerformanceCounterScopeKHR; - -typedef enum VkPerformanceCounterStorageKHR { - VK_PERFORMANCE_COUNTER_STORAGE_INT32_KHR = 0, - VK_PERFORMANCE_COUNTER_STORAGE_INT64_KHR = 1, - VK_PERFORMANCE_COUNTER_STORAGE_UINT32_KHR = 2, - VK_PERFORMANCE_COUNTER_STORAGE_UINT64_KHR = 3, - VK_PERFORMANCE_COUNTER_STORAGE_FLOAT32_KHR = 4, - VK_PERFORMANCE_COUNTER_STORAGE_FLOAT64_KHR = 5, - VK_PERFORMANCE_COUNTER_STORAGE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPerformanceCounterStorageKHR; - -typedef enum VkPerformanceCounterDescriptionFlagBitsKHR { - VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR = 0x00000001, - VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR = 0x00000002, - VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_PERFORMANCE_IMPACTING_BIT_KHR, - VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_KHR = VK_PERFORMANCE_COUNTER_DESCRIPTION_CONCURRENTLY_IMPACTED_BIT_KHR, - VK_PERFORMANCE_COUNTER_DESCRIPTION_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPerformanceCounterDescriptionFlagBitsKHR; -typedef VkFlags VkPerformanceCounterDescriptionFlagsKHR; - -typedef enum VkAcquireProfilingLockFlagBitsKHR { - VK_ACQUIRE_PROFILING_LOCK_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAcquireProfilingLockFlagBitsKHR; -typedef VkFlags VkAcquireProfilingLockFlagsKHR; -typedef struct VkPhysicalDevicePerformanceQueryFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 performanceCounterQueryPools; - VkBool32 performanceCounterMultipleQueryPools; -} VkPhysicalDevicePerformanceQueryFeaturesKHR; - -typedef struct VkPhysicalDevicePerformanceQueryPropertiesKHR { - VkStructureType sType; - void* pNext; - VkBool32 allowCommandBufferQueryCopies; -} VkPhysicalDevicePerformanceQueryPropertiesKHR; - -typedef struct VkPerformanceCounterKHR { - VkStructureType sType; - const void* pNext; - VkPerformanceCounterUnitKHR unit; - VkPerformanceCounterScopeKHR scope; - VkPerformanceCounterStorageKHR storage; - uint8_t uuid[VK_UUID_SIZE]; -} VkPerformanceCounterKHR; - -typedef struct VkPerformanceCounterDescriptionKHR { - VkStructureType sType; - const void* pNext; - VkPerformanceCounterDescriptionFlagsKHR flags; - char name[VK_MAX_DESCRIPTION_SIZE]; - char category[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; -} VkPerformanceCounterDescriptionKHR; - -typedef struct VkQueryPoolPerformanceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t queueFamilyIndex; - uint32_t counterIndexCount; - const uint32_t* pCounterIndices; -} VkQueryPoolPerformanceCreateInfoKHR; - -typedef union VkPerformanceCounterResultKHR { - int32_t int32; - int64_t int64; - uint32_t uint32; - uint64_t uint64; - float float32; - double float64; -} VkPerformanceCounterResultKHR; - -typedef struct VkAcquireProfilingLockInfoKHR { - VkStructureType sType; - const void* pNext; - VkAcquireProfilingLockFlagsKHR flags; - uint64_t timeout; -} VkAcquireProfilingLockInfoKHR; - -typedef struct VkPerformanceQuerySubmitInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t counterPassIndex; -} VkPerformanceQuerySubmitInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, uint32_t* pCounterCount, VkPerformanceCounterKHR* pCounters, VkPerformanceCounterDescriptionKHR* pCounterDescriptions); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR)(VkPhysicalDevice physicalDevice, const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo, uint32_t* pNumPasses); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireProfilingLockKHR)(VkDevice device, const VkAcquireProfilingLockInfoKHR* pInfo); -typedef void (VKAPI_PTR *PFN_vkReleaseProfilingLockKHR)(VkDevice device); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkEnumeratePhysicalDeviceQueueFamilyPerformanceQueryCountersKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - uint32_t* pCounterCount, - VkPerformanceCounterKHR* pCounters, - VkPerformanceCounterDescriptionKHR* pCounterDescriptions); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceQueueFamilyPerformanceQueryPassesKHR( - VkPhysicalDevice physicalDevice, - const VkQueryPoolPerformanceCreateInfoKHR* pPerformanceQueryCreateInfo, - uint32_t* pNumPasses); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireProfilingLockKHR( - VkDevice device, - const VkAcquireProfilingLockInfoKHR* pInfo); - -VKAPI_ATTR void VKAPI_CALL vkReleaseProfilingLockKHR( - VkDevice device); -#endif - - -#define VK_KHR_maintenance2 1 -#define VK_KHR_MAINTENANCE2_SPEC_VERSION 1 -#define VK_KHR_MAINTENANCE2_EXTENSION_NAME "VK_KHR_maintenance2" -typedef VkPointClippingBehavior VkPointClippingBehaviorKHR; - -typedef VkTessellationDomainOrigin VkTessellationDomainOriginKHR; - -typedef VkPhysicalDevicePointClippingProperties VkPhysicalDevicePointClippingPropertiesKHR; - -typedef VkRenderPassInputAttachmentAspectCreateInfo VkRenderPassInputAttachmentAspectCreateInfoKHR; - -typedef VkInputAttachmentAspectReference VkInputAttachmentAspectReferenceKHR; - -typedef VkImageViewUsageCreateInfo VkImageViewUsageCreateInfoKHR; - -typedef VkPipelineTessellationDomainOriginStateCreateInfo VkPipelineTessellationDomainOriginStateCreateInfoKHR; - - - -#define VK_KHR_get_surface_capabilities2 1 -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_SPEC_VERSION 1 -#define VK_KHR_GET_SURFACE_CAPABILITIES_2_EXTENSION_NAME "VK_KHR_get_surface_capabilities2" -typedef struct VkPhysicalDeviceSurfaceInfo2KHR { - VkStructureType sType; - const void* pNext; - VkSurfaceKHR surface; -} VkPhysicalDeviceSurfaceInfo2KHR; - -typedef struct VkSurfaceCapabilities2KHR { - VkStructureType sType; - void* pNext; - VkSurfaceCapabilitiesKHR surfaceCapabilities; -} VkSurfaceCapabilities2KHR; - -typedef struct VkSurfaceFormat2KHR { - VkStructureType sType; - void* pNext; - VkSurfaceFormatKHR surfaceFormat; -} VkSurfaceFormat2KHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkSurfaceCapabilities2KHR* pSurfaceCapabilities); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceFormats2KHR)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pSurfaceFormatCount, VkSurfaceFormat2KHR* pSurfaceFormats); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - VkSurfaceCapabilities2KHR* pSurfaceCapabilities); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceFormats2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - uint32_t* pSurfaceFormatCount, - VkSurfaceFormat2KHR* pSurfaceFormats); -#endif - - -#define VK_KHR_variable_pointers 1 -#define VK_KHR_VARIABLE_POINTERS_SPEC_VERSION 1 -#define VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME "VK_KHR_variable_pointers" -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointerFeaturesKHR; - -typedef VkPhysicalDeviceVariablePointersFeatures VkPhysicalDeviceVariablePointersFeaturesKHR; - - - -#define VK_KHR_get_display_properties2 1 -#define VK_KHR_GET_DISPLAY_PROPERTIES_2_SPEC_VERSION 1 -#define VK_KHR_GET_DISPLAY_PROPERTIES_2_EXTENSION_NAME "VK_KHR_get_display_properties2" -typedef struct VkDisplayProperties2KHR { - VkStructureType sType; - void* pNext; - VkDisplayPropertiesKHR displayProperties; -} VkDisplayProperties2KHR; - -typedef struct VkDisplayPlaneProperties2KHR { - VkStructureType sType; - void* pNext; - VkDisplayPlanePropertiesKHR displayPlaneProperties; -} VkDisplayPlaneProperties2KHR; - -typedef struct VkDisplayModeProperties2KHR { - VkStructureType sType; - void* pNext; - VkDisplayModePropertiesKHR displayModeProperties; -} VkDisplayModeProperties2KHR; - -typedef struct VkDisplayPlaneInfo2KHR { - VkStructureType sType; - const void* pNext; - VkDisplayModeKHR mode; - uint32_t planeIndex; -} VkDisplayPlaneInfo2KHR; - -typedef struct VkDisplayPlaneCapabilities2KHR { - VkStructureType sType; - void* pNext; - VkDisplayPlaneCapabilitiesKHR capabilities; -} VkDisplayPlaneCapabilities2KHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayProperties2KHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceDisplayPlaneProperties2KHR)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkDisplayPlaneProperties2KHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayModeProperties2KHR)(VkPhysicalDevice physicalDevice, VkDisplayKHR display, uint32_t* pPropertyCount, VkDisplayModeProperties2KHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetDisplayPlaneCapabilities2KHR)(VkPhysicalDevice physicalDevice, const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo, VkDisplayPlaneCapabilities2KHR* pCapabilities); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayProperties2KHR( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkDisplayProperties2KHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceDisplayPlaneProperties2KHR( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkDisplayPlaneProperties2KHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayModeProperties2KHR( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display, - uint32_t* pPropertyCount, - VkDisplayModeProperties2KHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDisplayPlaneCapabilities2KHR( - VkPhysicalDevice physicalDevice, - const VkDisplayPlaneInfo2KHR* pDisplayPlaneInfo, - VkDisplayPlaneCapabilities2KHR* pCapabilities); -#endif - - -#define VK_KHR_dedicated_allocation 1 -#define VK_KHR_DEDICATED_ALLOCATION_SPEC_VERSION 3 -#define VK_KHR_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_KHR_dedicated_allocation" -typedef VkMemoryDedicatedRequirements VkMemoryDedicatedRequirementsKHR; - -typedef VkMemoryDedicatedAllocateInfo VkMemoryDedicatedAllocateInfoKHR; - - - -#define VK_KHR_storage_buffer_storage_class 1 -#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION 1 -#define VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME "VK_KHR_storage_buffer_storage_class" - - -#define VK_KHR_relaxed_block_layout 1 -#define VK_KHR_RELAXED_BLOCK_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_RELAXED_BLOCK_LAYOUT_EXTENSION_NAME "VK_KHR_relaxed_block_layout" - - -#define VK_KHR_get_memory_requirements2 1 -#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_SPEC_VERSION 1 -#define VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME "VK_KHR_get_memory_requirements2" -typedef VkBufferMemoryRequirementsInfo2 VkBufferMemoryRequirementsInfo2KHR; - -typedef VkImageMemoryRequirementsInfo2 VkImageMemoryRequirementsInfo2KHR; - -typedef VkImageSparseMemoryRequirementsInfo2 VkImageSparseMemoryRequirementsInfo2KHR; - -typedef VkMemoryRequirements2 VkMemoryRequirements2KHR; - -typedef VkSparseImageMemoryRequirements2 VkSparseImageMemoryRequirements2KHR; - -typedef void (VKAPI_PTR *PFN_vkGetImageMemoryRequirements2KHR)(VkDevice device, const VkImageMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetBufferMemoryRequirements2KHR)(VkDevice device, const VkBufferMemoryRequirementsInfo2* pInfo, VkMemoryRequirements2* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkGetImageSparseMemoryRequirements2KHR)(VkDevice device, const VkImageSparseMemoryRequirementsInfo2* pInfo, uint32_t* pSparseMemoryRequirementCount, VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetImageMemoryRequirements2KHR( - VkDevice device, - const VkImageMemoryRequirementsInfo2* pInfo, - VkMemoryRequirements2* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetBufferMemoryRequirements2KHR( - VkDevice device, - const VkBufferMemoryRequirementsInfo2* pInfo, - VkMemoryRequirements2* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkGetImageSparseMemoryRequirements2KHR( - VkDevice device, - const VkImageSparseMemoryRequirementsInfo2* pInfo, - uint32_t* pSparseMemoryRequirementCount, - VkSparseImageMemoryRequirements2* pSparseMemoryRequirements); -#endif - - -#define VK_KHR_image_format_list 1 -#define VK_KHR_IMAGE_FORMAT_LIST_SPEC_VERSION 1 -#define VK_KHR_IMAGE_FORMAT_LIST_EXTENSION_NAME "VK_KHR_image_format_list" -typedef VkImageFormatListCreateInfo VkImageFormatListCreateInfoKHR; - - - -#define VK_KHR_sampler_ycbcr_conversion 1 -typedef VkSamplerYcbcrConversion VkSamplerYcbcrConversionKHR; - -#define VK_KHR_SAMPLER_YCBCR_CONVERSION_SPEC_VERSION 14 -#define VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME "VK_KHR_sampler_ycbcr_conversion" -typedef VkSamplerYcbcrModelConversion VkSamplerYcbcrModelConversionKHR; - -typedef VkSamplerYcbcrRange VkSamplerYcbcrRangeKHR; - -typedef VkChromaLocation VkChromaLocationKHR; - -typedef VkSamplerYcbcrConversionCreateInfo VkSamplerYcbcrConversionCreateInfoKHR; - -typedef VkSamplerYcbcrConversionInfo VkSamplerYcbcrConversionInfoKHR; - -typedef VkBindImagePlaneMemoryInfo VkBindImagePlaneMemoryInfoKHR; - -typedef VkImagePlaneMemoryRequirementsInfo VkImagePlaneMemoryRequirementsInfoKHR; - -typedef VkPhysicalDeviceSamplerYcbcrConversionFeatures VkPhysicalDeviceSamplerYcbcrConversionFeaturesKHR; - -typedef VkSamplerYcbcrConversionImageFormatProperties VkSamplerYcbcrConversionImageFormatPropertiesKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateSamplerYcbcrConversionKHR)(VkDevice device, const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSamplerYcbcrConversion* pYcbcrConversion); -typedef void (VKAPI_PTR *PFN_vkDestroySamplerYcbcrConversionKHR)(VkDevice device, VkSamplerYcbcrConversion ycbcrConversion, const VkAllocationCallbacks* pAllocator); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateSamplerYcbcrConversionKHR( - VkDevice device, - const VkSamplerYcbcrConversionCreateInfo* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSamplerYcbcrConversion* pYcbcrConversion); - -VKAPI_ATTR void VKAPI_CALL vkDestroySamplerYcbcrConversionKHR( - VkDevice device, - VkSamplerYcbcrConversion ycbcrConversion, - const VkAllocationCallbacks* pAllocator); -#endif - - -#define VK_KHR_bind_memory2 1 -#define VK_KHR_BIND_MEMORY_2_SPEC_VERSION 1 -#define VK_KHR_BIND_MEMORY_2_EXTENSION_NAME "VK_KHR_bind_memory2" -typedef VkBindBufferMemoryInfo VkBindBufferMemoryInfoKHR; - -typedef VkBindImageMemoryInfo VkBindImageMemoryInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkBindBufferMemory2KHR)(VkDevice device, uint32_t bindInfoCount, const VkBindBufferMemoryInfo* pBindInfos); -typedef VkResult (VKAPI_PTR *PFN_vkBindImageMemory2KHR)(VkDevice device, uint32_t bindInfoCount, const VkBindImageMemoryInfo* pBindInfos); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkBindBufferMemory2KHR( - VkDevice device, - uint32_t bindInfoCount, - const VkBindBufferMemoryInfo* pBindInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindImageMemory2KHR( - VkDevice device, - uint32_t bindInfoCount, - const VkBindImageMemoryInfo* pBindInfos); -#endif - - -#define VK_KHR_maintenance3 1 -#define VK_KHR_MAINTENANCE3_SPEC_VERSION 1 -#define VK_KHR_MAINTENANCE3_EXTENSION_NAME "VK_KHR_maintenance3" -typedef VkPhysicalDeviceMaintenance3Properties VkPhysicalDeviceMaintenance3PropertiesKHR; - -typedef VkDescriptorSetLayoutSupport VkDescriptorSetLayoutSupportKHR; - -typedef void (VKAPI_PTR *PFN_vkGetDescriptorSetLayoutSupportKHR)(VkDevice device, const VkDescriptorSetLayoutCreateInfo* pCreateInfo, VkDescriptorSetLayoutSupport* pSupport); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupportKHR( - VkDevice device, - const VkDescriptorSetLayoutCreateInfo* pCreateInfo, - VkDescriptorSetLayoutSupport* pSupport); -#endif - - -#define VK_KHR_draw_indirect_count 1 -#define VK_KHR_DRAW_INDIRECT_COUNT_SPEC_VERSION 1 -#define VK_KHR_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_KHR_draw_indirect_count" -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountKHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountKHR)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountKHR( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountKHR( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); -#endif - - -#define VK_KHR_shader_subgroup_extended_types 1 -#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_SPEC_VERSION 1 -#define VK_KHR_SHADER_SUBGROUP_EXTENDED_TYPES_EXTENSION_NAME "VK_KHR_shader_subgroup_extended_types" -typedef VkPhysicalDeviceShaderSubgroupExtendedTypesFeatures VkPhysicalDeviceShaderSubgroupExtendedTypesFeaturesKHR; - - - -#define VK_KHR_8bit_storage 1 -#define VK_KHR_8BIT_STORAGE_SPEC_VERSION 1 -#define VK_KHR_8BIT_STORAGE_EXTENSION_NAME "VK_KHR_8bit_storage" -typedef VkPhysicalDevice8BitStorageFeatures VkPhysicalDevice8BitStorageFeaturesKHR; - - - -#define VK_KHR_shader_atomic_int64 1 -#define VK_KHR_SHADER_ATOMIC_INT64_SPEC_VERSION 1 -#define VK_KHR_SHADER_ATOMIC_INT64_EXTENSION_NAME "VK_KHR_shader_atomic_int64" -typedef VkPhysicalDeviceShaderAtomicInt64Features VkPhysicalDeviceShaderAtomicInt64FeaturesKHR; - - - -#define VK_KHR_shader_clock 1 -#define VK_KHR_SHADER_CLOCK_SPEC_VERSION 1 -#define VK_KHR_SHADER_CLOCK_EXTENSION_NAME "VK_KHR_shader_clock" -typedef struct VkPhysicalDeviceShaderClockFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 shaderSubgroupClock; - VkBool32 shaderDeviceClock; -} VkPhysicalDeviceShaderClockFeaturesKHR; - - - -#define VK_KHR_driver_properties 1 -#define VK_KHR_DRIVER_PROPERTIES_SPEC_VERSION 1 -#define VK_KHR_DRIVER_PROPERTIES_EXTENSION_NAME "VK_KHR_driver_properties" -#define VK_MAX_DRIVER_NAME_SIZE_KHR VK_MAX_DRIVER_NAME_SIZE -#define VK_MAX_DRIVER_INFO_SIZE_KHR VK_MAX_DRIVER_INFO_SIZE -typedef VkDriverId VkDriverIdKHR; - -typedef VkConformanceVersion VkConformanceVersionKHR; - -typedef VkPhysicalDeviceDriverProperties VkPhysicalDeviceDriverPropertiesKHR; - - - -#define VK_KHR_shader_float_controls 1 -#define VK_KHR_SHADER_FLOAT_CONTROLS_SPEC_VERSION 4 -#define VK_KHR_SHADER_FLOAT_CONTROLS_EXTENSION_NAME "VK_KHR_shader_float_controls" -typedef VkShaderFloatControlsIndependence VkShaderFloatControlsIndependenceKHR; - -typedef VkPhysicalDeviceFloatControlsProperties VkPhysicalDeviceFloatControlsPropertiesKHR; - - - -#define VK_KHR_depth_stencil_resolve 1 -#define VK_KHR_DEPTH_STENCIL_RESOLVE_SPEC_VERSION 1 -#define VK_KHR_DEPTH_STENCIL_RESOLVE_EXTENSION_NAME "VK_KHR_depth_stencil_resolve" -typedef VkResolveModeFlagBits VkResolveModeFlagBitsKHR; - -typedef VkResolveModeFlags VkResolveModeFlagsKHR; - -typedef VkSubpassDescriptionDepthStencilResolve VkSubpassDescriptionDepthStencilResolveKHR; - -typedef VkPhysicalDeviceDepthStencilResolveProperties VkPhysicalDeviceDepthStencilResolvePropertiesKHR; - - - -#define VK_KHR_swapchain_mutable_format 1 -#define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_SPEC_VERSION 1 -#define VK_KHR_SWAPCHAIN_MUTABLE_FORMAT_EXTENSION_NAME "VK_KHR_swapchain_mutable_format" - - -#define VK_KHR_timeline_semaphore 1 -#define VK_KHR_TIMELINE_SEMAPHORE_SPEC_VERSION 2 -#define VK_KHR_TIMELINE_SEMAPHORE_EXTENSION_NAME "VK_KHR_timeline_semaphore" -typedef VkSemaphoreType VkSemaphoreTypeKHR; - -typedef VkSemaphoreWaitFlagBits VkSemaphoreWaitFlagBitsKHR; - -typedef VkSemaphoreWaitFlags VkSemaphoreWaitFlagsKHR; - -typedef VkPhysicalDeviceTimelineSemaphoreFeatures VkPhysicalDeviceTimelineSemaphoreFeaturesKHR; - -typedef VkPhysicalDeviceTimelineSemaphoreProperties VkPhysicalDeviceTimelineSemaphorePropertiesKHR; - -typedef VkSemaphoreTypeCreateInfo VkSemaphoreTypeCreateInfoKHR; - -typedef VkTimelineSemaphoreSubmitInfo VkTimelineSemaphoreSubmitInfoKHR; - -typedef VkSemaphoreWaitInfo VkSemaphoreWaitInfoKHR; - -typedef VkSemaphoreSignalInfo VkSemaphoreSignalInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreCounterValueKHR)(VkDevice device, VkSemaphore semaphore, uint64_t* pValue); -typedef VkResult (VKAPI_PTR *PFN_vkWaitSemaphoresKHR)(VkDevice device, const VkSemaphoreWaitInfo* pWaitInfo, uint64_t timeout); -typedef VkResult (VKAPI_PTR *PFN_vkSignalSemaphoreKHR)(VkDevice device, const VkSemaphoreSignalInfo* pSignalInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreCounterValueKHR( - VkDevice device, - VkSemaphore semaphore, - uint64_t* pValue); - -VKAPI_ATTR VkResult VKAPI_CALL vkWaitSemaphoresKHR( - VkDevice device, - const VkSemaphoreWaitInfo* pWaitInfo, - uint64_t timeout); - -VKAPI_ATTR VkResult VKAPI_CALL vkSignalSemaphoreKHR( - VkDevice device, - const VkSemaphoreSignalInfo* pSignalInfo); -#endif - - -#define VK_KHR_vulkan_memory_model 1 -#define VK_KHR_VULKAN_MEMORY_MODEL_SPEC_VERSION 3 -#define VK_KHR_VULKAN_MEMORY_MODEL_EXTENSION_NAME "VK_KHR_vulkan_memory_model" -typedef VkPhysicalDeviceVulkanMemoryModelFeatures VkPhysicalDeviceVulkanMemoryModelFeaturesKHR; - - - -#define VK_KHR_shader_terminate_invocation 1 -#define VK_KHR_SHADER_TERMINATE_INVOCATION_SPEC_VERSION 1 -#define VK_KHR_SHADER_TERMINATE_INVOCATION_EXTENSION_NAME "VK_KHR_shader_terminate_invocation" -typedef struct VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 shaderTerminateInvocation; -} VkPhysicalDeviceShaderTerminateInvocationFeaturesKHR; - - - -#define VK_KHR_fragment_shading_rate 1 -#define VK_KHR_FRAGMENT_SHADING_RATE_SPEC_VERSION 1 -#define VK_KHR_FRAGMENT_SHADING_RATE_EXTENSION_NAME "VK_KHR_fragment_shading_rate" - -typedef enum VkFragmentShadingRateCombinerOpKHR { - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_KEEP_KHR = 0, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_REPLACE_KHR = 1, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MIN_KHR = 2, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_KHR = 3, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MUL_KHR = 4, - VK_FRAGMENT_SHADING_RATE_COMBINER_OP_MAX_ENUM_KHR = 0x7FFFFFFF -} VkFragmentShadingRateCombinerOpKHR; -typedef struct VkFragmentShadingRateAttachmentInfoKHR { - VkStructureType sType; - const void* pNext; - const VkAttachmentReference2* pFragmentShadingRateAttachment; - VkExtent2D shadingRateAttachmentTexelSize; -} VkFragmentShadingRateAttachmentInfoKHR; - -typedef struct VkPipelineFragmentShadingRateStateCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkExtent2D fragmentSize; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateStateCreateInfoKHR; - -typedef struct VkPhysicalDeviceFragmentShadingRateFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 pipelineFragmentShadingRate; - VkBool32 primitiveFragmentShadingRate; - VkBool32 attachmentFragmentShadingRate; -} VkPhysicalDeviceFragmentShadingRateFeaturesKHR; - -typedef struct VkPhysicalDeviceFragmentShadingRatePropertiesKHR { - VkStructureType sType; - void* pNext; - VkExtent2D minFragmentShadingRateAttachmentTexelSize; - VkExtent2D maxFragmentShadingRateAttachmentTexelSize; - uint32_t maxFragmentShadingRateAttachmentTexelSizeAspectRatio; - VkBool32 primitiveFragmentShadingRateWithMultipleViewports; - VkBool32 layeredShadingRateAttachments; - VkBool32 fragmentShadingRateNonTrivialCombinerOps; - VkExtent2D maxFragmentSize; - uint32_t maxFragmentSizeAspectRatio; - uint32_t maxFragmentShadingRateCoverageSamples; - VkSampleCountFlagBits maxFragmentShadingRateRasterizationSamples; - VkBool32 fragmentShadingRateWithShaderDepthStencilWrites; - VkBool32 fragmentShadingRateWithSampleMask; - VkBool32 fragmentShadingRateWithShaderSampleMask; - VkBool32 fragmentShadingRateWithConservativeRasterization; - VkBool32 fragmentShadingRateWithFragmentShaderInterlock; - VkBool32 fragmentShadingRateWithCustomSampleLocations; - VkBool32 fragmentShadingRateStrictMultiplyCombiner; -} VkPhysicalDeviceFragmentShadingRatePropertiesKHR; - -typedef struct VkPhysicalDeviceFragmentShadingRateKHR { - VkStructureType sType; - void* pNext; - VkSampleCountFlags sampleCounts; - VkExtent2D fragmentSize; -} VkPhysicalDeviceFragmentShadingRateKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceFragmentShadingRatesKHR)(VkPhysicalDevice physicalDevice, uint32_t* pFragmentShadingRateCount, VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates); -typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateKHR)(VkCommandBuffer commandBuffer, const VkExtent2D* pFragmentSize, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceFragmentShadingRatesKHR( - VkPhysicalDevice physicalDevice, - uint32_t* pFragmentShadingRateCount, - VkPhysicalDeviceFragmentShadingRateKHR* pFragmentShadingRates); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateKHR( - VkCommandBuffer commandBuffer, - const VkExtent2D* pFragmentSize, - const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); -#endif - - -#define VK_KHR_spirv_1_4 1 -#define VK_KHR_SPIRV_1_4_SPEC_VERSION 1 -#define VK_KHR_SPIRV_1_4_EXTENSION_NAME "VK_KHR_spirv_1_4" - - -#define VK_KHR_surface_protected_capabilities 1 -#define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_SPEC_VERSION 1 -#define VK_KHR_SURFACE_PROTECTED_CAPABILITIES_EXTENSION_NAME "VK_KHR_surface_protected_capabilities" -typedef struct VkSurfaceProtectedCapabilitiesKHR { - VkStructureType sType; - const void* pNext; - VkBool32 supportsProtected; -} VkSurfaceProtectedCapabilitiesKHR; - - - -#define VK_KHR_separate_depth_stencil_layouts 1 -#define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_SPEC_VERSION 1 -#define VK_KHR_SEPARATE_DEPTH_STENCIL_LAYOUTS_EXTENSION_NAME "VK_KHR_separate_depth_stencil_layouts" -typedef VkPhysicalDeviceSeparateDepthStencilLayoutsFeatures VkPhysicalDeviceSeparateDepthStencilLayoutsFeaturesKHR; - -typedef VkAttachmentReferenceStencilLayout VkAttachmentReferenceStencilLayoutKHR; - -typedef VkAttachmentDescriptionStencilLayout VkAttachmentDescriptionStencilLayoutKHR; - - - -#define VK_KHR_uniform_buffer_standard_layout 1 -#define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_UNIFORM_BUFFER_STANDARD_LAYOUT_EXTENSION_NAME "VK_KHR_uniform_buffer_standard_layout" -typedef VkPhysicalDeviceUniformBufferStandardLayoutFeatures VkPhysicalDeviceUniformBufferStandardLayoutFeaturesKHR; - - - -#define VK_KHR_buffer_device_address 1 -#define VK_KHR_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 1 -#define VK_KHR_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_KHR_buffer_device_address" -typedef VkPhysicalDeviceBufferDeviceAddressFeatures VkPhysicalDeviceBufferDeviceAddressFeaturesKHR; - -typedef VkBufferDeviceAddressInfo VkBufferDeviceAddressInfoKHR; - -typedef VkBufferOpaqueCaptureAddressCreateInfo VkBufferOpaqueCaptureAddressCreateInfoKHR; - -typedef VkMemoryOpaqueCaptureAddressAllocateInfo VkMemoryOpaqueCaptureAddressAllocateInfoKHR; - -typedef VkDeviceMemoryOpaqueCaptureAddressInfo VkDeviceMemoryOpaqueCaptureAddressInfoKHR; - -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddressKHR)(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); -typedef uint64_t (VKAPI_PTR *PFN_vkGetBufferOpaqueCaptureAddressKHR)(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); -typedef uint64_t (VKAPI_PTR *PFN_vkGetDeviceMemoryOpaqueCaptureAddressKHR)(VkDevice device, const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressKHR( - VkDevice device, - const VkBufferDeviceAddressInfo* pInfo); - -VKAPI_ATTR uint64_t VKAPI_CALL vkGetBufferOpaqueCaptureAddressKHR( - VkDevice device, - const VkBufferDeviceAddressInfo* pInfo); - -VKAPI_ATTR uint64_t VKAPI_CALL vkGetDeviceMemoryOpaqueCaptureAddressKHR( - VkDevice device, - const VkDeviceMemoryOpaqueCaptureAddressInfo* pInfo); -#endif - - -#define VK_KHR_deferred_host_operations 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDeferredOperationKHR) -#define VK_KHR_DEFERRED_HOST_OPERATIONS_SPEC_VERSION 4 -#define VK_KHR_DEFERRED_HOST_OPERATIONS_EXTENSION_NAME "VK_KHR_deferred_host_operations" -typedef VkResult (VKAPI_PTR *PFN_vkCreateDeferredOperationKHR)(VkDevice device, const VkAllocationCallbacks* pAllocator, VkDeferredOperationKHR* pDeferredOperation); -typedef void (VKAPI_PTR *PFN_vkDestroyDeferredOperationKHR)(VkDevice device, VkDeferredOperationKHR operation, const VkAllocationCallbacks* pAllocator); -typedef uint32_t (VKAPI_PTR *PFN_vkGetDeferredOperationMaxConcurrencyKHR)(VkDevice device, VkDeferredOperationKHR operation); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeferredOperationResultKHR)(VkDevice device, VkDeferredOperationKHR operation); -typedef VkResult (VKAPI_PTR *PFN_vkDeferredOperationJoinKHR)(VkDevice device, VkDeferredOperationKHR operation); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDeferredOperationKHR( - VkDevice device, - const VkAllocationCallbacks* pAllocator, - VkDeferredOperationKHR* pDeferredOperation); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDeferredOperationKHR( - VkDevice device, - VkDeferredOperationKHR operation, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR uint32_t VKAPI_CALL vkGetDeferredOperationMaxConcurrencyKHR( - VkDevice device, - VkDeferredOperationKHR operation); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeferredOperationResultKHR( - VkDevice device, - VkDeferredOperationKHR operation); - -VKAPI_ATTR VkResult VKAPI_CALL vkDeferredOperationJoinKHR( - VkDevice device, - VkDeferredOperationKHR operation); -#endif - - -#define VK_KHR_pipeline_executable_properties 1 -#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_SPEC_VERSION 1 -#define VK_KHR_PIPELINE_EXECUTABLE_PROPERTIES_EXTENSION_NAME "VK_KHR_pipeline_executable_properties" - -typedef enum VkPipelineExecutableStatisticFormatKHR { - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_BOOL32_KHR = 0, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_INT64_KHR = 1, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_UINT64_KHR = 2, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_FLOAT64_KHR = 3, - VK_PIPELINE_EXECUTABLE_STATISTIC_FORMAT_MAX_ENUM_KHR = 0x7FFFFFFF -} VkPipelineExecutableStatisticFormatKHR; -typedef struct VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 pipelineExecutableInfo; -} VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR; - -typedef struct VkPipelineInfoKHR { - VkStructureType sType; - const void* pNext; - VkPipeline pipeline; -} VkPipelineInfoKHR; - -typedef struct VkPipelineExecutablePropertiesKHR { - VkStructureType sType; - void* pNext; - VkShaderStageFlags stages; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - uint32_t subgroupSize; -} VkPipelineExecutablePropertiesKHR; - -typedef struct VkPipelineExecutableInfoKHR { - VkStructureType sType; - const void* pNext; - VkPipeline pipeline; - uint32_t executableIndex; -} VkPipelineExecutableInfoKHR; - -typedef union VkPipelineExecutableStatisticValueKHR { - VkBool32 b32; - int64_t i64; - uint64_t u64; - double f64; -} VkPipelineExecutableStatisticValueKHR; - -typedef struct VkPipelineExecutableStatisticKHR { - VkStructureType sType; - void* pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkPipelineExecutableStatisticFormatKHR format; - VkPipelineExecutableStatisticValueKHR value; -} VkPipelineExecutableStatisticKHR; - -typedef struct VkPipelineExecutableInternalRepresentationKHR { - VkStructureType sType; - void* pNext; - char name[VK_MAX_DESCRIPTION_SIZE]; - char description[VK_MAX_DESCRIPTION_SIZE]; - VkBool32 isText; - size_t dataSize; - void* pData; -} VkPipelineExecutableInternalRepresentationKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutablePropertiesKHR)(VkDevice device, const VkPipelineInfoKHR* pPipelineInfo, uint32_t* pExecutableCount, VkPipelineExecutablePropertiesKHR* pProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableStatisticsKHR)(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pStatisticCount, VkPipelineExecutableStatisticKHR* pStatistics); -typedef VkResult (VKAPI_PTR *PFN_vkGetPipelineExecutableInternalRepresentationsKHR)(VkDevice device, const VkPipelineExecutableInfoKHR* pExecutableInfo, uint32_t* pInternalRepresentationCount, VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutablePropertiesKHR( - VkDevice device, - const VkPipelineInfoKHR* pPipelineInfo, - uint32_t* pExecutableCount, - VkPipelineExecutablePropertiesKHR* pProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableStatisticsKHR( - VkDevice device, - const VkPipelineExecutableInfoKHR* pExecutableInfo, - uint32_t* pStatisticCount, - VkPipelineExecutableStatisticKHR* pStatistics); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPipelineExecutableInternalRepresentationsKHR( - VkDevice device, - const VkPipelineExecutableInfoKHR* pExecutableInfo, - uint32_t* pInternalRepresentationCount, - VkPipelineExecutableInternalRepresentationKHR* pInternalRepresentations); -#endif - - -#define VK_KHR_pipeline_library 1 -#define VK_KHR_PIPELINE_LIBRARY_SPEC_VERSION 1 -#define VK_KHR_PIPELINE_LIBRARY_EXTENSION_NAME "VK_KHR_pipeline_library" -typedef struct VkPipelineLibraryCreateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t libraryCount; - const VkPipeline* pLibraries; -} VkPipelineLibraryCreateInfoKHR; - - - -#define VK_KHR_shader_non_semantic_info 1 -#define VK_KHR_SHADER_NON_SEMANTIC_INFO_SPEC_VERSION 1 -#define VK_KHR_SHADER_NON_SEMANTIC_INFO_EXTENSION_NAME "VK_KHR_shader_non_semantic_info" - - -#define VK_KHR_synchronization2 1 -typedef uint64_t VkFlags64; -#define VK_KHR_SYNCHRONIZATION_2_SPEC_VERSION 1 -#define VK_KHR_SYNCHRONIZATION_2_EXTENSION_NAME "VK_KHR_synchronization2" -typedef VkFlags64 VkPipelineStageFlags2KHR; - -// Flag bits for VkPipelineStageFlagBits2KHR -typedef VkFlags64 VkPipelineStageFlagBits2KHR; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_NONE_KHR = 0ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TOP_OF_PIPE_BIT_KHR = 0x00000001ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_DRAW_INDIRECT_BIT_KHR = 0x00000002ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_VERTEX_INPUT_BIT_KHR = 0x00000004ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_VERTEX_SHADER_BIT_KHR = 0x00000008ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TESSELLATION_CONTROL_SHADER_BIT_KHR = 0x00000010ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TESSELLATION_EVALUATION_SHADER_BIT_KHR = 0x00000020ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_GEOMETRY_SHADER_BIT_KHR = 0x00000040ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_FRAGMENT_SHADER_BIT_KHR = 0x00000080ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_EARLY_FRAGMENT_TESTS_BIT_KHR = 0x00000100ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_LATE_FRAGMENT_TESTS_BIT_KHR = 0x00000200ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_COLOR_ATTACHMENT_OUTPUT_BIT_KHR = 0x00000400ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_COMPUTE_SHADER_BIT_KHR = 0x00000800ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_ALL_TRANSFER_BIT_KHR = 0x00001000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TRANSFER_BIT_KHR = 0x00001000; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_BOTTOM_OF_PIPE_BIT_KHR = 0x00002000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_HOST_BIT_KHR = 0x00004000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_ALL_GRAPHICS_BIT_KHR = 0x00008000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_ALL_COMMANDS_BIT_KHR = 0x00010000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_COPY_BIT_KHR = 0x100000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_RESOLVE_BIT_KHR = 0x200000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_BLIT_BIT_KHR = 0x400000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_CLEAR_BIT_KHR = 0x800000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_INDEX_INPUT_BIT_KHR = 0x1000000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_VERTEX_ATTRIBUTE_INPUT_BIT_KHR = 0x2000000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_PRE_RASTERIZATION_SHADERS_BIT_KHR = 0x4000000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_VIDEO_DECODE_BIT_KHR = 0x04000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_VIDEO_ENCODE_BIT_KHR = 0x08000000ULL; -#endif -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TRANSFORM_FEEDBACK_BIT_EXT = 0x01000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_CONDITIONAL_RENDERING_BIT_EXT = 0x00040000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_COMMAND_PREPROCESS_BIT_NV = 0x00020000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_FRAGMENT_SHADING_RATE_ATTACHMENT_BIT_KHR = 0x00400000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_SHADING_RATE_IMAGE_BIT_NV = 0x00400000; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_KHR = 0x02000000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_KHR = 0x00200000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_RAY_TRACING_SHADER_BIT_NV = 0x00200000; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_ACCELERATION_STRUCTURE_BUILD_BIT_NV = 0x02000000; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_FRAGMENT_DENSITY_PROCESS_BIT_EXT = 0x00800000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_TASK_SHADER_BIT_NV = 0x00080000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_2_MESH_SHADER_BIT_NV = 0x00100000ULL; -static const VkPipelineStageFlagBits2KHR VK_PIPELINE_STAGE_FLAG_BITS_2KHR_MAX_ENUM_KHR = 0x7FFFFFFFFFFFFFFFULL; - -typedef VkFlags64 VkAccessFlags2KHR; - -// Flag bits for VkAccessFlagBits2KHR -typedef VkFlags64 VkAccessFlagBits2KHR; -static const VkAccessFlagBits2KHR VK_ACCESS_2_NONE_KHR = 0ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_INDIRECT_COMMAND_READ_BIT_KHR = 0x00000001ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_INDEX_READ_BIT_KHR = 0x00000002ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_VERTEX_ATTRIBUTE_READ_BIT_KHR = 0x00000004ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_UNIFORM_READ_BIT_KHR = 0x00000008ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_INPUT_ATTACHMENT_READ_BIT_KHR = 0x00000010ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADER_READ_BIT_KHR = 0x00000020ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADER_WRITE_BIT_KHR = 0x00000040ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_COLOR_ATTACHMENT_READ_BIT_KHR = 0x00000080ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_COLOR_ATTACHMENT_WRITE_BIT_KHR = 0x00000100ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_READ_BIT_KHR = 0x00000200ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_DEPTH_STENCIL_ATTACHMENT_WRITE_BIT_KHR = 0x00000400ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_TRANSFER_READ_BIT_KHR = 0x00000800ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_TRANSFER_WRITE_BIT_KHR = 0x00001000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_HOST_READ_BIT_KHR = 0x00002000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_HOST_WRITE_BIT_KHR = 0x00004000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_MEMORY_READ_BIT_KHR = 0x00008000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_MEMORY_WRITE_BIT_KHR = 0x00010000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADER_SAMPLED_READ_BIT_KHR = 0x100000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADER_STORAGE_READ_BIT_KHR = 0x200000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADER_STORAGE_WRITE_BIT_KHR = 0x400000000ULL; -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkAccessFlagBits2KHR VK_ACCESS_2_VIDEO_DECODE_READ_BIT_KHR = 0x800000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkAccessFlagBits2KHR VK_ACCESS_2_VIDEO_DECODE_WRITE_BIT_KHR = 0x1000000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkAccessFlagBits2KHR VK_ACCESS_2_VIDEO_ENCODE_READ_BIT_KHR = 0x2000000000ULL; -#endif -#ifdef VK_ENABLE_BETA_EXTENSIONS -static const VkAccessFlagBits2KHR VK_ACCESS_2_VIDEO_ENCODE_WRITE_BIT_KHR = 0x4000000000ULL; -#endif -static const VkAccessFlagBits2KHR VK_ACCESS_2_TRANSFORM_FEEDBACK_WRITE_BIT_EXT = 0x02000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_READ_BIT_EXT = 0x04000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_TRANSFORM_FEEDBACK_COUNTER_WRITE_BIT_EXT = 0x08000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_CONDITIONAL_RENDERING_READ_BIT_EXT = 0x00100000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_COMMAND_PREPROCESS_READ_BIT_NV = 0x00020000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_COMMAND_PREPROCESS_WRITE_BIT_NV = 0x00040000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR = 0x00800000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV = 0x00800000; -static const VkAccessFlagBits2KHR VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_KHR = 0x00200000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_KHR = 0x00400000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_ACCELERATION_STRUCTURE_READ_BIT_NV = 0x00200000; -static const VkAccessFlagBits2KHR VK_ACCESS_2_ACCELERATION_STRUCTURE_WRITE_BIT_NV = 0x00400000; -static const VkAccessFlagBits2KHR VK_ACCESS_2_FRAGMENT_DENSITY_MAP_READ_BIT_EXT = 0x01000000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_2_COLOR_ATTACHMENT_READ_NONCOHERENT_BIT_EXT = 0x00080000ULL; -static const VkAccessFlagBits2KHR VK_ACCESS_FLAG_BITS_2KHR_MAX_ENUM_KHR = 0x7FFFFFFFFFFFFFFFULL; - - -typedef enum VkSubmitFlagBitsKHR { - VK_SUBMIT_PROTECTED_BIT_KHR = 0x00000001, - VK_SUBMIT_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkSubmitFlagBitsKHR; -typedef VkFlags VkSubmitFlagsKHR; -typedef struct VkMemoryBarrier2KHR { - VkStructureType sType; - const void* pNext; - VkPipelineStageFlags2KHR srcStageMask; - VkAccessFlags2KHR srcAccessMask; - VkPipelineStageFlags2KHR dstStageMask; - VkAccessFlags2KHR dstAccessMask; -} VkMemoryBarrier2KHR; - -typedef struct VkBufferMemoryBarrier2KHR { - VkStructureType sType; - const void* pNext; - VkPipelineStageFlags2KHR srcStageMask; - VkAccessFlags2KHR srcAccessMask; - VkPipelineStageFlags2KHR dstStageMask; - VkAccessFlags2KHR dstAccessMask; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize size; -} VkBufferMemoryBarrier2KHR; - -typedef struct VkImageMemoryBarrier2KHR { - VkStructureType sType; - const void* pNext; - VkPipelineStageFlags2KHR srcStageMask; - VkAccessFlags2KHR srcAccessMask; - VkPipelineStageFlags2KHR dstStageMask; - VkAccessFlags2KHR dstAccessMask; - VkImageLayout oldLayout; - VkImageLayout newLayout; - uint32_t srcQueueFamilyIndex; - uint32_t dstQueueFamilyIndex; - VkImage image; - VkImageSubresourceRange subresourceRange; -} VkImageMemoryBarrier2KHR; - -typedef struct VkDependencyInfoKHR { - VkStructureType sType; - const void* pNext; - VkDependencyFlags dependencyFlags; - uint32_t memoryBarrierCount; - const VkMemoryBarrier2KHR* pMemoryBarriers; - uint32_t bufferMemoryBarrierCount; - const VkBufferMemoryBarrier2KHR* pBufferMemoryBarriers; - uint32_t imageMemoryBarrierCount; - const VkImageMemoryBarrier2KHR* pImageMemoryBarriers; -} VkDependencyInfoKHR; - -typedef struct VkSemaphoreSubmitInfoKHR { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - uint64_t value; - VkPipelineStageFlags2KHR stageMask; - uint32_t deviceIndex; -} VkSemaphoreSubmitInfoKHR; - -typedef struct VkCommandBufferSubmitInfoKHR { - VkStructureType sType; - const void* pNext; - VkCommandBuffer commandBuffer; - uint32_t deviceMask; -} VkCommandBufferSubmitInfoKHR; - -typedef struct VkSubmitInfo2KHR { - VkStructureType sType; - const void* pNext; - VkSubmitFlagsKHR flags; - uint32_t waitSemaphoreInfoCount; - const VkSemaphoreSubmitInfoKHR* pWaitSemaphoreInfos; - uint32_t commandBufferInfoCount; - const VkCommandBufferSubmitInfoKHR* pCommandBufferInfos; - uint32_t signalSemaphoreInfoCount; - const VkSemaphoreSubmitInfoKHR* pSignalSemaphoreInfos; -} VkSubmitInfo2KHR; - -typedef struct VkPhysicalDeviceSynchronization2FeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 synchronization2; -} VkPhysicalDeviceSynchronization2FeaturesKHR; - -typedef struct VkQueueFamilyCheckpointProperties2NV { - VkStructureType sType; - void* pNext; - VkPipelineStageFlags2KHR checkpointExecutionStageMask; -} VkQueueFamilyCheckpointProperties2NV; - -typedef struct VkCheckpointData2NV { - VkStructureType sType; - void* pNext; - VkPipelineStageFlags2KHR stage; - void* pCheckpointMarker; -} VkCheckpointData2NV; - -typedef void (VKAPI_PTR *PFN_vkCmdSetEvent2KHR)(VkCommandBuffer commandBuffer, VkEvent event, const VkDependencyInfoKHR* pDependencyInfo); -typedef void (VKAPI_PTR *PFN_vkCmdResetEvent2KHR)(VkCommandBuffer commandBuffer, VkEvent event, VkPipelineStageFlags2KHR stageMask); -typedef void (VKAPI_PTR *PFN_vkCmdWaitEvents2KHR)(VkCommandBuffer commandBuffer, uint32_t eventCount, const VkEvent* pEvents, const VkDependencyInfoKHR* pDependencyInfos); -typedef void (VKAPI_PTR *PFN_vkCmdPipelineBarrier2KHR)(VkCommandBuffer commandBuffer, const VkDependencyInfoKHR* pDependencyInfo); -typedef void (VKAPI_PTR *PFN_vkCmdWriteTimestamp2KHR)(VkCommandBuffer commandBuffer, VkPipelineStageFlags2KHR stage, VkQueryPool queryPool, uint32_t query); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSubmit2KHR)(VkQueue queue, uint32_t submitCount, const VkSubmitInfo2KHR* pSubmits, VkFence fence); -typedef void (VKAPI_PTR *PFN_vkCmdWriteBufferMarker2AMD)(VkCommandBuffer commandBuffer, VkPipelineStageFlags2KHR stage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker); -typedef void (VKAPI_PTR *PFN_vkGetQueueCheckpointData2NV)(VkQueue queue, uint32_t* pCheckpointDataCount, VkCheckpointData2NV* pCheckpointData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetEvent2KHR( - VkCommandBuffer commandBuffer, - VkEvent event, - const VkDependencyInfoKHR* pDependencyInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdResetEvent2KHR( - VkCommandBuffer commandBuffer, - VkEvent event, - VkPipelineStageFlags2KHR stageMask); - -VKAPI_ATTR void VKAPI_CALL vkCmdWaitEvents2KHR( - VkCommandBuffer commandBuffer, - uint32_t eventCount, - const VkEvent* pEvents, - const VkDependencyInfoKHR* pDependencyInfos); - -VKAPI_ATTR void VKAPI_CALL vkCmdPipelineBarrier2KHR( - VkCommandBuffer commandBuffer, - const VkDependencyInfoKHR* pDependencyInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdWriteTimestamp2KHR( - VkCommandBuffer commandBuffer, - VkPipelineStageFlags2KHR stage, - VkQueryPool queryPool, - uint32_t query); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueSubmit2KHR( - VkQueue queue, - uint32_t submitCount, - const VkSubmitInfo2KHR* pSubmits, - VkFence fence); - -VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarker2AMD( - VkCommandBuffer commandBuffer, - VkPipelineStageFlags2KHR stage, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - uint32_t marker); - -VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointData2NV( - VkQueue queue, - uint32_t* pCheckpointDataCount, - VkCheckpointData2NV* pCheckpointData); -#endif - - -#define VK_KHR_zero_initialize_workgroup_memory 1 -#define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_SPEC_VERSION 1 -#define VK_KHR_ZERO_INITIALIZE_WORKGROUP_MEMORY_EXTENSION_NAME "VK_KHR_zero_initialize_workgroup_memory" -typedef struct VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 shaderZeroInitializeWorkgroupMemory; -} VkPhysicalDeviceZeroInitializeWorkgroupMemoryFeaturesKHR; - - - -#define VK_KHR_workgroup_memory_explicit_layout 1 -#define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_SPEC_VERSION 1 -#define VK_KHR_WORKGROUP_MEMORY_EXPLICIT_LAYOUT_EXTENSION_NAME "VK_KHR_workgroup_memory_explicit_layout" -typedef struct VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 workgroupMemoryExplicitLayout; - VkBool32 workgroupMemoryExplicitLayoutScalarBlockLayout; - VkBool32 workgroupMemoryExplicitLayout8BitAccess; - VkBool32 workgroupMemoryExplicitLayout16BitAccess; -} VkPhysicalDeviceWorkgroupMemoryExplicitLayoutFeaturesKHR; - - - -#define VK_KHR_copy_commands2 1 -#define VK_KHR_COPY_COMMANDS_2_SPEC_VERSION 1 -#define VK_KHR_COPY_COMMANDS_2_EXTENSION_NAME "VK_KHR_copy_commands2" -typedef struct VkBufferCopy2KHR { - VkStructureType sType; - const void* pNext; - VkDeviceSize srcOffset; - VkDeviceSize dstOffset; - VkDeviceSize size; -} VkBufferCopy2KHR; - -typedef struct VkCopyBufferInfo2KHR { - VkStructureType sType; - const void* pNext; - VkBuffer srcBuffer; - VkBuffer dstBuffer; - uint32_t regionCount; - const VkBufferCopy2KHR* pRegions; -} VkCopyBufferInfo2KHR; - -typedef struct VkImageCopy2KHR { - VkStructureType sType; - const void* pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageCopy2KHR; - -typedef struct VkCopyImageInfo2KHR { - VkStructureType sType; - const void* pNext; - VkImage srcImage; - VkImageLayout srcImageLayout; - VkImage dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageCopy2KHR* pRegions; -} VkCopyImageInfo2KHR; - -typedef struct VkBufferImageCopy2KHR { - VkStructureType sType; - const void* pNext; - VkDeviceSize bufferOffset; - uint32_t bufferRowLength; - uint32_t bufferImageHeight; - VkImageSubresourceLayers imageSubresource; - VkOffset3D imageOffset; - VkExtent3D imageExtent; -} VkBufferImageCopy2KHR; - -typedef struct VkCopyBufferToImageInfo2KHR { - VkStructureType sType; - const void* pNext; - VkBuffer srcBuffer; - VkImage dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkBufferImageCopy2KHR* pRegions; -} VkCopyBufferToImageInfo2KHR; - -typedef struct VkCopyImageToBufferInfo2KHR { - VkStructureType sType; - const void* pNext; - VkImage srcImage; - VkImageLayout srcImageLayout; - VkBuffer dstBuffer; - uint32_t regionCount; - const VkBufferImageCopy2KHR* pRegions; -} VkCopyImageToBufferInfo2KHR; - -typedef struct VkImageBlit2KHR { - VkStructureType sType; - const void* pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffsets[2]; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffsets[2]; -} VkImageBlit2KHR; - -typedef struct VkBlitImageInfo2KHR { - VkStructureType sType; - const void* pNext; - VkImage srcImage; - VkImageLayout srcImageLayout; - VkImage dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageBlit2KHR* pRegions; - VkFilter filter; -} VkBlitImageInfo2KHR; - -typedef struct VkImageResolve2KHR { - VkStructureType sType; - const void* pNext; - VkImageSubresourceLayers srcSubresource; - VkOffset3D srcOffset; - VkImageSubresourceLayers dstSubresource; - VkOffset3D dstOffset; - VkExtent3D extent; -} VkImageResolve2KHR; - -typedef struct VkResolveImageInfo2KHR { - VkStructureType sType; - const void* pNext; - VkImage srcImage; - VkImageLayout srcImageLayout; - VkImage dstImage; - VkImageLayout dstImageLayout; - uint32_t regionCount; - const VkImageResolve2KHR* pRegions; -} VkResolveImageInfo2KHR; - -typedef void (VKAPI_PTR *PFN_vkCmdCopyBuffer2KHR)(VkCommandBuffer commandBuffer, const VkCopyBufferInfo2KHR* pCopyBufferInfo); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImage2KHR)(VkCommandBuffer commandBuffer, const VkCopyImageInfo2KHR* pCopyImageInfo); -typedef void (VKAPI_PTR *PFN_vkCmdCopyBufferToImage2KHR)(VkCommandBuffer commandBuffer, const VkCopyBufferToImageInfo2KHR* pCopyBufferToImageInfo); -typedef void (VKAPI_PTR *PFN_vkCmdCopyImageToBuffer2KHR)(VkCommandBuffer commandBuffer, const VkCopyImageToBufferInfo2KHR* pCopyImageToBufferInfo); -typedef void (VKAPI_PTR *PFN_vkCmdBlitImage2KHR)(VkCommandBuffer commandBuffer, const VkBlitImageInfo2KHR* pBlitImageInfo); -typedef void (VKAPI_PTR *PFN_vkCmdResolveImage2KHR)(VkCommandBuffer commandBuffer, const VkResolveImageInfo2KHR* pResolveImageInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdCopyBuffer2KHR( - VkCommandBuffer commandBuffer, - const VkCopyBufferInfo2KHR* pCopyBufferInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyImage2KHR( - VkCommandBuffer commandBuffer, - const VkCopyImageInfo2KHR* pCopyImageInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyBufferToImage2KHR( - VkCommandBuffer commandBuffer, - const VkCopyBufferToImageInfo2KHR* pCopyBufferToImageInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyImageToBuffer2KHR( - VkCommandBuffer commandBuffer, - const VkCopyImageToBufferInfo2KHR* pCopyImageToBufferInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdBlitImage2KHR( - VkCommandBuffer commandBuffer, - const VkBlitImageInfo2KHR* pBlitImageInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdResolveImage2KHR( - VkCommandBuffer commandBuffer, - const VkResolveImageInfo2KHR* pResolveImageInfo); -#endif - - -#define VK_EXT_debug_report 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT) -#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 10 -#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report" - -typedef enum VkDebugReportObjectTypeEXT { - VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0, - VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1, - VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2, - VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3, - VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4, - VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6, - VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7, - VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8, - VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9, - VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10, - VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11, - VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12, - VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13, - VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14, - VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17, - VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18, - VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23, - VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24, - VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25, - VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26, - VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27, - VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT = 28, - VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_KHR_EXT = 29, - VK_DEBUG_REPORT_OBJECT_TYPE_DISPLAY_MODE_KHR_EXT = 30, - VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT = 33, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT = 1000156000, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT = 1000085000, - VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_KHR_EXT = 1000150000, - VK_DEBUG_REPORT_OBJECT_TYPE_ACCELERATION_STRUCTURE_NV_EXT = 1000165000, - VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_CALLBACK_EXT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_VALIDATION_CACHE_EXT_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_UPDATE_TEMPLATE_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_KHR_EXT = VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_YCBCR_CONVERSION_EXT, - VK_DEBUG_REPORT_OBJECT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDebugReportObjectTypeEXT; - -typedef enum VkDebugReportFlagBitsEXT { - VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001, - VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002, - VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004, - VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008, - VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010, - VK_DEBUG_REPORT_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDebugReportFlagBitsEXT; -typedef VkFlags VkDebugReportFlagsEXT; -typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)( - VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, - const char* pLayerPrefix, - const char* pMessage, - void* pUserData); - -typedef struct VkDebugReportCallbackCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkDebugReportFlagsEXT flags; - PFN_vkDebugReportCallbackEXT pfnCallback; - void* pUserData; -} VkDebugReportCallbackCreateInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback); -typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT( - VkInstance instance, - const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDebugReportCallbackEXT* pCallback); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT( - VkInstance instance, - VkDebugReportCallbackEXT callback, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT( - VkInstance instance, - VkDebugReportFlagsEXT flags, - VkDebugReportObjectTypeEXT objectType, - uint64_t object, - size_t location, - int32_t messageCode, - const char* pLayerPrefix, - const char* pMessage); -#endif - - -#define VK_NV_glsl_shader 1 -#define VK_NV_GLSL_SHADER_SPEC_VERSION 1 -#define VK_NV_GLSL_SHADER_EXTENSION_NAME "VK_NV_glsl_shader" - - -#define VK_EXT_depth_range_unrestricted 1 -#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_SPEC_VERSION 1 -#define VK_EXT_DEPTH_RANGE_UNRESTRICTED_EXTENSION_NAME "VK_EXT_depth_range_unrestricted" - - -#define VK_IMG_filter_cubic 1 -#define VK_IMG_FILTER_CUBIC_SPEC_VERSION 1 -#define VK_IMG_FILTER_CUBIC_EXTENSION_NAME "VK_IMG_filter_cubic" - - -#define VK_AMD_rasterization_order 1 -#define VK_AMD_RASTERIZATION_ORDER_SPEC_VERSION 1 -#define VK_AMD_RASTERIZATION_ORDER_EXTENSION_NAME "VK_AMD_rasterization_order" - -typedef enum VkRasterizationOrderAMD { - VK_RASTERIZATION_ORDER_STRICT_AMD = 0, - VK_RASTERIZATION_ORDER_RELAXED_AMD = 1, - VK_RASTERIZATION_ORDER_MAX_ENUM_AMD = 0x7FFFFFFF -} VkRasterizationOrderAMD; -typedef struct VkPipelineRasterizationStateRasterizationOrderAMD { - VkStructureType sType; - const void* pNext; - VkRasterizationOrderAMD rasterizationOrder; -} VkPipelineRasterizationStateRasterizationOrderAMD; - - - -#define VK_AMD_shader_trinary_minmax 1 -#define VK_AMD_SHADER_TRINARY_MINMAX_SPEC_VERSION 1 -#define VK_AMD_SHADER_TRINARY_MINMAX_EXTENSION_NAME "VK_AMD_shader_trinary_minmax" - - -#define VK_AMD_shader_explicit_vertex_parameter 1 -#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_SPEC_VERSION 1 -#define VK_AMD_SHADER_EXPLICIT_VERTEX_PARAMETER_EXTENSION_NAME "VK_AMD_shader_explicit_vertex_parameter" - - -#define VK_EXT_debug_marker 1 -#define VK_EXT_DEBUG_MARKER_SPEC_VERSION 4 -#define VK_EXT_DEBUG_MARKER_EXTENSION_NAME "VK_EXT_debug_marker" -typedef struct VkDebugMarkerObjectNameInfoEXT { - VkStructureType sType; - const void* pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t object; - const char* pObjectName; -} VkDebugMarkerObjectNameInfoEXT; - -typedef struct VkDebugMarkerObjectTagInfoEXT { - VkStructureType sType; - const void* pNext; - VkDebugReportObjectTypeEXT objectType; - uint64_t object; - uint64_t tagName; - size_t tagSize; - const void* pTag; -} VkDebugMarkerObjectTagInfoEXT; - -typedef struct VkDebugMarkerMarkerInfoEXT { - VkStructureType sType; - const void* pNext; - const char* pMarkerName; - float color[4]; -} VkDebugMarkerMarkerInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectTagEXT)(VkDevice device, const VkDebugMarkerObjectTagInfoEXT* pTagInfo); -typedef VkResult (VKAPI_PTR *PFN_vkDebugMarkerSetObjectNameEXT)(VkDevice device, const VkDebugMarkerObjectNameInfoEXT* pNameInfo); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerBeginEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerEndEXT)(VkCommandBuffer commandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdDebugMarkerInsertEXT)(VkCommandBuffer commandBuffer, const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectTagEXT( - VkDevice device, - const VkDebugMarkerObjectTagInfoEXT* pTagInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkDebugMarkerSetObjectNameEXT( - VkDevice device, - const VkDebugMarkerObjectNameInfoEXT* pNameInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerBeginEXT( - VkCommandBuffer commandBuffer, - const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerEndEXT( - VkCommandBuffer commandBuffer); - -VKAPI_ATTR void VKAPI_CALL vkCmdDebugMarkerInsertEXT( - VkCommandBuffer commandBuffer, - const VkDebugMarkerMarkerInfoEXT* pMarkerInfo); -#endif - - -#define VK_AMD_gcn_shader 1 -#define VK_AMD_GCN_SHADER_SPEC_VERSION 1 -#define VK_AMD_GCN_SHADER_EXTENSION_NAME "VK_AMD_gcn_shader" - - -#define VK_NV_dedicated_allocation 1 -#define VK_NV_DEDICATED_ALLOCATION_SPEC_VERSION 1 -#define VK_NV_DEDICATED_ALLOCATION_EXTENSION_NAME "VK_NV_dedicated_allocation" -typedef struct VkDedicatedAllocationImageCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationImageCreateInfoNV; - -typedef struct VkDedicatedAllocationBufferCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 dedicatedAllocation; -} VkDedicatedAllocationBufferCreateInfoNV; - -typedef struct VkDedicatedAllocationMemoryAllocateInfoNV { - VkStructureType sType; - const void* pNext; - VkImage image; - VkBuffer buffer; -} VkDedicatedAllocationMemoryAllocateInfoNV; - - - -#define VK_EXT_transform_feedback 1 -#define VK_EXT_TRANSFORM_FEEDBACK_SPEC_VERSION 1 -#define VK_EXT_TRANSFORM_FEEDBACK_EXTENSION_NAME "VK_EXT_transform_feedback" -typedef VkFlags VkPipelineRasterizationStateStreamCreateFlagsEXT; -typedef struct VkPhysicalDeviceTransformFeedbackFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 transformFeedback; - VkBool32 geometryStreams; -} VkPhysicalDeviceTransformFeedbackFeaturesEXT; - -typedef struct VkPhysicalDeviceTransformFeedbackPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t maxTransformFeedbackStreams; - uint32_t maxTransformFeedbackBuffers; - VkDeviceSize maxTransformFeedbackBufferSize; - uint32_t maxTransformFeedbackStreamDataSize; - uint32_t maxTransformFeedbackBufferDataSize; - uint32_t maxTransformFeedbackBufferDataStride; - VkBool32 transformFeedbackQueries; - VkBool32 transformFeedbackStreamsLinesTriangles; - VkBool32 transformFeedbackRasterizationStreamSelect; - VkBool32 transformFeedbackDraw; -} VkPhysicalDeviceTransformFeedbackPropertiesEXT; - -typedef struct VkPipelineRasterizationStateStreamCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPipelineRasterizationStateStreamCreateFlagsEXT flags; - uint32_t rasterizationStream; -} VkPipelineRasterizationStateStreamCreateInfoEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdBindTransformFeedbackBuffersEXT)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes); -typedef void (VKAPI_PTR *PFN_vkCmdBeginTransformFeedbackEXT)(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets); -typedef void (VKAPI_PTR *PFN_vkCmdEndTransformFeedbackEXT)(VkCommandBuffer commandBuffer, uint32_t firstCounterBuffer, uint32_t counterBufferCount, const VkBuffer* pCounterBuffers, const VkDeviceSize* pCounterBufferOffsets); -typedef void (VKAPI_PTR *PFN_vkCmdBeginQueryIndexedEXT)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, VkQueryControlFlags flags, uint32_t index); -typedef void (VKAPI_PTR *PFN_vkCmdEndQueryIndexedEXT)(VkCommandBuffer commandBuffer, VkQueryPool queryPool, uint32_t query, uint32_t index); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectByteCountEXT)(VkCommandBuffer commandBuffer, uint32_t instanceCount, uint32_t firstInstance, VkBuffer counterBuffer, VkDeviceSize counterBufferOffset, uint32_t counterOffset, uint32_t vertexStride); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdBindTransformFeedbackBuffersEXT( - VkCommandBuffer commandBuffer, - uint32_t firstBinding, - uint32_t bindingCount, - const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets, - const VkDeviceSize* pSizes); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginTransformFeedbackEXT( - VkCommandBuffer commandBuffer, - uint32_t firstCounterBuffer, - uint32_t counterBufferCount, - const VkBuffer* pCounterBuffers, - const VkDeviceSize* pCounterBufferOffsets); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndTransformFeedbackEXT( - VkCommandBuffer commandBuffer, - uint32_t firstCounterBuffer, - uint32_t counterBufferCount, - const VkBuffer* pCounterBuffers, - const VkDeviceSize* pCounterBufferOffsets); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginQueryIndexedEXT( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query, - VkQueryControlFlags flags, - uint32_t index); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndQueryIndexedEXT( - VkCommandBuffer commandBuffer, - VkQueryPool queryPool, - uint32_t query, - uint32_t index); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectByteCountEXT( - VkCommandBuffer commandBuffer, - uint32_t instanceCount, - uint32_t firstInstance, - VkBuffer counterBuffer, - VkDeviceSize counterBufferOffset, - uint32_t counterOffset, - uint32_t vertexStride); -#endif - - -#define VK_NVX_image_view_handle 1 -#define VK_NVX_IMAGE_VIEW_HANDLE_SPEC_VERSION 2 -#define VK_NVX_IMAGE_VIEW_HANDLE_EXTENSION_NAME "VK_NVX_image_view_handle" -typedef struct VkImageViewHandleInfoNVX { - VkStructureType sType; - const void* pNext; - VkImageView imageView; - VkDescriptorType descriptorType; - VkSampler sampler; -} VkImageViewHandleInfoNVX; - -typedef struct VkImageViewAddressPropertiesNVX { - VkStructureType sType; - void* pNext; - VkDeviceAddress deviceAddress; - VkDeviceSize size; -} VkImageViewAddressPropertiesNVX; - -typedef uint32_t (VKAPI_PTR *PFN_vkGetImageViewHandleNVX)(VkDevice device, const VkImageViewHandleInfoNVX* pInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetImageViewAddressNVX)(VkDevice device, VkImageView imageView, VkImageViewAddressPropertiesNVX* pProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR uint32_t VKAPI_CALL vkGetImageViewHandleNVX( - VkDevice device, - const VkImageViewHandleInfoNVX* pInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetImageViewAddressNVX( - VkDevice device, - VkImageView imageView, - VkImageViewAddressPropertiesNVX* pProperties); -#endif - - -#define VK_AMD_draw_indirect_count 1 -#define VK_AMD_DRAW_INDIRECT_COUNT_SPEC_VERSION 2 -#define VK_AMD_DRAW_INDIRECT_COUNT_EXTENSION_NAME "VK_AMD_draw_indirect_count" -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDrawIndexedIndirectCountAMD)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndirectCountAMD( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawIndexedIndirectCountAMD( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); -#endif - - -#define VK_AMD_negative_viewport_height 1 -#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_SPEC_VERSION 1 -#define VK_AMD_NEGATIVE_VIEWPORT_HEIGHT_EXTENSION_NAME "VK_AMD_negative_viewport_height" - - -#define VK_AMD_gpu_shader_half_float 1 -#define VK_AMD_GPU_SHADER_HALF_FLOAT_SPEC_VERSION 2 -#define VK_AMD_GPU_SHADER_HALF_FLOAT_EXTENSION_NAME "VK_AMD_gpu_shader_half_float" - - -#define VK_AMD_shader_ballot 1 -#define VK_AMD_SHADER_BALLOT_SPEC_VERSION 1 -#define VK_AMD_SHADER_BALLOT_EXTENSION_NAME "VK_AMD_shader_ballot" - - -#define VK_AMD_texture_gather_bias_lod 1 -#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_SPEC_VERSION 1 -#define VK_AMD_TEXTURE_GATHER_BIAS_LOD_EXTENSION_NAME "VK_AMD_texture_gather_bias_lod" -typedef struct VkTextureLODGatherFormatPropertiesAMD { - VkStructureType sType; - void* pNext; - VkBool32 supportsTextureGatherLODBiasAMD; -} VkTextureLODGatherFormatPropertiesAMD; - - - -#define VK_AMD_shader_info 1 -#define VK_AMD_SHADER_INFO_SPEC_VERSION 1 -#define VK_AMD_SHADER_INFO_EXTENSION_NAME "VK_AMD_shader_info" - -typedef enum VkShaderInfoTypeAMD { - VK_SHADER_INFO_TYPE_STATISTICS_AMD = 0, - VK_SHADER_INFO_TYPE_BINARY_AMD = 1, - VK_SHADER_INFO_TYPE_DISASSEMBLY_AMD = 2, - VK_SHADER_INFO_TYPE_MAX_ENUM_AMD = 0x7FFFFFFF -} VkShaderInfoTypeAMD; -typedef struct VkShaderResourceUsageAMD { - uint32_t numUsedVgprs; - uint32_t numUsedSgprs; - uint32_t ldsSizePerLocalWorkGroup; - size_t ldsUsageSizeInBytes; - size_t scratchMemUsageInBytes; -} VkShaderResourceUsageAMD; - -typedef struct VkShaderStatisticsInfoAMD { - VkShaderStageFlags shaderStageMask; - VkShaderResourceUsageAMD resourceUsage; - uint32_t numPhysicalVgprs; - uint32_t numPhysicalSgprs; - uint32_t numAvailableVgprs; - uint32_t numAvailableSgprs; - uint32_t computeWorkGroupSize[3]; -} VkShaderStatisticsInfoAMD; - -typedef VkResult (VKAPI_PTR *PFN_vkGetShaderInfoAMD)(VkDevice device, VkPipeline pipeline, VkShaderStageFlagBits shaderStage, VkShaderInfoTypeAMD infoType, size_t* pInfoSize, void* pInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetShaderInfoAMD( - VkDevice device, - VkPipeline pipeline, - VkShaderStageFlagBits shaderStage, - VkShaderInfoTypeAMD infoType, - size_t* pInfoSize, - void* pInfo); -#endif - - -#define VK_AMD_shader_image_load_store_lod 1 -#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_SPEC_VERSION 1 -#define VK_AMD_SHADER_IMAGE_LOAD_STORE_LOD_EXTENSION_NAME "VK_AMD_shader_image_load_store_lod" - - -#define VK_NV_corner_sampled_image 1 -#define VK_NV_CORNER_SAMPLED_IMAGE_SPEC_VERSION 2 -#define VK_NV_CORNER_SAMPLED_IMAGE_EXTENSION_NAME "VK_NV_corner_sampled_image" -typedef struct VkPhysicalDeviceCornerSampledImageFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 cornerSampledImage; -} VkPhysicalDeviceCornerSampledImageFeaturesNV; - - - -#define VK_IMG_format_pvrtc 1 -#define VK_IMG_FORMAT_PVRTC_SPEC_VERSION 1 -#define VK_IMG_FORMAT_PVRTC_EXTENSION_NAME "VK_IMG_format_pvrtc" - - -#define VK_NV_external_memory_capabilities 1 -#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_SPEC_VERSION 1 -#define VK_NV_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME "VK_NV_external_memory_capabilities" - -typedef enum VkExternalMemoryHandleTypeFlagBitsNV { - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_BIT_NV = 0x00000001, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_WIN32_KMT_BIT_NV = 0x00000002, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_BIT_NV = 0x00000004, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_D3D11_IMAGE_KMT_BIT_NV = 0x00000008, - VK_EXTERNAL_MEMORY_HANDLE_TYPE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF -} VkExternalMemoryHandleTypeFlagBitsNV; -typedef VkFlags VkExternalMemoryHandleTypeFlagsNV; - -typedef enum VkExternalMemoryFeatureFlagBitsNV { - VK_EXTERNAL_MEMORY_FEATURE_DEDICATED_ONLY_BIT_NV = 0x00000001, - VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_NV = 0x00000002, - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_NV = 0x00000004, - VK_EXTERNAL_MEMORY_FEATURE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF -} VkExternalMemoryFeatureFlagBitsNV; -typedef VkFlags VkExternalMemoryFeatureFlagsNV; -typedef struct VkExternalImageFormatPropertiesNV { - VkImageFormatProperties imageFormatProperties; - VkExternalMemoryFeatureFlagsNV externalMemoryFeatures; - VkExternalMemoryHandleTypeFlagsNV exportFromImportedHandleTypes; - VkExternalMemoryHandleTypeFlagsNV compatibleHandleTypes; -} VkExternalImageFormatPropertiesNV; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceExternalImageFormatPropertiesNV)(VkPhysicalDevice physicalDevice, VkFormat format, VkImageType type, VkImageTiling tiling, VkImageUsageFlags usage, VkImageCreateFlags flags, VkExternalMemoryHandleTypeFlagsNV externalHandleType, VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceExternalImageFormatPropertiesNV( - VkPhysicalDevice physicalDevice, - VkFormat format, - VkImageType type, - VkImageTiling tiling, - VkImageUsageFlags usage, - VkImageCreateFlags flags, - VkExternalMemoryHandleTypeFlagsNV externalHandleType, - VkExternalImageFormatPropertiesNV* pExternalImageFormatProperties); -#endif - - -#define VK_NV_external_memory 1 -#define VK_NV_EXTERNAL_MEMORY_SPEC_VERSION 1 -#define VK_NV_EXTERNAL_MEMORY_EXTENSION_NAME "VK_NV_external_memory" -typedef struct VkExternalMemoryImageCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsNV handleTypes; -} VkExternalMemoryImageCreateInfoNV; - -typedef struct VkExportMemoryAllocateInfoNV { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsNV handleTypes; -} VkExportMemoryAllocateInfoNV; - - - -#define VK_EXT_validation_flags 1 -#define VK_EXT_VALIDATION_FLAGS_SPEC_VERSION 2 -#define VK_EXT_VALIDATION_FLAGS_EXTENSION_NAME "VK_EXT_validation_flags" - -typedef enum VkValidationCheckEXT { - VK_VALIDATION_CHECK_ALL_EXT = 0, - VK_VALIDATION_CHECK_SHADERS_EXT = 1, - VK_VALIDATION_CHECK_MAX_ENUM_EXT = 0x7FFFFFFF -} VkValidationCheckEXT; -typedef struct VkValidationFlagsEXT { - VkStructureType sType; - const void* pNext; - uint32_t disabledValidationCheckCount; - const VkValidationCheckEXT* pDisabledValidationChecks; -} VkValidationFlagsEXT; - - - -#define VK_EXT_shader_subgroup_ballot 1 -#define VK_EXT_SHADER_SUBGROUP_BALLOT_SPEC_VERSION 1 -#define VK_EXT_SHADER_SUBGROUP_BALLOT_EXTENSION_NAME "VK_EXT_shader_subgroup_ballot" - - -#define VK_EXT_shader_subgroup_vote 1 -#define VK_EXT_SHADER_SUBGROUP_VOTE_SPEC_VERSION 1 -#define VK_EXT_SHADER_SUBGROUP_VOTE_EXTENSION_NAME "VK_EXT_shader_subgroup_vote" - - -#define VK_EXT_texture_compression_astc_hdr 1 -#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_SPEC_VERSION 1 -#define VK_EXT_TEXTURE_COMPRESSION_ASTC_HDR_EXTENSION_NAME "VK_EXT_texture_compression_astc_hdr" -typedef struct VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 textureCompressionASTC_HDR; -} VkPhysicalDeviceTextureCompressionASTCHDRFeaturesEXT; - - - -#define VK_EXT_astc_decode_mode 1 -#define VK_EXT_ASTC_DECODE_MODE_SPEC_VERSION 1 -#define VK_EXT_ASTC_DECODE_MODE_EXTENSION_NAME "VK_EXT_astc_decode_mode" -typedef struct VkImageViewASTCDecodeModeEXT { - VkStructureType sType; - const void* pNext; - VkFormat decodeMode; -} VkImageViewASTCDecodeModeEXT; - -typedef struct VkPhysicalDeviceASTCDecodeFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 decodeModeSharedExponent; -} VkPhysicalDeviceASTCDecodeFeaturesEXT; - - - -#define VK_EXT_conditional_rendering 1 -#define VK_EXT_CONDITIONAL_RENDERING_SPEC_VERSION 2 -#define VK_EXT_CONDITIONAL_RENDERING_EXTENSION_NAME "VK_EXT_conditional_rendering" - -typedef enum VkConditionalRenderingFlagBitsEXT { - VK_CONDITIONAL_RENDERING_INVERTED_BIT_EXT = 0x00000001, - VK_CONDITIONAL_RENDERING_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkConditionalRenderingFlagBitsEXT; -typedef VkFlags VkConditionalRenderingFlagsEXT; -typedef struct VkConditionalRenderingBeginInfoEXT { - VkStructureType sType; - const void* pNext; - VkBuffer buffer; - VkDeviceSize offset; - VkConditionalRenderingFlagsEXT flags; -} VkConditionalRenderingBeginInfoEXT; - -typedef struct VkPhysicalDeviceConditionalRenderingFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 conditionalRendering; - VkBool32 inheritedConditionalRendering; -} VkPhysicalDeviceConditionalRenderingFeaturesEXT; - -typedef struct VkCommandBufferInheritanceConditionalRenderingInfoEXT { - VkStructureType sType; - const void* pNext; - VkBool32 conditionalRenderingEnable; -} VkCommandBufferInheritanceConditionalRenderingInfoEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdBeginConditionalRenderingEXT)(VkCommandBuffer commandBuffer, const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin); -typedef void (VKAPI_PTR *PFN_vkCmdEndConditionalRenderingEXT)(VkCommandBuffer commandBuffer); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdBeginConditionalRenderingEXT( - VkCommandBuffer commandBuffer, - const VkConditionalRenderingBeginInfoEXT* pConditionalRenderingBegin); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndConditionalRenderingEXT( - VkCommandBuffer commandBuffer); -#endif - - -#define VK_NV_clip_space_w_scaling 1 -#define VK_NV_CLIP_SPACE_W_SCALING_SPEC_VERSION 1 -#define VK_NV_CLIP_SPACE_W_SCALING_EXTENSION_NAME "VK_NV_clip_space_w_scaling" -typedef struct VkViewportWScalingNV { - float xcoeff; - float ycoeff; -} VkViewportWScalingNV; - -typedef struct VkPipelineViewportWScalingStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 viewportWScalingEnable; - uint32_t viewportCount; - const VkViewportWScalingNV* pViewportWScalings; -} VkPipelineViewportWScalingStateCreateInfoNV; - -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWScalingNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkViewportWScalingNV* pViewportWScalings); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWScalingNV( - VkCommandBuffer commandBuffer, - uint32_t firstViewport, - uint32_t viewportCount, - const VkViewportWScalingNV* pViewportWScalings); -#endif - - -#define VK_EXT_direct_mode_display 1 -#define VK_EXT_DIRECT_MODE_DISPLAY_SPEC_VERSION 1 -#define VK_EXT_DIRECT_MODE_DISPLAY_EXTENSION_NAME "VK_EXT_direct_mode_display" -typedef VkResult (VKAPI_PTR *PFN_vkReleaseDisplayEXT)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkReleaseDisplayEXT( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display); -#endif - - -#define VK_EXT_display_surface_counter 1 -#define VK_EXT_DISPLAY_SURFACE_COUNTER_SPEC_VERSION 1 -#define VK_EXT_DISPLAY_SURFACE_COUNTER_EXTENSION_NAME "VK_EXT_display_surface_counter" - -typedef enum VkSurfaceCounterFlagBitsEXT { - VK_SURFACE_COUNTER_VBLANK_BIT_EXT = 0x00000001, - VK_SURFACE_COUNTER_VBLANK_EXT = VK_SURFACE_COUNTER_VBLANK_BIT_EXT, - VK_SURFACE_COUNTER_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkSurfaceCounterFlagBitsEXT; -typedef VkFlags VkSurfaceCounterFlagsEXT; -typedef struct VkSurfaceCapabilities2EXT { - VkStructureType sType; - void* pNext; - uint32_t minImageCount; - uint32_t maxImageCount; - VkExtent2D currentExtent; - VkExtent2D minImageExtent; - VkExtent2D maxImageExtent; - uint32_t maxImageArrayLayers; - VkSurfaceTransformFlagsKHR supportedTransforms; - VkSurfaceTransformFlagBitsKHR currentTransform; - VkCompositeAlphaFlagsKHR supportedCompositeAlpha; - VkImageUsageFlags supportedUsageFlags; - VkSurfaceCounterFlagsEXT supportedSurfaceCounters; -} VkSurfaceCapabilities2EXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfaceCapabilities2EXT)(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface, VkSurfaceCapabilities2EXT* pSurfaceCapabilities); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfaceCapabilities2EXT( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - VkSurfaceCapabilities2EXT* pSurfaceCapabilities); -#endif - - -#define VK_EXT_display_control 1 -#define VK_EXT_DISPLAY_CONTROL_SPEC_VERSION 1 -#define VK_EXT_DISPLAY_CONTROL_EXTENSION_NAME "VK_EXT_display_control" - -typedef enum VkDisplayPowerStateEXT { - VK_DISPLAY_POWER_STATE_OFF_EXT = 0, - VK_DISPLAY_POWER_STATE_SUSPEND_EXT = 1, - VK_DISPLAY_POWER_STATE_ON_EXT = 2, - VK_DISPLAY_POWER_STATE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDisplayPowerStateEXT; - -typedef enum VkDeviceEventTypeEXT { - VK_DEVICE_EVENT_TYPE_DISPLAY_HOTPLUG_EXT = 0, - VK_DEVICE_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDeviceEventTypeEXT; - -typedef enum VkDisplayEventTypeEXT { - VK_DISPLAY_EVENT_TYPE_FIRST_PIXEL_OUT_EXT = 0, - VK_DISPLAY_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDisplayEventTypeEXT; -typedef struct VkDisplayPowerInfoEXT { - VkStructureType sType; - const void* pNext; - VkDisplayPowerStateEXT powerState; -} VkDisplayPowerInfoEXT; - -typedef struct VkDeviceEventInfoEXT { - VkStructureType sType; - const void* pNext; - VkDeviceEventTypeEXT deviceEvent; -} VkDeviceEventInfoEXT; - -typedef struct VkDisplayEventInfoEXT { - VkStructureType sType; - const void* pNext; - VkDisplayEventTypeEXT displayEvent; -} VkDisplayEventInfoEXT; - -typedef struct VkSwapchainCounterCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkSurfaceCounterFlagsEXT surfaceCounters; -} VkSwapchainCounterCreateInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkDisplayPowerControlEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayPowerInfoEXT* pDisplayPowerInfo); -typedef VkResult (VKAPI_PTR *PFN_vkRegisterDeviceEventEXT)(VkDevice device, const VkDeviceEventInfoEXT* pDeviceEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); -typedef VkResult (VKAPI_PTR *PFN_vkRegisterDisplayEventEXT)(VkDevice device, VkDisplayKHR display, const VkDisplayEventInfoEXT* pDisplayEventInfo, const VkAllocationCallbacks* pAllocator, VkFence* pFence); -typedef VkResult (VKAPI_PTR *PFN_vkGetSwapchainCounterEXT)(VkDevice device, VkSwapchainKHR swapchain, VkSurfaceCounterFlagBitsEXT counter, uint64_t* pCounterValue); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkDisplayPowerControlEXT( - VkDevice device, - VkDisplayKHR display, - const VkDisplayPowerInfoEXT* pDisplayPowerInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDeviceEventEXT( - VkDevice device, - const VkDeviceEventInfoEXT* pDeviceEventInfo, - const VkAllocationCallbacks* pAllocator, - VkFence* pFence); - -VKAPI_ATTR VkResult VKAPI_CALL vkRegisterDisplayEventEXT( - VkDevice device, - VkDisplayKHR display, - const VkDisplayEventInfoEXT* pDisplayEventInfo, - const VkAllocationCallbacks* pAllocator, - VkFence* pFence); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSwapchainCounterEXT( - VkDevice device, - VkSwapchainKHR swapchain, - VkSurfaceCounterFlagBitsEXT counter, - uint64_t* pCounterValue); -#endif - - -#define VK_GOOGLE_display_timing 1 -#define VK_GOOGLE_DISPLAY_TIMING_SPEC_VERSION 1 -#define VK_GOOGLE_DISPLAY_TIMING_EXTENSION_NAME "VK_GOOGLE_display_timing" -typedef struct VkRefreshCycleDurationGOOGLE { - uint64_t refreshDuration; -} VkRefreshCycleDurationGOOGLE; - -typedef struct VkPastPresentationTimingGOOGLE { - uint32_t presentID; - uint64_t desiredPresentTime; - uint64_t actualPresentTime; - uint64_t earliestPresentTime; - uint64_t presentMargin; -} VkPastPresentationTimingGOOGLE; - -typedef struct VkPresentTimeGOOGLE { - uint32_t presentID; - uint64_t desiredPresentTime; -} VkPresentTimeGOOGLE; - -typedef struct VkPresentTimesInfoGOOGLE { - VkStructureType sType; - const void* pNext; - uint32_t swapchainCount; - const VkPresentTimeGOOGLE* pTimes; -} VkPresentTimesInfoGOOGLE; - -typedef VkResult (VKAPI_PTR *PFN_vkGetRefreshCycleDurationGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); -typedef VkResult (VKAPI_PTR *PFN_vkGetPastPresentationTimingGOOGLE)(VkDevice device, VkSwapchainKHR swapchain, uint32_t* pPresentationTimingCount, VkPastPresentationTimingGOOGLE* pPresentationTimings); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetRefreshCycleDurationGOOGLE( - VkDevice device, - VkSwapchainKHR swapchain, - VkRefreshCycleDurationGOOGLE* pDisplayTimingProperties); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPastPresentationTimingGOOGLE( - VkDevice device, - VkSwapchainKHR swapchain, - uint32_t* pPresentationTimingCount, - VkPastPresentationTimingGOOGLE* pPresentationTimings); -#endif - - -#define VK_NV_sample_mask_override_coverage 1 -#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_SPEC_VERSION 1 -#define VK_NV_SAMPLE_MASK_OVERRIDE_COVERAGE_EXTENSION_NAME "VK_NV_sample_mask_override_coverage" - - -#define VK_NV_geometry_shader_passthrough 1 -#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_SPEC_VERSION 1 -#define VK_NV_GEOMETRY_SHADER_PASSTHROUGH_EXTENSION_NAME "VK_NV_geometry_shader_passthrough" - - -#define VK_NV_viewport_array2 1 -#define VK_NV_VIEWPORT_ARRAY2_SPEC_VERSION 1 -#define VK_NV_VIEWPORT_ARRAY2_EXTENSION_NAME "VK_NV_viewport_array2" - - -#define VK_NVX_multiview_per_view_attributes 1 -#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_SPEC_VERSION 1 -#define VK_NVX_MULTIVIEW_PER_VIEW_ATTRIBUTES_EXTENSION_NAME "VK_NVX_multiview_per_view_attributes" -typedef struct VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX { - VkStructureType sType; - void* pNext; - VkBool32 perViewPositionAllComponents; -} VkPhysicalDeviceMultiviewPerViewAttributesPropertiesNVX; - - - -#define VK_NV_viewport_swizzle 1 -#define VK_NV_VIEWPORT_SWIZZLE_SPEC_VERSION 1 -#define VK_NV_VIEWPORT_SWIZZLE_EXTENSION_NAME "VK_NV_viewport_swizzle" - -typedef enum VkViewportCoordinateSwizzleNV { - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_X_NV = 0, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_X_NV = 1, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Y_NV = 2, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Y_NV = 3, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_Z_NV = 4, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_Z_NV = 5, - VK_VIEWPORT_COORDINATE_SWIZZLE_POSITIVE_W_NV = 6, - VK_VIEWPORT_COORDINATE_SWIZZLE_NEGATIVE_W_NV = 7, - VK_VIEWPORT_COORDINATE_SWIZZLE_MAX_ENUM_NV = 0x7FFFFFFF -} VkViewportCoordinateSwizzleNV; -typedef VkFlags VkPipelineViewportSwizzleStateCreateFlagsNV; -typedef struct VkViewportSwizzleNV { - VkViewportCoordinateSwizzleNV x; - VkViewportCoordinateSwizzleNV y; - VkViewportCoordinateSwizzleNV z; - VkViewportCoordinateSwizzleNV w; -} VkViewportSwizzleNV; - -typedef struct VkPipelineViewportSwizzleStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineViewportSwizzleStateCreateFlagsNV flags; - uint32_t viewportCount; - const VkViewportSwizzleNV* pViewportSwizzles; -} VkPipelineViewportSwizzleStateCreateInfoNV; - - - -#define VK_EXT_discard_rectangles 1 -#define VK_EXT_DISCARD_RECTANGLES_SPEC_VERSION 1 -#define VK_EXT_DISCARD_RECTANGLES_EXTENSION_NAME "VK_EXT_discard_rectangles" - -typedef enum VkDiscardRectangleModeEXT { - VK_DISCARD_RECTANGLE_MODE_INCLUSIVE_EXT = 0, - VK_DISCARD_RECTANGLE_MODE_EXCLUSIVE_EXT = 1, - VK_DISCARD_RECTANGLE_MODE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDiscardRectangleModeEXT; -typedef VkFlags VkPipelineDiscardRectangleStateCreateFlagsEXT; -typedef struct VkPhysicalDeviceDiscardRectanglePropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t maxDiscardRectangles; -} VkPhysicalDeviceDiscardRectanglePropertiesEXT; - -typedef struct VkPipelineDiscardRectangleStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPipelineDiscardRectangleStateCreateFlagsEXT flags; - VkDiscardRectangleModeEXT discardRectangleMode; - uint32_t discardRectangleCount; - const VkRect2D* pDiscardRectangles; -} VkPipelineDiscardRectangleStateCreateInfoEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetDiscardRectangleEXT)(VkCommandBuffer commandBuffer, uint32_t firstDiscardRectangle, uint32_t discardRectangleCount, const VkRect2D* pDiscardRectangles); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetDiscardRectangleEXT( - VkCommandBuffer commandBuffer, - uint32_t firstDiscardRectangle, - uint32_t discardRectangleCount, - const VkRect2D* pDiscardRectangles); -#endif - - -#define VK_EXT_conservative_rasterization 1 -#define VK_EXT_CONSERVATIVE_RASTERIZATION_SPEC_VERSION 1 -#define VK_EXT_CONSERVATIVE_RASTERIZATION_EXTENSION_NAME "VK_EXT_conservative_rasterization" - -typedef enum VkConservativeRasterizationModeEXT { - VK_CONSERVATIVE_RASTERIZATION_MODE_DISABLED_EXT = 0, - VK_CONSERVATIVE_RASTERIZATION_MODE_OVERESTIMATE_EXT = 1, - VK_CONSERVATIVE_RASTERIZATION_MODE_UNDERESTIMATE_EXT = 2, - VK_CONSERVATIVE_RASTERIZATION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkConservativeRasterizationModeEXT; -typedef VkFlags VkPipelineRasterizationConservativeStateCreateFlagsEXT; -typedef struct VkPhysicalDeviceConservativeRasterizationPropertiesEXT { - VkStructureType sType; - void* pNext; - float primitiveOverestimationSize; - float maxExtraPrimitiveOverestimationSize; - float extraPrimitiveOverestimationSizeGranularity; - VkBool32 primitiveUnderestimation; - VkBool32 conservativePointAndLineRasterization; - VkBool32 degenerateTrianglesRasterized; - VkBool32 degenerateLinesRasterized; - VkBool32 fullyCoveredFragmentShaderInputVariable; - VkBool32 conservativeRasterizationPostDepthCoverage; -} VkPhysicalDeviceConservativeRasterizationPropertiesEXT; - -typedef struct VkPipelineRasterizationConservativeStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPipelineRasterizationConservativeStateCreateFlagsEXT flags; - VkConservativeRasterizationModeEXT conservativeRasterizationMode; - float extraPrimitiveOverestimationSize; -} VkPipelineRasterizationConservativeStateCreateInfoEXT; - - - -#define VK_EXT_depth_clip_enable 1 -#define VK_EXT_DEPTH_CLIP_ENABLE_SPEC_VERSION 1 -#define VK_EXT_DEPTH_CLIP_ENABLE_EXTENSION_NAME "VK_EXT_depth_clip_enable" -typedef VkFlags VkPipelineRasterizationDepthClipStateCreateFlagsEXT; -typedef struct VkPhysicalDeviceDepthClipEnableFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 depthClipEnable; -} VkPhysicalDeviceDepthClipEnableFeaturesEXT; - -typedef struct VkPipelineRasterizationDepthClipStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPipelineRasterizationDepthClipStateCreateFlagsEXT flags; - VkBool32 depthClipEnable; -} VkPipelineRasterizationDepthClipStateCreateInfoEXT; - - - -#define VK_EXT_swapchain_colorspace 1 -#define VK_EXT_SWAPCHAIN_COLOR_SPACE_SPEC_VERSION 4 -#define VK_EXT_SWAPCHAIN_COLOR_SPACE_EXTENSION_NAME "VK_EXT_swapchain_colorspace" - - -#define VK_EXT_hdr_metadata 1 -#define VK_EXT_HDR_METADATA_SPEC_VERSION 2 -#define VK_EXT_HDR_METADATA_EXTENSION_NAME "VK_EXT_hdr_metadata" -typedef struct VkXYColorEXT { - float x; - float y; -} VkXYColorEXT; - -typedef struct VkHdrMetadataEXT { - VkStructureType sType; - const void* pNext; - VkXYColorEXT displayPrimaryRed; - VkXYColorEXT displayPrimaryGreen; - VkXYColorEXT displayPrimaryBlue; - VkXYColorEXT whitePoint; - float maxLuminance; - float minLuminance; - float maxContentLightLevel; - float maxFrameAverageLightLevel; -} VkHdrMetadataEXT; - -typedef void (VKAPI_PTR *PFN_vkSetHdrMetadataEXT)(VkDevice device, uint32_t swapchainCount, const VkSwapchainKHR* pSwapchains, const VkHdrMetadataEXT* pMetadata); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkSetHdrMetadataEXT( - VkDevice device, - uint32_t swapchainCount, - const VkSwapchainKHR* pSwapchains, - const VkHdrMetadataEXT* pMetadata); -#endif - - -#define VK_EXT_external_memory_dma_buf 1 -#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_SPEC_VERSION 1 -#define VK_EXT_EXTERNAL_MEMORY_DMA_BUF_EXTENSION_NAME "VK_EXT_external_memory_dma_buf" - - -#define VK_EXT_queue_family_foreign 1 -#define VK_EXT_QUEUE_FAMILY_FOREIGN_SPEC_VERSION 1 -#define VK_EXT_QUEUE_FAMILY_FOREIGN_EXTENSION_NAME "VK_EXT_queue_family_foreign" -#define VK_QUEUE_FAMILY_FOREIGN_EXT (~2U) - - -#define VK_EXT_debug_utils 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugUtilsMessengerEXT) -#define VK_EXT_DEBUG_UTILS_SPEC_VERSION 2 -#define VK_EXT_DEBUG_UTILS_EXTENSION_NAME "VK_EXT_debug_utils" -typedef VkFlags VkDebugUtilsMessengerCallbackDataFlagsEXT; - -typedef enum VkDebugUtilsMessageSeverityFlagBitsEXT { - VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT = 0x00000001, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT = 0x00000010, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT = 0x00000100, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT = 0x00001000, - VK_DEBUG_UTILS_MESSAGE_SEVERITY_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDebugUtilsMessageSeverityFlagBitsEXT; - -typedef enum VkDebugUtilsMessageTypeFlagBitsEXT { - VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT = 0x00000001, - VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT = 0x00000002, - VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT = 0x00000004, - VK_DEBUG_UTILS_MESSAGE_TYPE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDebugUtilsMessageTypeFlagBitsEXT; -typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; -typedef VkFlags VkDebugUtilsMessageSeverityFlagsEXT; -typedef VkFlags VkDebugUtilsMessengerCreateFlagsEXT; -typedef struct VkDebugUtilsLabelEXT { - VkStructureType sType; - const void* pNext; - const char* pLabelName; - float color[4]; -} VkDebugUtilsLabelEXT; - -typedef struct VkDebugUtilsObjectNameInfoEXT { - VkStructureType sType; - const void* pNext; - VkObjectType objectType; - uint64_t objectHandle; - const char* pObjectName; -} VkDebugUtilsObjectNameInfoEXT; - -typedef struct VkDebugUtilsMessengerCallbackDataEXT { - VkStructureType sType; - const void* pNext; - VkDebugUtilsMessengerCallbackDataFlagsEXT flags; - const char* pMessageIdName; - int32_t messageIdNumber; - const char* pMessage; - uint32_t queueLabelCount; - const VkDebugUtilsLabelEXT* pQueueLabels; - uint32_t cmdBufLabelCount; - const VkDebugUtilsLabelEXT* pCmdBufLabels; - uint32_t objectCount; - const VkDebugUtilsObjectNameInfoEXT* pObjects; -} VkDebugUtilsMessengerCallbackDataEXT; - -typedef VkBool32 (VKAPI_PTR *PFN_vkDebugUtilsMessengerCallbackEXT)( - VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, - void* pUserData); - -typedef struct VkDebugUtilsMessengerCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkDebugUtilsMessengerCreateFlagsEXT flags; - VkDebugUtilsMessageSeverityFlagsEXT messageSeverity; - VkDebugUtilsMessageTypeFlagsEXT messageType; - PFN_vkDebugUtilsMessengerCallbackEXT pfnUserCallback; - void* pUserData; -} VkDebugUtilsMessengerCreateInfoEXT; - -typedef struct VkDebugUtilsObjectTagInfoEXT { - VkStructureType sType; - const void* pNext; - VkObjectType objectType; - uint64_t objectHandle; - uint64_t tagName; - size_t tagSize; - const void* pTag; -} VkDebugUtilsObjectTagInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkSetDebugUtilsObjectNameEXT)(VkDevice device, const VkDebugUtilsObjectNameInfoEXT* pNameInfo); -typedef VkResult (VKAPI_PTR *PFN_vkSetDebugUtilsObjectTagEXT)(VkDevice device, const VkDebugUtilsObjectTagInfoEXT* pTagInfo); -typedef void (VKAPI_PTR *PFN_vkQueueBeginDebugUtilsLabelEXT)(VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo); -typedef void (VKAPI_PTR *PFN_vkQueueEndDebugUtilsLabelEXT)(VkQueue queue); -typedef void (VKAPI_PTR *PFN_vkQueueInsertDebugUtilsLabelEXT)(VkQueue queue, const VkDebugUtilsLabelEXT* pLabelInfo); -typedef void (VKAPI_PTR *PFN_vkCmdBeginDebugUtilsLabelEXT)(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo); -typedef void (VKAPI_PTR *PFN_vkCmdEndDebugUtilsLabelEXT)(VkCommandBuffer commandBuffer); -typedef void (VKAPI_PTR *PFN_vkCmdInsertDebugUtilsLabelEXT)(VkCommandBuffer commandBuffer, const VkDebugUtilsLabelEXT* pLabelInfo); -typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugUtilsMessengerEXT)(VkInstance instance, const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugUtilsMessengerEXT* pMessenger); -typedef void (VKAPI_PTR *PFN_vkDestroyDebugUtilsMessengerEXT)(VkInstance instance, VkDebugUtilsMessengerEXT messenger, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkSubmitDebugUtilsMessageEXT)(VkInstance instance, VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkSetDebugUtilsObjectNameEXT( - VkDevice device, - const VkDebugUtilsObjectNameInfoEXT* pNameInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkSetDebugUtilsObjectTagEXT( - VkDevice device, - const VkDebugUtilsObjectTagInfoEXT* pTagInfo); - -VKAPI_ATTR void VKAPI_CALL vkQueueBeginDebugUtilsLabelEXT( - VkQueue queue, - const VkDebugUtilsLabelEXT* pLabelInfo); - -VKAPI_ATTR void VKAPI_CALL vkQueueEndDebugUtilsLabelEXT( - VkQueue queue); - -VKAPI_ATTR void VKAPI_CALL vkQueueInsertDebugUtilsLabelEXT( - VkQueue queue, - const VkDebugUtilsLabelEXT* pLabelInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdBeginDebugUtilsLabelEXT( - VkCommandBuffer commandBuffer, - const VkDebugUtilsLabelEXT* pLabelInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdEndDebugUtilsLabelEXT( - VkCommandBuffer commandBuffer); - -VKAPI_ATTR void VKAPI_CALL vkCmdInsertDebugUtilsLabelEXT( - VkCommandBuffer commandBuffer, - const VkDebugUtilsLabelEXT* pLabelInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugUtilsMessengerEXT( - VkInstance instance, - const VkDebugUtilsMessengerCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkDebugUtilsMessengerEXT* pMessenger); - -VKAPI_ATTR void VKAPI_CALL vkDestroyDebugUtilsMessengerEXT( - VkInstance instance, - VkDebugUtilsMessengerEXT messenger, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkSubmitDebugUtilsMessageEXT( - VkInstance instance, - VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, - VkDebugUtilsMessageTypeFlagsEXT messageTypes, - const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData); -#endif - - -#define VK_EXT_sampler_filter_minmax 1 -#define VK_EXT_SAMPLER_FILTER_MINMAX_SPEC_VERSION 2 -#define VK_EXT_SAMPLER_FILTER_MINMAX_EXTENSION_NAME "VK_EXT_sampler_filter_minmax" -typedef VkSamplerReductionMode VkSamplerReductionModeEXT; - -typedef VkSamplerReductionModeCreateInfo VkSamplerReductionModeCreateInfoEXT; - -typedef VkPhysicalDeviceSamplerFilterMinmaxProperties VkPhysicalDeviceSamplerFilterMinmaxPropertiesEXT; - - - -#define VK_AMD_gpu_shader_int16 1 -#define VK_AMD_GPU_SHADER_INT16_SPEC_VERSION 2 -#define VK_AMD_GPU_SHADER_INT16_EXTENSION_NAME "VK_AMD_gpu_shader_int16" - - -#define VK_AMD_mixed_attachment_samples 1 -#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_SPEC_VERSION 1 -#define VK_AMD_MIXED_ATTACHMENT_SAMPLES_EXTENSION_NAME "VK_AMD_mixed_attachment_samples" - - -#define VK_AMD_shader_fragment_mask 1 -#define VK_AMD_SHADER_FRAGMENT_MASK_SPEC_VERSION 1 -#define VK_AMD_SHADER_FRAGMENT_MASK_EXTENSION_NAME "VK_AMD_shader_fragment_mask" - - -#define VK_EXT_inline_uniform_block 1 -#define VK_EXT_INLINE_UNIFORM_BLOCK_SPEC_VERSION 1 -#define VK_EXT_INLINE_UNIFORM_BLOCK_EXTENSION_NAME "VK_EXT_inline_uniform_block" -typedef struct VkPhysicalDeviceInlineUniformBlockFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 inlineUniformBlock; - VkBool32 descriptorBindingInlineUniformBlockUpdateAfterBind; -} VkPhysicalDeviceInlineUniformBlockFeaturesEXT; - -typedef struct VkPhysicalDeviceInlineUniformBlockPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t maxInlineUniformBlockSize; - uint32_t maxPerStageDescriptorInlineUniformBlocks; - uint32_t maxPerStageDescriptorUpdateAfterBindInlineUniformBlocks; - uint32_t maxDescriptorSetInlineUniformBlocks; - uint32_t maxDescriptorSetUpdateAfterBindInlineUniformBlocks; -} VkPhysicalDeviceInlineUniformBlockPropertiesEXT; - -typedef struct VkWriteDescriptorSetInlineUniformBlockEXT { - VkStructureType sType; - const void* pNext; - uint32_t dataSize; - const void* pData; -} VkWriteDescriptorSetInlineUniformBlockEXT; - -typedef struct VkDescriptorPoolInlineUniformBlockCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t maxInlineUniformBlockBindings; -} VkDescriptorPoolInlineUniformBlockCreateInfoEXT; - - - -#define VK_EXT_shader_stencil_export 1 -#define VK_EXT_SHADER_STENCIL_EXPORT_SPEC_VERSION 1 -#define VK_EXT_SHADER_STENCIL_EXPORT_EXTENSION_NAME "VK_EXT_shader_stencil_export" - - -#define VK_EXT_sample_locations 1 -#define VK_EXT_SAMPLE_LOCATIONS_SPEC_VERSION 1 -#define VK_EXT_SAMPLE_LOCATIONS_EXTENSION_NAME "VK_EXT_sample_locations" -typedef struct VkSampleLocationEXT { - float x; - float y; -} VkSampleLocationEXT; - -typedef struct VkSampleLocationsInfoEXT { - VkStructureType sType; - const void* pNext; - VkSampleCountFlagBits sampleLocationsPerPixel; - VkExtent2D sampleLocationGridSize; - uint32_t sampleLocationsCount; - const VkSampleLocationEXT* pSampleLocations; -} VkSampleLocationsInfoEXT; - -typedef struct VkAttachmentSampleLocationsEXT { - uint32_t attachmentIndex; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkAttachmentSampleLocationsEXT; - -typedef struct VkSubpassSampleLocationsEXT { - uint32_t subpassIndex; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkSubpassSampleLocationsEXT; - -typedef struct VkRenderPassSampleLocationsBeginInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t attachmentInitialSampleLocationsCount; - const VkAttachmentSampleLocationsEXT* pAttachmentInitialSampleLocations; - uint32_t postSubpassSampleLocationsCount; - const VkSubpassSampleLocationsEXT* pPostSubpassSampleLocations; -} VkRenderPassSampleLocationsBeginInfoEXT; - -typedef struct VkPipelineSampleLocationsStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkBool32 sampleLocationsEnable; - VkSampleLocationsInfoEXT sampleLocationsInfo; -} VkPipelineSampleLocationsStateCreateInfoEXT; - -typedef struct VkPhysicalDeviceSampleLocationsPropertiesEXT { - VkStructureType sType; - void* pNext; - VkSampleCountFlags sampleLocationSampleCounts; - VkExtent2D maxSampleLocationGridSize; - float sampleLocationCoordinateRange[2]; - uint32_t sampleLocationSubPixelBits; - VkBool32 variableSampleLocations; -} VkPhysicalDeviceSampleLocationsPropertiesEXT; - -typedef struct VkMultisamplePropertiesEXT { - VkStructureType sType; - void* pNext; - VkExtent2D maxSampleLocationGridSize; -} VkMultisamplePropertiesEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetSampleLocationsEXT)(VkCommandBuffer commandBuffer, const VkSampleLocationsInfoEXT* pSampleLocationsInfo); -typedef void (VKAPI_PTR *PFN_vkGetPhysicalDeviceMultisamplePropertiesEXT)(VkPhysicalDevice physicalDevice, VkSampleCountFlagBits samples, VkMultisamplePropertiesEXT* pMultisampleProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetSampleLocationsEXT( - VkCommandBuffer commandBuffer, - const VkSampleLocationsInfoEXT* pSampleLocationsInfo); - -VKAPI_ATTR void VKAPI_CALL vkGetPhysicalDeviceMultisamplePropertiesEXT( - VkPhysicalDevice physicalDevice, - VkSampleCountFlagBits samples, - VkMultisamplePropertiesEXT* pMultisampleProperties); -#endif - - -#define VK_EXT_blend_operation_advanced 1 -#define VK_EXT_BLEND_OPERATION_ADVANCED_SPEC_VERSION 2 -#define VK_EXT_BLEND_OPERATION_ADVANCED_EXTENSION_NAME "VK_EXT_blend_operation_advanced" - -typedef enum VkBlendOverlapEXT { - VK_BLEND_OVERLAP_UNCORRELATED_EXT = 0, - VK_BLEND_OVERLAP_DISJOINT_EXT = 1, - VK_BLEND_OVERLAP_CONJOINT_EXT = 2, - VK_BLEND_OVERLAP_MAX_ENUM_EXT = 0x7FFFFFFF -} VkBlendOverlapEXT; -typedef struct VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 advancedBlendCoherentOperations; -} VkPhysicalDeviceBlendOperationAdvancedFeaturesEXT; - -typedef struct VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t advancedBlendMaxColorAttachments; - VkBool32 advancedBlendIndependentBlend; - VkBool32 advancedBlendNonPremultipliedSrcColor; - VkBool32 advancedBlendNonPremultipliedDstColor; - VkBool32 advancedBlendCorrelatedOverlap; - VkBool32 advancedBlendAllOperations; -} VkPhysicalDeviceBlendOperationAdvancedPropertiesEXT; - -typedef struct VkPipelineColorBlendAdvancedStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkBool32 srcPremultiplied; - VkBool32 dstPremultiplied; - VkBlendOverlapEXT blendOverlap; -} VkPipelineColorBlendAdvancedStateCreateInfoEXT; - - - -#define VK_NV_fragment_coverage_to_color 1 -#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_COVERAGE_TO_COLOR_EXTENSION_NAME "VK_NV_fragment_coverage_to_color" -typedef VkFlags VkPipelineCoverageToColorStateCreateFlagsNV; -typedef struct VkPipelineCoverageToColorStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineCoverageToColorStateCreateFlagsNV flags; - VkBool32 coverageToColorEnable; - uint32_t coverageToColorLocation; -} VkPipelineCoverageToColorStateCreateInfoNV; - - - -#define VK_NV_framebuffer_mixed_samples 1 -#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_SPEC_VERSION 1 -#define VK_NV_FRAMEBUFFER_MIXED_SAMPLES_EXTENSION_NAME "VK_NV_framebuffer_mixed_samples" - -typedef enum VkCoverageModulationModeNV { - VK_COVERAGE_MODULATION_MODE_NONE_NV = 0, - VK_COVERAGE_MODULATION_MODE_RGB_NV = 1, - VK_COVERAGE_MODULATION_MODE_ALPHA_NV = 2, - VK_COVERAGE_MODULATION_MODE_RGBA_NV = 3, - VK_COVERAGE_MODULATION_MODE_MAX_ENUM_NV = 0x7FFFFFFF -} VkCoverageModulationModeNV; -typedef VkFlags VkPipelineCoverageModulationStateCreateFlagsNV; -typedef struct VkPipelineCoverageModulationStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineCoverageModulationStateCreateFlagsNV flags; - VkCoverageModulationModeNV coverageModulationMode; - VkBool32 coverageModulationTableEnable; - uint32_t coverageModulationTableCount; - const float* pCoverageModulationTable; -} VkPipelineCoverageModulationStateCreateInfoNV; - - - -#define VK_NV_fill_rectangle 1 -#define VK_NV_FILL_RECTANGLE_SPEC_VERSION 1 -#define VK_NV_FILL_RECTANGLE_EXTENSION_NAME "VK_NV_fill_rectangle" - - -#define VK_NV_shader_sm_builtins 1 -#define VK_NV_SHADER_SM_BUILTINS_SPEC_VERSION 1 -#define VK_NV_SHADER_SM_BUILTINS_EXTENSION_NAME "VK_NV_shader_sm_builtins" -typedef struct VkPhysicalDeviceShaderSMBuiltinsPropertiesNV { - VkStructureType sType; - void* pNext; - uint32_t shaderSMCount; - uint32_t shaderWarpsPerSM; -} VkPhysicalDeviceShaderSMBuiltinsPropertiesNV; - -typedef struct VkPhysicalDeviceShaderSMBuiltinsFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 shaderSMBuiltins; -} VkPhysicalDeviceShaderSMBuiltinsFeaturesNV; - - - -#define VK_EXT_post_depth_coverage 1 -#define VK_EXT_POST_DEPTH_COVERAGE_SPEC_VERSION 1 -#define VK_EXT_POST_DEPTH_COVERAGE_EXTENSION_NAME "VK_EXT_post_depth_coverage" - - -#define VK_EXT_image_drm_format_modifier 1 -#define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_SPEC_VERSION 1 -#define VK_EXT_IMAGE_DRM_FORMAT_MODIFIER_EXTENSION_NAME "VK_EXT_image_drm_format_modifier" -typedef struct VkDrmFormatModifierPropertiesEXT { - uint64_t drmFormatModifier; - uint32_t drmFormatModifierPlaneCount; - VkFormatFeatureFlags drmFormatModifierTilingFeatures; -} VkDrmFormatModifierPropertiesEXT; - -typedef struct VkDrmFormatModifierPropertiesListEXT { - VkStructureType sType; - void* pNext; - uint32_t drmFormatModifierCount; - VkDrmFormatModifierPropertiesEXT* pDrmFormatModifierProperties; -} VkDrmFormatModifierPropertiesListEXT; - -typedef struct VkPhysicalDeviceImageDrmFormatModifierInfoEXT { - VkStructureType sType; - const void* pNext; - uint64_t drmFormatModifier; - VkSharingMode sharingMode; - uint32_t queueFamilyIndexCount; - const uint32_t* pQueueFamilyIndices; -} VkPhysicalDeviceImageDrmFormatModifierInfoEXT; - -typedef struct VkImageDrmFormatModifierListCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t drmFormatModifierCount; - const uint64_t* pDrmFormatModifiers; -} VkImageDrmFormatModifierListCreateInfoEXT; - -typedef struct VkImageDrmFormatModifierExplicitCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint64_t drmFormatModifier; - uint32_t drmFormatModifierPlaneCount; - const VkSubresourceLayout* pPlaneLayouts; -} VkImageDrmFormatModifierExplicitCreateInfoEXT; - -typedef struct VkImageDrmFormatModifierPropertiesEXT { - VkStructureType sType; - void* pNext; - uint64_t drmFormatModifier; -} VkImageDrmFormatModifierPropertiesEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetImageDrmFormatModifierPropertiesEXT)(VkDevice device, VkImage image, VkImageDrmFormatModifierPropertiesEXT* pProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetImageDrmFormatModifierPropertiesEXT( - VkDevice device, - VkImage image, - VkImageDrmFormatModifierPropertiesEXT* pProperties); -#endif - - -#define VK_EXT_validation_cache 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkValidationCacheEXT) -#define VK_EXT_VALIDATION_CACHE_SPEC_VERSION 1 -#define VK_EXT_VALIDATION_CACHE_EXTENSION_NAME "VK_EXT_validation_cache" - -typedef enum VkValidationCacheHeaderVersionEXT { - VK_VALIDATION_CACHE_HEADER_VERSION_ONE_EXT = 1, - VK_VALIDATION_CACHE_HEADER_VERSION_MAX_ENUM_EXT = 0x7FFFFFFF -} VkValidationCacheHeaderVersionEXT; -typedef VkFlags VkValidationCacheCreateFlagsEXT; -typedef struct VkValidationCacheCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkValidationCacheCreateFlagsEXT flags; - size_t initialDataSize; - const void* pInitialData; -} VkValidationCacheCreateInfoEXT; - -typedef struct VkShaderModuleValidationCacheCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkValidationCacheEXT validationCache; -} VkShaderModuleValidationCacheCreateInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateValidationCacheEXT)(VkDevice device, const VkValidationCacheCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkValidationCacheEXT* pValidationCache); -typedef void (VKAPI_PTR *PFN_vkDestroyValidationCacheEXT)(VkDevice device, VkValidationCacheEXT validationCache, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkMergeValidationCachesEXT)(VkDevice device, VkValidationCacheEXT dstCache, uint32_t srcCacheCount, const VkValidationCacheEXT* pSrcCaches); -typedef VkResult (VKAPI_PTR *PFN_vkGetValidationCacheDataEXT)(VkDevice device, VkValidationCacheEXT validationCache, size_t* pDataSize, void* pData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateValidationCacheEXT( - VkDevice device, - const VkValidationCacheCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkValidationCacheEXT* pValidationCache); - -VKAPI_ATTR void VKAPI_CALL vkDestroyValidationCacheEXT( - VkDevice device, - VkValidationCacheEXT validationCache, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkMergeValidationCachesEXT( - VkDevice device, - VkValidationCacheEXT dstCache, - uint32_t srcCacheCount, - const VkValidationCacheEXT* pSrcCaches); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetValidationCacheDataEXT( - VkDevice device, - VkValidationCacheEXT validationCache, - size_t* pDataSize, - void* pData); -#endif - - -#define VK_EXT_descriptor_indexing 1 -#define VK_EXT_DESCRIPTOR_INDEXING_SPEC_VERSION 2 -#define VK_EXT_DESCRIPTOR_INDEXING_EXTENSION_NAME "VK_EXT_descriptor_indexing" -typedef VkDescriptorBindingFlagBits VkDescriptorBindingFlagBitsEXT; - -typedef VkDescriptorBindingFlags VkDescriptorBindingFlagsEXT; - -typedef VkDescriptorSetLayoutBindingFlagsCreateInfo VkDescriptorSetLayoutBindingFlagsCreateInfoEXT; - -typedef VkPhysicalDeviceDescriptorIndexingFeatures VkPhysicalDeviceDescriptorIndexingFeaturesEXT; - -typedef VkPhysicalDeviceDescriptorIndexingProperties VkPhysicalDeviceDescriptorIndexingPropertiesEXT; - -typedef VkDescriptorSetVariableDescriptorCountAllocateInfo VkDescriptorSetVariableDescriptorCountAllocateInfoEXT; - -typedef VkDescriptorSetVariableDescriptorCountLayoutSupport VkDescriptorSetVariableDescriptorCountLayoutSupportEXT; - - - -#define VK_EXT_shader_viewport_index_layer 1 -#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_SPEC_VERSION 1 -#define VK_EXT_SHADER_VIEWPORT_INDEX_LAYER_EXTENSION_NAME "VK_EXT_shader_viewport_index_layer" - - -#define VK_NV_shading_rate_image 1 -#define VK_NV_SHADING_RATE_IMAGE_SPEC_VERSION 3 -#define VK_NV_SHADING_RATE_IMAGE_EXTENSION_NAME "VK_NV_shading_rate_image" - -typedef enum VkShadingRatePaletteEntryNV { - VK_SHADING_RATE_PALETTE_ENTRY_NO_INVOCATIONS_NV = 0, - VK_SHADING_RATE_PALETTE_ENTRY_16_INVOCATIONS_PER_PIXEL_NV = 1, - VK_SHADING_RATE_PALETTE_ENTRY_8_INVOCATIONS_PER_PIXEL_NV = 2, - VK_SHADING_RATE_PALETTE_ENTRY_4_INVOCATIONS_PER_PIXEL_NV = 3, - VK_SHADING_RATE_PALETTE_ENTRY_2_INVOCATIONS_PER_PIXEL_NV = 4, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_PIXEL_NV = 5, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X1_PIXELS_NV = 6, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_1X2_PIXELS_NV = 7, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X2_PIXELS_NV = 8, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X2_PIXELS_NV = 9, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_2X4_PIXELS_NV = 10, - VK_SHADING_RATE_PALETTE_ENTRY_1_INVOCATION_PER_4X4_PIXELS_NV = 11, - VK_SHADING_RATE_PALETTE_ENTRY_MAX_ENUM_NV = 0x7FFFFFFF -} VkShadingRatePaletteEntryNV; - -typedef enum VkCoarseSampleOrderTypeNV { - VK_COARSE_SAMPLE_ORDER_TYPE_DEFAULT_NV = 0, - VK_COARSE_SAMPLE_ORDER_TYPE_CUSTOM_NV = 1, - VK_COARSE_SAMPLE_ORDER_TYPE_PIXEL_MAJOR_NV = 2, - VK_COARSE_SAMPLE_ORDER_TYPE_SAMPLE_MAJOR_NV = 3, - VK_COARSE_SAMPLE_ORDER_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkCoarseSampleOrderTypeNV; -typedef struct VkShadingRatePaletteNV { - uint32_t shadingRatePaletteEntryCount; - const VkShadingRatePaletteEntryNV* pShadingRatePaletteEntries; -} VkShadingRatePaletteNV; - -typedef struct VkPipelineViewportShadingRateImageStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 shadingRateImageEnable; - uint32_t viewportCount; - const VkShadingRatePaletteNV* pShadingRatePalettes; -} VkPipelineViewportShadingRateImageStateCreateInfoNV; - -typedef struct VkPhysicalDeviceShadingRateImageFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 shadingRateImage; - VkBool32 shadingRateCoarseSampleOrder; -} VkPhysicalDeviceShadingRateImageFeaturesNV; - -typedef struct VkPhysicalDeviceShadingRateImagePropertiesNV { - VkStructureType sType; - void* pNext; - VkExtent2D shadingRateTexelSize; - uint32_t shadingRatePaletteSize; - uint32_t shadingRateMaxCoarseSamples; -} VkPhysicalDeviceShadingRateImagePropertiesNV; - -typedef struct VkCoarseSampleLocationNV { - uint32_t pixelX; - uint32_t pixelY; - uint32_t sample; -} VkCoarseSampleLocationNV; - -typedef struct VkCoarseSampleOrderCustomNV { - VkShadingRatePaletteEntryNV shadingRate; - uint32_t sampleCount; - uint32_t sampleLocationCount; - const VkCoarseSampleLocationNV* pSampleLocations; -} VkCoarseSampleOrderCustomNV; - -typedef struct VkPipelineViewportCoarseSampleOrderStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkCoarseSampleOrderTypeNV sampleOrderType; - uint32_t customSampleOrderCount; - const VkCoarseSampleOrderCustomNV* pCustomSampleOrders; -} VkPipelineViewportCoarseSampleOrderStateCreateInfoNV; - -typedef void (VKAPI_PTR *PFN_vkCmdBindShadingRateImageNV)(VkCommandBuffer commandBuffer, VkImageView imageView, VkImageLayout imageLayout); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportShadingRatePaletteNV)(VkCommandBuffer commandBuffer, uint32_t firstViewport, uint32_t viewportCount, const VkShadingRatePaletteNV* pShadingRatePalettes); -typedef void (VKAPI_PTR *PFN_vkCmdSetCoarseSampleOrderNV)(VkCommandBuffer commandBuffer, VkCoarseSampleOrderTypeNV sampleOrderType, uint32_t customSampleOrderCount, const VkCoarseSampleOrderCustomNV* pCustomSampleOrders); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdBindShadingRateImageNV( - VkCommandBuffer commandBuffer, - VkImageView imageView, - VkImageLayout imageLayout); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportShadingRatePaletteNV( - VkCommandBuffer commandBuffer, - uint32_t firstViewport, - uint32_t viewportCount, - const VkShadingRatePaletteNV* pShadingRatePalettes); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetCoarseSampleOrderNV( - VkCommandBuffer commandBuffer, - VkCoarseSampleOrderTypeNV sampleOrderType, - uint32_t customSampleOrderCount, - const VkCoarseSampleOrderCustomNV* pCustomSampleOrders); -#endif - - -#define VK_NV_ray_tracing 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureNV) -#define VK_NV_RAY_TRACING_SPEC_VERSION 3 -#define VK_NV_RAY_TRACING_EXTENSION_NAME "VK_NV_ray_tracing" -#define VK_SHADER_UNUSED_KHR (~0U) -#define VK_SHADER_UNUSED_NV VK_SHADER_UNUSED_KHR - -typedef enum VkRayTracingShaderGroupTypeKHR { - VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR = 0, - VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR = 1, - VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR = 2, - VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_GENERAL_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_TRIANGLES_HIT_GROUP_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_NV = VK_RAY_TRACING_SHADER_GROUP_TYPE_PROCEDURAL_HIT_GROUP_KHR, - VK_RAY_TRACING_SHADER_GROUP_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkRayTracingShaderGroupTypeKHR; -typedef VkRayTracingShaderGroupTypeKHR VkRayTracingShaderGroupTypeNV; - - -typedef enum VkGeometryTypeKHR { - VK_GEOMETRY_TYPE_TRIANGLES_KHR = 0, - VK_GEOMETRY_TYPE_AABBS_KHR = 1, - VK_GEOMETRY_TYPE_INSTANCES_KHR = 2, - VK_GEOMETRY_TYPE_TRIANGLES_NV = VK_GEOMETRY_TYPE_TRIANGLES_KHR, - VK_GEOMETRY_TYPE_AABBS_NV = VK_GEOMETRY_TYPE_AABBS_KHR, - VK_GEOMETRY_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkGeometryTypeKHR; -typedef VkGeometryTypeKHR VkGeometryTypeNV; - - -typedef enum VkAccelerationStructureTypeKHR { - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR = 0, - VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR = 1, - VK_ACCELERATION_STRUCTURE_TYPE_GENERIC_KHR = 2, - VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_TOP_LEVEL_KHR, - VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_NV = VK_ACCELERATION_STRUCTURE_TYPE_BOTTOM_LEVEL_KHR, - VK_ACCELERATION_STRUCTURE_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureTypeKHR; -typedef VkAccelerationStructureTypeKHR VkAccelerationStructureTypeNV; - - -typedef enum VkCopyAccelerationStructureModeKHR { - VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR = 0, - VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR = 1, - VK_COPY_ACCELERATION_STRUCTURE_MODE_SERIALIZE_KHR = 2, - VK_COPY_ACCELERATION_STRUCTURE_MODE_DESERIALIZE_KHR = 3, - VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_CLONE_KHR, - VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_NV = VK_COPY_ACCELERATION_STRUCTURE_MODE_COMPACT_KHR, - VK_COPY_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkCopyAccelerationStructureModeKHR; -typedef VkCopyAccelerationStructureModeKHR VkCopyAccelerationStructureModeNV; - - -typedef enum VkAccelerationStructureMemoryRequirementsTypeNV { - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_OBJECT_NV = 0, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_BUILD_SCRATCH_NV = 1, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_UPDATE_SCRATCH_NV = 2, - VK_ACCELERATION_STRUCTURE_MEMORY_REQUIREMENTS_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkAccelerationStructureMemoryRequirementsTypeNV; - -typedef enum VkGeometryFlagBitsKHR { - VK_GEOMETRY_OPAQUE_BIT_KHR = 0x00000001, - VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR = 0x00000002, - VK_GEOMETRY_OPAQUE_BIT_NV = VK_GEOMETRY_OPAQUE_BIT_KHR, - VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_NV = VK_GEOMETRY_NO_DUPLICATE_ANY_HIT_INVOCATION_BIT_KHR, - VK_GEOMETRY_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkGeometryFlagBitsKHR; -typedef VkFlags VkGeometryFlagsKHR; -typedef VkGeometryFlagsKHR VkGeometryFlagsNV; - -typedef VkGeometryFlagBitsKHR VkGeometryFlagBitsNV; - - -typedef enum VkGeometryInstanceFlagBitsKHR { - VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR = 0x00000001, - VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR = 0x00000002, - VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR = 0x00000004, - VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR = 0x00000008, - VK_GEOMETRY_INSTANCE_TRIANGLE_CULL_DISABLE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR, - VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_NV = VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_NV = VK_GEOMETRY_INSTANCE_FORCE_NO_OPAQUE_BIT_KHR, - VK_GEOMETRY_INSTANCE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkGeometryInstanceFlagBitsKHR; -typedef VkFlags VkGeometryInstanceFlagsKHR; -typedef VkGeometryInstanceFlagsKHR VkGeometryInstanceFlagsNV; - -typedef VkGeometryInstanceFlagBitsKHR VkGeometryInstanceFlagBitsNV; - - -typedef enum VkBuildAccelerationStructureFlagBitsKHR { - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR = 0x00000001, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR = 0x00000002, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR = 0x00000004, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR = 0x00000008, - VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR = 0x00000010, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_UPDATE_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_ALLOW_COMPACTION_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_TRACE_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_PREFER_FAST_BUILD_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_NV = VK_BUILD_ACCELERATION_STRUCTURE_LOW_MEMORY_BIT_KHR, - VK_BUILD_ACCELERATION_STRUCTURE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkBuildAccelerationStructureFlagBitsKHR; -typedef VkFlags VkBuildAccelerationStructureFlagsKHR; -typedef VkBuildAccelerationStructureFlagsKHR VkBuildAccelerationStructureFlagsNV; - -typedef VkBuildAccelerationStructureFlagBitsKHR VkBuildAccelerationStructureFlagBitsNV; - -typedef struct VkRayTracingShaderGroupCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; -} VkRayTracingShaderGroupCreateInfoNV; - -typedef struct VkRayTracingPipelineCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo* pStages; - uint32_t groupCount; - const VkRayTracingShaderGroupCreateInfoNV* pGroups; - uint32_t maxRecursionDepth; - VkPipelineLayout layout; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoNV; - -typedef struct VkGeometryTrianglesNV { - VkStructureType sType; - const void* pNext; - VkBuffer vertexData; - VkDeviceSize vertexOffset; - uint32_t vertexCount; - VkDeviceSize vertexStride; - VkFormat vertexFormat; - VkBuffer indexData; - VkDeviceSize indexOffset; - uint32_t indexCount; - VkIndexType indexType; - VkBuffer transformData; - VkDeviceSize transformOffset; -} VkGeometryTrianglesNV; - -typedef struct VkGeometryAABBNV { - VkStructureType sType; - const void* pNext; - VkBuffer aabbData; - uint32_t numAABBs; - uint32_t stride; - VkDeviceSize offset; -} VkGeometryAABBNV; - -typedef struct VkGeometryDataNV { - VkGeometryTrianglesNV triangles; - VkGeometryAABBNV aabbs; -} VkGeometryDataNV; - -typedef struct VkGeometryNV { - VkStructureType sType; - const void* pNext; - VkGeometryTypeKHR geometryType; - VkGeometryDataNV geometry; - VkGeometryFlagsKHR flags; -} VkGeometryNV; - -typedef struct VkAccelerationStructureInfoNV { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureTypeNV type; - VkBuildAccelerationStructureFlagsNV flags; - uint32_t instanceCount; - uint32_t geometryCount; - const VkGeometryNV* pGeometries; -} VkAccelerationStructureInfoNV; - -typedef struct VkAccelerationStructureCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkDeviceSize compactedSize; - VkAccelerationStructureInfoNV info; -} VkAccelerationStructureCreateInfoNV; - -typedef struct VkBindAccelerationStructureMemoryInfoNV { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureNV accelerationStructure; - VkDeviceMemory memory; - VkDeviceSize memoryOffset; - uint32_t deviceIndexCount; - const uint32_t* pDeviceIndices; -} VkBindAccelerationStructureMemoryInfoNV; - -typedef struct VkWriteDescriptorSetAccelerationStructureNV { - VkStructureType sType; - const void* pNext; - uint32_t accelerationStructureCount; - const VkAccelerationStructureNV* pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureNV; - -typedef struct VkAccelerationStructureMemoryRequirementsInfoNV { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureMemoryRequirementsTypeNV type; - VkAccelerationStructureNV accelerationStructure; -} VkAccelerationStructureMemoryRequirementsInfoNV; - -typedef struct VkPhysicalDeviceRayTracingPropertiesNV { - VkStructureType sType; - void* pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint64_t maxGeometryCount; - uint64_t maxInstanceCount; - uint64_t maxTriangleCount; - uint32_t maxDescriptorSetAccelerationStructures; -} VkPhysicalDeviceRayTracingPropertiesNV; - -typedef struct VkTransformMatrixKHR { - float matrix[3][4]; -} VkTransformMatrixKHR; - -typedef VkTransformMatrixKHR VkTransformMatrixNV; - -typedef struct VkAabbPositionsKHR { - float minX; - float minY; - float minZ; - float maxX; - float maxY; - float maxZ; -} VkAabbPositionsKHR; - -typedef VkAabbPositionsKHR VkAabbPositionsNV; - -typedef struct VkAccelerationStructureInstanceKHR { - VkTransformMatrixKHR transform; - uint32_t instanceCustomIndex:24; - uint32_t mask:8; - uint32_t instanceShaderBindingTableRecordOffset:24; - VkGeometryInstanceFlagsKHR flags:8; - uint64_t accelerationStructureReference; -} VkAccelerationStructureInstanceKHR; - -typedef VkAccelerationStructureInstanceKHR VkAccelerationStructureInstanceNV; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateAccelerationStructureNV)(VkDevice device, const VkAccelerationStructureCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureNV* pAccelerationStructure); -typedef void (VKAPI_PTR *PFN_vkDestroyAccelerationStructureNV)(VkDevice device, VkAccelerationStructureNV accelerationStructure, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureMemoryRequirementsNV)(VkDevice device, const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo, VkMemoryRequirements2KHR* pMemoryRequirements); -typedef VkResult (VKAPI_PTR *PFN_vkBindAccelerationStructureMemoryNV)(VkDevice device, uint32_t bindInfoCount, const VkBindAccelerationStructureMemoryInfoNV* pBindInfos); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructureNV)(VkCommandBuffer commandBuffer, const VkAccelerationStructureInfoNV* pInfo, VkBuffer instanceData, VkDeviceSize instanceOffset, VkBool32 update, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkBuffer scratch, VkDeviceSize scratchOffset); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureNV)(VkCommandBuffer commandBuffer, VkAccelerationStructureNV dst, VkAccelerationStructureNV src, VkCopyAccelerationStructureModeKHR mode); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysNV)(VkCommandBuffer commandBuffer, VkBuffer raygenShaderBindingTableBuffer, VkDeviceSize raygenShaderBindingOffset, VkBuffer missShaderBindingTableBuffer, VkDeviceSize missShaderBindingOffset, VkDeviceSize missShaderBindingStride, VkBuffer hitShaderBindingTableBuffer, VkDeviceSize hitShaderBindingOffset, VkDeviceSize hitShaderBindingStride, VkBuffer callableShaderBindingTableBuffer, VkDeviceSize callableShaderBindingOffset, VkDeviceSize callableShaderBindingStride, uint32_t width, uint32_t height, uint32_t depth); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRayTracingPipelinesNV)(VkDevice device, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoNV* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupHandlesKHR)(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupHandlesNV)(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData); -typedef VkResult (VKAPI_PTR *PFN_vkGetAccelerationStructureHandleNV)(VkDevice device, VkAccelerationStructureNV accelerationStructure, size_t dataSize, void* pData); -typedef void (VKAPI_PTR *PFN_vkCmdWriteAccelerationStructuresPropertiesNV)(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureNV* pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); -typedef VkResult (VKAPI_PTR *PFN_vkCompileDeferredNV)(VkDevice device, VkPipeline pipeline, uint32_t shader); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateAccelerationStructureNV( - VkDevice device, - const VkAccelerationStructureCreateInfoNV* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkAccelerationStructureNV* pAccelerationStructure); - -VKAPI_ATTR void VKAPI_CALL vkDestroyAccelerationStructureNV( - VkDevice device, - VkAccelerationStructureNV accelerationStructure, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureMemoryRequirementsNV( - VkDevice device, - const VkAccelerationStructureMemoryRequirementsInfoNV* pInfo, - VkMemoryRequirements2KHR* pMemoryRequirements); - -VKAPI_ATTR VkResult VKAPI_CALL vkBindAccelerationStructureMemoryNV( - VkDevice device, - uint32_t bindInfoCount, - const VkBindAccelerationStructureMemoryInfoNV* pBindInfos); - -VKAPI_ATTR void VKAPI_CALL vkCmdBuildAccelerationStructureNV( - VkCommandBuffer commandBuffer, - const VkAccelerationStructureInfoNV* pInfo, - VkBuffer instanceData, - VkDeviceSize instanceOffset, - VkBool32 update, - VkAccelerationStructureNV dst, - VkAccelerationStructureNV src, - VkBuffer scratch, - VkDeviceSize scratchOffset); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyAccelerationStructureNV( - VkCommandBuffer commandBuffer, - VkAccelerationStructureNV dst, - VkAccelerationStructureNV src, - VkCopyAccelerationStructureModeKHR mode); - -VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysNV( - VkCommandBuffer commandBuffer, - VkBuffer raygenShaderBindingTableBuffer, - VkDeviceSize raygenShaderBindingOffset, - VkBuffer missShaderBindingTableBuffer, - VkDeviceSize missShaderBindingOffset, - VkDeviceSize missShaderBindingStride, - VkBuffer hitShaderBindingTableBuffer, - VkDeviceSize hitShaderBindingOffset, - VkDeviceSize hitShaderBindingStride, - VkBuffer callableShaderBindingTableBuffer, - VkDeviceSize callableShaderBindingOffset, - VkDeviceSize callableShaderBindingStride, - uint32_t width, - uint32_t height, - uint32_t depth); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateRayTracingPipelinesNV( - VkDevice device, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkRayTracingPipelineCreateInfoNV* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetRayTracingShaderGroupHandlesKHR( - VkDevice device, - VkPipeline pipeline, - uint32_t firstGroup, - uint32_t groupCount, - size_t dataSize, - void* pData); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetRayTracingShaderGroupHandlesNV( - VkDevice device, - VkPipeline pipeline, - uint32_t firstGroup, - uint32_t groupCount, - size_t dataSize, - void* pData); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetAccelerationStructureHandleNV( - VkDevice device, - VkAccelerationStructureNV accelerationStructure, - size_t dataSize, - void* pData); - -VKAPI_ATTR void VKAPI_CALL vkCmdWriteAccelerationStructuresPropertiesNV( - VkCommandBuffer commandBuffer, - uint32_t accelerationStructureCount, - const VkAccelerationStructureNV* pAccelerationStructures, - VkQueryType queryType, - VkQueryPool queryPool, - uint32_t firstQuery); - -VKAPI_ATTR VkResult VKAPI_CALL vkCompileDeferredNV( - VkDevice device, - VkPipeline pipeline, - uint32_t shader); -#endif - - -#define VK_NV_representative_fragment_test 1 -#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_SPEC_VERSION 2 -#define VK_NV_REPRESENTATIVE_FRAGMENT_TEST_EXTENSION_NAME "VK_NV_representative_fragment_test" -typedef struct VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 representativeFragmentTest; -} VkPhysicalDeviceRepresentativeFragmentTestFeaturesNV; - -typedef struct VkPipelineRepresentativeFragmentTestStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 representativeFragmentTestEnable; -} VkPipelineRepresentativeFragmentTestStateCreateInfoNV; - - - -#define VK_EXT_filter_cubic 1 -#define VK_EXT_FILTER_CUBIC_SPEC_VERSION 3 -#define VK_EXT_FILTER_CUBIC_EXTENSION_NAME "VK_EXT_filter_cubic" -typedef struct VkPhysicalDeviceImageViewImageFormatInfoEXT { - VkStructureType sType; - void* pNext; - VkImageViewType imageViewType; -} VkPhysicalDeviceImageViewImageFormatInfoEXT; - -typedef struct VkFilterCubicImageViewImageFormatPropertiesEXT { - VkStructureType sType; - void* pNext; - VkBool32 filterCubic; - VkBool32 filterCubicMinmax; -} VkFilterCubicImageViewImageFormatPropertiesEXT; - - - -#define VK_QCOM_render_pass_shader_resolve 1 -#define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_SPEC_VERSION 4 -#define VK_QCOM_RENDER_PASS_SHADER_RESOLVE_EXTENSION_NAME "VK_QCOM_render_pass_shader_resolve" - - -#define VK_EXT_global_priority 1 -#define VK_EXT_GLOBAL_PRIORITY_SPEC_VERSION 2 -#define VK_EXT_GLOBAL_PRIORITY_EXTENSION_NAME "VK_EXT_global_priority" - -typedef enum VkQueueGlobalPriorityEXT { - VK_QUEUE_GLOBAL_PRIORITY_LOW_EXT = 128, - VK_QUEUE_GLOBAL_PRIORITY_MEDIUM_EXT = 256, - VK_QUEUE_GLOBAL_PRIORITY_HIGH_EXT = 512, - VK_QUEUE_GLOBAL_PRIORITY_REALTIME_EXT = 1024, - VK_QUEUE_GLOBAL_PRIORITY_MAX_ENUM_EXT = 0x7FFFFFFF -} VkQueueGlobalPriorityEXT; -typedef struct VkDeviceQueueGlobalPriorityCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkQueueGlobalPriorityEXT globalPriority; -} VkDeviceQueueGlobalPriorityCreateInfoEXT; - - - -#define VK_EXT_external_memory_host 1 -#define VK_EXT_EXTERNAL_MEMORY_HOST_SPEC_VERSION 1 -#define VK_EXT_EXTERNAL_MEMORY_HOST_EXTENSION_NAME "VK_EXT_external_memory_host" -typedef struct VkImportMemoryHostPointerInfoEXT { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - void* pHostPointer; -} VkImportMemoryHostPointerInfoEXT; - -typedef struct VkMemoryHostPointerPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t memoryTypeBits; -} VkMemoryHostPointerPropertiesEXT; - -typedef struct VkPhysicalDeviceExternalMemoryHostPropertiesEXT { - VkStructureType sType; - void* pNext; - VkDeviceSize minImportedHostPointerAlignment; -} VkPhysicalDeviceExternalMemoryHostPropertiesEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryHostPointerPropertiesEXT)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, const void* pHostPointer, VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryHostPointerPropertiesEXT( - VkDevice device, - VkExternalMemoryHandleTypeFlagBits handleType, - const void* pHostPointer, - VkMemoryHostPointerPropertiesEXT* pMemoryHostPointerProperties); -#endif - - -#define VK_AMD_buffer_marker 1 -#define VK_AMD_BUFFER_MARKER_SPEC_VERSION 1 -#define VK_AMD_BUFFER_MARKER_EXTENSION_NAME "VK_AMD_buffer_marker" -typedef void (VKAPI_PTR *PFN_vkCmdWriteBufferMarkerAMD)(VkCommandBuffer commandBuffer, VkPipelineStageFlagBits pipelineStage, VkBuffer dstBuffer, VkDeviceSize dstOffset, uint32_t marker); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdWriteBufferMarkerAMD( - VkCommandBuffer commandBuffer, - VkPipelineStageFlagBits pipelineStage, - VkBuffer dstBuffer, - VkDeviceSize dstOffset, - uint32_t marker); -#endif - - -#define VK_AMD_pipeline_compiler_control 1 -#define VK_AMD_PIPELINE_COMPILER_CONTROL_SPEC_VERSION 1 -#define VK_AMD_PIPELINE_COMPILER_CONTROL_EXTENSION_NAME "VK_AMD_pipeline_compiler_control" - -typedef enum VkPipelineCompilerControlFlagBitsAMD { - VK_PIPELINE_COMPILER_CONTROL_FLAG_BITS_MAX_ENUM_AMD = 0x7FFFFFFF -} VkPipelineCompilerControlFlagBitsAMD; -typedef VkFlags VkPipelineCompilerControlFlagsAMD; -typedef struct VkPipelineCompilerControlCreateInfoAMD { - VkStructureType sType; - const void* pNext; - VkPipelineCompilerControlFlagsAMD compilerControlFlags; -} VkPipelineCompilerControlCreateInfoAMD; - - - -#define VK_EXT_calibrated_timestamps 1 -#define VK_EXT_CALIBRATED_TIMESTAMPS_SPEC_VERSION 2 -#define VK_EXT_CALIBRATED_TIMESTAMPS_EXTENSION_NAME "VK_EXT_calibrated_timestamps" - -typedef enum VkTimeDomainEXT { - VK_TIME_DOMAIN_DEVICE_EXT = 0, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_EXT = 1, - VK_TIME_DOMAIN_CLOCK_MONOTONIC_RAW_EXT = 2, - VK_TIME_DOMAIN_QUERY_PERFORMANCE_COUNTER_EXT = 3, - VK_TIME_DOMAIN_MAX_ENUM_EXT = 0x7FFFFFFF -} VkTimeDomainEXT; -typedef struct VkCalibratedTimestampInfoEXT { - VkStructureType sType; - const void* pNext; - VkTimeDomainEXT timeDomain; -} VkCalibratedTimestampInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCalibrateableTimeDomainsEXT)(VkPhysicalDevice physicalDevice, uint32_t* pTimeDomainCount, VkTimeDomainEXT* pTimeDomains); -typedef VkResult (VKAPI_PTR *PFN_vkGetCalibratedTimestampsEXT)(VkDevice device, uint32_t timestampCount, const VkCalibratedTimestampInfoEXT* pTimestampInfos, uint64_t* pTimestamps, uint64_t* pMaxDeviation); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCalibrateableTimeDomainsEXT( - VkPhysicalDevice physicalDevice, - uint32_t* pTimeDomainCount, - VkTimeDomainEXT* pTimeDomains); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetCalibratedTimestampsEXT( - VkDevice device, - uint32_t timestampCount, - const VkCalibratedTimestampInfoEXT* pTimestampInfos, - uint64_t* pTimestamps, - uint64_t* pMaxDeviation); -#endif - - -#define VK_AMD_shader_core_properties 1 -#define VK_AMD_SHADER_CORE_PROPERTIES_SPEC_VERSION 2 -#define VK_AMD_SHADER_CORE_PROPERTIES_EXTENSION_NAME "VK_AMD_shader_core_properties" -typedef struct VkPhysicalDeviceShaderCorePropertiesAMD { - VkStructureType sType; - void* pNext; - uint32_t shaderEngineCount; - uint32_t shaderArraysPerEngineCount; - uint32_t computeUnitsPerShaderArray; - uint32_t simdPerComputeUnit; - uint32_t wavefrontsPerSimd; - uint32_t wavefrontSize; - uint32_t sgprsPerSimd; - uint32_t minSgprAllocation; - uint32_t maxSgprAllocation; - uint32_t sgprAllocationGranularity; - uint32_t vgprsPerSimd; - uint32_t minVgprAllocation; - uint32_t maxVgprAllocation; - uint32_t vgprAllocationGranularity; -} VkPhysicalDeviceShaderCorePropertiesAMD; - - - -#define VK_AMD_memory_overallocation_behavior 1 -#define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_SPEC_VERSION 1 -#define VK_AMD_MEMORY_OVERALLOCATION_BEHAVIOR_EXTENSION_NAME "VK_AMD_memory_overallocation_behavior" - -typedef enum VkMemoryOverallocationBehaviorAMD { - VK_MEMORY_OVERALLOCATION_BEHAVIOR_DEFAULT_AMD = 0, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_ALLOWED_AMD = 1, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_DISALLOWED_AMD = 2, - VK_MEMORY_OVERALLOCATION_BEHAVIOR_MAX_ENUM_AMD = 0x7FFFFFFF -} VkMemoryOverallocationBehaviorAMD; -typedef struct VkDeviceMemoryOverallocationCreateInfoAMD { - VkStructureType sType; - const void* pNext; - VkMemoryOverallocationBehaviorAMD overallocationBehavior; -} VkDeviceMemoryOverallocationCreateInfoAMD; - - - -#define VK_EXT_vertex_attribute_divisor 1 -#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_SPEC_VERSION 3 -#define VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME "VK_EXT_vertex_attribute_divisor" -typedef struct VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t maxVertexAttribDivisor; -} VkPhysicalDeviceVertexAttributeDivisorPropertiesEXT; - -typedef struct VkVertexInputBindingDivisorDescriptionEXT { - uint32_t binding; - uint32_t divisor; -} VkVertexInputBindingDivisorDescriptionEXT; - -typedef struct VkPipelineVertexInputDivisorStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t vertexBindingDivisorCount; - const VkVertexInputBindingDivisorDescriptionEXT* pVertexBindingDivisors; -} VkPipelineVertexInputDivisorStateCreateInfoEXT; - -typedef struct VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 vertexAttributeInstanceRateDivisor; - VkBool32 vertexAttributeInstanceRateZeroDivisor; -} VkPhysicalDeviceVertexAttributeDivisorFeaturesEXT; - - - -#define VK_EXT_pipeline_creation_feedback 1 -#define VK_EXT_PIPELINE_CREATION_FEEDBACK_SPEC_VERSION 1 -#define VK_EXT_PIPELINE_CREATION_FEEDBACK_EXTENSION_NAME "VK_EXT_pipeline_creation_feedback" - -typedef enum VkPipelineCreationFeedbackFlagBitsEXT { - VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT_EXT = 0x00000001, - VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT_EXT = 0x00000002, - VK_PIPELINE_CREATION_FEEDBACK_BASE_PIPELINE_ACCELERATION_BIT_EXT = 0x00000004, - VK_PIPELINE_CREATION_FEEDBACK_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkPipelineCreationFeedbackFlagBitsEXT; -typedef VkFlags VkPipelineCreationFeedbackFlagsEXT; -typedef struct VkPipelineCreationFeedbackEXT { - VkPipelineCreationFeedbackFlagsEXT flags; - uint64_t duration; -} VkPipelineCreationFeedbackEXT; - -typedef struct VkPipelineCreationFeedbackCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPipelineCreationFeedbackEXT* pPipelineCreationFeedback; - uint32_t pipelineStageCreationFeedbackCount; - VkPipelineCreationFeedbackEXT* pPipelineStageCreationFeedbacks; -} VkPipelineCreationFeedbackCreateInfoEXT; - - - -#define VK_NV_shader_subgroup_partitioned 1 -#define VK_NV_SHADER_SUBGROUP_PARTITIONED_SPEC_VERSION 1 -#define VK_NV_SHADER_SUBGROUP_PARTITIONED_EXTENSION_NAME "VK_NV_shader_subgroup_partitioned" - - -#define VK_NV_compute_shader_derivatives 1 -#define VK_NV_COMPUTE_SHADER_DERIVATIVES_SPEC_VERSION 1 -#define VK_NV_COMPUTE_SHADER_DERIVATIVES_EXTENSION_NAME "VK_NV_compute_shader_derivatives" -typedef struct VkPhysicalDeviceComputeShaderDerivativesFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 computeDerivativeGroupQuads; - VkBool32 computeDerivativeGroupLinear; -} VkPhysicalDeviceComputeShaderDerivativesFeaturesNV; - - - -#define VK_NV_mesh_shader 1 -#define VK_NV_MESH_SHADER_SPEC_VERSION 1 -#define VK_NV_MESH_SHADER_EXTENSION_NAME "VK_NV_mesh_shader" -typedef struct VkPhysicalDeviceMeshShaderFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 taskShader; - VkBool32 meshShader; -} VkPhysicalDeviceMeshShaderFeaturesNV; - -typedef struct VkPhysicalDeviceMeshShaderPropertiesNV { - VkStructureType sType; - void* pNext; - uint32_t maxDrawMeshTasksCount; - uint32_t maxTaskWorkGroupInvocations; - uint32_t maxTaskWorkGroupSize[3]; - uint32_t maxTaskTotalMemorySize; - uint32_t maxTaskOutputCount; - uint32_t maxMeshWorkGroupInvocations; - uint32_t maxMeshWorkGroupSize[3]; - uint32_t maxMeshTotalMemorySize; - uint32_t maxMeshOutputVertices; - uint32_t maxMeshOutputPrimitives; - uint32_t maxMeshMultiviewViewCount; - uint32_t meshOutputPerVertexGranularity; - uint32_t meshOutputPerPrimitiveGranularity; -} VkPhysicalDeviceMeshShaderPropertiesNV; - -typedef struct VkDrawMeshTasksIndirectCommandNV { - uint32_t taskCount; - uint32_t firstTask; -} VkDrawMeshTasksIndirectCommandNV; - -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksNV)(VkCommandBuffer commandBuffer, uint32_t taskCount, uint32_t firstTask); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectNV)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, uint32_t drawCount, uint32_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdDrawMeshTasksIndirectCountNV)(VkCommandBuffer commandBuffer, VkBuffer buffer, VkDeviceSize offset, VkBuffer countBuffer, VkDeviceSize countBufferOffset, uint32_t maxDrawCount, uint32_t stride); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksNV( - VkCommandBuffer commandBuffer, - uint32_t taskCount, - uint32_t firstTask); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectNV( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - uint32_t drawCount, - uint32_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdDrawMeshTasksIndirectCountNV( - VkCommandBuffer commandBuffer, - VkBuffer buffer, - VkDeviceSize offset, - VkBuffer countBuffer, - VkDeviceSize countBufferOffset, - uint32_t maxDrawCount, - uint32_t stride); -#endif - - -#define VK_NV_fragment_shader_barycentric 1 -#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_SHADER_BARYCENTRIC_EXTENSION_NAME "VK_NV_fragment_shader_barycentric" -typedef struct VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 fragmentShaderBarycentric; -} VkPhysicalDeviceFragmentShaderBarycentricFeaturesNV; - - - -#define VK_NV_shader_image_footprint 1 -#define VK_NV_SHADER_IMAGE_FOOTPRINT_SPEC_VERSION 2 -#define VK_NV_SHADER_IMAGE_FOOTPRINT_EXTENSION_NAME "VK_NV_shader_image_footprint" -typedef struct VkPhysicalDeviceShaderImageFootprintFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 imageFootprint; -} VkPhysicalDeviceShaderImageFootprintFeaturesNV; - - - -#define VK_NV_scissor_exclusive 1 -#define VK_NV_SCISSOR_EXCLUSIVE_SPEC_VERSION 1 -#define VK_NV_SCISSOR_EXCLUSIVE_EXTENSION_NAME "VK_NV_scissor_exclusive" -typedef struct VkPipelineViewportExclusiveScissorStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - uint32_t exclusiveScissorCount; - const VkRect2D* pExclusiveScissors; -} VkPipelineViewportExclusiveScissorStateCreateInfoNV; - -typedef struct VkPhysicalDeviceExclusiveScissorFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 exclusiveScissor; -} VkPhysicalDeviceExclusiveScissorFeaturesNV; - -typedef void (VKAPI_PTR *PFN_vkCmdSetExclusiveScissorNV)(VkCommandBuffer commandBuffer, uint32_t firstExclusiveScissor, uint32_t exclusiveScissorCount, const VkRect2D* pExclusiveScissors); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetExclusiveScissorNV( - VkCommandBuffer commandBuffer, - uint32_t firstExclusiveScissor, - uint32_t exclusiveScissorCount, - const VkRect2D* pExclusiveScissors); -#endif - - -#define VK_NV_device_diagnostic_checkpoints 1 -#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_SPEC_VERSION 2 -#define VK_NV_DEVICE_DIAGNOSTIC_CHECKPOINTS_EXTENSION_NAME "VK_NV_device_diagnostic_checkpoints" -typedef struct VkQueueFamilyCheckpointPropertiesNV { - VkStructureType sType; - void* pNext; - VkPipelineStageFlags checkpointExecutionStageMask; -} VkQueueFamilyCheckpointPropertiesNV; - -typedef struct VkCheckpointDataNV { - VkStructureType sType; - void* pNext; - VkPipelineStageFlagBits stage; - void* pCheckpointMarker; -} VkCheckpointDataNV; - -typedef void (VKAPI_PTR *PFN_vkCmdSetCheckpointNV)(VkCommandBuffer commandBuffer, const void* pCheckpointMarker); -typedef void (VKAPI_PTR *PFN_vkGetQueueCheckpointDataNV)(VkQueue queue, uint32_t* pCheckpointDataCount, VkCheckpointDataNV* pCheckpointData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetCheckpointNV( - VkCommandBuffer commandBuffer, - const void* pCheckpointMarker); - -VKAPI_ATTR void VKAPI_CALL vkGetQueueCheckpointDataNV( - VkQueue queue, - uint32_t* pCheckpointDataCount, - VkCheckpointDataNV* pCheckpointData); -#endif - - -#define VK_INTEL_shader_integer_functions2 1 -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_SPEC_VERSION 1 -#define VK_INTEL_SHADER_INTEGER_FUNCTIONS_2_EXTENSION_NAME "VK_INTEL_shader_integer_functions2" -typedef struct VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL { - VkStructureType sType; - void* pNext; - VkBool32 shaderIntegerFunctions2; -} VkPhysicalDeviceShaderIntegerFunctions2FeaturesINTEL; - - - -#define VK_INTEL_performance_query 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPerformanceConfigurationINTEL) -#define VK_INTEL_PERFORMANCE_QUERY_SPEC_VERSION 2 -#define VK_INTEL_PERFORMANCE_QUERY_EXTENSION_NAME "VK_INTEL_performance_query" - -typedef enum VkPerformanceConfigurationTypeINTEL { - VK_PERFORMANCE_CONFIGURATION_TYPE_COMMAND_QUEUE_METRICS_DISCOVERY_ACTIVATED_INTEL = 0, - VK_PERFORMANCE_CONFIGURATION_TYPE_MAX_ENUM_INTEL = 0x7FFFFFFF -} VkPerformanceConfigurationTypeINTEL; - -typedef enum VkQueryPoolSamplingModeINTEL { - VK_QUERY_POOL_SAMPLING_MODE_MANUAL_INTEL = 0, - VK_QUERY_POOL_SAMPLING_MODE_MAX_ENUM_INTEL = 0x7FFFFFFF -} VkQueryPoolSamplingModeINTEL; - -typedef enum VkPerformanceOverrideTypeINTEL { - VK_PERFORMANCE_OVERRIDE_TYPE_NULL_HARDWARE_INTEL = 0, - VK_PERFORMANCE_OVERRIDE_TYPE_FLUSH_GPU_CACHES_INTEL = 1, - VK_PERFORMANCE_OVERRIDE_TYPE_MAX_ENUM_INTEL = 0x7FFFFFFF -} VkPerformanceOverrideTypeINTEL; - -typedef enum VkPerformanceParameterTypeINTEL { - VK_PERFORMANCE_PARAMETER_TYPE_HW_COUNTERS_SUPPORTED_INTEL = 0, - VK_PERFORMANCE_PARAMETER_TYPE_STREAM_MARKER_VALID_BITS_INTEL = 1, - VK_PERFORMANCE_PARAMETER_TYPE_MAX_ENUM_INTEL = 0x7FFFFFFF -} VkPerformanceParameterTypeINTEL; - -typedef enum VkPerformanceValueTypeINTEL { - VK_PERFORMANCE_VALUE_TYPE_UINT32_INTEL = 0, - VK_PERFORMANCE_VALUE_TYPE_UINT64_INTEL = 1, - VK_PERFORMANCE_VALUE_TYPE_FLOAT_INTEL = 2, - VK_PERFORMANCE_VALUE_TYPE_BOOL_INTEL = 3, - VK_PERFORMANCE_VALUE_TYPE_STRING_INTEL = 4, - VK_PERFORMANCE_VALUE_TYPE_MAX_ENUM_INTEL = 0x7FFFFFFF -} VkPerformanceValueTypeINTEL; -typedef union VkPerformanceValueDataINTEL { - uint32_t value32; - uint64_t value64; - float valueFloat; - VkBool32 valueBool; - const char* valueString; -} VkPerformanceValueDataINTEL; - -typedef struct VkPerformanceValueINTEL { - VkPerformanceValueTypeINTEL type; - VkPerformanceValueDataINTEL data; -} VkPerformanceValueINTEL; - -typedef struct VkInitializePerformanceApiInfoINTEL { - VkStructureType sType; - const void* pNext; - void* pUserData; -} VkInitializePerformanceApiInfoINTEL; - -typedef struct VkQueryPoolPerformanceQueryCreateInfoINTEL { - VkStructureType sType; - const void* pNext; - VkQueryPoolSamplingModeINTEL performanceCountersSampling; -} VkQueryPoolPerformanceQueryCreateInfoINTEL; - -typedef VkQueryPoolPerformanceQueryCreateInfoINTEL VkQueryPoolCreateInfoINTEL; - -typedef struct VkPerformanceMarkerInfoINTEL { - VkStructureType sType; - const void* pNext; - uint64_t marker; -} VkPerformanceMarkerInfoINTEL; - -typedef struct VkPerformanceStreamMarkerInfoINTEL { - VkStructureType sType; - const void* pNext; - uint32_t marker; -} VkPerformanceStreamMarkerInfoINTEL; - -typedef struct VkPerformanceOverrideInfoINTEL { - VkStructureType sType; - const void* pNext; - VkPerformanceOverrideTypeINTEL type; - VkBool32 enable; - uint64_t parameter; -} VkPerformanceOverrideInfoINTEL; - -typedef struct VkPerformanceConfigurationAcquireInfoINTEL { - VkStructureType sType; - const void* pNext; - VkPerformanceConfigurationTypeINTEL type; -} VkPerformanceConfigurationAcquireInfoINTEL; - -typedef VkResult (VKAPI_PTR *PFN_vkInitializePerformanceApiINTEL)(VkDevice device, const VkInitializePerformanceApiInfoINTEL* pInitializeInfo); -typedef void (VKAPI_PTR *PFN_vkUninitializePerformanceApiINTEL)(VkDevice device); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceMarkerINTEL)(VkCommandBuffer commandBuffer, const VkPerformanceMarkerInfoINTEL* pMarkerInfo); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceStreamMarkerINTEL)(VkCommandBuffer commandBuffer, const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo); -typedef VkResult (VKAPI_PTR *PFN_vkCmdSetPerformanceOverrideINTEL)(VkCommandBuffer commandBuffer, const VkPerformanceOverrideInfoINTEL* pOverrideInfo); -typedef VkResult (VKAPI_PTR *PFN_vkAcquirePerformanceConfigurationINTEL)(VkDevice device, const VkPerformanceConfigurationAcquireInfoINTEL* pAcquireInfo, VkPerformanceConfigurationINTEL* pConfiguration); -typedef VkResult (VKAPI_PTR *PFN_vkReleasePerformanceConfigurationINTEL)(VkDevice device, VkPerformanceConfigurationINTEL configuration); -typedef VkResult (VKAPI_PTR *PFN_vkQueueSetPerformanceConfigurationINTEL)(VkQueue queue, VkPerformanceConfigurationINTEL configuration); -typedef VkResult (VKAPI_PTR *PFN_vkGetPerformanceParameterINTEL)(VkDevice device, VkPerformanceParameterTypeINTEL parameter, VkPerformanceValueINTEL* pValue); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkInitializePerformanceApiINTEL( - VkDevice device, - const VkInitializePerformanceApiInfoINTEL* pInitializeInfo); - -VKAPI_ATTR void VKAPI_CALL vkUninitializePerformanceApiINTEL( - VkDevice device); - -VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceMarkerINTEL( - VkCommandBuffer commandBuffer, - const VkPerformanceMarkerInfoINTEL* pMarkerInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceStreamMarkerINTEL( - VkCommandBuffer commandBuffer, - const VkPerformanceStreamMarkerInfoINTEL* pMarkerInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkCmdSetPerformanceOverrideINTEL( - VkCommandBuffer commandBuffer, - const VkPerformanceOverrideInfoINTEL* pOverrideInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquirePerformanceConfigurationINTEL( - VkDevice device, - const VkPerformanceConfigurationAcquireInfoINTEL* pAcquireInfo, - VkPerformanceConfigurationINTEL* pConfiguration); - -VKAPI_ATTR VkResult VKAPI_CALL vkReleasePerformanceConfigurationINTEL( - VkDevice device, - VkPerformanceConfigurationINTEL configuration); - -VKAPI_ATTR VkResult VKAPI_CALL vkQueueSetPerformanceConfigurationINTEL( - VkQueue queue, - VkPerformanceConfigurationINTEL configuration); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetPerformanceParameterINTEL( - VkDevice device, - VkPerformanceParameterTypeINTEL parameter, - VkPerformanceValueINTEL* pValue); -#endif - - -#define VK_EXT_pci_bus_info 1 -#define VK_EXT_PCI_BUS_INFO_SPEC_VERSION 2 -#define VK_EXT_PCI_BUS_INFO_EXTENSION_NAME "VK_EXT_pci_bus_info" -typedef struct VkPhysicalDevicePCIBusInfoPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t pciDomain; - uint32_t pciBus; - uint32_t pciDevice; - uint32_t pciFunction; -} VkPhysicalDevicePCIBusInfoPropertiesEXT; - - - -#define VK_AMD_display_native_hdr 1 -#define VK_AMD_DISPLAY_NATIVE_HDR_SPEC_VERSION 1 -#define VK_AMD_DISPLAY_NATIVE_HDR_EXTENSION_NAME "VK_AMD_display_native_hdr" -typedef struct VkDisplayNativeHdrSurfaceCapabilitiesAMD { - VkStructureType sType; - void* pNext; - VkBool32 localDimmingSupport; -} VkDisplayNativeHdrSurfaceCapabilitiesAMD; - -typedef struct VkSwapchainDisplayNativeHdrCreateInfoAMD { - VkStructureType sType; - const void* pNext; - VkBool32 localDimmingEnable; -} VkSwapchainDisplayNativeHdrCreateInfoAMD; - -typedef void (VKAPI_PTR *PFN_vkSetLocalDimmingAMD)(VkDevice device, VkSwapchainKHR swapChain, VkBool32 localDimmingEnable); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkSetLocalDimmingAMD( - VkDevice device, - VkSwapchainKHR swapChain, - VkBool32 localDimmingEnable); -#endif - - -#define VK_EXT_fragment_density_map 1 -#define VK_EXT_FRAGMENT_DENSITY_MAP_SPEC_VERSION 1 -#define VK_EXT_FRAGMENT_DENSITY_MAP_EXTENSION_NAME "VK_EXT_fragment_density_map" -typedef struct VkPhysicalDeviceFragmentDensityMapFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 fragmentDensityMap; - VkBool32 fragmentDensityMapDynamic; - VkBool32 fragmentDensityMapNonSubsampledImages; -} VkPhysicalDeviceFragmentDensityMapFeaturesEXT; - -typedef struct VkPhysicalDeviceFragmentDensityMapPropertiesEXT { - VkStructureType sType; - void* pNext; - VkExtent2D minFragmentDensityTexelSize; - VkExtent2D maxFragmentDensityTexelSize; - VkBool32 fragmentDensityInvocations; -} VkPhysicalDeviceFragmentDensityMapPropertiesEXT; - -typedef struct VkRenderPassFragmentDensityMapCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkAttachmentReference fragmentDensityMapAttachment; -} VkRenderPassFragmentDensityMapCreateInfoEXT; - - - -#define VK_EXT_scalar_block_layout 1 -#define VK_EXT_SCALAR_BLOCK_LAYOUT_SPEC_VERSION 1 -#define VK_EXT_SCALAR_BLOCK_LAYOUT_EXTENSION_NAME "VK_EXT_scalar_block_layout" -typedef VkPhysicalDeviceScalarBlockLayoutFeatures VkPhysicalDeviceScalarBlockLayoutFeaturesEXT; - - - -#define VK_GOOGLE_hlsl_functionality1 1 -#define VK_GOOGLE_HLSL_FUNCTIONALITY1_SPEC_VERSION 1 -#define VK_GOOGLE_HLSL_FUNCTIONALITY1_EXTENSION_NAME "VK_GOOGLE_hlsl_functionality1" - - -#define VK_GOOGLE_decorate_string 1 -#define VK_GOOGLE_DECORATE_STRING_SPEC_VERSION 1 -#define VK_GOOGLE_DECORATE_STRING_EXTENSION_NAME "VK_GOOGLE_decorate_string" - - -#define VK_EXT_subgroup_size_control 1 -#define VK_EXT_SUBGROUP_SIZE_CONTROL_SPEC_VERSION 2 -#define VK_EXT_SUBGROUP_SIZE_CONTROL_EXTENSION_NAME "VK_EXT_subgroup_size_control" -typedef struct VkPhysicalDeviceSubgroupSizeControlFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 subgroupSizeControl; - VkBool32 computeFullSubgroups; -} VkPhysicalDeviceSubgroupSizeControlFeaturesEXT; - -typedef struct VkPhysicalDeviceSubgroupSizeControlPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t minSubgroupSize; - uint32_t maxSubgroupSize; - uint32_t maxComputeWorkgroupSubgroups; - VkShaderStageFlags requiredSubgroupSizeStages; -} VkPhysicalDeviceSubgroupSizeControlPropertiesEXT; - -typedef struct VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT { - VkStructureType sType; - void* pNext; - uint32_t requiredSubgroupSize; -} VkPipelineShaderStageRequiredSubgroupSizeCreateInfoEXT; - - - -#define VK_AMD_shader_core_properties2 1 -#define VK_AMD_SHADER_CORE_PROPERTIES_2_SPEC_VERSION 1 -#define VK_AMD_SHADER_CORE_PROPERTIES_2_EXTENSION_NAME "VK_AMD_shader_core_properties2" - -typedef enum VkShaderCorePropertiesFlagBitsAMD { - VK_SHADER_CORE_PROPERTIES_FLAG_BITS_MAX_ENUM_AMD = 0x7FFFFFFF -} VkShaderCorePropertiesFlagBitsAMD; -typedef VkFlags VkShaderCorePropertiesFlagsAMD; -typedef struct VkPhysicalDeviceShaderCoreProperties2AMD { - VkStructureType sType; - void* pNext; - VkShaderCorePropertiesFlagsAMD shaderCoreFeatures; - uint32_t activeComputeUnitCount; -} VkPhysicalDeviceShaderCoreProperties2AMD; - - - -#define VK_AMD_device_coherent_memory 1 -#define VK_AMD_DEVICE_COHERENT_MEMORY_SPEC_VERSION 1 -#define VK_AMD_DEVICE_COHERENT_MEMORY_EXTENSION_NAME "VK_AMD_device_coherent_memory" -typedef struct VkPhysicalDeviceCoherentMemoryFeaturesAMD { - VkStructureType sType; - void* pNext; - VkBool32 deviceCoherentMemory; -} VkPhysicalDeviceCoherentMemoryFeaturesAMD; - - - -#define VK_EXT_shader_image_atomic_int64 1 -#define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_SPEC_VERSION 1 -#define VK_EXT_SHADER_IMAGE_ATOMIC_INT64_EXTENSION_NAME "VK_EXT_shader_image_atomic_int64" -typedef struct VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 shaderImageInt64Atomics; - VkBool32 sparseImageInt64Atomics; -} VkPhysicalDeviceShaderImageAtomicInt64FeaturesEXT; - - - -#define VK_EXT_memory_budget 1 -#define VK_EXT_MEMORY_BUDGET_SPEC_VERSION 1 -#define VK_EXT_MEMORY_BUDGET_EXTENSION_NAME "VK_EXT_memory_budget" -typedef struct VkPhysicalDeviceMemoryBudgetPropertiesEXT { - VkStructureType sType; - void* pNext; - VkDeviceSize heapBudget[VK_MAX_MEMORY_HEAPS]; - VkDeviceSize heapUsage[VK_MAX_MEMORY_HEAPS]; -} VkPhysicalDeviceMemoryBudgetPropertiesEXT; - - - -#define VK_EXT_memory_priority 1 -#define VK_EXT_MEMORY_PRIORITY_SPEC_VERSION 1 -#define VK_EXT_MEMORY_PRIORITY_EXTENSION_NAME "VK_EXT_memory_priority" -typedef struct VkPhysicalDeviceMemoryPriorityFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 memoryPriority; -} VkPhysicalDeviceMemoryPriorityFeaturesEXT; - -typedef struct VkMemoryPriorityAllocateInfoEXT { - VkStructureType sType; - const void* pNext; - float priority; -} VkMemoryPriorityAllocateInfoEXT; - - - -#define VK_NV_dedicated_allocation_image_aliasing 1 -#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_SPEC_VERSION 1 -#define VK_NV_DEDICATED_ALLOCATION_IMAGE_ALIASING_EXTENSION_NAME "VK_NV_dedicated_allocation_image_aliasing" -typedef struct VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 dedicatedAllocationImageAliasing; -} VkPhysicalDeviceDedicatedAllocationImageAliasingFeaturesNV; - - - -#define VK_EXT_buffer_device_address 1 -#define VK_EXT_BUFFER_DEVICE_ADDRESS_SPEC_VERSION 2 -#define VK_EXT_BUFFER_DEVICE_ADDRESS_EXTENSION_NAME "VK_EXT_buffer_device_address" -typedef struct VkPhysicalDeviceBufferDeviceAddressFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 bufferDeviceAddress; - VkBool32 bufferDeviceAddressCaptureReplay; - VkBool32 bufferDeviceAddressMultiDevice; -} VkPhysicalDeviceBufferDeviceAddressFeaturesEXT; - -typedef VkPhysicalDeviceBufferDeviceAddressFeaturesEXT VkPhysicalDeviceBufferAddressFeaturesEXT; - -typedef VkBufferDeviceAddressInfo VkBufferDeviceAddressInfoEXT; - -typedef struct VkBufferDeviceAddressCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkDeviceAddress deviceAddress; -} VkBufferDeviceAddressCreateInfoEXT; - -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetBufferDeviceAddressEXT)(VkDevice device, const VkBufferDeviceAddressInfo* pInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetBufferDeviceAddressEXT( - VkDevice device, - const VkBufferDeviceAddressInfo* pInfo); -#endif - - -#define VK_EXT_tooling_info 1 -#define VK_EXT_TOOLING_INFO_SPEC_VERSION 1 -#define VK_EXT_TOOLING_INFO_EXTENSION_NAME "VK_EXT_tooling_info" - -typedef enum VkToolPurposeFlagBitsEXT { - VK_TOOL_PURPOSE_VALIDATION_BIT_EXT = 0x00000001, - VK_TOOL_PURPOSE_PROFILING_BIT_EXT = 0x00000002, - VK_TOOL_PURPOSE_TRACING_BIT_EXT = 0x00000004, - VK_TOOL_PURPOSE_ADDITIONAL_FEATURES_BIT_EXT = 0x00000008, - VK_TOOL_PURPOSE_MODIFYING_FEATURES_BIT_EXT = 0x00000010, - VK_TOOL_PURPOSE_DEBUG_REPORTING_BIT_EXT = 0x00000020, - VK_TOOL_PURPOSE_DEBUG_MARKERS_BIT_EXT = 0x00000040, - VK_TOOL_PURPOSE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkToolPurposeFlagBitsEXT; -typedef VkFlags VkToolPurposeFlagsEXT; -typedef struct VkPhysicalDeviceToolPropertiesEXT { - VkStructureType sType; - void* pNext; - char name[VK_MAX_EXTENSION_NAME_SIZE]; - char version[VK_MAX_EXTENSION_NAME_SIZE]; - VkToolPurposeFlagsEXT purposes; - char description[VK_MAX_DESCRIPTION_SIZE]; - char layer[VK_MAX_EXTENSION_NAME_SIZE]; -} VkPhysicalDeviceToolPropertiesEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceToolPropertiesEXT)(VkPhysicalDevice physicalDevice, uint32_t* pToolCount, VkPhysicalDeviceToolPropertiesEXT* pToolProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceToolPropertiesEXT( - VkPhysicalDevice physicalDevice, - uint32_t* pToolCount, - VkPhysicalDeviceToolPropertiesEXT* pToolProperties); -#endif - - -#define VK_EXT_separate_stencil_usage 1 -#define VK_EXT_SEPARATE_STENCIL_USAGE_SPEC_VERSION 1 -#define VK_EXT_SEPARATE_STENCIL_USAGE_EXTENSION_NAME "VK_EXT_separate_stencil_usage" -typedef VkImageStencilUsageCreateInfo VkImageStencilUsageCreateInfoEXT; - - - -#define VK_EXT_validation_features 1 -#define VK_EXT_VALIDATION_FEATURES_SPEC_VERSION 4 -#define VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME "VK_EXT_validation_features" - -typedef enum VkValidationFeatureEnableEXT { - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_EXT = 0, - VK_VALIDATION_FEATURE_ENABLE_GPU_ASSISTED_RESERVE_BINDING_SLOT_EXT = 1, - VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT = 2, - VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT = 3, - VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT = 4, - VK_VALIDATION_FEATURE_ENABLE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkValidationFeatureEnableEXT; - -typedef enum VkValidationFeatureDisableEXT { - VK_VALIDATION_FEATURE_DISABLE_ALL_EXT = 0, - VK_VALIDATION_FEATURE_DISABLE_SHADERS_EXT = 1, - VK_VALIDATION_FEATURE_DISABLE_THREAD_SAFETY_EXT = 2, - VK_VALIDATION_FEATURE_DISABLE_API_PARAMETERS_EXT = 3, - VK_VALIDATION_FEATURE_DISABLE_OBJECT_LIFETIMES_EXT = 4, - VK_VALIDATION_FEATURE_DISABLE_CORE_CHECKS_EXT = 5, - VK_VALIDATION_FEATURE_DISABLE_UNIQUE_HANDLES_EXT = 6, - VK_VALIDATION_FEATURE_DISABLE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkValidationFeatureDisableEXT; -typedef struct VkValidationFeaturesEXT { - VkStructureType sType; - const void* pNext; - uint32_t enabledValidationFeatureCount; - const VkValidationFeatureEnableEXT* pEnabledValidationFeatures; - uint32_t disabledValidationFeatureCount; - const VkValidationFeatureDisableEXT* pDisabledValidationFeatures; -} VkValidationFeaturesEXT; - - - -#define VK_NV_cooperative_matrix 1 -#define VK_NV_COOPERATIVE_MATRIX_SPEC_VERSION 1 -#define VK_NV_COOPERATIVE_MATRIX_EXTENSION_NAME "VK_NV_cooperative_matrix" - -typedef enum VkComponentTypeNV { - VK_COMPONENT_TYPE_FLOAT16_NV = 0, - VK_COMPONENT_TYPE_FLOAT32_NV = 1, - VK_COMPONENT_TYPE_FLOAT64_NV = 2, - VK_COMPONENT_TYPE_SINT8_NV = 3, - VK_COMPONENT_TYPE_SINT16_NV = 4, - VK_COMPONENT_TYPE_SINT32_NV = 5, - VK_COMPONENT_TYPE_SINT64_NV = 6, - VK_COMPONENT_TYPE_UINT8_NV = 7, - VK_COMPONENT_TYPE_UINT16_NV = 8, - VK_COMPONENT_TYPE_UINT32_NV = 9, - VK_COMPONENT_TYPE_UINT64_NV = 10, - VK_COMPONENT_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkComponentTypeNV; - -typedef enum VkScopeNV { - VK_SCOPE_DEVICE_NV = 1, - VK_SCOPE_WORKGROUP_NV = 2, - VK_SCOPE_SUBGROUP_NV = 3, - VK_SCOPE_QUEUE_FAMILY_NV = 5, - VK_SCOPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkScopeNV; -typedef struct VkCooperativeMatrixPropertiesNV { - VkStructureType sType; - void* pNext; - uint32_t MSize; - uint32_t NSize; - uint32_t KSize; - VkComponentTypeNV AType; - VkComponentTypeNV BType; - VkComponentTypeNV CType; - VkComponentTypeNV DType; - VkScopeNV scope; -} VkCooperativeMatrixPropertiesNV; - -typedef struct VkPhysicalDeviceCooperativeMatrixFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 cooperativeMatrix; - VkBool32 cooperativeMatrixRobustBufferAccess; -} VkPhysicalDeviceCooperativeMatrixFeaturesNV; - -typedef struct VkPhysicalDeviceCooperativeMatrixPropertiesNV { - VkStructureType sType; - void* pNext; - VkShaderStageFlags cooperativeMatrixSupportedStages; -} VkPhysicalDeviceCooperativeMatrixPropertiesNV; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceCooperativeMatrixPropertiesNV)(VkPhysicalDevice physicalDevice, uint32_t* pPropertyCount, VkCooperativeMatrixPropertiesNV* pProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceCooperativeMatrixPropertiesNV( - VkPhysicalDevice physicalDevice, - uint32_t* pPropertyCount, - VkCooperativeMatrixPropertiesNV* pProperties); -#endif - - -#define VK_NV_coverage_reduction_mode 1 -#define VK_NV_COVERAGE_REDUCTION_MODE_SPEC_VERSION 1 -#define VK_NV_COVERAGE_REDUCTION_MODE_EXTENSION_NAME "VK_NV_coverage_reduction_mode" - -typedef enum VkCoverageReductionModeNV { - VK_COVERAGE_REDUCTION_MODE_MERGE_NV = 0, - VK_COVERAGE_REDUCTION_MODE_TRUNCATE_NV = 1, - VK_COVERAGE_REDUCTION_MODE_MAX_ENUM_NV = 0x7FFFFFFF -} VkCoverageReductionModeNV; -typedef VkFlags VkPipelineCoverageReductionStateCreateFlagsNV; -typedef struct VkPhysicalDeviceCoverageReductionModeFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 coverageReductionMode; -} VkPhysicalDeviceCoverageReductionModeFeaturesNV; - -typedef struct VkPipelineCoverageReductionStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineCoverageReductionStateCreateFlagsNV flags; - VkCoverageReductionModeNV coverageReductionMode; -} VkPipelineCoverageReductionStateCreateInfoNV; - -typedef struct VkFramebufferMixedSamplesCombinationNV { - VkStructureType sType; - void* pNext; - VkCoverageReductionModeNV coverageReductionMode; - VkSampleCountFlagBits rasterizationSamples; - VkSampleCountFlags depthStencilSamples; - VkSampleCountFlags colorSamples; -} VkFramebufferMixedSamplesCombinationNV; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV)(VkPhysicalDevice physicalDevice, uint32_t* pCombinationCount, VkFramebufferMixedSamplesCombinationNV* pCombinations); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSupportedFramebufferMixedSamplesCombinationsNV( - VkPhysicalDevice physicalDevice, - uint32_t* pCombinationCount, - VkFramebufferMixedSamplesCombinationNV* pCombinations); -#endif - - -#define VK_EXT_fragment_shader_interlock 1 -#define VK_EXT_FRAGMENT_SHADER_INTERLOCK_SPEC_VERSION 1 -#define VK_EXT_FRAGMENT_SHADER_INTERLOCK_EXTENSION_NAME "VK_EXT_fragment_shader_interlock" -typedef struct VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 fragmentShaderSampleInterlock; - VkBool32 fragmentShaderPixelInterlock; - VkBool32 fragmentShaderShadingRateInterlock; -} VkPhysicalDeviceFragmentShaderInterlockFeaturesEXT; - - - -#define VK_EXT_ycbcr_image_arrays 1 -#define VK_EXT_YCBCR_IMAGE_ARRAYS_SPEC_VERSION 1 -#define VK_EXT_YCBCR_IMAGE_ARRAYS_EXTENSION_NAME "VK_EXT_ycbcr_image_arrays" -typedef struct VkPhysicalDeviceYcbcrImageArraysFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 ycbcrImageArrays; -} VkPhysicalDeviceYcbcrImageArraysFeaturesEXT; - - - -#define VK_EXT_headless_surface 1 -#define VK_EXT_HEADLESS_SURFACE_SPEC_VERSION 1 -#define VK_EXT_HEADLESS_SURFACE_EXTENSION_NAME "VK_EXT_headless_surface" -typedef VkFlags VkHeadlessSurfaceCreateFlagsEXT; -typedef struct VkHeadlessSurfaceCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkHeadlessSurfaceCreateFlagsEXT flags; -} VkHeadlessSurfaceCreateInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateHeadlessSurfaceEXT)(VkInstance instance, const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateHeadlessSurfaceEXT( - VkInstance instance, - const VkHeadlessSurfaceCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); -#endif - - -#define VK_EXT_line_rasterization 1 -#define VK_EXT_LINE_RASTERIZATION_SPEC_VERSION 1 -#define VK_EXT_LINE_RASTERIZATION_EXTENSION_NAME "VK_EXT_line_rasterization" - -typedef enum VkLineRasterizationModeEXT { - VK_LINE_RASTERIZATION_MODE_DEFAULT_EXT = 0, - VK_LINE_RASTERIZATION_MODE_RECTANGULAR_EXT = 1, - VK_LINE_RASTERIZATION_MODE_BRESENHAM_EXT = 2, - VK_LINE_RASTERIZATION_MODE_RECTANGULAR_SMOOTH_EXT = 3, - VK_LINE_RASTERIZATION_MODE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkLineRasterizationModeEXT; -typedef struct VkPhysicalDeviceLineRasterizationFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 rectangularLines; - VkBool32 bresenhamLines; - VkBool32 smoothLines; - VkBool32 stippledRectangularLines; - VkBool32 stippledBresenhamLines; - VkBool32 stippledSmoothLines; -} VkPhysicalDeviceLineRasterizationFeaturesEXT; - -typedef struct VkPhysicalDeviceLineRasterizationPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t lineSubPixelPrecisionBits; -} VkPhysicalDeviceLineRasterizationPropertiesEXT; - -typedef struct VkPipelineRasterizationLineStateCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkLineRasterizationModeEXT lineRasterizationMode; - VkBool32 stippledLineEnable; - uint32_t lineStippleFactor; - uint16_t lineStipplePattern; -} VkPipelineRasterizationLineStateCreateInfoEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetLineStippleEXT)(VkCommandBuffer commandBuffer, uint32_t lineStippleFactor, uint16_t lineStipplePattern); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetLineStippleEXT( - VkCommandBuffer commandBuffer, - uint32_t lineStippleFactor, - uint16_t lineStipplePattern); -#endif - - -#define VK_EXT_shader_atomic_float 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_SPEC_VERSION 1 -#define VK_EXT_SHADER_ATOMIC_FLOAT_EXTENSION_NAME "VK_EXT_shader_atomic_float" -typedef struct VkPhysicalDeviceShaderAtomicFloatFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 shaderBufferFloat32Atomics; - VkBool32 shaderBufferFloat32AtomicAdd; - VkBool32 shaderBufferFloat64Atomics; - VkBool32 shaderBufferFloat64AtomicAdd; - VkBool32 shaderSharedFloat32Atomics; - VkBool32 shaderSharedFloat32AtomicAdd; - VkBool32 shaderSharedFloat64Atomics; - VkBool32 shaderSharedFloat64AtomicAdd; - VkBool32 shaderImageFloat32Atomics; - VkBool32 shaderImageFloat32AtomicAdd; - VkBool32 sparseImageFloat32Atomics; - VkBool32 sparseImageFloat32AtomicAdd; -} VkPhysicalDeviceShaderAtomicFloatFeaturesEXT; - - - -#define VK_EXT_host_query_reset 1 -#define VK_EXT_HOST_QUERY_RESET_SPEC_VERSION 1 -#define VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME "VK_EXT_host_query_reset" -typedef VkPhysicalDeviceHostQueryResetFeatures VkPhysicalDeviceHostQueryResetFeaturesEXT; - -typedef void (VKAPI_PTR *PFN_vkResetQueryPoolEXT)(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkResetQueryPoolEXT( - VkDevice device, - VkQueryPool queryPool, - uint32_t firstQuery, - uint32_t queryCount); -#endif - - -#define VK_EXT_index_type_uint8 1 -#define VK_EXT_INDEX_TYPE_UINT8_SPEC_VERSION 1 -#define VK_EXT_INDEX_TYPE_UINT8_EXTENSION_NAME "VK_EXT_index_type_uint8" -typedef struct VkPhysicalDeviceIndexTypeUint8FeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 indexTypeUint8; -} VkPhysicalDeviceIndexTypeUint8FeaturesEXT; - - - -#define VK_EXT_extended_dynamic_state 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_SPEC_VERSION 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_extended_dynamic_state" -typedef struct VkPhysicalDeviceExtendedDynamicStateFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 extendedDynamicState; -} VkPhysicalDeviceExtendedDynamicStateFeaturesEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetCullModeEXT)(VkCommandBuffer commandBuffer, VkCullModeFlags cullMode); -typedef void (VKAPI_PTR *PFN_vkCmdSetFrontFaceEXT)(VkCommandBuffer commandBuffer, VkFrontFace frontFace); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveTopologyEXT)(VkCommandBuffer commandBuffer, VkPrimitiveTopology primitiveTopology); -typedef void (VKAPI_PTR *PFN_vkCmdSetViewportWithCountEXT)(VkCommandBuffer commandBuffer, uint32_t viewportCount, const VkViewport* pViewports); -typedef void (VKAPI_PTR *PFN_vkCmdSetScissorWithCountEXT)(VkCommandBuffer commandBuffer, uint32_t scissorCount, const VkRect2D* pScissors); -typedef void (VKAPI_PTR *PFN_vkCmdBindVertexBuffers2EXT)(VkCommandBuffer commandBuffer, uint32_t firstBinding, uint32_t bindingCount, const VkBuffer* pBuffers, const VkDeviceSize* pOffsets, const VkDeviceSize* pSizes, const VkDeviceSize* pStrides); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthTestEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthTestEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthWriteEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthWriteEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthCompareOpEXT)(VkCommandBuffer commandBuffer, VkCompareOp depthCompareOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBoundsTestEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthBoundsTestEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilTestEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 stencilTestEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetStencilOpEXT)(VkCommandBuffer commandBuffer, VkStencilFaceFlags faceMask, VkStencilOp failOp, VkStencilOp passOp, VkStencilOp depthFailOp, VkCompareOp compareOp); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetCullModeEXT( - VkCommandBuffer commandBuffer, - VkCullModeFlags cullMode); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetFrontFaceEXT( - VkCommandBuffer commandBuffer, - VkFrontFace frontFace); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveTopologyEXT( - VkCommandBuffer commandBuffer, - VkPrimitiveTopology primitiveTopology); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetViewportWithCountEXT( - VkCommandBuffer commandBuffer, - uint32_t viewportCount, - const VkViewport* pViewports); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetScissorWithCountEXT( - VkCommandBuffer commandBuffer, - uint32_t scissorCount, - const VkRect2D* pScissors); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindVertexBuffers2EXT( - VkCommandBuffer commandBuffer, - uint32_t firstBinding, - uint32_t bindingCount, - const VkBuffer* pBuffers, - const VkDeviceSize* pOffsets, - const VkDeviceSize* pSizes, - const VkDeviceSize* pStrides); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthTestEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 depthTestEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthWriteEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 depthWriteEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthCompareOpEXT( - VkCommandBuffer commandBuffer, - VkCompareOp depthCompareOp); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBoundsTestEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 depthBoundsTestEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilTestEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 stencilTestEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetStencilOpEXT( - VkCommandBuffer commandBuffer, - VkStencilFaceFlags faceMask, - VkStencilOp failOp, - VkStencilOp passOp, - VkStencilOp depthFailOp, - VkCompareOp compareOp); -#endif - - -#define VK_EXT_shader_demote_to_helper_invocation 1 -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_SPEC_VERSION 1 -#define VK_EXT_SHADER_DEMOTE_TO_HELPER_INVOCATION_EXTENSION_NAME "VK_EXT_shader_demote_to_helper_invocation" -typedef struct VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 shaderDemoteToHelperInvocation; -} VkPhysicalDeviceShaderDemoteToHelperInvocationFeaturesEXT; - - - -#define VK_NV_device_generated_commands 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkIndirectCommandsLayoutNV) -#define VK_NV_DEVICE_GENERATED_COMMANDS_SPEC_VERSION 3 -#define VK_NV_DEVICE_GENERATED_COMMANDS_EXTENSION_NAME "VK_NV_device_generated_commands" - -typedef enum VkIndirectCommandsTokenTypeNV { - VK_INDIRECT_COMMANDS_TOKEN_TYPE_SHADER_GROUP_NV = 0, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_STATE_FLAGS_NV = 1, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_INDEX_BUFFER_NV = 2, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_VERTEX_BUFFER_NV = 3, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_PUSH_CONSTANT_NV = 4, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_INDEXED_NV = 5, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_NV = 6, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_DRAW_TASKS_NV = 7, - VK_INDIRECT_COMMANDS_TOKEN_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkIndirectCommandsTokenTypeNV; - -typedef enum VkIndirectStateFlagBitsNV { - VK_INDIRECT_STATE_FLAG_FRONTFACE_BIT_NV = 0x00000001, - VK_INDIRECT_STATE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF -} VkIndirectStateFlagBitsNV; -typedef VkFlags VkIndirectStateFlagsNV; - -typedef enum VkIndirectCommandsLayoutUsageFlagBitsNV { - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_EXPLICIT_PREPROCESS_BIT_NV = 0x00000001, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_INDEXED_SEQUENCES_BIT_NV = 0x00000002, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_UNORDERED_SEQUENCES_BIT_NV = 0x00000004, - VK_INDIRECT_COMMANDS_LAYOUT_USAGE_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF -} VkIndirectCommandsLayoutUsageFlagBitsNV; -typedef VkFlags VkIndirectCommandsLayoutUsageFlagsNV; -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV { - VkStructureType sType; - void* pNext; - uint32_t maxGraphicsShaderGroupCount; - uint32_t maxIndirectSequenceCount; - uint32_t maxIndirectCommandsTokenCount; - uint32_t maxIndirectCommandsStreamCount; - uint32_t maxIndirectCommandsTokenOffset; - uint32_t maxIndirectCommandsStreamStride; - uint32_t minSequencesCountBufferOffsetAlignment; - uint32_t minSequencesIndexBufferOffsetAlignment; - uint32_t minIndirectCommandsBufferOffsetAlignment; -} VkPhysicalDeviceDeviceGeneratedCommandsPropertiesNV; - -typedef struct VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 deviceGeneratedCommands; -} VkPhysicalDeviceDeviceGeneratedCommandsFeaturesNV; - -typedef struct VkGraphicsShaderGroupCreateInfoNV { - VkStructureType sType; - const void* pNext; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo* pStages; - const VkPipelineVertexInputStateCreateInfo* pVertexInputState; - const VkPipelineTessellationStateCreateInfo* pTessellationState; -} VkGraphicsShaderGroupCreateInfoNV; - -typedef struct VkGraphicsPipelineShaderGroupsCreateInfoNV { - VkStructureType sType; - const void* pNext; - uint32_t groupCount; - const VkGraphicsShaderGroupCreateInfoNV* pGroups; - uint32_t pipelineCount; - const VkPipeline* pPipelines; -} VkGraphicsPipelineShaderGroupsCreateInfoNV; - -typedef struct VkBindShaderGroupIndirectCommandNV { - uint32_t groupIndex; -} VkBindShaderGroupIndirectCommandNV; - -typedef struct VkBindIndexBufferIndirectCommandNV { - VkDeviceAddress bufferAddress; - uint32_t size; - VkIndexType indexType; -} VkBindIndexBufferIndirectCommandNV; - -typedef struct VkBindVertexBufferIndirectCommandNV { - VkDeviceAddress bufferAddress; - uint32_t size; - uint32_t stride; -} VkBindVertexBufferIndirectCommandNV; - -typedef struct VkSetStateFlagsIndirectCommandNV { - uint32_t data; -} VkSetStateFlagsIndirectCommandNV; - -typedef struct VkIndirectCommandsStreamNV { - VkBuffer buffer; - VkDeviceSize offset; -} VkIndirectCommandsStreamNV; - -typedef struct VkIndirectCommandsLayoutTokenNV { - VkStructureType sType; - const void* pNext; - VkIndirectCommandsTokenTypeNV tokenType; - uint32_t stream; - uint32_t offset; - uint32_t vertexBindingUnit; - VkBool32 vertexDynamicStride; - VkPipelineLayout pushconstantPipelineLayout; - VkShaderStageFlags pushconstantShaderStageFlags; - uint32_t pushconstantOffset; - uint32_t pushconstantSize; - VkIndirectStateFlagsNV indirectStateFlags; - uint32_t indexTypeCount; - const VkIndexType* pIndexTypes; - const uint32_t* pIndexTypeValues; -} VkIndirectCommandsLayoutTokenNV; - -typedef struct VkIndirectCommandsLayoutCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkIndirectCommandsLayoutUsageFlagsNV flags; - VkPipelineBindPoint pipelineBindPoint; - uint32_t tokenCount; - const VkIndirectCommandsLayoutTokenNV* pTokens; - uint32_t streamCount; - const uint32_t* pStreamStrides; -} VkIndirectCommandsLayoutCreateInfoNV; - -typedef struct VkGeneratedCommandsInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline pipeline; - VkIndirectCommandsLayoutNV indirectCommandsLayout; - uint32_t streamCount; - const VkIndirectCommandsStreamNV* pStreams; - uint32_t sequencesCount; - VkBuffer preprocessBuffer; - VkDeviceSize preprocessOffset; - VkDeviceSize preprocessSize; - VkBuffer sequencesCountBuffer; - VkDeviceSize sequencesCountOffset; - VkBuffer sequencesIndexBuffer; - VkDeviceSize sequencesIndexOffset; -} VkGeneratedCommandsInfoNV; - -typedef struct VkGeneratedCommandsMemoryRequirementsInfoNV { - VkStructureType sType; - const void* pNext; - VkPipelineBindPoint pipelineBindPoint; - VkPipeline pipeline; - VkIndirectCommandsLayoutNV indirectCommandsLayout; - uint32_t maxSequencesCount; -} VkGeneratedCommandsMemoryRequirementsInfoNV; - -typedef void (VKAPI_PTR *PFN_vkGetGeneratedCommandsMemoryRequirementsNV)(VkDevice device, const VkGeneratedCommandsMemoryRequirementsInfoNV* pInfo, VkMemoryRequirements2* pMemoryRequirements); -typedef void (VKAPI_PTR *PFN_vkCmdPreprocessGeneratedCommandsNV)(VkCommandBuffer commandBuffer, const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo); -typedef void (VKAPI_PTR *PFN_vkCmdExecuteGeneratedCommandsNV)(VkCommandBuffer commandBuffer, VkBool32 isPreprocessed, const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo); -typedef void (VKAPI_PTR *PFN_vkCmdBindPipelineShaderGroupNV)(VkCommandBuffer commandBuffer, VkPipelineBindPoint pipelineBindPoint, VkPipeline pipeline, uint32_t groupIndex); -typedef VkResult (VKAPI_PTR *PFN_vkCreateIndirectCommandsLayoutNV)(VkDevice device, const VkIndirectCommandsLayoutCreateInfoNV* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkIndirectCommandsLayoutNV* pIndirectCommandsLayout); -typedef void (VKAPI_PTR *PFN_vkDestroyIndirectCommandsLayoutNV)(VkDevice device, VkIndirectCommandsLayoutNV indirectCommandsLayout, const VkAllocationCallbacks* pAllocator); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkGetGeneratedCommandsMemoryRequirementsNV( - VkDevice device, - const VkGeneratedCommandsMemoryRequirementsInfoNV* pInfo, - VkMemoryRequirements2* pMemoryRequirements); - -VKAPI_ATTR void VKAPI_CALL vkCmdPreprocessGeneratedCommandsNV( - VkCommandBuffer commandBuffer, - const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdExecuteGeneratedCommandsNV( - VkCommandBuffer commandBuffer, - VkBool32 isPreprocessed, - const VkGeneratedCommandsInfoNV* pGeneratedCommandsInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdBindPipelineShaderGroupNV( - VkCommandBuffer commandBuffer, - VkPipelineBindPoint pipelineBindPoint, - VkPipeline pipeline, - uint32_t groupIndex); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateIndirectCommandsLayoutNV( - VkDevice device, - const VkIndirectCommandsLayoutCreateInfoNV* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkIndirectCommandsLayoutNV* pIndirectCommandsLayout); - -VKAPI_ATTR void VKAPI_CALL vkDestroyIndirectCommandsLayoutNV( - VkDevice device, - VkIndirectCommandsLayoutNV indirectCommandsLayout, - const VkAllocationCallbacks* pAllocator); -#endif - - -#define VK_NV_inherited_viewport_scissor 1 -#define VK_NV_INHERITED_VIEWPORT_SCISSOR_SPEC_VERSION 1 -#define VK_NV_INHERITED_VIEWPORT_SCISSOR_EXTENSION_NAME "VK_NV_inherited_viewport_scissor" -typedef struct VkPhysicalDeviceInheritedViewportScissorFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 inheritedViewportScissor2D; -} VkPhysicalDeviceInheritedViewportScissorFeaturesNV; - -typedef struct VkCommandBufferInheritanceViewportScissorInfoNV { - VkStructureType sType; - const void* pNext; - VkBool32 viewportScissor2D; - uint32_t viewportDepthCount; - const VkViewport* pViewportDepths; -} VkCommandBufferInheritanceViewportScissorInfoNV; - - - -#define VK_EXT_texel_buffer_alignment 1 -#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_SPEC_VERSION 1 -#define VK_EXT_TEXEL_BUFFER_ALIGNMENT_EXTENSION_NAME "VK_EXT_texel_buffer_alignment" -typedef struct VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 texelBufferAlignment; -} VkPhysicalDeviceTexelBufferAlignmentFeaturesEXT; - -typedef struct VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT { - VkStructureType sType; - void* pNext; - VkDeviceSize storageTexelBufferOffsetAlignmentBytes; - VkBool32 storageTexelBufferOffsetSingleTexelAlignment; - VkDeviceSize uniformTexelBufferOffsetAlignmentBytes; - VkBool32 uniformTexelBufferOffsetSingleTexelAlignment; -} VkPhysicalDeviceTexelBufferAlignmentPropertiesEXT; - - - -#define VK_QCOM_render_pass_transform 1 -#define VK_QCOM_RENDER_PASS_TRANSFORM_SPEC_VERSION 2 -#define VK_QCOM_RENDER_PASS_TRANSFORM_EXTENSION_NAME "VK_QCOM_render_pass_transform" -typedef struct VkRenderPassTransformBeginInfoQCOM { - VkStructureType sType; - void* pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkRenderPassTransformBeginInfoQCOM; - -typedef struct VkCommandBufferInheritanceRenderPassTransformInfoQCOM { - VkStructureType sType; - void* pNext; - VkSurfaceTransformFlagBitsKHR transform; - VkRect2D renderArea; -} VkCommandBufferInheritanceRenderPassTransformInfoQCOM; - - - -#define VK_EXT_device_memory_report 1 -#define VK_EXT_DEVICE_MEMORY_REPORT_SPEC_VERSION 2 -#define VK_EXT_DEVICE_MEMORY_REPORT_EXTENSION_NAME "VK_EXT_device_memory_report" - -typedef enum VkDeviceMemoryReportEventTypeEXT { - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATE_EXT = 0, - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_FREE_EXT = 1, - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_IMPORT_EXT = 2, - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_UNIMPORT_EXT = 3, - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_ALLOCATION_FAILED_EXT = 4, - VK_DEVICE_MEMORY_REPORT_EVENT_TYPE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkDeviceMemoryReportEventTypeEXT; -typedef VkFlags VkDeviceMemoryReportFlagsEXT; -typedef struct VkPhysicalDeviceDeviceMemoryReportFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 deviceMemoryReport; -} VkPhysicalDeviceDeviceMemoryReportFeaturesEXT; - -typedef struct VkDeviceMemoryReportCallbackDataEXT { - VkStructureType sType; - const void* pNext; - VkDeviceMemoryReportFlagsEXT flags; - VkDeviceMemoryReportEventTypeEXT type; - uint64_t memoryObjectId; - VkDeviceSize size; - VkObjectType objectType; - uint64_t objectHandle; - uint32_t heapIndex; -} VkDeviceMemoryReportCallbackDataEXT; - -typedef void (VKAPI_PTR *PFN_vkDeviceMemoryReportCallbackEXT)( - const VkDeviceMemoryReportCallbackDataEXT* pCallbackData, - void* pUserData); - -typedef struct VkDeviceDeviceMemoryReportCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkDeviceMemoryReportFlagsEXT flags; - PFN_vkDeviceMemoryReportCallbackEXT pfnUserCallback; - void* pUserData; -} VkDeviceDeviceMemoryReportCreateInfoEXT; - - - -#define VK_EXT_robustness2 1 -#define VK_EXT_ROBUSTNESS_2_SPEC_VERSION 1 -#define VK_EXT_ROBUSTNESS_2_EXTENSION_NAME "VK_EXT_robustness2" -typedef struct VkPhysicalDeviceRobustness2FeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 robustBufferAccess2; - VkBool32 robustImageAccess2; - VkBool32 nullDescriptor; -} VkPhysicalDeviceRobustness2FeaturesEXT; - -typedef struct VkPhysicalDeviceRobustness2PropertiesEXT { - VkStructureType sType; - void* pNext; - VkDeviceSize robustStorageBufferAccessSizeAlignment; - VkDeviceSize robustUniformBufferAccessSizeAlignment; -} VkPhysicalDeviceRobustness2PropertiesEXT; - - - -#define VK_EXT_custom_border_color 1 -#define VK_EXT_CUSTOM_BORDER_COLOR_SPEC_VERSION 12 -#define VK_EXT_CUSTOM_BORDER_COLOR_EXTENSION_NAME "VK_EXT_custom_border_color" -typedef struct VkSamplerCustomBorderColorCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkClearColorValue customBorderColor; - VkFormat format; -} VkSamplerCustomBorderColorCreateInfoEXT; - -typedef struct VkPhysicalDeviceCustomBorderColorPropertiesEXT { - VkStructureType sType; - void* pNext; - uint32_t maxCustomBorderColorSamplers; -} VkPhysicalDeviceCustomBorderColorPropertiesEXT; - -typedef struct VkPhysicalDeviceCustomBorderColorFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 customBorderColors; - VkBool32 customBorderColorWithoutFormat; -} VkPhysicalDeviceCustomBorderColorFeaturesEXT; - - - -#define VK_GOOGLE_user_type 1 -#define VK_GOOGLE_USER_TYPE_SPEC_VERSION 1 -#define VK_GOOGLE_USER_TYPE_EXTENSION_NAME "VK_GOOGLE_user_type" - - -#define VK_EXT_private_data 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkPrivateDataSlotEXT) -#define VK_EXT_PRIVATE_DATA_SPEC_VERSION 1 -#define VK_EXT_PRIVATE_DATA_EXTENSION_NAME "VK_EXT_private_data" - -typedef enum VkPrivateDataSlotCreateFlagBitsEXT { - VK_PRIVATE_DATA_SLOT_CREATE_FLAG_BITS_MAX_ENUM_EXT = 0x7FFFFFFF -} VkPrivateDataSlotCreateFlagBitsEXT; -typedef VkFlags VkPrivateDataSlotCreateFlagsEXT; -typedef struct VkPhysicalDevicePrivateDataFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 privateData; -} VkPhysicalDevicePrivateDataFeaturesEXT; - -typedef struct VkDevicePrivateDataCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t privateDataSlotRequestCount; -} VkDevicePrivateDataCreateInfoEXT; - -typedef struct VkPrivateDataSlotCreateInfoEXT { - VkStructureType sType; - const void* pNext; - VkPrivateDataSlotCreateFlagsEXT flags; -} VkPrivateDataSlotCreateInfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkCreatePrivateDataSlotEXT)(VkDevice device, const VkPrivateDataSlotCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkPrivateDataSlotEXT* pPrivateDataSlot); -typedef void (VKAPI_PTR *PFN_vkDestroyPrivateDataSlotEXT)(VkDevice device, VkPrivateDataSlotEXT privateDataSlot, const VkAllocationCallbacks* pAllocator); -typedef VkResult (VKAPI_PTR *PFN_vkSetPrivateDataEXT)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t data); -typedef void (VKAPI_PTR *PFN_vkGetPrivateDataEXT)(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t* pData); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreatePrivateDataSlotEXT( - VkDevice device, - const VkPrivateDataSlotCreateInfoEXT* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkPrivateDataSlotEXT* pPrivateDataSlot); - -VKAPI_ATTR void VKAPI_CALL vkDestroyPrivateDataSlotEXT( - VkDevice device, - VkPrivateDataSlotEXT privateDataSlot, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR VkResult VKAPI_CALL vkSetPrivateDataEXT( - VkDevice device, - VkObjectType objectType, - uint64_t objectHandle, - VkPrivateDataSlotEXT privateDataSlot, - uint64_t data); - -VKAPI_ATTR void VKAPI_CALL vkGetPrivateDataEXT( - VkDevice device, - VkObjectType objectType, - uint64_t objectHandle, - VkPrivateDataSlotEXT privateDataSlot, - uint64_t* pData); -#endif - - -#define VK_EXT_pipeline_creation_cache_control 1 -#define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_SPEC_VERSION 3 -#define VK_EXT_PIPELINE_CREATION_CACHE_CONTROL_EXTENSION_NAME "VK_EXT_pipeline_creation_cache_control" -typedef struct VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 pipelineCreationCacheControl; -} VkPhysicalDevicePipelineCreationCacheControlFeaturesEXT; - - - -#define VK_NV_device_diagnostics_config 1 -#define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_SPEC_VERSION 1 -#define VK_NV_DEVICE_DIAGNOSTICS_CONFIG_EXTENSION_NAME "VK_NV_device_diagnostics_config" - -typedef enum VkDeviceDiagnosticsConfigFlagBitsNV { - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_SHADER_DEBUG_INFO_BIT_NV = 0x00000001, - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_RESOURCE_TRACKING_BIT_NV = 0x00000002, - VK_DEVICE_DIAGNOSTICS_CONFIG_ENABLE_AUTOMATIC_CHECKPOINTS_BIT_NV = 0x00000004, - VK_DEVICE_DIAGNOSTICS_CONFIG_FLAG_BITS_MAX_ENUM_NV = 0x7FFFFFFF -} VkDeviceDiagnosticsConfigFlagBitsNV; -typedef VkFlags VkDeviceDiagnosticsConfigFlagsNV; -typedef struct VkPhysicalDeviceDiagnosticsConfigFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 diagnosticsConfig; -} VkPhysicalDeviceDiagnosticsConfigFeaturesNV; - -typedef struct VkDeviceDiagnosticsConfigCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkDeviceDiagnosticsConfigFlagsNV flags; -} VkDeviceDiagnosticsConfigCreateInfoNV; - - - -#define VK_QCOM_render_pass_store_ops 1 -#define VK_QCOM_render_pass_store_ops_SPEC_VERSION 2 -#define VK_QCOM_render_pass_store_ops_EXTENSION_NAME "VK_QCOM_render_pass_store_ops" - - -#define VK_NV_fragment_shading_rate_enums 1 -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_SPEC_VERSION 1 -#define VK_NV_FRAGMENT_SHADING_RATE_ENUMS_EXTENSION_NAME "VK_NV_fragment_shading_rate_enums" - -typedef enum VkFragmentShadingRateTypeNV { - VK_FRAGMENT_SHADING_RATE_TYPE_FRAGMENT_SIZE_NV = 0, - VK_FRAGMENT_SHADING_RATE_TYPE_ENUMS_NV = 1, - VK_FRAGMENT_SHADING_RATE_TYPE_MAX_ENUM_NV = 0x7FFFFFFF -} VkFragmentShadingRateTypeNV; - -typedef enum VkFragmentShadingRateNV { - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_PIXEL_NV = 0, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_1X2_PIXELS_NV = 1, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X1_PIXELS_NV = 4, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X2_PIXELS_NV = 5, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_2X4_PIXELS_NV = 6, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X2_PIXELS_NV = 9, - VK_FRAGMENT_SHADING_RATE_1_INVOCATION_PER_4X4_PIXELS_NV = 10, - VK_FRAGMENT_SHADING_RATE_2_INVOCATIONS_PER_PIXEL_NV = 11, - VK_FRAGMENT_SHADING_RATE_4_INVOCATIONS_PER_PIXEL_NV = 12, - VK_FRAGMENT_SHADING_RATE_8_INVOCATIONS_PER_PIXEL_NV = 13, - VK_FRAGMENT_SHADING_RATE_16_INVOCATIONS_PER_PIXEL_NV = 14, - VK_FRAGMENT_SHADING_RATE_NO_INVOCATIONS_NV = 15, - VK_FRAGMENT_SHADING_RATE_MAX_ENUM_NV = 0x7FFFFFFF -} VkFragmentShadingRateNV; -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV { - VkStructureType sType; - void* pNext; - VkBool32 fragmentShadingRateEnums; - VkBool32 supersampleFragmentShadingRates; - VkBool32 noInvocationFragmentShadingRates; -} VkPhysicalDeviceFragmentShadingRateEnumsFeaturesNV; - -typedef struct VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV { - VkStructureType sType; - void* pNext; - VkSampleCountFlagBits maxFragmentShadingRateInvocationCount; -} VkPhysicalDeviceFragmentShadingRateEnumsPropertiesNV; - -typedef struct VkPipelineFragmentShadingRateEnumStateCreateInfoNV { - VkStructureType sType; - const void* pNext; - VkFragmentShadingRateTypeNV shadingRateType; - VkFragmentShadingRateNV shadingRate; - VkFragmentShadingRateCombinerOpKHR combinerOps[2]; -} VkPipelineFragmentShadingRateEnumStateCreateInfoNV; - -typedef void (VKAPI_PTR *PFN_vkCmdSetFragmentShadingRateEnumNV)(VkCommandBuffer commandBuffer, VkFragmentShadingRateNV shadingRate, const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetFragmentShadingRateEnumNV( - VkCommandBuffer commandBuffer, - VkFragmentShadingRateNV shadingRate, - const VkFragmentShadingRateCombinerOpKHR combinerOps[2]); -#endif - - -#define VK_EXT_ycbcr_2plane_444_formats 1 -#define VK_EXT_YCBCR_2PLANE_444_FORMATS_SPEC_VERSION 1 -#define VK_EXT_YCBCR_2PLANE_444_FORMATS_EXTENSION_NAME "VK_EXT_ycbcr_2plane_444_formats" -typedef struct VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 ycbcr2plane444Formats; -} VkPhysicalDeviceYcbcr2Plane444FormatsFeaturesEXT; - - - -#define VK_EXT_fragment_density_map2 1 -#define VK_EXT_FRAGMENT_DENSITY_MAP_2_SPEC_VERSION 1 -#define VK_EXT_FRAGMENT_DENSITY_MAP_2_EXTENSION_NAME "VK_EXT_fragment_density_map2" -typedef struct VkPhysicalDeviceFragmentDensityMap2FeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 fragmentDensityMapDeferred; -} VkPhysicalDeviceFragmentDensityMap2FeaturesEXT; - -typedef struct VkPhysicalDeviceFragmentDensityMap2PropertiesEXT { - VkStructureType sType; - void* pNext; - VkBool32 subsampledLoads; - VkBool32 subsampledCoarseReconstructionEarlyAccess; - uint32_t maxSubsampledArrayLayers; - uint32_t maxDescriptorSetSubsampledSamplers; -} VkPhysicalDeviceFragmentDensityMap2PropertiesEXT; - - - -#define VK_QCOM_rotated_copy_commands 1 -#define VK_QCOM_ROTATED_COPY_COMMANDS_SPEC_VERSION 1 -#define VK_QCOM_ROTATED_COPY_COMMANDS_EXTENSION_NAME "VK_QCOM_rotated_copy_commands" -typedef struct VkCopyCommandTransformInfoQCOM { - VkStructureType sType; - const void* pNext; - VkSurfaceTransformFlagBitsKHR transform; -} VkCopyCommandTransformInfoQCOM; - - - -#define VK_EXT_image_robustness 1 -#define VK_EXT_IMAGE_ROBUSTNESS_SPEC_VERSION 1 -#define VK_EXT_IMAGE_ROBUSTNESS_EXTENSION_NAME "VK_EXT_image_robustness" -typedef struct VkPhysicalDeviceImageRobustnessFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 robustImageAccess; -} VkPhysicalDeviceImageRobustnessFeaturesEXT; - - - -#define VK_EXT_4444_formats 1 -#define VK_EXT_4444_FORMATS_SPEC_VERSION 1 -#define VK_EXT_4444_FORMATS_EXTENSION_NAME "VK_EXT_4444_formats" -typedef struct VkPhysicalDevice4444FormatsFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 formatA4R4G4B4; - VkBool32 formatA4B4G4R4; -} VkPhysicalDevice4444FormatsFeaturesEXT; - - - -#define VK_NV_acquire_winrt_display 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_SPEC_VERSION 1 -#define VK_NV_ACQUIRE_WINRT_DISPLAY_EXTENSION_NAME "VK_NV_acquire_winrt_display" -typedef VkResult (VKAPI_PTR *PFN_vkAcquireWinrtDisplayNV)(VkPhysicalDevice physicalDevice, VkDisplayKHR display); -typedef VkResult (VKAPI_PTR *PFN_vkGetWinrtDisplayNV)(VkPhysicalDevice physicalDevice, uint32_t deviceRelativeId, VkDisplayKHR* pDisplay); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - VkDisplayKHR display); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetWinrtDisplayNV( - VkPhysicalDevice physicalDevice, - uint32_t deviceRelativeId, - VkDisplayKHR* pDisplay); -#endif - - -#define VK_VALVE_mutable_descriptor_type 1 -#define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_SPEC_VERSION 1 -#define VK_VALVE_MUTABLE_DESCRIPTOR_TYPE_EXTENSION_NAME "VK_VALVE_mutable_descriptor_type" -typedef struct VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE { - VkStructureType sType; - void* pNext; - VkBool32 mutableDescriptorType; -} VkPhysicalDeviceMutableDescriptorTypeFeaturesVALVE; - -typedef struct VkMutableDescriptorTypeListVALVE { - uint32_t descriptorTypeCount; - const VkDescriptorType* pDescriptorTypes; -} VkMutableDescriptorTypeListVALVE; - -typedef struct VkMutableDescriptorTypeCreateInfoVALVE { - VkStructureType sType; - const void* pNext; - uint32_t mutableDescriptorTypeListCount; - const VkMutableDescriptorTypeListVALVE* pMutableDescriptorTypeLists; -} VkMutableDescriptorTypeCreateInfoVALVE; - - - -#define VK_EXT_vertex_input_dynamic_state 1 -#define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_SPEC_VERSION 2 -#define VK_EXT_VERTEX_INPUT_DYNAMIC_STATE_EXTENSION_NAME "VK_EXT_vertex_input_dynamic_state" -typedef struct VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 vertexInputDynamicState; -} VkPhysicalDeviceVertexInputDynamicStateFeaturesEXT; - -typedef struct VkVertexInputBindingDescription2EXT { - VkStructureType sType; - void* pNext; - uint32_t binding; - uint32_t stride; - VkVertexInputRate inputRate; - uint32_t divisor; -} VkVertexInputBindingDescription2EXT; - -typedef struct VkVertexInputAttributeDescription2EXT { - VkStructureType sType; - void* pNext; - uint32_t location; - uint32_t binding; - VkFormat format; - uint32_t offset; -} VkVertexInputAttributeDescription2EXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetVertexInputEXT)(VkCommandBuffer commandBuffer, uint32_t vertexBindingDescriptionCount, const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions, uint32_t vertexAttributeDescriptionCount, const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetVertexInputEXT( - VkCommandBuffer commandBuffer, - uint32_t vertexBindingDescriptionCount, - const VkVertexInputBindingDescription2EXT* pVertexBindingDescriptions, - uint32_t vertexAttributeDescriptionCount, - const VkVertexInputAttributeDescription2EXT* pVertexAttributeDescriptions); -#endif - - -#define VK_EXT_extended_dynamic_state2 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_2_SPEC_VERSION 1 -#define VK_EXT_EXTENDED_DYNAMIC_STATE_2_EXTENSION_NAME "VK_EXT_extended_dynamic_state2" -typedef struct VkPhysicalDeviceExtendedDynamicState2FeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 extendedDynamicState2; - VkBool32 extendedDynamicState2LogicOp; - VkBool32 extendedDynamicState2PatchControlPoints; -} VkPhysicalDeviceExtendedDynamicState2FeaturesEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetPatchControlPointsEXT)(VkCommandBuffer commandBuffer, uint32_t patchControlPoints); -typedef void (VKAPI_PTR *PFN_vkCmdSetRasterizerDiscardEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 rasterizerDiscardEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetDepthBiasEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 depthBiasEnable); -typedef void (VKAPI_PTR *PFN_vkCmdSetLogicOpEXT)(VkCommandBuffer commandBuffer, VkLogicOp logicOp); -typedef void (VKAPI_PTR *PFN_vkCmdSetPrimitiveRestartEnableEXT)(VkCommandBuffer commandBuffer, VkBool32 primitiveRestartEnable); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetPatchControlPointsEXT( - VkCommandBuffer commandBuffer, - uint32_t patchControlPoints); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetRasterizerDiscardEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 rasterizerDiscardEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetDepthBiasEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 depthBiasEnable); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetLogicOpEXT( - VkCommandBuffer commandBuffer, - VkLogicOp logicOp); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetPrimitiveRestartEnableEXT( - VkCommandBuffer commandBuffer, - VkBool32 primitiveRestartEnable); -#endif - - -#define VK_EXT_color_write_enable 1 -#define VK_EXT_COLOR_WRITE_ENABLE_SPEC_VERSION 1 -#define VK_EXT_COLOR_WRITE_ENABLE_EXTENSION_NAME "VK_EXT_color_write_enable" -typedef struct VkPhysicalDeviceColorWriteEnableFeaturesEXT { - VkStructureType sType; - void* pNext; - VkBool32 colorWriteEnable; -} VkPhysicalDeviceColorWriteEnableFeaturesEXT; - -typedef struct VkPipelineColorWriteCreateInfoEXT { - VkStructureType sType; - const void* pNext; - uint32_t attachmentCount; - const VkBool32* pColorWriteEnables; -} VkPipelineColorWriteCreateInfoEXT; - -typedef void (VKAPI_PTR *PFN_vkCmdSetColorWriteEnableEXT)(VkCommandBuffer commandBuffer, uint32_t attachmentCount, const VkBool32* pColorWriteEnables); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdSetColorWriteEnableEXT( - VkCommandBuffer commandBuffer, - uint32_t attachmentCount, - const VkBool32* pColorWriteEnables); -#endif - - -#define VK_KHR_acceleration_structure 1 -VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkAccelerationStructureKHR) -#define VK_KHR_ACCELERATION_STRUCTURE_SPEC_VERSION 11 -#define VK_KHR_ACCELERATION_STRUCTURE_EXTENSION_NAME "VK_KHR_acceleration_structure" - -typedef enum VkBuildAccelerationStructureModeKHR { - VK_BUILD_ACCELERATION_STRUCTURE_MODE_BUILD_KHR = 0, - VK_BUILD_ACCELERATION_STRUCTURE_MODE_UPDATE_KHR = 1, - VK_BUILD_ACCELERATION_STRUCTURE_MODE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkBuildAccelerationStructureModeKHR; - -typedef enum VkAccelerationStructureBuildTypeKHR { - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_KHR = 0, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_DEVICE_KHR = 1, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_HOST_OR_DEVICE_KHR = 2, - VK_ACCELERATION_STRUCTURE_BUILD_TYPE_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureBuildTypeKHR; - -typedef enum VkAccelerationStructureCompatibilityKHR { - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_COMPATIBLE_KHR = 0, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_INCOMPATIBLE_KHR = 1, - VK_ACCELERATION_STRUCTURE_COMPATIBILITY_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureCompatibilityKHR; - -typedef enum VkAccelerationStructureCreateFlagBitsKHR { - VK_ACCELERATION_STRUCTURE_CREATE_DEVICE_ADDRESS_CAPTURE_REPLAY_BIT_KHR = 0x00000001, - VK_ACCELERATION_STRUCTURE_CREATE_FLAG_BITS_MAX_ENUM_KHR = 0x7FFFFFFF -} VkAccelerationStructureCreateFlagBitsKHR; -typedef VkFlags VkAccelerationStructureCreateFlagsKHR; -typedef union VkDeviceOrHostAddressKHR { - VkDeviceAddress deviceAddress; - void* hostAddress; -} VkDeviceOrHostAddressKHR; - -typedef union VkDeviceOrHostAddressConstKHR { - VkDeviceAddress deviceAddress; - const void* hostAddress; -} VkDeviceOrHostAddressConstKHR; - -typedef struct VkAccelerationStructureBuildRangeInfoKHR { - uint32_t primitiveCount; - uint32_t primitiveOffset; - uint32_t firstVertex; - uint32_t transformOffset; -} VkAccelerationStructureBuildRangeInfoKHR; - -typedef struct VkAccelerationStructureGeometryTrianglesDataKHR { - VkStructureType sType; - const void* pNext; - VkFormat vertexFormat; - VkDeviceOrHostAddressConstKHR vertexData; - VkDeviceSize vertexStride; - uint32_t maxVertex; - VkIndexType indexType; - VkDeviceOrHostAddressConstKHR indexData; - VkDeviceOrHostAddressConstKHR transformData; -} VkAccelerationStructureGeometryTrianglesDataKHR; - -typedef struct VkAccelerationStructureGeometryAabbsDataKHR { - VkStructureType sType; - const void* pNext; - VkDeviceOrHostAddressConstKHR data; - VkDeviceSize stride; -} VkAccelerationStructureGeometryAabbsDataKHR; - -typedef struct VkAccelerationStructureGeometryInstancesDataKHR { - VkStructureType sType; - const void* pNext; - VkBool32 arrayOfPointers; - VkDeviceOrHostAddressConstKHR data; -} VkAccelerationStructureGeometryInstancesDataKHR; - -typedef union VkAccelerationStructureGeometryDataKHR { - VkAccelerationStructureGeometryTrianglesDataKHR triangles; - VkAccelerationStructureGeometryAabbsDataKHR aabbs; - VkAccelerationStructureGeometryInstancesDataKHR instances; -} VkAccelerationStructureGeometryDataKHR; - -typedef struct VkAccelerationStructureGeometryKHR { - VkStructureType sType; - const void* pNext; - VkGeometryTypeKHR geometryType; - VkAccelerationStructureGeometryDataKHR geometry; - VkGeometryFlagsKHR flags; -} VkAccelerationStructureGeometryKHR; - -typedef struct VkAccelerationStructureBuildGeometryInfoKHR { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureTypeKHR type; - VkBuildAccelerationStructureFlagsKHR flags; - VkBuildAccelerationStructureModeKHR mode; - VkAccelerationStructureKHR srcAccelerationStructure; - VkAccelerationStructureKHR dstAccelerationStructure; - uint32_t geometryCount; - const VkAccelerationStructureGeometryKHR* pGeometries; - const VkAccelerationStructureGeometryKHR* const* ppGeometries; - VkDeviceOrHostAddressKHR scratchData; -} VkAccelerationStructureBuildGeometryInfoKHR; - -typedef struct VkAccelerationStructureCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureCreateFlagsKHR createFlags; - VkBuffer buffer; - VkDeviceSize offset; - VkDeviceSize size; - VkAccelerationStructureTypeKHR type; - VkDeviceAddress deviceAddress; -} VkAccelerationStructureCreateInfoKHR; - -typedef struct VkWriteDescriptorSetAccelerationStructureKHR { - VkStructureType sType; - const void* pNext; - uint32_t accelerationStructureCount; - const VkAccelerationStructureKHR* pAccelerationStructures; -} VkWriteDescriptorSetAccelerationStructureKHR; - -typedef struct VkPhysicalDeviceAccelerationStructureFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 accelerationStructure; - VkBool32 accelerationStructureCaptureReplay; - VkBool32 accelerationStructureIndirectBuild; - VkBool32 accelerationStructureHostCommands; - VkBool32 descriptorBindingAccelerationStructureUpdateAfterBind; -} VkPhysicalDeviceAccelerationStructureFeaturesKHR; - -typedef struct VkPhysicalDeviceAccelerationStructurePropertiesKHR { - VkStructureType sType; - void* pNext; - uint64_t maxGeometryCount; - uint64_t maxInstanceCount; - uint64_t maxPrimitiveCount; - uint32_t maxPerStageDescriptorAccelerationStructures; - uint32_t maxPerStageDescriptorUpdateAfterBindAccelerationStructures; - uint32_t maxDescriptorSetAccelerationStructures; - uint32_t maxDescriptorSetUpdateAfterBindAccelerationStructures; - uint32_t minAccelerationStructureScratchOffsetAlignment; -} VkPhysicalDeviceAccelerationStructurePropertiesKHR; - -typedef struct VkAccelerationStructureDeviceAddressInfoKHR { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureKHR accelerationStructure; -} VkAccelerationStructureDeviceAddressInfoKHR; - -typedef struct VkAccelerationStructureVersionInfoKHR { - VkStructureType sType; - const void* pNext; - const uint8_t* pVersionData; -} VkAccelerationStructureVersionInfoKHR; - -typedef struct VkCopyAccelerationStructureToMemoryInfoKHR { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureKHR src; - VkDeviceOrHostAddressKHR dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureToMemoryInfoKHR; - -typedef struct VkCopyMemoryToAccelerationStructureInfoKHR { - VkStructureType sType; - const void* pNext; - VkDeviceOrHostAddressConstKHR src; - VkAccelerationStructureKHR dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyMemoryToAccelerationStructureInfoKHR; - -typedef struct VkCopyAccelerationStructureInfoKHR { - VkStructureType sType; - const void* pNext; - VkAccelerationStructureKHR src; - VkAccelerationStructureKHR dst; - VkCopyAccelerationStructureModeKHR mode; -} VkCopyAccelerationStructureInfoKHR; - -typedef struct VkAccelerationStructureBuildSizesInfoKHR { - VkStructureType sType; - const void* pNext; - VkDeviceSize accelerationStructureSize; - VkDeviceSize updateScratchSize; - VkDeviceSize buildScratchSize; -} VkAccelerationStructureBuildSizesInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateAccelerationStructureKHR)(VkDevice device, const VkAccelerationStructureCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkAccelerationStructureKHR* pAccelerationStructure); -typedef void (VKAPI_PTR *PFN_vkDestroyAccelerationStructureKHR)(VkDevice device, VkAccelerationStructureKHR accelerationStructure, const VkAllocationCallbacks* pAllocator); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructuresKHR)(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos); -typedef void (VKAPI_PTR *PFN_vkCmdBuildAccelerationStructuresIndirectKHR)(VkCommandBuffer commandBuffer, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkDeviceAddress* pIndirectDeviceAddresses, const uint32_t* pIndirectStrides, const uint32_t* const* ppMaxPrimitiveCounts); -typedef VkResult (VKAPI_PTR *PFN_vkBuildAccelerationStructuresKHR)(VkDevice device, VkDeferredOperationKHR deferredOperation, uint32_t infoCount, const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos); -typedef VkResult (VKAPI_PTR *PFN_vkCopyAccelerationStructureKHR)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureInfoKHR* pInfo); -typedef VkResult (VKAPI_PTR *PFN_vkCopyAccelerationStructureToMemoryKHR)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo); -typedef VkResult (VKAPI_PTR *PFN_vkCopyMemoryToAccelerationStructureKHR)(VkDevice device, VkDeferredOperationKHR deferredOperation, const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo); -typedef VkResult (VKAPI_PTR *PFN_vkWriteAccelerationStructuresPropertiesKHR)(VkDevice device, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR* pAccelerationStructures, VkQueryType queryType, size_t dataSize, void* pData, size_t stride); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureKHR)(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureInfoKHR* pInfo); -typedef void (VKAPI_PTR *PFN_vkCmdCopyAccelerationStructureToMemoryKHR)(VkCommandBuffer commandBuffer, const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo); -typedef void (VKAPI_PTR *PFN_vkCmdCopyMemoryToAccelerationStructureKHR)(VkCommandBuffer commandBuffer, const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo); -typedef VkDeviceAddress (VKAPI_PTR *PFN_vkGetAccelerationStructureDeviceAddressKHR)(VkDevice device, const VkAccelerationStructureDeviceAddressInfoKHR* pInfo); -typedef void (VKAPI_PTR *PFN_vkCmdWriteAccelerationStructuresPropertiesKHR)(VkCommandBuffer commandBuffer, uint32_t accelerationStructureCount, const VkAccelerationStructureKHR* pAccelerationStructures, VkQueryType queryType, VkQueryPool queryPool, uint32_t firstQuery); -typedef void (VKAPI_PTR *PFN_vkGetDeviceAccelerationStructureCompatibilityKHR)(VkDevice device, const VkAccelerationStructureVersionInfoKHR* pVersionInfo, VkAccelerationStructureCompatibilityKHR* pCompatibility); -typedef void (VKAPI_PTR *PFN_vkGetAccelerationStructureBuildSizesKHR)(VkDevice device, VkAccelerationStructureBuildTypeKHR buildType, const VkAccelerationStructureBuildGeometryInfoKHR* pBuildInfo, const uint32_t* pMaxPrimitiveCounts, VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateAccelerationStructureKHR( - VkDevice device, - const VkAccelerationStructureCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkAccelerationStructureKHR* pAccelerationStructure); - -VKAPI_ATTR void VKAPI_CALL vkDestroyAccelerationStructureKHR( - VkDevice device, - VkAccelerationStructureKHR accelerationStructure, - const VkAllocationCallbacks* pAllocator); - -VKAPI_ATTR void VKAPI_CALL vkCmdBuildAccelerationStructuresKHR( - VkCommandBuffer commandBuffer, - uint32_t infoCount, - const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, - const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos); - -VKAPI_ATTR void VKAPI_CALL vkCmdBuildAccelerationStructuresIndirectKHR( - VkCommandBuffer commandBuffer, - uint32_t infoCount, - const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, - const VkDeviceAddress* pIndirectDeviceAddresses, - const uint32_t* pIndirectStrides, - const uint32_t* const* ppMaxPrimitiveCounts); - -VKAPI_ATTR VkResult VKAPI_CALL vkBuildAccelerationStructuresKHR( - VkDevice device, - VkDeferredOperationKHR deferredOperation, - uint32_t infoCount, - const VkAccelerationStructureBuildGeometryInfoKHR* pInfos, - const VkAccelerationStructureBuildRangeInfoKHR* const* ppBuildRangeInfos); - -VKAPI_ATTR VkResult VKAPI_CALL vkCopyAccelerationStructureKHR( - VkDevice device, - VkDeferredOperationKHR deferredOperation, - const VkCopyAccelerationStructureInfoKHR* pInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkCopyAccelerationStructureToMemoryKHR( - VkDevice device, - VkDeferredOperationKHR deferredOperation, - const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkCopyMemoryToAccelerationStructureKHR( - VkDevice device, - VkDeferredOperationKHR deferredOperation, - const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkWriteAccelerationStructuresPropertiesKHR( - VkDevice device, - uint32_t accelerationStructureCount, - const VkAccelerationStructureKHR* pAccelerationStructures, - VkQueryType queryType, - size_t dataSize, - void* pData, - size_t stride); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyAccelerationStructureKHR( - VkCommandBuffer commandBuffer, - const VkCopyAccelerationStructureInfoKHR* pInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyAccelerationStructureToMemoryKHR( - VkCommandBuffer commandBuffer, - const VkCopyAccelerationStructureToMemoryInfoKHR* pInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdCopyMemoryToAccelerationStructureKHR( - VkCommandBuffer commandBuffer, - const VkCopyMemoryToAccelerationStructureInfoKHR* pInfo); - -VKAPI_ATTR VkDeviceAddress VKAPI_CALL vkGetAccelerationStructureDeviceAddressKHR( - VkDevice device, - const VkAccelerationStructureDeviceAddressInfoKHR* pInfo); - -VKAPI_ATTR void VKAPI_CALL vkCmdWriteAccelerationStructuresPropertiesKHR( - VkCommandBuffer commandBuffer, - uint32_t accelerationStructureCount, - const VkAccelerationStructureKHR* pAccelerationStructures, - VkQueryType queryType, - VkQueryPool queryPool, - uint32_t firstQuery); - -VKAPI_ATTR void VKAPI_CALL vkGetDeviceAccelerationStructureCompatibilityKHR( - VkDevice device, - const VkAccelerationStructureVersionInfoKHR* pVersionInfo, - VkAccelerationStructureCompatibilityKHR* pCompatibility); - -VKAPI_ATTR void VKAPI_CALL vkGetAccelerationStructureBuildSizesKHR( - VkDevice device, - VkAccelerationStructureBuildTypeKHR buildType, - const VkAccelerationStructureBuildGeometryInfoKHR* pBuildInfo, - const uint32_t* pMaxPrimitiveCounts, - VkAccelerationStructureBuildSizesInfoKHR* pSizeInfo); -#endif - - -#define VK_KHR_ray_tracing_pipeline 1 -#define VK_KHR_RAY_TRACING_PIPELINE_SPEC_VERSION 1 -#define VK_KHR_RAY_TRACING_PIPELINE_EXTENSION_NAME "VK_KHR_ray_tracing_pipeline" - -typedef enum VkShaderGroupShaderKHR { - VK_SHADER_GROUP_SHADER_GENERAL_KHR = 0, - VK_SHADER_GROUP_SHADER_CLOSEST_HIT_KHR = 1, - VK_SHADER_GROUP_SHADER_ANY_HIT_KHR = 2, - VK_SHADER_GROUP_SHADER_INTERSECTION_KHR = 3, - VK_SHADER_GROUP_SHADER_MAX_ENUM_KHR = 0x7FFFFFFF -} VkShaderGroupShaderKHR; -typedef struct VkRayTracingShaderGroupCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkRayTracingShaderGroupTypeKHR type; - uint32_t generalShader; - uint32_t closestHitShader; - uint32_t anyHitShader; - uint32_t intersectionShader; - const void* pShaderGroupCaptureReplayHandle; -} VkRayTracingShaderGroupCreateInfoKHR; - -typedef struct VkRayTracingPipelineInterfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t maxPipelineRayPayloadSize; - uint32_t maxPipelineRayHitAttributeSize; -} VkRayTracingPipelineInterfaceCreateInfoKHR; - -typedef struct VkRayTracingPipelineCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkPipelineCreateFlags flags; - uint32_t stageCount; - const VkPipelineShaderStageCreateInfo* pStages; - uint32_t groupCount; - const VkRayTracingShaderGroupCreateInfoKHR* pGroups; - uint32_t maxPipelineRayRecursionDepth; - const VkPipelineLibraryCreateInfoKHR* pLibraryInfo; - const VkRayTracingPipelineInterfaceCreateInfoKHR* pLibraryInterface; - const VkPipelineDynamicStateCreateInfo* pDynamicState; - VkPipelineLayout layout; - VkPipeline basePipelineHandle; - int32_t basePipelineIndex; -} VkRayTracingPipelineCreateInfoKHR; - -typedef struct VkPhysicalDeviceRayTracingPipelineFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 rayTracingPipeline; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplay; - VkBool32 rayTracingPipelineShaderGroupHandleCaptureReplayMixed; - VkBool32 rayTracingPipelineTraceRaysIndirect; - VkBool32 rayTraversalPrimitiveCulling; -} VkPhysicalDeviceRayTracingPipelineFeaturesKHR; - -typedef struct VkPhysicalDeviceRayTracingPipelinePropertiesKHR { - VkStructureType sType; - void* pNext; - uint32_t shaderGroupHandleSize; - uint32_t maxRayRecursionDepth; - uint32_t maxShaderGroupStride; - uint32_t shaderGroupBaseAlignment; - uint32_t shaderGroupHandleCaptureReplaySize; - uint32_t maxRayDispatchInvocationCount; - uint32_t shaderGroupHandleAlignment; - uint32_t maxRayHitAttributeSize; -} VkPhysicalDeviceRayTracingPipelinePropertiesKHR; - -typedef struct VkStridedDeviceAddressRegionKHR { - VkDeviceAddress deviceAddress; - VkDeviceSize stride; - VkDeviceSize size; -} VkStridedDeviceAddressRegionKHR; - -typedef struct VkTraceRaysIndirectCommandKHR { - uint32_t width; - uint32_t height; - uint32_t depth; -} VkTraceRaysIndirectCommandKHR; - -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysKHR)(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, uint32_t width, uint32_t height, uint32_t depth); -typedef VkResult (VKAPI_PTR *PFN_vkCreateRayTracingPipelinesKHR)(VkDevice device, VkDeferredOperationKHR deferredOperation, VkPipelineCache pipelineCache, uint32_t createInfoCount, const VkRayTracingPipelineCreateInfoKHR* pCreateInfos, const VkAllocationCallbacks* pAllocator, VkPipeline* pPipelines); -typedef VkResult (VKAPI_PTR *PFN_vkGetRayTracingCaptureReplayShaderGroupHandlesKHR)(VkDevice device, VkPipeline pipeline, uint32_t firstGroup, uint32_t groupCount, size_t dataSize, void* pData); -typedef void (VKAPI_PTR *PFN_vkCmdTraceRaysIndirectKHR)(VkCommandBuffer commandBuffer, const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, VkDeviceAddress indirectDeviceAddress); -typedef VkDeviceSize (VKAPI_PTR *PFN_vkGetRayTracingShaderGroupStackSizeKHR)(VkDevice device, VkPipeline pipeline, uint32_t group, VkShaderGroupShaderKHR groupShader); -typedef void (VKAPI_PTR *PFN_vkCmdSetRayTracingPipelineStackSizeKHR)(VkCommandBuffer commandBuffer, uint32_t pipelineStackSize); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysKHR( - VkCommandBuffer commandBuffer, - const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, - uint32_t width, - uint32_t height, - uint32_t depth); - -VKAPI_ATTR VkResult VKAPI_CALL vkCreateRayTracingPipelinesKHR( - VkDevice device, - VkDeferredOperationKHR deferredOperation, - VkPipelineCache pipelineCache, - uint32_t createInfoCount, - const VkRayTracingPipelineCreateInfoKHR* pCreateInfos, - const VkAllocationCallbacks* pAllocator, - VkPipeline* pPipelines); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetRayTracingCaptureReplayShaderGroupHandlesKHR( - VkDevice device, - VkPipeline pipeline, - uint32_t firstGroup, - uint32_t groupCount, - size_t dataSize, - void* pData); - -VKAPI_ATTR void VKAPI_CALL vkCmdTraceRaysIndirectKHR( - VkCommandBuffer commandBuffer, - const VkStridedDeviceAddressRegionKHR* pRaygenShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pMissShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pHitShaderBindingTable, - const VkStridedDeviceAddressRegionKHR* pCallableShaderBindingTable, - VkDeviceAddress indirectDeviceAddress); - -VKAPI_ATTR VkDeviceSize VKAPI_CALL vkGetRayTracingShaderGroupStackSizeKHR( - VkDevice device, - VkPipeline pipeline, - uint32_t group, - VkShaderGroupShaderKHR groupShader); - -VKAPI_ATTR void VKAPI_CALL vkCmdSetRayTracingPipelineStackSizeKHR( - VkCommandBuffer commandBuffer, - uint32_t pipelineStackSize); -#endif - - -#define VK_KHR_ray_query 1 -#define VK_KHR_RAY_QUERY_SPEC_VERSION 1 -#define VK_KHR_RAY_QUERY_EXTENSION_NAME "VK_KHR_ray_query" -typedef struct VkPhysicalDeviceRayQueryFeaturesKHR { - VkStructureType sType; - void* pNext; - VkBool32 rayQuery; -} VkPhysicalDeviceRayQueryFeaturesKHR; - - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h deleted file mode 100644 index 6e7e6afea6ce9c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_ios.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef VULKAN_IOS_H_ -#define VULKAN_IOS_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_MVK_ios_surface 1 -#define VK_MVK_IOS_SURFACE_SPEC_VERSION 3 -#define VK_MVK_IOS_SURFACE_EXTENSION_NAME "VK_MVK_ios_surface" -typedef VkFlags VkIOSSurfaceCreateFlagsMVK; -typedef struct VkIOSSurfaceCreateInfoMVK { - VkStructureType sType; - const void* pNext; - VkIOSSurfaceCreateFlagsMVK flags; - const void* pView; -} VkIOSSurfaceCreateInfoMVK; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateIOSSurfaceMVK)(VkInstance instance, const VkIOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateIOSSurfaceMVK( - VkInstance instance, - const VkIOSSurfaceCreateInfoMVK* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h deleted file mode 100644 index c49b123d078e93..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_macos.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef VULKAN_MACOS_H_ -#define VULKAN_MACOS_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_MVK_macos_surface 1 -#define VK_MVK_MACOS_SURFACE_SPEC_VERSION 3 -#define VK_MVK_MACOS_SURFACE_EXTENSION_NAME "VK_MVK_macos_surface" -typedef VkFlags VkMacOSSurfaceCreateFlagsMVK; -typedef struct VkMacOSSurfaceCreateInfoMVK { - VkStructureType sType; - const void* pNext; - VkMacOSSurfaceCreateFlagsMVK flags; - const void* pView; -} VkMacOSSurfaceCreateInfoMVK; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateMacOSSurfaceMVK)(VkInstance instance, const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateMacOSSurfaceMVK( - VkInstance instance, - const VkMacOSSurfaceCreateInfoMVK* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h deleted file mode 100644 index 1b680f0b1a20d0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_win32.h +++ /dev/null @@ -1,315 +0,0 @@ -#ifndef VULKAN_WIN32_H_ -#define VULKAN_WIN32_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_KHR_win32_surface 1 -#define VK_KHR_WIN32_SURFACE_SPEC_VERSION 6 -#define VK_KHR_WIN32_SURFACE_EXTENSION_NAME "VK_KHR_win32_surface" -typedef VkFlags VkWin32SurfaceCreateFlagsKHR; -typedef struct VkWin32SurfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkWin32SurfaceCreateFlagsKHR flags; - HINSTANCE hinstance; - HWND hwnd; -} VkWin32SurfaceCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateWin32SurfaceKHR)(VkInstance instance, const VkWin32SurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); -typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceWin32PresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateWin32SurfaceKHR( - VkInstance instance, - const VkWin32SurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); - -VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceWin32PresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex); -#endif - - -#define VK_KHR_external_memory_win32 1 -#define VK_KHR_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_KHR_external_memory_win32" -typedef struct VkImportMemoryWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagBits handleType; - HANDLE handle; - LPCWSTR name; -} VkImportMemoryWin32HandleInfoKHR; - -typedef struct VkExportMemoryWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportMemoryWin32HandleInfoKHR; - -typedef struct VkMemoryWin32HandlePropertiesKHR { - VkStructureType sType; - void* pNext; - uint32_t memoryTypeBits; -} VkMemoryWin32HandlePropertiesKHR; - -typedef struct VkMemoryGetWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkDeviceMemory memory; - VkExternalMemoryHandleTypeFlagBits handleType; -} VkMemoryGetWin32HandleInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleKHR)(VkDevice device, const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandlePropertiesKHR)(VkDevice device, VkExternalMemoryHandleTypeFlagBits handleType, HANDLE handle, VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleKHR( - VkDevice device, - const VkMemoryGetWin32HandleInfoKHR* pGetWin32HandleInfo, - HANDLE* pHandle); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandlePropertiesKHR( - VkDevice device, - VkExternalMemoryHandleTypeFlagBits handleType, - HANDLE handle, - VkMemoryWin32HandlePropertiesKHR* pMemoryWin32HandleProperties); -#endif - - -#define VK_KHR_win32_keyed_mutex 1 -#define VK_KHR_WIN32_KEYED_MUTEX_SPEC_VERSION 1 -#define VK_KHR_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_KHR_win32_keyed_mutex" -typedef struct VkWin32KeyedMutexAcquireReleaseInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t acquireCount; - const VkDeviceMemory* pAcquireSyncs; - const uint64_t* pAcquireKeys; - const uint32_t* pAcquireTimeouts; - uint32_t releaseCount; - const VkDeviceMemory* pReleaseSyncs; - const uint64_t* pReleaseKeys; -} VkWin32KeyedMutexAcquireReleaseInfoKHR; - - - -#define VK_KHR_external_semaphore_win32 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_SEMAPHORE_WIN32_EXTENSION_NAME "VK_KHR_external_semaphore_win32" -typedef struct VkImportSemaphoreWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkSemaphoreImportFlags flags; - VkExternalSemaphoreHandleTypeFlagBits handleType; - HANDLE handle; - LPCWSTR name; -} VkImportSemaphoreWin32HandleInfoKHR; - -typedef struct VkExportSemaphoreWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportSemaphoreWin32HandleInfoKHR; - -typedef struct VkD3D12FenceSubmitInfoKHR { - VkStructureType sType; - const void* pNext; - uint32_t waitSemaphoreValuesCount; - const uint64_t* pWaitSemaphoreValues; - uint32_t signalSemaphoreValuesCount; - const uint64_t* pSignalSemaphoreValues; -} VkD3D12FenceSubmitInfoKHR; - -typedef struct VkSemaphoreGetWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkSemaphore semaphore; - VkExternalSemaphoreHandleTypeFlagBits handleType; -} VkSemaphoreGetWin32HandleInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkImportSemaphoreWin32HandleKHR)(VkDevice device, const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetSemaphoreWin32HandleKHR)(VkDevice device, const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportSemaphoreWin32HandleKHR( - VkDevice device, - const VkImportSemaphoreWin32HandleInfoKHR* pImportSemaphoreWin32HandleInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetSemaphoreWin32HandleKHR( - VkDevice device, - const VkSemaphoreGetWin32HandleInfoKHR* pGetWin32HandleInfo, - HANDLE* pHandle); -#endif - - -#define VK_KHR_external_fence_win32 1 -#define VK_KHR_EXTERNAL_FENCE_WIN32_SPEC_VERSION 1 -#define VK_KHR_EXTERNAL_FENCE_WIN32_EXTENSION_NAME "VK_KHR_external_fence_win32" -typedef struct VkImportFenceWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkFence fence; - VkFenceImportFlags flags; - VkExternalFenceHandleTypeFlagBits handleType; - HANDLE handle; - LPCWSTR name; -} VkImportFenceWin32HandleInfoKHR; - -typedef struct VkExportFenceWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; - LPCWSTR name; -} VkExportFenceWin32HandleInfoKHR; - -typedef struct VkFenceGetWin32HandleInfoKHR { - VkStructureType sType; - const void* pNext; - VkFence fence; - VkExternalFenceHandleTypeFlagBits handleType; -} VkFenceGetWin32HandleInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkImportFenceWin32HandleKHR)(VkDevice device, const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); -typedef VkResult (VKAPI_PTR *PFN_vkGetFenceWin32HandleKHR)(VkDevice device, const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, HANDLE* pHandle); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkImportFenceWin32HandleKHR( - VkDevice device, - const VkImportFenceWin32HandleInfoKHR* pImportFenceWin32HandleInfo); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetFenceWin32HandleKHR( - VkDevice device, - const VkFenceGetWin32HandleInfoKHR* pGetWin32HandleInfo, - HANDLE* pHandle); -#endif - - -#define VK_NV_external_memory_win32 1 -#define VK_NV_EXTERNAL_MEMORY_WIN32_SPEC_VERSION 1 -#define VK_NV_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME "VK_NV_external_memory_win32" -typedef struct VkImportMemoryWin32HandleInfoNV { - VkStructureType sType; - const void* pNext; - VkExternalMemoryHandleTypeFlagsNV handleType; - HANDLE handle; -} VkImportMemoryWin32HandleInfoNV; - -typedef struct VkExportMemoryWin32HandleInfoNV { - VkStructureType sType; - const void* pNext; - const SECURITY_ATTRIBUTES* pAttributes; - DWORD dwAccess; -} VkExportMemoryWin32HandleInfoNV; - -typedef VkResult (VKAPI_PTR *PFN_vkGetMemoryWin32HandleNV)(VkDevice device, VkDeviceMemory memory, VkExternalMemoryHandleTypeFlagsNV handleType, HANDLE* pHandle); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetMemoryWin32HandleNV( - VkDevice device, - VkDeviceMemory memory, - VkExternalMemoryHandleTypeFlagsNV handleType, - HANDLE* pHandle); -#endif - - -#define VK_NV_win32_keyed_mutex 1 -#define VK_NV_WIN32_KEYED_MUTEX_SPEC_VERSION 2 -#define VK_NV_WIN32_KEYED_MUTEX_EXTENSION_NAME "VK_NV_win32_keyed_mutex" -typedef struct VkWin32KeyedMutexAcquireReleaseInfoNV { - VkStructureType sType; - const void* pNext; - uint32_t acquireCount; - const VkDeviceMemory* pAcquireSyncs; - const uint64_t* pAcquireKeys; - const uint32_t* pAcquireTimeoutMilliseconds; - uint32_t releaseCount; - const VkDeviceMemory* pReleaseSyncs; - const uint64_t* pReleaseKeys; -} VkWin32KeyedMutexAcquireReleaseInfoNV; - - - -#define VK_EXT_full_screen_exclusive 1 -#define VK_EXT_FULL_SCREEN_EXCLUSIVE_SPEC_VERSION 4 -#define VK_EXT_FULL_SCREEN_EXCLUSIVE_EXTENSION_NAME "VK_EXT_full_screen_exclusive" - -typedef enum VkFullScreenExclusiveEXT { - VK_FULL_SCREEN_EXCLUSIVE_DEFAULT_EXT = 0, - VK_FULL_SCREEN_EXCLUSIVE_ALLOWED_EXT = 1, - VK_FULL_SCREEN_EXCLUSIVE_DISALLOWED_EXT = 2, - VK_FULL_SCREEN_EXCLUSIVE_APPLICATION_CONTROLLED_EXT = 3, - VK_FULL_SCREEN_EXCLUSIVE_MAX_ENUM_EXT = 0x7FFFFFFF -} VkFullScreenExclusiveEXT; -typedef struct VkSurfaceFullScreenExclusiveInfoEXT { - VkStructureType sType; - void* pNext; - VkFullScreenExclusiveEXT fullScreenExclusive; -} VkSurfaceFullScreenExclusiveInfoEXT; - -typedef struct VkSurfaceCapabilitiesFullScreenExclusiveEXT { - VkStructureType sType; - void* pNext; - VkBool32 fullScreenExclusiveSupported; -} VkSurfaceCapabilitiesFullScreenExclusiveEXT; - -typedef struct VkSurfaceFullScreenExclusiveWin32InfoEXT { - VkStructureType sType; - const void* pNext; - HMONITOR hmonitor; -} VkSurfaceFullScreenExclusiveWin32InfoEXT; - -typedef VkResult (VKAPI_PTR *PFN_vkGetPhysicalDeviceSurfacePresentModes2EXT)(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, uint32_t* pPresentModeCount, VkPresentModeKHR* pPresentModes); -typedef VkResult (VKAPI_PTR *PFN_vkAcquireFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain); -typedef VkResult (VKAPI_PTR *PFN_vkReleaseFullScreenExclusiveModeEXT)(VkDevice device, VkSwapchainKHR swapchain); -typedef VkResult (VKAPI_PTR *PFN_vkGetDeviceGroupSurfacePresentModes2EXT)(VkDevice device, const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, VkDeviceGroupPresentModeFlagsKHR* pModes); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkGetPhysicalDeviceSurfacePresentModes2EXT( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - uint32_t* pPresentModeCount, - VkPresentModeKHR* pPresentModes); - -VKAPI_ATTR VkResult VKAPI_CALL vkAcquireFullScreenExclusiveModeEXT( - VkDevice device, - VkSwapchainKHR swapchain); - -VKAPI_ATTR VkResult VKAPI_CALL vkReleaseFullScreenExclusiveModeEXT( - VkDevice device, - VkSwapchainKHR swapchain); - -VKAPI_ATTR VkResult VKAPI_CALL vkGetDeviceGroupSurfacePresentModes2EXT( - VkDevice device, - const VkPhysicalDeviceSurfaceInfo2KHR* pSurfaceInfo, - VkDeviceGroupPresentModeFlagsKHR* pModes); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h deleted file mode 100644 index 5ba2ad850a2d75..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/third_party/vulkan/vulkan/vulkan_xcb.h +++ /dev/null @@ -1,55 +0,0 @@ -#ifndef VULKAN_XCB_H_ -#define VULKAN_XCB_H_ 1 - -/* -** Copyright 2015-2021 The Khronos Group Inc. -** -** SPDX-License-Identifier: Apache-2.0 -*/ - -/* -** This header is generated from the Khronos Vulkan XML API Registry. -** -*/ - - -#ifdef __cplusplus -extern "C" { -#endif - - - -#define VK_KHR_xcb_surface 1 -#define VK_KHR_XCB_SURFACE_SPEC_VERSION 6 -#define VK_KHR_XCB_SURFACE_EXTENSION_NAME "VK_KHR_xcb_surface" -typedef VkFlags VkXcbSurfaceCreateFlagsKHR; -typedef struct VkXcbSurfaceCreateInfoKHR { - VkStructureType sType; - const void* pNext; - VkXcbSurfaceCreateFlagsKHR flags; - xcb_connection_t* connection; - xcb_window_t window; -} VkXcbSurfaceCreateInfoKHR; - -typedef VkResult (VKAPI_PTR *PFN_vkCreateXcbSurfaceKHR)(VkInstance instance, const VkXcbSurfaceCreateInfoKHR* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkSurfaceKHR* pSurface); -typedef VkBool32 (VKAPI_PTR *PFN_vkGetPhysicalDeviceXcbPresentationSupportKHR)(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex, xcb_connection_t* connection, xcb_visualid_t visual_id); - -#ifndef VK_NO_PROTOTYPES -VKAPI_ATTR VkResult VKAPI_CALL vkCreateXcbSurfaceKHR( - VkInstance instance, - const VkXcbSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface); - -VKAPI_ATTR VkBool32 VKAPI_CALL vkGetPhysicalDeviceXcbPresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - xcb_connection_t* connection, - xcb_visualid_t visual_id); -#endif - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkAnimCodecPlayer.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkAnimCodecPlayer.h deleted file mode 100644 index f4729aa37d6bce..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkAnimCodecPlayer.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkAnimCodecPlayer_DEFINED -#define SkAnimCodecPlayer_DEFINED - -#include "include/codec/SkCodec.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" - -#include -#include -#include - -class SkImage; - -class SkAnimCodecPlayer { -public: - SkAnimCodecPlayer(std::unique_ptr codec); - ~SkAnimCodecPlayer(); - - /** - * Returns the current frame of the animation. This defaults to the first frame for - * animated codecs (i.e. msec = 0). Calling this multiple times (without calling seek()) - * will always return the same image object (or null if there was an error). - */ - sk_sp getFrame(); - - /** - * Return the size of the image(s) that will be returned by getFrame(). - */ - SkISize dimensions() const; - - /** - * Returns the total duration of the animation in milliseconds. Returns 0 for a single-frame - * image. - */ - uint32_t duration() const { return fTotalDuration; } - - /** - * Finds the closest frame associated with the time code (in milliseconds) and sets that - * to be the current frame (call getFrame() to retrieve that image). - * Returns true iff this call to seek() changed the "current frame" for the animation. - * Thus if seek() returns false, then getFrame() will return the same image as it did - * before this call to seek(). - */ - bool seek(uint32_t msec); - - -private: - std::unique_ptr fCodec; - SkImageInfo fImageInfo; - std::vector fFrameInfos; - std::vector > fImages; - int fCurrIndex = 0; - uint32_t fTotalDuration; - - sk_sp getFrameAt(int index); -}; - -#endif - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkBase64.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkBase64.h deleted file mode 100644 index e01028543a4230..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkBase64.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkBase64_DEFINED -#define SkBase64_DEFINED - -#include "include/core/SkTypes.h" - -#include - -struct SkBase64 { -public: - enum Error { - kNoError, - kPadError, - kBadCharError - }; - - /** - Base64 encodes src into dst. - - Normally this is called once with 'dst' nullptr to get the required size, then again with an - allocated 'dst' pointer to do the actual encoding. - - @param dst nullptr or a pointer to a buffer large enough to receive the result - - @param encode nullptr for default encoding or a pointer to at least 65 chars. - encode[64] will be used as the pad character. - Encodings other than the default encoding cannot be decoded. - - @return the required length of dst for encoding. - */ - static size_t Encode(const void* src, size_t length, void* dst, const char* encode = nullptr); - - /** - Base64 decodes src into dst. - - Normally this is called once with 'dst' nullptr to get the required size, then again with an - allocated 'dst' pointer to do the actual encoding. - - @param dst nullptr or a pointer to a buffer large enough to receive the result - - @param dstLength assigned the length dst is required to be. Must not be nullptr. - */ - static Error SK_WARN_UNUSED_RESULT Decode(const void* src, size_t srcLength, - void* dst, size_t* dstLength); -}; - -#endif // SkBase64_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCamera.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCamera.h deleted file mode 100644 index d2c8b8b23b9648..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCamera.h +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -// Inspired by Rob Johnson's most excellent QuickDraw GX sample code - -#ifndef SkCamera_DEFINED -#define SkCamera_DEFINED - -#include "include/core/SkM44.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/private/SkNoncopyable.h" - -// NOTE -- This entire header / impl is deprecated, and will be removed from Skia soon. -// -// Skia now has support for a 4x matrix (SkM44) in SkCanvas. -// - -class SkCanvas; - -// DEPRECATED -class SkPatch3D { -public: - SkPatch3D(); - - void reset(); - void transform(const SkM44&, SkPatch3D* dst = nullptr) const; - - // dot a unit vector with the patch's normal - SkScalar dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const; - SkScalar dotWith(const SkV3& v) const { - return this->dotWith(v.x, v.y, v.z); - } - - // deprecated, but still here for animator (for now) - void rotate(SkScalar /*x*/, SkScalar /*y*/, SkScalar /*z*/) {} - void rotateDegrees(SkScalar /*x*/, SkScalar /*y*/, SkScalar /*z*/) {} - -private: -public: // make public for SkDraw3D for now - SkV3 fU, fV; - SkV3 fOrigin; - - friend class SkCamera3D; -}; - -// DEPRECATED -class SkCamera3D { -public: - SkCamera3D(); - - void reset(); - void update(); - void patchToMatrix(const SkPatch3D&, SkMatrix* matrix) const; - - SkV3 fLocation; // origin of the camera's space - SkV3 fAxis; // view direction - SkV3 fZenith; // up direction - SkV3 fObserver; // eye position (may not be the same as the origin) - -private: - mutable SkMatrix fOrientation; - mutable bool fNeedToUpdate; - - void doUpdate() const; -}; - -// DEPRECATED -class SK_API Sk3DView : SkNoncopyable { -public: - Sk3DView(); - ~Sk3DView(); - - void save(); - void restore(); - - void translate(SkScalar x, SkScalar y, SkScalar z); - void rotateX(SkScalar deg); - void rotateY(SkScalar deg); - void rotateZ(SkScalar deg); - -#ifdef SK_BUILD_FOR_ANDROID_FRAMEWORK - void setCameraLocation(SkScalar x, SkScalar y, SkScalar z); - SkScalar getCameraLocationX() const; - SkScalar getCameraLocationY() const; - SkScalar getCameraLocationZ() const; -#endif - - void getMatrix(SkMatrix*) const; - void applyToCanvas(SkCanvas*) const; - - SkScalar dotWithNormal(SkScalar dx, SkScalar dy, SkScalar dz) const; - -private: - struct Rec { - Rec* fNext; - SkM44 fMatrix; - }; - Rec* fRec; - Rec fInitialRec; - SkCamera3D fCamera; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCanvasStateUtils.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCanvasStateUtils.h deleted file mode 100644 index 0172e379310671..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCanvasStateUtils.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2013 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCanvasStateUtils_DEFINED -#define SkCanvasStateUtils_DEFINED - -#include "include/core/SkTypes.h" - -#include - -class SkCanvas; -class SkCanvasState; - -/** - * A set of functions that are useful for copying the state of an SkCanvas - * across a library boundary where the Skia library on the other side of the - * boundary may be newer. The expected usage is outline below... - * - * Lib Boundary - * CaptureCanvasState(...) ||| - * SkCanvas --> SkCanvasState ||| - * ||| CreateFromCanvasState(...) - * ||| SkCanvasState --> SkCanvas` - * ||| Draw into SkCanvas` - * ||| Unref SkCanvas` - * ReleaseCanvasState(...) ||| - * - */ -class SK_API SkCanvasStateUtils { -public: - /** - * Captures the current state of the canvas into an opaque ptr that is safe - * to pass to a different instance of Skia (which may be the same version, - * or may be newer). The function will return NULL in the event that one of the - * following conditions are true. - * 1) the canvas device type is not supported (currently only raster is supported) - * 2) the canvas clip type is not supported (currently only non-AA clips are supported) - * - * It is recommended that the original canvas also not be used until all - * canvases that have been created using its captured state have been dereferenced. - * - * Finally, it is important to note that any draw filters attached to the - * canvas are NOT currently captured. - * - * @param canvas The canvas you wish to capture the current state of. - * @return NULL or an opaque ptr that can be passed to CreateFromCanvasState - * to reconstruct the canvas. The caller is responsible for calling - * ReleaseCanvasState to free the memory associated with this state. - */ - static SkCanvasState* CaptureCanvasState(SkCanvas* canvas); - - /** - * Create a new SkCanvas from the captured state of another SkCanvas. The - * function will return NULL in the event that one of the - * following conditions are true. - * 1) the captured state is in an unrecognized format - * 2) the captured canvas device type is not supported - * - * @param state Opaque object created by CaptureCanvasState. - * @return NULL or an SkCanvas* whose devices and matrix/clip state are - * identical to the captured canvas. The caller is responsible for - * calling unref on the SkCanvas. - */ - static std::unique_ptr MakeFromCanvasState(const SkCanvasState* state); - - /** - * Free the memory associated with the captured canvas state. The state - * should not be released until all SkCanvas objects created using that - * state have been dereferenced. Must be called from the same library - * instance that created the state via CaptureCanvasState. - * - * @param state The captured state you wish to dispose of. - */ - static void ReleaseCanvasState(SkCanvasState* state); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCustomTypeface.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCustomTypeface.h deleted file mode 100644 index afdf91e5ebcb86..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkCustomTypeface.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright 2020 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkCustomTypeface_DEFINED -#define SkCustomTypeface_DEFINED - -#include "include/core/SkDrawable.h" -#include "include/core/SkFontMetrics.h" -#include "include/core/SkFontStyle.h" -#include "include/core/SkPath.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -#include - -class SkStream; -class SkTypeface; - -class SK_API SkCustomTypefaceBuilder { -public: - SkCustomTypefaceBuilder(); - - void setGlyph(SkGlyphID, float advance, const SkPath&); - void setGlyph(SkGlyphID, float advance, sk_sp, const SkRect& bounds); - - void setMetrics(const SkFontMetrics& fm, float scale = 1); - void setFontStyle(SkFontStyle); - - sk_sp detach(); - -private: - struct GlyphRec { - // logical union - SkPath fPath; - sk_sp fDrawable; - - SkRect fBounds = {0,0,0,0}; // only used for drawable glyphs atm - float fAdvance = 0; - - bool isDrawable() const { - SkASSERT(!fDrawable || fPath.isEmpty()); - return fDrawable != nullptr; - } - }; - - std::vector fGlyphRecs; - SkFontMetrics fMetrics; - SkFontStyle fStyle; - - GlyphRec& ensureStorage(SkGlyphID); - - static sk_sp Deserialize(SkStream*); - - friend class SkTypeface; - friend class SkUserTypeface; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkEventTracer.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkEventTracer.h deleted file mode 100644 index 2ec0a3b3554f2f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkEventTracer.h +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (C) 2014 Google Inc. All rights reserved. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkEventTracer_DEFINED -#define SkEventTracer_DEFINED - -// The class in this header defines the interface between Skia's internal -// tracing macros and an external entity (e.g., Chrome) that will consume them. -// Such an entity should subclass SkEventTracer and provide an instance of -// that event to SkEventTracer::SetInstance. - -// If you're looking for the tracing macros to instrument Skia itself, those -// live in src/core/SkTraceEvent.h - -#include "include/core/SkTypes.h" - -#include - -class SK_API SkEventTracer { -public: - - typedef uint64_t Handle; - - /** - * If this is the first call to SetInstance or GetInstance then the passed instance is - * installed and true is returned. Otherwise, false is returned. In either case ownership of the - * tracer is transferred and it will be deleted when no longer needed. - * - * Not deleting the tracer on process exit should not cause problems as - * the whole heap is about to go away with the process. This can also - * improve performance by reducing the amount of work needed. - * - * @param leakTracer Do not delete tracer on process exit. - */ - static bool SetInstance(SkEventTracer*, bool leakTracer = false); - - /** - * Gets the event tracer. If this is the first call to SetInstance or GetIntance then a default - * event tracer is installed and returned. - */ - static SkEventTracer* GetInstance(); - - virtual ~SkEventTracer() = default; - - // The pointer returned from GetCategoryGroupEnabled() points to a - // value with zero or more of the following bits. Used in this class only. - // The TRACE_EVENT macros should only use the value as a bool. - // These values must be in sync with macro values in trace_event.h in chromium. - enum CategoryGroupEnabledFlags { - // Category group enabled for the recording mode. - kEnabledForRecording_CategoryGroupEnabledFlags = 1 << 0, - // Category group enabled for the monitoring mode. - kEnabledForMonitoring_CategoryGroupEnabledFlags = 1 << 1, - // Category group enabled by SetEventCallbackEnabled(). - kEnabledForEventCallback_CategoryGroupEnabledFlags = 1 << 2, - }; - - virtual const uint8_t* getCategoryGroupEnabled(const char* name) = 0; - virtual const char* getCategoryGroupName(const uint8_t* categoryEnabledFlag) = 0; - - virtual SkEventTracer::Handle - addTraceEvent(char phase, - const uint8_t* categoryEnabledFlag, - const char* name, - uint64_t id, - int32_t numArgs, - const char** argNames, - const uint8_t* argTypes, - const uint64_t* argValues, - uint8_t flags) = 0; - - virtual void - updateTraceEventDuration(const uint8_t* categoryEnabledFlag, - const char* name, - SkEventTracer::Handle handle) = 0; - - // Optional method that can be implemented to allow splitting up traces into different sections. - virtual void newTracingSection(const char*) {} - -protected: - SkEventTracer() = default; - SkEventTracer(const SkEventTracer&) = delete; - SkEventTracer& operator=(const SkEventTracer&) = delete; -}; - -#endif // SkEventTracer_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNWayCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNWayCanvas.h deleted file mode 100644 index 5ef7a103a98af2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNWayCanvas.h +++ /dev/null @@ -1,133 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkNWayCanvas_DEFINED -#define SkNWayCanvas_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkCanvas.h" -#include "include/core/SkCanvasVirtualEnforcer.h" -#include "include/core/SkClipOp.h" -#include "include/core/SkColor.h" -#include "include/core/SkM44.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTDArray.h" -#include "include/utils/SkNoDrawCanvas.h" - -#include - -namespace sktext { -class GlyphRunList; -} - -class SkData; -class SkDrawable; -class SkImage; -class SkMatrix; -class SkPaint; -class SkPath; -class SkPicture; -class SkRRect; -class SkRegion; -class SkShader; -class SkTextBlob; -class SkVertices; -struct SkDrawShadowRec; -struct SkPoint; -struct SkRSXform; -struct SkRect; - -#if SK_SUPPORT_GPU -namespace sktext::gpu { -class Slug; -} -#endif - -class SK_API SkNWayCanvas : public SkCanvasVirtualEnforcer { -public: - SkNWayCanvas(int width, int height); - ~SkNWayCanvas() override; - - virtual void addCanvas(SkCanvas*); - virtual void removeCanvas(SkCanvas*); - virtual void removeAll(); - -protected: - SkTDArray fList; - - void willSave() override; - SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec&) override; - bool onDoSaveBehind(const SkRect*) override; - void willRestore() override; - - void didConcat44(const SkM44&) override; - void didSetM44(const SkM44&) override; - void didScale(SkScalar, SkScalar) override; - void didTranslate(SkScalar, SkScalar) override; - - void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; - void onDrawGlyphRunList(const sktext::GlyphRunList&, const SkPaint&) override; - void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint& paint) override; -#if SK_SUPPORT_GPU - void onDrawSlug(const sktext::gpu::Slug* slug) override; -#endif - void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode, const SkPaint& paint) override; - - void onDrawPaint(const SkPaint&) override; - void onDrawBehind(const SkPaint&) override; - void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; - void onDrawRect(const SkRect&, const SkPaint&) override; - void onDrawRegion(const SkRegion&, const SkPaint&) override; - void onDrawOval(const SkRect&, const SkPaint&) override; - void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; - void onDrawRRect(const SkRRect&, const SkPaint&) override; - void onDrawPath(const SkPath&, const SkPaint&) override; - - void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, - const SkPaint*) override; - void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, - const SkPaint*, SrcRectConstraint) override; - void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, - const SkPaint*) override; - void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, - SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override; - - void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; - void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override; - - void onClipRect(const SkRect&, SkClipOp, ClipEdgeStyle) override; - void onClipRRect(const SkRRect&, SkClipOp, ClipEdgeStyle) override; - void onClipPath(const SkPath&, SkClipOp, ClipEdgeStyle) override; - void onClipShader(sk_sp, SkClipOp) override; - void onClipRegion(const SkRegion&, SkClipOp) override; - void onResetClip() override; - - void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; - void onDrawDrawable(SkDrawable*, const SkMatrix*) override; - void onDrawAnnotation(const SkRect&, const char[], SkData*) override; - - void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, - SkBlendMode) override; - void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], - const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override; - - void onFlush() override; - - class Iter; - -private: - using INHERITED = SkCanvasVirtualEnforcer; -}; - - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNoDrawCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNoDrawCanvas.h deleted file mode 100644 index 3f2563873858c0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNoDrawCanvas.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkNoDrawCanvas_DEFINED -#define SkNoDrawCanvas_DEFINED - -#include "include/core/SkCanvas.h" -#include "include/core/SkCanvasVirtualEnforcer.h" - -struct SkIRect; - -// SkNoDrawCanvas is a helper for SkCanvas subclasses which do not need to -// actually rasterize (e.g., analysis of the draw calls). -// -// It provides the following simplifications: -// -// * not backed by any device/pixels -// * conservative clipping (clipping calls only use rectangles) -// -class SK_API SkNoDrawCanvas : public SkCanvasVirtualEnforcer { -public: - SkNoDrawCanvas(int width, int height); - SkNoDrawCanvas(const SkIRect&); - - explicit SkNoDrawCanvas(sk_sp device); - - // Optimization to reset state to be the same as after construction. - void resetCanvas(int w, int h) { this->resetForNextPicture(SkIRect::MakeWH(w, h)); } - void resetCanvas(const SkIRect& rect) { this->resetForNextPicture(rect); } - -protected: - SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& rec) override; - bool onDoSaveBehind(const SkRect*) override; - - // No-op overrides for aborting rasterization earlier than SkNullBlitter. - void onDrawAnnotation(const SkRect&, const char[], SkData*) override {} - void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override {} - void onDrawDrawable(SkDrawable*, const SkMatrix*) override {} - void onDrawTextBlob(const SkTextBlob*, SkScalar, SkScalar, const SkPaint&) override {} - void onDrawPatch(const SkPoint[12], const SkColor[4], const SkPoint[4], SkBlendMode, - const SkPaint&) override {} - - void onDrawPaint(const SkPaint&) override {} - void onDrawBehind(const SkPaint&) override {} - void onDrawPoints(PointMode, size_t, const SkPoint[], const SkPaint&) override {} - void onDrawRect(const SkRect&, const SkPaint&) override {} - void onDrawRegion(const SkRegion&, const SkPaint&) override {} - void onDrawOval(const SkRect&, const SkPaint&) override {} - void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override {} - void onDrawRRect(const SkRRect&, const SkPaint&) override {} - void onDrawPath(const SkPath&, const SkPaint&) override {} - - void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, - const SkPaint*) override {} - void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, - const SkPaint*, SrcRectConstraint) override {} - void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, - const SkPaint*) override {} - void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, - SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override {} - - void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override {} - void onDrawShadowRec(const SkPath&, const SkDrawShadowRec&) override {} - void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override {} - - void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, - SkBlendMode) override {} - void onDrawEdgeAAImageSet2(const ImageSetEntry[], int, const SkPoint[], const SkMatrix[], - const SkSamplingOptions&, const SkPaint*, - SrcRectConstraint) override {} - -private: - using INHERITED = SkCanvasVirtualEnforcer; -}; - -#endif // SkNoDrawCanvas_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNullCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNullCanvas.h deleted file mode 100644 index a77e3e3de9bb80..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkNullCanvas.h +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkNullCanvas_DEFINED -#define SkNullCanvas_DEFINED - -#include "include/core/SkTypes.h" - -#include - -class SkCanvas; - -/** - * Creates a canvas that draws nothing. This is useful for performance testing. - */ -SK_API std::unique_ptr SkMakeNullCanvas(); - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkOrderedFontMgr.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkOrderedFontMgr.h deleted file mode 100644 index a03bfdb54108ae..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkOrderedFontMgr.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkOrderedFontMgr_DEFINED -#define SkOrderedFontMgr_DEFINED - -#include "include/core/SkFontMgr.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkTypes.h" - -#include -#include - -class SkData; -class SkFontStyle; -class SkStreamAsset; -class SkString; -class SkTypeface; -struct SkFontArguments; - -/** - * Collects an order list of other font managers, and visits them in order - * when a request to find or match is issued. - * - * Note: this explicitly fails on any attempt to Make a typeface: all of - * those requests will return null. - */ -class SK_API SkOrderedFontMgr : public SkFontMgr { -public: - SkOrderedFontMgr(); - ~SkOrderedFontMgr() override; - - void append(sk_sp); - -protected: - int onCountFamilies() const override; - void onGetFamilyName(int index, SkString* familyName) const override; - SkFontStyleSet* onCreateStyleSet(int index)const override; - - SkFontStyleSet* onMatchFamily(const char familyName[]) const override; - - SkTypeface* onMatchFamilyStyle(const char familyName[], const SkFontStyle&) const override; - SkTypeface* onMatchFamilyStyleCharacter(const char familyName[], const SkFontStyle&, - const char* bcp47[], int bcp47Count, - SkUnichar character) const override; - - // Note: all of these always return null - sk_sp onMakeFromData(sk_sp, int ttcIndex) const override; - sk_sp onMakeFromStreamIndex(std::unique_ptr, - int ttcIndex) const override; - sk_sp onMakeFromStreamArgs(std::unique_ptr, - const SkFontArguments&) const override; - sk_sp onMakeFromFile(const char path[], int ttcIndex) const override; - - sk_sp onLegacyMakeTypeface(const char familyName[], SkFontStyle) const override; - -private: - std::vector> fList; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkPaintFilterCanvas.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkPaintFilterCanvas.h deleted file mode 100644 index 5ce3c26f1dc743..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkPaintFilterCanvas.h +++ /dev/null @@ -1,141 +0,0 @@ -/* - * Copyright 2015 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkPaintFilterCanvas_DEFINED -#define SkPaintFilterCanvas_DEFINED - -#include "include/core/SkBlendMode.h" -#include "include/core/SkCanvas.h" -#include "include/core/SkCanvasVirtualEnforcer.h" -#include "include/core/SkColor.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkScalar.h" -#include "include/core/SkSize.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTDArray.h" -#include "include/utils/SkNWayCanvas.h" - -#include - -namespace sktext { -class GlyphRunList; -} - -class GrRecordingContext; -class SkData; -class SkDrawable; -class SkImage; -class SkMatrix; -class SkPaint; -class SkPath; -class SkPicture; -class SkPixmap; -class SkRRect; -class SkRegion; -class SkSurface; -class SkSurfaceProps; -class SkTextBlob; -class SkVertices; -struct SkDrawShadowRec; -struct SkPoint; -struct SkRSXform; -struct SkRect; - -/** \class SkPaintFilterCanvas - - A utility proxy base class for implementing draw/paint filters. -*/ -class SK_API SkPaintFilterCanvas : public SkCanvasVirtualEnforcer { -public: - /** - * The new SkPaintFilterCanvas is configured for forwarding to the - * specified canvas. Also copies the target canvas matrix and clip bounds. - */ - SkPaintFilterCanvas(SkCanvas* canvas); - - enum Type { - kPicture_Type, - }; - - // Forwarded to the wrapped canvas. - SkISize getBaseLayerSize() const override { return proxy()->getBaseLayerSize(); } - GrRecordingContext* recordingContext() override { return proxy()->recordingContext(); } - -protected: - /** - * Called with the paint that will be used to draw the specified type. - * The implementation may modify the paint as they wish. - * - * The result bool is used to determine whether the draw op is to be - * executed (true) or skipped (false). - * - * Note: The base implementation calls onFilter() for top-level/explicit paints only. - * To also filter encapsulated paints (e.g. SkPicture, SkTextBlob), clients may need to - * override the relevant methods (i.e. drawPicture, drawTextBlob). - */ - virtual bool onFilter(SkPaint& paint) const = 0; - - void onDrawPaint(const SkPaint&) override; - void onDrawBehind(const SkPaint&) override; - void onDrawPoints(PointMode, size_t count, const SkPoint pts[], const SkPaint&) override; - void onDrawRect(const SkRect&, const SkPaint&) override; - void onDrawRRect(const SkRRect&, const SkPaint&) override; - void onDrawDRRect(const SkRRect&, const SkRRect&, const SkPaint&) override; - void onDrawRegion(const SkRegion&, const SkPaint&) override; - void onDrawOval(const SkRect&, const SkPaint&) override; - void onDrawArc(const SkRect&, SkScalar, SkScalar, bool, const SkPaint&) override; - void onDrawPath(const SkPath&, const SkPaint&) override; - - void onDrawImage2(const SkImage*, SkScalar, SkScalar, const SkSamplingOptions&, - const SkPaint*) override; - void onDrawImageRect2(const SkImage*, const SkRect&, const SkRect&, const SkSamplingOptions&, - const SkPaint*, SrcRectConstraint) override; - void onDrawImageLattice2(const SkImage*, const Lattice&, const SkRect&, SkFilterMode, - const SkPaint*) override; - void onDrawAtlas2(const SkImage*, const SkRSXform[], const SkRect[], const SkColor[], int, - SkBlendMode, const SkSamplingOptions&, const SkRect*, const SkPaint*) override; - - void onDrawVerticesObject(const SkVertices*, SkBlendMode, const SkPaint&) override; - void onDrawPatch(const SkPoint cubics[12], const SkColor colors[4], - const SkPoint texCoords[4], SkBlendMode, - const SkPaint& paint) override; - void onDrawPicture(const SkPicture*, const SkMatrix*, const SkPaint*) override; - void onDrawDrawable(SkDrawable*, const SkMatrix*) override; - - void onDrawGlyphRunList(const sktext::GlyphRunList&, const SkPaint&) override; - void onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, - const SkPaint& paint) override; - void onDrawAnnotation(const SkRect& rect, const char key[], SkData* value) override; - void onDrawShadowRec(const SkPath& path, const SkDrawShadowRec& rec) override; - - void onDrawEdgeAAQuad(const SkRect&, const SkPoint[4], QuadAAFlags, const SkColor4f&, - SkBlendMode) override; - void onDrawEdgeAAImageSet2(const ImageSetEntry[], int count, const SkPoint[], const SkMatrix[], - const SkSamplingOptions&,const SkPaint*, SrcRectConstraint) override; - - // Forwarded to the wrapped canvas. - sk_sp onNewSurface(const SkImageInfo&, const SkSurfaceProps&) override; - bool onPeekPixels(SkPixmap* pixmap) override; - bool onAccessTopLayerPixels(SkPixmap* pixmap) override; - SkImageInfo onImageInfo() const override; - bool onGetProps(SkSurfaceProps* props, bool top) const override; - -private: - class AutoPaintFilter; - - SkCanvas* proxy() const { SkASSERT(fList.size() == 1); return fList[0]; } - - SkPaintFilterCanvas* internal_private_asPaintFilterCanvas() const override { - return const_cast(this); - } - - friend class SkAndroidFrameworkUtils; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParse.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParse.h deleted file mode 100644 index bcabc3c793ac18..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParse.h +++ /dev/null @@ -1,37 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkParse_DEFINED -#define SkParse_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -#include -#include - -class SK_API SkParse { -public: - static int Count(const char str[]); // number of scalars or int values - static int Count(const char str[], char separator); - static const char* FindColor(const char str[], SkColor* value); - static const char* FindHex(const char str[], uint32_t* value); - static const char* FindMSec(const char str[], SkMSec* value); - static const char* FindNamedColor(const char str[], size_t len, SkColor* color); - static const char* FindS32(const char str[], int32_t* value); - static const char* FindScalar(const char str[], SkScalar* value); - static const char* FindScalars(const char str[], SkScalar value[], int count); - - static bool FindBool(const char str[], bool* value); - // return the index of str in list[], or -1 if not found - static int FindList(const char str[], const char list[]); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParsePath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParsePath.h deleted file mode 100644 index f1c81b2f28d3c8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkParsePath.h +++ /dev/null @@ -1,25 +0,0 @@ - -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - - -#ifndef SkParsePath_DEFINED -#define SkParsePath_DEFINED - -#include "include/core/SkPath.h" - -class SkString; - -class SK_API SkParsePath { -public: - static bool FromSVGString(const char str[], SkPath*); - - enum class PathEncoding { Absolute, Relative }; - static void ToSVGString(const SkPath&, SkString*, PathEncoding = PathEncoding::Absolute); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkRandom.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkRandom.h deleted file mode 100644 index ba40732b9cf7a0..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkRandom.h +++ /dev/null @@ -1,169 +0,0 @@ -/* - * Copyright 2006 The Android Open Source Project - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkRandom_DEFINED -#define SkRandom_DEFINED - -#include "include/core/SkScalar.h" -#include "include/private/SkFixed.h" -#include "include/private/SkFloatBits.h" - -/** \class SkRandom - - Utility class that implements pseudo random 32bit numbers using Marsaglia's - multiply-with-carry "mother of all" algorithm. Unlike rand(), this class holds - its own state, so that multiple instances can be used with no side-effects. - - Has a large period and all bits are well-randomized. - */ -class SkRandom { -public: - SkRandom() { init(0); } - SkRandom(uint32_t seed) { init(seed); } - SkRandom(const SkRandom& rand) : fK(rand.fK), fJ(rand.fJ) {} - - SkRandom& operator=(const SkRandom& rand) { - fK = rand.fK; - fJ = rand.fJ; - - return *this; - } - - /** Return the next pseudo random number as an unsigned 32bit value. - */ - uint32_t nextU() { - fK = kKMul*(fK & 0xffff) + (fK >> 16); - fJ = kJMul*(fJ & 0xffff) + (fJ >> 16); - return (((fK << 16) | (fK >> 16)) + fJ); - } - - /** Return the next pseudo random number as a signed 32bit value. - */ - int32_t nextS() { return (int32_t)this->nextU(); } - - /** - * Returns value [0...1) as an IEEE float - */ - float nextF() { - int floatint = 0x3f800000 | (int)(this->nextU() >> 9); - float f = SkBits2Float(floatint) - 1.0f; - return f; - } - - /** - * Returns value [min...max) as a float - */ - float nextRangeF(float min, float max) { - return min + this->nextF() * (max - min); - } - - /** Return the next pseudo random number, as an unsigned value of - at most bitCount bits. - @param bitCount The maximum number of bits to be returned - */ - uint32_t nextBits(unsigned bitCount) { - SkASSERT(bitCount > 0 && bitCount <= 32); - return this->nextU() >> (32 - bitCount); - } - - /** Return the next pseudo random unsigned number, mapped to lie within - [min, max] inclusive. - */ - uint32_t nextRangeU(uint32_t min, uint32_t max) { - SkASSERT(min <= max); - uint32_t range = max - min + 1; - if (0 == range) { - return this->nextU(); - } else { - return min + this->nextU() % range; - } - } - - /** Return the next pseudo random unsigned number, mapped to lie within - [0, count). - */ - uint32_t nextULessThan(uint32_t count) { - SkASSERT(count > 0); - return this->nextRangeU(0, count - 1); - } - - /** Return the next pseudo random number expressed as a SkScalar - in the range [0..SK_Scalar1). - */ - SkScalar nextUScalar1() { return SkFixedToScalar(this->nextUFixed1()); } - - /** Return the next pseudo random number expressed as a SkScalar - in the range [min..max). - */ - SkScalar nextRangeScalar(SkScalar min, SkScalar max) { - return this->nextUScalar1() * (max - min) + min; - } - - /** Return the next pseudo random number expressed as a SkScalar - in the range [-SK_Scalar1..SK_Scalar1). - */ - SkScalar nextSScalar1() { return SkFixedToScalar(this->nextSFixed1()); } - - /** Return the next pseudo random number as a bool. - */ - bool nextBool() { return this->nextU() >= 0x80000000; } - - /** A biased version of nextBool(). - */ - bool nextBiasedBool(SkScalar fractionTrue) { - SkASSERT(fractionTrue >= 0 && fractionTrue <= SK_Scalar1); - return this->nextUScalar1() <= fractionTrue; - } - - /** Reset the random object. - */ - void setSeed(uint32_t seed) { init(seed); } - -private: - // Initialize state variables with LCG. - // We must ensure that both J and K are non-zero, otherwise the - // multiply-with-carry step will forevermore return zero. - void init(uint32_t seed) { - fK = NextLCG(seed); - if (0 == fK) { - fK = NextLCG(fK); - } - fJ = NextLCG(fK); - if (0 == fJ) { - fJ = NextLCG(fJ); - } - SkASSERT(0 != fK && 0 != fJ); - } - static uint32_t NextLCG(uint32_t seed) { return kMul*seed + kAdd; } - - /** Return the next pseudo random number expressed as an unsigned SkFixed - in the range [0..SK_Fixed1). - */ - SkFixed nextUFixed1() { return this->nextU() >> 16; } - - /** Return the next pseudo random number expressed as a signed SkFixed - in the range [-SK_Fixed1..SK_Fixed1). - */ - SkFixed nextSFixed1() { return this->nextS() >> 15; } - - // See "Numerical Recipes in C", 1992 page 284 for these constants - // For the LCG that sets the initial state from a seed - enum { - kMul = 1664525, - kAdd = 1013904223 - }; - // Constants for the multiply-with-carry steps - enum { - kKMul = 30345, - kJMul = 18000, - }; - - uint32_t fK; - uint32_t fJ; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkShadowUtils.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkShadowUtils.h deleted file mode 100644 index b7c43d569f89cb..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkShadowUtils.h +++ /dev/null @@ -1,88 +0,0 @@ - -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkShadowUtils_DEFINED -#define SkShadowUtils_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" -#include "include/private/SkShadowFlags.h" - -#include - -class SkCanvas; -class SkMatrix; -class SkPath; -struct SkPoint3; -struct SkRect; - -class SK_API SkShadowUtils { -public: - /** - * Draw an offset spot shadow and outlining ambient shadow for the given path using a disc - * light. The shadow may be cached, depending on the path type and canvas matrix. If the - * matrix is perspective or the path is volatile, it will not be cached. - * - * @param canvas The canvas on which to draw the shadows. - * @param path The occluder used to generate the shadows. - * @param zPlaneParams Values for the plane function which returns the Z offset of the - * occluder from the canvas based on local x and y values (the current matrix is not applied). - * @param lightPos Generally, the 3D position of the light relative to the canvas plane. - * If kDirectionalLight_ShadowFlag is set, this specifies a vector pointing - * towards the light. - * @param lightRadius Generally, the radius of the disc light. - * If DirectionalLight_ShadowFlag is set, this specifies the amount of - * blur when the occluder is at Z offset == 1. The blur will grow linearly - * as the Z value increases. - * @param ambientColor The color of the ambient shadow. - * @param spotColor The color of the spot shadow. - * @param flags Options controlling opaque occluder optimizations, shadow appearance, - * and light position. See SkShadowFlags. - */ - static void DrawShadow(SkCanvas* canvas, const SkPath& path, const SkPoint3& zPlaneParams, - const SkPoint3& lightPos, SkScalar lightRadius, - SkColor ambientColor, SkColor spotColor, - uint32_t flags = SkShadowFlags::kNone_ShadowFlag); - - /** - * Generate bounding box for shadows relative to path. Includes both the ambient and spot - * shadow bounds. - * - * @param ctm Current transformation matrix to device space. - * @param path The occluder used to generate the shadows. - * @param zPlaneParams Values for the plane function which returns the Z offset of the - * occluder from the canvas based on local x and y values (the current matrix is not applied). - * @param lightPos Generally, the 3D position of the light relative to the canvas plane. - * If kDirectionalLight_ShadowFlag is set, this specifies a vector pointing - * towards the light. - * @param lightRadius Generally, the radius of the disc light. - * If DirectionalLight_ShadowFlag is set, this specifies the amount of - * blur when the occluder is at Z offset == 1. The blur will grow linearly - * as the Z value increases. - * @param flags Options controlling opaque occluder optimizations, shadow appearance, - * and light position. See SkShadowFlags. - * @param bounds Return value for shadow bounding box. - * @return Returns true if successful, false otherwise. - */ - static bool GetLocalBounds(const SkMatrix& ctm, const SkPath& path, - const SkPoint3& zPlaneParams, const SkPoint3& lightPos, - SkScalar lightRadius, uint32_t flags, SkRect* bounds); - - /** - * Helper routine to compute color values for one-pass tonal alpha. - * - * @param inAmbientColor Original ambient color - * @param inSpotColor Original spot color - * @param outAmbientColor Modified ambient color - * @param outSpotColor Modified spot color - */ - static void ComputeTonalColors(SkColor inAmbientColor, SkColor inSpotColor, - SkColor* outAmbientColor, SkColor* outSpotColor); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTextUtils.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTextUtils.h deleted file mode 100644 index b73ab771e8312d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTextUtils.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTextUtils_DEFINED -#define SkTextUtils_DEFINED - -#include "include/core/SkFontTypes.h" -#include "include/core/SkScalar.h" -#include "include/core/SkTypes.h" - -#include -#include - -class SkCanvas; -class SkFont; -class SkPaint; -class SkPath; - -class SK_API SkTextUtils { -public: - enum Align { - kLeft_Align, - kCenter_Align, - kRight_Align, - }; - - static void Draw(SkCanvas*, const void* text, size_t size, SkTextEncoding, - SkScalar x, SkScalar y, const SkFont&, const SkPaint&, Align = kLeft_Align); - - static void DrawString(SkCanvas* canvas, const char text[], SkScalar x, SkScalar y, - const SkFont& font, const SkPaint& paint, Align align = kLeft_Align) { - Draw(canvas, text, strlen(text), SkTextEncoding::kUTF8, x, y, font, paint, align); - } - - static void GetPath(const void* text, size_t length, SkTextEncoding, SkScalar x, SkScalar y, - const SkFont&, SkPath*); -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTraceEventPhase.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTraceEventPhase.h deleted file mode 100644 index 38457be24b4079..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/SkTraceEventPhase.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -#ifndef SkTraceEventPhase_DEFINED -#define SkTraceEventPhase_DEFINED - -// Phase indicates the nature of an event entry. E.g. part of a begin/end pair. -#define TRACE_EVENT_PHASE_BEGIN ('B') -#define TRACE_EVENT_PHASE_END ('E') -#define TRACE_EVENT_PHASE_COMPLETE ('X') -#define TRACE_EVENT_PHASE_INSTANT ('I') -#define TRACE_EVENT_PHASE_ASYNC_BEGIN ('S') -#define TRACE_EVENT_PHASE_ASYNC_END ('F') -#define TRACE_EVENT_PHASE_COUNTER ('C') -#define TRACE_EVENT_PHASE_CREATE_OBJECT ('N') -#define TRACE_EVENT_PHASE_SNAPSHOT_OBJECT ('O') -#define TRACE_EVENT_PHASE_DELETE_OBJECT ('D') - -#endif // SkTraceEventPhase_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/mac/SkCGUtils.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/mac/SkCGUtils.h deleted file mode 100644 index a320dd8d4c9d24..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/include/utils/mac/SkCGUtils.h +++ /dev/null @@ -1,78 +0,0 @@ - -/* - * Copyright 2011 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ -#ifndef SkCGUtils_DEFINED -#define SkCGUtils_DEFINED - -#include "include/core/SkImage.h" -#include "include/core/SkImageInfo.h" -#include "include/core/SkPixmap.h" -#include "include/core/SkSize.h" - -#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) - -#ifdef SK_BUILD_FOR_MAC -#include -#endif - -#ifdef SK_BUILD_FOR_IOS -#include -#endif - -class SkBitmap; -class SkData; -class SkPixmap; -class SkStreamRewindable; - -SK_API CGContextRef SkCreateCGContext(const SkPixmap&); - -/** - * Given a CGImage, allocate an SkBitmap and copy the image's pixels into it. If scaleToFit is not - * null, use it to determine the size of the bitmap, and scale the image to fill the bitmap. - * Otherwise use the image's width/height. - * - * On failure, return false, and leave bitmap unchanged. - */ -SK_API bool SkCreateBitmapFromCGImage(SkBitmap* dst, CGImageRef src); - -SK_API sk_sp SkMakeImageFromCGImage(CGImageRef); - -/** - * Copy the pixels from src into the memory specified by info/rowBytes/dstPixels. On failure, - * return false (e.g. ImageInfo incompatible with src). - */ -SK_API bool SkCopyPixelsFromCGImage(const SkImageInfo& info, size_t rowBytes, void* dstPixels, - CGImageRef src); -static inline bool SkCopyPixelsFromCGImage(const SkPixmap& dst, CGImageRef src) { - return SkCopyPixelsFromCGImage(dst.info(), dst.rowBytes(), dst.writable_addr(), src); -} - -/** - * Create an imageref from the specified bitmap using the specified colorspace. - * If space is NULL, then CGColorSpaceCreateDeviceRGB() is used. - */ -SK_API CGImageRef SkCreateCGImageRefWithColorspace(const SkBitmap& bm, - CGColorSpaceRef space); - -/** - * Create an imageref from the specified bitmap using the colorspace returned - * by CGColorSpaceCreateDeviceRGB() - */ -static inline CGImageRef SkCreateCGImageRef(const SkBitmap& bm) { - return SkCreateCGImageRefWithColorspace(bm, nil); -} - -/** - * Draw the bitmap into the specified CG context. The bitmap will be converted - * to a CGImage using the generic RGB colorspace. (x,y) specifies the position - * of the top-left corner of the bitmap. The bitmap is converted using the - * colorspace returned by CGColorSpaceCreateDeviceRGB() - */ -void SkCGDrawBitmap(CGContextRef, const SkBitmap&, float x, float y); - -#endif // defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) -#endif // SkCGUtils_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms.h deleted file mode 100644 index 2ee56934ade6dd..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms.h +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#pragma once - -// skcms.h contains the entire public API for skcms. - -#ifndef SKCMS_API - #define SKCMS_API -#endif - -#include -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// A row-major 3x3 matrix (ie vals[row][col]) -typedef struct skcms_Matrix3x3 { - float vals[3][3]; -} skcms_Matrix3x3; - -// It is _not_ safe to alias the pointers to invert in-place. -SKCMS_API bool skcms_Matrix3x3_invert(const skcms_Matrix3x3*, skcms_Matrix3x3*); -SKCMS_API skcms_Matrix3x3 skcms_Matrix3x3_concat(const skcms_Matrix3x3*, const skcms_Matrix3x3*); - -// A row-major 3x4 matrix (ie vals[row][col]) -typedef struct skcms_Matrix3x4 { - float vals[3][4]; -} skcms_Matrix3x4; - -// A transfer function mapping encoded values to linear values, -// represented by this 7-parameter piecewise function: -// -// linear = sign(encoded) * (c*|encoded| + f) , 0 <= |encoded| < d -// = sign(encoded) * ((a*|encoded| + b)^g + e), d <= |encoded| -// -// (A simple gamma transfer function sets g to gamma and a to 1.) -typedef struct skcms_TransferFunction { - float g, a,b,c,d,e,f; -} skcms_TransferFunction; - -SKCMS_API float skcms_TransferFunction_eval (const skcms_TransferFunction*, float); -SKCMS_API bool skcms_TransferFunction_invert(const skcms_TransferFunction*, - skcms_TransferFunction*); - -// We can jam a couple alternate transfer function forms into skcms_TransferFunction, -// including those matching the general forms of the SMPTE ST 2084 PQ function or HLG. -// -// PQish: -// max(A + B|encoded|^C, 0) -// linear = sign(encoded) * (------------------------) ^ F -// D + E|encoded|^C -SKCMS_API bool skcms_TransferFunction_makePQish(skcms_TransferFunction*, - float A, float B, float C, - float D, float E, float F); -// HLGish: -// { K * sign(encoded) * ( (R|encoded|)^G ) when 0 <= |encoded| <= 1/R -// linear = { K * sign(encoded) * ( e^(a(|encoded|-c)) + b ) when 1/R < |encoded| -SKCMS_API bool skcms_TransferFunction_makeScaledHLGish(skcms_TransferFunction*, - float K, float R, float G, - float a, float b, float c); - -// Compatibility shim with K=1 for old callers. -static inline bool skcms_TransferFunction_makeHLGish(skcms_TransferFunction* fn, - float R, float G, - float a, float b, float c) { - return skcms_TransferFunction_makeScaledHLGish(fn, 1.0f, R,G, a,b,c); -} - -// PQ mapping encoded [0,1] to linear [0,1]. -static inline bool skcms_TransferFunction_makePQ(skcms_TransferFunction* tf) { - return skcms_TransferFunction_makePQish(tf, -107/128.0f, 1.0f, 32/2523.0f - , 2413/128.0f, -2392/128.0f, 8192/1305.0f); -} -// HLG mapping encoded [0,1] to linear [0,12]. -static inline bool skcms_TransferFunction_makeHLG(skcms_TransferFunction* tf) { - return skcms_TransferFunction_makeHLGish(tf, 2.0f, 2.0f - , 1/0.17883277f, 0.28466892f, 0.55991073f); -} - -// Is this an ordinary sRGB-ish transfer function, or one of the HDR forms we support? -SKCMS_API bool skcms_TransferFunction_isSRGBish(const skcms_TransferFunction*); -SKCMS_API bool skcms_TransferFunction_isPQish (const skcms_TransferFunction*); -SKCMS_API bool skcms_TransferFunction_isHLGish (const skcms_TransferFunction*); - -// Unified representation of 'curv' or 'para' tag data, or a 1D table from 'mft1' or 'mft2' -typedef union skcms_Curve { - struct { - uint32_t alias_of_table_entries; - skcms_TransferFunction parametric; - }; - struct { - uint32_t table_entries; - const uint8_t* table_8; - const uint8_t* table_16; - }; -} skcms_Curve; - -// Complex transforms between device space (A) and profile connection space (B): -// A2B: device -> [ "A" curves -> CLUT ] -> [ "M" curves -> matrix ] -> "B" curves -> PCS -// B2A: device <- [ "A" curves <- CLUT ] <- [ "M" curves <- matrix ] <- "B" curves <- PCS - -typedef struct skcms_A2B { - // Optional: N 1D "A" curves, followed by an N-dimensional CLUT. - // If input_channels == 0, these curves and CLUT are skipped, - // Otherwise, input_channels must be in [1, 4]. - uint32_t input_channels; - skcms_Curve input_curves[4]; - uint8_t grid_points[4]; - const uint8_t* grid_8; - const uint8_t* grid_16; - - // Optional: 3 1D "M" curves, followed by a color matrix. - // If matrix_channels == 0, these curves and matrix are skipped, - // Otherwise, matrix_channels must be 3. - uint32_t matrix_channels; - skcms_Curve matrix_curves[3]; - skcms_Matrix3x4 matrix; - - // Required: 3 1D "B" curves. Always present, and output_channels must be 3. - uint32_t output_channels; - skcms_Curve output_curves[3]; -} skcms_A2B; - -typedef struct skcms_B2A { - // Required: 3 1D "B" curves. Always present, and input_channels must be 3. - uint32_t input_channels; - skcms_Curve input_curves[3]; - - // Optional: a color matrix, followed by 3 1D "M" curves. - // If matrix_channels == 0, this matrix and these curves are skipped, - // Otherwise, matrix_channels must be 3. - uint32_t matrix_channels; - skcms_Matrix3x4 matrix; - skcms_Curve matrix_curves[3]; - - // Optional: an N-dimensional CLUT, followed by N 1D "A" curves. - // If output_channels == 0, this CLUT and these curves are skipped, - // Otherwise, output_channels must be in [1, 4]. - uint32_t output_channels; - uint8_t grid_points[4]; - const uint8_t* grid_8; - const uint8_t* grid_16; - skcms_Curve output_curves[4]; -} skcms_B2A; - -typedef struct skcms_CICP { - uint8_t color_primaries; - uint8_t transfer_characteristics; - uint8_t matrix_coefficients; - uint8_t video_full_range_flag; -} skcms_CICP; - -typedef struct skcms_ICCProfile { - const uint8_t* buffer; - - uint32_t size; - uint32_t data_color_space; - uint32_t pcs; - uint32_t tag_count; - - // skcms_Parse() will set commonly-used fields for you when possible: - - // If we can parse red, green and blue transfer curves from the profile, - // trc will be set to those three curves, and has_trc will be true. - bool has_trc; - skcms_Curve trc[3]; - - // If this profile's gamut can be represented by a 3x3 transform to XYZD50, - // skcms_Parse() sets toXYZD50 to that transform and has_toXYZD50 to true. - bool has_toXYZD50; - skcms_Matrix3x3 toXYZD50; - - // If the profile has a valid A2B0 or A2B1 tag, skcms_Parse() sets A2B to - // that data, and has_A2B to true. skcms_ParseWithA2BPriority() does the - // same following any user-provided prioritization of A2B0, A2B1, or A2B2. - bool has_A2B; - skcms_A2B A2B; - - // If the profile has a valid B2A0 or B2A1 tag, skcms_Parse() sets B2A to - // that data, and has_B2A to true. skcms_ParseWithA2BPriority() does the - // same following any user-provided prioritization of B2A0, B2A1, or B2A2. - bool has_B2A; - skcms_B2A B2A; - - // If the profile has a valid CICP tag, skcms_Parse() sets CICP to that data, - // and has_CICP to true. - bool has_CICP; - skcms_CICP CICP; -} skcms_ICCProfile; - -// The sRGB color profile is so commonly used that we offer a canonical skcms_ICCProfile for it. -SKCMS_API const skcms_ICCProfile* skcms_sRGB_profile(void); -// Ditto for XYZD50, the most common profile connection space. -SKCMS_API const skcms_ICCProfile* skcms_XYZD50_profile(void); - -SKCMS_API const skcms_TransferFunction* skcms_sRGB_TransferFunction(void); -SKCMS_API const skcms_TransferFunction* skcms_sRGB_Inverse_TransferFunction(void); -SKCMS_API const skcms_TransferFunction* skcms_Identity_TransferFunction(void); - -// Practical equality test for two skcms_ICCProfiles. -// The implementation is subject to change, but it will always try to answer -// "can I substitute A for B?" and "can I skip transforming from A to B?". -SKCMS_API bool skcms_ApproximatelyEqualProfiles(const skcms_ICCProfile* A, - const skcms_ICCProfile* B); - -// Practical test that answers: Is curve roughly the inverse of inv_tf? Typically used by passing -// the inverse of a known parametric transfer function (like sRGB), to determine if a particular -// curve is very close to sRGB. -SKCMS_API bool skcms_AreApproximateInverses(const skcms_Curve* curve, - const skcms_TransferFunction* inv_tf); - -// Similar to above, answering the question for all three TRC curves of the given profile. Again, -// passing skcms_sRGB_InverseTransferFunction as inv_tf will answer the question: -// "Does this profile have a transfer function that is very close to sRGB?" -SKCMS_API bool skcms_TRCs_AreApproximateInverse(const skcms_ICCProfile* profile, - const skcms_TransferFunction* inv_tf); - -// Parse an ICC profile and return true if possible, otherwise return false. -// Selects an A2B profile (if present) according to priority list (each entry 0-2). -// The buffer is not copied; it must remain valid as long as the skcms_ICCProfile will be used. -SKCMS_API bool skcms_ParseWithA2BPriority(const void*, size_t, - const int priority[], int priorities, - skcms_ICCProfile*); - -static inline bool skcms_Parse(const void* buf, size_t len, skcms_ICCProfile* profile) { - // For continuity of existing user expectations, - // prefer A2B0 (perceptual) over A2B1 (relative colormetric), and ignore A2B2 (saturation). - const int priority[] = {0,1}; - return skcms_ParseWithA2BPriority(buf, len, - priority, sizeof(priority)/sizeof(*priority), - profile); -} - -SKCMS_API bool skcms_ApproximateCurve(const skcms_Curve* curve, - skcms_TransferFunction* approx, - float* max_error); - -SKCMS_API bool skcms_GetCHAD(const skcms_ICCProfile*, skcms_Matrix3x3*); -SKCMS_API bool skcms_GetWTPT(const skcms_ICCProfile*, float xyz[3]); - -// These are common ICC signature values -enum { - // data_color_space - skcms_Signature_CMYK = 0x434D594B, - skcms_Signature_Gray = 0x47524159, - skcms_Signature_RGB = 0x52474220, - - // pcs - skcms_Signature_Lab = 0x4C616220, - skcms_Signature_XYZ = 0x58595A20, -}; - -typedef enum skcms_PixelFormat { - skcms_PixelFormat_A_8, - skcms_PixelFormat_A_8_, - skcms_PixelFormat_G_8, - skcms_PixelFormat_G_8_, - skcms_PixelFormat_RGBA_8888_Palette8, - skcms_PixelFormat_BGRA_8888_Palette8, - - skcms_PixelFormat_RGB_565, - skcms_PixelFormat_BGR_565, - - skcms_PixelFormat_ABGR_4444, - skcms_PixelFormat_ARGB_4444, - - skcms_PixelFormat_RGB_888, - skcms_PixelFormat_BGR_888, - skcms_PixelFormat_RGBA_8888, - skcms_PixelFormat_BGRA_8888, - skcms_PixelFormat_RGBA_8888_sRGB, // Automatic sRGB encoding / decoding. - skcms_PixelFormat_BGRA_8888_sRGB, // (Generally used with linear transfer functions.) - - skcms_PixelFormat_RGBA_1010102, - skcms_PixelFormat_BGRA_1010102, - - skcms_PixelFormat_RGB_161616LE, // Little-endian. Pointers must be 16-bit aligned. - skcms_PixelFormat_BGR_161616LE, - skcms_PixelFormat_RGBA_16161616LE, - skcms_PixelFormat_BGRA_16161616LE, - - skcms_PixelFormat_RGB_161616BE, // Big-endian. Pointers must be 16-bit aligned. - skcms_PixelFormat_BGR_161616BE, - skcms_PixelFormat_RGBA_16161616BE, - skcms_PixelFormat_BGRA_16161616BE, - - skcms_PixelFormat_RGB_hhh_Norm, // 1-5-10 half-precision float in [0,1] - skcms_PixelFormat_BGR_hhh_Norm, // Pointers must be 16-bit aligned. - skcms_PixelFormat_RGBA_hhhh_Norm, - skcms_PixelFormat_BGRA_hhhh_Norm, - - skcms_PixelFormat_RGB_hhh, // 1-5-10 half-precision float. - skcms_PixelFormat_BGR_hhh, // Pointers must be 16-bit aligned. - skcms_PixelFormat_RGBA_hhhh, - skcms_PixelFormat_BGRA_hhhh, - - skcms_PixelFormat_RGB_fff, // 1-8-23 single-precision float (the normal kind). - skcms_PixelFormat_BGR_fff, // Pointers must be 32-bit aligned. - skcms_PixelFormat_RGBA_ffff, - skcms_PixelFormat_BGRA_ffff, -} skcms_PixelFormat; - -// We always store any alpha channel linearly. In the chart below, tf-1() is the inverse -// transfer function for the given color profile (applying the transfer function linearizes). - -// We treat opaque as a strong requirement, not just a performance hint: we will ignore -// any source alpha and treat it as 1.0, and will make sure that any destination alpha -// channel is filled with the equivalent of 1.0. - -// We used to offer multiple types of premultiplication, but now just one, PremulAsEncoded. -// This is the premul you're probably used to working with. - -typedef enum skcms_AlphaFormat { - skcms_AlphaFormat_Opaque, // alpha is always opaque - // tf-1(r), tf-1(g), tf-1(b), 1.0 - skcms_AlphaFormat_Unpremul, // alpha and color are unassociated - // tf-1(r), tf-1(g), tf-1(b), a - skcms_AlphaFormat_PremulAsEncoded, // premultiplied while encoded - // tf-1(r)*a, tf-1(g)*a, tf-1(b)*a, a -} skcms_AlphaFormat; - -// Convert npixels pixels from src format and color profile to dst format and color profile -// and return true, otherwise return false. It is safe to alias dst == src if dstFmt == srcFmt. -SKCMS_API bool skcms_Transform(const void* src, - skcms_PixelFormat srcFmt, - skcms_AlphaFormat srcAlpha, - const skcms_ICCProfile* srcProfile, - void* dst, - skcms_PixelFormat dstFmt, - skcms_AlphaFormat dstAlpha, - const skcms_ICCProfile* dstProfile, - size_t npixels); - -// As skcms_Transform(), supporting srcFmts with a palette. -SKCMS_API bool skcms_TransformWithPalette(const void* src, - skcms_PixelFormat srcFmt, - skcms_AlphaFormat srcAlpha, - const skcms_ICCProfile* srcProfile, - void* dst, - skcms_PixelFormat dstFmt, - skcms_AlphaFormat dstAlpha, - const skcms_ICCProfile* dstProfile, - size_t npixels, - const void* palette); - -// If profile can be used as a destination in skcms_Transform, return true. Otherwise, attempt to -// rewrite it with approximations where reasonable. If successful, return true. If no reasonable -// approximation exists, leave the profile unchanged and return false. -SKCMS_API bool skcms_MakeUsableAsDestination(skcms_ICCProfile* profile); - -// If profile can be used as a destination with a single parametric transfer function (ie for -// rasterization), return true. Otherwise, attempt to rewrite it with approximations where -// reasonable. If successful, return true. If no reasonable approximation exists, leave the -// profile unchanged and return false. -SKCMS_API bool skcms_MakeUsableAsDestinationWithSingleCurve(skcms_ICCProfile* profile); - -// Returns a matrix to adapt XYZ color from given the whitepoint to D50. -SKCMS_API bool skcms_AdaptToXYZD50(float wx, float wy, - skcms_Matrix3x3* toXYZD50); - -// Returns a matrix to convert RGB color into XYZ adapted to D50, given the -// primaries and whitepoint of the RGB model. -SKCMS_API bool skcms_PrimariesToXYZD50(float rx, float ry, - float gx, float gy, - float bx, float by, - float wx, float wy, - skcms_Matrix3x3* toXYZD50); - -// Call before your first call to skcms_Transform() to skip runtime CPU detection. -SKCMS_API void skcms_DisableRuntimeCPUDetection(void); - -// Utilities for programmatically constructing profiles -static inline void skcms_Init(skcms_ICCProfile* p) { - memset(p, 0, sizeof(*p)); - p->data_color_space = skcms_Signature_RGB; - p->pcs = skcms_Signature_XYZ; -} - -static inline void skcms_SetTransferFunction(skcms_ICCProfile* p, - const skcms_TransferFunction* tf) { - p->has_trc = true; - for (int i = 0; i < 3; ++i) { - p->trc[i].table_entries = 0; - p->trc[i].parametric = *tf; - } -} - -static inline void skcms_SetXYZD50(skcms_ICCProfile* p, const skcms_Matrix3x3* m) { - p->has_toXYZD50 = true; - p->toXYZD50 = *m; -} - -#ifdef __cplusplus -} -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms_internal.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms_internal.h deleted file mode 100644 index cc6d578ba07497..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/skcms_internal.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#pragma once - -// skcms_internal.h contains APIs shared by skcms' internals and its test tools. -// Please don't use this header from outside the skcms repo. - -#include "skcms.h" -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -// ~~~~ General Helper Macros ~~~~ - #define ARRAY_COUNT(arr) (int)(sizeof((arr)) / sizeof(*(arr))) - - typedef struct skcms_ICCTag { - uint32_t signature; - uint32_t type; - uint32_t size; - const uint8_t* buf; - } skcms_ICCTag; - - void skcms_GetTagByIndex (const skcms_ICCProfile*, uint32_t idx, skcms_ICCTag*); - bool skcms_GetTagBySignature(const skcms_ICCProfile*, uint32_t sig, skcms_ICCTag*); - - float skcms_MaxRoundtripError(const skcms_Curve* curve, const skcms_TransferFunction* inv_tf); - - // 252 of a random shuffle of all possible bytes. - // 252 is evenly divisible by 3 and 4. Only 192, 10, 241, and 43 are missing. - // Used for ICC profile equivalence testing. - extern const uint8_t skcms_252_random_bytes[252]; - -// ~~~~ Portable Math ~~~~ - static inline float floorf_(float x) { - float roundtrip = (float)((int)x); - return roundtrip > x ? roundtrip - 1 : roundtrip; - } - static inline float fabsf_(float x) { return x < 0 ? -x : x; } - float powf_(float, float); - -// ~~~~ Does this pixel format need a palette pointer to be usable? ~~~~ - static inline bool needs_palette(skcms_PixelFormat fmt) { - return (fmt >> 1) == (skcms_PixelFormat_RGBA_8888_Palette8 >> 1); - } - -#ifdef __cplusplus -} -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/src/Transform_inl.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/src/Transform_inl.h deleted file mode 100644 index 7b8aa8ac1c50f2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skcms/src/Transform_inl.h +++ /dev/null @@ -1,1609 +0,0 @@ -/* - * Copyright 2018 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -// Intentionally NO #pragma once... included multiple times. - -// This file is included from skcms.cc in a namespace with some pre-defines: -// - N: depth of all vectors, 1,4,8, or 16 (preprocessor define) -// - V: a template to create a vector of N T's. - -using F = V; // Called F for historic reasons... maybe rename C? -using I32 = V; -using U64 = V; -using U32 = V; -using U16 = V; -using U8 = V; - - -#if defined(__GNUC__) && !defined(__clang__) - // Once again, GCC is kind of weird, not allowing vector = scalar directly. - static constexpr F F0 = F() + 0.0f, - F1 = F() + 1.0f, - FInfBits = F() + 0x7f800000; // equals 2139095040, the bit pattern of +Inf -#else - static constexpr F F0 = 0.0f, - F1 = 1.0f, - FInfBits = 0x7f800000; // equals 2139095040, the bit pattern of +Inf -#endif - -// Instead of checking __AVX__ below, we'll check USING_AVX. -// This lets skcms.cc set USING_AVX to force us in even if the compiler's not set that way. -// Same deal for __F16C__ and __AVX2__ ~~~> USING_AVX_F16C, USING_AVX2. - -#if !defined(USING_AVX) && N == 8 && defined(__AVX__) - #define USING_AVX -#endif -#if !defined(USING_AVX_F16C) && defined(USING_AVX) && defined(__F16C__) - #define USING AVX_F16C -#endif -#if !defined(USING_AVX2) && defined(USING_AVX) && defined(__AVX2__) - #define USING_AVX2 -#endif -#if !defined(USING_AVX512F) && N == 16 && defined(__AVX512F__) && defined(__AVX512DQ__) - #define USING_AVX512F -#endif - -// Similar to the AVX+ features, we define USING_NEON and USING_NEON_F16C. -// This is more for organizational clarity... skcms.cc doesn't force these. -#if N > 1 && defined(__ARM_NEON) - #define USING_NEON - #if __ARM_FP & 2 - #define USING_NEON_F16C - #endif - #if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC) && defined(SKCMS_OPT_INTO_NEON_FP16) - #define USING_NEON_FP16 - #endif -#endif - -// These -Wvector-conversion warnings seem to trigger in very bogus situations, -// like vst3q_f32() expecting a 16x char rather than a 4x float vector. :/ -#if defined(USING_NEON) && defined(__clang__) - #pragma clang diagnostic ignored "-Wvector-conversion" -#endif - -// GCC & Clang (but not clang-cl) warn returning U64 on x86 is larger than a register. -// You'd see warnings like, "using AVX even though AVX is not enabled". -// We stifle these warnings; our helpers that return U64 are always inlined. -#if defined(__SSE__) && defined(__GNUC__) - #if !defined(__has_warning) - #pragma GCC diagnostic ignored "-Wpsabi" - #elif __has_warning("-Wpsabi") - #pragma GCC diagnostic ignored "-Wpsabi" - #endif -#endif - -#if defined(__clang__) - #define FALLTHROUGH [[clang::fallthrough]] -#else - #define FALLTHROUGH -#endif - -// We tag most helper functions as SI, to enforce good code generation -// but also work around what we think is a bug in GCC: when targeting 32-bit -// x86, GCC tends to pass U16 (4x uint16_t vector) function arguments in the -// MMX mm0 register, which seems to mess with unrelated code that later uses -// x87 FP instructions (MMX's mm0 is an alias for x87's st0 register). -// -// It helps codegen to call __builtin_memcpy() when we know the byte count at compile time. -#if defined(__clang__) || defined(__GNUC__) - #define SI static inline __attribute__((always_inline)) -#else - #define SI static inline -#endif - -template -SI T load(const P* ptr) { - T val; - small_memcpy(&val, ptr, sizeof(val)); - return val; -} -template -SI void store(P* ptr, const T& val) { - small_memcpy(ptr, &val, sizeof(val)); -} - -// (T)v is a cast when N == 1 and a bit-pun when N>1, -// so we use cast(v) to actually cast or bit_pun(v) to bit-pun. -template -SI D cast(const S& v) { -#if N == 1 - return (D)v; -#elif defined(__clang__) - return __builtin_convertvector(v, D); -#else - D d; - for (int i = 0; i < N; i++) { - d[i] = v[i]; - } - return d; -#endif -} - -template -SI D bit_pun(const S& v) { - static_assert(sizeof(D) == sizeof(v), ""); - return load(&v); -} - -// When we convert from float to fixed point, it's very common to want to round, -// and for some reason compilers generate better code when converting to int32_t. -// To serve both those ends, we use this function to_fixed() instead of direct cast(). -#if defined(USING_NEON_FP16) - // NEON's got a F16 -> U16 instruction, so this should be fine without going via I16. - SI U16 to_fixed(F f) { return cast(f + 0.5f); } -#else - SI U32 to_fixed(F f) { return (U32)cast(f + 0.5f); } -#endif - - -// Sometimes we do something crazy on one branch of a conditonal, -// like divide by zero or convert a huge float to an integer, -// but then harmlessly select the other side. That trips up N==1 -// sanitizer builds, so we make if_then_else() a macro to avoid -// evaluating the unused side. - -#if N == 1 - #define if_then_else(cond, t, e) ((cond) ? (t) : (e)) -#else - template - SI T if_then_else(C cond, T t, T e) { - return bit_pun( ( cond & bit_pun(t)) | - (~cond & bit_pun(e)) ); - } -#endif - - -SI F F_from_Half(U16 half) { -#if defined(USING_NEON_FP16) - return bit_pun(half); -#elif defined(USING_NEON_F16C) - return vcvt_f32_f16((float16x4_t)half); -#elif defined(USING_AVX512F) - return (F)_mm512_cvtph_ps((__m256i)half); -#elif defined(USING_AVX_F16C) - typedef int16_t __attribute__((vector_size(16))) I16; - return __builtin_ia32_vcvtph2ps256((I16)half); -#else - U32 wide = cast(half); - // A half is 1-5-10 sign-exponent-mantissa, with 15 exponent bias. - U32 s = wide & 0x8000, - em = wide ^ s; - - // Constructing the float is easy if the half is not denormalized. - F norm = bit_pun( (s<<16) + (em<<13) + ((127-15)<<23) ); - - // Simply flush all denorm half floats to zero. - return if_then_else(em < 0x0400, F0, norm); -#endif -} - -#if defined(__clang__) - // The -((127-15)<<10) underflows that side of the math when - // we pass a denorm half float. It's harmless... we'll take the 0 side anyway. - __attribute__((no_sanitize("unsigned-integer-overflow"))) -#endif -SI U16 Half_from_F(F f) { -#if defined(USING_NEON_FP16) - return bit_pun(f); -#elif defined(USING_NEON_F16C) - return (U16)vcvt_f16_f32(f); -#elif defined(USING_AVX512F) - return (U16)_mm512_cvtps_ph((__m512 )f, _MM_FROUND_CUR_DIRECTION ); -#elif defined(USING_AVX_F16C) - return (U16)__builtin_ia32_vcvtps2ph256(f, 0x04/*_MM_FROUND_CUR_DIRECTION*/); -#else - // A float is 1-8-23 sign-exponent-mantissa, with 127 exponent bias. - U32 sem = bit_pun(f), - s = sem & 0x80000000, - em = sem ^ s; - - // For simplicity we flush denorm half floats (including all denorm floats) to zero. - return cast(if_then_else(em < 0x38800000, (U32)F0 - , (s>>16) + (em>>13) - ((127-15)<<10))); -#endif -} - -// Swap high and low bytes of 16-bit lanes, converting between big-endian and little-endian. -#if defined(USING_NEON_FP16) - SI U16 swap_endian_16(U16 v) { - return (U16)vrev16q_u8((uint8x16_t) v); - } -#elif defined(USING_NEON) - SI U16 swap_endian_16(U16 v) { - return (U16)vrev16_u8((uint8x8_t) v); - } -#endif - -SI U64 swap_endian_16x4(const U64& rgba) { - return (rgba & 0x00ff00ff00ff00ff) << 8 - | (rgba & 0xff00ff00ff00ff00) >> 8; -} - -#if defined(USING_NEON_FP16) - SI F min_(F x, F y) { return (F)vminq_f16((float16x8_t)x, (float16x8_t)y); } - SI F max_(F x, F y) { return (F)vmaxq_f16((float16x8_t)x, (float16x8_t)y); } -#elif defined(USING_NEON) - SI F min_(F x, F y) { return (F)vminq_f32((float32x4_t)x, (float32x4_t)y); } - SI F max_(F x, F y) { return (F)vmaxq_f32((float32x4_t)x, (float32x4_t)y); } -#else - SI F min_(F x, F y) { return if_then_else(x > y, y, x); } - SI F max_(F x, F y) { return if_then_else(x < y, y, x); } -#endif - -SI F floor_(F x) { -#if N == 1 - return floorf_(x); -#elif defined(USING_NEON_FP16) - return vrndmq_f16(x); -#elif defined(__aarch64__) - return vrndmq_f32(x); -#elif defined(USING_AVX512F) - // Clang's _mm512_floor_ps() passes its mask as -1, not (__mmask16)-1, - // and integer santizer catches that this implicit cast changes the - // value from -1 to 65535. We'll cast manually to work around it. - // Read this as `return _mm512_floor_ps(x)`. - return _mm512_mask_floor_ps(x, (__mmask16)-1, x); -#elif defined(USING_AVX) - return __builtin_ia32_roundps256(x, 0x01/*_MM_FROUND_FLOOR*/); -#elif defined(__SSE4_1__) - return _mm_floor_ps(x); -#else - // Round trip through integers with a truncating cast. - F roundtrip = cast(cast(x)); - // If x is negative, truncating gives the ceiling instead of the floor. - return roundtrip - if_then_else(roundtrip > x, F1, F0); - - // This implementation fails for values of x that are outside - // the range an integer can represent. We expect most x to be small. -#endif -} - -SI F approx_log2(F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - return x; -#else - // The first approximation of log2(x) is its exponent 'e', minus 127. - I32 bits = bit_pun(x); - - F e = cast(bits) * (1.0f / (1<<23)); - - // If we use the mantissa too we can refine the error signficantly. - F m = bit_pun( (bits & 0x007fffff) | 0x3f000000 ); - - return e - 124.225514990f - - 1.498030302f*m - - 1.725879990f/(0.3520887068f + m); -#endif -} - -SI F approx_log(F x) { - const float ln2 = 0.69314718f; - return ln2 * approx_log2(x); -} - -SI F approx_exp2(F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - return x; -#else - F fract = x - floor_(x); - - F fbits = (1.0f * (1<<23)) * (x + 121.274057500f - - 1.490129070f*fract - + 27.728023300f/(4.84252568f - fract)); - I32 bits = cast(min_(max_(fbits, F0), FInfBits)); - - return bit_pun(bits); -#endif -} - -SI F approx_pow(F x, float y) { - return if_then_else((x == F0) | (x == F1), x - , approx_exp2(approx_log2(x) * y)); -} - -SI F approx_exp(F x) { - const float log2_e = 1.4426950408889634074f; - return approx_exp2(log2_e * x); -} - -// Return tf(x). -SI F apply_tf(const skcms_TransferFunction* tf, F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - (void)tf; - return x; -#else - // Peel off the sign bit and set x = |x|. - U32 bits = bit_pun(x), - sign = bits & 0x80000000; - x = bit_pun(bits ^ sign); - - // The transfer function has a linear part up to d, exponential at d and after. - F v = if_then_else(x < tf->d, tf->c*x + tf->f - , approx_pow(tf->a*x + tf->b, tf->g) + tf->e); - - // Tack the sign bit back on. - return bit_pun(sign | bit_pun(v)); -#endif -} - -SI F apply_pq(const skcms_TransferFunction* tf, F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - (void)tf; - return x; -#else - U32 bits = bit_pun(x), - sign = bits & 0x80000000; - x = bit_pun(bits ^ sign); - - F v = approx_pow(max_(tf->a + tf->b * approx_pow(x, tf->c), F0) - / (tf->d + tf->e * approx_pow(x, tf->c)), - tf->f); - - return bit_pun(sign | bit_pun(v)); -#endif -} - -SI F apply_hlg(const skcms_TransferFunction* tf, F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - (void)tf; - return x; -#else - const float R = tf->a, G = tf->b, - a = tf->c, b = tf->d, c = tf->e, - K = tf->f + 1; - U32 bits = bit_pun(x), - sign = bits & 0x80000000; - x = bit_pun(bits ^ sign); - - F v = if_then_else(x*R <= 1, approx_pow(x*R, G) - , approx_exp((x-c)*a) + b); - - return K*bit_pun(sign | bit_pun(v)); -#endif -} - -SI F apply_hlginv(const skcms_TransferFunction* tf, F x) { -#if defined(USING_NEON_FP16) - // TODO(mtklein) - (void)tf; - return x; -#else - const float R = tf->a, G = tf->b, - a = tf->c, b = tf->d, c = tf->e, - K = tf->f + 1; - U32 bits = bit_pun(x), - sign = bits & 0x80000000; - x = bit_pun(bits ^ sign); - x /= K; - - F v = if_then_else(x <= 1, R * approx_pow(x, G) - , a * approx_log(x - b) + c); - - return bit_pun(sign | bit_pun(v)); -#endif -} - - -// Strided loads and stores of N values, starting from p. -template -SI T load_3(const P* p) { -#if N == 1 - return (T)p[0]; -#elif N == 4 - return T{p[ 0],p[ 3],p[ 6],p[ 9]}; -#elif N == 8 - return T{p[ 0],p[ 3],p[ 6],p[ 9], p[12],p[15],p[18],p[21]}; -#elif N == 16 - return T{p[ 0],p[ 3],p[ 6],p[ 9], p[12],p[15],p[18],p[21], - p[24],p[27],p[30],p[33], p[36],p[39],p[42],p[45]}; -#endif -} - -template -SI T load_4(const P* p) { -#if N == 1 - return (T)p[0]; -#elif N == 4 - return T{p[ 0],p[ 4],p[ 8],p[12]}; -#elif N == 8 - return T{p[ 0],p[ 4],p[ 8],p[12], p[16],p[20],p[24],p[28]}; -#elif N == 16 - return T{p[ 0],p[ 4],p[ 8],p[12], p[16],p[20],p[24],p[28], - p[32],p[36],p[40],p[44], p[48],p[52],p[56],p[60]}; -#endif -} - -template -SI void store_3(P* p, const T& v) { -#if N == 1 - p[0] = v; -#elif N == 4 - p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3]; -#elif N == 8 - p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3]; - p[12] = v[ 4]; p[15] = v[ 5]; p[18] = v[ 6]; p[21] = v[ 7]; -#elif N == 16 - p[ 0] = v[ 0]; p[ 3] = v[ 1]; p[ 6] = v[ 2]; p[ 9] = v[ 3]; - p[12] = v[ 4]; p[15] = v[ 5]; p[18] = v[ 6]; p[21] = v[ 7]; - p[24] = v[ 8]; p[27] = v[ 9]; p[30] = v[10]; p[33] = v[11]; - p[36] = v[12]; p[39] = v[13]; p[42] = v[14]; p[45] = v[15]; -#endif -} - -template -SI void store_4(P* p, const T& v) { -#if N == 1 - p[0] = v; -#elif N == 4 - p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3]; -#elif N == 8 - p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3]; - p[16] = v[ 4]; p[20] = v[ 5]; p[24] = v[ 6]; p[28] = v[ 7]; -#elif N == 16 - p[ 0] = v[ 0]; p[ 4] = v[ 1]; p[ 8] = v[ 2]; p[12] = v[ 3]; - p[16] = v[ 4]; p[20] = v[ 5]; p[24] = v[ 6]; p[28] = v[ 7]; - p[32] = v[ 8]; p[36] = v[ 9]; p[40] = v[10]; p[44] = v[11]; - p[48] = v[12]; p[52] = v[13]; p[56] = v[14]; p[60] = v[15]; -#endif -} - - -SI U8 gather_8(const uint8_t* p, I32 ix) { -#if N == 1 - U8 v = p[ix]; -#elif N == 4 - U8 v = { p[ix[0]], p[ix[1]], p[ix[2]], p[ix[3]] }; -#elif N == 8 - U8 v = { p[ix[0]], p[ix[1]], p[ix[2]], p[ix[3]], - p[ix[4]], p[ix[5]], p[ix[6]], p[ix[7]] }; -#elif N == 16 - U8 v = { p[ix[ 0]], p[ix[ 1]], p[ix[ 2]], p[ix[ 3]], - p[ix[ 4]], p[ix[ 5]], p[ix[ 6]], p[ix[ 7]], - p[ix[ 8]], p[ix[ 9]], p[ix[10]], p[ix[11]], - p[ix[12]], p[ix[13]], p[ix[14]], p[ix[15]] }; -#endif - return v; -} - -SI U16 gather_16(const uint8_t* p, I32 ix) { - // Load the i'th 16-bit value from p. - auto load_16 = [p](int i) { - return load(p + 2*i); - }; -#if N == 1 - U16 v = load_16(ix); -#elif N == 4 - U16 v = { load_16(ix[0]), load_16(ix[1]), load_16(ix[2]), load_16(ix[3]) }; -#elif N == 8 - U16 v = { load_16(ix[0]), load_16(ix[1]), load_16(ix[2]), load_16(ix[3]), - load_16(ix[4]), load_16(ix[5]), load_16(ix[6]), load_16(ix[7]) }; -#elif N == 16 - U16 v = { load_16(ix[ 0]), load_16(ix[ 1]), load_16(ix[ 2]), load_16(ix[ 3]), - load_16(ix[ 4]), load_16(ix[ 5]), load_16(ix[ 6]), load_16(ix[ 7]), - load_16(ix[ 8]), load_16(ix[ 9]), load_16(ix[10]), load_16(ix[11]), - load_16(ix[12]), load_16(ix[13]), load_16(ix[14]), load_16(ix[15]) }; -#endif - return v; -} - -SI U32 gather_32(const uint8_t* p, I32 ix) { - // Load the i'th 32-bit value from p. - auto load_32 = [p](int i) { - return load(p + 4*i); - }; -#if N == 1 - U32 v = load_32(ix); -#elif N == 4 - U32 v = { load_32(ix[0]), load_32(ix[1]), load_32(ix[2]), load_32(ix[3]) }; -#elif N == 8 - U32 v = { load_32(ix[0]), load_32(ix[1]), load_32(ix[2]), load_32(ix[3]), - load_32(ix[4]), load_32(ix[5]), load_32(ix[6]), load_32(ix[7]) }; -#elif N == 16 - U32 v = { load_32(ix[ 0]), load_32(ix[ 1]), load_32(ix[ 2]), load_32(ix[ 3]), - load_32(ix[ 4]), load_32(ix[ 5]), load_32(ix[ 6]), load_32(ix[ 7]), - load_32(ix[ 8]), load_32(ix[ 9]), load_32(ix[10]), load_32(ix[11]), - load_32(ix[12]), load_32(ix[13]), load_32(ix[14]), load_32(ix[15]) }; -#endif - // TODO: AVX2 and AVX-512 gathers (c.f. gather_24). - return v; -} - -SI U32 gather_24(const uint8_t* p, I32 ix) { - // First, back up a byte. Any place we're gathering from has a safe junk byte to read - // in front of it, either a previous table value, or some tag metadata. - p -= 1; - - // Load the i'th 24-bit value from p, and 1 extra byte. - auto load_24_32 = [p](int i) { - return load(p + 3*i); - }; - - // Now load multiples of 4 bytes (a junk byte, then r,g,b). -#if N == 1 - U32 v = load_24_32(ix); -#elif N == 4 - U32 v = { load_24_32(ix[0]), load_24_32(ix[1]), load_24_32(ix[2]), load_24_32(ix[3]) }; -#elif N == 8 && !defined(USING_AVX2) - U32 v = { load_24_32(ix[0]), load_24_32(ix[1]), load_24_32(ix[2]), load_24_32(ix[3]), - load_24_32(ix[4]), load_24_32(ix[5]), load_24_32(ix[6]), load_24_32(ix[7]) }; -#elif N == 8 - (void)load_24_32; - // The gather instruction here doesn't need any particular alignment, - // but the intrinsic takes a const int*. - const int* p4 = bit_pun(p); - I32 zero = { 0, 0, 0, 0, 0, 0, 0, 0}, - mask = {-1,-1,-1,-1, -1,-1,-1,-1}; - #if defined(__clang__) - U32 v = (U32)__builtin_ia32_gatherd_d256(zero, p4, 3*ix, mask, 1); - #elif defined(__GNUC__) - U32 v = (U32)__builtin_ia32_gathersiv8si(zero, p4, 3*ix, mask, 1); - #endif -#elif N == 16 - (void)load_24_32; - // The intrinsic is supposed to take const void* now, but it takes const int*, just like AVX2. - // And AVX-512 swapped the order of arguments. :/ - const int* p4 = bit_pun(p); - U32 v = (U32)_mm512_i32gather_epi32((__m512i)(3*ix), p4, 1); -#endif - - // Shift off the junk byte, leaving r,g,b in low 24 bits (and zero in the top 8). - return v >> 8; -} - -#if !defined(__arm__) - SI void gather_48(const uint8_t* p, I32 ix, U64* v) { - // As in gather_24(), with everything doubled. - p -= 2; - - // Load the i'th 48-bit value from p, and 2 extra bytes. - auto load_48_64 = [p](int i) { - return load(p + 6*i); - }; - - #if N == 1 - *v = load_48_64(ix); - #elif N == 4 - *v = U64{ - load_48_64(ix[0]), load_48_64(ix[1]), load_48_64(ix[2]), load_48_64(ix[3]), - }; - #elif N == 8 && !defined(USING_AVX2) - *v = U64{ - load_48_64(ix[0]), load_48_64(ix[1]), load_48_64(ix[2]), load_48_64(ix[3]), - load_48_64(ix[4]), load_48_64(ix[5]), load_48_64(ix[6]), load_48_64(ix[7]), - }; - #elif N == 8 - (void)load_48_64; - typedef int32_t __attribute__((vector_size(16))) Half_I32; - typedef long long __attribute__((vector_size(32))) Half_I64; - - // The gather instruction here doesn't need any particular alignment, - // but the intrinsic takes a const long long*. - const long long int* p8 = bit_pun(p); - - Half_I64 zero = { 0, 0, 0, 0}, - mask = {-1,-1,-1,-1}; - - ix *= 6; - Half_I32 ix_lo = { ix[0], ix[1], ix[2], ix[3] }, - ix_hi = { ix[4], ix[5], ix[6], ix[7] }; - - #if defined(__clang__) - Half_I64 lo = (Half_I64)__builtin_ia32_gatherd_q256(zero, p8, ix_lo, mask, 1), - hi = (Half_I64)__builtin_ia32_gatherd_q256(zero, p8, ix_hi, mask, 1); - #elif defined(__GNUC__) - Half_I64 lo = (Half_I64)__builtin_ia32_gathersiv4di(zero, p8, ix_lo, mask, 1), - hi = (Half_I64)__builtin_ia32_gathersiv4di(zero, p8, ix_hi, mask, 1); - #endif - store((char*)v + 0, lo); - store((char*)v + 32, hi); - #elif N == 16 - (void)load_48_64; - const long long int* p8 = bit_pun(p); - __m512i lo = _mm512_i32gather_epi64(_mm512_extracti32x8_epi32((__m512i)(6*ix), 0), p8, 1), - hi = _mm512_i32gather_epi64(_mm512_extracti32x8_epi32((__m512i)(6*ix), 1), p8, 1); - store((char*)v + 0, lo); - store((char*)v + 64, hi); - #endif - - *v >>= 16; - } -#endif - -SI F F_from_U8(U8 v) { - return cast(v) * (1/255.0f); -} - -SI F F_from_U16_BE(U16 v) { - // All 16-bit ICC values are big-endian, so we byte swap before converting to float. - // MSVC catches the "loss" of data here in the portable path, so we also make sure to mask. - U16 lo = (v >> 8), - hi = (v << 8) & 0xffff; - return cast(lo|hi) * (1/65535.0f); -} - -SI U16 U16_from_F(F v) { - // 65535 == inf in FP16, so promote to FP32 before converting. - return cast(cast>(v) * 65535 + 0.5f); -} - -SI F minus_1_ulp(F v) { -#if defined(USING_NEON_FP16) - return bit_pun( bit_pun(v) - 1 ); -#else - return bit_pun( bit_pun(v) - 1 ); -#endif -} - -SI F table(const skcms_Curve* curve, F v) { - // Clamp the input to [0,1], then scale to a table index. - F ix = max_(F0, min_(v, F1)) * (float)(curve->table_entries - 1); - - // We'll look up (equal or adjacent) entries at lo and hi, then lerp by t between the two. - I32 lo = cast( ix ), - hi = cast(minus_1_ulp(ix+1.0f)); - F t = ix - cast(lo); // i.e. the fractional part of ix. - - // TODO: can we load l and h simultaneously? Each entry in 'h' is either - // the same as in 'l' or adjacent. We have a rough idea that's it'd always be safe - // to read adjacent entries and perhaps underflow the table by a byte or two - // (it'd be junk, but always safe to read). Not sure how to lerp yet. - F l,h; - if (curve->table_8) { - l = F_from_U8(gather_8(curve->table_8, lo)); - h = F_from_U8(gather_8(curve->table_8, hi)); - } else { - l = F_from_U16_BE(gather_16(curve->table_16, lo)); - h = F_from_U16_BE(gather_16(curve->table_16, hi)); - } - return l + (h-l)*t; -} - -SI void sample_clut_8(const uint8_t* grid_8, I32 ix, F* r, F* g, F* b) { - U32 rgb = gather_24(grid_8, ix); - - *r = cast((rgb >> 0) & 0xff) * (1/255.0f); - *g = cast((rgb >> 8) & 0xff) * (1/255.0f); - *b = cast((rgb >> 16) & 0xff) * (1/255.0f); -} - -SI void sample_clut_8(const uint8_t* grid_8, I32 ix, F* r, F* g, F* b, F* a) { - // TODO: don't forget to optimize gather_32(). - U32 rgba = gather_32(grid_8, ix); - - *r = cast((rgba >> 0) & 0xff) * (1/255.0f); - *g = cast((rgba >> 8) & 0xff) * (1/255.0f); - *b = cast((rgba >> 16) & 0xff) * (1/255.0f); - *a = cast((rgba >> 24) & 0xff) * (1/255.0f); -} - -SI void sample_clut_16(const uint8_t* grid_16, I32 ix, F* r, F* g, F* b) { -#if defined(__arm__) - // This is up to 2x faster on 32-bit ARM than the #else-case fast path. - *r = F_from_U16_BE(gather_16(grid_16, 3*ix+0)); - *g = F_from_U16_BE(gather_16(grid_16, 3*ix+1)); - *b = F_from_U16_BE(gather_16(grid_16, 3*ix+2)); -#else - // This strategy is much faster for 64-bit builds, and fine for 32-bit x86 too. - U64 rgb; - gather_48(grid_16, ix, &rgb); - rgb = swap_endian_16x4(rgb); - - *r = cast((rgb >> 0) & 0xffff) * (1/65535.0f); - *g = cast((rgb >> 16) & 0xffff) * (1/65535.0f); - *b = cast((rgb >> 32) & 0xffff) * (1/65535.0f); -#endif -} - -SI void sample_clut_16(const uint8_t* grid_16, I32 ix, F* r, F* g, F* b, F* a) { - // TODO: gather_64()-based fast path? - *r = F_from_U16_BE(gather_16(grid_16, 4*ix+0)); - *g = F_from_U16_BE(gather_16(grid_16, 4*ix+1)); - *b = F_from_U16_BE(gather_16(grid_16, 4*ix+2)); - *a = F_from_U16_BE(gather_16(grid_16, 4*ix+3)); -} - -static void clut(uint32_t input_channels, uint32_t output_channels, - const uint8_t grid_points[4], const uint8_t* grid_8, const uint8_t* grid_16, - F* r, F* g, F* b, F* a) { - - const int dim = (int)input_channels; - assert (0 < dim && dim <= 4); - assert (output_channels == 3 || - output_channels == 4); - - // For each of these arrays, think foo[2*dim], but we use foo[8] since we know dim <= 4. - I32 index [8]; // Index contribution by dimension, first low from 0, then high from 4. - F weight[8]; // Weight for each contribution, again first low, then high. - - // O(dim) work first: calculate index,weight from r,g,b,a. - const F inputs[] = { *r,*g,*b,*a }; - for (int i = dim-1, stride = 1; i >= 0; i--) { - // x is where we logically want to sample the grid in the i-th dimension. - F x = inputs[i] * (float)(grid_points[i] - 1); - - // But we can't index at floats. lo and hi are the two integer grid points surrounding x. - I32 lo = cast( x ), // i.e. trunc(x) == floor(x) here. - hi = cast(minus_1_ulp(x+1.0f)); - // Notice how we fold in the accumulated stride across previous dimensions here. - index[i+0] = lo * stride; - index[i+4] = hi * stride; - stride *= grid_points[i]; - - // We'll interpolate between those two integer grid points by t. - F t = x - cast(lo); // i.e. fract(x) - weight[i+0] = 1-t; - weight[i+4] = t; - } - - *r = *g = *b = F0; - if (output_channels == 4) { - *a = F0; - } - - // We'll sample 2^dim == 1<input_channels, a2b->output_channels, - a2b->grid_points, a2b->grid_8, a2b->grid_16, - r,g,b,&a); -} -static void clut(const skcms_B2A* b2a, F* r, F* g, F* b, F* a) { - clut(b2a->input_channels, b2a->output_channels, - b2a->grid_points, b2a->grid_8, b2a->grid_16, - r,g,b,a); -} - -static void exec_ops(const Op* ops, const void** args, - const char* src, char* dst, int i) { - F r = F0, g = F0, b = F0, a = F1; - while (true) { - switch (*ops++) { - case Op_load_a8:{ - a = F_from_U8(load(src + 1*i)); - } break; - - case Op_load_g8:{ - r = g = b = F_from_U8(load(src + 1*i)); - } break; - - case Op_load_4444:{ - U16 abgr = load(src + 2*i); - - r = cast((abgr >> 12) & 0xf) * (1/15.0f); - g = cast((abgr >> 8) & 0xf) * (1/15.0f); - b = cast((abgr >> 4) & 0xf) * (1/15.0f); - a = cast((abgr >> 0) & 0xf) * (1/15.0f); - } break; - - case Op_load_565:{ - U16 rgb = load(src + 2*i); - - r = cast(rgb & (uint16_t)(31<< 0)) * (1.0f / (31<< 0)); - g = cast(rgb & (uint16_t)(63<< 5)) * (1.0f / (63<< 5)); - b = cast(rgb & (uint16_t)(31<<11)) * (1.0f / (31<<11)); - } break; - - case Op_load_888:{ - const uint8_t* rgb = (const uint8_t*)(src + 3*i); - #if defined(USING_NEON_FP16) - // See the explanation under USING_NEON below. This is that doubled up. - uint8x16x3_t v = {{ vdupq_n_u8(0), vdupq_n_u8(0), vdupq_n_u8(0) }}; - v = vld3q_lane_u8(rgb+ 0, v, 0); - v = vld3q_lane_u8(rgb+ 3, v, 2); - v = vld3q_lane_u8(rgb+ 6, v, 4); - v = vld3q_lane_u8(rgb+ 9, v, 6); - - v = vld3q_lane_u8(rgb+12, v, 8); - v = vld3q_lane_u8(rgb+15, v, 10); - v = vld3q_lane_u8(rgb+18, v, 12); - v = vld3q_lane_u8(rgb+21, v, 14); - - r = cast((U16)v.val[0]) * (1/255.0f); - g = cast((U16)v.val[1]) * (1/255.0f); - b = cast((U16)v.val[2]) * (1/255.0f); - #elif defined(USING_NEON) - // There's no uint8x4x3_t or vld3 load for it, so we'll load each rgb pixel one at - // a time. Since we're doing that, we might as well load them into 16-bit lanes. - // (We'd even load into 32-bit lanes, but that's not possible on ARMv7.) - uint8x8x3_t v = {{ vdup_n_u8(0), vdup_n_u8(0), vdup_n_u8(0) }}; - v = vld3_lane_u8(rgb+0, v, 0); - v = vld3_lane_u8(rgb+3, v, 2); - v = vld3_lane_u8(rgb+6, v, 4); - v = vld3_lane_u8(rgb+9, v, 6); - - // Now if we squint, those 3 uint8x8_t we constructed are really U16s, easy to - // convert to F. (Again, U32 would be even better here if drop ARMv7 or split - // ARMv7 and ARMv8 impls.) - r = cast((U16)v.val[0]) * (1/255.0f); - g = cast((U16)v.val[1]) * (1/255.0f); - b = cast((U16)v.val[2]) * (1/255.0f); - #else - r = cast(load_3(rgb+0) ) * (1/255.0f); - g = cast(load_3(rgb+1) ) * (1/255.0f); - b = cast(load_3(rgb+2) ) * (1/255.0f); - #endif - } break; - - case Op_load_8888:{ - U32 rgba = load(src + 4*i); - - r = cast((rgba >> 0) & 0xff) * (1/255.0f); - g = cast((rgba >> 8) & 0xff) * (1/255.0f); - b = cast((rgba >> 16) & 0xff) * (1/255.0f); - a = cast((rgba >> 24) & 0xff) * (1/255.0f); - } break; - - case Op_load_8888_palette8:{ - const uint8_t* palette = (const uint8_t*) *args++; - I32 ix = cast(load(src + 1*i)); - U32 rgba = gather_32(palette, ix); - - r = cast((rgba >> 0) & 0xff) * (1/255.0f); - g = cast((rgba >> 8) & 0xff) * (1/255.0f); - b = cast((rgba >> 16) & 0xff) * (1/255.0f); - a = cast((rgba >> 24) & 0xff) * (1/255.0f); - } break; - - case Op_load_1010102:{ - U32 rgba = load(src + 4*i); - - r = cast((rgba >> 0) & 0x3ff) * (1/1023.0f); - g = cast((rgba >> 10) & 0x3ff) * (1/1023.0f); - b = cast((rgba >> 20) & 0x3ff) * (1/1023.0f); - a = cast((rgba >> 30) & 0x3 ) * (1/ 3.0f); - } break; - - case Op_load_161616LE:{ - uintptr_t ptr = (uintptr_t)(src + 6*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x3_t v = vld3q_u16(rgb); - r = cast((U16)v.val[0]) * (1/65535.0f); - g = cast((U16)v.val[1]) * (1/65535.0f); - b = cast((U16)v.val[2]) * (1/65535.0f); - #elif defined(USING_NEON) - uint16x4x3_t v = vld3_u16(rgb); - r = cast((U16)v.val[0]) * (1/65535.0f); - g = cast((U16)v.val[1]) * (1/65535.0f); - b = cast((U16)v.val[2]) * (1/65535.0f); - #else - r = cast(load_3(rgb+0)) * (1/65535.0f); - g = cast(load_3(rgb+1)) * (1/65535.0f); - b = cast(load_3(rgb+2)) * (1/65535.0f); - #endif - } break; - - case Op_load_16161616LE:{ - uintptr_t ptr = (uintptr_t)(src + 8*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x4_t v = vld4q_u16(rgba); - r = cast((U16)v.val[0]) * (1/65535.0f); - g = cast((U16)v.val[1]) * (1/65535.0f); - b = cast((U16)v.val[2]) * (1/65535.0f); - a = cast((U16)v.val[3]) * (1/65535.0f); - #elif defined(USING_NEON) - uint16x4x4_t v = vld4_u16(rgba); - r = cast((U16)v.val[0]) * (1/65535.0f); - g = cast((U16)v.val[1]) * (1/65535.0f); - b = cast((U16)v.val[2]) * (1/65535.0f); - a = cast((U16)v.val[3]) * (1/65535.0f); - #else - U64 px = load(rgba); - - r = cast((px >> 0) & 0xffff) * (1/65535.0f); - g = cast((px >> 16) & 0xffff) * (1/65535.0f); - b = cast((px >> 32) & 0xffff) * (1/65535.0f); - a = cast((px >> 48) & 0xffff) * (1/65535.0f); - #endif - } break; - - case Op_load_161616BE:{ - uintptr_t ptr = (uintptr_t)(src + 6*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x3_t v = vld3q_u16(rgb); - r = cast(swap_endian_16((U16)v.val[0])) * (1/65535.0f); - g = cast(swap_endian_16((U16)v.val[1])) * (1/65535.0f); - b = cast(swap_endian_16((U16)v.val[2])) * (1/65535.0f); - #elif defined(USING_NEON) - uint16x4x3_t v = vld3_u16(rgb); - r = cast(swap_endian_16((U16)v.val[0])) * (1/65535.0f); - g = cast(swap_endian_16((U16)v.val[1])) * (1/65535.0f); - b = cast(swap_endian_16((U16)v.val[2])) * (1/65535.0f); - #else - U32 R = load_3(rgb+0), - G = load_3(rgb+1), - B = load_3(rgb+2); - // R,G,B are big-endian 16-bit, so byte swap them before converting to float. - r = cast((R & 0x00ff)<<8 | (R & 0xff00)>>8) * (1/65535.0f); - g = cast((G & 0x00ff)<<8 | (G & 0xff00)>>8) * (1/65535.0f); - b = cast((B & 0x00ff)<<8 | (B & 0xff00)>>8) * (1/65535.0f); - #endif - } break; - - case Op_load_16161616BE:{ - uintptr_t ptr = (uintptr_t)(src + 8*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x4_t v = vld4q_u16(rgba); - r = cast(swap_endian_16((U16)v.val[0])) * (1/65535.0f); - g = cast(swap_endian_16((U16)v.val[1])) * (1/65535.0f); - b = cast(swap_endian_16((U16)v.val[2])) * (1/65535.0f); - a = cast(swap_endian_16((U16)v.val[3])) * (1/65535.0f); - #elif defined(USING_NEON) - uint16x4x4_t v = vld4_u16(rgba); - r = cast(swap_endian_16((U16)v.val[0])) * (1/65535.0f); - g = cast(swap_endian_16((U16)v.val[1])) * (1/65535.0f); - b = cast(swap_endian_16((U16)v.val[2])) * (1/65535.0f); - a = cast(swap_endian_16((U16)v.val[3])) * (1/65535.0f); - #else - U64 px = swap_endian_16x4(load(rgba)); - - r = cast((px >> 0) & 0xffff) * (1/65535.0f); - g = cast((px >> 16) & 0xffff) * (1/65535.0f); - b = cast((px >> 32) & 0xffff) * (1/65535.0f); - a = cast((px >> 48) & 0xffff) * (1/65535.0f); - #endif - } break; - - case Op_load_hhh:{ - uintptr_t ptr = (uintptr_t)(src + 6*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgb = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x3_t v = vld3q_u16(rgb); - U16 R = (U16)v.val[0], - G = (U16)v.val[1], - B = (U16)v.val[2]; - #elif defined(USING_NEON) - uint16x4x3_t v = vld3_u16(rgb); - U16 R = (U16)v.val[0], - G = (U16)v.val[1], - B = (U16)v.val[2]; - #else - U16 R = load_3(rgb+0), - G = load_3(rgb+1), - B = load_3(rgb+2); - #endif - r = F_from_Half(R); - g = F_from_Half(G); - b = F_from_Half(B); - } break; - - case Op_load_hhhh:{ - uintptr_t ptr = (uintptr_t)(src + 8*i); - assert( (ptr & 1) == 0 ); // src must be 2-byte aligned for this - const uint16_t* rgba = (const uint16_t*)ptr; // cast to const uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x4_t v = vld4q_u16(rgba); - U16 R = (U16)v.val[0], - G = (U16)v.val[1], - B = (U16)v.val[2], - A = (U16)v.val[3]; - #elif defined(USING_NEON) - uint16x4x4_t v = vld4_u16(rgba); - U16 R = (U16)v.val[0], - G = (U16)v.val[1], - B = (U16)v.val[2], - A = (U16)v.val[3]; - #else - U64 px = load(rgba); - U16 R = cast((px >> 0) & 0xffff), - G = cast((px >> 16) & 0xffff), - B = cast((px >> 32) & 0xffff), - A = cast((px >> 48) & 0xffff); - #endif - r = F_from_Half(R); - g = F_from_Half(G); - b = F_from_Half(B); - a = F_from_Half(A); - } break; - - case Op_load_fff:{ - uintptr_t ptr = (uintptr_t)(src + 12*i); - assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this - const float* rgb = (const float*)ptr; // cast to const float* to be safe. - #if defined(USING_NEON_FP16) - float32x4x3_t lo = vld3q_f32(rgb + 0), - hi = vld3q_f32(rgb + 12); - r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0])); - g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1])); - b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2])); - #elif defined(USING_NEON) - float32x4x3_t v = vld3q_f32(rgb); - r = (F)v.val[0]; - g = (F)v.val[1]; - b = (F)v.val[2]; - #else - r = load_3(rgb+0); - g = load_3(rgb+1); - b = load_3(rgb+2); - #endif - } break; - - case Op_load_ffff:{ - uintptr_t ptr = (uintptr_t)(src + 16*i); - assert( (ptr & 3) == 0 ); // src must be 4-byte aligned for this - const float* rgba = (const float*)ptr; // cast to const float* to be safe. - #if defined(USING_NEON_FP16) - float32x4x4_t lo = vld4q_f32(rgba + 0), - hi = vld4q_f32(rgba + 16); - r = (F)vcombine_f16(vcvt_f16_f32(lo.val[0]), vcvt_f16_f32(hi.val[0])); - g = (F)vcombine_f16(vcvt_f16_f32(lo.val[1]), vcvt_f16_f32(hi.val[1])); - b = (F)vcombine_f16(vcvt_f16_f32(lo.val[2]), vcvt_f16_f32(hi.val[2])); - a = (F)vcombine_f16(vcvt_f16_f32(lo.val[3]), vcvt_f16_f32(hi.val[3])); - #elif defined(USING_NEON) - float32x4x4_t v = vld4q_f32(rgba); - r = (F)v.val[0]; - g = (F)v.val[1]; - b = (F)v.val[2]; - a = (F)v.val[3]; - #else - r = load_4(rgba+0); - g = load_4(rgba+1); - b = load_4(rgba+2); - a = load_4(rgba+3); - #endif - } break; - - case Op_swap_rb:{ - F t = r; - r = b; - b = t; - } break; - - case Op_clamp:{ - r = max_(F0, min_(r, F1)); - g = max_(F0, min_(g, F1)); - b = max_(F0, min_(b, F1)); - a = max_(F0, min_(a, F1)); - } break; - - case Op_invert:{ - r = F1 - r; - g = F1 - g; - b = F1 - b; - a = F1 - a; - } break; - - case Op_force_opaque:{ - a = F1; - } break; - - case Op_premul:{ - r *= a; - g *= a; - b *= a; - } break; - - case Op_unpremul:{ - F scale = if_then_else(F1 / a < INFINITY_, F1 / a, F0); - r *= scale; - g *= scale; - b *= scale; - } break; - - case Op_matrix_3x3:{ - const skcms_Matrix3x3* matrix = (const skcms_Matrix3x3*) *args++; - const float* m = &matrix->vals[0][0]; - - F R = m[0]*r + m[1]*g + m[2]*b, - G = m[3]*r + m[4]*g + m[5]*b, - B = m[6]*r + m[7]*g + m[8]*b; - - r = R; - g = G; - b = B; - } break; - - case Op_matrix_3x4:{ - const skcms_Matrix3x4* matrix = (const skcms_Matrix3x4*) *args++; - const float* m = &matrix->vals[0][0]; - - F R = m[0]*r + m[1]*g + m[ 2]*b + m[ 3], - G = m[4]*r + m[5]*g + m[ 6]*b + m[ 7], - B = m[8]*r + m[9]*g + m[10]*b + m[11]; - - r = R; - g = G; - b = B; - } break; - - case Op_lab_to_xyz:{ - // The L*a*b values are in r,g,b, but normalized to [0,1]. Reconstruct them: - F L = r * 100.0f, - A = g * 255.0f - 128.0f, - B = b * 255.0f - 128.0f; - - // Convert to CIE XYZ. - F Y = (L + 16.0f) * (1/116.0f), - X = Y + A*(1/500.0f), - Z = Y - B*(1/200.0f); - - X = if_then_else(X*X*X > 0.008856f, X*X*X, (X - (16/116.0f)) * (1/7.787f)); - Y = if_then_else(Y*Y*Y > 0.008856f, Y*Y*Y, (Y - (16/116.0f)) * (1/7.787f)); - Z = if_then_else(Z*Z*Z > 0.008856f, Z*Z*Z, (Z - (16/116.0f)) * (1/7.787f)); - - // Adjust to XYZD50 illuminant, and stuff back into r,g,b for the next op. - r = X * 0.9642f; - g = Y ; - b = Z * 0.8249f; - } break; - - // As above, in reverse. - case Op_xyz_to_lab:{ - F X = r * (1/0.9642f), - Y = g, - Z = b * (1/0.8249f); - - X = if_then_else(X > 0.008856f, approx_pow(X, 1/3.0f), X*7.787f + (16/116.0f)); - Y = if_then_else(Y > 0.008856f, approx_pow(Y, 1/3.0f), Y*7.787f + (16/116.0f)); - Z = if_then_else(Z > 0.008856f, approx_pow(Z, 1/3.0f), Z*7.787f + (16/116.0f)); - - F L = Y*116.0f - 16.0f, - A = (X-Y)*500.0f, - B = (Y-Z)*200.0f; - - r = L * (1/100.f); - g = (A + 128.0f) * (1/255.0f); - b = (B + 128.0f) * (1/255.0f); - } break; - - case Op_tf_r:{ r = apply_tf((const skcms_TransferFunction*)*args++, r); } break; - case Op_tf_g:{ g = apply_tf((const skcms_TransferFunction*)*args++, g); } break; - case Op_tf_b:{ b = apply_tf((const skcms_TransferFunction*)*args++, b); } break; - case Op_tf_a:{ a = apply_tf((const skcms_TransferFunction*)*args++, a); } break; - - case Op_pq_r:{ r = apply_pq((const skcms_TransferFunction*)*args++, r); } break; - case Op_pq_g:{ g = apply_pq((const skcms_TransferFunction*)*args++, g); } break; - case Op_pq_b:{ b = apply_pq((const skcms_TransferFunction*)*args++, b); } break; - case Op_pq_a:{ a = apply_pq((const skcms_TransferFunction*)*args++, a); } break; - - case Op_hlg_r:{ r = apply_hlg((const skcms_TransferFunction*)*args++, r); } break; - case Op_hlg_g:{ g = apply_hlg((const skcms_TransferFunction*)*args++, g); } break; - case Op_hlg_b:{ b = apply_hlg((const skcms_TransferFunction*)*args++, b); } break; - case Op_hlg_a:{ a = apply_hlg((const skcms_TransferFunction*)*args++, a); } break; - - case Op_hlginv_r:{ r = apply_hlginv((const skcms_TransferFunction*)*args++, r); } break; - case Op_hlginv_g:{ g = apply_hlginv((const skcms_TransferFunction*)*args++, g); } break; - case Op_hlginv_b:{ b = apply_hlginv((const skcms_TransferFunction*)*args++, b); } break; - case Op_hlginv_a:{ a = apply_hlginv((const skcms_TransferFunction*)*args++, a); } break; - - case Op_table_r: { r = table((const skcms_Curve*)*args++, r); } break; - case Op_table_g: { g = table((const skcms_Curve*)*args++, g); } break; - case Op_table_b: { b = table((const skcms_Curve*)*args++, b); } break; - case Op_table_a: { a = table((const skcms_Curve*)*args++, a); } break; - - case Op_clut_A2B: { - const skcms_A2B* a2b = (const skcms_A2B*) *args++; - clut(a2b, &r,&g,&b,a); - - if (a2b->input_channels == 4) { - // CMYK is opaque. - a = F1; - } - } break; - - case Op_clut_B2A: { - const skcms_B2A* b2a = (const skcms_B2A*) *args++; - clut(b2a, &r,&g,&b,&a); - } break; - - // Notice, from here on down the store_ ops all return, ending the loop. - - case Op_store_a8: { - store(dst + 1*i, cast(to_fixed(a * 255))); - } return; - - case Op_store_g8: { - // g should be holding luminance (Y) (r,g,b ~~~> X,Y,Z) - store(dst + 1*i, cast(to_fixed(g * 255))); - } return; - - case Op_store_4444: { - store(dst + 2*i, cast(to_fixed(r * 15) << 12) - | cast(to_fixed(g * 15) << 8) - | cast(to_fixed(b * 15) << 4) - | cast(to_fixed(a * 15) << 0)); - } return; - - case Op_store_565: { - store(dst + 2*i, cast(to_fixed(r * 31) << 0 ) - | cast(to_fixed(g * 63) << 5 ) - | cast(to_fixed(b * 31) << 11 )); - } return; - - case Op_store_888: { - uint8_t* rgb = (uint8_t*)dst + 3*i; - #if defined(USING_NEON_FP16) - // See the explanation under USING_NEON below. This is that doubled up. - U16 R = to_fixed(r * 255), - G = to_fixed(g * 255), - B = to_fixed(b * 255); - - uint8x16x3_t v = {{ (uint8x16_t)R, (uint8x16_t)G, (uint8x16_t)B }}; - vst3q_lane_u8(rgb+ 0, v, 0); - vst3q_lane_u8(rgb+ 3, v, 2); - vst3q_lane_u8(rgb+ 6, v, 4); - vst3q_lane_u8(rgb+ 9, v, 6); - - vst3q_lane_u8(rgb+12, v, 8); - vst3q_lane_u8(rgb+15, v, 10); - vst3q_lane_u8(rgb+18, v, 12); - vst3q_lane_u8(rgb+21, v, 14); - #elif defined(USING_NEON) - // Same deal as load_888 but in reverse... we'll store using uint8x8x3_t, but - // get there via U16 to save some instructions converting to float. And just - // like load_888, we'd prefer to go via U32 but for ARMv7 support. - U16 R = cast(to_fixed(r * 255)), - G = cast(to_fixed(g * 255)), - B = cast(to_fixed(b * 255)); - - uint8x8x3_t v = {{ (uint8x8_t)R, (uint8x8_t)G, (uint8x8_t)B }}; - vst3_lane_u8(rgb+0, v, 0); - vst3_lane_u8(rgb+3, v, 2); - vst3_lane_u8(rgb+6, v, 4); - vst3_lane_u8(rgb+9, v, 6); - #else - store_3(rgb+0, cast(to_fixed(r * 255)) ); - store_3(rgb+1, cast(to_fixed(g * 255)) ); - store_3(rgb+2, cast(to_fixed(b * 255)) ); - #endif - } return; - - case Op_store_8888: { - store(dst + 4*i, cast(to_fixed(r * 255)) << 0 - | cast(to_fixed(g * 255)) << 8 - | cast(to_fixed(b * 255)) << 16 - | cast(to_fixed(a * 255)) << 24); - } return; - - case Op_store_1010102: { - store(dst + 4*i, cast(to_fixed(r * 1023)) << 0 - | cast(to_fixed(g * 1023)) << 10 - | cast(to_fixed(b * 1023)) << 20 - | cast(to_fixed(a * 3)) << 30); - } return; - - case Op_store_161616LE: { - uintptr_t ptr = (uintptr_t)(dst + 6*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x3_t v = {{ - (uint16x8_t)U16_from_F(r), - (uint16x8_t)U16_from_F(g), - (uint16x8_t)U16_from_F(b), - }}; - vst3q_u16(rgb, v); - #elif defined(USING_NEON) - uint16x4x3_t v = {{ - (uint16x4_t)U16_from_F(r), - (uint16x4_t)U16_from_F(g), - (uint16x4_t)U16_from_F(b), - }}; - vst3_u16(rgb, v); - #else - store_3(rgb+0, U16_from_F(r)); - store_3(rgb+1, U16_from_F(g)); - store_3(rgb+2, U16_from_F(b)); - #endif - - } return; - - case Op_store_16161616LE: { - uintptr_t ptr = (uintptr_t)(dst + 8*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x4_t v = {{ - (uint16x8_t)U16_from_F(r), - (uint16x8_t)U16_from_F(g), - (uint16x8_t)U16_from_F(b), - (uint16x8_t)U16_from_F(a), - }}; - vst4q_u16(rgba, v); - #elif defined(USING_NEON) - uint16x4x4_t v = {{ - (uint16x4_t)U16_from_F(r), - (uint16x4_t)U16_from_F(g), - (uint16x4_t)U16_from_F(b), - (uint16x4_t)U16_from_F(a), - }}; - vst4_u16(rgba, v); - #else - U64 px = cast(to_fixed(r * 65535)) << 0 - | cast(to_fixed(g * 65535)) << 16 - | cast(to_fixed(b * 65535)) << 32 - | cast(to_fixed(a * 65535)) << 48; - store(rgba, px); - #endif - } return; - - case Op_store_161616BE: { - uintptr_t ptr = (uintptr_t)(dst + 6*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x3_t v = {{ - (uint16x8_t)swap_endian_16(U16_from_F(r)), - (uint16x8_t)swap_endian_16(U16_from_F(g)), - (uint16x8_t)swap_endian_16(U16_from_F(b)), - }}; - vst3q_u16(rgb, v); - #elif defined(USING_NEON) - uint16x4x3_t v = {{ - (uint16x4_t)swap_endian_16(cast(U16_from_F(r))), - (uint16x4_t)swap_endian_16(cast(U16_from_F(g))), - (uint16x4_t)swap_endian_16(cast(U16_from_F(b))), - }}; - vst3_u16(rgb, v); - #else - U32 R = to_fixed(r * 65535), - G = to_fixed(g * 65535), - B = to_fixed(b * 65535); - store_3(rgb+0, cast((R & 0x00ff) << 8 | (R & 0xff00) >> 8) ); - store_3(rgb+1, cast((G & 0x00ff) << 8 | (G & 0xff00) >> 8) ); - store_3(rgb+2, cast((B & 0x00ff) << 8 | (B & 0xff00) >> 8) ); - #endif - - } return; - - case Op_store_16161616BE: { - uintptr_t ptr = (uintptr_t)(dst + 8*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - #if defined(USING_NEON_FP16) - uint16x8x4_t v = {{ - (uint16x8_t)swap_endian_16(U16_from_F(r)), - (uint16x8_t)swap_endian_16(U16_from_F(g)), - (uint16x8_t)swap_endian_16(U16_from_F(b)), - (uint16x8_t)swap_endian_16(U16_from_F(a)), - }}; - vst4q_u16(rgba, v); - #elif defined(USING_NEON) - uint16x4x4_t v = {{ - (uint16x4_t)swap_endian_16(cast(U16_from_F(r))), - (uint16x4_t)swap_endian_16(cast(U16_from_F(g))), - (uint16x4_t)swap_endian_16(cast(U16_from_F(b))), - (uint16x4_t)swap_endian_16(cast(U16_from_F(a))), - }}; - vst4_u16(rgba, v); - #else - U64 px = cast(to_fixed(r * 65535)) << 0 - | cast(to_fixed(g * 65535)) << 16 - | cast(to_fixed(b * 65535)) << 32 - | cast(to_fixed(a * 65535)) << 48; - store(rgba, swap_endian_16x4(px)); - #endif - } return; - - case Op_store_hhh: { - uintptr_t ptr = (uintptr_t)(dst + 6*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgb = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - - U16 R = Half_from_F(r), - G = Half_from_F(g), - B = Half_from_F(b); - #if defined(USING_NEON_FP16) - uint16x8x3_t v = {{ - (uint16x8_t)R, - (uint16x8_t)G, - (uint16x8_t)B, - }}; - vst3q_u16(rgb, v); - #elif defined(USING_NEON) - uint16x4x3_t v = {{ - (uint16x4_t)R, - (uint16x4_t)G, - (uint16x4_t)B, - }}; - vst3_u16(rgb, v); - #else - store_3(rgb+0, R); - store_3(rgb+1, G); - store_3(rgb+2, B); - #endif - } return; - - case Op_store_hhhh: { - uintptr_t ptr = (uintptr_t)(dst + 8*i); - assert( (ptr & 1) == 0 ); // The dst pointer must be 2-byte aligned - uint16_t* rgba = (uint16_t*)ptr; // for this cast to uint16_t* to be safe. - - U16 R = Half_from_F(r), - G = Half_from_F(g), - B = Half_from_F(b), - A = Half_from_F(a); - #if defined(USING_NEON_FP16) - uint16x8x4_t v = {{ - (uint16x8_t)R, - (uint16x8_t)G, - (uint16x8_t)B, - (uint16x8_t)A, - }}; - vst4q_u16(rgba, v); - #elif defined(USING_NEON) - uint16x4x4_t v = {{ - (uint16x4_t)R, - (uint16x4_t)G, - (uint16x4_t)B, - (uint16x4_t)A, - }}; - vst4_u16(rgba, v); - #else - store(rgba, cast(R) << 0 - | cast(G) << 16 - | cast(B) << 32 - | cast(A) << 48); - #endif - - } return; - - case Op_store_fff: { - uintptr_t ptr = (uintptr_t)(dst + 12*i); - assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned - float* rgb = (float*)ptr; // for this cast to float* to be safe. - #if defined(USING_NEON_FP16) - float32x4x3_t lo = {{ - vcvt_f32_f16(vget_low_f16(r)), - vcvt_f32_f16(vget_low_f16(g)), - vcvt_f32_f16(vget_low_f16(b)), - }}, hi = {{ - vcvt_f32_f16(vget_high_f16(r)), - vcvt_f32_f16(vget_high_f16(g)), - vcvt_f32_f16(vget_high_f16(b)), - }}; - vst3q_f32(rgb + 0, lo); - vst3q_f32(rgb + 12, hi); - #elif defined(USING_NEON) - float32x4x3_t v = {{ - (float32x4_t)r, - (float32x4_t)g, - (float32x4_t)b, - }}; - vst3q_f32(rgb, v); - #else - store_3(rgb+0, r); - store_3(rgb+1, g); - store_3(rgb+2, b); - #endif - } return; - - case Op_store_ffff: { - uintptr_t ptr = (uintptr_t)(dst + 16*i); - assert( (ptr & 3) == 0 ); // The dst pointer must be 4-byte aligned - float* rgba = (float*)ptr; // for this cast to float* to be safe. - #if defined(USING_NEON_FP16) - float32x4x4_t lo = {{ - vcvt_f32_f16(vget_low_f16(r)), - vcvt_f32_f16(vget_low_f16(g)), - vcvt_f32_f16(vget_low_f16(b)), - vcvt_f32_f16(vget_low_f16(a)), - }}, hi = {{ - vcvt_f32_f16(vget_high_f16(r)), - vcvt_f32_f16(vget_high_f16(g)), - vcvt_f32_f16(vget_high_f16(b)), - vcvt_f32_f16(vget_high_f16(a)), - }}; - vst4q_f32(rgba + 0, lo); - vst4q_f32(rgba + 16, hi); - #elif defined(USING_NEON) - float32x4x4_t v = {{ - (float32x4_t)r, - (float32x4_t)g, - (float32x4_t)b, - (float32x4_t)a, - }}; - vst4q_f32(rgba, v); - #else - store_4(rgba+0, r); - store_4(rgba+1, g); - store_4(rgba+2, b); - store_4(rgba+3, a); - #endif - } return; - } - } -} - - -static void run_program(const Op* program, const void** arguments, - const char* src, char* dst, int n, - const size_t src_bpp, const size_t dst_bpp) { - int i = 0; - while (n >= N) { - exec_ops(program, arguments, src, dst, i); - i += N; - n -= N; - } - if (n > 0) { - char tmp[4*4*N] = {0}; - - memcpy(tmp, (const char*)src + (size_t)i*src_bpp, (size_t)n*src_bpp); - exec_ops(program, arguments, tmp, tmp, 0); - memcpy((char*)dst + (size_t)i*dst_bpp, tmp, (size_t)n*dst_bpp); - } -} - -// Clean up any #defines we may have set so that we can be #included again. -#if defined(USING_AVX) - #undef USING_AVX -#endif -#if defined(USING_AVX_F16C) - #undef USING_AVX_F16C -#endif -#if defined(USING_AVX2) - #undef USING_AVX2 -#endif -#if defined(USING_AVX512F) - #undef USING_AVX512F -#endif - -#if defined(USING_NEON) - #undef USING_NEON -#endif -#if defined(USING_NEON_F16C) - #undef USING_NEON_F16C -#endif -#if defined(USING_NEON_FP16) - #undef USING_NEON_FP16 -#endif - -#undef FALLTHROUGH diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/DartTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/DartTypes.h deleted file mode 100644 index 289a9ffd99fea9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/DartTypes.h +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2019 Google LLC. - -#ifndef DartTypes_DEFINED -#define DartTypes_DEFINED - -#include "include/core/SkRect.h" -#include "include/core/SkTypes.h" - -#include -#include -#include - -namespace skia { -namespace textlayout { - -enum Affinity { kUpstream, kDownstream }; - -enum class RectHeightStyle { - // Provide tight bounding boxes that fit heights per run. - kTight, - - // The height of the boxes will be the maximum height of all runs in the - // line. All rects in the same line will be the same height. - kMax, - - // Extends the top and/or bottom edge of the bounds to fully cover any line - // spacing. The top edge of each line should be the same as the bottom edge - // of the line above. There should be no gaps in vertical coverage given any - // ParagraphStyle line_height. - // - // The top and bottom of each rect will cover half of the - // space above and half of the space below the line. - kIncludeLineSpacingMiddle, - // The line spacing will be added to the top of the rect. - kIncludeLineSpacingTop, - // The line spacing will be added to the bottom of the rect. - kIncludeLineSpacingBottom, - // - kStrut -}; - -enum class RectWidthStyle { - // Provide tight bounding boxes that fit widths to the runs of each line - // independently. - kTight, - - // Extends the width of the last rect of each line to match the position of - // the widest rect over all the lines. - kMax -}; - -enum class TextAlign { - kLeft, - kRight, - kCenter, - kJustify, - kStart, - kEnd, -}; - -enum class TextDirection { - kRtl, - kLtr, -}; - -struct PositionWithAffinity { - int32_t position; - Affinity affinity; - - PositionWithAffinity() : position(0), affinity(kDownstream) {} - PositionWithAffinity(int32_t p, Affinity a) : position(p), affinity(a) {} -}; - -struct TextBox { - SkRect rect; - TextDirection direction; - - TextBox(SkRect r, TextDirection d) : rect(r), direction(d) {} -}; - -// ------------------------------------------------------------------- -// --- Reversed iterable - -template -UnaryFunction directional_for_each(C& c, bool forwards, UnaryFunction f) { - return forwards - ? std::for_each(std::begin(c), std::end(c), f) - : std::for_each(std::rbegin(c), std::rend(c), f); -} - -const size_t EMPTY_INDEX = std::numeric_limits::max(); -template struct SkRange { - SkRange() : start(), end() {} - SkRange(T s, T e) : start(s), end(e) {} - - using SignedT = std::make_signed_t; - - T start, end; - - bool operator==(const SkRange& other) const { - return start == other.start && end == other.end; - } - - T width() const { return end - start; } - - void Shift(SignedT delta) { - start += delta; - end += delta; - } - - bool contains(SkRange other) const { - return start <= other.start && end >= other.end; - } - - bool intersects(SkRange other) const { - return std::max(start, other.start) <= std::min(end, other.end); - } - - SkRange intersection(SkRange other) const { - return SkRange(std::max(start, other.start), std::min(end, other.end)); - } - - bool empty() const { - return start == EMPTY_INDEX && end == EMPTY_INDEX; - } -}; - -const SkRange EMPTY_RANGE = SkRange(EMPTY_INDEX, EMPTY_INDEX); - - -enum class TextBaseline { - kAlphabetic, - kIdeographic, -}; - -enum TextHeightBehavior { - kAll = 0x0, - kDisableFirstAscent = 0x1, - kDisableLastDescent = 0x2, - kDisableAll = 0x1 | 0x2, -}; - -enum class LineMetricStyle : uint8_t { - // Use ascent, descent, etc from a fixed baseline. - Typographic, - // Use ascent, descent, etc like css with the leading split and with height adjustments - CSS -}; - -} // namespace textlayout -} // namespace skia - -#endif // DartTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontArguments.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontArguments.h deleted file mode 100644 index 9560c0f18ca9f8..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontArguments.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef FontArguments_DEFINED -#define FontArguments_DEFINED - -#include -#include -#include "include/core/SkFontArguments.h" -#include "include/core/SkTypeface.h" - -namespace skia { -namespace textlayout { - -class FontArguments { -public: - FontArguments(const SkFontArguments&); - FontArguments(const FontArguments&) = default; - FontArguments(FontArguments&&) = default; - - FontArguments& operator=(const FontArguments&) = default; - FontArguments& operator=(FontArguments&&) = default; - - sk_sp CloneTypeface(sk_sp typeface) const; - - friend bool operator==(const FontArguments& a, const FontArguments& b); - friend bool operator!=(const FontArguments& a, const FontArguments& b); - friend struct std::hash; - -private: - FontArguments() = delete; - - int fCollectionIndex; - std::vector fCoordinates; - int fPaletteIndex; - std::vector fPaletteOverrides; -}; - -} // namespace textlayout -} // namespace skia - -namespace std { - template<> struct hash { - size_t operator()(const skia::textlayout::FontArguments& args) const; - }; -} - -#endif // FontArguments_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontCollection.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontCollection.h deleted file mode 100644 index a119e4b28d2c7e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/FontCollection.h +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef FontCollection_DEFINED -#define FontCollection_DEFINED - -#include -#include -#include -#include "include/core/SkFontMgr.h" -#include "include/core/SkRefCnt.h" -#include "include/private/SkTHash.h" -#include "modules/skparagraph/include/FontArguments.h" -#include "modules/skparagraph/include/ParagraphCache.h" -#include "modules/skparagraph/include/TextStyle.h" - -namespace skia { -namespace textlayout { - -class TextStyle; -class Paragraph; -class FontCollection : public SkRefCnt { -public: - FontCollection(); - - size_t getFontManagersCount() const; - - void setAssetFontManager(sk_sp fontManager); - void setDynamicFontManager(sk_sp fontManager); - void setTestFontManager(sk_sp fontManager); - void setDefaultFontManager(sk_sp fontManager); - void setDefaultFontManager(sk_sp fontManager, const char defaultFamilyName[]); - void setDefaultFontManager(sk_sp fontManager, const std::vector& defaultFamilyNames); - - sk_sp getFallbackManager() const { return fDefaultFontManager; } - - std::vector> findTypefaces(const std::vector& familyNames, SkFontStyle fontStyle); - std::vector> findTypefaces(const std::vector& familyNames, SkFontStyle fontStyle, const std::optional& fontArgs); - - sk_sp defaultFallback(SkUnichar unicode, SkFontStyle fontStyle, const SkString& locale); - sk_sp defaultFallback(); - - void disableFontFallback(); - void enableFontFallback(); - bool fontFallbackEnabled() { return fEnableFontFallback; } - - ParagraphCache* getParagraphCache() { return &fParagraphCache; } - - void clearCaches(); - -private: - std::vector> getFontManagerOrder() const; - - sk_sp matchTypeface(const SkString& familyName, SkFontStyle fontStyle); - - struct FamilyKey { - FamilyKey(const std::vector& familyNames, SkFontStyle style, const std::optional& args) - : fFamilyNames(familyNames), fFontStyle(style), fFontArguments(args) {} - - FamilyKey() {} - - std::vector fFamilyNames; - SkFontStyle fFontStyle; - std::optional fFontArguments; - - bool operator==(const FamilyKey& other) const; - - struct Hasher { - size_t operator()(const FamilyKey& key) const; - }; - }; - - bool fEnableFontFallback; - SkTHashMap>, FamilyKey::Hasher> fTypefaces; - sk_sp fDefaultFontManager; - sk_sp fAssetFontManager; - sk_sp fDynamicFontManager; - sk_sp fTestFontManager; - - std::vector fDefaultFamilyNames; - ParagraphCache fParagraphCache; -}; -} // namespace textlayout -} // namespace skia - -#endif // FontCollection_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Metrics.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Metrics.h deleted file mode 100644 index 4b8581ef7f55d4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Metrics.h +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef Metrics_DEFINED -#define Metrics_DEFINED - -#include -#include "modules/skparagraph/include/TextStyle.h" - -namespace skia { -namespace textlayout { -class StyleMetrics { -public: - StyleMetrics(const TextStyle* style) : text_style(style) {} - - StyleMetrics(const TextStyle* style, SkFontMetrics& metrics) - : text_style(style), font_metrics(metrics) {} - - const TextStyle* text_style; - - // SkFontMetrics contains the following metrics: - // - // * Top distance to reserve above baseline - // * Ascent distance to reserve below baseline - // * Descent extent below baseline - // * Bottom extent below baseline - // * Leading distance to add between lines - // * AvgCharWidth average character width - // * MaxCharWidth maximum character width - // * XMin minimum x - // * XMax maximum x - // * XHeight height of lower-case 'x' - // * CapHeight height of an upper-case letter - // * UnderlineThickness underline thickness - // * UnderlinePosition underline position relative to baseline - // * StrikeoutThickness strikeout thickness - // * StrikeoutPosition strikeout position relative to baseline - SkFontMetrics font_metrics; -}; - -class LineMetrics { -public: - LineMetrics() { } - - LineMetrics(size_t start, - size_t end, - size_t end_excluding_whitespace, - size_t end_including_newline, - bool hard_break) - : fStartIndex(start) - , fEndIndex(end) - , fEndExcludingWhitespaces(end_excluding_whitespace) - , fEndIncludingNewline(end_including_newline) - , fHardBreak(hard_break) {} - // The following fields are used in the layout process itself. - - // The indexes in the text buffer the line begins and ends. - size_t fStartIndex = 0; - size_t fEndIndex = 0; - size_t fEndExcludingWhitespaces = 0; - size_t fEndIncludingNewline = 0; - bool fHardBreak = false; - - // The following fields are tracked after or during layout to provide to - // the user as well as for computing bounding boxes. - - // The final computed ascent and descent for the line. This can be impacted by - // the strut, height, scaling, as well as outlying runs that are very tall. - // - // The top edge is `baseline - ascent` and the bottom edge is `baseline + - // descent`. Ascent and descent are provided as positive numbers. Raw numbers - // for specific runs of text can be obtained in run_metrics_map. These values - // are the cumulative metrics for the entire line. - double fAscent = SK_ScalarMax; - double fDescent = SK_ScalarMin; - double fUnscaledAscent = SK_ScalarMax; - // Total height of the paragraph including the current line. - // - // The height of the current line is `round(ascent + descent)`. - double fHeight = 0.0; - // Width of the line. - double fWidth = 0.0; - // The left edge of the line. The right edge can be obtained with `left + - // width` - double fLeft = 0.0; - // The y position of the baseline for this line from the top of the paragraph. - double fBaseline = 0.0; - // Zero indexed line number - size_t fLineNumber = 0; - - // Mapping between text index ranges and the FontMetrics associated with - // them. The first run will be keyed under start_index. The metrics here - // are before layout and are the base values we calculate from. - std::map fLineMetrics; -}; - -} // namespace textlayout -} // namespace skia - -#endif // Metrics_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Paragraph.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Paragraph.h deleted file mode 100644 index 5c5503876bec82..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/Paragraph.h +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef Paragraph_DEFINED -#define Paragraph_DEFINED - -#include "modules/skparagraph/include/FontCollection.h" -#include "modules/skparagraph/include/Metrics.h" -#include "modules/skparagraph/include/ParagraphStyle.h" -#include "modules/skparagraph/include/TextStyle.h" - -class SkCanvas; - -namespace skia { -namespace textlayout { - -class Paragraph { - -public: - Paragraph(ParagraphStyle style, sk_sp fonts); - - virtual ~Paragraph() = default; - - SkScalar getMaxWidth() { return fWidth; } - - SkScalar getHeight() { return fHeight; } - - SkScalar getMinIntrinsicWidth() { return fMinIntrinsicWidth; } - - SkScalar getMaxIntrinsicWidth() { return fMaxIntrinsicWidth; } - - SkScalar getAlphabeticBaseline() { return fAlphabeticBaseline; } - - SkScalar getIdeographicBaseline() { return fIdeographicBaseline; } - - SkScalar getLongestLine() { return fLongestLine; } - - bool didExceedMaxLines() { return fExceededMaxLines; } - - virtual void layout(SkScalar width) = 0; - - virtual void paint(SkCanvas* canvas, SkScalar x, SkScalar y) = 0; - - // Returns a vector of bounding boxes that enclose all text between - // start and end glyph indexes, including start and excluding end - virtual std::vector getRectsForRange(unsigned start, - unsigned end, - RectHeightStyle rectHeightStyle, - RectWidthStyle rectWidthStyle) = 0; - - virtual std::vector getRectsForPlaceholders() = 0; - - // Returns the index of the glyph that corresponds to the provided coordinate, - // with the top left corner as the origin, and +y direction as down - virtual PositionWithAffinity getGlyphPositionAtCoordinate(SkScalar dx, SkScalar dy) = 0; - - // Finds the first and last glyphs that define a word containing - // the glyph at index offset - virtual SkRange getWordBoundary(unsigned offset) = 0; - - virtual void getLineMetrics(std::vector&) = 0; - - virtual size_t lineNumber() = 0; - - virtual void markDirty() = 0; - - // This function will return the number of unresolved glyphs or - // -1 if not applicable (has not been shaped yet - valid case) - virtual int32_t unresolvedGlyphs() = 0; - - // Experimental API that allows fast way to update "immutable" paragraph - virtual void updateTextAlign(TextAlign textAlign) = 0; - virtual void updateText(size_t from, SkString text) = 0; - virtual void updateFontSize(size_t from, size_t to, SkScalar fontSize) = 0; - virtual void updateForegroundPaint(size_t from, size_t to, SkPaint paint) = 0; - virtual void updateBackgroundPaint(size_t from, size_t to, SkPaint paint) = 0; - - enum VisitorFlags { - kWhiteSpace_VisitorFlag = 1 << 0, - }; - struct VisitorInfo { - const SkFont& font; - SkPoint origin; - SkScalar advanceX; - int count; - const uint16_t* glyphs; // count values - const SkPoint* positions; // count values - const uint32_t* utf8Starts; // count+1 values - unsigned flags; - }; - - // lineNumber begins at 0. If info is null, this signals the end of that line. - using Visitor = std::function; - virtual void visit(const Visitor&) = 0; - -protected: - sk_sp fFontCollection; - ParagraphStyle fParagraphStyle; - - // Things for Flutter - SkScalar fAlphabeticBaseline; - SkScalar fIdeographicBaseline; - SkScalar fHeight; - SkScalar fWidth; - SkScalar fMaxIntrinsicWidth; - SkScalar fMinIntrinsicWidth; - SkScalar fLongestLine; - bool fExceededMaxLines; -}; -} // namespace textlayout -} // namespace skia - -#endif // Paragraph_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h deleted file mode 100644 index a76d4b0bb3172d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphBuilder.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef ParagraphBuilder_DEFINED -#define ParagraphBuilder_DEFINED - -#include -#include -#include -#include -#include "modules/skparagraph/include/FontCollection.h" -#include "modules/skparagraph/include/Paragraph.h" -#include "modules/skparagraph/include/ParagraphStyle.h" -#include "modules/skparagraph/include/TextStyle.h" - -namespace skia { -namespace textlayout { - -class ParagraphBuilder { -public: - ParagraphBuilder(const ParagraphStyle&, sk_sp) { } - - virtual ~ParagraphBuilder() = default; - - // Push a style to the stack. The corresponding text added with AddText will - // use the top-most style. - virtual void pushStyle(const TextStyle& style) = 0; - - // Remove a style from the stack. Useful to apply different styles to chunks - // of text such as bolding. - // Example: - // builder.PushStyle(normal_style); - // builder.AddText("Hello this is normal. "); - // - // builder.PushStyle(bold_style); - // builder.AddText("And this is BOLD. "); - // - // builder.Pop(); - // builder.AddText(" Back to normal again."); - virtual void pop() = 0; - - virtual TextStyle peekStyle() = 0; - - // Adds UTF16-encoded text to the builder. Forms the proper runs to use the upper-most style - // on the style_stack. - virtual void addText(const std::u16string& text) = 0; - - // Adds UTF8-encoded text to the builder, using the top-most style on the style_stack. - virtual void addText(const char* text) = 0; - virtual void addText(const char* text, size_t len) = 0; - - // Pushes the information required to leave an open space, where Flutter may - // draw a custom placeholder into. - // Internally, this method adds a single object replacement character (0xFFFC) - virtual void addPlaceholder(const PlaceholderStyle& placeholderStyle) = 0; - - // Constructs a SkParagraph object that can be used to layout and paint the text to a SkCanvas. - virtual std::unique_ptr Build() = 0; - - // Resets this builder to its initial state, discarding any text, styles, placeholders that have - // been added, but keeping the initial ParagraphStyle. - virtual void Reset() = 0; - - // Just until we fix all the google3 code - static std::unique_ptr make(const ParagraphStyle& style, - sk_sp fontCollection); -}; -} // namespace textlayout -} // namespace skia - -#endif // ParagraphBuilder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphCache.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphCache.h deleted file mode 100644 index 90ffb7019d8e83..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphCache.h +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef ParagraphCache_DEFINED -#define ParagraphCache_DEFINED - -#include "include/private/SkMutex.h" -#include "src/core/SkLRUCache.h" -#include // std::function - -#define PARAGRAPH_CACHE_STATS - -namespace skia { -namespace textlayout { - -enum InternalState { - kUnknown = 0, - kShaped = 2, - kClusterized = 3, - kMarked = 4, - kLineBroken = 5, - kFormatted = 6, - kDrawn = 7 -}; - -class ParagraphImpl; -class ParagraphCacheKey; -class ParagraphCacheValue; - -class ParagraphCache { -public: - ParagraphCache(); - ~ParagraphCache(); - - void abandon(); - void reset(); - bool updateParagraph(ParagraphImpl* paragraph); - bool findParagraph(ParagraphImpl* paragraph); - - // For testing - void setChecker(std::function checker) { - fChecker = std::move(checker); - } - void printStatistics(); - void turnOn(bool value) { fCacheIsOn = value; } - int count() { return fLRUCacheMap.count(); } - - bool isPossiblyTextEditing(ParagraphImpl* paragraph); - - private: - - struct Entry; - void updateFrom(const ParagraphImpl* paragraph, Entry* entry); - void updateTo(ParagraphImpl* paragraph, const Entry* entry); - - mutable SkMutex fParagraphMutex; - std::function fChecker; - - static const int kMaxEntries = 128; - - struct KeyHash { - uint32_t operator()(const ParagraphCacheKey& key) const; - }; - - SkLRUCache, KeyHash> fLRUCacheMap; - bool fCacheIsOn; - ParagraphCacheValue* fLastCachedValue; - -#ifdef PARAGRAPH_CACHE_STATS - int fTotalRequests; - int fCacheMisses; - int fHashMisses; // cache hit but hash table missed -#endif -}; - -} // namespace textlayout -} // namespace skia - -#endif // ParagraphCache_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphStyle.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphStyle.h deleted file mode 100644 index 5139571ddb0bae..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/ParagraphStyle.h +++ /dev/null @@ -1,143 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef ParagraphStyle_DEFINED -#define ParagraphStyle_DEFINED - -#include "include/core/SkFontStyle.h" -#include "include/core/SkScalar.h" -#include "include/core/SkString.h" -#include "modules/skparagraph/include/DartTypes.h" -#include "modules/skparagraph/include/TextStyle.h" - -#include -#include -#include -#include -#include -#include - -namespace skia { -namespace textlayout { - -struct StrutStyle { - StrutStyle(); - - const std::vector& getFontFamilies() const { return fFontFamilies; } - void setFontFamilies(std::vector families) { fFontFamilies = std::move(families); } - - SkFontStyle getFontStyle() const { return fFontStyle; } - void setFontStyle(SkFontStyle fontStyle) { fFontStyle = fontStyle; } - - SkScalar getFontSize() const { return fFontSize; } - void setFontSize(SkScalar size) { fFontSize = size; } - - void setHeight(SkScalar height) { fHeight = height; } - SkScalar getHeight() const { return fHeight; } - - void setLeading(SkScalar Leading) { fLeading = Leading; } - SkScalar getLeading() const { return fLeading; } - - bool getStrutEnabled() const { return fEnabled; } - void setStrutEnabled(bool v) { fEnabled = v; } - - bool getForceStrutHeight() const { return fForceHeight; } - void setForceStrutHeight(bool v) { fForceHeight = v; } - - bool getHeightOverride() const { return fHeightOverride; } - void setHeightOverride(bool v) { fHeightOverride = v; } - - void setHalfLeading(bool halfLeading) { fHalfLeading = halfLeading; } - bool getHalfLeading() const { return fHalfLeading; } - - bool operator==(const StrutStyle& rhs) const { - return this->fEnabled == rhs.fEnabled && - this->fHeightOverride == rhs.fHeightOverride && - this->fForceHeight == rhs.fForceHeight && - this->fHalfLeading == rhs.fHalfLeading && - nearlyEqual(this->fLeading, rhs.fLeading) && - nearlyEqual(this->fHeight, rhs.fHeight) && - nearlyEqual(this->fFontSize, rhs.fFontSize) && - this->fFontStyle == rhs.fFontStyle && - this->fFontFamilies == rhs.fFontFamilies; - } - -private: - - std::vector fFontFamilies; - SkFontStyle fFontStyle; - SkScalar fFontSize; - SkScalar fHeight; - SkScalar fLeading; - bool fForceHeight; - bool fEnabled; - bool fHeightOverride; - // true: half leading. - // false: scale ascent/descent with fHeight. - bool fHalfLeading; -}; - -struct ParagraphStyle { - ParagraphStyle(); - - bool operator==(const ParagraphStyle& rhs) const { - return this->fHeight == rhs.fHeight && - this->fEllipsis == rhs.fEllipsis && - this->fEllipsisUtf16 == rhs.fEllipsisUtf16 && - this->fTextDirection == rhs.fTextDirection && this->fTextAlign == rhs.fTextAlign && - this->fDefaultTextStyle == rhs.fDefaultTextStyle && - this->fReplaceTabCharacters == rhs.fReplaceTabCharacters; - } - - const StrutStyle& getStrutStyle() const { return fStrutStyle; } - void setStrutStyle(StrutStyle strutStyle) { fStrutStyle = std::move(strutStyle); } - - const TextStyle& getTextStyle() const { return fDefaultTextStyle; } - void setTextStyle(const TextStyle& textStyle) { fDefaultTextStyle = textStyle; } - - TextDirection getTextDirection() const { return fTextDirection; } - void setTextDirection(TextDirection direction) { fTextDirection = direction; } - - TextAlign getTextAlign() const { return fTextAlign; } - void setTextAlign(TextAlign align) { fTextAlign = align; } - - size_t getMaxLines() const { return fLinesLimit; } - void setMaxLines(size_t maxLines) { fLinesLimit = maxLines; } - - SkString getEllipsis() const { return fEllipsis; } - std::u16string getEllipsisUtf16() const { return fEllipsisUtf16; } - void setEllipsis(const std::u16string& ellipsis) { fEllipsisUtf16 = ellipsis; } - void setEllipsis(const SkString& ellipsis) { fEllipsis = ellipsis; } - - SkScalar getHeight() const { return fHeight; } - void setHeight(SkScalar height) { fHeight = height; } - - TextHeightBehavior getTextHeightBehavior() const { return fTextHeightBehavior; } - void setTextHeightBehavior(TextHeightBehavior v) { fTextHeightBehavior = v; } - - bool unlimited_lines() const { - return fLinesLimit == std::numeric_limits::max(); - } - bool ellipsized() const { return !fEllipsis.isEmpty() || !fEllipsisUtf16.empty(); } - TextAlign effective_align() const; - bool hintingIsOn() const { return fHintingIsOn; } - void turnHintingOff() { fHintingIsOn = false; } - - bool getReplaceTabCharacters() const { return fReplaceTabCharacters; } - void setReplaceTabCharacters(bool value) { fReplaceTabCharacters = value; } - -private: - StrutStyle fStrutStyle; - TextStyle fDefaultTextStyle; - TextAlign fTextAlign; - TextDirection fTextDirection; - size_t fLinesLimit; - std::u16string fEllipsisUtf16; - SkString fEllipsis; - SkScalar fHeight; - TextHeightBehavior fTextHeightBehavior; - bool fHintingIsOn; - bool fReplaceTabCharacters; -}; -} // namespace textlayout -} // namespace skia - -#endif // ParagraphStyle_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextShadow.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextShadow.h deleted file mode 100644 index e2f860992d2d11..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextShadow.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef TextShadow_DEFINED -#define TextShadow_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkPoint.h" - -namespace skia { -namespace textlayout { - -class TextShadow { -public: - SkColor fColor = SK_ColorBLACK; - SkPoint fOffset; - double fBlurSigma = 0.0; - - TextShadow(); - - TextShadow(SkColor color, SkPoint offset, double blurSigma); - - bool operator==(const TextShadow& other) const; - - bool operator!=(const TextShadow& other) const; - - bool hasShadow() const; -}; -} // namespace textlayout -} // namespace skia - -#endif // TextShadow_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextStyle.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextStyle.h deleted file mode 100644 index 82b4a7cb13cb49..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TextStyle.h +++ /dev/null @@ -1,352 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef TextStyle_DEFINED -#define TextStyle_DEFINED - -#include -#include -#include "include/core/SkColor.h" -#include "include/core/SkFont.h" -#include "include/core/SkFontMetrics.h" -#include "include/core/SkFontStyle.h" -#include "include/core/SkPaint.h" -#include "include/core/SkScalar.h" -#include "modules/skparagraph/include/DartTypes.h" -#include "modules/skparagraph/include/FontArguments.h" -#include "modules/skparagraph/include/TextShadow.h" - -// TODO: Make it external so the other platforms (Android) could use it -#define DEFAULT_FONT_FAMILY "sans-serif" - -namespace skia { -namespace textlayout { - -static inline bool nearlyZero(SkScalar x, SkScalar tolerance = SK_ScalarNearlyZero) { - if (SkScalarIsFinite(x)) { - return SkScalarNearlyZero(x, tolerance); - } - return false; -} - -static inline bool nearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance = SK_ScalarNearlyZero) { - if (SkScalarIsFinite(x) && SkScalarIsFinite(x)) { - return SkScalarNearlyEqual(x, y, tolerance); - } - // Inf == Inf, anything else is false - return x == y; -} - -// Multiple decorations can be applied at once. Ex: Underline and overline is -// (0x1 | 0x2) -enum TextDecoration { - kNoDecoration = 0x0, - kUnderline = 0x1, - kOverline = 0x2, - kLineThrough = 0x4, -}; -constexpr TextDecoration AllTextDecorations[] = { - kNoDecoration, - kUnderline, - kOverline, - kLineThrough, -}; - -enum TextDecorationStyle { kSolid, kDouble, kDotted, kDashed, kWavy }; - -enum TextDecorationMode { kGaps, kThrough }; - -enum StyleType { - kNone, - kAllAttributes, - kFont, - kForeground, - kBackground, - kShadow, - kDecorations, - kLetterSpacing, - kWordSpacing -}; - -struct Decoration { - TextDecoration fType; - TextDecorationMode fMode; - SkColor fColor; - TextDecorationStyle fStyle; - SkScalar fThicknessMultiplier; - - bool operator==(const Decoration& other) const { - return this->fType == other.fType && - this->fMode == other.fMode && - this->fColor == other.fColor && - this->fStyle == other.fStyle && - this->fThicknessMultiplier == other.fThicknessMultiplier; - } -}; - -/// Where to vertically align the placeholder relative to the surrounding text. -enum class PlaceholderAlignment { - /// Match the baseline of the placeholder with the baseline. - kBaseline, - - /// Align the bottom edge of the placeholder with the baseline such that the - /// placeholder sits on top of the baseline. - kAboveBaseline, - - /// Align the top edge of the placeholder with the baseline specified in - /// such that the placeholder hangs below the baseline. - kBelowBaseline, - - /// Align the top edge of the placeholder with the top edge of the font. - /// When the placeholder is very tall, the extra space will hang from - /// the top and extend through the bottom of the line. - kTop, - - /// Align the bottom edge of the placeholder with the top edge of the font. - /// When the placeholder is very tall, the extra space will rise from - /// the bottom and extend through the top of the line. - kBottom, - - /// Align the middle of the placeholder with the middle of the text. When the - /// placeholder is very tall, the extra space will grow equally from - /// the top and bottom of the line. - kMiddle, -}; - -struct FontFeature { - FontFeature(const SkString name, int value) : fName(name), fValue(value) {} - bool operator==(const FontFeature& that) const { - return fName == that.fName && fValue == that.fValue; - } - SkString fName; - int fValue; -}; - -struct PlaceholderStyle { - PlaceholderStyle() = default; - PlaceholderStyle(SkScalar width, SkScalar height, PlaceholderAlignment alignment, - TextBaseline baseline, SkScalar offset) - : fWidth(width) - , fHeight(height) - , fAlignment(alignment) - , fBaseline(baseline) - , fBaselineOffset(offset) {} - - bool equals(const PlaceholderStyle&) const; - - SkScalar fWidth = 0; - SkScalar fHeight = 0; - PlaceholderAlignment fAlignment = PlaceholderAlignment::kBaseline; - TextBaseline fBaseline = TextBaseline::kAlphabetic; - // Distance from the top edge of the rect to the baseline position. This - // baseline will be aligned against the alphabetic baseline of the surrounding - // text. - // - // Positive values drop the baseline lower (positions the rect higher) and - // small or negative values will cause the rect to be positioned underneath - // the line. When baseline == height, the bottom edge of the rect will rest on - // the alphabetic baseline. - SkScalar fBaselineOffset = 0; -}; - -class TextStyle { -public: - TextStyle() = default; - TextStyle(const TextStyle& other) = default; - TextStyle& operator=(const TextStyle& other) = default; - - TextStyle cloneForPlaceholder(); - - bool equals(const TextStyle& other) const; - bool equalsByFonts(const TextStyle& that) const; - bool matchOneAttribute(StyleType styleType, const TextStyle& other) const; - bool operator==(const TextStyle& rhs) const { return this->equals(rhs); } - - // Colors - SkColor getColor() const { return fColor; } - void setColor(SkColor color) { fColor = color; } - - bool hasForeground() const { return fHasForeground; } - SkPaint getForeground() const { return fForeground; } - void setForegroundColor(SkPaint paint) { - fHasForeground = true; - fForeground = std::move(paint); - } - void clearForegroundColor() { fHasForeground = false; } - - bool hasBackground() const { return fHasBackground; } - SkPaint getBackground() const { return fBackground; } - void setBackgroundColor(SkPaint paint) { - fHasBackground = true; - fBackground = std::move(paint); - } - void clearBackgroundColor() { fHasBackground = false; } - - // Decorations - Decoration getDecoration() const { return fDecoration; } - TextDecoration getDecorationType() const { return fDecoration.fType; } - TextDecorationMode getDecorationMode() const { return fDecoration.fMode; } - SkColor getDecorationColor() const { return fDecoration.fColor; } - TextDecorationStyle getDecorationStyle() const { return fDecoration.fStyle; } - SkScalar getDecorationThicknessMultiplier() const { - return fDecoration.fThicknessMultiplier; - } - void setDecoration(TextDecoration decoration) { fDecoration.fType = decoration; } - void setDecorationMode(TextDecorationMode mode) { fDecoration.fMode = mode; } - void setDecorationStyle(TextDecorationStyle style) { fDecoration.fStyle = style; } - void setDecorationColor(SkColor color) { fDecoration.fColor = color; } - void setDecorationThicknessMultiplier(SkScalar m) { fDecoration.fThicknessMultiplier = m; } - - // Weight/Width/Slant - SkFontStyle getFontStyle() const { return fFontStyle; } - void setFontStyle(SkFontStyle fontStyle) { fFontStyle = fontStyle; } - - // Shadows - size_t getShadowNumber() const { return fTextShadows.size(); } - std::vector getShadows() const { return fTextShadows; } - void addShadow(TextShadow shadow) { fTextShadows.emplace_back(shadow); } - void resetShadows() { fTextShadows.clear(); } - - // Font features - size_t getFontFeatureNumber() const { return fFontFeatures.size(); } - std::vector getFontFeatures() const { return fFontFeatures; } - void addFontFeature(const SkString& fontFeature, int value) - { fFontFeatures.emplace_back(fontFeature, value); } - void resetFontFeatures() { fFontFeatures.clear(); } - - // Font arguments - const std::optional& getFontArguments() const { return fFontArguments; } - // The contents of the SkFontArguments will be copied into the TextStyle, - // and the SkFontArguments can be safely deleted after setFontArguments returns. - void setFontArguments(const std::optional& args); - - SkScalar getFontSize() const { return fFontSize; } - void setFontSize(SkScalar size) { fFontSize = size; } - - const std::vector& getFontFamilies() const { return fFontFamilies; } - void setFontFamilies(std::vector families) { - fFontFamilies = std::move(families); - } - - SkScalar getBaselineShift() const { return fBaselineShift; } - void setBaselineShift(SkScalar baselineShift) { fBaselineShift = baselineShift; } - - void setHeight(SkScalar height) { fHeight = height; } - SkScalar getHeight() const { return fHeightOverride ? fHeight : 0; } - - void setHeightOverride(bool heightOverride) { fHeightOverride = heightOverride; } - bool getHeightOverride() const { return fHeightOverride; } - - void setHalfLeading(bool halfLeading) { fHalfLeading = halfLeading; } - bool getHalfLeading() const { return fHalfLeading; } - - void setLetterSpacing(SkScalar letterSpacing) { fLetterSpacing = letterSpacing; } - SkScalar getLetterSpacing() const { return fLetterSpacing; } - - void setWordSpacing(SkScalar wordSpacing) { fWordSpacing = wordSpacing; } - SkScalar getWordSpacing() const { return fWordSpacing; } - - SkTypeface* getTypeface() const { return fTypeface.get(); } - sk_sp refTypeface() const { return fTypeface; } - void setTypeface(sk_sp typeface) { fTypeface = std::move(typeface); } - - SkString getLocale() const { return fLocale; } - void setLocale(const SkString& locale) { fLocale = locale; } - - TextBaseline getTextBaseline() const { return fTextBaseline; } - void setTextBaseline(TextBaseline baseline) { fTextBaseline = baseline; } - - void getFontMetrics(SkFontMetrics* metrics) const; - - bool isPlaceholder() const { return fIsPlaceholder; } - void setPlaceholder() { fIsPlaceholder = true; } - -private: - static const std::vector* kDefaultFontFamilies; - - Decoration fDecoration = { - TextDecoration::kNoDecoration, - // TODO: switch back to kGaps when (if) switching flutter to skparagraph - TextDecorationMode::kThrough, - // It does not make sense to draw a transparent object, so we use this as a default - // value to indicate no decoration color was set. - SK_ColorTRANSPARENT, TextDecorationStyle::kSolid, - // Thickness is applied as a multiplier to the default thickness of the font. - 1.0f}; - - SkFontStyle fFontStyle; - - std::vector fFontFamilies = *kDefaultFontFamilies; - - SkScalar fFontSize = 14.0; - SkScalar fHeight = 1.0; - bool fHeightOverride = false; - SkScalar fBaselineShift = 0.0f; - // true: half leading. - // false: scale ascent/descent with fHeight. - bool fHalfLeading = false; - SkString fLocale = {}; - SkScalar fLetterSpacing = 0.0; - SkScalar fWordSpacing = 0.0; - - TextBaseline fTextBaseline = TextBaseline::kAlphabetic; - - SkColor fColor = SK_ColorWHITE; - bool fHasBackground = false; - SkPaint fBackground; - bool fHasForeground = false; - SkPaint fForeground; - - std::vector fTextShadows; - - sk_sp fTypeface; - bool fIsPlaceholder = false; - - std::vector fFontFeatures; - - std::optional fFontArguments; -}; - -typedef size_t TextIndex; -typedef SkRange TextRange; -const SkRange EMPTY_TEXT = EMPTY_RANGE; - -struct Block { - Block() = default; - Block(size_t start, size_t end, const TextStyle& style) : fRange(start, end), fStyle(style) {} - Block(TextRange textRange, const TextStyle& style) : fRange(textRange), fStyle(style) {} - - void add(TextRange tail) { - SkASSERT(fRange.end == tail.start); - fRange = TextRange(fRange.start, fRange.start + fRange.width() + tail.width()); - } - - TextRange fRange = EMPTY_RANGE; - TextStyle fStyle; -}; - - -typedef size_t BlockIndex; -typedef SkRange BlockRange; -const size_t EMPTY_BLOCK = EMPTY_INDEX; -const SkRange EMPTY_BLOCKS = EMPTY_RANGE; - -struct Placeholder { - Placeholder() = default; - Placeholder(size_t start, size_t end, const PlaceholderStyle& style, const TextStyle& textStyle, - BlockRange blocksBefore, TextRange textBefore) - : fRange(start, end) - , fStyle(style) - , fTextStyle(textStyle) - , fBlocksBefore(blocksBefore) - , fTextBefore(textBefore) {} - - TextRange fRange = EMPTY_RANGE; - PlaceholderStyle fStyle; - TextStyle fTextStyle; - BlockRange fBlocksBefore; - TextRange fTextBefore; -}; - -} // namespace textlayout -} // namespace skia - -#endif // TextStyle_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h deleted file mode 100644 index df759b125ad242..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skparagraph/include/TypefaceFontProvider.h +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2019 Google LLC. -#ifndef TypefaceFontProvider_DEFINED -#define TypefaceFontProvider_DEFINED - -#include "include/private/SkTArray.h" -#include "include/private/SkTHash.h" -#include -#include -#include -#include "include/core/SkFontMgr.h" -#include "include/core/SkStream.h" -#include "include/core/SkString.h" - -namespace skia { -namespace textlayout { - -class TypefaceFontStyleSet : public SkFontStyleSet { -public: - explicit TypefaceFontStyleSet(const SkString& familyName); - - int count() override; - void getStyle(int index, SkFontStyle*, SkString* name) override; - SkTypeface* createTypeface(int index) override; - SkTypeface* matchStyle(const SkFontStyle& pattern) override; - - SkString getFamilyName() const { return fFamilyName; } - SkString getAlias() const { return fAlias; } - void appendTypeface(sk_sp typeface); - -private: - SkTArray> fStyles; - SkString fFamilyName; - SkString fAlias; -}; - -class TypefaceFontProvider : public SkFontMgr { -public: - size_t registerTypeface(sk_sp typeface); - size_t registerTypeface(sk_sp typeface, const SkString& alias); - - int onCountFamilies() const override; - - void onGetFamilyName(int index, SkString* familyName) const override; - - SkFontStyleSet* onMatchFamily(const char familyName[]) const override; - - SkFontStyleSet* onCreateStyleSet(int) const override { return nullptr; } - SkTypeface* onMatchFamilyStyle(const char[], const SkFontStyle&) const override { - return nullptr; - } - SkTypeface* onMatchFamilyStyleCharacter(const char[], const SkFontStyle&, - const char*[], int, - SkUnichar) const override { - return nullptr; - } - - sk_sp onMakeFromData(sk_sp, int) const override { return nullptr; } - sk_sp onMakeFromStreamIndex(std::unique_ptr, int) const override { - return nullptr; - } - sk_sp onMakeFromStreamArgs(std::unique_ptr, - const SkFontArguments&) const override { - return nullptr; - } - sk_sp onMakeFromFile(const char[], int) const override { - return nullptr; - } - - sk_sp onLegacyMakeTypeface(const char[], SkFontStyle) const override { - return nullptr; - } - -private: - SkTHashMap> fRegisteredFamilies; - SkTArray fFamilyNames; -}; - -} // namespace textlayout -} // namespace skia - -#endif // TypefaceFontProvider_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skresources/include/SkResources.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skresources/include/SkResources.h deleted file mode 100644 index f59471198b0669..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/skresources/include/SkResources.h +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 2019 Google LLC - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkResources_DEFINED -#define SkResources_DEFINED - -#include "include/core/SkData.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSamplingOptions.h" -#include "include/core/SkString.h" -#include "include/core/SkTypeface.h" -#include "include/core/SkTypes.h" -#include "include/private/SkMutex.h" -#include "include/private/SkTHash.h" - -#include - -class SkAnimCodecPlayer; -class SkImage; - -namespace skresources { - -/** - * Image asset proxy interface. - */ -class SK_API ImageAsset : public SkRefCnt { -public: - /** - * Returns true if the image asset is animated. - */ - virtual bool isMultiFrame() = 0; - - /** - * DEPRECATED: override getFrameData() instead. - * - * Returns the SkImage for a given frame. - * - * If the image asset is static, getFrame() is only called once, at animation load time. - * Otherwise, this gets invoked every time the animation time is adjusted (on every seek). - * - * Embedders should cache and serve the same SkImage whenever possible, for efficiency. - * - * @param t Frame time code, in seconds, relative to the image layer timeline origin - * (in-point). - */ - virtual sk_sp getFrame(float t); - - struct FrameData { - // SkImage payload. - sk_sp image; - // Resampling parameters. - SkSamplingOptions sampling; - // Additional image transform to be applied before AE scaling rules. - SkMatrix matrix = SkMatrix::I(); - }; - - /** - * Returns the payload for a given frame. - * - * If the image asset is static, getFrameData() is only called once, at animation load time. - * Otherwise, this gets invoked every time the animation time is adjusted (on every seek). - * - * Embedders should cache and serve the same SkImage whenever possible, for efficiency. - * - * @param t Frame time code, in seconds, relative to the image layer timeline origin - * (in-point). - */ - virtual FrameData getFrameData(float t); -}; - -class MultiFrameImageAsset final : public ImageAsset { -public: - /** - * By default, images are decoded on-the-fly, at rasterization time. - * Large images may cause jank as decoding is expensive (and can thrash internal caches). - * - * Pass |predecode| true to force-decode all images upfront, at the cost of potentially more RAM - * and slower animation build times. - */ - static sk_sp Make(sk_sp, bool predecode = false); - - bool isMultiFrame() override; - - sk_sp getFrame(float t) override; - -private: - explicit MultiFrameImageAsset(std::unique_ptr, bool predecode); - - sk_sp generateFrame(float t); - - std::unique_ptr fPlayer; - sk_sp fCachedFrame; - bool fPreDecode; - - using INHERITED = ImageAsset; -}; - -/** - * External track (e.g. audio playback) interface. - * - * Used to wrap data payload and playback controllers. - */ -class ExternalTrackAsset : public SkRefCnt { -public: - /** - * Playback control callback, emitted for each corresponding Animation::seek(). - * - * @param t Frame time code, in seconds, relative to the layer's timeline origin - * (in-point). - * - * Negative |t| values are used to signal off state (stop playback outside layer span). - */ - virtual void seek(float t) = 0; -}; - -/** - * ResourceProvider is an interface that lets rich-content modules defer loading of external - * resources (images, fonts, etc.) to embedding clients. - */ -class SK_API ResourceProvider : public SkRefCnt { -public: - /** - * Load a generic resource (currently only nested animations) specified by |path| + |name|, - * and return as an SkData. - */ - virtual sk_sp load(const char[] /* resource_path */, - const char[] /* resource_name */) const { - return nullptr; - } - - /** - * Load an image asset specified by |path| + |name|, and returns the corresponding - * ImageAsset proxy. - */ - virtual sk_sp loadImageAsset(const char[] /* resource_path */, - const char[] /* resource_name */, - const char[] /* resource_id */) const { - return nullptr; - } - - /** - * Load an external audio track specified by |path|/|name|/|id|. - */ - virtual sk_sp loadAudioAsset(const char[] /* resource_path */, - const char[] /* resource_name */, - const char[] /* resource_id */) { - return nullptr; - } - - /** - * DEPRECATED: implement loadTypeface() instead. - * - * Load an external font and return as SkData. - * - * @param name font name ("fName" Lottie property) - * @param url web font URL ("fPath" Lottie property) - * - * -- Note -- - * - * This mechanism assumes monolithic fonts (single data blob). Some web font providers may - * serve multiple font blobs, segmented for various unicode ranges, depending on user agent - * capabilities (woff, woff2). In that case, the embedder would need to advertise no user - * agent capabilities when fetching the URL, in order to receive full font data. - */ - virtual sk_sp loadFont(const char[] /* name */, - const char[] /* url */) const { - return nullptr; - } - - /** - * Load an external font and return as SkTypeface. - * - * @param name font name - * @param url web font URL - */ - virtual sk_sp loadTypeface(const char[] /* name */, - const char[] /* url */) const { - return nullptr; - } -}; - -class FileResourceProvider final : public ResourceProvider { -public: - static sk_sp Make(SkString base_dir, bool predecode = false); - - sk_sp load(const char resource_path[], const char resource_name[]) const override; - - sk_sp loadImageAsset(const char[], const char[], const char[]) const override; - -private: - FileResourceProvider(SkString, bool); - - const SkString fDir; - const bool fPredecode; - - using INHERITED = ResourceProvider; -}; - -class ResourceProviderProxyBase : public ResourceProvider { -protected: - explicit ResourceProviderProxyBase(sk_sp); - - sk_sp load(const char[], const char[]) const override; - sk_sp loadImageAsset(const char[], const char[], const char[]) const override; - sk_sp loadTypeface(const char[], const char[]) const override; - sk_sp loadFont(const char[], const char[]) const override; - sk_sp loadAudioAsset(const char[], const char[], const char[]) override; - -private: - const sk_sp fProxy; -}; - -class SK_API CachingResourceProvider final : public ResourceProviderProxyBase { -public: - static sk_sp Make(sk_sp rp) { - return rp ? sk_sp(new CachingResourceProvider(std::move(rp))) - : nullptr; - } - -private: - explicit CachingResourceProvider(sk_sp); - - sk_sp loadImageAsset(const char[], const char[], const char[]) const override; - - mutable SkMutex fMutex; - mutable SkTHashMap> fImageCache; - - using INHERITED = ResourceProviderProxyBase; -}; - -class DataURIResourceProviderProxy final : public ResourceProviderProxyBase { -public: - static sk_sp Make(sk_sp rp, - bool predecode = false); - -private: - DataURIResourceProviderProxy(sk_sp, bool); - - sk_sp loadImageAsset(const char[], const char[], const char[]) const override; - sk_sp loadTypeface(const char[], const char[]) const override; - - const bool fPredecode; - - using INHERITED = ResourceProviderProxyBase; -}; - -} // namespace skresources - -#endif // SkResources_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttribute.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttribute.h deleted file mode 100644 index d6996638ccdcf4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttribute.h +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGAttribute_DEFINED -#define SkSVGAttribute_DEFINED - -#include "modules/svg/include/SkSVGTypes.h" -#include "src/core/SkTLazy.h" - -class SkSVGRenderContext; - -enum class SkSVGAttribute { - kClipRule, - kColor, - kColorInterpolation, - kColorInterpolationFilters, - kCx, // , , : center x position - kCy, // , , : center y position - kFill, - kFillOpacity, - kFillRule, - kFilter, - kFilterUnits, - kFontFamily, - kFontSize, - kFontStyle, - kFontWeight, - kFx, // : focal point x position - kFy, // : focal point y position - kGradientUnits, - kGradientTransform, - kHeight, - kHref, - kOpacity, - kPoints, - kPreserveAspectRatio, - kR, // , : radius - kRx, // ,: horizontal (corner) radius - kRy, // ,: vertical (corner) radius - kSpreadMethod, - kStroke, - kStrokeDashArray, - kStrokeDashOffset, - kStrokeOpacity, - kStrokeLineCap, - kStrokeLineJoin, - kStrokeMiterLimit, - kStrokeWidth, - kTransform, - kText, - kTextAnchor, - kViewBox, - kVisibility, - kWidth, - kX, - kX1, // : first endpoint x - kX2, // : second endpoint x - kY, - kY1, // : first endpoint y - kY2, // : second endpoint y - - kUnknown, -}; - -struct SkSVGPresentationAttributes { - static SkSVGPresentationAttributes MakeInitial(); - - // TODO: SkSVGProperty adds an extra ptr per attribute; refactor to reduce overhead. - - SkSVGProperty fFill; - SkSVGProperty fFillOpacity; - SkSVGProperty fFillRule; - SkSVGProperty fClipRule; - - SkSVGProperty fStroke; - SkSVGProperty fStrokeDashArray; - SkSVGProperty fStrokeDashOffset; - SkSVGProperty fStrokeLineCap; - SkSVGProperty fStrokeLineJoin; - SkSVGProperty fStrokeMiterLimit; - SkSVGProperty fStrokeOpacity; - SkSVGProperty fStrokeWidth; - - SkSVGProperty fVisibility; - - SkSVGProperty fColor; - SkSVGProperty fColorInterpolation; - SkSVGProperty fColorInterpolationFilters; - - SkSVGProperty fFontFamily; - SkSVGProperty fFontStyle; - SkSVGProperty fFontSize; - SkSVGProperty fFontWeight; - SkSVGProperty fTextAnchor; - - // uninherited - SkSVGProperty fOpacity; - SkSVGProperty fClipPath; - SkSVGProperty fDisplay; - SkSVGProperty fMask; - SkSVGProperty fFilter; - SkSVGProperty fStopColor; - SkSVGProperty fStopOpacity; - SkSVGProperty fFloodColor; - SkSVGProperty fFloodOpacity; - SkSVGProperty fLightingColor; -}; - -#endif // SkSVGAttribute_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttributeParser.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttributeParser.h deleted file mode 100644 index e4ac579f7966dc..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGAttributeParser.h +++ /dev/null @@ -1,160 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGAttributeParser_DEFINED -#define SkSVGAttributeParser_DEFINED - -#include - -#include "include/private/SkNoncopyable.h" -#include "modules/svg/include/SkSVGTypes.h" -#include "src/core/SkTLazy.h" - -class SkSVGAttributeParser : public SkNoncopyable { -public: - SkSVGAttributeParser(const char[]); - - bool parseInteger(SkSVGIntegerType*); - bool parseViewBox(SkSVGViewBoxType*); - bool parsePreserveAspectRatio(SkSVGPreserveAspectRatio*); - - // TODO: Migrate all parse*() functions to this style (and delete the old version) - // so they can be used by parse(): - bool parse(SkSVGIntegerType* v) { return parseInteger(v); } - - template using ParseResult = SkTLazy; - - template static ParseResult parse(const char* value) { - ParseResult result; - T parsedValue; - if (SkSVGAttributeParser(value).parse(&parsedValue)) { - result.set(std::move(parsedValue)); - } - return result; - } - - template - static ParseResult parse(const char* expectedName, - const char* name, - const char* value) { - if (!strcmp(name, expectedName)) { - return parse(value); - } - - return ParseResult(); - } - - template - static ParseResult parseProperty(const char* expectedName, - const char* name, - const char* value) { - if (strcmp(name, expectedName) != 0) { - return ParseResult(); - } - - if (!strcmp(value, "inherit")) { - PropertyT result(SkSVGPropertyState::kInherit); - return ParseResult(&result); - } - - auto pr = parse(value); - if (pr.isValid()) { - PropertyT result(*pr); - return ParseResult(&result); - } - - return ParseResult(); - } - -private: - class RestoreCurPos { - public: - explicit RestoreCurPos(SkSVGAttributeParser* self) - : fSelf(self), fCurPos(self->fCurPos) {} - - ~RestoreCurPos() { - if (fSelf) { - fSelf->fCurPos = this->fCurPos; - } - } - - void clear() { fSelf = nullptr; } - private: - SkSVGAttributeParser* fSelf; - const char* fCurPos; - - RestoreCurPos( const RestoreCurPos&) = delete; - RestoreCurPos& operator=(const RestoreCurPos&) = delete; - }; - - // Stack-only - void* operator new(size_t) = delete; - void* operator new(size_t, void*) = delete; - - template - bool parse(T*); - - template - bool advanceWhile(F func); - - bool matchStringToken(const char* token, const char** newPos = nullptr) const; - bool matchHexToken(const char** newPos) const; - - bool parseWSToken(); - bool parseEOSToken(); - bool parseSepToken(); - bool parseCommaWspToken(); - bool parseExpectedStringToken(const char*); - bool parseScalarToken(SkScalar*); - bool parseInt32Token(int32_t*); - bool parseEscape(SkUnichar*); - bool parseIdentToken(SkString*); - bool parseLengthUnitToken(SkSVGLength::Unit*); - bool parseNamedColorToken(SkColor*); - bool parseHexColorToken(SkColor*); - bool parseColorComponentToken(int32_t*); - bool parseColorToken(SkColor*); - bool parseRGBColorToken(SkColor*); - bool parseSVGColor(SkSVGColor*, SkSVGColor::Vars&&); - bool parseSVGColorType(SkSVGColorType*); - bool parseFuncIRI(SkSVGFuncIRI*); - - // Transform helpers - bool parseMatrixToken(SkMatrix*); - bool parseTranslateToken(SkMatrix*); - bool parseScaleToken(SkMatrix*); - bool parseRotateToken(SkMatrix*); - bool parseSkewXToken(SkMatrix*); - bool parseSkewYToken(SkMatrix*); - - // Parses a sequence of 'WS* WS* ()', where the nested sequence - // is handled by the passed functor. - template - bool parseParenthesized(const char* prefix, Func, T* result); - - template - bool parseList(std::vector*); - - template - bool parseEnumMap(const TArray& arr, T* result) { - for (size_t i = 0; i < std::size(arr); ++i) { - if (this->parseExpectedStringToken(std::get<0>(arr[i]))) { - *result = std::get<1>(arr[i]); - return true; - } - } - return false; - } - - // The current position in the input string. - const char* fCurPos; - const char* fEndPos; - - using INHERITED = SkNoncopyable; -}; - -#endif // SkSVGAttributeParser_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGCircle.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGCircle.h deleted file mode 100644 index d7e3f20540f81f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGCircle.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGCircle_DEFINED -#define SkSVGCircle_DEFINED - -#include "modules/svg/include/SkSVGShape.h" -#include "modules/svg/include/SkSVGTypes.h" - -struct SkPoint; - -class SkSVGCircle final : public SkSVGShape { -public: - static sk_sp Make() { return sk_sp(new SkSVGCircle()); } - - SVG_ATTR(Cx, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Cy, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(R , SkSVGLength, SkSVGLength(0)) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - -private: - SkSVGCircle(); - - // resolve and return the center and radius values - std::tuple resolve(const SkSVGLengthContext&) const; - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGCircle_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGClipPath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGClipPath.h deleted file mode 100644 index 832c9a36ac041a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGClipPath.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGClipPath_DEFINED -#define SkSVGClipPath_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGClipPath final : public SkSVGHiddenContainer { -public: - static sk_sp Make() { - return sk_sp(new SkSVGClipPath()); - } - - SVG_ATTR(ClipPathUnits, SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse)) - -private: - friend class SkSVGRenderContext; - - SkSVGClipPath(); - - bool parseAndSetAttribute(const char*, const char*) override; - - SkPath resolveClip(const SkSVGRenderContext&) const; - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGClipPath_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGContainer.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGContainer.h deleted file mode 100644 index 560271854f5b61..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGContainer.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGContainer_DEFINED -#define SkSVGContainer_DEFINED - -#include "include/private/SkTArray.h" -#include "modules/svg/include/SkSVGTransformableNode.h" - -class SkSVGContainer : public SkSVGTransformableNode { -public: - void appendChild(sk_sp) override; - -protected: - explicit SkSVGContainer(SkSVGTag); - - void onRender(const SkSVGRenderContext&) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - - bool hasChildren() const final; - - // TODO: add some sort of child iterator, and hide the container. - SkSTArray<1, sk_sp, true> fChildren; - -private: - using INHERITED = SkSVGTransformableNode; -}; - -#endif // SkSVGContainer_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDOM.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDOM.h deleted file mode 100644 index a035179b70e7b9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDOM.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGDOM_DEFINED -#define SkSVGDOM_DEFINED - -#include "include/core/SkFontMgr.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkSize.h" -#include "include/private/SkTemplates.h" -#include "modules/skresources/include/SkResources.h" -#include "modules/svg/include/SkSVGIDMapper.h" - -class SkCanvas; -class SkDOM; -class SkStream; -class SkSVGNode; -struct SkSVGPresentationContext; -class SkSVGSVG; - -class SkSVGDOM : public SkRefCnt { -public: - class Builder final { - public: - /** - * Specify a font manager for loading SVG fonts. - */ - Builder& setFontManager(sk_sp); - - /** - * Specify a resource provider for loading images etc. - */ - Builder& setResourceProvider(sk_sp); - - sk_sp make(SkStream&) const; - - private: - sk_sp fFontMgr; - sk_sp fResourceProvider; - }; - - static sk_sp MakeFromStream(SkStream& str) { - return Builder().make(str); - } - - /** - * Returns the root (outermost) SVG element. - */ - SkSVGSVG* getRoot() const { return fRoot.get(); } - - /** - * Specify a "container size" for the SVG dom. - * - * This is used to resolve the initial viewport when the root SVG width/height are specified - * in relative units. - * - * If the root dimensions are in absolute units, then the container size has no effect since - * the initial viewport is fixed. - */ - void setContainerSize(const SkSize&); - - /** - * DEPRECATED: use getRoot()->intrinsicSize() to query the root element intrinsic size. - * - * Returns the SVG dom container size. - * - * If the client specified a container size via setContainerSize(), then the same size is - * returned. - * - * When unspecified by clients, this returns the intrinsic size of the root element, as defined - * by its width/height attributes. If either width or height is specified in relative units - * (e.g. "100%"), then the corresponding intrinsic size dimension is zero. - */ - const SkSize& containerSize() const; - - // Returns the node with the given id, or nullptr if not found. - sk_sp* findNodeById(const char* id); - - void render(SkCanvas*) const; - - /** Render the node with the given id as if it were the only child of the root. */ - void renderNode(SkCanvas*, SkSVGPresentationContext&, const char* id) const; - -private: - SkSVGDOM(sk_sp, sk_sp, sk_sp, - SkSVGIDMapper&&); - - const sk_sp fRoot; - const sk_sp fFontMgr; - const sk_sp fResourceProvider; - const SkSVGIDMapper fIDMapper; - - SkSize fContainerSize; -}; - -#endif // SkSVGDOM_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDefs.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDefs.h deleted file mode 100644 index 46fbf43f9f3dd2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGDefs.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGDefs_DEFINED -#define SkSVGDefs_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" - -class SkSVGDefs : public SkSVGHiddenContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGDefs()); } - -private: - SkSVGDefs() : INHERITED(SkSVGTag::kDefs) {} - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGDefs_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGEllipse.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGEllipse.h deleted file mode 100644 index 940d1719de363d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGEllipse.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGEllipse_DEFINED -#define SkSVGEllipse_DEFINED - -#include "modules/svg/include/SkSVGShape.h" -#include "modules/svg/include/SkSVGTypes.h" - -struct SkRect; - -class SkSVGEllipse final : public SkSVGShape { -public: - static sk_sp Make() { return sk_sp(new SkSVGEllipse()); } - - SVG_ATTR(Cx, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Cy, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Rx, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Ry, SkSVGLength, SkSVGLength(0)) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - -private: - SkSVGEllipse(); - - SkRect resolve(const SkSVGLengthContext&) const; - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGEllipse_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFe.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFe.h deleted file mode 100644 index 1b0f90acae853b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFe.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFe_DEFINED -#define SkSVGFe_DEFINED - -#include - -#include "modules/svg/include/SkSVGHiddenContainer.h" - -class SkImageFilter; -class SkSVGFilterContext; - -class SkSVGFe : public SkSVGHiddenContainer { -public: - static bool IsFilterEffect(const sk_sp& node) { - switch (node->tag()) { - case SkSVGTag::kFeBlend: - case SkSVGTag::kFeColorMatrix: - case SkSVGTag::kFeComposite: - case SkSVGTag::kFeDiffuseLighting: - case SkSVGTag::kFeDisplacementMap: - case SkSVGTag::kFeFlood: - case SkSVGTag::kFeGaussianBlur: - case SkSVGTag::kFeImage: - case SkSVGTag::kFeMorphology: - case SkSVGTag::kFeOffset: - case SkSVGTag::kFeSpecularLighting: - case SkSVGTag::kFeTurbulence: - return true; - default: - return false; - } - } - - sk_sp makeImageFilter(const SkSVGRenderContext& ctx, - const SkSVGFilterContext& fctx) const; - - // https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveSubRegion - SkRect resolveFilterSubregion(const SkSVGRenderContext&, const SkSVGFilterContext&) const; - - /** - * Resolves the colorspace within which this filter effect should be applied. - * Spec: https://www.w3.org/TR/SVG11/painting.html#ColorInterpolationProperties - * 'color-interpolation-filters' property. - */ - virtual SkSVGColorspace resolveColorspace(const SkSVGRenderContext&, - const SkSVGFilterContext&) const; - - /** Propagates any inherited presentation attributes in the given context. */ - void applyProperties(SkSVGRenderContext*) const; - - SVG_ATTR(In, SkSVGFeInputType, SkSVGFeInputType()) - SVG_ATTR(Result, SkSVGStringType, SkSVGStringType()) - SVG_OPTIONAL_ATTR(X, SkSVGLength) - SVG_OPTIONAL_ATTR(Y, SkSVGLength) - SVG_OPTIONAL_ATTR(Width, SkSVGLength) - SVG_OPTIONAL_ATTR(Height, SkSVGLength) - -protected: - explicit SkSVGFe(SkSVGTag t) : INHERITED(t) {} - - virtual sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const = 0; - - virtual std::vector getInputs() const = 0; - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - /** - * Resolves the rect specified by the x, y, width and height attributes (if specified) on this - * filter effect. These attributes are resolved according to the given length context and - * the value of 'primitiveUnits' on the parent element. - */ - SkRect resolveBoundaries(const SkSVGRenderContext&, const SkSVGFilterContext&) const; - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGFe_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeBlend.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeBlend.h deleted file mode 100644 index 36d1f0f996dc74..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeBlend.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeBlend_DEFINED -#define SkSVGFeBlend_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeBlend : public SkSVGFe { -public: - enum class Mode { - kNormal, - kMultiply, - kScreen, - kDarken, - kLighten, - }; - - static sk_sp Make() { return sk_sp(new SkSVGFeBlend()); } - - SVG_ATTR(Mode, Mode, Mode::kNormal) - SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType()) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { - return {this->getIn(), this->getIn2()}; - } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeBlend() : INHERITED(SkSVGTag::kFeBlend) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeBlend_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h deleted file mode 100644 index 28d67b7c22d1cd..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeColorMatrix.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeColorMatrix_DEFINED -#define SkSVGFeColorMatrix_DEFINED - -#include "include/effects/SkColorMatrix.h" -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeColorMatrix final : public SkSVGFe { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeColorMatrix()); - } - - SVG_ATTR(Type, SkSVGFeColorMatrixType, SkSVGFeColorMatrixType(SkSVGFeColorMatrixType::kMatrix)) - SVG_ATTR(Values, SkSVGFeColorMatrixValues, SkSVGFeColorMatrixValues()) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {this->getIn()}; } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeColorMatrix() : INHERITED(SkSVGTag::kFeColorMatrix) {} - - SkColorMatrix makeMatrixForType() const; - - static SkColorMatrix MakeSaturate(SkSVGNumberType s); - - static SkColorMatrix MakeHueRotate(SkSVGNumberType degrees); - - static SkColorMatrix MakeLuminanceToAlpha(); - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeColorMatrix_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeComposite.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeComposite.h deleted file mode 100644 index df64e75da2834e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeComposite.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeComposite_DEFINED -#define SkSVGFeComposite_DEFINED - -#include "include/core/SkBlendMode.h" -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeComposite final : public SkSVGFe { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeComposite()); - } - - SVG_ATTR(In2, SkSVGFeInputType, SkSVGFeInputType()) - SVG_ATTR(K1, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(K2, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(K3, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(K4, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(Operator, SkSVGFeCompositeOperator, SkSVGFeCompositeOperator::kOver) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { - return {this->getIn(), this->getIn2()}; - } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeComposite() : INHERITED(SkSVGTag::kFeComposite) {} - - static SkBlendMode BlendModeForOperator(SkSVGFeCompositeOperator); - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeComposite_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h deleted file mode 100644 index 33c98fec70867c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeDisplacementMap.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeDisplacementMap_DEFINED -#define SkSVGFeDisplacementMap_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeDisplacementMap : public SkSVGFe { -public: - using ChannelSelector = SkColorChannel; - - static sk_sp Make() { - return sk_sp(new SkSVGFeDisplacementMap()); - } - - SkSVGColorspace resolveColorspace(const SkSVGRenderContext&, - const SkSVGFilterContext&) const final; - - SVG_ATTR(In2 , SkSVGFeInputType, SkSVGFeInputType()) - SVG_ATTR(XChannelSelector, ChannelSelector , ChannelSelector::kA) - SVG_ATTR(YChannelSelector, ChannelSelector , ChannelSelector::kA) - SVG_ATTR(Scale , SkSVGNumberType , SkSVGNumberType(0)) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { - return {this->getIn(), this->getIn2()}; - } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeDisplacementMap() : INHERITED(SkSVGTag::kFeDisplacementMap) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeDisplacementMap_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeFlood.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeFlood.h deleted file mode 100644 index 3625094abbdc64..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeFlood.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeFlood_DEFINED -#define SkSVGFeFlood_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeFlood : public SkSVGFe { -public: - static sk_sp Make() { return sk_sp(new SkSVGFeFlood()); } - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {}; } - -private: - SkSVGFeFlood() : INHERITED(SkSVGTag::kFeFlood) {} - - SkColor resolveFloodColor(const SkSVGRenderContext&) const; - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeFlood_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h deleted file mode 100644 index 2db505940caa5c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeGaussianBlur.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeGaussianBlur_DEFINED -#define SkSVGFeGaussianBlur_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeGaussianBlur : public SkSVGFe { -public: - struct StdDeviation { - SkSVGNumberType fX; - SkSVGNumberType fY; - }; - - static sk_sp Make() { - return sk_sp(new SkSVGFeGaussianBlur()); - } - - SVG_ATTR(StdDeviation, StdDeviation, StdDeviation({0, 0})) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {this->getIn()}; } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeGaussianBlur() : INHERITED(SkSVGTag::kFeGaussianBlur) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeGaussianBlur_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeImage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeImage.h deleted file mode 100644 index c51f046b327f1c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeImage.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeImage_DEFINED -#define SkSVGFeImage_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeImage : public SkSVGFe { -public: - static sk_sp Make() { return sk_sp(new SkSVGFeImage()); } - - SVG_ATTR(Href , SkSVGIRI , SkSVGIRI()) - SVG_ATTR(PreserveAspectRatio, SkSVGPreserveAspectRatio, SkSVGPreserveAspectRatio()) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {}; } - -private: - SkSVGFeImage() : INHERITED(SkSVGTag::kFeImage) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeImage_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLightSource.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLightSource.h deleted file mode 100644 index 643c150001083d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLightSource.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeLightSource_DEFINED -#define SkSVGFeLightSource_DEFINED - -#include "include/core/SkPoint3.h" -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeLightSource : public SkSVGHiddenContainer { -public: - void appendChild(sk_sp) final { - SkDebugf("cannot append child nodes to an SVG light source.\n"); - } - -protected: - explicit SkSVGFeLightSource(SkSVGTag tag) : INHERITED(tag) {} - -private: - using INHERITED = SkSVGHiddenContainer; -}; - -class SkSVGFeDistantLight final : public SkSVGFeLightSource { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeDistantLight()); - } - - SkPoint3 computeDirection() const; - - SVG_ATTR(Azimuth , SkSVGNumberType, 0) - SVG_ATTR(Elevation, SkSVGNumberType, 0) - -private: - SkSVGFeDistantLight() : INHERITED(SkSVGTag::kFeDistantLight) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGFeLightSource; -}; - -class SkSVGFePointLight final : public SkSVGFeLightSource { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFePointLight()); - } - - SVG_ATTR(X, SkSVGNumberType, 0) - SVG_ATTR(Y, SkSVGNumberType, 0) - SVG_ATTR(Z, SkSVGNumberType, 0) - -private: - SkSVGFePointLight() : INHERITED(SkSVGTag::kFePointLight) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGFeLightSource; -}; - -class SkSVGFeSpotLight final : public SkSVGFeLightSource { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeSpotLight()); - } - - SVG_ATTR(X , SkSVGNumberType, 0) - SVG_ATTR(Y , SkSVGNumberType, 0) - SVG_ATTR(Z , SkSVGNumberType, 0) - SVG_ATTR(PointsAtX , SkSVGNumberType, 0) - SVG_ATTR(PointsAtY , SkSVGNumberType, 0) - SVG_ATTR(PointsAtZ , SkSVGNumberType, 0) - SVG_ATTR(SpecularExponent, SkSVGNumberType, 1) - - SVG_OPTIONAL_ATTR(LimitingConeAngle, SkSVGNumberType) - -private: - SkSVGFeSpotLight() : INHERITED(SkSVGTag::kFeSpotLight) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGFeLightSource; -}; - -#endif // SkSVGFeLightSource_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLighting.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLighting.h deleted file mode 100644 index 1de1e4c4ed6a38..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeLighting.h +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeLighting_DEFINED -#define SkSVGFeLighting_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeDistantLight; -class SkSVGFePointLight; -class SkSVGFeSpotLight; - -class SkSVGFeLighting : public SkSVGFe { -public: - struct KernelUnitLength { - SkSVGNumberType fDx; - SkSVGNumberType fDy; - }; - - SVG_ATTR(SurfaceScale, SkSVGNumberType, 1) - SVG_OPTIONAL_ATTR(KernelUnitLength, KernelUnitLength) - -protected: - explicit SkSVGFeLighting(SkSVGTag t) : INHERITED(t) {} - - std::vector getInputs() const final { return {this->getIn()}; } - - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const final; - - virtual sk_sp makeDistantLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeDistantLight*) const = 0; - - virtual sk_sp makePointLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFePointLight*) const = 0; - - virtual sk_sp makeSpotLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeSpotLight*) const = 0; - - SkColor resolveLightingColor(const SkSVGRenderContext&) const; - - SkPoint3 resolveXYZ(const SkSVGRenderContext&, - const SkSVGFilterContext&, - SkSVGNumberType, - SkSVGNumberType, - SkSVGNumberType) const; - -private: - using INHERITED = SkSVGFe; -}; - -class SkSVGFeSpecularLighting final : public SkSVGFeLighting { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeSpecularLighting()); - } - - SVG_ATTR(SpecularConstant, SkSVGNumberType, 1) - SVG_ATTR(SpecularExponent, SkSVGNumberType, 1) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp makeDistantLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeDistantLight*) const final; - - sk_sp makePointLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFePointLight*) const final; - - sk_sp makeSpotLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeSpotLight*) const final; - -private: - SkSVGFeSpecularLighting() : INHERITED(SkSVGTag::kFeSpecularLighting) {} - - using INHERITED = SkSVGFeLighting; -}; - -class SkSVGFeDiffuseLighting final : public SkSVGFeLighting { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeDiffuseLighting()); - } - - SVG_ATTR(DiffuseConstant, SkSVGNumberType, 1) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp makeDistantLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeDistantLight*) const final; - - sk_sp makePointLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFePointLight*) const final; - - sk_sp makeSpotLight(const SkSVGRenderContext&, - const SkSVGFilterContext&, - const SkSVGFeSpotLight*) const final; - -private: - SkSVGFeDiffuseLighting() : INHERITED(SkSVGTag::kFeDiffuseLighting) {} - - using INHERITED = SkSVGFeLighting; -}; - -#endif // SkSVGFeLighting_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeMorphology.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeMorphology.h deleted file mode 100644 index 172460f72ec01e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeMorphology.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeMorphology_DEFINED -#define SkSVGFeMorphology_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeMorphology : public SkSVGFe { -public: - struct Radius { - SkSVGNumberType fX; - SkSVGNumberType fY; - }; - - enum class Operator { - kErode, - kDilate, - }; - - static sk_sp Make() { - return sk_sp(new SkSVGFeMorphology()); - } - - SVG_ATTR(Operator, Operator, Operator::kErode) - SVG_ATTR(Radius , Radius , Radius({0, 0})) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {this->getIn()}; } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeMorphology() : INHERITED(SkSVGTag::kFeMorphology) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeMorphology_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeOffset.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeOffset.h deleted file mode 100644 index 318194f2800931..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeOffset.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeOffset_DEFINED -#define SkSVGFeOffset_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeOffset : public SkSVGFe { -public: - static sk_sp Make() { return sk_sp(new SkSVGFeOffset()); } - - SVG_ATTR(Dx, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(Dy, SkSVGNumberType, SkSVGNumberType(0)) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {this->getIn()}; } - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGFeOffset() : INHERITED(SkSVGTag::kFeOffset) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeOffset_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h deleted file mode 100644 index e55de5ebdae263..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFeTurbulence.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFeTurbulence_DEFINED -#define SkSVGFeTurbulence_DEFINED - -#include "modules/svg/include/SkSVGFe.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFeTurbulence : public SkSVGFe { -public: - static sk_sp Make() { - return sk_sp(new SkSVGFeTurbulence()); - } - - SVG_ATTR(BaseFrequency, SkSVGFeTurbulenceBaseFrequency, SkSVGFeTurbulenceBaseFrequency({})) - SVG_ATTR(NumOctaves, SkSVGIntegerType, SkSVGIntegerType(1)) - SVG_ATTR(Seed, SkSVGNumberType, SkSVGNumberType(0)) - SVG_ATTR(TurbulenceType, - SkSVGFeTurbulenceType, - SkSVGFeTurbulenceType(SkSVGFeTurbulenceType::Type::kTurbulence)) - -protected: - sk_sp onMakeImageFilter(const SkSVGRenderContext&, - const SkSVGFilterContext&) const override; - - std::vector getInputs() const override { return {}; } - - bool parseAndSetAttribute(const char*, const char*) override; -private: - SkSVGFeTurbulence() : INHERITED(SkSVGTag::kFeTurbulence) {} - - using INHERITED = SkSVGFe; -}; - -#endif // SkSVGFeTurbulence_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilter.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilter.h deleted file mode 100644 index 288f8d4b6a31e5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilter.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFilter_DEFINED -#define SkSVGFilter_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGFilter final : public SkSVGHiddenContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGFilter()); } - - sk_sp buildFilterDAG(const SkSVGRenderContext&) const; - - SVG_ATTR(X, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Y, SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Width, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(FilterUnits, - SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) - SVG_ATTR(PrimitiveUnits, - SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse)) - -private: - SkSVGFilter() : INHERITED(SkSVGTag::kFilter) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGFilter_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilterContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilterContext.h deleted file mode 100644 index edd503403c1305..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGFilterContext.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright 2020 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGFilterContext_DEFINED -#define SkSVGFilterContext_DEFINED - -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkString.h" -#include "include/private/SkTHash.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkImageFilter; -class SkSVGFeInputType; -class SkSVGRenderContext; - -class SkSVGFilterContext { -public: - SkSVGFilterContext(const SkRect& filterEffectsRegion, - const SkSVGObjectBoundingBoxUnits& primitiveUnits) - : fFilterEffectsRegion(filterEffectsRegion) - , fPrimitiveUnits(primitiveUnits) - , fPreviousResult({nullptr, filterEffectsRegion, SkSVGColorspace::kSRGB}) {} - - const SkRect& filterEffectsRegion() const { return fFilterEffectsRegion; } - - const SkRect& filterPrimitiveSubregion(const SkSVGFeInputType&) const; - - const SkSVGObjectBoundingBoxUnits& primitiveUnits() const { return fPrimitiveUnits; } - - void registerResult(const SkSVGStringType&, const sk_sp&, const SkRect&, SkSVGColorspace); - - void setPreviousResult(const sk_sp&, const SkRect&, SkSVGColorspace); - - bool previousResultIsSourceGraphic() const; - - SkSVGColorspace resolveInputColorspace(const SkSVGRenderContext&, - const SkSVGFeInputType&) const; - - sk_sp resolveInput(const SkSVGRenderContext&, const SkSVGFeInputType&) const; - - sk_sp resolveInput(const SkSVGRenderContext&, const SkSVGFeInputType&, SkSVGColorspace) const; - -private: - struct Result { - sk_sp fImageFilter; - SkRect fFilterSubregion; - SkSVGColorspace fColorspace; - }; - - const Result* findResultById(const SkSVGStringType&) const; - - std::tuple, SkSVGColorspace> getInput(const SkSVGRenderContext&, - const SkSVGFeInputType&) const; - - SkRect fFilterEffectsRegion; - - SkSVGObjectBoundingBoxUnits fPrimitiveUnits; - - SkTHashMap fResults; - - Result fPreviousResult; -}; - -#endif // SkSVGFilterContext_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGG.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGG.h deleted file mode 100644 index 4d7368f8d091e9..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGG.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGG_DEFINED -#define SkSVGG_DEFINED - -#include "modules/svg/include/SkSVGContainer.h" - -class SkSVGG : public SkSVGContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGG()); } - -private: - SkSVGG() : INHERITED(SkSVGTag::kG) { } - - using INHERITED = SkSVGContainer; -}; - -#endif // SkSVGG_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGGradient.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGGradient.h deleted file mode 100644 index 2c1e45afcf5d84..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGGradient.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGGradient_DEFINED -#define SkSVGGradient_DEFINED - -#include "include/core/SkShader.h" -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkMatrix; -class SkSVGRenderContext; -class SkSVGStop; - -class SkSVGGradient : public SkSVGHiddenContainer { -public: - SVG_ATTR(Href, SkSVGIRI, SkSVGIRI()) - SVG_ATTR(GradientTransform, SkSVGTransformType, SkSVGTransformType(SkMatrix::I())) - SVG_ATTR(SpreadMethod, SkSVGSpreadMethod, SkSVGSpreadMethod(SkSVGSpreadMethod::Type::kPad)) - SVG_ATTR(GradientUnits, - SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) - -protected: - explicit SkSVGGradient(SkSVGTag t) : INHERITED(t) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const final; - - virtual sk_sp onMakeShader(const SkSVGRenderContext&, - const SkColor4f*, const SkScalar*, int count, - SkTileMode, const SkMatrix& localMatrix) const = 0; - -private: - using StopPositionArray = SkSTArray<2, SkScalar , true>; - using StopColorArray = SkSTArray<2, SkColor4f, true>; - void collectColorStops(const SkSVGRenderContext&, StopPositionArray*, StopColorArray*) const; - SkColor4f resolveStopColor(const SkSVGRenderContext&, const SkSVGStop&) const; - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGGradient_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h deleted file mode 100644 index 319118e6927566..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGHiddenContainer.h +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGHiddenContainer_DEFINED -#define SkSVGHiddenContainer_DEFINED - -#include "modules/svg/include/SkSVGContainer.h" - -class SkSVGHiddenContainer : public SkSVGContainer { -protected: - explicit SkSVGHiddenContainer(SkSVGTag t) : INHERITED(t) {} - - void onRender(const SkSVGRenderContext&) const final {} - -private: - using INHERITED = SkSVGContainer; -}; - -#endif // SkSVGHiddenContainer_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGIDMapper.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGIDMapper.h deleted file mode 100644 index ea0d9165fcbae2..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGIDMapper.h +++ /dev/null @@ -1,19 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGIDMapper_DEFINED -#define SkSVGIDMapper_DEFINED - -#include "include/core/SkRefCnt.h" -#include "include/private/SkTHash.h" - -class SkString; -class SkSVGNode; - -using SkSVGIDMapper = SkTHashMap>; - -#endif // SkSVGIDMapper_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGImage.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGImage.h deleted file mode 100644 index bef8c1f5e43a9d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGImage.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGImage_DEFINED -#define SkSVGImage_DEFINED - -#include "modules/svg/include/SkSVGTransformableNode.h" -#include "modules/svg/include/SkSVGTypes.h" - -namespace skresources { -class ResourceProvider; -} - -class SkSVGImage final : public SkSVGTransformableNode { -public: - static sk_sp Make() { - return sk_sp(new SkSVGImage()); - } - - void appendChild(sk_sp) override { - SkDebugf("cannot append child nodes to this element.\n"); - } - - bool onPrepareToRender(SkSVGRenderContext*) const override; - void onRender(const SkSVGRenderContext&) const override; - SkPath onAsPath(const SkSVGRenderContext&) const override; - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - - struct ImageInfo { - sk_sp fImage; - SkRect fDst; - }; - static ImageInfo LoadImage(const sk_sp&, - const SkSVGIRI&, - const SkRect&, - SkSVGPreserveAspectRatio); - - SVG_ATTR(X , SkSVGLength , SkSVGLength(0)) - SVG_ATTR(Y , SkSVGLength , SkSVGLength(0)) - SVG_ATTR(Width , SkSVGLength , SkSVGLength(0)) - SVG_ATTR(Height , SkSVGLength , SkSVGLength(0)) - SVG_ATTR(Href , SkSVGIRI , SkSVGIRI()) - SVG_ATTR(PreserveAspectRatio, SkSVGPreserveAspectRatio, SkSVGPreserveAspectRatio()) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGImage() : INHERITED(SkSVGTag::kImage) {} - - using INHERITED = SkSVGTransformableNode; -}; - -#endif // SkSVGImage_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLine.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLine.h deleted file mode 100644 index 35c534f5efc12b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLine.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGLine_DEFINED -#define SkSVGLine_DEFINED - -#include "modules/svg/include/SkSVGShape.h" -#include "modules/svg/include/SkSVGTypes.h" - -struct SkPoint; - -class SkSVGLine final : public SkSVGShape { -public: - static sk_sp Make() { return sk_sp(new SkSVGLine()); } - - SVG_ATTR(X1, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(X2, SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0)) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - -private: - SkSVGLine(); - - // resolve and return the two endpoints - std::tuple resolve(const SkSVGLengthContext&) const; - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGLine_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLinearGradient.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLinearGradient.h deleted file mode 100644 index 57ef10a6dbe1d1..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGLinearGradient.h +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGLinearGradient_DEFINED -#define SkSVGLinearGradient_DEFINED - -#include "modules/svg/include/SkSVGGradient.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGLinearGradient final : public SkSVGGradient { -public: - static sk_sp Make() { - return sk_sp(new SkSVGLinearGradient()); - } - - SVG_ATTR(X1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Y1, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) - SVG_ATTR(X2, SkSVGLength, SkSVGLength(100, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Y2, SkSVGLength, SkSVGLength(0 , SkSVGLength::Unit::kPercentage)) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp onMakeShader(const SkSVGRenderContext&, - const SkColor4f*, const SkScalar*, int count, - SkTileMode, const SkMatrix&) const override; -private: - SkSVGLinearGradient(); - - using INHERITED = SkSVGGradient; -}; - -#endif // SkSVGLinearGradient_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGMask.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGMask.h deleted file mode 100644 index f5460c89715722..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGMask.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2021 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGMask_DEFINED -#define SkSVGMask_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGMask final : public SkSVGHiddenContainer { -public: - static sk_sp Make() { - return sk_sp(new SkSVGMask()); - } - - SVG_ATTR(X , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Y , SkSVGLength, SkSVGLength(-10, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Width , SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Height, SkSVGLength, SkSVGLength(120, SkSVGLength::Unit::kPercentage)) - - SVG_ATTR(MaskUnits, SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kObjectBoundingBox)) - SVG_ATTR(MaskContentUnits, SkSVGObjectBoundingBoxUnits, - SkSVGObjectBoundingBoxUnits(SkSVGObjectBoundingBoxUnits::Type::kUserSpaceOnUse)) - -private: - friend class SkSVGRenderContext; - - SkSVGMask() : INHERITED(SkSVGTag::kMask) {} - - bool parseAndSetAttribute(const char*, const char*) override; - - SkRect bounds(const SkSVGRenderContext&) const; - void renderMask(const SkSVGRenderContext&) const; - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGMask_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGNode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGNode.h deleted file mode 100644 index 9ca1b33b387451..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGNode.h +++ /dev/null @@ -1,223 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGNode_DEFINED -#define SkSVGNode_DEFINED - -#include "include/core/SkRefCnt.h" -#include "modules/svg/include/SkSVGAttribute.h" -#include "modules/svg/include/SkSVGAttributeParser.h" - -class SkCanvas; -class SkMatrix; -class SkPaint; -class SkPath; -class SkSVGLengthContext; -class SkSVGRenderContext; -class SkSVGValue; - -enum class SkSVGTag { - kCircle, - kClipPath, - kDefs, - kEllipse, - kFeBlend, - kFeColorMatrix, - kFeComposite, - kFeDiffuseLighting, - kFeDisplacementMap, - kFeDistantLight, - kFeFlood, - kFeGaussianBlur, - kFeImage, - kFeMorphology, - kFeOffset, - kFePointLight, - kFeSpecularLighting, - kFeSpotLight, - kFeTurbulence, - kFilter, - kG, - kImage, - kLine, - kLinearGradient, - kMask, - kPath, - kPattern, - kPolygon, - kPolyline, - kRadialGradient, - kRect, - kStop, - kSvg, - kText, - kTextLiteral, - kTextPath, - kTSpan, - kUse -}; - -#define SVG_PRES_ATTR(attr_name, attr_type, attr_inherited) \ -private: \ - bool set##attr_name(SkSVGAttributeParser::ParseResult< \ - SkSVGProperty>&& pr) {\ - if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \ - return pr.isValid(); \ - } \ - \ -public: \ - const SkSVGProperty& get##attr_name() const { \ - return fPresentationAttributes.f##attr_name; \ - } \ - void set##attr_name(const SkSVGProperty& v) { \ - auto* dest = &fPresentationAttributes.f##attr_name; \ - if (!dest->isInheritable() || v.isValue()) { \ - /* TODO: If dest is not inheritable, handle v == "inherit" */ \ - *dest = v; \ - } else { \ - dest->set(SkSVGPropertyState::kInherit); \ - } \ - } \ - void set##attr_name(SkSVGProperty&& v) { \ - auto* dest = &fPresentationAttributes.f##attr_name; \ - if (!dest->isInheritable() || v.isValue()) { \ - /* TODO: If dest is not inheritable, handle v == "inherit" */ \ - *dest = std::move(v); \ - } else { \ - dest->set(SkSVGPropertyState::kInherit); \ - } \ - } - -class SkSVGNode : public SkRefCnt { -public: - ~SkSVGNode() override; - - SkSVGTag tag() const { return fTag; } - - virtual void appendChild(sk_sp) = 0; - - void render(const SkSVGRenderContext&) const; - bool asPaint(const SkSVGRenderContext&, SkPaint*) const; - SkPath asPath(const SkSVGRenderContext&) const; - SkRect objectBoundingBox(const SkSVGRenderContext&) const; - - void setAttribute(SkSVGAttribute, const SkSVGValue&); - bool setAttribute(const char* attributeName, const char* attributeValue); - - // TODO: consolidate with existing setAttribute - virtual bool parseAndSetAttribute(const char* name, const char* value); - - // inherited - SVG_PRES_ATTR(ClipRule , SkSVGFillRule , true) - SVG_PRES_ATTR(Color , SkSVGColorType , true) - SVG_PRES_ATTR(ColorInterpolation , SkSVGColorspace, true) - SVG_PRES_ATTR(ColorInterpolationFilters, SkSVGColorspace, true) - SVG_PRES_ATTR(FillRule , SkSVGFillRule , true) - SVG_PRES_ATTR(Fill , SkSVGPaint , true) - SVG_PRES_ATTR(FillOpacity , SkSVGNumberType, true) - SVG_PRES_ATTR(FontFamily , SkSVGFontFamily, true) - SVG_PRES_ATTR(FontSize , SkSVGFontSize , true) - SVG_PRES_ATTR(FontStyle , SkSVGFontStyle , true) - SVG_PRES_ATTR(FontWeight , SkSVGFontWeight, true) - SVG_PRES_ATTR(Stroke , SkSVGPaint , true) - SVG_PRES_ATTR(StrokeDashArray , SkSVGDashArray , true) - SVG_PRES_ATTR(StrokeDashOffset , SkSVGLength , true) - SVG_PRES_ATTR(StrokeLineCap , SkSVGLineCap , true) - SVG_PRES_ATTR(StrokeLineJoin , SkSVGLineJoin , true) - SVG_PRES_ATTR(StrokeMiterLimit , SkSVGNumberType, true) - SVG_PRES_ATTR(StrokeOpacity , SkSVGNumberType, true) - SVG_PRES_ATTR(StrokeWidth , SkSVGLength , true) - SVG_PRES_ATTR(TextAnchor , SkSVGTextAnchor, true) - SVG_PRES_ATTR(Visibility , SkSVGVisibility, true) - - // not inherited - SVG_PRES_ATTR(ClipPath , SkSVGFuncIRI , false) - SVG_PRES_ATTR(Display , SkSVGDisplay , false) - SVG_PRES_ATTR(Mask , SkSVGFuncIRI , false) - SVG_PRES_ATTR(Filter , SkSVGFuncIRI , false) - SVG_PRES_ATTR(Opacity , SkSVGNumberType, false) - SVG_PRES_ATTR(StopColor , SkSVGColor , false) - SVG_PRES_ATTR(StopOpacity , SkSVGNumberType, false) - SVG_PRES_ATTR(FloodColor , SkSVGColor , false) - SVG_PRES_ATTR(FloodOpacity , SkSVGNumberType, false) - SVG_PRES_ATTR(LightingColor , SkSVGColor , false) - -protected: - SkSVGNode(SkSVGTag); - - static SkMatrix ComputeViewboxMatrix(const SkRect&, const SkRect&, SkSVGPreserveAspectRatio); - - // Called before onRender(), to apply local attributes to the context. Unlike onRender(), - // onPrepareToRender() bubbles up the inheritance chain: overriders should always call - // INHERITED::onPrepareToRender(), unless they intend to short-circuit rendering - // (return false). - // Implementations are expected to return true if rendering is to continue, or false if - // the node/subtree rendering is disabled. - virtual bool onPrepareToRender(SkSVGRenderContext*) const; - - virtual void onRender(const SkSVGRenderContext&) const = 0; - - virtual bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const { return false; } - - virtual SkPath onAsPath(const SkSVGRenderContext&) const = 0; - - virtual void onSetAttribute(SkSVGAttribute, const SkSVGValue&) {} - - virtual bool hasChildren() const { return false; } - - virtual SkRect onObjectBoundingBox(const SkSVGRenderContext&) const { - return SkRect::MakeEmpty(); - } - -private: - SkSVGTag fTag; - - // FIXME: this should be sparse - SkSVGPresentationAttributes fPresentationAttributes; - - using INHERITED = SkRefCnt; -}; - -#undef SVG_PRES_ATTR // presentation attributes are only defined for the base class - -#define _SVG_ATTR_SETTERS(attr_name, attr_type, attr_default, set_cp, set_mv) \ - private: \ - bool set##attr_name( \ - const SkSVGAttributeParser::ParseResult& pr) { \ - if (pr.isValid()) { this->set##attr_name(*pr); } \ - return pr.isValid(); \ - } \ - bool set##attr_name( \ - SkSVGAttributeParser::ParseResult&& pr) { \ - if (pr.isValid()) { this->set##attr_name(std::move(*pr)); } \ - return pr.isValid(); \ - } \ - public: \ - void set##attr_name(const attr_type& a) { set_cp(a); } \ - void set##attr_name(attr_type&& a) { set_mv(std::move(a)); } - -#define SVG_ATTR(attr_name, attr_type, attr_default) \ - private: \ - attr_type f##attr_name = attr_default; \ - public: \ - const attr_type& get##attr_name() const { return f##attr_name; } \ - _SVG_ATTR_SETTERS( \ - attr_name, attr_type, attr_default, \ - [this](const attr_type& a) { this->f##attr_name = a; }, \ - [this](attr_type&& a) { this->f##attr_name = std::move(a); }) - -#define SVG_OPTIONAL_ATTR(attr_name, attr_type) \ - private: \ - SkTLazy f##attr_name; \ - public: \ - const SkTLazy& get##attr_name() const { return f##attr_name; } \ - _SVG_ATTR_SETTERS( \ - attr_name, attr_type, attr_default, \ - [this](const attr_type& a) { this->f##attr_name.set(a); }, \ - [this](attr_type&& a) { this->f##attr_name.set(std::move(a)); }) - -#endif // SkSVGNode_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h deleted file mode 100644 index fb4f830434fa3c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGOpenTypeSVGDecoder.h +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2022 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGOpenTypeSVGDecoder_DEFINED -#define SkSVGOpenTypeSVGDecoder_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkOpenTypeSVGDecoder.h" -#include "include/core/SkSpan.h" -#include "include/core/SkTypes.h" - -class SkCanvas; -class SkSVGDOM; - -class SkSVGOpenTypeSVGDecoder : public SkOpenTypeSVGDecoder { -public: - static std::unique_ptr Make(const uint8_t* svg, size_t svgLength); - size_t approximateSize() override; - bool render(SkCanvas&, int upem, SkGlyphID glyphId, - SkColor foregroundColor, SkSpan palette) override; - ~SkSVGOpenTypeSVGDecoder() override; -private: - SkSVGOpenTypeSVGDecoder(sk_sp skSvg, size_t approximateSize); - sk_sp fSkSvg; - size_t fApproximateSize; -}; - -#endif // SkSVGOpenTypeSVGDecoder_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPath.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPath.h deleted file mode 100644 index 24f97d4de4504a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPath.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGPath_DEFINED -#define SkSVGPath_DEFINED - -#include "include/core/SkPath.h" -#include "modules/svg/include/SkSVGShape.h" - -class SkSVGPath final : public SkSVGShape { -public: - static sk_sp Make() { return sk_sp(new SkSVGPath()); } - - SVG_ATTR(Path, SkPath, SkPath()) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - -private: - SkSVGPath(); - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGPath_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPattern.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPattern.h deleted file mode 100644 index 442ee1e912cb90..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPattern.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGPattern_DEFINED -#define SkSVGPattern_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGRenderContext; - -class SkSVGPattern final : public SkSVGHiddenContainer { -public: - static sk_sp Make() { - return sk_sp(new SkSVGPattern()); - } - - SVG_ATTR(Href, SkSVGIRI, SkSVGIRI()) - SVG_OPTIONAL_ATTR(X , SkSVGLength) - SVG_OPTIONAL_ATTR(Y , SkSVGLength) - SVG_OPTIONAL_ATTR(Width , SkSVGLength) - SVG_OPTIONAL_ATTR(Height , SkSVGLength) - SVG_OPTIONAL_ATTR(PatternTransform, SkSVGTransformType) - -protected: - SkSVGPattern(); - - bool parseAndSetAttribute(const char*, const char*) override; - - bool onAsPaint(const SkSVGRenderContext&, SkPaint*) const override; - -private: - struct PatternAttributes { - SkTLazy fX, - fY, - fWidth, - fHeight; - SkTLazy fPatternTransform; - }; - - const SkSVGPattern* resolveHref(const SkSVGRenderContext&, PatternAttributes*) const; - const SkSVGPattern* hrefTarget(const SkSVGRenderContext&) const; - - // TODO: - // - patternUnits - // - patternContentUnits - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGPattern_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPoly.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPoly.h deleted file mode 100644 index c6a49f199f289a..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGPoly.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGPoly_DEFINED -#define SkSVGPoly_DEFINED - -#include "include/core/SkPath.h" -#include "modules/svg/include/SkSVGShape.h" - -// Handles and elements. -class SkSVGPoly final : public SkSVGShape { -public: - static sk_sp MakePolygon() { - return sk_sp(new SkSVGPoly(SkSVGTag::kPolygon)); - } - - static sk_sp MakePolyline() { - return sk_sp(new SkSVGPoly(SkSVGTag::kPolyline)); - } - - SVG_ATTR(Points, SkSVGPointsType, SkSVGPointsType()) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - -private: - SkSVGPoly(SkSVGTag); - - mutable SkPath fPath; // mutated in onDraw(), to apply inherited fill types. - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGPoly_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRadialGradient.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRadialGradient.h deleted file mode 100644 index 1ab52e42214d9f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRadialGradient.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGRadialGradient_DEFINED -#define SkSVGRadialGradient_DEFINED - -#include "modules/svg/include/SkSVGGradient.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGRadialGradient final : public SkSVGGradient { -public: - static sk_sp Make() { - return sk_sp(new SkSVGRadialGradient()); - } - - SVG_ATTR(Cx, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Cy, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(R, SkSVGLength, SkSVGLength(50, SkSVGLength::Unit::kPercentage)) - SVG_OPTIONAL_ATTR(Fx, SkSVGLength) - SVG_OPTIONAL_ATTR(Fy, SkSVGLength) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - sk_sp onMakeShader(const SkSVGRenderContext&, - const SkColor4f*, const SkScalar*, int count, - SkTileMode, const SkMatrix&) const override; -private: - SkSVGRadialGradient(); - - using INHERITED = SkSVGGradient; -}; - -#endif // SkSVGRadialGradient_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRect.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRect.h deleted file mode 100644 index 87f1e44bc1078d..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRect.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGRect_DEFINED -#define SkSVGRect_DEFINED - -#include "modules/svg/include/SkSVGShape.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkRRect; - -class SkSVGRect final : public SkSVGShape { -public: - static sk_sp Make() { return sk_sp(new SkSVGRect()); } - - SVG_ATTR(X , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Y , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Width , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Height, SkSVGLength, SkSVGLength(0)) - - SVG_OPTIONAL_ATTR(Rx, SkSVGLength) - SVG_OPTIONAL_ATTR(Ry, SkSVGLength) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - - void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const override; - - SkPath onAsPath(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - -private: - SkSVGRect(); - - SkRRect resolve(const SkSVGLengthContext&) const; - - using INHERITED = SkSVGShape; -}; - -#endif // SkSVGRect_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRenderContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRenderContext.h deleted file mode 100644 index 27a86395cb4b4f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGRenderContext.h +++ /dev/null @@ -1,188 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGRenderContext_DEFINED -#define SkSVGRenderContext_DEFINED - -#include "include/core/SkFontMgr.h" -#include "include/core/SkM44.h" -#include "include/core/SkPaint.h" -#include "include/core/SkPath.h" -#include "include/core/SkRect.h" -#include "include/core/SkSize.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTHash.h" -#include "modules/skresources/include/SkResources.h" -#include "modules/svg/include/SkSVGAttribute.h" -#include "modules/svg/include/SkSVGIDMapper.h" -#include "src/core/SkTLazy.h" - -class SkCanvas; -class SkSVGLength; - -class SkSVGLengthContext { -public: - SkSVGLengthContext(const SkSize& viewport, SkScalar dpi = 90) - : fViewport(viewport), fDPI(dpi) {} - - enum class LengthType { - kHorizontal, - kVertical, - kOther, - }; - - const SkSize& viewPort() const { return fViewport; } - void setViewPort(const SkSize& viewport) { fViewport = viewport; } - - SkScalar resolve(const SkSVGLength&, LengthType) const; - SkRect resolveRect(const SkSVGLength& x, const SkSVGLength& y, - const SkSVGLength& w, const SkSVGLength& h) const; - -private: - SkSize fViewport; - SkScalar fDPI; -}; - -struct SkSVGPresentationContext { - SkSVGPresentationContext(); - SkSVGPresentationContext(const SkSVGPresentationContext&) = default; - SkSVGPresentationContext& operator=(const SkSVGPresentationContext&) = default; - - const SkTHashMap* fNamedColors = nullptr; - - // Inherited presentation attributes, computed for the current node. - SkSVGPresentationAttributes fInherited; -}; - -class SkSVGRenderContext { -public: - // Captures data required for object bounding box resolution. - struct OBBScope { - const SkSVGNode* fNode; - const SkSVGRenderContext* fCtx; - }; - - SkSVGRenderContext(SkCanvas*, const sk_sp&, - const sk_sp&, const SkSVGIDMapper&, - const SkSVGLengthContext&, const SkSVGPresentationContext&, - const OBBScope&); - SkSVGRenderContext(const SkSVGRenderContext&); - SkSVGRenderContext(const SkSVGRenderContext&, SkCanvas*); - // Establish a new OBB scope. Normally used when entering a node's render scope. - SkSVGRenderContext(const SkSVGRenderContext&, const SkSVGNode*); - ~SkSVGRenderContext(); - - const SkSVGLengthContext& lengthContext() const { return *fLengthContext; } - SkSVGLengthContext* writableLengthContext() { return fLengthContext.writable(); } - - const SkSVGPresentationContext& presentationContext() const { return *fPresentationContext; } - - SkCanvas* canvas() const { return fCanvas; } - void saveOnce(); - - enum ApplyFlags { - kLeaf = 1 << 0, // the target node doesn't have descendants - }; - void applyPresentationAttributes(const SkSVGPresentationAttributes&, uint32_t flags); - - // Scoped wrapper that temporarily clears the original node reference. - class BorrowedNode { - public: - explicit BorrowedNode(sk_sp* node) - : fOwner(node) { - if (fOwner) { - fBorrowed = std::move(*fOwner); - *fOwner = nullptr; - } - } - - ~BorrowedNode() { - if (fOwner) { - *fOwner = std::move(fBorrowed); - } - } - - const SkSVGNode* get() const { return fBorrowed.get(); } - const SkSVGNode* operator->() const { return fBorrowed.get(); } - const SkSVGNode& operator*() const { return *fBorrowed; } - - explicit operator bool() const { return !!fBorrowed; } - - private: - // noncopyable - BorrowedNode(const BorrowedNode&) = delete; - BorrowedNode& operator=(BorrowedNode&) = delete; - - sk_sp* fOwner; - sk_sp fBorrowed; - }; - - // Note: the id->node association is cleared for the lifetime of the returned value - // (effectively breaks reference cycles, assuming appropriate return value scoping). - BorrowedNode findNodeById(const SkSVGIRI&) const; - - SkTLazy fillPaint() const; - SkTLazy strokePaint() const; - - SkSVGColorType resolveSvgColor(const SkSVGColor&) const; - - // The local computed clip path (not inherited). - const SkPath* clipPath() const { return fClipPath.getMaybeNull(); } - - const sk_sp& resourceProvider() const { - return fResourceProvider; - } - - sk_sp fontMgr() const { - return fFontMgr ? fFontMgr : SkFontMgr::RefDefault(); - } - - // Returns the translate/scale transformation required to map into the current OBB scope, - // with the specified units. - struct OBBTransform { - SkV2 offset, scale; - }; - OBBTransform transformForCurrentOBB(SkSVGObjectBoundingBoxUnits) const; - - SkRect resolveOBBRect(const SkSVGLength& x, const SkSVGLength& y, - const SkSVGLength& w, const SkSVGLength& h, - SkSVGObjectBoundingBoxUnits) const; - -private: - // Stack-only - void* operator new(size_t) = delete; - void* operator new(size_t, void*) = delete; - SkSVGRenderContext& operator=(const SkSVGRenderContext&) = delete; - - void applyOpacity(SkScalar opacity, uint32_t flags, bool hasFilter); - void applyFilter(const SkSVGFuncIRI&); - void applyClip(const SkSVGFuncIRI&); - void applyMask(const SkSVGFuncIRI&); - - SkTLazy commonPaint(const SkSVGPaint&, float opacity) const; - - const sk_sp& fFontMgr; - const sk_sp& fResourceProvider; - const SkSVGIDMapper& fIDMapper; - SkTCopyOnFirstWrite fLengthContext; - SkTCopyOnFirstWrite fPresentationContext; - SkCanvas* fCanvas; - // The save count on 'fCanvas' at construction time. - // A restoreToCount() will be issued on destruction. - int fCanvasSaveCount; - - // clipPath, if present for the current context (not inherited). - SkTLazy fClipPath; - - // Deferred opacity optimization for leaf nodes. - float fDeferredPaintOpacity = 1; - - // Current object bounding box scope. - const OBBScope fOBBScope; -}; - -#endif // SkSVGRenderContext_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGSVG.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGSVG.h deleted file mode 100644 index 91f33dea9a3c27..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGSVG.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGSVG_DEFINED -#define SkSVGSVG_DEFINED - -#include "modules/svg/include/SkSVGContainer.h" -#include "modules/svg/include/SkSVGTypes.h" -#include "src/core/SkTLazy.h" - -class SkSVGLengthContext; - -class SkSVGSVG : public SkSVGContainer { -public: - enum class Type { - kRoot, - kInner, - }; - static sk_sp Make(Type t = Type::kInner) { return sk_sp(new SkSVGSVG(t)); } - - SVG_ATTR(X , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Y , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Width , SkSVGLength, SkSVGLength(100, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(Height , SkSVGLength, SkSVGLength(100, SkSVGLength::Unit::kPercentage)) - SVG_ATTR(PreserveAspectRatio, SkSVGPreserveAspectRatio, SkSVGPreserveAspectRatio()) - - SVG_OPTIONAL_ATTR(ViewBox, SkSVGViewBoxType) - - SkSize intrinsicSize(const SkSVGLengthContext&) const; - - void renderNode(const SkSVGRenderContext&, const SkSVGIRI& iri) const; - -protected: - bool onPrepareToRender(SkSVGRenderContext*) const override; - - void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; - -private: - explicit SkSVGSVG(Type t) - : INHERITED(SkSVGTag::kSvg) - , fType(t) - {} - - // Some attributes behave differently for the outermost svg element. - const Type fType; - - using INHERITED = SkSVGContainer; -}; - -#endif // SkSVGSVG_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGShape.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGShape.h deleted file mode 100644 index 79078354e9227c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGShape.h +++ /dev/null @@ -1,33 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGShape_DEFINED -#define SkSVGShape_DEFINED - -#include "include/core/SkPath.h" -#include "modules/svg/include/SkSVGTransformableNode.h" - -class SkSVGLengthContext; -class SkPaint; - -class SkSVGShape : public SkSVGTransformableNode { -public: - void appendChild(sk_sp) override; - -protected: - SkSVGShape(SkSVGTag); - - void onRender(const SkSVGRenderContext&) const final; - - virtual void onDraw(SkCanvas*, const SkSVGLengthContext&, const SkPaint&, - SkPathFillType) const = 0; - -private: - using INHERITED = SkSVGTransformableNode; -}; - -#endif // SkSVGShape_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGStop.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGStop.h deleted file mode 100644 index 58bf57b7642049..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGStop.h +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGStop_DEFINED -#define SkSVGStop_DEFINED - -#include "modules/svg/include/SkSVGHiddenContainer.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGLengthContext; - -class SkSVGStop : public SkSVGHiddenContainer { -public: - static sk_sp Make() { - return sk_sp(new SkSVGStop()); - } - - - SVG_ATTR(Offset, SkSVGLength, SkSVGLength(0, SkSVGLength::Unit::kPercentage)) - -protected: - bool parseAndSetAttribute(const char*, const char*) override; - -private: - SkSVGStop(); - - using INHERITED = SkSVGHiddenContainer; -}; - -#endif // SkSVGStop_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGText.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGText.h deleted file mode 100644 index f1fa4e7eeb745b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGText.h +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Copyright 2019 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGText_DEFINED -#define SkSVGText_DEFINED - -#include - -#include "modules/svg/include/SkSVGTransformableNode.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGTextContext; - -// Base class for text-rendering nodes. -class SkSVGTextFragment : public SkSVGTransformableNode { -public: - void renderText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const; - -protected: - explicit SkSVGTextFragment(SkSVGTag t) : INHERITED(t) {} - - virtual void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const = 0; - - // Text nodes other than the root element are not rendered directly. - void onRender(const SkSVGRenderContext&) const override {} - -private: - SkPath onAsPath(const SkSVGRenderContext&) const override; - - using INHERITED = SkSVGTransformableNode; -}; - -// Base class for nestable text containers (, , etc). -class SkSVGTextContainer : public SkSVGTextFragment { -public: - SVG_ATTR(X, std::vector, {}) - SVG_ATTR(Y, std::vector, {}) - SVG_ATTR(Dx, std::vector, {}) - SVG_ATTR(Dy, std::vector, {}) - SVG_ATTR(Rotate, std::vector, {}) - - SVG_ATTR(XmlSpace, SkSVGXmlSpace, SkSVGXmlSpace::kDefault) - - void appendChild(sk_sp) final; - -protected: - explicit SkSVGTextContainer(SkSVGTag t) : INHERITED(t) {} - - void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override; - - bool parseAndSetAttribute(const char*, const char*) override; - -private: - std::vector> fChildren; - - using INHERITED = SkSVGTextFragment; -}; - -class SkSVGText final : public SkSVGTextContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGText()); } - -private: - SkSVGText() : INHERITED(SkSVGTag::kText) {} - - void onRender(const SkSVGRenderContext&) const override; - - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - SkPath onAsPath(const SkSVGRenderContext&) const override; - - using INHERITED = SkSVGTextContainer; -}; - -class SkSVGTSpan final : public SkSVGTextContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGTSpan()); } - -private: - SkSVGTSpan() : INHERITED(SkSVGTag::kTSpan) {} - - using INHERITED = SkSVGTextContainer; -}; - -class SkSVGTextLiteral final : public SkSVGTextFragment { -public: - static sk_sp Make() { - return sk_sp(new SkSVGTextLiteral()); - } - - SVG_ATTR(Text, SkSVGStringType, SkSVGStringType()) - -private: - SkSVGTextLiteral() : INHERITED(SkSVGTag::kTextLiteral) {} - - void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override; - - void appendChild(sk_sp) override {} - - using INHERITED = SkSVGTextFragment; -}; - -class SkSVGTextPath final : public SkSVGTextContainer { -public: - static sk_sp Make() { return sk_sp(new SkSVGTextPath()); } - - SVG_ATTR(Href , SkSVGIRI , {} ) - SVG_ATTR(StartOffset, SkSVGLength, SkSVGLength(0)) - -private: - SkSVGTextPath() : INHERITED(SkSVGTag::kTextPath) {} - - void onShapeText(const SkSVGRenderContext&, SkSVGTextContext*, SkSVGXmlSpace) const override; - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGTextContainer; -}; - -#endif // SkSVGText_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTransformableNode.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTransformableNode.h deleted file mode 100644 index bc4d18f18e437c..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTransformableNode.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGTransformableNode_DEFINED -#define SkSVGTransformableNode_DEFINED - -#include "include/core/SkMatrix.h" -#include "modules/svg/include/SkSVGNode.h" - -class SkSVGTransformableNode : public SkSVGNode { -public: - void setTransform(const SkSVGTransformType& t) { fTransform = t; } - -protected: - SkSVGTransformableNode(SkSVGTag); - - bool onPrepareToRender(SkSVGRenderContext*) const override; - - void onSetAttribute(SkSVGAttribute, const SkSVGValue&) override; - - void mapToParent(SkPath*) const; - - void mapToParent(SkRect*) const; - -private: - // FIXME: should be sparse - SkSVGTransformType fTransform; - - using INHERITED = SkSVGNode; -}; - -#endif // SkSVGTransformableNode_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTypes.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTypes.h deleted file mode 100644 index db103bef59179b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGTypes.h +++ /dev/null @@ -1,730 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGTypes_DEFINED -#define SkSVGTypes_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkPath.h" -#include "include/core/SkPoint.h" -#include "include/core/SkRect.h" -#include "include/core/SkRefCnt.h" -#include "include/core/SkScalar.h" -#include "include/core/SkSpan.h" -#include "include/core/SkString.h" -#include "include/core/SkTypes.h" -#include "include/private/SkTDArray.h" -#include "src/core/SkTLazy.h" - -using SkSVGColorType = SkColor; -using SkSVGIntegerType = int; -using SkSVGNumberType = SkScalar; -using SkSVGStringType = SkString; -using SkSVGViewBoxType = SkRect; -using SkSVGTransformType = SkMatrix; -using SkSVGPointsType = SkTDArray; - -enum class SkSVGPropertyState { - kUnspecified, - kInherit, - kValue, -}; - -// https://www.w3.org/TR/SVG11/intro.html#TermProperty -template class SkSVGProperty { -public: - using ValueT = T; - - SkSVGProperty() : fState(SkSVGPropertyState::kUnspecified) {} - - explicit SkSVGProperty(SkSVGPropertyState state) : fState(state) {} - - explicit SkSVGProperty(const T& value) : fState(SkSVGPropertyState::kValue) { - fValue.set(value); - } - - explicit SkSVGProperty(T&& value) : fState(SkSVGPropertyState::kValue) { - fValue.set(std::move(value)); - } - - template - void init(Args&&... args) { - fState = SkSVGPropertyState::kValue; - fValue.init(std::forward(args)...); - } - - constexpr bool isInheritable() const { return kInheritable; } - - bool isValue() const { return fState == SkSVGPropertyState::kValue; } - - T* getMaybeNull() const { - return fValue.getMaybeNull(); - } - - void set(SkSVGPropertyState state) { - fState = state; - if (fState != SkSVGPropertyState::kValue) { - fValue.reset(); - } - } - - void set(const T& value) { - fState = SkSVGPropertyState::kValue; - fValue.set(value); - } - - void set(T&& value) { - fState = SkSVGPropertyState::kValue; - fValue.set(std::move(value)); - } - - T* operator->() { - SkASSERT(fState == SkSVGPropertyState::kValue); - SkASSERT(fValue.isValid()); - return fValue.get(); - } - - const T* operator->() const { - SkASSERT(fState == SkSVGPropertyState::kValue); - SkASSERT(fValue.isValid()); - return fValue.get(); - } - - T& operator*() { - SkASSERT(fState == SkSVGPropertyState::kValue); - SkASSERT(fValue.isValid()); - return *fValue; - } - - const T& operator*() const { - SkASSERT(fState == SkSVGPropertyState::kValue); - SkASSERT(fValue.isValid()); - return *fValue; - } - -private: - SkSVGPropertyState fState; - SkTLazy fValue; -}; - -class SkSVGLength { -public: - enum class Unit { - kUnknown, - kNumber, - kPercentage, - kEMS, - kEXS, - kPX, - kCM, - kMM, - kIN, - kPT, - kPC, - }; - - constexpr SkSVGLength() : fValue(0), fUnit(Unit::kUnknown) {} - explicit constexpr SkSVGLength(SkScalar v, Unit u = Unit::kNumber) - : fValue(v), fUnit(u) {} - SkSVGLength(const SkSVGLength&) = default; - SkSVGLength& operator=(const SkSVGLength&) = default; - - bool operator==(const SkSVGLength& other) const { - return fUnit == other.fUnit && fValue == other.fValue; - } - bool operator!=(const SkSVGLength& other) const { return !(*this == other); } - - const SkScalar& value() const { return fValue; } - const Unit& unit() const { return fUnit; } - -private: - SkScalar fValue; - Unit fUnit; -}; - -// https://www.w3.org/TR/SVG11/linking.html#IRIReference -class SkSVGIRI { -public: - enum class Type { - kLocal, - kNonlocal, - kDataURI, - }; - - SkSVGIRI() : fType(Type::kLocal) {} - SkSVGIRI(Type t, const SkSVGStringType& iri) : fType(t), fIRI(iri) {} - - Type type() const { return fType; } - const SkSVGStringType& iri() const { return fIRI; } - - bool operator==(const SkSVGIRI& other) const { - return fType == other.fType && fIRI == other.fIRI; - } - bool operator!=(const SkSVGIRI& other) const { return !(*this == other); } - -private: - Type fType; - SkSVGStringType fIRI; -}; - -// https://www.w3.org/TR/SVG11/types.html#InterfaceSVGColor -class SkSVGColor { -public: - enum class Type { - kCurrentColor, - kColor, - kICCColor, - }; - using Vars = SkSTArray<1, SkString>; - - SkSVGColor() : SkSVGColor(SK_ColorBLACK) {} - explicit SkSVGColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c), fVars(nullptr) {} - explicit SkSVGColor(Type t, Vars&& vars) - : fType(t), fColor(SK_ColorBLACK) - , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {} - explicit SkSVGColor(const SkSVGColorType& c, Vars&& vars) - : fType(Type::kColor), fColor(c) - , fVars(vars.empty() ? nullptr : new RefCntVars(std::move(vars))) {} - - SkSVGColor(const SkSVGColor&) = default; - SkSVGColor& operator=(const SkSVGColor&) = default; - SkSVGColor(SkSVGColor&&) = default; - SkSVGColor& operator=(SkSVGColor&&) = default; - - bool operator==(const SkSVGColor& other) const { - return fType == other.fType && fColor == other.fColor && fVars == other.fVars; - } - bool operator!=(const SkSVGColor& other) const { return !(*this == other); } - - Type type() const { return fType; } - const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; } - SkSpan vars() const { - return fVars ? SkSpan(fVars->fData) : SkSpan(); - } - SkSpan vars() { - return fVars ? SkSpan(fVars->fData) : SkSpan(); - } - -private: - Type fType; - SkSVGColorType fColor; - struct RefCntVars : public SkNVRefCnt { - RefCntVars(Vars&& vars) : fData(std::move(vars)) {} - Vars fData; - }; - sk_sp fVars; -}; - -class SkSVGPaint { -public: - enum class Type { - kNone, - kColor, - kIRI, - }; - - SkSVGPaint() : fType(Type::kNone), fColor(SK_ColorBLACK) {} - explicit SkSVGPaint(Type t) : fType(t), fColor(SK_ColorBLACK) {} - explicit SkSVGPaint(SkSVGColor c) : fType(Type::kColor), fColor(std::move(c)) {} - SkSVGPaint(const SkSVGIRI& iri, SkSVGColor fallback_color) - : fType(Type::kIRI), fColor(std::move(fallback_color)), fIRI(iri) {} - - SkSVGPaint(const SkSVGPaint&) = default; - SkSVGPaint& operator=(const SkSVGPaint&) = default; - SkSVGPaint(SkSVGPaint&&) = default; - SkSVGPaint& operator=(SkSVGPaint&&) = default; - - bool operator==(const SkSVGPaint& other) const { - return fType == other.fType && fColor == other.fColor && fIRI == other.fIRI; - } - bool operator!=(const SkSVGPaint& other) const { return !(*this == other); } - - Type type() const { return fType; } - const SkSVGColor& color() const { - SkASSERT(fType == Type::kColor || fType == Type::kIRI); - return fColor; - } - const SkSVGIRI& iri() const { SkASSERT(fType == Type::kIRI); return fIRI; } - -private: - Type fType; - - // Logical union. - SkSVGColor fColor; - SkSVGIRI fIRI; -}; - -// | none (used for clip/mask/filter properties) -class SkSVGFuncIRI { -public: - enum class Type { - kNone, - kIRI, - }; - - SkSVGFuncIRI() : fType(Type::kNone) {} - explicit SkSVGFuncIRI(Type t) : fType(t) {} - explicit SkSVGFuncIRI(SkSVGIRI&& iri) : fType(Type::kIRI), fIRI(std::move(iri)) {} - - bool operator==(const SkSVGFuncIRI& other) const { - return fType == other.fType && fIRI == other.fIRI; - } - bool operator!=(const SkSVGFuncIRI& other) const { return !(*this == other); } - - Type type() const { return fType; } - const SkSVGIRI& iri() const { SkASSERT(fType == Type::kIRI); return fIRI; } - -private: - Type fType; - SkSVGIRI fIRI; -}; - -enum class SkSVGLineCap { - kButt, - kRound, - kSquare, -}; - -class SkSVGLineJoin { -public: - enum class Type { - kMiter, - kRound, - kBevel, - kInherit, - }; - - constexpr SkSVGLineJoin() : fType(Type::kInherit) {} - constexpr explicit SkSVGLineJoin(Type t) : fType(t) {} - - SkSVGLineJoin(const SkSVGLineJoin&) = default; - SkSVGLineJoin& operator=(const SkSVGLineJoin&) = default; - - bool operator==(const SkSVGLineJoin& other) const { return fType == other.fType; } - bool operator!=(const SkSVGLineJoin& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -class SkSVGSpreadMethod { -public: - // These values must match Skia's SkShader::TileMode enum. - enum class Type { - kPad, // kClamp_TileMode - kRepeat, // kRepeat_TileMode - kReflect, // kMirror_TileMode - }; - - constexpr SkSVGSpreadMethod() : fType(Type::kPad) {} - constexpr explicit SkSVGSpreadMethod(Type t) : fType(t) {} - - SkSVGSpreadMethod(const SkSVGSpreadMethod&) = default; - SkSVGSpreadMethod& operator=(const SkSVGSpreadMethod&) = default; - - bool operator==(const SkSVGSpreadMethod& other) const { return fType == other.fType; } - bool operator!=(const SkSVGSpreadMethod& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -class SkSVGFillRule { -public: - enum class Type { - kNonZero, - kEvenOdd, - kInherit, - }; - - constexpr SkSVGFillRule() : fType(Type::kInherit) {} - constexpr explicit SkSVGFillRule(Type t) : fType(t) {} - - SkSVGFillRule(const SkSVGFillRule&) = default; - SkSVGFillRule& operator=(const SkSVGFillRule&) = default; - - bool operator==(const SkSVGFillRule& other) const { return fType == other.fType; } - bool operator!=(const SkSVGFillRule& other) const { return !(*this == other); } - - Type type() const { return fType; } - - SkPathFillType asFillType() const { - SkASSERT(fType != Type::kInherit); // should never be called for unresolved values. - return fType == Type::kEvenOdd ? SkPathFillType::kEvenOdd : SkPathFillType::kWinding; - } - -private: - Type fType; -}; - -class SkSVGVisibility { -public: - enum class Type { - kVisible, - kHidden, - kCollapse, - kInherit, - }; - - constexpr SkSVGVisibility() : fType(Type::kVisible) {} - constexpr explicit SkSVGVisibility(Type t) : fType(t) {} - - SkSVGVisibility(const SkSVGVisibility&) = default; - SkSVGVisibility& operator=(const SkSVGVisibility&) = default; - - bool operator==(const SkSVGVisibility& other) const { return fType == other.fType; } - bool operator!=(const SkSVGVisibility& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -class SkSVGDashArray { -public: - enum class Type { - kNone, - kDashArray, - kInherit, - }; - - SkSVGDashArray() : fType(Type::kNone) {} - explicit SkSVGDashArray(Type t) : fType(t) {} - explicit SkSVGDashArray(SkTDArray&& dashArray) - : fType(Type::kDashArray) - , fDashArray(std::move(dashArray)) {} - - SkSVGDashArray(const SkSVGDashArray&) = default; - SkSVGDashArray& operator=(const SkSVGDashArray&) = default; - - bool operator==(const SkSVGDashArray& other) const { - return fType == other.fType && fDashArray == other.fDashArray; - } - bool operator!=(const SkSVGDashArray& other) const { return !(*this == other); } - - Type type() const { return fType; } - - const SkTDArray& dashArray() const { return fDashArray; } - -private: - Type fType; - SkTDArray fDashArray; -}; - -class SkSVGStopColor { -public: - enum class Type { - kColor, - kCurrentColor, - kICCColor, - kInherit, - }; - - SkSVGStopColor() : fType(Type::kColor), fColor(SK_ColorBLACK) {} - explicit SkSVGStopColor(Type t) : fType(t), fColor(SK_ColorBLACK) {} - explicit SkSVGStopColor(const SkSVGColorType& c) : fType(Type::kColor), fColor(c) {} - - SkSVGStopColor(const SkSVGStopColor&) = default; - SkSVGStopColor& operator=(const SkSVGStopColor&) = default; - - bool operator==(const SkSVGStopColor& other) const { - return fType == other.fType && fColor == other.fColor; - } - bool operator!=(const SkSVGStopColor& other) const { return !(*this == other); } - - Type type() const { return fType; } - const SkSVGColorType& color() const { SkASSERT(fType == Type::kColor); return fColor; } - -private: - Type fType; - SkSVGColorType fColor; -}; - -class SkSVGObjectBoundingBoxUnits { -public: - enum class Type { - kUserSpaceOnUse, - kObjectBoundingBox, - }; - - SkSVGObjectBoundingBoxUnits() : fType(Type::kUserSpaceOnUse) {} - explicit SkSVGObjectBoundingBoxUnits(Type t) : fType(t) {} - - bool operator==(const SkSVGObjectBoundingBoxUnits& other) const { - return fType == other.fType; - } - bool operator!=(const SkSVGObjectBoundingBoxUnits& other) const { - return !(*this == other); - } - - Type type() const { return fType; } - -private: - Type fType; -}; - -class SkSVGFontFamily { -public: - enum class Type { - kFamily, - kInherit, - }; - - SkSVGFontFamily() : fType(Type::kInherit) {} - explicit SkSVGFontFamily(const char family[]) - : fType(Type::kFamily) - , fFamily(family) {} - - bool operator==(const SkSVGFontFamily& other) const { - return fType == other.fType && fFamily == other.fFamily; - } - bool operator!=(const SkSVGFontFamily& other) const { return !(*this == other); } - - Type type() const { return fType; } - - const SkString& family() const { return fFamily; } - -private: - Type fType; - SkString fFamily; -}; - -class SkSVGFontStyle { -public: - enum class Type { - kNormal, - kItalic, - kOblique, - kInherit, - }; - - SkSVGFontStyle() : fType(Type::kInherit) {} - explicit SkSVGFontStyle(Type t) : fType(t) {} - - bool operator==(const SkSVGFontStyle& other) const { - return fType == other.fType; - } - bool operator!=(const SkSVGFontStyle& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -class SkSVGFontSize { -public: - enum class Type { - kLength, - kInherit, - }; - - SkSVGFontSize() : fType(Type::kInherit), fSize(0) {} - explicit SkSVGFontSize(const SkSVGLength& s) - : fType(Type::kLength) - , fSize(s) {} - - bool operator==(const SkSVGFontSize& other) const { - return fType == other.fType && fSize == other.fSize; - } - bool operator!=(const SkSVGFontSize& other) const { return !(*this == other); } - - Type type() const { return fType; } - - const SkSVGLength& size() const { return fSize; } - -private: - Type fType; - SkSVGLength fSize; -}; - -class SkSVGFontWeight { -public: - enum class Type { - k100, - k200, - k300, - k400, - k500, - k600, - k700, - k800, - k900, - kNormal, - kBold, - kBolder, - kLighter, - kInherit, - }; - - SkSVGFontWeight() : fType(Type::kInherit) {} - explicit SkSVGFontWeight(Type t) : fType(t) {} - - bool operator==(const SkSVGFontWeight& other) const { - return fType == other.fType; - } - bool operator!=(const SkSVGFontWeight& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -struct SkSVGPreserveAspectRatio { - enum Align : uint8_t { - // These values are chosen such that bits [0,1] encode X alignment, and - // bits [2,3] encode Y alignment. - kXMinYMin = 0x00, - kXMidYMin = 0x01, - kXMaxYMin = 0x02, - kXMinYMid = 0x04, - kXMidYMid = 0x05, - kXMaxYMid = 0x06, - kXMinYMax = 0x08, - kXMidYMax = 0x09, - kXMaxYMax = 0x0a, - - kNone = 0x10, - }; - - enum Scale { - kMeet, - kSlice, - }; - - Align fAlign = kXMidYMid; - Scale fScale = kMeet; -}; - -class SkSVGTextAnchor { -public: - enum class Type { - kStart, - kMiddle, - kEnd, - kInherit, - }; - - SkSVGTextAnchor() : fType(Type::kInherit) {} - explicit SkSVGTextAnchor(Type t) : fType(t) {} - - bool operator==(const SkSVGTextAnchor& other) const { - return fType == other.fType; - } - bool operator!=(const SkSVGTextAnchor& other) const { return !(*this == other); } - - Type type() const { return fType; } - -private: - Type fType; -}; - -// https://www.w3.org/TR/SVG11/filters.html#FilterPrimitiveInAttribute -class SkSVGFeInputType { -public: - enum class Type { - kSourceGraphic, - kSourceAlpha, - kBackgroundImage, - kBackgroundAlpha, - kFillPaint, - kStrokePaint, - kFilterPrimitiveReference, - kUnspecified, - }; - - SkSVGFeInputType() : fType(Type::kUnspecified) {} - explicit SkSVGFeInputType(Type t) : fType(t) {} - explicit SkSVGFeInputType(const SkSVGStringType& id) - : fType(Type::kFilterPrimitiveReference), fId(id) {} - - bool operator==(const SkSVGFeInputType& other) const { - return fType == other.fType && fId == other.fId; - } - bool operator!=(const SkSVGFeInputType& other) const { return !(*this == other); } - - const SkString& id() const { - SkASSERT(fType == Type::kFilterPrimitiveReference); - return fId; - } - - Type type() const { return fType; } - -private: - Type fType; - SkString fId; -}; - -enum class SkSVGFeColorMatrixType { - kMatrix, - kSaturate, - kHueRotate, - kLuminanceToAlpha, -}; - -using SkSVGFeColorMatrixValues = SkTDArray; - -enum class SkSVGFeCompositeOperator { - kOver, - kIn, - kOut, - kAtop, - kXor, - kArithmetic, -}; - -class SkSVGFeTurbulenceBaseFrequency { -public: - SkSVGFeTurbulenceBaseFrequency() : fFreqX(0), fFreqY(0) {} - SkSVGFeTurbulenceBaseFrequency(SkSVGNumberType freqX, SkSVGNumberType freqY) - : fFreqX(freqX), fFreqY(freqY) {} - - SkSVGNumberType freqX() const { return fFreqX; } - SkSVGNumberType freqY() const { return fFreqY; } - -private: - SkSVGNumberType fFreqX; - SkSVGNumberType fFreqY; -}; - -struct SkSVGFeTurbulenceType { - enum Type { - kFractalNoise, - kTurbulence, - }; - - Type fType; - - SkSVGFeTurbulenceType() : fType(kTurbulence) {} - explicit SkSVGFeTurbulenceType(Type type) : fType(type) {} -}; - -enum class SkSVGXmlSpace { - kDefault, - kPreserve, -}; - -enum class SkSVGColorspace { - kAuto, - kSRGB, - kLinearRGB, -}; - -// https://www.w3.org/TR/SVG11/painting.html#DisplayProperty -enum class SkSVGDisplay { - kInline, - kNone, -}; - -#endif // SkSVGTypes_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGUse.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGUse.h deleted file mode 100644 index 93c2d2096403cb..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGUse.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2017 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGUse_DEFINED -#define SkSVGUse_DEFINED - -#include "modules/svg/include/SkSVGTransformableNode.h" -#include "modules/svg/include/SkSVGTypes.h" - -/** - * Implements support for (reference) elements. - * (https://www.w3.org/TR/SVG11/struct.html#UseElement) - */ -class SkSVGUse final : public SkSVGTransformableNode { -public: - static sk_sp Make() { return sk_sp(new SkSVGUse()); } - - void appendChild(sk_sp) override; - - SVG_ATTR(X , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Y , SkSVGLength, SkSVGLength(0)) - SVG_ATTR(Href, SkSVGIRI , SkSVGIRI()) - -protected: - bool onPrepareToRender(SkSVGRenderContext*) const override; - void onRender(const SkSVGRenderContext&) const override; - SkPath onAsPath(const SkSVGRenderContext&) const override; - SkRect onObjectBoundingBox(const SkSVGRenderContext&) const override; - -private: - SkSVGUse(); - - bool parseAndSetAttribute(const char*, const char*) override; - - using INHERITED = SkSVGTransformableNode; -}; - -#endif // SkSVGUse_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGValue.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGValue.h deleted file mode 100644 index eb1977feb356e3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/modules/svg/include/SkSVGValue.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkSVGValue_DEFINED -#define SkSVGValue_DEFINED - -#include "include/core/SkColor.h" -#include "include/core/SkMatrix.h" -#include "include/core/SkPath.h" -#include "include/core/SkTypes.h" -#include "include/private/SkNoncopyable.h" -#include "modules/svg/include/SkSVGTypes.h" - -class SkSVGValue : public SkNoncopyable { -public: - enum class Type { - kColor, - kFilter, - kLength, - kNumber, - kObjectBoundingBoxUnits, - kPreserveAspectRatio, - kStopColor, - kString, - kTransform, - kViewBox, - }; - - Type type() const { return fType; } - - template - const T* as() const { - return fType == T::TYPE ? static_cast(this) : nullptr; - } - -protected: - SkSVGValue(Type t) : fType(t) { } - -private: - Type fType; - - using INHERITED = SkNoncopyable; -}; - -template -class SkSVGWrapperValue final : public SkSVGValue { -public: - static constexpr Type TYPE = ValueType; - - explicit SkSVGWrapperValue(const T& v) - : INHERITED(ValueType) - , fWrappedValue(v) { } - - operator const T&() const { return fWrappedValue; } - const T* operator->() const { return &fWrappedValue; } - -private: - // Stack-only - void* operator new(size_t) = delete; - void* operator new(size_t, void*) = delete; - - const T& fWrappedValue; - - using INHERITED = SkSVGValue; -}; - -using SkSVGColorValue = SkSVGWrapperValue; -using SkSVGLengthValue = SkSVGWrapperValue; -using SkSVGTransformValue = SkSVGWrapperValue; -using SkSVGViewBoxValue = SkSVGWrapperValue; -using SkSVGNumberValue = SkSVGWrapperValue; -using SkSVGStringValue = SkSVGWrapperValue; -using SkSVGStopColorValue = SkSVGWrapperValue; - -using SkSVGPreserveAspectRatioValue = SkSVGWrapperValue; - -using SkSVGObjectBoundingBoxUnitsValue = SkSVGWrapperValue; - -#endif // SkSVGValue_DEFINED diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkLRUCache.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkLRUCache.h deleted file mode 100644 index 50429d500f25c5..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkLRUCache.h +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2016 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkLRUCache_DEFINED -#define SkLRUCache_DEFINED - -#include "include/private/SkChecksum.h" -#include "include/private/SkTHash.h" -#include "src/core/SkTInternalLList.h" - -/** - * A generic LRU cache. - */ -template -class SkLRUCache : public SkNoncopyable { -private: - struct Entry { - Entry(const K& key, V&& value) - : fKey(key) - , fValue(std::move(value)) {} - - K fKey; - V fValue; - - SK_DECLARE_INTERNAL_LLIST_INTERFACE(Entry); - }; - -public: - explicit SkLRUCache(int maxCount) - : fMaxCount(maxCount) {} - - ~SkLRUCache() { - Entry* node = fLRU.head(); - while (node) { - fLRU.remove(node); - delete node; - node = fLRU.head(); - } - } - - V* find(const K& key) { - Entry** value = fMap.find(key); - if (!value) { - return nullptr; - } - Entry* entry = *value; - if (entry != fLRU.head()) { - fLRU.remove(entry); - fLRU.addToHead(entry); - } // else it's already at head position, don't need to do anything - return &entry->fValue; - } - - V* insert(const K& key, V value) { - SkASSERT(!this->find(key)); - - Entry* entry = new Entry(key, std::move(value)); - fMap.set(entry); - fLRU.addToHead(entry); - while (fMap.count() > fMaxCount) { - this->remove(fLRU.tail()->fKey); - } - return &entry->fValue; - } - - V* insert_or_update(const K& key, V value) { - if (V* found = this->find(key)) { - *found = std::move(value); - return found; - } else { - return this->insert(key, std::move(value)); - } - } - - int count() { - return fMap.count(); - } - - template // f(K*, V*) - void foreach(Fn&& fn) { - typename SkTInternalLList::Iter iter; - for (Entry* e = iter.init(fLRU, SkTInternalLList::Iter::kHead_IterStart); e; - e = iter.next()) { - fn(&e->fKey, &e->fValue); - } - } - - void reset() { - fMap.reset(); - for (Entry* e = fLRU.head(); e; e = fLRU.head()) { - fLRU.remove(e); - delete e; - } - } - -private: - struct Traits { - static const K& GetKey(Entry* e) { - return e->fKey; - } - - static uint32_t Hash(const K& k) { - return HashK()(k); - } - }; - - void remove(const K& key) { - Entry** value = fMap.find(key); - SkASSERT(value); - Entry* entry = *value; - SkASSERT(key == entry->fKey); - fMap.remove(key); - fLRU.remove(entry); - delete entry; - } - - int fMaxCount; - SkTHashTable fMap; - SkTInternalLList fLRU; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkTInternalLList.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkTInternalLList.h deleted file mode 100644 index a5cb615556e564..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/skia/src/core/SkTInternalLList.h +++ /dev/null @@ -1,302 +0,0 @@ -/* - * Copyright 2012 Google Inc. - * - * Use of this source code is governed by a BSD-style license that can be - * found in the LICENSE file. - */ - -#ifndef SkTInternalLList_DEFINED -#define SkTInternalLList_DEFINED - -#include "include/core/SkTypes.h" - -/** - * This macro creates the member variables required by the SkTInternalLList class. It should be - * placed in the private section of any class that will be stored in a double linked list. - */ -#define SK_DECLARE_INTERNAL_LLIST_INTERFACE(ClassName) \ - friend class SkTInternalLList; \ - /* back pointer to the owning list - for debugging */ \ - SkDEBUGCODE(SkTInternalLList* fList = nullptr;) \ - ClassName* fPrev = nullptr; \ - ClassName* fNext = nullptr - -/** - * This class implements a templated internal doubly linked list data structure. - */ -template class SkTInternalLList { -public: - SkTInternalLList() {} - - void reset() { - fHead = nullptr; - fTail = nullptr; - } - - void remove(T* entry) { - SkASSERT(fHead && fTail); - SkASSERT(this->isInList(entry)); - - T* prev = entry->fPrev; - T* next = entry->fNext; - - if (prev) { - prev->fNext = next; - } else { - fHead = next; - } - if (next) { - next->fPrev = prev; - } else { - fTail = prev; - } - - entry->fPrev = nullptr; - entry->fNext = nullptr; - -#ifdef SK_DEBUG - entry->fList = nullptr; -#endif - } - - void addToHead(T* entry) { - SkASSERT(nullptr == entry->fPrev && nullptr == entry->fNext); - SkASSERT(nullptr == entry->fList); - - entry->fPrev = nullptr; - entry->fNext = fHead; - if (fHead) { - fHead->fPrev = entry; - } - fHead = entry; - if (nullptr == fTail) { - fTail = entry; - } - -#ifdef SK_DEBUG - entry->fList = this; -#endif - } - - void addToTail(T* entry) { - SkASSERT(nullptr == entry->fPrev && nullptr == entry->fNext); - SkASSERT(nullptr == entry->fList); - - entry->fPrev = fTail; - entry->fNext = nullptr; - if (fTail) { - fTail->fNext = entry; - } - fTail = entry; - if (nullptr == fHead) { - fHead = entry; - } - -#ifdef SK_DEBUG - entry->fList = this; -#endif - } - - /** - * Inserts a new list entry before an existing list entry. The new entry must not already be - * a member of this or any other list. If existingEntry is NULL then the new entry is added - * at the tail. - */ - void addBefore(T* newEntry, T* existingEntry) { - SkASSERT(newEntry); - - if (nullptr == existingEntry) { - this->addToTail(newEntry); - return; - } - - SkASSERT(this->isInList(existingEntry)); - newEntry->fNext = existingEntry; - T* prev = existingEntry->fPrev; - existingEntry->fPrev = newEntry; - newEntry->fPrev = prev; - if (nullptr == prev) { - SkASSERT(fHead == existingEntry); - fHead = newEntry; - } else { - prev->fNext = newEntry; - } -#ifdef SK_DEBUG - newEntry->fList = this; -#endif - } - - /** - * Inserts a new list entry after an existing list entry. The new entry must not already be - * a member of this or any other list. If existingEntry is NULL then the new entry is added - * at the head. - */ - void addAfter(T* newEntry, T* existingEntry) { - SkASSERT(newEntry); - - if (nullptr == existingEntry) { - this->addToHead(newEntry); - return; - } - - SkASSERT(this->isInList(existingEntry)); - newEntry->fPrev = existingEntry; - T* next = existingEntry->fNext; - existingEntry->fNext = newEntry; - newEntry->fNext = next; - if (nullptr == next) { - SkASSERT(fTail == existingEntry); - fTail = newEntry; - } else { - next->fPrev = newEntry; - } -#ifdef SK_DEBUG - newEntry->fList = this; -#endif - } - - void concat(SkTInternalLList&& list) { - if (list.isEmpty()) { - return; - } - - list.fHead->fPrev = fTail; - if (!fHead) { - SkASSERT(!list.fHead->fPrev); - fHead = list.fHead; - } else { - SkASSERT(fTail); - fTail->fNext = list.fHead; - } - fTail = list.fTail; - -#ifdef SK_DEBUG - for (T* node = list.fHead; node; node = node->fNext) { - SkASSERT(node->fList == &list); - node->fList = this; - } -#endif - - list.fHead = list.fTail = nullptr; - } - - bool isEmpty() const { - SkASSERT(SkToBool(fHead) == SkToBool(fTail)); - return !fHead; - } - - T* head() const { return fHead; } - T* tail() const { return fTail; } - - class Iter { - public: - enum IterStart { - kHead_IterStart, - kTail_IterStart - }; - - Iter() : fCurr(nullptr) {} - Iter(const Iter& iter) : fCurr(iter.fCurr) {} - Iter& operator= (const Iter& iter) { fCurr = iter.fCurr; return *this; } - - T* init(const SkTInternalLList& list, IterStart startLoc) { - if (kHead_IterStart == startLoc) { - fCurr = list.fHead; - } else { - SkASSERT(kTail_IterStart == startLoc); - fCurr = list.fTail; - } - - return fCurr; - } - - T* get() { return fCurr; } - - /** - * Return the next/previous element in the list or NULL if at the end. - */ - T* next() { - if (nullptr == fCurr) { - return nullptr; - } - - fCurr = fCurr->fNext; - return fCurr; - } - - T* prev() { - if (nullptr == fCurr) { - return nullptr; - } - - fCurr = fCurr->fPrev; - return fCurr; - } - - /** - * C++11 range-for interface. - */ - bool operator!=(const Iter& that) { return fCurr != that.fCurr; } - T* operator*() { return this->get(); } - void operator++() { this->next(); } - - private: - T* fCurr; - }; - - Iter begin() const { - Iter iter; - iter.init(*this, Iter::kHead_IterStart); - return iter; - } - - Iter end() const { return Iter(); } - -#ifdef SK_DEBUG - void validate() const { - SkASSERT(!fHead == !fTail); - Iter iter; - for (T* item = iter.init(*this, Iter::kHead_IterStart); item; item = iter.next()) { - SkASSERT(this->isInList(item)); - if (nullptr == item->fPrev) { - SkASSERT(fHead == item); - } else { - SkASSERT(item->fPrev->fNext == item); - } - if (nullptr == item->fNext) { - SkASSERT(fTail == item); - } else { - SkASSERT(item->fNext->fPrev == item); - } - } - } - - /** - * Debugging-only method that uses the list back pointer to check if 'entry' is indeed in 'this' - * list. - */ - bool isInList(const T* entry) const { - return entry->fList == this; - } - - /** - * Debugging-only method that laboriously counts the list entries. - */ - int countEntries() const { - int count = 0; - for (T* entry = fHead; entry; entry = entry->fNext) { - ++count; - } - return count; - } -#endif // SK_DEBUG - -private: - T* fHead = nullptr; - T* fTail = nullptr; - - SkTInternalLList(const SkTInternalLList&) = delete; - SkTInternalLList& operator=(const SkTInternalLList&) = delete; -}; - -#endif diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkLog.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkLog.h deleted file mode 100644 index b1d78dfea51609..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkLog.h +++ /dev/null @@ -1,80 +0,0 @@ -// -// Created by Christian Falch on 26/08/2021. -// - -#pragma once - -#include -#include - -#ifdef ANDROID -#include -#endif - -#ifdef TARGET_OS_IPHONE -#include -#endif - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -class ABI46_0_0RNSkLogger { -public: - /** - * Logs message to console - * @param message Message to be written out - */ - static void logToConsole(std::string message) { -#ifdef ANDROID - __android_log_write(ANDROID_LOG_INFO, "ABI46_0_0RNSkia", message.c_str()); -#endif - -#ifdef TARGET_OS_IPHONE - syslog(LOG_ERR, "%s\n", message.c_str()); -#endif - } - - /** - * Logs to console - * @param fmt Format string - * @param ... Arguments to format string - */ - static void logToConsole(const char *fmt, ...) { - va_list args; - va_start(args, fmt); - - static char buffer[512]; - vsnprintf(buffer, 512, fmt, args); -#ifdef ANDROID - __android_log_write(ANDROID_LOG_INFO, "ABI46_0_0RNSkia", buffer); -#endif -#ifdef TARGET_OS_IPHONE - syslog(LOG_ERR, "%s\n", buffer); -#endif - va_end(args); - } - - static void logToJavascriptConsole(jsi::Runtime& runtime, const std::string& message) { - auto console = ABI46_0_0RNSkLogger::getJavascriptConsole(runtime).asObject(runtime); - auto log = console.getPropertyAsFunction(runtime, "log"); - log.call(runtime, jsi::String::createFromUtf8(runtime, message)); - } - - static void warnToJavascriptConsole(jsi::Runtime& runtime, const std::string& message) { - auto console = ABI46_0_0RNSkLogger::getJavascriptConsole(runtime).asObject(runtime); - auto warn = console.getPropertyAsFunction(runtime, "warn"); - warn.call(runtime, jsi::String::createFromUtf8(runtime, message)); - } - -private: - static jsi::Value getJavascriptConsole(jsi::Runtime& runtime) { - auto console = runtime.global().getProperty(runtime, "console"); - if(console.isUndefined() || console.isNull()) { - jsi::detail::throwJSError(runtime, "Could not find console object."); - return jsi::Value::undefined(); - } - return console; - } -}; -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkMeasureTime.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkMeasureTime.h deleted file mode 100644 index c9a2986c9a6354..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkMeasureTime.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created by Christian Falch on 24/08/2021. -// - -#pragma once - -#include -#include - -#include - -namespace ABI46_0_0RNSkia { - -using namespace std::chrono; - -class ABI46_0_0RNSkMeasureTime { -public: - ABI46_0_0RNSkMeasureTime(const std::string &name) - : _name(name), _start(high_resolution_clock::now()){} - - ~ABI46_0_0RNSkMeasureTime() { - auto stop = high_resolution_clock::now(); - auto duration = duration_cast(stop - _start).count(); - ABI46_0_0RNSkLogger::logToConsole("%s: %lld ms\n", _name.c_str(), duration); - } - -private: - std::string _name; - time_point _start; -}; - -}; // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkTimingInfo.h b/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkTimingInfo.h deleted file mode 100644 index 8a0b9b56651ad4..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/cpp/utils/ABI46_0_0RNSkTimingInfo.h +++ /dev/null @@ -1,103 +0,0 @@ -#pragma once - -#include -#include - -#define NUMBER_OF_DURATION_SAMPLES 10 - -namespace ABI46_0_0RNSkia { - -using namespace std::chrono; -using frame = duration>; -using ms = duration; - -class ABI46_0_0RNSkTimingInfo { -public: - ABI46_0_0RNSkTimingInfo(const std::string &name): _name(std::move(name)) { - reset(); - } - - ~ABI46_0_0RNSkTimingInfo() {} - - void reset() { - _lastDurationIndex = 0; - _lastDurationsCount = 0; - _lastDuration = 0; - _prevFpsTimer = -1; - _frameCount = 0; - _lastFrameCount = -1; - _didSkip = false; - } - - void beginTiming() { - _start = high_resolution_clock::now(); - } - - void stopTiming() { - time_point stop = high_resolution_clock::now(); - addLastDuration(duration_cast(stop - _start).count()); - tick(stop); - if(_didSkip) { - _didSkip = false; - ABI46_0_0RNSkLogger::logToConsole("%s: Skipped frame. Previous frame time: %lldms", _name.c_str(), _lastDuration); - } - } - - void markSkipped() { - _didSkip = true; - } - - long getAverage() { return static_cast(_average); } - long getFps() { return _lastFrameCount; } - - void addLastDuration(long duration) { - _lastDuration = duration; - - // Average duration - _lastDurations[_lastDurationIndex++] = _lastDuration; - - if (_lastDurationIndex == NUMBER_OF_DURATION_SAMPLES) { - _lastDurationIndex = 0; - } - - if (_lastDurationsCount < NUMBER_OF_DURATION_SAMPLES) { - _lastDurationsCount++; - } - - _average = 0; - for (size_t i = 0; i < _lastDurationsCount; i++) { - _average = _average + _lastDurations[i]; - } - _average = _average / _lastDurationsCount; - } - -private: - - void tick(time_point now) { - auto ms = duration_cast(now.time_since_epoch()).count(); - - if(_prevFpsTimer == -1) { - _prevFpsTimer = ms; - } else if(ms - _prevFpsTimer >= 1000) { - _lastFrameCount = _frameCount; - _prevFpsTimer = ms; - _frameCount = 0; - } - _frameCount++; - } - - double _lastTimeStamp; - long _lastDurations[NUMBER_OF_DURATION_SAMPLES]; - int _lastDurationIndex; - int _lastDurationsCount; - long _lastDuration; - std::atomic _average; - time_point _start; - long _prevFpsTimer; - double _frameCount; - double _lastFrameCount; - double _didSkip; - std::string _name; -}; - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.h deleted file mode 100644 index 125ea45390a3e3..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#import - -#include "ABI46_0_0SkiaManager.h" - -@interface ABI46_0_0RNSkiaModule : NSObject - -- (ABI46_0_0SkiaManager *)manager; - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.mm deleted file mode 100644 index fc67f99abd5444..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/ABI46_0_0RNSkiaModule.mm +++ /dev/null @@ -1,42 +0,0 @@ - -#import "ABI46_0_0RNSkiaModule.h" -#import - -@implementation ABI46_0_0RNSkiaModule { - ABI46_0_0SkiaManager* skiaManager; -} - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNSkia) - -#pragma Accessors - --(ABI46_0_0SkiaManager*) manager { - return skiaManager; -} - -#pragma Setup and invalidation - -+ (BOOL)requiresMainQueueSetup { - return YES; -} - -- (void)invalidate -{ - if (skiaManager != nil) { - [skiaManager invalidate]; - } - skiaManager = nil; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) -{ - if (skiaManager != nil) { - // Already initialized, ignore call. - return @true; - } - ABI46_0_0RCTBridge* bridge = [ABI46_0_0RCTBridge currentBridge]; - skiaManager = [[ABI46_0_0SkiaManager alloc] initWithBridge:bridge]; - return @true; -} - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.h deleted file mode 100644 index 34b336e55a1893..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#import -#import - -typedef void (^block_t)(double); -@interface ABI46_0_0DisplayLink : NSObject { - CADisplayLink *_displayLink; -} - -@property(nonatomic, copy) block_t updateBlock; - -- (void)start:(block_t)block; - -- (void)stop; - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.mm deleted file mode 100644 index 8625d1905199e7..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0DisplayLink.mm +++ /dev/null @@ -1,36 +0,0 @@ -#import "ABI46_0_0DisplayLink.h" - -@implementation ABI46_0_0DisplayLink - -- (void)start:(block_t)block -{ - self.updateBlock = block; - // check whether the loop is already running - if(_displayLink == nil) - { - // specify update method - _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(update:)]; - - // add the display link to the main run loop - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; - } -} - -- (void)stop -{ - // check whether the loop is already stopped - if (_displayLink != nil) { - // if the display link is present, it gets invalidated (loop stops) - - [_displayLink invalidate]; - _displayLink = nil; - } -} - -- (void)update:(CADisplayLink *)sender -{ - double time = [sender timestamp]; - _updateBlock(time); -} - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.h deleted file mode 100644 index a7e522b9ac8b1f..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.h +++ /dev/null @@ -1,76 +0,0 @@ -#pragma once - -#import - -#include -#include -#include - -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#include - -#pragma clang diagnostic pop - -#include - -namespace ABI46_0_0facebook { - namespace ABI46_0_0React { - class CallInvoker; - } -} - -namespace ABI46_0_0RNSkia { - -using namespace ABI46_0_0facebook; - -static void handleNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, const void *object, CFDictionaryRef userInfo); - -class ABI46_0_0PlatformContext : public ABI46_0_0RNSkPlatformContext { -public: - ABI46_0_0PlatformContext(jsi::Runtime *runtime, - std::shared_ptr callInvoker) - : ABI46_0_0RNSkPlatformContext(runtime, callInvoker, [[UIScreen mainScreen] scale]) { - // We need to make sure we invalidate when modules are freed - CFNotificationCenterAddObserver( - CFNotificationCenterGetLocalCenter(), - this, - &handleNotification, - (__bridge CFStringRef)ABI46_0_0RCTBridgeWillInvalidateModulesNotification, - NULL, - CFNotificationSuspensionBehaviorDeliverImmediately - ); - } - - ~ABI46_0_0PlatformContext() { - CFNotificationCenterRemoveEveryObserver(CFNotificationCenterGetLocalCenter(), this); - } - - void startDrawLoop() override; - void stopDrawLoop() override; - - virtual void performStreamOperation( - const std::string &sourceUri, - const std::function)> &op) override; - - void raiseError(const std::exception &err) override; - - void willInvalidateModules() { - // We need to do some house-cleaning here! - invalidate(); - } - -private: - ABI46_0_0DisplayLink *_displayLink; -}; - -static void handleNotification(CFNotificationCenterRef center, void *observer, CFStringRef name, - const void *object, CFDictionaryRef userInfo) { - (static_cast(observer))->willInvalidateModules(); -} - -} // namespace ABI46_0_0RNSkia diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.mm deleted file mode 100644 index d64dc15991d257..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0PlatformContext.mm +++ /dev/null @@ -1,52 +0,0 @@ -#include "ABI46_0_0PlatformContext.h" - -#import -#include -#include - -#include - -namespace ABI46_0_0RNSkia { - - void ABI46_0_0PlatformContext::performStreamOperation(const std::string &sourceUri, - const std::function)> &op) { - - ABI46_0_0RNSkMeasureTime("ABI46_0_0PlatformContext::performStreamOperation"); - auto loader = [=]() { - - NSURL* url = [[NSURL alloc] initWithString:[NSString stringWithUTF8String: sourceUri.c_str()]]; - NSData* data = [NSData dataWithContentsOfURL:url]; - - auto bytes = [data bytes]; - auto skData = SkData::MakeWithCopy(bytes, [data length]); - auto stream = SkMemoryStream::Make(skData); - - op(std::move(stream)); - }; - - // Fire and forget the thread - will be resolved on completion - std::thread(loader).detach(); - } - -void ABI46_0_0PlatformContext::raiseError(const std::exception &err) { - ABI46_0_0RCTFatal(ABI46_0_0RCTErrorWithMessage([NSString stringWithUTF8String:err.what()])); -} - -void ABI46_0_0PlatformContext::startDrawLoop() { - if(_displayLink == nullptr) { - _displayLink = [[ABI46_0_0DisplayLink alloc] init]; - [_displayLink start:^(double time) { - notifyDrawLoop(false); - }]; - } -} - -void ABI46_0_0PlatformContext::stopDrawLoop() { - if(_displayLink != nullptr) { - [_displayLink stop]; - _displayLink = nullptr; - } -} - -} - diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.h deleted file mode 100644 index b81a5dffd82055..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.h +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#import "ABI46_0_0PlatformContext.h" -#import "ABI46_0_0RNSKDrawView.h" -#import -#import - -#import -#import -#import - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#import -#import -#import - -#pragma clang diagnostic pop - -class ABI46_0_0RNSkDrawViewImpl : public ABI46_0_0RNSkia::ABI46_0_0RNSkDrawView { -public: - ABI46_0_0RNSkDrawViewImpl(std::shared_ptr context); - ~ABI46_0_0RNSkDrawViewImpl(); - - CALayer* getLayer() { return _layer; } - - void setSize(int width, int height); - -protected: - float getScaledWidth() override { return _width * _context->getPixelDensity(); }; - float getScaledHeight() override { return _height * _context->getPixelDensity(); }; - -private: - void drawPicture(const sk_sp picture) override; - bool createSkiaSurface(); - - int _nativeId; - float _width = -1; - float _height = -1; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - CAMetalLayer *_layer; -#pragma clang diagnostic pop - - static id _commandQueue; - static id _device; - static sk_sp _skContext; - - std::shared_ptr _context; -}; diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.mm deleted file mode 100644 index b57945e247526b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0RNSkDrawViewImpl.mm +++ /dev/null @@ -1,112 +0,0 @@ -#import - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdocumentation" - -#import -#import -#import - -#pragma clang diagnostic pop - -#import -#import - -// These static class members are used by all Skia Views -id ABI46_0_0RNSkDrawViewImpl::_device = MTLCreateSystemDefaultDevice(); -id ABI46_0_0RNSkDrawViewImpl::_commandQueue = id(CFRetain((GrMTLHandle)[_device newCommandQueue])); - -sk_sp ABI46_0_0RNSkDrawViewImpl::_skContext = nullptr; - -ABI46_0_0RNSkDrawViewImpl::ABI46_0_0RNSkDrawViewImpl(std::shared_ptr context): - _context(context), ABI46_0_0RNSkia::ABI46_0_0RNSkDrawView(context) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" - _layer = [CAMetalLayer layer]; -#pragma clang diagnostic pop - - _layer.framebufferOnly = NO; - _layer.device = _device; - _layer.opaque = false; - _layer.contentsScale = _context->getPixelDensity(); - _layer.pixelFormat = MTLPixelFormatBGRA8Unorm; -} - -ABI46_0_0RNSkDrawViewImpl::~ABI46_0_0RNSkDrawViewImpl() { - if([[NSThread currentThread] isMainThread]) { - _layer = NULL; - } else { - __block auto tempLayer = _layer; - dispatch_async(dispatch_get_main_queue(), ^{ - // By using the tempLayer variable in the block we capture it and it will be - // released after the block has finished. This way the CAMetalLayer dealloc will - // only be called on the main thread. Problem: this destructor might be called from - // releasing the ABI46_0_0RNSkDrawViewImpl from a thread capture (after dtor has started), - // which would cause the CAMetalLayer dealloc to be called on another thread which - // causes a crash. - // https://github.com/Shopify/react-native-skia/issues/398 - tempLayer = tempLayer; - }); - } -} - -void ABI46_0_0RNSkDrawViewImpl::setSize(int width, int height) { - _width = width; - _height = height; - _layer.frame = CGRectMake(0, 0, width, height); - _layer.drawableSize = CGSizeMake(width * _context->getPixelDensity(), - height* _context->getPixelDensity()); - - requestRedraw(); -} - -void ABI46_0_0RNSkDrawViewImpl::drawPicture(const sk_sp picture) { - if(_width == -1 && _height == -1) { - return; - } - - if(_skContext == nullptr) { - GrContextOptions grContextOptions; - _skContext = GrDirectContext::MakeMetal((__bridge void*)_device, - (__bridge void*)_commandQueue, - grContextOptions); - } - - // Wrap in auto release pool since we want the system to clean up after rendering - // and not wait until later - we've seen some example of memory usage growing very - // fast in the simulator without this. - @autoreleasepool - { - id currentDrawable = [_layer nextDrawable]; - if(currentDrawable == nullptr) { - return; - } - - GrMtlTextureInfo fbInfo; - fbInfo.fTexture.retain((__bridge void*)currentDrawable.texture); - - GrBackendRenderTarget backendRT(_layer.drawableSize.width, - _layer.drawableSize.height, - 1, - fbInfo); - - auto skSurface = SkSurface::MakeFromBackendRenderTarget(_skContext.get(), - backendRT, - kTopLeft_GrSurfaceOrigin, - kBGRA_8888_SkColorType, - nullptr, - nullptr); - - if(skSurface == nullptr || skSurface->getCanvas() == nullptr) { - ABI46_0_0RNSkia::ABI46_0_0RNSkLogger::logToConsole("Skia surface could not be created from parameters."); - return; - } - - skSurface->getCanvas()->clear(SK_AlphaTRANSPARENT); - skSurface->getCanvas()->drawPicture(picture); - - id commandBuffer([_commandQueue commandBuffer]); - [commandBuffer presentDrawable:currentDrawable]; - [commandBuffer commit]; - } -} diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.h deleted file mode 100644 index b8dac2a91a720b..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.h +++ /dev/null @@ -1,23 +0,0 @@ -#pragma once - -#import -#import - -#import -#import - -#import - -class ABI46_0_0RNSkDrawViewImpl; - -@interface ABI46_0_0SkiaDrawView : UIView - -- (instancetype)initWithManager: (ABI46_0_0RNSkia::ABI46_0_0RNSkManager*)manager; - -- (std::shared_ptr) impl; - -- (void) setDrawingMode:(std::string) mode; -- (void) setDebugMode:(bool) debugMode; -- (void) setNativeId:(size_t) nativeId; - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.mm deleted file mode 100644 index ca01ac23de53da..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawView.mm +++ /dev/null @@ -1,169 +0,0 @@ -#import - -#import - -#include -#include - -#import -#import - -@implementation ABI46_0_0SkiaDrawView { - std::shared_ptr _impl; - ABI46_0_0RNSkia::ABI46_0_0RNSkManager* _manager; - ABI46_0_0RNSkia::ABI46_0_0RNSkDrawingMode _drawingMode; - bool _debugMode; - size_t _nativeId; -} - -#pragma mark Initialization and destruction - -- (instancetype) initWithManager: (ABI46_0_0RNSkia::ABI46_0_0RNSkManager*)manager; -{ - self = [super init]; - if (self) { - _manager = manager; - _nativeId = 0; - _debugMode = false; - _drawingMode = ABI46_0_0RNSkia::ABI46_0_0RNSkDrawingMode::Default; - - // Listen to notifications about module invalidation - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(willInvalidateModules) - name:ABI46_0_0RCTBridgeWillInvalidateModulesNotification - object:nil]; - } - return self; -} - -- (void) willInvalidateModules { - _impl = nullptr; - _manager = nullptr; -} - -#pragma mark Lifecycle - -- (void) willMoveToSuperview:(UIView *)newWindow { - if (newWindow == NULL) { - // Remove implementation view when the parent view is not set - if(_impl != nullptr) { - [_impl->getLayer() removeFromSuperlayer]; - - if(_nativeId != 0 && _manager != nullptr) { - _manager->setSkiaDrawView(_nativeId, nullptr); - } - - _impl = nullptr; - } - } else { - // Create implementation view when the parent view is set - if(_impl == nullptr && _manager != nullptr) { - _impl = std::make_shared(_manager->getPlatformContext()); - [self.layer addSublayer: _impl->getLayer()]; - if(_nativeId != 0) { - _manager->setSkiaDrawView(_nativeId, _impl); - } - _impl->setDrawingMode(_drawingMode); - _impl->setShowDebugOverlays(_debugMode); - } - } -} - -- (void) dealloc { - if(_manager != nullptr && _nativeId != 0) { - _manager->unregisterSkiaDrawView(_nativeId); - } -} - -#pragma mark Layout - -- (void) layoutSubviews { - [super layoutSubviews]; - if(_impl != nullptr) { - _impl->setSize(self.bounds.size.width, self.bounds.size.height); - } -} - -#pragma mark Properties - --(void) setDrawingMode:(std::string) mode { - _drawingMode = mode.compare("continuous") == 0 ? ABI46_0_0RNSkia::ABI46_0_0RNSkDrawingMode::Continuous : ABI46_0_0RNSkia::ABI46_0_0RNSkDrawingMode::Default; - - if(_impl != nullptr) { - _impl->setDrawingMode(_drawingMode); - } -} - --(void) setDebugMode:(bool) debugMode { - _debugMode = debugMode; - if(_impl != nullptr) { - _impl->setShowDebugOverlays(debugMode); - } -} - -- (void) setNativeId:(size_t) nativeId { - _nativeId = nativeId; - - if(_impl != nullptr) { - _manager->registerSkiaDrawView(nativeId, _impl); - } -} - -#pragma mark External API - -- (std::shared_ptr) impl { - return _impl; -} - -#pragma mark Touch handling - -- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event { - [self handleTouches:touches withEvent:event]; -} - --(void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { - [self handleTouches:touches withEvent:event]; -} - --(void) touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { - [self handleTouches:touches withEvent:event]; -} - -- (void) handleTouches:(NSSet*) touches withEvent:(UIEvent*) event { - if (event.type == UIEventTypeTouches) { - std::vector nextTouches; - for (UITouch *touch in touches) { - auto position = [touch preciseLocationInView:self]; - ABI46_0_0RNSkia::ABI46_0_0RNSkTouchPoint nextTouch; - nextTouch.x = position.x; - nextTouch.y = position.y; - nextTouch.force = [touch force]; - nextTouch.id = [touch hash]; - auto phase = [touch phase]; - switch(phase) { - case UITouchPhaseBegan: - nextTouch.type = ABI46_0_0RNSkia::ABI46_0_0RNSkTouchType::Start; - break; - case UITouchPhaseMoved: - nextTouch.type = ABI46_0_0RNSkia::ABI46_0_0RNSkTouchType::Active; - break; - case UITouchPhaseEnded: - nextTouch.type = ABI46_0_0RNSkia::ABI46_0_0RNSkTouchType::End; - break; - case UITouchPhaseCancelled: - nextTouch.type = ABI46_0_0RNSkia::ABI46_0_0RNSkTouchType::Cancelled; - break; - default: - nextTouch.type = ABI46_0_0RNSkia::ABI46_0_0RNSkTouchType::Active; - break; - } - - nextTouches.push_back(nextTouch); - } - if(_impl != nullptr) { - _impl->updateTouchState(std::move(nextTouches)); - } - } -} - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.h deleted file mode 100644 index 0ac98cf111fc56..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.h +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -#import - -@interface ABI46_0_0SkiaDrawViewManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.mm deleted file mode 100644 index 50424ec554037e..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaDrawViewManager.mm +++ /dev/null @@ -1,42 +0,0 @@ -#include -#include - -#include -#include -#include -#include - -@implementation ABI46_0_0SkiaDrawViewManager - -- (ABI46_0_0SkiaManager*) skiaManager { - auto bridge = [ABI46_0_0RCTBridge currentBridge]; - auto skiaModule = (ABI46_0_0RNSkiaModule*)[bridge moduleForName:@"RNSkia"]; - return [skiaModule manager]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(nativeID, NSNumber, ABI46_0_0SkiaDrawView) { - // Get parameter - int nativeId = [[ABI46_0_0RCTConvert NSString:json] intValue]; - [(ABI46_0_0SkiaDrawView*)view setNativeId:nativeId]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(mode, NSString, ABI46_0_0SkiaDrawView) { - std::string mode = json != NULL ? [[ABI46_0_0RCTConvert NSString:json] UTF8String] : "default"; - [(ABI46_0_0SkiaDrawView*)view setDrawingMode: mode]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(debug, BOOL, ABI46_0_0SkiaDrawView) { - bool debug = json != NULL ? [ABI46_0_0RCTConvert BOOL:json] : false; - [(ABI46_0_0SkiaDrawView*)view setDebugMode: debug]; -} - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0ReactNativeSkiaView) - -- (UIView *)view -{ - auto skManager = [[self skiaManager] skManager]; - // Pass SkManager as a raw pointer to avoid circular dependenciesr - return [[ABI46_0_0SkiaDrawView alloc] initWithManager:skManager.get()]; -} - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.h b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.h deleted file mode 100644 index 35f0d483362d81..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.h +++ /dev/null @@ -1,17 +0,0 @@ -#pragma once - -#import - -#import - -@interface ABI46_0_0SkiaManager : NSObject - -- (std::shared_ptr)skManager; - -- (instancetype)init NS_UNAVAILABLE; - -- (void)invalidate; - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge; - -@end diff --git a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.mm b/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.mm deleted file mode 100644 index 84812fc5297ea6..00000000000000 --- a/ios/vendored/sdk46/@shopify/react-native-skia/ios/RNSkia-iOS/ABI46_0_0SkiaManager.mm +++ /dev/null @@ -1,50 +0,0 @@ -#import - -#import - -#import -#import - -#import - -#import "ABI46_0_0PlatformContext.h" - -@implementation ABI46_0_0SkiaManager { - std::shared_ptr _skManager; - std::shared_ptr _platformContext; - __weak ABI46_0_0RCTBridge* weakBridge; -} - -- (std::shared_ptr) skManager { - return _skManager; -} - -- (void) invalidate { - if(_skManager != nullptr) { - _skManager->invalidate(); - } - _skManager = nullptr; - _platformContext = nullptr; -} - -- (instancetype) initWithBridge:(ABI46_0_0RCTBridge*)bridge { - self = [super init]; - if (self) { - ABI46_0_0RCTCxxBridge *cxxBridge = (ABI46_0_0RCTCxxBridge *)bridge; - if (cxxBridge.runtime) { - - auto callInvoker = bridge.jsCallInvoker; - ABI46_0_0facebook::jsi::Runtime* jsRuntime = (ABI46_0_0facebook::jsi::Runtime*)cxxBridge.runtime; - - // Create platform context - _platformContext = std::make_shared(jsRuntime, callInvoker); - - // Create the ABI46_0_0RNSkiaManager (cross platform) - _skManager = std::make_shared(jsRuntime, callInvoker, _platformContext); - - } - } - return self; -} - -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ABI46_0_0stripe-react-native.podspec.json b/ios/vendored/sdk46/@stripe/stripe-react-native/ABI46_0_0stripe-react-native.podspec.json deleted file mode 100644 index 7e781977fed932..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ABI46_0_0stripe-react-native.podspec.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "name": "ABI46_0_0stripe-react-native", - "version": "0.13.1", - "summary": "Stripe SDK for ABI46_0_0React Native", - "homepage": "https://github.com/stripe/stripe-react-native/#readme", - "license": "MIT", - "authors": "Stripe", - "platforms": { - "ios": "12.0" - }, - "source": { - "git": "https://github.com/stripe/stripe-react-native.git", - "tag": "0.13.1" - }, - "source_files": "ios/**/*.{h,m,mm,swift}", - "dependencies": { - "ABI46_0_0React-Core": [], - "Stripe": [ - "~> 23.3.0" - ], - "StripePaymentSheet": [ - "~> 23.3.0" - ], - "StripePayments": [ - "~> 23.3.0" - ], - "StripePaymentsUI": [ - "~> 23.3.0" - ], - "StripeApplePay": [ - "~> 23.3.0" - ], - "StripeFinancialConnections": [ - "~> 23.3.0" - ] - }, - "pod_target_xcconfig": { - "HEADER_SEARCH_PATHS": "\"${PODS_ROOT}/Stripe/Stripe3DS2\" \"${PODS_ROOT}/Headers/Public/Stripe\"" - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.m deleted file mode 100644 index 7564e7bb7d330f..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.m +++ /dev/null @@ -1,10 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(ApplePayButtonManager, ABI46_0_0ApplePayButtonManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPressAction, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(type, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(buttonStyle, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(borderRadius, NSNumber) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.swift deleted file mode 100644 index ea809f7377107a..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonManager.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -@objc(ABI46_0_0ApplePayButtonManager) -class ApplePayButtonManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return ApplePayButtonView(frame: CGRect.init()) - } - - override class func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonView.swift deleted file mode 100644 index 4f160e57f3bc52..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/ApplePayButtonView.swift +++ /dev/null @@ -1,49 +0,0 @@ -import Foundation -import UIKit - -@objc(ABI46_0_0ApplePayButtonView) -class ApplePayButtonView: UIView { - var applePayButton: PKPaymentButton? - - @objc var onPressAction: ABI46_0_0RCTDirectEventBlock? - @objc var type: NSNumber? - @objc var buttonStyle: NSNumber? - @objc var borderRadius: NSNumber? - - @objc func handleApplePayButtonTapped() { - if onPressAction != nil { - onPressAction!(["true": true]) - } - } - - override func didSetProps(_ changedProps: [String]!) { - if let applePayButton = self.applePayButton { - applePayButton.removeFromSuperview() - } - let paymentButtonType = PKPaymentButtonType(rawValue: self.type as? Int ?? 0) ?? .plain - let paymentButtonStyle = PKPaymentButtonStyle(rawValue: self.buttonStyle as? Int ?? 2) ?? .black - self.applePayButton = PKPaymentButton(paymentButtonType: paymentButtonType, paymentButtonStyle: paymentButtonStyle) - if #available(iOS 12.0, *) { - self.applePayButton?.cornerRadius = self.borderRadius as? CGFloat ?? 4.0 - } - - if let applePayButton = self.applePayButton { - applePayButton.addTarget(self, action: #selector(handleApplePayButtonTapped), for: .touchUpInside) - self.addSubview(applePayButton) - } - } - - override init(frame: CGRect) { - super.init(frame: frame) - } - - override func layoutSubviews() { - if let applePayButton = self.applePayButton { - applePayButton.frame = self.bounds - } - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.m deleted file mode 100644 index 8810d8bba34740..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.m +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(AuBECSDebitFormManager, ABI46_0_0AuBECSDebitFormManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCompleteAction, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(companyName, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(formStyle, NSDictionary) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.swift deleted file mode 100644 index ab59624b2ae8a0..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormManager.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -@objc(ABI46_0_0AuBECSDebitFormManager) -class AuBECSDebitFormManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return AuBECSDebitFormView(frame: CGRect.init()) - } - - override class func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormView.swift deleted file mode 100644 index cecdde98567ec7..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/AuBECSDebitFormView.swift +++ /dev/null @@ -1,85 +0,0 @@ -import Foundation -import UIKit -import Stripe - -@objc(ABI46_0_0AuBECSDebitFormView) -class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate { - - var auBecsFormView: STPAUBECSDebitFormView? - @objc var onCompleteAction: ABI46_0_0RCTDirectEventBlock? - @objc var companyName: NSString? - - override func didSetProps(_ changedProps: [String]!) { - if let auBecsFormView = self.auBecsFormView { - auBecsFormView.removeFromSuperview() - } - - - self.auBecsFormView = STPAUBECSDebitFormView(companyName: (companyName ?? "") as String) - self.auBecsFormView?.becsDebitFormDelegate = self - - - if let auBecsFormView = self.auBecsFormView { - self.addSubview(auBecsFormView) - setStyles() - } - } - - @objc var formStyle: NSDictionary = NSDictionary() { - didSet { - setStyles() - } - } - - private func setStyles() { - auBecsFormView?.formFont = UIFont.systemFont(ofSize: CGFloat(30)) - - if let textColor = formStyle["textColor"] as? String { - auBecsFormView?.formTextColor = UIColor(hexString: textColor) - } - if let fontSize = formStyle["fontSize"] as? Int { - auBecsFormView?.formFont = UIFont.systemFont(ofSize: CGFloat(fontSize)) - } - if let backgroundColor = formStyle["backgroundColor"] as? String { - auBecsFormView?.formBackgroundColor = UIColor(hexString: backgroundColor) - } - if let placeholderColor = formStyle["placeholderColor"] as? String { - auBecsFormView?.formPlaceholderColor = UIColor(hexString: placeholderColor) - } - if let textErrorColor = formStyle["textErrorColor"] as? String { - auBecsFormView?.formTextErrorColor = UIColor(hexString: textErrorColor) - } - if let borderColor = formStyle["borderColor"] as? String { - auBecsFormView?.layer.borderColor = UIColor(hexString: borderColor).cgColor - } - if let borderRadius = formStyle["borderRadius"] as? CGFloat { - auBecsFormView?.layer.cornerRadius = borderRadius - } - if let borderWidth = formStyle["borderWidth"] as? CGFloat { - auBecsFormView?.layer.borderWidth = borderWidth - } - } - - func auBECSDebitForm(_ form: STPAUBECSDebitFormView, didChangeToStateComplete complete: Bool) { - onCompleteAction!([ - "accountNumber": form.paymentMethodParams?.auBECSDebit?.accountNumber ?? "", - "bsbNumber": form.paymentMethodParams?.auBECSDebit?.bsbNumber ?? "", - "name": form.paymentMethodParams?.billingDetails?.name ?? "", - "email": form.paymentMethodParams?.billingDetails?.email ?? "" - ]) - } - - override init(frame: CGRect) { - super.init(frame: frame) - } - - override func layoutSubviews() { - if let auBecsFormView = self.auBecsFormView { - auBecsFormView.frame = self.bounds - } - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.m deleted file mode 100644 index e0c44f62cd69fc..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.m +++ /dev/null @@ -1,17 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(CardFieldManager, ABI46_0_0CardFieldManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(postalCodeEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(countryCode, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCardChange, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onFocusChange, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cardStyle, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(placeholders, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(autofocus, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(dangerouslyGetFullCardDetails, BOOL) -ABI46_0_0RCT_EXTERN_METHOD(focus:(nonnull NSNumber*) ABI46_0_0ReactTag) -ABI46_0_0RCT_EXTERN_METHOD(blur:(nonnull NSNumber*) ABI46_0_0ReactTag) -ABI46_0_0RCT_EXTERN_METHOD(clear:(nonnull NSNumber*) ABI46_0_0ReactTag) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.swift deleted file mode 100644 index 82624bd5ab57d1..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldManager.swift +++ /dev/null @@ -1,36 +0,0 @@ -import Foundation - -@objc(ABI46_0_0CardFieldManager) -class CardFieldManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - let cardField = CardFieldView() - let stripeSdk = bridge.module(forName: "StripeSdk") as? StripeSdk - stripeSdk?.cardFieldView = cardField; - return cardField - } - - @objc func focus(_ abi46_0_0ReactTag: NSNumber) { - self.bridge!.uiManager.addUIBlock { (_: ABI46_0_0RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in - let view: CardFieldView = (viewRegistry![abi46_0_0ReactTag] as? CardFieldView)! - view.focus() - } - } - - @objc func blur(_ abi46_0_0ReactTag: NSNumber) { - self.bridge!.uiManager.addUIBlock { (_: ABI46_0_0RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in - let view: CardFieldView = (viewRegistry![abi46_0_0ReactTag] as? CardFieldView)! - view.blur() - } - } - - @objc func clear(_ abi46_0_0ReactTag: NSNumber) { - self.bridge!.uiManager.addUIBlock { (_: ABI46_0_0RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in - let view: CardFieldView = (viewRegistry![abi46_0_0ReactTag] as? CardFieldView)! - view.clear() - } - } - - override class func requiresMainQueueSetup() -> Bool { - return false - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldView.swift deleted file mode 100644 index 3c61be24a6ea92..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFieldView.swift +++ /dev/null @@ -1,191 +0,0 @@ -import Foundation -import UIKit -import Stripe - -class CardFieldView: UIView, STPPaymentCardTextFieldDelegate { - @objc var onCardChange: ABI46_0_0RCTDirectEventBlock? - @objc var onFocusChange: ABI46_0_0RCTDirectEventBlock? - @objc var dangerouslyGetFullCardDetails: Bool = false - - private var cardField = STPPaymentCardTextField() - - public var cardParams: STPPaymentMethodCardParams? = nil - public var cardPostalCode: String? = nil - - @objc var postalCodeEnabled: Bool = true { - didSet { - cardField.postalCodeEntryEnabled = postalCodeEnabled - } - } - - @objc var countryCode: String? { - didSet { - cardField.countryCode = countryCode - } - } - - @objc var placeholders: NSDictionary = NSDictionary() { - didSet { - if let numberPlaceholder = placeholders["number"] as? String { - cardField.numberPlaceholder = numberPlaceholder - } else { - cardField.numberPlaceholder = "1234123412341234" - } - if let expirationPlaceholder = placeholders["expiration"] as? String { - cardField.expirationPlaceholder = expirationPlaceholder - } - if let cvcPlaceholder = placeholders["cvc"] as? String { - cardField.cvcPlaceholder = cvcPlaceholder - } - if let postalCodePlaceholder = placeholders["postalCode"] as? String { - cardField.postalCodePlaceholder = postalCodePlaceholder - } - } - } - - @objc var autofocus: Bool = false { - didSet { - if autofocus == true { - cardField.abi46_0_0ReactFocus() - } - } - } - - @objc var cardStyle: NSDictionary = NSDictionary() { - didSet { - if let borderWidth = cardStyle["borderWidth"] as? Int { - cardField.borderWidth = CGFloat(borderWidth) - } else { - cardField.borderWidth = CGFloat(0) - } - if let backgroundColor = cardStyle["backgroundColor"] as? String { - cardField.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderColor = cardStyle["borderColor"] as? String { - cardField.borderColor = UIColor(hexString: borderColor) - } - if let borderRadius = cardStyle["borderRadius"] as? Int { - cardField.cornerRadius = CGFloat(borderRadius) - } - if let cursorColor = cardStyle["cursorColor"] as? String { - cardField.cursorColor = UIColor(hexString: cursorColor) - } - if let textColor = cardStyle["textColor"] as? String { - cardField.textColor = UIColor(hexString: textColor) - } - if let textErrorColor = cardStyle["textErrorColor"] as? String { - cardField.textErrorColor = UIColor(hexString: textErrorColor) - } - let fontSize = cardStyle["fontSize"] as? Int ?? 14 - - if let fontFamily = cardStyle["fontFamily"] as? String { - cardField.font = UIFont(name: fontFamily, size: CGFloat(fontSize)) ?? UIFont.systemFont(ofSize: CGFloat(fontSize)) - } else { - if let fontSize = cardStyle["fontSize"] as? Int { - cardField.font = UIFont.systemFont(ofSize: CGFloat(fontSize)) - } - } - if let placeholderColor = cardStyle["placeholderColor"] as? String { - cardField.placeholderColor = UIColor(hexString: placeholderColor) - } - } - } - - override init(frame: CGRect) { - super.init(frame: frame) - cardField.delegate = self - - self.addSubview(cardField) - } - - func focus() { - cardField.becomeFirstResponder() - } - - func blur() { - cardField.resignFirstResponder() - } - - func clear() { - cardField.clear() - } - - func paymentCardTextFieldDidEndEditing(_ textField: STPPaymentCardTextField) { - onFocusChange?(["focusedField": NSNull()]) - } - - func paymentCardTextFieldDidBeginEditingNumber(_ textField: STPPaymentCardTextField) { - onFocusChange?(["focusedField": "CardNumber"]) - } - - func paymentCardTextFieldDidBeginEditingCVC(_ textField: STPPaymentCardTextField) { - onFocusChange?(["focusedField": "Cvc"]) - } - - func paymentCardTextFieldDidBeginEditingExpiration(_ textField: STPPaymentCardTextField) { - onFocusChange?(["focusedField": "ExpiryDate"]) - } - - func paymentCardTextFieldDidBeginEditingPostalCode(_ textField: STPPaymentCardTextField) { - onFocusChange?(["focusedField": "PostalCode"]) - } - - func paymentCardTextFieldDidChange(_ textField: STPPaymentCardTextField) { - if onCardChange != nil { - let brand = STPCardValidator.brand(forNumber: textField.cardParams.number ?? "") - let validExpiryDate = STPCardValidator.validationState(forExpirationYear: textField.cardParams.expYear?.stringValue ?? "", inMonth: textField.cardParams.expMonth?.stringValue ?? "") - let validCVC = STPCardValidator.validationState(forCVC: textField.cardParams.cvc ?? "", cardBrand: brand) - let validNumber = STPCardValidator.validationState(forNumber: textField.cardParams.number ?? "", validatingCardBrand: true) - var cardData: [String: Any?] = [ - "expiryMonth": textField.cardParams.expMonth ?? NSNull(), - "expiryYear": textField.cardParams.expYear ?? NSNull(), - "complete": textField.isValid, - "brand": Mappers.mapFromCardBrand(brand) ?? NSNull(), - "last4": textField.cardParams.last4 ?? "", - "validExpiryDate": Mappers.mapFromCardValidationState(state: validExpiryDate), - "validCVC": Mappers.mapFromCardValidationState(state: validCVC), - "validNumber": Mappers.mapFromCardValidationState(state: validNumber) - ] - if (cardField.postalCodeEntryEnabled) { - cardData["postalCode"] = textField.postalCode ?? "" - } - if (dangerouslyGetFullCardDetails) { - cardData["number"] = textField.cardParams.number ?? "" - cardData["cvc"] = textField.cardParams.cvc ?? "" - } - onCardChange!(cardData as [AnyHashable : Any]) - } - if (textField.isValid) { - self.cardParams = textField.cardParams - self.cardPostalCode = textField.postalCode - } else { - self.cardParams = nil - self.cardPostalCode = nil - } - } - - override func layoutSubviews() { - cardField.frame = self.bounds - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - func paymentContext(_ paymentContext: STPPaymentContext, didFailToLoadWithError error: Error) { - // - } - - func paymentContextDidChange(_ paymentContext: STPPaymentContext) { - // - } - - func paymentContext(_ paymentContext: STPPaymentContext, didCreatePaymentResult paymentResult: STPPaymentResult, completion: @escaping STPPaymentStatusBlock) { - // - } - - func paymentContext(_ paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: Error?) { - // - } - -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.m deleted file mode 100644 index 5b0cf8066e46a1..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.m +++ /dev/null @@ -1,13 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(CardFormManager, ABI46_0_0CardFormManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onFormComplete, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(dangerouslyGetFullCardDetails, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(autofocus, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(isUserInteractionEnabledValue, BOOL) -ABI46_0_0RCT_EXTERN_METHOD(focus:(nonnull NSNumber*) ABI46_0_0ReactTag) -ABI46_0_0RCT_EXTERN_METHOD(blur:(nonnull NSNumber*) ABI46_0_0ReactTag) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cardStyle, NSDictionary) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.swift deleted file mode 100644 index fdaca7e7ee48a8..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormManager.swift +++ /dev/null @@ -1,29 +0,0 @@ -import Foundation - -@objc(ABI46_0_0CardFormManager) -class CardFormManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - let cardForm = CardFormView() - let stripeSdk = bridge.module(forName: "StripeSdk") as? StripeSdk - stripeSdk?.cardFormView = cardForm; - return cardForm - } - - override class func requiresMainQueueSetup() -> Bool { - return false - } - - @objc func focus(_ abi46_0_0ReactTag: NSNumber) { - self.bridge!.uiManager.addUIBlock { (_: ABI46_0_0RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in - let view: CardFormView = (viewRegistry![abi46_0_0ReactTag] as? CardFormView)! - view.focus() - } - } - - @objc func blur(_ abi46_0_0ReactTag: NSNumber) { - self.bridge!.uiManager.addUIBlock { (_: ABI46_0_0RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in - let view: CardFormView = (viewRegistry![abi46_0_0ReactTag] as? CardFormView)! - view.blur() - } - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormView.swift deleted file mode 100644 index 989b7f20efd89f..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/CardFormView.swift +++ /dev/null @@ -1,94 +0,0 @@ -import Foundation -import UIKit -import Stripe - -class CardFormView: UIView, STPCardFormViewDelegate { - public var cardForm: STPCardFormView? - - public var cardParams: STPPaymentMethodCardParams? = nil - - @objc var dangerouslyGetFullCardDetails: Bool = false - @objc var onFormComplete: ABI46_0_0RCTDirectEventBlock? - @objc var autofocus: Bool = false - @objc var isUserInteractionEnabledValue: Bool = true - - override func didSetProps(_ changedProps: [String]!) { - if let cardForm = self.cardForm { - cardForm.removeFromSuperview() - } - - let style = self.cardStyle["type"] as? String == "borderless" ? STPCardFormViewStyle.borderless : STPCardFormViewStyle.standard - let _cardForm = STPCardFormView(style: style) - _cardForm.delegate = self - // _cardForm.isUserInteractionEnabled = isUserInteractionEnabledValue - - if autofocus == true { - let _ = _cardForm.becomeFirstResponder() - } - - self.cardForm = _cardForm - self.addSubview(_cardForm) - setStyles() - } - - @objc var cardStyle: NSDictionary = NSDictionary() { - didSet { - setStyles() - } - } - - func cardFormView(_ form: STPCardFormView, didChangeToStateComplete complete: Bool) { - if onFormComplete != nil { - let brand = STPCardValidator.brand(forNumber: cardForm?.cardParams?.card?.number ?? "") - var cardData: [String: Any?] = [ - "expiryMonth": cardForm?.cardParams?.card?.expMonth ?? NSNull(), - "expiryYear": cardForm?.cardParams?.card?.expYear ?? NSNull(), - "complete": complete, - "brand": Mappers.mapFromCardBrand(brand) ?? NSNull(), - "last4": cardForm?.cardParams?.card?.last4 ?? "", - "postalCode": cardForm?.cardParams?.billingDetails?.address?.postalCode ?? "", - "country": cardForm?.cardParams?.billingDetails?.address?.country - ] - - if (dangerouslyGetFullCardDetails) { - cardData["number"] = cardForm?.cardParams?.card?.number ?? "" - cardData["cvc"] = cardForm?.cardParams?.card?.cvc ?? "" - } - if (complete) { - self.cardParams = cardForm?.cardParams?.card - } else { - self.cardParams = nil - } - onFormComplete!(cardData as [AnyHashable : Any]) - } - } - - func focus() { - let _ = cardForm?.becomeFirstResponder() - } - - func blur() { - let _ = cardForm?.resignFirstResponder() - } - - func setStyles() { - if let backgroundColor = cardStyle["backgroundColor"] as? String { - cardForm?.backgroundColor = UIColor(hexString: backgroundColor) - } - // if let disabledBackgroundColor = cardStyle["disabledBackgroundColor"] as? String { - // cardForm?.disabledBackgroundColor = UIColor(hexString: disabledBackgroundColor) - // } - } - - override init(frame: CGRect) { - super.init(frame: frame) - } - - override func layoutSubviews() { - cardForm?.frame = self.bounds - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Errors.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Errors.swift deleted file mode 100644 index 66083042b52dc0..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Errors.swift +++ /dev/null @@ -1,88 +0,0 @@ -import Stripe - -enum ErrorType { - static let Failed = "Failed" - static let Canceled = "Canceled" - static let Unknown = "Unknown" -} - -class Errors { - static internal let isPIClientSecretValidRegex: NSRegularExpression? = try? NSRegularExpression( - pattern: "^pi_[^_]+_secret_[^_]+$", options: []) - - static internal let isSetiClientSecretValidRegex: NSRegularExpression? = try? NSRegularExpression( - pattern: "^seti_[^_]+_secret_[^_]+$", options: []) - - static internal let isEKClientSecretValidRegex: NSRegularExpression? = try? NSRegularExpression( - pattern: "^ek_[^_](.)+$", options: []) - - class func isPIClientSecretValid(clientSecret: String) -> Bool { - return (Errors.isPIClientSecretValidRegex?.numberOfMatches( - in: clientSecret, - options: .anchored, - range: NSRange(location: 0, length: clientSecret.count))) == 1 - } - class func isSetiClientSecretValid(clientSecret: String) -> Bool { - return (Errors.isSetiClientSecretValidRegex?.numberOfMatches( - in: clientSecret, - options: .anchored, - range: NSRange(location: 0, length: clientSecret.count))) == 1 - } - class func isEKClientSecretValid(clientSecret: String) -> Bool { - return (Errors.isEKClientSecretValidRegex?.numberOfMatches( - in: clientSecret, - options: .anchored, - range: NSRange(location: 0, length: clientSecret.count))) == 1 - } - - class func createError (_ code: String, _ message: String?) -> NSDictionary { - let value: NSDictionary = [ - "code": code, - "message": message ?? NSNull(), - "localizedMessage": message ?? NSNull(), - "declineCode": NSNull(), - "stripeErrorCode": NSNull(), - "type": NSNull() - ] - - return ["error": value] - } - class func createError (_ code: String, _ error: NSError?) -> NSDictionary { - let value: NSDictionary = [ - "code": code, - "message": error?.userInfo[STPError.errorMessageKey] ?? NSNull(), - "localizedMessage": error?.localizedDescription ?? NSNull(), - "declineCode": error?.userInfo[STPError.stripeDeclineCodeKey] ?? NSNull(), - "stripeErrorCode": error?.userInfo[STPError.stripeErrorCodeKey] ?? NSNull(), - "type": error?.userInfo[STPError.stripeErrorTypeKey] ?? NSNull(), - ] - - return ["error": value] - } - class func createError (_ code: String, _ error: STPSetupIntentLastSetupError?) -> NSDictionary { - let value: NSDictionary = [ - "code": code, - "message": error?.message ?? NSNull(), - "localizedMessage": error?.message ?? NSNull(), - "declineCode": error?.declineCode ?? NSNull(), - "stripeErrorCode": error?.code ?? NSNull(), - "type": Mappers.mapFromSetupIntentLastPaymentErrorType(error?.type) ?? NSNull() - ] - - return ["error": value] - } - - class func createError (_ code: String, _ error: STPPaymentIntentLastPaymentError?) -> NSDictionary { - let value: NSDictionary = [ - "code": code, - "message": error?.message ?? NSNull(), - "localizedMessage": error?.message ?? NSNull(), - "declineCode": error?.declineCode ?? NSNull(), - "stripeErrorCode": error?.code ?? NSNull(), - "type": Mappers.mapFromPaymentIntentLastPaymentErrorType(error?.type) ?? NSNull() - ] - - return ["error": value] - } -} - diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Mappers.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Mappers.swift deleted file mode 100644 index 95b66f780a5f60..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/Mappers.swift +++ /dev/null @@ -1,992 +0,0 @@ -import Stripe -import StripePaymentSheet - -class Mappers { - class func createResult(_ key: String, _ value: NSDictionary?) -> NSDictionary { - return [key: value ?? NSNull()] - } - - class func mapToPKContactField(field: String) -> PKContactField { - switch field { - case "emailAddress": return PKContactField.emailAddress - case "name": return PKContactField.name - case "phoneNumber": return PKContactField.phoneNumber - case "phoneticName": return PKContactField.phoneticName - case "postalAddress": return PKContactField.postalAddress - default: return PKContactField.name - } - } - - class func mapToPaymentSummaryItemType(type: String?) -> PKPaymentSummaryItemType { - if let type = type { - switch type { - case "pending": return PKPaymentSummaryItemType.pending - case "final": return PKPaymentSummaryItemType.final - default: return PKPaymentSummaryItemType.final - } - } - return PKPaymentSummaryItemType.final - } - - class func mapFromBankAccountHolderType(_ type: STPBankAccountHolderType?) -> String? { - if let type = type { - switch type { - case STPBankAccountHolderType.company: return "Company" - case STPBankAccountHolderType.individual: return "Individual" - default: return nil - } - } - return nil - } - - class func mapToBankAccountHolderType(_ type: String?) -> STPBankAccountHolderType { - switch type { - case "Company": return STPBankAccountHolderType.company - case "Individual": return STPBankAccountHolderType.individual - default: return STPBankAccountHolderType.individual - } - } - - class func mapFromBankAccountStatus(_ status: STPBankAccountStatus?) -> String? { - if let status = status { - switch status { - case STPBankAccountStatus.errored: return "Errored" - case STPBankAccountStatus.new: return "New" - case STPBankAccountStatus.validated: return "Validated" - case STPBankAccountStatus.verified: return "Verified" - case STPBankAccountStatus.verificationFailed: return "VerificationFailed" - default: return nil - } - } - return nil - } - - class func mapFromBankAccount(_ bankAccount: STPBankAccount?) -> NSDictionary? { - if (bankAccount == nil) { - return nil - } - let result: NSDictionary = [ - "id": bankAccount?.stripeID ?? NSNull(), - "bankName": bankAccount?.bankName ?? NSNull(), - "accountHolderName": bankAccount?.accountHolderName ?? NSNull(), - "accountHolderType": mapFromBankAccountHolderType(bankAccount?.accountHolderType) ?? NSNull(), - "country": bankAccount?.country ?? NSNull(), - "currency": bankAccount?.currency ?? NSNull(), - "routingNumber": bankAccount?.routingNumber ?? NSNull(), - "status": mapFromBankAccountStatus(bankAccount?.status) ?? NSNull(), - ] - return result - } - - class func mapFromCard(_ card: STPCard?) -> NSDictionary? { - if (card == nil) { - return nil - } - let cardMap: NSDictionary = [ - "brand": mapFromCardBrand(card?.brand) ?? NSNull(), - "country": card?.country ?? NSNull(), - "currency": card?.currency ?? NSNull(), - "expMonth": card?.expMonth ?? NSNull(), - "expYear": card?.expYear ?? NSNull(), - "last4": card?.last4 ?? NSNull(), - "funding": mapFromFunding(card?.funding) ?? NSNull(), - "name": card?.name ?? NSNull(), - "address": mapFromAddress(address: card?.address), - "id": card?.stripeID ?? NSNull(), - ] - return cardMap - } - - class func mapFromAddress(address: STPAddress?) -> NSDictionary { - let result: NSDictionary = [ - "city": address?.city ?? NSNull(), - "postalCode": address?.postalCode ?? NSNull(), - "country": address?.country ?? NSNull(), - "line1": address?.line1 ?? NSNull(), - "line2": address?.line2 ?? NSNull(), - "state": address?.state ?? NSNull(), - ] - - return result - } - - class func mapToAddress(address: NSDictionary?) -> STPAddress { - let result = STPAddress() - result.city = address?["city"] as? String - result.country = address?["country"] as? String - result.line1 = address?["line1"] as? String - result.line2 = address?["line2"] as? String - result.postalCode = address?["postalCode"] as? String - result.state = address?["state"] as? String - - return result - } - - class func mapFromFunding(_ funding: STPCardFundingType?) -> String? { - if let funding = funding { - switch funding { - case STPCardFundingType.credit: return "Credit" - case STPCardFundingType.debit: return "Debit" - case STPCardFundingType.prepaid: return "Prepaid" - case STPCardFundingType.other: return "Unknown" - - default: return nil - } - } - return nil - } - - class func mapFromTokenType(_ type: STPTokenType?) -> String? { - if let type = type { - switch type { - case STPTokenType.PII: return "Pii" - case STPTokenType.account: return "Account" - case STPTokenType.bankAccount: return "BankAccount" - case STPTokenType.card: return "Card" - case STPTokenType.cvcUpdate: return "CvcUpdate" - default: return nil - } - } - return nil - } - - class func mapFromToken(token: STPToken) -> NSDictionary { - let tokenMap: NSDictionary = [ - "id": token.tokenId, - "bankAccount": mapFromBankAccount(token.bankAccount) ?? NSNull(), - "created": convertDateToUnixTimestamp(date: token.created) ?? NSNull(), - "card": mapFromCard(token.card) ?? NSNull(), - "livemode": token.livemode, - "type": mapFromTokenType(token.type) ?? NSNull(), - ] - - return tokenMap - } - - class func mapToShippingMethods(shippingMethods: NSArray?) -> [PKShippingMethod] { - var shippingMethodsList: [PKShippingMethod] = [] - - if let methods = shippingMethods as? [[String : Any]] { - for method in methods { - let label = method["label"] as? String ?? "" - let amount = NSDecimalNumber(string: method["amount"] as? String ?? "") - let identifier = method["identifier"] as! String - let detail = method["detail"] as? String ?? "" - let type = Mappers.mapToPaymentSummaryItemType(type: method["type"] as? String) - let pm = PKShippingMethod.init(label: label, amount: amount, type: type) - pm.identifier = identifier - pm.detail = detail - shippingMethodsList.append(pm) - } - } - - return shippingMethodsList - } - - class func mapFromShippingMethod(shippingMethod: PKShippingMethod) -> NSDictionary { - let method: NSDictionary = [ - "detail": shippingMethod.detail ?? "", - "identifier": shippingMethod.identifier ?? "", - "amount": shippingMethod.amount.stringValue, - "type": shippingMethod.type, - "label": shippingMethod.label - ] - - return method - } - - class func mapFromShippingContact(shippingContact: PKContact) -> NSDictionary { - let name: NSDictionary = [ - "familyName": shippingContact.name?.familyName ?? "", - "namePrefix": shippingContact.name?.namePrefix ?? "", - "nameSuffix": shippingContact.name?.nameSuffix ?? "", - "givenName": shippingContact.name?.givenName ?? "", - "middleName": shippingContact.name?.middleName ?? "", - "nickname": shippingContact.name?.nickname ?? "", - ] - let contact: NSDictionary = [ - "emailAddress": shippingContact.emailAddress ?? "", - "phoneNumber": shippingContact.phoneNumber?.stringValue ?? "", - "name": name, - "postalAddress": [ - "city": shippingContact.postalAddress?.city, - "country": shippingContact.postalAddress?.country, - "postalCode": shippingContact.postalAddress?.postalCode, - "state": shippingContact.postalAddress?.state, - "street": shippingContact.postalAddress?.street, - "isoCountryCode": shippingContact.postalAddress?.isoCountryCode, - "subAdministrativeArea": shippingContact.postalAddress?.subAdministrativeArea, - "subLocality": shippingContact.postalAddress?.subLocality, - ], - ] - - return contact - } - - class func mapAddressFields(_ addressFields: [String]) -> [String] { - return addressFields.map { - if ($0 == "street") { - return CNPostalAddressStreetKey - } else if ($0 == "city") { - return CNPostalAddressCityKey - } else if ($0 == "subAdministrativeArea") { - return CNPostalAddressSubAdministrativeAreaKey - } else if ($0 == "state") { - return CNPostalAddressStateKey - } else if ($0 == "postalCode") { - return CNPostalAddressPostalCodeKey - } else if ($0 == "country") { - return CNPostalAddressCountryKey - } else if ($0 == "countryCode") { - return CNPostalAddressISOCountryCodeKey - } else if ($0 == "subLocality") { - return CNPostalAddressSubLocalityKey - } - return "" - } - } - - class func mapIntentStatus(status: STPPaymentIntentStatus?) -> String { - if let status = status { - switch status { - case STPPaymentIntentStatus.succeeded: return "Succeeded" - case STPPaymentIntentStatus.requiresPaymentMethod: return "RequiresPaymentMethod" - case STPPaymentIntentStatus.requiresConfirmation: return "RequiresConfirmation" - case STPPaymentIntentStatus.canceled: return "Canceled" - case STPPaymentIntentStatus.processing: return "Processing" - case STPPaymentIntentStatus.requiresAction: return "RequiresAction" - case STPPaymentIntentStatus.requiresCapture: return "RequiresCapture" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapPaymentMethodType(type: STPPaymentMethodType) -> String { - switch type { - case STPPaymentMethodType.card: return "Card" - case STPPaymentMethodType.alipay: return "Alipay" - case STPPaymentMethodType.grabPay: return "GrabPay" - case STPPaymentMethodType.iDEAL: return "Ideal" - case STPPaymentMethodType.FPX: return "Fpx" - case STPPaymentMethodType.cardPresent: return "CardPresent" - case STPPaymentMethodType.SEPADebit: return "SepaDebit" - case STPPaymentMethodType.AUBECSDebit: return "AuBecsDebit" - case STPPaymentMethodType.bacsDebit: return "BacsDebit" - case STPPaymentMethodType.giropay: return "Giropay" - case STPPaymentMethodType.przelewy24: return "P24" - case STPPaymentMethodType.EPS: return "Eps" - case STPPaymentMethodType.bancontact: return "Bancontact" - case STPPaymentMethodType.OXXO: return "Oxxo" - case STPPaymentMethodType.sofort: return "Sofort" - case STPPaymentMethodType.UPI: return "Upi" - case STPPaymentMethodType.afterpayClearpay: return "AfterpayClearpay" - case STPPaymentMethodType.klarna: return "Klarna" - case STPPaymentMethodType.USBankAccount: return "USBankAccount" - case STPPaymentMethodType.payPal: return "PayPal" - case STPPaymentMethodType.unknown: return "Unknown" - default: return "Unknown" - } - } - - class func mapToPaymentMethodType(type: String?) -> STPPaymentMethodType? { - if let type = type { - switch type { - case "Card": return STPPaymentMethodType.card - case "Alipay": return STPPaymentMethodType.alipay - case "GrabPay": return STPPaymentMethodType.grabPay - case "Ideal": return STPPaymentMethodType.iDEAL - case "Fpx": return STPPaymentMethodType.FPX - case "CardPresent": return STPPaymentMethodType.cardPresent - case "SepaDebit": return STPPaymentMethodType.SEPADebit - case "AuBecsDebit": return STPPaymentMethodType.AUBECSDebit - case "BacsDebit": return STPPaymentMethodType.bacsDebit - case "Giropay": return STPPaymentMethodType.giropay - case "P24": return STPPaymentMethodType.przelewy24 - case "Eps": return STPPaymentMethodType.EPS - case "Bancontact": return STPPaymentMethodType.bancontact - case "Oxxo": return STPPaymentMethodType.OXXO - case "Sofort": return STPPaymentMethodType.sofort - case "Upi": return STPPaymentMethodType.UPI - case "AfterpayClearpay": return STPPaymentMethodType.afterpayClearpay - case "Klarna": return STPPaymentMethodType.klarna - case "WeChatPay": return STPPaymentMethodType.weChatPay - case "USBankAccount": return STPPaymentMethodType.USBankAccount - case "PayPal": return STPPaymentMethodType.payPal - default: return STPPaymentMethodType.unknown - } - } - return nil - } - - class func mapCaptureMethod(_ captureMethod: STPPaymentIntentCaptureMethod?) -> String { - if let captureMethod = captureMethod { - switch captureMethod { - case STPPaymentIntentCaptureMethod.automatic: return "Automatic" - case STPPaymentIntentCaptureMethod.manual: return "Manual" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapConfirmationMethod(_ confirmationMethod: STPPaymentIntentConfirmationMethod?) -> String { - if let confirmationMethod = confirmationMethod { - switch confirmationMethod { - case STPPaymentIntentConfirmationMethod.automatic: return "Automatic" - case STPPaymentIntentConfirmationMethod.manual: return "Manual" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapIntentShipping(_ shipping: STPPaymentIntentShippingDetails) -> NSDictionary { - var addressDetails = NSDictionary() - if let address = shipping.address { - addressDetails = [ - "city": address.city ?? NSNull(), - "country": address.country ?? NSNull(), - "line1": address.line1 ?? NSNull(), - "line2":address.line2 ?? NSNull(), - "postalCode": address.postalCode ?? NSNull(), - ] - } - let shippingDetails: NSDictionary = [ - "address": addressDetails, - "name": shipping.name ?? NSNull(), - "phone": shipping.phone ?? NSNull(), - "trackingNumber": shipping.trackingNumber ?? NSNull(), - "carrier": shipping.carrier ?? NSNull(), - ] - return shippingDetails - } - - class func mapFromPaymentIntent (paymentIntent: STPPaymentIntent) -> NSDictionary { - let intent: NSMutableDictionary = [ - "id": paymentIntent.stripeId, - "currency": paymentIntent.currency, - "status": Mappers.mapIntentStatus(status: paymentIntent.status), - "description": paymentIntent.description, - "clientSecret": paymentIntent.clientSecret, - "receiptEmail": paymentIntent.receiptEmail ?? NSNull(), - "livemode": paymentIntent.livemode, - "paymentMethodId": paymentIntent.paymentMethodId ?? NSNull(), - "captureMethod": mapCaptureMethod(paymentIntent.captureMethod), - "confirmationMethod": mapConfirmationMethod(paymentIntent.confirmationMethod), - "created": convertDateToUnixTimestamp(date: paymentIntent.created) ?? NSNull(), - "amount": paymentIntent.amount, - "lastPaymentError": NSNull(), - "shipping": NSNull(), - "canceledAt": NSNull(), - "nextAction": mapNextAction(nextAction: paymentIntent.nextAction) ?? NSNull(), - ] - - if let lastPaymentError = paymentIntent.lastPaymentError { - let paymentError: NSMutableDictionary = [ - "code": lastPaymentError.code ?? NSNull(), - "message": lastPaymentError.message ?? NSNull(), - "type": mapFromPaymentIntentLastPaymentErrorType(lastPaymentError.type) ?? NSNull(), - "declineCode": lastPaymentError.declineCode ?? NSNull(), - "paymentMethod": mapFromPaymentMethod(lastPaymentError.paymentMethod) ?? NSNull() - ] - - intent.setValue(paymentError, forKey: "lastPaymentError") - } - - if let shipping = paymentIntent.shipping { - intent.setValue(mapIntentShipping(shipping), forKey: "shipping") - } - - if let canceledAt = paymentIntent.canceledAt { - intent.setValue(convertDateToUnixTimestamp(date: canceledAt), forKey: "canceledAt") - } - - return intent; - } - - class func mapNextAction(nextAction: STPIntentAction?) -> NSDictionary? { - if let it = nextAction { - switch it.type { - case .verifyWithMicrodeposits: - return [ - "type": "verifyWithMicrodeposits", - "redirectUrl": it.verifyWithMicrodeposits?.hostedVerificationURL.absoluteString ?? NSNull(), - "microdepositType": it.verifyWithMicrodeposits?.microdepositType.description ?? NSNull(), - "arrivalDate": it.verifyWithMicrodeposits?.arrivalDate.timeIntervalSince1970.description ?? NSNull(), - ] - case .redirectToURL: - return [ - "type": "urlRedirect", - "redirectUrl": it.redirectToURL?.url.absoluteString ?? NSNull() - ] - case .weChatPayRedirectToApp: - return [ - "type": "weChatRedirect", - "redirectUrl": it.weChatPayRedirectToApp?.nativeURL?.absoluteString ?? NSNull() - ] - case .alipayHandleRedirect: - return [ - "type": "alipayRedirect", - "redirectUrl": it.alipayHandleRedirect?.url.absoluteString ?? NSNull(), - "nativeRedirectUrl": it.alipayHandleRedirect?.nativeURL?.absoluteString ?? NSNull(), - ] - case .OXXODisplayDetails: - return [ - "type": "oxxoVoucher", - "expiration": it.oxxoDisplayDetails?.expiresAfter.timeIntervalSince1970 ?? NSNull(), - "voucherURL": it.oxxoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), - "voucherNumber": it.oxxoDisplayDetails?.number ?? NSNull(), - ] -// TODO: Not supported on Android -// case .boletoDisplayDetails: -// return [ -// "type": "boletoVoucher", -// "expiration": it.boletoDisplayDetails?.expiresAt.timeIntervalSince1970.description ?? NSNull(), -// "voucherURL": it.boletoDisplayDetails?.hostedVoucherURL.absoluteString ?? NSNull(), -// "voucherNumber": it.boletoDisplayDetails?.number ?? NSNull(), -// ] - default: // .useStripeSDK, .BLIKAuthorize, .unknown - return nil - } - } else { - return nil - } - } - - class func mapFromPaymentIntentLastPaymentErrorType(_ errorType: STPPaymentIntentLastPaymentErrorType?) -> String? { - if let errorType = errorType { - switch errorType { - case STPPaymentIntentLastPaymentErrorType.apiConnection: return "api_connection_error" - case STPPaymentIntentLastPaymentErrorType.api: return "api_error" - case STPPaymentIntentLastPaymentErrorType.authentication: return "authentication_error" - case STPPaymentIntentLastPaymentErrorType.card: return "card_error" - case STPPaymentIntentLastPaymentErrorType.idempotency: return "idempotency_error" - case STPPaymentIntentLastPaymentErrorType.invalidRequest: return "invalid_request_error" - case STPPaymentIntentLastPaymentErrorType.rateLimit: return "rate_limit_error" - case STPPaymentIntentLastPaymentErrorType.unknown: return nil - default: return nil - } - } - return nil - } - - class func mapFromSetupIntentLastPaymentErrorType(_ errorType: STPSetupIntentLastSetupErrorType?) -> String? { - if let errorType = errorType { - switch errorType { - case STPSetupIntentLastSetupErrorType.apiConnection: return "api_connection_error" - case STPSetupIntentLastSetupErrorType.API: return "api_error" - case STPSetupIntentLastSetupErrorType.authentication: return "authentication_error" - case STPSetupIntentLastSetupErrorType.card: return "card_error" - case STPSetupIntentLastSetupErrorType.idempotency: return "idempotency_error" - case STPSetupIntentLastSetupErrorType.invalidRequest: return "invalid_request_error" - case STPSetupIntentLastSetupErrorType.rateLimit: return "rate_limit_error" - case STPSetupIntentLastSetupErrorType.unknown: return nil - default: return nil - } - } - return nil - } - - class func mapToBillingDetails(billingDetails: NSDictionary?) -> STPPaymentMethodBillingDetails? { - guard let billingDetails = billingDetails else { - return nil - } - let billing = STPPaymentMethodBillingDetails() - billing.email = ABI46_0_0RCTConvert.nsString(billingDetails["email"]) - billing.phone = ABI46_0_0RCTConvert.nsString(billingDetails["phone"]) - billing.name = ABI46_0_0RCTConvert.nsString(billingDetails["name"]) - - let address = STPPaymentMethodAddress() - - if let addressMap = billingDetails["address"] as? NSDictionary { - address.city = ABI46_0_0RCTConvert.nsString(addressMap["city"]) - address.postalCode = ABI46_0_0RCTConvert.nsString(addressMap["postalCode"]) - address.country = ABI46_0_0RCTConvert.nsString(addressMap["country"]) - address.line1 = ABI46_0_0RCTConvert.nsString(addressMap["line1"]) - address.line2 = ABI46_0_0RCTConvert.nsString(addressMap["line2"]) - address.state = ABI46_0_0RCTConvert.nsString(addressMap["state"]) - } - - billing.address = address - - return billing - } - - class func mapToShippingDetails(shippingDetails: NSDictionary?) -> STPPaymentIntentShippingDetailsParams? { - guard let shippingDetails = shippingDetails else { - return nil - } - - let shippingAddress = STPPaymentIntentShippingDetailsAddressParams(line1: "") - - if let addressMap = shippingDetails["address"] as? NSDictionary { - shippingAddress.city = addressMap["city"] as? String - shippingAddress.postalCode = addressMap["postalCode"] as? String - shippingAddress.country = addressMap["country"] as? String - shippingAddress.line1 = addressMap["line1"] as? String ?? "" - shippingAddress.line2 = addressMap["line2"] as? String - shippingAddress.state = addressMap["state"] as? String - } - - let shipping = STPPaymentIntentShippingDetailsParams(address: shippingAddress, name: shippingDetails["name"] as? String ?? "") - - return shipping - } - - class func mapFromBillingDetails(billingDetails: STPPaymentMethodBillingDetails?) -> NSDictionary { - let billing: NSDictionary = [ - "email": billingDetails?.email ?? NSNull(), - "phone": billingDetails?.phone ?? NSNull(), - "name": billingDetails?.name ?? NSNull(), - "address": [ - "city": billingDetails?.address?.city, - "postalCode": billingDetails?.address?.postalCode, - "country": billingDetails?.address?.country, - "line1": billingDetails?.address?.line1, - "line2": billingDetails?.address?.line2, - "state": billingDetails?.address?.state, - ], - ] - - return billing - } - - class func mapFromCardBrand(_ brand: STPCardBrand?) -> String? { - if let brand = brand { - switch brand { - case STPCardBrand.visa: return "Visa" - case STPCardBrand.amex: return "AmericanExpress" - case STPCardBrand.mastercard: return "MasterCard" - case STPCardBrand.discover: return "Discover" - case STPCardBrand.JCB: return "JCB" - case STPCardBrand.dinersClub: return "DinersClub" - case STPCardBrand.unionPay: return "UnionPay" - case STPCardBrand.unknown: return "Unknown" - default: return nil - } - } - return nil - } - - class func mapToCardBrand(_ brand: String?) -> STPCardBrand { - if let brand = brand { - switch brand { - case "Visa": return STPCardBrand.visa - case "AmericanExpress" : return STPCardBrand.amex - case "MasterCard": return STPCardBrand.mastercard - case "Discover": return STPCardBrand.discover - case "JCB": return STPCardBrand.JCB - case "DinersClub": return STPCardBrand.dinersClub - case "UnionPay": return STPCardBrand.unionPay - case "Unknown": return STPCardBrand.unknown - default: return STPCardBrand.unknown - } - } - return STPCardBrand.unknown - } - - class func mapFromPaymentMethod(_ paymentMethod: STPPaymentMethod?) -> NSDictionary? { - guard let paymentMethod = paymentMethod else { - return nil - } - let card: NSDictionary = [ - "brand": Mappers.mapFromCardBrand(paymentMethod.card?.brand) ?? NSNull(), - "country": paymentMethod.card?.country ?? NSNull(), - "expYear": paymentMethod.card?.expYear ?? NSNull(), - "expMonth": paymentMethod.card?.expMonth ?? NSNull(), - "fingerprint": paymentMethod.card?.fingerprint ?? NSNull(), - "funding": paymentMethod.card?.funding ?? NSNull(), - "last4": paymentMethod.card?.last4 ?? NSNull() - ] - let sepaDebit: NSDictionary = [ - "bankCode": paymentMethod.sepaDebit?.bankCode ?? NSNull(), - "country": paymentMethod.sepaDebit?.country ?? NSNull(), - "fingerprint": paymentMethod.sepaDebit?.fingerprint ?? NSNull(), - "last4": paymentMethod.sepaDebit?.last4 ?? NSNull(), - ] - let bacsDebit: NSDictionary = [ - "fingerprint": paymentMethod.bacsDebit?.fingerprint ?? NSNull(), - "last4": paymentMethod.bacsDebit?.last4 ?? NSNull(), - "sortCode": paymentMethod.bacsDebit?.sortCode ?? NSNull() - ] - let auBECSDebit: NSDictionary = [ - "bsbNumber": paymentMethod.auBECSDebit?.bsbNumber ?? NSNull(), - "fingerprint": paymentMethod.auBECSDebit?.fingerprint ?? NSNull(), - "last4": paymentMethod.auBECSDebit?.last4 ?? NSNull() - ] - let USBankAccount: NSDictionary = [ - "routingNumber": paymentMethod.usBankAccount?.routingNumber ?? NSNull(), - "accountHolderType": mapFromUSBankAccountHolderType(type: paymentMethod.usBankAccount?.accountHolderType), - "accountType": mapFromUSBankAccountType(type: paymentMethod.usBankAccount?.accountType), - "last4": paymentMethod.usBankAccount?.last4 ?? NSNull(), - "bankName": paymentMethod.usBankAccount?.bankName ?? NSNull(), - "linkedAccount": paymentMethod.usBankAccount?.linkedAccount ?? NSNull(), - "fingerprint": paymentMethod.usBankAccount?.fingerprint ?? NSNull(), - "preferredNetworks": paymentMethod.usBankAccount?.networks?.preferred ?? NSNull(), - "supportedNetworks": paymentMethod.usBankAccount?.networks?.supported ?? NSNull(), - ] - let method: NSDictionary = [ - "id": paymentMethod.stripeId, - "paymentMethodType": Mappers.mapPaymentMethodType(type: paymentMethod.type), - "livemode": paymentMethod.liveMode, - "customerId": paymentMethod.customerId ?? NSNull(), - "billingDetails": Mappers.mapFromBillingDetails(billingDetails: paymentMethod.billingDetails), - "Card": card, - "Ideal": [ - "bankIdentifierCode": paymentMethod.iDEAL?.bankIdentifierCode ?? "", - "bankName": paymentMethod.iDEAL?.bankName ?? "" - ], - "Fpx": [ - "bank": paymentMethod.fpx?.bankIdentifierCode ?? "", - ], - "SepaDebit": sepaDebit, - "BacsDebit": bacsDebit, - "AuBecsDebit": auBECSDebit, - "Sofort": [ - "country": paymentMethod.sofort?.country - ], - "Upi": [ - "vpa": paymentMethod.upi?.vpa - ], - "USBankAccount": USBankAccount - ] - return method - } - - class func mapIntentStatus(status: STPSetupIntentStatus?) -> String { - if let status = status { - switch status { - case STPSetupIntentStatus.succeeded: return "Succeeded" - case STPSetupIntentStatus.requiresPaymentMethod: return "RequiresPaymentMethod" - case STPSetupIntentStatus.requiresConfirmation: return "RequiresConfirmation" - case STPSetupIntentStatus.canceled: return "Canceled" - case STPSetupIntentStatus.processing: return "Processing" - case STPSetupIntentStatus.requiresAction: return "RequiresAction" - case STPSetupIntentStatus.unknown: return "Unknown" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapFromSetupIntentUsage(usage: STPSetupIntentUsage?) -> String { - if let usage = usage { - switch usage { - case STPSetupIntentUsage.none: return "None" - case STPSetupIntentUsage.offSession: return "OffSession" - case STPSetupIntentUsage.onSession: return "OnSession" - case STPSetupIntentUsage.unknown: return "Unknown" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapToPaymentIntentFutureUsage(usage: String?) -> STPPaymentIntentSetupFutureUsage { - if let usage = usage { - switch usage { - case "None": return STPPaymentIntentSetupFutureUsage.none - case "OffSession": return STPPaymentIntentSetupFutureUsage.offSession - case "OnSession": return STPPaymentIntentSetupFutureUsage.onSession - case "Unknown": return STPPaymentIntentSetupFutureUsage.unknown - default: return STPPaymentIntentSetupFutureUsage.unknown - } - } - return STPPaymentIntentSetupFutureUsage.unknown - } - - class func mapFromSetupIntent(setupIntent: STPSetupIntent) -> NSDictionary { - let intent: NSMutableDictionary = [ - "id": setupIntent.stripeID, - "clientSecret": setupIntent.clientSecret, - "status": mapIntentStatus(status: setupIntent.status), - "description": setupIntent.stripeDescription ?? NSNull(), - "livemode": setupIntent.livemode, - "paymentMethodTypes": NSArray(), - "usage": mapFromSetupIntentUsage(usage: setupIntent.usage), - "paymentMethodId": setupIntent.paymentMethodID ?? NSNull(), - "created": NSNull(), - "lastSetupError": NSNull(), - "nextAction": mapNextAction(nextAction: setupIntent.nextAction) ?? NSNull(), - ] - - - let types = setupIntent.paymentMethodTypes.map { - mapPaymentMethodType(type: STPPaymentMethodType.init(rawValue: Int(truncating: $0))!) - } - - intent.setValue(types, forKey: "paymentMethodTypes") - intent.setValue(convertDateToUnixTimestamp(date: setupIntent.created), forKey: "created") - - if let lastSetupError = setupIntent.lastSetupError { - let setupError: NSMutableDictionary = [ - "code": lastSetupError.code ?? NSNull(), - "message": lastSetupError.message ?? NSNull(), - "type": mapFromSetupIntentLastPaymentErrorType(lastSetupError.type) ?? NSNull(), - "declineCode": lastSetupError.declineCode ?? NSNull(), - "paymentMethod": mapFromPaymentMethod(lastSetupError.paymentMethod) ?? NSNull() - ] - intent.setValue(setupError, forKey: "lastSetupError") - } - - return intent - } - - @available(iOS 13.0, *) - class func mapToUserInterfaceStyle(_ style: String) -> PaymentSheet.UserInterfaceStyle { - switch style { - case "alwaysDark": return PaymentSheet.UserInterfaceStyle.alwaysDark - case "alwaysLight": return PaymentSheet.UserInterfaceStyle.alwaysLight - default: return PaymentSheet.UserInterfaceStyle.automatic - } - } - - class func mapToReturnURL(urlScheme: String) -> String { - return urlScheme + "://safepay" - } - - class func mapUICustomization(_ params: NSDictionary) -> STPThreeDSUICustomization { - let uiCustomization = STPThreeDSUICustomization() - if let labelSettings = params["label"] as? Dictionary { - if let headingTextColor = labelSettings["headingTextColor"] as? String { - uiCustomization.labelCustomization.headingTextColor = UIColor(hexString: headingTextColor) - } - if let textColor = labelSettings["textColor"] as? String { - uiCustomization.labelCustomization.textColor = UIColor(hexString: textColor) - } - if let headingFontSize = labelSettings["headingFontSize"] as? Int { - uiCustomization.labelCustomization.headingFont = UIFont.systemFont(ofSize: CGFloat(headingFontSize)) - } - if let textFontSize = labelSettings["textFontSize"] as? Int { - uiCustomization.labelCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - } - - if let navigationBarSettings = params["navigationBar"] as? Dictionary { - if let barTintColor = navigationBarSettings["barTintColor"] as? String { - uiCustomization.navigationBarCustomization.barTintColor = UIColor(hexString: barTintColor) - } - if let barStyle = navigationBarSettings["barStyle"] as? Int { - uiCustomization.navigationBarCustomization.barStyle = UIBarStyle(rawValue: barStyle) ?? .default - } - if let headerText = navigationBarSettings["headerText"] as? String { - uiCustomization.navigationBarCustomization.headerText = headerText - } - if let buttonText = navigationBarSettings["buttonText"] as? String { - uiCustomization.navigationBarCustomization.buttonText = buttonText - } - if let textFontSize = navigationBarSettings["textFontSize"] as? Int { - uiCustomization.navigationBarCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = navigationBarSettings["textColor"] as? String { - uiCustomization.navigationBarCustomization.textColor = UIColor(hexString: textColor) - } - if let translucent = navigationBarSettings["translucent"] as? Bool { - uiCustomization.navigationBarCustomization.translucent = translucent - } - } - - if let textFieldSettings = params["textField"] as? Dictionary { - if let borderColor = textFieldSettings["borderColor"] as? String { - uiCustomization.textFieldCustomization.borderColor = UIColor(hexString: borderColor) - } - if let borderWidth = textFieldSettings["borderWidth"] as? Int { - uiCustomization.textFieldCustomization.borderWidth = CGFloat(borderWidth) - } - if let borderRadius = textFieldSettings["borderRadius"] as? Int { - uiCustomization.textFieldCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textColor = textFieldSettings["textColor"] as? String { - uiCustomization.textFieldCustomization.textColor = UIColor(hexString: textColor) - } - if let textFontSize = textFieldSettings["textFontSize"] as? Int { - uiCustomization.textFieldCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - } - - if let footerSettings = params["footer"] as? Dictionary { - if let backgroundColor = footerSettings["backgroundColor"] as? String { - uiCustomization.footerCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let chevronColor = footerSettings["chevronColor"] as? String { - uiCustomization.footerCustomization.chevronColor = UIColor(hexString: chevronColor) - } - if let headingTextColor = footerSettings["headingTextColor"] as? String { - uiCustomization.footerCustomization.headingTextColor = UIColor(hexString: headingTextColor) - } - if let textColor = footerSettings["textColor"] as? String { - uiCustomization.footerCustomization.textColor = UIColor(hexString: textColor) - } - } - - if let submitButtonSettings = params["submitButton"] as? Dictionary { - let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.submit) - - if let backgroundColor = submitButtonSettings["backgroundColor"] as? String { - buttonCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderRadius = submitButtonSettings["borderRadius"] as? Int { - buttonCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textFontSize = submitButtonSettings["textFontSize"] as? Int { - buttonCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = submitButtonSettings["textColor"] as? String { - buttonCustomization.textColor = UIColor(hexString: textColor) - } - - uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.submit) - } - - if let submitButtonSettings = params["cancelButton"] as? Dictionary { - let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.cancel) - - if let backgroundColor = submitButtonSettings["backgroundColor"] as? String { - buttonCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderRadius = submitButtonSettings["borderRadius"] as? Int { - buttonCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textFontSize = submitButtonSettings["textFontSize"] as? Int { - buttonCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = submitButtonSettings["textColor"] as? String { - buttonCustomization.textColor = UIColor(hexString: textColor) - } - - uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.cancel) - } - - if let submitButtonSettings = params["continueButton"] as? Dictionary { - let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.continue) - - if let backgroundColor = submitButtonSettings["backgroundColor"] as? String { - buttonCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderRadius = submitButtonSettings["borderRadius"] as? Int { - buttonCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textFontSize = submitButtonSettings["textFontSize"] as? Int { - buttonCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = submitButtonSettings["textColor"] as? String { - buttonCustomization.textColor = UIColor(hexString: textColor) - } - - uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.continue) - } - - if let submitButtonSettings = params["nextButton"] as? Dictionary { - let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.next) - - if let backgroundColor = submitButtonSettings["backgroundColor"] as? String { - buttonCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderRadius = submitButtonSettings["borderRadius"] as? Int { - buttonCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textFontSize = submitButtonSettings["textFontSize"] as? Int { - buttonCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = submitButtonSettings["textColor"] as? String { - buttonCustomization.textColor = UIColor(hexString: textColor) - } - - uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.next) - } - - if let submitButtonSettings = params["resendButton"] as? Dictionary { - let buttonCustomization = uiCustomization.buttonCustomization(for: STPThreeDSCustomizationButtonType.resend) - - if let backgroundColor = submitButtonSettings["backgroundColor"] as? String { - buttonCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - if let borderRadius = submitButtonSettings["borderRadius"] as? Int { - buttonCustomization.cornerRadius = CGFloat(borderRadius) - } - if let textFontSize = submitButtonSettings["textFontSize"] as? Int { - buttonCustomization.font = UIFont.systemFont(ofSize: CGFloat(textFontSize)) - } - if let textColor = submitButtonSettings["textColor"] as? String { - buttonCustomization.textColor = UIColor(hexString: textColor) - } - - uiCustomization.setButtonCustomization(buttonCustomization, for: STPThreeDSCustomizationButtonType.resend) - } - - if let backgroundColor = params["backgroundColor"] as? String { - uiCustomization.backgroundColor = UIColor(hexString: backgroundColor) - } - - - return uiCustomization - } - - class func convertDateToUnixTimestamp(date: Date?) -> String? { - if let date = date { - let value = date.timeIntervalSince1970 * 1000.0 - return String(format: "%.0f", value) - } - return nil - } - - class func mapFromCardValidationState(state: STPCardValidationState?) -> String { - if let state = state { - switch state { - case STPCardValidationState.valid: return "Valid" - case STPCardValidationState.invalid: return "Invalid" - case STPCardValidationState.incomplete: return "Incomplete" - default: return "Unknown" - } - } - return "Unknown" - } - - class func mapToPKAddPassButtonStyle(style: String?) -> PKAddPassButtonStyle { - if let style = style { - if (style == "onDarkBackground") { - return .blackOutline - } - } - return .black - } - - class func mapFromUSBankAccountHolderType(type: STPPaymentMethodUSBankAccountHolderType?) -> String { - if let type = type { - switch type { - case STPPaymentMethodUSBankAccountHolderType.company: return "Company" - case STPPaymentMethodUSBankAccountHolderType.individual: return "Individual" - case STPPaymentMethodUSBankAccountHolderType.unknown: return "Unknown" - } - } - return "Unknown" - } - - class func mapToUSBankAccountHolderType(type: String?) -> STPPaymentMethodUSBankAccountHolderType { - switch type { - case "Company": return STPPaymentMethodUSBankAccountHolderType.company - case "Individual": return STPPaymentMethodUSBankAccountHolderType.individual - default: return STPPaymentMethodUSBankAccountHolderType.individual - } - } - - class func mapFromUSBankAccountType(type: STPPaymentMethodUSBankAccountType?) -> String { - if let type = type { - switch type { - case STPPaymentMethodUSBankAccountType.savings: return "Savings" - case STPPaymentMethodUSBankAccountType.checking: return "Checking" - case STPPaymentMethodUSBankAccountType.unknown: return "Unknown" - } - } - return "Unknown" - } - - class func mapToUSBankAccountType(type: String?) -> STPPaymentMethodUSBankAccountType { - switch type { - case "Savings": return STPPaymentMethodUSBankAccountType.savings - case "Checking": return STPPaymentMethodUSBankAccountType.checking - default: return STPPaymentMethodUSBankAccountType.checking - } - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentMethodFactory.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentMethodFactory.swift deleted file mode 100644 index 753928ccf4e2af..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentMethodFactory.swift +++ /dev/null @@ -1,422 +0,0 @@ -import Foundation -import Stripe - -class PaymentMethodFactory { - var billingDetailsParams: STPPaymentMethodBillingDetails? = nil - var paymentMethodData: NSDictionary? = nil - var paymentMethodOptions: NSDictionary? = nil - var cardFieldView: CardFieldView? = nil - var cardFormView: CardFormView? = nil - - init(paymentMethodData: NSDictionary?, options: NSDictionary, cardFieldView: CardFieldView?, cardFormView: CardFormView?) { - self.paymentMethodData = paymentMethodData - self.billingDetailsParams = Mappers.mapToBillingDetails(billingDetails: paymentMethodData?["billingDetails"] as? NSDictionary) - self.paymentMethodOptions = options - self.cardFieldView = cardFieldView - self.cardFormView = cardFormView - } - - func createParams(paymentMethodType: STPPaymentMethodType) throws -> STPPaymentMethodParams? { - do { - switch paymentMethodType { - case STPPaymentMethodType.iDEAL: - return try createIDEALPaymentMethodParams() - case STPPaymentMethodType.OXXO: - return try createOXXOPaymentMethodParams() - case STPPaymentMethodType.card: - return try createCardPaymentMethodParams() - case STPPaymentMethodType.FPX: - return try createFPXPaymentMethodParams() - case STPPaymentMethodType.alipay: - return try createAlipayPaymentMethodParams() - case STPPaymentMethodType.sofort: - return try createSofortPaymentMethodParams() - case STPPaymentMethodType.bancontact: - return try createBancontactPaymentMethodParams() - case STPPaymentMethodType.SEPADebit: - return try createSepaPaymentMethodParams() - case STPPaymentMethodType.giropay: - return try createGiropayPaymentMethodParams() - case STPPaymentMethodType.EPS: - return try createEPSPaymentMethodParams() - case STPPaymentMethodType.grabPay: - return createGrabpayPaymentMethodParams() - case STPPaymentMethodType.przelewy24: - return try createP24PaymentMethodParams() - case STPPaymentMethodType.AUBECSDebit: - return try createBECSDebitPaymentMethodParams() - case STPPaymentMethodType.afterpayClearpay: - return try createAfterpayClearpayPaymentMethodParams() - case STPPaymentMethodType.klarna: - return try createKlarnaPaymentMethodParams() - case STPPaymentMethodType.USBankAccount: - return try createUSBankAccountPaymentMethodParams() - case STPPaymentMethodType.payPal: - return try createPayPalPaymentMethodParams() -// case STPPaymentMethodType.weChatPay: -// return try createWeChatPayPaymentMethodParams() - default: - throw PaymentMethodError.paymentNotSupported - } - } catch { - throw error - } - } - - func createOptions(paymentMethodType: STPPaymentMethodType) throws -> STPConfirmPaymentMethodOptions? { - do { - switch paymentMethodType { - case STPPaymentMethodType.iDEAL: - return nil - case STPPaymentMethodType.EPS: - return nil - case STPPaymentMethodType.card: - return createCardPaymentMethodOptions() - case STPPaymentMethodType.FPX: - return nil - case STPPaymentMethodType.sofort: - return nil - case STPPaymentMethodType.alipay: - return try createAlipayPaymentMethodOptions() - case STPPaymentMethodType.bancontact: - return nil - case STPPaymentMethodType.SEPADebit: - return nil - case STPPaymentMethodType.OXXO: - return nil - case STPPaymentMethodType.giropay: - return nil - case STPPaymentMethodType.grabPay: - return nil - case STPPaymentMethodType.przelewy24: - return nil - case STPPaymentMethodType.AUBECSDebit: - return nil - case STPPaymentMethodType.afterpayClearpay: - return nil - case STPPaymentMethodType.klarna: - return nil - case STPPaymentMethodType.weChatPay: - return try createWeChatPayPaymentMethodOptions() - case STPPaymentMethodType.USBankAccount: - return try createUSBankAccountPaymentMethodOptions() - case STPPaymentMethodType.payPal: - return nil - default: - throw PaymentMethodError.paymentNotSupported - } - } catch { - throw error - } - } - -// private func createWeChatPayPaymentMethodParams() throws -> STPPaymentMethodParams { -// let params = STPPaymentMethodWeChatPayParams() -// return STPPaymentMethodParams(weChatPay: params, billingDetails: billingDetailsParams, metadata: nil) -// } -// - - private func createUSBankAccountPaymentMethodOptions() throws -> STPConfirmPaymentMethodOptions { - let paymentOptions = STPConfirmPaymentMethodOptions() - if let usage = self.paymentMethodOptions?["setupFutureUsage"] as? String { - paymentOptions.usBankAccountOptions = STPConfirmUSBankAccountOptions(setupFutureUsage: Mappers.mapToPaymentIntentFutureUsage(usage: usage)) - } - - return paymentOptions - } - - private func createWeChatPayPaymentMethodOptions() throws -> STPConfirmPaymentMethodOptions { - guard let appId = self.paymentMethodData?["appId"] as? String else { - throw PaymentMethodError.weChatPayPaymentMissingParams - } - let paymentOptions = STPConfirmPaymentMethodOptions() - paymentOptions.weChatPayOptions = STPConfirmWeChatPayOptions(appId: appId) - - return paymentOptions - } - - private func createIDEALPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodiDEALParams() - if let bankName = self.paymentMethodData?["bankName"] as? String { - params.bankName = bankName - } - - - return STPPaymentMethodParams(iDEAL: params, billingDetails: billingDetailsParams, metadata: nil) - } - - private func createGrabpayPaymentMethodParams() -> STPPaymentMethodParams { - let params = STPPaymentMethodGrabPayParams() - - return STPPaymentMethodParams(grabPay: params, billingDetails: billingDetailsParams, metadata: nil) - } - - private func createCardPaymentMethodParams() throws -> STPPaymentMethodParams { - if let token = paymentMethodData?["token"] as? String { - let methodParams = STPPaymentMethodCardParams() - methodParams.token = ABI46_0_0RCTConvert.nsString(token) - return STPPaymentMethodParams(card: methodParams, billingDetails: billingDetailsParams, metadata: nil) - } - - guard let cardParams = cardFieldView?.cardParams ?? cardFormView?.cardParams else { - throw PaymentMethodError.cardPaymentMissingParams - } - - if cardFieldView?.cardParams != nil { - if let postalCode = cardFieldView?.cardPostalCode{ - if (billingDetailsParams == nil) { - let bd = STPPaymentMethodBillingDetails() - bd.address = STPPaymentMethodAddress() - bd.address?.postalCode = postalCode - billingDetailsParams = bd - } else { - billingDetailsParams?.address?.postalCode = postalCode - } - } - } - if cardFormView?.cardParams != nil { - if let address = cardFormView?.cardForm?.cardParams?.billingDetails?.address { - if (billingDetailsParams == nil) { - let bd = STPPaymentMethodBillingDetails() - bd.address = STPPaymentMethodAddress() - bd.address?.postalCode = address.postalCode - bd.address?.country = address.country - billingDetailsParams = bd - } else { - billingDetailsParams?.address?.postalCode = address.postalCode - billingDetailsParams?.address?.country = address.country - } - } - } - - return STPPaymentMethodParams(card: cardParams, billingDetails: billingDetailsParams, metadata: nil) - } - - - private func createCardPaymentMethodOptions() -> STPConfirmPaymentMethodOptions? { - let cvc = paymentMethodData?["cvc"] as? String - guard cvc != nil else { - return nil - } - - let cardOptions = STPConfirmCardOptions() - cardOptions.cvc = cvc; - let paymentMethodOptions = STPConfirmPaymentMethodOptions() - paymentMethodOptions.cardOptions = cardOptions - - return paymentMethodOptions - } - - private func createFPXPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodFPXParams() - - if self.paymentMethodData?["testOfflineBank"] as? Bool == true { - params.rawBankString = "test_offline_bank" - } - - return STPPaymentMethodParams(fpx: params, billingDetails: billingDetailsParams, metadata: nil) - } - - private func createAlipayPaymentMethodParams() throws -> STPPaymentMethodParams { - return STPPaymentMethodParams(alipay: STPPaymentMethodAlipayParams(), billingDetails: billingDetailsParams, metadata: nil) - } - - private func createP24PaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodPrzelewy24Params() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.p24PaymentMissingParams - } - - return STPPaymentMethodParams(przelewy24: params, billingDetails: billingDetails, metadata: nil) - } - - private func createAlipayPaymentMethodOptions() throws -> STPConfirmPaymentMethodOptions { - let options = STPConfirmPaymentMethodOptions() - options.alipayOptions = STPConfirmAlipayOptions() - return options - } - - private func createSofortPaymentMethodParams() throws -> STPPaymentMethodParams { - guard let country = self.paymentMethodData?["country"] as? String else { - throw PaymentMethodError.sofortPaymentMissingParams - } - let params = STPPaymentMethodSofortParams() - params.country = country - - return STPPaymentMethodParams(sofort: params, billingDetails: billingDetailsParams, metadata: nil) - } - - private func createBancontactPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodBancontactParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.bancontactPaymentMissingParams - } - - return STPPaymentMethodParams(bancontact: params, billingDetails: billingDetails, metadata: nil) - } - - private func createSepaPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodSEPADebitParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.sepaPaymentMissingParams - } - guard let iban = self.paymentMethodData?["iban"] as? String else { - throw PaymentMethodError.sepaPaymentMissingParams - } - - params.iban = iban - - return STPPaymentMethodParams(sepaDebit: params, billingDetails: billingDetails, metadata: nil) - } - - private func createOXXOPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodOXXOParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.bancontactPaymentMissingParams - } - - return STPPaymentMethodParams(oxxo: params, billingDetails: billingDetails, metadata: nil) - } - - private func createGiropayPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodGiropayParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.giropayPaymentMissingParams - } - - return STPPaymentMethodParams(giropay: params, billingDetails: billingDetails, metadata: nil) - } - - private func createEPSPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodEPSParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.epsPaymentMissingParams - } - - return STPPaymentMethodParams(eps: params, billingDetails: billingDetails, metadata: nil) - } - - private func createBECSDebitPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodAUBECSDebitParams() - - let billingDetails = STPPaymentMethodBillingDetails() - let formDetails = self.paymentMethodData?["formDetails"] as? NSDictionary - - billingDetails.name = formDetails?["name"] as? String - billingDetails.email = formDetails?["email"] as? String - params.accountNumber = formDetails?["accountNumber"] as? String - params.bsbNumber = formDetails?["bsbNumber"] as? String - - return STPPaymentMethodParams(aubecsDebit: params, billingDetails: billingDetails, metadata: nil) - } - - private func createAfterpayClearpayPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodAfterpayClearpayParams() - - guard let billingDetails = billingDetailsParams else { - throw PaymentMethodError.afterpayClearpayPaymentMissingParams - } - - return STPPaymentMethodParams(afterpayClearpay: params, billingDetails: billingDetails, metadata: nil) - } - - private func createKlarnaPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodKlarnaParams() - - if let billingDetails = billingDetailsParams, billingDetails.address?.country != nil, billingDetails.email != nil { - return STPPaymentMethodParams(klarna: params, billingDetails: billingDetails, metadata: nil) - } else { - throw PaymentMethodError.klarnaPaymentMissingParams - } - } - - private func createUSBankAccountPaymentMethodParams() throws -> STPPaymentMethodParams { - let params = STPPaymentMethodUSBankAccountParams() - - guard let accountNumber = self.paymentMethodData?["accountNumber"] as? String else { - throw PaymentMethodError.usBankAccountPaymentMissingAccountNumber - } - guard let routingNumber = self.paymentMethodData?["routingNumber"] as? String else { - throw PaymentMethodError.usBankAccountPaymentMissingRoutingNumber - } - - params.accountNumber = accountNumber - params.routingNumber = routingNumber - params.accountHolderType = Mappers.mapToUSBankAccountHolderType(type: self.paymentMethodData?["accountHolderType"] as? String) - params.accountType = Mappers.mapToUSBankAccountType(type: self.paymentMethodData?["accountType"] as? String) - - if let billingDetails = billingDetailsParams, billingDetails.name != nil { - return STPPaymentMethodParams(usBankAccount: params, billingDetails: billingDetails, metadata: nil) - } else { - throw PaymentMethodError.usBankAccountPaymentMissingParams - } - } - - private func createPayPalPaymentMethodParams() throws -> STPPaymentMethodParams { - return STPPaymentMethodParams(payPal: STPPaymentMethodPayPalParams(), billingDetails: billingDetailsParams, metadata: nil) - } -} - -enum PaymentMethodError: Error { - case cardPaymentMissingParams - case epsPaymentMissingParams - case idealPaymentMissingParams - case paymentNotSupported - case sofortPaymentMissingParams - case cardPaymentOptionsMissingParams - case bancontactPaymentMissingParams - case sepaPaymentMissingParams - case giropayPaymentMissingParams - case p24PaymentMissingParams - case afterpayClearpayPaymentMissingParams - case klarnaPaymentMissingParams - case weChatPayPaymentMissingParams - case usBankAccountPaymentMissingParams - case usBankAccountPaymentMissingAccountNumber - case usBankAccountPaymentMissingRoutingNumber -} - -extension PaymentMethodError: LocalizedError { - public var errorDescription: String? { - switch self { - case .cardPaymentMissingParams: - return NSLocalizedString("Card details not complete", comment: "Create payment error") - case .giropayPaymentMissingParams: - return NSLocalizedString("You must provide billing details", comment: "Create payment error") - case .idealPaymentMissingParams: - return NSLocalizedString("You must provide bank name", comment: "Create payment error") - case .sofortPaymentMissingParams: - return NSLocalizedString("You must provide bank account country", comment: "Create payment error") - case .p24PaymentMissingParams: - return NSLocalizedString("You must provide billing details", comment: "Create payment error") - case .bancontactPaymentMissingParams: - return NSLocalizedString("You must provide billing details", comment: "Create payment error") - case .sepaPaymentMissingParams: - return NSLocalizedString("You must provide billing details and IBAN", comment: "Create payment error") - case .epsPaymentMissingParams: - return NSLocalizedString("You must provide billing details", comment: "Create payment error") - case .afterpayClearpayPaymentMissingParams: - return NSLocalizedString("You must provide billing details", comment: "Create payment error") - case .paymentNotSupported: - return NSLocalizedString("This payment type is not supported yet", comment: "Create payment error") - case .cardPaymentOptionsMissingParams: - return NSLocalizedString("You must provide CVC number", comment: "Create payment error") - case .weChatPayPaymentMissingParams: - return NSLocalizedString("You must provide appId", comment: "Create payment error") - case .klarnaPaymentMissingParams: - return NSLocalizedString("Klarna requires that you provide the following billing details: email, country", comment: "Create payment error") - case .usBankAccountPaymentMissingParams: - return NSLocalizedString("When creating a US bank account payment method, you must provide the following billing details: name", comment: "Create payment error") - case .usBankAccountPaymentMissingAccountNumber: - return NSLocalizedString("When creating a US bank account payment method, you must provide the bank account number", comment: "Create payment error") - case .usBankAccountPaymentMissingRoutingNumber: - return NSLocalizedString("When creating a US bank account payment method, you must provide the bank routing number", comment: "Create payment error") - } - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentSheetAppearance.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentSheetAppearance.swift deleted file mode 100644 index f7fde9c72e2ee3..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/PaymentSheetAppearance.swift +++ /dev/null @@ -1,210 +0,0 @@ -// -// PaymentSheetAppearance.swift -// stripe-react-native -// -// Created by Charles Cruzan on 5/11/22. -// -import Stripe -import StripePaymentSheet - -extension StripeSdk { - func buildPaymentSheetAppearance(userParams: NSDictionary) throws -> PaymentSheet.Appearance { - var appearance = PaymentSheet.Appearance() - - if let fontParams = userParams[PaymentSheetAppearanceKeys.FONT] as? NSDictionary { - appearance.font = try buildFont(params: fontParams) - } - if let colorParams = userParams[PaymentSheetAppearanceKeys.COLORS] as? NSDictionary { - appearance.colors = try buildColors(params: colorParams) - } - if let shapeParams = userParams[PaymentSheetAppearanceKeys.SHAPES] as? NSDictionary { - appearance.cornerRadius = shapeParams[PaymentSheetAppearanceKeys.BORDER_RADIUS] as? CGFloat ?? PaymentSheet.Appearance.default.cornerRadius - appearance.borderWidth = shapeParams[PaymentSheetAppearanceKeys.BORDER_WIDTH] as? CGFloat ?? PaymentSheet.Appearance.default.borderWidth - if let shadowParams = shapeParams[PaymentSheetAppearanceKeys.SHADOW] as? NSDictionary { - appearance.shadow = try buildShadow(params: shadowParams) - } - } - if let primaryButtonParams = userParams[PaymentSheetAppearanceKeys.PRIMARY_BUTTON] as? NSDictionary { - appearance.primaryButton = try buildPrimaryButton(params: primaryButtonParams) - } - - return appearance - } - - private func buildFont(params: NSDictionary) throws -> PaymentSheet.Appearance.Font { - var font = PaymentSheet.Appearance.Font() - if let fontName = params[PaymentSheetAppearanceKeys.FAMILY] as? String { - guard let customFont = UIFont(name: fontName, size: UIFont.systemFontSize) else { - throw PaymentSheetAppearanceError.missingFont(fontName) - } - font.base = customFont - } - font.sizeScaleFactor = params[PaymentSheetAppearanceKeys.SCALE] as? CGFloat ?? PaymentSheet.Appearance.default.font.sizeScaleFactor - return font - } - - private func buildColors(params: NSDictionary) throws -> PaymentSheet.Appearance.Colors { - var colors = PaymentSheet.Appearance.Colors() - - if (params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && params.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil || - params.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil) { - throw PaymentSheetAppearanceError.missingAppearanceMode - } - - let lightModeParams = params[PaymentSheetAppearanceKeys.LIGHT] as? NSDictionary ?? params - let darkModeParams = params[PaymentSheetAppearanceKeys.DARK] as? NSDictionary ?? params - - colors.primary = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PRIMARY, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.primary - colors.background = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.background - colors.componentBackground = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentBackground - colors.componentBorder = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_BORDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentBorder - colors.componentDivider = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_DIVIDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentDivider - colors.text = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PRIMARY_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.text - colors.textSecondary = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.SECONDARY_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.textSecondary - colors.componentText = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.COMPONENT_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentText - colors.componentPlaceholderText = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.PLACEHOLDER_TEXT, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.componentPlaceholderText - colors.icon = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.ICON, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.icon - colors.danger = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.ERROR, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.colors.danger - - return colors - } - - private func buildShadow(params: NSDictionary) throws -> PaymentSheet.Appearance.Shadow { - var shadow = PaymentSheet.Appearance.Shadow() - - if let color = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.SHADOW_COLOR, lightParams: params, darkParams: params) { - shadow.color = color - } - if let opacity = params[PaymentSheetAppearanceKeys.OPACITY] as? CGFloat { - shadow.opacity = opacity - } - if let radius = params[PaymentSheetAppearanceKeys.BLUR_RADIUS] as? CGFloat { - shadow.radius = radius - } - if let offsetParams = params[PaymentSheetAppearanceKeys.OFFSET] as? NSDictionary { - if let x = offsetParams[PaymentSheetAppearanceKeys.X] as? CGFloat, let y = offsetParams[PaymentSheetAppearanceKeys.Y] as? CGFloat { - shadow.offset = CGSize(width: x, height:-y) - } - } - - return shadow - } - - private func buildPrimaryButton(params: NSDictionary) throws -> PaymentSheet.Appearance.PrimaryButton { - var primaryButton = PaymentSheet.Appearance.PrimaryButton() - - if let fontName = (params[PaymentSheetAppearanceKeys.FONT] as? NSDictionary)?[PaymentSheetAppearanceKeys.FAMILY] as? String { - guard let customFont = UIFont(name: fontName, size: UIFont.systemFontSize) else { - throw PaymentSheetAppearanceError.missingFont(fontName) - } - primaryButton.font = customFont - } - if let shapeParams = params[PaymentSheetAppearanceKeys.SHAPES] as? NSDictionary { - if let borderRadius = shapeParams[PaymentSheetAppearanceKeys.BORDER_RADIUS] as? CGFloat { - primaryButton.cornerRadius = borderRadius - } - if let borderWidth = shapeParams[PaymentSheetAppearanceKeys.BORDER_WIDTH] as? CGFloat { - primaryButton.borderWidth = borderWidth - } - if let shadowParams = shapeParams[PaymentSheetAppearanceKeys.SHADOW] as? NSDictionary { - primaryButton.shadow = try buildShadow(params: shadowParams) - } - } - if let colorParams = params[PaymentSheetAppearanceKeys.COLORS] as? NSDictionary { - if (colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil || - colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil) { - throw PaymentSheetAppearanceError.missingAppearanceMode - } - - let lightModeParams = colorParams[PaymentSheetAppearanceKeys.LIGHT] as? NSDictionary ?? colorParams - let darkModeParams = colorParams[PaymentSheetAppearanceKeys.DARK] as? NSDictionary ?? colorParams - - primaryButton.backgroundColor = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BACKGROUND, lightParams: lightModeParams, darkParams: darkModeParams) - primaryButton.textColor = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.TEXT, lightParams: lightModeParams, darkParams: darkModeParams) - primaryButton.borderColor = try StripeSdk.buildUserInterfaceStyleAwareColor(key: PaymentSheetAppearanceKeys.BORDER, lightParams: lightModeParams, darkParams: darkModeParams) ?? PaymentSheet.Appearance.default.primaryButton.borderColor - } - - return primaryButton - } - - private static func buildUserInterfaceStyleAwareColor(key: String, lightParams: NSDictionary, darkParams: NSDictionary) throws -> UIColor? { - guard let lightHexString = lightParams[key] as? String, let darkHexString = darkParams[key] as? String else { - return nil - } - - let darkCount = darkHexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted).count - let lightCount = lightHexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted).count - if (lightCount != 6 && lightCount != 8) { - throw PaymentSheetAppearanceError.unexpectedHexStringLength(lightHexString) - } else if (darkCount != 6 && darkCount != 8) { - throw PaymentSheetAppearanceError.unexpectedHexStringLength(darkHexString) - } - - let lightColor = UIColor(hexString: lightHexString) - let darkColor = UIColor(hexString: darkHexString) - - if #available(iOS 13.0, *) { - return UIColor.init { traits in - return traits.userInterfaceStyle == .dark ? darkColor : lightColor - } - } else { - return lightColor - } - } -} - -enum PaymentSheetAppearanceError : Error { - case missingFont(String) - case missingAppearanceMode - case unexpectedHexStringLength(String) -} - -extension PaymentSheetAppearanceError: LocalizedError { - public var errorDescription: String? { - switch self { - case .missingFont(let fontFamily): - return NSLocalizedString("Failed to set Payment Sheet appearance. Unable to find font: \(fontFamily)", comment: "Failed to set font") - case .missingAppearanceMode: - return NSLocalizedString("Failed to set Payment Sheet appearance. When providing 'colors.light' or 'colors.dark', you must provide both.", comment: "Failed to set colors") - case .unexpectedHexStringLength(let hexString): - return NSLocalizedString("Failed to set Payment Sheet appearance. Expected hex string of length 6 or 8, but received: \(hexString)", comment: "Failed to set color") - } - } -} - -private struct PaymentSheetAppearanceKeys { - static let COLORS = "colors" - static let LIGHT = "light" - static let DARK = "dark" - static let PRIMARY = "primary" - static let BACKGROUND = "background" - static let COMPONENT_BACKGROUND = "componentBackground" - static let COMPONENT_BORDER = "componentBorder" - static let COMPONENT_DIVIDER = "componentDivider" - static let COMPONENT_TEXT = "componentText" - static let PRIMARY_TEXT = "primaryText" - static let SECONDARY_TEXT = "secondaryText" - static let PLACEHOLDER_TEXT = "placeholderText" - static let ICON = "icon" - static let ERROR = "error" - - static let FONT = "font" - static let FAMILY = "family" - static let SCALE = "scale" - - static let SHAPES = "shapes" - static let BORDER_RADIUS = "borderRadius" - static let BORDER_WIDTH = "borderWidth" - - static let SHADOW = "shadow" - static let SHADOW_COLOR = "color" - static let OPACITY = "opacity" - static let OFFSET = "offset" - static let BLUR_RADIUS = "blurRadius" - static let X = "x" - static let Y = "y" - - static let PRIMARY_BUTTON = "primaryButton" - static let TEXT = "text" - static let BORDER = "border" -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.m deleted file mode 100644 index 7d41599d4d028d..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.m +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import -#import -#import "ABI46_0_0React/ABI46_0_0RCTUIManager.h" - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(StripeContainerManager, ABI46_0_0StripeContainerManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(keyboardShouldPersistTaps, BOOL) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.swift deleted file mode 100644 index 925a8c675a2395..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerManager.swift +++ /dev/null @@ -1,12 +0,0 @@ -import Foundation - -@objc(ABI46_0_0StripeContainerManager) -class StripeContainerManager: ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return StripeContainerView() - } - - override class func requiresMainQueueSetup() -> Bool { - return false - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerView.swift deleted file mode 100644 index 5909761db2c7af..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeContainerView.swift +++ /dev/null @@ -1,38 +0,0 @@ -import Foundation -import UIKit - -class StripeContainerView: UIView { - var tapRecognizer: UITapGestureRecognizer? = nil - - @objc var keyboardShouldPersistTaps: Bool = true { - didSet { - if (keyboardShouldPersistTaps == true) { - removeListener() - } else { - setListener() - } - } - } - - override init(frame: CGRect) { - super.init(frame: frame) - } - - func setListener() { - tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(endEditing(_:))) - - tapRecognizer!.cancelsTouchesInView = false - self.addGestureRecognizer(tapRecognizer!) - } - - func removeListener() { - if let tapRecognizer = self.tapRecognizer { - self.removeGestureRecognizer(tapRecognizer) - } - self.tapRecognizer = nil - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk-Bridging-Header.h b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk-Bridging-Header.h deleted file mode 100644 index 2c98df68df228c..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk-Bridging-Header.h +++ /dev/null @@ -1,7 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.m deleted file mode 100644 index 0eb8ce266031e7..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.m +++ /dev/null @@ -1,130 +0,0 @@ -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(StripeSdk, ABI46_0_0StripeSdk, ABI46_0_0RCTEventEmitter) - - -ABI46_0_0RCT_EXTERN_METHOD( - initialise:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - isApplePaySupported: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - createToken: (NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - presentApplePay:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - openApplePaySetup: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - updateApplePaySummaryItems:(NSArray *)summaryItems - errorAddressFields: (NSArray *)errorAddressFields - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - createTokenForCVCUpdate:(NSString *)cvc - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - handleURLCallback:(NSString *)url - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject) - -ABI46_0_0RCT_EXTERN_METHOD( - confirmApplePayPayment:(NSString *)clientSecret - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - createPaymentMethod:(NSDictionary *)data - options:(NSDictionary *)options - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - retrievePaymentIntent:(NSString *)clientSecret - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - retrieveSetupIntent:(NSString *)clientSecret - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - handleNextAction:(NSString *)paymentIntentClientSecret - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - initPaymentSheet:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - presentPaymentSheet:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - confirmPaymentSheetPayment:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - confirmPayment:(NSString *)paymentIntentClientSecret - data:(NSDictionary *)data - options:(NSDictionary *)options - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - confirmSetupIntent:(NSString *)setupIntentClientSecret - data:(NSDictionary *)data - options:(NSDictionary *)options - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -ABI46_0_0RCT_EXTERN_METHOD( - verifyMicrodeposits:(BOOL)isPaymentIntent - clientSecret:(NSString *)clientSecret - params:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) -ABI46_0_0RCT_EXTERN_METHOD( - collectBankAccount:(BOOL)isPaymentIntent - clientSecret:(NSString *)clientSecret - params:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) -ABI46_0_0RCT_EXTERN_METHOD( - isCardInWallet:(NSDictionary *)params - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter: (ABI46_0_0RCTPromiseRejectBlock)reject - ) - -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.swift deleted file mode 100644 index fab72bd54045f6..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/StripeSdk.swift +++ /dev/null @@ -1,1105 +0,0 @@ -import PassKit -import Stripe -import StripePaymentSheet - -@objc(ABI46_0_0StripeSdk) -class StripeSdk: ABI46_0_0RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionViewControllerDelegate, UIAdaptivePresentationControllerDelegate { - public var cardFieldView: CardFieldView? = nil - public var cardFormView: CardFormView? = nil - - var merchantIdentifier: String? = nil - - private var paymentSheet: PaymentSheet? - private var paymentSheetFlowController: PaymentSheet.FlowController? - - var urlScheme: String? = nil - - var applePayCompletionCallback: STPIntentClientSecretCompletionBlock? = nil - var applePayRequestResolver: ABI46_0_0RCTPromiseResolveBlock? = nil - var applePayRequestRejecter: ABI46_0_0RCTPromiseRejectBlock? = nil - var applePayCompletionRejecter: ABI46_0_0RCTPromiseRejectBlock? = nil - var confirmApplePayPaymentResolver: ABI46_0_0RCTPromiseResolveBlock? = nil - var confirmPaymentResolver: ABI46_0_0RCTPromiseResolveBlock? = nil - - var confirmPaymentClientSecret: String? = nil - - var shippingMethodUpdateHandler: ((PKPaymentRequestShippingMethodUpdate) -> Void)? = nil - var shippingContactUpdateHandler: ((PKPaymentRequestShippingContactUpdate) -> Void)? = nil - - override func supportedEvents() -> [String]! { - return ["onDidSetShippingMethod", "onDidSetShippingContact"] - } - - @objc override static func requiresMainQueueSetup() -> Bool { - return false - } - - @objc override func constantsToExport() -> [AnyHashable : Any] { - return [ - "API_VERSIONS": [ - "CORE": STPAPIClient.apiVersion, - "ISSUING": STPAPIClient.apiVersion, - ] - ] - } - - @objc(initialise:resolver:rejecter:) - func initialise(params: NSDictionary, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) -> Void { - let publishableKey = params["publishableKey"] as! String - let appInfo = params["appInfo"] as! NSDictionary - let stripeAccountId = params["stripeAccountId"] as? String - let params3ds = params["threeDSecureParams"] as? NSDictionary - let urlScheme = params["urlScheme"] as? String - let merchantIdentifier = params["merchantIdentifier"] as? String - - if let params3ds = params3ds { - configure3dSecure(params3ds) - } - - self.urlScheme = urlScheme - - STPAPIClient.shared.publishableKey = publishableKey - STPAPIClient.shared.stripeAccount = stripeAccountId - - let name = ABI46_0_0RCTConvert.nsString(appInfo["name"]) ?? "" - let partnerId = ABI46_0_0RCTConvert.nsString(appInfo["partnerId"]) ?? "" - let version = ABI46_0_0RCTConvert.nsString(appInfo["version"]) ?? "" - let url = ABI46_0_0RCTConvert.nsString(appInfo["url"]) ?? "" - - STPAPIClient.shared.appInfo = STPAppInfo(name: name, partnerId: partnerId, version: version, url: url) - self.merchantIdentifier = merchantIdentifier - resolve(NSNull()) - } - - @objc(initPaymentSheet:resolver:rejecter:) - func initPaymentSheet(params: NSDictionary, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) -> Void { - var configuration = PaymentSheet.Configuration() - self.paymentSheetFlowController = nil - - if let appearanceParams = params["appearance"] as? NSDictionary { - do { - configuration.appearance = try buildPaymentSheetAppearance(userParams: appearanceParams) - } catch { - resolve(Errors.createError(ErrorType.Failed, error.localizedDescription)) - return - } - } - - if params["applePay"] as? Bool == true { - if let merchantIdentifier = self.merchantIdentifier, let merchantCountryCode = params["merchantCountryCode"] as? String { - configuration.applePay = .init(merchantId: merchantIdentifier, - merchantCountryCode: merchantCountryCode) - } else { - resolve(Errors.createError(ErrorType.Failed, "Either merchantIdentifier or merchantCountryCode is missing")) - return - } - } - - if let merchantDisplayName = params["merchantDisplayName"] as? String { - configuration.merchantDisplayName = merchantDisplayName - } - - if let returnURL = params["returnURL"] as? String { - configuration.returnURL = returnURL - } - - if let allowsDelayedPaymentMethods = params["allowsDelayedPaymentMethods"] as? Bool { - configuration.allowsDelayedPaymentMethods = allowsDelayedPaymentMethods - } - - if let defaultBillingDetails = params["defaultBillingDetails"] as? [String: Any?] { - configuration.defaultBillingDetails.name = defaultBillingDetails["name"] as? String - configuration.defaultBillingDetails.email = defaultBillingDetails["email"] as? String - configuration.defaultBillingDetails.phone = defaultBillingDetails["phone"] as? String - - if let address = defaultBillingDetails["address"] as? [String: String] { - configuration.defaultBillingDetails.address = .init(city: address["city"], - country: address["country"], - line1: address["line1"], - line2: address["line2"], - postalCode: address["postalCode"], - state: address["state"]) - } - - } - - if let customerId = params["customerId"] as? String { - if let customerEphemeralKeySecret = params["customerEphemeralKeySecret"] as? String { - if (!Errors.isEKClientSecretValid(clientSecret: customerEphemeralKeySecret)) { - resolve(Errors.createError(ErrorType.Failed, "`customerEphemeralKeySecret` format does not match expected client secret formatting.")) - return - } - configuration.customer = .init(id: customerId, ephemeralKeySecret: customerEphemeralKeySecret) - } - } - - if #available(iOS 13.0, *) { - if let style = params["style"] as? String { - configuration.style = Mappers.mapToUserInterfaceStyle(style) - } - } - - func handlePaymentSheetFlowControllerResult(result: Result, stripeSdk: StripeSdk?) { - switch result { - case .failure(let error): - resolve(Errors.createError(ErrorType.Failed, error as NSError)) - case .success(let paymentSheetFlowController): - self.paymentSheetFlowController = paymentSheetFlowController - if let paymentOption = stripeSdk?.paymentSheetFlowController?.paymentOption { - let option: NSDictionary = [ - "label": paymentOption.label, - "image": paymentOption.image.pngData()?.base64EncodedString() ?? "" - ] - resolve(Mappers.createResult("paymentOption", option)) - } else { - resolve(Mappers.createResult("paymentOption", nil)) - } - } - } - - if let paymentIntentClientSecret = params["paymentIntentClientSecret"] as? String { - if (!Errors.isPIClientSecretValid(clientSecret: paymentIntentClientSecret)) { - resolve(Errors.createError(ErrorType.Failed, "`secret` format does not match expected client secret formatting.")) - return - } - - if params["customFlow"] as? Bool == true { - PaymentSheet.FlowController.create(paymentIntentClientSecret: paymentIntentClientSecret, - configuration: configuration) { [weak self] result in - handlePaymentSheetFlowControllerResult(result: result, stripeSdk: self) - } - } else { - self.paymentSheet = PaymentSheet(paymentIntentClientSecret: paymentIntentClientSecret, configuration: configuration) - resolve([]) - } - } else if let setupIntentClientSecret = params["setupIntentClientSecret"] as? String { - if (!Errors.isSetiClientSecretValid(clientSecret: setupIntentClientSecret)) { - resolve(Errors.createError(ErrorType.Failed, "`secret` format does not match expected client secret formatting.")) - return - } - - if params["customFlow"] as? Bool == true { - PaymentSheet.FlowController.create(setupIntentClientSecret: setupIntentClientSecret, - configuration: configuration) { [weak self] result in - handlePaymentSheetFlowControllerResult(result: result, stripeSdk: self) - } - } else { - self.paymentSheet = PaymentSheet(setupIntentClientSecret: setupIntentClientSecret, configuration: configuration) - resolve([]) - } - } else { - resolve(Errors.createError(ErrorType.Failed, "You must provide either paymentIntentClientSecret or setupIntentClientSecret")) - } - - } - - @objc(confirmPaymentSheetPayment:rejecter:) - func confirmPaymentSheetPayment(resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) -> Void { - DispatchQueue.main.async { - if (self.paymentSheetFlowController != nil) { - self.paymentSheetFlowController?.confirm(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) { paymentResult in - switch paymentResult { - case .completed: - resolve([]) - self.paymentSheetFlowController = nil - case .canceled: - resolve(Errors.createError(ErrorType.Canceled, "The payment flow has been canceled")) - case .failed(let error): - resolve(Errors.createError(ErrorType.Failed, error.localizedDescription)) - } - - } - } else { - resolve(Errors.createError(ErrorType.Failed, "No payment sheet has been initialized yet")) - } - } - } - - @objc(presentPaymentSheet:rejecter:) - func presentPaymentSheet(resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) -> Void { - - DispatchQueue.main.async { - if let paymentSheetFlowController = self.paymentSheetFlowController { - paymentSheetFlowController.presentPaymentOptions(from: - findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - ) { - if let paymentOption = self.paymentSheetFlowController?.paymentOption { - let option: NSDictionary = [ - "label": paymentOption.label, - "image": paymentOption.image.pngData()?.base64EncodedString() ?? "" - ] - resolve(Mappers.createResult("paymentOption", option)) - } else { - resolve(Errors.createError(ErrorType.Canceled, "The payment option selection flow has been canceled")) - } - } - } else if let paymentSheet = self.paymentSheet { - paymentSheet.present(from: - findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - ) { paymentResult in - switch paymentResult { - case .completed: - resolve([]) - self.paymentSheet = nil - case .canceled: - resolve(Errors.createError(ErrorType.Canceled, "The payment has been canceled")) - case .failed(let error): - resolve(Errors.createError(ErrorType.Failed, error as NSError)) - } - } - } else { - resolve(Errors.createError(ErrorType.Failed, "No payment sheet has been initialized yet")) - } - } - } - - @objc(createTokenForCVCUpdate:resolver:rejecter:) - func createTokenForCVCUpdate(cvc: String?, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - guard let cvc = cvc else { - resolve(Errors.createError(ErrorType.Failed, "You must provide CVC")) - return; - } - - STPAPIClient.shared.createToken(forCVCUpdate: cvc) { (token, error) in - if error != nil || token == nil { - resolve(Errors.createError(ErrorType.Failed, error?.localizedDescription ?? "")) - } else { - let tokenId = token?.tokenId - resolve(["tokenId": tokenId]) - } - } - } - - @objc(confirmSetupIntent:data:options:resolver:rejecter:) - func confirmSetupIntent (setupIntentClientSecret: String, params: NSDictionary, - options: NSDictionary, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - let paymentMethodData = params["paymentMethodData"] as? NSDictionary - let type = Mappers.mapToPaymentMethodType(type: params["paymentMethodType"] as? String) - guard let paymentMethodType = type else { - resolve(Errors.createError(ErrorType.Failed, "You must provide paymentMethodType.")) - return - } - - if (paymentMethodType == .payPal) { - resolve(Errors.createError(ErrorType.Failed, "PayPal is not yet supported through SetupIntents.")) - } - - var err: NSDictionary? = nil - let setupIntentParams: STPSetupIntentConfirmParams = { - // If payment method data is not supplied, assume payment method was attached through via collectBankAccount - if (paymentMethodType == .USBankAccount && paymentMethodData == nil) { - return STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret, paymentMethodType: .USBankAccount) - } else { - let parameters = STPSetupIntentConfirmParams(clientSecret: setupIntentClientSecret) - let factory = PaymentMethodFactory.init(paymentMethodData: paymentMethodData, options: options, cardFieldView: cardFieldView, cardFormView: cardFormView) - do { - let paymentMethodParams = try factory.createParams(paymentMethodType: paymentMethodType) - parameters.paymentMethodParams = paymentMethodParams - } catch { - err = Errors.createError(ErrorType.Failed, error as NSError?) - } - - return parameters - } - }() - - if (err != nil) { - resolve(err) - return - } - - if let urlScheme = urlScheme { - setupIntentParams.returnURL = Mappers.mapToReturnURL(urlScheme: urlScheme) - } - - let paymentHandler = STPPaymentHandler.shared() - paymentHandler.confirmSetupIntent(setupIntentParams, with: self) { status, setupIntent, error in - switch (status) { - case .failed: - resolve(Errors.createError(ErrorType.Failed, error)) - break - case .canceled: - if let lastError = setupIntent?.lastSetupError { - resolve(Errors.createError(ErrorType.Canceled, lastError)) - } else { - resolve(Errors.createError(ErrorType.Canceled, "The payment has been canceled")) - } - break - case .succeeded: - let intent = Mappers.mapFromSetupIntent(setupIntent: setupIntent!) - resolve(Mappers.createResult("setupIntent", intent)) - @unknown default: - resolve(Errors.createError(ErrorType.Unknown, error)) - break - } - } - } - - @objc(updateApplePaySummaryItems:errorAddressFields:resolver:rejecter:) - func updateApplePaySummaryItems(summaryItems: NSArray, errorAddressFields: [NSDictionary], resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - if (shippingMethodUpdateHandler == nil && shippingContactUpdateHandler == nil) { - resolve(Errors.createError(ErrorType.Failed, "You can use this method only after either onDidSetShippingMethod or onDidSetShippingContact events emitted")) - return - } - var paymentSummaryItems: [PKPaymentSummaryItem] = [] - if let items = summaryItems as? [[String : Any]] { - for item in items { - let label = item["label"] as? String ?? "" - let amount = NSDecimalNumber(string: item["amount"] as? String ?? "") - let type = Mappers.mapToPaymentSummaryItemType(type: item["type"] as? String) - paymentSummaryItems.append(PKPaymentSummaryItem(label: label, amount: amount, type: type)) - } - } - var shippingAddressErrors: [Error] = [] - - for item in errorAddressFields { - let field = item["field"] as! String - let message = item["message"] as? String ?? field + " error" - shippingAddressErrors.append(PKPaymentRequest.paymentShippingAddressInvalidError(withKey: field, localizedDescription: message)) - } - - shippingMethodUpdateHandler?(PKPaymentRequestShippingMethodUpdate.init(paymentSummaryItems: paymentSummaryItems)) - shippingContactUpdateHandler?(PKPaymentRequestShippingContactUpdate.init(errors: shippingAddressErrors, paymentSummaryItems: paymentSummaryItems, shippingMethods: [])) - self.shippingMethodUpdateHandler = nil - self.shippingContactUpdateHandler = nil - resolve([]) - } - - @objc(openApplePaySetup:rejecter:) - func openApplePaySetup(resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) -> Void { - let library = PKPassLibrary.init() - if (library.responds(to: #selector(PKPassLibrary.openPaymentSetup))) { - library.openPaymentSetup() - resolve([]) - } else { - resolve(Errors.createError(ErrorType.Failed, "Cannot open payment setup")) - } - } - - - func applePayContext(_ context: STPApplePayContext, didSelect shippingMethod: PKShippingMethod, handler: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void) { - self.shippingMethodUpdateHandler = handler - sendEvent(withName: "onDidSetShippingMethod", body: ["shippingMethod": Mappers.mapFromShippingMethod(shippingMethod: shippingMethod)]) - } - - func applePayContext(_ context: STPApplePayContext, didSelectShippingContact contact: PKContact, handler: @escaping (PKPaymentRequestShippingContactUpdate) -> Void) { - self.shippingContactUpdateHandler = handler - sendEvent(withName: "onDidSetShippingContact", body: ["shippingContact": Mappers.mapFromShippingContact(shippingContact: contact)]) - } - - func applePayContext(_ context: STPApplePayContext, didCreatePaymentMethod paymentMethod: STPPaymentMethod, paymentInformation: PKPayment, completion: @escaping STPIntentClientSecretCompletionBlock) { - self.applePayCompletionCallback = completion - - let address = paymentMethod.billingDetails?.address?.line1?.split(whereSeparator: \.isNewline) - if (address?.indices.contains(0) == true) { - paymentMethod.billingDetails?.address?.line1 = String(address?[0] ?? "") - } - if (address?.indices.contains(1) == true) { - paymentMethod.billingDetails?.address?.line2 = String(address?[1] ?? "") - } - - let method = Mappers.mapFromPaymentMethod(paymentMethod) - self.applePayRequestResolver?(Mappers.createResult("paymentMethod", method)) - self.applePayRequestRejecter = nil - } - - @objc(confirmApplePayPayment:resolver:rejecter:) - func confirmApplePayPayment(clientSecret: String, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - self.applePayCompletionRejecter = reject - self.confirmApplePayPaymentResolver = resolve - self.applePayCompletionCallback?(clientSecret, nil) - } - - func applePayContext(_ context: STPApplePayContext, didCompleteWith status: STPPaymentStatus, error: Error?) { - switch status { - case .success: - applePayCompletionRejecter = nil - applePayRequestRejecter = nil - confirmApplePayPaymentResolver?([]) - break - case .error: - let message = "Payment not completed" - applePayCompletionRejecter?(ErrorType.Failed, message, nil) - applePayRequestRejecter?(ErrorType.Failed, message, nil) - applePayCompletionRejecter = nil - applePayRequestRejecter = nil - break - case .userCancellation: - let message = "The payment has been canceled" - applePayCompletionRejecter?(ErrorType.Canceled, message, nil) - applePayRequestRejecter?(ErrorType.Canceled, message, nil) - applePayCompletionRejecter = nil - applePayRequestRejecter = nil - break - @unknown default: - let message = "Payment not completed" - applePayCompletionRejecter?(ErrorType.Unknown, message, nil) - applePayRequestRejecter?(ErrorType.Unknown, message, nil) - applePayCompletionRejecter = nil - applePayRequestRejecter = nil - } - } - - @objc(isApplePaySupported:rejecter:) - func isApplePaySupported(resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - let isSupported = StripeAPI.deviceSupportsApplePay() - resolve(isSupported) - } - - @objc(handleURLCallback:resolver:rejecter:) - func handleURLCallback(url: String?, resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - guard let url = url else { - resolve(false) - return; - } - let urlObj = URL(string: url) - if (urlObj == nil) { - resolve(false) - } else { - DispatchQueue.main.async { - let stripeHandled = StripeAPI.handleURLCallback(with: urlObj!) - resolve(stripeHandled) - } - } - } - - @objc(presentApplePay:resolver:rejecter:) - func presentApplePay(params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock) { - if (merchantIdentifier == nil) { - reject(ErrorType.Failed, "You must provide merchantIdentifier", nil) - return - } - - if (params["jcbEnabled"] as? Bool == true) { - StripeAPI.additionalEnabledApplePayNetworks = [.JCB] - } - - guard let summaryItems = params["cartItems"] as? NSArray else { - reject(ErrorType.Failed, "You must provide the items for purchase", nil) - return - } - guard let country = params["country"] as? String else { - reject(ErrorType.Failed, "You must provide the country", nil) - return - } - guard let currency = params["currency"] as? String else { - reject(ErrorType.Failed, "You must provide the payment currency", nil) - return - } - - self.applePayRequestResolver = resolve - self.applePayRequestRejecter = reject - - let merchantIdentifier = self.merchantIdentifier ?? "" - let paymentRequest = StripeAPI.paymentRequest(withMerchantIdentifier: merchantIdentifier, country: country, currency: currency) - - let requiredShippingAddressFields = params["requiredShippingAddressFields"] as? NSArray ?? NSArray() - let requiredBillingContactFields = params["requiredBillingContactFields"] as? NSArray ?? NSArray() - let shippingMethods = params["shippingMethods"] as? NSArray ?? NSArray() - - paymentRequest.requiredShippingContactFields = Set(requiredShippingAddressFields.map { - Mappers.mapToPKContactField(field: $0 as! String) - }) - - paymentRequest.requiredBillingContactFields = Set(requiredBillingContactFields.map { - Mappers.mapToPKContactField(field: $0 as! String) - }) - - paymentRequest.shippingMethods = Mappers.mapToShippingMethods(shippingMethods: shippingMethods) - - var paymentSummaryItems: [PKPaymentSummaryItem] = [] - - if let items = summaryItems as? [[String : Any]] { - for item in items { - let label = item["label"] as? String ?? "" - let amount = NSDecimalNumber(string: item["amount"] as? String ?? "") - let type = Mappers.mapToPaymentSummaryItemType(type: item["type"] as? String) - paymentSummaryItems.append(PKPaymentSummaryItem(label: label, amount: amount, type: type)) - } - } - - paymentRequest.paymentSummaryItems = paymentSummaryItems - if let applePayContext = STPApplePayContext(paymentRequest: paymentRequest, delegate: self) { - DispatchQueue.main.async { - applePayContext.presentApplePay(completion: nil) - } - } else { - reject(ErrorType.Failed, "Payment not completed", nil) - } - } - - func configure3dSecure(_ params: NSDictionary) { - let threeDSCustomizationSettings = STPPaymentHandler.shared().threeDSCustomizationSettings - let uiCustomization = Mappers.mapUICustomization(params) - - threeDSCustomizationSettings.uiCustomization = uiCustomization - } - - @objc(createPaymentMethod:options:resolver:rejecter:) - func createPaymentMethod( - params: NSDictionary, - options: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - let type = Mappers.mapToPaymentMethodType(type: params["paymentMethodType"] as? String) - guard let paymentMethodType = type else { - resolve(Errors.createError(ErrorType.Failed, "You must provide paymentMethodType")) - return - } - - var paymentMethodParams: STPPaymentMethodParams? - let factory = PaymentMethodFactory.init( - paymentMethodData: params["paymentMethodData"] as? NSDictionary, - options: options, - cardFieldView: cardFieldView, - cardFormView: cardFormView - ) - do { - paymentMethodParams = try factory.createParams(paymentMethodType: paymentMethodType) - } catch { - resolve(Errors.createError(ErrorType.Failed, error.localizedDescription)) - return - } - - if let paymentMethodParams = paymentMethodParams { - STPAPIClient.shared.createPaymentMethod(with: paymentMethodParams) { paymentMethod, error in - if let createError = error { - resolve(Errors.createError(ErrorType.Failed, createError.localizedDescription)) - return - } - - if let paymentMethod = paymentMethod { - let method = Mappers.mapFromPaymentMethod(paymentMethod) - resolve(Mappers.createResult("paymentMethod", method)) - } - } - } else { - resolve(Errors.createError(ErrorType.Unknown, "Unhandled error occured")) - } - } - - @objc(createToken:resolver:rejecter:) - func createToken( - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - guard let type = params["type"] as? String else { - resolve(Errors.createError(ErrorType.Failed, "type parameter is required")) - return - } - - // TODO: Consider moving this to its own class when more types are supported. - switch type { - case "BankAccount": - createTokenFromBankAccount(params: params, resolver: resolve, rejecter: reject) - case "Card": - createTokenFromCard(params: params, resolver: resolve, rejecter: reject) - case "Pii": - createTokenFromPii(params: params, resolver: resolve, rejecter: reject) - default: - resolve(Errors.createError(ErrorType.Failed, type + " type is not supported yet")) - } - } - - func createTokenFromBankAccount( - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - let accountHolderName = params["accountHolderName"] as? String - let accountHolderType = params["accountHolderType"] as? String - let accountNumber = params["accountNumber"] as? String - let country = params["country"] as? String - let currency = params["currency"] as? String - let routingNumber = params["routingNumber"] as? String - - let bankAccountParams = STPBankAccountParams() - bankAccountParams.accountHolderName = accountHolderName - bankAccountParams.accountNumber = accountNumber - bankAccountParams.country = country - bankAccountParams.currency = currency - bankAccountParams.routingNumber = routingNumber - bankAccountParams.accountHolderType = Mappers.mapToBankAccountHolderType(accountHolderType) - - - STPAPIClient.shared.createToken(withBankAccount: bankAccountParams) { token, error in - if let token = token { - resolve(Mappers.createResult("token", Mappers.mapFromToken(token: token))) - } else { - resolve(Errors.createError(ErrorType.Failed, error as NSError?)) - } - } - } - - func createTokenFromPii( - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - guard let personalId = params["personalId"] as? String else { - resolve(Errors.createError(ErrorType.Failed, "personalId parameter is required")) - return - } - - STPAPIClient.shared.createToken(withPersonalIDNumber: personalId) { token, error in - if let token = token { - resolve(Mappers.createResult("token", Mappers.mapFromToken(token: token))) - } else { - resolve(Errors.createError(ErrorType.Failed, error as NSError?)) - } - } - } - - func createTokenFromCard( - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - guard let cardParams = cardFieldView?.cardParams ?? cardFormView?.cardParams else { - resolve(Errors.createError(ErrorType.Failed, "Card details not complete")) - return - } - - let address = params["address"] as? NSDictionary - let cardSourceParams = STPCardParams() - cardSourceParams.number = cardParams.number - cardSourceParams.cvc = cardParams.cvc - cardSourceParams.expMonth = UInt(truncating: cardParams.expMonth ?? 0) - cardSourceParams.expYear = UInt(truncating: cardParams.expYear ?? 0) - cardSourceParams.address = Mappers.mapToAddress(address: address) - cardSourceParams.name = params["name"] as? String - cardSourceParams.currency = params["currency"] as? String - - STPAPIClient.shared.createToken(withCard: cardSourceParams) { token, error in - if let token = token { - resolve(Mappers.createResult("token", Mappers.mapFromToken(token: token))) - } else { - resolve(Errors.createError(ErrorType.Failed, error as NSError?)) - } - } - } - - @objc(handleNextAction:resolver:rejecter:) - func handleNextAction( - paymentIntentClientSecret: String, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ){ - let paymentHandler = STPPaymentHandler.shared() - paymentHandler.handleNextAction(forPayment: paymentIntentClientSecret, with: self, returnURL: nil) { status, paymentIntent, handleActionError in - switch (status) { - case .failed: - resolve(Errors.createError(ErrorType.Failed, handleActionError)) - break - case .canceled: - if let lastError = paymentIntent?.lastPaymentError { - resolve(Errors.createError(ErrorType.Canceled, lastError)) - } else { - resolve(Errors.createError(ErrorType.Canceled, "The payment has been canceled")) - } - break - case .succeeded: - if let paymentIntent = paymentIntent { - resolve(Mappers.createResult("paymentIntent", Mappers.mapFromPaymentIntent(paymentIntent: paymentIntent))) - } - break - @unknown default: - resolve(Errors.createError(ErrorType.Unknown, "Cannot complete payment")) - break - } - } - } - - @objc(collectBankAccount:clientSecret:params:resolver:rejecter:) - func collectBankAccount( - isPaymentIntent: Bool, - clientSecret: NSString, - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - let paymentMethodData = params["paymentMethodData"] as? NSDictionary - let type = Mappers.mapToPaymentMethodType(type: params["paymentMethodType"] as? String) - if (type != STPPaymentMethodType.USBankAccount) { - resolve(Errors.createError(ErrorType.Failed, "collectBankAccount currently only accepts the USBankAccount payment method type.")) - return - } - - guard let billingDetails = paymentMethodData?["billingDetails"] as? [String: Any?], let name = billingDetails["name"] as? String else { - resolve(Errors.createError(ErrorType.Failed, "You must provide a name when collecting US bank account details.")) - return - } - - if (name.isEmpty) { - resolve(Errors.createError(ErrorType.Failed, "You must provide a name when collecting US bank account details.")) - return - } - - let collectParams = STPCollectBankAccountParams.collectUSBankAccountParams( - with: name, - email: billingDetails["email"] as? String - ) - - if (isPaymentIntent) { - DispatchQueue.main.async { - STPBankAccountCollector().collectBankAccountForPayment( - clientSecret: clientSecret as String, - params: collectParams, - from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - ) { intent, error in - if let error = error { - resolve(Errors.createError(ErrorType.Failed, error as NSError)) - return - } - - if let intent = intent { - if (intent.status == .requiresPaymentMethod) { - resolve(Errors.createError(ErrorType.Canceled, "Bank account collection was canceled.")) - } - resolve( - Mappers.createResult("paymentIntent", Mappers.mapFromPaymentIntent(paymentIntent: intent)) - ) - } else { - resolve(Errors.createError(ErrorType.Unknown, "There was unexpected error while collecting bank account information.")) - } - } - } - } else { - DispatchQueue.main.async { - STPBankAccountCollector().collectBankAccountForSetup( - clientSecret: clientSecret as String, - params: collectParams, - from: findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - ) { intent, error in - if let error = error { - resolve(Errors.createError(ErrorType.Failed, error as NSError)) - return - } - - if let intent = intent { - if (intent.status == .requiresPaymentMethod) { - resolve(Errors.createError(ErrorType.Canceled, "Bank account collection was canceled.")) - } - resolve( - Mappers.createResult("setupIntent", Mappers.mapFromSetupIntent(setupIntent: intent)) - ) - } else { - resolve(Errors.createError(ErrorType.Unknown, "There was unexpected error while collecting bank account information.")) - } - } - } - } - } - - @objc(confirmPayment:data:options:resolver:rejecter:) - func confirmPayment( - paymentIntentClientSecret: String, - params: NSDictionary, - options: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - self.confirmPaymentResolver = resolve - self.confirmPaymentClientSecret = paymentIntentClientSecret - - let paymentMethodData = params["paymentMethodData"] as? NSDictionary - let type = Mappers.mapToPaymentMethodType(type: params["paymentMethodType"] as? String) - guard let paymentMethodType = type else { - resolve(Errors.createError(ErrorType.Failed, "You must provide paymentMethodType")) - return - } - - if (paymentMethodType == .FPX) { - let testOfflineBank = paymentMethodData?["testOfflineBank"] as? Bool - if (testOfflineBank == false || testOfflineBank == nil) { - payWithFPX(paymentIntentClientSecret) - return - } - } - - let (error, paymentIntentParams) = createPaymentIntentParams(paymentIntentClientSecret: paymentIntentClientSecret, paymentMethodType: paymentMethodType, paymentMethodData: paymentMethodData, options: options) - - if (error != nil) { - resolve(error) - } else { - STPPaymentHandler.shared().confirmPayment(paymentIntentParams, with: self, completion: onCompleteConfirmPayment) - } - } - - func createPaymentIntentParams( - paymentIntentClientSecret: String, - paymentMethodType: STPPaymentMethodType, - paymentMethodData: NSDictionary?, - options: NSDictionary - ) -> (NSDictionary?, STPPaymentIntentParams) { - let factory = PaymentMethodFactory.init(paymentMethodData: paymentMethodData, options: options, cardFieldView: cardFieldView, cardFormView: cardFormView) - var err: NSDictionary? = nil - - let paymentIntentParams: STPPaymentIntentParams = { - // If payment method data is not supplied, assume payment method was attached through via collectBankAccount - if (paymentMethodType == .USBankAccount && paymentMethodData == nil) { - return STPPaymentIntentParams(clientSecret: paymentIntentClientSecret, paymentMethodType: .USBankAccount) - } else { - let paymentMethodId = paymentMethodData?["paymentMethodId"] as? String - let parameters = STPPaymentIntentParams(clientSecret: paymentIntentClientSecret) - - if paymentMethodId != nil { - parameters.paymentMethodId = paymentMethodId - } else { - do { - let paymentMethodParams = try factory.createParams(paymentMethodType: paymentMethodType) - let paymentMethodOptions = try factory.createOptions(paymentMethodType: paymentMethodType) - parameters.paymentMethodParams = paymentMethodParams - parameters.paymentMethodOptions = paymentMethodOptions - } catch { - err = Errors.createError(ErrorType.Failed, error as NSError?) - } - } - return parameters - } - }() - - if let setupFutureUsage = options["setupFutureUsage"] as? String { - paymentIntentParams.setupFutureUsage = Mappers.mapToPaymentIntentFutureUsage(usage: setupFutureUsage) - } - if let urlScheme = urlScheme { - paymentIntentParams.returnURL = Mappers.mapToReturnURL(urlScheme: urlScheme) - } - paymentIntentParams.shipping = Mappers.mapToShippingDetails(shippingDetails: paymentMethodData?["shippingDetails"] as? NSDictionary) - - return (err, paymentIntentParams) - } - - @objc(retrievePaymentIntent:resolver:rejecter:) - func retrievePaymentIntent( - clientSecret: String, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - STPAPIClient.shared.retrievePaymentIntent(withClientSecret: clientSecret) { (paymentIntent, error) in - guard error == nil else { - if let lastPaymentError = paymentIntent?.lastPaymentError { - resolve(Errors.createError(ErrorType.Unknown, lastPaymentError)) - } else { - resolve(Errors.createError(ErrorType.Unknown, error?.localizedDescription)) - } - - return - } - - if let paymentIntent = paymentIntent { - resolve(Mappers.createResult("paymentIntent", Mappers.mapFromPaymentIntent(paymentIntent: paymentIntent))) - } else { - resolve(Errors.createError(ErrorType.Unknown, "Failed to retrieve the PaymentIntent")) - } - } - } - - @objc(retrieveSetupIntent:resolver:rejecter:) - func retrieveSetupIntent( - clientSecret: String, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - STPAPIClient.shared.retrieveSetupIntent(withClientSecret: clientSecret) { (setupIntent, error) in - guard error == nil else { - if let lastSetupError = setupIntent?.lastSetupError { - resolve(Errors.createError(ErrorType.Unknown, lastSetupError)) - } else { - resolve(Errors.createError(ErrorType.Unknown, error?.localizedDescription)) - } - - return - } - - if let setupIntent = setupIntent { - resolve(Mappers.createResult("setupIntent", Mappers.mapFromSetupIntent(setupIntent: setupIntent))) - } else { - resolve(Errors.createError(ErrorType.Unknown, "Failed to retrieve the SetupIntent")) - } - } - } - - @objc(verifyMicrodeposits:clientSecret:params:resolver:rejecter:) - func verifyMicrodeposits( - isPaymentIntent: Bool, - clientSecret: NSString, - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - let amounts = params["amounts"] as? NSArray - let descriptorCode = params["descriptorCode"] as? String - - if (amounts != nil && descriptorCode != nil || amounts == nil && descriptorCode == nil) { - resolve(Errors.createError(ErrorType.Failed, "You must provide either amounts OR descriptorCode, not both.")) - return - } - - if let amounts = amounts { - if (amounts.count != 2) { - resolve(Errors.createError(ErrorType.Failed, "Expected 2 integers in the amounts array, but received " + String(amounts.count))) - return - } - if (isPaymentIntent) { - STPAPIClient.shared.verifyPaymentIntentWithMicrodeposits( - clientSecret: clientSecret as String, - firstAmount: amounts[0] as! Int, - secondAmount: amounts[1] as! Int, - completion: onCompletePaymentVerification - ) - } else { - STPAPIClient.shared.verifySetupIntentWithMicrodeposits( - clientSecret: clientSecret as String, - firstAmount: amounts[0] as! Int, - secondAmount: amounts[1] as! Int, - completion: onCompleteSetupVerification - ) - } - } else if let descriptorCode = descriptorCode { - if (isPaymentIntent) { - STPAPIClient.shared.verifyPaymentIntentWithMicrodeposits( - clientSecret: clientSecret as String, - descriptorCode: descriptorCode, - completion: onCompletePaymentVerification - ) - } else { - STPAPIClient.shared.verifySetupIntentWithMicrodeposits( - clientSecret: clientSecret as String, - descriptorCode: descriptorCode, - completion: onCompleteSetupVerification - ) - } - } - - func onCompletePaymentVerification(intent: STPPaymentIntent?, error: Error?) { - if (error != nil) { - resolve(Errors.createError(ErrorType.Failed, error as NSError?)) - } else { - resolve(Mappers.createResult("paymentIntent", Mappers.mapFromPaymentIntent(paymentIntent:intent!))) - } - } - func onCompleteSetupVerification(intent: STPSetupIntent?, error: Error?) { - if (error != nil) { - resolve(Errors.createError(ErrorType.Failed, error as NSError?)) - } else { - resolve(Mappers.createResult("setupIntent", Mappers.mapFromSetupIntent(setupIntent:intent!))) - } - } - } - - @objc(isCardInWallet:resolver:rejecter:) - func isCardInWallet( - params: NSDictionary, - resolver resolve: @escaping ABI46_0_0RCTPromiseResolveBlock, - rejecter reject: @escaping ABI46_0_0RCTPromiseRejectBlock - ) -> Void { - guard let last4 = params["cardLastFour"] as? String else { - resolve(Errors.createError(ErrorType.Failed, "You must provide `cardLastFour`")) - return - } - - let existingPass: PKPass? = { - if #available(iOS 13.4, *) { - return PKPassLibrary().passes(of: PKPassType.secureElement).first(where: {$0.secureElementPass?.primaryAccountNumberSuffix == last4}) - } else { - return PKPassLibrary().passes(of: PKPassType.payment).first(where: {$0.paymentPass?.primaryAccountNumberSuffix == last4}) - } - }() - resolve(["isInWallet": existingPass != nil]) - } - - func presentationControllerDidDismiss(_ presentationController: UIPresentationController) { - confirmPaymentResolver?(Errors.createError(ErrorType.Canceled, "FPX Payment has been canceled")) - } - - func payWithFPX(_ paymentIntentClientSecret: String) { - let vc = STPBankSelectionViewController.init(bankMethod: .FPX) - - vc.delegate = self - - DispatchQueue.main.async { - vc.presentationController?.delegate = self - - let share = UIApplication.shared.delegate - share?.window??.rootViewController?.present(vc, animated: true) - } - } - - func bankSelectionViewController(_ bankViewController: STPBankSelectionViewController, didCreatePaymentMethodParams paymentMethodParams: STPPaymentMethodParams) { - guard let clientSecret = confirmPaymentClientSecret else { - confirmPaymentResolver?(Errors.createError(ErrorType.Failed, "Missing paymentIntentClientSecret")) - return - } - let paymentIntentParams = STPPaymentIntentParams(clientSecret: clientSecret) - paymentIntentParams.paymentMethodParams = paymentMethodParams - - if let urlScheme = urlScheme { - paymentIntentParams.returnURL = Mappers.mapToReturnURL(urlScheme: urlScheme) - } - let paymentHandler = STPPaymentHandler.shared() - bankViewController.dismiss(animated: true) - paymentHandler.confirmPayment(paymentIntentParams, with: self, completion: onCompleteConfirmPayment) - } - - func onCompleteConfirmPayment(status: STPPaymentHandlerActionStatus, paymentIntent: STPPaymentIntent?, error: NSError?) { - self.confirmPaymentClientSecret = nil - switch (status) { - case .failed: - confirmPaymentResolver?(Errors.createError(ErrorType.Failed, error)) - break - case .canceled: - let statusCode: String - if (paymentIntent?.status == STPPaymentIntentStatus.requiresPaymentMethod) { - statusCode = ErrorType.Failed - } else { - statusCode = ErrorType.Canceled - } - if let lastPaymentError = paymentIntent?.lastPaymentError { - confirmPaymentResolver?(Errors.createError(statusCode, lastPaymentError)) - } else { - confirmPaymentResolver?(Errors.createError(statusCode, "The payment has been canceled")) - } - break - case .succeeded: - if let paymentIntent = paymentIntent { - let intent = Mappers.mapFromPaymentIntent(paymentIntent: paymentIntent) - confirmPaymentResolver?(Mappers.createResult("paymentIntent", intent)) - } - break - @unknown default: - confirmPaymentResolver?(Errors.createError(ErrorType.Unknown, "Cannot complete the payment")) - break - } - } -} - -func findViewControllerPresenter(from uiViewController: UIViewController) -> UIViewController { - // Note: creating a UIViewController inside here results in a nil window - // This is a bit of a hack: We traverse the view hierarchy looking for the most reasonable VC to present from. - // A VC hosted within a SwiftUI cell, for example, doesn't have a parent, so we need to find the UIWindow. - var presentingViewController: UIViewController = - uiViewController.view.window?.rootViewController ?? uiViewController - - // Find the most-presented UIViewController - while let presented = presentingViewController.presentedViewController { - presentingViewController = presented - } - - return presentingViewController -} - -extension StripeSdk: STPAuthenticationContext { - func authenticationPresentingViewController() -> UIViewController { - return findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/UIColorExtension.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/UIColorExtension.swift deleted file mode 100644 index 245c683eb4bda8..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/UIColorExtension.swift +++ /dev/null @@ -1,26 +0,0 @@ -// -// UIColorExtension.swift -// CocoaAsyncSocket -// -// Created by Arkadiusz Kubaczkowski on 24/11/2020. -// - -extension UIColor { - public convenience init(hexString: String) { - let hex = hexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted) - var int = UInt64() - Scanner(string: hex).scanHexInt64(&int) - let a, r, g, b: UInt64 - switch hex.count { - case 3: // RGB (12-bit) - (a, r, g, b) = (255, (int >> 8) * 17, (int >> 4 & 0xF) * 17, (int & 0xF) * 17) - case 6: // RGB (24-bit) - (a, r, g, b) = (255, int >> 16, int >> 8 & 0xFF, int & 0xFF) - case 8: // ARGB (32-bit) - (a, r, g, b) = (int >> 24, int >> 16 & 0xFF, int >> 8 & 0xFF, int & 0xFF) - default: - (a, r, g, b) = (255, 0, 0, 0) - } - self.init(red: CGFloat(r) / 255, green: CGFloat(g) / 255, blue: CGFloat(b) / 255, alpha: CGFloat(a) / 255) - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.m b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.m deleted file mode 100644 index dc08ad6d372719..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.m +++ /dev/null @@ -1,18 +0,0 @@ -// -// AddToWalletButtonManager.m -// stripe-react-native -// -// Created by Charles Cruzan on 3/28/22. -// - -#import -#import -#import - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(AddToWalletButtonManager, ABI46_0_0AddToWalletButtonManager, ABI46_0_0RCTViewManager) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(testEnv, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(iOSButtonStyle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cardDetails, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(ephemeralKey, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCompleteAction, ABI46_0_0RCTDirectEventBlock) -@end diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.swift deleted file mode 100644 index da89f1abf0f04c..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonManager.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// AddToWalletButtonManager.swift -// stripe-react-native -// -// Created by Charles Cruzan on 3/28/22. -// - -import Foundation - -@objc(ABI46_0_0AddToWalletButtonManager) -class AddToWalletButtonManager : ABI46_0_0RCTViewManager { - override func view() -> UIView! { - return AddToWalletButtonView() - } - - override class func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonView.swift b/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonView.swift deleted file mode 100644 index cf216bf1f8616b..00000000000000 --- a/ios/vendored/sdk46/@stripe/stripe-react-native/ios/pushprovisioning/AddToWalletButtonView.swift +++ /dev/null @@ -1,145 +0,0 @@ -// -// AddToWalletButtonView.swift -// stripe-react-native -// -// Created by Charles Cruzan on 3/28/22. -// - -import Foundation -import Stripe - -@objc(ABI46_0_0AddToWalletButtonView) -class AddToWalletButtonView: UIView { - var pushProvisioningContext: STPPushProvisioningContext? = nil - var addToWalletButton: PKAddPassButton? = nil - - @objc var testEnv: Bool = false - @objc var iOSButtonStyle: NSString? - @objc var cardDetails: NSDictionary? - @objc var ephemeralKey: NSDictionary? - @objc var onCompleteAction: ABI46_0_0RCTDirectEventBlock? - - override init(frame: CGRect) { - super.init(frame: frame) - } - - required init?(coder: NSCoder) { - fatalError("init(coder:) has not been implemented") - } - - override func layoutSubviews() { - if let addToWalletButton = self.addToWalletButton { - addToWalletButton.frame = self.bounds - } - } - - func canAddPaymentPass() -> Bool { - return self.testEnv ? STPFakeAddPaymentPassViewController.canAddPaymentPass() : PKAddPaymentPassViewController.canAddPaymentPass() - } - - override func didSetProps(_ changedProps: [String]!) { - if let addToWalletButton = addToWalletButton { - addToWalletButton.removeFromSuperview() - } - - let style = Mappers.mapToPKAddPassButtonStyle(style: iOSButtonStyle as String?) - - self.addToWalletButton = PKAddPassButton.init(addPassButtonStyle: style) - - if let addToWalletButton = self.addToWalletButton { - addToWalletButton.addTarget(self, action: #selector(beginPushProvisioning), for: .touchUpInside) - self.addSubview(addToWalletButton) - } - } - - @objc func beginPushProvisioning() { - if (!canAddPaymentPass()) { - onCompleteAction!( - Errors.createError( - ErrorType.Failed, - "This app cannot add cards to Apple Pay. For information on requesting the necessary entitlement, see the Card Issuers section at developer.apple.com/apple-pay/." - ) as? [AnyHashable : Any] - ) - return - } - - guard let cardHolderName = cardDetails?["name"] as? String else { - onCompleteAction!( - Errors.createError( - ErrorType.Failed, - "Missing parameters. `cardDetails.name` must be supplied in the props to " - ) as? [AnyHashable : Any] - ) - return - } - - if (cardHolderName.isEmpty) { - onCompleteAction!( - Errors.createError( - ErrorType.Failed, - "`cardDetails.name` is required, but the passed string was empty" - ) as? [AnyHashable : Any] - ) - return - } - - let config = STPPushProvisioningContext.requestConfiguration( - withName: cardHolderName, - description: cardDetails?["description"] as? String, - last4: cardDetails?["lastFour"] as? String, - brand: Mappers.mapToCardBrand(cardDetails?["brand"] as? String), - primaryAccountIdentifier: cardDetails?["primaryAccountIdentifier"] as? String - ) - - // We can use STPFakeAddPaymentPassViewController ONLY IN TEST MODE. If STPFakeAddPaymentPassViewController is - // used with a live mode card, the flow will fail and show a 'Signing certificate was invalid' error. - let controller = { - return self.testEnv ? STPFakeAddPaymentPassViewController(requestConfiguration: config, delegate: self) : PKAddPaymentPassViewController(requestConfiguration: config, delegate: self) - }() - - let vc = findViewControllerPresenter(from: UIApplication.shared.delegate?.window??.rootViewController ?? UIViewController()) - vc.present(controller!, animated: true, completion: nil) - } -} - - -extension AddToWalletButtonView: PKAddPaymentPassViewControllerDelegate { - func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, generateRequestWithCertificateChain certificates: [Data], nonce: Data, nonceSignature: Data, completionHandler handler: @escaping (PKAddPaymentPassRequest) -> Void) { - self.pushProvisioningContext = STPPushProvisioningContext(keyProvider: self) - - self.pushProvisioningContext?.addPaymentPassViewController(controller, generateRequestWithCertificateChain: certificates, nonce: nonce, nonceSignature: nonceSignature, completionHandler: handler); - } - - func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, didFinishAdding pass: PKPaymentPass?, error: Error?) { - if let error = error as NSError? { - onCompleteAction!( - Errors.createError( - error.code == PKAddPaymentPassError.userCancelled.rawValue ? ErrorType.Canceled : ErrorType.Failed, - error as NSError? - ) as? [AnyHashable : Any] - ) - } else { - onCompleteAction!([ - "error": NSNull(), - ] as [AnyHashable : Any]) - } - controller.dismiss(animated: true, completion: nil) - } -} - - -extension AddToWalletButtonView: STPIssuingCardEphemeralKeyProvider { - func createIssuingCardKey(withAPIVersion apiVersion: String, completion: @escaping STPJSONResponseCompletionBlock) { - if let ephemeralKey = self.ephemeralKey as? [AnyHashable : Any] { - completion(ephemeralKey, nil) - } else { - onCompleteAction!( - Errors.createError( - ErrorType.Failed, - "Missing parameters. `ephemeralKey` must be supplied in the props to " - ) as? [AnyHashable : Any] - ) - completion(nil, nil) - } - } -} diff --git a/ios/vendored/sdk46/lottie-react-native/ABI46_0_0lottie-react-native.podspec.json b/ios/vendored/sdk46/lottie-react-native/ABI46_0_0lottie-react-native.podspec.json deleted file mode 100644 index f14f35201e14c7..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/ABI46_0_0lottie-react-native.podspec.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "ABI46_0_0lottie-react-native", - "version": "5.1.3", - "summary": "Lottie component for ABI46_0_0React Native (iOS and Android)", - "authors": { - "intelligibabble": "leland.m.richardson@gmail.com" - }, - "homepage": "https://github.com/airbnb/lottie-react-native#readme", - "license": "Apache-2.0", - "platforms": { - "ios": "11.0", - "osx": "10.10", - "tvos": "9.0" - }, - "source": { - "git": "https://github.com/react-community/lottie-react-native.git", - "tag": "v5.1.3" - }, - "source_files": "src/ios/**/*.{h,m,swift}", - "requires_arc": true, - "pod_target_xcconfig": { - "DEFINES_MODULE": "YES" - }, - "swift_versions": "5.0", - "dependencies": { - "ABI46_0_0React-Core": [], - "lottie-ios": [ - "~> 3.4.0" - ] - }, - "swift_version": "5.0" -} diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.h b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.h deleted file mode 100644 index faa8a1d99ca5a5..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -@interface ABI46_0_0RCTConvert (Lottie) - -+ (NSArray *)LRNColorFilters:(id)json; - -@end diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.m b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.m deleted file mode 100644 index d62a9f2bdee705..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ABI46_0_0RCTConvert+Lottie.m +++ /dev/null @@ -1,24 +0,0 @@ -#import "ABI46_0_0RCTConvert+Lottie.h" - -@implementation ABI46_0_0RCTConvert (Lottie) - -+ (NSArray *)LRNColorFilters:(id)json -{ - NSArray *rawFilters = [self NSArray:json]; - NSMutableArray *filters = [NSMutableArray arrayWithCapacity:[rawFilters count]]; - [rawFilters enumerateObjectsUsingBlock:^(NSDictionary *rawFilter, NSUInteger idx, BOOL *stop) { - NSString *keypath = rawFilter[@"keypath"]; - #if TARGET_OS_OSX - NSColor *color = [ABI46_0_0RCTConvert NSColor:rawFilter[@"color"]]; - #else - UIColor *color = [ABI46_0_0RCTConvert UIColor:rawFilter[@"color"]]; - #endif - [filters addObject:@{ - @"color": color, - @"keypath": keypath, - }]; - }]; - return filters; -} - -@end diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/AnimationViewManagerModule.swift b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/AnimationViewManagerModule.swift deleted file mode 100644 index b8f6e045786a75..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/AnimationViewManagerModule.swift +++ /dev/null @@ -1,88 +0,0 @@ -import Lottie - -#if os(OSX) -import AppKit - -typealias View = NSView - -#else -import UIKit - -typealias View = UIView - -#endif - -@objc(ABI46_0_0LottieAnimationView) -class AnimationViewManagerModule: ABI46_0_0RCTViewManager { - override func view() -> View! { - return ContainerView() - } - - @objc override func constantsToExport() -> [AnyHashable : Any]! { - return ["VERSION": 1] - } - - @objc(play:fromFrame:toFrame:) - public func play(_ abi46_0_0ReactTag: NSNumber, startFrame: NSNumber, endFrame: NSNumber) { - self.bridge.uiManager.addUIBlock { (uiManager, viewRegistry) in - guard let view = viewRegistry?[abi46_0_0ReactTag] as? ContainerView else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Invalid view returned from registry, expecting ContainerView") - } - return - } - - if (startFrame.intValue != -1 && endFrame.intValue != -1) { - view.play(fromFrame: AnimationFrameTime(truncating: startFrame), toFrame: AnimationFrameTime(truncating: endFrame)) - } else { - view.play() - } - } - } - - @objc(reset:) - public func reset(_ abi46_0_0ReactTag: NSNumber) { - self.bridge.uiManager.addUIBlock { uiManager, viewRegistry in - guard let view = viewRegistry?[abi46_0_0ReactTag] as? ContainerView else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Invalid view returned from registry, expecting ContainerView") - } - return - } - - view.reset() - } - } - - @objc(pause:) - public func pause(_ abi46_0_0ReactTag: NSNumber) { - self.bridge.uiManager.addUIBlock { uiManager, viewRegistry in - guard let view = viewRegistry?[abi46_0_0ReactTag] as? ContainerView else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Invalid view returned from registry, expecting ContainerView") - } - return - } - - view.pause() - } - } - - @objc(resume:) - public func resume(_ abi46_0_0ReactTag: NSNumber) { - self.bridge.uiManager.addUIBlock { uiManager, viewRegistry in - guard let view = viewRegistry?[abi46_0_0ReactTag] as? ContainerView else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Invalid view returned from registry, expecting ContainerView") - } - return - } - - view.resume() - } - } - - override static func requiresMainQueueSetup() -> Bool { - return true - } -} diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/Bridging.h b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/Bridging.h deleted file mode 100644 index 4df5aa6c7f46ae..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/Bridging.h +++ /dev/null @@ -1,4 +0,0 @@ -#import -#import -#import -#import diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ContainerView.swift b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ContainerView.swift deleted file mode 100644 index 05a05d5bace82f..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/ContainerView.swift +++ /dev/null @@ -1,216 +0,0 @@ -import Lottie -import Foundation - -class ContainerView: ABI46_0_0RCTView { - private var speed: CGFloat = 0.0 - private var progress: CGFloat = 0.0 - private var loop: LottieLoopMode = .playOnce - private var sourceJson: String = "" - private var resizeMode: String = "" - private var sourceName: String = "" - private var colorFilters: [NSDictionary] = [] - private var textFilters: [NSDictionary] = [] - @objc var onAnimationFinish: ABI46_0_0RCTBubblingEventBlock? - var animationView: AnimationView? - - override func traitCollectionDidChange(_ previousTraitCollection: UITraitCollection?) { - super.traitCollectionDidChange(previousTraitCollection) - if #available(iOS 13.0, *) { - if (self.traitCollection.hasDifferentColorAppearance(comparedTo: previousTraitCollection)) { - applyProperties() - print("dark mode changed") - } - } - } - - @objc func setSpeed(_ newSpeed: CGFloat) { - speed = newSpeed - - if (newSpeed != 0.0) { - animationView?.animationSpeed = newSpeed - if (!(animationView?.isAnimationPlaying ?? true)) { - animationView?.play() - } - } else if (animationView?.isAnimationPlaying ?? false) { - animationView?.pause() - } - } - - @objc func setProgress(_ newProgress: CGFloat) { - progress = newProgress - animationView?.currentProgress = progress - } - - override func abi46_0_0ReactSetFrame(_ frame: CGRect) { - super.abi46_0_0ReactSetFrame(frame) - animationView?.abi46_0_0ReactSetFrame(frame) - } - - @objc func setLoop(_ isLooping: Bool) { - loop = isLooping ? .loop : .playOnce - animationView?.loopMode = loop - } - - @objc func setTextFiltersIOS(_ newTextFilters: [NSDictionary]) { - textFilters = newTextFilters - - if (textFilters.count > 0) { - var filters = [String:String]() - for filter in textFilters { - let key = filter.value(forKey: "keypath") as! String - let value = filter.value(forKey: "text") as! String - filters[key] = value; - } - - let starAnimationView = AnimationView() - starAnimationView.textProvider = DictionaryTextProvider(filters) - starAnimationView.animation = animationView?.animation - replaceAnimationView(next: starAnimationView) - } - } - - @objc func setSourceURL(_ newSourceURLString: String) { - var url = URL(string: newSourceURLString) - - if(url?.scheme == nil) { - // interpret raw URL paths as relative to the resource bundle - url = URL(fileURLWithPath: newSourceURLString, relativeTo: Bundle.main.resourceURL) - } - - if(url != nil) { - DispatchQueue.global(qos: .default).async { - do { - let sourceJson = try String(contentsOf: url!) - guard let data = sourceJson.data(using: String.Encoding.utf8), - let animation = try? JSONDecoder().decode(Animation.self, from: data) else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Unable to decode the lottie animation object from the fetched URL source") - } - return - } - - DispatchQueue.main.async { - let starAnimationView = AnimationView() - starAnimationView.animation = animation - self.replaceAnimationView(next: starAnimationView) - self.animationView?.play() - } - } catch { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Unable to load the lottie animation URL") - } - } - } - } - } - - @objc func setSourceJson(_ newSourceJson: String) { - sourceJson = newSourceJson - - guard let data = sourceJson.data(using: String.Encoding.utf8), - let animation = try? JSONDecoder().decode(Animation.self, from: data) else { - if (ABI46_0_0RCT_DEBUG == 1) { - print("Unable to create the lottie animation object from the JSON source") - } - return - } - - let starAnimationView = AnimationView() - starAnimationView.animation = animation - replaceAnimationView(next: starAnimationView) - } - - @objc func setSourceName(_ newSourceName: String) { - if (newSourceName == sourceName) { - return - } - sourceName = newSourceName - - let starAnimationView = AnimationView(name: sourceName) - replaceAnimationView(next: starAnimationView) - } - - @objc func setResizeMode(_ resizeMode: String) { - switch (resizeMode) { - case "cover": - animationView?.contentMode = .scaleAspectFill - case "contain": - animationView?.contentMode = .scaleAspectFit - case "center": - animationView?.contentMode = .center - default: break - } - } - - @objc func setColorFilters(_ newColorFilters: [NSDictionary]) { - colorFilters = newColorFilters - applyProperties() - } - - func play(fromFrame: AnimationFrameTime? = nil, toFrame: AnimationFrameTime) { - let callback: LottieCompletionBlock = { animationFinished in - if let onFinish = self.onAnimationFinish { - onFinish(["isCancelled": !animationFinished]) - } - } - - animationView?.backgroundBehavior = .pauseAndRestore - animationView?.play(fromFrame: fromFrame, toFrame: toFrame, loopMode: self.loop, completion: callback); - } - - func play() { - let callback: LottieCompletionBlock = { animationFinished in - if let onFinish = self.onAnimationFinish { - onFinish(["isCancelled": !animationFinished]) - } - } - - animationView?.backgroundBehavior = .pauseAndRestore - animationView?.play(completion: callback) - } - - func reset() { - animationView?.currentProgress = 0; - animationView?.pause() - } - - func pause() { - animationView?.pause() - } - - func resume() { - play() - } - - // MARK: Private - - func replaceAnimationView(next: AnimationView) { - animationView?.removeFromSuperview() - - let contentMode = animationView?.contentMode ?? .scaleAspectFit - animationView = next - addSubview(next) - animationView?.contentMode = contentMode - animationView?.abi46_0_0ReactSetFrame(frame) - applyProperties() - } - - func applyProperties() { - guard let animationView = animationView else { return } - let isPlaying = animationView.isAnimationPlaying - animationView.currentProgress = progress - animationView.animationSpeed = speed - animationView.loopMode = loop - if (colorFilters.count > 0) { - for filter in colorFilters { - let keypath: String = "\(filter.value(forKey: "keypath") as! String).**.Color" - let fillKeypath = AnimationKeypath(keypath: keypath) - let colorFilterValueProvider = ColorValueProvider((filter.value(forKey: "color") as! PlatformColor).lottieColorValue) - animationView.setValueProvider(colorFilterValueProvider, keypath: fillKeypath) - } - } - if isPlaying { - resume() - } - } -} diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/LRNAnimationViewManagerObjC.m b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/LRNAnimationViewManagerObjC.m deleted file mode 100644 index db35bd2fcfae38..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/LRNAnimationViewManagerObjC.m +++ /dev/null @@ -1,24 +0,0 @@ -#import -#import "ABI46_0_0RCTConvert+Lottie.h" - -@interface ABI46_0_0RCT_EXTERN_REMAP_MODULE(LottieAnimationView, ABI46_0_0LottieAnimationView, ABI46_0_0RCTViewManager) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(resizeMode, NSString); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(sourceJson, NSString); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(sourceName, NSString); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(sourceURL, NSString); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(progress, CGFloat); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(loop, BOOL); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(speed, CGFloat); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onAnimationFinish, ABI46_0_0RCTBubblingEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(colorFilters, LRNColorFilters); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(textFiltersIOS, NSArray); - -ABI46_0_0RCT_EXTERN_METHOD(play:(nonnull NSNumber *)ABI46_0_0ReactTag fromFrame:(nonnull NSNumber *) startFrame toFrame:(nonnull NSNumber *) endFrame); - -ABI46_0_0RCT_EXTERN_METHOD(reset:(nonnull NSNumber *)ABI46_0_0ReactTag); -ABI46_0_0RCT_EXTERN_METHOD(pause:(nonnull NSNumber *)ABI46_0_0ReactTag); -ABI46_0_0RCT_EXTERN_METHOD(resume:(nonnull NSNumber *)ABI46_0_0ReactTag); - -@end - diff --git a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/PlatformColor.swift b/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/PlatformColor.swift deleted file mode 100644 index 30f219f538c0dc..00000000000000 --- a/ios/vendored/sdk46/lottie-react-native/src/ios/LottieReactNative/PlatformColor.swift +++ /dev/null @@ -1,31 +0,0 @@ -// -// PlatformColor.swift -// LottieReactNative -// -// Created by Igor Mandrigin on 2020-08-28. -// Copyright © 2020 Airbnb. All rights reserved. -// -import Lottie - -#if os(OSX) - -import AppKit - -typealias PlatformColor = NSColor - -// NSColor doesn't have this extension (UIColor receives it from Lottie), so we add it here -public extension NSColor { - var lottieColorValue: Color { - var r: CGFloat = 0, g: CGFloat = 0, b: CGFloat = 0, a: CGFloat = 0 - getRed(&r, green: &g, blue: &b, alpha: &a) - return Color(r: Double(r), g: Double(g), b: Double(b), a: Double(a)) - } -} - -#else - -import UIKit - -typealias PlatformColor = UIColor - -#endif diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ABI46_0_0RNGestureHandler.podspec.json b/ios/vendored/sdk46/react-native-gesture-handler/ABI46_0_0RNGestureHandler.podspec.json deleted file mode 100644 index a221075c871710..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ABI46_0_0RNGestureHandler.podspec.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "ABI46_0_0RNGestureHandler", - "version": "2.5.0", - "summary": "Experimental implementation of a new declarative API for gesture handling in react-native", - "homepage": "https://github.com/software-mansion/react-native-gesture-handler", - "license": "MIT", - "authors": { - "Krzysztof Magiera": "krzys.magiera@gmail.com" - }, - "source": { - "git": "https://github.com/software-mansion/react-native-gesture-handler", - "tag": "2.5.0" - }, - "source_files": "ios/**/*.{h,m,mm}", - "requires_arc": true, - "platforms": { - "ios": "9.0", - "tvos": "9.0" - }, - "dependencies": { - "ABI46_0_0React-Core": [] - } -} diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGHTouchEventType.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGHTouchEventType.h deleted file mode 100644 index 7115a6f2afe665..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGHTouchEventType.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNGHTouchEventType) { - ABI46_0_0RNGHTouchEventTypeUndetermined = 0, - ABI46_0_0RNGHTouchEventTypePointerDown, - ABI46_0_0RNGHTouchEventTypePointerMove, - ABI46_0_0RNGHTouchEventTypePointerUp, - ABI46_0_0RNGHTouchEventTypeCancelled, -}; diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.h deleted file mode 100644 index 570ed05425e68c..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.h +++ /dev/null @@ -1,83 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerActionType.h" -#import "ABI46_0_0RNGestureHandlerState.h" -#import "ABI46_0_0RNGestureHandlerDirection.h" -#import "ABI46_0_0RNGestureHandlerEvents.h" -#import "ABI46_0_0RNGestureHandlerPointerTracker.h" - -#import -#import -#import - -#define VEC_LEN_SQ(pt) (pt.x * pt.x + pt.y * pt.y) -#define TEST_MIN_IF_NOT_NAN(value, limit) \ -(!isnan(limit) && ((limit < 0 && value <= limit) || (limit >= 0 && value >= limit))) - -#define TEST_MAX_IF_NOT_NAN(value, max) \ -(!isnan(max) && ((max < 0 && value < max) || (max >= 0 && value > max))) - -#define APPLY_PROP(recognizer, config, type, prop, propName) do { \ -id value = config[propName]; \ -if (value != nil) { recognizer.prop = [ABI46_0_0RCTConvert type:value]; }\ -} while(0) - -#define APPLY_FLOAT_PROP(prop) do { APPLY_PROP(recognizer, config, CGFloat, prop, @#prop); } while(0) -#define APPLY_INT_PROP(prop) do { APPLY_PROP(recognizer, config, NSInteger, prop, @#prop); } while(0) -#define APPLY_NAMED_INT_PROP(prop, propName) do { APPLY_PROP(recognizer, config, NSInteger, prop, propName); } while(0) - -@protocol ABI46_0_0RNGestureHandlerEventEmitter - -- (void)sendEvent:(nonnull ABI46_0_0RNGestureHandlerStateChange *)event withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType; - -@end - - -@protocol ABI46_0_0RNRootViewGestureRecognizerDelegate - -- (void)gestureRecognizer:(nullable UIGestureRecognizer *)gestureRecognizer - didActivateInViewWithTouchHandler:(nullable UIView *)viewWithTouchHandler; - -@end - - -@interface ABI46_0_0RNGestureHandler : NSObject { - -@protected UIGestureRecognizer *_recognizer; -@protected ABI46_0_0RNGestureHandlerState _lastState; - -} - -+ (nullable ABI46_0_0RNGestureHandler *)findGestureHandlerByRecognizer:(nonnull UIGestureRecognizer *)recognizer; - -- (nonnull instancetype)initWithTag:(nonnull NSNumber *)tag; - -@property (nonatomic, readonly, nonnull) NSNumber *tag; -@property (nonatomic, weak, nullable) id emitter; -@property (nonatomic, readonly, nullable) UIGestureRecognizer *recognizer; -@property (nonatomic, readonly, nullable) ABI46_0_0RNGestureHandlerPointerTracker *pointerTracker; -@property (nonatomic) BOOL enabled; -@property (nonatomic) ABI46_0_0RNGestureHandlerActionType actionType; -@property (nonatomic) BOOL shouldCancelWhenOutside; -@property (nonatomic) BOOL needsPointerData; -@property (nonatomic) BOOL manualActivation; - -- (void)bindToView:(nonnull UIView *)view; -- (void)unbindFromView; -- (void)resetConfig NS_REQUIRES_SUPER; -- (void)configure:(nullable NSDictionary *)config NS_REQUIRES_SUPER; -- (void)handleGesture:(nonnull id)recognizer; -- (void)handleGesture:(nonnull id)recognizer inState:(ABI46_0_0RNGestureHandlerState)state; -- (BOOL)containsPointInView; -- (ABI46_0_0RNGestureHandlerState)state; -- (nullable ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(nonnull id)recognizer; - -- (void)stopActivationBlocker; -- (void)reset; -- (void)sendEventsInState:(ABI46_0_0RNGestureHandlerState)state - forViewWithTag:(nonnull NSNumber *)ABI46_0_0ReactTag - withExtraData:(nonnull ABI46_0_0RNGestureHandlerEventExtraData *)extraData; -- (void)sendEvent:(nonnull ABI46_0_0RNGestureHandlerStateChange *)event; -- (void)sendTouchEventInState:(ABI46_0_0RNGestureHandlerState)state - forViewWithTag:(nonnull NSNumber *)ABI46_0_0ReactTag; - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.m deleted file mode 100644 index a8dc62da59b890..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandler.m +++ /dev/null @@ -1,477 +0,0 @@ -#import "ABI46_0_0RNGestureHandler.h" -#import "ABI46_0_0RNManualActivationRecognizer.h" - -#import "Handlers/ABI46_0_0RNNativeViewHandler.h" - -#import - -#import - -@interface UIGestureRecognizer (ABI46_0_0GestureHandler) -@property (nonatomic, readonly) ABI46_0_0RNGestureHandler *ABI46_0_0gestureHandler; -@end - - -@implementation UIGestureRecognizer (ABI46_0_0GestureHandler) - -- (ABI46_0_0RNGestureHandler *)ABI46_0_0gestureHandler -{ - id delegate = self.delegate; - if ([delegate isKindOfClass:[ABI46_0_0RNGestureHandler class]]) { - return (ABI46_0_0RNGestureHandler *)delegate; - } - return nil; -} - -@end - -typedef struct ABI46_0_0RNGHHitSlop { - CGFloat top, left, bottom, right, width, height; -} ABI46_0_0RNGHHitSlop; - -static ABI46_0_0RNGHHitSlop ABI46_0_0RNGHHitSlopEmpty = { NAN, NAN, NAN, NAN, NAN, NAN }; - -#define ABI46_0_0RNGH_HIT_SLOP_GET(key) (prop[key] == nil ? NAN : [prop[key] doubleValue]) -#define ABI46_0_0RNGH_HIT_SLOP_IS_SET(hitSlop) (!isnan(hitSlop.left) || !isnan(hitSlop.right) || \ - !isnan(hitSlop.top) || !isnan(hitSlop.bottom)) -#define ABI46_0_0RNGH_HIT_SLOP_INSET(key) (isnan(hitSlop.key) ? 0. : hitSlop.key) - -CGRect ABI46_0_0RNGHHitSlopInsetRect(CGRect rect, ABI46_0_0RNGHHitSlop hitSlop) { - rect.origin.x -= ABI46_0_0RNGH_HIT_SLOP_INSET(left); - rect.origin.y -= ABI46_0_0RNGH_HIT_SLOP_INSET(top); - - if (!isnan(hitSlop.width)) { - if (!isnan(hitSlop.right)) { - rect.origin.x = rect.size.width - hitSlop.width + ABI46_0_0RNGH_HIT_SLOP_INSET(right); - } - rect.size.width = hitSlop.width; - } else { - rect.size.width += (ABI46_0_0RNGH_HIT_SLOP_INSET(left) + ABI46_0_0RNGH_HIT_SLOP_INSET(right)); - } - if (!isnan(hitSlop.height)) { - if (!isnan(hitSlop.bottom)) { - rect.origin.y = rect.size.height - hitSlop.height + ABI46_0_0RNGH_HIT_SLOP_INSET(bottom); - } - rect.size.height = hitSlop.height; - } else { - rect.size.height += (ABI46_0_0RNGH_HIT_SLOP_INSET(top) + ABI46_0_0RNGH_HIT_SLOP_INSET(bottom)); - } - return rect; -} - -static NSHashTable *allGestureHandlers; - -@implementation ABI46_0_0RNGestureHandler { - ABI46_0_0RNGestureHandlerPointerTracker *_pointerTracker; - ABI46_0_0RNGestureHandlerState _state; - ABI46_0_0RNManualActivationRecognizer *_manualActivationRecognizer; - NSArray *_handlersToWaitFor; - NSArray *_simultaneousHandlers; - ABI46_0_0RNGHHitSlop _hitSlop; - uint16_t _eventCoalescingKey; -} - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super init])) { - _pointerTracker = [[ABI46_0_0RNGestureHandlerPointerTracker alloc] initWithGestureHandler:self]; - _tag = tag; - _lastState = ABI46_0_0RNGestureHandlerStateUndetermined; - _hitSlop = ABI46_0_0RNGHHitSlopEmpty; - _state = ABI46_0_0RNGestureHandlerStateBegan; - _manualActivationRecognizer = nil; - - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - allGestureHandlers = [NSHashTable weakObjectsHashTable]; - }); - - [allGestureHandlers addObject:self]; - } - return self; -} - -- (void)resetConfig -{ - self.enabled = YES; - self.manualActivation = NO; - _shouldCancelWhenOutside = NO; - _handlersToWaitFor = nil; - _simultaneousHandlers = nil; - _hitSlop = ABI46_0_0RNGHHitSlopEmpty; - _needsPointerData = NO; - - _recognizer.cancelsTouchesInView = YES; -} - -- (void)configure:(NSDictionary *)config -{ - [self resetConfig]; - _handlersToWaitFor = [ABI46_0_0RCTConvert NSNumberArray:config[@"waitFor"]]; - _simultaneousHandlers = [ABI46_0_0RCTConvert NSNumberArray:config[@"simultaneousHandlers"]]; - - id prop = config[@"enabled"]; - if (prop != nil) { - self.enabled = [ABI46_0_0RCTConvert BOOL:prop]; - } - - prop = config[@"shouldCancelWhenOutside"]; - if (prop != nil) { - _shouldCancelWhenOutside = [ABI46_0_0RCTConvert BOOL:prop]; - } - - prop = config[@"cancelsTouchesInView"]; - if (prop != nil) { - _recognizer.cancelsTouchesInView = [ABI46_0_0RCTConvert BOOL:prop]; - } - - prop = config[@"needsPointerData"]; - if (prop != nil) { - _needsPointerData = [ABI46_0_0RCTConvert BOOL:prop]; - } - - prop = config[@"manualActivation"]; - if (prop != nil) { - self.manualActivation = [ABI46_0_0RCTConvert BOOL:prop]; - } - - prop = config[@"hitSlop"]; - if ([prop isKindOfClass:[NSNumber class]]) { - _hitSlop.left = _hitSlop.right = _hitSlop.top = _hitSlop.bottom = [prop doubleValue]; - } else if (prop != nil) { - _hitSlop.left = _hitSlop.right = ABI46_0_0RNGH_HIT_SLOP_GET(@"horizontal"); - _hitSlop.top = _hitSlop.bottom = ABI46_0_0RNGH_HIT_SLOP_GET(@"vertical"); - _hitSlop.left = ABI46_0_0RNGH_HIT_SLOP_GET(@"left"); - _hitSlop.right = ABI46_0_0RNGH_HIT_SLOP_GET(@"right"); - _hitSlop.top = ABI46_0_0RNGH_HIT_SLOP_GET(@"top"); - _hitSlop.bottom = ABI46_0_0RNGH_HIT_SLOP_GET(@"bottom"); - _hitSlop.width = ABI46_0_0RNGH_HIT_SLOP_GET(@"width"); - _hitSlop.height = ABI46_0_0RNGH_HIT_SLOP_GET(@"height"); - if (isnan(_hitSlop.left) && isnan(_hitSlop.right) && !isnan(_hitSlop.width)) { - ABI46_0_0RCTLogError(@"When width is set one of left or right pads need to be defined"); - } - if (!isnan(_hitSlop.width) && !isnan(_hitSlop.left) && !isnan(_hitSlop.right)) { - ABI46_0_0RCTLogError(@"Cannot have all of left, right and width defined"); - } - if (isnan(_hitSlop.top) && isnan(_hitSlop.bottom) && !isnan(_hitSlop.height)) { - ABI46_0_0RCTLogError(@"When height is set one of top or bottom pads need to be defined"); - } - if (!isnan(_hitSlop.height) && !isnan(_hitSlop.top) && !isnan(_hitSlop.bottom)) { - ABI46_0_0RCTLogError(@"Cannot have all of top, bottom and height defined"); - } - } -} - -- (void)setEnabled:(BOOL)enabled -{ - _enabled = enabled; - self.recognizer.enabled = enabled; -} - -- (void)bindToView:(UIView *)view -{ - view.userInteractionEnabled = YES; - self.recognizer.delegate = self; - [view addGestureRecognizer:self.recognizer]; - - [self bindManualActivationToView:view]; -} - -- (void)unbindFromView -{ - [self.recognizer.view removeGestureRecognizer:self.recognizer]; - self.recognizer.delegate = nil; - - [self unbindManualActivation]; -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forPosition:[recognizer locationInView:recognizer.view] - withAbsolutePosition:[recognizer locationInView:recognizer.view.window] - withNumberOfTouches:recognizer.numberOfTouches]; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer -{ - // it may happen that the gesture recognizer is reset after it's been unbound from the view, - // it that recognizer tried to send event, the app would crash because the target of the event - // would be nil. - if (recognizer.view.ABI46_0_0ReactTag == nil) { - return; - } - - _state = [self recognizerState]; - [self handleGesture:recognizer inState:_state]; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer inState:(ABI46_0_0RNGestureHandlerState)state -{ - _state = state; - ABI46_0_0RNGestureHandlerEventExtraData *eventData = [self eventExtraData:recognizer]; - [self sendEventsInState:self.state forViewWithTag:recognizer.view.ABI46_0_0ReactTag withExtraData:eventData]; -} - -- (void)sendEventsInState:(ABI46_0_0RNGestureHandlerState)state - forViewWithTag:(nonnull NSNumber *)ABI46_0_0ReactTag - withExtraData:(ABI46_0_0RNGestureHandlerEventExtraData *)extraData -{ - if (state != _lastState) { - // don't send change events from END to FAILED or CANCELLED, this may happen when gesture is ended in `onTouchesUp` callback - if (_lastState == ABI46_0_0RNGestureHandlerStateEnd && (state == ABI46_0_0RNGestureHandlerStateFailed || state == ABI46_0_0RNGestureHandlerStateCancelled)) { - return; - } - - if (state == ABI46_0_0RNGestureHandlerStateActive) { - // Generate a unique coalescing-key each time the gesture-handler becomes active. All events will have - // the same coalescing-key allowing ABI46_0_0RCTEventDispatcher to coalesce ABI46_0_0RNGestureHandlerEvents when events are - // generated faster than they can be treated by JS thread - static uint16_t nextEventCoalescingKey = 0; - self->_eventCoalescingKey = nextEventCoalescingKey++; - - } else if (state == ABI46_0_0RNGestureHandlerStateEnd && _lastState != ABI46_0_0RNGestureHandlerStateActive && !_manualActivation) { - id event = [[ABI46_0_0RNGestureHandlerStateChange alloc] initWithABI46_0_0ReactTag:ABI46_0_0ReactTag - handlerTag:_tag - state:ABI46_0_0RNGestureHandlerStateActive - prevState:_lastState - extraData:extraData]; - [self sendEvent:event]; - _lastState = ABI46_0_0RNGestureHandlerStateActive; - } - id stateEvent = [[ABI46_0_0RNGestureHandlerStateChange alloc] initWithABI46_0_0ReactTag:ABI46_0_0ReactTag - handlerTag:_tag - state:state - prevState:_lastState - extraData:extraData]; - [self sendEvent:stateEvent]; - _lastState = state; - } - - if (state == ABI46_0_0RNGestureHandlerStateActive) { - id touchEvent = [[ABI46_0_0RNGestureHandlerEvent alloc] initWithABI46_0_0ReactTag:ABI46_0_0ReactTag - handlerTag:_tag - state:state - extraData:extraData - coalescingKey:self->_eventCoalescingKey]; - [self sendEvent:touchEvent]; - } -} - -- (void)sendEvent:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - [self.emitter sendEvent:event withActionType:self.actionType]; -} - -- (void)sendTouchEventInState:(ABI46_0_0RNGestureHandlerState)state - forViewWithTag:(NSNumber *)ABI46_0_0ReactTag -{ - id extraData = [ABI46_0_0RNGestureHandlerEventExtraData forEventType:_pointerTracker.eventType - withChangedPointers:_pointerTracker.changedPointersData - withAllPointers:_pointerTracker.allPointersData - withNumberOfTouches:_pointerTracker.trackedPointersCount]; - id event = [[ABI46_0_0RNGestureHandlerEvent alloc] initWithABI46_0_0ReactTag:ABI46_0_0ReactTag handlerTag:_tag state:state extraData:extraData coalescingKey:[_tag intValue]]; - - [self.emitter sendEvent:event withActionType:self.actionType]; -} - -- (ABI46_0_0RNGestureHandlerState)recognizerState -{ - switch (_recognizer.state) { - case UIGestureRecognizerStateBegan: - case UIGestureRecognizerStatePossible: - return ABI46_0_0RNGestureHandlerStateBegan; - case UIGestureRecognizerStateEnded: - return ABI46_0_0RNGestureHandlerStateEnd; - case UIGestureRecognizerStateFailed: - return ABI46_0_0RNGestureHandlerStateFailed; - case UIGestureRecognizerStateCancelled: - return ABI46_0_0RNGestureHandlerStateCancelled; - case UIGestureRecognizerStateChanged: - return ABI46_0_0RNGestureHandlerStateActive; - } - return ABI46_0_0RNGestureHandlerStateUndetermined; -} - -- (ABI46_0_0RNGestureHandlerState)state -{ - // instead of mapping state of the recognizer directly, use value mapped when handleGesture was - // called, making it correct while awaiting for another handler failure - return _state; -} - -#pragma mark Manual activation - -- (void)stopActivationBlocker -{ - if (_manualActivationRecognizer != nil) { - [_manualActivationRecognizer fail]; - } -} - -- (void)setManualActivation:(BOOL)manualActivation -{ - _manualActivation = manualActivation; - - if (manualActivation) { - _manualActivationRecognizer = [[ABI46_0_0RNManualActivationRecognizer alloc] initWithGestureHandler:self]; - - if (_recognizer.view != nil) { - [_recognizer.view addGestureRecognizer:_manualActivationRecognizer]; - } - } else if (_manualActivationRecognizer != nil) { - [_manualActivationRecognizer.view removeGestureRecognizer:_manualActivationRecognizer]; - _manualActivationRecognizer = nil; - } -} - -- (void)bindManualActivationToView:(UIView *)view -{ - if (_manualActivationRecognizer != nil) { - [view addGestureRecognizer:_manualActivationRecognizer]; - } -} - -- (void)unbindManualActivation -{ - if (_manualActivationRecognizer != nil) { - [_manualActivationRecognizer.view removeGestureRecognizer:_manualActivationRecognizer]; - } -} - -#pragma mark UIGestureRecognizerDelegate - -+ (ABI46_0_0RNGestureHandler *)findGestureHandlerByRecognizer:(UIGestureRecognizer *)recognizer -{ - ABI46_0_0RNGestureHandler *handler = recognizer.ABI46_0_0gestureHandler; - if (handler != nil) { - return handler; - } - - // We may try to extract "DummyGestureHandler" in case when "otherGestureRecognizer" belongs to - // a native view being wrapped with "NativeViewGestureHandler" - UIView *reactView = recognizer.view; - while (reactView != nil && reactView.ABI46_0_0ReactTag == nil) { - reactView = reactView.superview; - } - - for (UIGestureRecognizer *recognizer in reactView.gestureRecognizers) { - if ([recognizer isKindOfClass:[ABI46_0_0RNDummyGestureRecognizer class]]) { - return recognizer.ABI46_0_0gestureHandler; - } - } - - return nil; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - ABI46_0_0RNGestureHandler *handler = [ABI46_0_0RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer]; - if ([handler isKindOfClass:[ABI46_0_0RNNativeViewGestureHandler class]]) { - for (NSNumber *handlerTag in handler->_handlersToWaitFor) { - if ([_tag isEqual:handlerTag]) { - return YES; - } - } - } - - return NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - if ([_handlersToWaitFor count]) { - ABI46_0_0RNGestureHandler *handler = [ABI46_0_0RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer]; - if (handler != nil) { - for (NSNumber *handlerTag in _handlersToWaitFor) { - if ([handler.tag isEqual:handlerTag]) { - return YES; - } - } - } - } - return NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - if (_recognizer.state == UIGestureRecognizerStateBegan && _recognizer.state == UIGestureRecognizerStatePossible) { - return YES; - } - - ABI46_0_0RNGestureHandler *handler = [ABI46_0_0RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer]; - if (handler != nil) { - if ([_simultaneousHandlers count]) { - for (NSNumber *handlerTag in _simultaneousHandlers) { - if ([handler.tag isEqual:handlerTag]) { - return YES; - } - } - } else if (handler->_simultaneousHandlers) { - for (NSNumber *handlerTag in handler->_simultaneousHandlers) { - if ([self.tag isEqual:handlerTag]) { - return YES; - } - } - } - } - return NO; -} - -- (void)reset -{ - // do not reset states while gesture is tracking pointers, as gestureRecognizerShouldBegin - // might be called after some pointers are down, and after state manipulation by the user. - // Pointer tracker calls this method when it resets, and in that case it no longer tracks - // any pointers, thus entering this if - if (!_needsPointerData || _pointerTracker.trackedPointersCount == 0) { - _lastState = ABI46_0_0RNGestureHandlerStateUndetermined; - _state = ABI46_0_0RNGestureHandlerStateBegan; - } -} - - - (BOOL)containsPointInView - { - CGPoint pt = [_recognizer locationInView:_recognizer.view]; - CGRect hitFrame = ABI46_0_0RNGHHitSlopInsetRect(_recognizer.view.bounds, _hitSlop); - return CGRectContainsPoint(hitFrame, pt); - } - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - if ([_handlersToWaitFor count]) { - for (ABI46_0_0RNGestureHandler *handler in [allGestureHandlers allObjects]) { - if (handler != nil - && (handler.state == ABI46_0_0RNGestureHandlerStateActive || handler->_recognizer.state == UIGestureRecognizerStateBegan)) { - for (NSNumber *handlerTag in _handlersToWaitFor) { - if ([handler.tag isEqual:handlerTag]) { - return NO; - } - } - } - } - } - - [self reset]; - return YES; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch -{ - // If hitSlop is set we use it to determine if a given gesture recognizer should start processing - // touch stream. This only works for negative values of hitSlop as this method won't be triggered - // unless touch startes in the bounds of the attached view. To acheve similar effect with positive - // values of hitSlop one should set hitSlop for the underlying view. This limitation is due to the - // fact that hitTest method is only available at the level of UIView - if (ABI46_0_0RNGH_HIT_SLOP_IS_SET(_hitSlop)) { - CGPoint location = [touch locationInView:gestureRecognizer.view]; - CGRect hitFrame = ABI46_0_0RNGHHitSlopInsetRect(gestureRecognizer.view.bounds, _hitSlop); - return CGRectContainsPoint(hitFrame, location); - } - return YES; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerActionType.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerActionType.h deleted file mode 100644 index 7a49d4f9c072b9..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerActionType.h +++ /dev/null @@ -1,8 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNGestureHandlerActionType) { - ABI46_0_0RNGestureHandlerActionTypeReanimatedWorklet = 1, // Reanimated worklet - ABI46_0_0RNGestureHandlerActionTypeNativeAnimatedEvent, // Animated.event with useNativeDriver: true - ABI46_0_0RNGestureHandlerActionTypeJSFunctionOldAPI, // JS function or Animated.event with useNativeDriver: false using old ABI46_0_0RNGH API - ABI46_0_0RNGestureHandlerActionTypeJSFunctionNewAPI, // JS function or Animated.event with useNativeDriver: false using new ABI46_0_0RNGH API -}; diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.h deleted file mode 100644 index dab5415a1fcf1d..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ABI46_0_0RNGestureHandlerButton.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNGestureHandlerButton : UIControl - -/** - * Insets used when hit testing inside this view. - */ -@property (nonatomic, assign) UIEdgeInsets hitTestEdgeInsets; -@property (nonatomic) BOOL userEnabled; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.m deleted file mode 100644 index b7fa175d96ae6f..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButton.m +++ /dev/null @@ -1,78 +0,0 @@ -// -// ABI46_0_0RNGestureHandlerButton.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandlerButton.h" - -#import - -/** - * Gesture Handler Button components overrides standard mechanism used by RN - * to determine touch target, which normally would reurn the UIView that is placed - * as the deepest element in the view hierarchy. - * It's done this way as it allows for the actual target determination to run in JS - * where we can travers up the view ierarchy to find first element that want to became - * JS responder. - * - * Since we want to use native button (or actually a `UIControl`) we need to determine - * the target in native. This makes it impossible for JS responder based components to - * function as a subviews of the button component. Here we override `hitTest:withEvent:` - * method and we only determine the target to be either a subclass of `UIControl` or a - * view that has gesture recognizers registered. - * - * This "default" behaviour of target determinator should be sufficient in most of the - * cases as in fact it is not that common UI pattern to have many nested buttons (usually - * there are just two levels e.g. when you have clickable table cells with additional - * buttons). In cases when the default behaviour is insufficient it is recommended to use - * `TapGestureHandler` instead of a button which gives much better flexibility as far as - * controlling the touch flow. - */ -@implementation ABI46_0_0RNGestureHandlerButton - -- (instancetype)init -{ - self = [super init]; - if (self) { - _hitTestEdgeInsets = UIEdgeInsetsZero; - _userEnabled = YES; -#if !TARGET_OS_TV - [self setExclusiveTouch:YES]; -#endif - } - return self; -} - -- (BOOL)shouldHandleTouch:(UIView *)view -{ - if ([view isKindOfClass:[ABI46_0_0RNGestureHandlerButton class]]) { - ABI46_0_0RNGestureHandlerButton *button = (ABI46_0_0RNGestureHandlerButton *)view; - return button.userEnabled; - } - - return [view isKindOfClass:[UIControl class]] || [view.gestureRecognizers count] > 0; -} - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - if (UIEdgeInsetsEqualToEdgeInsets(self.hitTestEdgeInsets, UIEdgeInsetsZero)) { - return [super pointInside:point withEvent:event]; - } - CGRect hitFrame = UIEdgeInsetsInsetRect(self.bounds, self.hitTestEdgeInsets); - return CGRectContainsPoint(hitFrame, point); -} - -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - UIView *inner = [super hitTest:point withEvent:event]; - while (inner && ![self shouldHandleTouch:inner]) { - inner = inner.superview; - } - return inner; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.h deleted file mode 100644 index 43f44b5d74dbbe..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef ABI46_0_0RN_FABRIC_ENABLED - -#import - -#import - -#import "ABI46_0_0RNGestureHandlerButton.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNGestureHandlerButtonComponentView : ABI46_0_0RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END - -#endif // ABI46_0_0RN_FABRIC_ENABLED diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.mm b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.mm deleted file mode 100644 index d04a5306279597..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonComponentView.mm +++ /dev/null @@ -1,61 +0,0 @@ -#ifdef ABI46_0_0RN_FABRIC_ENABLED - -#import "ABI46_0_0RNGestureHandlerButtonComponentView.h" - -#import - -#import -#import -#import -#import - -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#import "ABI46_0_0RNGestureHandlerButton.h" - -using namespace ABI46_0_0facebook::react; - -@interface ABI46_0_0RNGestureHandlerButtonComponentView () -@end - -@implementation ABI46_0_0RNGestureHandlerButtonComponentView -{ - ABI46_0_0RNGestureHandlerButton *_buttonView; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - _buttonView = [[ABI46_0_0RNGestureHandlerButton alloc] initWithFrame:self.bounds]; - - self.contentView = _buttonView; - } - - return self; -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -+ (ComponentDescriptorProvider)componentDescriptorProvider -{ - return concreteComponentDescriptorProvider(); -} - -- (void)updateProps:(const Props::Shared &)props oldProps:(const Props::Shared &)oldProps -{ - const auto &newProps = *std::static_pointer_cast(props); - - _buttonView.userEnabled = newProps.enabled; - _buttonView.exclusiveTouch = newProps.exclusive; - - [super updateProps:props oldProps:oldProps]; -} -@end - -Class ABI46_0_0RNGestureHandlerButtonCls(void) -{ - return ABI46_0_0RNGestureHandlerButtonComponentView.class; -} - -#endif // ABI46_0_0RN_FABRIC_ENABLED diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.h deleted file mode 100644 index 2878f5fd5e625c..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0RNGestureHandlerButtonManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.m deleted file mode 100644 index 044195463a6fe9..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerButtonManager.m +++ /dev/null @@ -1,33 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerButton.h" -#import "ABI46_0_0RNGestureHandlerButtonManager.h" - -@implementation ABI46_0_0RNGestureHandlerButtonManager - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNGestureHandlerButton) - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(enabled, BOOL, ABI46_0_0RNGestureHandlerButton) -{ - view.userEnabled = json == nil ? YES : [ABI46_0_0RCTConvert BOOL: json]; -} -#if !TARGET_OS_TV -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(exclusive, BOOL, ABI46_0_0RNGestureHandlerButton) -{ - [view setExclusiveTouch: json == nil ? YES : [ABI46_0_0RCTConvert BOOL: json]]; -} -#endif -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(hitSlop, UIEdgeInsets, ABI46_0_0RNGestureHandlerButton) -{ - if (json) { - UIEdgeInsets hitSlopInsets = [ABI46_0_0RCTConvert UIEdgeInsets:json]; - view.hitTestEdgeInsets = UIEdgeInsetsMake(-hitSlopInsets.top, -hitSlopInsets.left, -hitSlopInsets.bottom, -hitSlopInsets.right); - } else { - view.hitTestEdgeInsets = defaultView.hitTestEdgeInsets; - } -} - -- (UIView *)view -{ - return [ABI46_0_0RNGestureHandlerButton new]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerDirection.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerDirection.h deleted file mode 100644 index a4af036e89a491..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerDirection.h +++ /dev/null @@ -1,8 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNGestureHandlerDirection) { - ABI46_0_0RNGestureHandlerDirectionRight = 1, - ABI46_0_0RNGestureHandlerDirectionLeft = 2, - ABI46_0_0RNGestureHandlerDirectionUp = 4, - ABI46_0_0RNGestureHandlerDirectionDown = 8, -}; diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.h deleted file mode 100644 index cf6e69e3463afb..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.h +++ /dev/null @@ -1,65 +0,0 @@ -#import - -#import -#import - -#import "ABI46_0_0RNGestureHandlerState.h" -#import "ABI46_0_0RNGHTouchEventType.h" - -@interface ABI46_0_0RNGestureHandlerEventExtraData : NSObject - -@property (readonly) NSDictionary *data; - -- (instancetype)initWithData:(NSDictionary *)data; - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches - withDuration:(NSUInteger)duration; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPan:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withTranslation:(CGPoint)translation - withVelocity:(CGPoint)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forForce:(CGFloat)force - forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPinch:(CGFloat)scale - withFocalPoint:(CGPoint)focalPoint - withVelocity:(CGFloat)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forRotation:(CGFloat)rotation - withAnchorPoint:(CGPoint)anchorPoint - withVelocity:(CGFloat)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forEventType:(ABI46_0_0RNGHTouchEventType)eventType - withChangedPointers:(NSArray *)changedPointers - withAllPointers:(NSArray *)allPointers - withNumberOfTouches:(NSUInteger)numberOfTouches; -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside; -@end - -@interface ABI46_0_0RNGestureHandlerEvent : NSObject - -- (instancetype)initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - handlerTag:(NSNumber *)handlerTag - state:(ABI46_0_0RNGestureHandlerState)state - extraData:(ABI46_0_0RNGestureHandlerEventExtraData*)extraData - coalescingKey:(uint16_t)coalescingKey NS_DESIGNATED_INITIALIZER; - -@end - - -@interface ABI46_0_0RNGestureHandlerStateChange : NSObject - -- (instancetype)initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - handlerTag:(NSNumber *)handlerTag - state:(ABI46_0_0RNGestureHandlerState)state - prevState:(ABI46_0_0RNGestureHandlerState)prevState - extraData:(ABI46_0_0RNGestureHandlerEventExtraData*)extraData NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.m deleted file mode 100644 index 0761af614b43a8..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerEvents.m +++ /dev/null @@ -1,255 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerEvents.h" - -#define SAFE_VELOCITY(velocity) @(isnan(velocity) ? 0 : velocity) - -@implementation ABI46_0_0RNGestureHandlerEventExtraData - -- (instancetype)initWithData:(NSDictionary *)data; -{ - if ((self = [super init])) { - _data = data; - } - return self; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{ - @"x": @(position.x), - @"y": @(position.y), - @"absoluteX": @(absolutePosition.x), - @"absoluteY": @(absolutePosition.y), - @"numberOfPointers": @(numberOfTouches)}]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches - withDuration:(NSUInteger)duration -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{ - @"x": @(position.x), - @"y": @(position.y), - @"absoluteX": @(absolutePosition.x), - @"absoluteY": @(absolutePosition.y), - @"numberOfPointers": @(numberOfTouches), - @"duration":@(duration) - }]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPan:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withTranslation:(CGPoint)translation - withVelocity:(CGPoint)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{ - @"x": @(position.x), - @"y": @(position.y), - @"absoluteX": @(absolutePosition.x), - @"absoluteY": @(absolutePosition.y), - @"translationX": @(translation.x), - @"translationY": @(translation.y), - @"velocityX": SAFE_VELOCITY(velocity.x), - @"velocityY": SAFE_VELOCITY(velocity.y), - @"numberOfPointers": @(numberOfTouches)}]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forForce:(CGFloat)force - forPosition:(CGPoint)position - withAbsolutePosition:(CGPoint)absolutePosition - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{ - @"x": @(position.x), - @"y": @(position.y), - @"absoluteX": @(absolutePosition.x), - @"absoluteY": @(absolutePosition.y), - @"force": @(force), - @"numberOfPointers": @(numberOfTouches)}]; - -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPinch:(CGFloat)scale - withFocalPoint:(CGPoint)focalPoint - withVelocity:(CGFloat)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{ - @"scale": @(scale), - @"focalX": @(focalPoint.x), - @"focalY": @(focalPoint.y), - @"velocity": SAFE_VELOCITY(velocity), - @"numberOfPointers": @(numberOfTouches)}]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forRotation:(CGFloat)rotation - withAnchorPoint:(CGPoint)anchorPoint - withVelocity:(CGFloat)velocity - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{@"rotation": @(rotation), - @"anchorX": @(anchorPoint.x), - @"anchorY": @(anchorPoint.y), - @"velocity": SAFE_VELOCITY(velocity), - @"numberOfPointers": @(numberOfTouches)}]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forEventType:(ABI46_0_0RNGHTouchEventType)eventType - withChangedPointers:(NSArray *)changedPointers - withAllPointers:(NSArray *)allPointers - withNumberOfTouches:(NSUInteger)numberOfTouches -{ - if (changedPointers == nil || allPointers == nil) { - changedPointers = @[]; - allPointers = @[]; - eventType = ABI46_0_0RNGHTouchEventTypeUndetermined; - } - - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{@"eventType": @(eventType), - @"changedTouches": changedPointers, - @"allTouches": allPointers, - @"numberOfTouches": @(numberOfTouches)}]; -} - -+ (ABI46_0_0RNGestureHandlerEventExtraData *)forPointerInside:(BOOL)pointerInside -{ - return [[ABI46_0_0RNGestureHandlerEventExtraData alloc] - initWithData:@{@"pointerInside": @(pointerInside)}]; -} - -@end - - -@implementation ABI46_0_0RNGestureHandlerEvent -{ - NSNumber *_handlerTag; - ABI46_0_0RNGestureHandlerState _state; - ABI46_0_0RNGestureHandlerEventExtraData *_extraData; -} - -@synthesize viewTag = _viewTag; -@synthesize coalescingKey = _coalescingKey; - -- (instancetype)initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - handlerTag:(NSNumber *)handlerTag - state:(ABI46_0_0RNGestureHandlerState)state - extraData:(ABI46_0_0RNGestureHandlerEventExtraData *)extraData - coalescingKey:(uint16_t)coalescingKey -{ - if ((self = [super init])) { - _viewTag = ABI46_0_0ReactTag; - _handlerTag = handlerTag; - _state = state; - _extraData = extraData; - _coalescingKey = coalescingKey; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (NSString *)eventName -{ - return @"onGestureHandlerEvent"; -} - -- (BOOL)canCoalesce -{ - return YES; -} - -- (id)coalesceWithEvent:(id)newEvent; -{ - return newEvent; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - NSMutableDictionary *body = [NSMutableDictionary dictionaryWithDictionary:_extraData.data]; - [body setObject:_viewTag forKey:@"target"]; - [body setObject:_handlerTag forKey:@"handlerTag"]; - [body setObject:@(_state) forKey:@"state"]; - return @[self.viewTag, @"onGestureHandlerEvent", body]; -} - -@end - - -@implementation ABI46_0_0RNGestureHandlerStateChange -{ - NSNumber *_handlerTag; - ABI46_0_0RNGestureHandlerState _state; - ABI46_0_0RNGestureHandlerState _prevState; - ABI46_0_0RNGestureHandlerEventExtraData *_extraData; -} - -@synthesize viewTag = _viewTag; -@synthesize coalescingKey = _coalescingKey; - -- (instancetype)initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - handlerTag:(NSNumber *)handlerTag - state:(ABI46_0_0RNGestureHandlerState)state - prevState:(ABI46_0_0RNGestureHandlerState)prevState - extraData:(ABI46_0_0RNGestureHandlerEventExtraData *)extraData -{ - static uint16_t coalescingKey = 0; - if ((self = [super init])) { - _viewTag = ABI46_0_0ReactTag; - _handlerTag = handlerTag; - _state = state; - _prevState = prevState; - _extraData = extraData; - _coalescingKey = coalescingKey++; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (NSString *)eventName -{ - return @"onGestureHandlerStateChange"; -} - -- (BOOL)canCoalesce -{ - // TODO: event coalescing - return NO; -} - -- (id)coalesceWithEvent:(id)newEvent; -{ - return newEvent; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - NSMutableDictionary *body = [NSMutableDictionary dictionaryWithDictionary:_extraData.data]; - [body setObject:_viewTag forKey:@"target"]; - [body setObject:_handlerTag forKey:@"handlerTag"]; - [body setObject:@(_state) forKey:@"state"]; - [body setObject:@(_prevState) forKey:@"oldState"]; - return @[self.viewTag, @"onGestureHandlerStateChange", body]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.h deleted file mode 100644 index b9e1f15d9b58ac..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.h +++ /dev/null @@ -1,36 +0,0 @@ -#import - -#import - -#import "ABI46_0_0RNGestureHandler.h" - -@class ABI46_0_0RCTUIManager; -@class ABI46_0_0RCTEventDispatcher; - -@interface ABI46_0_0RNGestureHandlerManager : NSObject - -- (nonnull instancetype)initWithUIManager:(nonnull ABI46_0_0RCTUIManager *)uiManager - eventDispatcher:(nonnull ABI46_0_0RCTEventDispatcher *)eventDispatcher; - -- (void)createGestureHandler:(nonnull NSString *)handlerName - tag:(nonnull NSNumber *)handlerTag - config:(nonnull NSDictionary *)config; - -- (void)attachGestureHandler:(nonnull NSNumber *)handlerTag - toViewWithTag:(nonnull NSNumber *)viewTag - withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType; - -- (void)updateGestureHandler:(nonnull NSNumber *)handlerTag config:(nonnull NSDictionary *)config; - -- (void)dropGestureHandler:(nonnull NSNumber *)handlerTag; - -- (void)dropAllGestureHandlers; - -- (void)handleSetJSResponder:(nonnull NSNumber *)viewTag - blockNativeResponder:(nonnull NSNumber *)blockNativeResponder; - -- (void)handleClearJSResponder; - -- (nullable ABI46_0_0RNGestureHandler *)handlerWithTag:(nonnull NSNumber *)handlerTag; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.mm b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.mm deleted file mode 100644 index 82436b7357a6f0..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerManager.mm +++ /dev/null @@ -1,311 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerManager.h" - -#import -#import -#import -#import -#import -#import - -#if __has_include() -#import -#else -#import "ABI46_0_0RCTRootContentView.h" -#endif - -#import "ABI46_0_0RNGestureHandlerActionType.h" -#import "ABI46_0_0RNGestureHandlerState.h" -#import "ABI46_0_0RNGestureHandler.h" -#import "ABI46_0_0RNGestureHandlerRegistry.h" -#import "ABI46_0_0RNRootViewGestureRecognizer.h" - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -#import -#import -#else -#import -#endif // ABI46_0_0RN_FABRIC_ENABLED - -#import "Handlers/ABI46_0_0RNPanHandler.h" -#import "Handlers/ABI46_0_0RNTapHandler.h" -#import "Handlers/ABI46_0_0RNFlingHandler.h" -#import "Handlers/ABI46_0_0RNLongPressHandler.h" -#import "Handlers/ABI46_0_0RNNativeViewHandler.h" -#import "Handlers/ABI46_0_0RNPinchHandler.h" -#import "Handlers/ABI46_0_0RNRotationHandler.h" -#import "Handlers/ABI46_0_0RNForceTouchHandler.h" -#import "Handlers/ABI46_0_0RNManualHandler.h" - -// We use the method below instead of ABI46_0_0RCTLog because we log out messages after the bridge gets -// turned down in some cases. Which normally with ABI46_0_0RCTLog would cause a crash in DEBUG mode -#define ABI46_0_0RCTLifecycleLog(...) ABI46_0_0RCTDefaultLogFunction(ABI46_0_0RCTLogLevelInfo, ABI46_0_0RCTLogSourceNative, @(__FILE__), @(__LINE__), [NSString stringWithFormat:__VA_ARGS__]) - -@interface ABI46_0_0RNGestureHandlerManager () - -@end - -@implementation ABI46_0_0RNGestureHandlerManager -{ - ABI46_0_0RNGestureHandlerRegistry *_registry; - ABI46_0_0RCTUIManager *_uiManager; - NSHashTable *_rootViewGestureRecognizers; - ABI46_0_0RCTEventDispatcher *_eventDispatcher; - id _reanimatedModule; -} - -- (instancetype)initWithUIManager:(ABI46_0_0RCTUIManager *)uiManager - eventDispatcher:(ABI46_0_0RCTEventDispatcher *)eventDispatcher -{ - if ((self = [super init])) { - _uiManager = uiManager; - _eventDispatcher = eventDispatcher; - _registry = [ABI46_0_0RNGestureHandlerRegistry new]; - _rootViewGestureRecognizers = [NSHashTable hashTableWithOptions:NSPointerFunctionsWeakMemory]; - _reanimatedModule = nil; - } - return self; -} - -- (void)createGestureHandler:(NSString *)handlerName - tag:(NSNumber *)handlerTag - config:(NSDictionary *)config -{ - static NSDictionary *map; - static dispatch_once_t mapToken; - dispatch_once(&mapToken, ^{ - map = @{ - @"PanGestureHandler" : [ABI46_0_0RNPanGestureHandler class], - @"TapGestureHandler" : [ABI46_0_0RNTapGestureHandler class], - @"FlingGestureHandler" : [ABI46_0_0RNFlingGestureHandler class], - @"LongPressGestureHandler": [ABI46_0_0RNLongPressGestureHandler class], - @"NativeViewGestureHandler": [ABI46_0_0RNNativeViewGestureHandler class], - @"PinchGestureHandler": [ABI46_0_0RNPinchGestureHandler class], - @"RotationGestureHandler": [ABI46_0_0RNRotationGestureHandler class], - @"ForceTouchGestureHandler": [ABI46_0_0RNForceTouchHandler class], - @"ManualGestureHandler": [ABI46_0_0RNManualGestureHandler class], - }; - }); - - Class nodeClass = map[handlerName]; - if (!nodeClass) { - ABI46_0_0RCTLogError(@"Gesture handler type %@ is not supported", handlerName); - return; - } - - ABI46_0_0RNGestureHandler *gestureHandler = [[nodeClass alloc] initWithTag:handlerTag]; - [gestureHandler configure:config]; - [_registry registerGestureHandler:gestureHandler]; - - __weak id emitter = self; - gestureHandler.emitter = emitter; -} - - -- (void)attachGestureHandler:(nonnull NSNumber *)handlerTag - toViewWithTag:(nonnull NSNumber *)viewTag - withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType -{ - UIView *view = [_uiManager viewForABI46_0_0ReactTag:viewTag]; - -#ifdef ABI46_0_0RN_FABRIC_ENABLED - if (view == nil) { - // Happens when the view with given tag has been flattened. - // We cannot attach gesture handler to a non-existent view. - return; - } - - // I think it should be moved to ABI46_0_0RNNativeViewHandler, but that would require - // additional logic for setting contentView.ABI46_0_0ReactTag, this works for now - if ([view isKindOfClass:[ABI46_0_0RCTViewComponentView class]]) { - ABI46_0_0RCTViewComponentView *componentView = (ABI46_0_0RCTViewComponentView *)view; - if (componentView.contentView != nil) { - view = componentView.contentView; - } - } - - view.ABI46_0_0ReactTag = viewTag; // necessary for ABI46_0_0RNReanimated eventHash (e.g. "42onGestureHandlerEvent"), also will be returned as event.target -#endif // ABI46_0_0RN_FABRIC_ENABLED - - [_registry attachHandlerWithTag:handlerTag toView:view withActionType:actionType]; - - // register view if not already there - [self registerViewWithGestureRecognizerAttachedIfNeeded:view]; -} - -- (void)updateGestureHandler:(NSNumber *)handlerTag config:(NSDictionary *)config -{ - ABI46_0_0RNGestureHandler *handler = [_registry handlerWithTag:handlerTag]; - [handler configure:config]; -} - -- (void)dropGestureHandler:(NSNumber *)handlerTag -{ - [_registry dropHandlerWithTag:handlerTag]; -} - -- (void)dropAllGestureHandlers -{ - [_registry dropAllHandlers]; -} - -- (void)handleSetJSResponder:(NSNumber *)viewTag blockNativeResponder:(NSNumber *)blockNativeResponder -{ - if ([blockNativeResponder boolValue]) { - for (ABI46_0_0RNRootViewGestureRecognizer *recognizer in _rootViewGestureRecognizers) { - [recognizer blockOtherRecognizers]; - } - } -} - -- (void)handleClearJSResponder -{ - // ignore... -} - -- (id)handlerWithTag:(NSNumber *)handlerTag -{ - return [_registry handlerWithTag:handlerTag]; -} - - -#pragma mark Root Views Management - -- (void)registerViewWithGestureRecognizerAttachedIfNeeded:(UIView *)childView -{ - UIView *parent = childView; - while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) parent = parent.superview; - - // Many views can return the same touchHandler so we check if the one we want to register - // is not already present in the set. - UIView *touchHandlerView = [[parent performSelector:@selector(touchHandler)] view]; - - if (touchHandlerView == nil) { - return; - } - - for (UIGestureRecognizer *recognizer in touchHandlerView.gestureRecognizers) { - if ([recognizer isKindOfClass:[ABI46_0_0RNRootViewGestureRecognizer class]]) { - return; - } - } - - ABI46_0_0RCTLifecycleLog(@"[GESTURE HANDLER] Initialize gesture handler for view %@", touchHandlerView); - ABI46_0_0RNRootViewGestureRecognizer *recognizer = [ABI46_0_0RNRootViewGestureRecognizer new]; - recognizer.delegate = self; - touchHandlerView.userInteractionEnabled = YES; - [touchHandlerView addGestureRecognizer:recognizer]; - [_rootViewGestureRecognizers addObject:recognizer]; -} - -- (void)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer - didActivateInViewWithTouchHandler:(UIView *)viewWithTouchHandler -{ - // Cancel touches in RN's root view in order to cancel all in-js recognizers - - // As scroll events are special-cased in RN responder implementation and sending them would - // trigger JS responder change, we don't cancel touches if the handler that got activated is - // a scroll recognizer. This way root view will keep sending touchMove and touchEnd events - // and therefore allow JS responder to properly release the responder at the end of the touch - // stream. - // NOTE: this is not a proper fix and solving this problem requires upstream fixes to RN. In - // particular if we have one PanHandler and ScrollView that can work simultaniously then when - // the Pan handler activates it would still tigger cancel events. - // Once the upstream fix lands the line below along with this comment can be removed - if ([gestureRecognizer.view isKindOfClass:[UIScrollView class]]) return; - -#ifdef ABI46_0_0RN_FABRIC_ENABLED - ABI46_0_0RCTSurfaceTouchHandler *touchHandler = [viewWithTouchHandler performSelector:@selector(touchHandler)]; -#else - ABI46_0_0RCTTouchHandler *touchHandler = [viewWithTouchHandler performSelector:@selector(touchHandler)]; -#endif - [touchHandler setEnabled:NO]; - [touchHandler setEnabled:YES]; - -} - -#pragma mark Events - -- (void)sendEvent:(ABI46_0_0RNGestureHandlerStateChange *)event withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType -{ - switch (actionType) { - case ABI46_0_0RNGestureHandlerActionTypeReanimatedWorklet: - [self sendEventForReanimated:event]; - break; - - case ABI46_0_0RNGestureHandlerActionTypeNativeAnimatedEvent: - if ([event.eventName isEqualToString:@"onGestureHandlerEvent"]) { - [self sendEventForNativeAnimatedEvent:event]; - } else { - // Although onGestureEvent prop is an Animated.event with useNativeDriver: true, - // onHandlerStateChange prop is still a regular JS function. - // Also, Animated.event is only supported with old API. - [self sendEventForJSFunctionOldAPI:event]; - } - break; - - case ABI46_0_0RNGestureHandlerActionTypeJSFunctionOldAPI: - [self sendEventForJSFunctionOldAPI:event]; - break; - - case ABI46_0_0RNGestureHandlerActionTypeJSFunctionNewAPI: - [self sendEventForJSFunctionNewAPI:event]; - break; - } -} - -- (void)sendEventForReanimated:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to Reanimated. -#ifdef ABI46_0_0RN_FABRIC_ENABLED - // Send event directly to Reanimated - if (_reanimatedModule == nil) { - _reanimatedModule = [_uiManager.bridge moduleForName:@"ReanimatedModule"]; - } - - [_reanimatedModule eventDispatcherWillDispatchEvent:event]; -#else - // In the old architecture, Reanimated overwrites ABI46_0_0RCTEventDispatcher - // with ABI46_0_0REAEventDispatcher and intercepts all direct events. - [self sendEventForDirectEvent:event]; -#endif // ABI46_0_0RN_FABRIC_ENABLED -} - -- (void)sendEventForNativeAnimatedEvent:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to NativeAnimatedModule. - // Currently, NativeAnimated[Turbo]Module is ABI46_0_0RCTEventDispatcherObserver so we can - // simply send a direct event which is handled by the observer but ignored on JS side. - // TODO: send event directly to NativeAnimated[Turbo]Module - [self sendEventForDirectEvent:event]; -} - -- (void)sendEventForJSFunctionOldAPI:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to JS (old ABI46_0_0RNGH API). -#ifdef ABI46_0_0RN_FABRIC_ENABLED - [self sendEventForDeviceEvent:event]; -#else - [self sendEventForDirectEvent:event]; -#endif // ABI46_0_0RN_FABRIC_ENABLED -} - -- (void)sendEventForJSFunctionNewAPI:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to JS (new ABI46_0_0RNGH API). - [self sendEventForDeviceEvent:event]; -} - -- (void)sendEventForDirectEvent:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to JS as a direct event. - [_eventDispatcher sendEvent:event]; -} - -- (void)sendEventForDeviceEvent:(ABI46_0_0RNGestureHandlerStateChange *)event -{ - // Delivers the event to JS as a device event. - NSMutableDictionary *body = [[event arguments] objectAtIndex:2]; - [_eventDispatcher sendDeviceEventWithName:@"onGestureHandlerStateChange" body:body]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.h deleted file mode 100644 index 17c480ad7bc11e..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0RNGestureHandlerModule : ABI46_0_0RCTEventEmitter - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.mm b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.mm deleted file mode 100644 index 404e47289256ad..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerModule.mm +++ /dev/null @@ -1,312 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerModule.h" - -#import -#import -#import -#import -#import -#import - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import - -#import -#endif // ABI46_0_0RN_FABRIC_ENABLED - -#import "ABI46_0_0RNGestureHandlerState.h" -#import "ABI46_0_0RNGestureHandlerDirection.h" -#import "ABI46_0_0RNGestureHandler.h" -#import "ABI46_0_0RNGestureHandlerManager.h" - -#import "ABI46_0_0RNGestureHandlerButton.h" -#import "ABI46_0_0RNGestureHandlerStateManager.h" - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; -#endif // ABI46_0_0RN_FABRIC_ENABLED - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -@interface ABI46_0_0RNGestureHandlerModule () - -@end -#else -@interface ABI46_0_0RNGestureHandlerModule () - -@end -#endif // ABI46_0_0RN_FABRIC_ENABLED - -typedef void (^GestureHandlerOperation)(ABI46_0_0RNGestureHandlerManager *manager); - -@implementation ABI46_0_0RNGestureHandlerModule -{ - ABI46_0_0RNGestureHandlerManager *_manager; - - // Oparations called after views have been updated. - NSMutableArray *_operations; -} - -ABI46_0_0RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (void)invalidate -{ - ABI46_0_0RNGestureHandlerManager *handlerManager = _manager; - dispatch_async(dispatch_get_main_queue(), ^{ - [handlerManager dropAllGestureHandlers]; - }); - - _manager = nil; - -#ifdef ABI46_0_0RN_FABRIC_ENABLED - [self.bridge.surfacePresenter removeObserver:self]; -#else - [self.bridge.uiManager.observerCoordinator removeObserver:self]; -#endif // ABI46_0_0RN_FABRIC_ENABLED -} - -- (dispatch_queue_t)methodQueue -{ - // This module needs to be on the same queue as the UIManager to avoid - // having to lock `_operations` and `_preOperations` since `uiManagerWillFlushUIBlocks` - // will be called from that queue. - - // This is required as this module rely on having all the view nodes created before - // gesture handlers can be associated with them - return ABI46_0_0RCTGetUIManagerQueue(); -} - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -void decorateRuntime(jsi::Runtime &runtime) -{ - auto isFormsStackingContext = jsi::Function::createFromHostFunction( - runtime, - jsi::PropNameID::forAscii(runtime, "isFormsStackingContext"), - 1, - [](jsi::Runtime &runtime, - const jsi::Value &thisValue, - const jsi::Value *arguments, - size_t count) -> jsi::Value - { - if (!arguments[0].isObject()) - { - return jsi::Value::null(); - } - - auto shadowNode = arguments[0].asObject(runtime).getHostObject(runtime)->shadowNode; - bool isFormsStackingContext = shadowNode->getTraits().check(ShadowNodeTraits::FormsStackingContext); - - return jsi::Value(isFormsStackingContext); - }); - runtime.global().setProperty(runtime, "isFormsStackingContext", std::move(isFormsStackingContext)); -} -#endif // ABI46_0_0RN_FABRIC_ENABLED - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - [super setBridge:bridge]; - - _manager = [[ABI46_0_0RNGestureHandlerManager alloc] - initWithUIManager:bridge.uiManager - eventDispatcher:bridge.eventDispatcher]; - _operations = [NSMutableArray new]; - -#ifdef ABI46_0_0RN_FABRIC_ENABLED - [bridge.surfacePresenter addObserver:self]; -#else - [bridge.uiManager.observerCoordinator addObserver:self]; -#endif // ABI46_0_0RN_FABRIC_ENABLED -} - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) { - ABI46_0_0RCTCxxBridge *cxxBridge = (ABI46_0_0RCTCxxBridge *)self.bridge; - auto runtime = (jsi::Runtime *)cxxBridge.runtime; - decorateRuntime(*runtime); - return @true; -} -#endif // ABI46_0_0RN_FABRIC_ENABLED - -ABI46_0_0RCT_EXPORT_METHOD(createGestureHandler:(nonnull NSString *)handlerName tag:(nonnull NSNumber *)handlerTag config:(NSDictionary *)config) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager createGestureHandler:handlerName tag:handlerTag config:config]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(attachGestureHandler:(nonnull NSNumber *)handlerTag toViewWithTag:(nonnull NSNumber *)viewTag actionType:(nonnull NSNumber *)actionType) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager attachGestureHandler:handlerTag toViewWithTag:viewTag withActionType:(ABI46_0_0RNGestureHandlerActionType)[actionType integerValue]]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(updateGestureHandler:(nonnull NSNumber *)handlerTag config:(NSDictionary *)config) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager updateGestureHandler:handlerTag config:config]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(dropGestureHandler:(nonnull NSNumber *)handlerTag) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager dropGestureHandler:handlerTag]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(handleSetJSResponder:(nonnull NSNumber *)viewTag blockNativeResponder:(nonnull NSNumber *)blockNativeResponder) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager handleSetJSResponder:viewTag blockNativeResponder:blockNativeResponder]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(handleClearJSResponder) -{ - [self addOperationBlock:^(ABI46_0_0RNGestureHandlerManager *manager) { - [manager handleClearJSResponder]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(flushOperations) -{ - if (_operations.count == 0) { - return; - } - - NSArray *operations = _operations; - _operations = [NSMutableArray new]; - - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (GestureHandlerOperation operation in operations) { - operation(self->_manager); - } - }]; -} - -- (void)setGestureState:(int)state forHandler:(int)handlerTag -{ - ABI46_0_0RNGestureHandler *handler = [_manager handlerWithTag:@(handlerTag)]; - - if (handler != nil) { - if (state == 1) { // FAILED - handler.recognizer.state = UIGestureRecognizerStateFailed; - } else if (state == 2) { // BEGAN - handler.recognizer.state = UIGestureRecognizerStatePossible; - } else if (state == 3) { // CANCELLED - handler.recognizer.state = UIGestureRecognizerStateCancelled; - } else if (state == 4) { // ACTIVE - [handler stopActivationBlocker]; - handler.recognizer.state = UIGestureRecognizerStateBegan; - } else if (state == 5) { // ENDED - handler.recognizer.state = UIGestureRecognizerStateEnded; - } - } - - // if the gesture was set to finish, cancel all pointers it was tracking - if (state == 1 || state == 3 || state == 5) { - [handler.pointerTracker cancelPointers]; - } - - // do not send state change event when activating because it bypasses - // shouldRequireFailureOfGestureRecognizer - if (state != 4) { - [handler handleGesture:handler.recognizer]; - } -} - -#pragma mark -- Batch handling - -- (void)addOperationBlock:(GestureHandlerOperation)operation -{ - [_operations addObject:operation]; -} - -#pragma mark - ABI46_0_0RCTSurfacePresenterObserver - -#ifdef ABI46_0_0RN_FABRIC_ENABLED - -- (void)didMountComponentsWithRootTag:(NSInteger)rootTag -{ - ABI46_0_0RCTAssertMainQueue(); - - if (_operations.count == 0) { - return; - } - - NSArray *operations = _operations; - _operations = [NSMutableArray new]; - - for (GestureHandlerOperation operation in operations) { - operation(self->_manager); - } -} - -#else - -#pragma mark - ABI46_0_0RCTUIManagerObserver - -- (void)uiManagerWillFlushUIBlocks:(ABI46_0_0RCTUIManager *)uiManager -{ - [self uiManagerWillPerformMounting:uiManager]; -} - -- (void)uiManagerWillPerformMounting:(ABI46_0_0RCTUIManager *)uiManager -{ - if (_operations.count == 0) { - return; - } - - NSArray *operations = _operations; - _operations = [NSMutableArray new]; - - [uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (GestureHandlerOperation operation in operations) { - operation(self->_manager); - } - }]; -} - -#endif // ABI46_0_0RN_FABRIC_ENABLED - -#pragma mark Events - -- (NSArray *)supportedEvents -{ - return @[@"onGestureHandlerEvent", @"onGestureHandlerStateChange"]; -} - -#pragma mark Module Constants - -- (NSDictionary *)constantsToExport -{ - return @{ @"State": @{ - @"UNDETERMINED": @(ABI46_0_0RNGestureHandlerStateUndetermined), - @"BEGAN": @(ABI46_0_0RNGestureHandlerStateBegan), - @"ACTIVE": @(ABI46_0_0RNGestureHandlerStateActive), - @"CANCELLED": @(ABI46_0_0RNGestureHandlerStateCancelled), - @"FAILED": @(ABI46_0_0RNGestureHandlerStateFailed), - @"END": @(ABI46_0_0RNGestureHandlerStateEnd) - }, - @"Direction": @{ - @"RIGHT": @(ABI46_0_0RNGestureHandlerDirectionRight), - @"LEFT": @(ABI46_0_0RNGestureHandlerDirectionLeft), - @"UP": @(ABI46_0_0RNGestureHandlerDirectionUp), - @"DOWN": @(ABI46_0_0RNGestureHandlerDirectionDown) - } - }; -} - - - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.h deleted file mode 100644 index 7e283fbb459ec5..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -#import "ABI46_0_0RNGHTouchEventType.h" - -#define MAX_POINTERS_COUNT 12 - -@class ABI46_0_0RNGestureHandler; - -@interface ABI46_0_0RNGestureHandlerPointerTracker : NSObject - -@property (nonatomic) ABI46_0_0RNGHTouchEventType eventType; -@property (nonatomic) NSArray *changedPointersData; -@property (nonatomic) NSArray *allPointersData; -@property (nonatomic) int trackedPointersCount; - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; -- (void)reset; -- (void)cancelPointers; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.m deleted file mode 100644 index fefc1adffc78dc..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerPointerTracker.m +++ /dev/null @@ -1,240 +0,0 @@ -#import "ABI46_0_0RNGestureHandlerPointerTracker.h" -#import "ABI46_0_0RNGestureHandler.h" - -#import - -@implementation ABI46_0_0RNGestureHandlerPointerTracker { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - UITouch *_trackedPointers[MAX_POINTERS_COUNT]; - int _trackedPointersCount; -} - -- (id)initWithGestureHandler:(id)gestureHandler -{ - _gestureHandler = gestureHandler; - _trackedPointersCount = 0; - _changedPointersData = nil; - _allPointersData = nil; - - for (int i = 0; i < MAX_POINTERS_COUNT; i++) { - _trackedPointers[i] = nil; - } - - return self; -} - -- (int)registerTouch:(UITouch *)touch -{ - for (int index = 0; index < MAX_POINTERS_COUNT; index++) { - if (_trackedPointers[index] == nil) { - _trackedPointers[index] = touch; - return index; - } - } - - return -1; -} - -- (int)unregisterTouch:(UITouch *)touch -{ - for (int index = 0; index < MAX_POINTERS_COUNT; index++) { - if (_trackedPointers[index] == touch) { - _trackedPointers[index] = nil; - return index; - } - } - - return -1; -} - -- (int)findTouchIndex:(UITouch *)touch -{ - for (int index = 0; index < MAX_POINTERS_COUNT; index++) { - if (_trackedPointers[index] == touch) { - return index; - } - } - return -1; -} - -- (int)registeredTouchesCount -{ - int count = 0; - for (int i = 0; i < MAX_POINTERS_COUNT; i++) { - if (_trackedPointers[i] != nil) { - count++; - } - } - return count; -} - -- (NSDictionary *)extractPointerData:(int)index - forTouch:(UITouch *)touch -{ - CGPoint relativePos = [touch locationInView:_gestureHandler.recognizer.view]; - CGPoint absolutePos = [touch locationInView:_gestureHandler.recognizer.view.window]; - - return @{@"id": @(index), - @"x": @(relativePos.x), - @"y": @(relativePos.y), - @"absoluteX": @(absolutePos.x), - @"absoluteY": @(absolutePos.y)}; -} - -- (void)extractAllTouches { - int registeredTouches = [self registeredTouchesCount]; - - NSDictionary *data[registeredTouches]; - int nextIndex = 0; - - for (int i = 0; i < MAX_POINTERS_COUNT; i++) { - UITouch *touch = _trackedPointers[i]; - if (touch != nil) { - data[nextIndex++] = [self extractPointerData:i forTouch:touch]; - } - } - - _allPointersData = [[NSArray alloc] initWithObjects:data count:registeredTouches]; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (!_gestureHandler.needsPointerData) { - return; - } - - _eventType = ABI46_0_0RNGHTouchEventTypePointerDown; - - NSDictionary *data[touches.count]; - - for (int i = 0; i < [touches count]; i++) { - UITouch *touch = [[touches allObjects] objectAtIndex:i]; - int index = [self registerTouch:touch]; - if (index >= 0) { - _trackedPointersCount++; - } - - data[i] = [self extractPointerData:index forTouch:touch]; - } - - _changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]]; - // extract all touches last to include the ones that were just added - [self extractAllTouches]; - [self sendEvent]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (!_gestureHandler.needsPointerData) { - return; - } - - _eventType = ABI46_0_0RNGHTouchEventTypePointerMove; - - NSDictionary *data[touches.count]; - - for (int i = 0; i < [touches count]; i++) { - UITouch *touch = [[touches allObjects] objectAtIndex:i]; - int index = [self findTouchIndex:touch]; - data[i] = [self extractPointerData:index forTouch:touch]; - } - - _changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]]; - [self extractAllTouches]; - [self sendEvent]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (!_gestureHandler.needsPointerData) { - return; - } - - // extract all touches first to include the ones that were just lifted - [self extractAllTouches]; - - _eventType = ABI46_0_0RNGHTouchEventTypePointerUp; - - NSDictionary *data[touches.count]; - - for (int i = 0; i < [touches count]; i++) { - UITouch *touch = [[touches allObjects] objectAtIndex:i]; - int index = [self unregisterTouch:touch]; - if (index >= 0) { - _trackedPointersCount--; - } - - data[i] = [self extractPointerData:index forTouch:touch]; - } - - _changedPointersData = [[NSArray alloc] initWithObjects:data count:[touches count]]; - [self sendEvent]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (!_gestureHandler.needsPointerData) { - return; - } - - [self reset]; -} - -- (void)reset -{ - if (!_gestureHandler.needsPointerData) { - return; - } - - if (_trackedPointersCount == 0) { - // gesture has finished because all pointers were lifted, reset event type to send state change event - _eventType = ABI46_0_0RNGHTouchEventTypeUndetermined; - } else { - // turns out that the gesture may be made to fail without calling touchesCancelled in that case there - // are still tracked pointers but the recognizer state is already set to UIGestureRecognizerStateFailed - // we need to clear the pointers and send info about their cancellation - [self cancelPointers]; - } - - [_gestureHandler reset]; -} - -- (void)cancelPointers -{ - // extract all touches first to include the ones that were just cancelled - [self extractAllTouches]; - - int registeredTouches = [self registeredTouchesCount]; - - if (registeredTouches > 0) { - int nextIndex = 0; - NSDictionary *data[registeredTouches]; - - for (int i = 0; i < MAX_POINTERS_COUNT; i++) { - UITouch *touch = _trackedPointers[i]; - if (touch != nil) { - data[nextIndex++] = [self extractPointerData:i forTouch:touch]; - [self unregisterTouch:touch]; - } - } - - _eventType = ABI46_0_0RNGHTouchEventTypeCancelled; - _changedPointersData = [[NSArray alloc] initWithObjects:data count:registeredTouches]; - [self sendEvent]; - _trackedPointersCount = 0; - } -} - -- (void)sendEvent -{ - // it may happen that the gesture recognizer is reset after it's been unbound from the view, - // it that recognizer tried to send event, the app would crash because the target of the event - // would be nil. - if (!_gestureHandler.needsPointerData || _gestureHandler.recognizer.view.ABI46_0_0ReactTag == nil) { - return; - } - - [_gestureHandler sendTouchEventInState:[_gestureHandler state] forViewWithTag:_gestureHandler.recognizer.view.ABI46_0_0ReactTag]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.h deleted file mode 100644 index fc0bd2abb8d9f4..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ABI46_0_0RNGestureHandlerRegistry.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNGestureHandlerRegistry : NSObject - -- (nullable ABI46_0_0RNGestureHandler *)handlerWithTag:(nonnull NSNumber *)handlerTag; -- (void)registerGestureHandler:(nonnull ABI46_0_0RNGestureHandler *)gestureHandler; -- (void)attachHandlerWithTag:(nonnull NSNumber *)handlerTag toView:(nonnull UIView *)view withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType; -- (void)dropHandlerWithTag:(nonnull NSNumber *)handlerTag; -- (void)dropAllHandlers; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.m deleted file mode 100644 index 3962119739d02e..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRegistry.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// ABI46_0_0RNGestureHandlerRegistry.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandlerRegistry.h" - -#import - -@implementation ABI46_0_0RNGestureHandlerRegistry { - NSMutableDictionary *_handlers; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _handlers = [NSMutableDictionary new]; - } - return self; -} - -- (ABI46_0_0RNGestureHandler *)handlerWithTag:(NSNumber *)handlerTag -{ - return _handlers[handlerTag]; -} - -- (void)registerGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - _handlers[gestureHandler.tag] = gestureHandler; -} - -- (void)attachHandlerWithTag:(NSNumber *)handlerTag toView:(UIView *)view withActionType:(ABI46_0_0RNGestureHandlerActionType)actionType -{ - ABI46_0_0RNGestureHandler *handler = _handlers[handlerTag]; - ABI46_0_0RCTAssert(handler != nil, @"Handler for tag %@ does not exists", handlerTag); - [handler unbindFromView]; - handler.actionType = actionType; - [handler bindToView:view]; -} - -- (void)dropHandlerWithTag:(NSNumber *)handlerTag -{ - ABI46_0_0RNGestureHandler *handler = _handlers[handlerTag]; - [handler unbindFromView]; - [_handlers removeObjectForKey:handlerTag]; -} - -- (void)dropAllHandlers -{ - for (NSNumber* tag in _handlers) { - ABI46_0_0RNGestureHandler *handler = _handlers[tag]; - [handler unbindFromView]; - } - - [_handlers removeAllObjects]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRootViewComponentView.mm b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRootViewComponentView.mm deleted file mode 100644 index b320a03ab8d383..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerRootViewComponentView.mm +++ /dev/null @@ -1,21 +0,0 @@ -#ifdef ABI46_0_0RN_FABRIC_ENABLED - -#import "ABI46_0_0RCTFabricComponentsPlugins.h" - -Class ABI46_0_0RNGestureHandlerRootViewCls(void) -{ - // ABI46_0_0RNGestureHandlerRootView is Android-only. - // However, if we set `excludedPlatforms: ['iOS']` in `codegenNativeComponent`, - // codegen still generates `ABI46_0_0RNGestureHandlerRootViewShadowNode` (which it shouldn't) - // and thus the project fails to compile due to missing `ABI46_0_0RNGestureHandlerRootViewProps`. - // As a workaround, we could set `interfaceOnly: true` to disable autogenerating ShadowNode - // but then we would have to implement ComponentDescriptor and ShadowNode ourselves - // (probably just generate it once and keep the generated files in the repo) - // as well as make additional configuration so these files are actually compiled for Android. - // This simple trick allows us to have all the necessary files generated - // and compiled on Android while avoiding compilation errors on iOS. - // TODO: remove this file once `excludedPlatforms` option properly disables generating ShadowNode - return nil; -} - -#endif // ABI46_0_0RN_FABRIC_ENABLED diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerState.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerState.h deleted file mode 100644 index ffd7beb468b84f..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerState.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNGestureHandlerState) { - ABI46_0_0RNGestureHandlerStateUndetermined = 0, - ABI46_0_0RNGestureHandlerStateFailed, - ABI46_0_0RNGestureHandlerStateBegan, - ABI46_0_0RNGestureHandlerStateCancelled, - ABI46_0_0RNGestureHandlerStateActive, - ABI46_0_0RNGestureHandlerStateEnd, -}; diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerStateManager.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerStateManager.h deleted file mode 100644 index 1ab3ed8f020e21..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNGestureHandlerStateManager.h +++ /dev/null @@ -1,5 +0,0 @@ -@protocol ABI46_0_0RNGestureHandlerStateManager - --(void) setGestureState:(int)state forHandler:(int)handlerTag; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.h deleted file mode 100644 index 1112d09f1bfa6c..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -@class ABI46_0_0RNGestureHandler; - -@interface ABI46_0_0RNManualActivationRecognizer : UIGestureRecognizer - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler; -- (void)fail; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.m deleted file mode 100644 index 993141afdb7dfa..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNManualActivationRecognizer.m +++ /dev/null @@ -1,87 +0,0 @@ -#import "ABI46_0_0RNManualActivationRecognizer.h" -#import "ABI46_0_0RNGestureHandler.h" - -@implementation ABI46_0_0RNManualActivationRecognizer { - ABI46_0_0RNGestureHandler *_handler; - int _activePointers; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) { - _handler = gestureHandler; - self.delegate = self; - _activePointers = 0; - } - return self; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer -{ - if (recognizer.state == UIGestureRecognizerStateBegan) { - self.state = UIGestureRecognizerStateEnded; - [self reset]; - } -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - - _activePointers += touches.count; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - - _activePointers -= touches.count; - - if (_activePointers == 0) { - self.state = UIGestureRecognizerStateBegan; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - - _activePointers = 0; - [self reset]; -} - -- (void)reset -{ - self.enabled = YES; - [super reset]; -} - -- (void)fail -{ - self.enabled = NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return YES; -} - -- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - ABI46_0_0RNGestureHandler *handler = [ABI46_0_0RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer]; - if (handler != nil) { - if (handler.tag == _handler.tag) { - return YES; - } - } - - return NO; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.h deleted file mode 100644 index d9750bcddee509..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0RNRootViewGestureRecognizer.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNRootViewGestureRecognizer : UIGestureRecognizer - -@property (nullable, nonatomic, weak) id delegate; - -- (void)blockOtherRecognizers; - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.m deleted file mode 100644 index 5ac9efa4812691..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/ABI46_0_0RNRootViewGestureRecognizer.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// ABI46_0_0RNRootViewGestureRecognizer.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNRootViewGestureRecognizer.h" - -#import - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -#import -#else -#import -#endif // ABI46_0_0RN_FABRIC_ENABLED - - -@implementation ABI46_0_0RNRootViewGestureRecognizer -{ - BOOL _active; -} - -@dynamic delegate; - -- (instancetype)init -{ - if (self = [super init]) { - self.delaysTouchesEnded = NO; - self.delaysTouchesBegan = NO; - } - return self; -} - -- (BOOL)shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - // This method is used to implement "enabled" feature for gesture handlers. We enforce gesture - // recognizers that are connected with "disabled" handlers to wait for the root gesture - // recognizer to fail and this way we block them from acting. - ABI46_0_0RNGestureHandler *otherHandler = [ABI46_0_0RNGestureHandler - findGestureHandlerByRecognizer:otherGestureRecognizer]; - if (otherHandler != nil && otherHandler.enabled == NO) { - return YES; - } - return NO; -} - -- (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer -{ - return ![preventedGestureRecognizer isKindOfClass:[ -#ifdef ABI46_0_0RN_FABRIC_ENABLED - ABI46_0_0RCTSurfaceTouchHandler -#else - ABI46_0_0RCTTouchHandler -#endif - class]]; -} - -- (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer -{ - // When this method is called it means that one of handlers has activated, in this case we want - // to send an info to JS so that it cancells all JS responders - [self.delegate gestureRecognizer:preventingGestureRecognizer didActivateInViewWithTouchHandler:self.view]; - return [super canBePreventedByGestureRecognizer:preventingGestureRecognizer]; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - _active = YES; - self.state = UIGestureRecognizerStatePossible; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - self.state = UIGestureRecognizerStatePossible; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { - self.state = UIGestureRecognizerStateEnded; - } else { - self.state = UIGestureRecognizerStateFailed; - } - [self reset]; - _active = NO; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - self.state = UIGestureRecognizerStateCancelled; - [self reset]; - _active = NO; -} - -- (void)blockOtherRecognizers -{ - if (_active) { - self.state = UIGestureRecognizerStateBegan; - } -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.h deleted file mode 100644 index 1d7471db1fb8ed..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.h +++ /dev/null @@ -1,4 +0,0 @@ -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNFlingGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.m deleted file mode 100644 index 278954f0d1fe74..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNFlingHandler.m +++ /dev/null @@ -1,150 +0,0 @@ -#import "ABI46_0_0RNFlingHandler.h" - -@interface ABI46_0_0RNBetterSwipeGestureRecognizer : UISwipeGestureRecognizer - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNBetterSwipeGestureRecognizer { - __weak ABI46_0_0RNGestureHandler* _gestureHandler; - CGPoint _lastPoint; // location of the most recently updated touch, relative to the view - bool _hasBegan; // whether the `BEGAN` event has been sent -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - _lastPoint = CGPointZero; - _hasBegan = NO; - } - return self; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; - [_gestureHandler reset]; - [super touchesBegan:touches withEvent:event]; - - // self.numberOfTouches doesn't work for this because in case than one finger is required, - // when holding one finger on the screen and tapping with the second one, numberOfTouches is equal - // to 2 only for the first tap but 1 for all the following ones - if (!_hasBegan) { - [self triggerAction]; - _hasBegan = YES; - } - - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - _lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view]; - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)triggerAction -{ - [_gestureHandler handleGesture:self]; -} - -- (void)reset -{ - [self triggerAction]; - [_gestureHandler.pointerTracker reset]; - _hasBegan = NO; - [super reset]; -} - -- (CGPoint)getLastLocation { - // I think keeping the location of only one touch is enough since it would be used to determine the direction - // of the movement, and if it's wrong the recognizer fails anyway. - // In case the location of all touches is required, touch events are the way to go - return _lastPoint; -} - -@end - -@implementation ABI46_0_0RNFlingGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNBetterSwipeGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} -- (void)resetConfig -{ - [super resetConfig]; - UISwipeGestureRecognizer *recognizer = (UISwipeGestureRecognizer *)_recognizer; - recognizer.direction = UISwipeGestureRecognizerDirectionRight; -#if !TARGET_OS_TV - recognizer.numberOfTouchesRequired = 1; -#endif -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - UISwipeGestureRecognizer *recognizer = (UISwipeGestureRecognizer *)_recognizer; - - id prop = config[@"direction"]; - if (prop != nil) { - recognizer.direction = [ABI46_0_0RCTConvert NSInteger:prop]; - } - -#if !TARGET_OS_TV - prop = config[@"numberOfPointers"]; - if (prop != nil) { - recognizer.numberOfTouchesRequired = [ABI46_0_0RCTConvert NSInteger:prop]; - } -#endif -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ABI46_0_0RNGestureHandlerState savedState = _lastState; - BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer]; - _lastState = savedState; - - return shouldBegin; -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(id)_recognizer -{ - // For some weird reason [recognizer locationInView:recognizer.view.window] returns (0, 0). - // To calculate the correct absolute position, first calculate the absolute position of the - // view inside the root view controller (https://stackoverflow.com/a/7448573) and then - // add the relative touch position to it. - - ABI46_0_0RNBetterSwipeGestureRecognizer *recognizer = (ABI46_0_0RNBetterSwipeGestureRecognizer *)_recognizer; - - CGPoint viewAbsolutePosition = [recognizer.view convertPoint:recognizer.view.bounds.origin toView:[UIApplication sharedApplication].keyWindow.rootViewController.view]; - CGPoint locationInView = [recognizer getLastLocation]; - - return [ABI46_0_0RNGestureHandlerEventExtraData - forPosition:locationInView - withAbsolutePosition:CGPointMake(viewAbsolutePosition.x + locationInView.x, viewAbsolutePosition.y + locationInView.y) - withNumberOfTouches:recognizer.numberOfTouches]; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.h deleted file mode 100644 index 7cb2ad8ca74ce0..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.h +++ /dev/null @@ -1,4 +0,0 @@ -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNForceTouchHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.m deleted file mode 100644 index 8b9195d533d3ba..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNForceTouchHandler.m +++ /dev/null @@ -1,173 +0,0 @@ -#import "ABI46_0_0RNForceTouchHandler.h" - -#import - -#import - -@interface ABI46_0_0RNForceTouchGestureRecognizer : UIGestureRecognizer - -@property (nonatomic) CGFloat maxForce; -@property (nonatomic) CGFloat minForce; -@property (nonatomic) CGFloat force; -@property (nonatomic) BOOL feedbackOnActivation; - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNForceTouchGestureRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - UITouch *_firstTouch; -} - -static const CGFloat defaultForce = 0; -static const CGFloat defaultMinForce = 0.2; -static const CGFloat defaultMaxForce = NAN; -static const BOOL defaultFeedbackOnActivation = NO; - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - _force = defaultForce; - _minForce = defaultMinForce; - _maxForce = defaultMaxForce; - _feedbackOnActivation = defaultFeedbackOnActivation; - } - return self; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (_firstTouch) { - // ignore rest of fingers - return; - } - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; - - _firstTouch = [touches anyObject]; - [self handleForceWithTouches:touches]; - self.state = UIGestureRecognizerStatePossible; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (![touches containsObject:_firstTouch]) { - // Considered only the very first touch - return; - } - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; - - [self handleForceWithTouches:touches]; - - if ([self shouldFail]) { - self.state = UIGestureRecognizerStateFailed; - return; - } - - if (self.state == UIGestureRecognizerStatePossible && [self shouldActivate]) { - [self performFeedbackIfRequired]; - self.state = UIGestureRecognizerStateBegan; - } -} - -- (BOOL)shouldActivate { - return (_force >= _minForce); -} - -- (BOOL)shouldFail { - return TEST_MAX_IF_NOT_NAN(_force, _maxForce); -} - -- (void)performFeedbackIfRequired -{ -#if !TARGET_OS_TV - if (_feedbackOnActivation) { - if (@available(iOS 10.0, *)) { - [[[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)] impactOccurred]; - } - } -#endif -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - if (![touches containsObject:_firstTouch]) { - // Considered only the very first touch - return; - } - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - if (self.state == UIGestureRecognizerStateBegan || self.state == UIGestureRecognizerStateChanged) { - self.state = UIGestureRecognizerStateEnded; - } else { - self.state = UIGestureRecognizerStateFailed; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)handleForceWithTouches:(NSSet *)touches { - _force = _firstTouch.force / _firstTouch.maximumPossibleForce; -} - -- (void)reset { - [_gestureHandler.pointerTracker reset]; - [super reset]; - _force = 0; - _firstTouch = NULL; -} - -@end - -@implementation ABI46_0_0RNForceTouchHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNForceTouchGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} - -- (void)resetConfig -{ - [super resetConfig]; - ABI46_0_0RNForceTouchGestureRecognizer *recognizer = (ABI46_0_0RNForceTouchGestureRecognizer *)_recognizer; - - recognizer.feedbackOnActivation = defaultFeedbackOnActivation; - recognizer.maxForce = defaultMaxForce; - recognizer.minForce = defaultMinForce; -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - ABI46_0_0RNForceTouchGestureRecognizer *recognizer = (ABI46_0_0RNForceTouchGestureRecognizer *)_recognizer; - - APPLY_FLOAT_PROP(maxForce); - APPLY_FLOAT_PROP(minForce); - - id prop = config[@"feedbackOnActivation"]; - if (prop != nil) { - recognizer.feedbackOnActivation = [ABI46_0_0RCTConvert BOOL:prop]; - } -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(ABI46_0_0RNForceTouchGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forForce: recognizer.force - forPosition:[recognizer locationInView:recognizer.view] - withAbsolutePosition:[recognizer locationInView:recognizer.view.window] - withNumberOfTouches:recognizer.numberOfTouches]; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.h deleted file mode 100644 index 5fa7ea97b28827..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0RNLongPressHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNLongPressGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.m deleted file mode 100644 index 166fb40f09bdf2..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNLongPressHandler.m +++ /dev/null @@ -1,185 +0,0 @@ -// -// ABI46_0_0RNLongPressHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNLongPressHandler.h" - -#import - -#import - -#import - -@interface ABI46_0_0RNBetterLongPressGestureRecognizer : UILongPressGestureRecognizer { - uint64_t startTime; - uint64_t previousTime; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; -- (void)handleGesture:(UIGestureRecognizer *)recognizer; -- (NSUInteger) getDuration; - -@end - -@implementation ABI46_0_0RNBetterLongPressGestureRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - CGPoint _initPosition; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler -{ - if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - } - return self; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer -{ - previousTime = mach_absolute_time(); - [_gestureHandler handleGesture:recognizer]; -} - -- (void)triggerAction -{ - [self handleGesture:self]; -} - -- (CGPoint)translationInView -{ - CGPoint currentPosition = [self locationInView:self.view]; - return CGPointMake(currentPosition.x - _initPosition.x, currentPosition.y - _initPosition.y); -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; - - _initPosition = [self locationInView:self.view]; - startTime = mach_absolute_time(); - [_gestureHandler reset]; - [self triggerAction]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; - - CGPoint trans = [self translationInView]; - if ((_gestureHandler.shouldCancelWhenOutside && ![_gestureHandler containsPointInView]) - || (TEST_MAX_IF_NOT_NAN(fabs(trans.y * trans.y + trans.x + trans.x), self.allowableMovement * self.allowableMovement))) { - self.enabled = NO; - self.enabled = YES; - } -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)reset -{ - if (self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } - - [_gestureHandler.pointerTracker reset]; - - [super reset]; -} - -- (NSUInteger)getDuration -{ - static mach_timebase_info_data_t sTimebaseInfo; - - if (sTimebaseInfo.denom == 0) { - mach_timebase_info(&sTimebaseInfo); - } - - return (NSUInteger)(((previousTime - startTime) * sTimebaseInfo.numer / (sTimebaseInfo.denom * 1000000))); -} - -@end - - -@implementation ABI46_0_0RNLongPressGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNBetterLongPressGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} - -- (void)resetConfig -{ - [super resetConfig]; - UILongPressGestureRecognizer *recognizer = (UILongPressGestureRecognizer *)_recognizer; - - recognizer.minimumPressDuration = 0.5; - recognizer.allowableMovement = 10; -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - UILongPressGestureRecognizer *recognizer = (UILongPressGestureRecognizer *)_recognizer; - - id prop = config[@"minDurationMs"]; - if (prop != nil) { - recognizer.minimumPressDuration = [ABI46_0_0RCTConvert CGFloat:prop] / 1000.0; - } - - prop = config[@"maxDist"]; - if (prop != nil) { - recognizer.allowableMovement = [ABI46_0_0RCTConvert CGFloat:prop]; - } -} - -- (ABI46_0_0RNGestureHandlerState)state -{ - // For long press recognizer we treat "Began" state as "active" - // as it changes its state to "Began" as soon as the the minimum - // hold duration timeout is reached, whereas state "Changed" is - // only set after "Began" phase if there is some movement. - if (_recognizer.state == UIGestureRecognizerStateBegan) { - return ABI46_0_0RNGestureHandlerStateActive; - } - return [super state]; -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - //same as TapGH, this needs to be unified when all handlers are updated - ABI46_0_0RNGestureHandlerState savedState = _lastState; - BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer]; - _lastState = savedState; - - return shouldBegin; -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forPosition:[recognizer locationInView:recognizer.view] - withAbsolutePosition:[recognizer locationInView:recognizer.view.window] - withNumberOfTouches:recognizer.numberOfTouches - withDuration:[(ABI46_0_0RNBetterLongPressGestureRecognizer*)recognizer getDuration]]; -} -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.h deleted file mode 100644 index eab76a228859fc..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.h +++ /dev/null @@ -1,4 +0,0 @@ -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNManualGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.m deleted file mode 100644 index a42a3c5df5275c..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNManualHandler.m +++ /dev/null @@ -1,73 +0,0 @@ -#import "ABI46_0_0RNManualHandler.h" - -@interface ABI46_0_0RNManualRecognizer : UIGestureRecognizer - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNManualRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - BOOL _shouldSendBeginEvent; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - _shouldSendBeginEvent = YES; - } - return self; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; - - if (_shouldSendBeginEvent) { - [_gestureHandler handleGesture:self]; - _shouldSendBeginEvent = NO; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)reset -{ - [_gestureHandler.pointerTracker reset]; - [super reset]; - - _shouldSendBeginEvent = YES; -} - -@end - -@implementation ABI46_0_0RNManualGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNManualRecognizer alloc] initWithGestureHandler:self]; - - } - return self; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.h deleted file mode 100644 index 47f9d4e1e014f8..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0RNNativeViewHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNDummyGestureRecognizer : UIGestureRecognizer -@end - -@interface ABI46_0_0RNNativeViewGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.mm b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.mm deleted file mode 100644 index da6898e9e40b83..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNNativeViewHandler.mm +++ /dev/null @@ -1,189 +0,0 @@ -// -// ABI46_0_0RNNativeViewHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNNativeViewHandler.h" - -#import - -#import -#import - -#ifdef ABI46_0_0RN_FABRIC_ENABLED -#import -#else -#import -#endif // ABI46_0_0RN_FABRIC_ENABLED - -#pragma mark ABI46_0_0RNDummyGestureRecognizer - -@implementation ABI46_0_0RNDummyGestureRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - } - return self; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - self.state = UIGestureRecognizerStateFailed; - [self reset]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - self.state = UIGestureRecognizerStateCancelled; - [self reset]; -} - --(void)reset -{ - [_gestureHandler.pointerTracker reset]; - [super reset]; -} - -@end - -#pragma mark ABI46_0_0RNNativeViewgestureHandler - -@implementation ABI46_0_0RNNativeViewGestureHandler { - BOOL _shouldActivateOnStart; - BOOL _disallowInterruption; -} - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNDummyGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - _shouldActivateOnStart = [ABI46_0_0RCTConvert BOOL:config[@"shouldActivateOnStart"]]; - _disallowInterruption = [ABI46_0_0RCTConvert BOOL:config[@"disallowInterruption"]]; -} - -- (void)bindToView:(UIView *)view -{ - // For UIControl based views (UIButton, UISwitch) we provide special handling that would allow - // for properties like `disallowInterruption` to work. - if ([view isKindOfClass:[UIControl class]]) { - UIControl *control = (UIControl *)view; - [control addTarget:self action:@selector(handleTouchDown:forEvent:) forControlEvents:UIControlEventTouchDown]; - [control addTarget:self action:@selector(handleTouchUpOutside:forEvent:) forControlEvents:UIControlEventTouchUpOutside]; - [control addTarget:self action:@selector(handleTouchUpInside:forEvent:) forControlEvents:UIControlEventTouchUpInside]; - [control addTarget:self action:@selector(handleDragExit:forEvent:) forControlEvents:UIControlEventTouchDragExit]; - [control addTarget:self action:@selector(handleDragEnter:forEvent:) forControlEvents:UIControlEventTouchDragEnter]; - [control addTarget:self action:@selector(handleTouchCancel:forEvent:) forControlEvents:UIControlEventTouchCancel]; - } else { - [super bindToView:view]; - } - - // We can restore default scrollview behaviour to delay touches to scrollview's children - // because gesture handler system can handle cancellation of scroll recognizer when JS responder - // is set -#ifdef ABI46_0_0RN_FABRIC_ENABLED - if ([view isKindOfClass:[ABI46_0_0RCTScrollViewComponentView class]]) { - UIScrollView *scrollView = ((ABI46_0_0RCTScrollViewComponentView *)view).scrollView; - scrollView.delaysContentTouches = YES; - } -#else - if ([view isKindOfClass:[ABI46_0_0RCTScrollView class]]) { - // This part of the code is coupled with RN implementation of ScrollView native wrapper and - // we expect for ABI46_0_0RCTScrollView component to contain a subclass of UIScrollview as the only - // subview - UIScrollView *scrollView = [view.subviews objectAtIndex:0]; - scrollView.delaysContentTouches = YES; - } -#endif // ABI46_0_0RN_FABRIC_ENABLED -} - -- (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event -{ - [self reset]; - - if (_disallowInterruption) { - // When `disallowInterruption` is set we cancel all gesture handlers when this UIControl - // gets DOWN event - for (UITouch *touch in [event allTouches]) { - for (UIGestureRecognizer *recogn in [touch gestureRecognizers]) { - recogn.enabled = NO; - recogn.enabled = YES; - } - } - } - - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateActive - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:YES]]; -} - -- (void)handleTouchUpOutside:(UIView *)sender forEvent:(UIEvent *)event -{ - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateEnd - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:NO]]; -} - -- (void)handleTouchUpInside:(UIView *)sender forEvent:(UIEvent *)event -{ - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateEnd - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:YES]]; -} - -- (void)handleDragExit:(UIView *)sender forEvent:(UIEvent *)event -{ - // Pointer is moved outside of the view bounds, we cancel button when `shouldCancelWhenOutside` is set - if (self.shouldCancelWhenOutside) { - UIControl *control = (UIControl *)sender; - [control cancelTrackingWithEvent:event]; - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateEnd - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:NO]]; - } else { - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateActive - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:NO]]; - } -} - -- (void)handleDragEnter:(UIView *)sender forEvent:(UIEvent *)event -{ - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateActive - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:YES]]; -} - -- (void)handleTouchCancel:(UIView *)sender forEvent:(UIEvent *)event -{ - [self sendEventsInState:ABI46_0_0RNGestureHandlerStateCancelled - forViewWithTag:sender.ABI46_0_0ReactTag - withExtraData:[ABI46_0_0RNGestureHandlerEventExtraData forPointerInside:NO]]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.h deleted file mode 100644 index c2b656fa3e8c65..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0RNPanHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNPanGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.m deleted file mode 100644 index 3c2bf9bbd90d67..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPanHandler.m +++ /dev/null @@ -1,335 +0,0 @@ -// -// ABI46_0_0RNPanHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNPanHandler.h" - -#import - -@interface ABI46_0_0RNBetterPanGestureRecognizer : UIPanGestureRecognizer - -@property (nonatomic) CGFloat minDistSq; -@property (nonatomic) CGFloat minVelocityX; -@property (nonatomic) CGFloat minVelocityY; -@property (nonatomic) CGFloat minVelocitySq; -@property (nonatomic) CGFloat activeOffsetXStart; -@property (nonatomic) CGFloat activeOffsetXEnd; -@property (nonatomic) CGFloat failOffsetXStart; -@property (nonatomic) CGFloat failOffsetXEnd; -@property (nonatomic) CGFloat activeOffsetYStart; -@property (nonatomic) CGFloat activeOffsetYEnd; -@property (nonatomic) CGFloat failOffsetYStart; -@property (nonatomic) CGFloat failOffsetYEnd; -@property (nonatomic) CGFloat activateAfterLongPress; - - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - - -@implementation ABI46_0_0RNBetterPanGestureRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - NSUInteger _realMinimumNumberOfTouches; - BOOL _hasCustomActivationCriteria; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - _minDistSq = NAN; - _minVelocityX = NAN; - _minVelocityY = NAN; - _minVelocitySq = NAN; - _activeOffsetXStart = NAN; - _activeOffsetXEnd = NAN; - _failOffsetXStart = NAN; - _failOffsetXEnd = NAN; - _activeOffsetYStart = NAN; - _activeOffsetYEnd = NAN; - _failOffsetYStart = NAN; - _failOffsetYEnd = NAN; - _activateAfterLongPress = NAN; - _hasCustomActivationCriteria = NO; -#if !TARGET_OS_TV - _realMinimumNumberOfTouches = self.minimumNumberOfTouches; -#endif - } - return self; -} - -- (void)triggerAction -{ - [_gestureHandler handleGesture:self]; -} - -- (void)setMinimumNumberOfTouches:(NSUInteger)minimumNumberOfTouches -{ - _realMinimumNumberOfTouches = minimumNumberOfTouches; -} - -- (void)activateAfterLongPress -{ - self.state = UIGestureRecognizerStateBegan; - // Send event in ACTIVE state because UIGestureRecognizerStateBegan is mapped to ABI46_0_0RNGestureHandlerStateBegan - [_gestureHandler handleGesture:self inState:ABI46_0_0RNGestureHandlerStateActive]; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - if ([self numberOfTouches] == 0) { - [_gestureHandler reset]; - } -#if !TARGET_OS_TV - if (_hasCustomActivationCriteria) { - // We use "minimumNumberOfTouches" property to prevent pan handler from recognizing - // the gesture too early before we are sure that all criteria (e.g. minimum distance - // etc. are met) - super.minimumNumberOfTouches = 20; - } else { - super.minimumNumberOfTouches = _realMinimumNumberOfTouches; - } -#endif - [super touchesBegan:touches withEvent:event]; - [self triggerAction]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; - - if (!isnan(_activateAfterLongPress)) { - [self performSelector:@selector(activateAfterLongPress) withObject:nil afterDelay:_activateAfterLongPress]; - } -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; - - if (self.state == UIGestureRecognizerStatePossible && [self shouldFailUnderCustomCriteria]) { - self.state = UIGestureRecognizerStateFailed; - return; - } - if ((self.state == UIGestureRecognizerStatePossible || self.state == UIGestureRecognizerStateChanged)) { - if (_gestureHandler.shouldCancelWhenOutside && ![_gestureHandler containsPointInView]) { - // If the previous recognizer state is UIGestureRecognizerStateChanged - // then UIGestureRecognizer's sate machine will only transition to - // UIGestureRecognizerStateCancelled even if you set the state to - // UIGestureRecognizerStateFailed here. Making the behavior explicit. - self.state = (self.state == UIGestureRecognizerStatePossible) - ? UIGestureRecognizerStateFailed - : UIGestureRecognizerStateCancelled; - [self reset]; - return; - } - } - if (_hasCustomActivationCriteria && self.state == UIGestureRecognizerStatePossible && [self shouldActivateUnderCustomCriteria]) { -#if !TARGET_OS_TV - super.minimumNumberOfTouches = _realMinimumNumberOfTouches; - if ([self numberOfTouches] >= _realMinimumNumberOfTouches) { - self.state = UIGestureRecognizerStateBegan; - [self setTranslation:CGPointMake(0, 0) inView:self.view]; - } -#endif - } -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)reset -{ - [self triggerAction]; - [_gestureHandler.pointerTracker reset]; - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil]; - self.enabled = YES; - [super reset]; -} - -- (void)updateHasCustomActivationCriteria -{ - _hasCustomActivationCriteria = !isnan(_minDistSq) - || !isnan(_minVelocityX) || !isnan(_minVelocityY) || !isnan(_minVelocitySq) - || !isnan(_activeOffsetXStart) || !isnan(_activeOffsetXEnd) - || !isnan(_activeOffsetYStart) || !isnan(_activeOffsetYEnd); -} - -- (BOOL)shouldFailUnderCustomCriteria -{ - CGPoint trans = [self translationInView:self.view.window]; - // Apple docs say that 10 units is the default allowable movement for UILongPressGestureRecognizer - if (!isnan(_activateAfterLongPress) && trans.x * trans.x + trans.y * trans.y > 100) { - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil]; - return YES; - } - - if (!isnan(_failOffsetXStart) && trans.x < _failOffsetXStart) { - return YES; - } - if (!isnan(_failOffsetXEnd) && trans.x > _failOffsetXEnd) { - return YES; - } - if (!isnan(_failOffsetYStart) && trans.y < _failOffsetYStart) { - return YES; - } - if (!isnan(_failOffsetYEnd) && trans.y > _failOffsetYEnd) { - return YES; - } - return NO; -} - -- (BOOL)shouldActivateUnderCustomCriteria -{ - CGPoint trans = [self translationInView:self.view.window]; - if (!isnan(_activeOffsetXStart) && trans.x < _activeOffsetXStart) { - return YES; - } - if (!isnan(_activeOffsetXEnd) && trans.x > _activeOffsetXEnd) { - return YES; - } - if (!isnan(_activeOffsetYStart) && trans.y < _activeOffsetYStart) { - return YES; - } - if (!isnan(_activeOffsetYEnd) && trans.y > _activeOffsetYEnd) { - return YES; - } - - if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ(trans), _minDistSq)) { - return YES; - } - - CGPoint velocity = [self velocityInView:self.view]; - if (TEST_MIN_IF_NOT_NAN(velocity.x, _minVelocityX)) { - return YES; - } - if (TEST_MIN_IF_NOT_NAN(velocity.y, _minVelocityY)) { - return YES; - } - if (TEST_MIN_IF_NOT_NAN(VEC_LEN_SQ(velocity), _minVelocitySq)) { - return YES; - } - - return NO; -} - -@end - -@implementation ABI46_0_0RNPanGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNBetterPanGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} - -- (void)resetConfig -{ - [super resetConfig]; - ABI46_0_0RNBetterPanGestureRecognizer *recognizer = (ABI46_0_0RNBetterPanGestureRecognizer *)_recognizer; - recognizer.minVelocityX = NAN; - recognizer.minVelocityY = NAN; - recognizer.activeOffsetXStart = NAN; - recognizer.activeOffsetXEnd = NAN; - recognizer.failOffsetXStart = NAN; - recognizer.failOffsetXEnd = NAN; - recognizer.activeOffsetYStart = NAN; - recognizer.activeOffsetYEnd = NAN; - recognizer.failOffsetYStart = NAN; - recognizer.failOffsetYStart = NAN; - recognizer.failOffsetYEnd = NAN; -#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400 - if (@available(iOS 13.4, *)) { - recognizer.allowedScrollTypesMask = 0; - } -#endif -#if !TARGET_OS_TV - recognizer.minimumNumberOfTouches = 1; - recognizer.maximumNumberOfTouches = NSUIntegerMax; -#endif - recognizer.minDistSq = NAN; - recognizer.minVelocitySq = NAN; - recognizer.activateAfterLongPress = NAN; -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - ABI46_0_0RNBetterPanGestureRecognizer *recognizer = (ABI46_0_0RNBetterPanGestureRecognizer *)_recognizer; - - APPLY_FLOAT_PROP(minVelocityX); - APPLY_FLOAT_PROP(minVelocityY); - APPLY_FLOAT_PROP(activeOffsetXStart); - APPLY_FLOAT_PROP(activeOffsetXEnd); - APPLY_FLOAT_PROP(failOffsetXStart); - APPLY_FLOAT_PROP(failOffsetXEnd); - APPLY_FLOAT_PROP(activeOffsetYStart); - APPLY_FLOAT_PROP(activeOffsetYEnd); - APPLY_FLOAT_PROP(failOffsetYStart); - APPLY_FLOAT_PROP(failOffsetYEnd); - -#if !TARGET_OS_TV && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130400 - if (@available(iOS 13.4, *)) { - bool enableTrackpadTwoFingerGesture = [ABI46_0_0RCTConvert BOOL:config[@"enableTrackpadTwoFingerGesture"]]; - if(enableTrackpadTwoFingerGesture){ - recognizer.allowedScrollTypesMask = UIScrollTypeMaskAll; - } - } - - APPLY_NAMED_INT_PROP(minimumNumberOfTouches, @"minPointers"); - APPLY_NAMED_INT_PROP(maximumNumberOfTouches, @"maxPointers"); -#endif - - id prop = config[@"minDist"]; - if (prop != nil) { - CGFloat dist = [ABI46_0_0RCTConvert CGFloat:prop]; - recognizer.minDistSq = dist * dist; - } - - prop = config[@"minVelocity"]; - if (prop != nil) { - CGFloat velocity = [ABI46_0_0RCTConvert CGFloat:prop]; - recognizer.minVelocitySq = velocity * velocity; - } - - prop = config[@"activateAfterLongPress"]; - if (prop != nil) { - recognizer.activateAfterLongPress = [ABI46_0_0RCTConvert CGFloat:prop] / 1000.0; - recognizer.minDistSq = MAX(100, recognizer.minDistSq); - } - [recognizer updateHasCustomActivationCriteria]; -} - -- (BOOL) gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ABI46_0_0RNGestureHandlerState savedState = _lastState; - BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer]; - _lastState = savedState; - - return shouldBegin; -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIPanGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forPan:[recognizer locationInView:recognizer.view] - withAbsolutePosition:[recognizer locationInView:recognizer.view.window] - withTranslation:[recognizer translationInView:recognizer.view.window] - withVelocity:[recognizer velocityInView:recognizer.view.window] - withNumberOfTouches:recognizer.numberOfTouches]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.h deleted file mode 100644 index 67b6dc6c5d125f..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0RNPinchHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNPinchGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.m deleted file mode 100644 index 079810d8a7f9c3..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNPinchHandler.m +++ /dev/null @@ -1,96 +0,0 @@ - - -// -// ABI46_0_0RNPinchHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNPinchHandler.h" - -#if !TARGET_OS_TV -@interface ABI46_0_0RNBetterPinchRecognizer : UIPinchGestureRecognizer - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNBetterPinchRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - } - return self; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer -{ - if (self.state == UIGestureRecognizerStateBegan) { - self.scale = 1; - } - [_gestureHandler handleGesture:recognizer]; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)reset -{ - [_gestureHandler.pointerTracker reset]; - [super reset]; -} - -@end -#endif - -@implementation ABI46_0_0RNPinchGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { -#if !TARGET_OS_TV - _recognizer = [[ABI46_0_0RNBetterPinchRecognizer alloc] initWithGestureHandler:self]; -#endif - } - return self; -} - -#if !TARGET_OS_TV -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIPinchGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forPinch:recognizer.scale - withFocalPoint:[recognizer locationInView:recognizer.view] - withVelocity:recognizer.velocity - withNumberOfTouches:recognizer.numberOfTouches]; -} -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.h deleted file mode 100644 index b074fc3c214eb7..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0RNRotationHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNRotationGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.m deleted file mode 100644 index c748714c717a45..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNRotationHandler.m +++ /dev/null @@ -1,96 +0,0 @@ -// -// ABI46_0_0RNRotationHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNRotationHandler.h" - -#if !TARGET_OS_TV -@interface ABI46_0_0RNBetterRotationRecognizer : UIRotationGestureRecognizer - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNBetterRotationRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; -} - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler *)gestureHandler -{ - if ((self = [super initWithTarget:self action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - } - return self; -} - -- (void)handleGesture:(UIGestureRecognizer *)recognizer -{ - if (self.state == UIGestureRecognizerStateBegan) { - self.rotation = 0; - } - [_gestureHandler handleGesture:recognizer]; -} - - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; -} - -- (void)reset -{ - [_gestureHandler.pointerTracker reset]; - [super reset]; -} - -@end -#endif - -@implementation ABI46_0_0RNRotationGestureHandler - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - #if !TARGET_OS_TV - _recognizer = [[ABI46_0_0RNBetterRotationRecognizer alloc] initWithGestureHandler:self]; - #endif - } - return self; -} - -#if !TARGET_OS_TV -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIRotationGestureRecognizer *)recognizer -{ - return [ABI46_0_0RNGestureHandlerEventExtraData - forRotation:recognizer.rotation - withAnchorPoint:[recognizer locationInView:recognizer.view] - withVelocity:recognizer.velocity - withNumberOfTouches:recognizer.numberOfTouches]; -} -#endif - -@end - diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.h b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.h deleted file mode 100644 index 092a8c3fe9e46c..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0RNTapHandler.h -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNGestureHandler.h" - -@interface ABI46_0_0RNTapGestureHandler : ABI46_0_0RNGestureHandler -@end diff --git a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.m b/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.m deleted file mode 100644 index 2a177abcc44bc3..00000000000000 --- a/ios/vendored/sdk46/react-native-gesture-handler/ios/Handlers/ABI46_0_0RNTapHandler.m +++ /dev/null @@ -1,265 +0,0 @@ -// -// ABI46_0_0RNTapHandler.m -// ABI46_0_0RNGestureHandler -// -// Created by Krzysztof Magiera on 12/10/2017. -// Copyright © 2017 Software Mansion. All rights reserved. -// - -#import "ABI46_0_0RNTapHandler.h" - -#import - -#import - -// ABI46_0_0RNBetterTapGestureRecognizer extends UIGestureRecognizer instead of UITapGestureRecognizer -// because the latter does not allow for parameters like maxDelay, maxDuration, minPointers, -// maxDelta to be configured. Using our custom implementation of tap recognizer we are able -// to support these. - -@interface ABI46_0_0RNBetterTapGestureRecognizer : UIGestureRecognizer - -@property (nonatomic) NSUInteger numberOfTaps; -@property (nonatomic) NSTimeInterval maxDelay; -@property (nonatomic) NSTimeInterval maxDuration; -@property (nonatomic) CGFloat maxDistSq; -@property (nonatomic) CGFloat maxDeltaX; -@property (nonatomic) CGFloat maxDeltaY; -@property (nonatomic) NSInteger minPointers; - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler; - -@end - -@implementation ABI46_0_0RNBetterTapGestureRecognizer { - __weak ABI46_0_0RNGestureHandler *_gestureHandler; - NSUInteger _tapsSoFar; - CGPoint _initPosition; - NSInteger _maxNumberOfTouches; -} - -static const NSUInteger defaultNumberOfTaps = 1; -static const NSInteger defaultMinPointers = 1; -static const CGFloat defaultMaxDelay = 0.2; -static const NSTimeInterval defaultMaxDuration = 0.5; - -- (id)initWithGestureHandler:(ABI46_0_0RNGestureHandler*)gestureHandler -{ - if ((self = [super initWithTarget:gestureHandler action:@selector(handleGesture:)])) { - _gestureHandler = gestureHandler; - _tapsSoFar = 0; - _numberOfTaps = defaultNumberOfTaps; - _minPointers = defaultMinPointers; - _maxDelay = defaultMaxDelay; - _maxDuration = defaultMaxDuration; - _maxDeltaX = NAN; - _maxDeltaY = NAN; - _maxDistSq = NAN; - } - return self; -} - -- (void)triggerAction -{ - [_gestureHandler handleGesture:self]; -} - -- (void)cancel -{ - self.enabled = NO; -} - -- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesBegan:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesBegan:touches withEvent:event]; - - if (_tapsSoFar == 0) { - // this recognizer sends UNDETERMINED -> BEGAN state change event before gestureRecognizerShouldBegin - // is called (it resets the gesture handler), making it send whatever the last known state as oldState - // in the event. If we reset it here it correctly sends UNDETERMINED as oldState. - [_gestureHandler reset]; - _initPosition = [self locationInView:self.view.window]; - } - _tapsSoFar++; - if (_tapsSoFar) { - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil]; - } - NSInteger numberOfTouches = [touches count]; - if (numberOfTouches > _maxNumberOfTouches) { - _maxNumberOfTouches = numberOfTouches; - } - if (!isnan(_maxDuration)) { - [self performSelector:@selector(cancel) withObject:nil afterDelay:_maxDuration]; - } - self.state = UIGestureRecognizerStatePossible; - [self triggerAction]; -} - -- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesMoved:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesMoved:touches withEvent:event]; - - NSInteger numberOfTouches = [touches count]; - if (numberOfTouches > _maxNumberOfTouches) { - _maxNumberOfTouches = numberOfTouches; - } - - if (self.state != UIGestureRecognizerStatePossible) { - return; - } - - if ([self shouldFailUnderCustomCriteria]) { - self.state = UIGestureRecognizerStateFailed; - [self triggerAction]; - [self reset]; - return; - } - - self.state = UIGestureRecognizerStatePossible; - [self triggerAction]; -} - -- (CGPoint)translationInView { - CGPoint currentPosition = [self locationInView:self.view.window]; - return CGPointMake(currentPosition.x - _initPosition.x, currentPosition.y - _initPosition.y); -} - -- (BOOL)shouldFailUnderCustomCriteria -{ - if (_gestureHandler.shouldCancelWhenOutside) { - if (![_gestureHandler containsPointInView]) { - return YES; - } - } - - CGPoint trans = [self translationInView]; - if (TEST_MAX_IF_NOT_NAN(fabs(trans.x), _maxDeltaX)) { - return YES; - } - if (TEST_MAX_IF_NOT_NAN(fabs(trans.y), _maxDeltaY)) { - return YES; - } - if (TEST_MAX_IF_NOT_NAN(fabs(trans.y * trans.y + trans.x * trans.x), _maxDistSq)) { - return YES; - } - return NO; -} - -- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesEnded:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesEnded:touches withEvent:event]; - - if (_numberOfTaps == _tapsSoFar && _maxNumberOfTouches >= _minPointers) { - self.state = UIGestureRecognizerStateEnded; - [self reset]; - } else { - [self performSelector:@selector(cancel) withObject:nil afterDelay:_maxDelay]; - } -} - -- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event -{ - [super touchesCancelled:touches withEvent:event]; - [_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event]; - - self.state = UIGestureRecognizerStateCancelled; - [self reset]; -} - -- (void)reset -{ - if (self.state == UIGestureRecognizerStateFailed) { - [self triggerAction]; - } - [_gestureHandler.pointerTracker reset]; - - [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil]; - _tapsSoFar = 0; - _maxNumberOfTouches = 0; - self.enabled = YES; - [super reset]; -} - -@end - -@implementation ABI46_0_0RNTapGestureHandler { - ABI46_0_0RNGestureHandlerEventExtraData * _lastData; -} - -- (instancetype)initWithTag:(NSNumber *)tag -{ - if ((self = [super initWithTag:tag])) { - _recognizer = [[ABI46_0_0RNBetterTapGestureRecognizer alloc] initWithGestureHandler:self]; - } - return self; -} - -- (void)resetConfig -{ - [super resetConfig]; - ABI46_0_0RNBetterTapGestureRecognizer *recognizer = (ABI46_0_0RNBetterTapGestureRecognizer *)_recognizer; - - recognizer.numberOfTaps = defaultNumberOfTaps; - recognizer.minPointers = defaultMinPointers; - recognizer.maxDeltaX = NAN; - recognizer.maxDeltaY = NAN; - recognizer.maxDelay = defaultMaxDelay; - recognizer.maxDuration = defaultMaxDuration; - recognizer.maxDistSq = NAN; -} - -- (void)configure:(NSDictionary *)config -{ - [super configure:config]; - ABI46_0_0RNBetterTapGestureRecognizer *recognizer = (ABI46_0_0RNBetterTapGestureRecognizer *)_recognizer; - - APPLY_INT_PROP(numberOfTaps); - APPLY_INT_PROP(minPointers); - APPLY_FLOAT_PROP(maxDeltaX); - APPLY_FLOAT_PROP(maxDeltaY); - - id prop = config[@"maxDelayMs"]; - if (prop != nil) { - recognizer.maxDelay = [ABI46_0_0RCTConvert CGFloat:prop] / 1000.0; - } - - prop = config[@"maxDurationMs"]; - if (prop != nil) { - recognizer.maxDuration = [ABI46_0_0RCTConvert CGFloat:prop] / 1000.0; - } - - prop = config[@"maxDist"]; - if (prop != nil) { - CGFloat dist = [ABI46_0_0RCTConvert CGFloat:prop]; - recognizer.maxDistSq = dist * dist; - } -} - -- (ABI46_0_0RNGestureHandlerEventExtraData *)eventExtraData:(UIGestureRecognizer *)recognizer -{ - if (recognizer.state == UIGestureRecognizerStateEnded) { - return _lastData; - } - - _lastData = [super eventExtraData:recognizer]; - return _lastData; -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - // UNDETERMINED -> BEGAN state change event is sent before this method is called, - // in ABI46_0_0RNGestureHandler it resets _lastSatate variable, making is seem like handler - // went from UNDETERMINED to BEGAN and then from UNDETERMINED to ACTIVE. - // This way we preserve _lastState between events and keep correct state flow. - ABI46_0_0RNGestureHandlerState savedState = _lastState; - BOOL shouldBegin = [super gestureRecognizerShouldBegin:gestureRecognizer]; - _lastState = savedState; - - return shouldBegin; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-pager-view/ABI46_0_0react-native-pager-view.podspec.json b/ios/vendored/sdk46/react-native-pager-view/ABI46_0_0react-native-pager-view.podspec.json deleted file mode 100644 index 18ce7379f43a1a..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ABI46_0_0react-native-pager-view.podspec.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "ABI46_0_0react-native-pager-view", - "version": "5.4.24", - "summary": "ABI46_0_0React Native wrapper for Android and iOS ViewPager", - "homepage": "https://github.com/callstack/react-native-pager-view#readme", - "license": "MIT", - "authors": "troZee (https://github.com/callstack)", - "platforms": { - "ios": "10.0" - }, - "source": { - "git": "https://github.com/callstack/react-native-pager-view.git", - "tag": "5.4.24" - }, - "source_files": "ios/**/*.{h,m,mm,swift}", - "dependencies": { - "ABI46_0_0React-Core": [] - } -} diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.h deleted file mode 100644 index 5855f7addf3399..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.h +++ /dev/null @@ -1,11 +0,0 @@ - -#import -#import -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTConvert (UIPageViewControllerNavigationOrientation) - -@end - - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.m deleted file mode 100644 index 9600c4feb1c9c8..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.m +++ /dev/null @@ -1,11 +0,0 @@ - -#import "ABI46_0_0RCTConvert+UIPageViewControllerNavigationOrientation.h" - -@implementation ABI46_0_0RCTConvert (UIPageViewControllerNavigationOrientation) - -ABI46_0_0RCT_ENUM_CONVERTER(UIPageViewControllerNavigationOrientation, (@{ - @"horizontal": @(UIPageViewControllerNavigationOrientationHorizontal), - @"vertical": @(UIPageViewControllerNavigationOrientationVertical), - }), UIPageViewControllerNavigationOrientationHorizontal, integerValue) - -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.h deleted file mode 100644 index 45fe1ef48a2861..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.h +++ /dev/null @@ -1,10 +0,0 @@ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTConvert (UIPageViewControllerTransitionStyle) - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.m deleted file mode 100644 index 5786ab3c50a159..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.m +++ /dev/null @@ -1,11 +0,0 @@ - -#import "ABI46_0_0RCTConvert+UIPageViewControllerTransitionStyle.h" - -@implementation ABI46_0_0RCTConvert (UIPageViewControllerTransitionStyle) - -ABI46_0_0RCT_ENUM_CONVERTER(UIPageViewControllerTransitionStyle, (@{ - @"scroll": @(UIPageViewControllerTransitionStyleScroll), - @"curl": @(UIPageViewControllerTransitionStylePageCurl), - }), UIPageViewControllerTransitionStyleScroll, integerValue) - -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.h deleted file mode 100644 index 3adea9e09484cd..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.h +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTOnPageScrollEvent : NSObject - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - position:(NSNumber *)position - offset:(NSNumber *)offset; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.m deleted file mode 100644 index 7a9672437fb064..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollEvent.m +++ /dev/null @@ -1,60 +0,0 @@ -#import -#import "ABI46_0_0RCTOnPageScrollEvent.h" - -@implementation ABI46_0_0RCTOnPageScrollEvent -{ - NSNumber* _position; - NSNumber* _offset; -} - -@synthesize viewTag = _viewTag; - -- (NSString *)eventName { - return @"onPageScroll"; -} - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - position:(NSNumber *)position - offset:(NSNumber *)offset; -{ - ABI46_0_0RCTAssertParam(ABI46_0_0ReactTag); - - if ((self = [super init])) { - _viewTag = ABI46_0_0ReactTag; - _position = position; - _offset = offset; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) -- (uint16_t)coalescingKey -{ - return 0; -} - - -- (BOOL)canCoalesce -{ - return YES; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - return @[self.viewTag, ABI46_0_0RCTNormalizeInputEventName(self.eventName), @{ - @"position": _position, - @"offset": _offset - }]; -} - -- (id)coalesceWithEvent:(id)newEvent; -{ - return newEvent; -} - -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.h deleted file mode 100644 index 96ec3b7ad77d86..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.h +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTOnPageScrollStateChanged : NSObject - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - state:(NSString *)state - coalescingKey:(uint16_t)coalescingKey; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.m deleted file mode 100644 index af509532367500..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageScrollStateChanged.m +++ /dev/null @@ -1,59 +0,0 @@ -#import -#import "ABI46_0_0RCTOnPageScrollStateChanged.h" - -@implementation ABI46_0_0RCTOnPageScrollStateChanged -{ - NSString* _state; - uint16_t _coalescingKey; -} - -@synthesize viewTag = _viewTag; - -- (NSString *)eventName { - return @"onPageScrollStateChanged"; -} - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - state:(NSString *)state - coalescingKey:(uint16_t)coalescingKey; -{ - ABI46_0_0RCTAssertParam(ABI46_0_0ReactTag); - - if ((self = [super init])) { - _viewTag = ABI46_0_0ReactTag; - _state = state; - _coalescingKey = coalescingKey; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) -- (uint16_t)coalescingKey -{ - return _coalescingKey; -} - - -- (BOOL)canCoalesce -{ - return NO; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - return @[self.viewTag, ABI46_0_0RCTNormalizeInputEventName(self.eventName), @{ - @"pageScrollState": _state, - }]; -} - -- (id)coalesceWithEvent:(id)newEvent; -{ - return newEvent; -} - -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.h deleted file mode 100644 index 0183c43186e349..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.h +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTOnPageSelected : NSObject - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - position:(NSNumber *)position - coalescingKey:(uint16_t)coalescingKey; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.m deleted file mode 100644 index 70dca19fc0eac7..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0RCTOnPageSelected.m +++ /dev/null @@ -1,60 +0,0 @@ -#import -#import "ABI46_0_0RCTOnPageSelected.h" - -@implementation ABI46_0_0RCTOnPageSelected -{ - NSNumber* _position; - uint16_t _coalescingKey; -} - -@synthesize viewTag = _viewTag; - -- (NSString *)eventName { - return @"onPageSelected"; -} - -- (instancetype) initWithABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - position:(NSNumber *)position - coalescingKey:(uint16_t)coalescingKey; -{ - ABI46_0_0RCTAssertParam(ABI46_0_0ReactTag); - - if ((self = [super init])) { - _viewTag = ABI46_0_0ReactTag; - _position = position; - _coalescingKey = coalescingKey; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) -- (uint16_t)coalescingKey -{ - return _coalescingKey; -} - - -- (BOOL)canCoalesce -{ - return NO; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - return @[self.viewTag, ABI46_0_0RCTNormalizeInputEventName(self.eventName), @{ - @"position": _position, - }]; -} - -- (id)coalesceWithEvent:(id)newEvent; -{ - return newEvent; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.h deleted file mode 100644 index 048817d9cfd9eb..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.h +++ /dev/null @@ -1,36 +0,0 @@ -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0ReactNativePageView: UIView - -- (instancetype)initWithEventDispatcher:(ABI46_0_0RCTEventDispatcher *)eventDispatcher; - -@property(nonatomic) NSInteger initialPage; -@property(nonatomic) NSInteger lastReportedIndex; -@property(nonatomic) NSInteger currentIndex; -@property(nonatomic) NSInteger pageMargin; -@property(nonatomic, readonly) BOOL scrollEnabled; -@property(nonatomic, readonly) BOOL showPageIndicator; -@property(nonatomic, readonly) UIScrollViewKeyboardDismissMode dismissKeyboard; -@property(nonatomic) UIPageViewControllerTransitionStyle transitionStyle; -@property(nonatomic) UIPageViewControllerNavigationOrientation orientation; -@property(nonatomic, copy) ABI46_0_0RCTDirectEventBlock onPageSelected; -@property(nonatomic, copy) ABI46_0_0RCTDirectEventBlock onPageScroll; -@property(nonatomic, copy) ABI46_0_0RCTDirectEventBlock onPageScrollStateChanged; -@property(nonatomic) BOOL overdrag; -@property(nonatomic) NSString* layoutDirection; -@property(nonatomic) CGRect previousBounds; -@property(nonatomic, assign) BOOL animating; - -- (void)goTo:(NSInteger)index animated:(BOOL)animated; -- (void)shouldScroll:(BOOL)scrollEnabled; -- (void)shouldShowPageIndicator:(BOOL)showPageIndicator; -- (void)shouldDismissKeyboard:(NSString *)dismissKeyboard; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.m deleted file mode 100644 index 873f664d6cdbba..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactNativePageView.m +++ /dev/null @@ -1,512 +0,0 @@ - -#import "ABI46_0_0ReactNativePageView.h" -#import "ABI46_0_0React/ABI46_0_0RCTLog.h" -#import - -#import "UIViewController+CreateExtension.h" -#import "ABI46_0_0RCTOnPageScrollEvent.h" -#import "ABI46_0_0RCTOnPageScrollStateChanged.h" -#import "ABI46_0_0RCTOnPageSelected.h" -#import - -@interface ABI46_0_0ReactNativePageView () - -@property(nonatomic, strong) UIPageViewController *reactPageViewController; -@property(nonatomic, strong) UIPageControl *reactPageIndicatorView; -@property(nonatomic, strong) ABI46_0_0RCTEventDispatcher *eventDispatcher; - -@property(nonatomic, weak) UIScrollView *scrollView; -@property(nonatomic, weak) UIView *currentView; - -@property(nonatomic, strong) NSHashTable *cachedControllers; -@property(nonatomic, assign) CGPoint lastContentOffset; - -- (void)goTo:(NSInteger)index animated:(BOOL)animated; -- (void)shouldScroll:(BOOL)scrollEnabled; -- (void)shouldShowPageIndicator:(BOOL)showPageIndicator; -- (void)shouldDismissKeyboard:(NSString *)dismissKeyboard; - - -@end - -@implementation ABI46_0_0ReactNativePageView { - uint16_t _coalescingKey; -} - -- (instancetype)initWithEventDispatcher:(ABI46_0_0RCTEventDispatcher *)eventDispatcher { - if (self = [super init]) { - _scrollEnabled = YES; - _pageMargin = 0; - _lastReportedIndex = -1; - _transitionStyle = UIPageViewControllerTransitionStyleScroll; - _orientation = UIPageViewControllerNavigationOrientationHorizontal; - _currentIndex = 0; - _dismissKeyboard = UIScrollViewKeyboardDismissModeNone; - _coalescingKey = 0; - _eventDispatcher = eventDispatcher; - _cachedControllers = [NSHashTable hashTableWithOptions:NSHashTableStrongMemory]; - _overdrag = NO; - _layoutDirection = @"ltr"; - _previousBounds = CGRectMake(0, 0, 0, 0); - } - return self; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - if (self.reactPageViewController) { - [self shouldScroll:self.scrollEnabled]; - - if (!CGRectEqualToRect(self.previousBounds, CGRectMake(0, 0, 0, 0)) && !CGRectEqualToRect(self.bounds, self.previousBounds)) { - // Below line fix bug, where the view does not update after orientation changed. - [self updateDataSource]; - } - - self.previousBounds = CGRectMake(self.bounds.origin.x, self.bounds.origin.y, self.bounds.size.width, self.bounds.size.height); - } -} - -- (void)didUpdateABI46_0_0ReactSubviews { - if (!self.reactPageViewController && self.ABI46_0_0ReactViewController != nil) { - [self embed]; - [self setupInitialController]; - } else { - [self updateDataSource]; - } -} - -- (void)didMoveToSuperview { - [super didMoveToSuperview]; - if (!self.reactPageViewController && self.ABI46_0_0ReactViewController != nil) { - [self embed]; - [self setupInitialController]; - } -} - -- (void)didMoveToWindow { - [super didMoveToWindow]; - if (!self.reactPageViewController && self.ABI46_0_0ReactViewController != nil) { - [self embed]; - [self setupInitialController]; - } - - if (self.ABI46_0_0ReactViewController.navigationController != nil && self.ABI46_0_0ReactViewController.navigationController.interactivePopGestureRecognizer != nil) { - [self.scrollView.panGestureRecognizer requireGestureRecognizerToFail:self.ABI46_0_0ReactViewController.navigationController.interactivePopGestureRecognizer]; - } -} - -- (void)embed { - NSDictionary *options = @{ UIPageViewControllerOptionInterPageSpacingKey: @(self.pageMargin) }; - UIPageViewController *pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:self.transitionStyle - navigationOrientation:self.orientation - options:options]; - pageViewController.delegate = self; - pageViewController.dataSource = self; - - for (UIView *subview in pageViewController.view.subviews) { - if([subview isKindOfClass:UIScrollView.class]){ - ((UIScrollView *)subview).delegate = self; - ((UIScrollView *)subview).keyboardDismissMode = _dismissKeyboard; - ((UIScrollView *)subview).delaysContentTouches = YES; - self.scrollView = (UIScrollView *)subview; - } - } - - self.reactPageViewController = pageViewController; - - UIPageControl *pageIndicatorView = [self createPageIndicator]; - - pageIndicatorView.numberOfPages = self.ABI46_0_0ReactSubviews.count; - pageIndicatorView.currentPage = self.initialPage; - pageIndicatorView.hidden = !self.showPageIndicator; - - self.reactPageIndicatorView = pageIndicatorView; - - [self ABI46_0_0ReactAddControllerToClosestParent:pageViewController]; - [pageViewController.view addSubview:pageIndicatorView]; - [self addSubview:pageViewController.view]; - - pageViewController.view.frame = self.bounds; - - [self shouldScroll:self.scrollEnabled]; - - if (@available(iOS 9.0, *)) { - pageIndicatorView.translatesAutoresizingMaskIntoConstraints = NO; - NSLayoutConstraint *bottomConstraint = [pageIndicatorView.bottomAnchor constraintEqualToAnchor: pageViewController.view.bottomAnchor constant:0]; - NSLayoutConstraint *leadingConstraint = [pageIndicatorView.leadingAnchor constraintEqualToAnchor: pageViewController.view.leadingAnchor constant:0]; - NSLayoutConstraint *trailingConstraint = [pageIndicatorView.trailingAnchor constraintEqualToAnchor: pageViewController.view.trailingAnchor constant:0]; - - [NSLayoutConstraint activateConstraints:@[bottomConstraint, leadingConstraint, trailingConstraint]]; - } - [pageViewController.view layoutIfNeeded]; -} - -- (void)shouldScroll:(BOOL)scrollEnabled { - _scrollEnabled = scrollEnabled; - if (self.reactPageViewController.view) { - self.scrollView.scrollEnabled = scrollEnabled; - } -} - -- (void)shouldDismissKeyboard:(NSString *)dismissKeyboard { - _dismissKeyboard = [dismissKeyboard isEqual: @"on-drag"] ? - UIScrollViewKeyboardDismissModeOnDrag : UIScrollViewKeyboardDismissModeNone; - self.scrollView.keyboardDismissMode = _dismissKeyboard; -} - -- (void)setupInitialController { - UIView *initialView = self.ABI46_0_0ReactSubviews[self.initialPage]; - if (initialView) { - UIViewController *initialController = nil; - if (initialView.ABI46_0_0ReactViewController) { - initialController = initialView.ABI46_0_0ReactViewController; - } else { - initialController = [[UIViewController alloc] initWithView:initialView]; - } - - [self.cachedControllers addObject:initialController]; - - [self setABI46_0_0ReactViewControllers:self.initialPage - with:initialController - direction:UIPageViewControllerNavigationDirectionForward - animated:YES - shouldCallOnPageSelected:YES]; - } -} - -- (void)setABI46_0_0ReactViewControllers:(NSInteger)index - with:(UIViewController *)controller - direction:(UIPageViewControllerNavigationDirection)direction - animated:(BOOL)animated - shouldCallOnPageSelected:(BOOL)shouldCallOnPageSelected { - if (self.reactPageViewController == nil) { - return; - } - - NSArray *currentVCs = self.reactPageViewController.viewControllers; - if (currentVCs.count == 1 && [currentVCs.firstObject isEqual:controller]) { - // see: - // 1) https://github.com/callstack/react-native-pager-view/pull/462 - // 2) https://github.com/callstack/react-native-pager-view/issues/566 - [self.reactPageViewController setViewControllers:@[controller] - direction:direction - animated:YES - completion:nil]; - return; - } - - __weak ABI46_0_0ReactNativePageView *weakSelf = self; - uint16_t coalescingKey = _coalescingKey++; - - if (animated == YES) { - self.animating = YES; - } - - [self.reactPageViewController setViewControllers:@[controller] - direction:direction - animated:animated - completion:^(BOOL finished) { - __strong typeof(self) strongSelf = weakSelf; - strongSelf.currentIndex = index; - strongSelf.currentView = controller.view; - - if (finished) { - strongSelf.animating = NO; - } - - if (strongSelf.eventDispatcher) { - if (strongSelf.lastReportedIndex != strongSelf.currentIndex) { - if (shouldCallOnPageSelected) { - [strongSelf.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageSelected alloc] initWithABI46_0_0ReactTag:strongSelf.ABI46_0_0ReactTag position:@(index) coalescingKey:coalescingKey]]; - } - strongSelf.lastReportedIndex = strongSelf.currentIndex; - } - } - }]; -} - -- (UIViewController *)currentlyDisplayed { - return self.reactPageViewController.viewControllers.firstObject; -} - -- (UIViewController *)findCachedControllerForView:(UIView *)view { - for (UIViewController *controller in self.cachedControllers) { - if (controller.view.ABI46_0_0ReactTag == view.ABI46_0_0ReactTag) { - return controller; - } - } - return nil; -} - -- (void)updateDataSource { - if (!self.currentView && self.ABI46_0_0ReactSubviews.count == 0) { - return; - } - - NSInteger newIndex = self.currentView ? [self.ABI46_0_0ReactSubviews indexOfObject:self.currentView] : 0; - - if (newIndex == NSNotFound) { - // Current view was removed - NSInteger maxPage = self.ABI46_0_0ReactSubviews.count - 1; - NSInteger fallbackIndex = self.currentIndex >= maxPage ? maxPage : self.currentIndex; - - [self goTo:fallbackIndex animated:NO]; - } else { - [self goTo:newIndex animated:NO]; - } -} - -- (void)goTo:(NSInteger)index animated:(BOOL)animated { - NSInteger numberOfPages = self.ABI46_0_0ReactSubviews.count; - - if (numberOfPages == 0 || index < 0 || index > numberOfPages - 1) { - return; - } - - BOOL isForward = (index > self.currentIndex && [self isLtrLayout]) || (index < self.currentIndex && ![self isLtrLayout]); - UIPageViewControllerNavigationDirection direction = isForward ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse; - - self.reactPageIndicatorView.numberOfPages = numberOfPages; - self.reactPageIndicatorView.currentPage = index; - long diff = labs(index - _currentIndex); - - if (isForward && diff > 0) { - for (NSInteger i=_currentIndex; i<=index; i++) { - if (i == _currentIndex) { - continue; - } - [self goToViewController:i direction:direction animated:(!self.animating && i == index && animated) shouldCallOnPageSelected: i == index]; - } - } - - if (!isForward && diff > 0) { - for (NSInteger i=_currentIndex; i>=index; i--) { - // Prevent removal of one or many pages at a time - if (i == _currentIndex || i >= numberOfPages) { - continue; - } - [self goToViewController:i direction:direction animated:(!self.animating && i == index && animated) shouldCallOnPageSelected: i == index]; - } - } - - if (diff == 0) { - [self goToViewController:index direction:direction animated:NO shouldCallOnPageSelected:YES]; - } -} - -- (void)goToViewController:(NSInteger)index - direction:(UIPageViewControllerNavigationDirection)direction - animated:(BOOL)animated - shouldCallOnPageSelected:(BOOL)shouldCallOnPageSelected { - UIView *viewToDisplay = self.ABI46_0_0ReactSubviews[index]; - UIViewController *controllerToDisplay = [self findAndCacheControllerForView:viewToDisplay]; - [self setABI46_0_0ReactViewControllers:index - with:controllerToDisplay - direction:direction - animated:animated - shouldCallOnPageSelected:shouldCallOnPageSelected]; -} - -- (UIViewController *)findAndCacheControllerForView:(UIView *)viewToDisplay { - if (!viewToDisplay) { return nil; } - - UIViewController *controllerToDisplay = [self findCachedControllerForView:viewToDisplay]; - UIViewController *current = [self currentlyDisplayed]; - - if (!controllerToDisplay && current.view.ABI46_0_0ReactTag == viewToDisplay.ABI46_0_0ReactTag) { - controllerToDisplay = current; - } - if (!controllerToDisplay) { - if (viewToDisplay.ABI46_0_0ReactViewController) { - controllerToDisplay = viewToDisplay.ABI46_0_0ReactViewController; - } else { - controllerToDisplay = [[UIViewController alloc] initWithView:viewToDisplay]; - } - } - [self.cachedControllers addObject:controllerToDisplay]; - - return controllerToDisplay; -} - -- (UIViewController *)nextControllerForController:(UIViewController *)controller - inDirection:(UIPageViewControllerNavigationDirection)direction { - NSUInteger numberOfPages = self.ABI46_0_0ReactSubviews.count; - NSInteger index = [self.ABI46_0_0ReactSubviews indexOfObject:controller.view]; - - if (index == NSNotFound) { - return nil; - } - - direction == UIPageViewControllerNavigationDirectionForward ? index++ : index--; - - if (index < 0 || (index > (numberOfPages - 1))) { - return nil; - } - - UIView *viewToDisplay = self.ABI46_0_0ReactSubviews[index]; - - return [self findAndCacheControllerForView:viewToDisplay]; -} - -#pragma mark - UIPageViewControllerDelegate - -- (void)pageViewController:(UIPageViewController *)pageViewController - didFinishAnimating:(BOOL)finished - previousViewControllers:(nonnull NSArray *)previousViewControllers - transitionCompleted:(BOOL)completed { - - if (completed) { - UIViewController* currentVC = [self currentlyDisplayed]; - NSUInteger currentIndex = [self.ABI46_0_0ReactSubviews indexOfObject:currentVC.view]; - - self.currentIndex = currentIndex; - self.currentView = currentVC.view; - self.reactPageIndicatorView.currentPage = currentIndex; - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageSelected alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag position:@(currentIndex) coalescingKey:_coalescingKey++]]; - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageScrollEvent alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag position:@(currentIndex) offset:@(0.0)]]; - self.lastReportedIndex = currentIndex; - } -} - -#pragma mark - UIPageViewControllerDataSource - -- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController - viewControllerAfterViewController:(UIViewController *)viewController { - UIPageViewControllerNavigationDirection direction = [self isLtrLayout] ? UIPageViewControllerNavigationDirectionForward : UIPageViewControllerNavigationDirectionReverse; - return [self nextControllerForController:viewController inDirection:direction]; -} - -- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController - viewControllerBeforeViewController:(UIViewController *)viewController { - UIPageViewControllerNavigationDirection direction = [self isLtrLayout] ? UIPageViewControllerNavigationDirectionReverse : UIPageViewControllerNavigationDirectionForward; - return [self nextControllerForController:viewController inDirection:direction]; -} - -#pragma mark - UIPageControlDelegate - -- (void)shouldShowPageIndicator:(BOOL)showPageIndicator { - _showPageIndicator = showPageIndicator; - - if (self.reactPageIndicatorView) { - self.reactPageIndicatorView.hidden = !showPageIndicator; - } -} - -- (UIPageControl *)createPageIndicator { - UIPageControl *pageControl = [[UIPageControl alloc] init]; - pageControl.tintColor = UIColor.blackColor; - pageControl.pageIndicatorTintColor = UIColor.whiteColor; - pageControl.currentPageIndicatorTintColor = UIColor.blackColor; - [pageControl addTarget:self - action:@selector(pageControlValueChanged:) - forControlEvents:UIControlEventValueChanged]; - - return pageControl; -} - -- (void)pageControlValueChanged:(UIPageControl *)sender { - if (sender.currentPage != self.currentIndex) { - [self goTo:sender.currentPage animated:YES]; - } -} - -#pragma mark - UIScrollViewDelegate - -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView { - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageScrollStateChanged alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag state:@"dragging" coalescingKey:_coalescingKey++]]; -} - -- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset { - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageScrollStateChanged alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag state:@"settling" coalescingKey:_coalescingKey++]]; - - if (!_overdrag) { - NSInteger maxIndex = _reactPageIndicatorView.numberOfPages - 1; - BOOL isFirstPage = [self isLtrLayout] ? _currentIndex == 0 : _currentIndex == maxIndex; - BOOL isLastPage = [self isLtrLayout] ? _currentIndex == maxIndex : _currentIndex == 0; - CGFloat contentOffset =[self isHorizontal] ? scrollView.contentOffset.x : scrollView.contentOffset.y; - CGFloat topBound = [self isHorizontal] ? scrollView.bounds.size.width : scrollView.bounds.size.height; - - if ((isFirstPage && contentOffset <= topBound) || (isLastPage && contentOffset >= topBound)) { - CGPoint croppedOffset = [self isHorizontal] ? CGPointMake(topBound, 0) : CGPointMake(0, topBound); - *targetContentOffset = croppedOffset; - } - } -} - -- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageScrollStateChanged alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag state:@"idle" coalescingKey:_coalescingKey++]]; -} - -- (BOOL)isHorizontal { - return self.orientation == UIPageViewControllerNavigationOrientationHorizontal; -} - -- (void)scrollViewDidScroll:(UIScrollView *)scrollView { - CGPoint point = scrollView.contentOffset; - - float offset = 0; - - if (self.isHorizontal) { - if (self.frame.size.width != 0) { - offset = (point.x - self.frame.size.width)/self.frame.size.width; - } - } else { - if (self.frame.size.height != 0) { - offset = (point.y - self.frame.size.height)/self.frame.size.height; - } - } - - float absoluteOffset = fabs(offset); - - NSInteger position = self.currentIndex; - - - BOOL isAnimatingBackwards = ([self isLtrLayout] && offset<0) || (![self isLtrLayout] && offset > 0.05f); - if(isAnimatingBackwards){ - position = self.currentIndex - 1; - absoluteOffset = fmax(0, 1 - absoluteOffset); - } - - if (!_overdrag) { - NSInteger maxIndex = _reactPageIndicatorView.numberOfPages - 1; - NSInteger firstPageIndex = [self isLtrLayout] ? 0 : maxIndex; - NSInteger lastPageIndex = [self isLtrLayout] ? maxIndex : 0; - BOOL isFirstPage = _currentIndex == firstPageIndex; - BOOL isLastPage = _currentIndex == lastPageIndex; - CGFloat contentOffset =[self isHorizontal] ? scrollView.contentOffset.x : scrollView.contentOffset.y; - CGFloat topBound = [self isHorizontal] ? scrollView.bounds.size.width : scrollView.bounds.size.height; - - if ((isFirstPage && contentOffset <= topBound) || (isLastPage && contentOffset >= topBound)) { - CGPoint croppedOffset = [self isHorizontal] ? CGPointMake(topBound, 0) : CGPointMake(0, topBound); - scrollView.contentOffset = croppedOffset; - absoluteOffset=0; - position = isLastPage ? lastPageIndex : firstPageIndex; - } - } - - self.lastContentOffset = scrollView.contentOffset; - [self.eventDispatcher sendEvent:[[ABI46_0_0RCTOnPageScrollEvent alloc] initWithABI46_0_0ReactTag:self.ABI46_0_0ReactTag position:@(position) offset:@(absoluteOffset)]]; -} - -- (NSString *)determineScrollDirection:(UIScrollView *)scrollView { - NSString *scrollDirection; - if (self.isHorizontal) { - if (self.lastContentOffset.x > scrollView.contentOffset.x) { - scrollDirection = @"left"; - } else if (self.lastContentOffset.x < scrollView.contentOffset.x) { - scrollDirection = @"right"; - } - } else { - if (self.lastContentOffset.y > scrollView.contentOffset.y) { - scrollDirection = @"up"; - } else if (self.lastContentOffset.y < scrollView.contentOffset.y) { - scrollDirection = @"down"; - } - } - return scrollDirection; -} - -- (BOOL)isLtrLayout { - return [_layoutDirection isEqualToString:@"ltr"]; -} -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.h b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.h deleted file mode 100644 index d70981a61a9786..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.h +++ /dev/null @@ -1,13 +0,0 @@ - -#import -#import -#import -#import -#import "ABI46_0_0ReactNativePageView.h" -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0ReactViewPagerManager : ABI46_0_0RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.m b/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.m deleted file mode 100644 index cfc4d7ca3973f3..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/ABI46_0_0ReactViewPagerManager.m +++ /dev/null @@ -1,90 +0,0 @@ - -#import "ABI46_0_0ReactViewPagerManager.h" - -@implementation ABI46_0_0ReactViewPagerManager - -#pragma mark - RTC - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNCViewPager) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(initialPage, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pageMargin, NSInteger) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(transitionStyle, UIPageViewControllerTransitionStyle) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(orientation, UIPageViewControllerNavigationOrientation) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPageSelected, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPageScroll, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPageScrollStateChanged, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(overdrag, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(layoutDirection, NSString) - - -- (void) goToPage - : (nonnull NSNumber *)ABI46_0_0ReactTag index - : (nonnull NSNumber *)index animated - : (BOOL)animated { - [self.bridge.uiManager addUIBlock:^( - ABI46_0_0RCTUIManager *uiManager, - NSDictionary *viewRegistry) { - ABI46_0_0ReactNativePageView *view = (ABI46_0_0ReactNativePageView *)viewRegistry[ABI46_0_0ReactTag]; - if (!view || ![view isKindOfClass:[ABI46_0_0ReactNativePageView class]]) { - ABI46_0_0RCTLogError(@"Cannot find ABI46_0_0ReactNativePageView with tag #%@", ABI46_0_0ReactTag); - return; - } - if (!animated || !view.animating) { - [view goTo:index.integerValue animated:animated]; - } - }]; -} - -- (void) changeScrollEnabled -: (nonnull NSNumber *)ABI46_0_0ReactTag enabled -: (BOOL)enabled { - [self.bridge.uiManager addUIBlock:^( - ABI46_0_0RCTUIManager *uiManager, - NSDictionary *viewRegistry) { - ABI46_0_0ReactNativePageView *view = (ABI46_0_0ReactNativePageView *)viewRegistry[ABI46_0_0ReactTag]; - if (!view || ![view isKindOfClass:[ABI46_0_0ReactNativePageView class]]) { - ABI46_0_0RCTLogError(@"Cannot find ABI46_0_0ReactNativePageView with tag #%@", ABI46_0_0ReactTag); - return; - } - [view shouldScroll:enabled]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setPage - : (nonnull NSNumber *)ABI46_0_0ReactTag index - : (nonnull NSNumber *)index) { - [self goToPage:ABI46_0_0ReactTag index:index animated:true]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setPageWithoutAnimation - : (nonnull NSNumber *)ABI46_0_0ReactTag index - : (nonnull NSNumber *)index) { - [self goToPage:ABI46_0_0ReactTag index:index animated:false]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setScrollEnabled - : (nonnull NSNumber *)ABI46_0_0ReactTag enabled - : (nonnull NSNumber *)enabled) { - BOOL isEnabled = [enabled boolValue]; - [self changeScrollEnabled:ABI46_0_0ReactTag enabled:isEnabled]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, ABI46_0_0ReactNativePageView) { - [view shouldScroll:[ABI46_0_0RCTConvert BOOL:json]]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(keyboardDismissMode, NSString, ABI46_0_0ReactNativePageView) { - [view shouldDismissKeyboard:[ABI46_0_0RCTConvert NSString:json]]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(showPageIndicator, BOOL, ABI46_0_0ReactNativePageView) { - [view shouldShowPageIndicator:[ABI46_0_0RCTConvert BOOL:json]]; -} - -- (UIView *)view { - return [[ABI46_0_0ReactNativePageView alloc] initWithEventDispatcher:self.bridge.eventDispatcher]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.h b/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.h deleted file mode 100644 index 009e951786bd68..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface UIViewController (CreateExtension) - -- (instancetype)initWithView:(UIView *)view; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.m b/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.m deleted file mode 100644 index 715bd8cac36b69..00000000000000 --- a/ios/vendored/sdk46/react-native-pager-view/ios/UIViewController+CreateExtension.m +++ /dev/null @@ -1,12 +0,0 @@ -#import "UIViewController+CreateExtension.h" - -@implementation UIViewController (CreateExtension) - -- (instancetype)initWithView:(UIView *)view { - if (self = [self init]) { - self.view = view; - } - return self; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ABI46_0_0RNReanimated.podspec.json b/ios/vendored/sdk46/react-native-reanimated/ABI46_0_0RNReanimated.podspec.json deleted file mode 100644 index 5055d201b7284d..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ABI46_0_0RNReanimated.podspec.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "ABI46_0_0RNReanimated", - "version": "2.9.1", - "summary": "More powerful alternative to Animated library for ABI46_0_0React Native.", - "description": "ABI46_0_0RNReanimated", - "homepage": "https://github.com/software-mansion/react-native-reanimated", - "license": "MIT", - "authors": { - "author": "author@domain.cn" - }, - "platforms": { - "ios": "9.0", - "tvos": "9.0" - }, - "source": { - "git": "https://github.com/software-mansion/react-native-reanimated.git", - "tag": "2.9.1" - }, - "source_files": [ - "ios/**/*.{mm,h,m}", - "Common/cpp/**/*.cpp", - "Common/cpp/headers/**/*.h" - ], - "preserve_paths": [ - "Common/cpp/hidden_headers/**" - ], - "pod_target_xcconfig": { - "USE_HEADERMAP": "YES", - "HEADER_SEARCH_PATHS": "\"$(PODS_TARGET_SRCROOT)/ABI46_0_0ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/ABI46_0_0React-Core\" " - }, - "compiler_flags": "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=68 -Wno-comma -Wno-shorten-64-to-32 -Wno-documentation", - "xcconfig": { - "CLANG_CXX_LANGUAGE_STANDARD": "c++14", - "HEADER_SEARCH_PATHS": "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/boost-for-react-native\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/ABI46_0_0React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\"", - "OTHER_CFLAGS": "$(inherited) -DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DRNVERSION=68" - }, - "requires_arc": true, - "dependencies": { - "ABI46_0_0React-Core": [], - "FBLazyVector": [], - "FBReactNativeSpec": [], - "ABI46_0_0RCTRequired": [], - "ABI46_0_0RCTTypeSafety": [], - "ABI46_0_0React-CoreModules": [], - "ABI46_0_0React-Core/DevSupport": [], - "ABI46_0_0React-RCTActionSheet": [], - "ABI46_0_0React-RCTNetwork": [], - "ABI46_0_0React-RCTAnimation": [], - "ABI46_0_0React-RCTLinking": [], - "ABI46_0_0React-RCTBlob": [], - "ABI46_0_0React-RCTSettings": [], - "ABI46_0_0React-RCTText": [], - "ABI46_0_0React-RCTImage": [], - "ABI46_0_0React-Core/RCTWebSocket": [], - "ABI46_0_0React-cxxreact": [], - "ABI46_0_0React-jsi": [], - "ABI46_0_0React-jsiexecutor": [], - "ABI46_0_0React-jsinspector": [], - "ABI46_0_0ReactCommon/turbomodule/core": [], - "Yoga": [], - "DoubleConversion": [], - "glog": [], - "ABI46_0_0React-callinvoker": [], - "RCT-Folly": [] - } -} diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp deleted file mode 100644 index 70c7bf26696673..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/AnimatedSensor/AnimatedSensorModule.cpp +++ /dev/null @@ -1,72 +0,0 @@ -#include "AnimatedSensorModule.h" -#include "MutableValue.h" -#include "ValueWrapper.h" - -namespace ABI46_0_0reanimated { - -AnimatedSensorModule::AnimatedSensorModule( - const PlatformDepMethodsHolder &platformDepMethodsHolder, - RuntimeManager *runtimeManager) - : platformRegisterSensorFunction_(platformDepMethodsHolder.registerSensor), - platformUnregisterSensorFunction_( - platformDepMethodsHolder.unregisterSensor), - runtimeManager_(runtimeManager) {} - -AnimatedSensorModule::~AnimatedSensorModule() { - // It is called during app reload because app reload doesn't call hooks - // unmounting - for (auto sensorId : sensorsIds_) { - platformUnregisterSensorFunction_(sensorId); - } -} - -jsi::Value AnimatedSensorModule::registerSensor( - jsi::Runtime &rt, - const jsi::Value &sensorType, - const jsi::Value &interval, - const jsi::Value &sensorDataContainer) { - std::shared_ptr sensorsData = ShareableValue::adapt( - rt, sensorDataContainer.getObject(rt), runtimeManager_); - auto &mutableObject = - ValueWrapper::asMutableValue(sensorsData->valueContainer); - - std::function setter; - if (sensorType.asNumber() == SensorType::ROTATION_VECTOR) { - setter = [&, mutableObject](double newValues[]) { - jsi::Runtime &runtime = *runtimeManager_->runtime.get(); - jsi::Object value(runtime); - value.setProperty(runtime, "qw", newValues[0]); - value.setProperty(runtime, "qx", newValues[1]); - value.setProperty(runtime, "qy", newValues[2]); - value.setProperty(runtime, "qz", newValues[3]); - value.setProperty(runtime, "yaw", newValues[4]); - value.setProperty(runtime, "pitch", newValues[5]); - value.setProperty(runtime, "roll", newValues[6]); - mutableObject->setValue(runtime, std::move(value)); - }; - } else { - setter = [&, mutableObject](double newValues[]) { - jsi::Runtime &runtime = *runtimeManager_->runtime.get(); - jsi::Object value(runtime); - value.setProperty(runtime, "x", newValues[0]); - value.setProperty(runtime, "y", newValues[1]); - value.setProperty(runtime, "z", newValues[2]); - mutableObject->setValue(runtime, std::move(value)); - }; - } - - int sensorId = platformRegisterSensorFunction_( - sensorType.asNumber(), interval.asNumber(), setter); - if (sensorId != -1) { - sensorsIds_.insert(sensorId); - } - return jsi::Value(sensorId); -} - -void AnimatedSensorModule::unregisterSensor(const jsi::Value &sensorId) { - // It is called during sensor hook unmounting - sensorsIds_.erase(sensorId.getNumber()); - platformUnregisterSensorFunction_(sensorId.asNumber()); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp deleted file mode 100644 index e2c31f8e0ca3c2..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/LayoutAnimations/LayoutAnimationsProxy.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include "LayoutAnimationsProxy.h" -#include "FrozenObject.h" -#include "MutableValue.h" -#include "ShareableValue.h" -#include "ValueWrapper.h" - -namespace ABI46_0_0reanimated { - -const long long idOffset = 1e9; - -LayoutAnimationsProxy::LayoutAnimationsProxy( - std::function _notifyAboutProgress, - std::function _notifyAboutEnd) - : notifyAboutProgress(std::move(_notifyAboutProgress)), - notifyAboutEnd(std::move(_notifyAboutEnd)) {} - -void LayoutAnimationsProxy::startObserving( - int tag, - std::shared_ptr sv, - jsi::Runtime &rt) { - observedValues[tag] = sv; - sv->addListener(tag + idOffset, [sv, tag, this, &rt]() { - std::shared_ptr newValue = - ValueWrapper::asFrozenObject(sv->value->valueContainer); - this->notifyAboutProgress(tag, newValue->shallowClone(rt)); - }); -} - -void LayoutAnimationsProxy::stopObserving(int tag, bool finished) { - if (observedValues.count(tag) == 0) { - return; - } - std::shared_ptr sv = observedValues[tag]; - sv->removeListener(tag + idOffset); - observedValues.erase(tag); - this->notifyAboutEnd(tag, !finished); -} - -void LayoutAnimationsProxy::notifyAboutCancellation(int tag) { - this->notifyAboutEnd(tag, false); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp deleted file mode 100644 index 1d1f2cd83c23b2..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModule.cpp +++ /dev/null @@ -1,330 +0,0 @@ -#include "NativeReanimatedModule.h" -#include -#include -#include -#include "EventHandlerRegistry.h" -#include "FeaturesConfig.h" -#include "FrozenObject.h" -#include "JSIStoreValueUser.h" -#include "Mapper.h" -#include "MapperRegistry.h" -#include "MutableValue.h" -#include "ReanimatedHiddenHeaders.h" -#include "RuntimeDecorator.h" -#include "ShareableValue.h" -#include "WorkletEventHandler.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -void extractMutables( - jsi::Runtime &rt, - std::shared_ptr sv, - std::vector> &res) { - switch (sv->type) { - case ValueType::MutableValueType: { - auto &mutableValue = ValueWrapper::asMutableValue(sv->valueContainer); - res.push_back(mutableValue); - break; - } - case ValueType::FrozenArrayType: - for (auto &it : ValueWrapper::asFrozenArray(sv->valueContainer)) { - extractMutables(rt, it, res); - } - break; - case ValueType::RemoteObjectType: - case ValueType::FrozenObjectType: - for (auto &it : ValueWrapper::asFrozenObject(sv->valueContainer)->map) { - extractMutables(rt, it.second, res); - } - break; - default: - break; - } -} - -std::vector> extractMutablesFromArray( - jsi::Runtime &rt, - const jsi::Array &array, - NativeReanimatedModule *module) { - std::vector> res; - for (size_t i = 0, size = array.size(rt); i < size; i++) { - auto shareable = - ShareableValue::adapt(rt, array.getValueAtIndex(rt, i), module); - extractMutables(rt, shareable, res); - } - return res; -} - -NativeReanimatedModule::NativeReanimatedModule( - std::shared_ptr jsInvoker, - std::shared_ptr scheduler, - std::shared_ptr rt, - std::shared_ptr errorHandler, - std::function - propObtainer, - std::shared_ptr layoutAnimationsProxy, - PlatformDepMethodsHolder platformDepMethodsHolder) - : NativeReanimatedModuleSpec(jsInvoker), - RuntimeManager(rt, errorHandler, scheduler, RuntimeType::UI), - mapperRegistry(std::make_shared()), - eventHandlerRegistry(std::make_shared()), - requestRender(platformDepMethodsHolder.requestRender), - propObtainer(propObtainer), - animatedSensorModule(platformDepMethodsHolder, this), - configurePropsPlatformFunction( - platformDepMethodsHolder.configurePropsFunction) { - auto requestAnimationFrame = [=](FrameCallback callback) { - frameCallbacks.push_back(callback); - maybeRequestRender(); - }; - - this->layoutAnimationsProxy = layoutAnimationsProxy; - - RuntimeDecorator::decorateUIRuntime( - *runtime, - platformDepMethodsHolder.updaterFunction, - requestAnimationFrame, - platformDepMethodsHolder.scrollToFunction, - platformDepMethodsHolder.measuringFunction, - platformDepMethodsHolder.getCurrentTime, - platformDepMethodsHolder.registerSensor, - platformDepMethodsHolder.unregisterSensor, - platformDepMethodsHolder.setGestureStateFunction, - layoutAnimationsProxy); - onRenderCallback = [this](double timestampMs) { - this->renderRequested = false; - this->onRender(timestampMs); - }; - updaterFunction = platformDepMethodsHolder.updaterFunction; -} - -void NativeReanimatedModule::installCoreFunctions( - jsi::Runtime &rt, - const jsi::Value &valueSetter) { - this->valueSetter = ShareableValue::adapt(rt, valueSetter, this); -} - -jsi::Value NativeReanimatedModule::makeShareable( - jsi::Runtime &rt, - const jsi::Value &value) { - return ShareableValue::adapt(rt, value, this)->getValue(rt); -} - -jsi::Value NativeReanimatedModule::makeMutable( - jsi::Runtime &rt, - const jsi::Value &value) { - return ShareableValue::adapt(rt, value, this, ValueType::MutableValueType) - ->getValue(rt); -} - -jsi::Value NativeReanimatedModule::makeRemote( - jsi::Runtime &rt, - const jsi::Value &value) { - return ShareableValue::adapt(rt, value, this, ValueType::RemoteObjectType) - ->getValue(rt); -} - -jsi::Value NativeReanimatedModule::startMapper( - jsi::Runtime &rt, - const jsi::Value &worklet, - const jsi::Value &inputs, - const jsi::Value &outputs, - const jsi::Value &updater, - const jsi::Value &viewDescriptors) { - static unsigned long MAPPER_ID = 1; - - unsigned long newMapperId = MAPPER_ID++; - auto mapperShareable = ShareableValue::adapt(rt, worklet, this); - auto inputMutables = - extractMutablesFromArray(rt, inputs.asObject(rt).asArray(rt), this); - auto outputMutables = - extractMutablesFromArray(rt, outputs.asObject(rt).asArray(rt), this); - - int optimalizationLvl = 0; - auto optimalization = - updater.asObject(rt).getProperty(rt, "__optimalization"); - if (optimalization.isNumber()) { - optimalizationLvl = optimalization.asNumber(); - } - auto updaterSV = ShareableValue::adapt(rt, updater, this); - auto viewDescriptorsSV = ShareableValue::adapt(rt, viewDescriptors, this); - - scheduler->scheduleOnUI([=] { - auto mapperFunction = - mapperShareable->getValue(*runtime).asObject(*runtime).asFunction( - *runtime); - std::shared_ptr mapperFunctionPointer = - std::make_shared(std::move(mapperFunction)); - - std::shared_ptr mapperPointer = std::make_shared( - this, - newMapperId, - mapperFunctionPointer, - inputMutables, - outputMutables); - if (optimalizationLvl > 0) { - mapperPointer->enableFastMode( - optimalizationLvl, updaterSV, viewDescriptorsSV); - } - mapperRegistry->startMapper(mapperPointer); - maybeRequestRender(); - }); - - return jsi::Value(static_cast(newMapperId)); -} - -void NativeReanimatedModule::stopMapper( - jsi::Runtime &rt, - const jsi::Value &mapperId) { - unsigned long id = mapperId.asNumber(); - scheduler->scheduleOnUI([=] { - mapperRegistry->stopMapper(id); - maybeRequestRender(); - }); -} - -jsi::Value NativeReanimatedModule::registerEventHandler( - jsi::Runtime &rt, - const jsi::Value &eventHash, - const jsi::Value &worklet) { - static unsigned long EVENT_HANDLER_ID = 1; - - unsigned long newRegistrationId = EVENT_HANDLER_ID++; - auto eventName = eventHash.asString(rt).utf8(rt); - auto handlerShareable = ShareableValue::adapt(rt, worklet, this); - - scheduler->scheduleOnUI([=] { - auto handlerFunction = - handlerShareable->getValue(*runtime).asObject(*runtime).asFunction( - *runtime); - auto handler = std::make_shared( - newRegistrationId, eventName, std::move(handlerFunction)); - eventHandlerRegistry->registerEventHandler(handler); - }); - - return jsi::Value(static_cast(newRegistrationId)); -} - -void NativeReanimatedModule::unregisterEventHandler( - jsi::Runtime &rt, - const jsi::Value ®istrationId) { - unsigned long id = registrationId.asNumber(); - scheduler->scheduleOnUI( - [=] { eventHandlerRegistry->unregisterEventHandler(id); }); -} - -jsi::Value NativeReanimatedModule::getViewProp( - jsi::Runtime &rt, - const jsi::Value &viewTag, - const jsi::Value &propName, - const jsi::Value &callback) { - const int viewTagInt = static_cast(viewTag.asNumber()); - std::string propNameStr = propName.asString(rt).utf8(rt); - jsi::Function fun = callback.getObject(rt).asFunction(rt); - std::shared_ptr funPtr = - std::make_shared(std::move(fun)); - - scheduler->scheduleOnUI([&rt, viewTagInt, funPtr, this, propNameStr]() { - const jsi::String propNameValue = - jsi::String::createFromUtf8(rt, propNameStr); - jsi::Value result = propObtainer(rt, viewTagInt, propNameValue); - std::string resultStr = result.asString(rt).utf8(rt); - - scheduler->scheduleOnJS([&rt, resultStr, funPtr]() { - const jsi::String resultValue = - jsi::String::createFromUtf8(rt, resultStr); - funPtr->call(rt, resultValue); - }); - }); - - return jsi::Value::undefined(); -} - -jsi::Value NativeReanimatedModule::enableLayoutAnimations( - jsi::Runtime &rt, - const jsi::Value &config) { - FeaturesConfig::setLayoutAnimationEnabled(config.getBool()); - return jsi::Value::undefined(); -} - -jsi::Value NativeReanimatedModule::configureProps( - jsi::Runtime &rt, - const jsi::Value &uiProps, - const jsi::Value &nativeProps) { - configurePropsPlatformFunction(rt, uiProps, nativeProps); - return jsi::Value::undefined(); -} - -void NativeReanimatedModule::onEvent( - std::string eventName, - std::string eventAsString) { - try { - eventHandlerRegistry->processEvent(*runtime, eventName, eventAsString); - mapperRegistry->execute(*runtime); - if (mapperRegistry->needRunOnRender()) { - maybeRequestRender(); - } - } catch (std::exception &e) { - std::string str = e.what(); - this->errorHandler->setError(str); - this->errorHandler->raise(); - } catch (...) { - std::string str = "OnEvent error"; - this->errorHandler->setError(str); - this->errorHandler->raise(); - } -} - -bool NativeReanimatedModule::isAnyHandlerWaitingForEvent( - std::string eventName) { - return eventHandlerRegistry->isAnyHandlerWaitingForEvent(eventName); -} - -void NativeReanimatedModule::maybeRequestRender() { - if (!renderRequested) { - renderRequested = true; - requestRender(onRenderCallback, *this->runtime); - } -} - -void NativeReanimatedModule::onRender(double timestampMs) { - try { - std::vector callbacks = frameCallbacks; - frameCallbacks.clear(); - for (auto &callback : callbacks) { - callback(timestampMs); - } - mapperRegistry->execute(*runtime); - - if (mapperRegistry->needRunOnRender()) { - maybeRequestRender(); - } - } catch (std::exception &e) { - std::string str = e.what(); - this->errorHandler->setError(str); - this->errorHandler->raise(); - } catch (...) { - std::string str = "OnRender error"; - this->errorHandler->setError(str); - this->errorHandler->raise(); - } -} - -jsi::Value NativeReanimatedModule::registerSensor( - jsi::Runtime &rt, - const jsi::Value &sensorType, - const jsi::Value &interval, - const jsi::Value &sensorDataContainer) { - return animatedSensorModule.registerSensor( - rt, sensorType, interval, sensorDataContainer); -} - -void NativeReanimatedModule::unregisterSensor( - jsi::Runtime &rt, - const jsi::Value &sensorId) { - animatedSensorModule.unregisterSensor(sensorId); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp deleted file mode 100644 index a10e4cf6669426..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/NativeModules/NativeReanimatedModuleSpec.cpp +++ /dev/null @@ -1,167 +0,0 @@ -#include "NativeReanimatedModuleSpec.h" - -#define SPEC_PREFIX(FN_NAME) __hostFunction_NativeReanimatedModuleSpec_##FN_NAME - -namespace ABI46_0_0reanimated { - -static jsi::Value SPEC_PREFIX(installCoreFunctions)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->installCoreFunctions(rt, std::move(args[0])); - return jsi::Value::undefined(); -} - -// SharedValue - -static jsi::Value SPEC_PREFIX(makeShareable)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->makeShareable(rt, std::move(args[0])); -} - -static jsi::Value SPEC_PREFIX(makeMutable)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->makeMutable(rt, std::move(args[0])); -} - -static jsi::Value SPEC_PREFIX(makeRemote)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->makeRemote(rt, std::move(args[0])); -} - -static jsi::Value SPEC_PREFIX(startMapper)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->startMapper( - rt, - std::move(args[0]), - std::move(args[1]), - std::move(args[2]), - std::move(args[3]), - std::move(args[4])); -} - -static jsi::Value SPEC_PREFIX(stopMapper)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->stopMapper(rt, std::move(args[0])); - return jsi::Value::undefined(); -} - -static jsi::Value SPEC_PREFIX(registerEventHandler)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->registerEventHandler(rt, std::move(args[0]), std::move(args[1])); -} - -static jsi::Value SPEC_PREFIX(unregisterEventHandler)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->unregisterEventHandler(rt, std::move(args[0])); - return jsi::Value::undefined(); -} - -static jsi::Value SPEC_PREFIX(getViewProp)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->getViewProp( - rt, std::move(args[0]), std::move(args[1]), std::move(args[2])); - return jsi::Value::undefined(); -} - -static jsi::Value SPEC_PREFIX(enableLayoutAnimations)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->enableLayoutAnimations(rt, std::move(args[0])); - return jsi::Value::undefined(); -} - -static jsi::Value SPEC_PREFIX(registerSensor)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - return static_cast(&turboModule) - ->registerSensor( - rt, std::move(args[0]), std::move(args[1]), std::move(args[2])); -} - -static jsi::Value SPEC_PREFIX(unregisterSensor)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->unregisterSensor(rt, std::move(args[0])); - return jsi::Value::undefined(); -} - -static jsi::Value SPEC_PREFIX(configureProps)( - jsi::Runtime &rt, - TurboModule &turboModule, - const jsi::Value *args, - size_t count) { - static_cast(&turboModule) - ->configureProps(rt, std::move(args[0]), std::move(args[1])); - return jsi::Value::undefined(); -} - -NativeReanimatedModuleSpec::NativeReanimatedModuleSpec( - std::shared_ptr jsInvoker) - : TurboModule("NativeReanimated", jsInvoker) { - methodMap_["installCoreFunctions"] = - MethodMetadata{1, SPEC_PREFIX(installCoreFunctions)}; - - methodMap_["makeShareable"] = MethodMetadata{1, SPEC_PREFIX(makeShareable)}; - methodMap_["makeMutable"] = MethodMetadata{1, SPEC_PREFIX(makeMutable)}; - methodMap_["makeRemote"] = MethodMetadata{1, SPEC_PREFIX(makeRemote)}; - - methodMap_["startMapper"] = MethodMetadata{5, SPEC_PREFIX(startMapper)}; - methodMap_["stopMapper"] = MethodMetadata{1, SPEC_PREFIX(stopMapper)}; - - methodMap_["registerEventHandler"] = - MethodMetadata{2, SPEC_PREFIX(registerEventHandler)}; - methodMap_["unregisterEventHandler"] = - MethodMetadata{1, SPEC_PREFIX(unregisterEventHandler)}; - - methodMap_["getViewProp"] = MethodMetadata{3, SPEC_PREFIX(getViewProp)}; - methodMap_["enableLayoutAnimations"] = - MethodMetadata{2, SPEC_PREFIX(enableLayoutAnimations)}; - methodMap_["registerSensor"] = MethodMetadata{3, SPEC_PREFIX(registerSensor)}; - methodMap_["unregisterSensor"] = - MethodMetadata{1, SPEC_PREFIX(unregisterSensor)}; - methodMap_["configureProps"] = MethodMetadata{2, SPEC_PREFIX(configureProps)}; -} -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/EventHandlerRegistry.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/EventHandlerRegistry.cpp deleted file mode 100644 index 5fe53da11c1049..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/EventHandlerRegistry.cpp +++ /dev/null @@ -1,68 +0,0 @@ -#include "EventHandlerRegistry.h" -#include "WorkletEventHandler.h" - -namespace ABI46_0_0reanimated { - -void EventHandlerRegistry::registerEventHandler( - std::shared_ptr eventHandler) { - const std::lock_guard lock(instanceMutex); - eventMappings[eventHandler->eventName][eventHandler->id] = eventHandler; - eventHandlers[eventHandler->id] = eventHandler; -} - -void EventHandlerRegistry::unregisterEventHandler(unsigned long id) { - const std::lock_guard lock(instanceMutex); - auto handlerIt = eventHandlers.find(id); - if (handlerIt != eventHandlers.end()) { - eventMappings[handlerIt->second->eventName].erase(id); - if (eventMappings[handlerIt->second->eventName].empty()) { - eventMappings.erase(handlerIt->second->eventName); - } - eventHandlers.erase(handlerIt); - } -} - -void EventHandlerRegistry::processEvent( - jsi::Runtime &rt, - std::string eventName, - std::string eventPayload) { - std::vector> handlersForEvent; - { - const std::lock_guard lock(instanceMutex); - auto handlersIt = eventMappings.find(eventName); - if (handlersIt != eventMappings.end()) { - for (auto handler : handlersIt->second) { - handlersForEvent.push_back(handler.second); - } - } - } - // We receive here a JS Map with JSON as a value of NativeMap key - // { NativeMap: { "jsonProp": "json value" } } - // So we need to extract only JSON part - std::string delimimter = "NativeMap:"; - auto positionToSplit = eventPayload.find(delimimter) + delimimter.size(); - auto lastBracketCharactedPosition = eventPayload.size() - positionToSplit - 1; - auto eventJSON = - eventPayload.substr(positionToSplit, lastBracketCharactedPosition); - - if (eventJSON.compare(std::string("null")) == 0) { - return; - } - - auto eventObject = jsi::Value::createFromJsonUtf8( - rt, reinterpret_cast(&eventJSON[0]), eventJSON.size()); - - eventObject.asObject(rt).setProperty( - rt, "eventName", jsi::String::createFromUtf8(rt, eventName)); - for (auto handler : handlersForEvent) { - handler->process(rt, eventObject); - } -} - -bool EventHandlerRegistry::isAnyHandlerWaitingForEvent(std::string eventName) { - const std::lock_guard lock(instanceMutex); - auto it = eventMappings.find(eventName); - return (it != eventMappings.end()) && (!(it->second).empty()); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/MapperRegistry.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/MapperRegistry.cpp deleted file mode 100644 index f0e8883face842..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/MapperRegistry.cpp +++ /dev/null @@ -1,145 +0,0 @@ -#include "MapperRegistry.h" -#include -#include -#include -#include "Mapper.h" - -namespace ABI46_0_0reanimated { - -void MapperRegistry::startMapper(std::shared_ptr mapper) { - mappers[mapper->id] = mapper; - updatedSinceLastExecute = true; -} - -void MapperRegistry::stopMapper(unsigned long id) { - mappers.erase(id); - updatedSinceLastExecute = true; -} - -void MapperRegistry::execute(jsi::Runtime &rt) { - if (updatedSinceLastExecute) { - updateOrder(); - updatedSinceLastExecute = false; - } - for (auto &mapper : sortedMappers) { - if (mapper->dirty) { - mapper->execute(rt); - } - } -} - -bool MapperRegistry::needRunOnRender() { - return updatedSinceLastExecute; // TODO: also run if input nodes are dirty -} - -void MapperRegistry::updateOrder() { // Topological sorting - sortedMappers.clear(); - - struct NodeID { - std::shared_ptr mapper; - std::shared_ptr mutableValue; - - explicit NodeID(std::shared_ptr mapper) { - if (mapper == nullptr) { - throw std::runtime_error( - "Graph couldn't be sorted (Mapper cannot be nullptr)"); - } - this->mapper = mapper; - } - - explicit NodeID(std::shared_ptr mutableValue) { - if (mutableValue == nullptr) { - throw std::runtime_error( - "Graph couldn't be sorted (Mutable cannot be nullptr)"); - } - this->mutableValue = mutableValue; - } - - bool isMutable() const { - return mutableValue != nullptr; - } - - bool operator<(const NodeID &other) const { - if (isMutable() != other.isMutable()) - return isMutable() < other.isMutable(); - - if (isMutable()) { - return mutableValue < other.mutableValue; - } - - return mapper < other.mapper; - } - }; - - std::map deg; - - std::map, std::vector>> - mappersThatUseSharedValue; - - std::set> nodes; - - std::function update = [&](NodeID id) { - auto entry = std::make_pair(deg[id], id); - if (nodes.find(entry) == nodes.end()) - return; - nodes.erase(entry); - entry.first--; - deg[id]--; - nodes.insert(entry); - }; - - for (auto &entry : mappers) { - auto id = NodeID(entry.second); - auto &mapper = entry.second; - deg[id] = mapper->inputs.size(); - nodes.insert(std::make_pair(deg[id], id)); - - for (auto sharedValue : mapper->inputs) { - auto sharedValueID = NodeID(sharedValue); - mappersThatUseSharedValue[sharedValue].push_back(mapper); - if (deg.count(sharedValueID) == 0) { - deg[sharedValueID] = 0; - } - } - - for (auto sharedValue : mapper->outputs) { - deg[NodeID(sharedValue)]++; - } - } - - for (auto &entry : deg) { - auto id = entry.first; - if (id.isMutable()) { - nodes.insert(std::make_pair(entry.second, id)); - } - } - - while (nodes.size() > 0 && nodes.begin()->first == 0) { - auto entry = *nodes.begin(); - nodes.erase(entry); - - auto id = entry.second; - std::vector toUpdate; - - if (id.isMutable()) { - for (auto id : mappersThatUseSharedValue[id.mutableValue]) { - toUpdate.push_back(NodeID(id)); - } - } else { - for (auto sharedValue : id.mapper->outputs) { - toUpdate.push_back(NodeID(sharedValue)); - } - - sortedMappers.push_back(id.mapper); - } - - for (auto &id : toUpdate) - update(id); - } - - if (nodes.size() > 0) { - throw std::runtime_error("Cycle in mappers graph!"); - } -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/WorkletsCache.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/WorkletsCache.cpp deleted file mode 100644 index f032901cf59740..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Registries/WorkletsCache.cpp +++ /dev/null @@ -1,38 +0,0 @@ -#include "WorkletsCache.h" -#include "FrozenObject.h" -#include "ShareableValue.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -jsi::Value eval(jsi::Runtime &rt, const char *code) { - return rt.global().getPropertyAsFunction(rt, "eval").call(rt, code); -} - -jsi::Function function(jsi::Runtime &rt, const std::string &code) { - return eval(rt, ("(" + code + ")").c_str()).getObject(rt).getFunction(rt); -} - -std::shared_ptr WorkletsCache::getFunction( - jsi::Runtime &rt, - std::shared_ptr frozenObj) { - long long workletHash = - ValueWrapper::asNumber(frozenObj->map["__workletHash"]->valueContainer); - if (worklets.count(workletHash) == 0) { - auto codeBuffer = std::make_shared( - "(" + - ValueWrapper::asString(frozenObj->map["asString"]->valueContainer) + - ")"); - auto func = rt.evaluateJavaScript( - codeBuffer, - ValueWrapper::asString( - frozenObj->map["__location"]->valueContainer)) - .asObject(rt) - .asFunction(rt); - worklets[workletHash] = std::make_shared(std::move(func)); - } - return worklets[workletHash]; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/FrozenObject.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/FrozenObject.cpp deleted file mode 100644 index 1edbd861cf52aa..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/FrozenObject.cpp +++ /dev/null @@ -1,35 +0,0 @@ -#include "FrozenObject.h" -#include "RuntimeManager.h" -#include "ShareableValue.h" -#include "SharedParent.h" - -namespace ABI46_0_0reanimated { - -FrozenObject::FrozenObject( - jsi::Runtime &rt, - const jsi::Object &object, - RuntimeManager *runtimeManager) { - auto propertyNames = object.getPropertyNames(rt); - const size_t count = propertyNames.size(rt); - namesOrder.reserve(count); - for (size_t i = 0; i < count; i++) { - auto propertyName = propertyNames.getValueAtIndex(rt, i).asString(rt); - namesOrder.push_back(propertyName.utf8(rt)); - std::string nameStr = propertyName.utf8(rt); - map[nameStr] = ShareableValue::adapt( - rt, object.getProperty(rt, propertyName), runtimeManager); - this->containsHostFunction |= map[nameStr]->containsHostFunction; - } -} - -jsi::Object FrozenObject::shallowClone(jsi::Runtime &rt) { - jsi::Object object(rt); - for (auto propName : namesOrder) { - auto value = map[propName]; - object.setProperty( - rt, jsi::String::createFromUtf8(rt, propName), value->getValue(rt)); - } - return object; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValue.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValue.cpp deleted file mode 100644 index 55f7e972450f64..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValue.cpp +++ /dev/null @@ -1,132 +0,0 @@ -#include "MutableValue.h" -#include "RuntimeDecorator.h" -#include "RuntimeManager.h" -#include "ShareableValue.h" -#include "SharedParent.h" - -namespace ABI46_0_0reanimated { - -void MutableValue::setValue(jsi::Runtime &rt, const jsi::Value &newValue) { - std::lock_guard lock(readWriteMutex); - value = ShareableValue::adapt(rt, newValue, runtimeManager); - - std::shared_ptr thiz = shared_from_this(); - auto notifyListeners = [thiz]() { - for (auto listener : thiz->listeners) { - listener.second(); - } - }; - if (RuntimeDecorator::isUIRuntime(rt)) { - notifyListeners(); - } else { - runtimeManager->scheduler->scheduleOnUI( - [notifyListeners] { notifyListeners(); }); - } -} - -jsi::Value MutableValue::getValue(jsi::Runtime &rt) { - std::lock_guard lock(readWriteMutex); - return value->getValue(rt); -} - -void MutableValue::set( - jsi::Runtime &rt, - const jsi::PropNameID &name, - const jsi::Value &newValue) { - auto propName = name.utf8(rt); - if (!runtimeManager->valueSetter) { - throw jsi::JSError( - rt, - "Value-Setter is not yet configured! Make sure the core-functions are installed."); - } - - if (RuntimeDecorator::isUIRuntime(rt)) { - // UI thread - if (propName == "value") { - auto setterProxy = jsi::Object::createFromHostObject( - rt, std::make_shared(shared_from_this())); - runtimeManager->valueSetter->getValue(rt) - .asObject(rt) - .asFunction(rt) - .callWithThis(rt, setterProxy, newValue); - } else if (propName == "_animation") { - // TODO: assert to allow animation to be set from UI only - if (animation.expired()) { - animation = getWeakRef(rt); - } - *animation.lock() = jsi::Value(rt, newValue); - } else if (propName == "_value") { - auto setter = - std::make_shared(shared_from_this()); - setter->set(rt, jsi::PropNameID::forAscii(rt, "_value"), newValue); - } - } else { - // ABI46_0_0React-JS Thread or another threaded Runtime. - if (propName == "value") { - auto shareable = ShareableValue::adapt(rt, newValue, runtimeManager); - runtimeManager->scheduler->scheduleOnUI([this, shareable] { - jsi::Runtime &rt = *this->runtimeManager->runtime.get(); - auto setterProxy = jsi::Object::createFromHostObject( - rt, std::make_shared(shared_from_this())); - jsi::Value newValue = shareable->getValue(rt); - runtimeManager->valueSetter->getValue(rt) - .asObject(rt) - .asFunction(rt) - .callWithThis(rt, setterProxy, newValue); - }); - } - } -} - -jsi::Value MutableValue::get(jsi::Runtime &rt, const jsi::PropNameID &name) { - auto propName = name.utf8(rt); - - if (propName == "value") { - return getValue(rt); - } - - if (RuntimeDecorator::isUIRuntime(rt)) { - // _value and _animation should be accessed from UI only - if (propName == "_value") { - return getValue(rt); - } else if (propName == "_animation") { - // TODO: assert to allow animation to be read from UI only - if (animation.expired()) { - animation = getWeakRef(rt); - } - return jsi::Value(rt, *(animation.lock())); - } - } - - return jsi::Value::undefined(); -} - -std::vector MutableValue::getPropertyNames(jsi::Runtime &rt) { - std::vector result; - result.push_back(jsi::PropNameID::forUtf8(rt, std::string("value"))); - return result; -} - -MutableValue::MutableValue( - jsi::Runtime &rt, - const jsi::Value &initial, - RuntimeManager *runtimeManager, - std::shared_ptr s) - : StoreUser(s, *runtimeManager), - runtimeManager(runtimeManager), - value(ShareableValue::adapt(rt, initial, runtimeManager)) {} - -unsigned long int MutableValue::addListener( - unsigned long id, - std::function listener) { - listeners[id] = listener; - return id; -} - -void MutableValue::removeListener(unsigned long listenerId) { - if (listeners.count(listenerId) > 0) { - listeners.erase(listenerId); - } -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValueSetterProxy.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValueSetterProxy.cpp deleted file mode 100644 index 8f394236e6e0c3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/MutableValueSetterProxy.cpp +++ /dev/null @@ -1,47 +0,0 @@ -#include "MutableValueSetterProxy.h" -#include -#include "MutableValue.h" -#include "SharedParent.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -void MutableValueSetterProxy::set( - jsi::Runtime &rt, - const jsi::PropNameID &name, - const jsi::Value &newValue) { - auto propName = name.utf8(rt); - if (propName == "_value") { - mutableValue->setValue(rt, newValue); - } else if (propName == "_animation") { - // TODO: assert to allow animation to be set from UI only - if (mutableValue->animation.expired()) { - mutableValue->animation = mutableValue->getWeakRef(rt); - } - *mutableValue->animation.lock() = jsi::Value(rt, newValue); - } else if (propName == "value") { - // you call `this.value` inside of value setter, we should throw - } -} - -jsi::Value MutableValueSetterProxy::get( - jsi::Runtime &rt, - const jsi::PropNameID &name) { - auto propName = name.utf8(rt); - - if (propName == "value") { - return mutableValue->getValue(rt); - } else if (propName == "_value") { - return mutableValue->getValue(rt); - } else if (propName == "_animation") { - if (mutableValue->animation.expired()) { - mutableValue->animation = mutableValue->getWeakRef(rt); - } - return jsi::Value(rt, *mutableValue->animation.lock()); - } - - return jsi::Value::undefined(); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/RemoteObject.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/RemoteObject.cpp deleted file mode 100644 index 5d6ba931972ef3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/RemoteObject.cpp +++ /dev/null @@ -1,45 +0,0 @@ -#include "RemoteObject.h" -#include -#include "RuntimeDecorator.h" -#include "SharedParent.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -void RemoteObject::maybeInitializeOnWorkletRuntime(jsi::Runtime &rt) { - if (initializer.get() != nullptr) { - backing = getWeakRef(rt); - *backing.lock() = initializer->shallowClone(rt); - initializer = nullptr; - } -} - -jsi::Value RemoteObject::get(jsi::Runtime &rt, const jsi::PropNameID &name) { - if (RuntimeDecorator::isWorkletRuntime(rt)) { - return backing.lock()->getObject(rt).getProperty(rt, name); - } - return jsi::Value::undefined(); -} - -void RemoteObject::set( - jsi::Runtime &rt, - const jsi::PropNameID &name, - const jsi::Value &value) { - if (RuntimeDecorator::isWorkletRuntime(rt)) { - backing.lock()->getObject(rt).setProperty(rt, name, value); - } - // TODO: we should throw if trying to update remote from host runtime -} - -std::vector RemoteObject::getPropertyNames(jsi::Runtime &rt) { - std::vector res; - auto propertyNames = backing.lock()->getObject(rt).getPropertyNames(rt); - for (size_t i = 0, size = propertyNames.size(rt); i < size; i++) { - res.push_back(jsi::PropNameID::forString( - rt, propertyNames.getValueAtIndex(rt, i).asString(rt))); - } - return res; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/ShareableValue.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/ShareableValue.cpp deleted file mode 100644 index 1204e327307617..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/SharedItems/ShareableValue.cpp +++ /dev/null @@ -1,507 +0,0 @@ -#include -#include "FrozenObject.h" -#include "MutableValue.h" -#include "MutableValueSetterProxy.h" -#include "RemoteObject.h" -#include "RuntimeDecorator.h" -#include "RuntimeManager.h" -#include "SharedParent.h" - -namespace ABI46_0_0reanimated { -class ShareableValue; -const char *HIDDEN_HOST_OBJECT_PROP = "__reanimatedHostObjectRef"; -const char *ALREADY_CONVERTED = "__alreadyConverted"; -const char *CALL_ASYNC = "__callAsync"; -const char *PRIMAL_FUNCTION = "__primalFunction"; -const char *CALLBACK_ERROR_SUFFIX = - "\n\nPossible solutions are:\n" - "a) If you want to synchronously execute this method, mark it as a Worklet\n" - "b) If you want to execute this method on the JS thread, wrap it using runOnJS"; - -void addHiddenProperty( - jsi::Runtime &rt, - jsi::Value &&value, - const jsi::Object &obj, - const char *name) { - jsi::Object globalObject = rt.global().getPropertyAsObject(rt, "Object"); - jsi::Function defineProperty = - globalObject.getPropertyAsFunction(rt, "defineProperty"); - jsi::String internalPropName = jsi::String::createFromUtf8(rt, name); - jsi::Object paramForDefineProperty(rt); - paramForDefineProperty.setProperty(rt, "enumerable", false); - paramForDefineProperty.setProperty(rt, "value", value); - defineProperty.call(rt, obj, internalPropName, paramForDefineProperty); -} - -void freeze(jsi::Runtime &rt, const jsi::Object &obj) { - jsi::Object globalObject = rt.global().getPropertyAsObject(rt, "Object"); - jsi::Function freeze = globalObject.getPropertyAsFunction(rt, "freeze"); - freeze.call(rt, obj); -} - -void ShareableValue::adaptCache(jsi::Runtime &rt, const jsi::Value &value) { - // when adapting from host object we can assign cached value immediately such - // that we avoid running `toJSValue` in the future when given object is - // accessed - if (RuntimeDecorator::isWorkletRuntime(rt)) { - if (remoteValue.expired()) { - remoteValue = getWeakRef(rt); - } - (*remoteValue.lock()) = jsi::Value(rt, value); - } else { - hostValue = std::make_unique(rt, value); - } -} - -void ShareableValue::adapt( - jsi::Runtime &rt, - const jsi::Value &value, - ValueType objectType) { - if (value.isObject()) { - jsi::Object object = value.asObject(rt); - jsi::Value hiddenValue = object.getProperty(rt, HIDDEN_HOST_OBJECT_PROP); - if (!(hiddenValue.isUndefined())) { - jsi::Object hiddenProperty = hiddenValue.asObject(rt); - if (hiddenProperty.isHostObject(rt)) { - type = ValueType::FrozenObjectType; - if (object.hasProperty(rt, "__workletHash") && object.isFunction(rt)) { - type = ValueType::WorkletFunctionType; - } - valueContainer = std::make_unique( - hiddenProperty.getHostObject(rt)); - if (object.hasProperty(rt, ALREADY_CONVERTED)) { - adaptCache(rt, value); - } - return; - } - } - } - - if (objectType == ValueType::MutableValueType) { - type = ValueType::MutableValueType; - valueContainer = - std::make_unique(std::make_shared( - rt, value, runtimeManager, runtimeManager->scheduler)); - } else if (value.isUndefined()) { - type = ValueType::UndefinedType; - } else if (value.isNull()) { - type = ValueType::NullType; - } else if (value.isBool()) { - type = ValueType::BoolType; - valueContainer = std::make_unique(value.getBool()); - } else if (value.isNumber()) { - type = ValueType::NumberType; - valueContainer = std::make_unique(value.asNumber()); - } else if (value.isString()) { - type = ValueType::StringType; - valueContainer = - std::make_unique(value.asString(rt).utf8(rt)); - } else if (value.isObject()) { - auto object = value.asObject(rt); - if (object.isFunction(rt)) { - if (object.getProperty(rt, "__workletHash").isUndefined()) { - // not a worklet, we treat this as a host function - type = ValueType::HostFunctionType; - containsHostFunction = true; - - // Check if it's a hostFunction wrapper - jsi::Value primalFunction = object.getProperty(rt, PRIMAL_FUNCTION); - if (!primalFunction.isUndefined()) { - jsi::Object handlerAsObject = primalFunction.asObject(rt); - std::shared_ptr handler = - handlerAsObject.getHostObject(rt); - valueContainer = std::make_unique(handler); - } else { - valueContainer = std::make_unique( - std::make_shared( - std::make_shared(object.asFunction(rt)), rt)); - } - - } else { - // a worklet - type = ValueType::WorkletFunctionType; - valueContainer = std::make_unique( - std::make_shared(rt, object, runtimeManager)); - auto &frozenObject = ValueWrapper::asFrozenObject(valueContainer); - containsHostFunction |= frozenObject->containsHostFunction; - if (RuntimeDecorator::isReactRuntime(rt) && !containsHostFunction) { - addHiddenProperty( - rt, - createHost(rt, frozenObject), - object, - HIDDEN_HOST_OBJECT_PROP); - } - } - } else if (object.isArray(rt)) { - type = ValueType::FrozenArrayType; - auto array = object.asArray(rt); - valueContainer = std::make_unique(); - auto &frozenArray = ValueWrapper::asFrozenArray(valueContainer); - for (size_t i = 0, size = array.size(rt); i < size; i++) { - auto sv = adapt(rt, array.getValueAtIndex(rt, i), runtimeManager); - containsHostFunction |= sv->containsHostFunction; - frozenArray.push_back(sv); - } - } else if (object.isHostObject(rt)) { - type = ValueType::MutableValueType; - valueContainer = std::make_unique( - object.getHostObject(rt)); - adaptCache(rt, value); - } else if (object.isHostObject(rt)) { - type = ValueType::RemoteObjectType; - valueContainer = std::make_unique( - object.getHostObject(rt)); - adaptCache(rt, value); - } else if (objectType == ValueType::RemoteObjectType) { - type = ValueType::RemoteObjectType; - valueContainer = - std::make_unique(std::make_shared( - rt, object, runtimeManager, runtimeManager->scheduler)); - } else { - // create frozen object based on a copy of a given object - type = ValueType::FrozenObjectType; - valueContainer = std::make_unique( - std::make_shared(rt, object, runtimeManager)); - auto &frozenObject = ValueWrapper::asFrozenObject(valueContainer); - containsHostFunction |= frozenObject->containsHostFunction; - if (RuntimeDecorator::isReactRuntime(rt)) { - if (!containsHostFunction) { - addHiddenProperty( - rt, - createHost(rt, frozenObject), - object, - HIDDEN_HOST_OBJECT_PROP); - } - freeze(rt, object); - } - } - } else if (value.isSymbol()) { - type = ValueType::StringType; - valueContainer = - std::make_unique(value.asSymbol(rt).toString(rt)); - } else { - throw "Invalid value type"; - } -} - -std::shared_ptr ShareableValue::adapt( - jsi::Runtime &rt, - const jsi::Value &value, - RuntimeManager *runtimeManager, - ValueType valueType) { - auto sv = std::shared_ptr( - new ShareableValue(runtimeManager, runtimeManager->scheduler)); - sv->adapt(rt, value, valueType); - return sv; -} - -jsi::Value ShareableValue::getValue(jsi::Runtime &rt) { - // TODO: maybe we can cache toJSValue results on a per-runtime basis, need to - // avoid ref loops - if (&rt == runtimeManager->runtime.get()) { - // Getting value on the same runtime where it was created, prepare - // remoteValue - if (remoteValue.expired()) { - remoteValue = getWeakRef(rt); - } - - if (remoteValue.lock()->isUndefined()) { - (*remoteValue.lock()) = toJSValue(rt); - } - return jsi::Value(rt, *remoteValue.lock()); - } else { - // Getting value on a different runtime than where it was created from, - // prepare hostValue - if (hostValue.get() == nullptr) { - hostValue = std::make_unique(toJSValue(rt)); - } - return jsi::Value(rt, *hostValue); - } -} - -jsi::Object ShareableValue::createHost( - jsi::Runtime &rt, - std::shared_ptr host) { - return jsi::Object::createFromHostObject(rt, host); -} - -jsi::Value createFrozenWrapper( - jsi::Runtime &rt, - std::shared_ptr frozenObject) { - jsi::Object __reanimatedHiddenHost = - jsi::Object::createFromHostObject(rt, frozenObject); - jsi::Object obj = frozenObject->shallowClone(rt); - jsi::Object globalObject = rt.global().getPropertyAsObject(rt, "Object"); - jsi::Function freeze = globalObject.getPropertyAsFunction(rt, "freeze"); - if (!frozenObject->containsHostFunction) { - addHiddenProperty( - rt, std::move(__reanimatedHiddenHost), obj, HIDDEN_HOST_OBJECT_PROP); - addHiddenProperty(rt, true, obj, ALREADY_CONVERTED); - } - return freeze.call(rt, obj); -} - -jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) { - switch (type) { - case ValueType::UndefinedType: - return jsi::Value::undefined(); - case ValueType::NullType: - return jsi::Value::null(); - case ValueType::BoolType: - return jsi::Value(ValueWrapper::asBoolean(valueContainer)); - case ValueType::NumberType: - return jsi::Value(ValueWrapper::asNumber(valueContainer)); - case ValueType::StringType: { - auto &stringValue = ValueWrapper::asString(valueContainer); - return jsi::Value(rt, jsi::String::createFromUtf8(rt, stringValue)); - } - case ValueType::FrozenObjectType: { - auto &frozenObject = ValueWrapper::asFrozenObject(valueContainer); - return createFrozenWrapper(rt, frozenObject); - } - case ValueType::FrozenArrayType: { - auto &frozenArray = ValueWrapper::asFrozenArray(valueContainer); - jsi::Array array(rt, frozenArray.size()); - for (size_t i = 0; i < frozenArray.size(); i++) { - array.setValueAtIndex(rt, i, frozenArray[i]->toJSValue(rt)); - } - return array; - } - case ValueType::RemoteObjectType: { - auto &remoteObject = ValueWrapper::asRemoteObject(valueContainer); - if (RuntimeDecorator::isWorkletRuntime(rt)) { - remoteObject->maybeInitializeOnWorkletRuntime(rt); - } - return createHost(rt, remoteObject); - } - case ValueType::MutableValueType: { - auto &mutableObject = ValueWrapper::asMutableValue(valueContainer); - return createHost(rt, mutableObject); - } - case ValueType::HostFunctionType: { - auto hostFunctionWrapper = - ValueWrapper::asHostFunctionWrapper(valueContainer); - auto &hostRuntime = hostFunctionWrapper->value->hostRuntime; - if (hostRuntime == &rt) { - // function is accessed from the same runtime it was crated, we just - // return same function obj - return jsi::Value( - rt, *hostFunctionWrapper->value->getPureFunction().get()); - } else { - // function is accessed from a different runtime, we wrap function in - // host func that'd enqueue call on an appropriate thread - - auto runtimeManager = this->runtimeManager; - auto hostFunction = hostFunctionWrapper->value; - - auto warnFunction = [runtimeManager, hostFunction]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - jsi::Value jsThis = rt.global().getProperty(rt, "jsThis"); - std::string workletLocation = jsThis.asObject(rt) - .getProperty(rt, "__location") - .toString(rt) - .utf8(rt); - std::string exceptionMessage = "Tried to synchronously call "; - if (hostFunction->functionName.empty()) { - exceptionMessage += "anonymous function"; - } else { - exceptionMessage += "function {" + hostFunction->functionName + "}"; - } - exceptionMessage += - " from a different thread.\n\nOccurred in worklet location: "; - exceptionMessage += workletLocation; - exceptionMessage += CALLBACK_ERROR_SUFFIX; - runtimeManager->errorHandler->setError(exceptionMessage); - runtimeManager->errorHandler->raise(); - - return jsi::Value::undefined(); - }; - - auto clb = [runtimeManager, hostFunction, hostRuntime]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - // TODO: we should find thread based on runtime such that we could - // also call UI methods from RN and not only RN methods from UI - - std::vector> params; - for (int i = 0; i < count; ++i) { - params.push_back( - ShareableValue::adapt(rt, args[i], runtimeManager)); - } - - std::function job = [hostFunction, hostRuntime, params] { - jsi::Value *args = new jsi::Value[params.size()]; - for (int i = 0; i < params.size(); ++i) { - args[i] = params[i]->getValue(*hostRuntime); - } - jsi::Value returnedValue = - hostFunction->getPureFunction().get()->call( - *hostRuntime, - static_cast(args), - static_cast(params.size())); - - delete[] args; - // ToDo use returned value to return promise - }; - - runtimeManager->scheduler->scheduleOnJS(job); - return jsi::Value::undefined(); - }; - jsi::Function wrapperFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "hostFunction"), 0, warnFunction); - jsi::Function res = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "hostFunction"), 0, clb); - addHiddenProperty(rt, std::move(res), wrapperFunction, CALL_ASYNC); - jsi::Object functionHandler = - createHost(rt, hostFunctionWrapper->value); - addHiddenProperty( - rt, std::move(functionHandler), wrapperFunction, PRIMAL_FUNCTION); - return wrapperFunction; - } - } - case ValueType::WorkletFunctionType: { - auto runtimeManager = this->runtimeManager; - auto &frozenObject = ValueWrapper::asFrozenObject(this->valueContainer); - if (RuntimeDecorator::isWorkletRuntime(rt)) { - // when running on worklet thread we prep a function - - auto jsThis = std::make_shared( - frozenObject->shallowClone(*runtimeManager->runtime)); - std::shared_ptr funPtr( - runtimeManager->workletsCache->getFunction(rt, frozenObject)); - auto name = funPtr->getProperty(rt, "name").asString(rt).utf8(rt); - - auto clb = [=](jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) mutable -> jsi::Value { - const jsi::String jsThisName = - jsi::String::createFromAscii(rt, "jsThis"); - jsi::Object global = rt.global(); - jsi::Value oldJSThis = global.getProperty(rt, jsThisName); - global.setProperty(rt, jsThisName, *jsThis); // set jsThis - - jsi::Value res = jsi::Value::undefined(); - try { - if (thisValue.isObject()) { - res = - funPtr->callWithThis(rt, thisValue.asObject(rt), args, count); - } else { - res = funPtr->call(rt, args, count); - } - } catch (jsi::JSError &e) { - throw e; - } catch (...) { - if (demangleExceptionName( - abi::__cxa_current_exception_type()->name()) == - "ABI46_0_0facebook::jsi::JSError") { - throw jsi::JSError(rt, "Javascript worklet error"); - } - // TODO find out a way to get the error's message on hermes - jsi::Value location = jsThis->getProperty(rt, "__location"); - std::string str = "Javascript worklet error"; - if (location.isString()) { - str += "\nIn file: " + location.asString(rt).utf8(rt); - } - runtimeManager->errorHandler->setError(str); - runtimeManager->errorHandler->raise(); - } - global.setProperty(rt, jsThisName, oldJSThis); // clean jsThis - return res; - }; - return jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, name.c_str()), 0, clb); - } else { - // when run outside of UI thread we enqueue a call on the UI thread - auto clb = [=](jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - // TODO: we should find thread based on runtime such that we could - // also call UI methods from RN and not only RN methods from UI - - std::vector> params; - for (int i = 0; i < count; ++i) { - params.push_back( - ShareableValue::adapt(rt, args[i], runtimeManager)); - } - - runtimeManager->scheduler->scheduleOnUI([=] { - jsi::Runtime &rt = *runtimeManager->runtime.get(); - auto jsThis = createFrozenWrapper(rt, frozenObject).getObject(rt); - auto code = - jsThis.getProperty(rt, "asString").asString(rt).utf8(rt); - std::shared_ptr funPtr( - runtimeManager->workletsCache->getFunction(rt, frozenObject)); - - jsi::Value *args = new jsi::Value[params.size()]; - for (int i = 0; i < params.size(); ++i) { - args[i] = params[i]->getValue(rt); - } - - jsi::Value returnedValue; - const jsi::String jsThisName = - jsi::String::createFromAscii(rt, "jsThis"); - jsi::Object global = rt.global(); - jsi::Value oldJSThis = global.getProperty(rt, jsThisName); - global.setProperty(rt, jsThisName, jsThis); // set jsThis - try { - returnedValue = funPtr->call( - rt, - static_cast(args), - static_cast(params.size())); - } catch (std::exception &e) { - std::string str = e.what(); - runtimeManager->errorHandler->setError(str); - runtimeManager->errorHandler->raise(); - } catch (...) { - if (demangleExceptionName( - abi::__cxa_current_exception_type()->name()) == - "ABI46_0_0facebook::jsi::JSError") { - throw jsi::JSError(rt, "Javascript worklet error"); - } - // TODO find out a way to get the error's message on hermes - jsi::Value location = jsThis.getProperty(rt, "__location"); - std::string str = "Javascript worklet error"; - if (location.isString()) { - str += "\nIn file: " + location.asString(rt).utf8(rt); - } - runtimeManager->errorHandler->setError(str); - runtimeManager->errorHandler->raise(); - } - global.setProperty(rt, jsThisName, oldJSThis); // clean jsThis - - delete[] args; - // ToDo use returned value to return promise - }); - return jsi::Value::undefined(); - }; - return jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_workletFunction"), 0, clb); - } - } - default: { - throw "Unable to find conversion method for this type"; - } - } - throw "convert error"; -} - -std::string ShareableValue::demangleExceptionName(std::string toDemangle) { - int status = 0; - char *buff = - __cxxabiv1::__cxa_demangle(toDemangle.c_str(), nullptr, nullptr, &status); - if (!buff) { - return toDemangle; - } - std::string demangled = buff; - std::free(buff); - return demangled; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/FeaturesConfig.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/FeaturesConfig.cpp deleted file mode 100644 index 24e9fa2e676796..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/FeaturesConfig.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "FeaturesConfig.h" - -namespace ABI46_0_0reanimated { -bool FeaturesConfig::_isLayoutAnimationEnabled = false; -} diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/JSIStoreValueUser.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/JSIStoreValueUser.cpp deleted file mode 100644 index 2d87f7c9296118..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/JSIStoreValueUser.cpp +++ /dev/null @@ -1,55 +0,0 @@ -#include "JSIStoreValueUser.h" -#include "RuntimeManager.h" -#ifdef ONANDROID -#include -#endif - -namespace ABI46_0_0reanimated { - -std::weak_ptr StoreUser::getWeakRef(jsi::Runtime &rt) { - const std::lock_guard lock(storeUserData->storeMutex); - if (storeUserData->store.count(identifier) == 0) { - storeUserData->store[identifier] = - std::vector>(); - } - std::shared_ptr sv = - std::make_shared(rt, jsi::Value::undefined()); - storeUserData->store[identifier].push_back(sv); - - return sv; -} - -StoreUser::StoreUser( - std::shared_ptr s, - const RuntimeManager &runtimeManager) - : scheduler(s) { - storeUserData = runtimeManager.storeUserData; - identifier = storeUserData->ctr++; -} - -StoreUser::~StoreUser() { - int id = identifier; - std::shared_ptr strongScheduler = scheduler.lock(); - if (strongScheduler != nullptr) { - std::shared_ptr sud = storeUserData; -#ifdef ONANDROID - jni::ThreadScope::WithClassLoader([&] { - strongScheduler->scheduleOnUI([id, sud]() { - const std::lock_guard lock(sud->storeMutex); - if (sud->store.count(id) > 0) { - sud->store.erase(id); - } - }); - }); -#else - strongScheduler->scheduleOnUI([id, sud]() { - const std::lock_guard lock(sud->storeMutex); - if (sud->store.count(id) > 0) { - sud->store.erase(id); - } - }); -#endif - } -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Mapper.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Mapper.cpp deleted file mode 100644 index 89a56a79825243..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Mapper.cpp +++ /dev/null @@ -1,67 +0,0 @@ -#include "Mapper.h" -#include "MutableValue.h" -#include "SharedParent.h" - -namespace ABI46_0_0reanimated { - -Mapper::Mapper( - NativeReanimatedModule *module, - unsigned long id, - std::shared_ptr mapper, - std::vector> inputs, - std::vector> outputs) - : id(id), module(module), mapper(mapper), inputs(inputs), outputs(outputs) { - auto markDirty = [this, module]() { - this->dirty = true; - module->maybeRequestRender(); - }; - for (auto input : inputs) { - input->addListener(id, markDirty); - } -} - -void Mapper::execute(jsi::Runtime &rt) { - dirty = false; - if (optimalizationLvl == 0) { - mapper->callWithThis(rt, *mapper); // call styleUpdater - } else { - jsi::Object newStyle = userUpdater->call(rt).asObject(rt); - auto jsViewDescriptorArray = viewDescriptors->getValue(rt) - .getObject(rt) - .getProperty(rt, "value") - .asObject(rt) - .getArray(rt); - for (int i = 0; i < jsViewDescriptorArray.length(rt); ++i) { - auto jsViewDescriptor = - jsViewDescriptorArray.getValueAtIndex(rt, i).getObject(rt); - (*updateProps)( - rt, - static_cast(jsViewDescriptor.getProperty(rt, "tag").asNumber()), - jsViewDescriptor.getProperty(rt, "name"), - newStyle); - } - } -} - -void Mapper::enableFastMode( - const int optimalizationLvl, - const std::shared_ptr &updater, - const std::shared_ptr &jsViewDescriptors) { - if (optimalizationLvl == 0) { - return; - } - viewDescriptors = jsViewDescriptors; - this->optimalizationLvl = optimalizationLvl; - updateProps = &module->updaterFunction; - jsi::Runtime *rt = module->runtime.get(); - userUpdater = std::make_shared( - updater->getValue(*rt).asObject(*rt).asFunction(*rt)); -} - -Mapper::~Mapper() { - for (auto input : inputs) { - input->removeListener(id); - } -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/RuntimeDecorator.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/RuntimeDecorator.cpp deleted file mode 100644 index 96d6e1d267020b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/RuntimeDecorator.cpp +++ /dev/null @@ -1,242 +0,0 @@ -#include "RuntimeDecorator.h" -#include -#include -#include -#include "LayoutAnimationsProxy.h" -#include "MutableValue.h" -#include "ReanimatedHiddenHeaders.h" - -namespace ABI46_0_0reanimated { - -std::unordered_map - &RuntimeDecorator::runtimeRegistry() { - static std::unordered_map runtimeRegistry; - return runtimeRegistry; -} - -void RuntimeDecorator::registerRuntime( - jsi::Runtime *runtime, - RuntimeType runtimeType) { - runtimeRegistry().insert({runtime, runtimeType}); -} - -void RuntimeDecorator::decorateRuntime( - jsi::Runtime &rt, - const std::string &label) { - // This property will be used to find out if a runtime is a custom worklet - // runtime (e.g. UI, VisionCamera frame processor, ...) - rt.global().setProperty(rt, "_WORKLET", jsi::Value(true)); - // This property will be used for debugging - rt.global().setProperty( - rt, "_LABEL", jsi::String::createFromAscii(rt, label)); - - jsi::Object dummyGlobal(rt); - rt.global().setProperty(rt, "global", dummyGlobal); - - rt.global().setProperty(rt, "jsThis", jsi::Value::undefined()); - - auto callback = [](jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - const jsi::Value *value = &args[0]; - if (value->isString()) { - Logger::log(value->getString(rt).utf8(rt).c_str()); - } else if (value->isNumber()) { - Logger::log(value->getNumber()); - } else if (value->isUndefined()) { - Logger::log("undefined"); - } else { - Logger::log("unsupported value type"); - } - return jsi::Value::undefined(); - }; - jsi::Value log = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_log"), 1, callback); - rt.global().setProperty(rt, "_log", log); - - auto setGlobalConsole = [](jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - rt.global().setProperty(rt, "console", args[0]); - return jsi::Value::undefined(); - }; - rt.global().setProperty( - rt, - "_setGlobalConsole", - jsi::Function::createFromHostFunction( - rt, - jsi::PropNameID::forAscii(rt, "_setGlobalConsole"), - 1, - setGlobalConsole)); - - auto chronoNow = [](jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - double now = std::chrono::system_clock::now().time_since_epoch() / - std::chrono::milliseconds(1); - return jsi::Value(now); - }; - - rt.global().setProperty( - rt, - "_chronoNow", - jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_chronoNow"), 0, chronoNow)); - jsi::Object performance(rt); - performance.setProperty( - rt, - "now", - jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "now"), 0, chronoNow)); - rt.global().setProperty(rt, "performance", performance); -} - -void RuntimeDecorator::decorateUIRuntime( - jsi::Runtime &rt, - const UpdaterFunction updater, - const RequestFrameFunction requestFrame, - const ScrollToFunction scrollTo, - const MeasuringFunction measure, - const TimeProviderFunction getCurrentTime, - const RegisterSensorFunction registerSensor, - const UnregisterSensorFunction unregisterSensor, - const SetGestureStateFunction setGestureState, - std::shared_ptr layoutAnimationsProxy) { - RuntimeDecorator::decorateRuntime(rt, "UI"); - rt.global().setProperty(rt, "_UI", jsi::Value(true)); - - auto clb = [updater]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - const auto viewTag = args[0].asNumber(); - const jsi::Value *viewName = &args[1]; - const auto params = args[2].asObject(rt); - updater(rt, viewTag, *viewName, params); - return jsi::Value::undefined(); - }; - jsi::Value updateProps = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_updateProps"), 2, clb); - rt.global().setProperty(rt, "_updateProps", updateProps); - - auto clb2 = [requestFrame]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - auto fun = - std::make_shared(args[0].asObject(rt).asFunction(rt)); - requestFrame([&rt, fun](double timestampMs) { - fun->call(rt, jsi::Value(timestampMs)); - }); - return jsi::Value::undefined(); - }; - jsi::Value requestAnimationFrame = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "requestAnimationFrame"), 1, clb2); - rt.global().setProperty(rt, "requestAnimationFrame", requestAnimationFrame); - - auto clb3 = [scrollTo]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - int viewTag = static_cast(args[0].asNumber()); - double x = args[1].asNumber(); - double y = args[2].asNumber(); - bool animated = args[3].getBool(); - scrollTo(viewTag, x, y, animated); - return jsi::Value::undefined(); - }; - jsi::Value scrollToFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_scrollTo"), 4, clb3); - rt.global().setProperty(rt, "_scrollTo", scrollToFunction); - - auto clb4 = [measure]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - int viewTag = static_cast(args[0].asNumber()); - auto result = measure(viewTag); - jsi::Object resultObject(rt); - for (auto &i : result) { - resultObject.setProperty(rt, i.first.c_str(), i.second); - } - return resultObject; - }; - jsi::Value measureFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_measure"), 1, clb4); - rt.global().setProperty(rt, "_measure", measureFunction); - - auto clb6 = [getCurrentTime]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - const size_t count) -> jsi::Value { - return getCurrentTime(); - }; - jsi::Value timeFun = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_getCurrentTime"), 0, clb6); - rt.global().setProperty(rt, "_getCurrentTime", timeFun); - - rt.global().setProperty(rt, "_frameTimestamp", jsi::Value::undefined()); - rt.global().setProperty(rt, "_eventTimestamp", jsi::Value::undefined()); - - // layout animation - std::weak_ptr layoutProxy = layoutAnimationsProxy; - auto clb7 = [layoutProxy]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - std::shared_ptr proxy = layoutProxy.lock(); - if (layoutProxy.expired()) { - return jsi::Value::undefined(); - } - proxy->startObserving( - args[0].asNumber(), - args[1].asObject(rt).getHostObject(rt), - rt); - return jsi::Value::undefined(); - }; - jsi::Value _startObservingProgress = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_startObservingProgress"), 0, clb7); - rt.global().setProperty( - rt, "_startObservingProgress", _startObservingProgress); - - auto clb8 = [layoutProxy]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - std::shared_ptr proxy = layoutProxy.lock(); - if (layoutProxy.expired()) { - return jsi::Value::undefined(); - } - proxy->stopObserving(args[0].asNumber(), args[1].getBool()); - return jsi::Value::undefined(); - }; - jsi::Value _stopObservingProgress = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_stopObservingProgress"), 0, clb8); - rt.global().setProperty(rt, "_stopObservingProgress", _stopObservingProgress); - - auto clb9 = [setGestureState]( - jsi::Runtime &rt, - const jsi::Value &thisValue, - const jsi::Value *args, - size_t count) -> jsi::Value { - int handlerTag = static_cast(args[0].asNumber()); - int newState = static_cast(args[1].asNumber()); - setGestureState(handlerTag, newState); - return jsi::Value::undefined(); - }; - jsi::Value setGestureStateFunction = jsi::Function::createFromHostFunction( - rt, jsi::PropNameID::forAscii(rt, "_setGestureState"), 2, clb9); - rt.global().setProperty(rt, "_setGestureState", setGestureStateFunction); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Scheduler.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Scheduler.cpp deleted file mode 100644 index 444a45eaab544c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/Scheduler.cpp +++ /dev/null @@ -1,37 +0,0 @@ -#include "Scheduler.h" - -namespace ABI46_0_0reanimated { - -void Scheduler::scheduleOnUI(std::function job) { - uiJobs.push(std::move(job)); -} - -void Scheduler::scheduleOnJS(std::function job) { - jsCallInvoker_->invokeAsync(std::move(job)); -} - -void Scheduler::triggerUI() { - scheduledOnUI = false; - while (uiJobs.getSize()) { - auto job = uiJobs.pop(); - job(); - } -} - -void Scheduler::setJSCallInvoker( - std::shared_ptr jsCallInvoker) { - jsCallInvoker_ = jsCallInvoker; -} - -void Scheduler::setRuntimeManager( - std::shared_ptr runtimeManager) { - this->runtimeManager = runtimeManager; -} - -Scheduler::~Scheduler() {} - -Scheduler::Scheduler() { - this->scheduledOnUI = false; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/WorkletEventHandler.cpp b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/WorkletEventHandler.cpp deleted file mode 100644 index 5ad419239685d3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/Tools/WorkletEventHandler.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "WorkletEventHandler.h" - -namespace ABI46_0_0reanimated { - -void WorkletEventHandler::process( - jsi::Runtime &rt, - const jsi::Value &eventValue) { - handler.callWithThis(rt, handler, eventValue); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h deleted file mode 100644 index 711c2a1be181f3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/AnimatedSensor/AnimatedSensorModule.h +++ /dev/null @@ -1,41 +0,0 @@ -#pragma once - -#include -#include - -#include "PlatformDepMethodsHolder.h" -#include "RuntimeManager.h" - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; - -enum SensorType { - ACCELEROMETER = 1, - GYROSCOPE = 2, - GRAVITY = 3, - MAGNETIC_FIELD = 4, - ROTATION_VECTOR = 5, -}; - -class AnimatedSensorModule { - std::unordered_set sensorsIds_; - RegisterSensorFunction platformRegisterSensorFunction_; - UnregisterSensorFunction platformUnregisterSensorFunction_; - RuntimeManager *runtimeManager_; - - public: - AnimatedSensorModule( - const PlatformDepMethodsHolder &platformDepMethodsHolder, - RuntimeManager *runtimeManager); - ~AnimatedSensorModule(); - - jsi::Value registerSensor( - jsi::Runtime &rt, - const jsi::Value &sensorType, - const jsi::Value &interval, - const jsi::Value &sensorDataContainer); - void unregisterSensor(const jsi::Value &sensorId); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h deleted file mode 100644 index 58b4513b11ffc9..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/LayoutAnimations/LayoutAnimationsProxy.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; - -class MutableValue; - -class LayoutAnimationsProxy { - public: - LayoutAnimationsProxy( - std::function _notifyAboutProgress, - std::function _notifyAboutEnd); - - void - startObserving(int tag, std::shared_ptr sv, jsi::Runtime &rt); - void stopObserving(int tag, bool finished); - void notifyAboutCancellation(int tag); - - private: - std::function notifyAboutProgress; - std::function notifyAboutEnd; - std::map> observedValues; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModule.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModule.h deleted file mode 100644 index 0f91227684de57..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModule.h +++ /dev/null @@ -1,108 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -#include "AnimatedSensorModule.h" -#include "ErrorHandler.h" -#include "LayoutAnimationsProxy.h" -#include "NativeReanimatedModuleSpec.h" -#include "PlatformDepMethodsHolder.h" -#include "RuntimeDecorator.h" -#include "RuntimeManager.h" -#include "Scheduler.h" - -namespace ABI46_0_0reanimated { - -using FrameCallback = std::function; - -class ShareableValue; -class MutableValue; -class MapperRegistry; -class EventHandlerRegistry; - -class NativeReanimatedModule : public NativeReanimatedModuleSpec, - public RuntimeManager { - friend ShareableValue; - friend MutableValue; - - public: - NativeReanimatedModule( - std::shared_ptr jsInvoker, - std::shared_ptr scheduler, - std::shared_ptr rt, - std::shared_ptr errorHandler, - std::function - propObtainer, - std::shared_ptr layoutAnimationsProxy, - PlatformDepMethodsHolder platformDepMethodsHolder); - - void installCoreFunctions(jsi::Runtime &rt, const jsi::Value &valueSetter) - override; - - jsi::Value makeShareable(jsi::Runtime &rt, const jsi::Value &value) override; - jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) override; - jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) override; - - jsi::Value startMapper( - jsi::Runtime &rt, - const jsi::Value &worklet, - const jsi::Value &inputs, - const jsi::Value &outputs, - const jsi::Value &updater, - const jsi::Value &viewDescriptors) override; - void stopMapper(jsi::Runtime &rt, const jsi::Value &mapperId) override; - - jsi::Value registerEventHandler( - jsi::Runtime &rt, - const jsi::Value &eventHash, - const jsi::Value &worklet) override; - void unregisterEventHandler( - jsi::Runtime &rt, - const jsi::Value ®istrationId) override; - - jsi::Value getViewProp( - jsi::Runtime &rt, - const jsi::Value &viewTag, - const jsi::Value &propName, - const jsi::Value &callback) override; - - jsi::Value enableLayoutAnimations(jsi::Runtime &rt, const jsi::Value &config) - override; - jsi::Value configureProps( - jsi::Runtime &rt, - const jsi::Value &uiProps, - const jsi::Value &nativeProps) override; - - void onRender(double timestampMs); - void onEvent(std::string eventName, std::string eventAsString); - bool isAnyHandlerWaitingForEvent(std::string eventName); - - void maybeRequestRender(); - UpdaterFunction updaterFunction; - - jsi::Value registerSensor( - jsi::Runtime &rt, - const jsi::Value &sensorType, - const jsi::Value &interval, - const jsi::Value &sensorDataContainer) override; - void unregisterSensor(jsi::Runtime &rt, const jsi::Value &sensorId) override; - - private: - std::shared_ptr mapperRegistry; - std::shared_ptr eventHandlerRegistry; - std::function requestRender; - std::shared_ptr dummyEvent; - std::vector frameCallbacks; - bool renderRequested = false; - std::function - propObtainer; - std::function onRenderCallback; - std::shared_ptr layoutAnimationsProxy; - AnimatedSensorModule animatedSensorModule; - ConfigurePropsFunction configurePropsPlatformFunction; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h deleted file mode 100644 index bc5e9027176e55..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/NativeModules/NativeReanimatedModuleSpec.h +++ /dev/null @@ -1,82 +0,0 @@ -#pragma once - -#include -#include -#include - -#ifdef ONANDROID -#include "TurboModule.h" -#else -#include -#endif - -#include - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -namespace ABI46_0_0reanimated { - -class JSI_EXPORT NativeReanimatedModuleSpec : public TurboModule { - protected: - explicit NativeReanimatedModuleSpec(std::shared_ptr jsInvoker); - - public: - virtual void installCoreFunctions( - jsi::Runtime &rt, - const jsi::Value &valueSetter) = 0; - - // SharedValue - virtual jsi::Value makeShareable( - jsi::Runtime &rt, - const jsi::Value &value) = 0; - virtual jsi::Value makeMutable(jsi::Runtime &rt, const jsi::Value &value) = 0; - virtual jsi::Value makeRemote(jsi::Runtime &rt, const jsi::Value &value) = 0; - - // mappers - virtual jsi::Value startMapper( - jsi::Runtime &rt, - const jsi::Value &worklet, - const jsi::Value &inputs, - const jsi::Value &outputs, - const jsi::Value &updater, - const jsi::Value &viewDescriptors) = 0; - virtual void stopMapper(jsi::Runtime &rt, const jsi::Value &mapperId) = 0; - - // events - virtual jsi::Value registerEventHandler( - jsi::Runtime &rt, - const jsi::Value &eventHash, - const jsi::Value &worklet) = 0; - virtual void unregisterEventHandler( - jsi::Runtime &rt, - const jsi::Value ®istrationId) = 0; - - // views - virtual jsi::Value getViewProp( - jsi::Runtime &rt, - const jsi::Value &viewTag, - const jsi::Value &propName, - const jsi::Value &callback) = 0; - - // sensors - virtual jsi::Value registerSensor( - jsi::Runtime &rt, - const jsi::Value &sensorType, - const jsi::Value &interval, - const jsi::Value &sensorDataContainer) = 0; - virtual void unregisterSensor( - jsi::Runtime &rt, - const jsi::Value &sensorId) = 0; - - // other - virtual jsi::Value enableLayoutAnimations( - jsi::Runtime &rt, - const jsi::Value &config) = 0; - virtual jsi::Value configureProps( - jsi::Runtime &rt, - const jsi::Value &uiProps, - const jsi::Value &nativeProps) = 0; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/EventHandlerRegistry.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/EventHandlerRegistry.h deleted file mode 100644 index e5f937457ee470..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/EventHandlerRegistry.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class WorkletEventHandler; - -class EventHandlerRegistry { - std::map< - std::string, - std::unordered_map>> - eventMappings; - std::map> eventHandlers; - std::mutex instanceMutex; - - public: - void registerEventHandler(std::shared_ptr eventHandler); - void unregisterEventHandler(unsigned long id); - - void processEvent( - jsi::Runtime &rt, - std::string eventName, - std::string eventPayload); - bool isAnyHandlerWaitingForEvent(std::string eventName); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/MapperRegistry.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/MapperRegistry.h deleted file mode 100644 index cb1b784fb8de38..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/MapperRegistry.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class Mapper; - -class MapperRegistry { - std::unordered_map> mappers; - std::vector> sortedMappers; - void updateOrder(); - bool updatedSinceLastExecute = false; - - public: - void startMapper(std::shared_ptr mapper); - void stopMapper(unsigned long id); - - void execute(jsi::Runtime &rt); - - bool needRunOnRender(); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/WorkletsCache.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/WorkletsCache.h deleted file mode 100644 index 8ec85d9d8bc558..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Registries/WorkletsCache.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -#include -#include -#include -#include - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; - -class FrozenObject; - -class WorkletsCache { - private: - std::unordered_map> worklets; - - public: - std::shared_ptr getFunction( - jsi::Runtime &rt, - std::shared_ptr frozenObj); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/FrozenObject.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/FrozenObject.h deleted file mode 100644 index c742bc5bed04e3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/FrozenObject.h +++ /dev/null @@ -1,36 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "RuntimeManager.h" -#include "SharedParent.h" -#include "WorkletsCache.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class FrozenObject : public jsi::HostObject { - friend WorkletsCache; - friend void extractMutables( - jsi::Runtime &rt, - std::shared_ptr sv, - std::vector> &res); - - private: - std::unordered_map> map; - std::vector namesOrder; - - public: - FrozenObject( - jsi::Runtime &rt, - const jsi::Object &object, - RuntimeManager *runtimeManager); - jsi::Object shallowClone(jsi::Runtime &rt); - bool containsHostFunction = false; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/HostFunctionHandler.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/HostFunctionHandler.h deleted file mode 100644 index 7916ff3ccdddcb..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/HostFunctionHandler.h +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include -#include -#include - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -struct HostFunctionHandler : jsi::HostObject { - std::shared_ptr pureFunction; - std::string functionName; - jsi::Runtime *hostRuntime; - jsi::HostObject a; - - HostFunctionHandler(std::shared_ptr f, jsi::Runtime &rt) { - pureFunction = f; - functionName = f->getProperty(rt, "name").asString(rt).utf8(rt); - hostRuntime = &rt; - } - - std::shared_ptr getPureFunction() { - return pureFunction; - } -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValue.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValue.h deleted file mode 100644 index 2522507f76d41c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValue.h +++ /dev/null @@ -1,54 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "JSIStoreValueUser.h" -#include "LayoutAnimationsProxy.h" -#include "MutableValueSetterProxy.h" -#include "RuntimeManager.h" -#include "SharedParent.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class MutableValue : public jsi::HostObject, - public std::enable_shared_from_this, - public StoreUser { - private: - friend MutableValueSetterProxy; - friend LayoutAnimationsProxy; - - private: - RuntimeManager *runtimeManager; - std::mutex readWriteMutex; - std::shared_ptr value; - std::weak_ptr animation; - std::map> listeners; - - public: - void setValue(jsi::Runtime &rt, const jsi::Value &newValue); - jsi::Value getValue(jsi::Runtime &rt); - - public: - MutableValue( - jsi::Runtime &rt, - const jsi::Value &initial, - RuntimeManager *runtimeManager, - std::shared_ptr s); - - public: - void - set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value); - jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name); - std::vector getPropertyNames(jsi::Runtime &rt); - unsigned long addListener( - unsigned long listenerId, - std::function listener); - void removeListener(unsigned long listenerId); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h deleted file mode 100644 index 27df6f77058d9e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/MutableValueSetterProxy.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include -#include -#include -#include "SharedParent.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class MutableValueSetterProxy : public jsi::HostObject { - private: - friend MutableValue; - std::shared_ptr mutableValue; - - public: - explicit MutableValueSetterProxy(std::shared_ptr mutableValue) - : mutableValue(std::move(mutableValue)) {} - void - set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value); - jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RemoteObject.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RemoteObject.h deleted file mode 100644 index 26b4004f827a9a..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RemoteObject.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include -#include - -#include "FrozenObject.h" -#include "JSIStoreValueUser.h" -#include "SharedParent.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class RemoteObject : public jsi::HostObject, public StoreUser { - private: - std::weak_ptr backing; - std::unique_ptr initializer; - - public: - void maybeInitializeOnWorkletRuntime(jsi::Runtime &rt); - RemoteObject( - jsi::Runtime &rt, - const jsi::Object &object, - RuntimeManager *runtimeManager, - std::shared_ptr s) - : StoreUser(s, *runtimeManager), - initializer( - std::make_unique(rt, object, runtimeManager)) {} - void - set(jsi::Runtime &rt, const jsi::PropNameID &name, const jsi::Value &value); - jsi::Value get(jsi::Runtime &rt, const jsi::PropNameID &name); - std::vector getPropertyNames(jsi::Runtime &rt); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RuntimeManager.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RuntimeManager.h deleted file mode 100644 index fcac0bc87419ff..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/RuntimeManager.h +++ /dev/null @@ -1,75 +0,0 @@ -#pragma once - -#include -#include -#include "ErrorHandler.h" -#include "JSIStoreValueUser.h" -#include "RuntimeDecorator.h" -#include "Scheduler.h" -#include "ShareableValue.h" -#include "WorkletsCache.h" - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; - -/** - A class that manages a jsi::Runtime apart from the ABI46_0_0React-JS runtime. - */ -class RuntimeManager { - public: - RuntimeManager( - std::shared_ptr runtime, - std::shared_ptr errorHandler, - std::shared_ptr scheduler, - RuntimeType runtimeType = RuntimeType::Worklet) - : runtime(runtime), - errorHandler(errorHandler), - scheduler(scheduler), - workletsCache(std::make_unique()), - storeUserData(std::make_shared()) { - RuntimeDecorator::registerRuntime(this->runtime.get(), runtimeType); - } - - virtual ~RuntimeManager() { - clearStore(); - } - - public: - /** - Holds the jsi::Function worklet that is responsible for updating values in - JS. Can be null. - */ - std::shared_ptr valueSetter; - /** - Holds the jsi::Runtime this RuntimeManager is managing. - */ - std::shared_ptr runtime; - /** - Holds the error handler that will be invoked when any kind of error occurs. - */ - std::shared_ptr errorHandler; - /** - Holds the Scheduler that is responsible for scheduling work on the UI- or - ABI46_0_0React-JS Thread. - */ - std::shared_ptr scheduler; - /** - Holds a list of adapted Worklets which are cached to avoid unneccessary - recreation. - */ - std::unique_ptr workletsCache; - /** - Holds the JSI-Value Store where JSI::Values are cached on a - per-RuntimeManager basis. - */ - std::shared_ptr storeUserData; - - private: - void clearStore() { - const std::lock_guard lock(storeUserData->storeMutex); - storeUserData->store.clear(); - } -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ShareableValue.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ShareableValue.h deleted file mode 100644 index 795d31a2e6d742..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ShareableValue.h +++ /dev/null @@ -1,63 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include "AnimatedSensorModule.h" -#include "HostFunctionHandler.h" -#include "JSIStoreValueUser.h" -#include "LayoutAnimationsProxy.h" -#include "RuntimeManager.h" -#include "Scheduler.h" -#include "SharedParent.h" -#include "ValueWrapper.h" -#include "WorkletsCache.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class ShareableValue : public std::enable_shared_from_this, - public StoreUser { - friend WorkletsCache; - friend FrozenObject; - friend LayoutAnimationsProxy; - friend NativeReanimatedModule; - friend AnimatedSensorModule; - friend void extractMutables( - jsi::Runtime &rt, - std::shared_ptr sv, - std::vector> &res); - - private: - RuntimeManager *runtimeManager; - std::unique_ptr valueContainer; - std::unique_ptr hostValue; - std::weak_ptr remoteValue; - bool containsHostFunction = false; - - ShareableValue(RuntimeManager *runtimeManager, std::shared_ptr s) - : StoreUser(s, *runtimeManager), runtimeManager(runtimeManager) {} - - jsi::Value toJSValue(jsi::Runtime &rt); - jsi::Object createHost( - jsi::Runtime &rt, - std::shared_ptr host); - void adapt(jsi::Runtime &rt, const jsi::Value &value, ValueType objectType); - void adaptCache(jsi::Runtime &rt, const jsi::Value &value); - std::string demangleExceptionName(std::string toDemangle); - - public: - ValueType type = ValueType::UndefinedType; - static std::shared_ptr adapt( - jsi::Runtime &rt, - const jsi::Value &value, - RuntimeManager *runtimeManager, - ValueType objectType = ValueType::UndefinedType); - jsi::Value getValue(jsi::Runtime &rt); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/SharedParent.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/SharedParent.h deleted file mode 100644 index 786d016d1fc86c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/SharedParent.h +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -namespace ABI46_0_0reanimated { - -enum class ValueType { - UndefinedType, - NullType, - BoolType, - NumberType, - StringType, - RemoteObjectType, // object that can be instantiated on host side and modified - // on the remote (worklet) side - MutableValueType, // object with 'value' property that can be updated and read - // from any thread - HostFunctionType, // function that will be executed asynchronously on the host - // runtime - WorkletFunctionType, // function that gets run on the UI thread - FrozenObjectType, // frozen object, can only be set and never modified - FrozenArrayType, // frozen array, can only be set and never modified -}; - -class ShareableValue; -class MutableValue; -class RemoteObject; -class NativeReanimatedModule; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ValueWrapper.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ValueWrapper.h deleted file mode 100644 index 725df594000877..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SharedItems/ValueWrapper.h +++ /dev/null @@ -1,158 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "HostFunctionHandler.h" -#include "JSIStoreValueUser.h" -#include "SharedParent.h" -#include "WorkletsCache.h" - -namespace ABI46_0_0reanimated { - -class HostFunctionWrapper; -class AnimatedSensorModule; - -class ValueWrapper { - friend AnimatedSensorModule; - - public: - ValueWrapper() {} - explicit ValueWrapper(ValueType _type) : type(_type) {} - ValueType getType() const { - return type; - } - - virtual ~ValueWrapper() {} - - static inline bool asBoolean( - const std::unique_ptr &valueContainer); - static inline double asNumber( - const std::unique_ptr &valueContainer); - static inline const std::string &asString( - const std::unique_ptr &valueContainer); - static inline const std::shared_ptr &asHostFunction( - const std::unique_ptr &valueContainer); - static inline const std::shared_ptr &asFrozenObject( - const std::unique_ptr &valueContainer); - static inline const std::shared_ptr &asRemoteObject( - const std::unique_ptr &valueContainer); - static inline std::vector> &asFrozenArray( - const std::unique_ptr &valueContainer); - static inline const std::shared_ptr &asMutableValue( - const std::unique_ptr &valueContainer); - - static const HostFunctionWrapper *asHostFunctionWrapper( - const std::unique_ptr &valueContainer); - - protected: - ValueType type; -}; - -class BooleanValueWrapper : public ValueWrapper { - public: - explicit BooleanValueWrapper(const bool _value) - : ValueWrapper(ValueType::BoolType), value(_value) {} - bool value; -}; - -class NumberValueWrapper : public ValueWrapper { - public: - explicit NumberValueWrapper(const double _value) - : ValueWrapper(ValueType::NumberType), value(_value) {} - double value; -}; - -class StringValueWrapper : public ValueWrapper { - public: - explicit StringValueWrapper(const std::string &_value) - : ValueWrapper(ValueType::StringType), value(_value) {} - std::string value; -}; - -class HostFunctionWrapper : public ValueWrapper { - public: - explicit HostFunctionWrapper( - const std::shared_ptr &_value) - : ValueWrapper(ValueType::HostFunctionType), value(_value) {} - std::shared_ptr value; -}; - -class FrozenObjectWrapper : public ValueWrapper { - public: - explicit FrozenObjectWrapper(const std::shared_ptr &_value) - : ValueWrapper(ValueType::FrozenObjectType), value(_value) {} - std::shared_ptr value; -}; - -class RemoteObjectWrapper : public ValueWrapper { - public: - explicit RemoteObjectWrapper(const std::shared_ptr &_value) - : ValueWrapper(ValueType::RemoteObjectType), value(_value) {} - std::shared_ptr value; -}; - -class FrozenArrayWrapper : public ValueWrapper { - public: - FrozenArrayWrapper() : ValueWrapper(ValueType::FrozenArrayType) {} - explicit FrozenArrayWrapper( - const std::vector> &_value) - : ValueWrapper(ValueType::FrozenArrayType), value(_value) {} - std::vector> value; -}; - -class MutableValueWrapper : public ValueWrapper { - public: - explicit MutableValueWrapper(const std::shared_ptr &_value) - : ValueWrapper(ValueType::MutableValueType), value(_value) {} - std::shared_ptr value; -}; - -inline bool ValueWrapper::asBoolean( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline double ValueWrapper::asNumber( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const std::string &ValueWrapper::asString( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const std::shared_ptr &ValueWrapper::asHostFunction( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const std::shared_ptr &ValueWrapper::asFrozenObject( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const std::shared_ptr &ValueWrapper::asRemoteObject( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline std::vector> - &ValueWrapper::asFrozenArray( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const std::shared_ptr &ValueWrapper::asMutableValue( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get())->value; -} - -inline const HostFunctionWrapper *ValueWrapper::asHostFunctionWrapper( - const std::unique_ptr &valueContainer) { - return static_cast(valueContainer.get()); -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SpecTools/ErrorHandler.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SpecTools/ErrorHandler.h deleted file mode 100644 index 08008506895ddb..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/SpecTools/ErrorHandler.h +++ /dev/null @@ -1,32 +0,0 @@ -#pragma once - -#include -#include -#include "Scheduler.h" - -namespace ABI46_0_0reanimated { - -struct ErrorWrapper { - std::string message = ""; - bool handled = true; -}; - -class ErrorHandler { - public: - bool raise() { - if (getError()->handled) { - return false; - } - this->getScheduler()->scheduleOnUI([this]() mutable { this->raiseSpec(); }); - return true; - } - virtual std::shared_ptr getScheduler() = 0; - virtual std::shared_ptr getError() = 0; - virtual void setError(std::string message) = 0; - virtual ~ErrorHandler() {} - - protected: - virtual void raiseSpec() = 0; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/FeaturesConfig.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/FeaturesConfig.h deleted file mode 100644 index c3bbb764439501..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/FeaturesConfig.h +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once -#include - -namespace ABI46_0_0reanimated { - -class FeaturesConfig { - public: - static inline bool isLayoutAnimationEnabled() { - return _isLayoutAnimationEnabled; - } - static inline void setLayoutAnimationEnabled(bool isLayoutAnimationEnabled) { - _isLayoutAnimationEnabled = isLayoutAnimationEnabled; - } - - private: - static bool _isLayoutAnimationEnabled; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/JSIStoreValueUser.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/JSIStoreValueUser.h deleted file mode 100644 index 327284e882411c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/JSIStoreValueUser.h +++ /dev/null @@ -1,37 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include "Scheduler.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class RuntimeManager; - -struct StaticStoreUser { - std::atomic ctr; - std::unordered_map>> store; - std::recursive_mutex storeMutex; -}; - -class StoreUser { - int identifier = 0; - std::weak_ptr scheduler; - std::shared_ptr storeUserData; - - public: - StoreUser(std::shared_ptr s, const RuntimeManager &runtimeManager); - - std::weak_ptr getWeakRef(jsi::Runtime &rt); - void removeRefs(); - - virtual ~StoreUser(); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Mapper.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Mapper.h deleted file mode 100644 index f45a42d250943c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Mapper.h +++ /dev/null @@ -1,51 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include "NativeReanimatedModule.h" -#include "ShareableValue.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class MapperRegistry; - -struct ViewDescriptor { - int tag; - jsi::Value name; -}; - -class Mapper : public std::enable_shared_from_this { - friend MapperRegistry; - - private: - unsigned long id; - NativeReanimatedModule *module; - std::shared_ptr mapper; - std::vector> inputs; - std::vector> outputs; - bool dirty = true; - std::shared_ptr userUpdater; - UpdaterFunction *updateProps; - int optimalizationLvl = 0; - std::shared_ptr viewDescriptors; - - public: - Mapper( - NativeReanimatedModule *module, - unsigned long id, - std::shared_ptr mapper, - std::vector> inputs, - std::vector> outputs); - void execute(jsi::Runtime &rt); - void enableFastMode( - const int optimalizationLvl, - const std::shared_ptr &updater, - const std::shared_ptr &jsViewDescriptors); - virtual ~Mapper(); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h deleted file mode 100644 index 39c3e54b378d08..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/PlatformDepMethodsHolder.h +++ /dev/null @@ -1,46 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -using UpdaterFunction = std::function; -using RequestRender = - std::function, jsi::Runtime &rt)>; -using ScrollToFunction = std::function; -using MeasuringFunction = - std::function>(int)>; -using TimeProviderFunction = std::function; - -using RegisterSensorFunction = - std::function)>; -using UnregisterSensorFunction = std::function; -using SetGestureStateFunction = std::function; -using ConfigurePropsFunction = std::function; - -struct PlatformDepMethodsHolder { - RequestRender requestRender; - UpdaterFunction updaterFunction; - ScrollToFunction scrollToFunction; - MeasuringFunction measuringFunction; - TimeProviderFunction getCurrentTime; - RegisterSensorFunction registerSensor; - UnregisterSensorFunction unregisterSensor; - SetGestureStateFunction setGestureStateFunction; - ConfigurePropsFunction configurePropsFunction; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h deleted file mode 100644 index e5f9c0844c6ba0..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/ReanimatedHiddenHeaders.h +++ /dev/null @@ -1,11 +0,0 @@ -#pragma once - -#if defined(ONANDROID) -#include "Logger.h" -#include "LoggerInterface.h" -#include "SpeedChecker.h" -#else -#include "Common/cpp/hidden_headers/Logger.h" -#include "Common/cpp/hidden_headers/LoggerInterface.h" -#include "Common/cpp/hidden_headers/SpeedChecker.h" -#endif diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/RuntimeDecorator.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/RuntimeDecorator.h deleted file mode 100644 index d36ca2ac628dac..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/RuntimeDecorator.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include "LayoutAnimationsProxy.h" -#include "PlatformDepMethodsHolder.h" - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -using RequestFrameFunction = std::function)>; - -enum RuntimeType { - /** - Represents any runtime that supports the concept of workletization - */ - Worklet, - /** - Represents the Reanimated UI worklet runtime specifically - */ - UI -}; -typedef jsi::Runtime *RuntimePointer; - -class RuntimeDecorator { - public: - static void decorateRuntime(jsi::Runtime &rt, const std::string &label); - static void decorateUIRuntime( - jsi::Runtime &rt, - const UpdaterFunction updater, - const RequestFrameFunction requestFrame, - const ScrollToFunction scrollTo, - const MeasuringFunction measure, - const TimeProviderFunction getCurrentTime, - const RegisterSensorFunction registerSensor, - const UnregisterSensorFunction unregisterSensor, - const SetGestureStateFunction setGestureState, - std::shared_ptr layoutAnimationsProxy); - - /** - Returns true if the given Runtime is the Reanimated UI-Thread Runtime. - */ - inline static bool isUIRuntime(jsi::Runtime &rt); - /** - Returns true if the given Runtime is a Runtime that supports the concept of - Workletization. (REA, Vision, ...) - */ - inline static bool isWorkletRuntime(jsi::Runtime &rt); - /** - Returns true if the given Runtime is the default ABI46_0_0React-JS Runtime. - */ - inline static bool isReactRuntime(jsi::Runtime &rt); - /** - Register the given Runtime. This function is required for every - RuntimeManager, otherwise future runtime checks will fail. - */ - static void registerRuntime(jsi::Runtime *runtime, RuntimeType runtimeType); - - private: - static std::unordered_map &runtimeRegistry(); -}; - -inline bool RuntimeDecorator::isUIRuntime(jsi::Runtime &rt) { - auto iterator = runtimeRegistry().find(&rt); - if (iterator == runtimeRegistry().end()) - return false; - return iterator->second == RuntimeType::UI; -} - -inline bool RuntimeDecorator::isWorkletRuntime(jsi::Runtime &rt) { - auto iterator = runtimeRegistry().find(&rt); - if (iterator == runtimeRegistry().end()) - return false; - auto type = iterator->second; - return type == RuntimeType::UI || type == RuntimeType::Worklet; -} - -inline bool RuntimeDecorator::isReactRuntime(jsi::Runtime &rt) { - auto iterator = runtimeRegistry().find(&rt); - if (iterator == runtimeRegistry().end()) - return true; - return false; -} - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Scheduler.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Scheduler.h deleted file mode 100644 index 0aa21494d21df3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/Scheduler.h +++ /dev/null @@ -1,89 +0,0 @@ -#pragma once - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace ABI46_0_0reanimated { - -// -// Copyright (c) 2013 Juan Palacios juan.palacios.puyana@gmail.com -// Subject to the BSD 2-Clause License -// - see < http://opensource.org/licenses/BSD-2-Clause> -// -template -class Queue { - public: - T pop() { - std::unique_lock mlock(mutex_); - while (queue_.empty()) { - cond_.wait(mlock); - } - auto item = queue_.front(); - queue_.pop(); - return item; - } - - void pop(T &item) { - std::unique_lock mlock(mutex_); - while (queue_.empty()) { - cond_.wait(mlock); - } - item = queue_.front(); - queue_.pop(); - } - - void push(const T &item) { - std::unique_lock mlock(mutex_); - queue_.push(item); - mlock.unlock(); - cond_.notify_one(); - } - - void push(T &&item) { - std::unique_lock mlock(mutex_); - queue_.push(std::move(item)); - mlock.unlock(); - cond_.notify_one(); - } - - size_t getSize() { - std::unique_lock mlock(mutex_); - const size_t res = queue_.size(); - mlock.unlock(); - cond_.notify_one(); - return res; - } - - private: - std::queue queue_; - std::mutex mutex_; - std::condition_variable cond_; -}; - -class RuntimeManager; - -class Scheduler { - public: - Scheduler(); - void scheduleOnJS(std::function job); - void setJSCallInvoker( - std::shared_ptr jsCallInvoker); - void setRuntimeManager(std::shared_ptr runtimeManager); - virtual void scheduleOnUI(std::function job); - virtual void triggerUI(); - virtual ~Scheduler(); - - protected: - std::atomic scheduledOnUI{}; - Queue> uiJobs; - std::shared_ptr jsCallInvoker_; - std::weak_ptr runtimeManager; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/WorkletEventHandler.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/WorkletEventHandler.h deleted file mode 100644 index 698b40a7b4ad2f..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/headers/Tools/WorkletEventHandler.h +++ /dev/null @@ -1,30 +0,0 @@ -#pragma once - -#include -#include -#include - -using namespace ABI46_0_0facebook; - -namespace ABI46_0_0reanimated { - -class EventHandlerRegistry; - -class WorkletEventHandler { - friend EventHandlerRegistry; - - private: - unsigned long id; - std::string eventName; - jsi::Function handler; - - public: - WorkletEventHandler( - unsigned long id, - std::string eventName, - jsi::Function &&handler) - : id(id), eventName(eventName), handler(std::move(handler)) {} - void process(jsi::Runtime &rt, const jsi::Value &eventValue); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/Logger.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/Logger.h deleted file mode 100644 index 31c253ae764b13..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/Logger.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include -#include "./LoggerInterface.h" - -namespace ABI46_0_0reanimated { - -class Logger { - public: - template - static void log(T value) { - if (instance == nullptr) { - throw std::runtime_error("no logger specified"); - } - instance->log(value); - } - - private: - static std::unique_ptr instance; -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/LoggerInterface.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/LoggerInterface.h deleted file mode 100644 index c15298e06ca6c3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/LoggerInterface.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -namespace ABI46_0_0reanimated { - -class LoggerInterface { - public: - virtual void log(const char *str) = 0; - virtual void log(double d) = 0; - virtual void log(int i) = 0; - virtual void log(bool b) = 0; - virtual ~LoggerInterface() {} -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/SpeedChecker.h b/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/SpeedChecker.h deleted file mode 100644 index 2bfd686d20996a..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/Common/cpp/hidden_headers/SpeedChecker.h +++ /dev/null @@ -1,29 +0,0 @@ -#pragma once - -#define CHECK_SPEED 1 - -#include -#include -#include -#include -#include "./Logger.h" - -namespace ABI46_0_0reanimated { - -class SpeedChecker { - public: - static void checkSpeed(std::string tag, std::function fun) { -#if CHECK_SPEED - auto start = std::chrono::system_clock::now(); -#endif - fun(); -#if CHECK_SPEED - auto end = std::chrono::system_clock::now(); - std::chrono::duration elapsed_seconds = end - start; - tag += " " + std::to_string(elapsed_seconds.count()) + "s"; - Logger::log(tag.c_str()); -#endif - } -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.h b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.h deleted file mode 100644 index 77d204f8bef374..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.h +++ /dev/null @@ -1,10 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0REAEventDispatcher : ABI46_0_0RCTEventDispatcher - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.m b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.m deleted file mode 100644 index 6c6afad5850aa5..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAEventDispatcher.m +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import -#import -#import - -@implementation ABI46_0_0REAEventDispatcher - -- (void)sendEvent:(id)event -{ - [[[self bridge] moduleForName:@"ReanimatedModule"] eventDispatcherWillDispatchEvent:event]; - [super sendEvent:event]; -} - -+ (NSString *)moduleName -{ - return NSStringFromClass([ABI46_0_0RCTEventDispatcher class]); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.h b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.h deleted file mode 100644 index 84a64a410dc69e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.h +++ /dev/null @@ -1,14 +0,0 @@ -#import -#import -#import -#import -#import -#import - -#import - -@interface ABI46_0_0REAModule : ABI46_0_0RCTEventEmitter - -@property (nonatomic, readonly) ABI46_0_0REANodesManager *nodesManager; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.m b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.m deleted file mode 100644 index 790f8473160e43..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAModule.m +++ /dev/null @@ -1,184 +0,0 @@ -#import -#import -#import -#import - -typedef void (^AnimatedOperation)(ABI46_0_0REANodesManager *nodesManager); - -@implementation ABI46_0_0REAModule { - NSMutableArray *_operations; - ABI46_0_0REATransitionManager *_transitionManager; -} - -ABI46_0_0RCT_EXPORT_MODULE(ReanimatedModule); - -- (void)invalidate -{ - _transitionManager = nil; - [_nodesManager invalidate]; - [self.bridge.uiManager.observerCoordinator removeObserver:self]; -} - -- (dispatch_queue_t)methodQueue -{ - // This module needs to be on the same queue as the UIManager to avoid - // having to lock `_operations` and `_preOperations` since `uiManagerWillPerformMounting` - // will be called from that queue. - return ABI46_0_0RCTGetUIManagerQueue(); -} - -#pragma mark-- Initialize - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - [super setBridge:bridge]; - - _nodesManager = [[ABI46_0_0REANodesManager alloc] initWithModule:self uiManager:self.bridge.uiManager]; - _operations = [NSMutableArray new]; - - _transitionManager = [[ABI46_0_0REATransitionManager alloc] initWithUIManager:self.bridge.uiManager]; - - [bridge.uiManager.observerCoordinator addObserver:self]; -} - -ABI46_0_0RCT_EXPORT_METHOD(installTurboModule) -{ - // TODO: Move initialization from UIResponder+Reanimated to here -} - -#pragma mark-- Transitioning API - -ABI46_0_0RCT_EXPORT_METHOD(animateNextTransition : (nonnull NSNumber *)rootTag config : (NSDictionary *)config) -{ - [_transitionManager animateNextTransitionInRoot:rootTag withConfig:config]; -} - -#pragma mark-- API - -ABI46_0_0RCT_EXPORT_METHOD(createNode : (nonnull NSNumber *)nodeID config : (NSDictionary *)config) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager createNode:nodeID config:config]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(dropNode : (nonnull NSNumber *)nodeID) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager dropNode:nodeID]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getValue : (nonnull NSNumber *)nodeID callback : (ABI46_0_0RCTResponseSenderBlock)callback) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager getValue:nodeID callback:(ABI46_0_0RCTResponseSenderBlock)callback]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(connectNodes : (nonnull NSNumber *)parentID childTag : (nonnull NSNumber *)childID) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager connectNodes:parentID childID:childID]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(disconnectNodes : (nonnull NSNumber *)parentID childTag : (nonnull NSNumber *)childID) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager disconnectNodes:parentID childID:childID]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(connectNodeToView : (nonnull NSNumber *)nodeID viewTag : (nonnull NSNumber *)viewTag) -{ - NSString *viewName = [self.bridge.uiManager viewNameForABI46_0_0ReactTag:viewTag]; - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager connectNodeToView:nodeID viewTag:viewTag viewName:viewName]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(disconnectNodeFromView : (nonnull NSNumber *)nodeID viewTag : (nonnull NSNumber *)viewTag) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager disconnectNodeFromView:nodeID viewTag:viewTag]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(attachEvent - : (nonnull NSNumber *)viewTag eventName - : (nonnull NSString *)eventName eventNodeID - : (nonnull NSNumber *)eventNodeID) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager attachEvent:viewTag eventName:eventName eventNodeID:eventNodeID]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(detachEvent - : (nonnull NSNumber *)viewTag eventName - : (nonnull NSString *)eventName eventNodeID - : (nonnull NSNumber *)eventNodeID) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager detachEvent:viewTag eventName:eventName eventNodeID:eventNodeID]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setValue : (nonnull NSNumber *)nodeID newValue : (nonnull NSNumber *)newValue) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager setValueForNodeID:nodeID value:newValue]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(triggerRender) -{ - [self addOperationBlock:^(ABI46_0_0REANodesManager *nodesManager) { - [nodesManager postRunUpdatesAfterAnimation]; - }]; -} - -#pragma mark-- Batch handling - -- (void)addOperationBlock:(AnimatedOperation)operation -{ - [_operations addObject:operation]; -} - -#pragma mark - ABI46_0_0RCTUIManagerObserver - -- (void)uiManagerWillPerformMounting:(ABI46_0_0RCTUIManager *)uiManager -{ - [_nodesManager maybeFlushUpdateBuffer]; - if (_operations.count == 0) { - return; - } - - NSArray *operations = _operations; - _operations = [NSMutableArray new]; - - ABI46_0_0REANodesManager *nodesManager = _nodesManager; - - [uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - for (AnimatedOperation operation in operations) { - operation(nodesManager); - } - [nodesManager operationsBatchDidComplete]; - }]; -} - -#pragma mark-- Events - -- (NSArray *)supportedEvents -{ - return @[ @"onReanimatedCall", @"onReanimatedPropsChange" ]; -} - -- (void)eventDispatcherWillDispatchEvent:(id)event -{ - // Events can be dispatched from any queue - [_nodesManager dispatchEvent:event]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.h b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.h deleted file mode 100644 index 89ecfdf459cb0b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.h +++ /dev/null @@ -1,83 +0,0 @@ -#import -#import -#import -#import - -@class ABI46_0_0REAModule; - -typedef void (^ABI46_0_0REAOnAnimationCallback)(CADisplayLink *displayLink); -typedef void (^ABI46_0_0REANativeAnimationOp)(ABI46_0_0RCTUIManager *uiManager); -typedef void (^ABI46_0_0REAEventHandler)(NSString *eventName, id event); - -@interface ABI46_0_0REANodesManager : NSObject - -@property (nonatomic, weak, nullable) ABI46_0_0RCTUIManager *uiManager; -@property (nonatomic, weak, nullable) ABI46_0_0REAModule *reanimatedModule; -@property (nonatomic, readonly) CFTimeInterval currentAnimationTimestamp; - -@property (nonatomic, nullable) NSSet *uiProps; -@property (nonatomic, nullable) NSSet *nativeProps; - -- (nonnull instancetype)initWithModule:(ABI46_0_0REAModule *)reanimatedModule uiManager:(nonnull ABI46_0_0RCTUIManager *)uiManager; - -- (ABI46_0_0REANode *_Nullable)findNodeByID:(nonnull ABI46_0_0REANodeID)nodeID; - -- (void)invalidate; - -- (void)operationsBatchDidComplete; - -// - -- (void)postOnAnimation:(ABI46_0_0REAOnAnimationCallback)clb; -- (void)postRunUpdatesAfterAnimation; -- (void)registerEventHandler:(ABI46_0_0REAEventHandler)eventHandler; -- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)ABI46_0_0ReactTag - viewName:(NSString *)viewName - nativeProps:(NSMutableDictionary *)nativeProps - trySynchronously:(BOOL)trySync; -- (void)getValue:(ABI46_0_0REANodeID)nodeID callback:(ABI46_0_0RCTResponseSenderBlock)callback; - -// graph - -- (void)createNode:(nonnull ABI46_0_0REANodeID)tag config:(NSDictionary *__nonnull)config; - -- (void)dropNode:(nonnull ABI46_0_0REANodeID)tag; - -- (void)connectNodes:(nonnull ABI46_0_0REANodeID)parentID childID:(nonnull ABI46_0_0REANodeID)childID; - -- (void)disconnectNodes:(nonnull ABI46_0_0REANodeID)parentID childID:(nonnull ABI46_0_0REANodeID)childID; - -- (void)connectNodeToView:(nonnull ABI46_0_0REANodeID)nodeID - viewTag:(nonnull NSNumber *)viewTag - viewName:(nonnull NSString *)viewName; - -- (void)disconnectNodeFromView:(nonnull ABI46_0_0REANodeID)nodeID viewTag:(nonnull NSNumber *)viewTag; - -- (void)attachEvent:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventNodeID:(nonnull ABI46_0_0REANodeID)eventNodeID; - -- (void)detachEvent:(nonnull NSNumber *)viewTag - eventName:(nonnull NSString *)eventName - eventNodeID:(nonnull ABI46_0_0REANodeID)eventNodeID; - -// configuration - -- (void)configureUiProps:(nonnull NSSet *)uiPropsSet - andNativeProps:(nonnull NSSet *)nativePropsSet; - -- (void)updateProps:(nonnull NSDictionary *)props - ofViewWithTag:(nonnull NSNumber *)viewTag - withName:(nonnull NSString *)viewName; - -- (NSString *)obtainProp:(nonnull NSNumber *)viewTag propName:(nonnull NSString *)propName; - -// events - -- (void)dispatchEvent:(id)event; - -- (void)setValueForNodeID:(nonnull NSNumber *)nodeID value:(nonnull NSNumber *)newValue; - -- (void)maybeFlushUpdateBuffer; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.m b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.m deleted file mode 100644 index bdf9f0c3fdc632..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REANodesManager.m +++ /dev/null @@ -1,626 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -// Interface below has been added in order to use private methods of ABI46_0_0RCTUIManager, -// ABI46_0_0RCTUIManager#UpdateView is a ABI46_0_0React Method which is exported to JS but in -// Objective-C it stays private -// ABI46_0_0RCTUIManager#setNeedsLayout is a method which updated layout only which -// in its turn will trigger relayout if no batch has been activated - -@interface ABI46_0_0RCTUIManager () - -- (void)updateView:(nonnull NSNumber *)ABI46_0_0ReactTag viewName:(NSString *)viewName props:(NSDictionary *)props; - -- (void)setNeedsLayout; - -@end - -@interface ABI46_0_0RCTUIManager (SyncUpdates) - -- (BOOL)hasEnqueuedUICommands; - -- (void)runSyncUIUpdatesWithObserver:(id)observer; - -@end - -@interface ABI46_0_0ComponentUpdate : NSObject - -@property (nonnull) NSMutableDictionary *props; -@property (nonnull) NSNumber *viewTag; -@property (nonnull) NSString *viewName; - -@end - -@implementation ABI46_0_0ComponentUpdate -@end - -@implementation ABI46_0_0RCTUIManager (SyncUpdates) - -- (BOOL)hasEnqueuedUICommands -{ - // Accessing some private bits of ABI46_0_0RCTUIManager to provide missing functionality - return [[self valueForKey:@"_pendingUIBlocks"] count] > 0; -} - -- (void)runSyncUIUpdatesWithObserver:(id)observer -{ - // before we run uimanager batch complete, we override coordinator observers list - // to avoid observers from firing. This is done because we only want the uimanager - // related operations to run and not all other operations (including the ones enqueued - // by reanimated or native animated modules) from being scheduled. If we were to allow - // other modules to execute some logic from this sync uimanager run there is a possibility - // that the commands will execute out of order or that we intercept a batch of commands that - // those modules may be in a middle of (we verify that batch isn't in progress for uimodule - // but can't do the same for all remaining modules) - - // store reference to the observers array - id oldObservers = [self.observerCoordinator valueForKey:@"_observers"]; - - // temporarily replace observers with a table conatining just nodesmanager (we need - // this to capture mounting block) - NSHashTable> *soleObserver = [NSHashTable new]; - [soleObserver addObject:observer]; - [self.observerCoordinator setValue:soleObserver forKey:@"_observers"]; - - // run batch - [self batchDidComplete]; - // restore old observers table - [self.observerCoordinator setValue:oldObservers forKey:@"_observers"]; -} - -@end - -@interface ABI46_0_0REANodesManager () - -@end - -@implementation ABI46_0_0REANodesManager { - NSMutableDictionary *_nodes; - NSMapTable *_eventMapping; - NSMutableArray> *_eventQueue; - CADisplayLink *_displayLink; - ABI46_0_0REAUpdateContext *_updateContext; - BOOL _wantRunUpdates; - BOOL _processingDirectEvent; - NSMutableArray *_onAnimationCallbacks; - NSMutableArray *_operationsInBatch; - BOOL _tryRunBatchUpdatesSynchronously; - ABI46_0_0REAEventHandler _eventHandler; - volatile void (^_mounting)(void); - NSMutableDictionary *_componentUpdateBuffer; - volatile atomic_bool _shouldFlushUpdateBuffer; - NSMutableDictionary *_viewRegistry; -} - -- (instancetype)initWithModule:(ABI46_0_0REAModule *)reanimatedModule uiManager:(ABI46_0_0RCTUIManager *)uiManager -{ - if ((self = [super init])) { - _reanimatedModule = reanimatedModule; - _uiManager = uiManager; - _nodes = [NSMutableDictionary new]; - _eventMapping = [NSMapTable strongToWeakObjectsMapTable]; - _eventQueue = [NSMutableArray new]; - _updateContext = [ABI46_0_0REAUpdateContext new]; - _wantRunUpdates = NO; - _onAnimationCallbacks = [NSMutableArray new]; - _operationsInBatch = [NSMutableArray new]; - _componentUpdateBuffer = [NSMutableDictionary new]; - _viewRegistry = [_uiManager valueForKey:@"_viewRegistry"]; - _shouldFlushUpdateBuffer = false; - } - - _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onAnimationFrame:)]; - _displayLink.preferredFramesPerSecond = 120; // will fallback to 60 fps for devices without Pro Motion display - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes]; - [_displayLink setPaused:true]; - return self; -} - -- (void)invalidate -{ - _eventHandler = nil; - [_displayLink invalidate]; -} - -- (void)operationsBatchDidComplete -{ - if (![_displayLink isPaused]) { - // if display link is set it means some of the operations that have run as a part of the batch - // requested updates. We want updates to be run in the same frame as in which operations have - // been scheduled as it may mean the new view has just been mounted and expects its initial - // props to be calculated. - // Unfortunately if the operation has just scheduled animation callback it won't run until the - // next frame, so it's being triggered manually. - _wantRunUpdates = YES; - [self performOperations]; - } -} - -- (ABI46_0_0REANode *)findNodeByID:(ABI46_0_0REANodeID)nodeID -{ - return _nodes[nodeID]; -} - -- (void)postOnAnimation:(ABI46_0_0REAOnAnimationCallback)clb -{ - [_onAnimationCallbacks addObject:clb]; - [self startUpdatingOnAnimationFrame]; -} - -- (void)postRunUpdatesAfterAnimation -{ - _wantRunUpdates = YES; - if (!_processingDirectEvent) { - [self startUpdatingOnAnimationFrame]; - } -} - -- (void)registerEventHandler:(ABI46_0_0REAEventHandler)eventHandler -{ - _eventHandler = eventHandler; -} - -- (void)startUpdatingOnAnimationFrame -{ - // Setting _currentAnimationTimestamp here is connected with manual triggering of performOperations - // in operationsBatchDidComplete. If new node has been created and clock has not been started, - // _displayLink won't be initialized soon enough and _displayLink.timestamp will be 0. - // However, CADisplayLink is using CACurrentMediaTime so if there's need to perform one more - // evaluation, it could be used it here. In usual case, CACurrentMediaTime is not being used in - // favor of setting it with _displayLink.timestamp in onAnimationFrame method. - _currentAnimationTimestamp = CACurrentMediaTime(); - [_displayLink setPaused:false]; -} - -- (void)stopUpdatingOnAnimationFrame -{ - if (_displayLink) { - [_displayLink setPaused:true]; - } -} - -- (void)onAnimationFrame:(CADisplayLink *)displayLink -{ - _currentAnimationTimestamp = _displayLink.timestamp; - - // We process all enqueued events first - for (NSUInteger i = 0; i < _eventQueue.count; i++) { - id event = _eventQueue[i]; - [self processEvent:event]; - } - [_eventQueue removeAllObjects]; - - NSArray *callbacks = _onAnimationCallbacks; - _onAnimationCallbacks = [NSMutableArray new]; - - // When one of the callbacks would postOnAnimation callback we don't want - // to process it until the next frame. This is why we cpy the array before - // we iterate over it - for (ABI46_0_0REAOnAnimationCallback block in callbacks) { - block(displayLink); - } - - [self performOperations]; - - if (_onAnimationCallbacks.count == 0) { - [self stopUpdatingOnAnimationFrame]; - } -} - -- (BOOL)uiManager:(ABI46_0_0RCTUIManager *)manager performMountingWithBlock:(ABI46_0_0RCTUIManagerMountingBlock)block -{ - ABI46_0_0RCTAssert(_mounting == nil, @"Mouting block is expected to not be set"); - _mounting = block; - return YES; -} - -- (void)performOperations -{ - if (_wantRunUpdates) { - [ABI46_0_0REANode runPropUpdates:_updateContext]; - } - if (_operationsInBatch.count != 0) { - NSMutableArray *copiedOperationsQueue = _operationsInBatch; - _operationsInBatch = [NSMutableArray new]; - - BOOL trySynchronously = _tryRunBatchUpdatesSynchronously; - _tryRunBatchUpdatesSynchronously = NO; - - __weak typeof(self) weakSelf = self; - dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); - ABI46_0_0RCTExecuteOnUIManagerQueue(^{ - __typeof__(self) strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - BOOL canUpdateSynchronously = trySynchronously && ![strongSelf.uiManager hasEnqueuedUICommands]; - - if (!canUpdateSynchronously) { - dispatch_semaphore_signal(semaphore); - } - - for (int i = 0; i < copiedOperationsQueue.count; i++) { - copiedOperationsQueue[i](strongSelf.uiManager); - } - - if (canUpdateSynchronously) { - [strongSelf.uiManager runSyncUIUpdatesWithObserver:self]; - dispatch_semaphore_signal(semaphore); - } - // In case canUpdateSynchronously=true we still have to send uiManagerWillPerformMounting event - // to observers because some components (e.g. TextInput) update their UIViews only on that event. - [strongSelf.uiManager setNeedsLayout]; - }); - if (trySynchronously) { - dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); - } - - if (_mounting) { - _mounting(); - _mounting = nil; - } - } - _wantRunUpdates = NO; -} - -- (void)enqueueUpdateViewOnNativeThread:(nonnull NSNumber *)ABI46_0_0ReactTag - viewName:(NSString *)viewName - nativeProps:(NSMutableDictionary *)nativeProps - trySynchronously:(BOOL)trySync -{ - if (trySync) { - _tryRunBatchUpdatesSynchronously = YES; - } - [_operationsInBatch addObject:^(ABI46_0_0RCTUIManager *uiManager) { - [uiManager updateView:ABI46_0_0ReactTag viewName:viewName props:nativeProps]; - }]; -} - -- (void)getValue:(ABI46_0_0REANodeID)nodeID callback:(ABI46_0_0RCTResponseSenderBlock)callback -{ - id val = _nodes[nodeID].value; - if (val) { - callback(@[ val ]); - } else { - // NULL is not an object and it's not possible to pass it as callback's argument - callback(@[ [NSNull null] ]); - } -} - -#pragma mark-- Graph - -- (void)createNode:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - static NSDictionary *map; - static dispatch_once_t mapToken; - dispatch_once(&mapToken, ^{ - map = @{ - @"props" : [ABI46_0_0REAPropsNode class], - @"style" : [ABI46_0_0REAStyleNode class], - @"transform" : [ABI46_0_0REATransformNode class], - @"value" : [ABI46_0_0REAValueNode class], - @"block" : [ABI46_0_0REABlockNode class], - @"cond" : [ABI46_0_0REACondNode class], - @"op" : [ABI46_0_0REAOperatorNode class], - @"set" : [ABI46_0_0REASetNode class], - @"debug" : [ABI46_0_0READebugNode class], - @"clock" : [ABI46_0_0REAClockNode class], - @"clockStart" : [ABI46_0_0REAClockStartNode class], - @"clockStop" : [ABI46_0_0REAClockStopNode class], - @"clockTest" : [ABI46_0_0REAClockTestNode class], - @"call" : [ABI46_0_0REAJSCallNode class], - @"bezier" : [ABI46_0_0REABezierNode class], - @"event" : [ABI46_0_0REAEventNode class], - @"always" : [ABI46_0_0REAAlwaysNode class], - @"concat" : [ABI46_0_0REAConcatNode class], - @"param" : [ABI46_0_0REAParamNode class], - @"func" : [ABI46_0_0REAFunctionNode class], - @"callfunc" : [ABI46_0_0REACallFuncNode class] - // @"listener": nil, - }; - }); - - NSString *nodeType = [ABI46_0_0RCTConvert NSString:config[@"type"]]; - - Class nodeClass = map[nodeType]; - if (!nodeClass) { - ABI46_0_0RCTLogError(@"Animated node type %@ not supported natively", nodeType); - return; - } - - ABI46_0_0REANode *node = [[nodeClass alloc] initWithID:nodeID config:config]; - node.nodesManager = self; - node.updateContext = _updateContext; - _nodes[nodeID] = node; -} - -- (void)dropNode:(ABI46_0_0REANodeID)nodeID -{ - ABI46_0_0REANode *node = _nodes[nodeID]; - if (node) { - [node onDrop]; - [_nodes removeObjectForKey:nodeID]; - } -} - -- (void)connectNodes:(nonnull NSNumber *)parentID childID:(nonnull ABI46_0_0REANodeID)childID -{ - ABI46_0_0RCTAssertParam(parentID); - ABI46_0_0RCTAssertParam(childID); - - ABI46_0_0REANode *parentNode = _nodes[parentID]; - ABI46_0_0REANode *childNode = _nodes[childID]; - - ABI46_0_0RCTAssertParam(childNode); - - [parentNode addChild:childNode]; -} - -- (void)disconnectNodes:(ABI46_0_0REANodeID)parentID childID:(ABI46_0_0REANodeID)childID -{ - ABI46_0_0RCTAssertParam(parentID); - ABI46_0_0RCTAssertParam(childID); - - ABI46_0_0REANode *parentNode = _nodes[parentID]; - ABI46_0_0REANode *childNode = _nodes[childID]; - - ABI46_0_0RCTAssertParam(childNode); - - [parentNode removeChild:childNode]; -} - -- (void)connectNodeToView:(ABI46_0_0REANodeID)nodeID viewTag:(NSNumber *)viewTag viewName:(NSString *)viewName -{ - ABI46_0_0RCTAssertParam(nodeID); - ABI46_0_0REANode *node = _nodes[nodeID]; - ABI46_0_0RCTAssertParam(node); - - if ([node isKindOfClass:[ABI46_0_0REAPropsNode class]]) { - [(ABI46_0_0REAPropsNode *)node connectToView:viewTag viewName:viewName]; - } -} - -- (void)disconnectNodeFromView:(ABI46_0_0REANodeID)nodeID viewTag:(NSNumber *)viewTag -{ - ABI46_0_0RCTAssertParam(nodeID); - ABI46_0_0REANode *node = _nodes[nodeID]; - ABI46_0_0RCTAssertParam(node); - - if ([node isKindOfClass:[ABI46_0_0REAPropsNode class]]) { - [(ABI46_0_0REAPropsNode *)node disconnectFromView:viewTag]; - } -} - -- (void)attachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(ABI46_0_0REANodeID)eventNodeID -{ - ABI46_0_0RCTAssertParam(eventNodeID); - ABI46_0_0REANode *eventNode = _nodes[eventNodeID]; - ABI46_0_0RCTAssert([eventNode isKindOfClass:[ABI46_0_0REAEventNode class]], @"Event node is of an invalid type"); - - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, ABI46_0_0RCTNormalizeInputEventName(eventName)]; - ABI46_0_0RCTAssert([_eventMapping objectForKey:key] == nil, @"Event handler already set for the given view and event type"); - [_eventMapping setObject:eventNode forKey:key]; -} - -- (void)detachEvent:(NSNumber *)viewTag eventName:(NSString *)eventName eventNodeID:(ABI46_0_0REANodeID)eventNodeID -{ - NSString *key = [NSString stringWithFormat:@"%@%@", viewTag, ABI46_0_0RCTNormalizeInputEventName(eventName)]; - [_eventMapping removeObjectForKey:key]; -} - -- (void)processEvent:(id)event -{ - NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, ABI46_0_0RCTNormalizeInputEventName(event.eventName)]; - ABI46_0_0REAEventNode *eventNode = [_eventMapping objectForKey:key]; - [eventNode processEvent:event]; -} - -- (void)processDirectEvent:(id)event -{ - _processingDirectEvent = YES; - [self processEvent:event]; - [self performOperations]; - _processingDirectEvent = NO; -} - -- (BOOL)isDirectEvent:(id)event -{ - static NSArray *directEventNames; - static dispatch_once_t directEventNamesToken; - dispatch_once(&directEventNamesToken, ^{ - directEventNames = @[ - @"topContentSizeChange", - @"topMomentumScrollBegin", - @"topMomentumScrollEnd", - @"topScroll", - @"topScrollBeginDrag", - @"topScrollEndDrag" - ]; - }); - - return [directEventNames containsObject:ABI46_0_0RCTNormalizeInputEventName(event.eventName)]; -} - -- (void)dispatchEvent:(id)event -{ - NSString *key = [NSString stringWithFormat:@"%@%@", event.viewTag, ABI46_0_0RCTNormalizeInputEventName(event.eventName)]; - - NSString *eventHash = [NSString stringWithFormat:@"%@%@", event.viewTag, event.eventName]; - - if (_eventHandler != nil) { - __weak ABI46_0_0REAEventHandler eventHandler = _eventHandler; - __weak typeof(self) weakSelf = self; - ABI46_0_0RCTExecuteOnMainQueue(^void() { - __typeof__(self) strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - if (eventHandler == nil) { - return; - } - eventHandler(eventHash, event); - if ([strongSelf isDirectEvent:event]) { - [strongSelf performOperations]; - } - }); - } - - ABI46_0_0REANode *eventNode = [_eventMapping objectForKey:key]; - - if (eventNode != nil) { - if ([self isDirectEvent:event]) { - // Bypass the event queue/animation frames and process scroll events - // immediately to avoid getting out of sync with the scroll position - [self processDirectEvent:event]; - } else { - // enqueue node to be processed - [_eventQueue addObject:event]; - [self startUpdatingOnAnimationFrame]; - } - } -} - -- (void)configureUiProps:(nonnull NSSet *)uiPropsSet - andNativeProps:(nonnull NSSet *)nativePropsSet -{ - _uiProps = uiPropsSet; - _nativeProps = nativePropsSet; -} - -- (BOOL)isNotNativeViewFullyMounted:(NSNumber *)viewTag -{ - return _viewRegistry[viewTag].superview == nil; -} - -- (void)setValueForNodeID:(nonnull NSNumber *)nodeID value:(nonnull NSNumber *)newValue -{ - ABI46_0_0RCTAssertParam(nodeID); - - ABI46_0_0REANode *node = _nodes[nodeID]; - - ABI46_0_0REAValueNode *valueNode = (ABI46_0_0REAValueNode *)node; - [valueNode setValue:newValue]; -} - -- (void)updateProps:(nonnull NSDictionary *)props - ofViewWithTag:(nonnull NSNumber *)viewTag - withName:(nonnull NSString *)viewName -{ - ABI46_0_0ComponentUpdate *lastSnapshot = _componentUpdateBuffer[viewTag]; - if ([self isNotNativeViewFullyMounted:viewTag] || lastSnapshot != nil) { - if (lastSnapshot == nil) { - ABI46_0_0ComponentUpdate *propsSnapshot = [ABI46_0_0ComponentUpdate new]; - propsSnapshot.props = [props mutableCopy]; - propsSnapshot.viewTag = viewTag; - propsSnapshot.viewName = viewName; - _componentUpdateBuffer[viewTag] = propsSnapshot; - atomic_store(&_shouldFlushUpdateBuffer, true); - } else { - NSMutableDictionary *lastProps = lastSnapshot.props; - for (NSString *key in props) { - [lastProps setValue:props[key] forKey:key]; - } - } - return; - } - - // TODO: refactor PropsNode to also use this function - NSMutableDictionary *uiProps = [NSMutableDictionary new]; - NSMutableDictionary *nativeProps = [NSMutableDictionary new]; - NSMutableDictionary *jsProps = [NSMutableDictionary new]; - - void (^addBlock)(NSString *key, id obj, BOOL *stop) = ^(NSString *key, id obj, BOOL *stop) { - if ([self.uiProps containsObject:key]) { - uiProps[key] = obj; - } else if ([self.nativeProps containsObject:key]) { - nativeProps[key] = obj; - } else { - jsProps[key] = obj; - } - }; - - [props enumerateKeysAndObjectsUsingBlock:addBlock]; - - if (uiProps.count > 0) { - [self.uiManager synchronouslyUpdateViewOnUIThread:viewTag viewName:viewName props:uiProps]; - } - if (nativeProps.count > 0) { - [self enqueueUpdateViewOnNativeThread:viewTag viewName:viewName nativeProps:nativeProps trySynchronously:YES]; - } - if (jsProps.count > 0) { - [self.reanimatedModule sendEventWithName:@"onReanimatedPropsChange" - body:@{@"viewTag" : viewTag, @"props" : jsProps}]; - } -} - -- (NSString *)obtainProp:(nonnull NSNumber *)viewTag propName:(nonnull NSString *)propName -{ - UIView *view = [self.uiManager viewForABI46_0_0ReactTag:viewTag]; - - NSString *result = - [NSString stringWithFormat:@"error: unknown propName %@, currently supported: opacity, zIndex", propName]; - - if ([propName isEqualToString:@"opacity"]) { - CGFloat alpha = view.alpha; - result = [@(alpha) stringValue]; - } else if ([propName isEqualToString:@"zIndex"]) { - NSInteger zIndex = view.ABI46_0_0ReactZIndex; - result = [@(zIndex) stringValue]; - } - - return result; -} - -- (void)maybeFlushUpdateBuffer -{ - ABI46_0_0RCTAssertUIManagerQueue(); - bool shouldFlushUpdateBuffer = atomic_load(&_shouldFlushUpdateBuffer); - if (!shouldFlushUpdateBuffer) { - return; - } - - __weak typeof(self) weakSelf = self; - [_uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *manager, __unused NSDictionary *viewRegistry) { - __typeof__(self) strongSelf = weakSelf; - if (strongSelf == nil) { - return; - } - atomic_store(&strongSelf->_shouldFlushUpdateBuffer, false); - NSMutableDictionary *componentUpdateBuffer = [strongSelf->_componentUpdateBuffer copy]; - strongSelf->_componentUpdateBuffer = [NSMutableDictionary new]; - for (NSNumber *tag in componentUpdateBuffer) { - ABI46_0_0ComponentUpdate *componentUpdate = componentUpdateBuffer[tag]; - if (componentUpdate == Nil) { - continue; - } - [strongSelf updateProps:componentUpdate.props - ofViewWithTag:componentUpdate.viewTag - withName:componentUpdate.viewName]; - } - [strongSelf performOperations]; - }]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAUtils.h b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAUtils.h deleted file mode 100644 index b81bfafea0adb1..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0REAUtils.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -#define ABI46_0_0REA_LOG_ERROR_IF_NIL(value, errorMsg) \ - ({ \ - if (value == nil) \ - ABI46_0_0RCTLogError(errorMsg); \ - }) diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0RNGestureHandlerStateManager.h b/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0RNGestureHandlerStateManager.h deleted file mode 100644 index c67a81e4767680..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/ABI46_0_0RNGestureHandlerStateManager.h +++ /dev/null @@ -1,5 +0,0 @@ -@protocol ABI46_0_0RNGestureHandlerStateManager - -- (void)setGestureState:(int)state forHandler:(int)handlerTag; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.h b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.h deleted file mode 100644 index a6d28013ed59f1..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.h +++ /dev/null @@ -1,32 +0,0 @@ -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef NS_ENUM(NSInteger, ViewState) { - Inactive, - Appearing, - Disappearing, - Layout, - ToRemove, -}; - -@interface ABI46_0_0REAAnimationsManager : NSObject - -- (instancetype)initWithUIManager:(ABI46_0_0RCTUIManager *)uiManager; -- (void)setRemovingConfigBlock:(void (^)(NSNumber *tag))block; -- (void)setAnimationStartingBlock: - (void (^)(NSNumber *tag, NSString *type, NSDictionary *target, NSNumber *depth))startAnimation; -- (void)notifyAboutProgress:(NSDictionary *)newStyle tag:(NSNumber *)tag; -- (void)notifyAboutEnd:(NSNumber *)tag cancelled:(BOOL)cancelled; -- (void)invalidate; -- (void)onViewRemoval:(UIView *)view before:(ABI46_0_0REASnapshot *)before; -- (void)onViewCreate:(UIView *)view after:(ABI46_0_0REASnapshot *)after; -- (void)onViewUpdate:(UIView *)view before:(ABI46_0_0REASnapshot *)before after:(ABI46_0_0REASnapshot *)after; -- (void)setToBeRemovedRegistry:(NSMutableDictionary> *> *)toBeRemovedRegister; -- (void)removeLeftovers; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.m b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.m deleted file mode 100644 index 3364318a00c997..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAAnimationsManager.m +++ /dev/null @@ -1,360 +0,0 @@ -#import -#import -#import -#import -#import -#import - -@interface ABI46_0_0REAAnimationsManager () - -typedef NS_ENUM(NSInteger, FrameConfigType) { EnteringFrame, ExitingFrame }; - -@property (atomic, nullable) void (^startAnimationForTag)(NSNumber *, NSString *, NSDictionary *, NSNumber *); -@property (atomic, nullable) void (^removeConfigForTag)(NSNumber *); - -- (void)removeLeftovers; -- (void)scheduleCleaning; -- (double)getDoubleOrZero:(NSNumber *)number; - -@end - -@implementation ABI46_0_0REAAnimationsManager { - ABI46_0_0RCTUIManager *_uiManager; - ABI46_0_0REAUIManager *_reaUiManager; - NSMutableDictionary *_states; - NSMutableDictionary *_viewForTag; - NSMutableSet *_toRemove; - NSMutableArray *_targetKeys; - NSMutableArray *_currentKeys; - BOOL _cleaningScheduled; -} - -+ (NSArray *)layoutKeys -{ - static NSArray *_array; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - _array = @[ @"originX", @"originY", @"width", @"height" ]; - }); - return _array; -} - -- (instancetype)initWithUIManager:(ABI46_0_0RCTUIManager *)uiManager -{ - if (self = [super init]) { - _uiManager = uiManager; - _reaUiManager = (ABI46_0_0REAUIManager *)uiManager; - _states = [NSMutableDictionary new]; - _viewForTag = [NSMutableDictionary new]; - _toRemove = [NSMutableSet new]; - _cleaningScheduled = false; - - _targetKeys = [NSMutableArray new]; - _currentKeys = [NSMutableArray new]; - for (NSString *key in [[self class] layoutKeys]) { - [_targetKeys addObject:[NSString stringWithFormat:@"target%@", [key capitalizedString]]]; - [_currentKeys addObject:[NSString stringWithFormat:@"current%@", [key capitalizedString]]]; - } - } - return self; -} - -- (void)invalidate -{ - _startAnimationForTag = nil; - _removeConfigForTag = nil; - _uiManager = nil; - _states = nil; - _viewForTag = nil; - _toRemove = nil; - _cleaningScheduled = false; - _targetKeys = nil; - _currentKeys = nil; -} - -- (void)setAnimationStartingBlock: - (void (^)(NSNumber *tag, NSString *type, NSDictionary *yogaValues, NSNumber *depth))startAnimation -{ - _startAnimationForTag = startAnimation; -} - -- (void)setRemovingConfigBlock:(void (^)(NSNumber *tag))block -{ - _removeConfigForTag = block; -} - -- (void)scheduleCleaning -{ - if (_cleaningScheduled) { - return; - } - _cleaningScheduled = true; - - __weak ABI46_0_0REAAnimationsManager *weakSelf = self; - dispatch_async(dispatch_get_main_queue(), ^{ - self->_cleaningScheduled = false; - if (weakSelf == nil) { - return; - } - [self removeLeftovers]; - }); -} - -- (void)findRoot:(UIView *)view roots:(NSMutableSet *)roots -{ - UIView *currentView = view; - NSNumber *lastToRemoveTag = nil; - while (currentView != nil) { - ViewState state = [_states[currentView.ABI46_0_0ReactTag] intValue]; - if (state == Disappearing) { - return; - } - if (state == ToRemove) { - lastToRemoveTag = currentView.ABI46_0_0ReactTag; - } - currentView = currentView.superview; - } - if (lastToRemoveTag != nil) { - [roots addObject:lastToRemoveTag]; - } -} - -- (BOOL)dfs:(UIView *)root view:(UIView *)view cands:(NSMutableSet *)cands -{ - NSNumber *tag = view.ABI46_0_0ReactTag; - if (tag == nil) { - return true; - } - if (![cands containsObject:tag] && _states[tag] != nil) { - return true; - } - BOOL cannotStripe = false; - NSArray *toRemoveCopy = [view.ABI46_0_0ReactSubviews copy]; - for (UIView *child in toRemoveCopy) { - if (![view isKindOfClass:[ABI46_0_0RCTTextView class]]) { - cannotStripe |= [self dfs:root view:child cands:cands]; - } - } - if (!cannotStripe) { - if (view.ABI46_0_0ReactSuperview != nil) { - [_reaUiManager unregisterView:view]; - } - [_states removeObjectForKey:tag]; - [_viewForTag removeObjectForKey:tag]; - [_toRemove removeObject:tag]; - } - return cannotStripe; -} - -- (void)removeLeftovers -{ - NSMutableSet *roots = [NSMutableSet new]; - for (NSNumber *viewTag in _toRemove) { - UIView *view = _viewForTag[viewTag]; - if (view == nil) { - view = [_reaUiManager viewForABI46_0_0ReactTag:viewTag]; - _viewForTag[viewTag] = view; - } - [self findRoot:view roots:roots]; - } - for (NSNumber *viewTag in roots) { - UIView *view = _viewForTag[viewTag]; - [self dfs:view view:view cands:_toRemove]; - } -} - -- (void)notifyAboutEnd:(NSNumber *)tag cancelled:(BOOL)cancelled -{ - if (!cancelled) { - ViewState state = [_states[tag] intValue]; - if (state == Appearing) { - _states[tag] = [NSNumber numberWithInt:Layout]; - } - if (state == Disappearing) { - _states[tag] = [NSNumber numberWithInt:ToRemove]; - if (tag != nil) { - [_toRemove addObject:tag]; - } - [self scheduleCleaning]; - } - } -} - -- (void)notifyAboutProgress:(NSDictionary *)newStyle tag:(NSNumber *)tag -{ - if (_states[tag] == nil) { - return; - } - ViewState state = [_states[tag] intValue]; - if (state == Inactive) { - _states[tag] = [NSNumber numberWithInt:Appearing]; - } - - NSMutableDictionary *dataComponenetsByName = [_uiManager valueForKey:@"_componentDataByName"]; - ABI46_0_0RCTComponentData *componentData = dataComponenetsByName[@"RCTView"]; - [self setNewProps:[newStyle mutableCopy] forView:_viewForTag[tag] withComponentData:componentData]; -} - -- (double)getDoubleOrZero:(NSNumber *)number -{ - double doubleValue = [number doubleValue]; - if (doubleValue != doubleValue) { // NaN != NaN - return 0; - } - return doubleValue; -} - -- (void)setNewProps:(NSMutableDictionary *)newProps - forView:(UIView *)view - withComponentData:(ABI46_0_0RCTComponentData *)componentData -{ - if (newProps[@"height"]) { - double height = [self getDoubleOrZero:newProps[@"height"]]; - double oldHeight = view.bounds.size.height; - view.bounds = CGRectMake(0, 0, view.bounds.size.width, height); - view.center = CGPointMake(view.center.x, view.center.y - oldHeight / 2.0 + view.bounds.size.height / 2.0); - [newProps removeObjectForKey:@"height"]; - } - if (newProps[@"width"]) { - double width = [self getDoubleOrZero:newProps[@"width"]]; - double oldWidth = view.bounds.size.width; - view.bounds = CGRectMake(0, 0, width, view.bounds.size.height); - view.center = CGPointMake(view.center.x + view.bounds.size.width / 2.0 - oldWidth / 2.0, view.center.y); - [newProps removeObjectForKey:@"width"]; - } - if (newProps[@"originX"]) { - double originX = [self getDoubleOrZero:newProps[@"originX"]]; - view.center = CGPointMake(originX + view.bounds.size.width / 2.0, view.center.y); - [newProps removeObjectForKey:@"originX"]; - } - if (newProps[@"originY"]) { - double originY = [self getDoubleOrZero:newProps[@"originY"]]; - view.center = CGPointMake(view.center.x, originY + view.bounds.size.height / 2.0); - [newProps removeObjectForKey:@"originY"]; - } - [componentData setProps:newProps forView:view]; -} - -- (NSDictionary *)prepareDataForAnimatingWorklet:(NSMutableDictionary *)values frameConfig:(FrameConfigType)frameConfig -{ - UIView *windowView = UIApplication.sharedApplication.keyWindow; - if (frameConfig == EnteringFrame) { - NSDictionary *preparedData = @{ - @"targetWidth" : values[@"width"], - @"targetHeight" : values[@"height"], - @"targetOriginX" : values[@"originX"], - @"targetOriginY" : values[@"originY"], - @"targetGlobalOriginX" : values[@"globalOriginX"], - @"targetGlobalOriginY" : values[@"globalOriginY"], - @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width], - @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height] - }; - return preparedData; - } else { - NSDictionary *preparedData = @{ - @"currentWidth" : values[@"width"], - @"currentHeight" : values[@"height"], - @"currentOriginX" : values[@"originX"], - @"currentOriginY" : values[@"originY"], - @"currentGlobalOriginX" : values[@"globalOriginX"], - @"currentGlobalOriginY" : values[@"globalOriginY"], - @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width], - @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height] - }; - return preparedData; - } -} - -- (NSDictionary *)prepareDataForLayoutAnimatingWorklet:(NSMutableDictionary *)currentValues - targetValues:(NSMutableDictionary *)targetValues -{ - UIView *windowView = UIApplication.sharedApplication.keyWindow; - NSDictionary *preparedData = @{ - @"currentWidth" : currentValues[@"width"], - @"currentHeight" : currentValues[@"height"], - @"currentOriginX" : currentValues[@"originX"], - @"currentOriginY" : currentValues[@"originY"], - @"currentGlobalOriginX" : currentValues[@"globalOriginX"], - @"currentGlobalOriginY" : currentValues[@"globalOriginY"], - @"targetWidth" : targetValues[@"width"], - @"targetHeight" : targetValues[@"height"], - @"targetOriginX" : targetValues[@"originX"], - @"targetOriginY" : targetValues[@"originY"], - @"targetGlobalOriginX" : targetValues[@"globalOriginX"], - @"targetGlobalOriginY" : targetValues[@"globalOriginY"], - @"windowWidth" : [NSNumber numberWithDouble:windowView.bounds.size.width], - @"windowHeight" : [NSNumber numberWithDouble:windowView.bounds.size.height] - }; - return preparedData; -} - -- (void)onViewRemoval:(UIView *)view before:(ABI46_0_0REASnapshot *)before -{ - NSNumber *tag = view.ABI46_0_0ReactTag; - ViewState state = [_states[tag] intValue]; - if (state == Disappearing || state == ToRemove || tag == nil) { - return; - } - NSMutableDictionary *startValues = before.values; - if (state == Inactive) { - if (startValues != nil) { - _states[tag] = [NSNumber numberWithInt:ToRemove]; - [_toRemove addObject:tag]; - [self scheduleCleaning]; - } - return; - } - _states[tag] = [NSNumber numberWithInt:Disappearing]; - NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:startValues frameConfig:ExitingFrame]; - _startAnimationForTag(tag, @"exiting", preparedValues, @(0)); -} - -- (void)onViewCreate:(UIView *)view after:(ABI46_0_0REASnapshot *)after -{ - _reaUiManager.flushUiOperations(); - NSNumber *tag = view.ABI46_0_0ReactTag; - if (_states[tag] == nil) { - _states[tag] = [NSNumber numberWithInt:Inactive]; - _viewForTag[tag] = view; - } - NSMutableDictionary *targetValues = after.values; - ViewState state = [_states[tag] intValue]; - if (state == Inactive) { - if (targetValues != nil) { - NSDictionary *preparedValues = [self prepareDataForAnimatingWorklet:targetValues frameConfig:EnteringFrame]; - _startAnimationForTag(tag, @"entering", preparedValues, @(0)); - } - return; - } -} - -- (void)onViewUpdate:(UIView *)view before:(ABI46_0_0REASnapshot *)before after:(ABI46_0_0REASnapshot *)after -{ - NSNumber *tag = view.ABI46_0_0ReactTag; - NSMutableDictionary *targetValues = after.values; - NSMutableDictionary *currentValues = before.values; - if (_states[tag] == nil) { - return; - } - ViewState state = [_states[tag] intValue]; - if (state == Disappearing || state == ToRemove || state == Inactive) { - return; - } - if (state == Appearing) { - BOOL doNotStartLayout = true; - for (int i = 0; i < [[self class] layoutKeys].count; ++i) { - if ([((NSNumber *)currentValues[_currentKeys[i]]) doubleValue] != - [((NSNumber *)targetValues[_targetKeys[i]]) doubleValue]) { - doNotStartLayout = false; - } - } - if (doNotStartLayout) { - return; - } - } - _states[view.ABI46_0_0ReactTag] = [NSNumber numberWithInt:Layout]; - NSDictionary *preparedValues = [self prepareDataForLayoutAnimatingWorklet:currentValues targetValues:targetValues]; - _startAnimationForTag(view.ABI46_0_0ReactTag, @"layout", preparedValues, @(0)); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.h b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.h deleted file mode 100644 index 1b2b19bb8b3048..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0REASnapshot : NSObject - -@property NSMutableDictionary *values; - -- (instancetype)init:(UIView *)view; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.m b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.m deleted file mode 100644 index df1dbbeb845ac9..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REASnapshot.m +++ /dev/null @@ -1,29 +0,0 @@ -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@implementation ABI46_0_0REASnapshot { - UIView *_view; -} - -- (instancetype)init:(UIView *)view -{ - self = [super init]; - _view = view; - UIView *windowView = UIApplication.sharedApplication.keyWindow; - CGPoint originFromRootPerspective = [[view superview] convertPoint:view.center toView:windowView]; - _values = [NSMutableDictionary new]; - _values[@"width"] = [NSNumber numberWithDouble:(double)(view.bounds.size.width)]; - _values[@"height"] = [NSNumber numberWithDouble:(double)(view.bounds.size.height)]; - _values[@"originX"] = [NSNumber numberWithDouble:view.center.x - view.bounds.size.width / 2.0]; - _values[@"originY"] = [NSNumber numberWithDouble:view.center.y - view.bounds.size.height / 2.0]; - _values[@"globalOriginX"] = [NSNumber numberWithDouble:originFromRootPerspective.x - view.bounds.size.width / 2.0]; - _values[@"globalOriginY"] = [NSNumber numberWithDouble:originFromRootPerspective.y - view.bounds.size.height / 2.0]; - - return self; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.h b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.h deleted file mode 100644 index c46b740a84485e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.h +++ /dev/null @@ -1,16 +0,0 @@ -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0REAUIManager : ABI46_0_0RCTUIManager -@property BOOL ABI46_0_0blockSetter; -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge; -- (void)setUp:(ABI46_0_0REAAnimationsManager *)animationsManager; -- (void)unregisterView:(id)view; -@property (nonatomic, copy) void (^flushUiOperations)(); -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.mm b/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.mm deleted file mode 100644 index 2e338ae2553f1b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/LayoutReanimation/ABI46_0_0REAUIManager.mm +++ /dev/null @@ -1,387 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#if __has_include() -#import -#endif - -@interface ABI46_0_0RCTUIManager (REA) -- (void)_manageChildren:(NSNumber *)containerTag - moveFromIndices:(NSArray *)moveFromIndices - moveToIndices:(NSArray *)moveToIndices - addChildABI46_0_0ReactTags:(NSArray *)addChildABI46_0_0ReactTags - addAtIndices:(NSArray *)addAtIndices - removeAtIndices:(NSArray *)removeAtIndices - registry:(NSMutableDictionary> *)registry; - -- (NSArray> *)_childrenToRemoveFromContainer:(id)container - atIndices:(NSArray *)atIndices; -@end - -@implementation ABI46_0_0REAUIManager - -BOOL ABI46_0_0blockSetter = false; -NSMutableDictionary> *> *ABI46_0_0_toBeRemovedRegister; -NSMutableDictionary *ABI46_0_0_parentMapper; -ABI46_0_0REAAnimationsManager *ABI46_0_0_animationsManager; -std::weak_ptr ABI46_0_0_scheduler; - -+ (NSString *)moduleName -{ - return NSStringFromClass([ABI46_0_0RCTUIManager class]); -} - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (!_ABI46_0_0blockSetter) { - _ABI46_0_0blockSetter = true; - - self.bridge = bridge; - [super setValue:bridge forKey:@"_bridge"]; - [self setValue:[bridge.uiManager valueForKey:@"_shadowViewRegistry"] forKey:@"_shadowViewRegistry"]; - [self setValue:[bridge.uiManager valueForKey:@"_viewRegistry"] forKey:@"_viewRegistry"]; - [self setValue:[bridge.uiManager valueForKey:@"_nativeIDRegistry"] forKey:@"_nativeIDRegistry"]; - [self setValue:[bridge.uiManager valueForKey:@"_shadowViewsWithUpdatedProps"] - forKey:@"_shadowViewsWithUpdatedProps"]; - [self setValue:[bridge.uiManager valueForKey:@"_shadowViewsWithUpdatedChildren"] - forKey:@"_shadowViewsWithUpdatedChildren"]; - [self setValue:[bridge.uiManager valueForKey:@"_pendingUIBlocks"] forKey:@"_pendingUIBlocks"]; - [self setValue:[bridge.uiManager valueForKey:@"_rootViewTags"] forKey:@"_rootViewTags"]; - [self setValue:[bridge.uiManager valueForKey:@"_observerCoordinator"] forKey:@"_observerCoordinator"]; - [self setValue:[bridge.uiManager valueForKey:@"_componentDataByName"] forKey:@"_componentDataByName"]; - - _ABI46_0_0blockSetter = false; - } -} - -- (void)_manageChildren:(NSNumber *)containerTag - moveFromIndices:(NSArray *)moveFromIndices - moveToIndices:(NSArray *)moveToIndices - addChildABI46_0_0ReactTags:(NSArray *)addChildABI46_0_0ReactTags - addAtIndices:(NSArray *)addAtIndices - removeAtIndices:(NSArray *)removeAtIndices - registry:(NSMutableDictionary> *)registry -{ - if (!ABI46_0_0reanimated::FeaturesConfig::isLayoutAnimationEnabled()) { - [super _manageChildren:containerTag - moveFromIndices:moveFromIndices - moveToIndices:moveToIndices - addChildABI46_0_0ReactTags:addChildABI46_0_0ReactTags - addAtIndices:addAtIndices - removeAtIndices:removeAtIndices - registry:registry]; - return; - } - - // Reanimated changes /start - BOOL isUIViewRegistry = ((id)registry == (id)[self valueForKey:@"_viewRegistry"]); - id container; - NSMutableArray> *permanentlyRemovedChildren; - if (isUIViewRegistry) { - container = registry[containerTag]; - for (id toRemoveChild in ABI46_0_0_toBeRemovedRegister[containerTag]) { - [container removeABI46_0_0ReactSubview:toRemoveChild]; - } - - permanentlyRemovedChildren = (NSMutableArray *)[super _childrenToRemoveFromContainer:container - atIndices:removeAtIndices]; - if (permanentlyRemovedChildren != nil) { - for (id permanentlyRemovedChild in permanentlyRemovedChildren) { - if (ABI46_0_0_toBeRemovedRegister[containerTag] == nil) { - ABI46_0_0_toBeRemovedRegister[containerTag] = [[NSMutableSet> alloc] init]; - } - [ABI46_0_0_toBeRemovedRegister[containerTag] addObject:permanentlyRemovedChild]; - } - } - } - // Reanimated changes /end - - [super _manageChildren:containerTag - moveFromIndices:moveFromIndices - moveToIndices:moveToIndices - addChildABI46_0_0ReactTags:addChildABI46_0_0ReactTags - addAtIndices:addAtIndices - removeAtIndices:removeAtIndices - registry:registry]; - - // Reanimated changes /start - if (isUIViewRegistry) { - NSMutableDictionary> *viewRegistry = [self valueForKey:@"_viewRegistry"]; - for (id toRemoveChild in ABI46_0_0_toBeRemovedRegister[containerTag]) { - NSInteger lastIndex = [container ABI46_0_0ReactSubviews].count - 1; - if (lastIndex < 0) { - lastIndex = 0; - } - if ([toRemoveChild isKindOfClass:[ABI46_0_0RCTModalHostView class]] -#if __has_include() - || ([toRemoveChild isKindOfClass:[ABI46_0_0RNSScreenView class]]) -#endif - ) { - // we don't want layout animations when removing modals or Screens of native-stack since it brings buggy - // behavior - [ABI46_0_0_toBeRemovedRegister[container.ABI46_0_0ReactTag] removeObject:toRemoveChild]; - [permanentlyRemovedChildren removeObject:toRemoveChild]; - - } else { - [container insertABI46_0_0ReactSubview:toRemoveChild atIndex:lastIndex]; - viewRegistry[toRemoveChild.ABI46_0_0ReactTag] = toRemoveChild; - } - } - - for (UIView *removedChild in permanentlyRemovedChildren) { - [self callAnimationForTree:removedChild parentTag:containerTag]; - } - } - // Reanimated changes /end -} - -- (void)callAnimationForTree:(UIView *)view parentTag:(NSNumber *)parentTag -{ - ABI46_0_0REASnapshot *snapshot = [[ABI46_0_0REASnapshot alloc] init:view]; - ABI46_0_0_parentMapper[view.ABI46_0_0ReactTag] = parentTag; - [ABI46_0_0_animationsManager onViewRemoval:view before:snapshot]; - - for (UIView *subView in view.ABI46_0_0ReactSubviews) { - [self callAnimationForTree:subView parentTag:view.ABI46_0_0ReactTag]; - } -} - -// Overrided https://github.com/facebook/react-native/blob/v0.65.0/ABI46_0_0React/Modules/ABI46_0_0RCTUIManager.m#L530 -- (ABI46_0_0RCTViewManagerUIBlock)uiBlockWithLayoutUpdateForRootView:(ABI46_0_0RCTRootShadowView *)rootShadowView -{ - NSHashTable *affectedShadowViews = [NSHashTable weakObjectsHashTable]; - [rootShadowView layoutWithAffectedShadowViews:affectedShadowViews]; - - if (!affectedShadowViews.count) { - // no frame change results in no UI update block - return nil; - } - - typedef struct { - CGRect frame; - UIUserInterfaceLayoutDirection layoutDirection; - BOOL isNew; - BOOL parentIsNew; - ABI46_0_0RCTDisplayType displayType; - } ABI46_0_0RCTFrameData; - - // Construct arrays then hand off to main thread - NSUInteger count = affectedShadowViews.count; - NSMutableArray *ABI46_0_0ReactTags = [[NSMutableArray alloc] initWithCapacity:count]; - NSMutableData *framesData = [[NSMutableData alloc] initWithLength:sizeof(ABI46_0_0RCTFrameData) * count]; - { - NSUInteger index = 0; - ABI46_0_0RCTFrameData *frameDataArray = (ABI46_0_0RCTFrameData *)framesData.mutableBytes; - for (ABI46_0_0RCTShadowView *shadowView in affectedShadowViews) { - ABI46_0_0ReactTags[index] = shadowView.ABI46_0_0ReactTag; - ABI46_0_0RCTLayoutMetrics layoutMetrics = shadowView.layoutMetrics; - frameDataArray[index++] = (ABI46_0_0RCTFrameData){ - layoutMetrics.frame, - layoutMetrics.layoutDirection, - shadowView.isNewView, - shadowView.superview.isNewView, - layoutMetrics.displayType}; - } - } - - for (ABI46_0_0RCTShadowView *shadowView in affectedShadowViews) { - // We have to do this after we build the parentsAreNew array. - shadowView.newView = NO; - - NSNumber *ABI46_0_0ReactTag = shadowView.ABI46_0_0ReactTag; - - if (shadowView.onLayout) { - CGRect frame = shadowView.layoutMetrics.frame; - shadowView.onLayout(@{ - @"layout" : @{ - @"x" : @(frame.origin.x), - @"y" : @(frame.origin.y), - @"width" : @(frame.size.width), - @"height" : @(frame.size.height), - }, - }); - } - - if (ABI46_0_0RCTIsABI46_0_0ReactRootView(ABI46_0_0ReactTag) && [shadowView isKindOfClass:[ABI46_0_0RCTRootShadowView class]]) { - CGSize contentSize = shadowView.layoutMetrics.frame.size; - - ABI46_0_0RCTExecuteOnMainQueue(^{ - NSMutableDictionary *viewRegistry = [self valueForKey:@"_viewRegistry"]; - UIView *view = viewRegistry[ABI46_0_0ReactTag]; - ABI46_0_0RCTAssert(view != nil, @"view (for ID %@) not found", ABI46_0_0ReactTag); - - ABI46_0_0RCTRootView *rootView = (ABI46_0_0RCTRootView *)[view superview]; - if ([rootView isKindOfClass:[ABI46_0_0RCTRootView class]]) { - rootView.intrinsicContentSize = contentSize; - } - }); - } - } - - // Perform layout (possibly animated) - return ^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - const ABI46_0_0RCTFrameData *frameDataArray = (const ABI46_0_0RCTFrameData *)framesData.bytes; - ABI46_0_0RCTLayoutAnimationGroup *layoutAnimationGroup = [uiManager valueForKey:@"_layoutAnimationGroup"]; - - __block NSUInteger completionsCalled = 0; - - NSInteger index = 0; - for (NSNumber *ABI46_0_0ReactTag in ABI46_0_0ReactTags) { - ABI46_0_0RCTFrameData frameData = frameDataArray[index++]; - - UIView *view = viewRegistry[ABI46_0_0ReactTag]; - CGRect frame = frameData.frame; - - UIUserInterfaceLayoutDirection layoutDirection = frameData.layoutDirection; - BOOL isNew = frameData.isNew; - ABI46_0_0RCTLayoutAnimation *updatingLayoutAnimation = isNew ? nil : layoutAnimationGroup.updatingLayoutAnimation; - BOOL shouldAnimateCreation = isNew && !frameData.parentIsNew; - ABI46_0_0RCTLayoutAnimation *creatingLayoutAnimation = - shouldAnimateCreation ? layoutAnimationGroup.creatingLayoutAnimation : nil; - BOOL isHidden = frameData.displayType == ABI46_0_0RCTDisplayTypeNone; - - void (^completion)(BOOL) = ^(BOOL finished) { - completionsCalled++; - if (layoutAnimationGroup.callback && completionsCalled == count) { - layoutAnimationGroup.callback(@[ @(finished) ]); - - // It's unsafe to call this callback more than once, so we nil it out here - // to make sure that doesn't happen. - layoutAnimationGroup.callback = nil; - } - }; - - if (view.ABI46_0_0ReactLayoutDirection != layoutDirection) { - view.ABI46_0_0ReactLayoutDirection = layoutDirection; - } - - if (view.isHidden != isHidden) { - view.hidden = isHidden; - } - - // Reanimated changes /start - ABI46_0_0REASnapshot *snapshotBefore; - if (ABI46_0_0reanimated::FeaturesConfig::isLayoutAnimationEnabled()) { - snapshotBefore = [[ABI46_0_0REASnapshot alloc] init:view]; - } - // Reanimated changes /end - - if (creatingLayoutAnimation) { - // Animate view creation - [view ABI46_0_0ReactSetFrame:frame]; - - CATransform3D finalTransform = view.layer.transform; - CGFloat finalOpacity = view.layer.opacity; - - NSString *property = creatingLayoutAnimation.property; - if ([property isEqualToString:@"scaleXY"]) { - view.layer.transform = CATransform3DMakeScale(0, 0, 0); - } else if ([property isEqualToString:@"scaleX"]) { - view.layer.transform = CATransform3DMakeScale(0, 1, 0); - } else if ([property isEqualToString:@"scaleY"]) { - view.layer.transform = CATransform3DMakeScale(1, 0, 0); - } else if ([property isEqualToString:@"opacity"]) { - view.layer.opacity = 0.0; - } else { - ABI46_0_0RCTLogError(@"Unsupported layout animation createConfig property %@", creatingLayoutAnimation.property); - } - - [creatingLayoutAnimation - performAnimations:^{ - if ([property isEqualToString:@"scaleX"] || [property isEqualToString:@"scaleY"] || - [property isEqualToString:@"scaleXY"]) { - view.layer.transform = finalTransform; - } else if ([property isEqualToString:@"opacity"]) { - view.layer.opacity = finalOpacity; - } - } - withCompletionBlock:completion]; - - } else if (updatingLayoutAnimation) { - // Animate view update - [updatingLayoutAnimation - performAnimations:^{ - [view ABI46_0_0ReactSetFrame:frame]; - } - withCompletionBlock:completion]; - - } else { - // Update without animation - [view ABI46_0_0ReactSetFrame:frame]; - completion(YES); - } - - // Reanimated changes /start - if (ABI46_0_0reanimated::FeaturesConfig::isLayoutAnimationEnabled()) { - if (isNew) { - ABI46_0_0REASnapshot *snapshot = [[ABI46_0_0REASnapshot alloc] init:view]; - [ABI46_0_0_animationsManager onViewCreate:view after:snapshot]; - } else { - ABI46_0_0REASnapshot *snapshotAfter = [[ABI46_0_0REASnapshot alloc] init:view]; - [ABI46_0_0_animationsManager onViewUpdate:view before:snapshotBefore after:snapshotAfter]; - } - } - } - - [ABI46_0_0_animationsManager removeLeftovers]; - // Clean up - // uiManager->_layoutAnimationGroup = nil; - [uiManager setValue:nil forKey:@"_layoutAnimationGroup"]; - // Reanimated changes /end - }; -} - -- (Class)class -{ - return [ABI46_0_0RCTUIManager class]; -} - -+ (Class)class -{ - return [ABI46_0_0RCTUIManager class]; -} - -- (void)setUp:(ABI46_0_0REAAnimationsManager *)animationsManager -{ - ABI46_0_0_animationsManager = animationsManager; - ABI46_0_0_toBeRemovedRegister = [[NSMutableDictionary> *> alloc] init]; - ABI46_0_0_parentMapper = [[NSMutableDictionary alloc] init]; -} - -- (void)unregisterView:(id)view -{ - NSNumber *tag = ABI46_0_0_parentMapper[view.ABI46_0_0ReactTag]; - if (tag == nil) { - return; - } - - [ABI46_0_0_toBeRemovedRegister[tag] removeObject:view]; - if (ABI46_0_0_toBeRemovedRegister[tag].count == 0) { - [ABI46_0_0_toBeRemovedRegister removeObjectForKey:tag]; - } - NSMutableDictionary> *viewRegistry = [self valueForKey:@"_viewRegistry"]; - [view.ABI46_0_0ReactSuperview removeABI46_0_0ReactSubview:view]; - id parentView = viewRegistry[tag]; - @try { - [parentView removeABI46_0_0ReactSubview:view]; - } @catch (id anException) { - } -#if __has_include() - if ([view isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - [parentView didUpdateABI46_0_0ReactSubviews]; - } -#endif - [viewRegistry removeObjectForKey:view.ABI46_0_0ReactTag]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.h deleted file mode 100644 index 8d56bd0ccecce0..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.h +++ /dev/null @@ -1,4 +0,0 @@ -#import - -@interface ABI46_0_0REAAlwaysNode : ABI46_0_0REANode -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.m deleted file mode 100644 index e3f96c379c96b4..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAAlwaysNode.m +++ /dev/null @@ -1,35 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import - -@implementation ABI46_0_0REAAlwaysNode { - NSNumber *_nodeToBeEvaluated; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _nodeToBeEvaluated = [ABI46_0_0RCTConvert NSNumber:config[@"what"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _nodeToBeEvaluated, @"Reanimated: First argument passed to always node is either of wrong type or is missing."); - } - return self; -} - -- (id)evaluate -{ - [[self.nodesManager findNodeByID:_nodeToBeEvaluated] value]; - return @(0); -} - -- (void)update -{ - [self value]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.h deleted file mode 100644 index 65d1a767762030..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REABezierNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.m deleted file mode 100644 index d0ac42d15997d7..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABezierNode.m +++ /dev/null @@ -1,103 +0,0 @@ -#import -#import -#import -#import -#import -#include - -#define EPS 1e-5 - -@implementation ABI46_0_0REABezierNode { - CGFloat ax, bx, cx, ay, by, cy; - NSNumber *_inputNodeID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _inputNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"input"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _inputNodeID, @"Reanimated: First argument passed to bezier node is either of wrong type or is missing."); - - CGFloat mX1 = [config[@"mX1"] doubleValue]; - CGFloat mY1 = [config[@"mY1"] doubleValue]; - CGFloat mX2 = [config[@"mX2"] doubleValue]; - CGFloat mY2 = [config[@"mY2"] doubleValue]; - - // Calculate the polynomial coefficients, implicit first and last control points are (0,0) and (1,1). - cx = 3.0 * mX1; - bx = 3.0 * (mX2 - mX1) - cx; - ax = 1.0 - cx - bx; - - cy = 3.0 * mY1; - by = 3.0 * (mY2 - mY1) - cy; - ay = 1.0 - cy - by; - } - return self; -} - -- (CGFloat)sampleCurveX:(CGFloat)t -{ - // `ax t^3 + bx t^2 + cx t' expanded using Horner's rule. - return ((ax * t + bx) * t + cx) * t; -} - -- (CGFloat)sampleCurveY:(CGFloat)t -{ - return ((ay * t + by) * t + cy) * t; -} - -- (CGFloat)sampleCurveDerivativeX:(CGFloat)t -{ - return (3.0 * ax * t + 2.0 * bx) * t + cx; -} - -- (CGFloat)solveCurveX:(CGFloat)x withEpsilon:(CGFloat)epsilon -{ - CGFloat t0, t1, t2, x2, d2; - NSUInteger i; - - // First try a few iterations of Newton's method -- normally very fast. - for (t2 = x, i = 0; i < 8; i++) { - x2 = [self sampleCurveX:t2] - x; - if (fabs(x2) < epsilon) - return t2; - d2 = [self sampleCurveDerivativeX:t2]; - if (fabs(d2) < 1e-6) - break; - t2 = t2 - x2 / d2; - } - - // Fall back to the bisection method for reliability. - t0 = 0.0; - t1 = 1.0; - t2 = x; - - if (t2 < t0) - return t0; - if (t2 > t1) - return t1; - - while (t0 < t1) { - x2 = [self sampleCurveX:t2]; - if (fabs(x2 - x) < epsilon) - return t2; - if (x > x2) - t0 = t2; - else - t1 = t2; - t2 = (t1 - t0) * .5 + t0; - } - - // Failure. - return t2; -} - -- (id)evaluate -{ - CGFloat x = [[[self.nodesManager findNodeByID:_inputNodeID] value] doubleValue]; - CGFloat y = [self sampleCurveY:[self solveCurveX:x withEpsilon:EPS]]; - return @(y); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.h deleted file mode 100644 index 541cd0189c27b2..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REABlockNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.m deleted file mode 100644 index 63d81faff4f1f4..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REABlockNode.m +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import - -@implementation ABI46_0_0REABlockNode { - NSArray *_block; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _block = config[@"block"]; - } - return self; -} - -- (id)evaluate -{ - id result; - for (NSNumber *inputID in _block) { - result = [[self.nodesManager findNodeByID:inputID] value]; - } - return result; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.h deleted file mode 100644 index 1eac0cb46b8b9e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.h +++ /dev/null @@ -1,6 +0,0 @@ - -#import - -@interface ABI46_0_0REACallFuncNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.m deleted file mode 100644 index 38be28a396382f..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACallFuncNode.m +++ /dev/null @@ -1,69 +0,0 @@ - - -#import -#import -#import -#import -#import - -@implementation ABI46_0_0REACallFuncNode { - NSNumber *_whatNodeID; - NSArray *_args; - NSArray *_params; - NSString *_prevCallID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _whatNodeID = config[@"what"]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _whatNodeID, @"Reanimated: First argument passed to callFunc node is either of wrong type or is missing."); - _args = config[@"args"]; - _params = config[@"params"]; - _prevCallID = NULL; - } - return self; -} - -- (void)beginContext -{ - // To ensure that functions can be called multiple times in the same animation frame - // (functions might have different parameters and might be called multiple times) - // we inform the current update context about where we are called from by setting the - // current call id - this will ensure that memoization is correct for function nodes. - _prevCallID = self.updateContext.callID; - self.updateContext.callID = - [NSString stringWithFormat:@"%@/%@", self.updateContext.callID, [self.nodeID stringValue]]; - - // A CallFuncNode has a reference to a function node which holds the node graph that should - // be updated. A Function node has a list of ParamNodes which are basically nodes that can - // reference other nodes. When we start a new function call we update the parameter nodes - // with the current arguments: - for (NSUInteger i = 0; i < _params.count; i++) { - NSNumber *paramID = [_params objectAtIndex:i]; - ABI46_0_0REAParamNode *param = (ABI46_0_0REAParamNode *)[self.nodesManager findNodeByID:paramID]; - [param beginContext:_args[i] prevCallID:_prevCallID]; - } -} - -- (void)endContext -{ - for (NSUInteger i = 0; i < _params.count; i++) { - NSNumber *paramID = [_params objectAtIndex:i]; - ABI46_0_0REAParamNode *param = (ABI46_0_0REAParamNode *)[self.nodesManager findNodeByID:paramID]; - [param endContext]; - } - self.updateContext.callID = _prevCallID; -} - -- (id)evaluate -{ - [self beginContext]; - ABI46_0_0REAFunctionNode *what = (ABI46_0_0REAFunctionNode *)[self.nodesManager findNodeByID:_whatNodeID]; - NSNumber *newValue = [what value]; - [self endContext]; - return newValue; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.h deleted file mode 100644 index 6464fb0360d935..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.h +++ /dev/null @@ -1,19 +0,0 @@ -#import - -@interface ABI46_0_0REAClockNode : ABI46_0_0REANode -@property (nonatomic, readonly) BOOL isRunning; -- (void)start; -- (void)stop; -@end - -@interface ABI46_0_0REAClockOpNode : ABI46_0_0REANode -@end - -@interface ABI46_0_0REAClockStartNode : ABI46_0_0REAClockOpNode -@end - -@interface ABI46_0_0REAClockStopNode : ABI46_0_0REAClockOpNode -@end - -@interface ABI46_0_0REAClockTestNode : ABI46_0_0REAClockOpNode -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.m deleted file mode 100644 index 58ed1fd37ebb0d..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAClockNodes.m +++ /dev/null @@ -1,118 +0,0 @@ -#import -#import -#import -#import -#import -#import - -@interface ABI46_0_0REAClockNode () - -@property (nonatomic) NSNumber *lastTimestampMs; - -@end - -@implementation ABI46_0_0REAClockNode - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _isRunning = NO; - } - return self; -} - -- (void)start -{ - if (_isRunning) - return; - _isRunning = YES; - - __block __weak void (^weak_animationClb)(CADisplayLink *displayLink); - void (^animationClb)(CADisplayLink *displayLink); - __weak ABI46_0_0REAClockNode *weakSelf = self; - - weak_animationClb = animationClb = ^(CADisplayLink *displayLink) { - if (!weakSelf.isRunning) - return; - [weakSelf markUpdated]; - [weakSelf.nodesManager postOnAnimation:weak_animationClb]; - }; - - [self.nodesManager postOnAnimation:animationClb]; -} - -- (void)stop -{ - _isRunning = false; -} - -- (id)evaluate -{ - return @(self.nodesManager.currentAnimationTimestamp * 1000.); -} - -@end - -@implementation ABI46_0_0REAClockOpNode { - NSNumber *_clockNodeID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _clockNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"clock"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _clockNodeID, @"Reanimated: First argument passed to clock node is either of wrong type or is missing."); - } - return self; -} - -- (ABI46_0_0REANode *)clockNode -{ - return (ABI46_0_0REANode *)[self.nodesManager findNodeByID:_clockNodeID]; -} - -@end - -@implementation ABI46_0_0REAClockStartNode - -- (id)evaluate -{ - ABI46_0_0REANode *node = [self clockNode]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - [(ABI46_0_0REAParamNode *)node start]; - } else { - [(ABI46_0_0REAClockNode *)node start]; - } - return @(0); -} - -@end - -@implementation ABI46_0_0REAClockStopNode - -- (id)evaluate -{ - ABI46_0_0REANode *node = [self clockNode]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - [(ABI46_0_0REAParamNode *)node stop]; - } else { - [(ABI46_0_0REAClockNode *)node stop]; - } - return @(0); -} - -@end - -@implementation ABI46_0_0REAClockTestNode - -- (id)evaluate -{ - ABI46_0_0REANode *node = [self clockNode]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - return @(((ABI46_0_0REAParamNode *)node).isRunning ? 1 : 0); - } - return @([(ABI46_0_0REAClockNode *)node isRunning] ? 1 : 0); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.h deleted file mode 100644 index fa316a43be1a8a..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REAConcatNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.m deleted file mode 100644 index 47a51928ee5ad8..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAConcatNode.m +++ /dev/null @@ -1,32 +0,0 @@ -#import -#import -#import - -@implementation ABI46_0_0REAConcatNode { - NSArray *_input; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _input = config[@"input"]; - } - return self; -} - -- (id)evaluate -{ - NSMutableString *result = [NSMutableString new]; - for (int i = 0; i < _input.count; i++) { - NSObject *val = [[self.nodesManager findNodeByID:_input[i]] value]; - if ([val isKindOfClass:[NSNumber class]]) { - [result appendString:[(NSNumber *)val stringValue]]; - } - if ([val isKindOfClass:[NSString class]]) { - [result appendString:val]; - } - } - return result; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.h deleted file mode 100644 index 7a25b04f5bc4d7..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REACondNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.m deleted file mode 100644 index 0fc23101cadd32..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REACondNode.m +++ /dev/null @@ -1,36 +0,0 @@ -#import -#import -#import -#import -#import - -@implementation ABI46_0_0REACondNode { - NSNumber *_condNodeID; - NSNumber *_ifBlockID; - NSNumber *_elseBlockID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _condNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"cond"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _condNodeID, @"Reanimated: First argument passed to cond node is either of wrong type or is missing."); - _ifBlockID = [ABI46_0_0RCTConvert NSNumber:config[@"ifBlock"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _ifBlockID, @"Reanimated: Second argument passed to cond node is either of wrong type or is missing."); - _elseBlockID = [ABI46_0_0RCTConvert NSNumber:config[@"elseBlock"]]; - } - return self; -} - -- (id)evaluate -{ - id cond = [[self.nodesManager findNodeByID:_condNodeID] value]; - if ([cond doubleValue]) { - return [[self.nodesManager findNodeByID:_ifBlockID] value]; - } - return _elseBlockID != nil ? [[self.nodesManager findNodeByID:_elseBlockID] value] : @(0); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.h deleted file mode 100644 index 36bc3c18826926..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0READebugNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.m deleted file mode 100644 index d95d6e5ebde3ab..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0READebugNode.m +++ /dev/null @@ -1,30 +0,0 @@ -#import -#import -#import -#import -#import - -@implementation ABI46_0_0READebugNode { - NSNumber *_valueNodeID; - NSString *_message; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _message = [ABI46_0_0RCTConvert NSString:config[@"message"]]; - _valueNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"value"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _valueNodeID, @"Reanimated: Second argument passed to debug node is either of wrong type or is missing."); - } - return self; -} - -- (id)evaluate -{ - id value = [[self.nodesManager findNodeByID:_valueNodeID] value]; - NSLog(@"%@ %@", _message, value); - return value; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.h deleted file mode 100644 index 639769f60da363..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import - -@interface ABI46_0_0REAEventNode : ABI46_0_0REANode - -- (void)processEvent:(id)event; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.m deleted file mode 100644 index 94e5e3a0587cb0..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAEventNode.m +++ /dev/null @@ -1,35 +0,0 @@ -#import -#import -#import - -@implementation ABI46_0_0REAEventNode { - NSArray *_argMapping; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _argMapping = config[@"argMapping"]; - } - return self; -} - -- (void)processEvent:(id)event -{ - NSArray *args = event.arguments; - // argMapping is an array of eventPaths, each even path ends with a target node ID - for (NSArray *eventPath in _argMapping) { - // Supported events args are in the following order: viewTag, eventName, eventData. - id value = args[2]; - for (NSUInteger i = 0; i < eventPath.count; i++) { - if (i < eventPath.count - 1) { - value = [value valueForKey:eventPath[i]]; - } else { - ABI46_0_0REAValueNode *node = (ABI46_0_0REAValueNode *)[self.nodesManager findNodeByID:eventPath[i]]; - [node setValue:value]; - } - } - } -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.h deleted file mode 100644 index 2b711bb3175337..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.h +++ /dev/null @@ -1,6 +0,0 @@ - -#import - -@interface ABI46_0_0REAFunctionNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.m deleted file mode 100644 index b83a30a77ffa5e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAFunctionNode.m +++ /dev/null @@ -1,24 +0,0 @@ - -#import -#import -#import - -@implementation ABI46_0_0REAFunctionNode { - NSNumber *_nodeToBeEvaluated; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _nodeToBeEvaluated = config[@"what"]; - } - return self; -} - -- (id)evaluate -{ - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:_nodeToBeEvaluated]; - return [node value]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.h deleted file mode 100644 index ade399a11ef34a..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REAJSCallNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.m deleted file mode 100644 index 99b86a8111b447..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAJSCallNode.m +++ /dev/null @@ -1,30 +0,0 @@ -#import -#import -#import - -@implementation ABI46_0_0REAJSCallNode { - NSArray *_input; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _input = config[@"input"]; - } - return self; -} - -- (id)evaluate -{ - NSMutableArray *args = [NSMutableArray arrayWithCapacity:_input.count]; - for (NSUInteger i = 0; i < _input.count; i++) { - args[i] = [[self.nodesManager findNodeByID:_input[i]] value]; - } - - [self.nodesManager.reanimatedModule sendEventWithName:@"onReanimatedCall" - body:@{@"id" : self.nodeID, @"args" : args}]; - - return @(0); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.h deleted file mode 100644 index 95ff626a44c2ee..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.h +++ /dev/null @@ -1,40 +0,0 @@ -#import -#import - -@class ABI46_0_0REANodesManager; - -typedef NSNumber *ABI46_0_0REANodeID; - -@protocol ABI46_0_0REAFinalNode - -- (void)update; - -@end - -@interface ABI46_0_0REAUpdateContext : NSObject -@property (nonatomic) NSString *callID; -@end - -@interface ABI46_0_0REANode : NSObject - -+ (void)runPropUpdates:(nonnull ABI46_0_0REAUpdateContext *)context; - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, weak, nullable) ABI46_0_0REANodesManager *nodesManager; -@property (nonatomic, nullable) ABI46_0_0REAUpdateContext *updateContext; -@property (nonatomic, readonly, nonnull) ABI46_0_0REANodeID nodeID; - -- (_Nullable id)evaluate; -- (_Nullable id)value; -- (void)markUpdated; - -- (void)addChild:(ABI46_0_0REANode *)child NS_REQUIRES_SUPER; -- (void)removeChild:(ABI46_0_0REANode *)child NS_REQUIRES_SUPER; - -- (void)dangerouslyRescheduleEvaluate; -- (void)forceUpdateMemoizedValue:(id)value; - -- (void)onDrop; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.m deleted file mode 100644 index 431361ea5d25e3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REANode.m +++ /dev/null @@ -1,155 +0,0 @@ -#import -#import - -#import - -@interface ABI46_0_0REAUpdateContext () - -@property (nonatomic, nonnull) NSMutableArray *updatedNodes; -@property (nonatomic) NSNumber *loopID; - -@end - -@implementation ABI46_0_0REAUpdateContext - -- (instancetype)init -{ - if ((self = [super init])) { - _loopID = [[NSNumber alloc] initWithInt:1]; - _updatedNodes = [NSMutableArray new]; - _callID = @""; - } - return self; -} - -@end - -@interface ABI46_0_0REANode () - -@property (nonatomic) NSMutableDictionary *lastLoopID; -@property (nonatomic) NSMutableDictionary *memoizedValue; -@property (nonatomic, nullable) NSMutableArray *childNodes; - -@end - -@implementation ABI46_0_0REANode - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super init])) { - _nodeID = nodeID; - _lastLoopID = [NSMutableDictionary dictionary]; - _memoizedValue = [NSMutableDictionary dictionary]; - _lastLoopID[@""] = 0; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(-(instancetype)init) - -- (void)dangerouslyRescheduleEvaluate -{ - _lastLoopID[self.updateContext.callID] = 0; - [self markUpdated]; -} - -- (void)forceUpdateMemoizedValue:(id)value -{ - _memoizedValue[self.updateContext.callID] = value; - [self markUpdated]; -} - -- (id)evaluate -{ - return 0; -} - -- (id)value -{ - if (![_lastLoopID objectForKey:_updateContext.callID] || - [[_lastLoopID objectForKey:_updateContext.callID] longValue] < [_updateContext.loopID longValue]) { - [_lastLoopID setObject:_updateContext.loopID forKey:_updateContext.callID]; - id val = [self evaluate]; - [_memoizedValue setObject:(val == nil ? [NSNull null] : val) forKey:_updateContext.callID]; - return val; - } - id memoizedValue = [_memoizedValue objectForKey:_updateContext.callID]; - return [memoizedValue isKindOfClass:[NSNull class]] ? nil : memoizedValue; -} - -- (void)addChild:(ABI46_0_0REANode *)child -{ - if (!_childNodes) { - _childNodes = [NSMutableArray new]; - } - if (child) { - [_childNodes addObject:child]; - [child dangerouslyRescheduleEvaluate]; - } -} - -- (void)removeChild:(ABI46_0_0REANode *)child -{ - if (child) { - [_childNodes removeObject:child]; - } -} - -- (void)markUpdated -{ - [_updateContext.updatedNodes addObject:self]; - [self.nodesManager postRunUpdatesAfterAnimation]; -} - -+ (NSMutableArray *)updatedNodes -{ - static NSMutableArray *updatedNodes; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - updatedNodes = [NSMutableArray new]; - }); - return updatedNodes; -} - -+ (void)findAndUpdateNodes:(nonnull ABI46_0_0REANode *)node - withVisitedSet:(NSMutableSet *)visitedNodes - withFinalNodes:(NSMutableArray> *)finalNodes -{ - if ([visitedNodes containsObject:node]) { - return; - } else { - [visitedNodes addObject:node]; - } - for (ABI46_0_0REANode *child in node.childNodes) { - [self findAndUpdateNodes:child withVisitedSet:visitedNodes withFinalNodes:finalNodes]; - } - if ([node conformsToProtocol:@protocol(ABI46_0_0REAFinalNode)]) { - [finalNodes addObject:(id)node]; - } -} - -+ (void)runPropUpdates:(ABI46_0_0REAUpdateContext *)context -{ - NSMutableSet *visitedNodes = [NSMutableSet new]; - NSMutableArray> *finalNodes = [NSMutableArray new]; - for (NSUInteger i = 0; i < context.updatedNodes.count; i++) { - [self findAndUpdateNodes:context.updatedNodes[i] withVisitedSet:visitedNodes withFinalNodes:finalNodes]; - if (i == context.updatedNodes.count - 1) { - while (finalNodes.count > 0) { - // NSMutableArray used for stack implementation - [[finalNodes lastObject] update]; - [finalNodes removeLastObject]; - } - } - } - - [context.updatedNodes removeAllObjects]; - context.loopID = [[NSNumber alloc] initWithLong:context.loopID.longValue + 1]; -} - -- (void)onDrop -{ - // noop -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.h deleted file mode 100644 index 262d8e123da60e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REAOperatorNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.m deleted file mode 100644 index bab083f065d38b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAOperatorNode.m +++ /dev/null @@ -1,114 +0,0 @@ -#import -#import -#include - -typedef id (^ABI46_0_0REAOperatorBlock)(NSArray *inputNodes); - -#define ABI46_0_0REA_REDUCE(OP) \ - ^(NSArray * inputNodes) { \ - double acc = [[inputNodes[0] value] doubleValue]; \ - for (NSUInteger i = 1; i < inputNodes.count; i++) { \ - double a = acc, b = [[inputNodes[i] value] doubleValue]; \ - acc = OP; \ - } \ - return @(acc); \ - } - -#define ABI46_0_0REA_SINGLE(OP) \ - ^(NSArray * inputNodes) { \ - double a = [[inputNodes[0] value] doubleValue]; \ - return @(OP); \ - } - -#define ABI46_0_0REA_INFIX(OP) \ - ^(NSArray * inputNodes) { \ - double a = [[inputNodes[0] value] doubleValue]; \ - double b = [[inputNodes[1] value] doubleValue]; \ - return @(OP); \ - } - -@implementation ABI46_0_0REAOperatorNode { - NSArray *_input; - NSMutableArray *_inputNodes; - ABI46_0_0REAOperatorBlock _op; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - static NSDictionary *OPS; - static dispatch_once_t opsToken; - dispatch_once(&opsToken, ^{ - OPS = @{// arithmetic - @"add" : ABI46_0_0REA_REDUCE(a + b), - @"sub" : ABI46_0_0REA_REDUCE(a - b), - @"multiply" : ABI46_0_0REA_REDUCE(a * b), - @"divide" : ABI46_0_0REA_REDUCE(a / b), - @"pow" : ABI46_0_0REA_REDUCE(pow(a, b)), - @"modulo" : ABI46_0_0REA_REDUCE(fmod(fmod(a, b) + b, b)), - @"sqrt" : ABI46_0_0REA_SINGLE(sqrt(a)), - @"log" : ABI46_0_0REA_SINGLE(log(a)), - @"sin" : ABI46_0_0REA_SINGLE(sin(a)), - @"cos" : ABI46_0_0REA_SINGLE(cos(a)), - @"tan" : ABI46_0_0REA_SINGLE(tan(a)), - @"acos" : ABI46_0_0REA_SINGLE(acos(a)), - @"asin" : ABI46_0_0REA_SINGLE(asin(a)), - @"atan" : ABI46_0_0REA_SINGLE(atan(a)), - @"exp" : ABI46_0_0REA_SINGLE(exp(a)), - @"round" : ABI46_0_0REA_SINGLE(round(a)), - @"abs" : ABI46_0_0REA_SINGLE(fabs(a)), - @"ceil" : ABI46_0_0REA_SINGLE(ceil(a)), - @"floor" : ABI46_0_0REA_SINGLE(floor(a)), - @"max" : ABI46_0_0REA_REDUCE(MAX(a, b)), - @"min" : ABI46_0_0REA_REDUCE(MIN(a, b)), - - // logical - @"and" : ^(NSArray *inputNodes){ - BOOL res = [[inputNodes[0] value] doubleValue]; - for (NSUInteger i = 1; i < inputNodes.count && res; i++) { - res = res && [[inputNodes[i] value] doubleValue]; - } - return res ? @(1.) : @(0.); - }, - @"or": ^(NSArray *inputNodes) { - BOOL res = [[inputNodes[0] value] doubleValue]; - for (NSUInteger i = 1; i < inputNodes.count && !res; i++) { - res = res || [[inputNodes[i] value] doubleValue]; - } - return res ? @(1.) : @(0.); - }, - @"not": ABI46_0_0REA_SINGLE(!a), - @"defined": ^(NSArray *inputNodes) { - id val = [inputNodes[0] value]; - id res = @(val != nil && !([val isKindOfClass:[NSNumber class]] && isnan([val doubleValue]))); - return res; - }, - - // comparing - @"lessThan": ABI46_0_0REA_INFIX(a < b), - @"eq": ABI46_0_0REA_INFIX(a == b), - @"greaterThan": ABI46_0_0REA_INFIX(a > b), - @"lessOrEq": ABI46_0_0REA_INFIX(a <= b), - @"greaterOrEq": ABI46_0_0REA_INFIX(a >= b), - @"neq": ABI46_0_0REA_INFIX(a != b), -}; -}); -if ((self = [super initWithID:nodeID config:config])) { - _input = config[@"input"]; - _inputNodes = [NSMutableArray arrayWithCapacity:_input.count]; - _op = OPS[config[@"op"]]; - if (!_op) { - ABI46_0_0RCTLogError(@"Operator '%@' not found", config[@"op"]); - } -} -return self; -} - -- (id)evaluate -{ - for (NSUInteger i = 0; i < _input.count; i++) { - _inputNodes[i] = [self.nodesManager findNodeByID:_input[i]]; - } - return _op(_inputNodes); -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.h deleted file mode 100644 index 05e6cb709236ed..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -@interface ABI46_0_0REAParamNode : ABI46_0_0REAValueNode - -- (void)beginContext:(NSNumber *)ref prevCallID:(NSNumber *)prevCallID; -- (void)endContext; -- (void)start; -- (void)stop; -- (BOOL)isRunning; -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.m deleted file mode 100644 index 97c58375ed348b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAParamNode.m +++ /dev/null @@ -1,79 +0,0 @@ -#import -#import -#import -#import - -@implementation ABI46_0_0REAParamNode { - NSMutableArray *_argstack; - NSString *_prevCallID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _argstack = [NSMutableArray arrayWithCapacity:0]; - } - return self; -} - -- (void)setValue:(NSNumber *)value -{ - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:[_argstack lastObject]]; - NSString *callID = self.updateContext.callID; - self.updateContext.callID = _prevCallID; - [(ABI46_0_0REAValueNode *)node setValue:value]; - self.updateContext.callID = callID; - [self forceUpdateMemoizedValue:value]; -} - -- (void)beginContext:(NSNumber *)ref prevCallID:(NSString *)prevCallID -{ - _prevCallID = prevCallID; - [_argstack addObject:ref]; -} - -- (void)endContext -{ - [_argstack removeLastObject]; -} - -- (id)evaluate -{ - NSString *callID = self.updateContext.callID; - self.updateContext.callID = _prevCallID; - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:[_argstack lastObject]]; - id val = [node value]; - self.updateContext.callID = callID; - return val; -} - -- (void)start -{ - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:[_argstack lastObject]]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - [(ABI46_0_0REAParamNode *)node start]; - } else { - [(ABI46_0_0REAClockNode *)node start]; - } -} - -- (void)stop -{ - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:[_argstack lastObject]]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - [(ABI46_0_0REAParamNode *)node stop]; - } else { - [(ABI46_0_0REAClockNode *)node stop]; - } -} - -- (BOOL)isRunning -{ - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:[_argstack lastObject]]; - if ([node isKindOfClass:[ABI46_0_0REAParamNode class]]) { - return [(ABI46_0_0REAParamNode *)node isRunning]; - } - return [(ABI46_0_0REAClockNode *)node isRunning]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.h deleted file mode 100644 index 5f1d9131241558..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -@interface ABI46_0_0REAPropsNode : ABI46_0_0REANode - -- (void)connectToView:(NSNumber *_Nonnull)viewTag viewName:(NSString *_Nonnull)viewName; - -- (void)disconnectFromView:(NSNumber *_Nonnull)viewTag; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.m deleted file mode 100644 index 41c952603a9451..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAPropsNode.m +++ /dev/null @@ -1,96 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import - -@implementation ABI46_0_0REAPropsNode { - NSNumber *_connectedViewTag; - NSString *_connectedViewName; - NSMutableDictionary *_propsConfig; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if (self = [super initWithID:nodeID config:config]) { - _propsConfig = config[@"props"]; - } - return self; -} - -- (void)connectToView:(NSNumber *)viewTag viewName:(NSString *)viewName -{ - _connectedViewTag = viewTag; - _connectedViewName = viewName; - [self dangerouslyRescheduleEvaluate]; -} - -- (void)disconnectFromView:(NSNumber *)viewTag -{ - _connectedViewTag = nil; - _connectedViewName = nil; -} - -- (id)evaluate -{ - NSMutableDictionary *uiProps = [NSMutableDictionary new]; - NSMutableDictionary *nativeProps = [NSMutableDictionary new]; - NSMutableDictionary *jsProps = [NSMutableDictionary new]; - - void (^addBlock)(NSString *key, id obj, BOOL *stop) = ^(NSString *key, id obj, BOOL *stop) { - if ([self.nodesManager.uiProps containsObject:key]) { - uiProps[key] = obj; - } else if ([self.nodesManager.nativeProps containsObject:key]) { - nativeProps[key] = obj; - } else { - jsProps[key] = obj; - } - }; - - for (NSString *prop in _propsConfig) { - ABI46_0_0REANode *propNode = [self.nodesManager findNodeByID:_propsConfig[prop]]; - - if ([propNode isKindOfClass:[ABI46_0_0REAStyleNode class]]) { - [[propNode value] enumerateKeysAndObjectsUsingBlock:addBlock]; - } else { - addBlock(prop, [propNode value], nil); - } - } - - if (_connectedViewTag != nil) { - if (uiProps.count > 0) { - [self.nodesManager.uiManager synchronouslyUpdateViewOnUIThread:_connectedViewTag - viewName:_connectedViewName - props:uiProps]; - } - if (nativeProps.count > 0) { - [self.nodesManager enqueueUpdateViewOnNativeThread:_connectedViewTag - viewName:_connectedViewName - nativeProps:nativeProps - trySynchronously:NO]; - } - if (jsProps.count > 0) { - [self.nodesManager.reanimatedModule sendEventWithName:@"onReanimatedPropsChange" - body:@{@"viewTag" : _connectedViewTag, @"props" : jsProps}]; - } - } - - return @(0); -} - -- (void)update -{ - // Since we are updating nodes after detaching them from views there is a time where it's - // possible that the view was disconnected and still receive an update, this is normal and we can - // simply skip that update. - if (!_connectedViewTag) { - return; - } - - // triger for side effect - [self value]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.h deleted file mode 100644 index e28f6231821435..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REASetNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.m deleted file mode 100644 index e3be1a93b64584..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REASetNode.m +++ /dev/null @@ -1,34 +0,0 @@ -#import -#import -#import -#import -#import -#import - -@implementation ABI46_0_0REASetNode { - NSNumber *_whatNodeID; - NSNumber *_valueNodeID; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _whatNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"what"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _whatNodeID, @"Reanimated: First argument passed to set node is either of wrong type or is missing."); - _valueNodeID = [ABI46_0_0RCTConvert NSNumber:config[@"value"]]; - ABI46_0_0REA_LOG_ERROR_IF_NIL( - _valueNodeID, @"Reanimated: Second argument passed to set node is either of wrong type or is missing."); - } - return self; -} - -- (id)evaluate -{ - NSNumber *newValue = [[self.nodesManager findNodeByID:_valueNodeID] value]; - ABI46_0_0REAValueNode *what = (ABI46_0_0REAValueNode *)[self.nodesManager findNodeByID:_whatNodeID]; - [what setValue:newValue]; - return newValue; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.h deleted file mode 100644 index 27ec9b641c1e8d..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REAStyleNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.m deleted file mode 100644 index c7f113006f1476..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAStyleNode.m +++ /dev/null @@ -1,27 +0,0 @@ -#import -#import - -@implementation ABI46_0_0REAStyleNode { - NSMutableDictionary *_styleConfig; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config; -{ - if ((self = [super initWithID:nodeID config:config])) { - _styleConfig = config[@"style"]; - } - return self; -} - -- (id)evaluate -{ - NSMutableDictionary *styles = [NSMutableDictionary new]; - for (NSString *prop in _styleConfig) { - ABI46_0_0REANode *propNode = [self.nodesManager findNodeByID:_styleConfig[prop]]; - styles[prop] = [propNode value]; - } - - return styles; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.h deleted file mode 100644 index 92f742ac35eea4..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0REATransformNode : ABI46_0_0REANode - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.m deleted file mode 100644 index 32878cc45b53a2..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REATransformNode.m +++ /dev/null @@ -1,36 +0,0 @@ -#import -#import -#import - -@implementation ABI46_0_0REATransformNode { - NSArray *_transformConfigs; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if ((self = [super initWithID:nodeID config:config])) { - _transformConfigs = config[@"transform"]; - } - return self; -} - -- (id)evaluate -{ - NSMutableArray *transform = [NSMutableArray arrayWithCapacity:_transformConfigs.count]; - for (NSDictionary *transformConfig in _transformConfigs) { - NSString *property = transformConfig[@"property"]; - ABI46_0_0REANodeID nodeID = [ABI46_0_0RCTConvert NSNumber:transformConfig[@"nodeID"]]; - NSNumber *value; - if (nodeID) { - ABI46_0_0REANode *node = [self.nodesManager findNodeByID:nodeID]; - value = [node value]; - } else { - value = transformConfig[@"value"]; - } - [transform addObject:@{property : value}]; - } - - return transform; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.h b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.h deleted file mode 100644 index 59ab074bfa74e6..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -@class ABI46_0_0REAValueNode; - -@interface ABI46_0_0REAValueNode : ABI46_0_0REANode - -- (void)setValue:(NSNumber *)value; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.m b/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.m deleted file mode 100644 index d8f277dbc98647..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Nodes/ABI46_0_0REAValueNode.m +++ /dev/null @@ -1,26 +0,0 @@ -#import - -@implementation ABI46_0_0REAValueNode { - NSNumber *_value; -} - -- (instancetype)initWithID:(ABI46_0_0REANodeID)nodeID config:(NSDictionary *)config -{ - if (self = [super initWithID:nodeID config:config]) { - _value = config[@"value"]; - } - return self; -} - -- (void)setValue:(NSNumber *)value -{ - _value = value; - [self forceUpdateMemoizedValue:value]; -} - -- (id)evaluate -{ - return _value; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.h deleted file mode 100644 index 4780a1d88c99bd..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.h +++ /dev/null @@ -1,11 +0,0 @@ -#import -#import - -@interface ABI46_0_0RCTConvert (ABI46_0_0REATransition) - -+ (ABI46_0_0REATransitionType)ABI46_0_0REATransitionType:(id)json; -+ (ABI46_0_0REATransitionAnimationType)ABI46_0_0REATransitionAnimationType:(id)json; -+ (ABI46_0_0REATransitionInterpolationType)ABI46_0_0REATransitionInterpolationType:(id)json; -+ (ABI46_0_0REATransitionPropagationType)ABI46_0_0REATransitionPropagationType:(id)json; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.m deleted file mode 100644 index 13e67a7a381ac5..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0RCTConvert+REATransition.m +++ /dev/null @@ -1,53 +0,0 @@ -#import - -@implementation ABI46_0_0RCTConvert (ABI46_0_0REATransition) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0REATransitionType, - (@{ - @"none" : @(ABI46_0_0REATransitionTypeNone), - @"group" : @(ABI46_0_0REATransitionTypeGroup), - @"in" : @(ABI46_0_0REATransitionTypeIn), - @"out" : @(ABI46_0_0REATransitionTypeOut), - @"change" : @(ABI46_0_0REATransitionTypeChange), - }), - ABI46_0_0REATransitionTypeNone, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0REATransitionAnimationType, - (@{ - @"none" : @(ABI46_0_0REATransitionAnimationTypeNone), - @"fade" : @(ABI46_0_0REATransitionAnimationTypeFade), - @"scale" : @(ABI46_0_0REATransitionAnimationTypeScale), - @"slide-top" : @(ABI46_0_0REATransitionAnimationTypeSlideTop), - @"slide-bottom" : @(ABI46_0_0REATransitionAnimationTypeSlideBottom), - @"slide-right" : @(ABI46_0_0REATransitionAnimationTypeSlideRight), - @"slide-left" : @(ABI46_0_0REATransitionAnimationTypeSlideLeft) - }), - ABI46_0_0REATransitionAnimationTypeNone, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0REATransitionInterpolationType, - (@{ - @"linear" : @(ABI46_0_0REATransitionInterpolationLinear), - @"easeIn" : @(ABI46_0_0REATransitionInterpolationEaseIn), - @"easeOut" : @(ABI46_0_0REATransitionInterpolationEaseOut), - @"easeInOut" : @(ABI46_0_0REATransitionInterpolationEaseInOut), - }), - ABI46_0_0REATransitionInterpolationLinear, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0REATransitionPropagationType, - (@{ - @"none" : @(ABI46_0_0REATransitionPropagationNone), - @"top" : @(ABI46_0_0REATransitionPropagationTop), - @"bottom" : @(ABI46_0_0REATransitionPropagationBottom), - @"left" : @(ABI46_0_0REATransitionPropagationLeft), - @"right" : @(ABI46_0_0REATransitionPropagationRight) - }), - ABI46_0_0REATransitionPropagationNone, - integerValue) -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.h deleted file mode 100644 index 0c93856e22dbc8..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.h +++ /dev/null @@ -1,26 +0,0 @@ -#import - -@interface ABI46_0_0REATransitionGroup : ABI46_0_0REATransition -@property (nonatomic) BOOL sequence; -@property (nonatomic) NSArray *transitions; -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAVisibilityTransition : ABI46_0_0REATransition -@property (nonatomic) ABI46_0_0REATransitionAnimationType animationType; -- (ABI46_0_0REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent; -- (ABI46_0_0REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent; -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAInTransition : ABI46_0_0REAVisibilityTransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAOutTransition : ABI46_0_0REAVisibilityTransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAChangeTransition : ABI46_0_0REATransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.m deleted file mode 100644 index 78b755f117e382..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REAAllTransitions.m +++ /dev/null @@ -1,296 +0,0 @@ -#import -#import -#import - -@interface ABI46_0_0REASnapshotRemover : NSObject -@end - -@implementation ABI46_0_0REASnapshotRemover { - UIView *_view; -} - -- (instancetype)initWithView:(UIView *)view; -{ - self = [super init]; - if (self) { - _view = view; - } - return self; -} - -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag -{ - [_view removeFromSuperview]; -} - -@end - -@implementation ABI46_0_0REATransitionGroup - -- (instancetype)initWithConfig:(NSDictionary *)config -{ - if (self = [super initWithConfig:config]) { - _sequence = [ABI46_0_0RCTConvert BOOL:config[@"sequence"]]; - NSArray *transitions = [ABI46_0_0RCTConvert NSArray:config[@"transitions"]]; - NSMutableArray *inflated = [NSMutableArray new]; - for (NSDictionary *transitionConfig in transitions) { - [inflated addObject:[ABI46_0_0REATransition inflate:transitionConfig]]; - inflated.lastObject.parent = self; - } - _transitions = inflated; - } - return self; -} - -- (instancetype)init -{ - if (self = [super init]) { - _transitions = [NSMutableArray new]; - } - return self; -} - -- (NSArray *) - animationsForTransitioning:(NSMutableDictionary *)startValues - endValues:(NSMutableDictionary *)endValues - forRoot:(UIView *)root -{ - CFTimeInterval delay = self.delay; - NSMutableArray *animations = [NSMutableArray new]; - for (ABI46_0_0REATransition *transition in _transitions) { - NSArray *subanims = [transition animationsForTransitioning:startValues endValues:endValues forRoot:root]; - CFTimeInterval finishTime = CACurrentMediaTime(); - for (ABI46_0_0REATransitionAnimation *anim in subanims) { - [anim delayBy:delay]; - finishTime = MAX(finishTime, anim.finishTime); - } - [animations addObjectsFromArray:subanims]; - if (_sequence) { - delay = finishTime - CACurrentMediaTime(); - } - } - return animations; -} - -@end - -@implementation ABI46_0_0REAVisibilityTransition - -- (instancetype)initWithConfig:(NSDictionary *)config -{ - if (self = [super initWithConfig:config]) { - _animationType = [ABI46_0_0RCTConvert ABI46_0_0REATransitionAnimationType:config[@"animation"]]; - } - return self; -} - -- (ABI46_0_0REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent forRoot:(UIView *)root -{ - return nil; -} - -- (ABI46_0_0REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent forRoot:(UIView *)root -{ - return nil; -} - -- (ABI46_0_0REATransitionAnimation *)animationForTransitioning:(ABI46_0_0REATransitionValues *)startValues - endValues:(ABI46_0_0REATransitionValues *)endValues - forRoot:(UIView *)root -{ - BOOL isViewAppearing = (startValues == nil); - if (isViewAppearing && !IS_LAYOUT_ONLY(endValues.view)) { - NSNumber *parentKey = endValues.reactParent.ABI46_0_0ReactTag; - ABI46_0_0REATransitionValues *parentStartValues = [self findStartValuesForKey:parentKey]; - ABI46_0_0REATransitionValues *parentEndValues = [self findEndValuesForKey:parentKey]; - BOOL isParentAppearing = (parentStartValues == nil && parentEndValues != nil); - if (!isParentAppearing) { - return [self appearView:endValues.view inParent:endValues.parent forRoot:root]; - } - } - - if (endValues == nil && !IS_LAYOUT_ONLY(startValues.view) && startValues.reactParent.window != nil) { - startValues.view.center = startValues.centerInReactParent; - return [self disappearView:startValues.view fromParent:startValues.reactParent forRoot:root]; - } - return nil; -} - -@end - -@implementation ABI46_0_0REAInTransition -- (instancetype)initWithConfig:(NSDictionary *)config -{ - if (self = [super initWithConfig:config]) { - } - return self; -} - -- (ABI46_0_0REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent forRoot:(UIView *)root -{ - CABasicAnimation *animation; - switch (self.animationType) { - case ABI46_0_0REATransitionAnimationTypeNone: - return nil; - case ABI46_0_0REATransitionAnimationTypeFade: { - CGFloat finalOpacity = view.layer.opacity; - animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; - animation.fromValue = @(0.0f); - animation.toValue = @(finalOpacity); - break; - } - case ABI46_0_0REATransitionAnimationTypeScale: { - CATransform3D finalTransform = view.layer.transform; - animation = [CABasicAnimation animationWithKeyPath:@"transform"]; - animation.fromValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.0, 0.0, 0)]; - animation.toValue = [NSValue valueWithCATransform3D:finalTransform]; - break; - } - case ABI46_0_0REATransitionAnimationTypeSlideTop: - case ABI46_0_0REATransitionAnimationTypeSlideBottom: - case ABI46_0_0REATransitionAnimationTypeSlideLeft: - case ABI46_0_0REATransitionAnimationTypeSlideRight: { - CGPoint finalPosition = view.layer.position; - CGPoint startPosition = finalPosition; - switch (self.animationType) { - case ABI46_0_0REATransitionAnimationTypeSlideTop: - startPosition.y -= root.frame.size.height; - break; - case ABI46_0_0REATransitionAnimationTypeSlideBottom: - startPosition.y += root.frame.size.height; - break; - case ABI46_0_0REATransitionAnimationTypeSlideLeft: - startPosition.x -= root.frame.size.width; - break; - case ABI46_0_0REATransitionAnimationTypeSlideRight: - startPosition.x += root.frame.size.width; - break; - } - animation = [CABasicAnimation animationWithKeyPath:@"position"]; - animation.fromValue = @(startPosition); - animation.toValue = @(finalPosition); - break; - } - } - animation.fillMode = kCAFillModeBackwards; - - return [ABI46_0_0REATransitionAnimation transitionWithAnimation:animation layer:view.layer andKeyPath:animation.keyPath]; -} -@end - -@implementation ABI46_0_0REAOutTransition -- (instancetype)initWithConfig:(NSDictionary *)config -{ - if (self = [super initWithConfig:config]) { - } - return self; -} - -- (ABI46_0_0REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent forRoot:(UIView *)root -{ - if (self.animationType == ABI46_0_0REATransitionAnimationTypeNone) { - return nil; - } - // Add view back to parent temporarily in order to take snapshot - [parent addSubview:view]; - UIView *snapshotView = [view snapshotViewAfterScreenUpdates:NO]; - [view removeFromSuperview]; - snapshotView.frame = view.frame; - [parent addSubview:snapshotView]; - CALayer *snapshot = snapshotView.layer; - - CABasicAnimation *animation; - switch (self.animationType) { - case ABI46_0_0REATransitionAnimationTypeFade: { - CGFloat fromValue = snapshot.opacity; - snapshot.opacity = 0.0f; - animation = [CABasicAnimation animationWithKeyPath:@"opacity"]; - animation.fromValue = @(fromValue); - animation.toValue = @(0.0f); - break; - } - case ABI46_0_0REATransitionAnimationTypeScale: { - CATransform3D fromValue = snapshot.transform; - snapshot.transform = CATransform3DMakeScale(0.001, 0.001, 0.001); - animation = [CABasicAnimation animationWithKeyPath:@"transform"]; - animation.fromValue = [NSValue valueWithCATransform3D:fromValue]; - animation.toValue = [NSValue valueWithCATransform3D:CATransform3DMakeScale(0.001, 0.001, 0.001)]; - break; - } - case ABI46_0_0REATransitionAnimationTypeSlideTop: - case ABI46_0_0REATransitionAnimationTypeSlideBottom: - case ABI46_0_0REATransitionAnimationTypeSlideLeft: - case ABI46_0_0REATransitionAnimationTypeSlideRight: { - CGPoint startPosition = snapshot.position; - CGPoint finalPosition = startPosition; - switch (self.animationType) { - case ABI46_0_0REATransitionAnimationTypeSlideTop: - finalPosition.y -= root.frame.size.height; - break; - case ABI46_0_0REATransitionAnimationTypeSlideBottom: - finalPosition.y += root.frame.size.height; - break; - case ABI46_0_0REATransitionAnimationTypeSlideLeft: - finalPosition.x -= root.frame.size.width; - break; - case ABI46_0_0REATransitionAnimationTypeSlideRight: - finalPosition.x += root.frame.size.width; - break; - } - snapshot.position = finalPosition; - animation = [CABasicAnimation animationWithKeyPath:@"position"]; - animation.fromValue = @(startPosition); - animation.toValue = @(finalPosition); - break; - } - } - animation.fillMode = kCAFillModeBackwards; - animation.delegate = [[ABI46_0_0REASnapshotRemover alloc] initWithView:snapshotView]; - - return [ABI46_0_0REATransitionAnimation transitionWithAnimation:animation layer:snapshot andKeyPath:animation.keyPath]; -} -@end - -@implementation ABI46_0_0REAChangeTransition - -- (ABI46_0_0REATransitionAnimation *)animationForTransitioning:(ABI46_0_0REATransitionValues *)startValues - endValues:(ABI46_0_0REATransitionValues *)endValues - forRoot:(UIView *)root -{ - if (startValues == nil || endValues == nil || endValues.view.window == nil) { - return nil; - } - BOOL animatePosition = !CGPointEqualToPoint(startValues.center, endValues.center); - BOOL animateBounds = !CGRectEqualToRect(startValues.bounds, endValues.bounds); - - if (!animatePosition && !animateBounds) { - return nil; - } - - CALayer *layer = endValues.view.layer; - - CAAnimationGroup *group = [CAAnimationGroup animation]; - group.fillMode = kCAFillModeBackwards; - - NSMutableArray *animations = [NSMutableArray new]; - - if (animatePosition) { - CGPoint fromValue = layer.presentationLayer.position; - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"]; - animation.fromValue = [NSValue valueWithCGPoint:fromValue]; - animation.toValue = [NSValue valueWithCGPoint:endValues.center]; - [animations addObject:animation]; - } - - if (animateBounds) { - CGRect fromValue = layer.presentationLayer.bounds; - CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"bounds"]; - animation.fromValue = [NSValue valueWithCGRect:fromValue]; - animation.toValue = [NSValue valueWithCGRect:endValues.bounds]; - [animations addObject:animation]; - } - - group.animations = animations; - return [ABI46_0_0REATransitionAnimation transitionWithAnimation:group layer:layer andKeyPath:nil]; -} -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.h deleted file mode 100644 index 010893a35e2f50..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.h +++ /dev/null @@ -1,64 +0,0 @@ -#import -#import -#import -#import -#import - -// TODO: fix below implementation -#define IS_LAYOUT_ONLY(view) ([view isKindOfClass:[ABI46_0_0RCTView class]] && view.backgroundColor == nil) - -typedef NS_ENUM(NSInteger, ABI46_0_0REATransitionType) { - ABI46_0_0REATransitionTypeNone = 0, - ABI46_0_0REATransitionTypeGroup, - ABI46_0_0REATransitionTypeIn, - ABI46_0_0REATransitionTypeOut, - ABI46_0_0REATransitionTypeChange -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0REATransitionAnimationType) { - ABI46_0_0REATransitionAnimationTypeNone = 0, - ABI46_0_0REATransitionAnimationTypeFade, - ABI46_0_0REATransitionAnimationTypeScale, - ABI46_0_0REATransitionAnimationTypeSlideTop, - ABI46_0_0REATransitionAnimationTypeSlideBottom, - ABI46_0_0REATransitionAnimationTypeSlideRight, - ABI46_0_0REATransitionAnimationTypeSlideLeft, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0REATransitionInterpolationType) { - ABI46_0_0REATransitionInterpolationLinear = 0, - ABI46_0_0REATransitionInterpolationEaseIn, - ABI46_0_0REATransitionInterpolationEaseOut, - ABI46_0_0REATransitionInterpolationEaseInOut, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0REATransitionPropagationType) { - ABI46_0_0REATransitionPropagationNone = 0, - ABI46_0_0REATransitionPropagationTop, - ABI46_0_0REATransitionPropagationBottom, - ABI46_0_0REATransitionPropagationLeft, - ABI46_0_0REATransitionPropagationRight, -}; - -@interface ABI46_0_0REATransition : NSObject -@property (nonatomic, weak) ABI46_0_0REATransition *parent; -@property (nonatomic) CFTimeInterval duration; -@property (nonatomic) CFTimeInterval delay; -@property (nonatomic) ABI46_0_0REATransitionInterpolationType interpolation; -@property (nonatomic) ABI46_0_0REATransitionPropagationType propagation; -- (instancetype)initWithConfig:(NSDictionary *)config; -- (CAMediaTimingFunction *)mediaTiming; -- (void)startCaptureInRoot:(UIView *)root; -- (void)playInRoot:(UIView *)root; -- (ABI46_0_0REATransitionValues *)findStartValuesForKey:(NSNumber *)key; -- (ABI46_0_0REATransitionValues *)findEndValuesForKey:(NSNumber *)key; -- (ABI46_0_0REATransitionAnimation *)animationForTransitioning:(ABI46_0_0REATransitionValues *)startValues - endValues:(ABI46_0_0REATransitionValues *)endValues - forRoot:(UIView *)root; -- (NSArray *) - animationsForTransitioning:(NSMutableDictionary *)startValues - endValues:(NSMutableDictionary *)endValues - forRoot:(UIView *)root; - -+ (ABI46_0_0REATransition *)inflate:(NSDictionary *)config; -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.m deleted file mode 100644 index 58aa887edef841..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransition.m +++ /dev/null @@ -1,210 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import - -#define DEFAULT_PROPAGATION_SPEED 3 - -@interface ABI46_0_0REATransitionGroup : ABI46_0_0REATransition -@property (nonatomic) BOOL sequence; -@property (nonatomic) NSArray *transitions; -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAVisibilityTransition : ABI46_0_0REATransition -@property (nonatomic) ABI46_0_0REATransitionAnimationType animationType; -- (ABI46_0_0REATransitionAnimation *)appearView:(UIView *)view inParent:(UIView *)parent; -- (ABI46_0_0REATransitionAnimation *)disappearView:(UIView *)view fromParent:(UIView *)parent; -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAInTransition : ABI46_0_0REAVisibilityTransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAOutTransition : ABI46_0_0REAVisibilityTransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@interface ABI46_0_0REAChangeTransition : ABI46_0_0REATransition -- (instancetype)initWithConfig:(NSDictionary *)config; -@end - -@implementation ABI46_0_0REATransition { - __weak UIView *_root; - NSMutableDictionary *_startValues; - NSMutableDictionary *_endValues; -} - -+ (ABI46_0_0REATransition *)inflate:(NSDictionary *)config -{ - ABI46_0_0REATransitionType type = [ABI46_0_0RCTConvert ABI46_0_0REATransitionType:config[@"type"]]; - switch (type) { - case ABI46_0_0REATransitionTypeGroup: - return [[ABI46_0_0REATransitionGroup alloc] initWithConfig:config]; - case ABI46_0_0REATransitionTypeIn: - return [[ABI46_0_0REAInTransition alloc] initWithConfig:config]; - case ABI46_0_0REATransitionTypeOut: - return [[ABI46_0_0REAOutTransition alloc] initWithConfig:config]; - case ABI46_0_0REATransitionTypeChange: - return [[ABI46_0_0REAChangeTransition alloc] initWithConfig:config]; - case ABI46_0_0REATransitionTypeNone: - default: - ABI46_0_0RCTLogError(@"Invalid transitioning type %@", config[@"type"]); - } - return nil; -} - -- (instancetype)initWithConfig:(NSDictionary *)config -{ - if (self = [super init]) { - _duration = [ABI46_0_0RCTConvert double:config[@"durationMs"]] / 1000.0; - _delay = [ABI46_0_0RCTConvert double:config[@"delayMs"]] / 1000.0; - _interpolation = [ABI46_0_0RCTConvert ABI46_0_0REATransitionInterpolationType:config[@"interpolation"]]; - _propagation = [ABI46_0_0RCTConvert ABI46_0_0REATransitionPropagationType:config[@"propagation"]]; - } - return self; -} - -- (void)captureRecursiveIn:(UIView *)view - to:(NSMutableDictionary *)map - forRoot:(UIView *)root -{ - NSNumber *tag = view.ABI46_0_0ReactTag; - if (tag != nil) { - map[tag] = [[ABI46_0_0REATransitionValues alloc] initWithView:view forRoot:root]; - for (UIView *subview in view.ABI46_0_0ReactSubviews) { - [self captureRecursiveIn:subview to:map forRoot:root]; - } - } -} - -- (void)startCaptureInRoot:(UIView *)root -{ - _startValues = [NSMutableDictionary new]; - [self captureRecursiveIn:root to:_startValues forRoot:root]; -} - -- (void)playInRoot:(UIView *)root -{ - _endValues = [NSMutableDictionary new]; - [self captureRecursiveIn:root to:_endValues forRoot:root]; - NSArray *animations = [self animationsForTransitioning:_startValues endValues:_endValues forRoot:root]; - for (ABI46_0_0REATransitionAnimation *animation in animations) { - [animation play]; - } - _startValues = nil; - _endValues = nil; -} - -- (ABI46_0_0REATransitionValues *)findStartValuesForKey:(NSNumber *)key -{ - if (_parent != nil) { - return [_parent findStartValuesForKey:key]; - } - return _startValues[key]; -} - -- (ABI46_0_0REATransitionValues *)findEndValuesForKey:(NSNumber *)key -{ - if (_parent != nil) { - return [_parent findEndValuesForKey:key]; - } - return _endValues[key]; -} - -- (CFTimeInterval)propagationDelayForTransitioning:(ABI46_0_0REATransitionValues *)startValues - endValues:(ABI46_0_0REATransitionValues *)endValues - forRoot:(UIView *)root -{ - if (self.propagation == ABI46_0_0REATransitionPropagationNone) { - return 0.; - } - - ABI46_0_0REATransitionValues *values = endValues; - if (values == nil) { - values = startValues; - } - - double fraction = 0.; - switch (self.propagation) { - case ABI46_0_0REATransitionPropagationLeft: - fraction = values.centerRelativeToRoot.x / root.layer.bounds.size.width; - break; - case ABI46_0_0REATransitionPropagationRight: - fraction = 1. - values.centerRelativeToRoot.x / root.layer.bounds.size.width; - break; - case ABI46_0_0REATransitionPropagationTop: - fraction = values.centerRelativeToRoot.y / root.layer.bounds.size.height; - break; - case ABI46_0_0REATransitionPropagationBottom: - fraction = 1. - values.centerRelativeToRoot.y / root.layer.bounds.size.height; - break; - } - - return _duration * MIN(MAX(0., fraction), 1.) / DEFAULT_PROPAGATION_SPEED; -} - -- (CAMediaTimingFunction *)mediaTiming -{ - switch (self.interpolation) { - case ABI46_0_0REATransitionInterpolationLinear: - return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; - case ABI46_0_0REATransitionInterpolationEaseIn: - return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]; - case ABI46_0_0REATransitionInterpolationEaseOut: - return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut]; - case ABI46_0_0REATransitionInterpolationEaseInOut: - return [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - } -} - -- (ABI46_0_0REATransitionAnimation *)animationForTransitioning:(ABI46_0_0REATransitionValues *)startValues - endValues:(ABI46_0_0REATransitionValues *)endValues - forRoot:(UIView *)root -{ - return nil; -} - -- (NSArray *) - animationsForTransitioning:(NSMutableDictionary *)startValues - endValues:(NSMutableDictionary *)endValues - forRoot:(UIView *)root -{ - NSMutableArray *animations = [NSMutableArray new]; - [startValues enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, ABI46_0_0REATransitionValues *startValue, BOOL *stop) { - ABI46_0_0REATransitionValues *endValue = endValues[key]; - ABI46_0_0REATransitionAnimation *animation = [self animationForTransitioning:startValue endValues:endValue forRoot:root]; - if (animation != nil) { - animation.animation.timingFunction = self.mediaTiming; - animation.animation.duration = self.duration; - [animation delayBy:self.delay]; - CFTimeInterval propagationDelay = [self propagationDelayForTransitioning:startValue - endValues:endValue - forRoot:root]; - [animation delayBy:propagationDelay]; - // animation.animation.duration -= propagationDelay; - [animations addObject:animation]; - } - }]; - [endValues enumerateKeysAndObjectsUsingBlock:^(NSNumber *key, ABI46_0_0REATransitionValues *endValue, BOOL *stop) { - if (startValues[key] == nil) { - ABI46_0_0REATransitionAnimation *animation = [self animationForTransitioning:nil endValues:endValue forRoot:root]; - if (animation != nil) { - animation.animation.timingFunction = self.mediaTiming; - animation.animation.duration = self.duration; - [animation delayBy:self.delay]; - CFTimeInterval propagationDelay = [self propagationDelayForTransitioning:nil endValues:endValue forRoot:root]; - [animation delayBy:propagationDelay]; - // animation.animation.duration -= propagationDelay; - [animations addObject:animation]; - } - } - }]; - return animations; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.h deleted file mode 100644 index 81e969bdd36bf9..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.h +++ /dev/null @@ -1,17 +0,0 @@ -#import - -@interface ABI46_0_0REATransitionAnimation : NSObject - -@property (nonatomic) CAAnimation *animation; -@property (nonatomic) CALayer *layer; -@property (nonatomic) NSString *keyPath; - -+ (ABI46_0_0REATransitionAnimation *)transitionWithAnimation:(CAAnimation *)animation - layer:(CALayer *)layer - andKeyPath:(NSString *)keyPath; -- (void)play; -- (void)delayBy:(CFTimeInterval)delay; -- (CFTimeInterval)finishTime; -- (CFTimeInterval)duration; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.m deleted file mode 100644 index be97ee6d486a6e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionAnimation.m +++ /dev/null @@ -1,79 +0,0 @@ -#import -#import - -#define DEFAULT_DURATION 0.25 - -#if TARGET_IPHONE_SIMULATOR -// Based on https://stackoverflow.com/a/13307674 -float UIAnimationDragCoefficient(void); -#endif - -CGFloat ABI46_0_0SimAnimationDragCoefficient() -{ -#if TARGET_IPHONE_SIMULATOR - if (NSClassFromString(@"XCTest") != nil) { - // UIAnimationDragCoefficient is 10.0 in tests for some reason, but - // we need it to be 1.0. - return 1.0; - } else { - return (CGFloat)UIAnimationDragCoefficient(); - } -#else - return 1.0; -#endif -} - -@implementation ABI46_0_0REATransitionAnimation { - NSTimeInterval _delay; -} - -+ (ABI46_0_0REATransitionAnimation *)transitionWithAnimation:(CAAnimation *)animation - layer:(CALayer *)layer - andKeyPath:(NSString *)keyPath; -{ - ABI46_0_0REATransitionAnimation *anim = [ABI46_0_0REATransitionAnimation new]; - anim.animation = animation; - anim.layer = layer; - anim.keyPath = keyPath; - return anim; -} - -- (void)play -{ - /* - CACurrentMediaTime introduces some kind of delay even if _delay is set to 0 - it calls mach_absolute_time() which is based on the last time the device booted - which might cause the delay - */ - if (_delay > 0) { - _animation.beginTime = CACurrentMediaTime() + _delay * ABI46_0_0SimAnimationDragCoefficient(); - } - _animation.duration = self.duration * ABI46_0_0SimAnimationDragCoefficient(); - [_layer addAnimation:_animation forKey:_keyPath]; -} - -- (void)delayBy:(CFTimeInterval)delay -{ - if (delay <= 0) { - return; - } - _delay += delay; -} - -- (CFTimeInterval)duration -{ - if (_animation.duration == 0) { - return DEFAULT_DURATION; - } - return _animation.duration; -} - -- (CFTimeInterval)finishTime -{ - if (_animation.beginTime == 0) { - return CACurrentMediaTime() + self.duration + _delay; - } - return _animation.beginTime + self.duration + _delay; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.h deleted file mode 100644 index c166d85f277f23..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.h +++ /dev/null @@ -1,9 +0,0 @@ -#import -#import - -@interface ABI46_0_0REATransitionManager : NSObject - -- (instancetype)initWithUIManager:(ABI46_0_0RCTUIManager *)uiManager; -- (void)animateNextTransitionInRoot:(nonnull NSNumber *)ABI46_0_0ReactTag withConfig:(NSDictionary *)config; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.m deleted file mode 100644 index 78d0bccf9f6b0c..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionManager.m +++ /dev/null @@ -1,60 +0,0 @@ -#import -#import -#import -#import - -@interface ABI46_0_0REATransitionManager () -@end - -@implementation ABI46_0_0REATransitionManager { - ABI46_0_0REATransition *_pendingTransition; - UIView *_pendingTransitionRoot; - ABI46_0_0RCTUIManager *_uiManager; -} - -- (instancetype)initWithUIManager:(id)uiManager -{ - if (self = [super init]) { - _uiManager = uiManager; - } - return self; -} - -- (void)beginTransition:(ABI46_0_0REATransition *)transition forView:(UIView *)view -{ - ABI46_0_0RCTAssertMainQueue(); - if (_pendingTransition != nil) { - return; - } - _pendingTransition = transition; - _pendingTransitionRoot = view; - [transition startCaptureInRoot:view]; -} - -- (void)uiManagerWillPerformMounting:(ABI46_0_0RCTUIManager *)manager -{ - [manager addUIBlock:^(ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - [_pendingTransition playInRoot:_pendingTransitionRoot]; - _pendingTransitionRoot = nil; - _pendingTransition = nil; - }]; -} - -- (void)animateNextTransitionInRoot:(NSNumber *)ABI46_0_0ReactTag withConfig:(NSDictionary *)config -{ - [_uiManager.observerCoordinator addObserver:self]; - [_uiManager prependUIBlock:^(ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - UIView *view = viewRegistry[ABI46_0_0ReactTag]; - NSArray *transitionConfigs = [ABI46_0_0RCTConvert NSArray:config[@"transitions"]]; - for (id transitionConfig in transitionConfigs) { - ABI46_0_0REATransition *transition = [ABI46_0_0REATransition inflate:transitionConfig]; - [self beginTransition:transition forView:view]; - } - }]; - __weak id weakSelf = self; - [_uiManager addUIBlock:^(ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - [uiManager.observerCoordinator removeObserver:weakSelf]; - }]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.h b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.h deleted file mode 100644 index 0c4430696f5c4e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.h +++ /dev/null @@ -1,15 +0,0 @@ -#import - -@interface ABI46_0_0REATransitionValues : NSObject - -@property (nonatomic) CGPoint center; -@property (nonatomic) CGRect bounds; -@property (nonatomic) CGPoint centerRelativeToRoot; -@property (nonatomic, retain) UIView *view; -@property (nonatomic, retain) UIView *parent; -@property (nonatomic, retain) UIView *reactParent; -@property (nonatomic) CGPoint centerInReactParent; - -- (instancetype)initWithView:(UIView *)view forRoot:(UIView *)root; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.m b/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.m deleted file mode 100644 index 25fcac69c06a0e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/Transitioning/ABI46_0_0REATransitionValues.m +++ /dev/null @@ -1,25 +0,0 @@ -#import -#import -#import -#import - -@implementation ABI46_0_0REATransitionValues - -- (instancetype)initWithView:(UIView *)view forRoot:(UIView *)root -{ - if (self = [super init]) { - _view = view; - _parent = view.superview; - _reactParent = view.ABI46_0_0ReactSuperview; - while (_reactParent != nil && _reactParent != root && IS_LAYOUT_ONLY(_reactParent)) { - _reactParent = _reactParent.ABI46_0_0ReactSuperview; - } - _center = view.center; - _bounds = view.bounds; - _centerRelativeToRoot = [_parent convertPoint:_center toView:root]; - _centerInReactParent = [_parent convertPoint:_center toView:_reactParent]; - } - return self; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.h deleted file mode 100644 index a67bc78bba7ae6..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import -#include -#include - -namespace ABI46_0_0reanimated { - -class ABI46_0_0REAIOSErrorHandler : public ErrorHandler { - std::shared_ptr scheduler; - void raiseSpec() override; - std::shared_ptr error; - - public: - ABI46_0_0REAIOSErrorHandler(std::shared_ptr scheduler); - std::shared_ptr getScheduler() override; - std::shared_ptr getError() override; - void setError(std::string message) override; - virtual ~ABI46_0_0REAIOSErrorHandler() {} -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.mm deleted file mode 100644 index f25779367108e3..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSErrorHandler.mm +++ /dev/null @@ -1,40 +0,0 @@ -#import -#import -#import - -namespace ABI46_0_0reanimated { - -ABI46_0_0REAIOSErrorHandler::ABI46_0_0REAIOSErrorHandler(std::shared_ptr scheduler) -{ - this->scheduler = scheduler; - error = std::make_shared(); -} - -void ABI46_0_0REAIOSErrorHandler::raiseSpec() -{ - if (error->handled) { - return; - } - ABI46_0_0RCTLogError(@(error->message.c_str())); - this->error->handled = true; -} - -std::shared_ptr ABI46_0_0REAIOSErrorHandler::getScheduler() -{ - return this->scheduler; -} - -std::shared_ptr ABI46_0_0REAIOSErrorHandler::getError() -{ - return this->error; -} - -void ABI46_0_0REAIOSErrorHandler::setError(std::string message) -{ - if (error->handled) { - error->message = message; - error->handled = false; - } -} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.h deleted file mode 100644 index be2679ede97404..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.h +++ /dev/null @@ -1,15 +0,0 @@ -#import -#include - -namespace ABI46_0_0reanimated { - -class ABI46_0_0REAIOSLogger : public LoggerInterface { - public: - void log(const char *str) override; - void log(double d) override; - void log(int i) override; - void log(bool b) override; - virtual ~ABI46_0_0REAIOSLogger() {} -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.mm deleted file mode 100644 index f6d47023c65eac..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSLogger.mm +++ /dev/null @@ -1,29 +0,0 @@ -#import -#import - -namespace ABI46_0_0reanimated { - -std::unique_ptr Logger::instance = std::make_unique(); - -void ABI46_0_0REAIOSLogger::log(const char *str) -{ - NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]); -} - -void ABI46_0_0REAIOSLogger::log(double d) -{ - NSLog(@"%lf", d); -} - -void ABI46_0_0REAIOSLogger::log(int i) -{ - NSLog(@"%i", i); -} - -void ABI46_0_0REAIOSLogger::log(bool b) -{ - const char *str = (b) ? "true" : "false"; - NSLog(@"%@", [NSString stringWithCString:str encoding:[NSString defaultCStringEncoding]]); -} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.h deleted file mode 100644 index 5a2a5dec0ab907..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.h +++ /dev/null @@ -1,19 +0,0 @@ -#import -#import -#import -#include -#include - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -class ABI46_0_0REAIOSScheduler : public Scheduler { - public: - ABI46_0_0REAIOSScheduler(std::shared_ptr jsInvoker); - void scheduleOnUI(std::function job) override; - virtual ~ABI46_0_0REAIOSScheduler(); -}; - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.mm deleted file mode 100644 index 7e11451277fbbc..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAIOSScheduler.mm +++ /dev/null @@ -1,48 +0,0 @@ -#import -#import - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -ABI46_0_0REAIOSScheduler::ABI46_0_0REAIOSScheduler(std::shared_ptr jsInvoker) -{ - this->jsCallInvoker_ = jsInvoker; -} - -void ABI46_0_0REAIOSScheduler::scheduleOnUI(std::function job) -{ - if (runtimeManager.lock() == nullptr) { - return; - } - - if ([NSThread isMainThread]) { - if (runtimeManager.lock()) { - job(); - } - return; - } - - Scheduler::scheduleOnUI(job); - if ([NSThread isMainThread]) { - if (runtimeManager.lock()) { - triggerUI(); - } - return; - } - - if (!this->scheduledOnUI) { - __block std::weak_ptr blockRuntimeManager = runtimeManager; - - dispatch_async(dispatch_get_main_queue(), ^{ - if (blockRuntimeManager.lock()) { - triggerUI(); - } - }); - } -} - -ABI46_0_0REAIOSScheduler::~ABI46_0_0REAIOSScheduler() {} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.h deleted file mode 100644 index 2888fda4026afb..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.h +++ /dev/null @@ -1,30 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import - -#if RNVERSION >= 64 -#import -#endif - -#if RNVERSION < 63 -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -JSIExecutor::RuntimeInstaller ABI46_0_0REAJSIExecutorRuntimeInstaller( - ABI46_0_0RCTBridge *bridge, - JSIExecutor::RuntimeInstaller runtimeInstallerToWrap); - -} // namespace reanimated -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.mm deleted file mode 100644 index 6674602744c5a6..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/ABI46_0_0REAInitializer.mm +++ /dev/null @@ -1,75 +0,0 @@ -#import -#import - -@interface ABI46_0_0RCTEventDispatcher (Reanimated) - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge; - -@end - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -JSIExecutor::RuntimeInstaller ABI46_0_0REAJSIExecutorRuntimeInstaller( - ABI46_0_0RCTBridge *bridge, - JSIExecutor::RuntimeInstaller runtimeInstallerToWrap) -{ - [bridge moduleForClass:[ABI46_0_0RCTUIManager class]]; - ABI46_0_0REAUIManager *reaUiManager = [ABI46_0_0REAUIManager new]; - [reaUiManager setBridge:bridge]; - ABI46_0_0RCTUIManager *uiManager = reaUiManager; - [bridge updateModuleWithInstance:uiManager]; - - [bridge moduleForClass:[ABI46_0_0RCTEventDispatcher class]]; - ABI46_0_0RCTEventDispatcher *eventDispatcher = [ABI46_0_0REAEventDispatcher new]; -#if RNVERSION >= 66 - ABI46_0_0RCTCallableJSModules *callableJSModules = [ABI46_0_0RCTCallableJSModules new]; - [bridge setValue:callableJSModules forKey:@"_callableJSModules"]; - [callableJSModules setBridge:bridge]; - [eventDispatcher setValue:callableJSModules forKey:@"_callableJSModules"]; - [eventDispatcher setValue:bridge forKey:@"_bridge"]; - [eventDispatcher initialize]; -#else - [eventDispatcher setBridge:bridge]; -#endif - [bridge updateModuleWithInstance:eventDispatcher]; - const auto runtimeInstaller = [bridge, runtimeInstallerToWrap](ABI46_0_0facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } -#if RNVERSION >= 63 - auto reanimatedModule = ABI46_0_0reanimated::createReanimatedModule(bridge, bridge.jsCallInvoker); -#else - auto callInvoker = std::make_shared(bridge.reactInstance); - auto reanimatedModule = ABI46_0_0reanimated::createReanimatedModule(bridge, callInvoker); -#endif - auto workletRuntimeValue = runtime - .global() - .getProperty(runtime, "ArrayBuffer") - .asObject(runtime) - .asFunction(runtime) - .callAsConstructor(runtime, {static_cast(sizeof(void*))}); - uintptr_t* workletRuntimeData = reinterpret_cast( - workletRuntimeValue.getObject(runtime).getArrayBuffer(runtime).data(runtime)); - workletRuntimeData[0] = reinterpret_cast(reanimatedModule->runtime.get()); - - runtime.global().setProperty( - runtime, - "_WORKLET_RUNTIME", - workletRuntimeValue); - - runtime.global().setProperty( - runtime, - jsi::PropNameID::forAscii(runtime, "__reanimatedModuleProxy"), - jsi::Object::createFromHostObject(runtime, reanimatedModule)); - - if (runtimeInstallerToWrap) { - runtimeInstallerToWrap(runtime); - } - }; - return runtimeInstaller; -} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.h deleted file mode 100644 index 18fbe7fdac2f0b..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.h +++ /dev/null @@ -1,24 +0,0 @@ -#import -#import -#import -#include -#include -#include - -namespace ABI46_0_0reanimated { - -std::vector> measure( - int viewTag, - ABI46_0_0RCTUIManager *uiManager); -void scrollTo( - int scrollViewTag, - ABI46_0_0RCTUIManager *uiManager, - double x, - double y, - bool animated); -void setGestureState( - id gestureHandlerStateManager, - int handlerTag, - int newState); - -} // namespace reanimated diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.mm deleted file mode 100644 index 681448bff651f1..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeMethods.mm +++ /dev/null @@ -1,54 +0,0 @@ -#import -#import -#import - -namespace ABI46_0_0reanimated { - -std::vector> measure(int viewTag, ABI46_0_0RCTUIManager *uiManager) -{ - UIView *view = [uiManager viewForABI46_0_0ReactTag:@(viewTag)]; - - UIView *rootView = view; - - if (view == nil) { - return std::vector>(1, std::make_pair("x", -1234567.0)); - } - - while (rootView.superview && ![rootView isABI46_0_0ReactRootView]) { - rootView = rootView.superview; - } - - if (rootView == nil) { - return std::vector>(1, std::make_pair("x", -1234567.0)); - } - - CGRect frame = view.frame; - CGRect globalBounds = [view convertRect:view.bounds toView:rootView]; - - std::vector> result; - result.push_back({"x", frame.origin.x}); - result.push_back({"y", frame.origin.y}); - - result.push_back({"width", globalBounds.size.width}); - result.push_back({"height", globalBounds.size.height}); - - result.push_back({"pageX", globalBounds.origin.x}); - result.push_back({"pageY", globalBounds.origin.y}); - return result; -} - -void scrollTo(int scrollViewTag, ABI46_0_0RCTUIManager *uiManager, double x, double y, bool animated) -{ - UIView *view = [uiManager viewForABI46_0_0ReactTag:@(scrollViewTag)]; - ABI46_0_0RCTScrollView *scrollView = (ABI46_0_0RCTScrollView *)view; - [scrollView scrollToOffset:(CGPoint){(CGFloat)x, (CGFloat)y} animated:animated]; -} - -void setGestureState(id gestureHandlerStateManager, int handlerTag, int newState) -{ - if (gestureHandlerStateManager != nil) { - [gestureHandlerStateManager setGestureState:newState forHandler:handlerTag]; - } -} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.h deleted file mode 100644 index b086cd00f3ee7f..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.h +++ /dev/null @@ -1,15 +0,0 @@ -#if __cplusplus - -#import -#import -#include - -namespace ABI46_0_0reanimated { - -std::shared_ptr createReanimatedModule( - ABI46_0_0RCTBridge *bridge, - std::shared_ptr jsInvoker); - -} - -#endif diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.mm deleted file mode 100644 index 317c77cdb185f0..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/NativeProxy.mm +++ /dev/null @@ -1,341 +0,0 @@ -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#if TARGET_IPHONE_SIMULATOR -#import -#endif - -#if __has_include() -#import -#else -#import -#endif - -namespace ABI46_0_0reanimated { - -using namespace ABI46_0_0facebook; -using namespace ABI46_0_0React; - -static CGFloat SimAnimationDragCoefficient(void) -{ - static float (*UIAnimationDragCoefficient)(void) = NULL; -#if TARGET_IPHONE_SIMULATOR - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - UIAnimationDragCoefficient = (float (*)(void))dlsym(RTLD_DEFAULT, "UIAnimationDragCoefficient"); - }); -#endif - return UIAnimationDragCoefficient ? UIAnimationDragCoefficient() : 1.f; -} - -static CFTimeInterval calculateTimestampWithSlowAnimations(CFTimeInterval currentTimestamp) -{ -#if TARGET_IPHONE_SIMULATOR - static CFTimeInterval dragCoefChangedTimestamp = CACurrentMediaTime(); - static CGFloat previousDragCoef = SimAnimationDragCoefficient(); - - const CGFloat dragCoef = SimAnimationDragCoefficient(); - if (previousDragCoef != dragCoef) { - previousDragCoef = dragCoef; - dragCoefChangedTimestamp = CACurrentMediaTime(); - } - - const bool areSlowAnimationsEnabled = dragCoef != 1.f; - if (areSlowAnimationsEnabled) { - return (dragCoefChangedTimestamp + (currentTimestamp - dragCoefChangedTimestamp) / dragCoef); - } else { - return currentTimestamp; - } -#else - return currentTimestamp; -#endif -} - -// COPIED FROM ABI46_0_0RCTTurboModule.mm -static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value); - -static NSString *convertJSIStringToNSString(jsi::Runtime &runtime, const jsi::String &value) -{ - return [NSString stringWithUTF8String:value.utf8(runtime).c_str()]; -} - -static NSDictionary *convertJSIObjectToNSDictionary(jsi::Runtime &runtime, const jsi::Object &value) -{ - jsi::Array propertyNames = value.getPropertyNames(runtime); - size_t size = propertyNames.size(runtime); - NSMutableDictionary *result = [NSMutableDictionary new]; - for (size_t i = 0; i < size; i++) { - jsi::String name = propertyNames.getValueAtIndex(runtime, i).getString(runtime); - NSString *k = convertJSIStringToNSString(runtime, name); - id v = convertJSIValueToObjCObject(runtime, value.getProperty(runtime, name)); - if (v) { - result[k] = v; - } - } - return [result copy]; -} - -static NSArray *convertJSIArrayToNSArray(jsi::Runtime &runtime, const jsi::Array &value) -{ - size_t size = value.size(runtime); - NSMutableArray *result = [NSMutableArray new]; - for (size_t i = 0; i < size; i++) { - // Insert kCFNull when it's `undefined` value to preserve the indices. - [result addObject:convertJSIValueToObjCObject(runtime, value.getValueAtIndex(runtime, i)) ?: (id)kCFNull]; - } - return [result copy]; -} - -static id convertJSIValueToObjCObject(jsi::Runtime &runtime, const jsi::Value &value) -{ - if (value.isUndefined() || value.isNull()) { - return nil; - } - if (value.isBool()) { - return @(value.getBool()); - } - if (value.isNumber()) { - return @(value.getNumber()); - } - if (value.isString()) { - return convertJSIStringToNSString(runtime, value.getString(runtime)); - } - if (value.isObject()) { - jsi::Object o = value.getObject(runtime); - if (o.isArray(runtime)) { - return convertJSIArrayToNSArray(runtime, o.getArray(runtime)); - } - return convertJSIObjectToNSDictionary(runtime, o); - } - - throw std::runtime_error("Unsupported jsi::jsi::Value kind"); -} - -static NSSet *convertProps(jsi::Runtime &rt, const jsi::Value &props) -{ - NSMutableSet *propsSet = [[NSMutableSet alloc] init]; - jsi::Array propsNames = props.asObject(rt).asArray(rt); - for (int i = 0; i < propsNames.size(rt); i++) { - NSString *propName = @(propsNames.getValueAtIndex(rt, i).asString(rt).utf8(rt).c_str()); - [propsSet addObject:propName]; - } - return propsSet; -} - -std::shared_ptr createReanimatedModule( - ABI46_0_0RCTBridge *bridge, - std::shared_ptr jsInvoker) -{ - ABI46_0_0REAModule *reanimatedModule = [bridge moduleForClass:[ABI46_0_0REAModule class]]; - - auto propUpdater = [reanimatedModule]( - jsi::Runtime &rt, int viewTag, const jsi::Value &viewName, const jsi::Object &props) -> void { - NSString *nsViewName = [NSString stringWithCString:viewName.asString(rt).utf8(rt).c_str() - encoding:[NSString defaultCStringEncoding]]; - - NSDictionary *propsDict = convertJSIObjectToNSDictionary(rt, props); - [reanimatedModule.nodesManager updateProps:propsDict - ofViewWithTag:[NSNumber numberWithInt:viewTag] - withName:nsViewName]; - }; - - ABI46_0_0RCTUIManager *uiManager = reanimatedModule.nodesManager.uiManager; - auto measuringFunction = [uiManager](int viewTag) -> std::vector> { - return measure(viewTag, uiManager); - }; - - auto scrollToFunction = [uiManager](int viewTag, double x, double y, bool animated) { - scrollTo(viewTag, uiManager, x, y, animated); - }; - - id gestureHandlerStateManager = nil; - auto setGestureStateFunction = [gestureHandlerStateManager, bridge](int handlerTag, int newState) mutable { - if (gestureHandlerStateManager == nil) { - gestureHandlerStateManager = [bridge moduleForName:@"ABI46_0_0RNGestureHandlerModule"]; - } - - setGestureState(gestureHandlerStateManager, handlerTag, newState); - }; - - auto propObtainer = [reanimatedModule]( - jsi::Runtime &rt, const int viewTag, const jsi::String &propName) -> jsi::Value { - NSString *propNameConverted = [NSString stringWithFormat:@"%s", propName.utf8(rt).c_str()]; - std::string resultStr = std::string([[reanimatedModule.nodesManager obtainProp:[NSNumber numberWithInt:viewTag] - propName:propNameConverted] UTF8String]); - jsi::Value val = jsi::String::createFromUtf8(rt, resultStr); - return val; - }; - -#if __has_include() - std::shared_ptr animatedRuntime = ABI46_0_0facebook::hermes::makeHermesRuntime(); -#else - std::shared_ptr animatedRuntime = ABI46_0_0facebook::jsc::makeJSCRuntime(); -#endif - - std::shared_ptr scheduler = std::make_shared(jsInvoker); - std::shared_ptr errorHandler = std::make_shared(scheduler); - std::shared_ptr module; - - __block std::weak_ptr weakScheduler = scheduler; - ((ABI46_0_0REAUIManager *)uiManager).flushUiOperations = ^void() { - std::shared_ptr scheduler = weakScheduler.lock(); - if (scheduler != nullptr) { - scheduler->triggerUI(); - } - }; - - auto requestRender = [reanimatedModule, &module](std::function onRender, jsi::Runtime &rt) { - [reanimatedModule.nodesManager postOnAnimation:^(CADisplayLink *displayLink) { - double frameTimestamp = calculateTimestampWithSlowAnimations(displayLink.targetTimestamp) * 1000; - jsi::Object global = rt.global(); - jsi::String frameTimestampName = jsi::String::createFromAscii(rt, "_frameTimestamp"); - global.setProperty(rt, frameTimestampName, frameTimestamp); - onRender(frameTimestamp); - global.setProperty(rt, frameTimestampName, jsi::Value::undefined()); - }]; - }; - - auto getCurrentTime = []() { return calculateTimestampWithSlowAnimations(CACurrentMediaTime()) * 1000; }; - - // Layout Animations start - ABI46_0_0REAUIManager *reaUiManagerNoCast = [bridge moduleForClass:[ABI46_0_0REAUIManager class]]; - ABI46_0_0RCTUIManager *reaUiManager = reaUiManagerNoCast; - ABI46_0_0REAAnimationsManager *animationsManager = [[ABI46_0_0REAAnimationsManager alloc] initWithUIManager:reaUiManager]; - [reaUiManagerNoCast setUp:animationsManager]; - - auto notifyAboutProgress = [=](int tag, jsi::Object newStyle) { - if (animationsManager) { - NSDictionary *propsDict = convertJSIObjectToNSDictionary(*animatedRuntime, newStyle); - [animationsManager notifyAboutProgress:propsDict tag:[NSNumber numberWithInt:tag]]; - } - }; - - auto notifyAboutEnd = [=](int tag, bool isCancelled) { - if (animationsManager) { - [animationsManager notifyAboutEnd:[NSNumber numberWithInt:tag] cancelled:isCancelled]; - } - }; - - auto configurePropsFunction = [reanimatedModule]( - jsi::Runtime &rt, const jsi::Value &uiProps, const jsi::Value &nativeProps) { - NSSet *uiPropsSet = convertProps(rt, uiProps); - NSSet *nativePropsSet = convertProps(rt, nativeProps); - [reanimatedModule.nodesManager configureUiProps:uiPropsSet andNativeProps:nativePropsSet]; - }; - - std::shared_ptr layoutAnimationsProxy = - std::make_shared(notifyAboutProgress, notifyAboutEnd); - std::weak_ptr wrt = animatedRuntime; - [animationsManager setAnimationStartingBlock:^( - NSNumber *_Nonnull tag, NSString *type, NSDictionary *_Nonnull values, NSNumber *depth) { - std::shared_ptr rt = wrt.lock(); - if (wrt.expired()) { - return; - } - jsi::Object yogaValues(*rt); - for (NSString *key in values.allKeys) { - NSNumber *value = values[key]; - yogaValues.setProperty(*rt, [key UTF8String], [value doubleValue]); - } - - jsi::Value layoutAnimationRepositoryAsValue = - rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository"); - if (!layoutAnimationRepositoryAsValue.isUndefined()) { - jsi::Function startAnimationForTag = - layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "startAnimationForTag"); - startAnimationForTag.call( - *rt, - jsi::Value([tag intValue]), - jsi::String::createFromAscii(*rt, std::string([type UTF8String])), - yogaValues, - jsi::Value([depth intValue])); - } - }]; - - [animationsManager setRemovingConfigBlock:^(NSNumber *_Nonnull tag) { - std::shared_ptr rt = wrt.lock(); - if (wrt.expired()) { - return; - } - jsi::Value layoutAnimationRepositoryAsValue = - rt->global().getPropertyAsObject(*rt, "global").getProperty(*rt, "LayoutAnimationRepository"); - if (!layoutAnimationRepositoryAsValue.isUndefined()) { - jsi::Function removeConfig = - layoutAnimationRepositoryAsValue.getObject(*rt).getPropertyAsFunction(*rt, "removeConfig"); - removeConfig.call(*rt, jsi::Value([tag intValue])); - } - }]; - - // Layout Animations end - - // sensors - ABI46_0_0ReanimatedSensorContainer *reanimatedSensorContainer = [[ABI46_0_0ReanimatedSensorContainer alloc] init]; - auto registerSensorFunction = [=](int sensorType, int interval, std::function setter) -> int { - return [reanimatedSensorContainer registerSensor:(ABI46_0_0ReanimatedSensorType)sensorType - interval:interval - setter:^(double *data) { - setter(data); - }]; - }; - - auto unregisterSensorFunction = [=](int sensorId) { [reanimatedSensorContainer unregisterSensor:sensorId]; }; - // end sensors - - PlatformDepMethodsHolder platformDepMethodsHolder = { - requestRender, - propUpdater, - scrollToFunction, - measuringFunction, - getCurrentTime, - registerSensorFunction, - unregisterSensorFunction, - setGestureStateFunction, - configurePropsFunction}; - - module = std::make_shared( - jsInvoker, - scheduler, - animatedRuntime, - errorHandler, - propObtainer, - layoutAnimationsProxy, - platformDepMethodsHolder); - - scheduler->setRuntimeManager(module); - - [reanimatedModule.nodesManager registerEventHandler:^(NSString *eventName, id event) { - std::string eventNameString([eventName UTF8String]); - - std::string eventAsString; - try { - eventAsString = folly::toJson(convertIdToFollyDynamic([event arguments][2])); - } catch (std::exception &) { - // Events from other libraries may contain NaN or INF values which cannot be represented in JSON. - // See https://github.com/software-mansion/react-native-reanimated/issues/1776 for details. - return; - } - - eventAsString = "{ NativeMap:" + eventAsString + "}"; - jsi::Object global = module->runtime->global(); - jsi::String eventTimestampName = jsi::String::createFromAscii(*module->runtime, "_eventTimestamp"); - global.setProperty(*module->runtime, eventTimestampName, CACurrentMediaTime() * 1000); - module->onEvent(eventNameString, eventAsString); - global.setProperty(*module->runtime, eventTimestampName, jsi::Value::undefined()); - }]; - - return module; -} - -} diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.h b/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.h deleted file mode 100644 index af2f175671be08..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.h +++ /dev/null @@ -1,10 +0,0 @@ -#import -#import - -#ifndef DONT_AUTOINSTALL_REANIMATED - -@interface UIResponder (Reanimated) - -@end - -#endif diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.mm b/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.mm deleted file mode 100644 index 5f953eacf7a36e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/native/UIResponder+Reanimated.mm +++ /dev/null @@ -1,33 +0,0 @@ -#import -#import -#import - -#if __has_include() -#import -typedef HermesExecutorFactory ExecutorFactory; -#elif __has_include() -#import -typedef HermesExecutorFactory ExecutorFactory; -#else -#import -typedef JSCExecutorFactory ExecutorFactory; -#endif - -#ifndef DONT_AUTOINSTALL_REANIMATED - -@implementation UIResponder (Reanimated) -- (std::unique_ptr)jsExecutorFactoryForBridge:(ABI46_0_0RCTBridge *)bridge -{ - const auto installer = ABI46_0_0reanimated::ABI46_0_0REAJSIExecutorRuntimeInstaller(bridge, NULL); - -#if RNVERSION >= 64 - // installs globals such as console, nativePerformanceNow, etc. - return std::make_unique(ABI46_0_0RCTJSIExecutorRuntimeInstaller(installer)); -#else - return std::make_unique(installer); -#endif -} - -@end - -#endif diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.h b/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.h deleted file mode 100644 index 6c2ada22c9d226..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.h +++ /dev/null @@ -1,25 +0,0 @@ -#if __has_include() -#import -#endif -#import - -@interface ABI46_0_0ReanimatedSensor : NSObject { - ABI46_0_0ReanimatedSensorType _sensorType; - double _interval; - double _lastTimestamp; -#if !TARGET_OS_TV - CMMotionManager *_motionManager; -#endif - void (^_setter)(double[]); -} - -- (instancetype)init:(ABI46_0_0ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter; -- (bool)initialize; -- (bool)initializeGyroscope; -- (bool)initializeAccelerometer; -- (bool)initializeGravity; -- (bool)initializeMagnetometer; -- (bool)initializeOrientation; -- (void)cancel; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.m b/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.m deleted file mode 100644 index 5bab68abd5f40e..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensor.m +++ /dev/null @@ -1,217 +0,0 @@ -#import - -#if __has_include() -@implementation ABI46_0_0ReanimatedSensor - -- (instancetype)init:(ABI46_0_0ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter -{ - self = [super init]; - _sensorType = sensorType; - _interval = interval / 1000; // in seconds - _setter = setter; - _motionManager = [[CMMotionManager alloc] init]; - return self; -} - -- (bool)initialize -{ - if (_sensorType == ACCELEROMETER) { - return [self initializeAccelerometer]; - } else if (_sensorType == GYROSCOPE) { - return [self initializeGyroscope]; - } else if (_sensorType == GRAVITY) { - return [self initializeGravity]; - } else if (_sensorType == MAGNETIC_FIELD) { - return [self initializeMagnetometer]; - } else if (_sensorType == ROTATION_VECTOR) { - return [self initializeOrientation]; - } - - return false; -} - -- (bool)initializeGyroscope -{ - if (![_motionManager isGyroAvailable]) { - return false; - } - [_motionManager setGyroUpdateInterval:_interval]; - [_motionManager startGyroUpdates]; - [_motionManager - startGyroUpdatesToQueue:[NSOperationQueue mainQueue] - withHandler:^(CMGyroData *sensorData, NSError *error) { - double currentTime = [[NSProcessInfo processInfo] systemUptime]; - if (currentTime - self->_lastTimestamp < self->_interval) { - return; - } - double data[] = {sensorData.rotationRate.x, sensorData.rotationRate.y, sensorData.rotationRate.z}; - self->_setter(data); - self->_lastTimestamp = currentTime; - }]; - - return true; -} - -- (bool)initializeAccelerometer -{ - if (![_motionManager isAccelerometerAvailable]) { - return false; - } - [_motionManager setAccelerometerUpdateInterval:_interval]; - [_motionManager startAccelerometerUpdates]; - [_motionManager - startAccelerometerUpdatesToQueue:[NSOperationQueue mainQueue] - withHandler:^(CMAccelerometerData *sensorData, NSError *error) { - double currentTime = [[NSProcessInfo processInfo] systemUptime]; - if (currentTime - self->_lastTimestamp < self->_interval) { - return; - } - double data[] = { - sensorData.acceleration.x, sensorData.acceleration.y, sensorData.acceleration.z}; - self->_setter(data); - self->_lastTimestamp = currentTime; - }]; - - return true; -} - -- (bool)initializeGravity -{ - if (![_motionManager isDeviceMotionAvailable]) { - return false; - } - [_motionManager setDeviceMotionUpdateInterval:_interval]; - [_motionManager setShowsDeviceMovementDisplay:YES]; - [_motionManager - startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] - withHandler:^(CMDeviceMotion *sensorData, NSError *error) { - double currentTime = [[NSProcessInfo processInfo] systemUptime]; - if (currentTime - self->_lastTimestamp < self->_interval) { - return; - } - double data[] = {sensorData.gravity.x, sensorData.gravity.y, sensorData.gravity.z}; - self->_setter(data); - self->_lastTimestamp = currentTime; - }]; - - return true; -} - -- (bool)initializeMagnetometer -{ - if (![_motionManager isMagnetometerAvailable]) { - return false; - } - [_motionManager setMagnetometerUpdateInterval:_interval]; - [_motionManager startMagnetometerUpdates]; - [_motionManager - startMagnetometerUpdatesToQueue:[NSOperationQueue mainQueue] - withHandler:^(CMMagnetometerData *sensorData, NSError *error) { - double currentTime = [[NSProcessInfo processInfo] systemUptime]; - if (currentTime - self->_lastTimestamp < self->_interval) { - return; - } - double data[] = { - sensorData.magneticField.x, sensorData.magneticField.y, sensorData.magneticField.z}; - self->_setter(data); - self->_lastTimestamp = currentTime; - }]; - - return true; -} - -- (bool)initializeOrientation -{ - if (![_motionManager isDeviceMotionAvailable]) { - return false; - } - [_motionManager setDeviceMotionUpdateInterval:_interval]; - - [_motionManager setShowsDeviceMovementDisplay:YES]; - [_motionManager startDeviceMotionUpdatesUsingReferenceFrame:CMAttitudeReferenceFrameXTrueNorthZVertical - toQueue:[NSOperationQueue mainQueue] - withHandler:^(CMDeviceMotion *sensorData, NSError *error) { - double currentTime = [[NSProcessInfo processInfo] systemUptime]; - if (currentTime - self->_lastTimestamp < self->_interval) { - return; - } - CMAttitude *attitude = sensorData.attitude; - double data[] = { - attitude.quaternion.x, - attitude.quaternion.y, - attitude.quaternion.z, - attitude.quaternion.w, - attitude.yaw, - attitude.pitch, - attitude.roll - }; - self->_setter(data); - self->_lastTimestamp = currentTime; - }]; - - return true; -} - -- (void)cancel -{ - if (_sensorType == ACCELEROMETER) { - [_motionManager stopAccelerometerUpdates]; - } else if (_sensorType == GYROSCOPE) { - [_motionManager stopGyroUpdates]; - } else if (_sensorType == GRAVITY) { - [_motionManager stopDeviceMotionUpdates]; - } else if (_sensorType == MAGNETIC_FIELD) { - [_motionManager stopMagnetometerUpdates]; - } else if (_sensorType == ROTATION_VECTOR) { - [_motionManager stopDeviceMotionUpdates]; - } -} - -@end - -#else - -@implementation ABI46_0_0ReanimatedSensor - -- (instancetype)init:(ABI46_0_0ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter -{ - self = [super init]; - return self; -} - -- (bool)initialize -{ - return false; -} - -- (bool)initializeGyroscope -{ - return false; -} - -- (bool)initializeAccelerometer -{ - return false; -} - -- (bool)initializeGravity -{ - return false; -} - -- (bool)initializeMagnetometer -{ - return false; -} - -- (bool)initializeOrientation -{ - return false; -} - -- (void)cancel -{ -} - -@end -#endif diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.h b/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.h deleted file mode 100644 index acb02c7d6e8c15..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.h +++ /dev/null @@ -1,12 +0,0 @@ -#import - -@interface ABI46_0_0ReanimatedSensorContainer : NSObject { - NSNumber *_nextSensorId; - NSMutableDictionary *_sensors; -} - -- (instancetype)init; -- (int)registerSensor:(ABI46_0_0ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter; -- (void)unregisterSensor:(int)sensorId; - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.m b/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.m deleted file mode 100644 index 45c4f541cfc910..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorContainer.m +++ /dev/null @@ -1,40 +0,0 @@ -#import -#import -#import - -static NSNumber *_nextSensorId = nil; - -@implementation ABI46_0_0ReanimatedSensorContainer - -- (instancetype)init -{ - self = [super init]; - _sensors = [[NSMutableDictionary alloc] init]; - _nextSensorId = @0; - return self; -} - -- (int)registerSensor:(ABI46_0_0ReanimatedSensorType)sensorType interval:(int)interval setter:(void (^)(double[]))setter -{ - ABI46_0_0ReanimatedSensor *sensor = [[ABI46_0_0ReanimatedSensor alloc] init:sensorType interval:interval setter:setter]; - if ([sensor initialize]) { - NSNumber *sensorId = [_nextSensorId copy]; - _nextSensorId = [NSNumber numberWithInt:[_nextSensorId intValue] + 1]; - [_sensors setObject:sensor forKey:sensorId]; - return [sensorId intValue]; - } else { - return -1; - } -} - -- (void)unregisterSensor:(int)sensorId -{ - NSNumber *_sensorId = [NSNumber numberWithInt:sensorId]; - if (_sensors[_sensorId] == nil) { - return; - } - [_sensors[_sensorId] cancel]; - [_sensors removeObjectForKey:_sensorId]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorType.h b/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorType.h deleted file mode 100644 index b4e9c25574cb91..00000000000000 --- a/ios/vendored/sdk46/react-native-reanimated/ios/sensor/ABI46_0_0ReanimatedSensorType.h +++ /dev/null @@ -1,7 +0,0 @@ -typedef NS_ENUM(NSUInteger, ABI46_0_0ReanimatedSensorType) { - ACCELEROMETER = 1, - GYROSCOPE = 2, - GRAVITY = 3, - MAGNETIC_FIELD = 4, - ROTATION_VECTOR = 5, -}; diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ABI46_0_0react-native-safe-area-context.podspec.json b/ios/vendored/sdk46/react-native-safe-area-context/ABI46_0_0react-native-safe-area-context.podspec.json deleted file mode 100644 index 0e071613c81fdc..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ABI46_0_0react-native-safe-area-context.podspec.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "name": "ABI46_0_0react-native-safe-area-context", - "version": "4.3.1", - "summary": "A flexible way to handle safe area, also works on Android and web.", - "license": "MIT", - "authors": "Janic Duplessis ", - "homepage": "https://github.com/th3rdwave/react-native-safe-area-context#readme", - "platforms": { - "ios": "11.0", - "tvos": "11.0" - }, - "source": { - "git": "https://github.com/th3rdwave/react-native-safe-area-context.git", - "tag": "v4.3.1" - }, - "source_files": "ios/**/*.{h,m,mm}", - "exclude_files": "ios/Fabric", - "compiler_flags": "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32", - "pod_target_xcconfig": { - "HEADER_SEARCH_PATHS": "\"$(PODS_ROOT)/boost\"", - "CLANG_CXX_LANGUAGE_STANDARD": "c++17" - }, - "dependencies": { - "ABI46_0_0React": [], - "RCT-Folly": [], - "ABI46_0_0RCTRequired": [], - "ABI46_0_0RCTTypeSafety": [], - "ABI46_0_0ReactCommon/turbomodule/core": [] - } -} diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.h deleted file mode 100644 index 59499939d985ba..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaContext : NSObject - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.mm b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.mm deleted file mode 100644 index f579fd9b59dd72..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaContext.mm +++ /dev/null @@ -1,78 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaContext.h" - -#if __has_include() -#define ABI46_0_0RCT_USE_CODEGEN 1 -#else -#define ABI46_0_0RCT_USE_CODEGEN 0 -#endif - -#import -#import -#if ABI46_0_0RCT_USE_CODEGEN -#import -#endif - -#if ABI46_0_0RCT_USE_CODEGEN -using namespace ABI46_0_0facebook::react; - -@interface ABI46_0_0RNCSafeAreaContext () -@end -#endif - -@implementation ABI46_0_0RNCSafeAreaContext - -ABI46_0_0RCT_EXPORT_MODULE() - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - __block NSDictionary *constants; - - ABI46_0_0RCTUnsafeExecuteOnMainQueueSync(^{ - UIWindow *window = ABI46_0_0RCTKeyWindow(); - if (window == nil) { - constants = @{@"initialWindowMetrics" : [NSNull null]}; - return; - } - - UIEdgeInsets safeAreaInsets = window.safeAreaInsets; - constants = @{ - @"initialWindowMetrics" : @{ - @"insets" : @{ - @"top" : @(safeAreaInsets.top), - @"right" : @(safeAreaInsets.right), - @"bottom" : @(safeAreaInsets.bottom), - @"left" : @(safeAreaInsets.left), - }, - @"frame" : @{ - @"x" : @(window.frame.origin.x), - @"y" : @(window.frame.origin.y), - @"width" : @(window.frame.size.width), - @"height" : @(window.frame.size.height), - }, - } - }; - }); - - return constants; -} - -#if ABI46_0_0RCT_USE_CODEGEN - -- (std::shared_ptr)getTurboModule:(const ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.h deleted file mode 100644 index 6eeb755ddeb10c..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaProvider : ABI46_0_0RCTView - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onInsetsChange; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.m deleted file mode 100644 index 47ed7baca6cc9d..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProvider.m +++ /dev/null @@ -1,67 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaProvider.h" - -#import -#import -#import "ABI46_0_0RNCSafeAreaUtils.h" - -@implementation ABI46_0_0RNCSafeAreaProvider { - UIEdgeInsets _currentSafeAreaInsets; - CGRect _currentFrame; - BOOL _initialInsetsSent; -} - -- (void)safeAreaInsetsDidChange -{ - [self invalidateSafeAreaInsets]; -} - -- (void)invalidateSafeAreaInsets -{ - // This gets called before the view size is set by react-native so - // make sure to wait so we don't set wrong insets to JS. - if (CGSizeEqualToSize(self.frame.size, CGSizeZero)) { - return; - } - - UIEdgeInsets safeAreaInsets = self.safeAreaInsets; - CGRect frame = [self convertRect:self.bounds toView:nil]; - - if (_initialInsetsSent && - UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / ABI46_0_0RCTScreenScale()) && - CGRectEqualToRect(frame, _currentFrame)) { - return; - } - - _initialInsetsSent = YES; - _currentSafeAreaInsets = safeAreaInsets; - _currentFrame = frame; - - [NSNotificationCenter.defaultCenter - postNotificationName:ABI46_0_0RNCSafeAreaDidChange - object:self - userInfo:nil]; - - self.onInsetsChange(@{ - @"insets" : @{ - @"top" : @(safeAreaInsets.top), - @"right" : @(safeAreaInsets.right), - @"bottom" : @(safeAreaInsets.bottom), - @"left" : @(safeAreaInsets.left), - }, - @"frame" : @{ - @"x" : @(frame.origin.x), - @"y" : @(frame.origin.y), - @"width" : @(frame.size.width), - @"height" : @(frame.size.height), - }, - }); -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - [self invalidateSafeAreaInsets]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.h deleted file mode 100644 index fa6fd3246d9fc6..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaProviderManager : ABI46_0_0RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.m deleted file mode 100644 index b0179c92567605..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaProviderManager.m +++ /dev/null @@ -1,16 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaProviderManager.h" - -#import "ABI46_0_0RNCSafeAreaProvider.h" - -@implementation ABI46_0_0RNCSafeAreaProviderManager - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNCSafeAreaProvider) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onInsetsChange, ABI46_0_0RCTDirectEventBlock) - -- (UIView *)view -{ - return [ABI46_0_0RNCSafeAreaProvider new]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.h deleted file mode 100644 index 17b83e890f2560..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaShadowView : ABI46_0_0RCTShadowView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.m deleted file mode 100644 index 4eb403293b5f84..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaShadowView.m +++ /dev/null @@ -1,184 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaShadowView.h" - -#import -#include - -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import "ABI46_0_0RNCSafeAreaViewLocalData.h" -#import "ABI46_0_0RNCSafeAreaViewMode.h" - -// From ABI46_0_0RCTShadowView.m -typedef NS_ENUM(unsigned int, meta_prop_t) { - META_PROP_LEFT, - META_PROP_TOP, - META_PROP_RIGHT, - META_PROP_BOTTOM, - META_PROP_HORIZONTAL, - META_PROP_VERTICAL, - META_PROP_ALL, - META_PROP_COUNT, -}; - -@implementation ABI46_0_0RNCSafeAreaShadowView { - ABI46_0_0RNCSafeAreaViewLocalData *_localData; - bool _needsUpdate; - ABI46_0_0YGValue _paddingMetaProps[META_PROP_COUNT]; - ABI46_0_0YGValue _marginMetaProps[META_PROP_COUNT]; -} - -- (instancetype)init -{ - self = [super init]; - if (self) { - _needsUpdate = false; - for (unsigned int ii = 0; ii < META_PROP_COUNT; ii++) { - _paddingMetaProps[ii] = ABI46_0_0YGValueUndefined; - _marginMetaProps[ii] = ABI46_0_0YGValueUndefined; - } - } - return self; -} - -- (void)extractEdges:(ABI46_0_0YGValue[])_metaProps - top:(CGFloat *)top - right:(CGFloat *)right - bottom:(CGFloat *)bottom - left:(CGFloat *)left -{ - if (_metaProps[META_PROP_ALL].unit == ABI46_0_0YGUnitPoint) { - *top = _metaProps[META_PROP_ALL].value; - *right = _metaProps[META_PROP_ALL].value; - *bottom = _metaProps[META_PROP_ALL].value; - *left = _metaProps[META_PROP_ALL].value; - } - - if (_metaProps[META_PROP_HORIZONTAL].unit == ABI46_0_0YGUnitPoint) { - *right = _metaProps[META_PROP_HORIZONTAL].value; - *left = _metaProps[META_PROP_HORIZONTAL].value; - } - - if (_metaProps[META_PROP_VERTICAL].unit == ABI46_0_0YGUnitPoint) { - *top = _metaProps[META_PROP_VERTICAL].value; - *bottom = _metaProps[META_PROP_VERTICAL].value; - } - - if (_metaProps[META_PROP_TOP].unit == ABI46_0_0YGUnitPoint) { - *top = _metaProps[META_PROP_TOP].value; - } - - if (_metaProps[META_PROP_RIGHT].unit == ABI46_0_0YGUnitPoint) { - *right = _metaProps[META_PROP_RIGHT].value; - } - - if (_metaProps[META_PROP_BOTTOM].unit == ABI46_0_0YGUnitPoint) { - *bottom = _metaProps[META_PROP_BOTTOM].value; - } - - if (_metaProps[META_PROP_LEFT].unit == ABI46_0_0YGUnitPoint) { - *left = _metaProps[META_PROP_LEFT].value; - } -} - -- (void)resetInsetsForMode:(ABI46_0_0RNCSafeAreaViewMode)mode -{ - if (mode == ABI46_0_0RNCSafeAreaViewModePadding) { - super.paddingTop = _paddingMetaProps[META_PROP_TOP]; - super.paddingRight = _paddingMetaProps[META_PROP_RIGHT]; - super.paddingBottom = _paddingMetaProps[META_PROP_BOTTOM]; - super.paddingLeft = _paddingMetaProps[META_PROP_LEFT]; - } else if (mode == ABI46_0_0RNCSafeAreaViewModeMargin) { - super.marginTop = _marginMetaProps[META_PROP_TOP]; - super.marginRight = _marginMetaProps[META_PROP_RIGHT]; - super.marginBottom = _marginMetaProps[META_PROP_BOTTOM]; - super.marginLeft = _marginMetaProps[META_PROP_LEFT]; - } -} - -- (void)updateInsets -{ - if (_localData == nil) { - return; - } - - UIEdgeInsets insets = _localData.insets; - ABI46_0_0RNCSafeAreaViewMode mode = _localData.mode; - ABI46_0_0RNCSafeAreaViewEdges edges = _localData.edges; - - CGFloat top = 0; - CGFloat right = 0; - CGFloat bottom = 0; - CGFloat left = 0; - - CGFloat insetTop = (edges & ABI46_0_0RNCSafeAreaViewEdgesTop) ? insets.top : 0; - CGFloat insetRight = (edges & ABI46_0_0RNCSafeAreaViewEdgesRight) ? insets.right : 0; - CGFloat insetBottom = (edges & ABI46_0_0RNCSafeAreaViewEdgesBottom) ? insets.bottom : 0; - CGFloat insetLeft = (edges & ABI46_0_0RNCSafeAreaViewEdgesLeft) ? insets.left : 0; - - if (mode == ABI46_0_0RNCSafeAreaViewModePadding) { - [self extractEdges:_paddingMetaProps top:&top right:&right bottom:&bottom left:&left]; - super.paddingTop = (ABI46_0_0YGValue){insetTop + top, ABI46_0_0YGUnitPoint}; - super.paddingRight = (ABI46_0_0YGValue){insetRight + right, ABI46_0_0YGUnitPoint}; - super.paddingBottom = (ABI46_0_0YGValue){insetBottom + bottom, ABI46_0_0YGUnitPoint}; - super.paddingLeft = (ABI46_0_0YGValue){insetLeft + left, ABI46_0_0YGUnitPoint}; - } else if (mode == ABI46_0_0RNCSafeAreaViewModeMargin) { - [self extractEdges:_marginMetaProps top:&top right:&right bottom:&bottom left:&left]; - super.marginTop = (ABI46_0_0YGValue){insetTop + top, ABI46_0_0YGUnitPoint}; - super.marginRight = (ABI46_0_0YGValue){insetRight + right, ABI46_0_0YGUnitPoint}; - super.marginBottom = (ABI46_0_0YGValue){insetBottom + bottom, ABI46_0_0YGUnitPoint}; - super.marginLeft = (ABI46_0_0YGValue){insetLeft + left, ABI46_0_0YGUnitPoint}; - } -} - -- (void)didSetProps:(NSArray *)changedProps -{ - if (_needsUpdate) { - _needsUpdate = false; - [self updateInsets]; - } - [super didSetProps:changedProps]; -} - -- (void)setLocalData:(ABI46_0_0RNCSafeAreaViewLocalData *)localData -{ - ABI46_0_0RCTAssert( - [localData isKindOfClass:[ABI46_0_0RNCSafeAreaViewLocalData class]], - @"Local data object for `ABI46_0_0RCTRNCSafeAreaShadowView` must be `ABI46_0_0RCTRNCSafeAreaViewLocalData` instance."); - - if (_localData != nil && _localData.mode != localData.mode) { - [self resetInsetsForMode:_localData.mode]; - } - - _localData = localData; - _needsUpdate = false; - [self updateInsets]; - - if (_localData.mode == ABI46_0_0RNCSafeAreaViewModePadding) { - [super didSetProps:@[ @"paddingTop", @"paddingRight", @"paddingBottom", @"paddingLeft" ]]; - } else { - [super didSetProps:@[ @"marginTop", @"marginRight", @"marginBottom", @"marginLeft" ]]; - } -} - -#define SHADOW_VIEW_MARGIN_PADDING_PROP(edge, metaProp) \ - -(void)setPadding##edge : (ABI46_0_0YGValue)value \ - { \ - [super setPadding##edge:value]; \ - _needsUpdate = true; \ - _paddingMetaProps[META_PROP_##metaProp] = value; \ - } \ - -(void)setMargin##edge : (ABI46_0_0YGValue)value \ - { \ - [super setMargin##edge:value]; \ - _needsUpdate = true; \ - _marginMetaProps[META_PROP_##metaProp] = value; \ - } - -SHADOW_VIEW_MARGIN_PADDING_PROP(, ALL); -SHADOW_VIEW_MARGIN_PADDING_PROP(Vertical, VERTICAL); -SHADOW_VIEW_MARGIN_PADDING_PROP(Horizontal, HORIZONTAL); -SHADOW_VIEW_MARGIN_PADDING_PROP(Top, TOP); -SHADOW_VIEW_MARGIN_PADDING_PROP(Right, RIGHT); -SHADOW_VIEW_MARGIN_PADDING_PROP(Bottom, BOTTOM); -SHADOW_VIEW_MARGIN_PADDING_PROP(Left, LEFT); - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.h deleted file mode 100644 index 6b0de264b7482c..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.h +++ /dev/null @@ -1,8 +0,0 @@ -#import -#import -#import - -extern NSString * const ABI46_0_0RNCSafeAreaDidChange; - -ABI46_0_0RCT_EXTERN BOOL -UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold); diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.m deleted file mode 100644 index cfe227f51759a0..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaUtils.m +++ /dev/null @@ -1,11 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaUtils.h" - -#import - -NSString * const ABI46_0_0RNCSafeAreaDidChange = @"ABI46_0_0RNCSafeAreaDidChange"; - -BOOL UIEdgeInsetsEqualToEdgeInsetsWithThreshold(UIEdgeInsets insets1, UIEdgeInsets insets2, CGFloat threshold) -{ - return ABS(insets1.left - insets2.left) <= threshold && ABS(insets1.right - insets2.right) <= threshold && - ABS(insets1.top - insets2.top) <= threshold && ABS(insets1.bottom - insets2.bottom) <= threshold; -} diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.h deleted file mode 100644 index 74a9acdc0a650f..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.h +++ /dev/null @@ -1,21 +0,0 @@ -#import -#import -#import - -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import "ABI46_0_0RNCSafeAreaViewMode.h" - -NS_ASSUME_NONNULL_BEGIN - -@class ABI46_0_0RNCSafeAreaView; - -@interface ABI46_0_0RNCSafeAreaView : ABI46_0_0RCTView - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge; - -@property (nonatomic, assign) ABI46_0_0RNCSafeAreaViewMode mode; -@property (nonatomic, assign) ABI46_0_0RNCSafeAreaViewEdges edges; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.m deleted file mode 100644 index e37c6dd8f2a066..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaView.m +++ /dev/null @@ -1,125 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaView.h" - -#import -#import - -#import "ABI46_0_0RNCSafeAreaProvider.h" -#import "ABI46_0_0RNCSafeAreaUtils.h" -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import "ABI46_0_0RNCSafeAreaViewLocalData.h" -#import "ABI46_0_0RNCSafeAreaViewMode.h" - -@implementation ABI46_0_0RNCSafeAreaView { - __weak ABI46_0_0RCTBridge *_bridge; - UIEdgeInsets _currentSafeAreaInsets; - ABI46_0_0RNCSafeAreaViewMode _mode; - ABI46_0_0RNCSafeAreaViewEdges _edges; - __weak UIView *_Nullable _providerView; -} - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (self = [super initWithFrame:CGRectZero]) { - _bridge = bridge; - // Defaults - _mode = ABI46_0_0RNCSafeAreaViewModePadding; - _edges = ABI46_0_0RNCSafeAreaViewEdgesAll; - } - - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(-(instancetype)initWithCoder : (NSCoder *)decoder) -ABI46_0_0RCT_NOT_IMPLEMENTED(-(instancetype)initWithFrame : (CGRect)frame) - -- (NSString *)description -{ - NSString *superDescription = [super description]; - - // Cutting the last `>` character. - if (superDescription.length > 0 && [superDescription characterAtIndex:superDescription.length - 1] == '>') { - superDescription = [superDescription substringToIndex:superDescription.length - 1]; - } - - return [NSString stringWithFormat:@"%@; ABI46_0_0RNCSafeAreaInsets = %@; appliedRNCSafeAreaInsets = %@>", - superDescription, - NSStringFromUIEdgeInsets(_providerView.safeAreaInsets), - NSStringFromUIEdgeInsets(_currentSafeAreaInsets)]; -} - -- (void)didMoveToWindow -{ - UIView *previousProviderView = _providerView; - _providerView = [self findNearestProvider]; - - [self invalidateSafeAreaInsets]; - - if (previousProviderView != _providerView) { - [NSNotificationCenter.defaultCenter - removeObserver:self - name:ABI46_0_0RNCSafeAreaDidChange - object:previousProviderView]; - [NSNotificationCenter.defaultCenter - addObserver:self - selector:@selector(safeAreaProviderInsetsDidChange:) - name:ABI46_0_0RNCSafeAreaDidChange - object:_providerView]; - } -} - -- (void)safeAreaProviderInsetsDidChange:(NSNotification *)notification -{ - [self invalidateSafeAreaInsets]; -} - -- (void)invalidateSafeAreaInsets -{ - if (_providerView == nil) { - return; - } - UIEdgeInsets safeAreaInsets = _providerView.safeAreaInsets; - - if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / ABI46_0_0RCTScreenScale())) { - return; - } - - _currentSafeAreaInsets = safeAreaInsets; - [self updateLocalData]; -} - -- (UIView *)findNearestProvider -{ - UIView *current = self.ABI46_0_0ReactSuperview; - while (current != nil) { - if ([current isKindOfClass:ABI46_0_0RNCSafeAreaProvider.class]) { - return current; - } - current = current.ABI46_0_0ReactSuperview; - } - return self; -} - -- (void)updateLocalData -{ - if (_providerView == nil) { - return; - } - ABI46_0_0RNCSafeAreaViewLocalData *localData = [[ABI46_0_0RNCSafeAreaViewLocalData alloc] initWithInsets:_currentSafeAreaInsets - mode:_mode - edges:_edges]; - [_bridge.uiManager setLocalData:localData forView:self]; -} - -- (void)setMode:(ABI46_0_0RNCSafeAreaViewMode)mode -{ - _mode = mode; - [self updateLocalData]; -} - -- (void)setEdges:(ABI46_0_0RNCSafeAreaViewEdges)edges -{ - _edges = edges; - [self updateLocalData]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.h deleted file mode 100644 index 25d018e9887d9f..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNCSafeAreaViewEdges) { - ABI46_0_0RNCSafeAreaViewEdgesTop = 0b1000, - ABI46_0_0RNCSafeAreaViewEdgesRight = 0b0100, - ABI46_0_0RNCSafeAreaViewEdgesBottom = 0b0010, - ABI46_0_0RNCSafeAreaViewEdgesLeft = 0b0001, - ABI46_0_0RNCSafeAreaViewEdgesAll = 0b1111, -}; diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.m deleted file mode 100644 index 8db8bc1fd5ccf4..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewEdges.m +++ /dev/null @@ -1,17 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNCSafeAreaView) - -ABI46_0_0RCT_MULTI_ENUM_CONVERTER( - ABI46_0_0RNCSafeAreaViewEdges, - (@{ - @"top" : @(ABI46_0_0RNCSafeAreaViewEdgesTop), - @"right" : @(ABI46_0_0RNCSafeAreaViewEdgesRight), - @"bottom" : @(ABI46_0_0RNCSafeAreaViewEdgesBottom), - @"left" : @(ABI46_0_0RNCSafeAreaViewEdgesLeft), - }), - ABI46_0_0RNCSafeAreaViewEdgesAll, - integerValue); - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.h deleted file mode 100644 index 80a08a735e7668..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.h +++ /dev/null @@ -1,18 +0,0 @@ -#import - -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import "ABI46_0_0RNCSafeAreaViewMode.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaViewLocalData : NSObject - -- (instancetype)initWithInsets:(UIEdgeInsets)insets mode:(ABI46_0_0RNCSafeAreaViewMode)mode edges:(ABI46_0_0RNCSafeAreaViewEdges)edges; - -@property (atomic, readonly) UIEdgeInsets insets; -@property (atomic, readonly) ABI46_0_0RNCSafeAreaViewMode mode; -@property (atomic, readonly) ABI46_0_0RNCSafeAreaViewEdges edges; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.m deleted file mode 100644 index e92428473f33d2..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewLocalData.m +++ /dev/null @@ -1,16 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaViewLocalData.h" - -@implementation ABI46_0_0RNCSafeAreaViewLocalData - -- (instancetype)initWithInsets:(UIEdgeInsets)insets mode:(ABI46_0_0RNCSafeAreaViewMode)mode edges:(ABI46_0_0RNCSafeAreaViewEdges)edges -{ - if (self = [super init]) { - _insets = insets; - _mode = mode; - _edges = edges; - } - - return self; -} - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.h deleted file mode 100644 index 2a224bf1fc02d3..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaViewManager : ABI46_0_0RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.m deleted file mode 100644 index 9bd66619d36d57..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewManager.m +++ /dev/null @@ -1,25 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaViewManager.h" - -#import "ABI46_0_0RNCSafeAreaShadowView.h" -#import "ABI46_0_0RNCSafeAreaView.h" -#import "ABI46_0_0RNCSafeAreaViewEdges.h" -#import "ABI46_0_0RNCSafeAreaViewMode.h" - -@implementation ABI46_0_0RNCSafeAreaViewManager - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNCSafeAreaView) - -- (UIView *)view -{ - return [[ABI46_0_0RNCSafeAreaView alloc] initWithBridge:self.bridge]; -} - -- (ABI46_0_0RNCSafeAreaShadowView *)shadowView -{ - return [ABI46_0_0RNCSafeAreaShadowView new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mode, ABI46_0_0RNCSafeAreaViewMode) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(edges, ABI46_0_0RNCSafeAreaViewEdges) - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.h deleted file mode 100644 index 795ad05bea9447..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.h +++ /dev/null @@ -1,7 +0,0 @@ -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNCSafeAreaViewMode) { - ABI46_0_0RNCSafeAreaViewModePadding, - ABI46_0_0RNCSafeAreaViewModeMargin, - ABI46_0_0RNCSafeAreaViewModeBorder, -}; diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.m b/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.m deleted file mode 100644 index 6000ed9ae77da6..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/ABI46_0_0RNCSafeAreaViewMode.m +++ /dev/null @@ -1,15 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaViewMode.h" -#import - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNCSafeAreaView) - -ABI46_0_0RCT_MULTI_ENUM_CONVERTER( - ABI46_0_0RNCSafeAreaViewMode, - (@{ - @"padding" : @(ABI46_0_0RNCSafeAreaViewModePadding), - @"margin" : @(ABI46_0_0RNCSafeAreaViewModeMargin), - }), - ABI46_0_0RNCSafeAreaViewModePadding, - integerValue); - -@end diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.h deleted file mode 100644 index 202a7529074bab..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.h +++ /dev/null @@ -1,13 +0,0 @@ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaProviderComponentView : ABI46_0_0RCTViewComponentView - -extern NSString * const ABI46_0_0RNCSafeAreaDidChange; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.mm b/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.mm deleted file mode 100644 index 61245cfae8fb2f..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaProviderComponentView.mm +++ /dev/null @@ -1,108 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaProviderComponentView.h" - -#import -#import -#import -#import - -#import -#import "ABI46_0_0RNCSafeAreaUtils.h" - -using namespace ABI46_0_0facebook::react; - -@interface ABI46_0_0RNCSafeAreaProviderComponentView () -@end - -@implementation ABI46_0_0RNCSafeAreaProviderComponentView { - UIEdgeInsets _currentSafeAreaInsets; - CGRect _currentFrame; - BOOL _initialInsetsSent; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -- (void)safeAreaInsetsDidChange -{ - [self invalidateSafeAreaInsets]; -} - -- (void)invalidateSafeAreaInsets -{ - // This gets called before the view size is set by react-native so - // make sure to wait so we don't set wrong insets to JS. - if (CGSizeEqualToSize(self.frame.size, CGSizeZero)) { - return; - } - - UIEdgeInsets safeAreaInsets = self.safeAreaInsets; - CGRect frame = [self convertRect:self.bounds toView:nil]; - - if (_initialInsetsSent && - UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / ABI46_0_0RCTScreenScale()) && - CGRectEqualToRect(frame, _currentFrame)) { - return; - } - - _initialInsetsSent = YES; - _currentSafeAreaInsets = safeAreaInsets; - _currentFrame = frame; - - [NSNotificationCenter.defaultCenter postNotificationName:ABI46_0_0RNCSafeAreaDidChange object:self userInfo:nil]; - - if (_eventEmitter) { - ABI46_0_0RNCSafeAreaProviderEventEmitter::OnInsetsChange event = { - .insets = - { - .top = safeAreaInsets.top, - .left = safeAreaInsets.left, - .bottom = safeAreaInsets.bottom, - .right = safeAreaInsets.right, - }, - .frame = - { - .x = frame.origin.x, - .y = frame.origin.y, - .width = frame.size.width, - .height = frame.size.height, - }, - }; - std::static_pointer_cast(_eventEmitter)->onInsetsChange(event); - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - [self invalidateSafeAreaInsets]; -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -+ (ComponentDescriptorProvider)componentDescriptorProvider -{ - return concreteComponentDescriptorProvider(); -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - _currentSafeAreaInsets = UIEdgeInsetsZero; - _currentFrame = CGRectZero; - _initialInsetsSent = NO; -} - -@end - -Class ABI46_0_0RNCSafeAreaProviderCls(void) -{ - return ABI46_0_0RNCSafeAreaProviderComponentView.class; -} diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.h deleted file mode 100644 index b79cffa8d3c748..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.h +++ /dev/null @@ -1,11 +0,0 @@ -#import - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNCSafeAreaViewComponentView : ABI46_0_0RCTViewComponentView - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.mm b/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.mm deleted file mode 100644 index 5b88d577e387e3..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/Fabric/ABI46_0_0RNCSafeAreaViewComponentView.mm +++ /dev/null @@ -1,147 +0,0 @@ -#import "ABI46_0_0RNCSafeAreaViewComponentView.h" - -#import -#import -#import -#import -#import - -#import -#import - -#import "ABI46_0_0RNCSafeAreaProviderComponentView.h" -#import "ABI46_0_0RNCSafeAreaUtils.h" - -using namespace ABI46_0_0facebook::react; - -@interface ABI46_0_0RNCSafeAreaViewComponentView () -@end - -@implementation ABI46_0_0RNCSafeAreaViewComponentView { - ABI46_0_0RNCSafeAreaViewShadowNode::ConcreteState::Shared _state; - UIEdgeInsets _currentSafeAreaInsets; - __weak UIView *_Nullable _providerView; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -- (NSString *)description -{ - NSString *superDescription = [super description]; - - // Cutting the last `>` character. - if (superDescription.length > 0 && [superDescription characterAtIndex:superDescription.length - 1] == '>') { - superDescription = [superDescription substringToIndex:superDescription.length - 1]; - } - - return [NSString stringWithFormat:@"%@; ABI46_0_0RNCSafeAreaInsets = %@; appliedRNCSafeAreaInsets = %@>", - superDescription, - NSStringFromUIEdgeInsets(_providerView.safeAreaInsets), - NSStringFromUIEdgeInsets(_currentSafeAreaInsets)]; -} - -- (void)didMoveToWindow -{ - UIView *previousProviderView = _providerView; - _providerView = [self findNearestProvider]; - - [self updateStateIfNecessary]; - - if (previousProviderView != _providerView) { - [NSNotificationCenter.defaultCenter removeObserver:self name:ABI46_0_0RNCSafeAreaDidChange object:previousProviderView]; - [NSNotificationCenter.defaultCenter addObserver:self - selector:@selector(safeAreaProviderInsetsDidChange:) - name:ABI46_0_0RNCSafeAreaDidChange - object:_providerView]; - } -} - -- (void)safeAreaProviderInsetsDidChange:(NSNotification *)notification -{ - [self updateStateIfNecessary]; -} - -- (void)updateStateIfNecessary -{ - if (_providerView == nil) { - return; - } - UIEdgeInsets safeAreaInsets = _providerView.safeAreaInsets; - - if (UIEdgeInsetsEqualToEdgeInsetsWithThreshold(safeAreaInsets, _currentSafeAreaInsets, 1.0 / ABI46_0_0RCTScreenScale())) { - return; - } - - _currentSafeAreaInsets = safeAreaInsets; - [self updateState]; -} - -- (UIView *)findNearestProvider -{ - UIView *current = self.superview; - while (current != nil) { - if ([current isKindOfClass:ABI46_0_0RNCSafeAreaProviderComponentView.class]) { - return current; - } - current = current.superview; - } - return self; -} - -- (void)updateState -{ - if (!_state) { - return; - } - - _state->updateState( - [=](ABI46_0_0RNCSafeAreaViewShadowNode::ConcreteState::Data const &oldData) - -> ABI46_0_0RNCSafeAreaViewShadowNode::ConcreteState::SharedData { - auto newData = oldData; - newData.insets = ABI46_0_0RCTEdgeInsetsFromUIEdgeInsets(_currentSafeAreaInsets); - return std::make_shared(newData); - }); -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -+ (ComponentDescriptorProvider)componentDescriptorProvider -{ - return concreteComponentDescriptorProvider(); -} - -- (void)updateState:(State::Shared const &)state oldState:(State::Shared const &)oldState -{ - _state = std::static_pointer_cast(state); -} - -- (void)finalizeUpdates:(ABI46_0_0RNComponentViewUpdateMask)updateMask -{ - [super finalizeUpdates:updateMask]; - [self updateStateIfNecessary]; -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - - [NSNotificationCenter.defaultCenter removeObserver:self]; - _state.reset(); - _providerView = nil; - _currentSafeAreaInsets = UIEdgeInsetsZero; -} - -@end - -Class ABI46_0_0RNCSafeAreaViewCls(void) -{ - return ABI46_0_0RNCSafeAreaViewComponentView.class; -} diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec-generated.mm b/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec-generated.mm deleted file mode 100644 index 01c31a3c042e23..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec-generated.mm +++ /dev/null @@ -1,31 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleObjCpp - * - * We create an umbrella header (and corresponding implementation) here since - * Cxx compilation in BUCK has a limitation: source-code producing genrule()s - * must have a single output. More files => more genrule()s => slower builds. - */ - -#import "SafeAreaContextSpec.h" - - -namespace ABI46_0_0facebook { - namespace ABI46_0_0React { - - static ABI46_0_0facebook::jsi::Value __hostFunction_NativeSafeAreaContextSpecJSI_getConstants(ABI46_0_0facebook::jsi::Runtime& rt, TurboModule &turboModule, const ABI46_0_0facebook::jsi::Value* args, size_t count) { - return static_cast(turboModule).invokeObjCMethod(rt, ObjectKind, "getConstants", @selector(getConstants), args, count); - } - - NativeSafeAreaContextSpecJSI::NativeSafeAreaContextSpecJSI(const ObjCTurboModule::InitParams ¶ms) - : ObjCTurboModule(params) { - - methodMap_["getConstants"] = MethodMetadata {0, __hostFunction_NativeSafeAreaContextSpecJSI_getConstants}; - - } - } // namespace ABI46_0_0React -} // namespace ABI46_0_0facebook diff --git a/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec.h b/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec.h deleted file mode 100644 index 4c5395ae7406b8..00000000000000 --- a/ios/vendored/sdk46/react-native-safe-area-context/ios/SafeAreaContextSpec/SafeAreaContextSpec.h +++ /dev/null @@ -1,209 +0,0 @@ -/** - * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen). - * - * Do not edit this file as changes may cause incorrect behavior and will be lost - * once the code is regenerated. - * - * @generated by codegen project: GenerateModuleObjCpp - * - * We create an umbrella header (and corresponding implementation) here since - * Cxx compilation in BUCK has a limitation: source-code producing genrule()s - * must have a single output. More files => more genrule()s => slower builds. - */ - -#ifndef __cplusplus -#error This file must be compiled as Obj-C++. If you are importing it, you must change your file extension to .mm. -#endif -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -namespace JS { - namespace NativeSafeAreaContext { - struct ConstantsInitialWindowMetricsInsets { - - struct Builder { - struct Input { - ABI46_0_0RCTRequired top; - ABI46_0_0RCTRequired right; - ABI46_0_0RCTRequired bottom; - ABI46_0_0RCTRequired left; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing ConstantsInitialWindowMetricsInsets */ - Builder(ConstantsInitialWindowMetricsInsets i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static ConstantsInitialWindowMetricsInsets fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - ConstantsInitialWindowMetricsInsets(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -namespace JS { - namespace NativeSafeAreaContext { - struct ConstantsInitialWindowMetricsFrame { - - struct Builder { - struct Input { - ABI46_0_0RCTRequired x; - ABI46_0_0RCTRequired y; - ABI46_0_0RCTRequired width; - ABI46_0_0RCTRequired height; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing ConstantsInitialWindowMetricsFrame */ - Builder(ConstantsInitialWindowMetricsFrame i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static ConstantsInitialWindowMetricsFrame fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - ConstantsInitialWindowMetricsFrame(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -namespace JS { - namespace NativeSafeAreaContext { - struct ConstantsInitialWindowMetrics { - - struct Builder { - struct Input { - ABI46_0_0RCTRequired insets; - ABI46_0_0RCTRequired frame; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing ConstantsInitialWindowMetrics */ - Builder(ConstantsInitialWindowMetrics i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static ConstantsInitialWindowMetrics fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - ConstantsInitialWindowMetrics(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -namespace JS { - namespace NativeSafeAreaContext { - struct Constants { - - struct Builder { - struct Input { - std::optional initialWindowMetrics; - }; - - /** Initialize with a set of values */ - Builder(const Input i); - /** Initialize with an existing Constants */ - Builder(Constants i); - /** Builds the object. Generally used only by the infrastructure. */ - NSDictionary *buildUnsafeRawValue() const { return _factory(); }; - private: - NSDictionary *(^_factory)(void); - }; - - static Constants fromUnsafeRawValue(NSDictionary *const v) { return {v}; } - NSDictionary *unsafeRawValue() const { return _v; } - private: - Constants(NSDictionary *const v) : _v(v) {} - NSDictionary *_v; - }; - } -} -@protocol NativeSafeAreaContextSpec - -- (ABI46_0_0facebook::ABI46_0_0React::ModuleConstants)constantsToExport; -- (ABI46_0_0facebook::ABI46_0_0React::ModuleConstants)getConstants; - -@end -namespace ABI46_0_0facebook { - namespace ABI46_0_0React { - /** - * ObjC++ class for module 'NativeSafeAreaContext' - */ - class JSI_EXPORT NativeSafeAreaContextSpecJSI : public ObjCTurboModule { - public: - NativeSafeAreaContextSpecJSI(const ObjCTurboModule::InitParams ¶ms); - }; - } // namespace ABI46_0_0React -} // namespace ABI46_0_0facebook -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetricsInsets::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto top = i.top.get(); - d[@"top"] = @(top); - auto right = i.right.get(); - d[@"right"] = @(right); - auto bottom = i.bottom.get(); - d[@"bottom"] = @(bottom); - auto left = i.left.get(); - d[@"left"] = @(left); - return d; -}) {} -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetricsInsets::Builder::Builder(ConstantsInitialWindowMetricsInsets i) : _factory(^{ - return i.unsafeRawValue(); -}) {} -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetricsFrame::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto x = i.x.get(); - d[@"x"] = @(x); - auto y = i.y.get(); - d[@"y"] = @(y); - auto width = i.width.get(); - d[@"width"] = @(width); - auto height = i.height.get(); - d[@"height"] = @(height); - return d; -}) {} -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetricsFrame::Builder::Builder(ConstantsInitialWindowMetricsFrame i) : _factory(^{ - return i.unsafeRawValue(); -}) {} -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetrics::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto insets = i.insets.get(); - d[@"insets"] = insets.buildUnsafeRawValue(); - auto frame = i.frame.get(); - d[@"frame"] = frame.buildUnsafeRawValue(); - return d; -}) {} -inline JS::NativeSafeAreaContext::ConstantsInitialWindowMetrics::Builder::Builder(ConstantsInitialWindowMetrics i) : _factory(^{ - return i.unsafeRawValue(); -}) {} -inline JS::NativeSafeAreaContext::Constants::Builder::Builder(const Input i) : _factory(^{ - NSMutableDictionary *d = [NSMutableDictionary new]; - auto initialWindowMetrics = i.initialWindowMetrics; - d[@"initialWindowMetrics"] = initialWindowMetrics.has_value() ? initialWindowMetrics.value().buildUnsafeRawValue() : nil; - return d; -}) {} -inline JS::NativeSafeAreaContext::Constants::Builder::Builder(Constants i) : _factory(^{ - return i.unsafeRawValue(); -}) {} diff --git a/ios/vendored/sdk46/react-native-screens/ABI46_0_0RNScreens.podspec.json b/ios/vendored/sdk46/react-native-screens/ABI46_0_0RNScreens.podspec.json deleted file mode 100644 index 3799168803dd1b..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ABI46_0_0RNScreens.podspec.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "ABI46_0_0RNScreens", - "version": "3.15.0", - "summary": "Native navigation primitives for your ABI46_0_0React Native app.", - "description": "ABI46_0_0RNScreens - first incomplete navigation solution for your ABI46_0_0React Native app", - "homepage": "https://github.com/software-mansion/react-native-screens", - "license": "MIT", - "authors": { - "author": "author@domain.cn" - }, - "platforms": { - "ios": "9.0", - "tvos": "11.0" - }, - "source": { - "git": "https://github.com/software-mansion/react-native-screens.git", - "tag": "3.15.0" - }, - "source_files": "ios/**/*.{h,m,mm}", - "requires_arc": true, - "dependencies": { - "ABI46_0_0React-Core": [], - "ABI46_0_0React-RCTImage": [] - } -} diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.h deleted file mode 100644 index 716b51fef96b61..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.h +++ /dev/null @@ -1,30 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#import "ABI46_0_0RNSEnums.h" - -@interface ABI46_0_0RNSConvert : NSObject - -+ (ABI46_0_0RNSScreenStackPresentation)ABI46_0_0RNSScreenStackPresentationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation)stackPresentation; - -+ (ABI46_0_0RNSScreenStackAnimation)ABI46_0_0RNSScreenStackAnimationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation)stackAnimation; - -+ (ABI46_0_0RNSScreenStackHeaderSubviewType)ABI46_0_0RNSScreenStackHeaderSubviewTypeFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType)subviewType; - -+ (ABI46_0_0RNSScreenReplaceAnimation)ABI46_0_0RNSScreenReplaceAnimationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenReplaceAnimation)replaceAnimation; - -+ (ABI46_0_0RNSScreenSwipeDirection)ABI46_0_0RNSScreenSwipeDirectionFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenSwipeDirection)swipeDirection; - -+ (NSDictionary *)gestureResponseDistanceDictFromCppStruct: - (const ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenGestureResponseDistanceStruct &)gestureResponseDistance; - -+ (UITextAutocapitalizationType)UITextAutocapitalizationTypeFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize)autoCapitalize; - -@end - -#endif // RN_FABRIC_ENABLED diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.mm deleted file mode 100644 index 386420a09a71db..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSConvert.mm +++ /dev/null @@ -1,120 +0,0 @@ -#import "ABI46_0_0RNSConvert.h" - -#ifdef RN_FABRIC_ENABLED -@implementation ABI46_0_0RNSConvert - -+ (ABI46_0_0RNSScreenStackPresentation)ABI46_0_0RNSScreenStackPresentationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation)stackPresentation -{ - switch (stackPresentation) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::Push: - return ABI46_0_0RNSScreenStackPresentationPush; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::Modal: - return ABI46_0_0RNSScreenStackPresentationModal; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::FullScreenModal: - return ABI46_0_0RNSScreenStackPresentationFullScreenModal; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::FormSheet: - return ABI46_0_0RNSScreenStackPresentationFormSheet; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::ContainedModal: - return ABI46_0_0RNSScreenStackPresentationContainedModal; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::TransparentModal: - return ABI46_0_0RNSScreenStackPresentationTransparentModal; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackPresentation::ContainedTransparentModal: - return ABI46_0_0RNSScreenStackPresentationContainedTransparentModal; - } -} - -+ (ABI46_0_0RNSScreenStackAnimation)ABI46_0_0RNSScreenStackAnimationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation)stackAnimation -{ - switch (stackAnimation) { - // these three are intentionally grouped - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Slide_from_right: - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Slide_from_left: - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Default: - return ABI46_0_0RNSScreenStackAnimationDefault; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Flip: - return ABI46_0_0RNSScreenStackAnimationFlip; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Simple_push: - return ABI46_0_0RNSScreenStackAnimationSimplePush; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::None: - return ABI46_0_0RNSScreenStackAnimationNone; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Fade: - return ABI46_0_0RNSScreenStackAnimationFade; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Slide_from_bottom: - return ABI46_0_0RNSScreenStackAnimationSlideFromBottom; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackAnimation::Fade_from_bottom: - return ABI46_0_0RNSScreenStackAnimationFadeFromBottom; - } -} - -+ (ABI46_0_0RNSScreenStackHeaderSubviewType)ABI46_0_0RNSScreenStackHeaderSubviewTypeFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType)subviewType -{ - switch (subviewType) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::Left: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeLeft; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::Right: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeRight; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::Title: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeTitle; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::Center: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeCenter; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::SearchBar: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeSearchBar; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewType::Back: - return ABI46_0_0RNSScreenStackHeaderSubviewTypeBackButton; - } -} - -+ (ABI46_0_0RNSScreenReplaceAnimation)ABI46_0_0RNSScreenReplaceAnimationFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenReplaceAnimation)replaceAnimation -{ - switch (replaceAnimation) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenReplaceAnimation::Pop: - return ABI46_0_0RNSScreenReplaceAnimationPop; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenReplaceAnimation::Push: - return ABI46_0_0RNSScreenReplaceAnimationPush; - } -} - -+ (ABI46_0_0RNSScreenSwipeDirection)ABI46_0_0RNSScreenSwipeDirectionFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenSwipeDirection)swipeDirection -{ - switch (swipeDirection) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenSwipeDirection::Horizontal: - return ABI46_0_0RNSScreenSwipeDirectionHorizontal; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenSwipeDirection::Vertical: - return ABI46_0_0RNSScreenSwipeDirectionVertical; - } -} - -+ (NSDictionary *)gestureResponseDistanceDictFromCppStruct: - (const ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenGestureResponseDistanceStruct &)gestureResponseDistance -{ - return @{ - @"start" : @(gestureResponseDistance.start), - @"end" : @(gestureResponseDistance.end), - @"top" : @(gestureResponseDistance.top), - @"bottom" : @(gestureResponseDistance.bottom), - }; -} - -+ (UITextAutocapitalizationType)UITextAutocapitalizationTypeFromCppEquivalent: - (ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize)autoCapitalize -{ - switch (autoCapitalize) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize::Words: - return UITextAutocapitalizationTypeWords; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize::Sentences: - return UITextAutocapitalizationTypeSentences; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize::Characters: - return UITextAutocapitalizationTypeAllCharacters; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarAutoCapitalize::None: - return UITextAutocapitalizationTypeNone; - } -} - -@end - -#endif // RN_FABRIC_ENABLED diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSEnums.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSEnums.h deleted file mode 100644 index 9041f4f663daf8..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSEnums.h +++ /dev/null @@ -1,59 +0,0 @@ -typedef NS_ENUM(NSInteger, ABI46_0_0RNSScreenStackPresentation) { - ABI46_0_0RNSScreenStackPresentationPush, - ABI46_0_0RNSScreenStackPresentationModal, - ABI46_0_0RNSScreenStackPresentationTransparentModal, - ABI46_0_0RNSScreenStackPresentationContainedModal, - ABI46_0_0RNSScreenStackPresentationContainedTransparentModal, - ABI46_0_0RNSScreenStackPresentationFullScreenModal, - ABI46_0_0RNSScreenStackPresentationFormSheet -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSScreenStackAnimation) { - ABI46_0_0RNSScreenStackAnimationDefault, - ABI46_0_0RNSScreenStackAnimationNone, - ABI46_0_0RNSScreenStackAnimationFade, - ABI46_0_0RNSScreenStackAnimationFadeFromBottom, - ABI46_0_0RNSScreenStackAnimationFlip, - ABI46_0_0RNSScreenStackAnimationSlideFromBottom, - ABI46_0_0RNSScreenStackAnimationSimplePush, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSScreenReplaceAnimation) { - ABI46_0_0RNSScreenReplaceAnimationPop, - ABI46_0_0RNSScreenReplaceAnimationPush, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSScreenSwipeDirection) { - ABI46_0_0RNSScreenSwipeDirectionHorizontal, - ABI46_0_0RNSScreenSwipeDirectionVertical, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSActivityState) { - ABI46_0_0RNSActivityStateInactive = 0, - ABI46_0_0RNSActivityStateTransitioningOrBelowTop = 1, - ABI46_0_0RNSActivityStateOnTop = 2 -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSStatusBarStyle) { - ABI46_0_0RNSStatusBarStyleAuto, - ABI46_0_0RNSStatusBarStyleInverted, - ABI46_0_0RNSStatusBarStyleLight, - ABI46_0_0RNSStatusBarStyleDark, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSWindowTrait) { - ABI46_0_0RNSWindowTraitStyle, - ABI46_0_0RNSWindowTraitAnimation, - ABI46_0_0RNSWindowTraitHidden, - ABI46_0_0RNSWindowTraitOrientation, - ABI46_0_0RNSWindowTraitHomeIndicatorHidden, -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSScreenStackHeaderSubviewType) { - ABI46_0_0RNSScreenStackHeaderSubviewTypeBackButton, - ABI46_0_0RNSScreenStackHeaderSubviewTypeLeft, - ABI46_0_0RNSScreenStackHeaderSubviewTypeRight, - ABI46_0_0RNSScreenStackHeaderSubviewTypeTitle, - ABI46_0_0RNSScreenStackHeaderSubviewTypeCenter, - ABI46_0_0RNSScreenStackHeaderSubviewTypeSearchBar, -}; diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.h deleted file mode 100644 index 2d40b91c113485..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.h +++ /dev/null @@ -1,30 +0,0 @@ -#import - -#ifdef RN_FABRIC_ENABLED -#import -#else -#import -#import -#endif - -@interface ABI46_0_0RNSFullWindowOverlayManager : ABI46_0_0RCTViewManager - -@end - -@interface ABI46_0_0RNSFullWindowOverlayContainer : UIView - -@end - -@interface ABI46_0_0RNSFullWindowOverlay : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - ABI46_0_0RCTView -#endif // RN_FABRIC_ENABLED - -#ifdef RN_FABRIC_ENABLED -@property (nonatomic) ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics oldLayoutMetrics; -@property (nonatomic) ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics newLayoutMetrics; -#endif // RN_FABRIC_ENABLED - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.mm deleted file mode 100644 index a40086ed6c497e..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSFullWindowOverlay.mm +++ /dev/null @@ -1,199 +0,0 @@ -#import - -#import "ABI46_0_0RNSFullWindowOverlay.h" - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#else -#import -#endif // RN_FABRIC_ENABLED - -@implementation ABI46_0_0RNSFullWindowOverlayContainer - -- (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event -{ - for (UIView *view in [self subviews]) { - if (view.userInteractionEnabled && [view pointInside:[self convertPoint:point toView:view] withEvent:event]) { - return YES; - } - } - return NO; -} - -@end - -@implementation ABI46_0_0RNSFullWindowOverlay { - __weak ABI46_0_0RCTBridge *_bridge; - ABI46_0_0RNSFullWindowOverlayContainer *_container; - CGRect _reactFrame; -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTSurfaceTouchHandler *_touchHandler; -#else - ABI46_0_0RCTTouchHandler *_touchHandler; -#endif // RN_FABRIC_ENABLED -} - -#ifdef RN_FABRIC_ENABLED -- (instancetype)init -{ - if (self = [super init]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - [self _initCommon]; - } - return self; -} -#endif // RN_FABRIC_ENABLED - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - [self _initCommon]; - } - - return self; -} - -- (void)_initCommon -{ - _reactFrame = CGRectNull; - _container = self.container; - [self show]; -} - -- (void)addSubview:(UIView *)view -{ - [_container addSubview:view]; -} - -- (ABI46_0_0RNSFullWindowOverlayContainer *)container -{ - if (_container == nil) { - _container = [[ABI46_0_0RNSFullWindowOverlayContainer alloc] initWithFrame:_reactFrame]; - } - - return _container; -} - -- (void)show -{ - UIWindow *window = ABI46_0_0RCTSharedApplication().delegate.window; - [window addSubview:_container]; -} - -- (void)didMoveToWindow -{ - if (self.window == nil) { - if (_container != nil) { - [_container removeFromSuperview]; - [_touchHandler detachFromView:_container]; - } - } else { - if (_touchHandler == nil) { -#ifdef RN_FABRIC_ENABLED - _touchHandler = [ABI46_0_0RCTSurfaceTouchHandler new]; -#else - _touchHandler = [[ABI46_0_0RCTTouchHandler alloc] initWithBridge:_bridge]; -#endif - } - [_touchHandler attachToView:_container]; - } -} - -#ifdef RN_FABRIC_ENABLED -#pragma mark - Fabric Specific - -// When the component unmounts we remove it from window's children, -// so when the component gets recycled we need to add it back. -- (void)maybeShow -{ - UIWindow *window = ABI46_0_0RCTSharedApplication().delegate.window; - if (![[window subviews] containsObject:self]) { - [window addSubview:_container]; - } -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider< - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSFullWindowOverlayComponentDescriptor>(); -} - -- (void)prepareForRecycle -{ - [_container removeFromSuperview]; - // Due to view recycling we don't really want to set _container = nil - // as it won't be instantiated when the component appears for the second time. - // We could consider nulling in here & using container (lazy getter) everywhere else. - // _container = nil; - [super prepareForRecycle]; -} - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - // When the component unmounts we remove it from window's children, - // so when the component gets recycled we need to add it back. - // As for now it is called here as we lack of method that is called - // just before component gets restored (from recycle pool). - [self maybeShow]; - [self addSubview:childComponentView]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - [childComponentView removeFromSuperview]; -} - -- (void)updateLayoutMetrics:(ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics const &)layoutMetrics - oldLayoutMetrics:(ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics const &)oldLayoutMetrics -{ - CGRect frame = ABI46_0_0RCTCGRectFromRect(layoutMetrics.frame); - _reactFrame = frame; - [_container setFrame:frame]; -} - -#else -#pragma mark - Paper specific - -- (void)ABI46_0_0ReactSetFrame:(CGRect)frame -{ - _reactFrame = frame; - [_container setFrame:frame]; -} - -- (void)invalidate -{ - [_container removeFromSuperview]; - _container = nil; -} - -#endif // RN_FABRIC_ENABLED - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSFullWindowOverlayCls(void) -{ - return ABI46_0_0RNSFullWindowOverlay.class; -} -#endif // RN_FABRIC_ENABLED - -@implementation ABI46_0_0RNSFullWindowOverlayManager - -ABI46_0_0RCT_EXPORT_MODULE() - -#ifdef RN_FABRIC_ENABLED -#else -- (UIView *)view -{ - return [[ABI46_0_0RNSFullWindowOverlay alloc] initWithBridge:self.bridge]; -} -#endif // RN_FABRIC_ENABLED - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.h deleted file mode 100644 index c40b43b459817e..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.h +++ /dev/null @@ -1,117 +0,0 @@ -#import -#import - -#import "ABI46_0_0RNSEnums.h" -#import "ABI46_0_0RNSScreenContainer.h" - -#if RN_FABRIC_ENABLED -#import -#else -#import -#endif - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RCTConvert (ABI46_0_0RNSScreen) - -+ (ABI46_0_0RNSScreenStackPresentation)ABI46_0_0RNSScreenStackPresentation:(id)json; -+ (ABI46_0_0RNSScreenStackAnimation)ABI46_0_0RNSScreenStackAnimation:(id)json; - -#if !TARGET_OS_TV -+ (ABI46_0_0RNSStatusBarStyle)ABI46_0_0RNSStatusBarStyle:(id)json; -+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; -+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json; -#endif - -@end - -@class ABI46_0_0RNSScreenView; - -@interface ABI46_0_0RNSScreen : UIViewController - -- (instancetype)initWithView:(UIView *)view; -- (UIViewController *)findChildVCForConfigAndTrait:(ABI46_0_0RNSWindowTrait)trait includingModals:(BOOL)includingModals; -- (void)notifyFinishTransitioning; -- (ABI46_0_0RNSScreenView *)screenView; -#ifdef RN_FABRIC_ENABLED -- (void)setViewToSnapshot:(UIView *)snapshot; -- (void)resetViewToScreen; -#endif - -@end - -@interface ABI46_0_0RNSScreenView : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - ABI46_0_0RCTView -#endif - -@property (nonatomic) BOOL fullScreenSwipeEnabled; -@property (nonatomic) BOOL gestureEnabled; -@property (nonatomic) BOOL hasStatusBarHiddenSet; -@property (nonatomic) BOOL hasStatusBarStyleSet; -@property (nonatomic) BOOL hasStatusBarAnimationSet; -@property (nonatomic) BOOL hasHomeIndicatorHiddenSet; -@property (nonatomic) BOOL hasOrientationSet; -@property (nonatomic) ABI46_0_0RNSScreenStackAnimation stackAnimation; -@property (nonatomic) ABI46_0_0RNSScreenStackPresentation stackPresentation; -@property (nonatomic) ABI46_0_0RNSScreenSwipeDirection swipeDirection; -@property (nonatomic) ABI46_0_0RNSScreenReplaceAnimation replaceAnimation; -@property (nonatomic, retain) NSNumber *transitionDuration; -@property (nonatomic, readonly) BOOL dismissed; -@property (nonatomic) BOOL hideKeyboardOnSwipe; -@property (nonatomic) BOOL customAnimationOnSwipe; -@property (nonatomic) BOOL preventNativeDismiss; -@property (nonatomic, retain) ABI46_0_0RNSScreen *controller; -@property (nonatomic, copy) NSDictionary *gestureResponseDistance; -@property (nonatomic) int activityState; -@property (weak, nonatomic) UIView *ABI46_0_0ReactSuperview; - -#if !TARGET_OS_TV -@property (nonatomic) ABI46_0_0RNSStatusBarStyle statusBarStyle; -@property (nonatomic) UIStatusBarAnimation statusBarAnimation; -@property (nonatomic) UIInterfaceOrientationMask screenOrientation; -@property (nonatomic) BOOL statusBarHidden; -@property (nonatomic) BOOL homeIndicatorHidden; -#endif - -#ifdef RN_FABRIC_ENABLED -// we recreate the behavior of `ABI46_0_0ReactSetFrame` on new architecture -@property (nonatomic) ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics oldLayoutMetrics; -@property (nonatomic) ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics newLayoutMetrics; -@property (weak, nonatomic) UIView *config; -#else -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onAppear; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDisappear; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDismissed; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onWillAppear; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onWillDisappear; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onNativeDismissCancelled; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onTransitionProgress; -#endif - -- (void)notifyFinishTransitioning; - -#ifdef RN_FABRIC_ENABLED -- (void)notifyWillAppear; -- (void)notifyWillDisappear; -- (void)notifyAppear; -- (void)notifyDisappear; -- (void)updateBounds; -- (void)notifyDismissedWithCount:(int)dismissCount; -#endif - -- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward; - -@end - -@interface UIView (ABI46_0_0RNSScreen) -- (UIViewController *)parentViewController; -@end - -@interface ABI46_0_0RNSScreenManager : ABI46_0_0RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.mm deleted file mode 100644 index ef06f6eb1e34c4..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreen.mm +++ /dev/null @@ -1,1284 +0,0 @@ -#import - -#import "ABI46_0_0RNSScreen.h" -#import "ABI46_0_0RNSScreenContainer.h" -#import "ABI46_0_0RNSScreenWindowTraits.h" - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#import "ABI46_0_0RNSConvert.h" -#import "ABI46_0_0RNSScreenViewEvent.h" -#else -#import -#endif - -#import -#import -#import "ABI46_0_0RNSScreenStack.h" -#import "ABI46_0_0RNSScreenStackHeaderConfig.h" - -@interface ABI46_0_0RNSScreenView () -#ifdef RN_FABRIC_ENABLED - -#else - -#endif -@end - -@implementation ABI46_0_0RNSScreenView { - __weak ABI46_0_0RCTBridge *_bridge; -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTSurfaceTouchHandler *_touchHandler; - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenShadowNode::ConcreteState::Shared _state; - // on fabric, they are not available by default so we need them exposed here too - NSMutableArray *_ABI46_0_0ReactSubviews; -#else - ABI46_0_0RCTTouchHandler *_touchHandler; - CGRect _reactFrame; -#endif -} - -#ifdef RN_FABRIC_ENABLED -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - [self initCommonProps]; - } - - return self; -} -#endif - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - [self initCommonProps]; - } - - return self; -} - -- (void)initCommonProps -{ - _controller = [[ABI46_0_0RNSScreen alloc] initWithView:self]; - _stackPresentation = ABI46_0_0RNSScreenStackPresentationPush; - _stackAnimation = ABI46_0_0RNSScreenStackAnimationDefault; - _gestureEnabled = YES; - _replaceAnimation = ABI46_0_0RNSScreenReplaceAnimationPop; - _dismissed = NO; - _hasStatusBarStyleSet = NO; - _hasStatusBarAnimationSet = NO; - _hasStatusBarHiddenSet = NO; - _hasOrientationSet = NO; - _hasHomeIndicatorHiddenSet = NO; -} - -- (UIViewController *)ABI46_0_0ReactViewController -{ - return _controller; -} - -#ifdef RN_FABRIC_ENABLED -- (NSArray *)ABI46_0_0ReactSubviews -{ - return _ABI46_0_0ReactSubviews; -} -#endif - -- (void)updateBounds -{ -#ifdef RN_FABRIC_ENABLED - if (_state != nullptr) { - auto newState = ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenState{ABI46_0_0RCTSizeFromCGSize(self.bounds.size)}; - _state->updateState(std::move(newState)); - UINavigationController *navctr = _controller.navigationController; - [navctr.view setNeedsLayout]; - } -#else - [_bridge.uiManager setSize:self.bounds.size forView:self]; -#endif -} - -- (void)setStackPresentation:(ABI46_0_0RNSScreenStackPresentation)stackPresentation -{ - switch (stackPresentation) { - case ABI46_0_0RNSScreenStackPresentationModal: -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, tvOS 13.0, *)) { - _controller.modalPresentationStyle = UIModalPresentationAutomatic; - } else { - _controller.modalPresentationStyle = UIModalPresentationFullScreen; - } -#else - _controller.modalPresentationStyle = UIModalPresentationFullScreen; -#endif - break; - case ABI46_0_0RNSScreenStackPresentationFullScreenModal: - _controller.modalPresentationStyle = UIModalPresentationFullScreen; - break; -#if !TARGET_OS_TV - case ABI46_0_0RNSScreenStackPresentationFormSheet: - _controller.modalPresentationStyle = UIModalPresentationFormSheet; - break; -#endif - case ABI46_0_0RNSScreenStackPresentationTransparentModal: - _controller.modalPresentationStyle = UIModalPresentationOverFullScreen; - break; - case ABI46_0_0RNSScreenStackPresentationContainedModal: - _controller.modalPresentationStyle = UIModalPresentationCurrentContext; - break; - case ABI46_0_0RNSScreenStackPresentationContainedTransparentModal: - _controller.modalPresentationStyle = UIModalPresentationOverCurrentContext; - break; - case ABI46_0_0RNSScreenStackPresentationPush: - // ignored, we only need to keep in mind not to set presentation delegate - break; - } - // There is a bug in UIKit which causes retain loop when presentationController is accessed for a - // controller that is not going to be presented modally. We therefore need to avoid setting the - // delegate for screens presented using push. This also means that when controller is updated from - // modal to push type, this may cause memory leak, we warn about that as well. - if (stackPresentation != ABI46_0_0RNSScreenStackPresentationPush) { - // `modalPresentationStyle` must be set before accessing `presentationController` - // otherwise a default controller will be created and cannot be changed after. - // Documented here: - // https://developer.apple.com/documentation/uikit/uiviewcontroller/1621426-presentationcontroller?language=objc - _controller.presentationController.delegate = self; - } else if (_stackPresentation != ABI46_0_0RNSScreenStackPresentationPush) { -#ifdef RN_FABRIC_ENABLED - // TODO: on Fabric, same controllers can be used as modals and then recycled and used a push which would result in - // this error. It would be good to check if it doesn't leak in such case. -#else - ABI46_0_0RCTLogError( - @"Screen presentation updated from modal to push, this may likely result in a screen object leakage. If you need to change presentation style create a new screen object instead"); -#endif - } - _stackPresentation = stackPresentation; -} - -- (void)setStackAnimation:(ABI46_0_0RNSScreenStackAnimation)stackAnimation -{ - _stackAnimation = stackAnimation; - - switch (stackAnimation) { - case ABI46_0_0RNSScreenStackAnimationFade: - _controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; - break; -#if !TARGET_OS_TV - case ABI46_0_0RNSScreenStackAnimationFlip: - _controller.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; - break; -#endif - case ABI46_0_0RNSScreenStackAnimationNone: - case ABI46_0_0RNSScreenStackAnimationDefault: - case ABI46_0_0RNSScreenStackAnimationSimplePush: - case ABI46_0_0RNSScreenStackAnimationSlideFromBottom: - case ABI46_0_0RNSScreenStackAnimationFadeFromBottom: - // Default - break; - } -} - -- (void)setGestureEnabled:(BOOL)gestureEnabled -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, tvOS 13.0, *)) { - _controller.modalInPresentation = !gestureEnabled; - } -#endif - - _gestureEnabled = gestureEnabled; -} - -- (void)setReplaceAnimation:(ABI46_0_0RNSScreenReplaceAnimation)replaceAnimation -{ - _replaceAnimation = replaceAnimation; -} - -// Nil will be provided when activityState is set as an animated value and we change -// it from JS to be a plain value (non animated). -// In case when nil is received, we want to ignore such value and not make -// any updates as the actual non-nil value will follow immediately. -- (void)setActivityStateOrNil:(NSNumber *)activityStateOrNil -{ - int activityState = [activityStateOrNil intValue]; - if (activityStateOrNil != nil && activityState != -1 && activityState != _activityState) { - _activityState = activityState; - [_ABI46_0_0ReactSuperview markChildUpdated]; - } -} - -#if !TARGET_OS_TV -- (void)setStatusBarStyle:(ABI46_0_0RNSStatusBarStyle)statusBarStyle -{ - _hasStatusBarStyleSet = YES; - _statusBarStyle = statusBarStyle; - [ABI46_0_0RNSScreenWindowTraits assertViewControllerBasedStatusBarAppearenceSet]; - [ABI46_0_0RNSScreenWindowTraits updateStatusBarAppearance]; -} - -- (void)setStatusBarAnimation:(UIStatusBarAnimation)statusBarAnimation -{ - _hasStatusBarAnimationSet = YES; - _statusBarAnimation = statusBarAnimation; - [ABI46_0_0RNSScreenWindowTraits assertViewControllerBasedStatusBarAppearenceSet]; -} - -- (void)setStatusBarHidden:(BOOL)statusBarHidden -{ - _hasStatusBarHiddenSet = YES; - _statusBarHidden = statusBarHidden; - [ABI46_0_0RNSScreenWindowTraits assertViewControllerBasedStatusBarAppearenceSet]; - [ABI46_0_0RNSScreenWindowTraits updateStatusBarAppearance]; -} - -- (void)setScreenOrientation:(UIInterfaceOrientationMask)screenOrientation -{ - _hasOrientationSet = YES; - _screenOrientation = screenOrientation; - [ABI46_0_0RNSScreenWindowTraits enforceDesiredDeviceOrientation]; -} - -- (void)setHomeIndicatorHidden:(BOOL)homeIndicatorHidden -{ - _hasHomeIndicatorHiddenSet = YES; - _homeIndicatorHidden = homeIndicatorHidden; - [ABI46_0_0RNSScreenWindowTraits updateHomeIndicatorAutoHidden]; -} -#endif - -- (UIView *)ABI46_0_0ReactSuperview -{ - return _ABI46_0_0ReactSuperview; -} - -- (void)addSubview:(UIView *)view -{ - if (![view isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - [super addSubview:view]; - } else { - ((ABI46_0_0RNSScreenStackHeaderConfig *)view).screenView = self; - } -} - -- (void)notifyDismissedWithCount:(int)dismissCount -{ -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onDismissed(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnDismissed{.dismissCount = dismissCount}); - } -#else - // TODO: hopefully problems connected to dismissed prop are only the case on paper - _dismissed = YES; - if (self.onDismissed) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.onDismissed) { - self.onDismissed(@{@"dismissCount" : @(dismissCount)}); - } - }); - } -#endif -} - -- (void)notifyDismissCancelledWithDismissCount:(int)dismissCount -{ -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onNativeDismissCancelled( - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnNativeDismissCancelled{.dismissCount = dismissCount}); - } -#else - if (self.onNativeDismissCancelled) { - self.onNativeDismissCancelled(@{@"dismissCount" : @(dismissCount)}); - } -#endif -} - -- (void)notifyWillAppear -{ -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onWillAppear(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnWillAppear{}); - } - [self updateLayoutMetrics:_newLayoutMetrics oldLayoutMetrics:_oldLayoutMetrics]; -#else - if (self.onWillAppear) { - self.onWillAppear(nil); - } - // we do it here too because at this moment the `parentViewController` is already not nil, - // so if the parent is not UINavCtr, the frame will be updated to the correct one. - [self ABI46_0_0ReactSetFrame:_reactFrame]; -#endif -} - -- (void)notifyWillDisappear -{ - if (_hideKeyboardOnSwipe) { - [self endEditing:YES]; - } -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onWillDisappear(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnWillDisappear{}); - } -#else - if (self.onWillDisappear) { - self.onWillDisappear(nil); - } -#endif -} - -- (void)notifyAppear -{ -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onAppear(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnAppear{}); - } -#else - if (self.onAppear) { - dispatch_async(dispatch_get_main_queue(), ^{ - if (self.onAppear) { - self.onAppear(nil); - } - }); - } -#endif -} - -- (void)notifyDisappear -{ -#ifdef RN_FABRIC_ENABLED - // If screen is already unmounted then there will be no event emitter - // it will be cleaned in prepareForRecycle - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onDisappear(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnDisappear{}); - } -#else - if (self.onDisappear) { - self.onDisappear(nil); - } -#endif -} - -- (BOOL)isMountedUnderScreenOrReactRoot -{ -#ifdef RN_FABRIC_ENABLED -#define ABI46_0_0RNS_EXPECTED_VIEW ABI46_0_0RCTRootComponentView -#else -#define ABI46_0_0RNS_EXPECTED_VIEW ABI46_0_0RCTRootView -#endif - for (UIView *parent = self.superview; parent != nil; parent = parent.superview) { - if ([parent isKindOfClass:[ABI46_0_0RNS_EXPECTED_VIEW class]] || [parent isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - return YES; - } - } - return NO; -#undef ABI46_0_0RNS_EXPECTED_VIEW -} - -- (void)didMoveToWindow -{ - // For RN touches to work we need to instantiate and connect ABI46_0_0RCTTouchHandler. This only applies - // for screens that aren't mounted under ABI46_0_0RCTRootView e.g., modals that are mounted directly to - // root application window. - if (self.window != nil && ![self isMountedUnderScreenOrReactRoot]) { - if (_touchHandler == nil) { -#ifdef RN_FABRIC_ENABLED - _touchHandler = [ABI46_0_0RCTSurfaceTouchHandler new]; -#else - _touchHandler = [[ABI46_0_0RCTTouchHandler alloc] initWithBridge:_bridge]; -#endif - } - [_touchHandler attachToView:self]; - } else { - [_touchHandler detachFromView:self]; - } -} - -#ifdef RN_FABRIC_ENABLED -- (ABI46_0_0RCTSurfaceTouchHandler *)touchHandler -#else -- (ABI46_0_0RCTTouchHandler *)touchHandler -#endif -{ - if (_touchHandler != nil) { - return _touchHandler; - } - UIView *parent = [self superview]; - while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) - parent = parent.superview; - if (parent != nil) { - return [parent performSelector:@selector(touchHandler)]; - } - return nil; -} - -- (void)notifyFinishTransitioning -{ - [_controller notifyFinishTransitioning]; -} - -- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onTransitionProgress(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenEventEmitter::OnTransitionProgress{ - .progress = progress, .closing = closing ? 1 : 0, .goingForward = goingForward ? 1 : 0}); - } - ABI46_0_0RNSScreenViewEvent *event = [[ABI46_0_0RNSScreenViewEvent alloc] initWithEventName:@"onTransitionProgress" - ABI46_0_0ReactTag:[NSNumber numberWithInt:self.tag] - progress:progress - closing:closing - goingForward:goingForward]; - [[ABI46_0_0RCTBridge currentBridge].eventDispatcher sendEvent:event]; -#else - if (self.onTransitionProgress) { - self.onTransitionProgress(@{ - @"progress" : @(progress), - @"closing" : @(closing ? 1 : 0), - @"goingForward" : @(goingForward ? 1 : 0), - }); - } -#endif -} - -- (void)presentationControllerWillDismiss:(UIPresentationController *)presentationController -{ - // We need to call both "cancel" and "reset" here because RN's gesture recognizer - // does not handle the scenario when it gets cancelled by other top - // level gesture recognizer. In this case by the modal dismiss gesture. - // Because of that, at the moment when this method gets called the ABI46_0_0React's - // gesture recognizer is already in FAILED state but cancel events never gets - // send to JS. Calling "reset" forces ABI46_0_0RCTTouchHanler to dispatch cancel event. - // To test this behavior one need to open a dismissable modal and start - // pulling down starting at some touchable item. Without "reset" the touchable - // will never go back from highlighted state even when the modal start sliding - // down. -#ifdef RN_FABRIC_ENABLED - [_touchHandler setEnabled:NO]; - [_touchHandler setEnabled:YES]; -#else - [_touchHandler cancel]; -#endif - [_touchHandler reset]; -} - -- (BOOL)presentationControllerShouldDismiss:(UIPresentationController *)presentationController -{ - if (_preventNativeDismiss) { - [self notifyDismissCancelledWithDismissCount:1]; - return NO; - } - return _gestureEnabled; -} - -- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController -{ - if ([_ABI46_0_0ReactSuperview respondsToSelector:@selector(presentationControllerDidDismiss:)]) { - [_ABI46_0_0ReactSuperview performSelector:@selector(presentationControllerDidDismiss:) withObject:presentationController]; - } -} - -#pragma mark - Fabric specific -#ifdef RN_FABRIC_ENABLED - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider(); -} - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - [super mountChildComponentView:childComponentView index:index]; - if ([childComponentView isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - _config = childComponentView; - ((ABI46_0_0RNSScreenStackHeaderConfig *)childComponentView).screenView = self; - } - [_ABI46_0_0ReactSubviews insertObject:childComponentView atIndex:index]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - if ([childComponentView isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - _config = nil; - } - [_ABI46_0_0ReactSubviews removeObject:childComponentView]; - [super unmountChildComponentView:childComponentView index:index]; -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - // TODO: Make sure that there is no edge case when this should be uncommented - // _controller=nil; - _dismissed = NO; - _state.reset(); - _touchHandler = nil; -} - -- (void)updateProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)props - oldProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)oldProps -{ - const auto &oldScreenProps = *std::static_pointer_cast(_props); - const auto &newScreenProps = *std::static_pointer_cast(props); - - [self setFullScreenSwipeEnabled:newScreenProps.fullScreenSwipeEnabled]; - - [self setGestureEnabled:newScreenProps.gestureEnabled]; - - [self setTransitionDuration:[NSNumber numberWithInt:newScreenProps.transitionDuration]]; - - [self setHideKeyboardOnSwipe:newScreenProps.hideKeyboardOnSwipe]; - - [self setCustomAnimationOnSwipe:newScreenProps.customAnimationOnSwipe]; - - [self - setGestureResponseDistance:[ABI46_0_0RNSConvert - gestureResponseDistanceDictFromCppStruct:newScreenProps.gestureResponseDistance]]; - - [self setPreventNativeDismiss:newScreenProps.preventNativeDismiss]; - - [self setActivityStateOrNil:[NSNumber numberWithFloat:newScreenProps.activityState]]; - - [self setSwipeDirection:[ABI46_0_0RNSConvert ABI46_0_0RNSScreenSwipeDirectionFromCppEquivalent:newScreenProps.swipeDirection]]; - -#if !TARGET_OS_TV - if (newScreenProps.statusBarHidden != oldScreenProps.statusBarHidden) { - [self setStatusBarHidden:newScreenProps.statusBarHidden]; - } - - if (newScreenProps.statusBarStyle != oldScreenProps.statusBarStyle) { - [self setStatusBarStyle:[ABI46_0_0RCTConvert - ABI46_0_0RNSStatusBarStyle:ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.statusBarStyle)]]; - } - - if (newScreenProps.statusBarAnimation != oldScreenProps.statusBarAnimation) { - [self setStatusBarAnimation:[ABI46_0_0RCTConvert UIStatusBarAnimation:ABI46_0_0RCTNSStringFromStringNilIfEmpty( - newScreenProps.statusBarAnimation)]]; - } - - if (newScreenProps.screenOrientation != oldScreenProps.screenOrientation) { - [self setScreenOrientation:[ABI46_0_0RCTConvert UIInterfaceOrientationMask:ABI46_0_0RCTNSStringFromStringNilIfEmpty( - newScreenProps.screenOrientation)]]; - } - - if (newScreenProps.homeIndicatorHidden != oldScreenProps.homeIndicatorHidden) { - [self setHomeIndicatorHidden:newScreenProps.homeIndicatorHidden]; - } -#endif - - if (newScreenProps.stackPresentation != oldScreenProps.stackPresentation) { - [self - setStackPresentation:[ABI46_0_0RNSConvert ABI46_0_0RNSScreenStackPresentationFromCppEquivalent:newScreenProps.stackPresentation]]; - } - - if (newScreenProps.stackAnimation != oldScreenProps.stackAnimation) { - [self setStackAnimation:[ABI46_0_0RNSConvert ABI46_0_0RNSScreenStackAnimationFromCppEquivalent:newScreenProps.stackAnimation]]; - } - - if (newScreenProps.replaceAnimation != oldScreenProps.replaceAnimation) { - [self setReplaceAnimation:[ABI46_0_0RNSConvert ABI46_0_0RNSScreenReplaceAnimationFromCppEquivalent:newScreenProps.replaceAnimation]]; - } - - [super updateProps:props oldProps:oldProps]; -} - -- (void)updateState:(ABI46_0_0facebook::ABI46_0_0React::State::Shared const &)state - oldState:(ABI46_0_0facebook::ABI46_0_0React::State::Shared const &)oldState -{ - _state = std::static_pointer_cast(state); -} - -- (void)updateLayoutMetrics:(const ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics &)layoutMetrics - oldLayoutMetrics:(const ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics &)oldLayoutMetrics -{ - _newLayoutMetrics = layoutMetrics; - _oldLayoutMetrics = oldLayoutMetrics; - UIViewController *parentVC = self.ABI46_0_0ReactViewController.parentViewController; - if (parentVC != nil && ![parentVC isKindOfClass:[ABI46_0_0RNScreensNavigationController class]]) { - [super updateLayoutMetrics:layoutMetrics oldLayoutMetrics:oldLayoutMetrics]; - } - // when screen is mounted under ABI46_0_0RNScreensNavigationController it's size is controller - // by the navigation controller itself. That is, it is set to fill space of - // the controller. In that case we ignore react layout system from managing - // the screen dimensions and we wait for the screen VC to update and then we - // pass the dimensions to ui view manager to take into account when laying out - // subviews - // Explanation taken from `ABI46_0_0ReactSetFrame`, which is old arch equivalent of this code. -} - -#pragma mark - Paper specific -#else - -- (void)setPointerEvents:(ABI46_0_0RCTPointerEvents)pointerEvents -{ - // pointer events settings are managed by the parent screen container, we ignore - // any attempt of setting that via ABI46_0_0React props -} - -- (void)ABI46_0_0ReactSetFrame:(CGRect)frame -{ - _reactFrame = frame; - UIViewController *parentVC = self.ABI46_0_0ReactViewController.parentViewController; - if (parentVC != nil && ![parentVC isKindOfClass:[ABI46_0_0RNScreensNavigationController class]]) { - [super ABI46_0_0ReactSetFrame:frame]; - } - // when screen is mounted under ABI46_0_0RNScreensNavigationController it's size is controller - // by the navigation controller itself. That is, it is set to fill space of - // the controller. In that case we ignore react layout system from managing - // the screen dimensions and we wait for the screen VC to update and then we - // pass the dimensions to ui view manager to take into account when laying out - // subviews -} - -- (void)invalidate -{ - _controller = nil; -} -#endif - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenCls(void) -{ - return ABI46_0_0RNSScreenView.class; -} -#endif - -#pragma mark - ABI46_0_0RNSScreen - -@implementation ABI46_0_0RNSScreen { - __weak id _previousFirstResponder; - CGRect _lastViewFrame; - ABI46_0_0RNSScreenView *_initialView; - UIView *_fakeView; - CADisplayLink *_animationTimer; - CGFloat _currentAlpha; - BOOL _closing; - BOOL _goingForward; - int _dismissCount; - BOOL _isSwiping; - BOOL _shouldNotify; -} - -#pragma mark - Common - -- (instancetype)initWithView:(UIView *)view -{ - if (self = [super init]) { - self.view = view; - _fakeView = [UIView new]; - _shouldNotify = YES; -#ifdef RN_FABRIC_ENABLED - _initialView = (ABI46_0_0RNSScreenView *)view; -#endif - } - return self; -} - -// TODO: Find out why this is executed when screen is going out -- (void)viewWillAppear:(BOOL)animated -{ - [super viewWillAppear:animated]; - if (!_isSwiping) { - [self.screenView notifyWillAppear]; - if (self.transitionCoordinator.isInteractive) { - // we started dismissing with swipe gesture - _isSwiping = YES; - } - } else { - // this event is also triggered if we cancelled the swipe. - // The _isSwiping is still true, but we don't want to notify then - _shouldNotify = NO; - } - - [self hideHeaderIfNecessary]; - // as per documentation of these methods - _goingForward = [self isBeingPresented] || [self isMovingToParentViewController]; - - [ABI46_0_0RNSScreenWindowTraits updateWindowTraits]; - if (_shouldNotify) { - _closing = NO; - [self notifyTransitionProgress:0.0 closing:_closing goingForward:_goingForward]; - [self setupProgressNotification]; - } -} - -- (void)viewWillDisappear:(BOOL)animated -{ - [super viewWillDisappear:animated]; - if (!self.transitionCoordinator.isInteractive) { - // user might have long pressed ios 14 back button item, - // so he can go back more than one screen and we need to dismiss more screens in JS stack then. - // We check it by calculating the difference between the index of currently displayed screen - // and the index of the target screen, which is the view of topViewController at this point. - // If the value is lower than 1, it means we are dismissing a modal, or navigating forward, or going back with JS. - int selfIndex = [self getIndexOfView:self.screenView]; - int targetIndex = [self getIndexOfView:self.navigationController.topViewController.view]; - _dismissCount = selfIndex - targetIndex > 0 ? selfIndex - targetIndex : 1; - } else { - _dismissCount = 1; - } - - // same flow as in viewWillAppear - if (!_isSwiping) { - [self.screenView notifyWillDisappear]; - if (self.transitionCoordinator.isInteractive) { - _isSwiping = YES; - } - } else { - _shouldNotify = NO; - } - - // as per documentation of these methods - _goingForward = !([self isBeingDismissed] || [self isMovingFromParentViewController]); - - if (_shouldNotify) { - _closing = YES; - [self notifyTransitionProgress:0.0 closing:_closing goingForward:_goingForward]; - [self setupProgressNotification]; - } -} - -- (void)viewDidAppear:(BOOL)animated -{ - [super viewDidAppear:animated]; - if (!_isSwiping || _shouldNotify) { - // we are going forward or dismissing without swipe - // or successfully swiped back - [self.screenView notifyAppear]; - [self notifyTransitionProgress:1.0 closing:NO goingForward:_goingForward]; - } - - _isSwiping = NO; - _shouldNotify = YES; -} - -- (void)viewDidDisappear:(BOOL)animated -{ - [super viewDidDisappear:animated]; -#ifdef RN_FABRIC_ENABLED - [self resetViewToScreen]; -#endif - if (self.parentViewController == nil && self.presentingViewController == nil) { - if (self.screenView.preventNativeDismiss) { - // if we want to prevent the native dismiss, we do not send dismissal event, - // but instead call `updateContainer`, which restores the JS navigation stack - [self.screenView.ABI46_0_0ReactSuperview updateContainer]; - [self.screenView notifyDismissCancelledWithDismissCount:_dismissCount]; - } else { - // screen dismissed, send event - [self.screenView notifyDismissedWithCount:_dismissCount]; - } - } - // same flow as in viewDidAppear - if (!_isSwiping || _shouldNotify) { - [self.screenView notifyDisappear]; - [self notifyTransitionProgress:1.0 closing:YES goingForward:_goingForward]; - } - - _isSwiping = NO; - _shouldNotify = YES; -#ifdef RN_FABRIC_ENABLED -#else - [self traverseForScrollView:self.screenView]; -#endif -} - -- (void)viewDidLayoutSubviews -{ - [super viewDidLayoutSubviews]; - - // The below code makes the screen view adapt dimensions provided by the system. We take these - // into account only when the view is mounted under ABI46_0_0RNScreensNavigationController in which case system - // provides additional padding to account for possible header, and in the case when screen is - // shown as a native modal, as the final dimensions of the modal on iOS 12+ are shorter than the - // screen size - BOOL isDisplayedWithinUINavController = - [self.parentViewController isKindOfClass:[ABI46_0_0RNScreensNavigationController class]]; - BOOL isPresentedAsNativeModal = self.parentViewController == nil && self.presentingViewController != nil; - - if (isDisplayedWithinUINavController || isPresentedAsNativeModal) { -#ifdef RN_FABRIC_ENABLED - [self.screenView updateBounds]; -#else - if (!CGRectEqualToRect(_lastViewFrame, self.screenView.frame)) { - _lastViewFrame = self.screenView.frame; - [((ABI46_0_0RNSScreenView *)self.viewIfLoaded) updateBounds]; - } -#endif - } -} - -- (void)notifyFinishTransitioning -{ - [_previousFirstResponder becomeFirstResponder]; - _previousFirstResponder = nil; - // the correct Screen for appearance is set after the transition, same for orientation. - [ABI46_0_0RNSScreenWindowTraits updateWindowTraits]; -} - -- (void)willMoveToParentViewController:(UIViewController *)parent -{ - [super willMoveToParentViewController:parent]; - if (parent == nil) { - id responder = [self findFirstResponder:self.screenView]; - if (responder != nil) { - _previousFirstResponder = responder; - } - } -} - -- (id)findFirstResponder:(UIView *)parent -{ - if (parent.isFirstResponder) { - return parent; - } - for (UIView *subView in parent.subviews) { - id responder = [self findFirstResponder:subView]; - if (responder != nil) { - return responder; - } - } - return nil; -} - -#pragma mark - transition progress related methods - -- (void)setupProgressNotification -{ - if (self.transitionCoordinator != nil) { - _fakeView.alpha = 0.0; - [self.transitionCoordinator - animateAlongsideTransition:^(id _Nonnull context) { - [[context containerView] addSubview:self->_fakeView]; - self->_fakeView.alpha = 1.0; - self->_animationTimer = [CADisplayLink displayLinkWithTarget:self selector:@selector(handleAnimation)]; - [self->_animationTimer addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; - } - completion:^(id _Nonnull context) { - [self->_animationTimer setPaused:YES]; - [self->_animationTimer invalidate]; - [self->_fakeView removeFromSuperview]; - }]; - } -} - -- (void)handleAnimation -{ - if ([[_fakeView layer] presentationLayer] != nil) { - CGFloat fakeViewAlpha = _fakeView.layer.presentationLayer.opacity; - if (_currentAlpha != fakeViewAlpha) { - _currentAlpha = fmax(0.0, fmin(1.0, fakeViewAlpha)); - [self notifyTransitionProgress:_currentAlpha closing:_closing goingForward:_goingForward]; - } - } -} - -- (void)notifyTransitionProgress:(double)progress closing:(BOOL)closing goingForward:(BOOL)goingForward -{ - if ([self.view isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - // if the view is already snapshot, there is not sense in sending progress since on JS side - // the component is already not present - [(ABI46_0_0RNSScreenView *)self.view notifyTransitionProgress:progress closing:closing goingForward:goingForward]; - } -} - -#if !TARGET_OS_TV -// if the returned vc is a child, it means that it can provide config; -// if the returned vc is self, it means that there is no child for config and self has config to provide, -// so we return self which results in asking self for preferredStatusBarStyle/Animation etc.; -// if the returned vc is nil, it means none of children could provide config and self does not have config either, -// so if it was asked by parent, it will fallback to parent's option, or use default option if it is the top Screen -- (UIViewController *)findChildVCForConfigAndTrait:(ABI46_0_0RNSWindowTrait)trait includingModals:(BOOL)includingModals -{ - UIViewController *lastViewController = [[self childViewControllers] lastObject]; - if ([self.presentedViewController isKindOfClass:[ABI46_0_0RNSScreen class]]) { - lastViewController = self.presentedViewController; - // we don't want to allow controlling of status bar appearance when we present non-fullScreen modal - // and it is not possible if `modalPresentationCapturesStatusBarAppearance` is not set to YES, so even - // if we went into a modal here and ask it, it wouldn't take any effect. For fullScreen modals, the system - // asks them by itself, so we can stop traversing here. - // for screen orientation, we need to start the search again from that modal - return !includingModals - ? nil - : [(ABI46_0_0RNSScreen *)lastViewController findChildVCForConfigAndTrait:trait includingModals:includingModals] - ?: lastViewController; - } - - UIViewController *selfOrNil = [self hasTraitSet:trait] ? self : nil; - if (lastViewController == nil) { - return selfOrNil; - } else { - if ([lastViewController conformsToProtocol:@protocol(ABI46_0_0RNScreensViewControllerDelegate)]) { - // If there is a child (should be VC of ScreenContainer or ScreenStack), that has a child that could provide the - // trait, we recursively go into its findChildVCForConfig, and if one of the children has the trait set, we return - // it, otherwise we return self if this VC has config, and nil if it doesn't we use - // `childViewControllerForStatusBarStyle` for all options since the behavior is the same for all of them - UIViewController *childScreen = [lastViewController childViewControllerForStatusBarStyle]; - if ([childScreen isKindOfClass:[ABI46_0_0RNSScreen class]]) { - return [(ABI46_0_0RNSScreen *)childScreen findChildVCForConfigAndTrait:trait includingModals:includingModals] - ?: selfOrNil; - } else { - return selfOrNil; - } - } else { - // child vc is not from this library, so we don't ask it - return selfOrNil; - } - } -} - -- (BOOL)hasTraitSet:(ABI46_0_0RNSWindowTrait)trait -{ - switch (trait) { - case ABI46_0_0RNSWindowTraitStyle: { - return self.screenView.hasStatusBarStyleSet; - } - case ABI46_0_0RNSWindowTraitAnimation: { - return self.screenView.hasStatusBarAnimationSet; - } - case ABI46_0_0RNSWindowTraitHidden: { - return self.screenView.hasStatusBarHiddenSet; - } - case ABI46_0_0RNSWindowTraitOrientation: { - return self.screenView.hasOrientationSet; - } - case ABI46_0_0RNSWindowTraitHomeIndicatorHidden: { - return self.screenView.hasHomeIndicatorHiddenSet; - } - default: { - ABI46_0_0RCTLogError(@"Unknown trait passed: %d", (int)trait); - } - } - return NO; -} - -- (UIViewController *)childViewControllerForStatusBarHidden -{ - UIViewController *vc = [self findChildVCForConfigAndTrait:ABI46_0_0RNSWindowTraitHidden includingModals:NO]; - return vc == self ? nil : vc; -} - -- (BOOL)prefersStatusBarHidden -{ - return self.screenView.statusBarHidden; -} - -- (UIViewController *)childViewControllerForStatusBarStyle -{ - UIViewController *vc = [self findChildVCForConfigAndTrait:ABI46_0_0RNSWindowTraitStyle includingModals:NO]; - return vc == self ? nil : vc; -} - -- (UIStatusBarStyle)preferredStatusBarStyle -{ - return [ABI46_0_0RNSScreenWindowTraits statusBarStyleForRNSStatusBarStyle:self.screenView.statusBarStyle]; -} - -- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation -{ - UIViewController *vc = [self findChildVCForConfigAndTrait:ABI46_0_0RNSWindowTraitAnimation includingModals:NO]; - - if ([vc isKindOfClass:[ABI46_0_0RNSScreen class]]) { - return ((ABI46_0_0RNSScreen *)vc).screenView.statusBarAnimation; - } - return UIStatusBarAnimationFade; -} - -- (UIInterfaceOrientationMask)supportedInterfaceOrientations -{ - UIViewController *vc = [self findChildVCForConfigAndTrait:ABI46_0_0RNSWindowTraitOrientation includingModals:YES]; - - if ([vc isKindOfClass:[ABI46_0_0RNSScreen class]]) { - return ((ABI46_0_0RNSScreen *)vc).screenView.screenOrientation; - } - return UIInterfaceOrientationMaskAllButUpsideDown; -} - -- (UIViewController *)childViewControllerForHomeIndicatorAutoHidden -{ - UIViewController *vc = [self findChildVCForConfigAndTrait:ABI46_0_0RNSWindowTraitHomeIndicatorHidden includingModals:YES]; - return vc == self ? nil : vc; -} - -- (BOOL)prefersHomeIndicatorAutoHidden -{ - return self.screenView.homeIndicatorHidden; -} -- (int)getParentChildrenCount -{ - return (int)[[self.screenView.ABI46_0_0ReactSuperview ABI46_0_0ReactSubviews] count]; -} -#endif - -- (int)getIndexOfView:(UIView *)view -{ - return (int)[[self.screenView.ABI46_0_0ReactSuperview ABI46_0_0ReactSubviews] indexOfObject:view]; -} - -// since on Fabric the view of controller can be a snapshot of type `UIView`, -// when we want to check props of ScreenView, we need to get them from _initialView -- (ABI46_0_0RNSScreenView *)screenView -{ -#ifdef RN_FABRIC_ENABLED - return _initialView; -#else - return (ABI46_0_0RNSScreenView *)self.view; -#endif -} - -- (void)hideHeaderIfNecessary -{ -#if !TARGET_OS_TV - // On iOS >=13, there is a bug when user transitions from screen with active search bar to screen without header - // In that case default iOS header will be shown. To fix this we hide header when the screens that appears has header - // hidden and search bar was active on previous screen. We need to do it asynchronously, because default header is - // added after viewWillAppear. - if (@available(iOS 13.0, *)) { - NSUInteger currentIndex = [self.navigationController.viewControllers indexOfObject:self]; - - // we need to check whether ABI46_0_0ReactSubviews array is empty, because on Fabric child nodes are unmounted first -> - // ABI46_0_0ReactSubviews array may be empty - if (currentIndex > 0 && [self.screenView.ABI46_0_0ReactSubviews count] > 0 && - [self.screenView.ABI46_0_0ReactSubviews[0] isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - UINavigationItem *prevNavigationItem = - [self.navigationController.viewControllers objectAtIndex:currentIndex - 1].navigationItem; - ABI46_0_0RNSScreenStackHeaderConfig *config = ((ABI46_0_0RNSScreenStackHeaderConfig *)self.screenView.ABI46_0_0ReactSubviews[0]); - - BOOL wasSearchBarActive = prevNavigationItem.searchController.active; - -#ifdef RN_FABRIC_ENABLED - BOOL shouldHideHeader = !config.show; -#else - BOOL shouldHideHeader = config.hide; -#endif - - if (wasSearchBarActive && shouldHideHeader) { - dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, 0); - dispatch_after(popTime, dispatch_get_main_queue(), ^(void) { - [self.navigationController setNavigationBarHidden:YES animated:NO]; - }); - } - } - } -#endif -} - -#ifdef RN_FABRIC_ENABLED -#pragma mark - Fabric specific - -- (void)setViewToSnapshot:(UIView *)snapshot -{ - // modals of native stack seem not to support - // changing their view by just setting the view - if (_initialView.stackPresentation != ABI46_0_0RNSScreenStackPresentationPush) { - UIView *superView = self.view.superview; - [self.view removeFromSuperview]; - self.view = snapshot; - [superView addSubview:self.view]; - } else { - [self.view removeFromSuperview]; - self.view = snapshot; - } -} - -- (void)resetViewToScreen -{ - if (self.view != _initialView) { - [self.view removeFromSuperview]; - self.view = _initialView; - } -} - -#else -#pragma mark - Paper specific - -- (void)traverseForScrollView:(UIView *)view -{ - if (![[self.view valueForKey:@"_bridge"] valueForKey:@"_jsThread"]) { - // we don't want to send `scrollViewDidEndDecelerating` event to JS before the JS thread is ready - return; - } - if ([view isKindOfClass:[UIScrollView class]] && - ([[(UIScrollView *)view delegate] respondsToSelector:@selector(scrollViewDidEndDecelerating:)])) { - [[(UIScrollView *)view delegate] scrollViewDidEndDecelerating:(id)view]; - } - [view.subviews enumerateObjectsUsingBlock:^(__kindof UIView *_Nonnull obj, NSUInteger idx, BOOL *_Nonnull stop) { - [self traverseForScrollView:obj]; - }]; -} -#endif - -@end - -@implementation ABI46_0_0RNSScreenManager - -ABI46_0_0RCT_EXPORT_MODULE() - -// we want to handle the case when activityState is nil -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(activityState, activityStateOrNil, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(customAnimationOnSwipe, BOOL); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fullScreenSwipeEnabled, BOOL); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gestureEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gestureResponseDistance, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideKeyboardOnSwipe, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(preventNativeDismiss, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(replaceAnimation, ABI46_0_0RNSScreenReplaceAnimation) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(stackPresentation, ABI46_0_0RNSScreenStackPresentation) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(stackAnimation, ABI46_0_0RNSScreenStackAnimation) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(swipeDirection, ABI46_0_0RNSScreenSwipeDirection) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(transitionDuration, NSNumber) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onAppear, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDisappear, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDismissed, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onNativeDismissCancelled, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onTransitionProgress, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onWillAppear, ABI46_0_0RCTDirectEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onWillDisappear, ABI46_0_0RCTDirectEventBlock); - -#if !TARGET_OS_TV -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(screenOrientation, UIInterfaceOrientationMask) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(statusBarAnimation, UIStatusBarAnimation) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(statusBarHidden, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(statusBarStyle, ABI46_0_0RNSStatusBarStyle) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(homeIndicatorHidden, BOOL) -#endif - -- (UIView *)view -{ - return [[ABI46_0_0RNSScreenView alloc] initWithBridge:self.bridge]; -} - -@end - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNSScreen) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSScreenStackPresentation, - (@{ - @"push" : @(ABI46_0_0RNSScreenStackPresentationPush), - @"modal" : @(ABI46_0_0RNSScreenStackPresentationModal), - @"fullScreenModal" : @(ABI46_0_0RNSScreenStackPresentationFullScreenModal), - @"formSheet" : @(ABI46_0_0RNSScreenStackPresentationFormSheet), - @"containedModal" : @(ABI46_0_0RNSScreenStackPresentationContainedModal), - @"transparentModal" : @(ABI46_0_0RNSScreenStackPresentationTransparentModal), - @"containedTransparentModal" : @(ABI46_0_0RNSScreenStackPresentationContainedTransparentModal) - }), - ABI46_0_0RNSScreenStackPresentationPush, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSScreenStackAnimation, - (@{ - @"default" : @(ABI46_0_0RNSScreenStackAnimationDefault), - @"none" : @(ABI46_0_0RNSScreenStackAnimationNone), - @"fade" : @(ABI46_0_0RNSScreenStackAnimationFade), - @"fade_from_bottom" : @(ABI46_0_0RNSScreenStackAnimationFadeFromBottom), - @"flip" : @(ABI46_0_0RNSScreenStackAnimationFlip), - @"simple_push" : @(ABI46_0_0RNSScreenStackAnimationSimplePush), - @"slide_from_bottom" : @(ABI46_0_0RNSScreenStackAnimationSlideFromBottom), - @"slide_from_right" : @(ABI46_0_0RNSScreenStackAnimationDefault), - @"slide_from_left" : @(ABI46_0_0RNSScreenStackAnimationDefault), - }), - ABI46_0_0RNSScreenStackAnimationDefault, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSScreenReplaceAnimation, - (@{ - @"push" : @(ABI46_0_0RNSScreenReplaceAnimationPush), - @"pop" : @(ABI46_0_0RNSScreenReplaceAnimationPop), - }), - ABI46_0_0RNSScreenReplaceAnimationPop, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSScreenSwipeDirection, - (@{ - @"vertical" : @(ABI46_0_0RNSScreenSwipeDirectionVertical), - @"horizontal" : @(ABI46_0_0RNSScreenSwipeDirectionHorizontal), - }), - ABI46_0_0RNSScreenSwipeDirectionHorizontal, - integerValue) - -#if !TARGET_OS_TV -ABI46_0_0RCT_ENUM_CONVERTER( - UIStatusBarAnimation, - (@{ - @"none" : @(UIStatusBarAnimationNone), - @"fade" : @(UIStatusBarAnimationFade), - @"slide" : @(UIStatusBarAnimationSlide) - }), - UIStatusBarAnimationNone, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSStatusBarStyle, - (@{ - @"auto" : @(ABI46_0_0RNSStatusBarStyleAuto), - @"inverted" : @(ABI46_0_0RNSStatusBarStyleInverted), - @"light" : @(ABI46_0_0RNSStatusBarStyleLight), - @"dark" : @(ABI46_0_0RNSStatusBarStyleDark), - }), - ABI46_0_0RNSStatusBarStyleAuto, - integerValue) - -+ (UIInterfaceOrientationMask)UIInterfaceOrientationMask:(id)json -{ - json = [self NSString:json]; - if ([json isEqualToString:@"default"]) { - return UIInterfaceOrientationMaskAllButUpsideDown; - } else if ([json isEqualToString:@"all"]) { - return UIInterfaceOrientationMaskAll; - } else if ([json isEqualToString:@"portrait"]) { - return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskPortraitUpsideDown; - } else if ([json isEqualToString:@"portrait_up"]) { - return UIInterfaceOrientationMaskPortrait; - } else if ([json isEqualToString:@"portrait_down"]) { - return UIInterfaceOrientationMaskPortraitUpsideDown; - } else if ([json isEqualToString:@"landscape"]) { - return UIInterfaceOrientationMaskLandscape; - } else if ([json isEqualToString:@"landscape_left"]) { - return UIInterfaceOrientationMaskLandscapeLeft; - } else if ([json isEqualToString:@"landscape_right"]) { - return UIInterfaceOrientationMaskLandscapeRight; - } - return UIInterfaceOrientationMaskAllButUpsideDown; -} -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.h deleted file mode 100644 index 762b27cee0a8e8..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#else -#endif - -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ABI46_0_0RNSScreenContainerDelegate - -- (void)markChildUpdated; -- (void)updateContainer; - -@end - -@protocol ABI46_0_0RNScreensViewControllerDelegate - -@end - -@interface ABI46_0_0RNScreensViewController : UIViewController - -- (UIViewController *)findActiveChildVC; - -@end - -@interface ABI46_0_0RNSScreenContainerManager : ABI46_0_0RCTViewManager - -@end - -@interface ABI46_0_0RNSScreenContainerView : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - UIView -#endif - -@property (nonatomic, retain) UIViewController *controller; -@property (nonatomic, retain) NSMutableArray *ABI46_0_0ReactSubviews; - -- (void)maybeDismissVC; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.mm deleted file mode 100644 index 2ba7fa347c1713..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenContainer.mm +++ /dev/null @@ -1,340 +0,0 @@ -#import "ABI46_0_0RNSScreenContainer.h" -#import "ABI46_0_0RNSScreen.h" - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#endif - -@implementation ABI46_0_0RNScreensViewController - -#if !TARGET_OS_TV -- (UIViewController *)childViewControllerForStatusBarStyle -{ - return [self findActiveChildVC]; -} - -- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation -{ - return [self findActiveChildVC].preferredStatusBarUpdateAnimation; -} - -- (UIViewController *)childViewControllerForStatusBarHidden -{ - return [self findActiveChildVC]; -} - -- (UIInterfaceOrientationMask)supportedInterfaceOrientations -{ - return [self findActiveChildVC].supportedInterfaceOrientations; -} - -- (UIViewController *)childViewControllerForHomeIndicatorAutoHidden -{ - return [self findActiveChildVC]; -} -#endif - -- (UIViewController *)findActiveChildVC -{ - for (UIViewController *childVC in self.childViewControllers) { - if ([childVC isKindOfClass:[ABI46_0_0RNSScreen class]] && - ((ABI46_0_0RNSScreen *)childVC).screenView.activityState == ABI46_0_0RNSActivityStateOnTop) { - return childVC; - } - } - return [[self childViewControllers] lastObject]; -} - -@end - -@implementation ABI46_0_0RNSScreenContainerView { - BOOL _invalidated; - NSMutableSet *_activeScreens; -} - -- (instancetype)init -{ - if (self = [super init]) { -#ifdef RN_FABRIC_ENABLED - static const auto defaultProps = std::make_shared(); - _props = defaultProps; -#endif - _activeScreens = [NSMutableSet new]; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - [self setupController]; - _invalidated = NO; - } - return self; -} - -- (void)setupController -{ - _controller = [[ABI46_0_0RNScreensViewController alloc] init]; - [self addSubview:_controller.view]; -} - -- (void)markChildUpdated -{ - // We want the attaching/detaching of children to be always made on main queue, which - // is currently true for `react-navigation` since this method is triggered - // by the changes of `Animated` value in stack's transition or adding/removing screens - // in all navigators - ABI46_0_0RCTAssertMainQueue(); - [self updateContainer]; -} - -- (void)insertABI46_0_0ReactSubview:(ABI46_0_0RNSScreenView *)subview atIndex:(NSInteger)atIndex -{ - subview.ABI46_0_0ReactSuperview = self; - [_ABI46_0_0ReactSubviews insertObject:subview atIndex:atIndex]; - [subview ABI46_0_0ReactSetFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; -} - -- (void)removeABI46_0_0ReactSubview:(ABI46_0_0RNSScreenView *)subview -{ - subview.ABI46_0_0ReactSuperview = nil; - [_ABI46_0_0ReactSubviews removeObject:subview]; -} - -- (NSArray *)ABI46_0_0ReactSubviews -{ - return _ABI46_0_0ReactSubviews; -} - -- (UIViewController *)ABI46_0_0ReactViewController -{ - return _controller; -} - -- (UIViewController *)findChildControllerForScreen:(ABI46_0_0RNSScreenView *)screen -{ - for (UIViewController *vc in _controller.childViewControllers) { - if (vc.view == screen) { - return vc; - } - } - return nil; -} - -- (void)prepareDetach:(ABI46_0_0RNSScreenView *)screen -{ - [[self findChildControllerForScreen:screen] willMoveToParentViewController:nil]; -} - -- (void)detachScreen:(ABI46_0_0RNSScreenView *)screen -{ - // We use findChildControllerForScreen method instead of directly accesing - // screen.controller because screen.controller may be reset to nil when the - // original screen view gets detached from the view hierarchy (we reset controller - // reference to avoid reference loops) - UIViewController *detachController = [self findChildControllerForScreen:screen]; - [detachController willMoveToParentViewController:nil]; - [screen removeFromSuperview]; - [detachController removeFromParentViewController]; - [_activeScreens removeObject:screen]; -} - -- (void)attachScreen:(ABI46_0_0RNSScreenView *)screen atIndex:(NSInteger)index -{ - [_controller addChildViewController:screen.controller]; - // the frame is already set at this moment because we adjust it in insertABI46_0_0ReactSubview. We don't - // want to update it here as react-driven animations may already run and hence changing the frame - // would result in visual glitches - [_controller.view insertSubview:screen.controller.view atIndex:index]; - [screen.controller didMoveToParentViewController:_controller]; - [_activeScreens addObject:screen]; -} - -- (void)updateContainer -{ - BOOL screenRemoved = NO; - // remove screens that are no longer active - NSMutableSet *orphaned = [NSMutableSet setWithSet:_activeScreens]; - for (ABI46_0_0RNSScreenView *screen in _ABI46_0_0ReactSubviews) { - if (screen.activityState == ABI46_0_0RNSActivityStateInactive && [_activeScreens containsObject:screen]) { - screenRemoved = YES; - [self detachScreen:screen]; - } - [orphaned removeObject:screen]; - } - for (ABI46_0_0RNSScreenView *screen in orphaned) { - screenRemoved = YES; - [self detachScreen:screen]; - } - - // detect if new screen is going to be activated - BOOL screenAdded = NO; - for (ABI46_0_0RNSScreenView *screen in _ABI46_0_0ReactSubviews) { - if (screen.activityState != ABI46_0_0RNSActivityStateInactive && ![_activeScreens containsObject:screen]) { - screenAdded = YES; - } - } - - if (screenAdded) { - // add new screens in order they are placed in subviews array - NSInteger index = 0; - for (ABI46_0_0RNSScreenView *screen in _ABI46_0_0ReactSubviews) { - if (screen.activityState != ABI46_0_0RNSActivityStateInactive) { - if ([_activeScreens containsObject:screen] && screen.activityState == ABI46_0_0RNSActivityStateTransitioningOrBelowTop) { - // for screens that were already active we want to mimick the effect UINavigationController - // has when willMoveToWindow:nil is triggered before the animation starts - [self prepareDetach:screen]; - } else if (![_activeScreens containsObject:screen]) { - [self attachScreen:screen atIndex:index]; - } - index += 1; - } - } - } - - for (ABI46_0_0RNSScreenView *screen in _ABI46_0_0ReactSubviews) { - if (screen.activityState == ABI46_0_0RNSActivityStateOnTop) { - [screen notifyFinishTransitioning]; - } - } - - if (screenRemoved || screenAdded) { - [self maybeDismissVC]; - } -} - -- (void)maybeDismissVC -{ - if (_controller.presentedViewController == nil && _controller.presentingViewController == nil) { - // if user has reachability enabled (one hand use) and the window is slided down the below - // method will force it to slide back up as it is expected to happen with UINavController when - // we push or pop views. - // We only do that if `presentedViewController` is nil, as otherwise it'd mean that modal has - // been presented on top of recently changed controller in which case the below method would - // dismiss such a modal (e.g., permission modal or alert) - [_controller dismissViewControllerAnimated:NO completion:nil]; - } -} - -- (void)didUpdateABI46_0_0ReactSubviews -{ - [self markChildUpdated]; -} - -- (void)didMoveToWindow -{ - if (self.window && !_invalidated) { - // We check whether the view has been invalidated before running side-effects in didMoveToWindow - // This is needed because when LayoutAnimations are used it is possible for view to be re-attached - // to a window despite the fact it has been removed from the ABI46_0_0React Native view hierarchy. - [self ABI46_0_0ReactAddControllerToClosestParent:_controller]; - } -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - _controller.view.frame = self.bounds; - for (ABI46_0_0RNSScreenView *subview in _ABI46_0_0ReactSubviews) { -#ifdef RN_FABRIC_ENABLED - ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics screenLayoutMetrics = subview.newLayoutMetrics; - screenLayoutMetrics.frame = ABI46_0_0RCTRectFromCGRect(CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)); - [subview updateLayoutMetrics:screenLayoutMetrics oldLayoutMetrics:subview.oldLayoutMetrics]; -#else - [subview ABI46_0_0ReactSetFrame:CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)]; -#endif - [subview setNeedsLayout]; - } -} - -#pragma mark-- Fabric specific -#ifdef RN_FABRIC_ENABLED - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - if (![childComponentView isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - ABI46_0_0RCTLogError(@"ScreenContainer only accepts children of type Screen"); - return; - } - - ABI46_0_0RNSScreenView *screenView = (ABI46_0_0RNSScreenView *)childComponentView; - - ABI46_0_0RCTAssert( - childComponentView.ABI46_0_0ReactSuperview == nil, - @"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)", - self, - childComponentView, - @(index), - @([childComponentView.superview tag])); - - [_ABI46_0_0ReactSubviews insertObject:screenView atIndex:index]; - screenView.ABI46_0_0ReactSuperview = self; - ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics screenLayoutMetrics = screenView.newLayoutMetrics; - screenLayoutMetrics.frame = ABI46_0_0RCTRectFromCGRect(CGRectMake(0, 0, self.bounds.size.width, self.bounds.size.height)); - [screenView updateLayoutMetrics:screenLayoutMetrics oldLayoutMetrics:screenView.oldLayoutMetrics]; - [self markChildUpdated]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - ABI46_0_0RCTAssert( - childComponentView.ABI46_0_0ReactSuperview == self, - @"Attempt to unmount a view which is mounted inside different view. (parent: %@, child: %@, index: %@)", - self, - childComponentView, - @(index)); - ABI46_0_0RCTAssert( - (_ABI46_0_0ReactSubviews.count > index) && [_ABI46_0_0ReactSubviews objectAtIndex:index] == childComponentView, - @"Attempt to unmount a view which has a different index. (parent: %@, child: %@, index: %@, actual index: %@, tag at index: %@)", - self, - childComponentView, - @(index), - @([_ABI46_0_0ReactSubviews indexOfObject:childComponentView]), - @([[_ABI46_0_0ReactSubviews objectAtIndex:index] tag])); - ((ABI46_0_0RNSScreenView *)childComponentView).ABI46_0_0ReactSuperview = nil; - [_ABI46_0_0ReactSubviews removeObject:childComponentView]; - [childComponentView removeFromSuperview]; - [self markChildUpdated]; -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider(); -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - [_controller willMoveToParentViewController:nil]; - [_controller removeFromParentViewController]; -} - -#pragma mark-- Paper specific -#else - -- (void)invalidate -{ - _invalidated = YES; - [_controller willMoveToParentViewController:nil]; - [_controller removeFromParentViewController]; -} - -#endif - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenContainerCls(void) -{ - return ABI46_0_0RNSScreenContainerView.class; -} -#endif - -@implementation ABI46_0_0RNSScreenContainerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [[ABI46_0_0RNSScreenContainerView alloc] init]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.h deleted file mode 100644 index 0e2c885141bcbc..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.h +++ /dev/null @@ -1,16 +0,0 @@ -#import - -#import "ABI46_0_0RNSScreenContainer.h" -#import "ABI46_0_0RNSScreenStack.h" - -@interface ABI46_0_0RNScreensContainerNavigationController : ABI46_0_0RNScreensNavigationController - -@end - -@interface ABI46_0_0RNSScreenNavigationContainerView : ABI46_0_0RNSScreenContainerView - -@end - -@interface ABI46_0_0RNSScreenNavigationContainerManager : ABI46_0_0RNSScreenContainerManager - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.mm deleted file mode 100644 index b64b68f2dbc6d2..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenNavigationContainer.mm +++ /dev/null @@ -1,65 +0,0 @@ -#import "ABI46_0_0RNSScreenNavigationContainer.h" -#import "ABI46_0_0RNSScreen.h" -#import "ABI46_0_0RNSScreenContainer.h" - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#endif - -@implementation ABI46_0_0RNScreensContainerNavigationController - -@end - -@implementation ABI46_0_0RNSScreenNavigationContainerView - -- (void)setupController -{ - self.controller = [[ABI46_0_0RNScreensContainerNavigationController alloc] init]; - [(ABI46_0_0RNScreensContainerNavigationController *)self.controller setNavigationBarHidden:YES animated:NO]; - [self addSubview:self.controller.view]; -} - -- (void)updateContainer -{ - for (ABI46_0_0RNSScreenView *screen in self.ABI46_0_0ReactSubviews) { - if (screen.activityState == ABI46_0_0RNSActivityStateOnTop) { - // there should never be more than one screen with `ABI46_0_0RNSActivityStateOnTop` - // since this component should be used for `tabs` and `drawer` navigators - [(ABI46_0_0RNScreensContainerNavigationController *)self.controller setViewControllers:@[ screen.controller ] animated:NO]; - [screen notifyFinishTransitioning]; - } - } - - [self maybeDismissVC]; -} - -#pragma mark-- Fabric specific -#ifdef RN_FABRIC_ENABLED -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider< - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenNavigationContainerComponentDescriptor>(); -} -#endif - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenNavigationContainerCls(void) -{ - return ABI46_0_0RNSScreenNavigationContainerView.class; -} -#endif - -@implementation ABI46_0_0RNSScreenNavigationContainerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [[ABI46_0_0RNSScreenNavigationContainerView alloc] init]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.h deleted file mode 100644 index e41894258330bc..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#else -#import -#import -#endif - -#import "ABI46_0_0RNSScreenContainer.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNScreensNavigationController : UINavigationController - -@end - -@interface ABI46_0_0RNSScreenStackView : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - UIView -#endif - -- (void)markChildUpdated; -- (void)didUpdateChildren; - -#ifdef RN_FABRIC_ENABLED -#else -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onFinishTransitioning; -#endif // RN_FABRIC_ENABLED - -@end - -@interface ABI46_0_0RNSScreenStackManager : ABI46_0_0RCTViewManager - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.mm deleted file mode 100644 index 79fcf61946ab9e..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStack.mm +++ /dev/null @@ -1,1056 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import -#import - -#import "ABI46_0_0RCTFabricComponentsPlugins.h" - -#else -#import -#import -#import -#import -#import -#import -#endif // RN_FABRIC_ENABLED - -#import "ABI46_0_0RNSScreen.h" -#import "ABI46_0_0RNSScreenStack.h" -#import "ABI46_0_0RNSScreenStackAnimator.h" -#import "ABI46_0_0RNSScreenStackHeaderConfig.h" -#import "ABI46_0_0RNSScreenWindowTraits.h" - -@interface ABI46_0_0RNSScreenStackView () < - UINavigationControllerDelegate, - UIAdaptivePresentationControllerDelegate, - UIGestureRecognizerDelegate, - UIViewControllerTransitioningDelegate -#ifdef RN_FABRIC_ENABLED - , - ABI46_0_0RCTMountingTransactionObserving -#endif - > - -@property (nonatomic) NSMutableArray *presentedModals; -@property (nonatomic) BOOL updatingModals; -@property (nonatomic) BOOL scheduleModalsUpdate; - -@end - -@implementation ABI46_0_0RNScreensNavigationController - -#if !TARGET_OS_TV -- (UIViewController *)childViewControllerForStatusBarStyle -{ - return [self topViewController]; -} - -- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation -{ - return [self topViewController].preferredStatusBarUpdateAnimation; -} - -- (UIViewController *)childViewControllerForStatusBarHidden -{ - return [self topViewController]; -} - -- (UIInterfaceOrientationMask)supportedInterfaceOrientations -{ - return [self topViewController].supportedInterfaceOrientations; -} - -- (UIViewController *)childViewControllerForHomeIndicatorAutoHidden -{ - return [self topViewController]; -} -#endif - -@end - -#if !TARGET_OS_TV -@interface ABI46_0_0RNSScreenEdgeGestureRecognizer : UIScreenEdgePanGestureRecognizer -@end - -@implementation ABI46_0_0RNSScreenEdgeGestureRecognizer -@end - -@interface ABI46_0_0RNSPanGestureRecognizer : UIPanGestureRecognizer -@end - -@implementation ABI46_0_0RNSPanGestureRecognizer -@end -#endif - -@implementation ABI46_0_0RNSScreenStackView { - UINavigationController *_controller; - NSMutableArray *_ABI46_0_0ReactSubviews; - BOOL _invalidated; - BOOL _isFullWidthSwiping; - UIPercentDrivenInteractiveTransition *_interactionController; - BOOL _hasLayout; - __weak ABI46_0_0RNSScreenStackManager *_manager; - BOOL _updateScheduled; -#ifdef RN_FABRIC_ENABLED - UIView *_snapshot; -#endif -} - -#ifdef RN_FABRIC_ENABLED -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - [self initCommonProps]; - } - - return self; -} -#endif // RN_FABRIC_ENABLED - -- (instancetype)initWithManager:(ABI46_0_0RNSScreenStackManager *)manager -{ - if (self = [super init]) { - _hasLayout = NO; - _invalidated = NO; - _manager = manager; - [self initCommonProps]; - } - return self; -} - -- (void)initCommonProps -{ - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - _presentedModals = [NSMutableArray new]; - _controller = [ABI46_0_0RNScreensNavigationController new]; - _controller.delegate = self; -#if !TARGET_OS_TV - [self setupGestureHandlers]; -#endif - // we have to initialize viewControllers with a non empty array for - // largeTitle header to render in the opened state. If it is empty - // the header will render in collapsed state which is perhaps a bug - // in UIKit but ¯\_(ツ)_/¯ - [_controller setViewControllers:@[ [UIViewController new] ]]; -} - -#pragma mark - Common - -- (void)emitOnFinishTransitioningEvent -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onFinishTransitioning(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackEventEmitter::OnFinishTransitioning{}); - } -#else - if (self.onFinishTransitioning) { - self.onFinishTransitioning(nil); - } -#endif -} - -- (void)navigationController:(UINavigationController *)navigationController - willShowViewController:(UIViewController *)viewController - animated:(BOOL)animated -{ - UIView *view = viewController.view; -#ifdef RN_FABRIC_ENABLED - if (![view isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - // if the current view is a snapshot, config was already removed so we don't trigger the method - return; - } -#endif - ABI46_0_0RNSScreenStackHeaderConfig *config = nil; - for (UIView *subview in view.ABI46_0_0ReactSubviews) { - if ([subview isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - config = (ABI46_0_0RNSScreenStackHeaderConfig *)subview; - break; - } - } - [ABI46_0_0RNSScreenStackHeaderConfig willShowViewController:viewController animated:animated withConfig:config]; -} - -- (void)presentationControllerDidDismiss:(UIPresentationController *)presentationController -{ - // We don't directly set presentation delegate but instead rely on the ScreenView's delegate to - // forward certain calls to the container (Stack). - if ([presentationController.presentedViewController isKindOfClass:[ABI46_0_0RNSScreen class]]) { - // we trigger the update of status bar's appearance here because there is no other lifecycle method - // that can handle it when dismissing a modal, the same for orientation - [ABI46_0_0RNSScreenWindowTraits updateWindowTraits]; - [_presentedModals removeObject:presentationController.presentedViewController]; - - _updatingModals = NO; -#ifdef RN_FABRIC_ENABLED - [self emitOnFinishTransitioningEvent]; -#else - // we double check if there are no new controllers pending to be presented since someone could - // have tried to push another one during the transition. - // We don't do it on Fabric since update of container will be triggered from "unmount" method afterwards - [self updateContainer]; - if (self.onFinishTransitioning) { - // instead of directly triggering onFinishTransitioning this time we enqueue the event on the - // main queue. We do that because onDismiss event is also enqueued and we want for the transition - // finish event to arrive later than onDismiss (see ABI46_0_0RNSScreen#notifyDismiss) - dispatch_async(dispatch_get_main_queue(), ^{ - [self emitOnFinishTransitioningEvent]; - }); - } -#endif - } -} - -- (NSArray *)ABI46_0_0ReactSubviews -{ - return _ABI46_0_0ReactSubviews; -} - -- (void)didMoveToWindow -{ - [super didMoveToWindow]; -#ifdef RN_FABRIC_ENABLED - // for handling nested stacks - [self maybeAddToParentAndUpdateContainer]; -#else - if (!_invalidated) { - // We check whether the view has been invalidated before running side-effects in didMoveToWindow - // This is needed because when LayoutAnimations are used it is possible for view to be re-attached - // to a window despite the fact it has been removed from the ABI46_0_0React Native view hierarchy. - [self maybeAddToParentAndUpdateContainer]; - } -#endif -} - -- (void)maybeAddToParentAndUpdateContainer -{ - BOOL wasScreenMounted = _controller.parentViewController != nil; -#ifdef RN_FABRIC_ENABLED - BOOL isScreenReadyForShowing = self.window; -#else - BOOL isScreenReadyForShowing = self.window && _hasLayout; -#endif - if (!isScreenReadyForShowing && !wasScreenMounted) { - // We wait with adding to parent controller until the stack is mounted and has its initial - // layout done. - // If we add it before layout, some of the items (specifically items from the navigation bar), - // won't be able to position properly. Also the position and size of such items, even if it - // happens to change, won't be properly updated (this is perhaps some internal issue of UIKit). - // If we add it when window is not attached, some of the view transitions will be bloced (i.e. - // modal transitions) and the internal view controler's state will get out of sync with what's - // on screen without us knowing. - return; - } - [self updateContainer]; - if (!wasScreenMounted) { - // when stack hasn't been added to parent VC yet we do two things: - // 1) we run updateContainer (the one above) – we do this because we want push view controllers to - // be installed before the VC is mounted. If we do that after it is added to parent the push - // updates operations are going to be blocked by UIKit. - // 2) we add navigation VS to parent – this is needed for the VC lifecycle events to be dispatched - // properly - // 3) we again call updateContainer – this time we do this to open modal controllers. Modals - // won't open in (1) because they require navigator to be added to parent. We handle that case - // gracefully in setModalViewControllers and can retry opening at any point. - [self ABI46_0_0ReactAddControllerToClosestParent:_controller]; - [self updateContainer]; - } -} - -- (void)ABI46_0_0ReactAddControllerToClosestParent:(UIViewController *)controller -{ - if (!controller.parentViewController) { - UIView *parentView = (UIView *)self.ABI46_0_0ReactSuperview; - while (parentView) { - if (parentView.ABI46_0_0ReactViewController) { - [parentView.ABI46_0_0ReactViewController addChildViewController:controller]; - [self addSubview:controller.view]; -#if !TARGET_OS_TV - _controller.interactivePopGestureRecognizer.delegate = self; -#endif - [controller didMoveToParentViewController:parentView.ABI46_0_0ReactViewController]; - // On iOS pre 12 we observed that `willShowViewController` delegate method does not always - // get triggered when the navigation controller is instantiated. As the only thing we do in - // that delegate method is ask nav header to update to the current state it does not hurt to - // trigger that logic from here too such that we can be sure the header is properly updated. - [self navigationController:_controller willShowViewController:_controller.topViewController animated:NO]; - break; - } - parentView = (UIView *)parentView.ABI46_0_0ReactSuperview; - } - return; - } -} - -- (void)setModalViewControllers:(NSArray *)controllers -{ - // prevent re-entry - if (_updatingModals) { - _scheduleModalsUpdate = YES; - return; - } - - // when there is no change we return immediately. This check is important because sometime we may - // accidently trigger modal dismiss if we don't verify to run the below code only when an actual - // change in the list of presented modal was made. - if ([_presentedModals isEqualToArray:controllers]) { - return; - } - - // if view controller is not yet attached to window we skip updates now and run them when view - // is attached - if (self.window == nil && _presentedModals.lastObject.view.window == nil) { - return; - } - - _updatingModals = YES; - - NSMutableArray *newControllers = [NSMutableArray arrayWithArray:controllers]; - [newControllers removeObjectsInArray:_presentedModals]; - - // find bottom-most controller that should stay on the stack for the duration of transition - NSUInteger changeRootIndex = 0; - UIViewController *changeRootController = _controller; - for (NSUInteger i = 0; i < MIN(_presentedModals.count, controllers.count); i++) { - if (_presentedModals[i] == controllers[i]) { - changeRootController = controllers[i]; - changeRootIndex = i + 1; - } else { - break; - } - } - - // we verify that controllers added on top of changeRootIndex are all new. Unfortunately modal - // VCs cannot be reshuffled (there are some visual glitches when we try to dismiss then show as - // even non-animated dismissal has delay and updates the screen several times) - for (NSUInteger i = changeRootIndex; i < controllers.count; i++) { - if ([_presentedModals containsObject:controllers[i]]) { - ABI46_0_0RCTAssert(false, @"Modally presented controllers are being reshuffled, this is not allowed"); - } - } - - __weak ABI46_0_0RNSScreenStackView *weakSelf = self; - - void (^afterTransitions)(void) = ^{ - [weakSelf emitOnFinishTransitioningEvent]; - weakSelf.updatingModals = NO; - if (weakSelf.scheduleModalsUpdate) { - // if modals update was requested during setModalViewControllers we set scheduleModalsUpdate - // flag in order to perform updates at a later point. Here we are done with all modals - // transitions and check this flag again. If it was set, we reset the flag and execute updates. - weakSelf.scheduleModalsUpdate = NO; - [weakSelf updateContainer]; - } - // we trigger the update of orientation here because, when dismissing the modal from JS, - // neither `viewWillAppear` nor `presentationControllerDidDismiss` are called, same for status bar. - [ABI46_0_0RNSScreenWindowTraits updateWindowTraits]; - }; - - void (^finish)(void) = ^{ - NSUInteger oldCount = weakSelf.presentedModals.count; - if (changeRootIndex < oldCount) { - [weakSelf.presentedModals removeObjectsInRange:NSMakeRange(changeRootIndex, oldCount - changeRootIndex)]; - } - BOOL isAttached = - changeRootController.parentViewController != nil || changeRootController.presentingViewController != nil; - if (!isAttached || changeRootIndex >= controllers.count) { - // if change controller view is not attached, presenting modals will silently fail on iOS. - // In such a case we trigger controllers update from didMoveToWindow. - // We also don't run any present transitions if changeRootIndex is greater or equal to the size - // of new controllers array. This means that no new controllers should be presented. - afterTransitions(); - return; - } else { - UIViewController *previous = changeRootController; - for (NSUInteger i = changeRootIndex; i < controllers.count; i++) { - UIViewController *next = controllers[i]; - BOOL lastModal = (i == controllers.count - 1); - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, tvOS 13.0, *)) { - // Inherit UI style from its parent - solves an issue with incorrect style being applied to some UIKit views - // like date picker or segmented control. - next.overrideUserInterfaceStyle = self->_controller.overrideUserInterfaceStyle; - } -#endif - - BOOL shouldAnimate = lastModal && [next isKindOfClass:[ABI46_0_0RNSScreen class]] && - ((ABI46_0_0RNSScreen *)next).screenView.stackAnimation != ABI46_0_0RNSScreenStackAnimationNone; - - // if you want to present another modal quick enough after dismissing the previous one, - // it will result in wrong changeRootController, see repro in - // https://github.com/software-mansion/react-native-screens/issues/1299 We call `updateContainer` again in - // `presentationControllerDidDismiss` to cover this case and present new controller - if (previous.beingDismissed) { - return; - } - - [previous presentViewController:next - animated:shouldAnimate - completion:^{ - [weakSelf.presentedModals addObject:next]; - if (lastModal) { - afterTransitions(); - }; - }]; - previous = next; - } - } - }; - - if (changeRootController.presentedViewController != nil && - [_presentedModals containsObject:changeRootController.presentedViewController]) { - BOOL shouldAnimate = changeRootIndex == controllers.count && - [changeRootController.presentedViewController isKindOfClass:[ABI46_0_0RNSScreen class]] && - ((ABI46_0_0RNSScreen *)changeRootController.presentedViewController).screenView.stackAnimation != - ABI46_0_0RNSScreenStackAnimationNone; - [changeRootController dismissViewControllerAnimated:shouldAnimate completion:finish]; - } else { - finish(); - } -} - -- (void)setPushViewControllers:(NSArray *)controllers -{ - // when there is no change we return immediately - if ([_controller.viewControllers isEqualToArray:controllers]) { - return; - } - - // if view controller is not yet attached to window we skip updates now and run them when view - // is attached - if (self.window == nil) { - return; - } - // when transition is ongoing, any updates made to the controller will not be reflected until the - // transition is complete. In particular, when we push/pop view controllers we expect viewControllers - // property to be updated immediately. Based on that property we then calculate future updates. - // When the transition is ongoing the property won't be updated immediatly. We therefore avoid - // making any updated when transition is ongoing and schedule updates for when the transition - // is complete. - if (_controller.transitionCoordinator != nil) { - if (!_updateScheduled) { - _updateScheduled = YES; - __weak ABI46_0_0RNSScreenStackView *weakSelf = self; - [_controller.transitionCoordinator - animateAlongsideTransition:^(id _Nonnull context) { - // do nothing here, we only want to be notified when transition is complete - } - completion:^(id _Nonnull context) { - self->_updateScheduled = NO; - [weakSelf updateContainer]; - }]; - } - return; - } - - UIViewController *top = controllers.lastObject; -#ifdef RN_FABRIC_ENABLED - UIViewController *previousTop = _controller.topViewController; -#else - UIViewController *previousTop = _controller.viewControllers.lastObject; -#endif - - // At the start we set viewControllers to contain a single UIViewController - // instance. This is a workaround for header height adjustment bug (see comment - // in the init function). Here, we need to detect if the initial empty - // controller is still there - BOOL firstTimePush = ![previousTop isKindOfClass:[ABI46_0_0RNSScreen class]]; - - if (firstTimePush) { - // nothing pushed yet - [_controller setViewControllers:controllers animated:NO]; - } else if (top != previousTop) { - if (![controllers containsObject:previousTop]) { - // if the previous top screen does not exist anymore and the new top was not on the stack before, probably replace - // was called, so we check the animation - if (![_controller.viewControllers containsObject:top] && - ((ABI46_0_0RNSScreenView *)top.view).replaceAnimation == ABI46_0_0RNSScreenReplaceAnimationPush) { - // setting new controllers with animation does `push` animation by default -#ifdef RN_FABRIC_ENABLED - auto screenController = (ABI46_0_0RNSScreen *)top; - [screenController resetViewToScreen]; -#endif - [_controller setViewControllers:controllers animated:YES]; - } else { - // last top controller is no longer on stack - // in this case we set the controllers stack to the new list with - // added the last top element to it and perform (animated) pop - NSMutableArray *newControllers = [NSMutableArray arrayWithArray:controllers]; - [newControllers addObject:previousTop]; - [_controller setViewControllers:newControllers animated:NO]; - [_controller popViewControllerAnimated:YES]; - } - } else if (![_controller.viewControllers containsObject:top]) { - // new top controller is not on the stack - // in such case we update the stack except from the last element with - // no animation and do animated push of the last item - NSMutableArray *newControllers = [NSMutableArray arrayWithArray:controllers]; - [newControllers removeLastObject]; - [_controller setViewControllers:newControllers animated:NO]; -#ifdef RN_FABRIC_ENABLED - auto screenController = (ABI46_0_0RNSScreen *)top; - [screenController resetViewToScreen]; -#endif - [_controller pushViewController:top animated:YES]; - } else { - // don't really know what this case could be, but may need to handle it - // somehow - [_controller setViewControllers:controllers animated:NO]; - } - } else { - // change wasn't on the top of the stack. We don't need animation. - [_controller setViewControllers:controllers animated:NO]; - } -} - -- (void)updateContainer -{ - NSMutableArray *pushControllers = [NSMutableArray new]; - NSMutableArray *modalControllers = [NSMutableArray new]; - for (ABI46_0_0RNSScreenView *screen in _ABI46_0_0ReactSubviews) { - if (!screen.dismissed && screen.controller != nil) { - if (pushControllers.count == 0) { - // first screen on the list needs to be places as "push controller" - [pushControllers addObject:screen.controller]; - } else { - if (screen.stackPresentation == ABI46_0_0RNSScreenStackPresentationPush) { - [pushControllers addObject:screen.controller]; - } else { - [modalControllers addObject:screen.controller]; - } - } - } - } - - [self setPushViewControllers:pushControllers]; - [self setModalViewControllers:modalControllers]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - _controller.view.frame = self.bounds; -} - -- (void)dismissOnReload -{ -#ifdef RN_FABRIC_ENABLED - if ([_controller.visibleViewController isKindOfClass:[ABI46_0_0RNSScreen class]]) { - [(ABI46_0_0RNSScreen *)_controller.visibleViewController resetViewToScreen]; - } -#else - dispatch_async(dispatch_get_main_queue(), ^{ - [self invalidate]; - }); -#endif -} - -#pragma mark methods connected to transitioning - -- (id)navigationController:(UINavigationController *)navigationController - animationControllerForOperation:(UINavigationControllerOperation)operation - fromViewController:(UIViewController *)fromVC - toViewController:(UIViewController *)toVC -{ - ABI46_0_0RNSScreenView *screen; - if (operation == UINavigationControllerOperationPush) { - screen = ((ABI46_0_0RNSScreen *)toVC).screenView; - } else if (operation == UINavigationControllerOperationPop) { - screen = ((ABI46_0_0RNSScreen *)fromVC).screenView; - } - if (screen != nil && - // we need to return the animator when full width swiping even if the animation is not custom, - // otherwise the screen will be just popped immediately due to no animation - (_isFullWidthSwiping || [ABI46_0_0RNSScreenStackAnimator isCustomAnimation:screen.stackAnimation])) { - return [[ABI46_0_0RNSScreenStackAnimator alloc] initWithOperation:operation]; - } - return nil; -} - -- (void)cancelTouchesInParent -{ - // cancel touches in parent, this is needed to cancel RN touch events. For example when Touchable - // item is close to an edge and we start pulling from edge we want the Touchable to be cancelled. - // Without the below code the Touchable will remain active (highlighted) for the duration of back - // gesture and onPress may fire when we release the finger. - UIView *parent = _controller.view; - while (parent != nil && ![parent respondsToSelector:@selector(touchHandler)]) - parent = parent.superview; - if (parent != nil) { -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTSurfaceTouchHandler *touchHandler = [parent performSelector:@selector(touchHandler)]; -#else - ABI46_0_0RCTTouchHandler *touchHandler = [parent performSelector:@selector(touchHandler)]; -#endif - [touchHandler setEnabled:NO]; - [touchHandler setEnabled:YES]; - [touchHandler reset]; - } -} - -- (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer -{ - ABI46_0_0RNSScreenView *topScreen = _ABI46_0_0ReactSubviews.lastObject; - -#if TARGET_OS_TV - [self cancelTouchesInParent]; - return YES; -#else - // ABI46_0_0RNSPanGestureRecognizer will receive events iff topScreen.fullScreenSwipeEnabled == YES; - // Events are filtered in gestureRecognizer:shouldReceivePressOrTouchEvent: method - if ([gestureRecognizer isKindOfClass:[ABI46_0_0RNSPanGestureRecognizer class]]) { - if ([self isInGestureResponseDistance:gestureRecognizer topScreen:topScreen]) { - _isFullWidthSwiping = YES; - [self cancelTouchesInParent]; - return YES; - } - return NO; - } - - // Now we're dealing with ABI46_0_0RNSScreenEdgeGestureRecognizer (or _UIParallaxTransitionPanGestureRecognizer) - if (topScreen.customAnimationOnSwipe && [ABI46_0_0RNSScreenStackAnimator isCustomAnimation:topScreen.stackAnimation]) { - if ([gestureRecognizer isKindOfClass:[ABI46_0_0RNSScreenEdgeGestureRecognizer class]]) { - // if we do not set any explicit `semanticContentAttribute`, it is `UISemanticContentAttributeUnspecified` instead - // of `UISemanticContentAttributeForceLeftToRight`, so we just check if it is RTL or not - BOOL isCorrectEdge = (_controller.view.semanticContentAttribute == UISemanticContentAttributeForceRightToLeft && - ((ABI46_0_0RNSScreenEdgeGestureRecognizer *)gestureRecognizer).edges == UIRectEdgeRight) || - (_controller.view.semanticContentAttribute != UISemanticContentAttributeForceRightToLeft && - ((ABI46_0_0RNSScreenEdgeGestureRecognizer *)gestureRecognizer).edges == UIRectEdgeLeft); - if (isCorrectEdge) { - [self cancelTouchesInParent]; - return YES; - } - } - return NO; - } else { - if ([gestureRecognizer isKindOfClass:[ABI46_0_0RNSScreenEdgeGestureRecognizer class]]) { - // it should only recognize with `customAnimationOnSwipe` set - return NO; - } - // _UIParallaxTransitionPanGestureRecognizer (other...) - [self cancelTouchesInParent]; - return YES; - } - -#endif // TARGET_OS_TV -} - -#if !TARGET_OS_TV -- (void)setupGestureHandlers -{ - // gesture recognizers for custom stack animations - ABI46_0_0RNSScreenEdgeGestureRecognizer *leftEdgeSwipeGestureRecognizer = - [[ABI46_0_0RNSScreenEdgeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; - leftEdgeSwipeGestureRecognizer.edges = UIRectEdgeLeft; - leftEdgeSwipeGestureRecognizer.delegate = self; - [self addGestureRecognizer:leftEdgeSwipeGestureRecognizer]; - - ABI46_0_0RNSScreenEdgeGestureRecognizer *rightEdgeSwipeGestureRecognizer = - [[ABI46_0_0RNSScreenEdgeGestureRecognizer alloc] initWithTarget:self action:@selector(handleSwipe:)]; - rightEdgeSwipeGestureRecognizer.edges = UIRectEdgeRight; - rightEdgeSwipeGestureRecognizer.delegate = self; - [self addGestureRecognizer:rightEdgeSwipeGestureRecognizer]; - - // gesture recognizer for full width swipe gesture - ABI46_0_0RNSPanGestureRecognizer *panRecognizer = [[ABI46_0_0RNSPanGestureRecognizer alloc] initWithTarget:self - action:@selector(handleSwipe:)]; - panRecognizer.delegate = self; - [self addGestureRecognizer:panRecognizer]; -} - -- (void)handleSwipe:(UIPanGestureRecognizer *)gestureRecognizer -{ - ABI46_0_0RNSScreenView *topScreen = _ABI46_0_0ReactSubviews.lastObject; - float translation; - float velocity; - float distance; - if (topScreen.swipeDirection == ABI46_0_0RNSScreenSwipeDirectionVertical) { - translation = [gestureRecognizer translationInView:gestureRecognizer.view].y; - velocity = [gestureRecognizer velocityInView:gestureRecognizer.view].y; - distance = gestureRecognizer.view.bounds.size.height; - } else { - translation = [gestureRecognizer translationInView:gestureRecognizer.view].x; - velocity = [gestureRecognizer velocityInView:gestureRecognizer.view].x; - distance = gestureRecognizer.view.bounds.size.width; - BOOL isRTL = _controller.view.semanticContentAttribute == UISemanticContentAttributeForceRightToLeft; - if (isRTL) { - translation = -translation; - velocity = -velocity; - } - } - - float transitionProgress = (translation / distance); - - switch (gestureRecognizer.state) { - case UIGestureRecognizerStateBegan: { - _interactionController = [UIPercentDrivenInteractiveTransition new]; - [_controller popViewControllerAnimated:YES]; - break; - } - - case UIGestureRecognizerStateChanged: { - [_interactionController updateInteractiveTransition:transitionProgress]; - break; - } - - case UIGestureRecognizerStateCancelled: { - [_interactionController cancelInteractiveTransition]; - break; - } - - case UIGestureRecognizerStateEnded: { - // values taken from - // https://github.com/react-navigation/react-navigation/blob/54739828598d7072c1bf7b369659e3682db3edc5/packages/stack/src/views/Stack/Card.tsx#L316 - BOOL shouldFinishTransition = (translation + velocity * 0.3) > (distance / 2); - if (shouldFinishTransition) { - [_interactionController finishInteractiveTransition]; - } else { - [_interactionController cancelInteractiveTransition]; - } - _interactionController = nil; - } - default: { - break; - } - } -} - -- (id)navigationController:(UINavigationController *)navigationController - interactionControllerForAnimationController: - (id)animationController -{ - return _interactionController; -} - -- (id)interactionControllerForDismissal: - (id)animator -{ - return _interactionController; -} - -- (void)navigationController:(UINavigationController *)navigationController - didShowViewController:(UIViewController *)viewController - animated:(BOOL)animated -{ - [self emitOnFinishTransitioningEvent]; - [ABI46_0_0RNSScreenWindowTraits updateWindowTraits]; -} -#endif - -- (void)markChildUpdated -{ - // do nothing -} - -- (void)didUpdateChildren -{ - // do nothing -} - -- (UIViewController *)ABI46_0_0ReactViewController -{ - return _controller; -} - -- (BOOL)isInGestureResponseDistance:(UIGestureRecognizer *)gestureRecognizer topScreen:(ABI46_0_0RNSScreenView *)topScreen -{ - NSDictionary *gestureResponseDistanceValues = topScreen.gestureResponseDistance; - float x = [gestureRecognizer locationInView:gestureRecognizer.view].x; - float y = [gestureRecognizer locationInView:gestureRecognizer.view].y; - BOOL isRTL = _controller.view.semanticContentAttribute == UISemanticContentAttributeForceRightToLeft; - if (isRTL) { - x = _controller.view.frame.size.width - x; - } - - // see: - // https://github.com/software-mansion/react-native-screens/pull/1442/commits/74d4bae321875d8305ad021b3d448ebf713e7d56 - // this prop is always default initialized so we do not expect any nils - float start = [gestureResponseDistanceValues[@"start"] floatValue]; - float end = [gestureResponseDistanceValues[@"end"] floatValue]; - float top = [gestureResponseDistanceValues[@"top"] floatValue]; - float bottom = [gestureResponseDistanceValues[@"bottom"] floatValue]; - - // we check if any of the constraints are violated and return NO if so - return !( - (start != -1 && x < start) || (end != -1 && x > end) || (top != -1 && y < top) || (bottom != -1 && y > bottom)); -} - -// By default, the header buttons that are not inside the native hit area -// cannot be clicked, so we check it by ourselves -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - if (CGRectContainsPoint(_controller.navigationBar.frame, point)) { - // headerConfig should be the first subview of the topmost screen - UIView *headerConfig = [[_ABI46_0_0ReactSubviews.lastObject ABI46_0_0ReactSubviews] firstObject]; - if ([headerConfig isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - UIView *headerHitTestResult = [headerConfig hitTest:point withEvent:event]; - if (headerHitTestResult != nil) { - return headerHitTestResult; - } - } - } - return [super hitTest:point withEvent:event]; -} - -#if !TARGET_OS_TV - -- (BOOL)isScrollViewPanGestureRecognizer:(UIGestureRecognizer *)gestureRecognizer -{ - // NOTE: This hack is required to restore native behavior of edge swipe (interactive pop gesture) - // without this, on a screen with a scroll view, it's only possible to pop view by panning horizontally - // if even slightly diagonal (or if in motion), scroll view will scroll, and edge swipe will be cancelled - if (![[gestureRecognizer view] isKindOfClass:[UIScrollView class]]) { - return NO; - } - UIScrollView *scrollView = (UIScrollView *)gestureRecognizer.view; - return scrollView.panGestureRecognizer == gestureRecognizer; -} - -// Custom method for compatibility with iOS < 13.4 -// ABI46_0_0RNSScreenStackView is a UIGestureRecognizerDelegate for three types of gesture recognizers: -// ABI46_0_0RNSPanGestureRecognizer, ABI46_0_0RNSScreenEdgeGestureRecognizer, _UIParallaxTransitionPanGestureRecognizer -// Be careful when adding another type of gesture recognizer. -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceivePressOrTouchEvent:(NSObject *)event -{ - ABI46_0_0RNSScreenView *topScreen = _ABI46_0_0ReactSubviews.lastObject; - - if (![topScreen isKindOfClass:[ABI46_0_0RNSScreenView class]] || !topScreen.gestureEnabled || - _controller.viewControllers.count < 2) { - return NO; - } - - // We want to pass events to ABI46_0_0RNSPanGestureRecognizer iff full screen swipe is enabled. - if ([gestureRecognizer isKindOfClass:[ABI46_0_0RNSPanGestureRecognizer class]]) { - return topScreen.fullScreenSwipeEnabled; - } - - // ABI46_0_0RNSScreenEdgeGestureRecognizer || _UIParallaxTransitionPanGestureRecognizer - return YES; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceivePress:(UIPress *)press; -{ - return [self gestureRecognizer:gestureRecognizer shouldReceivePressOrTouchEvent:press]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; -{ - return [self gestureRecognizer:gestureRecognizer shouldReceivePressOrTouchEvent:touch]; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer - shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - if ([gestureRecognizer isKindOfClass:[ABI46_0_0RNSPanGestureRecognizer class]] && - [self isScrollViewPanGestureRecognizer:otherGestureRecognizer]) { - ABI46_0_0RNSPanGestureRecognizer *panGestureRecognizer = (ABI46_0_0RNSPanGestureRecognizer *)gestureRecognizer; - BOOL isBackGesture = [panGestureRecognizer translationInView:panGestureRecognizer.view].x > 0 && - _controller.viewControllers.count > 1; - - if (gestureRecognizer.state == UIGestureRecognizerStateBegan || isBackGesture) { - return NO; - } - - return YES; - } - return NO; -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer - shouldBeRequiredToFailByGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer -{ - return ( - [gestureRecognizer isKindOfClass:[UIScreenEdgePanGestureRecognizer class]] && - [self isScrollViewPanGestureRecognizer:otherGestureRecognizer]); -} - -#endif // !TARGET_OS_TV - -- (void)insertABI46_0_0ReactSubview:(ABI46_0_0RNSScreenView *)subview atIndex:(NSInteger)atIndex -{ - if (![subview isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - ABI46_0_0RCTLogError(@"ScreenStack only accepts children of type Screen"); - return; - } - subview.ABI46_0_0ReactSuperview = self; - [_ABI46_0_0ReactSubviews insertObject:subview atIndex:atIndex]; -} - -- (void)removeABI46_0_0ReactSubview:(ABI46_0_0RNSScreenView *)subview -{ - subview.ABI46_0_0ReactSuperview = nil; - [_ABI46_0_0ReactSubviews removeObject:subview]; -} - -- (void)didUpdateABI46_0_0ReactSubviews -{ - // we need to wait until children have their layout set. At this point they don't have the layout - // set yet, however the layout call is already enqueued on ui thread. Enqueuing update call on the - // ui queue will guarantee that the update will run after layout. - dispatch_async(dispatch_get_main_queue(), ^{ - self->_hasLayout = YES; - [self maybeAddToParentAndUpdateContainer]; - }); -} - -#ifdef RN_FABRIC_ENABLED -#pragma mark - Fabric specific - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - if (![childComponentView isKindOfClass:[ABI46_0_0RNSScreenView class]]) { - ABI46_0_0RCTLogError(@"ScreenStack only accepts children of type Screen"); - return; - } - - ABI46_0_0RCTAssert( - childComponentView.ABI46_0_0ReactSuperview == nil, - @"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)", - self, - childComponentView, - @(index), - @([childComponentView.superview tag])); - - [_ABI46_0_0ReactSubviews insertObject:(ABI46_0_0RNSScreenView *)childComponentView atIndex:index]; - ((ABI46_0_0RNSScreenView *)childComponentView).ABI46_0_0ReactSuperview = self; - dispatch_async(dispatch_get_main_queue(), ^{ - [self maybeAddToParentAndUpdateContainer]; - }); -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - ABI46_0_0RNSScreenView *screenChildComponent = (ABI46_0_0RNSScreenView *)childComponentView; - // We should only do a snapshot of a screen that is on the top. - // We also check `_presentedModals` since if you push 2 modals, second one is not a "child" of _controller. - // Also, when dissmised with a gesture, the screen already is not under the window, so we don't need to apply - // snapshot. - if (screenChildComponent.window != nil && - ((screenChildComponent == _controller.visibleViewController.view && _presentedModals.count < 2) || - screenChildComponent == [_presentedModals.lastObject view])) { - [screenChildComponent.controller setViewToSnapshot:_snapshot]; - } - - ABI46_0_0RCTAssert( - screenChildComponent.ABI46_0_0ReactSuperview == self, - @"Attempt to unmount a view which is mounted inside different view. (parent: %@, child: %@, index: %@)", - self, - screenChildComponent, - @(index)); - ABI46_0_0RCTAssert( - (_ABI46_0_0ReactSubviews.count > index) && [_ABI46_0_0ReactSubviews objectAtIndex:index] == childComponentView, - @"Attempt to unmount a view which has a different index. (parent: %@, child: %@, index: %@, actual index: %@, tag at index: %@)", - self, - screenChildComponent, - @(index), - @([_ABI46_0_0ReactSubviews indexOfObject:screenChildComponent]), - @([[_ABI46_0_0ReactSubviews objectAtIndex:index] tag])); - screenChildComponent.ABI46_0_0ReactSuperview = nil; - [_ABI46_0_0ReactSubviews removeObject:screenChildComponent]; - [screenChildComponent removeFromSuperview]; - dispatch_async(dispatch_get_main_queue(), ^{ - [self maybeAddToParentAndUpdateContainer]; - }); -} - -- (void)takeSnapshot -{ - _snapshot = [_controller.visibleViewController.view snapshotViewAfterScreenUpdates:NO]; -} - -- (void)mountingTransactionWillMount:(ABI46_0_0facebook::ABI46_0_0React::MountingTransaction const &)transaction - withSurfaceTelemetry:(ABI46_0_0facebook::ABI46_0_0React::SurfaceTelemetry const &)surfaceTelemetry -{ - for (auto mutation : transaction.getMutations()) { - if (mutation.type == ABI46_0_0facebook::ABI46_0_0React::ShadowViewMutation::Type::Remove && - mutation.parentShadowView.componentName != nil && - strcmp(mutation.parentShadowView.componentName, "ABI46_0_0RNSScreenStack") == 0) { - [self takeSnapshot]; - return; - } - } -} - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - - for (UIViewController *controller in _presentedModals) { - [controller dismissViewControllerAnimated:NO completion:nil]; - } - - [_presentedModals removeAllObjects]; - [self dismissOnReload]; - [_controller willMoveToParentViewController:nil]; - [_controller removeFromParentViewController]; - [_controller setViewControllers:@[ [UIViewController new] ]]; -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider(); -} -#else -#pragma mark - Paper specific - -- (void)invalidate -{ - _invalidated = YES; - for (UIViewController *controller in _presentedModals) { - [controller dismissViewControllerAnimated:NO completion:nil]; - } - [_presentedModals removeAllObjects]; - [_controller willMoveToParentViewController:nil]; - [_controller removeFromParentViewController]; -} - -#endif // RN_FABRIC_ENABLED - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenStackCls(void) -{ - return ABI46_0_0RNSScreenStackView.class; -} -#endif - -@implementation ABI46_0_0RNSScreenStackManager { - NSPointerArray *_stacks; -} - -ABI46_0_0RCT_EXPORT_MODULE() - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onFinishTransitioning, ABI46_0_0RCTDirectEventBlock); - -#ifdef RN_FABRIC_ENABLED -#else -- (UIView *)view -{ - ABI46_0_0RNSScreenStackView *view = [[ABI46_0_0RNSScreenStackView alloc] initWithManager:self]; - if (!_stacks) { - _stacks = [NSPointerArray weakObjectsPointerArray]; - } - [_stacks addPointer:(__bridge void *)view]; - return view; -} -#endif // RN_FABRIC_ENABLED - -- (void)invalidate -{ - for (ABI46_0_0RNSScreenStackView *stack in _stacks) { - [stack dismissOnReload]; - } - _stacks = nil; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.h deleted file mode 100644 index 8e26844f907b39..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.h +++ /dev/null @@ -1,8 +0,0 @@ -#import "ABI46_0_0RNSScreen.h" - -@interface ABI46_0_0RNSScreenStackAnimator : NSObject - -- (instancetype)initWithOperation:(UINavigationControllerOperation)operation; -+ (BOOL)isCustomAnimation:(ABI46_0_0RNSScreenStackAnimation)animation; - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.mm deleted file mode 100644 index 89eb8e16ea0795..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackAnimator.mm +++ /dev/null @@ -1,320 +0,0 @@ -#import "ABI46_0_0RNSScreenStackAnimator.h" -#import "ABI46_0_0RNSScreenStack.h" - -#import "ABI46_0_0RNSScreen.h" - -// proportions to default transition duration -static const float ABI46_0_0RNSSlideOpenTransitionDurationProportion = 1; -static const float ABI46_0_0RNSFadeOpenTransitionDurationProportion = 0.2 / 0.35; -static const float ABI46_0_0RNSSlideCloseTransitionDurationProportion = 0.25 / 0.35; -static const float ABI46_0_0RNSFadeCloseTransitionDurationProportion = 0.15 / 0.35; -static const float ABI46_0_0RNSFadeCloseDelayTransitionDurationProportion = 0.1 / 0.35; - -@implementation ABI46_0_0RNSScreenStackAnimator { - UINavigationControllerOperation _operation; - NSTimeInterval _transitionDuration; -} - -- (instancetype)initWithOperation:(UINavigationControllerOperation)operation -{ - if (self = [super init]) { - _operation = operation; - _transitionDuration = 0.35; // default duration in seconds - } - return self; -} - -- (NSTimeInterval)transitionDuration:(id)transitionContext -{ - ABI46_0_0RNSScreenView *screen; - if (_operation == UINavigationControllerOperationPush) { - UIViewController *toViewController = - [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; - screen = ((ABI46_0_0RNSScreen *)toViewController).screenView; - } else if (_operation == UINavigationControllerOperationPop) { - UIViewController *fromViewController = - [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; - screen = ((ABI46_0_0RNSScreen *)fromViewController).screenView; - } - - if (screen != nil && screen.stackAnimation == ABI46_0_0RNSScreenStackAnimationNone) { - return 0; - } - - if (screen != nil && screen.transitionDuration != nil && [screen.transitionDuration floatValue] >= 0) { - float durationInSeconds = [screen.transitionDuration floatValue] / 1000.0; - return durationInSeconds; - } - - return _transitionDuration; -} - -- (void)animateTransition:(id)transitionContext -{ - UIViewController *toViewController = [transitionContext viewControllerForKey:UITransitionContextToViewControllerKey]; - UIViewController *fromViewController = - [transitionContext viewControllerForKey:UITransitionContextFromViewControllerKey]; - toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; - - ABI46_0_0RNSScreenView *screen; - if (_operation == UINavigationControllerOperationPush) { - screen = ((ABI46_0_0RNSScreen *)toViewController).screenView; - } else if (_operation == UINavigationControllerOperationPop) { - screen = ((ABI46_0_0RNSScreen *)fromViewController).screenView; - } - - if (screen != nil) { - if (screen.fullScreenSwipeEnabled && transitionContext.isInteractive) { - // we are swiping with full width gesture - if (screen.customAnimationOnSwipe) { - [self animateTransitionWithStackAnimation:screen.stackAnimation - transitionContext:transitionContext - toVC:toViewController - fromVC:fromViewController]; - } else { - // we have to provide an animation when swiping, otherwise the screen will be popped immediately, - // so in case of no custom animation on swipe set, we provide the one closest to the default - [self animateSimplePushWithTransitionContext:transitionContext toVC:toViewController fromVC:fromViewController]; - } - } else { - // we are going forward or provided custom animation on swipe or clicked native header back button - [self animateTransitionWithStackAnimation:screen.stackAnimation - transitionContext:transitionContext - toVC:toViewController - fromVC:fromViewController]; - } - } -} - -- (void)animateSimplePushWithTransitionContext:(id)transitionContext - toVC:(UIViewController *)toViewController - fromVC:(UIViewController *)fromViewController -{ - float containerWidth = transitionContext.containerView.bounds.size.width; - float belowViewWidth = containerWidth * 0.3; - - CGAffineTransform rightTransform = CGAffineTransformMakeTranslation(containerWidth, 0); - CGAffineTransform leftTransform = CGAffineTransformMakeTranslation(-belowViewWidth, 0); - - if (toViewController.navigationController.view.semanticContentAttribute == - UISemanticContentAttributeForceRightToLeft) { - rightTransform = CGAffineTransformMakeTranslation(-containerWidth, 0); - leftTransform = CGAffineTransformMakeTranslation(belowViewWidth, 0); - } - - if (_operation == UINavigationControllerOperationPush) { - toViewController.view.transform = rightTransform; - [[transitionContext containerView] addSubview:toViewController.view]; - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:^{ - fromViewController.view.transform = leftTransform; - toViewController.view.transform = CGAffineTransformIdentity; - } - completion:^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - } else if (_operation == UINavigationControllerOperationPop) { - toViewController.view.transform = leftTransform; - [[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view]; - - void (^animationBlock)(void) = ^{ - toViewController.view.transform = CGAffineTransformIdentity; - fromViewController.view.transform = rightTransform; - }; - void (^completionBlock)(BOOL) = ^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }; - - if (!transitionContext.isInteractive) { - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:animationBlock - completion:completionBlock]; - } else { - // we don't want the EaseInOut option when swiping to dismiss the view, it is the same in default animation option - [UIView animateWithDuration:[self transitionDuration:transitionContext] - delay:0.0 - options:UIViewAnimationOptionCurveLinear - animations:animationBlock - completion:completionBlock]; - } - } -} - -- (void)animateFadeWithTransitionContext:(id)transitionContext - toVC:(UIViewController *)toViewController - fromVC:(UIViewController *)fromViewController -{ - toViewController.view.frame = [transitionContext finalFrameForViewController:toViewController]; - - if (_operation == UINavigationControllerOperationPush) { - [[transitionContext containerView] addSubview:toViewController.view]; - toViewController.view.alpha = 0.0; - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:^{ - toViewController.view.alpha = 1.0; - } - completion:^(BOOL finished) { - toViewController.view.alpha = 1.0; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - } else if (_operation == UINavigationControllerOperationPop) { - [[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view]; - - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:^{ - fromViewController.view.alpha = 0.0; - } - completion:^(BOOL finished) { - fromViewController.view.alpha = 1.0; - - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - } -} - -- (void)animateSlideFromBottomWithTransitionContext:(id)transitionContext - toVC:(UIViewController *)toViewController - fromVC:(UIViewController *)fromViewController -{ - CGAffineTransform topBottomTransform = - CGAffineTransformMakeTranslation(0, transitionContext.containerView.bounds.size.height); - - if (_operation == UINavigationControllerOperationPush) { - toViewController.view.transform = topBottomTransform; - [[transitionContext containerView] addSubview:toViewController.view]; - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:^{ - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - } - completion:^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - } else if (_operation == UINavigationControllerOperationPop) { - toViewController.view.transform = CGAffineTransformIdentity; - [[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view]; - - void (^animationBlock)(void) = ^{ - toViewController.view.transform = CGAffineTransformIdentity; - fromViewController.view.transform = topBottomTransform; - }; - void (^completionBlock)(BOOL) = ^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }; - - if (!transitionContext.isInteractive) { - [UIView animateWithDuration:[self transitionDuration:transitionContext] - animations:animationBlock - completion:completionBlock]; - } else { - // we don't want the EaseInOut option when swiping to dismiss the view, it is the same in default animation option - [UIView animateWithDuration:[self transitionDuration:transitionContext] - delay:0.0 - options:UIViewAnimationOptionCurveLinear - animations:animationBlock - completion:completionBlock]; - } - } -} - -- (void)animateFadeFromBottomWithTransitionContext:(id)transitionContext - toVC:(UIViewController *)toViewController - fromVC:(UIViewController *)fromViewController -{ - CGAffineTransform topBottomTransform = - CGAffineTransformMakeTranslation(0, 0.08 * transitionContext.containerView.bounds.size.height); - - const float transitionDuration = [self transitionDuration:transitionContext]; - - if (_operation == UINavigationControllerOperationPush) { - toViewController.view.transform = topBottomTransform; - toViewController.view.alpha = 0.0; - [[transitionContext containerView] addSubview:toViewController.view]; - - // Android Nougat open animation - // http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml - [UIView animateWithDuration:transitionDuration * ABI46_0_0RNSSlideOpenTransitionDurationProportion // defaults to 0.35 s - delay:0 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - } - completion:^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - [UIView animateWithDuration:transitionDuration * ABI46_0_0RNSFadeOpenTransitionDurationProportion // defaults to 0.2 s - delay:0 - options:UIViewAnimationOptionCurveEaseOut - animations:^{ - toViewController.view.alpha = 1.0; - } - completion:nil]; - - } else if (_operation == UINavigationControllerOperationPop) { - toViewController.view.transform = CGAffineTransformIdentity; - [[transitionContext containerView] insertSubview:toViewController.view belowSubview:fromViewController.view]; - - // Android Nougat exit animation - // http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml - [UIView animateWithDuration:transitionDuration * ABI46_0_0RNSSlideCloseTransitionDurationProportion // defaults to 0.25 s - delay:0 - options:UIViewAnimationOptionCurveEaseIn - animations:^{ - toViewController.view.transform = CGAffineTransformIdentity; - fromViewController.view.transform = topBottomTransform; - } - completion:^(BOOL finished) { - fromViewController.view.transform = CGAffineTransformIdentity; - toViewController.view.transform = CGAffineTransformIdentity; - fromViewController.view.alpha = 1.0; - toViewController.view.alpha = 1.0; - [transitionContext completeTransition:![transitionContext transitionWasCancelled]]; - }]; - [UIView animateWithDuration:transitionDuration * ABI46_0_0RNSFadeCloseTransitionDurationProportion // defaults to 0.15 s - delay:transitionDuration * ABI46_0_0RNSFadeCloseDelayTransitionDurationProportion // defaults to 0.1 s - options:UIViewAnimationOptionCurveLinear - animations:^{ - fromViewController.view.alpha = 0.0; - } - completion:nil]; - } -} - -+ (BOOL)isCustomAnimation:(ABI46_0_0RNSScreenStackAnimation)animation -{ - return (animation != ABI46_0_0RNSScreenStackAnimationFlip && animation != ABI46_0_0RNSScreenStackAnimationDefault); -} - -- (void)animateTransitionWithStackAnimation:(ABI46_0_0RNSScreenStackAnimation)animation - transitionContext:(id)transitionContext - toVC:(UIViewController *)toVC - fromVC:(UIViewController *)fromVC -{ - if (animation == ABI46_0_0RNSScreenStackAnimationSimplePush) { - [self animateSimplePushWithTransitionContext:transitionContext toVC:toVC fromVC:fromVC]; - return; - } else if (animation == ABI46_0_0RNSScreenStackAnimationFade || animation == ABI46_0_0RNSScreenStackAnimationNone) { - [self animateFadeWithTransitionContext:transitionContext toVC:toVC fromVC:fromVC]; - return; - } else if (animation == ABI46_0_0RNSScreenStackAnimationSlideFromBottom) { - [self animateSlideFromBottomWithTransitionContext:transitionContext toVC:toVC fromVC:fromVC]; - return; - } else if (animation == ABI46_0_0RNSScreenStackAnimationFadeFromBottom) { - [self animateFadeFromBottomWithTransitionContext:transitionContext toVC:toVC fromVC:fromVC]; - return; - } - // simple_push is the default custom animation - [self animateSimplePushWithTransitionContext:transitionContext toVC:toVC fromVC:fromVC]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.h deleted file mode 100644 index 636ef1ae684bd9..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#else -#import -#endif - -#import -#import "ABI46_0_0RNSScreen.h" -#import "ABI46_0_0RNSScreenStackHeaderSubview.h" -#import "ABI46_0_0RNSSearchBar.h" - -@interface ABI46_0_0RNSScreenStackHeaderConfig : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - UIView -#endif - -@property (nonatomic, weak) ABI46_0_0RNSScreenView *screenView; - -#ifdef RN_FABRIC_ENABLED -@property (nonatomic) BOOL show; -#else -@property (nonatomic) UIBlurEffectStyle blurEffect; -@property (nonatomic) BOOL hide; -#endif - -@property (nonatomic, retain) NSString *title; -@property (nonatomic, retain) NSString *titleFontFamily; -@property (nonatomic, retain) NSNumber *titleFontSize; -@property (nonatomic, retain) NSString *titleFontWeight; -@property (nonatomic, retain) UIColor *titleColor; -@property (nonatomic, retain) NSString *backTitle; -@property (nonatomic, retain) NSString *backTitleFontFamily; -@property (nonatomic, retain) NSNumber *backTitleFontSize; -@property (nonatomic, retain) UIColor *backgroundColor; -@property (nonatomic, retain) UIColor *color; -@property (nonatomic) BOOL largeTitle; -@property (nonatomic, retain) NSString *largeTitleFontFamily; -@property (nonatomic, retain) NSNumber *largeTitleFontSize; -@property (nonatomic, retain) NSString *largeTitleFontWeight; -@property (nonatomic, retain) UIColor *largeTitleBackgroundColor; -@property (nonatomic) BOOL largeTitleHideShadow; -@property (nonatomic, retain) UIColor *largeTitleColor; -@property (nonatomic) BOOL hideBackButton; -@property (nonatomic) BOOL disableBackButtonMenu; -@property (nonatomic) BOOL hideShadow; -@property (nonatomic) BOOL translucent; -@property (nonatomic) BOOL backButtonInCustomView; -@property (nonatomic) UISemanticContentAttribute direction; - -+ (void)willShowViewController:(UIViewController *)vc - animated:(BOOL)animated - withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config; - -@end - -@interface ABI46_0_0RNSScreenStackHeaderConfigManager : ABI46_0_0RCTViewManager - -@end - -@interface ABI46_0_0RCTConvert (ABI46_0_0RNSScreenStackHeader) - -+ (UIBlurEffectStyle)UIBlurEffectStyle:(id)json; -+ (UISemanticContentAttribute)UISemanticContentAttribute:(id)json; - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.mm deleted file mode 100644 index a1b329258050c7..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderConfig.mm +++ /dev/null @@ -1,884 +0,0 @@ -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#else -#import -#import -#import -#import -#import -#import -#import -#endif -#import -#import "ABI46_0_0RNSScreen.h" -#import "ABI46_0_0RNSScreenStackHeaderConfig.h" -#import "ABI46_0_0RNSSearchBar.h" -#import "ABI46_0_0RNSUIBarButtonItem.h" - -#ifdef RN_FABRIC_ENABLED -#else -// Some RN private method hacking below. Couldn't figure out better way to access image data -// of a given ABI46_0_0RCTImageView. See more comments in the code section processing SubviewTypeBackButton -@interface ABI46_0_0RCTImageView (Private) -- (UIImage *)image; -@end - -@interface ABI46_0_0RCTImageLoader (Private) -- (id)imageCache; -@end -#endif - -@implementation ABI46_0_0RNSScreenStackHeaderConfig { - NSMutableArray *_ABI46_0_0ReactSubviews; -#ifdef RN_FABRIC_ENABLED - BOOL _initialPropsSet; -#else -#endif -} - -#ifdef RN_FABRIC_ENABLED -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - self.hidden = YES; - _show = YES; - _translucent = NO; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - } - return self; -} -#else -- (instancetype)init -{ - if (self = [super init]) { - self.hidden = YES; - _translucent = YES; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - } - return self; -} -#endif - -- (UIView *)ABI46_0_0ReactSuperview -{ - return _screenView; -} - -- (NSArray *)ABI46_0_0ReactSubviews -{ - return _ABI46_0_0ReactSubviews; -} - -- (void)removeFromSuperview -{ - [super removeFromSuperview]; - _screenView = nil; -} - -// this method is never invoked by the system since this view -// is not added to native view hierarchy so we can apply our logic -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - for (ABI46_0_0RNSScreenStackHeaderSubview *subview in _ABI46_0_0ReactSubviews) { - if (subview.type == ABI46_0_0RNSScreenStackHeaderSubviewTypeLeft || subview.type == ABI46_0_0RNSScreenStackHeaderSubviewTypeRight) { - // we wrap the headerLeft/Right component in a UIBarButtonItem - // so we need to use the only subview of it to retrieve the correct view - UIView *headerComponent = subview.subviews.firstObject; - // we convert the point to ABI46_0_0RNSScreenStackView since it always contains the header inside it - CGPoint convertedPoint = [_screenView.ABI46_0_0ReactSuperview convertPoint:point toView:headerComponent]; - - UIView *hitTestResult = [headerComponent hitTest:convertedPoint withEvent:event]; - if (hitTestResult != nil) { - return hitTestResult; - } - } - } - return nil; -} - -- (void)updateViewControllerIfNeeded -{ - UIViewController *vc = _screenView.controller; - UINavigationController *nav = (UINavigationController *)vc.parentViewController; - UIViewController *nextVC = nav.visibleViewController; - if (nav.transitionCoordinator != nil) { - // if navigator is performing transition instead of allowing to update of `visibleConttroller` - // we look at `topController`. This is because during transitiong the `visibleController` won't - // point to the controller that is going to be revealed after transition. This check fixes the - // problem when config gets updated while the transition is ongoing. - nextVC = nav.topViewController; - } - - // we want updates sent to the VC below modal too since it is also visible - BOOL isPresentingVC = vc.presentedViewController == nextVC; - - BOOL isInFullScreenModal = nav == nil && _screenView.stackPresentation == ABI46_0_0RNSScreenStackPresentationFullScreenModal; - // if nav is nil, it means we can be in a fullScreen modal, so there is no nextVC, but we still want to update - if (vc != nil && (nextVC == vc || isInFullScreenModal || isPresentingVC)) { - [ABI46_0_0RNSScreenStackHeaderConfig updateViewController:self.screenView.controller withConfig:self animated:YES]; - } -} - -- (void)layoutNavigationControllerView -{ - // We need to layout navigation controller view after translucent prop changes, because otherwise - // frame of ABI46_0_0RNSScreen will not be changed and screen content will remain the same size. - // For more details look at https://github.com/software-mansion/react-native-screens/issues/1158 - UIViewController *vc = _screenView.controller; - UINavigationController *navctr = vc.navigationController; - [navctr.view setNeedsLayout]; -} - -+ (void)setAnimatedConfig:(UIViewController *)vc withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config -{ - UINavigationBar *navbar = ((UINavigationController *)vc.parentViewController).navigationBar; - // It is workaround for loading custom back icon when transitioning from a screen without header to the screen which - // has one. This action fails when navigating to the screen with header for the second time and loads default back - // button. It looks like changing the tint color of navbar triggers an update of the items belonging to it and it - // seems to load the custom back image so we change the tint color's alpha by a very small amount and then set it to - // the one it should have. -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_14_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 - // it brakes the behavior of `headerRight` in iOS 14, where the bug desribed above seems to be fixed, so we do nothing - // in iOS 14 - if (@available(iOS 14.0, *)) { - } else -#endif - { - [navbar setTintColor:[config.color colorWithAlphaComponent:CGColorGetAlpha(config.color.CGColor) - 0.01]]; - } - [navbar setTintColor:config.color]; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - // font customized on the navigation item level, so nothing to do here - } else -#endif - { - BOOL hideShadow = config.hideShadow; - - if (config.backgroundColor && CGColorGetAlpha(config.backgroundColor.CGColor) == 0.) { - [navbar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; - [navbar setBarTintColor:[UIColor clearColor]]; - hideShadow = YES; - } else { - [navbar setBackgroundImage:nil forBarMetrics:UIBarMetricsDefault]; - [navbar setBarTintColor:config.backgroundColor]; - } - [navbar setTranslucent:config.translucent]; - [navbar setValue:@(hideShadow ? YES : NO) forKey:@"hidesShadow"]; - - if (config.titleFontFamily || config.titleFontSize || config.titleFontWeight || config.titleColor) { - NSMutableDictionary *attrs = [NSMutableDictionary new]; - - if (config.titleColor) { - attrs[NSForegroundColorAttributeName] = config.titleColor; - } - - NSString *family = config.titleFontFamily ?: nil; - NSNumber *size = config.titleFontSize ?: @17; - NSString *weight = config.titleFontWeight ?: nil; - if (family || weight) { - attrs[NSFontAttributeName] = [ABI46_0_0RCTFont updateFont:nil - withFamily:family - size:size - weight:weight - style:nil - variant:nil - scaleMultiplier:1.0]; - } else { - attrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[size floatValue]]; - } - [navbar setTitleTextAttributes:attrs]; - } - -#if !TARGET_OS_TV - if (@available(iOS 11.0, *)) { - if (config.largeTitle && - (config.largeTitleFontFamily || config.largeTitleFontSize || config.largeTitleFontWeight || - config.largeTitleColor || config.titleColor)) { - NSMutableDictionary *largeAttrs = [NSMutableDictionary new]; - if (config.largeTitleColor || config.titleColor) { - largeAttrs[NSForegroundColorAttributeName] = - config.largeTitleColor ? config.largeTitleColor : config.titleColor; - } - NSString *largeFamily = config.largeTitleFontFamily ?: nil; - NSNumber *largeSize = config.largeTitleFontSize ?: @34; - NSString *largeWeight = config.largeTitleFontWeight ?: nil; - if (largeFamily || largeWeight) { - largeAttrs[NSFontAttributeName] = [ABI46_0_0RCTFont updateFont:nil - withFamily:largeFamily - size:largeSize - weight:largeWeight - style:nil - variant:nil - scaleMultiplier:1.0]; - } else { - largeAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:[largeSize floatValue] weight:UIFontWeightBold]; - } - [navbar setLargeTitleTextAttributes:largeAttrs]; - } - } -#endif - } -} - -+ (void)setTitleAttibutes:(NSDictionary *)attrs forButton:(UIBarButtonItem *)button -{ - [button setTitleTextAttributes:attrs forState:UIControlStateNormal]; - [button setTitleTextAttributes:attrs forState:UIControlStateHighlighted]; - [button setTitleTextAttributes:attrs forState:UIControlStateDisabled]; - [button setTitleTextAttributes:attrs forState:UIControlStateSelected]; - [button setTitleTextAttributes:attrs forState:UIControlStateFocused]; -} - -+ (UIImage *)loadBackButtonImageInViewController:(UIViewController *)vc withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config -{ -#ifdef RN_FABRIC_ENABLED - @throw([NSException exceptionWithName:@"UNIMPLEMENTED" reason:@"Implement" userInfo:nil]); -#else - BOOL hasBackButtonImage = NO; - for (ABI46_0_0RNSScreenStackHeaderSubview *subview in config.ABI46_0_0ReactSubviews) { - if (subview.type == ABI46_0_0RNSScreenStackHeaderSubviewTypeBackButton && subview.subviews.count > 0) { - hasBackButtonImage = YES; - ABI46_0_0RCTImageView *imageView = subview.subviews[0]; - if (imageView.image == nil) { - // This is yet another workaround for loading custom back icon. It turns out that under - // certain circumstances image attribute can be null despite the app running in production - // mode (when images are loaded from the filesystem). This can happen because image attribute - // is reset when image view is detached from window, and also in some cases initialization - // does not populate the frame of the image view before the loading start. The latter result - // in the image attribute not being updated. We manually set frame to the size of an image - // in order to trigger proper reload that'd update the image attribute. - ABI46_0_0RCTImageSource *source = imageView.imageSources[0]; - [imageView ABI46_0_0ReactSetFrame:CGRectMake( - imageView.frame.origin.x, - imageView.frame.origin.y, - source.size.width, - source.size.height)]; - } - UIImage *image = imageView.image; - // IMPORTANT!!! - // image can be nil in DEV MODE ONLY - // - // It is so, because in dev mode images are loaded over HTTP from the packager. In that case - // we first check if image is already loaded in cache and if it is, we take it from cache and - // display immediately. Otherwise we wait for the transition to finish and retry updating - // header config. - // Unfortunately due to some problems in UIKit we cannot update the image while the screen - // transition is ongoing. This results in the settings being reset after the transition is done - // to the state from before the transition. - if (image == nil) { - // in DEV MODE we try to load from cache (we use private API for that as it is not exposed - // publically in headers). - ABI46_0_0RCTImageSource *source = imageView.imageSources[0]; - ABI46_0_0RCTImageLoader *imageloader = [subview.bridge moduleForClass:[ABI46_0_0RCTImageLoader class]]; - image = [imageloader.imageCache imageForUrl:source.request.URL.absoluteString - size:source.size - scale:source.scale - resizeMode:imageView.resizeMode]; - } - if (image == nil) { - // This will be triggered if the image is not in the cache yet. What we do is we wait until - // the end of transition and run header config updates again. We could potentially wait for - // image on load to trigger, but that would require even more private method hacking. - if (vc.transitionCoordinator) { - [vc.transitionCoordinator - animateAlongsideTransition:^(id _Nonnull context) { - // nothing, we just want completion - } - completion:^(id _Nonnull context) { - // in order for new back button image to be loaded we need to trigger another change - // in back button props that'd make UIKit redraw the button. Otherwise the changes are - // not reflected. Here we change back button visibility which is then immediately restored -#if !TARGET_OS_TV - vc.navigationItem.hidesBackButton = YES; -#endif - [config updateViewControllerIfNeeded]; - }]; - } - return [UIImage new]; - } else { - return image; - } - } - } -#endif // RN_FABRIC_ENABLED - return nil; -} - -+ (void)willShowViewController:(UIViewController *)vc - animated:(BOOL)animated - withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config -{ - [self updateViewController:vc withConfig:config animated:animated]; -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 -+ (UINavigationBarAppearance *)buildAppearance:(UIViewController *)vc - withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config API_AVAILABLE(ios(13.0)) -{ - UINavigationBarAppearance *appearance = [UINavigationBarAppearance new]; - - if (config.backgroundColor && CGColorGetAlpha(config.backgroundColor.CGColor) == 0.) { - // transparent background color - [appearance configureWithTransparentBackground]; - } else { - [appearance configureWithOpaqueBackground]; - } - - // set background color if specified - if (config.backgroundColor) { - appearance.backgroundColor = config.backgroundColor; - } - - // TODO: implement blurEffect on Fabric -#ifdef RN_FABRIC_ENABLED -#else - if (config.blurEffect) { - appearance.backgroundEffect = [UIBlurEffect effectWithStyle:config.blurEffect]; - } -#endif - - if (config.hideShadow) { - appearance.shadowColor = nil; - } - - if (config.titleFontFamily || config.titleFontSize || config.titleFontWeight || config.titleColor) { - NSMutableDictionary *attrs = [NSMutableDictionary new]; - - if (config.titleColor) { - attrs[NSForegroundColorAttributeName] = config.titleColor; - } - - NSString *family = config.titleFontFamily ?: nil; - NSNumber *size = config.titleFontSize ?: @17; - NSString *weight = config.titleFontWeight ?: nil; - if (family || weight) { - attrs[NSFontAttributeName] = [ABI46_0_0RCTFont updateFont:nil - withFamily:config.titleFontFamily - size:size - weight:weight - style:nil - variant:nil - scaleMultiplier:1.0]; - } else { - attrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[size floatValue]]; - } - appearance.titleTextAttributes = attrs; - } - - if (config.largeTitleFontFamily || config.largeTitleFontSize || config.largeTitleFontWeight || - config.largeTitleColor || config.titleColor) { - NSMutableDictionary *largeAttrs = [NSMutableDictionary new]; - - if (config.largeTitleColor || config.titleColor) { - largeAttrs[NSForegroundColorAttributeName] = config.largeTitleColor ? config.largeTitleColor : config.titleColor; - } - - NSString *largeFamily = config.largeTitleFontFamily ?: nil; - NSNumber *largeSize = config.largeTitleFontSize ?: @34; - NSString *largeWeight = config.largeTitleFontWeight ?: nil; - if (largeFamily || largeWeight) { - largeAttrs[NSFontAttributeName] = [ABI46_0_0RCTFont updateFont:nil - withFamily:largeFamily - size:largeSize - weight:largeWeight - style:nil - variant:nil - scaleMultiplier:1.0]; - } else { - largeAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:[largeSize floatValue] weight:UIFontWeightBold]; - } - - appearance.largeTitleTextAttributes = largeAttrs; - } - -#ifdef RN_FABRIC_ENABLED - [appearance setBackIndicatorImage:nil transitionMaskImage:nil]; -#else - UIImage *backButtonImage = [self loadBackButtonImageInViewController:vc withConfig:config]; - if (backButtonImage) { - [appearance setBackIndicatorImage:backButtonImage transitionMaskImage:backButtonImage]; - } else if (appearance.backIndicatorImage) { - [appearance setBackIndicatorImage:nil transitionMaskImage:nil]; - } -#endif // RN_FABRIC_ENABLED - return appearance; -} -#endif - -+ (void)updateViewController:(UIViewController *)vc - withConfig:(ABI46_0_0RNSScreenStackHeaderConfig *)config - animated:(BOOL)animated -{ - UINavigationItem *navitem = vc.navigationItem; - UINavigationController *navctr = (UINavigationController *)vc.parentViewController; - - NSUInteger currentIndex = [navctr.viewControllers indexOfObject:vc]; - UINavigationItem *prevItem = - currentIndex > 0 ? [navctr.viewControllers objectAtIndex:currentIndex - 1].navigationItem : nil; - - BOOL wasHidden = navctr.navigationBarHidden; -#ifdef RN_FABRIC_ENABLED - BOOL shouldHide = config == nil || !config.show; -#else - BOOL shouldHide = config == nil || config.hide; -#endif - - if (!shouldHide && !config.translucent) { - // when nav bar is not translucent we chage edgesForExtendedLayout to avoid system laying out - // the screen underneath navigation controllers - vc.edgesForExtendedLayout = UIRectEdgeNone; - } else { - // system default is UIRectEdgeAll - vc.edgesForExtendedLayout = UIRectEdgeAll; - } - - [navctr setNavigationBarHidden:shouldHide animated:animated]; - - if ((config.direction == UISemanticContentAttributeForceLeftToRight || - config.direction == UISemanticContentAttributeForceRightToLeft) && - // iOS 12 cancels swipe gesture when direction is changed. See #1091 - navctr.view.semanticContentAttribute != config.direction) { - navctr.view.semanticContentAttribute = config.direction; - navctr.navigationBar.semanticContentAttribute = config.direction; - } - - if (shouldHide) { - return; - } - - navitem.title = config.title; -#if !TARGET_OS_TV - if (config.backTitle != nil || config.backTitleFontFamily || config.backTitleFontSize || - config.disableBackButtonMenu) { - ABI46_0_0RNSUIBarButtonItem *backBarButtonItem = [[ABI46_0_0RNSUIBarButtonItem alloc] initWithTitle:config.backTitle ?: prevItem.title - style:UIBarButtonItemStylePlain - target:nil - action:nil]; - - [backBarButtonItem setMenuHidden:config.disableBackButtonMenu]; - - prevItem.backBarButtonItem = backBarButtonItem; - if (config.backTitleFontFamily || config.backTitleFontSize) { - NSMutableDictionary *attrs = [NSMutableDictionary new]; - NSNumber *size = config.backTitleFontSize ?: @17; - if (config.backTitleFontFamily) { - attrs[NSFontAttributeName] = [ABI46_0_0RCTFont updateFont:nil - withFamily:config.backTitleFontFamily - size:size - weight:nil - style:nil - variant:nil - scaleMultiplier:1.0]; - } else { - attrs[NSFontAttributeName] = [UIFont boldSystemFontOfSize:[size floatValue]]; - } - [self setTitleAttibutes:attrs forButton:prevItem.backBarButtonItem]; - } - } else { - prevItem.backBarButtonItem = nil; - } - - if (@available(iOS 11.0, *)) { - if (config.largeTitle) { - navctr.navigationBar.prefersLargeTitles = YES; - } - navitem.largeTitleDisplayMode = - config.largeTitle ? UINavigationItemLargeTitleDisplayModeAlways : UINavigationItemLargeTitleDisplayModeNever; - } -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, tvOS 13.0, *)) { - UINavigationBarAppearance *appearance = [self buildAppearance:vc withConfig:config]; - navitem.standardAppearance = appearance; - navitem.compactAppearance = appearance; - - UINavigationBarAppearance *scrollEdgeAppearance = - [[UINavigationBarAppearance alloc] initWithBarAppearance:appearance]; - if (config.largeTitleBackgroundColor != nil) { - scrollEdgeAppearance.backgroundColor = config.largeTitleBackgroundColor; - } - if (config.largeTitleHideShadow) { - scrollEdgeAppearance.shadowColor = nil; - } - navitem.scrollEdgeAppearance = scrollEdgeAppearance; - } else -#endif - { -#if !TARGET_OS_TV - // updating backIndicatotImage does not work when called during transition. On iOS pre 13 we need - // to update it before the navigation starts. - UIImage *backButtonImage = [self loadBackButtonImageInViewController:vc withConfig:config]; - if (backButtonImage) { - navctr.navigationBar.backIndicatorImage = backButtonImage; - navctr.navigationBar.backIndicatorTransitionMaskImage = backButtonImage; - } else if (navctr.navigationBar.backIndicatorImage) { - navctr.navigationBar.backIndicatorImage = nil; - navctr.navigationBar.backIndicatorTransitionMaskImage = nil; - } -#endif - } -#if !TARGET_OS_TV - navitem.hidesBackButton = config.hideBackButton; -#endif - navitem.leftBarButtonItem = nil; - navitem.rightBarButtonItem = nil; - navitem.titleView = nil; - - for (ABI46_0_0RNSScreenStackHeaderSubview *subview in config.ABI46_0_0ReactSubviews) { - switch (subview.type) { - case ABI46_0_0RNSScreenStackHeaderSubviewTypeLeft: { -#if !TARGET_OS_TV - navitem.leftItemsSupplementBackButton = config.backButtonInCustomView; -#endif - UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:subview]; - navitem.leftBarButtonItem = buttonItem; - break; - } - case ABI46_0_0RNSScreenStackHeaderSubviewTypeRight: { - UIBarButtonItem *buttonItem = [[UIBarButtonItem alloc] initWithCustomView:subview]; - navitem.rightBarButtonItem = buttonItem; - break; - } - case ABI46_0_0RNSScreenStackHeaderSubviewTypeCenter: - case ABI46_0_0RNSScreenStackHeaderSubviewTypeTitle: { - navitem.titleView = subview; - break; - } - case ABI46_0_0RNSScreenStackHeaderSubviewTypeSearchBar: { - if (subview.subviews == nil || [subview.subviews count] == 0) { - ABI46_0_0RCTLogWarn( - @"Failed to attach search bar to the header. We recommend using `useLayoutEffect` when managing " - "searchBar properties dynamically. \n\nSee: github.com/software-mansion/react-native-screens/issues/1188"); - break; - } - - if ([subview.subviews[0] isKindOfClass:[ABI46_0_0RNSSearchBar class]]) { -#if !TARGET_OS_TV - if (@available(iOS 11.0, *)) { - ABI46_0_0RNSSearchBar *searchBar = subview.subviews[0]; - navitem.searchController = searchBar.controller; - navitem.hidesSearchBarWhenScrolling = searchBar.hideWhenScrolling; - } -#endif - } - break; - } - case ABI46_0_0RNSScreenStackHeaderSubviewTypeBackButton: { -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTLogWarn(@"Back button subivew is not yet Fabric compatible in react-native-screens"); -#endif - break; - } - } - } - - if (animated && vc.transitionCoordinator != nil && - vc.transitionCoordinator.presentationStyle == UIModalPresentationNone && !wasHidden) { - // when there is an ongoing transition we may need to update navbar setting in animation block - // using animateAlongsideTransition. However, we only do that given the transition is not a modal - // transition (presentationStyle == UIModalPresentationNone) and that the bar was not previously - // hidden. This is because both for modal transitions and transitions from screen with hidden bar - // the transition animation block does not get triggered. This is ok, because with both of those - // types of transitions there is no "shared" navigation bar that needs to be updated in an animated - // way. - [vc.transitionCoordinator - animateAlongsideTransition:^(id _Nonnull context) { - [self setAnimatedConfig:vc withConfig:config]; - } - completion:^(id _Nonnull context) { - if ([context isCancelled]) { - UIViewController *fromVC = [context viewControllerForKey:UITransitionContextFromViewControllerKey]; - ABI46_0_0RNSScreenStackHeaderConfig *config = nil; - for (UIView *subview in fromVC.view.ABI46_0_0ReactSubviews) { - if ([subview isKindOfClass:[ABI46_0_0RNSScreenStackHeaderConfig class]]) { - config = (ABI46_0_0RNSScreenStackHeaderConfig *)subview; - break; - } - } - [self setAnimatedConfig:fromVC withConfig:config]; - } - }]; - } else { - [self setAnimatedConfig:vc withConfig:config]; - } -} - -- (void)insertABI46_0_0ReactSubview:(ABI46_0_0RNSScreenStackHeaderSubview *)subview atIndex:(NSInteger)atIndex -{ - [_ABI46_0_0ReactSubviews insertObject:subview atIndex:atIndex]; - subview.ABI46_0_0ReactSuperview = self; -} - -- (void)removeABI46_0_0ReactSubview:(ABI46_0_0RNSScreenStackHeaderSubview *)subview -{ - [_ABI46_0_0ReactSubviews removeObject:subview]; -} - -- (void)didUpdateABI46_0_0ReactSubviews -{ - [super didUpdateABI46_0_0ReactSubviews]; - [self updateViewControllerIfNeeded]; -} - -#ifdef RN_FABRIC_ENABLED -#pragma mark - Fabric specific - -- (void)mountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - if (![childComponentView isKindOfClass:[ABI46_0_0RNSScreenStackHeaderSubview class]]) { - ABI46_0_0RCTLogError(@"ScreenStackHeader only accepts children of type ScreenStackHeaderSubview"); - return; - } - - ABI46_0_0RCTAssert( - childComponentView.superview == nil, - @"Attempt to mount already mounted component view. (parent: %@, child: %@, index: %@, existing parent: %@)", - self, - childComponentView, - @(index), - @([childComponentView.superview tag])); - - // [_ABI46_0_0ReactSubviews insertObject:(ABI46_0_0RNSScreenStackHeaderSubview *)childComponentView atIndex:index]; - [self insertABI46_0_0ReactSubview:(ABI46_0_0RNSScreenStackHeaderSubview *)childComponentView atIndex:index]; - [self updateViewControllerIfNeeded]; -} - -- (void)unmountChildComponentView:(UIView *)childComponentView index:(NSInteger)index -{ - [_ABI46_0_0ReactSubviews removeObject:(ABI46_0_0RNSScreenStackHeaderSubview *)childComponentView]; - [childComponentView removeFromSuperview]; -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; - _initialPropsSet = NO; -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider< - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderConfigComponentDescriptor>(); -} - -- (NSNumber *)getFontSizePropValue:(int)value -{ - if (value > 0) - return [NSNumber numberWithInt:value]; - return nil; -} - -- (UISemanticContentAttribute)getDirectionPropValue:(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderConfigDirection)direction -{ - switch (direction) { - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderConfigDirection::Rtl: - return UISemanticContentAttributeForceRightToLeft; - case ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderConfigDirection::Ltr: - return UISemanticContentAttributeForceLeftToRight; - } -} - -- (void)updateProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)props - oldProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)oldProps -{ - [super updateProps:props oldProps:oldProps]; - - const auto &oldScreenProps = - *std::static_pointer_cast(_props); - const auto &newScreenProps = *std::static_pointer_cast(props); - - BOOL needsNavigationControllerLayout = !_initialPropsSet; - - if (newScreenProps.hidden != !_show) { - _show = !newScreenProps.hidden; - needsNavigationControllerLayout = YES; - } - - if (newScreenProps.translucent != _translucent) { - _translucent = newScreenProps.translucent; - needsNavigationControllerLayout = YES; - } - - if (newScreenProps.backButtonInCustomView != _backButtonInCustomView) { - [self setBackButtonInCustomView:newScreenProps.backButtonInCustomView]; - } - - _title = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.title); - if (newScreenProps.titleFontFamily != oldScreenProps.titleFontFamily) { - _titleFontFamily = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.titleFontFamily); - } - _titleFontWeight = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.titleFontWeight); - _titleFontSize = [self getFontSizePropValue:newScreenProps.titleFontSize]; - _hideShadow = newScreenProps.hideShadow; - - _largeTitle = newScreenProps.largeTitle; - if (newScreenProps.largeTitleFontFamily != oldScreenProps.largeTitleFontFamily) { - _largeTitleFontFamily = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.largeTitleFontFamily); - } - _largeTitleFontWeight = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.largeTitleFontWeight); - _largeTitleFontSize = [self getFontSizePropValue:newScreenProps.largeTitleFontSize]; - _largeTitleHideShadow = newScreenProps.largeTitleHideShadow; - - _backTitle = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.backTitle); - if (newScreenProps.backTitleFontFamily != oldScreenProps.backTitleFontFamily) { - _backTitleFontFamily = ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.backTitleFontFamily); - } - _backTitleFontSize = [self getFontSizePropValue:newScreenProps.backTitleFontSize]; - _hideBackButton = newScreenProps.hideBackButton; - _disableBackButtonMenu = newScreenProps.disableBackButtonMenu; - - if (newScreenProps.direction != oldScreenProps.direction) { - _direction = [self getDirectionPropValue:newScreenProps.direction]; - } - - // We cannot compare SharedColor because it is shared value. - // We could compare color value, but it is more performant to just assign new value - _titleColor = ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.titleColor); - _largeTitleColor = ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.largeTitleColor); - _color = ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.color); - _backgroundColor = ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.backgroundColor); - - [self updateViewControllerIfNeeded]; - - if (needsNavigationControllerLayout) { - [self layoutNavigationControllerView]; - } - - _initialPropsSet = YES; - _props = std::static_pointer_cast(props); -} - -#else -#pragma mark - Paper specific - -- (void)didSetProps:(NSArray *)changedProps -{ - [super didSetProps:changedProps]; - [self updateViewControllerIfNeeded]; - // We need to layout navigation controller view after translucent prop changes, because otherwise - // frame of ABI46_0_0RNSScreen will not be changed and screen content will remain the same size. - // For more details look at https://github.com/software-mansion/react-native-screens/issues/1158 - if ([changedProps containsObject:@"translucent"]) { - [self layoutNavigationControllerView]; - } -} - -#endif -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenStackHeaderConfigCls(void) -{ - return ABI46_0_0RNSScreenStackHeaderConfig.class; -} -#endif - -@implementation ABI46_0_0RNSScreenStackHeaderConfigManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ABI46_0_0RNSScreenStackHeaderConfig new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(title, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(titleFontFamily, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(titleFontSize, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(titleFontWeight, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(titleColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backTitle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backTitleFontFamily, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backTitleFontSize, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backgroundColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(blurEffect, UIBlurEffectStyle) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(color, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(direction, UISemanticContentAttribute) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitle, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleFontFamily, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleFontSize, NSNumber) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleFontWeight, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleBackgroundColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(largeTitleHideShadow, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideBackButton, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideShadow, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(backButtonInCustomView, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(disableBackButtonMenu, BOOL) -// `hidden` is an UIView property, we need to use different name internally -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(hidden, hide, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(translucent, BOOL) - -@end - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNSScreenStackHeader) - -+ (NSMutableDictionary *)blurEffectsForIOSVersion -{ - NSMutableDictionary *blurEffects = [NSMutableDictionary new]; - [blurEffects addEntriesFromDictionary:@{ - @"extraLight" : @(UIBlurEffectStyleExtraLight), - @"light" : @(UIBlurEffectStyleLight), - @"dark" : @(UIBlurEffectStyleDark), - }]; - - if (@available(iOS 10.0, *)) { - [blurEffects addEntriesFromDictionary:@{ - @"regular" : @(UIBlurEffectStyleRegular), - @"prominent" : @(UIBlurEffectStyleProminent), - }]; - } -#if !TARGET_OS_TV && defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - [blurEffects addEntriesFromDictionary:@{ - @"systemUltraThinMaterial" : @(UIBlurEffectStyleSystemUltraThinMaterial), - @"systemThinMaterial" : @(UIBlurEffectStyleSystemThinMaterial), - @"systemMaterial" : @(UIBlurEffectStyleSystemMaterial), - @"systemThickMaterial" : @(UIBlurEffectStyleSystemThickMaterial), - @"systemChromeMaterial" : @(UIBlurEffectStyleSystemChromeMaterial), - @"systemUltraThinMaterialLight" : @(UIBlurEffectStyleSystemUltraThinMaterialLight), - @"systemThinMaterialLight" : @(UIBlurEffectStyleSystemThinMaterialLight), - @"systemMaterialLight" : @(UIBlurEffectStyleSystemMaterialLight), - @"systemThickMaterialLight" : @(UIBlurEffectStyleSystemThickMaterialLight), - @"systemChromeMaterialLight" : @(UIBlurEffectStyleSystemChromeMaterialLight), - @"systemUltraThinMaterialDark" : @(UIBlurEffectStyleSystemUltraThinMaterialDark), - @"systemThinMaterialDark" : @(UIBlurEffectStyleSystemThinMaterialDark), - @"systemMaterialDark" : @(UIBlurEffectStyleSystemMaterialDark), - @"systemThickMaterialDark" : @(UIBlurEffectStyleSystemThickMaterialDark), - @"systemChromeMaterialDark" : @(UIBlurEffectStyleSystemChromeMaterialDark), - }]; - } -#endif - return blurEffects; -} - -ABI46_0_0RCT_ENUM_CONVERTER( - UISemanticContentAttribute, - (@{ - @"ltr" : @(UISemanticContentAttributeForceLeftToRight), - @"rtl" : @(UISemanticContentAttributeForceRightToLeft), - }), - UISemanticContentAttributeUnspecified, - integerValue) - -ABI46_0_0RCT_ENUM_CONVERTER(UIBlurEffectStyle, ([self blurEffectsForIOSVersion]), UIBlurEffectStyleExtraLight, integerValue) - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.h deleted file mode 100644 index 9419699bc53156..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.h +++ /dev/null @@ -1,45 +0,0 @@ - -#ifdef RN_FABRIC_ENABLED -#import -#endif - -#import -#import -#import "ABI46_0_0RNSEnums.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0RNSScreenStackHeaderSubview : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - UIView -#endif - -@property (nonatomic) ABI46_0_0RNSScreenStackHeaderSubviewType type; - -@property (nonatomic, weak) UIView *ABI46_0_0ReactSuperview; - -#ifdef RN_FABRIC_ENABLED -#else -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge; - -#endif - -@end - -@interface ABI46_0_0RNSScreenStackHeaderSubviewManager : ABI46_0_0RCTViewManager - -@property (nonatomic) ABI46_0_0RNSScreenStackHeaderSubviewType type; - -@end - -@interface ABI46_0_0RCTConvert (ABI46_0_0RNSScreenStackHeaderSubview) - -+ (ABI46_0_0RNSScreenStackHeaderSubviewType)ABI46_0_0RNSScreenStackHeaderSubviewType:(id)json; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.mm deleted file mode 100644 index da81943a0726f2..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenStackHeaderSubview.mm +++ /dev/null @@ -1,137 +0,0 @@ -#import "ABI46_0_0RNSScreenStackHeaderSubview.h" -#import "ABI46_0_0RNSConvert.h" - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import - -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#endif - -@implementation ABI46_0_0RNSScreenStackHeaderSubview - -#pragma mark - Common - -#ifdef RN_FABRIC_ENABLED - -#pragma mark - Fabric specific - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - } - - return self; -} - -#pragma mark - ABI46_0_0RCTComponentViewProtocol - -- (void)prepareForRecycle -{ - [super prepareForRecycle]; -} - -- (void)updateProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)props - oldProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)oldProps -{ - const auto &newHeaderSubviewProps = - *std::static_pointer_cast(props); - const auto &oldHeaderSubviewProps = - *std::static_pointer_cast(_props); - - if (newHeaderSubviewProps.type != oldHeaderSubviewProps.type) { - _type = [ABI46_0_0RNSConvert ABI46_0_0RNSScreenStackHeaderSubviewTypeFromCppEquivalent:newHeaderSubviewProps.type]; - } - - [super updateProps:props oldProps:oldProps]; -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider< - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSScreenStackHeaderSubviewComponentDescriptor>(); -} - -- (void)updateLayoutMetrics:(const ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics &)layoutMetrics - oldLayoutMetrics:(const ABI46_0_0facebook::ABI46_0_0React::LayoutMetrics &)oldLayoutMetrics -{ - CGRect frame = ABI46_0_0RCTCGRectFromRect(layoutMetrics.frame); - // CALayer will crash if we pass NaN or Inf values. - // It's unclear how to detect this case on cross-platform manner holistically, so we have to do it on the mounting - // layer as well. NaN/Inf is a kinda valid result of some math operations. Even if we can (and should) detect (and - // report early) incorrect (NaN and Inf) values which come from JavaScript side, we sometimes cannot backtrace the - // sources of a calculation that produced an incorrect/useless result. - if (!std::isfinite(frame.size.width) || !std::isfinite(frame.size.height)) { - ABI46_0_0RCTLogWarn( - @"-[UIView(ComponentViewProtocol) updateLayoutMetrics:oldLayoutMetrics:]: Received invalid layout metrics (%@) for a view (%@).", - NSStringFromCGRect(frame), - self); - } else { - self.bounds = CGRect{CGPointZero, frame.size}; - } -} - -#else -#pragma mark - Paper specific - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - } - return self; -} - -- (void)ABI46_0_0ReactSetFrame:(CGRect)frame -{ - // Block any attempt to set coordinates on ABI46_0_0RNSScreenStackHeaderSubview. This - // makes UINavigationBar the only one to control the position of header content. - [super ABI46_0_0ReactSetFrame:CGRectMake(0, 0, frame.size.width, frame.size.height)]; -} - -#endif // RN_FABRIC_ENABLED -@end - -@implementation ABI46_0_0RNSScreenStackHeaderSubviewManager - -ABI46_0_0RCT_EXPORT_MODULE() - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(type, ABI46_0_0RNSScreenStackHeaderSubviewType) - -#ifdef RN_FABRIC_ENABLED -#else -- (UIView *)view -{ - return [[ABI46_0_0RNSScreenStackHeaderSubview alloc] initWithBridge:self.bridge]; -} -#endif - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSScreenStackHeaderSubviewCls(void) -{ - return ABI46_0_0RNSScreenStackHeaderSubview.class; -} -#endif - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNSScreenStackHeaderSubview) - -ABI46_0_0RCT_ENUM_CONVERTER( - ABI46_0_0RNSScreenStackHeaderSubviewType, - (@{ - @"back" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeBackButton), - @"left" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeLeft), - @"right" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeRight), - @"title" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeTitle), - @"center" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeCenter), - @"searchBar" : @(ABI46_0_0RNSScreenStackHeaderSubviewTypeSearchBar), - }), - ABI46_0_0RNSScreenStackHeaderSubviewTypeTitle, - integerValue) - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.h deleted file mode 100644 index a0fd96366cd2bf..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.h +++ /dev/null @@ -1,12 +0,0 @@ -#import -#import - -@interface ABI46_0_0RNSScreenViewEvent : NSObject - -- (instancetype)initWithEventName:(NSString *)eventName - ABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - progress:(double)progress - closing:(int)closing - goingForward:(int)goingForward; - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.mm deleted file mode 100644 index 1b1f436c48e0e1..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenViewEvent.mm +++ /dev/null @@ -1,59 +0,0 @@ -#import "ABI46_0_0RNSScreenViewEvent.h" -#import - -@implementation ABI46_0_0RNSScreenViewEvent { - double _progress; - int _closing; - int _goingForward; -} - -@synthesize viewTag = _viewTag; -@synthesize eventName = _eventName; - -- (instancetype)initWithEventName:(NSString *)eventName - ABI46_0_0ReactTag:(NSNumber *)ABI46_0_0ReactTag - progress:(double)progress - closing:(int)closing - goingForward:(int)goingForward -{ - ABI46_0_0RCTAssertParam(ABI46_0_0ReactTag); - - if ((self = [super init])) { - _eventName = [eventName copy]; - _viewTag = ABI46_0_0ReactTag; - _progress = progress; - _closing = closing; - _goingForward = goingForward; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(-(instancetype)init) - -- (NSDictionary *)body -{ - NSDictionary *body = @{ - @"progress" : @(_progress), - @"closing" : @(_closing ? 1 : 0), - @"goingForward" : @(_goingForward ? 1 : 0), - }; - - return body; -} - -- (BOOL)canCoalesce -{ - return NO; -} - -+ (NSString *)moduleDotMethod -{ - return @"ABI46_0_0RCTEventEmitter.receiveEvent"; -} - -- (NSArray *)arguments -{ - return @[ self.viewTag, ABI46_0_0RCTNormalizeInputEventName(self.eventName), [self body] ]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.h deleted file mode 100644 index 308786fb51be10..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.h +++ /dev/null @@ -1,26 +0,0 @@ -#import "ABI46_0_0RNSScreen.h" - -@interface ABI46_0_0RNSScreenWindowTraits : NSObject - -+ (void)updateWindowTraits; - -#if !TARGET_OS_TV -+ (void)assertViewControllerBasedStatusBarAppearenceSet; -#endif -+ (void)updateStatusBarAppearance; -+ (void)enforceDesiredDeviceOrientation; -+ (void)updateHomeIndicatorAutoHidden; - -#if !TARGET_OS_TV -+ (UIStatusBarStyle)statusBarStyleForRNSStatusBarStyle:(ABI46_0_0RNSStatusBarStyle)statusBarStyle; -+ (UIInterfaceOrientation)defaultOrientationForOrientationMask:(UIInterfaceOrientationMask)orientationMask; -+ (UIInterfaceOrientation)interfaceOrientationFromDeviceOrientation:(UIDeviceOrientation)deviceOrientation; -+ (UIInterfaceOrientationMask)maskFromOrientation:(UIInterfaceOrientation)orientation; -#endif - -+ (BOOL)shouldAskScreensForTrait:(ABI46_0_0RNSWindowTrait)trait - includingModals:(BOOL)includingModals - inViewController:(UIViewController *)vc; -+ (BOOL)shouldAskScreensForScreenOrientationInViewController:(UIViewController *)vc; - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.mm deleted file mode 100644 index 011ae87f842b65..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSScreenWindowTraits.mm +++ /dev/null @@ -1,243 +0,0 @@ -#import "ABI46_0_0RNSScreenWindowTraits.h" -#import "ABI46_0_0RNSScreenContainer.h" -#import "ABI46_0_0RNSScreenStack.h" - -@implementation ABI46_0_0RNSScreenWindowTraits - -#if !TARGET_OS_TV -+ (void)assertViewControllerBasedStatusBarAppearenceSet -{ - static dispatch_once_t once; - static bool viewControllerBasedAppearence; - dispatch_once(&once, ^{ - viewControllerBasedAppearence = - [[[NSBundle mainBundle] objectForInfoDictionaryKey:@"UIViewControllerBasedStatusBarAppearance"] boolValue]; - }); - if (!viewControllerBasedAppearence) { - ABI46_0_0RCTLogError(@"If you want to change the appearance of status bar, you have to change \ - UIViewControllerBasedStatusBarAppearance key in the Info.plist to YES"); - } -} -#endif - -+ (void)updateStatusBarAppearance -{ -#if !TARGET_OS_TV - [UIView animateWithDuration:0.4 - animations:^{ // duration based on "Programming iOS 13" p. 311 implementation -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13, *)) { - UIWindow *firstWindow = [[[UIApplication sharedApplication] windows] firstObject]; - if (firstWindow != nil) { - [[firstWindow rootViewController] setNeedsStatusBarAppearanceUpdate]; - } - } else -#endif - { - [UIApplication.sharedApplication.keyWindow.rootViewController setNeedsStatusBarAppearanceUpdate]; - } - }]; -#endif -} - -+ (void)updateHomeIndicatorAutoHidden -{ -#if !TARGET_OS_TV - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13, *)) { - UIWindow *firstWindow = [[[UIApplication sharedApplication] windows] firstObject]; - if (firstWindow != nil) { - [[firstWindow rootViewController] setNeedsUpdateOfHomeIndicatorAutoHidden]; - } - } else -#endif - { - if (@available(iOS 11.0, *)) { - [UIApplication.sharedApplication.keyWindow.rootViewController setNeedsUpdateOfHomeIndicatorAutoHidden]; - } - } -#endif -} - -#if !TARGET_OS_TV -+ (UIStatusBarStyle)statusBarStyleForRNSStatusBarStyle:(ABI46_0_0RNSStatusBarStyle)statusBarStyle -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - switch (statusBarStyle) { - case ABI46_0_0RNSStatusBarStyleAuto: - return [UITraitCollection.currentTraitCollection userInterfaceStyle] == UIUserInterfaceStyleDark - ? UIStatusBarStyleLightContent - : UIStatusBarStyleDarkContent; - case ABI46_0_0RNSStatusBarStyleInverted: - return [UITraitCollection.currentTraitCollection userInterfaceStyle] == UIUserInterfaceStyleDark - ? UIStatusBarStyleDarkContent - : UIStatusBarStyleLightContent; - case ABI46_0_0RNSStatusBarStyleLight: - return UIStatusBarStyleLightContent; - case ABI46_0_0RNSStatusBarStyleDark: - return UIStatusBarStyleDarkContent; - default: - return UIStatusBarStyleLightContent; - } - } -#endif - // it is the only non-default style available for iOS < 13 - if (statusBarStyle == ABI46_0_0RNSStatusBarStyleLight) { - return UIStatusBarStyleLightContent; - } - return UIStatusBarStyleDefault; -} -#endif - -#if !TARGET_OS_TV -+ (UIInterfaceOrientation)defaultOrientationForOrientationMask:(UIInterfaceOrientationMask)orientationMask -{ - if (UIInterfaceOrientationMaskPortrait & orientationMask) { - return UIInterfaceOrientationPortrait; - } else if (UIInterfaceOrientationMaskLandscapeLeft & orientationMask) { - return UIInterfaceOrientationLandscapeLeft; - } else if (UIInterfaceOrientationMaskLandscapeRight & orientationMask) { - return UIInterfaceOrientationLandscapeRight; - } else if (UIInterfaceOrientationMaskPortraitUpsideDown & orientationMask) { - return UIInterfaceOrientationPortraitUpsideDown; - } - return UIInterfaceOrientationUnknown; -} - -+ (UIInterfaceOrientation)interfaceOrientationFromDeviceOrientation:(UIDeviceOrientation)deviceOrientation -{ - switch (deviceOrientation) { - case UIDeviceOrientationPortrait: - return UIInterfaceOrientationPortrait; - case UIDeviceOrientationPortraitUpsideDown: - return UIInterfaceOrientationPortraitUpsideDown; - // UIDevice and UIInterface landscape orientations are switched - case UIDeviceOrientationLandscapeLeft: - return UIInterfaceOrientationLandscapeRight; - case UIDeviceOrientationLandscapeRight: - return UIInterfaceOrientationLandscapeLeft; - default: - return UIInterfaceOrientationUnknown; - } -} - -+ (UIInterfaceOrientationMask)maskFromOrientation:(UIInterfaceOrientation)orientation -{ - return 1 << orientation; -} -#endif - -+ (void)enforceDesiredDeviceOrientation -{ -#if !TARGET_OS_TV - dispatch_async(dispatch_get_main_queue(), ^{ - UIInterfaceOrientationMask orientationMask = UIInterfaceOrientationMaskAllButUpsideDown; -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13, *)) { - UIWindow *firstWindow = [[[UIApplication sharedApplication] windows] firstObject]; - if (firstWindow != nil) { - orientationMask = [firstWindow rootViewController].supportedInterfaceOrientations; - } - } else -#endif - { - orientationMask = UIApplication.sharedApplication.keyWindow.rootViewController.supportedInterfaceOrientations; - } - UIInterfaceOrientation currentDeviceOrientation = - [ABI46_0_0RNSScreenWindowTraits interfaceOrientationFromDeviceOrientation:[[UIDevice currentDevice] orientation]]; - UIInterfaceOrientation currentInterfaceOrientation = [ABI46_0_0RNSScreenWindowTraits interfaceOrientation]; - UIInterfaceOrientation newOrientation = UIInterfaceOrientationUnknown; - if ([ABI46_0_0RNSScreenWindowTraits maskFromOrientation:currentDeviceOrientation] & orientationMask) { - if (!([ABI46_0_0RNSScreenWindowTraits maskFromOrientation:currentInterfaceOrientation] & orientationMask)) { - // if the device orientation is in the mask, but interface orientation is not, we rotate to device's orientation - newOrientation = currentDeviceOrientation; - } else { - if (currentDeviceOrientation != currentInterfaceOrientation) { - // if both device orientation and interface orientation are in the mask, but in different orientations, we - // rotate to device's orientation - newOrientation = currentDeviceOrientation; - } - } - } else { - if (!([ABI46_0_0RNSScreenWindowTraits maskFromOrientation:currentInterfaceOrientation] & orientationMask)) { - // if both device orientation and interface orientation are not in the mask, we rotate to closest available - // rotation from mask - newOrientation = [ABI46_0_0RNSScreenWindowTraits defaultOrientationForOrientationMask:orientationMask]; - } else { - // if the device orientation is not in the mask, but interface orientation is in the mask, do nothing - } - } - if (newOrientation != UIInterfaceOrientationUnknown) { - [[UIDevice currentDevice] setValue:@(newOrientation) forKey:@"orientation"]; - [UIViewController attemptRotationToDeviceOrientation]; - } - }); -#endif -} - -+ (void)updateWindowTraits -{ - [ABI46_0_0RNSScreenWindowTraits updateStatusBarAppearance]; - [ABI46_0_0RNSScreenWindowTraits enforceDesiredDeviceOrientation]; - [ABI46_0_0RNSScreenWindowTraits updateHomeIndicatorAutoHidden]; -} - -#if !TARGET_OS_TV -// based on -// https://stackoverflow.com/questions/57965701/statusbarorientation-was-deprecated-in-ios-13-0-when-attempting-to-get-app-ori/61249908#61249908 -+ (UIInterfaceOrientation)interfaceOrientation -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 - if (@available(iOS 13.0, *)) { - UIWindow *firstWindow = [[[UIApplication sharedApplication] windows] firstObject]; - if (firstWindow == nil) { - return UIInterfaceOrientationUnknown; - } - UIWindowScene *windowScene = firstWindow.windowScene; - if (windowScene == nil) { - return UIInterfaceOrientationUnknown; - } - return windowScene.interfaceOrientation; - } else -#endif - { - return UIApplication.sharedApplication.statusBarOrientation; - } -} -#endif - -// method to be used in Expo for checking if ABI46_0_0RNScreens have trait set -+ (BOOL)shouldAskScreensForTrait:(ABI46_0_0RNSWindowTrait)trait - includingModals:(BOOL)includingModals - inViewController:(UIViewController *)vc -{ - UIViewController *lastViewController = [[vc childViewControllers] lastObject]; - if ([lastViewController conformsToProtocol:@protocol(ABI46_0_0RNScreensViewControllerDelegate)]) { - UIViewController *vc = nil; - if ([lastViewController isKindOfClass:[ABI46_0_0RNScreensViewController class]]) { - vc = [(ABI46_0_0RNScreensViewController *)lastViewController findActiveChildVC]; - } else if ([lastViewController isKindOfClass:[ABI46_0_0RNScreensNavigationController class]]) { - vc = [(ABI46_0_0RNScreensNavigationController *)lastViewController topViewController]; - } - return [vc isKindOfClass:[ABI46_0_0RNSScreen class]] && - [(ABI46_0_0RNSScreen *)vc findChildVCForConfigAndTrait:trait includingModals:includingModals] != nil; - } - return NO; -} - -// same method as above, but directly for orientation -+ (BOOL)shouldAskScreensForScreenOrientationInViewController:(UIViewController *)vc -{ - return [ABI46_0_0RNSScreenWindowTraits shouldAskScreensForTrait:ABI46_0_0RNSWindowTraitOrientation - includingModals:YES - inViewController:vc]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.h b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.h deleted file mode 100644 index f7ec33854e514b..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.h +++ /dev/null @@ -1,35 +0,0 @@ -#import - -#ifdef RN_FABRIC_ENABLED -#import -#endif - -#import -#import -#import - -@interface ABI46_0_0RNSSearchBar : -#ifdef RN_FABRIC_ENABLED - ABI46_0_0RCTViewComponentView -#else - UIView -#endif - -@property (nonatomic) BOOL hideWhenScrolling; - -@property (nonatomic, retain) UISearchController *controller; - -#ifdef RN_FABRIC_ENABLED -#else -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChangeText; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onCancelButtonPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onSearchButtonPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onFocus; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onBlur; -#endif - -@end - -@interface ABI46_0_0RNSSearchBarManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.mm b/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.mm deleted file mode 100644 index 98e1e1251f1f95..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/ABI46_0_0RNSSearchBar.mm +++ /dev/null @@ -1,351 +0,0 @@ -#import - -#import "ABI46_0_0RNSSearchBar.h" - -#import -#import -#import - -#ifdef RN_FABRIC_ENABLED -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTFabricComponentsPlugins.h" -#import "ABI46_0_0RNSConvert.h" -#endif - -@implementation ABI46_0_0RNSSearchBar { - __weak ABI46_0_0RCTBridge *_bridge; - UISearchController *_controller; - UIColor *_textColor; -} - -@synthesize controller = _controller; - -- (instancetype)initWithBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (self = [super init]) { - _bridge = bridge; - [self initCommonProps]; - } - return self; -} - -#ifdef RN_FABRIC_ENABLED -- (instancetype)init -{ - if (self = [super init]) { - static const auto defaultProps = std::make_shared(); - _props = defaultProps; - [self initCommonProps]; - } - return self; -} -#endif - -- (void)initCommonProps -{ - _controller = [[UISearchController alloc] initWithSearchResultsController:nil]; - _controller.searchBar.delegate = self; - _hideWhenScrolling = YES; -} - -- (void)emitOnFocusEvent -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onFocus(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarEventEmitter::OnFocus{}); - } -#else - if (self.onFocus) { - self.onFocus(@{}); - } -#endif -} - -- (void)emitOnBlurEvent -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onBlur(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarEventEmitter::OnBlur{}); - } -#else - if (self.onBlur) { - self.onBlur(@{}); - } -#endif -} - -- (void)emitOnSearchButtonPressEventWithText:(NSString *)text -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onSearchButtonPress( - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarEventEmitter::OnSearchButtonPress{.text = ABI46_0_0RCTStringFromNSString(text)}); - } -#else - if (self.onSearchButtonPress) { - self.onSearchButtonPress(@{ - @"text" : text, - }); - } -#endif -} - -- (void)emitOnCancelButtonPressEvent -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onCancelButtonPress(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarEventEmitter::OnCancelButtonPress{}); - } -#else - if (self.onCancelButtonPress) { - self.onCancelButtonPress(@{}); - } -#endif -} - -- (void)emitOnChangeTextEventWithText:(NSString *)text -{ -#ifdef RN_FABRIC_ENABLED - if (_eventEmitter != nullptr) { - std::dynamic_pointer_cast(_eventEmitter) - ->onChangeText(ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RNSSearchBarEventEmitter::OnChangeText{.text = ABI46_0_0RCTStringFromNSString(text)}); - } -#else - if (self.onChangeText) { - self.onChangeText(@{ - @"text" : text, - }); - } -#endif -} - -- (void)setObscureBackground:(BOOL)obscureBackground -{ - if (@available(iOS 9.1, *)) { - [_controller setObscuresBackgroundDuringPresentation:obscureBackground]; - } -} - -- (void)setHideNavigationBar:(BOOL)hideNavigationBar -{ - [_controller setHidesNavigationBarDuringPresentation:hideNavigationBar]; -} - -- (void)setHideWhenScrolling:(BOOL)hideWhenScrolling -{ - _hideWhenScrolling = hideWhenScrolling; -} - -- (void)setAutoCapitalize:(UITextAutocapitalizationType)autoCapitalize -{ - [_controller.searchBar setAutocapitalizationType:autoCapitalize]; -} - -- (void)setPlaceholder:(NSString *)placeholder -{ - [_controller.searchBar setPlaceholder:placeholder]; -} - -- (void)setBarTintColor:(UIColor *)barTintColor -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 && !TARGET_OS_TV - if (@available(iOS 13.0, *)) { - [_controller.searchBar.searchTextField setBackgroundColor:barTintColor]; - } -#endif -} - -- (void)setTintColor:(UIColor *)tintColor -{ - [_controller.searchBar setTintColor:tintColor]; -} - -- (void)setTextColor:(UIColor *)textColor -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 && !TARGET_OS_TV - _textColor = textColor; - if (@available(iOS 13.0, *)) { - [_controller.searchBar.searchTextField setTextColor:_textColor]; - } -#endif -} - -- (void)setCancelButtonText:(NSString *)text -{ - [_controller.searchBar setValue:text forKey:@"cancelButtonText"]; -} - -- (void)hideCancelButton -{ -#if !TARGET_OS_TV - if (@available(iOS 13, *)) { - // On iOS 13+ UISearchController automatically shows/hides cancel button - // https://developer.apple.com/documentation/uikit/uisearchcontroller/3152926-automaticallyshowscancelbutton?language=objc - } else { - [_controller.searchBar setShowsCancelButton:NO animated:YES]; - } -#endif -} - -- (void)showCancelButton -{ -#if !TARGET_OS_TV - if (@available(iOS 13, *)) { - // On iOS 13+ UISearchController automatically shows/hides cancel button - // https://developer.apple.com/documentation/uikit/uisearchcontroller/3152926-automaticallyshowscancelbutton?language=objc - } else { - [_controller.searchBar setShowsCancelButton:YES animated:YES]; - } -#endif -} - -#pragma mark delegate methods - -- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar -{ -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0 && !TARGET_OS_TV - if (@available(iOS 13.0, *)) { - // for some reason, the color does not change when set at the beginning, - // so we apply it again here - if (_textColor != nil) { - [_controller.searchBar.searchTextField setTextColor:_textColor]; - } - } -#endif - - [self showCancelButton]; - [self becomeFirstResponder]; - [self emitOnFocusEvent]; -} - -- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar -{ - [self emitOnBlurEvent]; - [self hideCancelButton]; -} - -- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText -{ - [self emitOnChangeTextEventWithText:_controller.searchBar.text]; -} - -- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar -{ - [self emitOnSearchButtonPressEventWithText:_controller.searchBar.text]; -} - -#if !TARGET_OS_TV -- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar -{ - _controller.searchBar.text = @""; - [self resignFirstResponder]; - [self hideCancelButton]; - - [self emitOnCancelButtonPressEvent]; - [self emitOnChangeTextEventWithText:_controller.searchBar.text]; -} -#endif // !TARGET_OS_TV - -#pragma mark-- Fabric specific - -#ifdef RN_FABRIC_ENABLED -- (void)updateProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)props - oldProps:(ABI46_0_0facebook::ABI46_0_0React::Props::Shared const &)oldProps -{ - const auto &oldScreenProps = *std::static_pointer_cast(_props); - const auto &newScreenProps = *std::static_pointer_cast(props); - - [self setHideWhenScrolling:newScreenProps.hideWhenScrolling]; - - if (oldScreenProps.cancelButtonText != newScreenProps.cancelButtonText) { - [self setCancelButtonText:ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.cancelButtonText)]; - } - - if (oldScreenProps.obscureBackground != newScreenProps.obscureBackground) { - [self setObscureBackground:newScreenProps.obscureBackground]; - } - - if (oldScreenProps.hideNavigationBar != newScreenProps.hideNavigationBar) { - [self setHideNavigationBar:newScreenProps.hideNavigationBar]; - } - - if (oldScreenProps.placeholder != newScreenProps.placeholder) { - [self setPlaceholder:ABI46_0_0RCTNSStringFromStringNilIfEmpty(newScreenProps.placeholder)]; - } - - if (oldScreenProps.autoCapitalize != newScreenProps.autoCapitalize) { - [self setAutoCapitalize:[ABI46_0_0RNSConvert UITextAutocapitalizationTypeFromCppEquivalent:newScreenProps.autoCapitalize]]; - } - - if (oldScreenProps.tintColor != newScreenProps.tintColor) { - [self setTintColor:ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.tintColor)]; - } - - if (oldScreenProps.barTintColor != newScreenProps.barTintColor) { - [self setBarTintColor:ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.barTintColor)]; - } - - if (oldScreenProps.textColor != newScreenProps.textColor) { - [self setTextColor:ABI46_0_0RCTUIColorFromSharedColor(newScreenProps.textColor)]; - } - - [super updateProps:props oldProps:oldProps]; -} - -+ (ABI46_0_0facebook::ABI46_0_0React::ComponentDescriptorProvider)componentDescriptorProvider -{ - return ABI46_0_0facebook::ABI46_0_0React::concreteComponentDescriptorProvider(); -} - -#else -#endif - -@end - -#ifdef RN_FABRIC_ENABLED -Class ABI46_0_0RNSSearchBarCls(void) -{ - return ABI46_0_0RNSSearchBar.class; -} -#endif - -@implementation ABI46_0_0RNSSearchBarManager - -ABI46_0_0RCT_EXPORT_MODULE() - -#ifdef RN_FABRIC_ENABLED -#else -- (UIView *)view -{ - return [[ABI46_0_0RNSSearchBar alloc] initWithBridge:self.bridge]; -} -#endif - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(obscureBackground, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideNavigationBar, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideWhenScrolling, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(autoCapitalize, UITextAutocapitalizationType) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(placeholder, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(barTintColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(textColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cancelButtonText, NSString) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChangeText, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCancelButtonPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onSearchButtonPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onFocus, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onBlur, ABI46_0_0RCTBubblingEventBlock) - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.h b/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.h deleted file mode 100644 index d2790d4c2fb7d5..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface UIViewController (ABI46_0_0RNScreens) - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.mm b/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.mm deleted file mode 100644 index 6a42aeacb60c05..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/UIViewController+ABI46_0_0RNScreens.mm +++ /dev/null @@ -1,78 +0,0 @@ -#import "ABI46_0_0RNSScreenContainer.h" -#import "UIViewController+ABI46_0_0RNScreens.h" - -#import - -@implementation UIViewController (ABI46_0_0RNScreens) - -#if !TARGET_OS_TV -- (UIViewController *)reactNativeScreensChildViewControllerForStatusBarStyle -{ - UIViewController *childVC = [self findChildRNScreensViewController]; - return childVC ?: [self reactNativeScreensChildViewControllerForStatusBarStyle]; -} - -- (UIViewController *)reactNativeScreensChildViewControllerForStatusBarHidden -{ - UIViewController *childVC = [self findChildRNScreensViewController]; - return childVC ?: [self reactNativeScreensChildViewControllerForStatusBarHidden]; -} - -- (UIStatusBarAnimation)reactNativeScreensPreferredStatusBarUpdateAnimation -{ - UIViewController *childVC = [self findChildRNScreensViewController]; - return childVC ? childVC.preferredStatusBarUpdateAnimation - : [self reactNativeScreensPreferredStatusBarUpdateAnimation]; -} - -- (UIInterfaceOrientationMask)reactNativeScreensSupportedInterfaceOrientations -{ - UIViewController *childVC = [self findChildRNScreensViewController]; - return childVC ? childVC.supportedInterfaceOrientations : [self reactNativeScreensSupportedInterfaceOrientations]; -} - -- (UIViewController *)reactNativeScreensChildViewControllerForHomeIndicatorAutoHidden -{ - UIViewController *childVC = [self findChildRNScreensViewController]; - return childVC ?: [self reactNativeScreensChildViewControllerForHomeIndicatorAutoHidden]; -} - -- (UIViewController *)findChildRNScreensViewController -{ - UIViewController *lastViewController = [[self childViewControllers] lastObject]; - if ([lastViewController conformsToProtocol:@protocol(ABI46_0_0RNScreensViewControllerDelegate)]) { - return lastViewController; - } - return nil; -} - -+ (void)load -{ - static dispatch_once_t once_token; - dispatch_once(&once_token, ^{ - Class uiVCClass = [UIViewController class]; - - method_exchangeImplementations( - class_getInstanceMethod(uiVCClass, @selector(childViewControllerForStatusBarStyle)), - class_getInstanceMethod(uiVCClass, @selector(reactNativeScreensChildViewControllerForStatusBarStyle))); - - method_exchangeImplementations( - class_getInstanceMethod(uiVCClass, @selector(childViewControllerForStatusBarHidden)), - class_getInstanceMethod(uiVCClass, @selector(reactNativeScreensChildViewControllerForStatusBarHidden))); - - method_exchangeImplementations( - class_getInstanceMethod(uiVCClass, @selector(preferredStatusBarUpdateAnimation)), - class_getInstanceMethod(uiVCClass, @selector(reactNativeScreensPreferredStatusBarUpdateAnimation))); - - method_exchangeImplementations( - class_getInstanceMethod(uiVCClass, @selector(supportedInterfaceOrientations)), - class_getInstanceMethod(uiVCClass, @selector(reactNativeScreensSupportedInterfaceOrientations))); - - method_exchangeImplementations( - class_getInstanceMethod(uiVCClass, @selector(childViewControllerForHomeIndicatorAutoHidden)), - class_getInstanceMethod(uiVCClass, @selector(reactNativeScreensChildViewControllerForHomeIndicatorAutoHidden))); - }); -} -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.h b/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.h deleted file mode 100644 index 4cd30516b5ed4c..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.h +++ /dev/null @@ -1,9 +0,0 @@ -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface UIWindow (ABI46_0_0RNScreens) - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.mm b/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.mm deleted file mode 100644 index 07d91c771fd934..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/UIWindow+ABI46_0_0RNScreens.mm +++ /dev/null @@ -1,17 +0,0 @@ -#import "ABI46_0_0RNSFullWindowOverlay.h" -#import "UIWindow+ABI46_0_0RNScreens.h" - -@implementation UIWindow (ABI46_0_0RNScreens) - -- (void)didAddSubview:(UIView *)subview -{ - if (![subview isKindOfClass:[ABI46_0_0RNSFullWindowOverlayContainer class]]) { - for (UIView *view in self.subviews) { - if ([view isKindOfClass:[ABI46_0_0RNSFullWindowOverlayContainer class]]) { - [self bringSubviewToFront:view]; - } - } - } -} - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.h b/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.h deleted file mode 100644 index 3fefbd4f1da8d5..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.h +++ /dev/null @@ -1,5 +0,0 @@ -@interface ABI46_0_0RNSUIBarButtonItem : UIBarButtonItem - -@property (nonatomic) BOOL menuHidden; - -@end diff --git a/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.mm b/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.mm deleted file mode 100644 index f0cca1e2fb8281..00000000000000 --- a/ios/vendored/sdk46/react-native-screens/ios/utils/ABI46_0_0RNSUIBarButtonItem.mm +++ /dev/null @@ -1,22 +0,0 @@ -#import "./ABI46_0_0RNSUIBarButtonItem.h" - -@implementation ABI46_0_0RNSUIBarButtonItem - -- (void)setMenuHidden:(BOOL)menuHidden -{ - _menuHidden = menuHidden; -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_14_0) && \ - __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 -- (void)setMenu:(UIMenu *)menu -{ - if (@available(iOS 14.0, *)) { - if (!_menuHidden) { - super.menu = menu; - } - } -} -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-webview/ABI46_0_0react-native-webview.podspec.json b/ios/vendored/sdk46/react-native-webview/ABI46_0_0react-native-webview.podspec.json deleted file mode 100644 index 0d6a2e97a2d584..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/ABI46_0_0react-native-webview.podspec.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "ABI46_0_0react-native-webview", - "version": "11.22.4", - "summary": "ABI46_0_0React Native WebView component for iOS, Android, macOS, and Windows", - "license": "MIT", - "authors": "Jamon Holmgren ", - "homepage": "https://github.com/react-native-webview/react-native-webview#readme", - "platforms": { - "ios": "9.0", - "osx": "10.13" - }, - "source": { - "git": "https://github.com/react-native-webview/react-native-webview.git", - "tag": "v11.22.4" - }, - "source_files": "apple/**/*.{h,m}", - "dependencies": { - "ABI46_0_0React-Core": [] - } -} diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.h b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.h deleted file mode 100644 index 53ae5c77fa7594..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCWKProcessPoolManager : NSObject - -+ (instancetype) sharedManager; -- (WKProcessPool *)sharedProcessPoolForScopeKey:(NSString *)scopeKey; - -@end diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.m b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.m deleted file mode 100644 index 5424f25c8bfec7..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWKProcessPoolManager.m +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNCWKProcessPoolManager.h" - -@interface ABI46_0_0RNCWKProcessPoolManager() { - WKProcessPool *_sharedProcessPool; - NSMutableDictionary *_pools; -} -@end - -@implementation ABI46_0_0RNCWKProcessPoolManager - -- (instancetype)init -{ - if (self = [super init]) { - _pools = [NSMutableDictionary new]; - } - return self; -} - -- (WKProcessPool *)sharedProcessPoolForScopeKey:(NSString *)scopeKey -{ - if (!scopeKey) { - return [self sharedProcessPool]; - } - if (!_pools[scopeKey]) { - _pools[scopeKey] = [[WKProcessPool alloc] init]; - } - return _pools[scopeKey]; -} - - -+ (id) sharedManager { - static ABI46_0_0RNCWKProcessPoolManager *_sharedManager = nil; - @synchronized(self) { - if(_sharedManager == nil) { - _sharedManager = [[super alloc] init]; - } - return _sharedManager; - } -} - -- (WKProcessPool *)sharedProcessPool { - if (!_sharedProcessPool) { - _sharedProcessPool = [[WKProcessPool alloc] init]; - } - return _sharedProcessPool; -} - -@end - diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.h b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.h deleted file mode 100644 index dab259dee41cdd..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.h +++ /dev/null @@ -1,119 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import - -typedef enum ABI46_0_0RNCWebViewPermissionGrantType : NSUInteger { - ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt, - ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny, - ABI46_0_0RNCWebViewPermissionGrantType_Deny, - ABI46_0_0RNCWebViewPermissionGrantType_Grant, - ABI46_0_0RNCWebViewPermissionGrantType_Prompt -} ABI46_0_0RNCWebViewPermissionGrantType; - -@class ABI46_0_0RNCWebView; - -@protocol ABI46_0_0RNCWebViewDelegate - -- (BOOL)webView:(ABI46_0_0RNCWebView *_Nonnull)webView -shouldStartLoadForRequest:(NSMutableDictionary *_Nonnull)request - withCallback:(ABI46_0_0RCTDirectEventBlock _Nonnull)callback; - -@end - -@interface ABI46_0_0RNCWeakScriptMessageDelegate : NSObject - -@property (nonatomic, weak, nullable) id scriptDelegate; - -- (nullable instancetype)initWithDelegate:(id _Nullable)scriptDelegate; - -@end - -@interface ABI46_0_0RNCWebView : ABI46_0_0RCTView -@property (nonatomic, strong) NSString *scopeKey; - -@property (nonatomic, weak) id _Nullable delegate; -@property (nonatomic, copy) NSDictionary * _Nullable source; -@property (nonatomic, assign) BOOL messagingEnabled; -@property (nonatomic, copy) NSString * _Nullable injectedJavaScript; -@property (nonatomic, copy) NSString * _Nullable injectedJavaScriptBeforeContentLoaded; -@property (nonatomic, assign) BOOL injectedJavaScriptForMainFrameOnly; -@property (nonatomic, assign) BOOL injectedJavaScriptBeforeContentLoadedForMainFrameOnly; -@property (nonatomic, assign) BOOL scrollEnabled; -@property (nonatomic, assign) BOOL sharedCookiesEnabled; -@property (nonatomic, assign) BOOL autoManageStatusBarEnabled; -@property (nonatomic, assign) BOOL pagingEnabled; -@property (nonatomic, assign) CGFloat decelerationRate; -@property (nonatomic, assign) BOOL allowsInlineMediaPlayback; -@property (nonatomic, assign) BOOL allowsAirPlayForMediaPlayback; -@property (nonatomic, assign) BOOL bounces; -@property (nonatomic, assign) BOOL mediaPlaybackRequiresUserAction; -#if WEBKIT_IOS_10_APIS_AVAILABLE -@property (nonatomic, assign) WKDataDetectorTypes dataDetectorTypes; -#endif -@property (nonatomic, assign) UIEdgeInsets contentInset; -@property (nonatomic, assign) BOOL automaticallyAdjustContentInsets; -@property (nonatomic, assign) BOOL keyboardDisplayRequiresUserAction; -@property (nonatomic, assign) BOOL hideKeyboardAccessoryView; -@property (nonatomic, assign) BOOL allowsBackForwardNavigationGestures; -@property (nonatomic, assign) BOOL incognito; -@property (nonatomic, assign) BOOL useSharedProcessPool; -@property (nonatomic, copy) NSString * _Nullable userAgent; -@property (nonatomic, copy) NSString * _Nullable applicationNameForUserAgent; -@property (nonatomic, assign) BOOL cacheEnabled; -@property (nonatomic, assign) BOOL javaScriptEnabled; -@property (nonatomic, assign) BOOL javaScriptCanOpenWindowsAutomatically; -@property (nonatomic, assign) BOOL allowFileAccessFromFileURLs; -@property (nonatomic, assign) BOOL allowUniversalAccessFromFileURLs; -@property (nonatomic, assign) BOOL allowsLinkPreview; -@property (nonatomic, assign) BOOL showsHorizontalScrollIndicator; -@property (nonatomic, assign) BOOL showsVerticalScrollIndicator; -@property (nonatomic, assign) BOOL directionalLockEnabled; -@property (nonatomic, assign) BOOL ignoreSilentHardwareSwitch; -@property (nonatomic, copy) NSString * _Nullable allowingReadAccessToURL; -@property (nonatomic, copy) NSDictionary * _Nullable basicAuthCredential; -@property (nonatomic, assign) BOOL pullToRefreshEnabled; -@property (nonatomic, assign) BOOL enableApplePay; -@property (nonatomic, copy) NSArray * _Nullable menuItems; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onCustomMenuSelection; -#if !TARGET_OS_OSX -@property (nonatomic, weak) UIRefreshControl * _Nullable refreshControl; -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ -@property (nonatomic, assign) WKContentMode contentMode; -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */ -@property (nonatomic, assign) BOOL limitsNavigationsToAppBoundDomains; -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */ -@property (nonatomic, assign) BOOL textInteractionEnabled; -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */ -@property (nonatomic, assign) ABI46_0_0RNCWebViewPermissionGrantType mediaCapturePermissionGrantType; -#endif - -+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential; -+ (void)setCustomCertificatesForHost:(nullable NSDictionary *)certificates; -- (void)postMessage:(NSString *_Nullable)message; -- (void)injectJavaScript:(NSString *_Nullable)script; -- (void)goForward; -- (void)goBack; -- (void)reload; -- (void)stopLoading; -- (void)requestFocus; -#if !TARGET_OS_OSX -- (void)addPullToRefreshControl; -- (void)pullToRefresh:(UIRefreshControl *_Nonnull)refreshControl; -#endif - -@end diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.m b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.m deleted file mode 100644 index 774056c09b7795..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebView.m +++ /dev/null @@ -1,1660 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCWebView.h" -#import -#import -#import "ABI46_0_0RNCWKProcessPoolManager.h" -#if !TARGET_OS_OSX -#import -#else -#import -#endif // !TARGET_OS_OSX - -#import "objc/runtime.h" - -static NSTimer *keyboardTimer; -static NSString *const HistoryShimName = @"ABI46_0_0ReactNativeHistoryShim"; -static NSString *const MessageHandlerName = @"ReactNativeWebView"; -static NSURLCredential* clientAuthenticationCredential; -static NSDictionary* customCertificatesForHost; - -static NSString *const CUSTOM_SELECTOR = @"_CUSTOM_SELECTOR_"; - -#if !TARGET_OS_OSX -// runtime trick to remove WKWebView keyboard default toolbar -// see: http://stackoverflow.com/questions/19033292/ios-7-uiwebview-keyboard-issue/19042279#19042279 -@interface ABI46_0_0_SwizzleHelperWK : UIView -@property (nonatomic, copy) WKWebView *webView; -@end -@implementation ABI46_0_0_SwizzleHelperWK --(id)inputAccessoryView -{ - if (_webView == nil) { - return nil; - } - - if ([_webView respondsToSelector:@selector(inputAssistantItem)]) { - UITextInputAssistantItem *inputAssistantItem = [_webView inputAssistantItem]; - inputAssistantItem.leadingBarButtonGroups = @[]; - inputAssistantItem.trailingBarButtonGroups = @[]; - } - return nil; -} -@end -#endif // !TARGET_OS_OSX - -#if TARGET_OS_OSX -@interface ABI46_0_0RNCWKWebView : WKWebView -@end -@implementation ABI46_0_0RNCWKWebView -- (void)scrollWheel:(NSEvent *)theEvent { - ABI46_0_0RNCWebView *rncWebView = (ABI46_0_0RNCWebView *)[self superview]; - ABI46_0_0RCTAssert([rncWebView isKindOfClass:[rncWebView class]], @"superview must be an ABI46_0_0RNCWebView"); - if (![rncWebView scrollEnabled]) { - [[self nextResponder] scrollWheel:theEvent]; - return; - } - [super scrollWheel:theEvent]; -} -@end -#endif // TARGET_OS_OSX - -@interface ABI46_0_0RNCWebView () - -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onFileDownload; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onLoadingStart; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onLoadingFinish; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onLoadingError; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onLoadingProgress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onShouldStartLoadWithRequest; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onHttpError; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMessage; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onScroll; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onContentProcessDidTerminate; -#if !TARGET_OS_OSX -@property (nonatomic, copy) WKWebView *webView; -#else -@property (nonatomic, copy) ABI46_0_0RNCWKWebView *webView; -#endif // !TARGET_OS_OSX -@property (nonatomic, strong) WKUserScript *postMessageScript; -@property (nonatomic, strong) WKUserScript *atStartScript; -@property (nonatomic, strong) WKUserScript *atEndScript; -@end - -@implementation ABI46_0_0RNCWebView -{ -#if !TARGET_OS_OSX - UIColor * _savedBackgroundColor; -#else - ABI46_0_0RCTUIColor * _savedBackgroundColor; -#endif // !TARGET_OS_OSX - BOOL _savedHideKeyboardAccessoryView; - BOOL _savedKeyboardDisplayRequiresUserAction; - - // Workaround for StatusBar appearance bug for iOS 12 - // https://github.com/react-native-webview/react-native-webview/issues/62 - BOOL _isFullScreenVideoOpen; -#if !TARGET_OS_OSX - UIStatusBarStyle _savedStatusBarStyle; -#endif // !TARGET_OS_OSX - BOOL _savedStatusBarHidden; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - UIScrollViewContentInsetAdjustmentBehavior _savedContentInsetAdjustmentBehavior; -#endif -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ - BOOL _savedAutomaticallyAdjustsScrollIndicatorInsets; -#endif -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { -#if !TARGET_OS_OSX - super.backgroundColor = [UIColor clearColor]; -#else - super.backgroundColor = [ABI46_0_0RCTUIColor clearColor]; -#endif // !TARGET_OS_OSX - _bounces = YES; - _scrollEnabled = YES; - _showsHorizontalScrollIndicator = YES; - _showsVerticalScrollIndicator = YES; - _directionalLockEnabled = YES; - _automaticallyAdjustContentInsets = YES; - _autoManageStatusBarEnabled = YES; - _contentInset = UIEdgeInsetsZero; - _savedKeyboardDisplayRequiresUserAction = YES; -#if !TARGET_OS_OSX - _savedStatusBarStyle = ABI46_0_0RCTSharedApplication().statusBarStyle; - _savedStatusBarHidden = ABI46_0_0RCTSharedApplication().statusBarHidden; -#endif // !TARGET_OS_OSX - _injectedJavaScript = nil; - _injectedJavaScriptForMainFrameOnly = YES; - _injectedJavaScriptBeforeContentLoaded = nil; - _injectedJavaScriptBeforeContentLoadedForMainFrameOnly = YES; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - _savedContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever; -#endif -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ - _savedAutomaticallyAdjustsScrollIndicatorInsets = NO; -#endif - _enableApplePay = NO; -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */ - _mediaCapturePermissionGrantType = ABI46_0_0RNCWebViewPermissionGrantType_Prompt; -#endif - } - -#if !TARGET_OS_OSX - [[NSNotificationCenter defaultCenter]addObserver:self - selector:@selector(appDidBecomeActive) - name:UIApplicationDidBecomeActiveNotification - object:nil]; - - [[NSNotificationCenter defaultCenter]addObserver:self - selector:@selector(appWillResignActive) - name:UIApplicationWillResignActiveNotification - object:nil]; - if (@available(iOS 12.0, *)) { - // Workaround for a keyboard dismissal bug present in iOS 12 - // https://openradar.appspot.com/radar?id=5018321736957952 - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(keyboardWillHide) - name:UIKeyboardWillHideNotification object:nil]; - [[NSNotificationCenter defaultCenter] - addObserver:self - selector:@selector(keyboardWillShow) - name:UIKeyboardWillShowNotification object:nil]; - - // Workaround for StatusBar appearance bug for iOS 12 - // https://github.com/react-native-webview/react-native-webview/issues/62 - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(showFullScreenVideoStatusBars) - name:UIWindowDidBecomeVisibleNotification - object:nil]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(hideFullScreenVideoStatusBars) - name:UIWindowDidBecomeHiddenNotification - object:nil]; - - } -#endif // !TARGET_OS_OSX - return self; -} - -#if !TARGET_OS_OSX -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { - // Only allow long press gesture - if ([otherGestureRecognizer isKindOfClass:[UILongPressGestureRecognizer class]]) { - return YES; - }else{ - return NO; - } -} - -// Listener for long presses -- (void)startLongPress:(UILongPressGestureRecognizer *)pressSender -{ - // When a long press ends, bring up our custom UIMenu - if(pressSender.state == UIGestureRecognizerStateEnded) { - if (!self.menuItems || self.menuItems.count == 0) { - return; - } - UIMenuController *menuController = [UIMenuController sharedMenuController]; - NSMutableArray *menuControllerItems = [NSMutableArray arrayWithCapacity:self.menuItems.count]; - - for(NSDictionary *menuItem in self.menuItems) { - NSString *menuItemLabel = [ABI46_0_0RCTConvert NSString:menuItem[@"label"]]; - NSString *menuItemKey = [ABI46_0_0RCTConvert NSString:menuItem[@"key"]]; - NSString *sel = [NSString stringWithFormat:@"%@%@", CUSTOM_SELECTOR, menuItemKey]; - UIMenuItem *item = [[UIMenuItem alloc] initWithTitle: menuItemLabel - action: NSSelectorFromString(sel)]; - - [menuControllerItems addObject: item]; - } - - menuController.menuItems = menuControllerItems; - [menuController setMenuVisible:YES animated:YES]; - } -} - -#endif // !TARGET_OS_OSX - -- (void)dealloc -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (void)tappedMenuItem:(NSString *)eventType -{ - // Get the selected text - // NOTE: selecting text in an iframe or shadow DOM will not work - [self.webView evaluateJavaScript: @"window.getSelection().toString()" completionHandler: ^(id result, NSError *error) { - if (error != nil) { - ABI46_0_0RCTLogWarn(@"%@", [NSString stringWithFormat:@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string. %@", error]); - } else { - if (self.onCustomMenuSelection) { - NSPredicate *filter = [NSPredicate predicateWithFormat:@"key contains[c] %@ ",eventType]; - NSArray *filteredMenuItems = [self.menuItems filteredArrayUsingPredicate:filter]; - NSDictionary *selectedMenuItem = filteredMenuItems[0]; - NSString *label = [ABI46_0_0RCTConvert NSString:selectedMenuItem[@"label"]]; - self.onCustomMenuSelection(@{ - @"key": eventType, - @"label": label, - @"selectedText": result - }); - } else { - ABI46_0_0RCTLogWarn(@"Error evaluating onCustomMenuSelection: You must implement an `onCustomMenuSelection` callback when using custom menu items"); - } - } - }]; -} - -// Overwrite method that interprets which action to call upon UIMenu Selection -// https://developer.apple.com/documentation/objectivec/nsobject/1571960-methodsignatureforselector -- (NSMethodSignature *)methodSignatureForSelector:(SEL)sel -{ - NSMethodSignature *existingSelector = [super methodSignatureForSelector:sel]; - if (existingSelector) { - return existingSelector; - } - return [super methodSignatureForSelector:@selector(tappedMenuItem:)]; -} - -// Needed to forward messages to other objects -// https://developer.apple.com/documentation/objectivec/nsobject/1571955-forwardinvocation -- (void)forwardInvocation:(NSInvocation *)invocation -{ - NSString *sel = NSStringFromSelector([invocation selector]); - NSRange match = [sel rangeOfString:CUSTOM_SELECTOR]; - if (match.location == 0) { - [self tappedMenuItem:[sel substringFromIndex:17]]; - } else { - [super forwardInvocation:invocation]; - } -} - -// Allows the instance to respond to UIMenuController Actions -- (BOOL)canBecomeFirstResponder -{ - return YES; -} - -// Control which items show up on the UIMenuController -- (BOOL)canPerformAction:(SEL)action withSender:(id)sender -{ - NSString *sel = NSStringFromSelector(action); - // Do any of them have our custom keys? - NSRange match = [sel rangeOfString:CUSTOM_SELECTOR]; - - if (match.location == 0) { - return YES; - } - return NO; -} - -/** - * See https://stackoverflow.com/questions/25713069/why-is-wkwebview-not-opening-links-with-target-blank/25853806#25853806 for details. - */ -- (WKWebView *)webView:(WKWebView *)webView createWebViewWithConfiguration:(WKWebViewConfiguration *)configuration forNavigationAction:(WKNavigationAction *)navigationAction windowFeatures:(WKWindowFeatures *)windowFeatures -{ - if (!navigationAction.targetFrame.isMainFrame) { - [webView loadRequest:navigationAction.request]; - } - return nil; -} - -- (WKWebViewConfiguration *)setUpWkWebViewConfig -{ - WKWebViewConfiguration *wkWebViewConfig = [WKWebViewConfiguration new]; - WKPreferences *prefs = [[WKPreferences alloc]init]; - BOOL _prefsUsed = NO; - if (!_javaScriptEnabled) { - prefs.javaScriptEnabled = NO; - _prefsUsed = YES; - } - if (_allowUniversalAccessFromFileURLs) { - [wkWebViewConfig setValue:@TRUE forKey:@"allowUniversalAccessFromFileURLs"]; - } - if (_allowFileAccessFromFileURLs) { - [prefs setValue:@TRUE forKey:@"allowFileAccessFromFileURLs"]; - _prefsUsed = YES; - } - if (_javaScriptCanOpenWindowsAutomatically) { - [prefs setValue:@TRUE forKey:@"javaScriptCanOpenWindowsAutomatically"]; - _prefsUsed = YES; - } -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */ - if (@available(iOS 14.5, *)) { - if (!_textInteractionEnabled) { - [prefs setValue:@FALSE forKey:@"textInteractionEnabled"]; - _prefsUsed = YES; - } - } -#endif - if (_prefsUsed) { - wkWebViewConfig.preferences = prefs; - } - if (_incognito) { - wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore]; - } else if (_cacheEnabled) { - wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore defaultDataStore]; - } - if(self.useSharedProcessPool) { - wkWebViewConfig.processPool = [[ABI46_0_0RNCWKProcessPoolManager sharedManager] sharedProcessPoolForScopeKey:self.scopeKey]; - } - wkWebViewConfig.userContentController = [WKUserContentController new]; - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ - if (@available(iOS 13.0, *)) { - WKWebpagePreferences *pagePrefs = [[WKWebpagePreferences alloc]init]; - pagePrefs.preferredContentMode = _contentMode; - wkWebViewConfig.defaultWebpagePreferences = pagePrefs; - } -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */ - if (@available(iOS 14.0, *)) { - if ([wkWebViewConfig respondsToSelector:@selector(limitsNavigationsToAppBoundDomains)]) { - if (_limitsNavigationsToAppBoundDomains) { - wkWebViewConfig.limitsNavigationsToAppBoundDomains = YES; - } - } - } -#endif - - // Shim the HTML5 history API: - [wkWebViewConfig.userContentController addScriptMessageHandler:[[ABI46_0_0RNCWeakScriptMessageDelegate alloc] initWithDelegate:self] - name:HistoryShimName]; - [self resetupScripts:wkWebViewConfig]; - - if(@available(macos 10.11, ios 9.0, *)) { - wkWebViewConfig.allowsAirPlayForMediaPlayback = _allowsAirPlayForMediaPlayback; - } - -#if !TARGET_OS_OSX - wkWebViewConfig.allowsInlineMediaPlayback = _allowsInlineMediaPlayback; -#if WEBKIT_IOS_10_APIS_AVAILABLE - wkWebViewConfig.mediaTypesRequiringUserActionForPlayback = _mediaPlaybackRequiresUserAction - ? WKAudiovisualMediaTypeAll - : WKAudiovisualMediaTypeNone; - wkWebViewConfig.dataDetectorTypes = _dataDetectorTypes; -#else - wkWebViewConfig.mediaPlaybackRequiresUserAction = _mediaPlaybackRequiresUserAction; -#endif -#endif // !TARGET_OS_OSX - - if (_applicationNameForUserAgent) { - wkWebViewConfig.applicationNameForUserAgent = [NSString stringWithFormat:@"%@ %@", wkWebViewConfig.applicationNameForUserAgent, _applicationNameForUserAgent]; - } - - return wkWebViewConfig; -} - -- (void)didMoveToWindow -{ - if (self.window != nil && _webView == nil) { - WKWebViewConfiguration *wkWebViewConfig = [self setUpWkWebViewConfig]; -#if !TARGET_OS_OSX - _webView = [[WKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig]; -#else - _webView = [[ABI46_0_0RNCWKWebView alloc] initWithFrame:self.bounds configuration: wkWebViewConfig]; -#endif // !TARGET_OS_OSX - - [self setBackgroundColor: _savedBackgroundColor]; -#if !TARGET_OS_OSX - _webView.scrollView.delegate = self; -#endif // !TARGET_OS_OSX - _webView.UIDelegate = self; - _webView.navigationDelegate = self; -#if !TARGET_OS_OSX - if (_pullToRefreshEnabled) { - [self addPullToRefreshControl]; - } - _webView.scrollView.scrollEnabled = _scrollEnabled; - _webView.scrollView.pagingEnabled = _pagingEnabled; - //For UIRefreshControl to work correctly, the bounces should always be true - _webView.scrollView.bounces = _pullToRefreshEnabled || _bounces; - _webView.scrollView.showsHorizontalScrollIndicator = _showsHorizontalScrollIndicator; - _webView.scrollView.showsVerticalScrollIndicator = _showsVerticalScrollIndicator; - _webView.scrollView.directionalLockEnabled = _directionalLockEnabled; -#endif // !TARGET_OS_OSX - _webView.allowsLinkPreview = _allowsLinkPreview; - [_webView addObserver:self forKeyPath:@"estimatedProgress" options:NSKeyValueObservingOptionOld | NSKeyValueObservingOptionNew context:nil]; - _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures; - - _webView.customUserAgent = _userAgent; -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ - if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - _webView.scrollView.contentInsetAdjustmentBehavior = _savedContentInsetAdjustmentBehavior; - } -#endif -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ - if (@available(iOS 13.0, *)) { - _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = _savedAutomaticallyAdjustsScrollIndicatorInsets; - } -#endif - - [self addSubview:_webView]; - [self setHideKeyboardAccessoryView: _savedHideKeyboardAccessoryView]; - [self setKeyboardDisplayRequiresUserAction: _savedKeyboardDisplayRequiresUserAction]; - [self visitSource]; - } -#if !TARGET_OS_OSX - // Allow this object to recognize gestures - if (self.menuItems != nil) { - UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(startLongPress:)]; - longPress.delegate = self; - - longPress.minimumPressDuration = 0.4f; - longPress.numberOfTouchesRequired = 1; - longPress.cancelsTouchesInView = YES; - [self addGestureRecognizer:longPress]; - } -#endif // !TARGET_OS_OSX -} - -// Update webview property when the component prop changes. -- (void)setAllowsBackForwardNavigationGestures:(BOOL)allowsBackForwardNavigationGestures { - _allowsBackForwardNavigationGestures = allowsBackForwardNavigationGestures; - _webView.allowsBackForwardNavigationGestures = _allowsBackForwardNavigationGestures; -} - -- (void)removeFromSuperview -{ - if (_webView) { - [_webView.configuration.userContentController removeScriptMessageHandlerForName:HistoryShimName]; - [_webView.configuration.userContentController removeScriptMessageHandlerForName:MessageHandlerName]; - [_webView removeObserver:self forKeyPath:@"estimatedProgress"]; - [_webView removeFromSuperview]; -#if !TARGET_OS_OSX - _webView.scrollView.delegate = nil; -#endif // !TARGET_OS_OSX - _webView = nil; - if (_onContentProcessDidTerminate) { - NSMutableDictionary *event = [self baseEvent]; - _onContentProcessDidTerminate(event); - } - } - - [super removeFromSuperview]; -} - -#if !TARGET_OS_OSX --(void)showFullScreenVideoStatusBars -{ -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (!_autoManageStatusBarEnabled) { - return; - } - - _isFullScreenVideoOpen = YES; - ABI46_0_0RCTUnsafeExecuteOnMainQueueSync(^{ - [ABI46_0_0RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES]; - }); -#pragma clang diagnostic pop -} - --(void)hideFullScreenVideoStatusBars -{ -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (!_autoManageStatusBarEnabled) { - return; - } - - _isFullScreenVideoOpen = NO; - ABI46_0_0RCTUnsafeExecuteOnMainQueueSync(^{ - [ABI46_0_0RCTSharedApplication() setStatusBarHidden:self->_savedStatusBarHidden animated:YES]; - [ABI46_0_0RCTSharedApplication() setStatusBarStyle:self->_savedStatusBarStyle animated:YES]; - }); -#pragma clang diagnostic pop -} - --(void)keyboardWillHide -{ - keyboardTimer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(keyboardDisplacementFix) userInfo:nil repeats:false]; - [[NSRunLoop mainRunLoop] addTimer:keyboardTimer forMode:NSRunLoopCommonModes]; -} --(void)keyboardWillShow -{ - if (keyboardTimer != nil) { - [keyboardTimer invalidate]; - } -} --(void)keyboardDisplacementFix -{ - // Additional viewport checks to prevent unintentional scrolls - UIScrollView *scrollView = self.webView.scrollView; - double maxContentOffset = scrollView.contentSize.height - scrollView.frame.size.height; - if (maxContentOffset < 0) { - maxContentOffset = 0; - } - if (scrollView.contentOffset.y > maxContentOffset) { - // https://stackoverflow.com/a/9637807/824966 - [UIView animateWithDuration:.25 animations:^{ - scrollView.contentOffset = CGPointMake(0, maxContentOffset); - }]; - } -} -#endif // !TARGET_OS_OSX - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context{ - if ([keyPath isEqual:@"estimatedProgress"] && object == self.webView) { - if(_onLoadingProgress){ - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary:@{@"progress":[NSNumber numberWithDouble:self.webView.estimatedProgress]}]; - _onLoadingProgress(event); - } - }else{ - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - -#if !TARGET_OS_OSX -- (void)setBackgroundColor:(UIColor *)backgroundColor -#else -- (void)setBackgroundColor:(ABI46_0_0RCTUIColor *)backgroundColor -#endif // !TARGET_OS_OSX -{ - _savedBackgroundColor = backgroundColor; - if (_webView == nil) { - return; - } - - CGFloat alpha = CGColorGetAlpha(backgroundColor.CGColor); - BOOL opaque = (alpha == 1.0); -#if !TARGET_OS_OSX - self.opaque = _webView.opaque = opaque; - _webView.scrollView.backgroundColor = backgroundColor; - _webView.backgroundColor = backgroundColor; -#else - // https://stackoverflow.com/questions/40007753/macos-wkwebview-background-transparency - NSOperatingSystemVersion version = { 10, 12, 0 }; - if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version]) { - [_webView setValue:@(opaque) forKey: @"drawsBackground"]; - } else { - [_webView setValue:@(!opaque) forKey: @"drawsTransparentBackground"]; - } -#endif // !TARGET_OS_OSX -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -- (void)setContentInsetAdjustmentBehavior:(UIScrollViewContentInsetAdjustmentBehavior)behavior -{ - _savedContentInsetAdjustmentBehavior = behavior; - if (_webView == nil) { - return; - } - - if ([_webView.scrollView respondsToSelector:@selector(setContentInsetAdjustmentBehavior:)]) { - CGPoint contentOffset = _webView.scrollView.contentOffset; - _webView.scrollView.contentInsetAdjustmentBehavior = behavior; - _webView.scrollView.contentOffset = contentOffset; - } -} -#endif -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ -- (void)setAutomaticallyAdjustsScrollIndicatorInsets:(BOOL)automaticallyAdjustsScrollIndicatorInsets{ - _savedAutomaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets; - if (_webView == nil) { - return; - } - if ([_webView.scrollView respondsToSelector:@selector(setAutomaticallyAdjustsScrollIndicatorInsets:)]) { - _webView.scrollView.automaticallyAdjustsScrollIndicatorInsets = automaticallyAdjustsScrollIndicatorInsets; - } -} -#endif -/** - * This method is called whenever JavaScript running within the web view calls: - * - window.webkit.messageHandlers[MessageHandlerName].postMessage - */ -- (void)userContentController:(WKUserContentController *)userContentController - didReceiveScriptMessage:(WKScriptMessage *)message -{ - if ([message.name isEqualToString:HistoryShimName]) { - if (_onLoadingFinish) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{@"navigationType": message.body}]; - _onLoadingFinish(event); - } - } else if ([message.name isEqualToString:MessageHandlerName]) { - if (_onMessage) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{@"data": message.body}]; - _onMessage(event); - } - } -} - -- (void)setSource:(NSDictionary *)source -{ - if (![_source isEqualToDictionary:source]) { - _source = [source copy]; - - if (_webView != nil) { - [self visitSource]; - } - } -} - -- (void)setAllowingReadAccessToURL:(NSString *)allowingReadAccessToURL -{ - if (![_allowingReadAccessToURL isEqualToString:allowingReadAccessToURL]) { - _allowingReadAccessToURL = [allowingReadAccessToURL copy]; - - if (_webView != nil) { - [self visitSource]; - } - } -} - -#if !TARGET_OS_OSX -- (void)setContentInset:(UIEdgeInsets)contentInset -{ - _contentInset = contentInset; - [ABI46_0_0RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:NO]; -} - -- (void)refreshContentInset -{ - [ABI46_0_0RCTView autoAdjustInsetsForView:self - withScrollView:_webView.scrollView - updateOffset:YES]; -} -#endif // !TARGET_OS_OSX - -- (void)visitSource -{ - // Check for a static html source first - NSString *html = [ABI46_0_0RCTConvert NSString:_source[@"html"]]; - if (html) { - NSURL *baseURL = [ABI46_0_0RCTConvert NSURL:_source[@"baseUrl"]]; - if (!baseURL) { - baseURL = [NSURL URLWithString:@"about:blank"]; - } - [_webView loadHTMLString:html baseURL:baseURL]; - return; - } - // Add cookie for subsequent resource requests sent by page itself, if cookie was set in headers on WebView - NSString *headerCookie = [ABI46_0_0RCTConvert NSString:_source[@"headers"][@"cookie"]]; - if(headerCookie) { - NSDictionary *headers = [NSDictionary dictionaryWithObjectsAndKeys:headerCookie,@"Set-Cookie",nil]; - NSURL *urlString = [NSURL URLWithString:_source[@"uri"]]; - NSArray *httpCookies = [NSHTTPCookie cookiesWithResponseHeaderFields:headers forURL:urlString]; - [self writeCookiesToWebView:httpCookies completion:nil]; - } - - NSURLRequest *request = [self requestForSource:_source]; - - [self syncCookiesToWebView:^{ - // Because of the way ABI46_0_0React works, as pages redirect, we actually end up - // passing the redirect urls back here, so we ignore them if trying to load - // the same url. We'll expose a call to 'reload' to allow a user to load - // the existing page. - if ([request.URL isEqual:_webView.URL]) { - return; - } - if (!request.URL) { - // Clear the webview - [_webView loadHTMLString:@"" baseURL:nil]; - return; - } - if (request.URL.host) { - [_webView loadRequest:request]; - } - else { - NSURL* readAccessUrl = _allowingReadAccessToURL ? [ABI46_0_0RCTConvert NSURL:_allowingReadAccessToURL] : request.URL; - [_webView loadFileURL:request.URL allowingReadAccessToURL:readAccessUrl]; - } - }]; -} - -#if !TARGET_OS_OSX --(void)setKeyboardDisplayRequiresUserAction:(BOOL)keyboardDisplayRequiresUserAction -{ - if (_webView == nil) { - _savedKeyboardDisplayRequiresUserAction = keyboardDisplayRequiresUserAction; - return; - } - - if (_savedKeyboardDisplayRequiresUserAction == true) { - return; - } - - UIView* subview; - - for (UIView* view in _webView.scrollView.subviews) { - if([[view.class description] hasPrefix:@"WK"]) - subview = view; - } - - if(subview == nil) return; - - Class class = subview.class; - - NSOperatingSystemVersion iOS_11_3_0 = (NSOperatingSystemVersion){11, 3, 0}; - NSOperatingSystemVersion iOS_12_2_0 = (NSOperatingSystemVersion){12, 2, 0}; - NSOperatingSystemVersion iOS_13_0_0 = (NSOperatingSystemVersion){13, 0, 0}; - - Method method; - IMP override; - - if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_13_0_0]) { - // iOS 13.0.0 - Future - SEL selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:activityStateChanges:userObject:"); - method = class_getInstanceMethod(class, selector); - IMP original = method_getImplementation(method); - override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) { - ((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4); - }); - } - else if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_12_2_0]) { - // iOS 12.2.0 - iOS 13.0.0 - SEL selector = sel_getUid("_elementDidFocus:userIsInteracting:blurPreviousNode:changingActivityState:userObject:"); - method = class_getInstanceMethod(class, selector); - IMP original = method_getImplementation(method); - override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) { - ((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4); - }); - } - else if ([[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion: iOS_11_3_0]) { - // iOS 11.3.0 - 12.2.0 - SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:changingActivityState:userObject:"); - method = class_getInstanceMethod(class, selector); - IMP original = method_getImplementation(method); - override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, BOOL arg3, id arg4) { - ((void (*)(id, SEL, void*, BOOL, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3, arg4); - }); - } else { - // iOS 9.0 - 11.3.0 - SEL selector = sel_getUid("_startAssistingNode:userIsInteracting:blurPreviousNode:userObject:"); - method = class_getInstanceMethod(class, selector); - IMP original = method_getImplementation(method); - override = imp_implementationWithBlock(^void(id me, void* arg0, BOOL arg1, BOOL arg2, id arg3) { - ((void (*)(id, SEL, void*, BOOL, BOOL, id))original)(me, selector, arg0, TRUE, arg2, arg3); - }); - } - - method_setImplementation(method, override); -} - --(void)setHideKeyboardAccessoryView:(BOOL)hideKeyboardAccessoryView -{ - if (_webView == nil) { - _savedHideKeyboardAccessoryView = hideKeyboardAccessoryView; - return; - } - - if (_savedHideKeyboardAccessoryView == false) { - return; - } - - UIView* subview; - - for (UIView* view in _webView.scrollView.subviews) { - if([[view.class description] hasPrefix:@"WK"]) - subview = view; - } - - if(subview == nil) return; - - NSString* name = [NSString stringWithFormat:@"%@ABI46_0_0_SwizzleHelperWK", subview.class.superclass]; - Class newClass = NSClassFromString(name); - - if(newClass == nil) - { - newClass = objc_allocateClassPair(subview.class, [name cStringUsingEncoding:NSASCIIStringEncoding], 0); - if(!newClass) return; - - Method method = class_getInstanceMethod([ABI46_0_0_SwizzleHelperWK class], @selector(inputAccessoryView)); - class_addMethod(newClass, @selector(inputAccessoryView), method_getImplementation(method), method_getTypeEncoding(method)); - - objc_registerClassPair(newClass); - } - - object_setClass(subview, newClass); -} - -// UIScrollViewDelegate method -- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView -{ - scrollView.decelerationRate = _decelerationRate; -} -#endif // !TARGET_OS_OSX - -- (void)setUserAgent:(NSString*)userAgent -{ - _userAgent = userAgent; - _webView.customUserAgent = userAgent; -} - -- (void)setScrollEnabled:(BOOL)scrollEnabled -{ - _scrollEnabled = scrollEnabled; -#if !TARGET_OS_OSX - _webView.scrollView.scrollEnabled = scrollEnabled; -#endif // !TARGET_OS_OSX -} - -#if !TARGET_OS_OSX -// UIScrollViewDelegate method -- (void)scrollViewDidScroll:(UIScrollView *)scrollView -{ - // Don't allow scrolling the scrollView. - if (!_scrollEnabled) { - scrollView.bounds = _webView.bounds; - } - else if (_onScroll != nil) { - NSDictionary *event = @{ - @"contentOffset": @{ - @"x": @(scrollView.contentOffset.x), - @"y": @(scrollView.contentOffset.y) - }, - @"contentInset": @{ - @"top": @(scrollView.contentInset.top), - @"left": @(scrollView.contentInset.left), - @"bottom": @(scrollView.contentInset.bottom), - @"right": @(scrollView.contentInset.right) - }, - @"contentSize": @{ - @"width": @(scrollView.contentSize.width), - @"height": @(scrollView.contentSize.height) - }, - @"layoutMeasurement": @{ - @"width": @(scrollView.frame.size.width), - @"height": @(scrollView.frame.size.height) - }, - @"zoomScale": @(scrollView.zoomScale ?: 1), - }; - _onScroll(event); - } -} - -- (void)setDirectionalLockEnabled:(BOOL)directionalLockEnabled -{ - _directionalLockEnabled = directionalLockEnabled; - _webView.scrollView.directionalLockEnabled = directionalLockEnabled; -} - -- (void)setShowsHorizontalScrollIndicator:(BOOL)showsHorizontalScrollIndicator -{ - _showsHorizontalScrollIndicator = showsHorizontalScrollIndicator; - _webView.scrollView.showsHorizontalScrollIndicator = showsHorizontalScrollIndicator; -} - -- (void)setShowsVerticalScrollIndicator:(BOOL)showsVerticalScrollIndicator -{ - _showsVerticalScrollIndicator = showsVerticalScrollIndicator; - _webView.scrollView.showsVerticalScrollIndicator = showsVerticalScrollIndicator; -} -#endif // !TARGET_OS_OSX - -- (void)postMessage:(NSString *)message -{ - NSDictionary *eventInitDict = @{@"data": message}; - NSString *source = [NSString - stringWithFormat:@"window.dispatchEvent(new MessageEvent('message', %@));", - ABI46_0_0RCTJSONStringify(eventInitDict, NULL) - ]; - [self injectJavaScript: source]; -} - -- (void)layoutSubviews -{ - [super layoutSubviews]; - - // Ensure webview takes the position and dimensions of ABI46_0_0RNCWebView - _webView.frame = self.bounds; -#if !TARGET_OS_OSX - _webView.scrollView.contentInset = _contentInset; -#endif // !TARGET_OS_OSX -} - -- (NSMutableDictionary *)baseEvent -{ - NSDictionary *event = @{ - @"url": _webView.URL.absoluteString ?: @"", - @"title": _webView.title ?: @"", - @"loading" : @(_webView.loading), - @"canGoBack": @(_webView.canGoBack), - @"canGoForward" : @(_webView.canGoForward) - }; - return [[NSMutableDictionary alloc] initWithDictionary: event]; -} - -+ (void)setClientAuthenticationCredential:(nullable NSURLCredential*)credential { - clientAuthenticationCredential = credential; -} - -+ (void)setCustomCertificatesForHost:(nullable NSDictionary*)certificates { - customCertificatesForHost = certificates; -} - -- (void) webView:(WKWebView *)webView - didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge - completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential * _Nullable))completionHandler -{ - NSString* host = nil; - if (webView.URL != nil) { - host = webView.URL.host; - } - if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodClientCertificate) { - completionHandler(NSURLSessionAuthChallengeUseCredential, clientAuthenticationCredential); - return; - } - if ([[challenge protectionSpace] serverTrust] != nil && customCertificatesForHost != nil && host != nil) { - SecCertificateRef localCertificate = (__bridge SecCertificateRef)([customCertificatesForHost objectForKey:host]); - if (localCertificate != nil) { - NSData *localCertificateData = (NSData*) CFBridgingRelease(SecCertificateCopyData(localCertificate)); - SecTrustRef trust = [[challenge protectionSpace] serverTrust]; - long count = SecTrustGetCertificateCount(trust); - for (long i = 0; i < count; i++) { - SecCertificateRef serverCertificate = SecTrustGetCertificateAtIndex(trust, i); - if (serverCertificate == nil) { continue; } - NSData *serverCertificateData = (NSData *) CFBridgingRelease(SecCertificateCopyData(serverCertificate)); - if ([serverCertificateData isEqualToData:localCertificateData]) { - NSURLCredential *useCredential = [NSURLCredential credentialForTrust:trust]; - if (challenge.sender != nil) { - [challenge.sender useCredential:useCredential forAuthenticationChallenge:challenge]; - } - completionHandler(NSURLSessionAuthChallengeUseCredential, useCredential); - return; - } - } - } - } - if ([[challenge protectionSpace] authenticationMethod] == NSURLAuthenticationMethodHTTPBasic) { - NSString *username = [_basicAuthCredential valueForKey:@"username"]; - NSString *password = [_basicAuthCredential valueForKey:@"password"]; - if (username && password) { - NSURLCredential *credential = [NSURLCredential credentialWithUser:username password:password persistence:NSURLCredentialPersistenceNone]; - completionHandler(NSURLSessionAuthChallengeUseCredential, credential); - return; - } - } - completionHandler(NSURLSessionAuthChallengePerformDefaultHandling, nil); -} - -#pragma mark - WKNavigationDelegate methods - -/** - * alert - */ -- (void)webView:(WKWebView *)webView runJavaScriptAlertPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(void))completionHandler -{ -#if !TARGET_OS_OSX - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - completionHandler(); - }]]; - [[self topViewController] presentViewController:alert animated:YES completion:NULL]; -#else - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:message]; - [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:^(__unused NSModalResponse response){ - completionHandler(); - }]; -#endif // !TARGET_OS_OSX -} - -/** - * confirm - */ -- (void)webView:(WKWebView *)webView runJavaScriptConfirmPanelWithMessage:(NSString *)message initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(BOOL))completionHandler{ -#if !TARGET_OS_OSX - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:message preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:[UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - completionHandler(YES); - }]]; - [alert addAction:[UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { - completionHandler(NO); - }]]; - [[self topViewController] presentViewController:alert animated:YES completion:NULL]; -#else - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:message]; - [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")]; - [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel button")]; - void (^callbacksHandlers)(NSModalResponse response) = ^void(NSModalResponse response) { - completionHandler(response == NSAlertFirstButtonReturn); - }; - [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:callbacksHandlers]; -#endif // !TARGET_OS_OSX -} - -/** - * prompt - */ -- (void)webView:(WKWebView *)webView runJavaScriptTextInputPanelWithPrompt:(NSString *)prompt defaultText:(NSString *)defaultText initiatedByFrame:(WKFrameInfo *)frame completionHandler:(void (^)(NSString *))completionHandler{ -#if !TARGET_OS_OSX - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"" message:prompt preferredStyle:UIAlertControllerStyleAlert]; - [alert addTextFieldWithConfigurationHandler:^(UITextField *textField) { - textField.text = defaultText; - }]; - UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"Ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - completionHandler([[alert.textFields lastObject] text]); - }]; - [alert addAction:okAction]; - UIAlertAction *cancelAction = [UIAlertAction actionWithTitle:@"Cancel" style:UIAlertActionStyleCancel handler:^(UIAlertAction *action) { - completionHandler(nil); - }]; - [alert addAction:cancelAction]; - alert.preferredAction = okAction; - [[self topViewController] presentViewController:alert animated:YES completion:NULL]; -#else - NSAlert *alert = [[NSAlert alloc] init]; - [alert setMessageText:prompt]; - - const NSRect ABI46_0_0RCTSingleTextFieldFrame = NSMakeRect(0.0, 0.0, 275.0, 22.0); - NSTextField *textField = [[NSTextField alloc] initWithFrame:ABI46_0_0RCTSingleTextFieldFrame]; - textField.cell.scrollable = YES; - if (@available(macOS 10.11, *)) { - textField.maximumNumberOfLines = 1; - } - textField.stringValue = defaultText; - [alert setAccessoryView:textField]; - - [alert addButtonWithTitle:NSLocalizedString(@"OK", @"OK button")]; - [alert addButtonWithTitle:NSLocalizedString(@"Cancel", @"Cancel button")]; - [alert beginSheetModalForWindow:[NSApp keyWindow] completionHandler:^(NSModalResponse response) { - if (response == NSAlertFirstButtonReturn) { - completionHandler([textField stringValue]); - } else { - completionHandler(nil); - } - }]; -#endif // !TARGET_OS_OSX -} - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */ -/** - * Media capture permissions (prevent multiple prompts) - */ -- (void) webView:(WKWebView *)webView - requestMediaCapturePermissionForOrigin:(WKSecurityOrigin *)origin - initiatedByFrame:(WKFrameInfo *)frame - type:(WKMediaCaptureType)type - decisionHandler:(void (^)(WKPermissionDecision decision))decisionHandler { - if (_mediaCapturePermissionGrantType == ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt || _mediaCapturePermissionGrantType == ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny) { - if ([origin.host isEqualToString:webView.URL.host]) { - decisionHandler(WKPermissionDecisionGrant); - } else { - WKPermissionDecision decision = _mediaCapturePermissionGrantType == ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt ? WKPermissionDecisionPrompt : WKPermissionDecisionDeny; - decisionHandler(decision); - } - } else if (_mediaCapturePermissionGrantType == ABI46_0_0RNCWebViewPermissionGrantType_Deny) { - decisionHandler(WKPermissionDecisionDeny); - } else if (_mediaCapturePermissionGrantType == ABI46_0_0RNCWebViewPermissionGrantType_Grant) { - decisionHandler(WKPermissionDecisionGrant); - } else { - decisionHandler(WKPermissionDecisionPrompt); - } -} -#endif - -#if !TARGET_OS_OSX -/** - * topViewController - */ --(UIViewController *)topViewController{ - return ABI46_0_0RCTPresentedViewController(); -} - -#endif // !TARGET_OS_OSX - -/** - * Decides whether to allow or cancel a navigation. - * @see https://fburl.com/42r9fxob - */ -- (void) webView:(WKWebView *)webView - decidePolicyForNavigationAction:(WKNavigationAction *)navigationAction - decisionHandler:(void (^)(WKNavigationActionPolicy))decisionHandler -{ - static NSDictionary *navigationTypes; - static dispatch_once_t onceToken; - - dispatch_once(&onceToken, ^{ - navigationTypes = @{ - @(WKNavigationTypeLinkActivated): @"click", - @(WKNavigationTypeFormSubmitted): @"formsubmit", - @(WKNavigationTypeBackForward): @"backforward", - @(WKNavigationTypeReload): @"reload", - @(WKNavigationTypeFormResubmitted): @"formresubmit", - @(WKNavigationTypeOther): @"other", - }; - }); - - WKNavigationType navigationType = navigationAction.navigationType; - NSURLRequest *request = navigationAction.request; - BOOL isTopFrame = [request.URL isEqual:request.mainDocumentURL]; - - if (_onShouldStartLoadWithRequest) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"mainDocumentURL": (request.mainDocumentURL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)], - @"isTopFrame": @(isTopFrame) - }]; - if (![self.delegate webView:self - shouldStartLoadForRequest:event - withCallback:_onShouldStartLoadWithRequest]) { - decisionHandler(WKNavigationActionPolicyCancel); - return; - } - } - - if (_onLoadingStart) { - // We have this check to filter out iframe requests and whatnot - if (isTopFrame) { - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary: @{ - @"url": (request.URL).absoluteString, - @"navigationType": navigationTypes[@(navigationType)] - }]; - _onLoadingStart(event); - } - } - - // Allow all navigation by default - decisionHandler(WKNavigationActionPolicyAllow); -} - -/** - * Called when the web view’s content process is terminated. - * @see https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455639-webviewwebcontentprocessdidtermi?language=objc - */ -- (void)webViewWebContentProcessDidTerminate:(WKWebView *)webView -{ - ABI46_0_0RCTLogWarn(@"Webview Process Terminated"); - if (_onContentProcessDidTerminate) { - NSMutableDictionary *event = [self baseEvent]; - _onContentProcessDidTerminate(event); - } -} - -/** - * Decides whether to allow or cancel a navigation after its response is known. - * @see https://developer.apple.com/documentation/webkit/wknavigationdelegate/1455643-webview?language=objc - */ -- (void) webView:(WKWebView *)webView - decidePolicyForNavigationResponse:(WKNavigationResponse *)navigationResponse - decisionHandler:(void (^)(WKNavigationResponsePolicy))decisionHandler -{ - WKNavigationResponsePolicy policy = WKNavigationResponsePolicyAllow; - if (_onHttpError && navigationResponse.forMainFrame) { - if ([navigationResponse.response isKindOfClass:[NSHTTPURLResponse class]]) { - NSHTTPURLResponse *response = (NSHTTPURLResponse *)navigationResponse.response; - NSInteger statusCode = response.statusCode; - - if (statusCode >= 400) { - NSMutableDictionary *httpErrorEvent = [self baseEvent]; - [httpErrorEvent addEntriesFromDictionary: @{ - @"url": response.URL.absoluteString, - @"statusCode": @(statusCode) - }]; - - _onHttpError(httpErrorEvent); - } - - NSString *disposition = nil; - if (@available(iOS 13, *)) { - disposition = [response valueForHTTPHeaderField:@"Content-Disposition"]; - } - BOOL isAttachment = disposition != nil && [disposition hasPrefix:@"attachment"]; - if (isAttachment || !navigationResponse.canShowMIMEType) { - if (_onFileDownload) { - policy = WKNavigationResponsePolicyCancel; - - NSMutableDictionary *downloadEvent = [self baseEvent]; - [downloadEvent addEntriesFromDictionary: @{ - @"downloadUrl": (response.URL).absoluteString, - }]; - _onFileDownload(downloadEvent); - } - } - } - } - - decisionHandler(policy); -} - -/** - * Called when an error occurs while the web view is loading content. - * @see https://fburl.com/km6vqenw - */ -- (void) webView:(WKWebView *)webView - didFailProvisionalNavigation:(WKNavigation *)navigation - withError:(NSError *)error -{ - if (_onLoadingError) { - if ([error.domain isEqualToString:NSURLErrorDomain] && error.code == NSURLErrorCancelled) { - // NSURLErrorCancelled is reported when a page has a redirect OR if you load - // a new URL in the WebView before the previous one came back. We can just - // ignore these since they aren't real errors. - // http://stackoverflow.com/questions/1024748/how-do-i-fix-nsurlerrordomain-error-999-in-iphone-3-0-os - return; - } - - if ([error.domain isEqualToString:@"WebKitErrorDomain"] && - (error.code == 102 || error.code == 101)) { - // Error code 102 "Frame load interrupted" is raised by the WKWebView - // when the URL is from an http redirect. This is a common pattern when - // implementing OAuth with a WebView. - return; - } - - NSMutableDictionary *event = [self baseEvent]; - [event addEntriesFromDictionary:@{ - @"didFailProvisionalNavigation": @YES, - @"domain": error.domain, - @"code": @(error.code), - @"description": error.localizedDescription, - }]; - _onLoadingError(event); - } -} - -- (void)evaluateJS:(NSString *)js - thenCall: (void (^)(NSString*)) callback -{ - if (self.enableApplePay) { - ABI46_0_0RCTLogWarn(@"Cannot run javascript when apple pay is enabled"); - return; - } - [self.webView evaluateJavaScript: js completionHandler: ^(id result, NSError *error) { - if (callback != nil) { - callback([NSString stringWithFormat:@"%@", result]); - } - if (error != nil) { - ABI46_0_0RCTLogWarn(@"%@", [NSString stringWithFormat:@"Error evaluating injectedJavaScript: This is possibly due to an unsupported return type. Try adding true to the end of your injectedJavaScript string. %@", error]); - } - }]; -} - --(void)forceIgnoreSilentHardwareSwitch:(BOOL)initialSetup -{ - NSString *mp3Str = @"data:audio/mp3;base64,//tAxAAAAAAAAAAAAAAAAAAAAAAASW5mbwAAAA8AAAAFAAAESAAzMzMzMzMzMzMzMzMzMzMzMzMzZmZmZmZmZmZmZmZmZmZmZmZmZmaZmZmZmZmZmZmZmZmZmZmZmZmZmczMzMzMzMzMzMzMzMzMzMzMzMzM//////////////////////////8AAAA5TEFNRTMuMTAwAZYAAAAAAAAAABQ4JAMGQgAAOAAABEhNIZS0AAAAAAD/+0DEAAPH3Yz0AAR8CPqyIEABp6AxjG/4x/XiInE4lfQDFwIIRE+uBgZoW4RL0OLMDFn6E5v+/u5ehf76bu7/6bu5+gAiIQGAABQIUJ0QolFghEn/9PhZQpcUTpXMjo0OGzRCZXyKxoIQzB2KhCtGobpT9TRVj/3Pmfp+f8X7Pu1B04sTnc3s0XhOlXoGVCMNo9X//9/r6a10TZEY5DsxqvO7mO5qFvpFCmKIjhpSItGsUYcRO//7QsQRgEiljQIAgLFJAbIhNBCa+JmorCbOi5q9nVd2dKnusTMQg4MFUlD6DQ4OFijwGAijRMfLbHG4nLVTjydyPlJTj8pfPflf9/5GD950A5e+jsrmNZSjSirjs1R7hnkia8vr//l/7Nb+crvr9Ok5ZJOylUKRxf/P9Zn0j2P4pJYXyKkeuy5wUYtdmOu6uobEtFqhIJViLEKIjGxchGev/L3Y0O3bwrIOszTBAZ7Ih28EUaSOZf/7QsQfg8fpjQIADN0JHbGgQBAZ8T//y//t/7d/2+f5m7MdCeo/9tdkMtGLbt1tqnabRroO1Qfvh20yEbei8nfDXP7btW7f9/uO9tbe5IvHQbLlxpf3DkAk0ojYcv///5/u3/7PTfGjPEPUvt5D6f+/3Lea4lz4tc4TnM/mFPrmalWbboeNiNyeyr+vufttZuvrVrt/WYv3T74JFo8qEDiJqJrmDTs///v99xDku2xG02jjunrICP/7QsQtA8kpkQAAgNMA/7FgQAGnobgfghgqA+uXwWQ3XFmGimSbe2X3ksY//KzK1a2k6cnNWOPJnPWUsYbKqkh8RJzrVf///P///////4vyhLKHLrCb5nIrYIUss4cthigL1lQ1wwNAc6C1pf1TIKRSkt+a//z+yLVcwlXKSqeSuCVQFLng2h4AFAFgTkH+Z/8jTX/zr//zsJV/5f//5UX/0ZNCNCCaf5lTCTRkaEdhNP//n/KUjf/7QsQ5AEhdiwAAjN7I6jGddBCO+WGTQ1mXrYatSAgaykxBTUUzLjEwMKqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqg=="; - NSString *scr; - if (initialSetup) { - scr = [NSString stringWithFormat:@"var s=new Audio('%@');s.id='wkwebviewAudio';s.controls=false;s.loop=true;s.play();document.body.appendChild(s);true", mp3Str]; - } else { - scr = [NSString stringWithFormat:@"var s=document.getElementById('wkwebviewAudio');s.src=null;s.parentNode.removeChild(s);s=null;s=new Audio('%@');s.id='wkwebviewAudio';s.controls=false;s.loop=true;s.play();document.body.appendChild(s);true", mp3Str]; - } - [self evaluateJS: scr thenCall: nil]; -} - --(void)disableIgnoreSilentSwitch -{ - [self evaluateJS: @"document.getElementById('wkwebviewAudio').src=null;true" thenCall: nil]; -} - --(void)appDidBecomeActive -{ - if (_ignoreSilentHardwareSwitch) { - [self forceIgnoreSilentHardwareSwitch:false]; - } -} - --(void)appWillResignActive -{ - if (_ignoreSilentHardwareSwitch) { - [self disableIgnoreSilentSwitch]; - } -} - -/** - * Called when the navigation is complete. - * @see https://fburl.com/rtys6jlb - */ -- (void)webView:(WKWebView *)webView -didFinishNavigation:(WKNavigation *)navigation -{ - if(_sharedCookiesEnabled && @available(iOS 11.0, *)) { - // Write all cookies from WKWebView back to sharedHTTPCookieStorage - [webView.configuration.websiteDataStore.httpCookieStore getAllCookies:^(NSArray* cookies) { - for (NSHTTPCookie *cookie in cookies) { - [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookie:cookie]; - } - }]; - } - - if (_ignoreSilentHardwareSwitch) { - [self forceIgnoreSilentHardwareSwitch:true]; - } - - if (_onLoadingFinish) { - _onLoadingFinish([self baseEvent]); - } -} - -- (void)injectJavaScript:(NSString *)script -{ - [self evaluateJS: script thenCall: nil]; -} - -- (void)goForward -{ - [_webView goForward]; -} - -- (void)goBack -{ - [_webView goBack]; -} - -- (void)reload -{ - /** - * When the initial load fails due to network connectivity issues, - * [_webView reload] doesn't reload the webpage. Therefore, we must - * manually call [_webView loadRequest:request]. - */ - NSURLRequest *request = [self requestForSource:self.source]; - - if (request.URL && !_webView.URL.absoluteString.length) { - [_webView loadRequest:request]; - } else { - [_webView reload]; - } -} -#if !TARGET_OS_OSX -- (void)addPullToRefreshControl -{ - UIRefreshControl *refreshControl = [[UIRefreshControl alloc] init]; - _refreshControl = refreshControl; - [_webView.scrollView addSubview: refreshControl]; - [refreshControl addTarget:self action:@selector(pullToRefresh:) forControlEvents: UIControlEventValueChanged]; -} - -- (void)pullToRefresh:(UIRefreshControl *)refreshControl -{ - [self reload]; - [refreshControl endRefreshing]; -} - - -- (void)setPullToRefreshEnabled:(BOOL)pullToRefreshEnabled -{ - _pullToRefreshEnabled = pullToRefreshEnabled; - - if (pullToRefreshEnabled) { - [self addPullToRefreshControl]; - } else { - [_refreshControl removeFromSuperview]; - } - - [self setBounces:_bounces]; -} -#endif // !TARGET_OS_OSX - -- (void)stopLoading -{ - [_webView stopLoading]; -} - -- (void)requestFocus -{ -#if !TARGET_OS_OSX - [_webView becomeFirstResponder]; -#endif // !TARGET_OS_OSX -} - -#if !TARGET_OS_OSX -- (void)setBounces:(BOOL)bounces -{ - _bounces = bounces; - //For UIRefreshControl to work correctly, the bounces should always be true - _webView.scrollView.bounces = _pullToRefreshEnabled || bounces; -} -#endif // !TARGET_OS_OSX - -- (void)setInjectedJavaScript:(NSString *)source { - _injectedJavaScript = source; - - self.atEndScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source - injectionTime:WKUserScriptInjectionTimeAtDocumentEnd - forMainFrameOnly:_injectedJavaScriptForMainFrameOnly]; - - if(_webView != nil){ - [self resetupScripts:_webView.configuration]; - } -} - -- (void)setInjectedJavaScriptBeforeContentLoaded:(NSString *)source { - _injectedJavaScriptBeforeContentLoaded = source; - - self.atStartScript = source == nil ? nil : [[WKUserScript alloc] initWithSource:source - injectionTime:WKUserScriptInjectionTimeAtDocumentStart - forMainFrameOnly:_injectedJavaScriptBeforeContentLoadedForMainFrameOnly]; - - if(_webView != nil){ - [self resetupScripts:_webView.configuration]; - } -} - -- (void)setInjectedJavaScriptForMainFrameOnly:(BOOL)mainFrameOnly { - _injectedJavaScriptForMainFrameOnly = mainFrameOnly; - [self setInjectedJavaScript:_injectedJavaScript]; -} - -- (void)setInjectedJavaScriptBeforeContentLoadedForMainFrameOnly:(BOOL)mainFrameOnly { - _injectedJavaScriptBeforeContentLoadedForMainFrameOnly = mainFrameOnly; - [self setInjectedJavaScriptBeforeContentLoaded:_injectedJavaScriptBeforeContentLoaded]; -} - -- (void)setMessagingEnabled:(BOOL)messagingEnabled { - _messagingEnabled = messagingEnabled; - - self.postMessageScript = _messagingEnabled ? - [ - [WKUserScript alloc] - initWithSource: [ - NSString - stringWithFormat: - @"window.%@ = {" - " postMessage: function (data) {" - " window.webkit.messageHandlers.%@.postMessage(String(data));" - " }" - "};", MessageHandlerName, MessageHandlerName - ] - injectionTime:WKUserScriptInjectionTimeAtDocumentStart - /* TODO: For a separate (minor) PR: use logic like this (as react-native-wkwebview does) so that messaging can be used in all frames if desired. - * I am keeping it as YES for consistency with previous behaviour. */ - // forMainFrameOnly:_messagingEnabledForMainFrameOnly - forMainFrameOnly:YES - ] : - nil; - - if(_webView != nil){ - [self resetupScripts:_webView.configuration]; - } -} - -- (void)writeCookiesToWebView:(NSArray*)cookies completion:(void (^)(void))completion { - // The required cookie APIs only became available on iOS 11 - if(_sharedCookiesEnabled && @available(iOS 11.0, *)) { - dispatch_async(dispatch_get_main_queue(), ^{ - dispatch_group_t group = dispatch_group_create(); - for (NSHTTPCookie *cookie in cookies) { - dispatch_group_enter(group); - [_webView.configuration.websiteDataStore.httpCookieStore setCookie:cookie completionHandler:^{ - dispatch_group_leave(group); - }]; - } - dispatch_group_notify(group, dispatch_get_main_queue(), ^{ - if (completion) { - completion(); - } - }); - }); - } else if (completion) { - completion(); - } -} - -- (void)syncCookiesToWebView:(void (^)(void))completion { - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]; - [self writeCookiesToWebView:cookies completion:completion]; -} - -- (void)resetupScripts:(WKWebViewConfiguration *)wkWebViewConfig { - [wkWebViewConfig.userContentController removeAllUserScripts]; - [wkWebViewConfig.userContentController removeScriptMessageHandlerForName:MessageHandlerName]; - if(self.enableApplePay){ - if (self.postMessageScript){ - [wkWebViewConfig.userContentController addScriptMessageHandler:[[ABI46_0_0RNCWeakScriptMessageDelegate alloc] initWithDelegate:self] - name:MessageHandlerName]; - } - return; - } - - NSString *html5HistoryAPIShimSource = [NSString stringWithFormat: - @"(function(history) {\n" - " function notify(type) {\n" - " setTimeout(function() {\n" - " window.webkit.messageHandlers.%@.postMessage(type)\n" - " }, 0)\n" - " }\n" - " function shim(f) {\n" - " return function pushState() {\n" - " notify('other')\n" - " return f.apply(history, arguments)\n" - " }\n" - " }\n" - " history.pushState = shim(history.pushState)\n" - " history.replaceState = shim(history.replaceState)\n" - " window.addEventListener('popstate', function() {\n" - " notify('backforward')\n" - " })\n" - "})(window.history)\n", HistoryShimName - ]; - WKUserScript *script = [[WKUserScript alloc] initWithSource:html5HistoryAPIShimSource injectionTime:WKUserScriptInjectionTimeAtDocumentStart forMainFrameOnly:YES]; - [wkWebViewConfig.userContentController addUserScript:script]; - - if(_sharedCookiesEnabled) { - // More info to sending cookies with WKWebView - // https://stackoverflow.com/questions/26573137/can-i-set-the-cookies-to-be-used-by-a-wkwebview/26577303#26577303 - if (@available(iOS 11.0, *)) { - // Set Cookies in iOS 11 and above, initialize websiteDataStore before setting cookies - // See also https://forums.developer.apple.com/thread/97194 - // check if websiteDataStore has not been initialized before - if(!_incognito && !_cacheEnabled) { - wkWebViewConfig.websiteDataStore = [WKWebsiteDataStore nonPersistentDataStore]; - } - [self syncCookiesToWebView:nil]; - } else { - NSMutableString *script = [NSMutableString string]; - - // Clear all existing cookies in a direct called function. This ensures that no - // javascript error will break the web content javascript. - // We keep this code here, if someone requires that Cookies are also removed within the - // the WebView and want to extends the current sharedCookiesEnabled option with an - // additional property. - // Generates JS: document.cookie = "key=; Expires=Thu, 01 Jan 1970 00:00:01 GMT;" - // for each cookie which is already available in the WebView context. - /* - [script appendString:@"(function () {\n"]; - [script appendString:@" var cookies = document.cookie.split('; ');\n"]; - [script appendString:@" for (var i = 0; i < cookies.length; i++) {\n"]; - [script appendString:@" if (cookies[i].indexOf('=') !== -1) {\n"]; - [script appendString:@" document.cookie = cookies[i].split('=')[0] + '=; Expires=Thu, 01 Jan 1970 00:00:01 GMT';\n"]; - [script appendString:@" }\n"]; - [script appendString:@" }\n"]; - [script appendString:@"})();\n\n"]; - */ - - // Set cookies in a direct called function. This ensures that no - // javascript error will break the web content javascript. - // Generates JS: document.cookie = "key=value; Path=/; Expires=Thu, 01 Jan 20xx 00:00:01 GMT;" - // for each cookie which is available in the application context. - [script appendString:@"(function () {\n"]; - for (NSHTTPCookie *cookie in [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookies]) { - [script appendFormat:@"document.cookie = %@ + '=' + %@", - ABI46_0_0RCTJSONStringify(cookie.name, NULL), - ABI46_0_0RCTJSONStringify(cookie.value, NULL)]; - if (cookie.path) { - [script appendFormat:@" + '; Path=' + %@", ABI46_0_0RCTJSONStringify(cookie.path, NULL)]; - } - if (cookie.expiresDate) { - [script appendFormat:@" + '; Expires=' + new Date(%f).toUTCString()", - cookie.expiresDate.timeIntervalSince1970 * 1000 - ]; - } - [script appendString:@";\n"]; - } - [script appendString:@"})();\n"]; - - WKUserScript* cookieInScript = [[WKUserScript alloc] initWithSource:script - injectionTime:WKUserScriptInjectionTimeAtDocumentStart - forMainFrameOnly:YES]; - [wkWebViewConfig.userContentController addUserScript:cookieInScript]; - } - } - - if(_messagingEnabled){ - if (self.postMessageScript){ - [wkWebViewConfig.userContentController addScriptMessageHandler:[[ABI46_0_0RNCWeakScriptMessageDelegate alloc] initWithDelegate:self] - name:MessageHandlerName]; - [wkWebViewConfig.userContentController addUserScript:self.postMessageScript]; - } - if (self.atEndScript) { - [wkWebViewConfig.userContentController addUserScript:self.atEndScript]; - } - } - // Whether or not messaging is enabled, add the startup script if it exists. - if (self.atStartScript) { - [wkWebViewConfig.userContentController addUserScript:self.atStartScript]; - } -} - -- (NSURLRequest *)requestForSource:(id)json { - NSURLRequest *request = [ABI46_0_0RCTConvert NSURLRequest:self.source]; - - // If sharedCookiesEnabled we automatically add all application cookies to the - // http request. This is automatically done on iOS 11+ in the WebView constructor. - // Se we need to manually add these shared cookies here only for iOS versions < 11. - if (_sharedCookiesEnabled) { - if (@available(iOS 11.0, *)) { - // see WKWebView initialization for added cookies - } else if (request != nil) { - NSArray *cookies = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:request.URL]; - NSDictionary *cookieHeader = [NSHTTPCookie requestHeaderFieldsWithCookies:cookies]; - NSMutableURLRequest *mutableRequest = [request mutableCopy]; - [mutableRequest setAllHTTPHeaderFields:cookieHeader]; - return mutableRequest; - } - } - return request; -} - -@end - -@implementation ABI46_0_0RNCWeakScriptMessageDelegate - -- (instancetype)initWithDelegate:(id)scriptDelegate { - self = [super init]; - if (self) { - _scriptDelegate = scriptDelegate; - } - return self; -} - -- (void)userContentController:(WKUserContentController *)userContentController didReceiveScriptMessage:(WKScriptMessage *)message { - [self.scriptDelegate userContentController:userContentController didReceiveScriptMessage:message]; -} - -@end diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.h b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.h deleted file mode 100644 index c997cbf1e2aeae..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCWebViewManager : ABI46_0_0RCTViewManager -@property (nonatomic, copy) NSArray * _Nullable menuItems; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onCustomMenuSelection; -@end diff --git a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.m b/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.m deleted file mode 100644 index ae7578f1e6315a..00000000000000 --- a/ios/vendored/sdk46/react-native-webview/apple/ABI46_0_0RNCWebViewManager.m +++ /dev/null @@ -1,301 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCWebViewManager.h" - -#import -#import -#import "ABI46_0_0RNCWebView.h" - -@interface ABI46_0_0RNCWebViewManager () -@end - -@implementation ABI46_0_0RCTConvert (WKWebView) -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ -ABI46_0_0RCT_ENUM_CONVERTER(WKContentMode, (@{ - @"recommended": @(WKContentModeRecommended), - @"mobile": @(WKContentModeMobile), - @"desktop": @(WKContentModeDesktop), -}), WKContentModeRecommended, integerValue) -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */ -ABI46_0_0RCT_ENUM_CONVERTER(ABI46_0_0RNCWebViewPermissionGrantType, (@{ - @"grantIfSameHostElsePrompt": @(ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElsePrompt), - @"grantIfSameHostElseDeny": @(ABI46_0_0RNCWebViewPermissionGrantType_GrantIfSameHost_ElseDeny), - @"deny": @(ABI46_0_0RNCWebViewPermissionGrantType_Deny), - @"grant": @(ABI46_0_0RNCWebViewPermissionGrantType_Grant), - @"prompt": @(ABI46_0_0RNCWebViewPermissionGrantType_Prompt), -}), ABI46_0_0RNCWebViewPermissionGrantType_Prompt, integerValue) -#endif -@end - -@implementation ABI46_0_0RNCWebViewManager -{ - NSString *_scopeKey; - NSConditionLock *_shouldStartLoadLock; - BOOL _shouldStartLoad; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -#if !TARGET_OS_OSX -- (UIView *)view -#else -- (ABI46_0_0RCTUIView *)view -#endif // !TARGET_OS_OSX -{ - ABI46_0_0RNCWebView *webView = [ABI46_0_0RNCWebView new]; - webView.scopeKey = _scopeKey; - webView.delegate = self; - return webView; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(source, NSDictionary) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onFileDownload, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLoadingStart, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLoadingFinish, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLoadingError, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLoadingProgress, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onHttpError, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onShouldStartLoadWithRequest, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onContentProcessDidTerminate, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(injectedJavaScript, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoaded, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptForMainFrameOnly, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(injectedJavaScriptBeforeContentLoadedForMainFrameOnly, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(javaScriptEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(javaScriptCanOpenWindowsAutomatically, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowFileAccessFromFileURLs, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowUniversalAccessFromFileURLs, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowsInlineMediaPlayback, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowsAirPlayForMediaPlayback, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mediaPlaybackRequiresUserAction, BOOL) -#if WEBKIT_IOS_10_APIS_AVAILABLE -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(dataDetectorTypes, WKDataDetectorTypes) -#endif -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(contentInset, UIEdgeInsets) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustContentInsets, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(autoManageStatusBarEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(hideKeyboardAccessoryView, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowsBackForwardNavigationGestures, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(incognito, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pagingEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(applicationNameForUserAgent, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowsLinkPreview, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(allowingReadAccessToURL, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(basicAuthCredential, NSDictionary) - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 110000 /* __IPHONE_11_0 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(contentInsetAdjustmentBehavior, UIScrollViewContentInsetAdjustmentBehavior) -#endif -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* __IPHONE_13_0 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(automaticallyAdjustsScrollIndicatorInsets, BOOL) -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000 /* iOS 13 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(contentMode, WKContentMode) -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140000 /* iOS 14 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(limitsNavigationsToAppBoundDomains, BOOL) -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 140500 /* iOS 14.5 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(textInteractionEnabled, BOOL) -#endif - -#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 150000 /* iOS 15 */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mediaCapturePermissionGrantType, ABI46_0_0RNCWebViewPermissionGrantType) -#endif - -/** - * Expose methods to enable messaging the webview. - */ -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(messagingEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMessage, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onScroll, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(enableApplePay, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(menuItems, NSArray); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCustomMenuSelection, ABI46_0_0RCTDirectEventBlock) - -ABI46_0_0RCT_EXPORT_METHOD(postMessage:(nonnull NSNumber *)ABI46_0_0ReactTag message:(NSString *)message) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view postMessage:message]; - } - }]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(pullToRefreshEnabled, BOOL, ABI46_0_0RNCWebView) { - view.pullToRefreshEnabled = json == nil ? false : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(bounces, BOOL, ABI46_0_0RNCWebView) { - view.bounces = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(useSharedProcessPool, BOOL, ABI46_0_0RNCWebView) { - view.useSharedProcessPool = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(userAgent, NSString, ABI46_0_0RNCWebView) { - view.userAgent = [ABI46_0_0RCTConvert NSString: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(scrollEnabled, BOOL, ABI46_0_0RNCWebView) { - view.scrollEnabled = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(sharedCookiesEnabled, BOOL, ABI46_0_0RNCWebView) { - view.sharedCookiesEnabled = json == nil ? false : [ABI46_0_0RCTConvert BOOL: json]; -} - -#if !TARGET_OS_OSX -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(decelerationRate, CGFloat, ABI46_0_0RNCWebView) { - view.decelerationRate = json == nil ? UIScrollViewDecelerationRateNormal : [ABI46_0_0RCTConvert CGFloat: json]; -} -#endif // !TARGET_OS_OSX - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(directionalLockEnabled, BOOL, ABI46_0_0RNCWebView) { - view.directionalLockEnabled = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(showsHorizontalScrollIndicator, BOOL, ABI46_0_0RNCWebView) { - view.showsHorizontalScrollIndicator = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(showsVerticalScrollIndicator, BOOL, ABI46_0_0RNCWebView) { - view.showsVerticalScrollIndicator = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(keyboardDisplayRequiresUserAction, BOOL, ABI46_0_0RNCWebView) { - view.keyboardDisplayRequiresUserAction = json == nil ? true : [ABI46_0_0RCTConvert BOOL: json]; -} - -ABI46_0_0RCT_EXPORT_METHOD(injectJavaScript:(nonnull NSNumber *)ABI46_0_0ReactTag script:(NSString *)script) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view injectJavaScript:script]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(goBack:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view goBack]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(goForward:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view goForward]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(reload:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view reload]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(stopLoading:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view stopLoading]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(requestFocus:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - ABI46_0_0RNCWebView *view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0RNCWebView class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0RNCWebView, got: %@", view); - } else { - [view requestFocus]; - } - }]; -} - -#pragma mark - Exported synchronous methods - -- (BOOL) webView:(ABI46_0_0RNCWebView *)webView -shouldStartLoadForRequest:(NSMutableDictionary *)request - withCallback:(ABI46_0_0RCTDirectEventBlock)callback -{ - _shouldStartLoadLock = [[NSConditionLock alloc] initWithCondition:arc4random()]; - _shouldStartLoad = YES; - request[@"lockIdentifier"] = @(_shouldStartLoadLock.condition); - callback(request); - - // Block the main thread for a maximum of 250ms until the JS thread returns - if ([_shouldStartLoadLock lockWhenCondition:0 beforeDate:[NSDate dateWithTimeIntervalSinceNow:.25]]) { - BOOL returnValue = _shouldStartLoad; - [_shouldStartLoadLock unlock]; - _shouldStartLoadLock = nil; - return returnValue; - } else { - ABI46_0_0RCTLogWarn(@"Did not receive response to shouldStartLoad in time, defaulting to YES"); - return YES; - } -} - -ABI46_0_0RCT_EXPORT_METHOD(startLoadWithResult:(BOOL)result lockIdentifier:(NSInteger)lockIdentifier) -{ - if ([_shouldStartLoadLock tryLockWhenCondition:lockIdentifier]) { - _shouldStartLoad = result; - [_shouldStartLoadLock unlockWithCondition:0]; - } else { - ABI46_0_0RCTLogWarn(@"startLoadWithResult invoked with invalid lockIdentifier: " - "got %lld, expected %lld", (long long)lockIdentifier, (long long)_shouldStartLoadLock.condition); - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/ABI46_0_0ExpoKit.podspec b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/ABI46_0_0ExpoKit.podspec deleted file mode 100644 index eaf82910f7cbdd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/ABI46_0_0ExpoKit.podspec +++ /dev/null @@ -1,140 +0,0 @@ - -# generated from template-files/ios/ExpoKit.podspec - - -folly_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1' -folly_compiler_flags = folly_flags + ' ' + '-Wno-comma -Wno-shorten-64-to-32' -boost_compiler_flags = '-Wno-documentation' - -Pod::Spec.new do |s| - s.name = "ABI46_0_0ExpoKit" - s.version = "46.0.0" - s.summary = 'ExpoKit' - s.description = 'ExpoKit allows native projects to integrate with the Expo SDK.' - s.homepage = 'http://docs.expo.io' - s.license = 'MIT' - s.author = "650 Industries, Inc." - s.requires_arc = true - s.platform = :ios, "12.0" - s.swift_version = '5.4' - s.default_subspec = "Core" - s.source = { :git => "http://github.com/expo/expo.git" } - s.xcconfig = { - 'CLANG_CXX_LANGUAGE_STANDARD' => 'gnu++14', - 'SYSTEM_HEADER_SEARCH_PATHS' => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/React-Core\"", - 'OTHER_CPLUSPLUSFLAGS' => [ - "$(OTHER_CFLAGS)", - "-DFOLLY_NO_CONFIG", - "-DFOLLY_MOBILE=1", - "-DFOLLY_USE_LIBCPP=1" - ] - } - - s.pod_target_xcconfig = { - 'USE_HEADERMAP' => 'YES', - 'DEFINES_MODULE' => 'YES', - } - - - s.pod_target_xcconfig = { - "USE_HEADERMAP" => "YES", - "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_TARGET_SRCROOT)\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/Headers/Private/React-Core\" " - } - s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.xcconfig = { - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/glog\" \"$(PODS_ROOT)/RCT-Folly\" \"$(PODS_ROOT)/Headers/Private/ABI46_0_0React-Core\"", - "OTHER_CFLAGS" => "$(inherited)" + " " + folly_flags - } - - s.subspec "Expo" do |ss| - ss.source_files = "Core/**/*.{h,m,mm,cpp}" - - ss.dependency "ABI46_0_0React-Core" - ss.dependency "ABI46_0_0React-Core/DevSupport" - ss.dependency "ABI46_0_0ReactCommon" - ss.dependency "ABI46_0_0RCTRequired" - ss.dependency "ABI46_0_0RCTTypeSafety" - ss.dependency "ABI46_0_0EXAppleAuthentication" - ss.dependency "ABI46_0_0EXApplication" - ss.dependency "ABI46_0_0EXAV" - ss.dependency "ABI46_0_0EXBackgroundFetch" - ss.dependency "ABI46_0_0EXBarCodeScanner" - ss.dependency "ABI46_0_0EXBattery" - ss.dependency "ABI46_0_0EXBlur" - ss.dependency "EXBranch" - ss.dependency "ABI46_0_0EXBrightness" - ss.dependency "ABI46_0_0EXCalendar" - ss.dependency "ABI46_0_0EXCamera" - ss.dependency "ABI46_0_0ExpoCellular" - ss.dependency "ABI46_0_0ExpoClipboard" - ss.dependency "ABI46_0_0EXConstants" - ss.dependency "ABI46_0_0EXContacts" - ss.dependency "ABI46_0_0ExpoCrypto" - ss.dependency "ABI46_0_0EXDevice" - ss.dependency "ABI46_0_0EXDocumentPicker" - ss.dependency "ABI46_0_0EASClient" - ss.dependency "ABI46_0_0EXErrorRecovery" - ss.dependency "ABI46_0_0EXFileSystem" - ss.dependency "ABI46_0_0EXFirebaseAnalytics" - ss.dependency "ABI46_0_0EXFirebaseCore" - ss.dependency "ABI46_0_0EXFont" - ss.dependency "ABI46_0_0EXGL_CPP" - ss.dependency "ABI46_0_0EXGL" - ss.dependency "ABI46_0_0ExpoHaptics" - ss.dependency "ABI46_0_0EXImageLoader" - ss.dependency "ABI46_0_0ExpoImageManipulator" - ss.dependency "ABI46_0_0ExpoImagePicker" - ss.dependency "ABI46_0_0EXJSONUtils" - ss.dependency "ABI46_0_0ExpoKeepAwake" - ss.dependency "ABI46_0_0ExpoLinearGradient" - ss.dependency "ABI46_0_0EXLocalAuthentication" - ss.dependency "ABI46_0_0ExpoLocalization" - ss.dependency "ABI46_0_0EXLocation" - ss.dependency "ABI46_0_0ExpoMailComposer" - ss.dependency "ABI46_0_0EXManifests" - ss.dependency "ABI46_0_0EXMediaLibrary" - ss.dependency "ABI46_0_0ExpoModulesCore" - ss.dependency "ABI46_0_0EXNetwork" - ss.dependency "ABI46_0_0EXNotifications" - ss.dependency "ABI46_0_0EXPermissions" - ss.dependency "ABI46_0_0EXPrint" - ss.dependency "ABI46_0_0ExpoRandom" - ss.dependency "ABI46_0_0EXScreenCapture" - ss.dependency "ABI46_0_0EXScreenOrientation" - ss.dependency "ABI46_0_0EXSecureStore" - ss.dependency "ABI46_0_0EXSensors" - ss.dependency "ABI46_0_0EXSharing" - ss.dependency "ABI46_0_0EXSMS" - ss.dependency "ABI46_0_0EXSpeech" - ss.dependency "ABI46_0_0EXSplashScreen" - ss.dependency "ABI46_0_0EXSQLite" - ss.dependency "ABI46_0_0EXStoreReview" - ss.dependency "ABI46_0_0EXStructuredHeaders" - ss.dependency "ABI46_0_0ExpoSystemUI" - ss.dependency "ABI46_0_0EXTaskManager" - ss.dependency "ABI46_0_0ExpoTrackingTransparency" - ss.dependency "ABI46_0_0EXUpdatesInterface" - ss.dependency "ABI46_0_0EXUpdates" - ss.dependency "ABI46_0_0EXVideoThumbnails" - ss.dependency "ABI46_0_0ExpoWebBrowser" - ss.dependency "ABI46_0_0Expo" - ss.dependency "ABI46_0_0UMAppLoader" - ss.dependency "Analytics" - ss.dependency "AppAuth" - ss.dependency "FBAudienceNetwork" - ss.dependency "FBSDKCoreKit" - ss.dependency "GoogleSignIn" - ss.dependency "GoogleMaps" - ss.dependency "Google-Maps-iOS-Utils" - ss.dependency "lottie-ios" - ss.dependency "JKBigInteger" - ss.dependency "Branch" - ss.dependency "RCT-Folly" - ss.dependency "ABI46_0_0ExpoModulesProvider" - end - - s.subspec "ExpoOptional" do |ss| - ss.dependency "ABI46_0_0ExpoKit/Expo" - ss.source_files = "Optional/**/*.{h,m,mm}" - end -end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXUnversioned.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXUnversioned.h deleted file mode 100644 index 6a0d94e309924c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXUnversioned.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -// noop (used by code transform) - -@protocol ABI46_0_0EXUnversioned - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.h deleted file mode 100644 index d236042fde0e17..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.h +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import -#import - -@interface ABI46_0_0EXVersionManager : NSObject - -// Uses a params dict since the internal workings may change over time, but we want to keep the interface the same. -- (instancetype)initWithParams:(NSDictionary *)params - manifest:(ABI46_0_0EXManifestsManifest *)manifest - fatalHandler:(void (^)(NSError *))fatalHandler - logFunction:(ABI46_0_0RCTLogFunction)logFunction - logThreshold:(NSInteger)threshold; -- (void)bridgeWillStartLoading:(id)bridge; -- (void)bridgeFinishedLoading:(id)bridge; -- (void)invalidate; - -/** - * Dev tools (implementation varies by SDK) - */ -- (void)showDevMenuForBridge:(id)bridge; -- (void)disableRemoteDebuggingForBridge:(id)bridge; -- (void)toggleRemoteDebuggingForBridge:(id)bridge; -- (void)togglePerformanceMonitorForBridge:(id)bridge; -- (void)toggleElementInspectorForBridge:(id)bridge; -- (uint32_t)addWebSocketNotificationHandler:(void (^)(NSDictionary *))handler - queue:(dispatch_queue_t)queue - forMethod:(NSString *)method; - -- (NSDictionary *)devMenuItemsForBridge:(id)bridge; -- (void)selectDevMenuItemWithKey:(NSString *)key onBridge:(id)bridge; - -/** - * Provides the extra native modules required to set up a bridge with this version. - */ -- (NSArray *)extraModulesForBridge:(id)bridge; - -- (void *)versionedJsExecutorFactoryForBridge:(id)bridge; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.mm b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.mm deleted file mode 100644 index e2e58dae0018f2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ABI46_0_0EXVersionManager.mm +++ /dev/null @@ -1,581 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXAppState.h" -#import "ABI46_0_0EXDevSettings.h" -#import "ABI46_0_0EXDisabledDevLoadingView.h" -#import "ABI46_0_0EXDisabledDevMenu.h" -#import "ABI46_0_0EXDisabledRedBox.h" -#import "ABI46_0_0EXVersionManager.h" -#import "ABI46_0_0EXScopedBridgeModule.h" -#import "ABI46_0_0EXStatusBarManager.h" -#import "ABI46_0_0EXUnversioned.h" -#import "ABI46_0_0EXScopedFileSystemModule.h" -#import "ABI46_0_0EXTest.h" - -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import -#import - -#import - -#import -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0EXScopedModuleRegistry.h" -#import "ABI46_0_0EXScopedModuleRegistryAdapter.h" -#import "ABI46_0_0EXScopedModuleRegistryDelegate.h" - -#import -#import -#import -#import - -#import -#import -#import -#import -#import - -// Import 3rd party modules that need to be scoped. -#import "ABI46_0_0RNCWebViewManager.h" - -ABI46_0_0RCT_EXTERN NSDictionary *ABI46_0_0EXGetScopedModuleClasses(void); -ABI46_0_0RCT_EXTERN void ABI46_0_0EXRegisterScopedModule(Class, ...); - -@interface ABI46_0_0RCTEventDispatcher (ABI46_0_0REAnimated) - -- (void)setBridge:(ABI46_0_0RCTBridge*)bridge; - -@end - -// this is needed because ABI46_0_0RCTPerfMonitor does not declare a public interface -// anywhere that we can import. -@interface ABI46_0_0RCTPerfMonitorDevSettingsHack - -- (void)hide; -- (void)show; - -@end - -@interface ABI46_0_0RCTBridgeHack - -- (void)reload; - -@end - -@interface ABI46_0_0EXVersionManager () - -// is this the first time this ABI has been touched at runtime? -@property (nonatomic, assign) BOOL isFirstLoad; -@property (nonatomic, strong) NSDictionary *params; -@property (nonatomic, strong) ABI46_0_0EXManifestsManifest *manifest; -@property (nonatomic, strong) ABI46_0_0RCTTurboModuleManager *turboModuleManager; - -@end - -@implementation ABI46_0_0EXVersionManager - -/** - * Expected params: - * NSDictionary *constants - * NSURL *initialUri - * @BOOL isDeveloper - * @BOOL isStandardDevMenuAllowed - * @ABI46_0_0EXTestEnvironment testEnvironment - * NSDictionary *services - * - * Kernel-only: - * ABI46_0_0EXKernel *kernel - * NSArray *supportedSdkVersions - * id exceptionsManagerDelegate - */ -- (instancetype)initWithParams:(NSDictionary *)params - manifest:(ABI46_0_0EXManifestsManifest *)manifest - fatalHandler:(void (^)(NSError *))fatalHandler - logFunction:(ABI46_0_0RCTLogFunction)logFunction - logThreshold:(NSInteger)threshold -{ - if (self = [super init]) { - _params = params; - _manifest = manifest; - [self configureABIWithFatalHandler:fatalHandler logFunction:logFunction logThreshold:threshold]; - } - return self; -} - -+ (void)load -{ - // Register scoped 3rd party modules. Some of them are separate pods that - // don't have access to ABI46_0_0EXScopedModuleRegistry and so they can't register themselves. - ABI46_0_0EXRegisterScopedModule([ABI46_0_0RNCWebViewManager class], ABI46_0_0EX_KERNEL_SERVICE_NONE, nil); -} - -- (void)bridgeWillStartLoading:(id)bridge -{ - // We need to check DEBUG flag here because in ejected projects ABI46_0_0RCT_DEV is set only for ABI46_0_0React and not for ExpoKit to which this file belongs to. - // It can be changed to just ABI46_0_0RCT_DEV once we deprecate ExpoKit and set that flag for the entire standalone project. -#if DEBUG || ABI46_0_0RCT_DEV - if ([self _isDevModeEnabledForBridge:bridge]) { - // Set the bundle url for the packager connection manually - NSURL *bundleURL = [bridge bundleURL]; - NSString *packagerServerHostPort = [NSString stringWithFormat:@"%@:%@", bundleURL.host, bundleURL.port]; - [[ABI46_0_0RCTPackagerConnection sharedPackagerConnection] reconnect:packagerServerHostPort]; - } -#endif - - // Manually send a "start loading" notif, since the real one happened uselessly inside the ABI46_0_0RCTBatchedBridge constructor - [[NSNotificationCenter defaultCenter] - postNotificationName:ABI46_0_0RCTJavaScriptWillStartLoadingNotification object:bridge]; -} - -- (void)bridgeFinishedLoading:(id)bridge -{ - // Override the "Reload" button from Redbox to reload the app from manifest - // Keep in mind that it is possible this will return a ABI46_0_0EXDisabledRedBox - ABI46_0_0RCTRedBox *redBox = [self _moduleInstanceForBridge:bridge named:@"RedBox"]; - [redBox setOverrideReloadAction:^{ - [[NSNotificationCenter defaultCenter] postNotificationName:@"EXReloadActiveAppRequest" object:nil]; - }]; -} - -- (void)invalidate {} - -- (NSDictionary *)devMenuItemsForBridge:(id)bridge -{ - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - BOOL isDevModeEnabled = [self _isDevModeEnabledForBridge:bridge]; - NSMutableDictionary *items = [NSMutableDictionary new]; - - if (isDevModeEnabled) { - items[@"dev-inspector"] = @{ - @"label": devSettings.isElementInspectorShown ? @"Hide Element Inspector" : @"Show Element Inspector", - @"isEnabled": @YES - }; - } else { - items[@"dev-inspector"] = @{ - @"label": @"Element Inspector Unavailable", - @"isEnabled": @NO - }; - } - - if (devSettings.isRemoteDebuggingAvailable && isDevModeEnabled) { - items[@"dev-remote-debug"] = @{ - @"label": (devSettings.isDebuggingRemotely) ? @"Stop Remote Debugging" : @"Debug Remote JS", - @"isEnabled": @YES - }; - } else { - items[@"dev-remote-debug"] = @{ - @"label": @"Remote Debugger Unavailable", - @"isEnabled": @NO, - @"detail": ABI46_0_0RCTTurboModuleEnabled() ? @"Remote debugging is unavailable while Turbo Modules are enabled. To debug remotely, please set `turboModules` to false in app.json." : [NSNull null] - }; - } - - if (devSettings.isHotLoadingAvailable && isDevModeEnabled) { - items[@"dev-hmr"] = @{ - @"label": (devSettings.isHotLoadingEnabled) ? @"Disable Fast Refresh" : @"Enable Fast Refresh", - @"isEnabled": @YES, - }; - } else { - items[@"dev-hmr"] = @{ - @"label": @"Fast Refresh Unavailable", - @"isEnabled": @NO, - @"detail": @"Use the Reload button above to reload when in production mode. Switch back to development mode to use Fast Refresh." - }; - } - - id perfMonitor = [self _moduleInstanceForBridge:bridge named:@"PerfMonitor"]; - if (perfMonitor && isDevModeEnabled) { - items[@"dev-perf-monitor"] = @{ - @"label": devSettings.isPerfMonitorShown ? @"Hide Performance Monitor" : @"Show Performance Monitor", - @"isEnabled": @YES, - }; - } else { - items[@"dev-perf-monitor"] = @{ - @"label": @"Performance Monitor Unavailable", - @"isEnabled": @NO, - }; - } - - return items; -} - -- (void)selectDevMenuItemWithKey:(NSString *)key onBridge:(id)bridge -{ - ABI46_0_0RCTAssertMainQueue(); - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - if ([key isEqualToString:@"dev-reload"]) { - // bridge could be an ABI46_0_0RCTBridge of any version and we need to cast it since ARC needs to know - // the return type - [(ABI46_0_0RCTBridgeHack *)bridge reload]; - } else if ([key isEqualToString:@"dev-remote-debug"]) { - devSettings.isDebuggingRemotely = !devSettings.isDebuggingRemotely; - } else if ([key isEqualToString:@"dev-profiler"]) { - devSettings.isProfilingEnabled = !devSettings.isProfilingEnabled; - } else if ([key isEqualToString:@"dev-hmr"]) { - devSettings.isHotLoadingEnabled = !devSettings.isHotLoadingEnabled; - } else if ([key isEqualToString:@"dev-inspector"]) { - [devSettings toggleElementInspector]; - } else if ([key isEqualToString:@"dev-perf-monitor"]) { - id perfMonitor = [self _moduleInstanceForBridge:bridge named:@"PerfMonitor"]; - if (perfMonitor) { - if (devSettings.isPerfMonitorShown) { - [perfMonitor hide]; - devSettings.isPerfMonitorShown = NO; - } else { - [perfMonitor show]; - devSettings.isPerfMonitorShown = YES; - } - } - } -} - -- (void)showDevMenuForBridge:(id)bridge -{ - ABI46_0_0RCTAssertMainQueue(); - id devMenu = [self _moduleInstanceForBridge:bridge named:@"DevMenu"]; - // respondsToSelector: check is required because it's possible this bridge - // was instantiated with a `disabledDevMenu` instance and the gesture preference was recently updated. - if ([devMenu respondsToSelector:@selector(show)]) { - [((ABI46_0_0RCTDevMenu *)devMenu) show]; - } -} - -- (void)disableRemoteDebuggingForBridge:(id)bridge -{ - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - devSettings.isDebuggingRemotely = NO; -} - -- (void)toggleRemoteDebuggingForBridge:(id)bridge -{ - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - devSettings.isDebuggingRemotely = !devSettings.isDebuggingRemotely; -} - -- (void)togglePerformanceMonitorForBridge:(id)bridge -{ - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - id perfMonitor = [self _moduleInstanceForBridge:bridge named:@"PerfMonitor"]; - if (perfMonitor) { - if (devSettings.isPerfMonitorShown) { - [perfMonitor hide]; - devSettings.isPerfMonitorShown = NO; - } else { - [perfMonitor show]; - devSettings.isPerfMonitorShown = YES; - } - } -} - -- (void)toggleElementInspectorForBridge:(id)bridge -{ - ABI46_0_0RCTDevSettings *devSettings = (ABI46_0_0RCTDevSettings *)[self _moduleInstanceForBridge:bridge named:@"DevSettings"]; - [devSettings toggleElementInspector]; -} - -#if DEBUG || ABI46_0_0RCT_DEV -- (uint32_t)addWebSocketNotificationHandler:(void (^)(NSDictionary *))handler - queue:(dispatch_queue_t)queue - forMethod:(NSString *)method -{ - return [[ABI46_0_0RCTPackagerConnection sharedPackagerConnection] addNotificationHandler:handler queue:queue forMethod:method]; -} -#endif - -#pragma mark - internal - -- (BOOL)_isDevModeEnabledForBridge:(id)bridge -{ - return ([ABI46_0_0RCTGetURLQueryParam([bridge bundleURL], @"dev") boolValue]); -} - -- (id)_moduleInstanceForBridge:(id)bridge named:(NSString *)name -{ - return [bridge moduleForClass:[self getModuleClassFromName:[name UTF8String]]]; -} - -- (void)configureABIWithFatalHandler:(void (^)(NSError *))fatalHandler - logFunction:(ABI46_0_0RCTLogFunction)logFunction - logThreshold:(NSInteger)threshold -{ - ABI46_0_0RCTEnableTurboModule([self.manifest.experiments[@"turboModules"] boolValue]); - ABI46_0_0RCTSetFatalHandler(fatalHandler); - ABI46_0_0RCTSetLogThreshold((ABI46_0_0RCTLogLevel) threshold); - ABI46_0_0RCTSetLogFunction(logFunction); -} - -- (NSArray *)extraModulesForBridge:(id)bridge -{ - NSDictionary *params = _params; - NSDictionary *services = params[@"services"]; - - NSMutableArray *extraModules = [NSMutableArray arrayWithArray: - @[ - [[ABI46_0_0EXAppState alloc] init], - [[ABI46_0_0EXDisabledDevLoadingView alloc] init], - [[ABI46_0_0EXStatusBarManager alloc] init], - ]]; - - // add scoped modules - [extraModules addObjectsFromArray:[self _newScopedModulesForServices:services params:params]]; - - if (params[@"testEnvironment"]) { - ABI46_0_0EXTestEnvironment testEnvironment = (ABI46_0_0EXTestEnvironment)[params[@"testEnvironment"] unsignedIntegerValue]; - if (testEnvironment != ABI46_0_0EXTestEnvironmentNone) { - ABI46_0_0EXTest *testModule = [[ABI46_0_0EXTest alloc] initWithEnvironment:testEnvironment]; - [extraModules addObject:testModule]; - } - } - - if (params[@"browserModuleClass"]) { - Class browserModuleClass = params[@"browserModuleClass"]; - id homeModule = [[browserModuleClass alloc] initWithExperienceStableLegacyId:self.manifest.stableLegacyId - scopeKey:self.manifest.scopeKey - easProjectId:self.manifest.easProjectId - kernelServiceDelegate:services[@"EXHomeModuleManager"] - params:params]; - [extraModules addObject:homeModule]; - } - - ABI46_0_0EXModuleRegistryProvider *moduleRegistryProvider = [[ABI46_0_0EXModuleRegistryProvider alloc] initWithSingletonModules:params[@"singletonModules"]]; - - Class resolverClass = [ABI46_0_0EXScopedModuleRegistryDelegate class]; - if (params[@"moduleRegistryDelegateClass"] && params[@"moduleRegistryDelegateClass"] != [NSNull null]) { - resolverClass = params[@"moduleRegistryDelegateClass"]; - } - - id moduleRegistryDelegate = [[resolverClass alloc] initWithParams:params]; - [moduleRegistryProvider setModuleRegistryDelegate:moduleRegistryDelegate]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - ABI46_0_0EXScopedModuleRegistryAdapter *moduleRegistryAdapter = [[ABI46_0_0EXScopedModuleRegistryAdapter alloc] initWithModuleRegistryProvider:moduleRegistryProvider]; -#pragma clang diagnostic pop - - ABI46_0_0EXModuleRegistry *moduleRegistry = [moduleRegistryAdapter moduleRegistryForParams:params - forExperienceStableLegacyId:self.manifest.stableLegacyId - scopeKey:self.manifest.scopeKey - manifest:self.manifest - withKernelServices:services]; - - // Adding ABI46_0_0EXNativeModulesProxy with the custom moduleRegistry. - ABI46_0_0EXNativeModulesProxy *expoNativeModulesProxy = [[ABI46_0_0EXNativeModulesProxy alloc] initWithCustomModuleRegistry:moduleRegistry]; - [extraModules addObject:expoNativeModulesProxy]; - - // Adding the way to access the module registry from ABI46_0_0RCTBridgeModules. - [extraModules addObject:[[ABI46_0_0EXModuleRegistryHolderReactModule alloc] initWithModuleRegistry:moduleRegistry]]; - - if (!ABI46_0_0RCTTurboModuleEnabled()) { - [extraModules addObject:[self getModuleInstanceFromClass:[self getModuleClassFromName:"DevSettings"]]]; - id exceptionsManager = [self getModuleInstanceFromClass:ABI46_0_0RCTExceptionsManagerCls()]; - if (exceptionsManager) { - [extraModules addObject:exceptionsManager]; - } - [extraModules addObject:[self getModuleInstanceFromClass:[self getModuleClassFromName:"DevMenu"]]]; - [extraModules addObject:[self getModuleInstanceFromClass:[self getModuleClassFromName:"RedBox"]]]; - [extraModules addObject:[self getModuleInstanceFromClass:ABI46_0_0RCTAsyncLocalStorageCls()]]; - } - - return extraModules; -} - -- (NSArray *)_newScopedModulesForServices:(NSDictionary *)services params:(NSDictionary *)params -{ - NSMutableArray *result = [NSMutableArray array]; - NSDictionary *ABI46_0_0EXScopedModuleClasses = ABI46_0_0EXGetScopedModuleClasses(); - if (ABI46_0_0EXScopedModuleClasses) { - [ABI46_0_0EXScopedModuleClasses enumerateKeysAndObjectsUsingBlock:^(NSString * _Nonnull scopedModuleClassName, NSDictionary * _Nonnull kernelServiceClassNames, BOOL * _Nonnull stop) { - NSMutableDictionary *moduleServices = [[NSMutableDictionary alloc] init]; - for (id kernelServiceClassName in kernelServiceClassNames) { - NSString *kernelSerivceName = kernelServiceClassNames[kernelServiceClassName]; - id service = ([kernelSerivceName isEqualToString:ABI46_0_0EX_KERNEL_SERVICE_NONE]) ? [NSNull null] : services[kernelSerivceName]; - moduleServices[kernelServiceClassName] = service; - } - - id scopedModule; - Class scopedModuleClass = NSClassFromString(scopedModuleClassName); - if (moduleServices.count > 1) { - scopedModule = [[scopedModuleClass alloc] initWithExperienceStableLegacyId:self.manifest.stableLegacyId - scopeKey:self.manifest.scopeKey - easProjectId:self.manifest.easProjectId - kernelServiceDelegates:moduleServices - params:params]; - } else if (moduleServices.count == 0) { - scopedModule = [[scopedModuleClass alloc] initWithExperienceStableLegacyId:self.manifest.stableLegacyId - scopeKey:self.manifest.scopeKey - easProjectId:self.manifest.easProjectId - kernelServiceDelegate:nil - params:params]; - } else { - scopedModule = [[scopedModuleClass alloc] initWithExperienceStableLegacyId:self.manifest.stableLegacyId - scopeKey:self.manifest.scopeKey - easProjectId:self.manifest.easProjectId - kernelServiceDelegate:moduleServices[[moduleServices allKeys][0]] - params:params]; - } - - if (scopedModule) { - [result addObject:scopedModule]; - } - }]; - } - return result; -} - -- (Class)getModuleClassFromName:(const char *)name -{ - if (std::string(name) == "DevSettings") { - return ABI46_0_0EXDevSettings.class; - } - if (std::string(name) == "DevMenu") { - if (![_params[@"isStandardDevMenuAllowed"] boolValue] || ![_params[@"isDeveloper"] boolValue]) { - // non-kernel, or non-development kernel, uses expo menu instead of ABI46_0_0RCTDevMenu - return ABI46_0_0EXDisabledDevMenu.class; - } - } - if (std::string(name) == "RedBox") { - if (![_params[@"isDeveloper"] boolValue]) { - // user-facing (not debugging). - // additionally disable ABI46_0_0RCTRedBox - return ABI46_0_0EXDisabledRedBox.class; - } - } - return ABI46_0_0RCTCoreModulesClassProvider(name); -} - -/** - Returns a pure C++ object wrapping an exported unimodule instance. - */ -- (std::shared_ptr)getTurboModule:(const std::string &)name - jsInvoker:(std::shared_ptr)jsInvoker -{ - return nullptr; -} - -- (id)getModuleInstanceFromClass:(Class)moduleClass -{ - // Standard - if (moduleClass == ABI46_0_0RCTImageLoader.class) { - return [[moduleClass alloc] initWithRedirectDelegate:nil loadersProvider:^NSArray> *(ABI46_0_0RCTModuleRegistry *) { - return @[[ABI46_0_0RCTLocalAssetImageLoader new], [ABI46_0_0EXMediaLibraryImageLoader new]]; - } decodersProvider:^NSArray> *(ABI46_0_0RCTModuleRegistry *) { - return @[[ABI46_0_0RCTGIFImageDecoder new]]; - }]; - } else if (moduleClass == ABI46_0_0RCTNetworking.class) { - return [[moduleClass alloc] initWithHandlersProvider:^NSArray> *(ABI46_0_0RCTModuleRegistry *) { - return @[ - [ABI46_0_0RCTHTTPRequestHandler new], - [ABI46_0_0RCTDataRequestHandler new], - [ABI46_0_0RCTFileRequestHandler new], - ]; - }]; - } - - // Expo-specific - if (moduleClass == ABI46_0_0EXDevSettings.class) { - BOOL isDevelopment = ![self _isOpeningHomeInProductionMode] && [_params[@"isDeveloper"] boolValue]; - return [[moduleClass alloc] initWithScopeKey:self.manifest.scopeKey isDevelopment:isDevelopment]; - } else if (moduleClass == ABI46_0_0RCTExceptionsManagerCls()) { - id exceptionsManagerDelegate = _params[@"exceptionsManagerDelegate"]; - if (exceptionsManagerDelegate) { - return [[moduleClass alloc] initWithDelegate:exceptionsManagerDelegate]; - } else { - ABI46_0_0RCTLogWarn(@"No exceptions manager provided when building extra modules for bridge."); - } - } else if (moduleClass == ABI46_0_0RCTAsyncLocalStorageCls()) { - NSString *documentDirectory; - if (_params[@"fileSystemDirectories"]) { - documentDirectory = _params[@"fileSystemDirectories"][@"documentDirectory"]; - } else { - NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - documentDirectory = [documentPaths objectAtIndex:0]; - } - NSString *localStorageDirectory = [documentDirectory stringByAppendingPathComponent:@"RCTAsyncLocalStorage"]; - return [[moduleClass alloc] initWithStorageDirectory:localStorageDirectory]; - } - - return [moduleClass new]; -} - -- (std::shared_ptr)getTurboModule:(const std::string &)name - initParams:(const ABI46_0_0facebook::ABI46_0_0React::ObjCTurboModule::InitParams &)params -{ - // TODO: ADD - return nullptr; -} - -- (BOOL)_isOpeningHomeInProductionMode -{ - return _params[@"browserModuleClass"] && !self.manifest.developer; -} - -- (void *)versionedJsExecutorFactoryForBridge:(ABI46_0_0RCTBridge *)bridge -{ - [bridge moduleForClass:[ABI46_0_0RCTUIManager class]]; - ABI46_0_0REAUIManager *reaUiManager = [ABI46_0_0REAUIManager new]; - [reaUiManager setBridge:bridge]; - ABI46_0_0RCTUIManager *uiManager = reaUiManager; - [bridge updateModuleWithInstance:uiManager]; - - [bridge moduleForClass:[ABI46_0_0RCTEventDispatcher class]]; - ABI46_0_0RCTEventDispatcher *eventDispatcher = [ABI46_0_0REAEventDispatcher new]; - ABI46_0_0RCTCallableJSModules *callableJSModules = [ABI46_0_0RCTCallableJSModules new]; - [bridge setValue:callableJSModules forKey:@"_callableJSModules"]; - [callableJSModules setBridge:bridge]; - [eventDispatcher setValue:callableJSModules forKey:@"_callableJSModules"]; - [eventDispatcher setValue:bridge forKey:@"_bridge"]; - [eventDispatcher initialize]; - [bridge updateModuleWithInstance:eventDispatcher]; - - ABI46_0_0EX_WEAKIFY(self); - const auto executor = [ABI46_0_0EXWeak_self, bridge](ABI46_0_0facebook::jsi::Runtime &runtime) { - if (!bridge) { - return; - } - ABI46_0_0EX_ENSURE_STRONGIFY(self); - auto reanimatedModule = ABI46_0_0reanimated::createReanimatedModule(bridge, bridge.jsCallInvoker); - auto workletRuntimeValue = runtime - .global() - .getProperty(runtime, "ArrayBuffer") - .asObject(runtime) - .asFunction(runtime) - .callAsConstructor(runtime, {static_cast(sizeof(void*))}); - uintptr_t* workletRuntimeData = reinterpret_cast( - workletRuntimeValue.getObject(runtime).getArrayBuffer(runtime).data(runtime)); - workletRuntimeData[0] = reinterpret_cast(reanimatedModule->runtime.get()); - runtime.global().setProperty( - runtime, - "_WORKLET_RUNTIME", - workletRuntimeValue); - - runtime.global().setProperty( - runtime, - jsi::PropNameID::forAscii(runtime, "__reanimatedModuleProxy"), - jsi::Object::createFromHostObject(runtime, reanimatedModule)); - }; - return new ABI46_0_0facebook::ABI46_0_0React::JSCExecutorFactory(ABI46_0_0RCTJSIExecutorRuntimeInstaller(executor)); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.h deleted file mode 100644 index a522062407c492..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ABI46_0_0EXImageUtils.h -// Exponent -// -// Created by Stanisław Chmiela on 17.11.2017. -// Copyright © 2017 650 Industries. All rights reserved. -// - -#import -#import -#import - -@interface ABI46_0_0EXImageUtils : NSObject - -+ (UIImage *)generatePhotoOfSize:(CGSize)size; -+ (UIImage *)cropImage:(UIImage *)image toRect:(CGRect)rect; -+ (NSString *)writeImage:(NSData *)image toPath:(NSString *)path; -+ (void)updatePhotoMetadata:(CMSampleBufferRef)imageSampleBuffer withAdditionalData:(NSDictionary *)additionalData inResponse:(NSMutableDictionary *)response; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.m deleted file mode 100644 index d972a0638af87a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXImageUtils.m +++ /dev/null @@ -1,71 +0,0 @@ -// -// ABI46_0_0EXImageUtils.m -// Exponent -// -// Created by Stanisław Chmiela on 17.11.2017. -// Copyright © 2017 650 Industries. All rights reserved. -// - -#import "ABI46_0_0EXImageUtils.h" - -@implementation ABI46_0_0EXImageUtils - -+ (UIImage *)generatePhotoOfSize:(CGSize)size -{ - CGRect rect = CGRectMake(0, 0, size.width, size.height); - UIImage *image; - UIGraphicsBeginImageContextWithOptions(size, YES, 0); - UIColor *color = [UIColor blackColor]; - [color setFill]; - UIRectFill(rect); - NSDate *currentDate = [NSDate date]; - NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init]; - [dateFormatter setDateFormat:@"dd.MM.YY HH:mm:ss"]; - NSString *text = [dateFormatter stringFromDate:currentDate]; - NSDictionary *attributes = [NSDictionary dictionaryWithObjects: @[[UIFont systemFontOfSize:18.0], [UIColor orangeColor]] - forKeys: @[NSFontAttributeName, NSForegroundColorAttributeName]]; - [text drawAtPoint:CGPointMake(size.width * 0.1, size.height * 0.9) withAttributes:attributes]; - image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return image; -} - -+ (UIImage *)cropImage:(UIImage *)image toRect:(CGRect)rect -{ - CGImageRef takenCGImage = image.CGImage; - CGImageRef cropCGImage = CGImageCreateWithImageInRect(takenCGImage, rect); - image = [UIImage imageWithCGImage:cropCGImage scale:image.scale orientation:image.imageOrientation]; - CGImageRelease(cropCGImage); - return image; -} - -+ (NSString *)writeImage:(NSData *)image toPath:(NSString *)path -{ - [image writeToFile:path atomically:YES]; - NSURL *fileURL = [NSURL fileURLWithPath:path]; - return [fileURL absoluteString]; -} - -+ (void)updatePhotoMetadata:(CMSampleBufferRef)imageSampleBuffer withAdditionalData:(NSDictionary *)additionalData inResponse:(NSMutableDictionary *)response -{ - CFDictionaryRef exifAttachments = CMGetAttachment(imageSampleBuffer, kCGImagePropertyExifDictionary, NULL); - NSMutableDictionary *metadata = (__bridge NSMutableDictionary *)exifAttachments; - metadata[(NSString *)kCGImagePropertyExifPixelYDimension] = response[@"width"]; - metadata[(NSString *)kCGImagePropertyExifPixelXDimension] = response[@"height"]; - - for (id key in additionalData) { - metadata[key] = additionalData[key]; - } - - NSDictionary *gps = metadata[(NSString *)kCGImagePropertyGPSDictionary]; - - if (gps) { - for (NSString *gpsKey in gps) { - metadata[[@"GPS" stringByAppendingString:gpsKey]] = gps[gpsKey]; - } - } - - response[@"exif"] = metadata; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.h deleted file mode 100644 index 2b17d5056478bf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.h +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016-present 650 Industries. All rights reserved. - -#import -#import "ABI46_0_0EXScopedBridgeModule.h" -#import "ABI46_0_0EXScopedModuleRegistry.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol ABI46_0_0EXUserNotificationCenterService - -- (void)requestAuthorizationWithOptions:(UNAuthorizationOptions)options completionHandler:(void (^)(BOOL granted, NSError *__nullable error))completionHandler; - -- (void)setNotificationCategories:(NSSet *)categories; -- (void)getNotificationCategoriesWithCompletionHandler:(void(^)(NSSet *categories))completionHandler; - -- (void)getNotificationSettingsWithCompletionHandler:(void(^)(UNNotificationSettings *settings))completionHandler; - -- (void)addNotificationRequest:(UNNotificationRequest *)request withCompletionHandler:(nullable void(^)(NSError *__nullable error))completionHandler; - -- (void)getPendingNotificationRequestsWithCompletionHandler:(void(^)(NSArray *requests))completionHandler; -- (void)removePendingNotificationRequestsWithIdentifiers:(NSArray *)identifiers; -- (void)removeAllPendingNotificationRequests; - -@end - -@protocol ABI46_0_0EXNotificationsScopedModuleDelegate - -- (void)getApnsTokenForScopedModule:(id)scopedModule - completionHandler:(void (^)(NSString * _Nullable, NSError * _Nullable))handler; -- (void)getExpoPushTokenForScopedModule:(id)scopedModule - completionHandler:(void (^)(NSString * _Nullable pushToken, NSError * _Nullable error))handler; - -@end - -@protocol ABI46_0_0EXNotificationsIdentifiersManager - -- (NSString *)internalIdForIdentifier:(NSString *)identifier scopeKey:(NSString *)scopeKey; -- (NSString *)exportedIdForInternalIdentifier:(NSString *)identifier; - -@end - -@interface ABI46_0_0EXNotifications : ABI46_0_0EXScopedBridgeModule - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.m deleted file mode 100644 index 9d89c361cc9e3f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXNotifications.m +++ /dev/null @@ -1,461 +0,0 @@ -// Copyright 2016-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXNotifications.h" -#import "ABI46_0_0EXUnversioned.h" -#import "ABI46_0_0EXUtil.h" - -#import -#import - -#import - -#import "ABI46_0_0EXConstantsBinding.h" - -@implementation ABI46_0_0RCTConvert (NSCalendarUnit) - -ABI46_0_0RCT_ENUM_CONVERTER(NSCalendarUnit, - (@{ - @"year": @(NSCalendarUnitYear), - @"month": @(NSCalendarUnitMonth), - @"week": @(NSCalendarUnitWeekOfYear), - @"day": @(NSCalendarUnitDay), - @"hour": @(NSCalendarUnitHour), - @"minute": @(NSCalendarUnitMinute) - }), - 0, - integerValue); - -@end - -@interface ABI46_0_0EXNotifications () - -// unversioned ABI46_0_0EXRemoteNotificationManager instance -@property (nonatomic, weak) id remoteNotificationsDelegate; -@property (nonatomic, weak) id notificationsIdentifiersManager; -@property (nonatomic, weak) id userNotificationCenter; - -@end - -@implementation ABI46_0_0EXNotifications - -ABI46_0_0EX_EXPORT_SCOPED_MULTISERVICE_MODULE(ExponentNotifications, @"RemoteNotificationManager", @"UserNotificationManager", @"UserNotificationCenter"); - -@synthesize bridge = _bridge; -@synthesize methodQueue = _methodQueue; - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - _bridge = bridge; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegates:(NSDictionary *)kernelServiceInstances - params:(NSDictionary *)params -{ - if (self = [super initWithExperienceStableLegacyId:experienceStableLegacyId - scopeKey:scopeKey - easProjectId:easProjectId - kernelServiceDelegate:kernelServiceInstances - params:params]) { - _userNotificationCenter = kernelServiceInstances[@"UserNotificationCenter"]; - _remoteNotificationsDelegate = kernelServiceInstances[@"RemoteNotificationManager"]; - _notificationsIdentifiersManager = kernelServiceInstances[@"UserNotificationManager"]; - } - return self; -} - -ABI46_0_0RCT_REMAP_METHOD(getDevicePushTokenAsync, - getDevicePushTokenWithConfig: (__unused NSDictionary *)config - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - ABI46_0_0EXConstantsBinding *constants = [[[self.bridge moduleForClass:[ABI46_0_0EXModuleRegistryHolderReactModule class]] exModuleRegistry] getModuleImplementingProtocol:@protocol(ABI46_0_0EXConstantsInterface)]; - if (![constants.appOwnership isEqualToString:@"standalone"]) { - return reject(0, @"getDevicePushTokenAsync is only accessible within standalone applications", nil); - } - - [_remoteNotificationsDelegate getApnsTokenForScopedModule:self completionHandler:^(NSString * _Nullable apnsToken, NSError * _Nullable error) { - if (error) { - reject(@"ERR_NOTIFICATIONS_PUSH_REGISTRATION_FAILED", error.localizedDescription, error); - } else { - resolve(@{ @"type": @"apns", @"data": apnsToken }); - } - }]; -} - -ABI46_0_0RCT_REMAP_METHOD(getExponentPushTokenAsync, - getExponentPushTokenAsyncWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if (!self.experienceStableLegacyId && !self.easProjectId) { - reject(@"E_NOTIFICATIONS_INTERNAL_ERROR", @"The notifications module is missing the current project's ID", nil); - return; - } - - [_remoteNotificationsDelegate getExpoPushTokenForScopedModule:self completionHandler:^(NSString *pushToken, NSError *error) { - if (error) { - reject(@"E_NOTIFICATIONS_TOKEN_REGISTRATION_FAILED", error.localizedDescription, error); - } else { - resolve(pushToken); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(presentLocalNotification:(NSDictionary *)payload - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if (!payload[@"data"]) { - reject(@"E_NOTIF_NO_DATA", @"Attempted to send a local notification with no `data` property.", nil); - return; - } - UNMutableNotificationContent *content = [self _localNotificationFromPayload:payload]; - UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:content.userInfo[@"id"] - content:content - trigger:nil]; - - [_userNotificationCenter addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { - if (error) { - reject(@"E_NOTIF", [NSString stringWithFormat:@"Could not add a notification request: %@", error.localizedDescription], error); - } else { - resolve(content.userInfo[@"id"]); - } - }]; -} - - - ABI46_0_0RCT_EXPORT_METHOD(scheduleNotificationWithTimer:(NSDictionary *)payload - withOptions:(NSDictionary *)options - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if (!payload[@"data"]) { - reject(@"E_NOTIF_NO_DATA", @"Attempted to send a local notification with no `data` property.", nil); - return; - } - BOOL repeats = [options[@"repeat"] boolValue]; - int seconds = [options[@"interval"] intValue] / 1000; - UNTimeIntervalNotificationTrigger *notificationTrigger = [UNTimeIntervalNotificationTrigger triggerWithTimeInterval:seconds repeats:repeats]; - UNMutableNotificationContent *content = [self _localNotificationFromPayload:payload]; - UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:content.userInfo[@"id"] - content:content - trigger:notificationTrigger]; - [_userNotificationCenter addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { - if (error) { - reject(@"E_NOTIF_REQ", error.localizedDescription, error); - } else { - resolve(content.userInfo[@"id"]); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(scheduleNotificationWithCalendar:(NSDictionary *)payload - withOptions:(NSDictionary *)options - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if (!payload[@"data"]) { - reject(@"E_NOTIF_NO_DATA", @"Attempted to send a local notification with no `data` property.", nil); - return; - } - UNCalendarNotificationTrigger *notificationTrigger = [self calendarTriggerFrom:options]; - UNMutableNotificationContent *content = [self _localNotificationFromPayload:payload]; - UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:content.userInfo[@"id"] - content:content - trigger:notificationTrigger]; - [_userNotificationCenter addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { - if (error) { - reject(@"E_NOTIF_REQ", error.localizedDescription, error); - } else { - resolve(content.userInfo[@"id"]); - } - }]; -} - - -ABI46_0_0RCT_EXPORT_METHOD(scheduleLocalNotification:(NSDictionary *)payload - withOptions:(NSDictionary *)options - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if (!payload[@"data"]) { - reject(@"E_NOTIF_NO_DATA", @"Attempted to send a local notification with no `data` property.", nil); - return; - } - UNCalendarNotificationTrigger *notificationTrigger = [self notificationTriggerFor:options[@"time"]]; - UNMutableNotificationContent *content = [self _localNotificationFromPayload:payload]; - UNNotificationRequest *request = [UNNotificationRequest requestWithIdentifier:content.userInfo[@"id"] - content:content - trigger:notificationTrigger]; - [_userNotificationCenter addNotificationRequest:request withCompletionHandler:^(NSError * _Nullable error) { - if (error) { - reject(@"E_NOTIF_REQ", error.localizedDescription, error); - } else { - resolve(content.userInfo[@"id"]); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(legacyScheduleLocalRepeatingNotification:(NSDictionary *)payload - withOptions:(NSDictionary *)options - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - #pragma GCC diagnostic ignored "-Wdeprecated-declarations" - if (!payload[@"data"]) { - reject(@"E_NOTIF_NO_DATA", @"Attempted to send a local notification with no `data` property.", nil); - return; - } - UILocalNotification *localNotification = [UILocalNotification new]; - NSString *uniqueId = [[NSUUID new] UUIDString]; - localNotification.alertTitle = payload[@"title"]; - localNotification.alertBody = payload[@"body"]; - if ([payload[@"sound"] boolValue]) { - localNotification.soundName = UILocalNotificationDefaultSoundName; - } - if ([payload[@"categoryId"] isKindOfClass:[NSString class]]) { - localNotification.category = [self internalIdForIdentifier:payload[@"categoryId"]]; - } - localNotification.applicationIconBadgeNumber = [ABI46_0_0RCTConvert NSInteger:payload[@"count"]] ?: 0; - localNotification.userInfo = @{ - @"body": payload[@"data"], - @"experienceId": self.scopeKey, - @"scopeKey": self.scopeKey, - @"id": uniqueId - }; - localNotification.fireDate = [ABI46_0_0RCTConvert NSDate:options[@"time"]] ?: [NSDate new]; - localNotification.repeatInterval = [ABI46_0_0RCTConvert NSCalendarUnit:options[@"repeat"]] ?: 0; - - __weak typeof(self) weakSelf = self; - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - [ABI46_0_0RCTSharedApplication() scheduleLocalNotification:localNotification]; - dispatch_queue_t methodQueue = weakSelf.methodQueue; - if (methodQueue) { - dispatch_async(methodQueue, ^{ - resolve(uniqueId); - }); - } - }]; - #pragma GCC diagnostic warning "-Wdeprecated-declarations" -} - -ABI46_0_0RCT_REMAP_METHOD(cancelScheduledNotificationAsync, - cancelScheduledNotificationAsync:(NSString *)uniqueId - withResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - __weak id userNotificationCenter = _userNotificationCenter; - [_userNotificationCenter getPendingNotificationRequestsWithCompletionHandler:^(NSArray * _Nonnull requests) { - for (UNNotificationRequest *request in requests) { - if ([request.content.userInfo[@"id"] isEqualToString:uniqueId]) { - [userNotificationCenter removePendingNotificationRequestsWithIdentifiers:@[request.identifier]]; - return resolve(nil); - } - } - reject(@"E_NO_NOTIF", [NSString stringWithFormat:@"Could not find pending notification request to cancel with id = %@", uniqueId], nil); - }]; -} - -ABI46_0_0RCT_REMAP_METHOD(cancelAllScheduledNotificationsAsync, - cancelAllScheduledNotificationsAsyncWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - __weak id userNotificationCenter = _userNotificationCenter; - [_userNotificationCenter getPendingNotificationRequestsWithCompletionHandler:^(NSArray * _Nonnull requests) { - NSMutableArray *requestsToCancelIdentifiers = [NSMutableArray new]; - for (UNNotificationRequest *request in requests) { - if ([request.content.userInfo[@"experienceId"] isEqualToString:self.scopeKey]) { - [requestsToCancelIdentifiers addObject:request.identifier]; - } - } - [userNotificationCenter removePendingNotificationRequestsWithIdentifiers:requestsToCancelIdentifiers]; - resolve(nil); - }]; -} - -#pragma mark - Badges - -// TODO: Make this read from the kernel instead of UIApplication for the main Exponent app - -ABI46_0_0RCT_REMAP_METHOD(getBadgeNumberAsync, - getBadgeNumberAsyncWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - __block NSInteger badgeNumber; - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - badgeNumber = ABI46_0_0RCTSharedApplication().applicationIconBadgeNumber; - }]; - resolve(@(badgeNumber)); -} - -ABI46_0_0RCT_EXPORT_METHOD(setBadgeNumberAsync:(nonnull NSNumber *)number - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - ABI46_0_0RCTSharedApplication().applicationIconBadgeNumber = number.integerValue; - }]; - resolve(nil); -} - -# pragma mark - Categories - -ABI46_0_0RCT_REMAP_METHOD(createCategoryAsync, - createCategoryWithCategoryId:(NSString *)categoryId - actions:(NSArray *)actions - previewPlaceholder: (NSString *)previewPlaceholder - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - NSMutableArray *actionsArray = [[NSMutableArray alloc] init]; - for (NSDictionary *actionParams in actions) { - [actionsArray addObject:[self parseNotificationActionFromParams:actionParams]]; - } - - UNNotificationCategory *newCategory; - if (@available(iOS 11, *)) { - newCategory = [UNNotificationCategory categoryWithIdentifier:[self internalIdForIdentifier:categoryId] - actions:actionsArray - intentIdentifiers:@[] - hiddenPreviewsBodyPlaceholder: previewPlaceholder - options:UNNotificationCategoryOptionNone]; - } else { - newCategory = [UNNotificationCategory categoryWithIdentifier:[self internalIdForIdentifier:categoryId] - actions:actionsArray - intentIdentifiers:@[] - options:UNNotificationCategoryOptionNone]; - } - - __weak id userNotificationCenter = _userNotificationCenter; - [_userNotificationCenter getNotificationCategoriesWithCompletionHandler:^(NSSet *categories) { - NSMutableSet *newCategories = [categories mutableCopy]; - for (UNNotificationCategory *category in newCategories) { - if ([category.identifier isEqualToString:newCategory.identifier]) { - [newCategories removeObject:category]; - break; - } - } - [newCategories addObject:newCategory]; - [userNotificationCenter setNotificationCategories:newCategories]; - resolve(nil); - }]; -} - -ABI46_0_0RCT_REMAP_METHOD(deleteCategoryAsync, - deleteCategoryWithCategoryId:(NSString *)categoryId - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - NSString *internalCategoryId = [self internalIdForIdentifier:categoryId]; - __weak id userNotificationCenter = _userNotificationCenter; - [_userNotificationCenter getNotificationCategoriesWithCompletionHandler:^(NSSet *categories) { - NSMutableSet *newCategories = [categories mutableCopy]; - for (UNNotificationCategory *category in newCategories) { - if ([category.identifier isEqualToString:internalCategoryId]) { - [newCategories removeObject:category]; - break; - } - } - [userNotificationCenter setNotificationCategories:newCategories]; - resolve(nil); - }]; -} - -#pragma mark - internal - -- (UNMutableNotificationContent *)_localNotificationFromPayload:(NSDictionary *)payload -{ - UNMutableNotificationContent *content = [UNMutableNotificationContent new]; - - NSString *uniqueId = [[NSUUID new] UUIDString]; - - content.title = payload[@"title"]; - content.body = payload[@"body"]; - - if ([payload[@"sound"] boolValue]) { - content.sound = [UNNotificationSound defaultSound]; - } - - if ([payload[@"count"] isKindOfClass:[NSNumber class]]) { - content.badge = (NSNumber *)payload[@"count"]; - } - - if ([payload[@"categoryId"] isKindOfClass:[NSString class]]) { - content.categoryIdentifier = [self internalIdForIdentifier:payload[@"categoryId"]]; - } - - content.userInfo = @{ - @"body": payload[@"data"], - @"experienceId": self.scopeKey, - @"scopeKey": self.scopeKey, - @"id": uniqueId - }; - - return content; -} - -- (NSString *)internalIdForIdentifier:(NSString *)identifier { - return [_notificationsIdentifiersManager internalIdForIdentifier:identifier scopeKey:self.scopeKey]; -} - -- (UNCalendarNotificationTrigger *)notificationTriggerFor:(NSNumber * _Nullable)unixTime -{ - NSDateComponents *dateComponents = [self dateComponentsFrom:unixTime]; - return [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:dateComponents repeats:NO]; -} - -- (NSDateComponents *)dateComponentsFrom:(NSNumber * _Nullable)unixTime { - static unsigned unitFlags = NSCalendarUnitSecond | NSCalendarUnitMinute | NSCalendarUnitHour | NSCalendarUnitDay | NSCalendarUnitMonth | NSCalendarUnitYear; - NSDate *triggerDate = [ABI46_0_0RCTConvert NSDate:unixTime] ?: [NSDate new]; - NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian]; - return [calendar components:unitFlags fromDate:triggerDate]; -} - -- (UNCalendarNotificationTrigger *)calendarTriggerFrom:(NSDictionary *)options -{ - BOOL repeats = [options[@"repeat"] boolValue]; - - NSDateComponents *date = [[NSDateComponents alloc] init]; - - NSArray *timeUnits = @[@"year", @"day", @"weekDay", @"month", @"hour", @"second", @"minute"]; - - for (NSString *timeUnit in timeUnits) { - if (options[timeUnit]) { - [date setValue:options[timeUnit] forKey:timeUnit]; - } - } - - return [UNCalendarNotificationTrigger triggerWithDateMatchingComponents:date repeats:repeats]; -} - - -- (UNNotificationAction *)parseNotificationActionFromParams:(NSDictionary *)params -{ - NSString *actionId = [self internalIdForIdentifier:params[@"actionId"]]; - NSString *buttonTitle = params[@"buttonTitle"]; - - UNNotificationActionOptions options = UNNotificationActionOptionNone; - if (![params[@"doNotOpenInForeground"] boolValue]) { - options += UNNotificationActionOptionForeground; - } - if ([params[@"isDestructive"] boolValue]) { - options += UNNotificationActionOptionDestructive; - } - if ([params[@"isAuthenticationRequired"] boolValue]) { - options += UNNotificationActionOptionAuthenticationRequired; - } - - if ([params[@"textInput"] isKindOfClass:[NSDictionary class]]) { - return [UNTextInputNotificationAction actionWithIdentifier:actionId - title:buttonTitle - options:options - textInputButtonTitle:params[@"textInput"][@"submitButtonTitle"] - textInputPlaceholder:params[@"textInput"][@"placeholder"]]; - } - - return [UNNotificationAction actionWithIdentifier:actionId title:buttonTitle options:options]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.h deleted file mode 100644 index 0c5bc4b992f8bf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016-present 650 Industries. All rights reserved. - -#import -#import "ABI46_0_0EXScopedBridgeModule.h" -#import "ABI46_0_0EXScopedModuleRegistry.h" - -@interface ABI46_0_0EXUtil : ABI46_0_0EXScopedBridgeModule - -+ (nullable NSString *)escapedResourceName:(nullable NSString *)name; -+ (void)performSynchronouslyOnMainThread:(nonnull void (^)(void))block; -+ (nonnull NSString *)hexStringWithCGColor:(nullable CGColorRef)color; -+ (nonnull UIColor *)colorWithRGB:(unsigned int)rgbValue; - -/** - * Expects @"#ABCDEF" - */ -+ (nullable UIColor *)colorWithHexString:(nullable NSString *)hexString; - -- (nullable UIViewController *)currentViewController; - -@end - -@protocol ABI46_0_0EXUtilService - -- (nullable UIViewController *)currentViewController; -- (nullable NSDictionary *)launchOptions; - -@end - -ABI46_0_0EX_DECLARE_SCOPED_MODULE_GETTER(ABI46_0_0EXUtil, util) diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.m deleted file mode 100644 index 4639c4a81243fb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ABI46_0_0EXUtil.m +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2016-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXUtil.h" -#import "ABI46_0_0EXScopedModuleRegistry.h" - -@interface ABI46_0_0EXUtil () - -@property (nonatomic, weak) id kernelUtilService; - -@end - -ABI46_0_0EX_DEFINE_SCOPED_MODULE_GETTER(ABI46_0_0EXUtil, util) - -@implementation ABI46_0_0EXUtil - -ABI46_0_0EX_EXPORT_SCOPED_MODULE(ExponentUtil, UtilService); - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params -{ - if (self = [super initWithExperienceStableLegacyId:experienceStableLegacyId - scopeKey:scopeKey - easProjectId:easProjectId - kernelServiceDelegate:kernelServiceInstance - params:params]) { - _kernelUtilService = kernelServiceInstance; - } - return self; -} - -+ (NSString *)escapedResourceName:(NSString *)name -{ - NSString *charactersToEscape = @"!*'();:@&=+$,/?%#[]"; - NSCharacterSet *allowedCharacters = [[NSCharacterSet characterSetWithCharactersInString:charactersToEscape] invertedSet]; - return [name stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacters]; -} - -+ (void)performSynchronouslyOnMainThread:(void (^)(void))block -{ - if ([NSThread isMainThread]) { - block(); - } else { - dispatch_sync(dispatch_get_main_queue(), block); - } -} - -// https://stackoverflow.com/questions/14051807/how-can-i-get-a-hex-string-from-uicolor-or-from-rgb -+ (NSString *)hexStringWithCGColor:(CGColorRef)color -{ - const CGFloat *components = CGColorGetComponents(color); - size_t count = CGColorGetNumberOfComponents(color); - - if (count == 2) { - return [NSString stringWithFormat:@"#%02lX%02lX%02lX", - lroundf(components[0] * 255.0), - lroundf(components[0] * 255.0), - lroundf(components[0] * 255.0)]; - } else { - return [NSString stringWithFormat:@"#%02lX%02lX%02lX", - lroundf(components[0] * 255.0), - lroundf(components[1] * 255.0), - lroundf(components[2] * 255.0)]; - } -} - -+ (UIColor *)colorWithRGB:(unsigned int)rgbValue -{ - return [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 - green:((float)((rgbValue & 0xFF00) >> 8))/255.0 - blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0]; -} - -+ (UIColor *)colorWithHexString:(NSString *)hexString -{ - if (!hexString || hexString.length != 7 || [hexString characterAtIndex:0] != '#') { - return nil; - } - hexString = [hexString substringWithRange:NSMakeRange(1, 6)]; - NSScanner *scanner = [NSScanner scannerWithString:hexString]; - unsigned int hex; - if ([scanner scanHexInt:&hex]) { - int r = (hex >> 16) & 0xFF; - int g = (hex >> 8) & 0xFF; - int b = (hex) & 0xFF; - - return [UIColor colorWithRed:r / 255.0f - green:g / 255.0f - blue:b / 255.0f - alpha:1.0f]; - } - return nil; -} - -- (UIViewController *)currentViewController -{ - return [_kernelUtilService currentViewController]; -} - -- (nullable NSDictionary *)launchOptions -{ - return [_kernelUtilService launchOptions]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.h deleted file mode 100644 index f9e1464cae139d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - NOTE: the imports are slightly changed by hand for expo versioning. - since cognito sdk does not change frequently, these changes are not included in `update-vendored-module` script. you should modify manually whenever upgrading the module. - changes we did: - - replace imports from double-quote "" to bracket <> for xcode to find the correct versioning headers and clang modules. - */ - -#import -#import -#import - -#import - -@interface ABI46_0_0RNAWSCognito : NSObject --(NSString*)getRandomBase64:(NSUInteger)byteLength; -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.m deleted file mode 100644 index 00316db1b15c6c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Cognito/ABI46_0_0RNAWSCognito.m +++ /dev/null @@ -1,59 +0,0 @@ -#import "ABI46_0_0RNAWSCognito.h" - -static NSString* N_IN_HEX = @"FFFFFFFFFFFFFFFFC90FDAA22168C234C4C6628B80DC1CD129024E088A67CC74020BBEA63B139B22514A08798E3404DDEF9519B3CD3A431B302B0A6DF25F14374FE1356D6D51C245E485B576625E7EC6F44C42E9A637ED6B0BFF5CB6F406B7EDEE386BFB5A899FA5AE9F24117C4B1FE649286651ECE45B3DC2007CB8A163BF0598DA48361C55D39A69163FA8FD24CF5F83655D23DCA3AD961C62F356208552BB9ED529077096966D670C354E4ABC9804F1746C08CA18217C32905E462E36CE3BE39E772C180E86039B2783A2EC07A28FB5C55DF06F4C52C9DE2BCBF6955817183995497CEA956AE515D2261898FA051015728E5A8AAAC42DAD33170D04507A33A85521ABDF1CBA64ECFB850458DBEF0A8AEA71575D060C7DB3970F85A6E1E4C7ABF5AE8CDB0933D71E8C94E04A25619DCEE3D2261AD2EE6BF12FFA06D98A0864D87602733EC86A64521F2B18177B200CBBE117577A615D6C770988C0BAD946E208E24FA074E5AB3143DB5BFCE0FD108E4B82D120A93AD2CAFFFFFFFFFFFFFFFF"; - -@implementation ABI46_0_0RNAWSCognito - -- (dispatch_queue_t)methodQueue { - return dispatch_get_main_queue(); -} -ABI46_0_0RCT_EXPORT_MODULE() - -ABI46_0_0RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString*, getRandomBase64:(NSUInteger)byteLength) { - NSMutableData *data = [NSMutableData dataWithLength:byteLength]; - int result = SecRandomCopyBytes(kSecRandomDefault, byteLength, data.mutableBytes); - if (result != errSecSuccess) { - @throw([NSException exceptionWithName:@"NO_RANDOM_BYTES" reason:@"Failed to acquire secure random bytes" userInfo:nil]); - } - return [data base64EncodedStringWithOptions:0]; -} - -ABI46_0_0RCT_EXPORT_METHOD(computeModPow:(NSDictionary *)values - callback:(ABI46_0_0RCTResponseSenderBlock)callback) { - JKBigInteger *target = [[JKBigInteger alloc] initWithString:values[@"target"] andRadix:16]; - JKBigInteger *value = [[JKBigInteger alloc] initWithString:values[@"value"] andRadix:16]; - JKBigInteger *modifier = [[JKBigInteger alloc] initWithString:values[@"modifier"] andRadix:16]; - JKBigInteger *result = [target pow:value andMod:modifier]; - if (result) { - callback(@[[NSNull null], [result stringValueWithRadix:16]]); - } else { - callback(@[@[ABI46_0_0RCTMakeError(@"computeModPow error", nil, nil)], [NSNull null]]); - } -} - -ABI46_0_0RCT_EXPORT_METHOD(computeS:(NSDictionary *)values - callback:(ABI46_0_0RCTResponseSenderBlock)callback) { - JKBigInteger *N = [[JKBigInteger alloc] initWithString:N_IN_HEX andRadix:16]; - JKBigInteger *g = [[JKBigInteger alloc] initWithString:values[@"g"] andRadix:16]; - JKBigInteger *x = [[JKBigInteger alloc] initWithString:values[@"x"] andRadix:16]; - JKBigInteger *k = [[JKBigInteger alloc] initWithString:values[@"k"] andRadix:16]; - JKBigInteger *a = [[JKBigInteger alloc] initWithString:values[@"a"] andRadix:16]; - JKBigInteger *b = [[JKBigInteger alloc] initWithString:values[@"b"] andRadix:16]; - JKBigInteger *u = [[JKBigInteger alloc] initWithString:values[@"u"] andRadix:16]; - JKBigInteger *exp = [a add:[u multiply:x]]; - JKBigInteger *base = [b subtract:[k multiply:[g pow:x andMod:N]]]; - base = [self mod:base divisor:N]; - JKBigInteger *result = [base pow:exp andMod:N]; - result = [self mod:result divisor:N]; - if (result) { - callback(@[[NSNull null], [result stringValueWithRadix:16]]); - } else { - callback(@[@[ABI46_0_0RCTMakeError(@"computeS error", nil, nil)], [NSNull null]]); - } -} - -- (JKBigInteger*) mod:(JKBigInteger*)dividend divisor:(JKBigInteger*) divisor { - return [[divisor add:[dividend remainder:divisor]] remainder:divisor]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.h deleted file mode 100644 index fd42001e800f7b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNDateTimePicker : UIDatePicker - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.m deleted file mode 100644 index 0f85d0dedcbf57..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePicker.m +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNDateTimePicker.h" - -#import -#import - -@interface ABI46_0_0RNDateTimePicker () - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChange; -@property (nonatomic, assign) NSInteger ABI46_0_0ReactMinuteInterval; - -@end - -@implementation ABI46_0_0RNDateTimePicker - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - [self addTarget:self action:@selector(didChange) - forControlEvents:UIControlEventValueChanged]; - _ABI46_0_0ReactMinuteInterval = 1; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)didChange -{ - if (_onChange) { - _onChange(@{ @"timestamp": @(self.date.timeIntervalSince1970 * 1000.0) }); - } -} - -- (void)setDatePickerMode:(UIDatePickerMode)datePickerMode -{ - [super setDatePickerMode:datePickerMode]; - // We need to set minuteInterval after setting datePickerMode, otherwise minuteInterval is invalid in time mode. - self.minuteInterval = _ABI46_0_0ReactMinuteInterval; -} - -- (void)setMinuteInterval:(NSInteger)minuteInterval -{ - [super setMinuteInterval:minuteInterval]; - _ABI46_0_0ReactMinuteInterval = minuteInterval; -} - -- (void)setDate:(NSDate *)date { - // Need to avoid the case where values coming back through the bridge trigger a new valueChanged event - if (![self.date isEqualToDate:date]) { - [super setDate:date animated:NO]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.h deleted file mode 100644 index 1cf521ad054665..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -@interface ABI46_0_0RCTConvert(UIDatePicker) - -+ (UIDatePickerMode)UIDatePickerMode:(id)json; - -@end - -@interface ABI46_0_0RNDateTimePickerManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.m deleted file mode 100644 index e6b8b226248d14..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/DateTimePicker/ABI46_0_0RNDateTimePickerManager.m +++ /dev/null @@ -1,177 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNDateTimePickerManager.h" - -#import -#import -#import "ABI46_0_0RNDateTimePicker.h" -#import - -#ifndef __IPHONE_15_0 -@interface UIColor (Xcode12) -+ (instancetype) tintColor; -@end -#endif - -@implementation ABI46_0_0RCTConvert(UIDatePicker) - -ABI46_0_0RCT_ENUM_CONVERTER(UIDatePickerMode, (@{ - @"time": @(UIDatePickerModeTime), - @"date": @(UIDatePickerModeDate), - @"datetime": @(UIDatePickerModeDateAndTime), -}), UIDatePickerModeTime, integerValue) - - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunguarded-availability-new" -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 - -typedef UIDatePickerStyle ABI46_0_0RNCUIDatePickerStyle; - -// using UIDatePickerStyle directly conflicts with ABI46_0_0RN implementation -ABI46_0_0RCT_ENUM_CONVERTER(ABI46_0_0RNCUIDatePickerStyle, (@{ - @"default": @(UIDatePickerStyleAutomatic), - @"compact": @(UIDatePickerStyleCompact), - @"spinner": @(UIDatePickerStyleWheels), - @"inline": @(UIDatePickerStyleInline), -}), UIDatePickerStyleAutomatic, integerValue) - - -ABI46_0_0RCT_ENUM_CONVERTER(UIUserInterfaceStyle, (@{ - @"dark": @(UIUserInterfaceStyleDark), - @"light": @(UIUserInterfaceStyleLight), -}), UIUserInterfaceStyleUnspecified, integerValue) - -#endif -#pragma clang diagnostic pop - - -@end - -@implementation ABI46_0_0RNDateTimePickerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ABI46_0_0RNDateTimePicker new]; -} - -+ (NSString*) datepickerStyleToString: (UIDatePickerStyle) style API_AVAILABLE(ios(13.4)){ - // ABI46_0_0RCTConvert does not handle this.? - switch (style) { - case UIDatePickerStyleCompact: - return @"compact"; - case UIDatePickerStyleWheels: - return @"spinner"; -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_14_0 - case UIDatePickerStyleInline: - return @"inline"; -#endif - default: - [NSException raise:@"Unsupported style value" format:@"UIDatePickerStyle of %ld is unsupported", (long)style]; - return @""; - } -} - -ABI46_0_0RCT_EXPORT_METHOD(getDefaultDisplayValue:(NSDictionary *)options resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - dispatch_async(dispatch_get_main_queue(), ^{ - if (@available(iOS 13.4, *)) { - UIDatePicker* view = [ABI46_0_0RNDateTimePicker new]; - - view.preferredDatePickerStyle = UIDatePickerStyleAutomatic; - UIDatePickerMode renderedMode = [ABI46_0_0RCTConvert UIDatePickerMode:options[@"mode"]]; - view.datePickerMode = renderedMode; - // NOTE afaict we do not need to measure the actual dimensions here, but if we do, just look at the original PR - - UIDatePickerStyle determinedDisplayValue = view.datePickerStyle; - - resolve(@{ - @"determinedDisplayValue": [ABI46_0_0RNDateTimePickerManager datepickerStyleToString:determinedDisplayValue], - }); - } else { - // never happens; the condition is just to avoid compiler warnings - reject(@"UNEXPECTED_CALL", @"unexpected getDefaultDisplayValue() call", nil); - } - }); -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(date, NSDate) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(locale, NSLocale) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumDate, NSDate) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumDate, NSDate) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minuteInterval, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(enabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChange, ABI46_0_0RCTBubblingEventBlock) - -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(mode, datePickerMode, UIDatePickerMode) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(timeZoneOffsetInMinutes, timeZone, NSTimeZone) - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(themeVariant, UIUserInterfaceStyle, ABI46_0_0RNDateTimePicker) { - if (@available(iOS 13.0, *)) { - if (json) { - UIUserInterfaceStyle propValue = [ABI46_0_0RCTConvert UIUserInterfaceStyle:json]; - view.overrideUserInterfaceStyle = propValue; - } else { - view.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified; - } - } -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(textColor, UIColor, ABI46_0_0RNDateTimePicker) -{ - if (@available(iOS 14.0, *)) { - if (view.datePickerStyle != UIDatePickerStyleWheels) { - // prevents #247 - return; - } - } - if (json) { - [view setValue:[ABI46_0_0RCTConvert UIColor:json] forKey:@"textColor"]; - [view setValue:@(NO) forKey:@"highlightsToday"]; - } else { - UIColor* defaultColor; - if (@available(iOS 13.0, *)) { - defaultColor = [UIColor labelColor]; - } else { - defaultColor = [UIColor blackColor]; - } - [view setValue:defaultColor forKey:@"textColor"]; - [view setValue:@(YES) forKey:@"highlightsToday"]; - } -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(accentColor, UIColor, ABI46_0_0RNDateTimePicker) -{ - if (json) { - [view setTintColor:[ABI46_0_0RCTConvert UIColor:json]]; - } else { - if (@available(iOS 15.0, *)) { - [view setTintColor:[UIColor tintColor]]; - } else { - [view setTintColor:[UIColor systemBlueColor]]; - } - } -} - -// TODO vonovak setting preferredDatePickerStyle invalidates minuteinterval -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(displayIOS, ABI46_0_0RNCUIDatePickerStyle, ABI46_0_0RNDateTimePicker) -{ - // officially since 13.4 (https://developer.apple.com/documentation/uikit/uidatepickerstyle?language=objc) but practically since 14 - if (@available(iOS 14.0, *)) { - if (json) { - UIDatePickerStyle propValue = [ABI46_0_0RCTConvert ABI46_0_0RNCUIDatePickerStyle:json]; - view.preferredDatePickerStyle = propValue; - } else { - view.preferredDatePickerStyle = UIDatePickerStyleAutomatic; - } - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.h deleted file mode 100644 index d8bacf57c7fab4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ABI46_0_0AIRDummyView.h -// AirMapsExplorer -// -// Created by Gil Birman on 10/4/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - - -@interface ABI46_0_0AIRDummyView : UIView -@property (nonatomic, weak) UIView *view; -- (instancetype)initWithView:(UIView*)view; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.m deleted file mode 100644 index f645bcd9ceaec6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRDummyView.m +++ /dev/null @@ -1,23 +0,0 @@ -// -// ABI46_0_0AIRDummyView.m -// AirMapsExplorer -// -// Created by Gil Birman on 10/4/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import "ABI46_0_0AIRDummyView.h" - -@implementation ABI46_0_0AIRDummyView -- (instancetype)initWithView:(UIView*)view -{ - if ((self = [super init])) { - self.view = view; - } - return self; -} -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.h deleted file mode 100644 index 3ded5cbcd08e0b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// ABI46_0_0AIRGMSMarker.h -// AirMaps -// -// Created by Gil Birman on 9/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@class ABI46_0_0AIRGoogleMapMarker; - -@interface ABI46_0_0AIRGMSMarker : GMSMarker -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, weak) ABI46_0_0AIRGoogleMapMarker *fakeMarker; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@end - - -@protocol ABI46_0_0AIRGMSMarkerDelegate -@required --(void)didTapMarker; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.m deleted file mode 100644 index 67fea828f740f5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSMarker.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// ABI46_0_0AIRGMSMarker.m -// AirMaps -// -// Created by Gil Birman on 9/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGMSMarker.h" - -@implementation ABI46_0_0AIRGMSMarker - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.h deleted file mode 100644 index e3e99362c172b3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ABI46_0_0AIRGMSPolygon.h -// AirMaps -// -// Created by Gerardo Pacheco 02/05/2017. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@class ABI46_0_0AIRGoogleMapPolygon; - -@interface ABI46_0_0AIRGMSPolygon : GMSPolygon -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.m deleted file mode 100644 index d19c03ec8f9b4e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolygon.m +++ /dev/null @@ -1,16 +0,0 @@ -// -// ABI46_0_0AIRGMSPolygon.m -// AirMaps -// -// Created by Gerardo Pacheco 02/05/2017. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGMSPolygon.h" - -@implementation ABI46_0_0AIRGMSPolygon - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.h deleted file mode 100644 index dca6e4293993a4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.h +++ /dev/null @@ -1,20 +0,0 @@ -// -// ABI46_0_0AIRGMSPolyline.h -// AirMaps -// -// Created by Guilherme Pontes 04/05/2017. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@class ABI46_0_0AIRGoogleMapPolyline; - -@interface ABI46_0_0AIRGMSPolyline : GMSPolyline -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.m deleted file mode 100644 index 4d400a4174a97b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGMSPolyline.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRGMSPolyline.m -// AirMaps -// -// Created by Guilherme Pontes 04/05/2017. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGMSPolyline.h" - -@implementation ABI46_0_0AIRGMSPolyline -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.h deleted file mode 100644 index 29b8cd615cf5ac..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.h +++ /dev/null @@ -1,85 +0,0 @@ -// -// ABI46_0_0AIRGoogleMap.h -// AirMaps -// -// Created by Gil Birman on 9/1/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRGMSMarker.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - -@interface ABI46_0_0AIRGoogleMap : GMSMapView - -// TODO: don't use MK region? -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; -@property (nonatomic, assign) MKCoordinateRegion initialRegion; -@property (nonatomic, assign) MKCoordinateRegion region; -@property (nonatomic, assign) GMSCameraPosition *cameraProp; // Because the base class already has a "camera" prop. -@property (nonatomic, assign) GMSCameraPosition *initialCamera; -@property (nonatomic, assign) NSString *customMapStyleString; -@property (nonatomic, assign) UIEdgeInsets mapPadding; -@property (nonatomic, assign) NSString *paddingAdjustmentBehaviorString; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onMapReady; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onMapLoaded; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onKmlReady; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onLongPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPanDrag; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onUserLocationChange; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onMarkerPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChange; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPoiClick; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onRegionChange; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onRegionChangeComplete; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onIndoorLevelActivated; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onIndoorBuildingFocused; -@property (nonatomic, strong) NSMutableArray *markers; -@property (nonatomic, strong) NSMutableArray *polygons; -@property (nonatomic, strong) NSMutableArray *polylines; -@property (nonatomic, strong) NSMutableArray *circles; -@property (nonatomic, strong) NSMutableArray *heatmaps; -@property (nonatomic, strong) NSMutableArray *tiles; -@property (nonatomic, strong) NSMutableArray *overlays; - -@property (nonatomic, assign) BOOL showsBuildings; -@property (nonatomic, assign) BOOL showsTraffic; -@property (nonatomic, assign) BOOL showsCompass; -@property (nonatomic, assign) BOOL scrollEnabled; -@property (nonatomic, assign) BOOL zoomEnabled; -@property (nonatomic, assign) BOOL rotateEnabled; -@property (nonatomic, assign) BOOL scrollDuringRotateOrZoomEnabled; -@property (nonatomic, assign) BOOL pitchEnabled; -@property (nonatomic, assign) BOOL zoomTapEnabled; -@property (nonatomic, assign) BOOL showsUserLocation; -@property (nonatomic, assign) BOOL showsMyLocationButton; -@property (nonatomic, assign) BOOL showsIndoors; -@property (nonatomic, assign) BOOL showsIndoorLevelPicker; -@property (nonatomic, assign) NSString *kmlSrc; - -- (void)didPrepareMap; -- (void)mapViewDidFinishTileRendering; -- (BOOL)didTapMarker:(GMSMarker *)marker; -- (void)didTapPolyline:(GMSPolyline *)polyline; -- (void)didTapPolygon:(GMSPolygon *)polygon; -- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate; -- (void)didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate; -- (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture; -- (void)idleAtCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture; -- (void)didTapPOIWithPlaceID:(NSString *)placeID name:(NSString *) name location:(CLLocationCoordinate2D) location; -- (NSArray *)getMapBoundaries; - -+ (MKCoordinateRegion)makeGMSCameraPositionFromMap:(GMSMapView *)map andGMSCameraPosition:(GMSCameraPosition *)position; -+ (GMSCameraPosition*)makeGMSCameraPositionFromMap:(GMSMapView *)map andMKCoordinateRegion:(MKCoordinateRegion)region; - -- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.m deleted file mode 100644 index df698634a02906..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMap.m +++ /dev/null @@ -1,952 +0,0 @@ -// -// ABI46_0_0AIRGoogleMap.m -// AirMaps -// -// Created by Gil Birman on 9/1/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMap.h" -#import "ABI46_0_0AIRGoogleMapMarker.h" -#import "ABI46_0_0AIRGoogleMapMarkerManager.h" -#import "ABI46_0_0AIRGoogleMapPolygon.h" -#import "ABI46_0_0AIRGoogleMapPolyline.h" -#import "ABI46_0_0AIRGoogleMapCircle.h" -#import "ABI46_0_0AIRGoogleMapHeatmap.h" -#import "ABI46_0_0AIRGoogleMapUrlTile.h" -#import "ABI46_0_0AIRGoogleMapWMSTile.h" -#import "ABI46_0_0AIRGoogleMapOverlay.h" -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" -#import - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS_UTILS -#import -#import -#import -#import -#define REQUIRES_GOOGLE_MAPS_UTILS(feature) do {} while (0) -#else -#define GMUKMLParser void -#define GMUPlacemark void -#define REQUIRES_GOOGLE_MAPS_UTILS(feature) do { \ - [NSException raise:@"ABI46_0_0ReactNativeMapsDependencyMissing" \ - format:@"Use of " feature "requires Google-Maps-iOS-Utils, you must install via CocoaPods to use this feature"]; \ -} while (0) -#endif - - -id regionAsJSON(MKCoordinateRegion region) { - return @{ - @"latitude": [NSNumber numberWithDouble:region.center.latitude], - @"longitude": [NSNumber numberWithDouble:region.center.longitude], - @"latitudeDelta": [NSNumber numberWithDouble:region.span.latitudeDelta], - @"longitudeDelta": [NSNumber numberWithDouble:region.span.longitudeDelta], - }; -} - -@interface ABI46_0_0AIRGoogleMap () - -- (id)eventFromCoordinate:(CLLocationCoordinate2D)coordinate; - -@property (nonatomic, strong) NSMutableDictionary *origGestureRecognizersMeta; - -@end - -@implementation ABI46_0_0AIRGoogleMap -{ - NSMutableArray *_ABI46_0_0ReactSubviews; - MKCoordinateRegion _initialRegion; - MKCoordinateRegion _region; - BOOL _initialCameraSetOnLoad; - BOOL _didCallOnMapReady; - BOOL _didMoveToWindow; - BOOL _zoomTapEnabled; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - _markers = [NSMutableArray array]; - _polygons = [NSMutableArray array]; - _polylines = [NSMutableArray array]; - _circles = [NSMutableArray array]; - _heatmaps = [NSMutableArray array]; - _tiles = [NSMutableArray array]; - _overlays = [NSMutableArray array]; - _initialCamera = nil; - _cameraProp = nil; - _initialRegion = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.0, 0.0)); - _region = MKCoordinateRegionMake(CLLocationCoordinate2DMake(0.0, 0.0), MKCoordinateSpanMake(0.0, 0.0)); - _initialCameraSetOnLoad = false; - _didCallOnMapReady = false; - _didMoveToWindow = false; - _zoomTapEnabled = YES; - - // Listen to the myLocation property of GMSMapView. - [self addObserver:self - forKeyPath:@"myLocation" - options:NSKeyValueObservingOptionNew - context:NULL]; - - self.origGestureRecognizersMeta = [[NSMutableDictionary alloc] init]; - - self.indoorDisplay.delegate = self; - } - return self; -} - -- (void)dealloc { - [self removeObserver:self - forKeyPath:@"myLocation" - context:NULL]; -} - -- (id)eventFromCoordinate:(CLLocationCoordinate2D)coordinate { - - CGPoint touchPoint = [self.projection pointForCoordinate:coordinate]; - - return @{ - @"coordinate": @{ - @"latitude": @(coordinate.latitude), - @"longitude": @(coordinate.longitude), - }, - @"position": @{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }, - }; -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (void)insertABI46_0_0ReactSubview:(id)subview atIndex:(NSInteger)atIndex { - // Our desired API is to pass up markers/overlays as children to the mapview component. - // This is where we intercept them and do the appropriate underlying mapview action. - if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0AIRGoogleMapMarker *marker = (ABI46_0_0AIRGoogleMapMarker*)subview; - marker.realMarker.map = self; - [self.markers addObject:marker]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapPolygon class]]) { - ABI46_0_0AIRGoogleMapPolygon *polygon = (ABI46_0_0AIRGoogleMapPolygon*)subview; - polygon.polygon.map = self; - [self.polygons addObject:polygon]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapPolyline class]]) { - ABI46_0_0AIRGoogleMapPolyline *polyline = (ABI46_0_0AIRGoogleMapPolyline*)subview; - polyline.polyline.map = self; - [self.polylines addObject:polyline]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapCircle class]]) { - ABI46_0_0AIRGoogleMapCircle *circle = (ABI46_0_0AIRGoogleMapCircle*)subview; - circle.circle.map = self; - [self.circles addObject:circle]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapUrlTile class]]) { - ABI46_0_0AIRGoogleMapUrlTile *tile = (ABI46_0_0AIRGoogleMapUrlTile*)subview; - tile.tileLayer.map = self; - [self.tiles addObject:tile]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapWMSTile class]]) { - ABI46_0_0AIRGoogleMapWMSTile *tile = (ABI46_0_0AIRGoogleMapWMSTile*)subview; - tile.tileLayer.map = self; - [self.tiles addObject:tile]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapOverlay class]]) { - ABI46_0_0AIRGoogleMapOverlay *overlay = (ABI46_0_0AIRGoogleMapOverlay*)subview; - overlay.overlay.map = self; - [self.overlays addObject:overlay]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapHeatmap class]]){ - ABI46_0_0AIRGoogleMapHeatmap *heatmap = (ABI46_0_0AIRGoogleMapHeatmap*)subview; - heatmap.heatmap.map = self; - [self.heatmaps addObject:heatmap]; - } else { - NSArray> *childSubviews = [subview ABI46_0_0ReactSubviews]; - for (int i = 0; i < childSubviews.count; i++) { - [self insertABI46_0_0ReactSubview:(UIView *)childSubviews[i] atIndex:atIndex]; - } - } - [_ABI46_0_0ReactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex]; -} -#pragma clang diagnostic pop - - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (void)removeABI46_0_0ReactSubview:(id)subview { - // similarly, when the children are being removed we have to do the appropriate - // underlying mapview action here. - if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0AIRGoogleMapMarker *marker = (ABI46_0_0AIRGoogleMapMarker*)subview; - marker.realMarker.map = nil; - [self.markers removeObject:marker]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapPolygon class]]) { - ABI46_0_0AIRGoogleMapPolygon *polygon = (ABI46_0_0AIRGoogleMapPolygon*)subview; - polygon.polygon.map = nil; - [self.polygons removeObject:polygon]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapPolyline class]]) { - ABI46_0_0AIRGoogleMapPolyline *polyline = (ABI46_0_0AIRGoogleMapPolyline*)subview; - polyline.polyline.map = nil; - [self.polylines removeObject:polyline]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapCircle class]]) { - ABI46_0_0AIRGoogleMapCircle *circle = (ABI46_0_0AIRGoogleMapCircle*)subview; - circle.circle.map = nil; - [self.circles removeObject:circle]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapUrlTile class]]) { - ABI46_0_0AIRGoogleMapUrlTile *tile = (ABI46_0_0AIRGoogleMapUrlTile*)subview; - tile.tileLayer.map = nil; - [self.tiles removeObject:tile]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapWMSTile class]]) { - ABI46_0_0AIRGoogleMapWMSTile *tile = (ABI46_0_0AIRGoogleMapWMSTile*)subview; - tile.tileLayer.map = nil; - [self.tiles removeObject:tile]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapOverlay class]]) { - ABI46_0_0AIRGoogleMapOverlay *overlay = (ABI46_0_0AIRGoogleMapOverlay*)subview; - overlay.overlay.map = nil; - [self.overlays removeObject:overlay]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapHeatmap class]]){ - ABI46_0_0AIRGoogleMapHeatmap *heatmap = (ABI46_0_0AIRGoogleMapHeatmap*)subview; - heatmap.heatmap.map = nil; - [self.heatmaps removeObject:heatmap]; - } else { - NSArray> *childSubviews = [subview ABI46_0_0ReactSubviews]; - for (int i = 0; i < childSubviews.count; i++) { - [self removeABI46_0_0ReactSubview:(UIView *)childSubviews[i]]; - } - } - [_ABI46_0_0ReactSubviews removeObject:(UIView *)subview]; -} -#pragma clang diagnostic pop - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (NSArray> *)ABI46_0_0ReactSubviews { - return _ABI46_0_0ReactSubviews; -} -#pragma clang diagnostic pop - -- (NSArray *)getMapBoundaries -{ - GMSVisibleRegion visibleRegion = self.projection.visibleRegion; - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion:visibleRegion]; - - CLLocationCoordinate2D northEast = bounds.northEast; - CLLocationCoordinate2D southWest = bounds.southWest; - - return @[ - @[ - [NSNumber numberWithDouble:northEast.longitude], - [NSNumber numberWithDouble:northEast.latitude] - ], - @[ - [NSNumber numberWithDouble:southWest.longitude], - [NSNumber numberWithDouble:southWest.latitude] - ] - ]; -} - -- (void)didMoveToWindow { - if (_didMoveToWindow) return; - _didMoveToWindow = true; - - if (_initialCamera != nil) { - self.camera = _initialCamera; - } - else if (_initialRegion.span.latitudeDelta != 0.0 && - _initialRegion.span.longitudeDelta != 0.0) { - self.camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_initialRegion]; - } else if (_region.span.latitudeDelta != 0.0 && - _region.span.longitudeDelta != 0.0) { - self.camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:_region]; - } - - [super didMoveToWindow]; -} - -- (void)setInitialRegion:(MKCoordinateRegion)initialRegion { - if (_initialCameraSetOnLoad) return; - _initialRegion = initialRegion; - _initialCameraSetOnLoad = _didMoveToWindow; - self.camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:initialRegion]; -} - -- (void)setInitialCamera:(GMSCameraPosition*)initialCamera { - if (_initialCameraSetOnLoad) return; - _initialCamera = initialCamera; - _initialCameraSetOnLoad = _didMoveToWindow; - self.camera = initialCamera; -} - -- (void)setRegion:(MKCoordinateRegion)region { - // TODO: The JS component is repeatedly setting region unnecessarily. We might want to deal with that in here. - _region = region; - self.camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andMKCoordinateRegion:region]; -} - -- (void)setCameraProp:(GMSCameraPosition*)camera { - _initialCamera = camera; - self.camera = camera; -} - - -- (void)didPrepareMap { - UIView* mapView = [self valueForKey:@"mapView"]; //GMSVectorMapView - [self overrideGestureRecognizersForView:mapView]; - - if (_didCallOnMapReady) return; - _didCallOnMapReady = true; - if (self.onMapReady) self.onMapReady(@{}); -} - -- (void)mapViewDidFinishTileRendering { - if (self.onMapLoaded) self.onMapLoaded(@{}); -} - -- (BOOL)didTapMarker:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *airMarker = (ABI46_0_0AIRGMSMarker *)marker; - - id event = @{@"action": @"marker-press", - @"id": airMarker.identifier ?: @"unknown", - @"coordinate": @{ - @"latitude": @(airMarker.position.latitude), - @"longitude": @(airMarker.position.longitude) - } - }; - - if (airMarker.onPress) airMarker.onPress(event); - if (self.onMarkerPress) self.onMarkerPress(event); - - // TODO: not sure why this is necessary - [self setSelectedMarker:marker]; - return NO; -} - -- (void)didTapPolyline:(GMSOverlay *)polyline { - ABI46_0_0AIRGMSPolyline *airPolyline = (ABI46_0_0AIRGMSPolyline *)polyline; - - id event = @{@"action": @"polyline-press", - @"id": airPolyline.identifier ?: @"unknown", - }; - - if (airPolyline.onPress) airPolyline.onPress(event); -} - -- (void)didTapPolygon:(GMSOverlay *)polygon { - ABI46_0_0AIRGMSPolygon *airPolygon = (ABI46_0_0AIRGMSPolygon *)polygon; - - id event = @{@"action": @"polygon-press", - @"id": airPolygon.identifier ?: @"unknown", - }; - - if (airPolygon.onPress) airPolygon.onPress(event); -} - -- (void)didTapAtCoordinate:(CLLocationCoordinate2D)coordinate { - if (!self.onPress) return; - self.onPress([self eventFromCoordinate:coordinate]); -} - -- (void)didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate { - if (!self.onLongPress) return; - self.onLongPress([self eventFromCoordinate:coordinate]); -} - -- (void)didChangeCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture{ - id event = @{@"continuous": @YES, - @"region": regionAsJSON([ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]), - @"isGesture": [NSNumber numberWithBool:isGesture], - }; - - if (self.onChange) self.onChange(event); -} - -- (void)didTapPOIWithPlaceID:(NSString *)placeID - name:(NSString *)name - location:(CLLocationCoordinate2D)location { - id event = @{@"placeId": placeID, - @"name": name, - @"coordinate": @{ - @"latitude": @(location.latitude), - @"longitude": @(location.longitude) - } - }; - - if (self.onPoiClick) self.onPoiClick(event); -} - -- (void)idleAtCameraPosition:(GMSCameraPosition *)position isGesture:(BOOL)isGesture{ - id event = @{@"continuous": @NO, - @"region": regionAsJSON([ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:self andGMSCameraPosition:position]), - @"isGesture": [NSNumber numberWithBool:isGesture], - }; - if (self.onChange) self.onChange(event); // complete -} - -- (void)setMapPadding:(UIEdgeInsets)mapPadding { - self.padding = mapPadding; -} - -- (UIEdgeInsets)mapPadding { - return self.padding; -} - -- (void)setPaddingAdjustmentBehaviorString:(NSString *)str -{ - if ([str isEqualToString:@"never"]) - { - self.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorNever; - } - else if ([str isEqualToString:@"automatic"]) - { - self.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorAutomatic; - } - else //if ([str isEqualToString:@"always"]) <-- default - { - self.paddingAdjustmentBehavior = kGMSMapViewPaddingAdjustmentBehaviorAlways; - } -} - -- (NSString *)paddingAdjustmentBehaviorString -{ - switch (self.paddingAdjustmentBehavior) - { - case kGMSMapViewPaddingAdjustmentBehaviorNever: - return @"never"; - case kGMSMapViewPaddingAdjustmentBehaviorAutomatic: - return @"automatic"; - case kGMSMapViewPaddingAdjustmentBehaviorAlways: - return @"always"; - - default: - return @"unknown"; - } -} - -- (void)setScrollEnabled:(BOOL)scrollEnabled { - self.settings.scrollGestures = scrollEnabled; -} - -- (BOOL)scrollEnabled { - return self.settings.scrollGestures; -} - -- (void)setZoomEnabled:(BOOL)zoomEnabled { - self.settings.zoomGestures = zoomEnabled; -} - -- (BOOL)zoomEnabled { - return self.settings.zoomGestures; -} - -- (void)setScrollDuringRotateOrZoomEnabled:(BOOL)enableScrollGesturesDuringRotateOrZoom { - self.settings.allowScrollGesturesDuringRotateOrZoom = enableScrollGesturesDuringRotateOrZoom; -} - -- (BOOL)scrollDuringRotateOrZoomEnabled { - return self.settings.allowScrollGesturesDuringRotateOrZoom; -} - -- (void)setZoomTapEnabled:(BOOL)zoomTapEnabled { - _zoomTapEnabled = zoomTapEnabled; -} - -- (BOOL)zoomTapEnabled { - return _zoomTapEnabled; -} - -- (void)setRotateEnabled:(BOOL)rotateEnabled { - self.settings.rotateGestures = rotateEnabled; -} - -- (BOOL)rotateEnabled { - return self.settings.rotateGestures; -} - -- (void)setPitchEnabled:(BOOL)pitchEnabled { - self.settings.tiltGestures = pitchEnabled; -} - -- (BOOL)pitchEnabled { - return self.settings.tiltGestures; -} - -- (void)setShowsTraffic:(BOOL)showsTraffic { - self.trafficEnabled = showsTraffic; -} - -- (BOOL)showsTraffic { - return self.trafficEnabled; -} - -- (void)setShowsBuildings:(BOOL)showsBuildings { - self.buildingsEnabled = showsBuildings; -} - -- (BOOL)showsBuildings { - return self.buildingsEnabled; -} - -- (void)setShowsCompass:(BOOL)showsCompass { - self.settings.compassButton = showsCompass; -} - -- (void)setCustomMapStyleString:(NSString *)customMapStyleString { - NSError *error; - - GMSMapStyle *style = [GMSMapStyle styleWithJSONString:customMapStyleString error:&error]; - - if (!style) { - NSLog(@"The style definition could not be loaded: %@", error); - } - - self.mapStyle = style; -} - -- (BOOL)showsCompass { - return self.settings.compassButton; -} - -- (void)setShowsUserLocation:(BOOL)showsUserLocation { - self.myLocationEnabled = showsUserLocation; -} - -- (BOOL)showsUserLocation { - return self.myLocationEnabled; -} - -- (void)setShowsMyLocationButton:(BOOL)showsMyLocationButton { - self.settings.myLocationButton = showsMyLocationButton; -} - -- (BOOL)showsMyLocationButton { - return self.settings.myLocationButton; -} - -- (void)setMinZoomLevel:(CGFloat)minZoomLevel { - [self setMinZoom:minZoomLevel maxZoom:self.maxZoom ]; -} - -- (void)setMaxZoomLevel:(CGFloat)maxZoomLevel { - [self setMinZoom:self.minZoom maxZoom:maxZoomLevel ]; -} - -- (void)setShowsIndoors:(BOOL)showsIndoors { - self.indoorEnabled = showsIndoors; -} - -- (BOOL)showsIndoors { - return self.indoorEnabled; -} - -- (void)setShowsIndoorLevelPicker:(BOOL)showsIndoorLevelPicker { - self.settings.indoorPicker = showsIndoorLevelPicker; -} - -- (BOOL)showsIndoorLevelPicker { - return self.settings.indoorPicker; -} - -+ (MKCoordinateRegion) makeGMSCameraPositionFromMap:(GMSMapView *)map andGMSCameraPosition:(GMSCameraPosition *)position { - // solution from here: http://stackoverflow.com/a/16587735/1102215 - GMSVisibleRegion visibleRegion = map.projection.visibleRegion; - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithRegion: visibleRegion]; - CLLocationCoordinate2D center; - CLLocationDegrees longitudeDelta; - CLLocationDegrees latitudeDelta = bounds.northEast.latitude - bounds.southWest.latitude; - - if(bounds.northEast.longitude >= bounds.southWest.longitude) { - //Standard case - center = CLLocationCoordinate2DMake((bounds.southWest.latitude + bounds.northEast.latitude) / 2, - (bounds.southWest.longitude + bounds.northEast.longitude) / 2); - longitudeDelta = bounds.northEast.longitude - bounds.southWest.longitude; - } else { - //Region spans the international dateline - center = CLLocationCoordinate2DMake((bounds.southWest.latitude + bounds.northEast.latitude) / 2, - (bounds.southWest.longitude + bounds.northEast.longitude + 360) / 2); - longitudeDelta = bounds.northEast.longitude + 360 - bounds.southWest.longitude; - } - MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta); - return MKCoordinateRegionMake(center, span); -} - -+ (GMSCameraPosition*) makeGMSCameraPositionFromMap:(GMSMapView *)map andMKCoordinateRegion:(MKCoordinateRegion)region { - float latitudeDelta = region.span.latitudeDelta * 0.5; - float longitudeDelta = region.span.longitudeDelta * 0.5; - - CLLocationCoordinate2D a = CLLocationCoordinate2DMake(region.center.latitude + latitudeDelta, - region.center.longitude + longitudeDelta); - CLLocationCoordinate2D b = CLLocationCoordinate2DMake(region.center.latitude - latitudeDelta, - region.center.longitude - longitudeDelta); - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:a coordinate:b]; - return [map cameraForBounds:bounds insets:UIEdgeInsetsZero]; -} - -#pragma mark - Utils - -- (CGRect) frameForMarker:(ABI46_0_0AIRGoogleMapMarker*) mrkView { - CGPoint mrkAnchor = mrkView.realMarker.groundAnchor; - CGPoint mrkPoint = [self.projection pointForCoordinate:mrkView.coordinate]; - CGSize mrkSize = mrkView.realMarker.iconView ? mrkView.realMarker.iconView.bounds.size : CGSizeMake(20, 30); - CGRect mrkFrame = CGRectMake(mrkPoint.x, mrkPoint.y, mrkSize.width, mrkSize.height); - mrkFrame.origin.y -= mrkAnchor.y * mrkSize.height; - mrkFrame.origin.x -= mrkAnchor.x * mrkSize.width; - return mrkFrame; -} - -- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible { - NSMutableDictionary* markersFrames = [NSMutableDictionary new]; - for (ABI46_0_0AIRGoogleMapMarker* mrkView in self.markers) { - CGRect frame = [self frameForMarker:mrkView]; - CGPoint point = [self.projection pointForCoordinate:mrkView.coordinate]; - NSDictionary* frameDict = @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height) - }; - NSDictionary* pointDict = @{ - @"x": @(point.x), - @"y": @(point.y) - }; - NSString* k = mrkView.identifier; - BOOL isVisible = CGRectIntersectsRect(self.bounds, frame); - if (k != nil && (!onlyVisible || isVisible)) { - [markersFrames setObject:@{ @"frame": frameDict, @"point": pointDict } forKey:k]; - } - } - return markersFrames; -} - -- (ABI46_0_0AIRGoogleMapMarker*) markerAtPoint:(CGPoint)point { - ABI46_0_0AIRGoogleMapMarker* mrk = nil; - for (ABI46_0_0AIRGoogleMapMarker* mrkView in self.markers) { - CGRect frame = [self frameForMarker:mrkView]; - if (CGRectContainsPoint(frame, point)) { - mrk = mrkView; - break; - } - } - return mrk; -} - --(SEL)getActionForTarget:(NSObject*)target { - SEL action = nil; - uint32_t ivarCount; - Ivar *ivars = class_copyIvarList([target class], &ivarCount); - if (ivars) { - for (uint32_t i = 0 ; i < ivarCount ; i++) { - Ivar ivar = ivars[i]; - const char* type = ivar_getTypeEncoding(ivar); - const char* ivarName = ivar_getName(ivar); - NSString* name = [NSString stringWithCString: ivarName encoding: NSASCIIStringEncoding]; - if (type[0] == ':' && [name isEqualToString:@"_action"]) { - SEL sel = ((SEL (*)(id, Ivar))object_getIvar)(target, ivar); - action = sel; - break; - } - } - } - free(ivars); - return action; -} - -#pragma mark - Overrides for Callout behavior - --(void)overrideGestureRecognizersForView:(UIView*)view { - NSArray* grs = view.gestureRecognizers; - for (UIGestureRecognizer* gestureRecognizer in grs) { - NSNumber* grHash = [NSNumber numberWithUnsignedInteger:gestureRecognizer.hash]; - if([self.origGestureRecognizersMeta objectForKey:grHash] != nil) - continue; //already patched - - //get original handlers - NSArray* origTargets = [gestureRecognizer valueForKey:@"targets"]; - NSMutableArray* origTargetsActions = [[NSMutableArray alloc] init]; - BOOL isZoomTapGesture = NO; - for (NSObject* trg in origTargets) { - NSObject* target = [trg valueForKey:@"target"]; - SEL action = [self getActionForTarget:trg]; - isZoomTapGesture = [NSStringFromSelector(action) isEqualToString:@"handleZoomTapGesture:"]; - [origTargetsActions addObject:@{ - @"target": [NSValue valueWithNonretainedObject:target], - @"action": NSStringFromSelector(action) - }]; - } - if (isZoomTapGesture && self.zoomTapEnabled == NO) { - [view removeGestureRecognizer:gestureRecognizer]; - continue; - } - - //replace with extendedMapGestureHandler - for (NSDictionary* origTargetAction in origTargetsActions) { - NSValue* targetValue = [origTargetAction objectForKey:@"target"]; - NSObject* target = [targetValue nonretainedObjectValue]; - NSString* actionString = [origTargetAction objectForKey:@"action"]; - SEL action = NSSelectorFromString(actionString); - [gestureRecognizer removeTarget:target action:action]; - } - [gestureRecognizer addTarget:self action:@selector(extendedMapGestureHandler:)]; - - [self.origGestureRecognizersMeta setObject:@{@"targets": origTargetsActions} - forKey:grHash]; - } -} - -- (id)extendedMapGestureHandler:(UIGestureRecognizer*)gestureRecognizer { - NSNumber* grHash = [NSNumber numberWithUnsignedInteger:gestureRecognizer.hash]; - UIWindow* win = [[[UIApplication sharedApplication] windows] firstObject]; - NSObject* bubbleProvider = [self valueForKey:@"bubbleProvider"]; //GMSbubbleEntityProvider - CGRect bubbleAbsoluteFrame = [bubbleProvider accessibilityFrame]; - CGRect bubbleFrame = [win convertRect:bubbleAbsoluteFrame toView:self]; - UIView* bubbleView = [bubbleProvider valueForKey:@"view"]; - - BOOL performOriginalActions = YES; - BOOL isTap = [gestureRecognizer isKindOfClass:[UITapGestureRecognizer class]] || [gestureRecognizer isMemberOfClass:[UITapGestureRecognizer class]]; - if (isTap) { - BOOL isTapInsideBubble = NO; - CGPoint tapPoint = CGPointZero; - CGPoint tapPointInBubble = CGPointZero; - - NSArray* touches = [gestureRecognizer valueForKey:@"touches"]; - UITouch* oneTouch = [touches firstObject]; - NSArray* delayedTouches = [gestureRecognizer valueForKey:@"delayedTouches"]; - NSObject* delayedTouch = [delayedTouches firstObject]; //UIGestureDeleayedTouch - UITouch* tapTouch = [delayedTouch valueForKey:@"stateWhenDelayed"]; - if (!tapTouch) - tapTouch = oneTouch; - tapPoint = [tapTouch locationInView:self]; - isTapInsideBubble = tapTouch != nil && CGRectContainsPoint(bubbleFrame, tapPoint); - if (isTapInsideBubble) { - tapPointInBubble = CGPointMake(tapPoint.x - bubbleFrame.origin.x, tapPoint.y - bubbleFrame.origin.y); - } - if (isTapInsideBubble) { - //find bubble's marker - ABI46_0_0AIRGoogleMapMarker* markerView = nil; - ABI46_0_0AIRGMSMarker* marker = nil; - for (ABI46_0_0AIRGoogleMapMarker* mrk in self.markers) { - if ([mrk.calloutView isEqual:bubbleView]) { - markerView = mrk; - marker = markerView.realMarker; - break; - } - } - - //find real tap target subview - UIView* realSubview = [(ABI46_0_0RCTView*)bubbleView hitTest:tapPointInBubble withEvent:nil]; - ABI46_0_0AIRGoogleMapCalloutSubview* realPressableSubview = nil; - if (realSubview) { - UIView* tmp = realSubview; - while (tmp && tmp != win && tmp != bubbleView) { - if ([tmp respondsToSelector:@selector(onPress)]) { - realPressableSubview = (ABI46_0_0AIRGoogleMapCalloutSubview*) tmp; - break; - } - tmp = tmp.superview; - } - } - - if (markerView) { - BOOL isInsideCallout = [markerView.calloutView isPointInside:tapPointInBubble]; - if (isInsideCallout) { - [markerView didTapInfoWindowOfMarker:marker subview:realPressableSubview point:tapPointInBubble frame:bubbleFrame]; - } else { - ABI46_0_0AIRGoogleMapMarker* markerAtTapPoint = [self markerAtPoint:tapPoint]; - if (markerAtTapPoint != nil) { - [self didTapMarker:markerAtTapPoint.realMarker]; - } else { - CLLocationCoordinate2D coord = [self.projection coordinateForPoint:tapPoint]; - [markerView hideCalloutView]; - [self didTapAtCoordinate:coord]; - } - } - - performOriginalActions = NO; - } - } - } - - if (performOriginalActions) { - NSDictionary* origMeta = [self.origGestureRecognizersMeta objectForKey:grHash]; - NSDictionary* origTargets = [origMeta objectForKey:@"targets"]; - for (NSDictionary* origTarget in origTargets) { - NSValue* targetValue = [origTarget objectForKey:@"target"]; - NSObject* target = [targetValue nonretainedObjectValue]; - NSString* actionString = [origTarget objectForKey:@"action"]; - SEL action = NSSelectorFromString(actionString); -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - [target performSelector:action withObject:gestureRecognizer]; -#pragma clang diagnostic pop - } - } - - return nil; -} - - -#pragma mark - KVO updates - -- (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change - context:(void *)context { - if ([keyPath isEqualToString:@"myLocation"]){ - CLLocation *location = [object myLocation]; - - id event = @{@"coordinate": @{ - @"latitude": @(location.coordinate.latitude), - @"longitude": @(location.coordinate.longitude), - @"altitude": @(location.altitude), - @"timestamp": @(location.timestamp.timeIntervalSinceReferenceDate * 1000), - @"accuracy": @(location.horizontalAccuracy), - @"altitudeAccuracy": @(location.verticalAccuracy), - @"speed": @(location.speed), - @"heading": @(location.course), - } - }; - - if (self.onUserLocationChange) self.onUserLocationChange(event); - } else { - // This message is not for me; pass it on to super. - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - -+ (NSString *)GetIconUrl:(GMUPlacemark *) marker parser:(GMUKMLParser *) parser { -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS_UTILS - if (marker.style.styleID != nil) { - for (GMUStyle *style in parser.styles) { - if (style.styleID == marker.style.styleID) { - return style.iconUrl; - } - } - } - - return marker.style.iconUrl; -#else - REQUIRES_GOOGLE_MAPS_UTILS("GetIconUrl:parser:"); return @""; -#endif -} - -- (NSString *)KmlSrc { - return _kmlSrc; -} - -- (void)setKmlSrc:(NSString *)kmlUrl { -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS_UTILS - - _kmlSrc = kmlUrl; - - NSURL *url = [NSURL URLWithString:kmlUrl]; - NSData *urlData = nil; - - if ([url isFileURL]) { - urlData = [NSData dataWithContentsOfURL:url]; - } else { - urlData = [[NSFileManager defaultManager] contentsAtPath:kmlUrl]; - } - - GMUKMLParser *parser = [[GMUKMLParser alloc] initWithData:urlData]; - [parser parse]; - - NSUInteger index = 0; - NSMutableArray *markers = [[NSMutableArray alloc]init]; - - for (GMUPlacemark *place in parser.placemarks) { - - CLLocationCoordinate2D location =((GMUPoint *) place.geometry).coordinate; - - ABI46_0_0AIRGoogleMapMarker *marker = (ABI46_0_0AIRGoogleMapMarker *)[[ABI46_0_0AIRGoogleMapMarkerManager alloc] view]; - if (!marker.bridge) { - marker.bridge = _bridge; - } - marker.identifier = place.title; - marker.coordinate = location; - marker.title = place.title; - marker.subtitle = place.snippet; - marker.pinColor = place.style.fillColor; - marker.imageSrc = [ABI46_0_0AIRGoogleMap GetIconUrl:place parser:parser]; - marker.layer.backgroundColor = [UIColor clearColor].CGColor; - marker.layer.position = CGPointZero; - - [self insertABI46_0_0ReactSubview:(UIView *) marker atIndex:index]; - - [markers addObject:@{@"id": marker.identifier, - @"title": marker.title, - @"description": marker.subtitle, - @"coordinate": @{ - @"latitude": @(location.latitude), - @"longitude": @(location.longitude) - } - }]; - - index++; - } - - id event = @{@"markers": markers}; - if (self.onKmlReady) self.onKmlReady(event); -#else - REQUIRES_GOOGLE_MAPS_UTILS(); -#endif -} - - -- (void) didChangeActiveBuilding: (nullable GMSIndoorBuilding *) building { - if (!building) { - if (!self.onIndoorBuildingFocused) { - return; - } - self.onIndoorBuildingFocused(@{ - @"IndoorBuilding": @{ - @"activeLevelIndex": @0, - @"underground": @false, - @"levels": [[NSMutableArray alloc]init] - } - }); - } - NSInteger i = 0; - NSMutableArray *arrayLevels = [[NSMutableArray alloc]init]; - for (GMSIndoorLevel *level in building.levels) { - [arrayLevels addObject: @{ - @"index": @(i), - @"name" : level.name, - @"shortName" : level.shortName, - }]; - i++; - } - if (!self.onIndoorBuildingFocused) { - return; - } - self.onIndoorBuildingFocused(@{ - @"IndoorBuilding": @{ - @"activeLevelIndex": @(building.defaultLevelIndex), - @"underground": @(building.underground), - @"levels": arrayLevels - } - }); -} - -- (void) didChangeActiveLevel: (nullable GMSIndoorLevel *) level { - if (!self.onIndoorLevelActivated || !self.indoorDisplay || !level) { - return; - } - NSInteger i = 0; - for (GMSIndoorLevel *buildingLevel in self.indoorDisplay.activeBuilding.levels) { - if (buildingLevel.name == level.name && buildingLevel.shortName == level.shortName) { - break; - } - i++; - } - self.onIndoorLevelActivated(@{ - @"IndoorLevel": @{ - @"activeLevelIndex": @(i), - @"name": level.name, - @"shortName": level.shortName - } - }); -} - - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.h deleted file mode 100644 index 8316c641ae9d2d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.h +++ /dev/null @@ -1,23 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCallout.h -// AirMaps -// -// Created by Gil Birman on 9/6/16. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0AIRGoogleMapCallout : UIView -@property (nonatomic, assign) BOOL tooltip; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, assign) BOOL alphaHitTest; - -- (BOOL) isPointInside:(CGPoint)pointInCallout; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.m deleted file mode 100644 index 755435147fa03a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCallout.m +++ /dev/null @@ -1,39 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCallout.m -// AirMaps -// -// Created by Gil Birman on 9/6/16. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapCallout.h" -#import -#import -#import - -@implementation ABI46_0_0AIRGoogleMapCallout - -- (BOOL) isPointInside:(CGPoint)pointInCallout { - if (!self.alphaHitTest) - return TRUE; - CGFloat alpha = [self alphaOfPoint:pointInCallout]; - return alpha >= 0.01; -} - -- (CGFloat) alphaOfPoint:(CGPoint)point { - unsigned char pixel[4] = {0}; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast); - CGContextTranslateCTM(context, -point.x, -point.y); - [self.layer renderInContext:context]; - CGContextRelease(context); - CGColorSpaceRelease(colorSpace); - return pixel[3]/255.0; -} - - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.h deleted file mode 100644 index 149d546d41f11f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutManager.h -// AirMaps -// -// Created by Gil Birman on 9/6/16. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapCalloutManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.m deleted file mode 100644 index 4bc5546b54d08e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutManager.m +++ /dev/null @@ -1,30 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutManager.m -// AirMaps -// -// Created by Gil Birman on 9/6/16. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapCalloutManager.h" -#import "ABI46_0_0AIRGoogleMapCallout.h" -#import - -@implementation ABI46_0_0AIRGoogleMapCalloutManager -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapCallout *callout = [ABI46_0_0AIRGoogleMapCallout new]; - return callout; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tooltip, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(alphaHitTest, BOOL) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.h deleted file mode 100644 index 70f3ce3e77b59c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutSubview.h -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0AIRGoogleMapCalloutSubview : UIView -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.m deleted file mode 100644 index d9463f5e6cb4c5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubview.m +++ /dev/null @@ -1,19 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutSubview.m -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapCalloutSubview.h" -#import -#import -#import - -@implementation ABI46_0_0AIRGoogleMapCalloutSubview -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.h deleted file mode 100644 index ac6dc668a46b7a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutSubviewManager.h -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapCalloutSubviewManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.m deleted file mode 100644 index 4338ab8a534349..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCalloutSubviewManager.m +++ /dev/null @@ -1,28 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCalloutSubviewManager.m -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapCalloutSubviewManager.h" -#import "ABI46_0_0AIRGoogleMapCalloutSubview.h" -#import - -@implementation ABI46_0_0AIRGoogleMapCalloutSubviewManager -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapCalloutSubview *calloutSubview = [ABI46_0_0AIRGoogleMapCalloutSubview new]; - return calloutSubview; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.h deleted file mode 100644 index c823d39324dd40..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.h +++ /dev/null @@ -1,24 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapsCircle.h -// -// Created by Nick Italiano on 10/24/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import "ABI46_0_0AIRMapCoordinate.h" - -@interface ABI46_0_0AIRGoogleMapCircle : UIView - -@property (nonatomic, strong) GMSCircle *circle; -@property (nonatomic, assign) double radius; -@property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate; -@property (nonatomic, assign) UIColor *strokeColor; -@property (nonatomic, assign) double strokeWidth; -@property (nonatomic, assign) UIColor *fillColor; -@property (nonatomic, assign) int zIndex; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.m deleted file mode 100644 index 01bf2535c57ddf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircle.m +++ /dev/null @@ -1,61 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapsCircle.m -// -// Created by Nick Italiano on 10/24/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS -#import -#import "ABI46_0_0AIRGoogleMapCircle.h" -#import -#import - -@implementation ABI46_0_0AIRGoogleMapCircle - -- (instancetype)init -{ - if (self = [super init]) { - _circle = [[GMSCircle alloc] init]; - } - return self; -} - -- (void)setRadius:(double)radius -{ - _radius = radius; - _circle.radius = radius; -} - -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate -{ - _centerCoordinate = centerCoordinate; - _circle.position = centerCoordinate; -} - --(void)setStrokeColor:(UIColor *)strokeColor -{ - _strokeColor = strokeColor; - _circle.strokeColor = strokeColor; -} - --(void)setStrokeWidth:(double)strokeWidth -{ - _strokeWidth = strokeWidth; - _circle.strokeWidth = strokeWidth; -} - --(void)setFillColor:(UIColor *)fillColor -{ - _fillColor = fillColor; - _circle.fillColor = fillColor; -} - --(void)setZIndex:(int)zIndex -{ - _zIndex = zIndex; - _circle.zIndex = zIndex; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.h deleted file mode 100644 index 4266980491bf77..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCircleManager.h -// -// Created by Nick Italiano on 10/24/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapCircleManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.m deleted file mode 100644 index 626fd82fce681a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapCircleManager.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapCircleManager.m -// -// Created by Nick Italiano on 10/24/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapCircleManager.h" -#import "ABI46_0_0AIRGoogleMapCircle.h" -#import -#import - -@interface ABI46_0_0AIRGoogleMapCircleManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapCircleManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapCircle *circle = [ABI46_0_0AIRGoogleMapCircle new]; - return circle; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(radius, double) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(center, centerCoordinate, CLLocationCoordinate2D) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, double) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, int) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.h deleted file mode 100644 index 50c8eda22b6367..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapHeatmap.h -// -// Created by David Cako on 29 April 2018. -// - -#import - -@interface ABI46_0_0AIRGoogleMapHeatmap : UIView - -@property (nonatomic, strong) GMUHeatmapTileLayer *heatmap; -@property (nonatomic, strong) NSMutableArray *points; -@property (nonatomic, assign) NSUInteger radius; -@property (nonatomic, assign) float opacity; -@property (nonatomic, assign) GMUGradient *gradient; - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.m deleted file mode 100644 index 92c9b65f7c28e3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmap.m +++ /dev/null @@ -1,64 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapHeatmap.m -// -// Created by David Cako on 29 April 2018. -// -#import -#import "ABI46_0_0AIRGoogleMapHeatmap.h" -#import -#import -#import - -@implementation ABI46_0_0AIRGoogleMapHeatmap - -- (instancetype)init -{ - if (self = [super init]) { - _heatmap = [[GMUHeatmapTileLayer alloc] init]; - } - return self; -} - -- (void)setPoints:(NSArray *)points -{ - NSMutableArray *w = [NSMutableArray arrayWithCapacity:points.count]; - for (int i = 0; i < points.count; i++) { - CLLocationCoordinate2D coord = [ABI46_0_0RCTConvert CLLocationCoordinate2D:points[i]]; - float intensity = 1.0; - if (points[i][@"weight"] != nil) { - intensity = [ABI46_0_0RCTConvert float:points[i][@"weight"]]; - } - [w addObject:[[GMUWeightedLatLng alloc] initWithCoordinate:coord intensity:intensity]]; - } - _points = w; - [self.heatmap setWeightedData:w]; - [self.heatmap clearTileCache]; - [self.heatmap setMap:self.heatmap.map]; -} - -- (void)setRadius:(NSUInteger)radius -{ - _radius = radius; - [self.heatmap setRadius:radius]; -} - -- (void)setOpacity:(float)opacity -{ - _opacity = opacity; - [self.heatmap setOpacity:opacity]; -} - -- (void)setGradient:(NSDictionary *)gradient -{ - NSArray *colors = [ABI46_0_0RCTConvert UIColorArray:gradient[@"colors"]]; - NSArray *colorStartPoints = [ABI46_0_0RCTConvert NSNumberArray:gradient[@"startPoints"]]; - NSUInteger colorMapSize = [ABI46_0_0RCTConvert NSUInteger:gradient[@"colorMapSize"]]; - - GMUGradient *gmuGradient = [[GMUGradient alloc] initWithColors:colors - startPoints:colorStartPoints - colorMapSize:colorMapSize]; - _gradient = gmuGradient; - [self.heatmap setGradient:gmuGradient]; -} - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.h deleted file mode 100644 index eb4fc2fdbb29fb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.h +++ /dev/null @@ -1,11 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapHeatmapManager.h -// -// Created by David Cako on 29 April 2018. -// - -#import - -@interface ABI46_0_0AIRGoogleMapHeatmapManager : ABI46_0_0RCTViewManager - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.m deleted file mode 100644 index 5047af9d7b9590..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapHeatmapManager.m +++ /dev/null @@ -1,32 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapHeatmapManager.m -// -// Created by David Cako on 29 April 2018. -// - -#import "ABI46_0_0AIRGoogleMapHeatmapManager.h" -#import "ABI46_0_0AIRGoogleMapHeatmap.h" -#import "ABI46_0_0AIRGoogleMap.h" -#import -#import - -@interface ABI46_0_0AIRGoogleMapHeatmapManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapHeatmapManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapHeatmap *heatmap = [ABI46_0_0AIRGoogleMapHeatmap new]; - return heatmap; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(points, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(radius, NSUInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, float) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradient, NSDictionary *) - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.h deleted file mode 100644 index 06e23e915d4568..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapManager.h -// AirMaps -// -// Created by Gil Birman on 9/1/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapManager : ABI46_0_0RCTViewManager -@property (nonatomic) BOOL isGesture; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.m deleted file mode 100644 index c26f8bd46ed52b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapManager.m +++ /dev/null @@ -1,690 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapManager.m -// AirMaps -// -// Created by Gil Birman on 9/1/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - - -#import "ABI46_0_0AIRGoogleMapManager.h" -#import -#import -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+GMSMapViewType.h" -#import "ABI46_0_0AIRGoogleMap.h" -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapPolyline.h" -#import "ABI46_0_0AIRMapPolygon.h" -#import "ABI46_0_0AIRMapCircle.h" -#import "ABI46_0_0SMCalloutView.h" -#import "ABI46_0_0AIRGoogleMapMarker.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - -#import -#import - -static NSString *const ABI46_0_0RCTMapViewKey = @"MapView"; - - -@interface ABI46_0_0AIRGoogleMapManager() -{ - BOOL didCallOnMapReady; -} -@end - -@implementation ABI46_0_0AIRGoogleMapManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMap *map = [ABI46_0_0AIRGoogleMap new]; - map.bridge = self.bridge; - map.delegate = self; - map.isAccessibilityElement = NO; - map.accessibilityElementsHidden = NO; - map.settings.consumesGesturesInView = NO; - - UIPanGestureRecognizer *drag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDrag:)]; - [drag setMinimumNumberOfTouches:1]; - [drag setMaximumNumberOfTouches:1]; - [map addGestureRecognizer:drag]; - - UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDrag:)]; - [map addGestureRecognizer:pinch]; - - return map; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(initialCamera, GMSCameraPosition) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, GMSCameraPosition) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(initialRegion, MKCoordinateRegion) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(region, MKCoordinateRegion) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL) -//ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL) // Not supported by GoogleMaps -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(scrollDuringRotateOrZoomEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zoomTapEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsIndoors, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsIndoorLevelPicker, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(customMapStyleString, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(paddingAdjustmentBehavior, paddingAdjustmentBehaviorString, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMapReady, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onKmlReady, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLongPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPanDrag, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onRegionChange, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPoiClick, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mapType, GMSMapViewType) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString) - -ABI46_0_0RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view], NULL); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - resolve(@{ - @"center": @{ - @"latitude": @(mapView.camera.target.latitude), - @"longitude": @(mapView.camera.target.longitude), - }, - @"pitch": @(mapView.camera.viewingAngle), - @"heading": @(mapView.camera.bearing), - @"zoom": @(mapView.camera.zoom), - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - camera:(id)json) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - GMSCameraPosition *camera = [ABI46_0_0RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView camera]]; - [mapView setCamera:camera]; - } - }]; -} - - -ABI46_0_0RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - withCamera:(id)json - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - GMSCameraPosition *camera = [ABI46_0_0RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView camera]]; - [mapView animateToCameraPosition:camera]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToNavigation:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(MKCoordinateRegion)region - withBearing:(CGFloat)bearing - withAngle:(double)angle - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - GMSCameraPosition *camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:mapView andMKCoordinateRegion:region]; - [mapView animateToCameraPosition:camera]; - [mapView animateToViewingAngle:angle]; - [mapView animateToBearing:bearing]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToRegion:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(MKCoordinateRegion)region - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - // Core Animation must be used to control the animation's duration - // See http://stackoverflow.com/a/15663039/171744 - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - GMSCameraPosition *camera = [ABI46_0_0AIRGoogleMap makeGMSCameraPositionFromMap:mapView andMKCoordinateRegion:region]; - [mapView animateToCameraPosition:camera]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToCoordinate:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(CLLocationCoordinate2D)latlng - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - [(ABI46_0_0AIRGoogleMap *)view animateToLocation:latlng]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToViewingAngle:(nonnull NSNumber *)ABI46_0_0ReactTag - withAngle:(double)angle - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - [mapView animateToViewingAngle:angle]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToBearing:(nonnull NSNumber *)ABI46_0_0ReactTag - withBearing:(CGFloat)bearing - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - [CATransaction begin]; - [CATransaction setAnimationDuration:duration/1000]; - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - [mapView animateToBearing:bearing]; - [CATransaction commit]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)ABI46_0_0ReactTag - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - CLLocationCoordinate2D myLocation = ((ABI46_0_0AIRGoogleMapMarker *)(mapView.markers.firstObject)).realMarker.position; - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation]; - - for (ABI46_0_0AIRGoogleMapMarker *marker in mapView.markers) - bounds = [bounds includingCoordinate:marker.realMarker.position]; - - GMSCameraUpdate* cameraUpdate; - - if ([edgePadding count] != 0) { - // Set Map viewport - CGFloat top = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"top"]]; - CGFloat right = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"right"]]; - CGFloat bottom = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"bottom"]]; - CGFloat left = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"left"]]; - - cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)]; - } else { - cameraUpdate = [GMSCameraUpdate fitBounds:bounds withPadding:55.0f]; - } - if (animated) { - [mapView animateWithCameraUpdate: cameraUpdate]; - } else { - [mapView moveCamera: cameraUpdate]; - } - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToSuppliedMarkers:(nonnull NSNumber *)ABI46_0_0ReactTag - markers:(nonnull NSArray *)markers - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { - ABI46_0_0AIRGoogleMapMarker *marker = (ABI46_0_0AIRGoogleMapMarker *)evaluatedObject; - return [marker isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]] && [markers containsObject:marker.identifier]; - }]; - - NSArray *filteredMarkers = [mapView.markers filteredArrayUsingPredicate:filterMarkers]; - - CLLocationCoordinate2D myLocation = ((ABI46_0_0AIRGoogleMapMarker *)(filteredMarkers.firstObject)).realMarker.position; - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation]; - - for (ABI46_0_0AIRGoogleMapMarker *marker in filteredMarkers) - bounds = [bounds includingCoordinate:marker.realMarker.position]; - - // Set Map viewport - CGFloat top = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"top"]]; - CGFloat right = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"right"]]; - CGFloat bottom = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"bottom"]]; - CGFloat left = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"left"]]; - - GMSCameraUpdate* cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)]; - if (animated) { - [mapView animateWithCameraUpdate:cameraUpdate - ]; - } else { - [mapView moveCamera: cameraUpdate]; - } - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)ABI46_0_0ReactTag - coordinates:(nonnull NSArray *)coordinates - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - CLLocationCoordinate2D myLocation = coordinates.firstObject.coordinate; - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:myLocation coordinate:myLocation]; - - for (ABI46_0_0AIRMapCoordinate *coordinate in coordinates) - bounds = [bounds includingCoordinate:coordinate.coordinate]; - - // Set Map viewport - CGFloat top = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"top"]]; - CGFloat right = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"right"]]; - CGFloat bottom = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"bottom"]]; - CGFloat left = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"left"]]; - - GMSCameraUpdate *cameraUpdate = [GMSCameraUpdate fitBounds:bounds withEdgeInsets:UIEdgeInsetsMake(top, left, bottom, right)]; - - if (animated) { - [mapView animateWithCameraUpdate: cameraUpdate]; - } else { - [mapView moveCamera: cameraUpdate]; - } - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)ABI46_0_0ReactTag - withWidth:(nonnull NSNumber *)width - withHeight:(nonnull NSNumber *)height - withRegion:(MKCoordinateRegion)region - format:(nonnull NSString *)format - quality:(nonnull NSNumber *)quality - result:(nonnull NSString *)result - withCallback:(ABI46_0_0RCTResponseSenderBlock)callback) -{ - NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; - NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format]; - NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent: pathComponent]; - - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - // TODO: currently we are ignoring width, height, region - - UIGraphicsBeginImageContextWithOptions(mapView.frame.size, YES, 0.0f); - [mapView.layer renderInContext:UIGraphicsGetCurrentContext()]; - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - - NSData *data; - if ([format isEqualToString:@"png"]) { - data = UIImagePNGRepresentation(image); - - } - else if([format isEqualToString:@"jpg"]) { - data = UIImageJPEGRepresentation(image, quality.floatValue); - } - - if ([result isEqualToString:@"file"]) { - [data writeToFile:filePath atomically:YES]; - callback(@[[NSNull null], filePath]); - } - else if ([result isEqualToString:@"base64"]) { - callback(@[[NSNull null], [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn]]); - } - else if ([result isEqualToString:@"legacy"]) { - - // In the initial (iOS only) implementation of takeSnapshot, - // both the uri and the base64 encoded string were returned. - // Returning both is rarely useful and in fact causes a - // performance penalty when only the file URI is desired. - // In that case the base64 encoded string was always marshalled - // over the JS-bridge (which is quite slow). - // A new more flexible API was created to cover this. - // This code should be removed in a future release when the - // old API is fully deprecated. - [data writeToFile:filePath atomically:YES]; - NSDictionary *snapshotData = @{ - @"uri": filePath, - @"data": [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn] - }; - callback(@[[NSNull null], snapshotData]); - } - - } - UIGraphicsEndImageContext(); - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)ABI46_0_0ReactTag - coordinate:(NSDictionary *)coordinate - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - CLLocationCoordinate2D coord = - CLLocationCoordinate2DMake( - [coordinate[@"latitude"] doubleValue], - [coordinate[@"longitude"] doubleValue] - ); - - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - CGPoint touchPoint = [mapView.projection pointForCoordinate:coord]; - - resolve(@{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)ABI46_0_0ReactTag - point:(NSDictionary *)point - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - CGPoint pt = CGPointMake( - [point[@"x"] doubleValue], - [point[@"y"] doubleValue] - ); - - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:pt]; - - resolve(@{ - @"latitude": @(coordinate.latitude), - @"longitude": @(coordinate.longitude), - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getMarkersFrames:(nonnull NSNumber *)ABI46_0_0ReactTag - onlyVisible:(BOOL)onlyVisible - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - resolve([mapView getMarkersFramesWithOnlyVisible:onlyVisible]); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)ABI46_0_0ReactTag - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - NSArray *boundingBox = [view getMapBoundaries]; - - resolve(@{ - @"northEast" : @{ - @"longitude" : boundingBox[0][0], - @"latitude" : boundingBox[0][1] - }, - @"southWest" : @{ - @"longitude" : boundingBox[1][0], - @"latitude" : boundingBox[1][1] - } - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setMapBoundaries:(nonnull NSNumber *)ABI46_0_0ReactTag - northEast:(CLLocationCoordinate2D)northEast - southWest:(CLLocationCoordinate2D)southWest) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - - GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest]; - - mapView.cameraTargetBounds = bounds; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(setIndoorActiveLevelIndex:(nonnull NSNumber *)ABI46_0_0ReactTag - levelIndex:(NSInteger) levelIndex) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRGoogleMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMap *mapView = (ABI46_0_0AIRGoogleMap *)view; - if (!mapView.indoorDisplay) { - return; - } - if ( levelIndex < [mapView.indoorDisplay.activeBuilding.levels count]) { - mapView.indoorDisplay.activeLevel = mapView.indoorDisplay.activeBuilding.levels[levelIndex]; - } - } - }]; - } - -+ (BOOL)requiresMainQueueSetup { - return YES; -} - -- (NSDictionary *)constantsToExport { - return @{ @"legalNotice": [GMSServices openSourceLicenseInfo] }; -} - -- (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture{ - self.isGesture = gesture; -} - -- (void)mapViewDidStartTileRendering:(GMSMapView *)mapView { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didPrepareMap]; -} - -- (void)mapViewDidFinishTileRendering:(GMSMapView *)mapView { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView mapViewDidFinishTileRendering]; -} - -- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - return [googleMapView didTapMarker:marker]; -} - -- (void)mapView:(GMSMapView *)mapView didTapOverlay:(GMSPolygon *)polygon { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didTapPolygon:polygon]; -} - -- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didTapAtCoordinate:coordinate]; -} - -- (void)mapView:(GMSMapView *)mapView didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didLongPressAtCoordinate:coordinate]; -} - -- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didChangeCameraPosition:position isGesture:self.isGesture]; -} - -- (void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView idleAtCameraPosition:position isGesture:self.isGesture]; -} - -- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - return [aMarker.fakeMarker markerInfoWindow];} - -- (UIView *)mapView:(GMSMapView *)mapView markerInfoContents:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - return [aMarker.fakeMarker markerInfoContents]; -} - -- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - [aMarker.fakeMarker didTapInfoWindowOfMarker:aMarker]; -} - -- (void)mapView:(GMSMapView *)mapView didBeginDraggingMarker:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - [aMarker.fakeMarker didBeginDraggingMarker:aMarker]; -} - -- (void)mapView:(GMSMapView *)mapView didEndDraggingMarker:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - [aMarker.fakeMarker didEndDraggingMarker:aMarker]; -} - -- (void)mapView:(GMSMapView *)mapView didDragMarker:(GMSMarker *)marker { - ABI46_0_0AIRGMSMarker *aMarker = (ABI46_0_0AIRGMSMarker *)marker; - [aMarker.fakeMarker didDragMarker:aMarker]; -} - -- (void)mapView:(GMSMapView *)mapView - didTapPOIWithPlaceID:(NSString *)placeID - name:(NSString *)name - location:(CLLocationCoordinate2D)location { - ABI46_0_0AIRGoogleMap *googleMapView = (ABI46_0_0AIRGoogleMap *)mapView; - [googleMapView didTapPOIWithPlaceID:placeID name:name location:location]; -} - -#pragma mark Gesture Recognizer Handlers - -- (void)handleMapDrag:(UIPanGestureRecognizer*)recognizer { - ABI46_0_0AIRGoogleMap *map = (ABI46_0_0AIRGoogleMap *)recognizer.view; - if (!map.onPanDrag) return; - - CGPoint touchPoint = [recognizer locationInView:map]; - CLLocationCoordinate2D coord = [map.projection coordinateForPoint:touchPoint]; - map.onPanDrag(@{ - @"coordinate": @{ - @"latitude": @(coord.latitude), - @"longitude": @(coord.longitude), - }, - @"position": @{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }, - }); - -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.h deleted file mode 100644 index 2cdeaa23841802..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.h +++ /dev/null @@ -1,56 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapMarker.h -// AirMaps -// -// Created by Gil Birman on 9/2/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import -#import "ABI46_0_0AIRGMSMarker.h" -#import "ABI46_0_0AIRGoogleMap.h" -#import "ABI46_0_0AIRGoogleMapCallout.h" -#import "ABI46_0_0AIRGoogleMapCalloutSubview.h" - -@interface ABI46_0_0AIRGoogleMapMarker : UIView - -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; -@property (nonatomic, strong) ABI46_0_0AIRGoogleMapCallout *calloutView; -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, assign) CLLocationCoordinate2D coordinate; -@property (nonatomic, assign) CLLocationDegrees rotation; -@property (nonatomic, strong) ABI46_0_0AIRGMSMarker* realMarker; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDragStart; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDrag; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDragEnd; -@property (nonatomic, copy) NSString *imageSrc; -@property (nonatomic, copy) NSString *iconSrc; -@property (nonatomic, copy) NSString *title; -@property (nonatomic, copy) NSString *subtitle; -@property (nonatomic, strong) UIColor *pinColor; -@property (nonatomic, assign) CGPoint anchor; -@property (nonatomic, assign) CGPoint calloutAnchor; -@property (nonatomic, assign) NSInteger zIndex; -@property (nonatomic, assign) double opacity; -@property (nonatomic, assign) BOOL draggable; -@property (nonatomic, assign) BOOL tappable; -@property (nonatomic, assign) BOOL tracksViewChanges; -@property (nonatomic, assign) BOOL tracksInfoWindowChanges; - -- (void)showCalloutView; -- (void)hideCalloutView; -- (void)redraw; -- (UIView *)markerInfoContents; -- (UIView *)markerInfoWindow; -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker; -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker point:(CGPoint)point frame:(CGRect)frame; -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker subview:(ABI46_0_0AIRGoogleMapCalloutSubview*)subview point:(CGPoint)point frame:(CGRect)frame; -- (void)didBeginDraggingMarker:(ABI46_0_0AIRGMSMarker *)marker; -- (void)didEndDraggingMarker:(ABI46_0_0AIRGMSMarker *)marker; -- (void)didDragMarker:(ABI46_0_0AIRGMSMarker *)marker; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.m deleted file mode 100644 index 7f840c9e20d8de..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarker.m +++ /dev/null @@ -1,428 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapMarker.m -// AirMaps -// -// Created by Gil Birman on 9/2/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapMarker.h" -#import -#import -#import -#import "ABI46_0_0AIRGMSMarker.h" -#import "ABI46_0_0AIRGoogleMapCallout.h" -#import "ABI46_0_0AIRDummyView.h" - -CGRect unionRect(CGRect a, CGRect b) { - return CGRectMake( - MIN(a.origin.x, b.origin.x), - MIN(a.origin.y, b.origin.y), - MAX(a.size.width, b.size.width), - MAX(a.size.height, b.size.height)); -} - -@interface ABI46_0_0AIRGoogleMapMarker () -- (id)eventFromMarker:(ABI46_0_0AIRGMSMarker*)marker; -@end - -@implementation ABI46_0_0AIRGoogleMapMarker { - ABI46_0_0RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; - __weak UIImageView *_iconImageView; - UIView *_iconView; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _realMarker = [[ABI46_0_0AIRGMSMarker alloc] init]; - _realMarker.fakeMarker = self; - _realMarker.tracksViewChanges = true; - _realMarker.tracksInfoWindowChanges = false; - } - return self; -} - -- (void)layoutSubviews { - float width = 0; - float height = 0; - - for (UIView *v in [_iconView subviews]) { - - float fw = v.frame.origin.x + v.frame.size.width; - float fh = v.frame.origin.y + v.frame.size.height; - - width = MAX(fw, width); - height = MAX(fh, height); - } - - [_iconView setFrame:CGRectMake(0, 0, width, height)]; -} - -- (id)eventFromMarker:(ABI46_0_0AIRGMSMarker*)marker { - - CLLocationCoordinate2D coordinate = marker.position; - CGPoint position = [self.realMarker.map.projection pointForCoordinate:coordinate]; - - return @{ - @"id": marker.identifier ?: @"unknown", - @"position": @{ - @"x": @(position.x), - @"y": @(position.y), - }, - @"coordinate": @{ - @"latitude": @(coordinate.latitude), - @"longitude": @(coordinate.longitude), - } - }; -} - -- (void)iconViewInsertSubview:(UIView*)subview atIndex:(NSInteger)atIndex { - if (!_realMarker.iconView) { - _iconView = [[UIView alloc] init]; - _realMarker.iconView = _iconView; - } - [_iconView insertSubview:subview atIndex:atIndex]; -} - -- (void)insertABI46_0_0ReactSubview:(id)subview atIndex:(NSInteger)atIndex { - if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapCallout class]]) { - self.calloutView = (ABI46_0_0AIRGoogleMapCallout *)subview; - } else { // a child view of the marker - [self iconViewInsertSubview:(UIView*)subview atIndex:atIndex+1]; - } - ABI46_0_0AIRDummyView *dummySubview = [[ABI46_0_0AIRDummyView alloc] initWithView:(UIView *)subview]; - [super insertABI46_0_0ReactSubview:(UIView*)dummySubview atIndex:atIndex]; -} - -- (void)removeABI46_0_0ReactSubview:(id)dummySubview { - UIView* subview = ((ABI46_0_0AIRDummyView*)dummySubview).view; - - if ([subview isKindOfClass:[ABI46_0_0AIRGoogleMapCallout class]]) { - self.calloutView = nil; - } else { - [(UIView*)subview removeFromSuperview]; - } - [super removeABI46_0_0ReactSubview:(UIView*)dummySubview]; -} - -- (void)showCalloutView { - [_realMarker.map setSelectedMarker:_realMarker]; -} - -- (void)hideCalloutView { - [_realMarker.map setSelectedMarker:Nil]; -} - -- (void)redraw { - if (!_realMarker.iconView) return; - - BOOL oldValue = _realMarker.tracksViewChanges; - - if (oldValue == YES) - { - // Immediate refresh, like right now. Not waiting for next frame. - UIView *view = _realMarker.iconView; - _realMarker.iconView = nil; - _realMarker.iconView = view; - } - else - { - // Refresh according to docs - _realMarker.tracksViewChanges = YES; - _realMarker.tracksViewChanges = NO; - } -} - -- (UIView *)markerInfoContents { - if (self.calloutView && !self.calloutView.tooltip) { - return self.calloutView; - } - return nil; -} - -- (UIView *)markerInfoWindow { - if (self.calloutView && self.calloutView.tooltip) { - return self.calloutView; - } - return nil; -} - -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker point:(CGPoint)point frame:(CGRect)frame { - if (self.calloutView && self.calloutView.onPress) { - //todo: why not 'callout-press' ? - id event = @{ - @"action": @"marker-overlay-press", - @"id": self.identifier ?: @"unknown", - @"point": @{ - @"x": @(point.x), - @"y": @(point.y), - }, - @"frame": @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height), - } - }; - self.calloutView.onPress(event); - } -} - -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker { - [self didTapInfoWindowOfMarker:marker point:CGPointMake(-1, -1) frame:CGRectZero]; -} - -- (void)didTapInfoWindowOfMarker:(ABI46_0_0AIRGMSMarker *)marker subview:(ABI46_0_0AIRGoogleMapCalloutSubview*)subview point:(CGPoint)point frame:(CGRect)frame { - if (subview && subview.onPress) { - //todo: why not 'callout-inside-press' ? - id event = @{ - @"action": @"marker-inside-overlay-press", - @"id": self.identifier ?: @"unknown", - @"point": @{ - @"x": @(point.x), - @"y": @(point.y), - }, - @"frame": @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height), - } - }; - subview.onPress(event); - } else { - [self didTapInfoWindowOfMarker:marker point:point frame:frame]; - } -} - -- (void)didBeginDraggingMarker:(ABI46_0_0AIRGMSMarker *)marker { - if (!self.onDragStart) return; - self.onDragStart([self eventFromMarker:marker]); -} - -- (void)didEndDraggingMarker:(ABI46_0_0AIRGMSMarker *)marker { - if (!self.onDragEnd) return; - self.onDragEnd([self eventFromMarker:marker]); -} - -- (void)didDragMarker:(ABI46_0_0AIRGMSMarker *)marker { - if (!self.onDrag) return; - self.onDrag([self eventFromMarker:marker]); -} - -- (void)setCoordinate:(CLLocationCoordinate2D)coordinate { - _realMarker.position = coordinate; -} - -- (CLLocationCoordinate2D)coordinate { - return _realMarker.position; -} - -- (void)setRotation:(CLLocationDegrees)rotation { - _realMarker.rotation = rotation; -} - -- (CLLocationDegrees)rotation { - return _realMarker.rotation; -} - -- (void)setIdentifier:(NSString *)identifier { - _realMarker.identifier = identifier; -} - -- (NSString *)identifier { - return _realMarker.identifier; -} - -- (void)setOnPress:(ABI46_0_0RCTBubblingEventBlock)onPress { - _realMarker.onPress = onPress; -} - -- (ABI46_0_0RCTBubblingEventBlock)onPress { - return _realMarker.onPress; -} - -- (void)setOpacity:(double)opacity -{ - _realMarker.opacity = opacity; -} - -- (void)setImageSrc:(NSString *)imageSrc -{ - _imageSrc = imageSrc; - - if (_reloadImageCancellationBlock) { - _reloadImageCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - - if (!_imageSrc) { - if (_iconImageView) [_iconImageView removeFromSuperview]; - return; - } - - if (!_iconImageView) { - // prevent glitch with marker (cf. https://github.com/ABI46_0_0React-native-maps/ABI46_0_0React-native-maps/issues/738) - UIImageView *empyImageView = [[UIImageView alloc] init]; - _iconImageView = empyImageView; - [self iconViewInsertSubview:_iconImageView atIndex:0]; - } - - _reloadImageCancellationBlock = [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:_imageSrc] - size:self.bounds.size - scale:ABI46_0_0RCTScreenScale() - clipped:YES - resizeMode:ABI46_0_0RCTResizeModeCenter - progressBlock:nil - partialLoadBlock:nil - completionBlock:^(NSError *error, UIImage *image) { - if (error) { - // TODO(lmr): do something with the error? - NSLog(@"%@", error); - } - dispatch_async(dispatch_get_main_queue(), ^{ - - // TODO(gil): This way allows different image sizes - if (self->_iconImageView) [self->_iconImageView removeFromSuperview]; - - // ... but this way is more efficient? -// if (_iconImageView) { -// [_iconImageView setImage:image]; -// return; -// } - - UIImageView *imageView = [[UIImageView alloc] initWithImage:image]; - - // TODO: w,h or pixel density could be a prop. - float density = 1; - float w = image.size.width/density; - float h = image.size.height/density; - CGRect bounds = CGRectMake(0, 0, w, h); - - imageView.contentMode = UIViewContentModeScaleAspectFit; - [imageView setFrame:bounds]; - - // NOTE: sizeToFit doesn't work instead. Not sure why. - // TODO: Doing it this way is not ideal because it causes things to reshuffle - // when the image loads IF the image is larger than the UIView. - // Shouldn't required images have size info automatically via ABI46_0_0RN? - CGRect selfBounds = unionRect(bounds, self.bounds); - [self setFrame:selfBounds]; - - self->_iconImageView = imageView; - [self iconViewInsertSubview:imageView atIndex:0]; - }); - }]; -} - -- (void)setIconSrc:(NSString *)iconSrc -{ - _iconSrc = iconSrc; - - if (_reloadImageCancellationBlock) { - _reloadImageCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - - _reloadImageCancellationBlock = - [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:_iconSrc] - size:self.bounds.size - scale:ABI46_0_0RCTScreenScale() - clipped:YES - resizeMode:ABI46_0_0RCTResizeModeCenter - progressBlock:nil - partialLoadBlock:nil - completionBlock:^(NSError *error, UIImage *image) { - if (error) { - // TODO(lmr): do something with the error? - NSLog(@"%@", error); - } - dispatch_async(dispatch_get_main_queue(), ^{ - self->_realMarker.icon = image; - }); - }]; -} - -- (void)setTitle:(NSString *)title { - _realMarker.title = [title copy]; -} - -- (NSString *)title { - return _realMarker.title; -} - -- (void)setSubtitle:(NSString *)subtitle { - _realMarker.snippet = subtitle; -} - -- (NSString *)subtitle { - return _realMarker.snippet; -} - -- (void)setPinColor:(UIColor *)pinColor { - _pinColor = pinColor; - _realMarker.icon = [GMSMarker markerImageWithColor:pinColor]; -} - -- (void)setAnchor:(CGPoint)anchor { - _anchor = anchor; - _realMarker.groundAnchor = anchor; -} - -- (void)setCalloutAnchor:(CGPoint)calloutAnchor { - _calloutAnchor = calloutAnchor; - _realMarker.infoWindowAnchor = calloutAnchor; -} - - -- (void)setZIndex:(NSInteger)zIndex -{ - _zIndex = zIndex; - _realMarker.zIndex = (int)zIndex; -} - -- (void)setDraggable:(BOOL)draggable { - _realMarker.draggable = draggable; -} - -- (BOOL)draggable { - return _realMarker.draggable; -} - -- (void)setTappable:(BOOL)tappable { - _realMarker.tappable = tappable; -} - -- (BOOL)tappable { - return _realMarker.tappable; -} - -- (void)setFlat:(BOOL)flat { - _realMarker.flat = flat; -} - -- (BOOL)flat { - return _realMarker.flat; -} - -- (void)setTracksViewChanges:(BOOL)tracksViewChanges { - _realMarker.tracksViewChanges = tracksViewChanges; -} - -- (BOOL)tracksViewChanges { - return _realMarker.tracksViewChanges; -} - -- (void)setTracksInfoWindowChanges:(BOOL)tracksInfoWindowChanges { - _realMarker.tracksInfoWindowChanges = tracksInfoWindowChanges; -} - -- (BOOL)tracksInfoWindowChanges { - return _realMarker.tracksInfoWindowChanges; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.h deleted file mode 100644 index 661986912a62eb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapMarkerManager.h -// AirMaps -// -// Created by Gil Birman on 9/2/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapMarkerManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.m deleted file mode 100644 index a5040249a5bce8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapMarkerManager.m +++ /dev/null @@ -1,115 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapMarkerManager.m -// AirMaps -// -// Created by Gil Birman on 9/2/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapMarkerManager.h" -#import "ABI46_0_0AIRGoogleMapMarker.h" -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" - -@implementation ABI46_0_0AIRGoogleMapMarkerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapMarker *marker = [ABI46_0_0AIRGoogleMapMarker new]; -// UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTap:)]; -// // setting this to NO allows the parent MapView to continue receiving marker selection events -// tapGestureRecognizer.cancelsTouchesInView = NO; -// [marker addGestureRecognizer:tapGestureRecognizer]; - marker.bridge = self.bridge; - marker.isAccessibilityElement = YES; - marker.accessibilityElementsHidden = NO; - return marker; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(identifier, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rotation, CLLocationDegrees) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(icon, iconSrc, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(title, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(description, subtitle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pinColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(anchor, CGPoint) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(calloutAnchor, CGPoint) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(draggable, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tappable, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(flat, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tracksViewChanges, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tracksInfoWindowChanges, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, double) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDragStart, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDrag, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDragEnd, ABI46_0_0RCTDirectEventBlock) - -ABI46_0_0RCT_EXPORT_METHOD(showCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [(ABI46_0_0AIRGoogleMapMarker *) view showCalloutView]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(hideCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [(ABI46_0_0AIRGoogleMapMarker *) view hideCalloutView]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(redrawCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRGoogleMapMarker* marker = (ABI46_0_0AIRGoogleMapMarker *) view; - - [NSTimer scheduledTimerWithTimeInterval:0.0 - target:[NSBlockOperation blockOperationWithBlock:^{ - [marker hideCalloutView]; - [marker showCalloutView]; - }] - selector:@selector(main) - userInfo:nil - repeats:NO - ]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(redraw:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRGoogleMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [(ABI46_0_0AIRGoogleMapMarker *) view redraw]; - } - }]; -} -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.h deleted file mode 100644 index 672f768fc265e3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapOverlay.h -// -// Created by Taro Matsuzawa on 5/3/17. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRGoogleMap.h" - -@interface ABI46_0_0AIRGoogleMapOverlay : UIView - -@property (nonatomic, strong) GMSGroundOverlay *overlay; -@property (nonatomic, copy) NSString *imageSrc; -@property (nonatomic, strong, readonly) UIImage *overlayImage; -@property (nonatomic, copy) NSArray *boundsRect; -@property (nonatomic, assign) CGFloat opacity; -@property (nonatomic, readonly) GMSCoordinateBounds *overlayBounds; -@property (nonatomic, readonly) double bearing; - -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.m deleted file mode 100644 index 994b2ac924ddb7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlay.m +++ /dev/null @@ -1,92 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapOverlay.m -// Created by Nick Italiano on 3/5/17. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapOverlay.h" - -#import -#import -#import -#import - -@interface ABI46_0_0AIRGoogleMapOverlay() - @property (nonatomic, strong, readwrite) UIImage *overlayImage; - @property (nonatomic, readwrite) GMSCoordinateBounds *overlayBounds; - @property (nonatomic) CLLocationDirection bearing; -@end - -@implementation ABI46_0_0AIRGoogleMapOverlay { - ABI46_0_0RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; - CLLocationCoordinate2D _southWest; - CLLocationCoordinate2D _northEast; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _overlay = [[GMSGroundOverlay alloc] init]; - } - return self; -} - -- (void)setImageSrc:(NSString *)imageSrc -{ - NSLog(@">>> SET IMAGESRC: %@", imageSrc); - _imageSrc = imageSrc; - - if (_reloadImageCancellationBlock) { - _reloadImageCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - - __weak typeof(self) weakSelf = self; - _reloadImageCancellationBlock = [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:_imageSrc] - size:weakSelf.bounds.size - scale:ABI46_0_0RCTScreenScale() - clipped:YES - resizeMode:ABI46_0_0RCTResizeModeCenter - progressBlock:nil - partialLoadBlock:nil - completionBlock:^(NSError *error, UIImage *image) { - if (error) { - NSLog(@"%@", error); - } - dispatch_async(dispatch_get_main_queue(), ^{ - NSLog(@">>> IMAGE: %@", image); - weakSelf.overlayImage = image; - weakSelf.overlay.icon = image; - }); - }]; - -} - -- (void)setBoundsRect:(NSArray *)boundsRect -{ - _boundsRect = boundsRect; - - _southWest = CLLocationCoordinate2DMake([boundsRect[1][0] doubleValue], [boundsRect[0][1] doubleValue]); - _northEast = CLLocationCoordinate2DMake([boundsRect[0][0] doubleValue], [boundsRect[1][1] doubleValue]); - - _overlayBounds = [[GMSCoordinateBounds alloc] initWithCoordinate:_southWest - coordinate:_northEast]; - - _overlay.bounds = _overlayBounds; -} - -- (void)setBearing:(double)bearing -{ - _bearing = (double)bearing; - _overlay.bearing = _bearing; -} - -- (void)setOpacity:(CGFloat)opacity -{ - _overlay.opacity = opacity; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.h deleted file mode 100644 index b0163ff178d1a2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapOverlayManager.h -// Created by Taro Matsuzawa on 3/5/17. -// - -#import -#import - -@interface ABI46_0_0AIRGoogleMapOverlayManager : ABI46_0_0RCTViewManager -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.m deleted file mode 100644 index 0b1209c1ac6537..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapOverlayManager.m +++ /dev/null @@ -1,24 +0,0 @@ -#import "ABI46_0_0AIRGoogleMapOverlayManager.h" -#import "ABI46_0_0AIRGoogleMapOverlay.h" - -@interface ABI46_0_0AIRGoogleMapOverlayManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapOverlayManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapOverlay *overlay = [ABI46_0_0AIRGoogleMapOverlay new]; - overlay.bridge = self.bridge; - return overlay; -} - -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(bounds, boundsRect, NSArray) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(bearing, bearing, double) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(opacity, opacity, CGFloat) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.h deleted file mode 100644 index 9274844a4ec0d2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.h +++ /dev/null @@ -1,32 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolygon.h -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import -#import "ABI46_0_0AIRGMSPolygon.h" -#import "ABI46_0_0AIRMapCoordinate.h" - -@interface ABI46_0_0AIRGoogleMapPolygon : UIView - -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, strong) ABI46_0_0AIRGMSPolygon *polygon; -@property (nonatomic, strong) NSArray *coordinates; -@property (nonatomic, strong) NSArray *> *holes; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; - -@property (nonatomic, assign) UIColor *fillColor; -@property (nonatomic, assign) double strokeWidth; -@property (nonatomic, assign) UIColor *strokeColor; -@property (nonatomic, assign) BOOL geodesic; -@property (nonatomic, assign) int zIndex; -@property (nonatomic, assign) BOOL tappable; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.m deleted file mode 100644 index 8c13f75a7f96ac..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygon.m +++ /dev/null @@ -1,100 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolygon.m -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapPolygon.h" -#import "ABI46_0_0AIRGMSPolygon.h" -#import - -@implementation ABI46_0_0AIRGoogleMapPolygon - -- (instancetype)init -{ - if (self = [super init]) { - _polygon = [[ABI46_0_0AIRGMSPolygon alloc] init]; - } - - return self; -} - -- (void)setCoordinates:(NSArray *)coordinates -{ - _coordinates = coordinates; - - GMSMutablePath *path = [GMSMutablePath path]; - for(int i = 0; i < coordinates.count; i++) - { - [path addCoordinate:coordinates[i].coordinate]; - } - - _polygon.path = path; -} - -- (void)setHoles:(NSArray *> *)holes -{ - _holes = holes; - - if (holes.count) - { - NSMutableArray *interiorPolygons = [NSMutableArray array]; - for(int h = 0; h < holes.count; h++) - { - GMSMutablePath *path = [GMSMutablePath path]; - for(int i = 0; i < holes[h].count; i++) - { - [path addCoordinate:holes[h][i].coordinate]; - } - [interiorPolygons addObject:path]; - } - - _polygon.holes = interiorPolygons; - } -} - --(void)setFillColor:(UIColor *)fillColor -{ - _fillColor = fillColor; - _polygon.fillColor = fillColor; -} - --(void)setStrokeWidth:(double)strokeWidth -{ - _strokeWidth = strokeWidth; - _polygon.strokeWidth = strokeWidth; -} - --(void)setStrokeColor:(UIColor *) strokeColor -{ - _strokeColor = strokeColor; - _polygon.strokeColor = strokeColor; -} - --(void)setGeodesic:(BOOL)geodesic -{ - _geodesic = geodesic; - _polygon.geodesic = geodesic; -} - --(void)setZIndex:(int)zIndex -{ - _zIndex = zIndex; - _polygon.zIndex = zIndex; -} - --(void)setTappable:(BOOL)tappable -{ - _tappable = tappable; - _polygon.tappable = tappable; -} - -- (void)setOnPress:(ABI46_0_0RCTBubblingEventBlock)onPress { - _polygon.onPress = onPress; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.h deleted file mode 100644 index bbf91a863b100d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolylgoneManager.h -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapPolygonManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.m deleted file mode 100644 index c062529e05dd0d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolygonManager.m +++ /dev/null @@ -1,46 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolylgoneManager.m -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS -#import "ABI46_0_0AIRGoogleMapPolygonManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRGoogleMapPolygon.h" - -@interface ABI46_0_0AIRGoogleMapPolygonManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapPolygonManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapPolygon *polygon = [ABI46_0_0AIRGoogleMapPolygon new]; - polygon.bridge = self.bridge; - return polygon; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinates, ABI46_0_0AIRMapCoordinateArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(holes, ABI46_0_0AIRMapCoordinateArrayArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, double) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(geodesic, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tappable, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.h deleted file mode 100644 index 938f1eb6b2935c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolyline.h -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS -#import -#import -#import -#import "ABI46_0_0AIRGMSPolyline.h" -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRGoogleMapMarker.h" - -@interface ABI46_0_0AIRGoogleMapPolyline : UIView - -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, strong) ABI46_0_0AIRGMSPolyline *polyline; -@property (nonatomic, strong) NSArray *coordinates; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; - -@property (nonatomic, strong) UIColor *strokeColor; -@property (nonatomic, strong) NSArray *strokeColors; -@property (nonatomic, assign) double strokeWidth; -@property (nonatomic, assign) UIColor *fillColor; -@property (nonatomic, strong) NSArray *lineDashPattern; -@property (nonatomic, assign) BOOL geodesic; -@property (nonatomic, assign) NSString *title; -@property (nonatomic, assign) int zIndex; -@property (nonatomic, assign) BOOL tappable; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.m deleted file mode 100644 index 234edb6bbfa0d8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolyline.m +++ /dev/null @@ -1,135 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolyline.m -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS -#import -#import "ABI46_0_0AIRGoogleMapPolyline.h" -#import "ABI46_0_0AIRGMSPolyline.h" -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRGoogleMapMarker.h" -#import "ABI46_0_0AIRGoogleMapMarkerManager.h" -#import -#import - -@implementation ABI46_0_0AIRGoogleMapPolyline - -- (instancetype)init -{ - if (self = [super init]) { - _polyline = [[ABI46_0_0AIRGMSPolyline alloc] init]; - } - return self; -} - --(void)setCoordinates:(NSArray *)coordinates -{ - _coordinates = coordinates; - - GMSMutablePath *path = [GMSMutablePath path]; - for(int i = 0; i < coordinates.count; i++) - { - [path addCoordinate:coordinates[i].coordinate]; - } - - _polyline.path = path; - - [self configureStyleSpansIfNeeded]; -} - --(void)setStrokeColor:(UIColor *)strokeColor -{ - _strokeColor = strokeColor; - _polyline.strokeColor = strokeColor; - [self configureStyleSpansIfNeeded]; -} - --(void)setStrokeColors:(NSArray *)strokeColors -{ - NSMutableArray *spans = [NSMutableArray arrayWithCapacity:[strokeColors count]]; - for (int i = 0; i < [strokeColors count]; i++) - { - GMSStrokeStyle *stroke; - - if (i == 0) { - stroke = [GMSStrokeStyle solidColor:strokeColors[i]]; - } else { - stroke = [GMSStrokeStyle gradientFromColor:strokeColors[i-1] toColor:strokeColors[i]]; - } - - [spans addObject:[GMSStyleSpan spanWithStyle:stroke]]; - } - - _strokeColors = strokeColors; - _polyline.spans = spans; -} - --(void)setStrokeWidth:(double)strokeWidth -{ - _strokeWidth = strokeWidth; - _polyline.strokeWidth = strokeWidth; -} - --(void)setFillColor:(UIColor *)fillColor -{ - _fillColor = fillColor; - _polyline.spans = @[[GMSStyleSpan spanWithColor:fillColor]]; -} - -- (void)setLineDashPattern:(NSArray *)lineDashPattern { - _lineDashPattern = lineDashPattern; - [self configureStyleSpansIfNeeded]; -} - --(void)setGeodesic:(BOOL)geodesic -{ - _geodesic = geodesic; - _polyline.geodesic = geodesic; -} - --(void)setTitle:(NSString *)title -{ - _title = title; - _polyline.title = _title; -} - --(void) setZIndex:(int)zIndex -{ - _zIndex = zIndex; - _polyline.zIndex = zIndex; -} - --(void)setTappable:(BOOL)tappable -{ - _tappable = tappable; - _polyline.tappable = tappable; -} - -- (void)setOnPress:(ABI46_0_0RCTBubblingEventBlock)onPress { - _polyline.onPress = onPress; -} - -- (void)configureStyleSpansIfNeeded { - if (!_strokeColor || !_lineDashPattern || !_polyline.path) { - return; - } - - BOOL isLine = YES; - NSMutableArray *styles = [[NSMutableArray alloc] init]; - for (NSInteger i = 0; i < _lineDashPattern.count; i++) { - if (isLine) { - [styles addObject:[GMSStrokeStyle solidColor:_strokeColor]]; - } else { - [styles addObject:[GMSStrokeStyle solidColor:[UIColor clearColor]]]; - } - isLine = !isLine; - } - - _polyline.spans = GMSStyleSpans(_polyline.path, styles, _lineDashPattern, kGMSLengthRhumb); -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.h deleted file mode 100644 index e8159db21af8dd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolylineManager.h -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import - -@interface ABI46_0_0AIRGoogleMapPolylineManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.m deleted file mode 100644 index c15b98fd01adf0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapPolylineManager.m +++ /dev/null @@ -1,48 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapPolylineManager.m -// -// Created by Nick Italiano on 10/22/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapPolylineManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRGoogleMapPolyline.h" - -@interface ABI46_0_0AIRGoogleMapPolylineManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapPolylineManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapPolyline *polyline = [ABI46_0_0AIRGoogleMapPolyline new]; - polyline.bridge = self.bridge; - return polyline; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinates, ABI46_0_0AIRMapCoordinateArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColors, UIColorArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, double) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(geodesic, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tappable, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapURLTileManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapURLTileManager.m deleted file mode 100644 index 9b3fa10e9e8358..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapURLTileManager.m +++ /dev/null @@ -1,33 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapURLTileManager.m -// Created by Nick Italiano on 11/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapUrlTileManager.h" -#import "ABI46_0_0AIRGoogleMapUrlTile.h" - -@interface ABI46_0_0AIRGoogleMapUrlTileManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapUrlTileManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapUrlTile *tileLayer = [ABI46_0_0AIRGoogleMapUrlTile new]; - return tileLayer; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(urlTemplate, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(flipY, BOOL) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.h deleted file mode 100644 index f4655ee7ba57eb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapURLTile.h -// Created by Nick Italiano on 11/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0AIRGoogleMapUrlTile : UIView - -@property (nonatomic, strong) GMSURLTileLayer *tileLayer; -@property (nonatomic, assign) NSString *urlTemplate; -@property (nonatomic, assign) int zIndex; -@property NSInteger *maximumZ; -@property NSInteger *minimumZ; -@property BOOL flipY; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.m deleted file mode 100644 index b147dd534327e0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTile.m +++ /dev/null @@ -1,56 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapURLTile.m -// Created by Nick Italiano on 11/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapUrlTile.h" - -@implementation ABI46_0_0AIRGoogleMapUrlTile - -- (void)setZIndex:(int)zIndex -{ - _zIndex = zIndex; - _tileLayer.zIndex = zIndex; -} - -- (void)setUrlTemplate:(NSString *)urlTemplate -{ - _urlTemplate = urlTemplate; - _tileLayer = [GMSURLTileLayer tileLayerWithURLConstructor:[self _getTileURLConstructor]]; - _tileLayer.tileSize = [[UIScreen mainScreen] scale] * 256; -} - -- (GMSTileURLConstructor)_getTileURLConstructor -{ - NSString *urlTemplate = self.urlTemplate; - NSInteger *maximumZ = self.maximumZ; - NSInteger *minimumZ = self.minimumZ; - GMSTileURLConstructor urls = ^NSURL* _Nullable (NSUInteger x, NSUInteger y, NSUInteger zoom) { - - if (self.flipY == YES) { - y = (1 << zoom) - y - 1; - } - - NSString *url = urlTemplate; - url = [url stringByReplacingOccurrencesOfString:@"{x}" withString:[NSString stringWithFormat: @"%ld", (long)x]]; - url = [url stringByReplacingOccurrencesOfString:@"{y}" withString:[NSString stringWithFormat: @"%ld", (long)y]]; - url = [url stringByReplacingOccurrencesOfString:@"{z}" withString:[NSString stringWithFormat: @"%ld", (long)zoom]]; - - if(maximumZ && (long)zoom > (long)maximumZ) { - return nil; - } - - if(minimumZ && (long)zoom < (long)minimumZ) { - return nil; - } - - return [NSURL URLWithString:url]; - }; - return urls; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTileManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTileManager.h deleted file mode 100644 index 511cf7facecfd2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapUrlTileManager.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapURLTileManager.h -// Created by Nick Italiano on 11/5/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0AIRGoogleMapUrlTileManager : ABI46_0_0RCTViewManager -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.h deleted file mode 100644 index aac25763efec49..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapWMSTile.h -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0WMSTileOverlay : GMSSyncTileLayer -@property (nonatomic) double MapX,MapY,FULL; -@property (nonatomic, strong) NSString *template; -@property (nonatomic, assign) NSInteger maximumZ; -@property (nonatomic, assign) NSInteger minimumZ; -@end - -@interface ABI46_0_0AIRGoogleMapWMSTile : UIView -@property (nonatomic, strong) ABI46_0_0WMSTileOverlay *tileLayer; -@property (nonatomic, assign) NSString *urlTemplate; -@property (nonatomic, assign) int zIndex; -@property (nonatomic, assign) NSInteger maximumZ; -@property (nonatomic, assign) NSInteger minimumZ; -@property (nonatomic, assign) NSInteger tileSize; -@property (nonatomic, assign) float opacity; -@end - -#endif - - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.m deleted file mode 100644 index 481007124da26f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTile.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapWMSTile.m -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapWMSTile.h" - -@implementation ABI46_0_0AIRGoogleMapWMSTile - --(id) init -{ - self = [super init]; - _opacity = 1; - return self ; -} - -- (void)setZIndex:(int)zIndex -{ - _zIndex = zIndex; - _tileLayer.zIndex = zIndex; -} -- (void)setTileSize:(NSInteger)tileSize -{ - _tileSize = tileSize; - if(self.tileLayer) { - self.tileLayer.tileSize = tileSize; - [self.tileLayer clearTileCache]; - } -} -- (void)setMinimumZ:(NSInteger)minimumZ -{ - _minimumZ = minimumZ; - if(self.tileLayer && _minimumZ) { - [self.tileLayer setMinimumZ: _minimumZ ]; - [self.tileLayer clearTileCache]; - } -} - -- (void)setMaximumZ:(NSInteger)maximumZ -{ - _maximumZ = maximumZ; - if(self.tileLayer && maximumZ) { - [self.tileLayer setMaximumZ: _maximumZ ]; - [self.tileLayer clearTileCache]; - } -} -- (void)setOpacity:(float)opacity -{ - _opacity = opacity; - if(self.tileLayer ) { - [self.tileLayer setOpacity:opacity]; - [self.tileLayer clearTileCache]; - } -} - -- (void)setUrlTemplate:(NSString *)urlTemplate -{ - _urlTemplate = urlTemplate; - ABI46_0_0WMSTileOverlay *tile = [[ABI46_0_0WMSTileOverlay alloc] init]; - [tile setTemplate:urlTemplate]; - [tile setMaximumZ: _maximumZ]; - [tile setMinimumZ: _minimumZ]; - [tile setOpacity: _opacity]; - [tile setTileSize: _tileSize]; - [tile setZIndex: _zIndex]; - _tileLayer = tile; -} -@end - -@implementation ABI46_0_0WMSTileOverlay --(id) init -{ - self = [super init]; - _MapX = -20037508.34789244; - _MapY = 20037508.34789244; - _FULL = 20037508.34789244 * 2; - return self ; -} - --(NSArray *)getBoundBox:(NSInteger)x yAxis:(NSInteger)y zoom:(NSInteger)zoom -{ - double tile = _FULL / pow(2.0, (double)zoom); - NSArray *result =[[NSArray alloc] initWithObjects: - [NSNumber numberWithDouble:_MapX + (double)x * tile ], - [NSNumber numberWithDouble:_MapY - (double)(y+1) * tile ], - [NSNumber numberWithDouble:_MapX + (double)(x+1) * tile ], - [NSNumber numberWithDouble:_MapY - (double)y * tile ], - nil]; - - return result; - -} - -- (UIImage *)tileForX:(NSUInteger)x y:(NSUInteger)y zoom:(NSUInteger)zoom -{ - NSInteger maximumZ = self.maximumZ; - NSInteger minimumZ = self.minimumZ; - if(maximumZ && (long)zoom > (long)maximumZ) { - return nil; - } - if(minimumZ && (long)zoom < (long)minimumZ) { - return nil; - } - NSArray *bb = [self getBoundBox:x yAxis:y zoom:zoom]; - NSMutableString *url = [self.template mutableCopy]; - [url replaceOccurrencesOfString: @"{minX}" withString:[NSString stringWithFormat:@"%@", bb[0]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{minY}" withString:[NSString stringWithFormat:@"%@", bb[1]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{maxX}" withString:[NSString stringWithFormat:@"%@", bb[2]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{maxY}" withString:[NSString stringWithFormat:@"%@", bb[3]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{width}" withString:[NSString stringWithFormat:@"%d", (int)self.tileSize] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{height}" withString:[NSString stringWithFormat:@"%d", (int)self.tileSize] options:0 range:NSMakeRange(0, url.length)]; - NSURL *uri = [NSURL URLWithString:url]; - NSData *data = [NSData dataWithContentsOfURL:uri]; - UIImage *img = [[UIImage alloc] initWithData:data]; - return img; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.h deleted file mode 100644 index b1d6079c2d00c3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapWMSTileManager.h -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import - -@interface ABI46_0_0AIRGoogleMapWMSTileManager : ABI46_0_0RCTViewManager -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.m deleted file mode 100644 index 3e23c3e0644c54..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0AIRGoogleMapWMSTileManager.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// ABI46_0_0AIRGoogleMapWMSTileManager.m -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0AIRGoogleMapWMSTileManager.h" -#import "ABI46_0_0AIRGoogleMapWMSTile.h" - -@interface ABI46_0_0AIRGoogleMapWMSTileManager() - -@end - -@implementation ABI46_0_0AIRGoogleMapWMSTileManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRGoogleMapWMSTile *tileLayer = [ABI46_0_0AIRGoogleMapWMSTile new]; - return tileLayer; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(urlTemplate, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumZ, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumZ, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileSize, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, float) - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.h deleted file mode 100644 index 41721b9f20cc04..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0RCTConvert+GMSMapViewType.h -// -// Created by Nick Italiano on 10/23/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import -#import -#import - -@interface ABI46_0_0RCTConvert (GMSMapViewType) -+ (GMSCameraPosition*)GMSCameraPositionWithDefaults:(id)json existingCamera:(GMSCameraPosition*)existingCamera; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.m deleted file mode 100644 index 7eb405d7111cc1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/GoogleMaps/ABI46_0_0RCTConvert+GMSMapViewType.m +++ /dev/null @@ -1,79 +0,0 @@ -// -// ABI46_0_0RCTConvert+GMSMapViewType.m -// -// Created by Nick Italiano on 10/23/16. -// - -#ifdef ABI46_0_0HAVE_GOOGLE_MAPS - -#import "ABI46_0_0RCTConvert+GMSMapViewType.h" -#import -#import -#import - -@implementation ABI46_0_0RCTConvert (GMSMapViewType) - ABI46_0_0RCT_ENUM_CONVERTER(GMSMapViewType, - ( - @{ - @"standard": @(kGMSTypeNormal), - @"satellite": @(kGMSTypeSatellite), - @"hybrid": @(kGMSTypeHybrid), - @"terrain": @(kGMSTypeTerrain), - @"none": @(kGMSTypeNone) - } - ), kGMSTypeTerrain, intValue) - - -+ (GMSCameraPosition*)GMSCameraPosition:(id)json -{ - json = [self NSDictionary:json]; - return [ABI46_0_0RCTConvert GMSCameraPositionWithDefaults:json existingCamera:nil]; -} - -+ (GMSCameraPosition*)GMSCameraPositionWithDefaults:(id)json existingCamera:(GMSCameraPosition*)existingCamera -{ - CLLocationDegrees latitude = 0; - CLLocationDegrees longitude = 0; - double viewingAngle = 0; - double zoom = 0; - double bearing = 0; - - if (existingCamera != nil) { - viewingAngle = existingCamera.viewingAngle; - latitude = existingCamera.target.latitude; - longitude = existingCamera.target.longitude; - zoom = existingCamera.zoom; - bearing = existingCamera.bearing; - } - - if (json[@"center"]) { - CLLocationCoordinate2D target = [self CLLocationCoordinate2D:json[@"center"]]; - latitude = target.latitude; - longitude = target.longitude; - } - - if (json[@"pitch"]) { - viewingAngle = [self double:json[@"pitch"]]; - } - - // zoomAtCoordinate:forMeters:perPoints is offered by the SDK, which would allow - // us to support the "altitude" property of the camera as an alternative to "zoom". - // However, I am not clear on what the "perPoints" argument does... - if (json[@"zoom"]) { - zoom = [self double:json[@"zoom"]]; - } - - if (json[@"heading"]) { - bearing = [self double:json[@"heading"]]; - } - - return [GMSCameraPosition cameraWithLatitude:latitude - longitude:longitude - zoom:zoom - bearing:bearing - viewingAngle:viewingAngle]; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.h deleted file mode 100644 index a5a8b3563dccf3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.h +++ /dev/null @@ -1,81 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import - -#import -#import "ABI46_0_0SMCalloutView.h" -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapCalloutSubview.h" - -@class ABI46_0_0AIRMapMarker; - -extern const CLLocationDegrees ABI46_0_0AIRMapDefaultSpan; -extern const NSTimeInterval ABI46_0_0AIRMapRegionChangeObserveInterval; -extern const CGFloat ABI46_0_0AIRMapZoomBoundBuffer; -extern const NSInteger ABI46_0_0AIRMapMaxZoomLevel; - -@interface ABI46_0_0AIRMap: MKMapView - -@property (nonatomic, strong) ABI46_0_0SMCalloutView *calloutView; -@property (nonatomic, strong) UIImageView *cacheImageView; -@property (nonatomic, strong) UIView *loadingView; - -@property (nonatomic, copy) NSString *userLocationAnnotationTitle; -@property (nonatomic, assign) BOOL followUserLocation; -@property (nonatomic, assign) BOOL userLocationCalloutEnabled; -@property (nonatomic, assign) BOOL hasStartedRendering; -@property (nonatomic, assign) BOOL cacheEnabled; -@property (nonatomic, assign) BOOL loadingEnabled; -@property (nonatomic, strong) UIColor *loadingBackgroundColor; -@property (nonatomic, strong) UIColor *loadingIndicatorColor; -@property (nonatomic, assign) BOOL hasShownInitialLoading; -@property (nonatomic, assign) CGFloat minDelta; -@property (nonatomic, assign) CGFloat maxDelta; -@property (nonatomic, assign) UIEdgeInsets legalLabelInsets; -@property (nonatomic, strong) NSTimer *regionChangeObserveTimer; -@property (nonatomic, assign) MKCoordinateRegion initialRegion; -@property (nonatomic, assign) MKMapCamera *initialCamera; -@property (nonatomic, assign) CGFloat minZoomLevel; -@property (nonatomic, assign) CGFloat maxZoomLevel; -@property (nonatomic, assign) CGPoint compassOffset; -@property (nonatomic, assign) UIEdgeInsets mapPadding; - -@property (nonatomic, assign) CLLocationCoordinate2D pendingCenter; -@property (nonatomic, assign) MKCoordinateSpan pendingSpan; - - -@property (nonatomic, assign) BOOL ignoreRegionChanges; - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onMapReady; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChange; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPanDrag; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onDoublePress; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onLongPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerSelect; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerDeselect; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerDragStart; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerDrag; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMarkerDragEnd; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onCalloutPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onRegionChange; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onUserLocationChange; - -- (void)cacheViewIfNeeded; -- (void)beginLoading; -- (void)finishLoading; -- (NSArray *)getMapBoundaries; - -- (ABI46_0_0AIRMapMarker*) markerAtPoint:(CGPoint)point; -- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.m deleted file mode 100644 index ba6ceb6a383b23..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMap.m +++ /dev/null @@ -1,691 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMap.h" - -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapPolyline.h" -#import "ABI46_0_0AIRMapPolygon.h" -#import "ABI46_0_0AIRMapCircle.h" -#import -#import "ABI46_0_0AIRMapUrlTile.h" -#import "ABI46_0_0AIRMapWMSTile.h" -#import "ABI46_0_0AIRMapLocalTile.h" -#import "ABI46_0_0AIRMapOverlay.h" - -const CLLocationDegrees ABI46_0_0AIRMapDefaultSpan = 0.005; -const NSTimeInterval ABI46_0_0AIRMapRegionChangeObserveInterval = 0.1; -const CGFloat ABI46_0_0AIRMapZoomBoundBuffer = 0.01; -const NSInteger ABI46_0_0AIRMapMaxZoomLevel = 20; - - -@interface MKMapView (UIGestureRecognizer) - -// this tells the compiler that MKMapView actually implements this method -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; - -@end - -@interface ABI46_0_0AIRMap () - -@property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView; -@property (nonatomic, assign) NSNumber *shouldZoomEnabled; -@property (nonatomic, assign) NSNumber *shouldScrollEnabled; - -- (void)updateScrollEnabled; -- (void)updateZoomEnabled; - -@end - -@implementation ABI46_0_0AIRMap -{ - UIView *_legalLabel; - CLLocationManager *_locationManager; - BOOL _initialRegionSet; - BOOL _initialCameraSet; - - // Array to manually track ABI46_0_0RN subviews - // - // ABI46_0_0AIRMap implicitly creates subviews that aren't regular ABI46_0_0RN children - // (ABI46_0_0SMCalloutView injects an overlay subview), which otherwise confuses ABI46_0_0RN - // during component re-renders: - // https://github.com/facebook/ABI46_0_0React-native/blob/v0.16.0/ABI46_0_0React/Modules/ABI46_0_0RCTUIManager.m#L657 - // - // Implementation based on ABI46_0_0RCTTextField, another component with indirect children - // https://github.com/facebook/ABI46_0_0React-native/blob/v0.16.0/Libraries/Text/ABI46_0_0RCTTextField.m#L20 - NSMutableArray *_ABI46_0_0ReactSubviews; -} - -- (instancetype)init -{ - if ((self = [super init])) { - _hasStartedRendering = NO; - _ABI46_0_0ReactSubviews = [NSMutableArray new]; - - // Find Apple link label - for (UIView *subview in self.subviews) { - if ([NSStringFromClass(subview.class) isEqualToString:@"MKAttributionLabel"]) { - // This check is super hacky, but the whole premise of moving around - // Apple's internal subviews is super hacky - _legalLabel = subview; - break; - } - } - - // 3rd-party callout view for MapKit that has more options than the built-in. It's painstakingly built to - // be identical to the built-in callout view (which has a private API) - self.calloutView = [ABI46_0_0SMCalloutView platformCalloutView]; - self.calloutView.delegate = self; - - self.minZoomLevel = 0; - self.maxZoomLevel = ABI46_0_0AIRMapMaxZoomLevel; - self.compassOffset = CGPointMake(0, 0); - } - return self; -} - -- (void)dealloc -{ - [_regionChangeObserveTimer invalidate]; -} - --(void)addSubview:(UIView *)view { - if([view isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - [self addAnnotation:(id )view]; - } else { - [super addSubview:view]; - } -} - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (void)insertABI46_0_0ReactSubview:(id)subview atIndex:(NSInteger)atIndex { - // Our desired API is to pass up markers/overlays as children to the mapview component. - // This is where we intercept them and do the appropriate underlying mapview action. - if ([subview isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - [self addAnnotation:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapPolyline class]]) { - ((ABI46_0_0AIRMapPolyline *)subview).map = self; - [self addOverlay:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapPolygon class]]) { - ((ABI46_0_0AIRMapPolygon *)subview).map = self; - [self addOverlay:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapCircle class]]) { - ((ABI46_0_0AIRMapCircle *)subview).map = self; - [self addOverlay:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapUrlTile class]]) { - ((ABI46_0_0AIRMapUrlTile *)subview).map = self; - [self addOverlay:(id)subview]; - }else if ([subview isKindOfClass:[ABI46_0_0AIRMapWMSTile class]]) { - ((ABI46_0_0AIRMapWMSTile *)subview).map = self; - [self addOverlay:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapLocalTile class]]) { - ((ABI46_0_0AIRMapLocalTile *)subview).map = self; - [self addOverlay:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapOverlay class]]) { - ((ABI46_0_0AIRMapOverlay *)subview).map = self; - [self addOverlay:(id)subview]; - } else { - NSArray> *childSubviews = [subview ABI46_0_0ReactSubviews]; - for (int i = 0; i < childSubviews.count; i++) { - [self insertABI46_0_0ReactSubview:(UIView *)childSubviews[i] atIndex:atIndex]; - } - } - [_ABI46_0_0ReactSubviews insertObject:(UIView *)subview atIndex:(NSUInteger) atIndex]; -} -#pragma clang diagnostic pop - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (void)removeABI46_0_0ReactSubview:(id)subview { - // similarly, when the children are being removed we have to do the appropriate - // underlying mapview action here. - if ([subview isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - [self removeAnnotation:(id)subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapPolyline class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapPolygon class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapCircle class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapUrlTile class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapWMSTile class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapLocalTile class]]) { - [self removeOverlay:(id ) subview]; - } else if ([subview isKindOfClass:[ABI46_0_0AIRMapOverlay class]]) { - [self removeOverlay:(id ) subview]; - } else { - NSArray> *childSubviews = [subview ABI46_0_0ReactSubviews]; - for (int i = 0; i < childSubviews.count; i++) { - [self removeABI46_0_0ReactSubview:(UIView *)childSubviews[i]]; - } - } - [_ABI46_0_0ReactSubviews removeObject:(UIView *)subview]; -} -#pragma clang diagnostic pop - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wobjc-missing-super-calls" -- (NSArray> *)ABI46_0_0ReactSubviews { - return _ABI46_0_0ReactSubviews; -} -#pragma clang diagnostic pop - -#pragma mark Utils - -- (NSArray*) markers { - NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { - ABI46_0_0AIRMapMarker *marker = (ABI46_0_0AIRMapMarker *)evaluatedObject; - return [marker isKindOfClass:[ABI46_0_0AIRMapMarker class]]; - }]; - NSArray *filteredMarkers = [self.annotations filteredArrayUsingPredicate:filterMarkers]; - return filteredMarkers; -} - -- (ABI46_0_0AIRMapMarker*) markerForCallout:(ABI46_0_0AIRMapCallout*)callout { - ABI46_0_0AIRMapMarker* marker = nil; - NSArray* markers = [self markers]; - for (ABI46_0_0AIRMapMarker* mrk in markers) { - if (mrk.calloutView == callout) { - marker = mrk; - break; - } - } - return marker; -} - -- (CGRect) frameForMarker:(ABI46_0_0AIRMapMarker*) mrkAnn { - MKAnnotationView* mrkView = [self viewForAnnotation: mrkAnn]; - CGRect mrkFrame = mrkView.frame; - return mrkFrame; -} - -- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible { - NSMutableDictionary* markersFrames = [NSMutableDictionary new]; - for (ABI46_0_0AIRMapMarker* mrkAnn in self.markers) { - CGRect frame = [self frameForMarker:mrkAnn]; - CGPoint point = [self convertCoordinate:mrkAnn.coordinate toPointToView:self]; - NSDictionary* frameDict = @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height) - }; - NSDictionary* pointDict = @{ - @"x": @(point.x), - @"y": @(point.y) - }; - NSString* k = mrkAnn.identifier; - BOOL isVisible = CGRectIntersectsRect(self.bounds, frame); - if (k != nil && (!onlyVisible || isVisible)) { - [markersFrames setObject:@{ @"frame": frameDict, @"point": pointDict } forKey:k]; - } - } - return markersFrames; -} - -- (ABI46_0_0AIRMapMarker*) markerAtPoint:(CGPoint)point { - ABI46_0_0AIRMapMarker* mrk = nil; - for (ABI46_0_0AIRMapMarker* mrkAnn in self.markers) { - CGRect frame = [self frameForMarker:mrkAnn]; - if (CGRectContainsPoint(frame, point)) { - mrk = mrkAnn; - break; - } - } - return mrk; -} - -#pragma mark Overrides for Callout behavior - -// override UIGestureRecognizer's delegate method so we can prevent MKMapView's recognizer from firing -// when we interact with UIControl subclasses inside our callout view. -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch { - if ([touch.view isDescendantOfView:self.calloutView]) - return NO; - else - return [super gestureRecognizer:gestureRecognizer shouldReceiveTouch:touch]; -} - - -// Allow touches to be sent to our calloutview. -// See this for some discussion of why we need to override this: https://github.com/nfarina/calloutview/pull/9 -- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { - - CGPoint touchPoint = [self.calloutView convertPoint:point fromView:self]; - UIView *touchedView = [self.calloutView hitTest:touchPoint withEvent:event]; - - if (touchedView) { - UIWindow* win = [[[UIApplication sharedApplication] windows] firstObject]; - ABI46_0_0AIRMapCalloutSubview* calloutSubview = nil; - ABI46_0_0AIRMapCallout* callout = nil; - ABI46_0_0AIRMapMarker* marker = nil; - - UIView* tmp = touchedView; - while (tmp && tmp != win && tmp != self.calloutView) { - if ([tmp respondsToSelector:@selector(onPress)]) { - calloutSubview = (ABI46_0_0AIRMapCalloutSubview*) tmp; - } - if ([tmp isKindOfClass:[ABI46_0_0AIRMapCallout class]]) { - callout = (ABI46_0_0AIRMapCallout*) tmp; - break; - } - tmp = tmp.superview; - } - - if (callout) { - marker = [self markerForCallout:callout]; - if (marker) { - CGPoint touchPointReal = [marker.calloutView convertPoint:point fromView:self]; - if (![callout isPointInside:touchPointReal]) { - return [super hitTest:point withEvent:event]; - } - } - } - - return calloutSubview ? calloutSubview : touchedView; - } - - return [super hitTest:point withEvent:event]; -} - -#pragma mark ABI46_0_0SMCalloutViewDelegate - -- (NSTimeInterval)calloutView:(ABI46_0_0SMCalloutView *)calloutView delayForRepositionWithSize:(CGSize)offset { - - // When the callout is being asked to present in a way where it or its target will be partially offscreen, it asks us - // if we'd like to reposition our surface first so the callout is completely visible. Here we scroll the map into view, - // but it takes some math because we have to deal in lon/lat instead of the given offset in pixels. - - CLLocationCoordinate2D coordinate = self.region.center; - - // where's the center coordinate in terms of our view? - CGPoint center = [self convertCoordinate:coordinate toPointToView:self]; - - // move it by the requested offset - center.x -= offset.width; - center.y -= offset.height; - - // and translate it back into map coordinates - coordinate = [self convertPoint:center toCoordinateFromView:self]; - - // move the map! - [self setCenterCoordinate:coordinate animated:YES]; - - // tell the callout to wait for a while while we scroll (we assume the scroll delay for MKMapView matches UIScrollView) - return kSMCalloutViewRepositionDelayForUIScrollView; -} - -#pragma mark Accessors - -- (NSArray *)getMapBoundaries -{ - MKMapRect mapRect = self.visibleMapRect; - - CLLocationCoordinate2D northEast = MKCoordinateForMapPoint(MKMapPointMake(MKMapRectGetMaxX(mapRect), mapRect.origin.y)); - CLLocationCoordinate2D southWest = MKCoordinateForMapPoint(MKMapPointMake(mapRect.origin.x, MKMapRectGetMaxY(mapRect))); - - return @[ - @[ - [NSNumber numberWithDouble:northEast.longitude], - [NSNumber numberWithDouble:northEast.latitude] - ], - @[ - [NSNumber numberWithDouble:southWest.longitude], - [NSNumber numberWithDouble:southWest.latitude] - ] - ]; -} - -- (void)setShowsUserLocation:(BOOL)showsUserLocation -{ - if (self.showsUserLocation != showsUserLocation) { - if (showsUserLocation && !_locationManager) { - _locationManager = [CLLocationManager new]; - if ([_locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)]) { - [_locationManager requestWhenInUseAuthorization]; - } - } - super.showsUserLocation = showsUserLocation; - } -} - -- (void)setUserInterfaceStyle:(NSString*)userInterfaceStyle -{ - if (@available(iOS 13.0, *)) { - if([userInterfaceStyle isEqualToString:@"light"]) { - self.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; - } else if([userInterfaceStyle isEqualToString:@"dark"]) { - self.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; - } else { - self.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified; - } - } else { - NSLog(@"UserInterfaceStyle not supported below iOS 13"); - } -} - -- (void)setTintColor:(UIColor *)tintColor -{ - super.tintColor = tintColor; -} - -- (void)setFollowsUserLocation:(BOOL)followsUserLocation -{ - _followUserLocation = followsUserLocation; -} - -- (void)setUserLocationCalloutEnabled:(BOOL)calloutEnabled -{ - _userLocationCalloutEnabled = calloutEnabled; -} - -- (void)setHandlePanDrag:(BOOL)handleMapDrag { - for (UIGestureRecognizer *recognizer in [self gestureRecognizers]) { - if ([recognizer isKindOfClass:[UIPanGestureRecognizer class]]) { - recognizer.enabled = handleMapDrag; - break; - } - } -} - -- (void)setRegion:(MKCoordinateRegion)region animated:(BOOL)animated -{ - // If location is invalid, abort - if (!CLLocationCoordinate2DIsValid(region.center)) { - return; - } - - // If new span values are nil, use old values instead - if (!region.span.latitudeDelta) { - region.span.latitudeDelta = self.region.span.latitudeDelta; - } - if (!region.span.longitudeDelta) { - region.span.longitudeDelta = self.region.span.longitudeDelta; - } - - // Animate/move to new position - [super setRegion:region animated:animated]; -} - -- (void)setInitialRegion:(MKCoordinateRegion)initialRegion { - if (!_initialRegionSet) { - _initialRegionSet = YES; - [self setRegion:initialRegion animated:NO]; - } -} - -- (void)setCamera:(MKMapCamera*)camera animated:(BOOL)animated -{ - [super setCamera:camera animated:animated]; -} - - -- (void)setInitialCamera:(MKMapCamera*)initialCamera { - if (!_initialCameraSet) { - _initialCameraSet = YES; - [self setCamera:initialCamera animated:NO]; - } -} - -- (void)setCacheEnabled:(BOOL)cacheEnabled { - _cacheEnabled = cacheEnabled; - if (self.cacheEnabled && self.cacheImageView.image == nil) { - self.loadingView.hidden = NO; - [self.activityIndicatorView startAnimating]; - } - else { - if (_loadingView != nil) { - self.loadingView.hidden = YES; - } - } -} - -- (void)setLoadingEnabled:(BOOL)loadingEnabled { - _loadingEnabled = loadingEnabled; - if (!self.hasShownInitialLoading) { - self.loadingView.hidden = !self.loadingEnabled; - } - else { - if (_loadingView != nil) { - self.loadingView.hidden = YES; - } - } -} - -- (UIColor *)loadingBackgroundColor { - return self.loadingView.backgroundColor; -} - -- (void)setLoadingBackgroundColor:(UIColor *)loadingBackgroundColor { - self.loadingView.backgroundColor = loadingBackgroundColor; -} - -- (UIColor *)loadingIndicatorColor { - return self.activityIndicatorView.color; -} - -- (void)setLoadingIndicatorColor:(UIColor *)loadingIndicatorColor { - self.activityIndicatorView.color = loadingIndicatorColor; -} - -// Include properties of MKMapView which are only available on iOS 9+ -// and check if their selector is available before calling super method. - -- (void)setShowsCompass:(BOOL)showsCompass { - if ([MKMapView instancesRespondToSelector:@selector(setShowsCompass:)]) { - [super setShowsCompass:showsCompass]; - } -} - -- (BOOL)showsCompass { - if ([MKMapView instancesRespondToSelector:@selector(showsCompass)]) { - return [super showsCompass]; - } else { - return NO; - } -} - -- (void)setShowsScale:(BOOL)showsScale { - if ([MKMapView instancesRespondToSelector:@selector(setShowsScale:)]) { - [super setShowsScale:showsScale]; - } -} - -- (BOOL)showsScale { - if ([MKMapView instancesRespondToSelector:@selector(showsScale)]) { - return [super showsScale]; - } else { - return NO; - } -} - -- (void)setShowsTraffic:(BOOL)showsTraffic { - if ([MKMapView instancesRespondToSelector:@selector(setShowsTraffic:)]) { - [super setShowsTraffic:showsTraffic]; - } -} - -- (BOOL)showsTraffic { - if ([MKMapView instancesRespondToSelector:@selector(showsTraffic)]) { - return [super showsTraffic]; - } else { - return NO; - } -} - -- (void)setScrollEnabled:(BOOL)scrollEnabled { - self.shouldScrollEnabled = [NSNumber numberWithBool:scrollEnabled]; - [self updateScrollEnabled]; -} - -- (void)updateScrollEnabled { - if (self.cacheEnabled) { - [super setScrollEnabled:NO]; - } - else if (self.shouldScrollEnabled != nil) { - [super setScrollEnabled:[self.shouldScrollEnabled boolValue]]; - } -} - -- (void)setZoomEnabled:(BOOL)zoomEnabled { - self.shouldZoomEnabled = [NSNumber numberWithBool:zoomEnabled]; - [self updateZoomEnabled]; -} - -- (void)updateZoomEnabled { - if (self.cacheEnabled) { - [super setZoomEnabled: NO]; - } - else if (self.shouldZoomEnabled != nil) { - [super setZoomEnabled:[self.shouldZoomEnabled boolValue]]; - } -} - -- (void)cacheViewIfNeeded { - // https://github.com/ABI46_0_0React-native-maps/ABI46_0_0React-native-maps/issues/3100 - // Do nothing if app is not active - if ([[UIApplication sharedApplication] applicationState] != UIApplicationStateActive) { - return; - } - if (self.hasShownInitialLoading) { - if (!self.cacheEnabled) { - if (_cacheImageView != nil) { - self.cacheImageView.hidden = YES; - self.cacheImageView.image = nil; - } - } - else { - self.cacheImageView.image = nil; - self.cacheImageView.hidden = YES; - - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.01 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ - self.cacheImageView.image = nil; - self.cacheImageView.hidden = YES; - UIGraphicsBeginImageContextWithOptions(self.bounds.size, self.opaque, 0.0); - [self.layer renderInContext:UIGraphicsGetCurrentContext()]; - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - self.cacheImageView.image = image; - self.cacheImageView.hidden = NO; - }); - } - - [self updateScrollEnabled]; - [self updateZoomEnabled]; - [self updateLegalLabelInsets]; - } -} - -- (void)updateLegalLabelInsets { - if (_legalLabel) { - dispatch_async(dispatch_get_main_queue(), ^{ - CGRect frame = self->_legalLabel.frame; - if (self->_legalLabelInsets.left) { - frame.origin.x = self->_legalLabelInsets.left; - } else if (self->_legalLabelInsets.right) { - frame.origin.x = self.frame.size.width - self->_legalLabelInsets.right - frame.size.width; - } - if (self->_legalLabelInsets.top) { - frame.origin.y = self->_legalLabelInsets.top; - } else if (self->_legalLabelInsets.bottom) { - frame.origin.y = self.frame.size.height - self->_legalLabelInsets.bottom - frame.size.height; - } - self->_legalLabel.frame = frame; - }); - } -} - - -- (void)setLegalLabelInsets:(UIEdgeInsets)legalLabelInsets { - _legalLabelInsets = legalLabelInsets; - [self updateLegalLabelInsets]; -} - -- (void)setMapPadding:(UIEdgeInsets)mapPadding { - self.layoutMargins = mapPadding; -} - -- (UIEdgeInsets)mapPadding { - return self.layoutMargins; -} - -- (void)beginLoading { - if ((!self.hasShownInitialLoading && self.loadingEnabled) || (self.cacheEnabled && self.cacheImageView.image == nil)) { - self.loadingView.hidden = NO; - [self.activityIndicatorView startAnimating]; - } - else { - if (_loadingView != nil) { - self.loadingView.hidden = YES; - } - } -} - -- (void)finishLoading { - self.hasShownInitialLoading = YES; - if (_loadingView != nil) { - self.loadingView.hidden = YES; - } - [self cacheViewIfNeeded]; -} - -- (UIActivityIndicatorView *)activityIndicatorView { - if (_activityIndicatorView == nil) { - _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; - _activityIndicatorView.center = self.loadingView.center; - _activityIndicatorView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin; - _activityIndicatorView.color = [UIColor colorWithRed:96.f/255.f green:96.f/255.f blue:96.f/255.f alpha:1.f]; // defaults to #606060 - } - [self.loadingView addSubview:_activityIndicatorView]; - return _activityIndicatorView; -} - -- (UIView *)loadingView { - if (_loadingView == nil) { - _loadingView = [[UIView alloc] initWithFrame:self.bounds]; - _loadingView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; - _loadingView.backgroundColor = [UIColor whiteColor]; // defaults to #FFFFFF - [self addSubview:_loadingView]; - _loadingView.hidden = NO; - } - return _loadingView; -} - -- (UIImageView *)cacheImageView { - if (_cacheImageView == nil) { - _cacheImageView = [[UIImageView alloc] initWithFrame:self.bounds]; - _cacheImageView.contentMode = UIViewContentModeCenter; - _cacheImageView.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleHeight; - [self addSubview:self.cacheImageView]; - _cacheImageView.hidden = YES; - } - return _cacheImageView; -} - -- (void)layoutSubviews { - [super layoutSubviews]; - [self cacheViewIfNeeded]; - NSUInteger index = [[self subviews] indexOfObjectPassingTest:^BOOL(__kindof UIView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { - NSString *str = NSStringFromClass([obj class]); - return [str containsString:@"MKCompassView"]; - }]; - if (index != NSNotFound) { - UIView* compassButton; - compassButton = [self.subviews objectAtIndex:index]; - compassButton.frame = CGRectMake(compassButton.frame.origin.x + _compassOffset.x, compassButton.frame.origin.y + _compassOffset.y, compassButton.frame.size.width, compassButton.frame.size.height); - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.h deleted file mode 100644 index 5857982f16ef75..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import -#import - - -@interface ABI46_0_0AIRMapCallout : ABI46_0_0RCTView - -@property (nonatomic, assign) BOOL tooltip; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, assign) BOOL alphaHitTest; - -- (BOOL) isPointInside:(CGPoint)pointInCallout; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.m deleted file mode 100644 index 3be0d34f2590e7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCallout.m +++ /dev/null @@ -1,30 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0AIRMapCallout.h" - - -@implementation ABI46_0_0AIRMapCallout - -- (BOOL) isPointInside:(CGPoint)pointInCallout { - if (!self.alphaHitTest) - return TRUE; - CGFloat alpha = [self alphaOfPoint:pointInCallout]; - return alpha >= 0.01; -} - -- (CGFloat) alphaOfPoint:(CGPoint)point { - unsigned char pixel[4] = {0}; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGContextRef context = CGBitmapContextCreate(pixel, 1, 1, 8, 4, colorSpace, kCGBitmapAlphaInfoMask & kCGImageAlphaPremultipliedLast); - CGContextTranslateCTM(context, -point.x, -point.y); - [self.layer renderInContext:context]; - CGContextRelease(context); - CGColorSpaceRelease(colorSpace); - return pixel[3]/255.0; -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.h deleted file mode 100644 index b43554cf56ca3b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - - -@interface ABI46_0_0AIRMapCalloutManager : ABI46_0_0RCTViewManager -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.m deleted file mode 100644 index 95e562d5db13f1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutManager.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapCalloutManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapCallout.h" - -@interface ABI46_0_0AIRMapCalloutManager() - -@end - -@implementation ABI46_0_0AIRMapCalloutManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ABI46_0_0AIRMapCallout new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tooltip, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(alphaHitTest, BOOL) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.h deleted file mode 100644 index f7fee52c7114fc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRMapCalloutSubview.h -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#import -#import - -@interface ABI46_0_0AIRMapCalloutSubview : UIView -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.m deleted file mode 100644 index c34267a4f36d15..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubview.m +++ /dev/null @@ -1,15 +0,0 @@ -// -// ABI46_0_0AIRMapCalloutSubview.m -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#import "ABI46_0_0AIRMapCalloutSubview.h" -#import -#import -#import - -@implementation ABI46_0_0AIRMapCalloutSubview -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.h deleted file mode 100644 index fa74379eadd823..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ABI46_0_0AIRMapCalloutSubviewManager.h -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#import - -@interface ABI46_0_0AIRMapCalloutSubviewManager : ABI46_0_0RCTViewManager - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.m deleted file mode 100644 index 4e5c1c7552cf08..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCalloutSubviewManager.m +++ /dev/null @@ -1,24 +0,0 @@ -// -// ABI46_0_0AIRMapCalloutSubviewManager.m -// AirMaps -// -// Created by Denis Oblogin on 10/8/18. -// -// - -#import "ABI46_0_0AIRMapCalloutSubviewManager.h" -#import "ABI46_0_0AIRMapCalloutSubview.h" -#import - -@implementation ABI46_0_0AIRMapCalloutSubviewManager -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapCalloutSubview *calloutSubview = [ABI46_0_0AIRMapCalloutSubview new]; - return calloutSubview; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.h deleted file mode 100644 index a78c14a37e4c4d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - -#import -#import - -#import -#import - -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - -@interface ABI46_0_0AIRMapCircle: MKAnnotationView - -@property (nonatomic, weak) ABI46_0_0AIRMap *map; - -@property (nonatomic, strong) MKCircle *circle; -@property (nonatomic, strong) MKCircleRenderer *renderer; - -@property (nonatomic, assign) CLLocationCoordinate2D centerCoordinate; -@property (nonatomic, assign) CLLocationDistance radius; - -@property (nonatomic, strong) UIColor *fillColor; -@property (nonatomic, strong) UIColor *strokeColor; -@property (nonatomic, assign) CGFloat strokeWidth; -@property (nonatomic, assign) CGFloat miterLimit; -@property (nonatomic, assign) CGLineCap lineCap; -@property (nonatomic, assign) CGLineJoin lineJoin; -@property (nonatomic, assign) CGFloat lineDashPhase; -@property (nonatomic, strong) NSArray *lineDashPattern; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.m deleted file mode 100644 index 53b74779ffe09d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircle.m +++ /dev/null @@ -1,169 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0AIRMapCircle.h" -#import - - -@implementation ABI46_0_0AIRMapCircle { - BOOL _radiusSet; - BOOL _centerSet; -} - -- (void)setFillColor:(UIColor *)fillColor { - _fillColor = fillColor; - [self update]; -} - -- (void)setStrokeColor:(UIColor *)strokeColor { - _strokeColor = strokeColor; - [self update]; -} - -- (void)setStrokeWidth:(CGFloat)strokeWidth { - _strokeWidth = strokeWidth; - [self update]; -} - -- (void)setLineJoin:(CGLineJoin)lineJoin { - _lineJoin = lineJoin; - [self update]; -} - -- (void)setLineCap:(CGLineCap)lineCap { - _lineCap = lineCap; - [self update]; -} - -- (void)setMiterLimit:(CGFloat)miterLimit { - _miterLimit = miterLimit; - [self update]; -} - -- (void)setLineDashPhase:(CGFloat)lineDashPhase { - _lineDashPhase = lineDashPhase; - [self update]; -} - -- (void)setLineDashPattern:(NSArray *)lineDashPattern { - _lineDashPattern = lineDashPattern; - [self update]; -} - -- (void)setRadius:(CLLocationDistance)radius { - _radius = radius; - _radiusSet = YES; - [self createCircleAndRendererIfPossible]; - [self update]; -} - -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate{ - _centerCoordinate = centerCoordinate; - _centerSet = YES; - [self createCircleAndRendererIfPossible]; - [self update]; -} - -- (void) createCircleAndRendererIfPossible -{ - if (!_centerSet || !_radiusSet) return; - self.circle = [MKCircle circleWithCenterCoordinate:_centerCoordinate radius:_radius]; - self.renderer = [[MKCircleRenderer alloc] initWithCircle:self.circle]; -} - -- (void) update -{ - if (!_renderer) return; - _renderer.fillColor = _fillColor; - _renderer.strokeColor = _strokeColor; - _renderer.lineWidth = _strokeWidth; - _renderer.lineCap = _lineCap; - _renderer.lineJoin = _lineJoin; - _renderer.miterLimit = _miterLimit; - _renderer.lineDashPhase = _lineDashPhase; - _renderer.lineDashPattern = _lineDashPattern; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self]; -} - - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D) coordinate -{ - return self.circle.coordinate; -} - -- (MKMapRect) boundingMapRect -{ - return self.circle.boundingMapRect; -} - -- (BOOL)intersectsMapRect:(MKMapRect)mapRect -{ - BOOL answer = [self.circle intersectsMapRect:mapRect]; - return answer; -} - -- (BOOL)canReplaceMapContent -{ - return NO; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.h deleted file mode 100644 index c59722a8c619fc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - - -@interface ABI46_0_0AIRMapCircleManager : ABI46_0_0RCTViewManager -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.m deleted file mode 100644 index 6fd4220c10e436..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCircleManager.m +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapCircleManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapCircle.h" - -@interface ABI46_0_0AIRMapCircleManager() - -@end - -@implementation ABI46_0_0AIRMapCircleManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapCircle *circle = [ABI46_0_0AIRMapCircle new]; - return circle; -} - -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(center, centerCoordinate, CLLocationCoordinate2D) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(radius, CLLocationDistance) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineCap, CGLineCap) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineJoin, CGLineJoin) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(miterLimit, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPhase, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray) - -// NOTE(lmr): -// for now, onPress events for overlays will be left unimplemented. Seems it is possible with some work, but -// it is difficult to achieve in both ios and android so I decided to leave it out. -//ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.h deleted file mode 100644 index 9832c4bfe0d03c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import -#import - -@interface ABI46_0_0AIRMapCoordinate : NSObject - -@property (nonatomic, assign) CLLocationCoordinate2D coordinate; - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.m deleted file mode 100644 index 41ef494814b4ca..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapCoordinate.m +++ /dev/null @@ -1,12 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0AIRMapCoordinate.h" - - -@implementation ABI46_0_0AIRMapCoordinate { - -} -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.h deleted file mode 100644 index 3baa11fe126e77..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.h +++ /dev/null @@ -1,36 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTile.h -// AirMaps -// -// Created by Peter Zavadsky on 01/12/2017. -// Copyright © 2017 Christopher. All rights reserved. -// - -#import -#import -#import - -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - -@interface ABI46_0_0AIRMapLocalTile : MKAnnotationView - -@property (nonatomic, weak) ABI46_0_0AIRMap *map; - -@property (nonatomic, strong) MKTileOverlay *tileOverlay; -@property (nonatomic, strong) MKTileOverlayRenderer *renderer; - -@property (nonatomic, copy) NSString *pathTemplate; -@property (nonatomic, assign) CGFloat tileSize; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -//- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.m deleted file mode 100644 index 380dbd5f6f3165..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTile.m +++ /dev/null @@ -1,68 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTile.m -// AirMaps -// -// Created by Peter Zavadsky on 01/12/2017. -// Copyright © 2017 Christopher. All rights reserved. -// - -#import "ABI46_0_0AIRMapLocalTile.h" -#import -#import "ABI46_0_0AIRMapLocalTileOverlay.h" - -@implementation ABI46_0_0AIRMapLocalTile { - BOOL _pathTemplateSet; - BOOL _tileSizeSet; -} - - -- (void)setPathTemplate:(NSString *)pathTemplate{ - _pathTemplate = pathTemplate; - _pathTemplateSet = YES; - [self createTileOverlayAndRendererIfPossible]; - [self update]; -} - -- (void)setTileSize:(CGFloat)tileSize{ - _tileSize = tileSize; - _tileSizeSet = YES; - [self createTileOverlayAndRendererIfPossible]; - [self update]; -} - -- (void) createTileOverlayAndRendererIfPossible -{ - if (!_pathTemplateSet || !_tileSizeSet) return; - self.tileOverlay = [[ABI46_0_0AIRMapLocalTileOverlay alloc] initWithURLTemplate:self.pathTemplate]; - self.tileOverlay.canReplaceMapContent = YES; - self.tileOverlay.tileSize = CGSizeMake(_tileSize, _tileSize); - self.renderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:self.tileOverlay]; -} - -- (void) update -{ - if (!_renderer) return; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self level:MKOverlayLevelAboveLabels]; -} - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D) coordinate -{ - return self.tileOverlay.coordinate; -} - -- (MKMapRect) boundingMapRect -{ - return self.tileOverlay.boundingMapRect; -} - -- (BOOL)canReplaceMapContent -{ - return self.tileOverlay.canReplaceMapContent; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.h deleted file mode 100644 index 84788b487b9520..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.h +++ /dev/null @@ -1,13 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTileManager.h -// AirMaps -// -// Created by Peter Zavadsky on 01/12/2017. -// Copyright © 2017 Christopher. All rights reserved. -// - -#import - -@interface ABI46_0_0AIRMapLocalTileManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.m deleted file mode 100644 index cde8d786414a17..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileManager.m +++ /dev/null @@ -1,38 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTileManager.m -// AirMaps -// -// Created by Peter Zavadsky on 01/12/2017. -// Copyright © 2017 Christopher. All rights reserved. -// - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapLocalTile.h" - -#import "ABI46_0_0AIRMapLocalTileManager.h" - -@interface ABI46_0_0AIRMapLocalTileManager() - -@end - -@implementation ABI46_0_0AIRMapLocalTileManager - - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapLocalTile *tile = [ABI46_0_0AIRMapLocalTile new]; - return tile; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pathTemplate, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileSize, CGFloat) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.h deleted file mode 100644 index 7fda6f38ff80b3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.h +++ /dev/null @@ -1,12 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTileOverlay.h -// Pods -// -// Created by Peter Zavadsky on 04/12/2017. -// - -#import - -@interface ABI46_0_0AIRMapLocalTileOverlay : MKTileOverlay - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.m deleted file mode 100644 index 42fa7038da9cae..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapLocalTileOverlay.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// ABI46_0_0AIRMapLocalTileOverlay.m -// Pods-AirMapsExplorer -// -// Created by Peter Zavadsky on 04/12/2017. -// - -#import "ABI46_0_0AIRMapLocalTileOverlay.h" - -@interface ABI46_0_0AIRMapLocalTileOverlay () - -@end - -@implementation ABI46_0_0AIRMapLocalTileOverlay - - --(void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result { - NSMutableString *tileFilePath = [self.URLTemplate mutableCopy]; - [tileFilePath replaceOccurrencesOfString: @"{x}" withString:[NSString stringWithFormat:@"%li", (long)path.x] options:0 range:NSMakeRange(0, tileFilePath.length)]; - [tileFilePath replaceOccurrencesOfString:@"{y}" withString:[NSString stringWithFormat:@"%li", (long)path.y] options:0 range:NSMakeRange(0, tileFilePath.length)]; - [tileFilePath replaceOccurrencesOfString:@"{z}" withString:[NSString stringWithFormat:@"%li", (long)path.z] options:0 range:NSMakeRange(0, tileFilePath.length)]; - if ([[NSFileManager defaultManager] fileExistsAtPath:tileFilePath]) { - NSData* tile = [NSData dataWithContentsOfFile:tileFilePath]; - result(tile,nil); - } else { - result(nil, nil); - } -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.h deleted file mode 100644 index 8603026ac10aca..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import "ABI46_0_0AIRMap.h" - -#define MERCATOR_RADIUS 85445659.44705395 -#define MERCATOR_OFFSET 268435456 - -@interface ABI46_0_0AIRMapManager : ABI46_0_0RCTViewManager - - -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate - zoomLevel:(double)zoomLevel - animated:(BOOL)animated - mapView:(ABI46_0_0AIRMap *)mapView; - -- (MKCoordinateRegion)coordinateRegionWithMapView:(ABI46_0_0AIRMap *)mapView - centerCoordinate:(CLLocationCoordinate2D)centerCoordinate - andZoomLevel:(double)zoomLevel; -- (double) zoomLevel:(ABI46_0_0AIRMap *)mapView; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.m deleted file mode 100644 index 55807c7427ed8f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapManager.m +++ /dev/null @@ -1,1391 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapManager.h" - -#import -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapPolyline.h" -#import "ABI46_0_0AIRMapPolygon.h" -#import "ABI46_0_0AIRMapCircle.h" -#import "ABI46_0_0SMCalloutView.h" -#import "ABI46_0_0AIRMapUrlTile.h" -#import "ABI46_0_0AIRMapWMSTile.h" -#import "ABI46_0_0AIRMapLocalTile.h" -#import "ABI46_0_0AIRMapSnapshot.h" -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapOverlay.h" -#import "ABI46_0_0AIRWeakTimerReference.h" -#import "ABI46_0_0AIRWeakMapReference.h" -#import - -static NSString *const ABI46_0_0RCTMapViewKey = @"MapView"; - - -@interface ABI46_0_0AIRMapManager() - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; - -@end - -@implementation ABI46_0_0AIRMapManager{ - BOOL _hasObserver; -} - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMap *map = [ABI46_0_0AIRMap new]; - map.delegate = self; - - map.isAccessibilityElement = NO; - map.accessibilityElementsHidden = NO; - - // MKMapView doesn't report tap events, so we attach gesture recognizers to it - UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapTap:)]; - UITapGestureRecognizer *doubleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDoubleTap:)]; - [doubleTap setNumberOfTapsRequired:2]; - [tap requireGestureRecognizerToFail:doubleTap]; - - UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapLongPress:)]; - UIPanGestureRecognizer *drag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDrag:)]; - [drag setMinimumNumberOfTouches:1]; - // setting this to NO allows the parent MapView to continue receiving marker selection events - tap.cancelsTouchesInView = NO; - doubleTap.cancelsTouchesInView = NO; - longPress.cancelsTouchesInView = NO; - - doubleTap.delegate = self; - - // disable drag by default - drag.enabled = NO; - drag.delegate = self; - - [map addGestureRecognizer:tap]; - [map addGestureRecognizer:doubleTap]; - [map addGestureRecognizer:longPress]; - [map addGestureRecognizer:drag]; - - return map; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(userLocationAnnotationTitle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(userInterfaceStyle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(followsUserLocation, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(userLocationCalloutEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cacheEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(loadingEnabled, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(loadingBackgroundColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(loadingIndicatorColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(handlePanDrag, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minDelta, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(compassOffset, CGPoint) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMapReady, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPanDrag, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLongPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDoublePress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerDeselect, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerDragStart, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerDrag, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMarkerDragEnd, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCalloutPress, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(initialRegion, MKCoordinateRegion, ABI46_0_0AIRMap) -{ - if (json == nil) return; - - // don't emit region change events when we are setting the initialRegion - BOOL originalIgnore = view.ignoreRegionChanges; - view.ignoreRegionChanges = YES; - [view setInitialRegion:[ABI46_0_0RCTConvert MKCoordinateRegion:json]]; - view.ignoreRegionChanges = originalIgnore; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(initialCamera, MKMapCamera, ABI46_0_0AIRMap) -{ - if (json == nil) return; - - // don't emit region change events when we are setting the initialCamera - BOOL originalIgnore = view.ignoreRegionChanges; - view.ignoreRegionChanges = YES; - [view setInitialCamera:[ABI46_0_0RCTConvert MKMapCamera:json]]; - view.ignoreRegionChanges = originalIgnore; -} - - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat) - - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, ABI46_0_0AIRMap) -{ - if (json == nil) return; - - // don't emit region change events when we are setting the region - BOOL originalIgnore = view.ignoreRegionChanges; - view.ignoreRegionChanges = YES; - [view setRegion:[ABI46_0_0RCTConvert MKCoordinateRegion:json] animated:NO]; - view.ignoreRegionChanges = originalIgnore; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(camera, MKMapCamera*, ABI46_0_0AIRMap) -{ - if (json == nil) return; - - // don't emit region change events when we are setting the camera - BOOL originalIgnore = view.ignoreRegionChanges; - view.ignoreRegionChanges = YES; - [view setCamera:[ABI46_0_0RCTConvert MKMapCamera:json] animated:NO]; - view.ignoreRegionChanges = originalIgnore; -} - - -#pragma mark exported MapView methods - -ABI46_0_0RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)ABI46_0_0ReactTag - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - NSArray *boundingBox = [view getMapBoundaries]; - - resolve(@{ - @"northEast" : @{ - @"longitude" : boundingBox[0][0], - @"latitude" : boundingBox[0][1] - }, - @"southWest" : @{ - @"longitude" : boundingBox[1][0], - @"latitude" : boundingBox[1][1] - } - }); - } - }]; -} - - - -ABI46_0_0RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view], NULL); - } else { - MKMapCamera *camera = [mapView camera]; - resolve(@{ - @"center": @{ - @"latitude": @(camera.centerCoordinate.latitude), - @"longitude": @(camera.centerCoordinate.longitude), - }, - @"pitch": @(camera.pitch), - @"heading": @(camera.heading), - @"altitude": @(camera.altitude), - }); - } - }]; -} - - -ABI46_0_0RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - camera:(id)json) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - - // Merge the changes given with the current camera - MKMapCamera *camera = [ABI46_0_0RCTConvert MKMapCameraWithDefaults:json existingCamera:[mapView camera]]; - - // don't emit region change events when we are setting the camera - BOOL originalIgnore = mapView.ignoreRegionChanges; - mapView.ignoreRegionChanges = YES; - [mapView setCamera:camera animated:NO]; - mapView.ignoreRegionChanges = originalIgnore; - } - }]; -} - - -ABI46_0_0RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)ABI46_0_0ReactTag - withCamera:(id)json - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - - // Merge the changes given with the current camera - MKMapCamera *camera = [ABI46_0_0RCTConvert MKMapCameraWithDefaults:json existingCamera:[mapView camera]]; - - // don't emit region change events when we are setting the camera - BOOL originalIgnore = mapView.ignoreRegionChanges; - mapView.ignoreRegionChanges = YES; - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [mapView setCamera:camera animated:YES]; - } completion:^(BOOL finished){ - mapView.ignoreRegionChanges = originalIgnore; - }]; - } - }]; -} - - -ABI46_0_0RCT_EXPORT_METHOD(animateToNavigation:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(MKCoordinateRegion)region - withBearing:(CGFloat)bearing - withAngle:(double)angle - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - MKMapCamera *mapCamera = [[mapView camera] copy]; - [mapCamera setPitch:angle]; - [mapCamera setHeading:bearing]; - - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [(ABI46_0_0AIRMap *)view setRegion:region animated:YES]; - [mapView setCamera:mapCamera animated:YES]; - }]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToRegion:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(MKCoordinateRegion)region - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [(ABI46_0_0AIRMap *)view setRegion:region animated:YES]; - }]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToCoordinate:(nonnull NSNumber *)ABI46_0_0ReactTag - withRegion:(CLLocationCoordinate2D)latlng - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - MKCoordinateRegion region; - region.span = mapView.region.span; - region.center = latlng; - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [mapView setRegion:region animated:YES]; - }]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToViewingAngle:(nonnull NSNumber *)ABI46_0_0ReactTag - withAngle:(double)angle - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - - MKMapCamera *mapCamera = [[mapView camera] copy]; - [mapCamera setPitch:angle]; - - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [mapView setCamera:mapCamera animated:YES]; - }]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(animateToBearing:(nonnull NSNumber *)ABI46_0_0ReactTag - withBearing:(CGFloat)bearing - withDuration:(CGFloat)duration) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - - MKMapCamera *mapCamera = [[mapView camera] copy]; - [mapCamera setHeading:bearing]; - - [ABI46_0_0AIRMap animateWithDuration:duration/1000 animations:^{ - [mapView setCamera:mapCamera animated:YES]; - }]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)ABI46_0_0ReactTag - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - // TODO(lmr): we potentially want to include overlays here... and could concat the two arrays together. - dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.1 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ - [mapView showAnnotations:mapView.annotations animated:animated]; - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToSuppliedMarkers:(nonnull NSNumber *)ABI46_0_0ReactTag - markers:(nonnull NSArray *)markers - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - // TODO(lmr): we potentially want to include overlays here... and could concat the two arrays together. - // id annotations = mapView.annotations; - - NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) { - ABI46_0_0AIRMapMarker *marker = (ABI46_0_0AIRMapMarker *)evaluatedObject; - return [marker isKindOfClass:[ABI46_0_0AIRMapMarker class]] && [markers containsObject:marker.identifier]; - }]; - - NSArray *filteredMarkers = [mapView.annotations filteredArrayUsingPredicate:filterMarkers]; - - [mapView showAnnotations:filteredMarkers animated:animated]; - - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)ABI46_0_0ReactTag - coordinates:(nonnull NSArray *)coordinates - edgePadding:(nonnull NSDictionary *)edgePadding - animated:(BOOL)animated) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - - // Create Polyline with coordinates - CLLocationCoordinate2D coords[coordinates.count]; - for(int i = 0; i < coordinates.count; i++) - { - coords[i] = coordinates[i].coordinate; - } - MKPolyline *polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count]; - - // Set Map viewport - CGFloat top = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"top"]]; - CGFloat right = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"right"]]; - CGFloat bottom = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"bottom"]]; - CGFloat left = [ABI46_0_0RCTConvert CGFloat:edgePadding[@"left"]]; - - [mapView setVisibleMapRect:[polyline boundingMapRect] edgePadding:UIEdgeInsetsMake(top, left, bottom, right) animated:animated]; - - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)ABI46_0_0ReactTag - width:(nonnull NSNumber *)width - height:(nonnull NSNumber *)height - region:(MKCoordinateRegion)region - format:(nonnull NSString *)format - quality:(nonnull NSNumber *)quality - result:(nonnull NSString *)result - callback:(ABI46_0_0RCTResponseSenderBlock)callback) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - MKMapSnapshotOptions *options = [[MKMapSnapshotOptions alloc] init]; - - options.mapType = mapView.mapType; - options.region = (region.center.latitude && region.center.longitude) ? region : mapView.region; - options.size = CGSizeMake( - ([width floatValue] == 0) ? mapView.bounds.size.width : [width floatValue], - ([height floatValue] == 0) ? mapView.bounds.size.height : [height floatValue] - ); - options.scale = [[UIScreen mainScreen] scale]; - - MKMapSnapshotter *snapshotter = [[MKMapSnapshotter alloc] initWithOptions:options]; - - [self takeMapSnapshot:mapView - snapshotter:snapshotter - format:format - quality:quality.floatValue - result:result - callback:callback]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)ABI46_0_0ReactTag - coordinate: (NSDictionary *)coordinate - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view], NULL); - } else { - CGPoint touchPoint = [mapView convertCoordinate: - CLLocationCoordinate2DMake( - [coordinate[@"latitude"] doubleValue], - [coordinate[@"longitude"] doubleValue] - ) - toPointToView:mapView]; - - resolve(@{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getMarkersFrames:(nonnull NSNumber *)ABI46_0_0ReactTag - onlyVisible:(BOOL)onlyVisible - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view], NULL); - } else { - resolve([mapView getMarkersFramesWithOnlyVisible:onlyVisible]); - } - }]; -} - - - -ABI46_0_0RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)ABI46_0_0ReactTag - point:(NSDictionary *)point - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - ABI46_0_0AIRMap *mapView = (ABI46_0_0AIRMap *)view; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view], NULL); - } else { - CLLocationCoordinate2D coordinate = [mapView convertPoint: - CGPointMake( - [point[@"x"] doubleValue], - [point[@"y"] doubleValue] - ) - toCoordinateFromView:mapView]; - - resolve(@{ - @"latitude": @(coordinate.latitude), - @"longitude": @(coordinate.longitude), - }); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getAddressFromCoordinates:(nonnull NSNumber *)ABI46_0_0ReactTag - coordinate: (NSDictionary *)coordinate - resolver: (ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMap class]]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view], NULL); - } else { - if (coordinate == nil || - ![[coordinate allKeys] containsObject:@"latitude"] || - ![[coordinate allKeys] containsObject:@"longitude"]) { - reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid coordinate format"], NULL); - } - CLLocation *location = [[CLLocation alloc] initWithLatitude:[coordinate[@"latitude"] doubleValue] - longitude:[coordinate[@"longitude"] doubleValue]]; - CLGeocoder *geoCoder = [[CLGeocoder alloc] init]; - [geoCoder reverseGeocodeLocation:location - completionHandler:^(NSArray *placemarks, NSError *error) { - if (error == nil && [placemarks count] > 0){ - CLPlacemark *placemark = placemarks[0]; - resolve(@{ - @"name" : [NSString stringWithFormat:@"%@", placemark.name], - @"thoroughfare" : [NSString stringWithFormat:@"%@", placemark.thoroughfare], - @"subThoroughfare" : [NSString stringWithFormat:@"%@", placemark.subThoroughfare], - @"locality" : [NSString stringWithFormat:@"%@", placemark.locality], - @"subLocality" : [NSString stringWithFormat:@"%@", placemark.subLocality], - @"administrativeArea" : [NSString stringWithFormat:@"%@", placemark.administrativeArea], - @"subAdministrativeArea" : [NSString stringWithFormat:@"%@", placemark.subAdministrativeArea], - @"postalCode" : [NSString stringWithFormat:@"%@", placemark.postalCode], - @"countryCode" : [NSString stringWithFormat:@"%@", placemark.ISOcountryCode], - @"country" : [NSString stringWithFormat:@"%@", placemark.country], - }); - } else { - reject(@"Invalid argument", [NSString stringWithFormat:@"Can not get address location"], NULL); - } - }]; - } - }]; -} - -#pragma mark Take Snapshot -- (void)takeMapSnapshot:(ABI46_0_0AIRMap *)mapView - snapshotter:(MKMapSnapshotter *) snapshotter - format:(NSString *)format - quality:(CGFloat) quality - result:(NSString *)result - callback:(ABI46_0_0RCTResponseSenderBlock) callback { - NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970]; - NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format]; - NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent: pathComponent]; - - [snapshotter startWithQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - completionHandler:^(MKMapSnapshot *snapshot, NSError *error) { - if (error) { - callback(@[error]); - return; - } - MKAnnotationView *pin = [[MKPinAnnotationView alloc] initWithAnnotation:nil reuseIdentifier:nil]; - - UIImage *image = snapshot.image; - UIGraphicsBeginImageContextWithOptions(image.size, YES, image.scale); - { - [image drawAtPoint:CGPointMake(0.0f, 0.0f)]; - - CGRect rect = CGRectMake(0.0f, 0.0f, image.size.width, image.size.height); - - for (id overlay in mapView.overlays) { - if ([overlay respondsToSelector:@selector(drawToSnapshot:context:)]) { - [overlay drawToSnapshot:snapshot context:UIGraphicsGetCurrentContext()]; - } - } - - for (id annotation in mapView.annotations) { - CGPoint point = [snapshot pointForCoordinate:annotation.coordinate]; - - MKAnnotationView* anView = [mapView viewForAnnotation: annotation]; - - if (anView){ - pin = anView; - } - - if (CGRectContainsPoint(rect, point)) { - point.x = point.x + pin.centerOffset.x - (pin.bounds.size.width / 2.0f); - point.y = point.y + pin.centerOffset.y - (pin.bounds.size.height / 2.0f); - if (pin.image) { - [pin.image drawAtPoint:point]; - } else { - CGRect pinRect = CGRectMake(point.x, point.y, pin.bounds.size.width, pin.bounds.size.height); - [pin drawViewHierarchyInRect:pinRect afterScreenUpdates:NO]; - } - } - } - - UIImage *compositeImage = UIGraphicsGetImageFromCurrentImageContext(); - - NSData *data; - if ([format isEqualToString:@"png"]) { - data = UIImagePNGRepresentation(compositeImage); - } - else if([format isEqualToString:@"jpg"]) { - data = UIImageJPEGRepresentation(compositeImage, quality); - } - - if ([result isEqualToString:@"file"]) { - [data writeToFile:filePath atomically:YES]; - callback(@[[NSNull null], filePath]); - } - else if ([result isEqualToString:@"base64"]) { - callback(@[[NSNull null], [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn]]); - } - else if ([result isEqualToString:@"legacy"]) { - - // In the initial (iOS only) implementation of takeSnapshot, - // both the uri and the base64 encoded string were returned. - // Returning both is rarely useful and in fact causes a - // performance penalty when only the file URI is desired. - // In that case the base64 encoded string was always marshalled - // over the JS-bridge (which is quite slow). - // A new more flexible API was created to cover this. - // This code should be removed in a future release when the - // old API is fully deprecated. - [data writeToFile:filePath atomically:YES]; - NSDictionary *snapshotData = @{ - @"uri": filePath, - @"data": [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn] - }; - callback(@[[NSNull null], snapshotData]); - } - } - UIGraphicsEndImageContext(); - }]; -} - -#pragma mark Gesture Recognizer Handlers - -#define MAX_DISTANCE_PX 10.0f -- (void)handleMapTap:(UITapGestureRecognizer *)recognizer { - ABI46_0_0AIRMap *map = (ABI46_0_0AIRMap *)recognizer.view; - - CGPoint tapPoint = [recognizer locationInView:map]; - CLLocationCoordinate2D tapCoordinate = [map convertPoint:tapPoint toCoordinateFromView:map]; - MKMapPoint mapPoint = MKMapPointForCoordinate(tapCoordinate); - CGPoint mapPointAsCGP = CGPointMake(mapPoint.x, mapPoint.y); - - double maxMeters = [self metersFromPixel:MAX_DISTANCE_PX atPoint:tapPoint forMap:map]; - float nearestDistance = MAXFLOAT; - ABI46_0_0AIRMapPolyline *nearestPolyline = nil; - - for (id overlay in map.overlays) { - if([overlay isKindOfClass:[ABI46_0_0AIRMapPolygon class]]){ - ABI46_0_0AIRMapPolygon *polygon = (ABI46_0_0AIRMapPolygon*) overlay; - if (polygon.onPress) { - CGMutablePathRef mpr = CGPathCreateMutable(); - - for(int i = 0; i < polygon.coordinates.count; i++) { - ABI46_0_0AIRMapCoordinate *c = polygon.coordinates[i]; - MKMapPoint mp = MKMapPointForCoordinate(c.coordinate); - if (i == 0) { - CGPathMoveToPoint(mpr, NULL, mp.x, mp.y); - } else { - CGPathAddLineToPoint(mpr, NULL, mp.x, mp.y); - } - } - - if (CGPathContainsPoint(mpr, NULL, mapPointAsCGP, FALSE)) { - id event = @{ - @"action": @"polygon-press", - @"coordinate": @{ - @"latitude": @(tapCoordinate.latitude), - @"longitude": @(tapCoordinate.longitude), - }, - }; - polygon.onPress(event); - } - - CGPathRelease(mpr); - } - } - - if([overlay isKindOfClass:[ABI46_0_0AIRMapPolyline class]]){ - ABI46_0_0AIRMapPolyline *polyline = (ABI46_0_0AIRMapPolyline*) overlay; - if (polyline.onPress) { - float distance = [self distanceOfPoint:MKMapPointForCoordinate(tapCoordinate) - toPoly:polyline]; - if (distance < nearestDistance) { - nearestDistance = distance; - nearestPolyline = polyline; - } - } - } - - if ([overlay isKindOfClass:[ABI46_0_0AIRMapOverlay class]]) { - ABI46_0_0AIRMapOverlay *imageOverlay = (ABI46_0_0AIRMapOverlay*) overlay; - if (MKMapRectContainsPoint(imageOverlay.boundingMapRect, mapPoint)) { - if (imageOverlay.onPress) { - id event = @{ - @"action": @"image-overlay-press", - @"name": imageOverlay.name ?: @"unknown", - @"coordinate": @{ - @"latitude": @(imageOverlay.coordinate.latitude), - @"longitude": @(imageOverlay.coordinate.longitude) - } - }; - imageOverlay.onPress(event); - } - } - } - - } - - if (nearestDistance <= maxMeters) { - ABI46_0_0AIRMapCoordinate *firstCoord = nearestPolyline.coordinates.firstObject; - id event = @{ - @"action": @"polyline-press", - @"coordinate": @{ - @"latitude": @(firstCoord.coordinate.latitude), - @"longitude": @(firstCoord.coordinate.longitude) - } - }; - nearestPolyline.onPress(event); - } - - if (!map.onPress) return; - map.onPress(@{ - @"coordinate": @{ - @"latitude": @(tapCoordinate.latitude), - @"longitude": @(tapCoordinate.longitude), - }, - @"position": @{ - @"x": @(tapPoint.x), - @"y": @(tapPoint.y), - }, - }); - -} - -- (void)handleMapDrag:(UIPanGestureRecognizer*)recognizer { - ABI46_0_0AIRMap *map = (ABI46_0_0AIRMap *)recognizer.view; - if (!map.onPanDrag) return; - - CGPoint touchPoint = [recognizer locationInView:map]; - CLLocationCoordinate2D coord = [map convertPoint:touchPoint toCoordinateFromView:map]; - map.onPanDrag(@{ - @"coordinate": @{ - @"latitude": @(coord.latitude), - @"longitude": @(coord.longitude), - }, - @"position": @{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }, - }); - -} - -- (void)handleMapDoubleTap:(UIPanGestureRecognizer*)recognizer { - ABI46_0_0AIRMap *map = (ABI46_0_0AIRMap *)recognizer.view; - if (!map.onDoublePress) return; - - CGPoint touchPoint = [recognizer locationInView:map]; - CLLocationCoordinate2D coord = [map convertPoint:touchPoint toCoordinateFromView:map]; - map.onDoublePress(@{ - @"coordinate": @{ - @"latitude": @(coord.latitude), - @"longitude": @(coord.longitude), - }, - @"position": @{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }, - }); - -} - - -- (void)handleMapLongPress:(UITapGestureRecognizer *)recognizer { - - // NOTE: android only does the equivalent of "began", so we only send in this case - if (recognizer.state != UIGestureRecognizerStateBegan) return; - - ABI46_0_0AIRMap *map = (ABI46_0_0AIRMap *)recognizer.view; - if (!map.onLongPress) return; - - CGPoint touchPoint = [recognizer locationInView:map]; - CLLocationCoordinate2D coord = [map convertPoint:touchPoint toCoordinateFromView:map]; - - map.onLongPress(@{ - @"coordinate": @{ - @"latitude": @(coord.latitude), - @"longitude": @(coord.longitude), - }, - @"position": @{ - @"x": @(touchPoint.x), - @"y": @(touchPoint.y), - }, - }); -} - -#pragma mark MKMapViewDelegate - -#pragma mark Polyline stuff - -- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id )overlay{ - if ([overlay isKindOfClass:[ABI46_0_0AIRMapPolyline class]]) { - return ((ABI46_0_0AIRMapPolyline *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapPolygon class]]) { - return ((ABI46_0_0AIRMapPolygon *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapCircle class]]) { - return ((ABI46_0_0AIRMapCircle *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapUrlTile class]]) { - return ((ABI46_0_0AIRMapUrlTile *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapWMSTile class]]) { - return ((ABI46_0_0AIRMapWMSTile *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapLocalTile class]]) { - return ((ABI46_0_0AIRMapLocalTile *)overlay).renderer; - } else if ([overlay isKindOfClass:[ABI46_0_0AIRMapOverlay class]]) { - return ((ABI46_0_0AIRMapOverlay *)overlay).renderer; - } else if([overlay isKindOfClass:[MKTileOverlay class]]) { - return [[MKTileOverlayRenderer alloc] initWithTileOverlay:overlay]; - } else { - return nil; - } -} - - -#pragma mark Annotation Stuff - -- (void)mapView:(ABI46_0_0AIRMap *)mapView didAddAnnotationViews:(NSArray *)views -{ - if(!mapView.userLocationCalloutEnabled){ - for(MKAnnotationView* view in views){ - if ([view.annotation isKindOfClass:[MKUserLocation class]]){ - [view setEnabled:NO]; - [view setCanShowCallout:NO]; - break; - } - } - } -} - - -- (void)mapView:(ABI46_0_0AIRMap *)mapView didSelectAnnotationView:(MKAnnotationView *)view -{ - if ([view.annotation isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - [(ABI46_0_0AIRMapMarker *)view.annotation showCalloutView]; - } else if ([view.annotation isKindOfClass:[MKUserLocation class]] && mapView.userLocationAnnotationTitle != nil && view.annotation.title != mapView.userLocationAnnotationTitle) { - [(MKUserLocation*)view.annotation setTitle: mapView.userLocationAnnotationTitle]; - } - -} - -- (void)mapView:(ABI46_0_0AIRMap *)mapView didDeselectAnnotationView:(MKAnnotationView *)view { - if ([view.annotation isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - [(ABI46_0_0AIRMapMarker *)view.annotation hideCalloutView]; - } -} - -- (MKAnnotationView *)mapView:(__unused ABI46_0_0AIRMap *)mapView viewForAnnotation:(ABI46_0_0AIRMapMarker *)marker -{ - if (![marker isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - if ([marker isKindOfClass:[MKUserLocation class]] && mapView.userLocationAnnotationTitle != nil) { - [(MKUserLocation*)marker setTitle: mapView.userLocationAnnotationTitle]; - return nil; - } - return nil; - } - - marker.map = mapView; - return [marker getAnnotationView]; -} - -static int kDragCenterContext; - -- (void)mapView:(ABI46_0_0AIRMap *)mapView - annotationView:(MKAnnotationView *)view - didChangeDragState:(MKAnnotationViewDragState)newState - fromOldState:(MKAnnotationViewDragState)oldState -{ - if (![view.annotation isKindOfClass:[ABI46_0_0AIRMapMarker class]]) return; - ABI46_0_0AIRMapMarker *marker = (ABI46_0_0AIRMapMarker *)view.annotation; - - BOOL isPinView = [view isKindOfClass:[MKPinAnnotationView class]]; - - id event = @{ - @"id": marker.identifier ?: @"unknown", - @"coordinate": @{ - @"latitude": @(marker.coordinate.latitude), - @"longitude": @(marker.coordinate.longitude) - } - }; - - if (newState == MKAnnotationViewDragStateEnding || newState == MKAnnotationViewDragStateCanceling) { - if (!isPinView) { - [view setDragState:MKAnnotationViewDragStateNone animated:NO]; - } - if (mapView.onMarkerDragEnd) mapView.onMarkerDragEnd(event); - if (marker.onDragEnd) marker.onDragEnd(event); - - if(_hasObserver) [view removeObserver:self forKeyPath:@"center"]; - _hasObserver = NO; - } else if (newState == MKAnnotationViewDragStateStarting) { - // MapKit doesn't emit continuous drag events. To get around this, we are going to use KVO. - [view addObserver:self forKeyPath:@"center" options:NSKeyValueObservingOptionNew context:&kDragCenterContext]; - _hasObserver = YES; - if (mapView.onMarkerDragStart) mapView.onMarkerDragStart(event); - if (marker.onDragStart) marker.onDragStart(event); - } -} - -- (void)observeValueForKeyPath:(NSString *)keyPath - ofObject:(id)object - change:(NSDictionary *)change - context:(void *)context -{ - if ([keyPath isEqualToString:@"center"] && [object isKindOfClass:[MKAnnotationView class]]) { - MKAnnotationView *view = (MKAnnotationView *)object; - ABI46_0_0AIRMapMarker *marker = (ABI46_0_0AIRMapMarker *)view.annotation; - - // a marker we don't control might be getting dragged. Check just in case. - if (!marker) return; - - ABI46_0_0AIRMap *map = marker.map; - - // don't waste time calculating if there are no events to listen to it - if (!map.onMarkerDrag && !marker.onDrag) return; - - CGPoint position = CGPointMake(view.center.x - view.centerOffset.x, view.center.y - view.centerOffset.y); - CLLocationCoordinate2D coordinate = [map convertPoint:position toCoordinateFromView:map]; - - id event = @{ - @"id": marker.identifier ?: @"unknown", - @"position": @{ - @"x": @(position.x), - @"y": @(position.y), - }, - @"coordinate": @{ - @"latitude": @(coordinate.latitude), - @"longitude": @(coordinate.longitude), - } - }; - - if (map.onMarkerDrag) map.onMarkerDrag(event); - if (marker.onDrag) marker.onDrag(event); - - } else { - // This message is not for me; pass it on to super. - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } -} - -- (void)mapView:(ABI46_0_0AIRMap *)mapView didUpdateUserLocation:(MKUserLocation *)location -{ - id event = @{@"coordinate": @{ - @"latitude": @(location.coordinate.latitude), - @"longitude": @(location.coordinate.longitude), - @"altitude": @(location.location.altitude), - @"timestamp": @(location.location.timestamp.timeIntervalSinceReferenceDate * 1000), - @"accuracy": @(location.location.horizontalAccuracy), - @"altitudeAccuracy": @(location.location.verticalAccuracy), - @"speed": @(location.location.speed), - @"heading": @(location.location.course), - } - }; - - if (mapView.onUserLocationChange) { - mapView.onUserLocationChange(event); - } - - if (mapView.followUserLocation) { - MKCoordinateRegion region; - region.span.latitudeDelta = ABI46_0_0AIRMapDefaultSpan; - region.span.longitudeDelta = ABI46_0_0AIRMapDefaultSpan; - region.center = location.coordinate; - [mapView setRegion:region animated:YES]; - - // Move to user location only for the first time it loads up. - // mapView.followUserLocation = NO; - } - -} - -- (void)mapView:(ABI46_0_0AIRMap *)mapView regionWillChangeAnimated:(__unused BOOL)animated -{ - // Don't send region did change events until map has - // started rendering, as these won't represent the final location - if(mapView.hasStartedRendering){ - [self _regionChanged:mapView]; - } - - ABI46_0_0AIRWeakTimerReference *weakTarget = [[ABI46_0_0AIRWeakTimerReference alloc] initWithTarget:self andSelector:@selector(_onTick:)]; - - mapView.regionChangeObserveTimer = [NSTimer timerWithTimeInterval:ABI46_0_0AIRMapRegionChangeObserveInterval - target:weakTarget - selector:@selector(timerDidFire:) - userInfo:@{ ABI46_0_0RCTMapViewKey: [[ABI46_0_0AIRWeakMapReference alloc] initWithMapView: mapView] } - repeats:YES]; - - [[NSRunLoop mainRunLoop] addTimer:mapView.regionChangeObserveTimer forMode:NSRunLoopCommonModes]; -} - -- (void)mapView:(ABI46_0_0AIRMap *)mapView regionDidChangeAnimated:(__unused BOOL)animated -{ - CGFloat zoomLevel = [self zoomLevel:mapView]; - [mapView.regionChangeObserveTimer invalidate]; - mapView.regionChangeObserveTimer = nil; - - // Don't send region did change events until map has - // started rendering, as these won't represent the final location - if(mapView.hasStartedRendering){ - [self _regionChanged:mapView]; - } - - if (zoomLevel < mapView.minZoomLevel) { - [self setCenterCoordinate:[mapView centerCoordinate] zoomLevel:mapView.minZoomLevel animated:TRUE mapView:mapView]; - } - else if (zoomLevel > mapView.maxZoomLevel) { - [self setCenterCoordinate:[mapView centerCoordinate] zoomLevel:mapView.maxZoomLevel animated:TRUE mapView:mapView]; - } - - // Don't send region did change events until map has - // started rendering, as these won't represent the final location - if (mapView.hasStartedRendering) { - [self _emitRegionChangeEvent:mapView continuous:NO]; - }; - - mapView.pendingCenter = mapView.region.center; - mapView.pendingSpan = mapView.region.span; -} - -- (void)mapViewWillStartRenderingMap:(ABI46_0_0AIRMap *)mapView -{ - if (!mapView.hasStartedRendering) { - mapView.onMapReady(@{}); - mapView.hasStartedRendering = YES; - } - [mapView beginLoading]; - [self _emitRegionChangeEvent:mapView continuous:NO]; -} - -- (void)mapViewDidFinishRenderingMap:(ABI46_0_0AIRMap *)mapView fullyRendered:(BOOL)fullyRendered -{ - [mapView finishLoading]; -} - -#pragma mark Private - -- (void)_onTick:(NSTimer *)timer -{ - ABI46_0_0AIRWeakMapReference *weakRef = timer.userInfo[ABI46_0_0RCTMapViewKey]; - [self _regionChanged:weakRef.mapView]; -} - -- (void)_regionChanged:(ABI46_0_0AIRMap *)mapView -{ - BOOL needZoom = NO; - CGFloat newLongitudeDelta = 0.0f; - MKCoordinateRegion region = mapView.region; - // On iOS 7, it's possible that we observe invalid locations during initialization of the map. - // Filter those out. - if (!CLLocationCoordinate2DIsValid(region.center)) { - return; - } - // Calculation on float is not 100% accurate. If user zoom to max/min and then move, it's likely the map will auto zoom to max/min from time to time. - // So let's try to make map zoom back to 99% max or 101% min so that there are some buffer that moving the map won't constantly hitting the max/min bound. - if (mapView.maxDelta > FLT_EPSILON && region.span.longitudeDelta > mapView.maxDelta) { - needZoom = YES; - newLongitudeDelta = mapView.maxDelta * (1 - ABI46_0_0AIRMapZoomBoundBuffer); - } else if (mapView.minDelta > FLT_EPSILON && region.span.longitudeDelta < mapView.minDelta) { - needZoom = YES; - newLongitudeDelta = mapView.minDelta * (1 + ABI46_0_0AIRMapZoomBoundBuffer); - } - if (needZoom) { - region.span.latitudeDelta = region.span.latitudeDelta / region.span.longitudeDelta * newLongitudeDelta; - region.span.longitudeDelta = newLongitudeDelta; - mapView.region = region; - } - - // Continuously observe region changes - [self _emitRegionChangeEvent:mapView continuous:YES]; -} - -- (void)_emitRegionChangeEvent:(ABI46_0_0AIRMap *)mapView continuous:(BOOL)continuous -{ - if (!mapView.ignoreRegionChanges && mapView.onChange) { - MKCoordinateRegion region = mapView.region; - if (!CLLocationCoordinate2DIsValid(region.center)) { - return; - } - -#define FLUSH_NAN(value) (isnan(value) ? 0 : value) - mapView.onChange(@{ - @"continuous": @(continuous), - @"region": @{ - @"latitude": @(FLUSH_NAN(region.center.latitude)), - @"longitude": @(FLUSH_NAN(region.center.longitude)), - @"latitudeDelta": @(FLUSH_NAN(region.span.latitudeDelta)), - @"longitudeDelta": @(FLUSH_NAN(region.span.longitudeDelta)), - } - }); - } -} - -/** Returns the distance of |pt| to |poly| in meters - * - * - */ -- (double)distanceOfPoint:(MKMapPoint)pt toPoly:(ABI46_0_0AIRMapPolyline *)poly -{ - double distance = MAXFLOAT; - for (int n = 0; n < poly.coordinates.count - 1; n++) { - - MKMapPoint ptA = MKMapPointForCoordinate(poly.coordinates[n].coordinate); - MKMapPoint ptB = MKMapPointForCoordinate(poly.coordinates[n + 1].coordinate); - - double xDelta = ptB.x - ptA.x; - double yDelta = ptB.y - ptA.y; - - if (xDelta == 0.0 && yDelta == 0.0) { - continue; - } - - double u = ((pt.x - ptA.x) * xDelta + (pt.y - ptA.y) * yDelta) / (xDelta * xDelta + yDelta * yDelta); - MKMapPoint ptClosest; - if (u < 0.0) { - ptClosest = ptA; - } - else if (u > 1.0) { - ptClosest = ptB; - } - else { - ptClosest = MKMapPointMake(ptA.x + u * xDelta, ptA.y + u * yDelta); - } - - distance = MIN(distance, MKMetersBetweenMapPoints(ptClosest, pt)); - } - - return distance; -} - - -/** Converts |px| to meters at location |pt| */ -- (double)metersFromPixel:(NSUInteger)px atPoint:(CGPoint)pt forMap:(ABI46_0_0AIRMap *)mapView -{ - CGPoint ptB = CGPointMake(pt.x + px, pt.y); - - CLLocationCoordinate2D coordA = [mapView convertPoint:pt toCoordinateFromView:mapView]; - CLLocationCoordinate2D coordB = [mapView convertPoint:ptB toCoordinateFromView:mapView]; - - return MKMetersBetweenMapPoints(MKMapPointForCoordinate(coordA), MKMapPointForCoordinate(coordB)); -} - -+ (double)longitudeToPixelSpaceX:(double)longitude -{ - return round(MERCATOR_OFFSET + MERCATOR_RADIUS * longitude * M_PI / 180.0); -} - -+ (double)latitudeToPixelSpaceY:(double)latitude -{ - if (latitude == 90.0) { - return 0; - } else if (latitude == -90.0) { - return MERCATOR_OFFSET * 2; - } else { - return round(MERCATOR_OFFSET - MERCATOR_RADIUS * logf((1 + sinf(latitude * M_PI / 180.0)) / (1 - sinf(latitude * M_PI / 180.0))) / 2.0); - } -} - -+ (double)pixelSpaceXToLongitude:(double)pixelX -{ - return ((round(pixelX) - MERCATOR_OFFSET) / MERCATOR_RADIUS) * 180.0 / M_PI; -} - -+ (double)pixelSpaceYToLatitude:(double)pixelY -{ - return (M_PI / 2.0 - 2.0 * atan(exp((round(pixelY) - MERCATOR_OFFSET) / MERCATOR_RADIUS))) * 180.0 / M_PI; -} - -#pragma mark - -#pragma mark Helper methods - -- (MKCoordinateSpan)coordinateSpanWithMapView:(ABI46_0_0AIRMap *)mapView - centerCoordinate:(CLLocationCoordinate2D)centerCoordinate - andZoomLevel:(double)zoomLevel -{ - // convert center coordiate to pixel space - double centerPixelX = [ABI46_0_0AIRMapManager longitudeToPixelSpaceX:centerCoordinate.longitude]; - double centerPixelY = [ABI46_0_0AIRMapManager latitudeToPixelSpaceY:centerCoordinate.latitude]; - - // determine the scale value from the zoom level - double zoomExponent = ABI46_0_0AIRMapMaxZoomLevel - zoomLevel; - double zoomScale = pow(2, zoomExponent); - - // scale the map’s size in pixel space - CGSize mapSizeInPixels = mapView.bounds.size; - double scaledMapWidth = mapSizeInPixels.width * zoomScale; - double scaledMapHeight = mapSizeInPixels.height * zoomScale; - - // figure out the position of the top-left pixel - double topLeftPixelX = centerPixelX - (scaledMapWidth / 2); - double topLeftPixelY = centerPixelY - (scaledMapHeight / 2); - - // find delta between left and right longitudes - CLLocationDegrees minLng = [ABI46_0_0AIRMapManager pixelSpaceXToLongitude:topLeftPixelX]; - CLLocationDegrees maxLng = [ABI46_0_0AIRMapManager pixelSpaceXToLongitude:topLeftPixelX + scaledMapWidth]; - CLLocationDegrees longitudeDelta = maxLng - minLng; - - // find delta between top and bottom latitudes - CLLocationDegrees minLat = [ABI46_0_0AIRMapManager pixelSpaceYToLatitude:topLeftPixelY]; - CLLocationDegrees maxLat = [ABI46_0_0AIRMapManager pixelSpaceYToLatitude:topLeftPixelY + scaledMapHeight]; - CLLocationDegrees latitudeDelta = -1 * (maxLat - minLat); - - // create and return the lat/lng span - MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta); - return span; -} - -#pragma mark - -#pragma mark Public methods - -- (void)setCenterCoordinate:(CLLocationCoordinate2D)centerCoordinate - zoomLevel:(double)zoomLevel - animated:(BOOL)animated - mapView:(ABI46_0_0AIRMap *)mapView -{ - // clamp large numbers to 28 - zoomLevel = MIN(zoomLevel, ABI46_0_0AIRMapMaxZoomLevel); - - // use the zoom level to compute the region - MKCoordinateSpan span = [self coordinateSpanWithMapView:mapView centerCoordinate:centerCoordinate andZoomLevel:zoomLevel]; - MKCoordinateRegion region = MKCoordinateRegionMake(centerCoordinate, span); - - // set the region like normal - [mapView setRegion:region animated:animated]; -} - -//KMapView cannot display tiles that cross the pole (as these would involve wrapping the map from top to bottom, something that a Mercator projection just cannot do). --(MKCoordinateRegion)coordinateRegionWithMapView:(ABI46_0_0AIRMap *)mapView - centerCoordinate:(CLLocationCoordinate2D)centerCoordinate - andZoomLevel:(double)zoomLevel -{ - // clamp lat/long values to appropriate ranges - centerCoordinate.latitude = MIN(MAX(-90.0, centerCoordinate.latitude), 90.0); - centerCoordinate.longitude = fmod(centerCoordinate.longitude, 180.0); - - // convert center coordiate to pixel space - double centerPixelX = [ABI46_0_0AIRMapManager longitudeToPixelSpaceX:centerCoordinate.longitude]; - double centerPixelY = [ABI46_0_0AIRMapManager latitudeToPixelSpaceY:centerCoordinate.latitude]; - - // determine the scale value from the zoom level - double zoomExponent = ABI46_0_0AIRMapMaxZoomLevel - zoomLevel; - double zoomScale = pow(2, zoomExponent); - - // scale the map’s size in pixel space - CGSize mapSizeInPixels = mapView.bounds.size; - double scaledMapWidth = mapSizeInPixels.width * zoomScale; - double scaledMapHeight = mapSizeInPixels.height * zoomScale; - - // figure out the position of the left pixel - double topLeftPixelX = centerPixelX - (scaledMapWidth / 2); - - // find delta between left and right longitudes - CLLocationDegrees minLng = [ABI46_0_0AIRMapManager pixelSpaceXToLongitude:topLeftPixelX]; - CLLocationDegrees maxLng = [ABI46_0_0AIRMapManager pixelSpaceXToLongitude:topLeftPixelX + scaledMapWidth]; - CLLocationDegrees longitudeDelta = maxLng - minLng; - - // if we’re at a pole then calculate the distance from the pole towards the equator - // as MKMapView doesn’t like drawing boxes over the poles - double topPixelY = centerPixelY - (scaledMapHeight / 2); - double bottomPixelY = centerPixelY + (scaledMapHeight / 2); - BOOL adjustedCenterPoint = NO; - if (topPixelY > MERCATOR_OFFSET * 2) { - topPixelY = centerPixelY - scaledMapHeight; - bottomPixelY = MERCATOR_OFFSET * 2; - adjustedCenterPoint = YES; - } - - // find delta between top and bottom latitudes - CLLocationDegrees minLat = [ABI46_0_0AIRMapManager pixelSpaceYToLatitude:topPixelY]; - CLLocationDegrees maxLat = [ABI46_0_0AIRMapManager pixelSpaceYToLatitude:bottomPixelY]; - CLLocationDegrees latitudeDelta = -1 * (maxLat - minLat); - - // create and return the lat/lng span - MKCoordinateSpan span = MKCoordinateSpanMake(latitudeDelta, longitudeDelta); - MKCoordinateRegion region = MKCoordinateRegionMake(centerCoordinate, span); - // once again, MKMapView doesn’t like drawing boxes over the poles - // so adjust the center coordinate to the center of the resulting region - if (adjustedCenterPoint) { - region.center.latitude = [ABI46_0_0AIRMapManager pixelSpaceYToLatitude:((bottomPixelY + topPixelY) / 2.0)]; - } - - return region; -} - -- (double) zoomLevel:(ABI46_0_0AIRMap *)mapView { - MKCoordinateRegion region = mapView.region; - - double centerPixelX = [ABI46_0_0AIRMapManager longitudeToPixelSpaceX: region.center.longitude]; - double topLeftPixelX = [ABI46_0_0AIRMapManager longitudeToPixelSpaceX: region.center.longitude - region.span.longitudeDelta / 2]; - - double scaledMapWidth = (centerPixelX - topLeftPixelX) * 2; - CGSize mapSizeInPixels = mapView.bounds.size; - double zoomScale = scaledMapWidth / mapSizeInPixels.width; - double zoomExponent = log(zoomScale) / log(2); - double zoomLevel = ABI46_0_0AIRMapMaxZoomLevel - zoomExponent; - - return zoomLevel; -} - -#pragma mark MKMapViewDelegate - Tracking the User Location - -- (void)mapView:(ABI46_0_0AIRMap *)mapView didFailToLocateUserWithError:(NSError *)error { - id event = @{@"error": @{ @"message": error.localizedDescription }}; - if (mapView.onUserLocationChange) { - mapView.onUserLocationChange(event); - } -} - -- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { - return YES; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.h deleted file mode 100644 index db80aa0b8edeb7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.h +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapCallout.h" - -#import -#import - -#import -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0SMCalloutView.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - -@class ABI46_0_0RCTBridge; - -@interface ABI46_0_0AIRMapMarker : MKAnnotationView - -@property (nonatomic, strong) ABI46_0_0AIRMapCallout *calloutView; -@property (nonatomic, weak) ABI46_0_0AIRMap *map; -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; - -@property (nonatomic, strong) NSString *identifier; -@property (nonatomic, copy) NSString *imageSrc; -@property (nonatomic, copy) NSString *title; -@property (nonatomic, copy) NSString *subtitle; -@property (nonatomic, assign) CLLocationCoordinate2D coordinate; -@property (nonatomic, strong) UIColor *pinColor; -@property (nonatomic, assign) NSInteger zIndex; -@property (nonatomic, assign) double opacity; -@property (nonatomic, assign) BOOL isPreselected; - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onSelect; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDeselect; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onCalloutPress; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDragStart; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDrag; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onDragEnd; - - -- (MKAnnotationView *)getAnnotationView; -- (void)fillCalloutView:(ABI46_0_0SMCalloutView *)calloutView; -- (BOOL)shouldShowCalloutView; -- (void)showCalloutView; -- (void)hideCalloutView; -- (void)addTapGestureRecognizer; - -@end - - -@interface ABI46_0_0AIREmptyCalloutBackgroundView : ABI46_0_0SMCalloutBackgroundView -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.m deleted file mode 100644 index 0c97cce29b2034..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarker.m +++ /dev/null @@ -1,365 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapMarker.h" - -#import -#import -#import -#import -#import - -NSInteger const ABI46_0_0AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999; - -@implementation ABI46_0_0AIREmptyCalloutBackgroundView -@end - -@implementation ABI46_0_0AIRMapMarker { - BOOL _hasSetCalloutOffset; - ABI46_0_0RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; - MKPinAnnotationView *_pinView; - BOOL _calloutIsOpen; - NSInteger _zIndexBeforeOpen; -} - -- (instancetype)initWithFrame:(CGRect)frame { - self = [super initWithFrame:frame]; - if (self) { - [self.layer addObserver:self forKeyPath:@"zPosition" options:NSKeyValueObservingOptionNew context:nil]; - } - return self; -} - -- (void)ABI46_0_0ReactSetFrame:(CGRect)frame -{ - // Make sure we use the image size when available - CGSize size = self.image ? self.image.size : frame.size; - CGRect bounds = {CGPointZero, size}; - - // The MapView is basically in charge of figuring out the center position of the marker view. If the view changed in - // height though, we need to compensate in such a way that the bottom of the marker stays at the same spot on the - // map. - CGFloat dy = (bounds.size.height - self.bounds.size.height) / 2; - CGPoint center = (CGPoint){ self.center.x, self.center.y - dy }; - - // Avoid crashes due to nan coords - if (isnan(center.x) || isnan(center.y) || - isnan(bounds.origin.x) || isnan(bounds.origin.y) || - isnan(bounds.size.width) || isnan(bounds.size.height)) { - ABI46_0_0RCTLogError(@"Invalid layout for (%@)%@. position: %@. bounds: %@", - self.ABI46_0_0ReactTag, self, NSStringFromCGPoint(center), NSStringFromCGRect(bounds)); - return; - } - - self.center = center; - self.bounds = bounds; -} - -- (void)insertABI46_0_0ReactSubview:(id)subview atIndex:(NSInteger)atIndex { - if ([subview isKindOfClass:[ABI46_0_0AIRMapCallout class]]) { - self.calloutView = (ABI46_0_0AIRMapCallout *)subview; - } else { - [super insertABI46_0_0ReactSubview:(UIView *)subview atIndex:atIndex]; - } -} - -- (void)removeABI46_0_0ReactSubview:(id)subview { - if ([subview isKindOfClass:[ABI46_0_0AIRMapCallout class]] && self.calloutView == subview) { - self.calloutView = nil; - } else { - [super removeABI46_0_0ReactSubview:(UIView *)subview]; - } -} - -- (MKAnnotationView *)getAnnotationView -{ - if ([self shouldUsePinView]) { - // In this case, we want to render a platform "default" marker. - if (_pinView == nil) { - _pinView = [[MKPinAnnotationView alloc] initWithAnnotation:self reuseIdentifier: nil]; - [self addGestureRecognizerToView:_pinView]; - _pinView.annotation = self; - } - - _pinView.draggable = self.draggable; - _pinView.layer.zPosition = self.zIndex; - - // TODO(lmr): Looks like this API was introduces in iOS 8. We may want to handle differently for earlier - // versions. Right now it's just leaving it with the default color. People needing the colors are free to - // use their own custom markers. - if ([_pinView respondsToSelector:@selector(setPinTintColor:)]) { - _pinView.pinTintColor = self.pinColor; - } - - return _pinView; - } else { - // If it has subviews, it means we are wanting to render a custom marker with arbitrary ABI46_0_0React views. - // if it has a non-null image, it means we want to render a custom marker with the image. - // In either case, we want to return the ABI46_0_0AIRMapMarker since it is both an MKAnnotation and an - // MKAnnotationView all at the same time. - self.layer.zPosition = self.zIndex; - return self; - } -} - -- (void)fillCalloutView:(ABI46_0_0SMCalloutView *)calloutView -{ - // Set everything necessary on the calloutView before it becomes visible. - - // Apply the MKAnnotationView's desired calloutOffset (from the top-middle of the view) - if ([self shouldUsePinView] && !_hasSetCalloutOffset) { - calloutView.calloutOffset = CGPointMake(-8,0); - } else { - calloutView.calloutOffset = self.calloutOffset; - } - - if (self.calloutView) { - calloutView.title = nil; - calloutView.subtitle = nil; - if (self.calloutView.tooltip) { - // if tooltip is true, then the user wants their ABI46_0_0React view to be the "tooltip" as wwell, so we set - // the background view to something empty/transparent - calloutView.backgroundView = [ABI46_0_0AIREmptyCalloutBackgroundView new]; - } else { - // the default tooltip look is wanted, and the user is just filling the content with their ABI46_0_0React subviews. - // as a result, we use the default "masked" background view. - calloutView.backgroundView = [ABI46_0_0SMCalloutMaskedBackgroundView new]; - } - - // when this is set, the callout's content will be whatever ABI46_0_0React views the user has put as the callout's - // children. - calloutView.contentView = self.calloutView; - - } else { - - // if there is no calloutView, it means the user wants to use the default callout behavior with title/subtitle - // pairs. - calloutView.title = self.title; - calloutView.subtitle = self.subtitle; - calloutView.contentView = nil; - calloutView.backgroundView = [ABI46_0_0SMCalloutMaskedBackgroundView new]; - } -} - -- (void)showCalloutView -{ - _calloutIsOpen = YES; - [self setZIndex:_zIndexBeforeOpen]; - - MKAnnotationView *annotationView = [self getAnnotationView]; - - [self setSelected:YES animated:NO]; - [self.map selectAnnotation:self animated:NO]; - - id event = @{ - @"action": @"marker-select", - @"id": self.identifier ?: @"unknown", - @"coordinate": @{ - @"latitude": @(self.coordinate.latitude), - @"longitude": @(self.coordinate.longitude) - } - }; - - if (self.map.onMarkerSelect) self.map.onMarkerSelect(event); - if (self.onSelect) self.onSelect(event); - - if (![self shouldShowCalloutView]) { - // no callout to show - return; - } - - [self fillCalloutView:self.map.calloutView]; - - // This is where we present our custom callout view... MapKit's built-in callout doesn't have the flexibility - // we need, but a lot of work was done by Nick Farina to make this identical to MapKit's built-in. - [self.map.calloutView presentCalloutFromRect:annotationView.bounds - inView:annotationView - constrainedToView:self.map - animated:YES]; -} - -#pragma mark - Tap Gesture & Events. - -- (void)addTapGestureRecognizer { - [self addGestureRecognizerToView:nil]; -} - -- (void)addGestureRecognizerToView:(UIView *)view { - if (!view) { - view = self; - } - UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTap:)]; - // setting this to NO allows the parent MapView to continue receiving marker selection events - tapGestureRecognizer.cancelsTouchesInView = NO; - [view addGestureRecognizer:tapGestureRecognizer]; -} - -- (void)_handleTap:(UITapGestureRecognizer *)recognizer { - ABI46_0_0AIRMapMarker *marker = self; - if (!marker) return; - - if (marker.selected) { - CGPoint touchPoint = [recognizer locationInView:marker.map.calloutView]; - CGRect bubbleFrame = [self.calloutView convertRect:marker.map.calloutView.bounds toView:marker.map]; - CGPoint touchPointReal = [recognizer locationInView:self.calloutView]; - - UIView *calloutView = [marker.map.calloutView hitTest:touchPoint withEvent:nil]; - if (calloutView) { - // the callout (or its subview) got clicked, not the marker - UIWindow* win = [[[UIApplication sharedApplication] windows] firstObject]; - ABI46_0_0AIRMapCalloutSubview* calloutSubview = nil; - UIView* tmp = calloutView; - while (tmp && tmp != win && tmp != self.calloutView && tmp != self.map) { - if ([tmp respondsToSelector:@selector(onPress)]) { - calloutSubview = (ABI46_0_0AIRMapCalloutSubview*) tmp; - break; - } - tmp = tmp.superview; - } - - id event = @{ - @"action": calloutSubview ? @"callout-inside-press" : @"callout-press", - @"id": marker.identifier ?: @"unknown", - @"point": @{ - @"x": @(touchPointReal.x), - @"y": @(touchPointReal.y), - }, - @"frame": @{ - @"x": @(bubbleFrame.origin.x), - @"y": @(bubbleFrame.origin.y), - @"width": @(bubbleFrame.size.width), - @"height": @(bubbleFrame.size.height), - } - }; - - if (calloutSubview) calloutSubview.onPress(event); - if (marker.onCalloutPress) marker.onCalloutPress(event); - if (marker.calloutView && marker.calloutView.onPress) marker.calloutView.onPress(event); - if (marker.map.onCalloutPress) marker.map.onCalloutPress(event); - return; - } - } - - // the actual marker got clicked - id event = @{ - @"action": @"marker-press", - @"id": marker.identifier ?: @"unknown", - @"coordinate": @{ - @"latitude": @(marker.coordinate.latitude), - @"longitude": @(marker.coordinate.longitude) - } - }; - - if (marker.onPress) marker.onPress(event); - if (marker.map.onMarkerPress) marker.map.onMarkerPress(event); - - [marker.map selectAnnotation:marker animated:NO]; -} - -- (void)hideCalloutView -{ - _calloutIsOpen = NO; - [self setZIndex:_zIndexBeforeOpen]; - // hide the callout view - [self.map.calloutView dismissCalloutAnimated:YES]; - - [self setSelected:NO animated:NO]; - [self.map deselectAnnotation:self animated:NO]; - - id event = @{ - @"action": @"marker-deselect", - @"id": self.identifier ?: @"unknown", - @"coordinate": @{ - @"latitude": @(self.coordinate.latitude), - @"longitude": @(self.coordinate.longitude) - } - }; - - if (self.map.onMarkerDeselect) self.map.onMarkerDeselect(event); - if (self.onDeselect) self.onDeselect(event); -} - -- (void)setCalloutOffset:(CGPoint)calloutOffset -{ - _hasSetCalloutOffset = YES; - [super setCalloutOffset:calloutOffset]; -} - -- (BOOL)shouldShowCalloutView -{ - return self.calloutView != nil || self.title != nil || self.subtitle != nil; -} - -- (BOOL)shouldUsePinView -{ - return self.ABI46_0_0ReactSubviews.count == 0 && !self.imageSrc; -} - -- (void)setOpacity:(double)opacity -{ - [self setAlpha:opacity]; -} - -- (void)setImageSrc:(NSString *)imageSrc -{ - _imageSrc = imageSrc; - - if (_reloadImageCancellationBlock) { - _reloadImageCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - _reloadImageCancellationBlock = [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:_imageSrc] - size:self.bounds.size - scale:ABI46_0_0RCTScreenScale() - clipped:YES - resizeMode:ABI46_0_0RCTResizeModeCenter - progressBlock:nil - partialLoadBlock:nil - completionBlock:^(NSError *error, UIImage *image) { - if (error) { - // TODO(lmr): do something with the error? - NSLog(@"%@", error); - } - dispatch_async(dispatch_get_main_queue(), ^{ - self.image = image; - }); - }]; -} - -- (void)setPinColor:(UIColor *)pinColor -{ - _pinColor = pinColor; - - if ([_pinView respondsToSelector:@selector(setPinTintColor:)]) { - _pinView.pinTintColor = _pinColor; - } -} - -- (void)setZIndex:(NSInteger)zIndex -{ - _zIndexBeforeOpen = zIndex; - _zIndex = _calloutIsOpen ? zIndex + ABI46_0_0AIR_CALLOUT_OPEN_ZINDEX_BASELINE : zIndex; - self.layer.zPosition = zIndex; -} - -- (BOOL)isSelected { - return _isPreselected || [super isSelected]; -} - -- (void)dealloc { - [self.layer removeObserver:self forKeyPath:@"zPosition"]; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if ([keyPath isEqualToString:@"zPosition"]) { - self.layer.zPosition = _zIndex; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.h deleted file mode 100644 index a3c6cce4f5ce7b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -@interface ABI46_0_0AIRMapMarkerManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.m deleted file mode 100644 index 21a89666c0dabd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapMarkerManager.m +++ /dev/null @@ -1,95 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapMarkerManager.h" - -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" - -@interface ABI46_0_0AIRMapMarkerManager () - -@end - -@implementation ABI46_0_0AIRMapMarkerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapMarker *marker = [ABI46_0_0AIRMapMarker new]; - [marker addTapGestureRecognizer]; - marker.bridge = self.bridge; - marker.isAccessibilityElement = YES; - marker.accessibilityElementsHidden = NO; - return marker; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(identifier, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString) -//ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(reuseIdentifier, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(title, NSString) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(description, subtitle, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(centerOffset, CGPoint) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(calloutOffset, CGPoint) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(pinColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(draggable, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, double) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(isPreselected, BOOL) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onSelect, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDeselect, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onCalloutPress, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDragStart, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDrag, ABI46_0_0RCTDirectEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onDragEnd, ABI46_0_0RCTDirectEventBlock) - - -ABI46_0_0RCT_EXPORT_METHOD(showCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [(ABI46_0_0AIRMapMarker *) view showCalloutView]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(hideCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - [(ABI46_0_0AIRMapMarker *) view hideCalloutView]; - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(redrawCallout:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - id view = viewRegistry[ABI46_0_0ReactTag]; - if (![view isKindOfClass:[ABI46_0_0AIRMapMarker class]]) { - ABI46_0_0RCTLogError(@"Invalid view returned from registry, expecting ABI46_0_0AIRMap, got: %@", view); - } else { - //no need to do anything here - } - }]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.h deleted file mode 100644 index c49cd80e65db36..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.h +++ /dev/null @@ -1,36 +0,0 @@ -#import "ABI46_0_0AIRMapCallout.h" - -#import -#import - -#import "ABI46_0_0RCTConvert+AirMap.h" -#import -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0AIRMapOverlayRenderer.h" - -@class ABI46_0_0RCTBridge; - -@interface ABI46_0_0AIRMapOverlay : UIView - -@property (nonatomic, strong) ABI46_0_0AIRMapOverlayRenderer *renderer; -@property (nonatomic, weak) ABI46_0_0AIRMap *map; -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; - -@property (nonatomic, strong) NSString *name; -@property (nonatomic, copy) NSString *imageSrc; -@property (nonatomic, strong, readonly) UIImage *overlayImage; -@property (nonatomic, copy) NSArray *boundsRect; -@property (nonatomic, assign) NSInteger rotation; -@property (nonatomic, assign) CGFloat transparency; -@property (nonatomic, assign) NSInteger zIndex; - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.m deleted file mode 100644 index 40d58593e64b40..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlay.m +++ /dev/null @@ -1,103 +0,0 @@ -#import "ABI46_0_0AIRMapOverlay.h" - -#import -#import -#import -#import -#import - -@interface ABI46_0_0AIRMapOverlay() -@property (nonatomic, strong, readwrite) UIImage *overlayImage; -@end - -@implementation ABI46_0_0AIRMapOverlay { - ABI46_0_0RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; - CLLocationCoordinate2D _southWest; - CLLocationCoordinate2D _northEast; - MKMapRect _mapRect; -} - -- (void)setImageSrc:(NSString *)imageSrc -{ - NSLog(@">>> SET IMAGESRC: %@", imageSrc); - _imageSrc = imageSrc; - - if (_reloadImageCancellationBlock) { - _reloadImageCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - __weak typeof(self) weakSelf = self; - _reloadImageCancellationBlock = [[_bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:_imageSrc] - size:weakSelf.bounds.size - scale:ABI46_0_0RCTScreenScale() - clipped:YES - resizeMode:ABI46_0_0RCTResizeModeCenter - progressBlock:nil - partialLoadBlock:nil - completionBlock:^(NSError *error, UIImage *image) { - if (error) { - NSLog(@"%@", error); - } - dispatch_async(dispatch_get_main_queue(), ^{ - NSLog(@">>> IMAGE: %@", image); - weakSelf.overlayImage = image; - [weakSelf createOverlayRendererIfPossible]; - [weakSelf update]; - }); - }]; -} - -- (void)setBoundsRect:(NSArray *)boundsRect { - _boundsRect = boundsRect; - - _southWest = CLLocationCoordinate2DMake([boundsRect[0][0] doubleValue], [boundsRect[0][1] doubleValue]); - _northEast = CLLocationCoordinate2DMake([boundsRect[1][0] doubleValue], [boundsRect[1][1] doubleValue]); - - MKMapPoint southWest = MKMapPointForCoordinate(_southWest); - MKMapPoint northEast = MKMapPointForCoordinate(_northEast); - - _mapRect = MKMapRectMake(southWest.x, northEast.y, ABS(northEast.x - southWest.x), ABS(northEast.y - southWest.y)); - - [self update]; -} - -- (void)createOverlayRendererIfPossible -{ - if (MKMapRectIsEmpty(_mapRect) || !self.overlayImage) return; - __weak typeof(self) weakSelf = self; - self.renderer = [[ABI46_0_0AIRMapOverlayRenderer alloc] initWithOverlay:weakSelf]; -} - -- (void)update -{ - if (!_renderer) return; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self]; -} - - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D)coordinate -{ - return MKCoordinateForMapPoint(MKMapPointMake(MKMapRectGetMidX(_mapRect), MKMapRectGetMidY(_mapRect))); -} - -- (MKMapRect)boundingMapRect -{ - return _mapRect; -} - -- (BOOL)intersectsMapRect:(MKMapRect)mapRect -{ - return MKMapRectIntersectsRect(_mapRect, mapRect); -} - -- (BOOL)canReplaceMapContent -{ - return NO; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.h deleted file mode 100644 index 90a47d0674236a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.h +++ /dev/null @@ -1,5 +0,0 @@ -#import - -@interface ABI46_0_0AIRMapOverlayManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.m deleted file mode 100644 index c62e2eb82e31b9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayManager.m +++ /dev/null @@ -1,27 +0,0 @@ -#import "ABI46_0_0AIRMapOverlayManager.h" - -#import -#import -#import -#import "ABI46_0_0AIRMapOverlay.h" - -@interface ABI46_0_0AIRMapOverlayManager () - -@end - -@implementation ABI46_0_0AIRMapOverlayManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapOverlay *overlay = [ABI46_0_0AIRMapOverlay new]; - overlay.bridge = self.bridge; - return overlay; -} - -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(bounds, boundsRect, NSArray) -ABI46_0_0RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString) - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.h deleted file mode 100644 index 2c8cf838f330c4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.h +++ /dev/null @@ -1,8 +0,0 @@ -#import - -@interface ABI46_0_0AIRMapOverlayRenderer : MKOverlayRenderer - -@property (nonatomic, assign) NSInteger rotation; -@property (nonatomic, assign) CGFloat transparency; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.m deleted file mode 100644 index 7003fafaf2a224..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapOverlayRenderer.m +++ /dev/null @@ -1,30 +0,0 @@ -#import "ABI46_0_0AIRMapOverlayRenderer.h" -#import "ABI46_0_0AIRMapOverlay.h" - -@implementation ABI46_0_0AIRMapOverlayRenderer - -- (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context { - UIImage *image = [(ABI46_0_0AIRMapOverlay *)self.overlay overlayImage]; - - CGContextSaveGState(context); - - CGImageRef imageReference = image.CGImage; - - MKMapRect theMapRect = [self.overlay boundingMapRect]; - CGRect theRect = [self rectForMapRect:theMapRect]; - - CGContextRotateCTM(context, M_PI); - CGContextScaleCTM(context, -1.0, 1.0); - CGContextTranslateCTM(context, 0.0, -theRect.size.height); - CGContextAddRect(context, theRect); - CGContextDrawImage(context, theRect, imageReference); - - CGContextRestoreGState(context); -} - -- (BOOL)canDrawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale { - return [(ABI46_0_0AIRMapOverlay *)self.overlay overlayImage] != nil; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.h deleted file mode 100644 index a406820d8d39dd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - -#import -#import - -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - - - -@interface ABI46_0_0AIRMapPolygon: MKAnnotationView - -@property (nonatomic, weak) ABI46_0_0AIRMap *map; - -@property (nonatomic, strong) MKPolygon *polygon; -@property (nonatomic, strong) MKPolygonRenderer *renderer; -@property (nonatomic, strong) NSArray *interiorPolygons; - -@property (nonatomic, strong) NSArray *coordinates; -@property (nonatomic, strong) NSArray *> *holes; -@property (nonatomic, strong) UIColor *fillColor; -@property (nonatomic, strong) UIColor *strokeColor; -@property (nonatomic, assign) CGFloat strokeWidth; -@property (nonatomic, assign) CGFloat miterLimit; -@property (nonatomic, assign) CGLineCap lineCap; -@property (nonatomic, assign) CGLineJoin lineJoin; -@property (nonatomic, assign) CGFloat lineDashPhase; -@property (nonatomic, strong) NSArray *lineDashPattern; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.m deleted file mode 100644 index 1b98073238ba85..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygon.m +++ /dev/null @@ -1,178 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0AIRMapPolygon.h" -#import - - -@implementation ABI46_0_0AIRMapPolygon { - -} - -- (void)setFillColor:(UIColor *)fillColor { - _fillColor = fillColor; - [self update]; -} - -- (void)setStrokeColor:(UIColor *)strokeColor { - _strokeColor = strokeColor; - [self update]; -} - -- (void)setStrokeWidth:(CGFloat)strokeWidth { - _strokeWidth = strokeWidth; - [self update]; -} - -- (void)setLineJoin:(CGLineJoin)lineJoin { - _lineJoin = lineJoin; - [self update]; -} - -- (void)setLineCap:(CGLineCap)lineCap { - _lineCap = lineCap; - [self update]; -} - -- (void)setMiterLimit:(CGFloat)miterLimit { - _miterLimit = miterLimit; - [self update]; -} - -- (void)setLineDashPhase:(CGFloat)lineDashPhase { - _lineDashPhase = lineDashPhase; - [self update]; -} - -- (void)setLineDashPattern:(NSArray *)lineDashPattern { - _lineDashPattern = lineDashPattern; - [self update]; -} - -- (void)setCoordinates:(NSArray *)coordinates { - _coordinates = coordinates; - CLLocationCoordinate2D coords[coordinates.count]; - for(int i = 0; i < coordinates.count; i++) - { - coords[i] = coordinates[i].coordinate; - } - self.polygon = [MKPolygon polygonWithCoordinates:coords count:coordinates.count interiorPolygons:_interiorPolygons]; - // TODO: we could lazy-initialize the polygon, since we don't need it until the - // polygon is in view. - self.renderer = [[MKPolygonRenderer alloc] initWithPolygon:self.polygon]; - [self update]; -} - -- (void)setHoles:(NSArray *> *)holes { - _holes = holes; - if (holes.count) - { - NSMutableArray *polygons = [NSMutableArray array]; - for(int h = 0; h < holes.count; h++) - { - CLLocationCoordinate2D coords[holes[h].count]; - for(int i = 0; i < holes[h].count; i++) - { - coords[i] = holes[h][i].coordinate; - } - [polygons addObject:[MKPolygon polygonWithCoordinates:coords count:holes[h].count]]; - } - _interiorPolygons = polygons; - } -} - -- (void) update -{ - if (!_renderer) return; - _renderer.fillColor = _fillColor; - _renderer.strokeColor = _strokeColor; - _renderer.lineWidth = _strokeWidth; - _renderer.lineCap = _lineCap; - _renderer.lineJoin = _lineJoin; - _renderer.miterLimit = _miterLimit; - _renderer.lineDashPhase = _lineDashPhase; - _renderer.lineDashPattern = _lineDashPattern; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self]; -} - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D) coordinate -{ - return self.polygon.coordinate; -} - -- (MKMapRect) boundingMapRect -{ - return self.polygon.boundingMapRect; -} - -- (BOOL)intersectsMapRect:(MKMapRect)mapRect -{ - BOOL answer = [self.polygon intersectsMapRect:mapRect]; - return answer; -} - -- (BOOL)canReplaceMapContent -{ - return NO; -} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.h deleted file mode 100644 index 169ec987e5520b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - - -@interface ABI46_0_0AIRMapPolygonManager : ABI46_0_0RCTViewManager -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.m deleted file mode 100644 index cbd79b8ae163b8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolygonManager.m +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapPolygonManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapPolygon.h" - -@interface ABI46_0_0AIRMapPolygonManager() - -@end - -@implementation ABI46_0_0AIRMapPolygonManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapPolygon *polygon = [ABI46_0_0AIRMapPolygon new]; - return polygon; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinates, ABI46_0_0AIRMapCoordinateArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(holes, ABI46_0_0AIRMapCoordinateArrayArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineCap, CGLineCap) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineJoin, CGLineJoin) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(miterLimit, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPhase, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.h deleted file mode 100644 index 064a24d99a2fc1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - -#import -#import - -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" - - -@interface ABI46_0_0AIRMapPolyline: MKAnnotationView - -@property (nonatomic, weak) ABI46_0_0AIRMap *map; - -@property (nonatomic, strong) MKPolyline *polyline; -@property (nonatomic, strong) MKOverlayPathRenderer *renderer; - -@property (nonatomic, strong) NSArray *coordinates; -@property (nonatomic, strong) UIColor *fillColor; -@property (nonatomic, strong) UIColor *strokeColor; -@property (nonatomic, strong) NSArray *strokeColors; -@property (nonatomic, assign) CGFloat strokeWidth; -@property (nonatomic, assign) CGFloat miterLimit; -@property (nonatomic, assign) CGLineCap lineCap; -@property (nonatomic, assign) CGLineJoin lineJoin; -@property (nonatomic, assign) CGFloat lineDashPhase; -@property (nonatomic, strong) NSArray *lineDashPattern; -@property (nonatomic, assign) BOOL geodesic; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onPress; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.m deleted file mode 100644 index e9ca91c9290863..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolyline.m +++ /dev/null @@ -1,160 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0AIRMapPolyline.h" -#import "ABI46_0_0AIRMapPolylineRenderer.h" -#import - - -@implementation ABI46_0_0AIRMapPolyline { - -} - -- (void)setFillColor:(UIColor *)fillColor { - _fillColor = fillColor; - [self update]; -} - -- (void)setStrokeColor:(UIColor *)strokeColor { - _strokeColor = strokeColor; - [self update]; -} - -- (void)setStrokeColors:(NSArray *)strokeColors { - _strokeColors = strokeColors; - if ((self.renderer != nil) && ![_renderer isKindOfClass:[ABI46_0_0AIRMapPolylineRenderer class]]) { - self.renderer = [self createRenderer]; - } - [self update]; -} - -- (void)setStrokeWidth:(CGFloat)strokeWidth { - _strokeWidth = strokeWidth; - [self update]; -} - -- (void)setLineJoin:(CGLineJoin)lineJoin { - _lineJoin = lineJoin; - [self update]; -} - -- (void)setLineCap:(CGLineCap)lineCap { - _lineCap = lineCap; - [self update]; -} - -- (void)setMiterLimit:(CGFloat)miterLimit { - _miterLimit = miterLimit; - [self update]; -} - -- (void)setLineDashPhase:(CGFloat)lineDashPhase { - _lineDashPhase = lineDashPhase; - [self update]; -} - -- (void)setLineDashPattern:(NSArray *)lineDashPattern { - _lineDashPattern = lineDashPattern; - [self update]; -} - --(void)setGeodesic:(BOOL)geodesic -{ - _geodesic = geodesic; - if(_coordinates){ - [self setCoordinates:_coordinates]; - } -} - -- (void)setCoordinates:(NSArray *)coordinates { - _coordinates = coordinates; - CLLocationCoordinate2D coords[coordinates.count]; - for(int i = 0; i < coordinates.count; i++) - { - coords[i] = coordinates[i].coordinate; - } - if(_geodesic){ - self.polyline = [MKGeodesicPolyline polylineWithCoordinates:coords count:coordinates.count]; - } else { - self.polyline = [MKPolyline polylineWithCoordinates:coords count:coordinates.count]; - } - - self.renderer = [self createRenderer]; - [self update]; -} - -- (MKOverlayPathRenderer*)createRenderer { - if (self.polyline == nil) return nil; - if (self.strokeColors == nil) { - // Use the default renderer when no array of stroke-colors is defined. - // This behaviour may be changed in the future if we permanently want to - // use the custom renderer, because it can add funtionality that is not - // supported by the default renderer. - return [[MKPolylineRenderer alloc] initWithPolyline:self.polyline]; - } - else { - return [[ABI46_0_0AIRMapPolylineRenderer alloc] initWithOverlay:self polyline:self.polyline]; - } -} - -- (void) update -{ - if (!_renderer) return; - [self updateRenderer:_renderer]; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self]; -} - -- (void) updateRenderer:(MKOverlayPathRenderer*)renderer { - renderer.fillColor = _fillColor; - renderer.strokeColor = _strokeColor; - renderer.lineWidth = _strokeWidth; - renderer.lineCap = _lineCap; - renderer.lineJoin = _lineJoin; - renderer.miterLimit = _miterLimit; - renderer.lineDashPhase = _lineDashPhase; - renderer.lineDashPattern = _lineDashPattern; - - if ([renderer isKindOfClass:[ABI46_0_0AIRMapPolylineRenderer class]]) { - ((ABI46_0_0AIRMapPolylineRenderer*)renderer).strokeColors = _strokeColors; - } -} - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D) coordinate -{ - return self.polyline.coordinate; -} - -- (MKMapRect) boundingMapRect -{ - return self.polyline.boundingMapRect; -} - -- (BOOL)intersectsMapRect:(MKMapRect)mapRect -{ - BOOL answer = [self.polyline intersectsMapRect:mapRect]; - return answer; -} - -- (BOOL)canReplaceMapContent -{ - return NO; -} - - -#pragma mark ABI46_0_0AIRMapSnapshot implementation - -- (void) drawToSnapshot:(MKMapSnapshot *) snapshot context:(CGContextRef) context -{ - ABI46_0_0AIRMapPolylineRenderer* renderer = [[ABI46_0_0AIRMapPolylineRenderer alloc] initWithSnapshot:snapshot overlay:self polyline:self.polyline]; - [self updateRenderer:renderer]; - [renderer drawWithZoomScale:2 inContext:context]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.h deleted file mode 100644 index ce082b066422ef..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import - - -@interface ABI46_0_0AIRMapPolylineManager : ABI46_0_0RCTViewManager -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.m deleted file mode 100644 index 011cabad254b7e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineManager.m +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRMapPolylineManager.h" - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapPolyline.h" - -@interface ABI46_0_0AIRMapPolylineManager() - -@end - -@implementation ABI46_0_0AIRMapPolylineManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapPolyline *polyline = [ABI46_0_0AIRMapPolyline new]; - return polyline; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(coordinates, ABI46_0_0AIRMapCoordinateArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColor, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeColors, UIColorArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineCap, CGLineCap) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineJoin, CGLineJoin) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(miterLimit, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPhase, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lineDashPattern, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(geodesic, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onPress, ABI46_0_0RCTBubblingEventBlock) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.h deleted file mode 100644 index be3ba3c2525d7c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ABI46_0_0AIRMapPolylineRenderer.h -// mapDemo -// -// Created by IjzerenHein on 13-11-21. -// Copyright (c) 2017 IjzerenHein. All rights reserved. -// - -#import - -@interface ABI46_0_0AIRMapPolylineRenderer : MKOverlayPathRenderer - --(id)initWithOverlay:(id)overlay polyline:(MKPolyline*)polyline; --(id)initWithSnapshot:(MKMapSnapshot*)snapshot overlay:(id)overlay polyline:(MKPolyline*)polyline; --(void)drawWithZoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context; - -@property (nonatomic, strong) NSArray *strokeColors; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.m deleted file mode 100644 index 3b6e39e1786f67..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapPolylineRenderer.m +++ /dev/null @@ -1,240 +0,0 @@ -// -// ABI46_0_0AIRMapPolylineRenderer.h -// mapDemo -// -// Created by IjzerenHein on 13-11-21. -// Copyright (c) 2017 IjzerenHein. All rights reserved. -// - -#import "ABI46_0_0AIRMapPolylineRenderer.h" - -@interface ABI46_0_0AIRMapPolylineRendererSegment : NSObject -- (id)initWithPoint:(CGPoint)point color:(UIColor*)color; -- (void) addPoint:(CGPoint)point color:(UIColor*)color; -@property CGMutablePathRef path; -@property UIColor *startColor; -@property UIColor *endColor; -@property CGPoint startPoint; -@property CGPoint endPoint; -@end -@implementation ABI46_0_0AIRMapPolylineRendererSegment -- (id)initWithPoint:(CGPoint)point color:(UIColor*)color -{ - self = [super init]; - if (self){ - self.path = CGPathCreateMutable(); - self.startColor = color; - self.startPoint = point; - self.endPoint = point; - CGPathMoveToPoint(self.path, nil, point.x, point.y); - } - return self; -} -- (void) addPoint:(CGPoint)point color:(UIColor*)color -{ - self.endPoint = point; - self.endColor = color; - CGPathAddLineToPoint(self.path, nil, point.x, point.y); -} -@end - -@implementation ABI46_0_0AIRMapPolylineRenderer { - MKPolyline* _polyline; - NSArray *_strokeColors; - MKMapSnapshot* _snapshot; - CLLocationCoordinate2D* _coordinates; -} - -@synthesize strokeColors; - -- (id)initWithOverlay:(id)overlay polyline:(MKPolyline*)polyline -{ - self = [super initWithOverlay:overlay]; - if (self){ - _polyline = polyline; - [self createPath]; - } - return self; -} - -- (id)initWithSnapshot:(MKMapSnapshot*)snapshot overlay:(id)overlay polyline:(MKPolyline*)polyline -{ - self = [super initWithOverlay:overlay]; - if (self){ - _snapshot = snapshot; - _polyline = polyline; - _coordinates = malloc(sizeof(CLLocationCoordinate2D) * [_polyline pointCount]); - [_polyline getCoordinates:_coordinates range:NSMakeRange(0, [_polyline pointCount])]; - } - return self; -} - -- (void) dealloc -{ - if (_coordinates) free(_coordinates); -} - -- (CGPoint) pointForIndex:(NSUInteger)index -{ - if (_snapshot != nil) { - return [_snapshot pointForCoordinate:_coordinates[index]]; - } - else { - return [self pointForMapPoint:_polyline.points[index]]; - } -} - -- (UIColor*) colorForIndex:(NSUInteger)index -{ - if ((_strokeColors == nil) || !_strokeColors.count) return self.strokeColor; - index = MIN(index, _strokeColors.count - 1); - UIColor* color = _strokeColors[index]; - CGFloat pc_r,pc_g,pc_b,pc_a; - [color getRed:&pc_r green:&pc_g blue:&pc_b alpha:&pc_a]; - return (pc_a == 0) ? nil : color; -} - -- (void) createPath -{ - CGMutablePathRef path = CGPathCreateMutable(); - BOOL first = YES; - for (NSUInteger i = 0, n = _polyline.pointCount; i < n; i++){ - CGPoint point = [self pointForIndex:i]; - if (first) { - CGPathMoveToPoint(path, nil, point.x, point.y); - first = NO; - } else { - CGPathAddLineToPoint(path, nil, point.x, point.y); - } - } - self.path = path; -} - -- (NSArray*) createSegments -{ - NSMutableArray* segments = [NSMutableArray new]; - if (_polyline.pointCount <= 1) return segments; - ABI46_0_0AIRMapPolylineRendererSegment* segment = nil; - for (NSUInteger i = 0, n = _polyline.pointCount; i < n; i++){ - CGPoint point = [self pointForIndex:i]; - UIColor* color = [self colorForIndex:i]; - if (segment == nil) { - - // Start new segment - segment = [[ABI46_0_0AIRMapPolylineRendererSegment alloc] initWithPoint:point color:color]; - [segments addObject:segment]; - } - else if (((color == nil) && (segment.endColor == nil)) || - ((color != nil) && [segment.startColor isEqual:color])) { - - // Append point to segment - [segment addPoint:point color: color]; - } - else { - - // Close the last segment if needed - if (segment.endColor == nil) { - [segment addPoint:point color:color]; - } - else { - - // Add transition gradient - segment = [[ABI46_0_0AIRMapPolylineRendererSegment alloc] initWithPoint:segment.endPoint color:segment.endColor]; - [segment addPoint:point color:color]; - [segments addObject:segment]; - } - - // Start new segment - if (i < (n - 1)) { - segment = [[ABI46_0_0AIRMapPolylineRendererSegment alloc] initWithPoint:point color:color]; - [segments addObject:segment]; - } - } - } - - // Remove last segment in case it only contains a single path point - if ((segment != nil) && (segment.endColor == nil)) { - [segments removeLastObject]; - } - - return segments; -} - -- (void) setStrokeColors:(NSArray *)strokeColors -{ - if (_strokeColors != strokeColors) { - _strokeColors = strokeColors; - } -} - -- (void) setStrokeColor:(UIColor *)strokeColor -{ - if (super.strokeColor != strokeColor) { - super.strokeColor = strokeColor; - } -} - -- (void) drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context -{ - CGRect pointsRect = CGPathGetBoundingBox(self.path); - CGRect mapRectCG = [self rectForMapRect:mapRect]; - if (!CGRectIntersectsRect(pointsRect, mapRectCG)) return; - - [self drawWithZoomScale:zoomScale inContext:context]; -} - -- (void) drawWithZoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context -{ - CGFloat lineWidth = (self.lineWidth / zoomScale) * 2.0; - CGContextSetLineWidth(context, lineWidth); - CGContextSetLineCap(context, self.lineCap); - CGContextSetLineJoin(context, self.lineJoin); - CGContextSetFillColorWithColor(context, self.fillColor.CGColor); - CGContextSetMiterLimit(context, self.miterLimit); - CGFloat dashes[self.lineDashPattern.count]; - for (NSUInteger i = 0; i < self.lineDashPattern.count; i++) { - dashes[i] = self.lineDashPattern[i].floatValue; - } - CGContextSetLineDash(context, self.lineDashPhase, dashes, self.lineDashPattern.count); - - NSArray* segments = [self createSegments]; - for (NSUInteger i = 0, n = segments.count; i < n; i++) { - ABI46_0_0AIRMapPolylineRendererSegment* segment = segments[i]; - - CGContextBeginPath(context); - CGContextAddPath(context, segment.path); - - // When segment has two colors, draw it as a gradient - if (![segment.startColor isEqual:segment.endColor]) { - CGFloat pc_r,pc_g,pc_b,pc_a, - cc_r,cc_g,cc_b,cc_a; - [segment.startColor getRed:&pc_r green:&pc_g blue:&pc_b alpha:&pc_a]; - [segment.endColor getRed:&cc_r green:&cc_g blue:&cc_b alpha:&cc_a]; - CGFloat gradientColors[8] = {pc_r,pc_g,pc_b,pc_a, - cc_r,cc_g,cc_b,cc_a}; - CGFloat gradientLocation[2] = {0,1}; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColorComponents(colorSpace, gradientColors, gradientLocation, 2); - CGColorSpaceRelease(colorSpace); - - CGContextReplacePathWithStrokedPath(context); - CGContextClip(context); - CGContextDrawLinearGradient( - context, - gradient, - segment.startPoint, - segment.endPoint, - kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation - ); - CGGradientRelease(gradient); - CGContextResetClip(context); - } - else { - CGContextSetStrokeColorWithColor(context, segment.startColor.CGColor); - CGContextStrokePath(context); - } - } -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapSnapshot.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapSnapshot.h deleted file mode 100644 index e5db7b15d9b663..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapSnapshot.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRMapSnapshot.h -// AirMaps -// -// Created by Hein Rutjes on 26/09/16. -// Copyright © 2016 Christopher. All rights reserved. -// - -#ifndef ABI46_0_0AIRMapSnapshot_h -#define ABI46_0_0AIRMapSnapshot_h - -@protocol ABI46_0_0AIRMapSnapshot -@optional -- (void) drawToSnapshot:(MKMapSnapshot *) snapshot context:(CGContextRef) context; -@end - -#endif /* ABI46_0_0AIRMapSnapshot_h */ diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.h deleted file mode 100644 index 81e300d43ff459..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.h +++ /dev/null @@ -1,57 +0,0 @@ -// -// ABI46_0_0AIRUrlTileOverlay.h -// AirMaps -// -// Created by cascadian on 3/19/16. -// Copyright © 2016. All rights reserved. -// - -#import -#import -#import - -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapUrlTileCachedOverlay.h" - -@interface ABI46_0_0AIRMapUrlTile : MKAnnotationView { - BOOL _urlTemplateSet; - BOOL _tileSizeSet; - BOOL _flipYSet; - BOOL _tileCachePathSet; - BOOL _tileCacheMaxAgeSet; - BOOL _maximumNativeZSet; - BOOL _cachedOverlayCreated; - BOOL _opacitySet; -} - -@property (nonatomic, weak) ABI46_0_0AIRMap *map; - -@property (nonatomic, strong) ABI46_0_0AIRMapUrlTileCachedOverlay *tileOverlay; -@property (nonatomic, strong) MKTileOverlayRenderer *renderer; -@property (nonatomic, copy) NSString *urlTemplate; -@property NSInteger maximumZ; -@property NSInteger maximumNativeZ; -@property NSInteger minimumZ; -@property BOOL flipY; -@property BOOL shouldReplaceMapContent; -@property NSInteger tileSize; -@property (nonatomic, copy) NSString *tileCachePath; -@property NSInteger tileCacheMaxAge; -@property BOOL offlineMode; -@property CGFloat opacity; - -- (void)updateProperties; -- (void)update; - -#pragma mark MKOverlay protocol - -@property(nonatomic, readonly) CLLocationCoordinate2D coordinate; -@property(nonatomic, readonly) MKMapRect boundingMapRect; -//- (BOOL)intersectsMapRect:(MKMapRect)mapRect; -- (BOOL)canReplaceMapContent; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.m deleted file mode 100644 index 21c6210498d16c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTile.m +++ /dev/null @@ -1,211 +0,0 @@ -// -// ABI46_0_0AIRUrlTileOverlay.m -// AirMaps -// -// Created by cascadian on 3/19/16. -// Copyright © 2016. All rights reserved. -// - -#import "ABI46_0_0AIRMapUrlTile.h" -#import -#import "ABI46_0_0AIRMapUrlTileCachedOverlay.h" - -@implementation ABI46_0_0AIRMapUrlTile - -- (void)setShouldReplaceMapContent:(BOOL)shouldReplaceMapContent -{ - _shouldReplaceMapContent = shouldReplaceMapContent; - if (self.tileOverlay) { - self.tileOverlay.canReplaceMapContent = _shouldReplaceMapContent; - } - [self update]; -} - -- (void)setMaximumZ:(NSInteger)maximumZ -{ - _maximumZ = maximumZ; - if (self.tileOverlay) { - self.tileOverlay.maximumZ = _maximumZ; - } - [self update]; -} - -- (void)setMaximumNativeZ:(NSInteger)maximumNativeZ -{ - _maximumNativeZ = maximumNativeZ; - _maximumNativeZSet = YES; - if (_cachedOverlayCreated) { - self.tileOverlay.maximumNativeZ = _maximumNativeZ; - } else { - [self createTileOverlayAndRendererIfPossible]; - } - [self update]; -} - -- (void)setMinimumZ:(NSInteger)minimumZ -{ - _minimumZ = minimumZ; - if (self.tileOverlay) { - self.tileOverlay.minimumZ = _minimumZ; - } - [self update]; -} - -- (void)setFlipY:(BOOL)flipY -{ - _flipY = flipY; - _flipYSet = YES; - if (self.tileOverlay) { - self.tileOverlay.geometryFlipped = _flipY; - } - [self update]; -} - -- (void)setUrlTemplate:(NSString *)urlTemplate -{ - _urlTemplate = urlTemplate; - _urlTemplateSet = YES; - [self createTileOverlayAndRendererIfPossible]; - [self update]; -} - -- (void)setTileSize:(NSInteger)tileSize -{ - _tileSize = tileSize; - _tileSizeSet = YES; - [self createTileOverlayAndRendererIfPossible]; - [self update]; -} - -- (void)setTileCachePath:(NSString *)tileCachePath{ - if (!tileCachePath) return; - _tileCachePath = tileCachePath; - _tileCachePathSet = YES; - [self createTileOverlayAndRendererIfPossible]; - [self update]; -} - -- (void)setTileCacheMaxAge:(NSInteger)tileCacheMaxAge{ - _tileCacheMaxAge = tileCacheMaxAge; - _tileCacheMaxAgeSet = YES; - if (_cachedOverlayCreated) { - self.tileOverlay.tileCacheMaxAge = _tileCacheMaxAge; - } else { - [self createTileOverlayAndRendererIfPossible]; - } - [self update]; -} - -- (void)setOfflineMode:(BOOL)offlineMode -{ - _offlineMode = offlineMode; - if (_cachedOverlayCreated) { - self.tileOverlay.offlineMode = _offlineMode; - } - if (self.renderer) [self.renderer reloadData]; -} - -- (void)setOpacity:(CGFloat)opacity -{ - _opacity = opacity; - _opacitySet = YES; - if (self.renderer) { - self.renderer.alpha = opacity; - } else { - [self createTileOverlayAndRendererIfPossible]; - } - [self update]; -} - -- (void)createTileOverlayAndRendererIfPossible -{ - if (!_urlTemplateSet) return; - if (_tileCachePathSet || _maximumNativeZSet) { - NSLog(@"tileCache dir %@", _tileCachePath); - self.tileOverlay = [[ABI46_0_0AIRMapUrlTileCachedOverlay alloc] initWithURLTemplate:self.urlTemplate]; - _cachedOverlayCreated = YES; - if (_tileCachePathSet) { - NSURL *urlPath = [NSURL URLWithString:[self.tileCachePath stringByAppendingString:@"/"]]; - if (urlPath.fileURL) { - self.tileOverlay.tileCachePath = urlPath; - } else { - NSURL *filePath = [NSURL fileURLWithPath:self.tileCachePath isDirectory:YES]; - self.tileOverlay.tileCachePath = filePath; - } - - if (_tileCacheMaxAgeSet) { - self.tileOverlay.tileCacheMaxAge = self.tileCacheMaxAge; - } - } - } else { - NSLog(@"tileCache normal overlay"); - self.tileOverlay = [[MKTileOverlay alloc] initWithURLTemplate:self.urlTemplate]; - _cachedOverlayCreated = NO; - } - - [self updateProperties]; - - self.renderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:self.tileOverlay]; - if (_opacitySet) { - self.renderer.alpha = self.opacity; - } -} - -- (void)updateProperties -{ - self.tileOverlay.canReplaceMapContent = self.shouldReplaceMapContent; - - if(self.minimumZ) { - self.tileOverlay.minimumZ = self.minimumZ; - } - if (self.maximumZ) { - self.tileOverlay.maximumZ = self.maximumZ; - } - if (_cachedOverlayCreated && self.maximumNativeZ) { - self.tileOverlay.maximumNativeZ = self.maximumNativeZ; - } - if (_flipYSet) { - self.tileOverlay.geometryFlipped = self.flipY; - } - if (_tileSizeSet) { - self.tileOverlay.tileSize = CGSizeMake(self.tileSize, self.tileSize); - } - if (_cachedOverlayCreated && self.offlineMode) { - self.tileOverlay.offlineMode = self.offlineMode; - } -} - -- (void)update -{ - if (!_renderer) return; - - if (_map == nil) return; - [_map removeOverlay:self]; - [_map addOverlay:self level:MKOverlayLevelAboveLabels]; - for (id overlay in _map.overlays) { - if ([overlay isKindOfClass:[ABI46_0_0AIRMapUrlTile class]]) { - continue; - } - [_map removeOverlay:overlay]; - [_map addOverlay:overlay]; - } -} - -#pragma mark MKOverlay implementation - -- (CLLocationCoordinate2D)coordinate -{ - return self.tileOverlay.coordinate; -} - -- (MKMapRect)boundingMapRect -{ - return self.tileOverlay.boundingMapRect; -} - -- (BOOL)canReplaceMapContent -{ - return self.tileOverlay.canReplaceMapContent; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.h deleted file mode 100644 index df745e78da2053..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// ABI46_0_0AIRMapUrlTileCachedOverlay.h -// Airmaps -// -// Created by Markus Suomi on 10/04/2021. -// - -#import - -@interface ABI46_0_0AIRMapUrlTileCachedOverlay : MKTileOverlay - -@property NSInteger maximumNativeZ; -@property (nonatomic, copy) NSURL *tileCachePath; -@property NSInteger tileCacheMaxAge; -@property BOOL offlineMode; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.m deleted file mode 100644 index 5b324eb2ec5b6d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileCachedOverlay.m +++ /dev/null @@ -1,235 +0,0 @@ -// -// ABI46_0_0AIRMapUrlTileCachedOverlay.m -// Airmaps -// -// Created by Markus Suomi on 10/04/2021. -// - -#import "ABI46_0_0AIRMapUrlTileCachedOverlay.h" - -@interface ABI46_0_0AIRMapUrlTileCachedOverlay () - -@end - -@implementation ABI46_0_0AIRMapUrlTileCachedOverlay { - CIContext *_ciContext; - CGColorSpaceRef _colorspace; - NSURLSession *_urlSession; -} - -- (void)loadTileAtPath:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result -{ - if (!result) return; - - NSInteger maximumZ = self.maximumNativeZ ? self.maximumNativeZ : path.z; - [self scaleIfNeededLowerZoomTile:path maximumZ:maximumZ result:^(NSData *image, NSError *error) { - if (!image && self.offlineMode && self.tileCachePath) { - NSInteger zoomLevelToStart = (path.z > maximumZ) ? maximumZ - 1 : path.z - 1; - NSInteger minimumZoomToSearch = self.minimumZ >= zoomLevelToStart - 3 ? self.minimumZ : zoomLevelToStart - 3; - [self findLowerZoomTileAndScale:path tryZ:zoomLevelToStart minZ:minimumZoomToSearch result:result]; - } else { - result(image, error); - } - }]; -} - -- (void)scaleIfNeededLowerZoomTile:(MKTileOverlayPath)path maximumZ:(NSInteger)maximumZ result:(void (^)(NSData *, NSError *))result -{ - NSInteger overZoomLevel = path.z - maximumZ; - if (overZoomLevel <= 0) { - [self getTileImage:path result:result]; - return; - } - - NSInteger zoomFactor = 1 << overZoomLevel; - - MKTileOverlayPath parentTile; - parentTile.x = path.x >> overZoomLevel; - parentTile.y = path.y >> overZoomLevel; - parentTile.z = path.z - overZoomLevel; - parentTile.contentScaleFactor = path.contentScaleFactor; - - NSInteger xOffset = path.x % zoomFactor; - NSInteger yOffset = path.y % zoomFactor; - NSInteger subTileSize = self.tileSize.width / zoomFactor; - - if (!_ciContext) _ciContext = [CIContext context]; - if (!_colorspace) _colorspace = CGColorSpaceCreateDeviceRGB(); - - [self getTileImage:parentTile result:^(NSData *image, NSError *error) { - if (!image) { - result(nil, nil); - return; - } - - CIImage* originalCIImage = [CIImage imageWithData:image]; - - CGRect rect; - rect.origin.x = xOffset * subTileSize; - rect.origin.y = self.tileSize.width - (yOffset + 1) * subTileSize; - rect.size.width = subTileSize; - rect.size.height = subTileSize; - CIVector *inputRect = [CIVector vectorWithCGRect:rect]; - CIFilter* cropFilter = [CIFilter filterWithName:@"CICrop"]; - [cropFilter setValue:originalCIImage forKey:@"inputImage"]; - [cropFilter setValue:inputRect forKey:@"inputRectangle"]; - - CGAffineTransform trans = CGAffineTransformMakeScale(zoomFactor, zoomFactor); - CIImage* scaledCIImage = [cropFilter.outputImage imageByApplyingTransform:trans]; - - NSData *finalImage = [_ciContext PNGRepresentationOfImage:scaledCIImage format:kCIFormatABGR8 colorSpace:_colorspace options:nil]; - result(finalImage, nil); - }]; -} - -- (void)findLowerZoomTileAndScale:(MKTileOverlayPath)path tryZ:(NSInteger)tryZ minZ:(NSInteger)minZ result:(void (^)(NSData *, NSError *))result -{ - [self scaleIfNeededLowerZoomTile:path maximumZ:tryZ result:^(NSData *image, NSError *error) { - if (image) { - result(image, error); - } else if (tryZ >= minZ) { - [self findLowerZoomTileAndScale:path tryZ:tryZ - 1 minZ:minZ result:result]; - } else { - result(nil, nil); - } - }]; -} - -- (void)getTileImage:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result -{ - NSData *image; - NSURL *tileCacheFileDirectory = [NSURL URLWithString:[NSString stringWithFormat:@"%d/%d/", (int)path.z, (int)path.x] relativeToURL:self.tileCachePath]; - NSURL *tileCacheFilePath = [NSURL URLWithString:[NSString stringWithFormat:@"%d", (int)path.y] relativeToURL:tileCacheFileDirectory]; - - if (self.tileCachePath) { - image = [self readTileImage:path fromFilePath:tileCacheFilePath]; - if (image) { - result(image, nil); - if (!self.offlineMode && self.tileCacheMaxAge) { - [self checkForRefresh:path fromFilePath:tileCacheFilePath]; - } - } - } - - if (!image) { - if (!self.offlineMode) { - [self fetchTile:path result:^(NSData *image, NSError *error) { - result(image, error); - if (image && self.tileCachePath) { - [self writeTileImage:tileCacheFileDirectory withTileCacheFilePath:tileCacheFilePath withTileData:image]; - } - }]; - } else { - result(nil, nil); - } - } -} - -- (NSData *)readTileImage:(MKTileOverlayPath)path fromFilePath:(NSURL *)tileCacheFilePath -{ - NSError *error; - - if ([[NSFileManager defaultManager] fileExistsAtPath:[tileCacheFilePath path]]) { - if (!self.tileCacheMaxAge) { - [[NSFileManager defaultManager] setAttributes:@{NSFileModificationDate:[NSDate date]} - ofItemAtPath:[tileCacheFilePath path] - error:&error]; - } - - NSData *tile = [NSData dataWithContentsOfFile:[tileCacheFilePath path]]; - NSLog(@"tileCache HIT for %d_%d_%d", (int)path.z, (int)path.x, (int)path.y); - NSLog(@"tileCache HIT, with max age set at %d", self.tileCacheMaxAge); - return tile; - } else { - NSLog(@"tileCache MISS for %d_%d_%d", (int)path.z, (int)path.x, (int)path.y); - return nil; - } -} - -- (void)fetchTile:(MKTileOverlayPath)path result:(void (^)(NSData *, NSError *))result -{ - if (!_urlSession) [self createURLSession]; - - [[_urlSession dataTaskWithURL:[self URLForTilePath:path] - completionHandler:^(NSData *data, - NSURLResponse *response, - NSError *error) { - result(data, error); - }] resume]; -} - -- (void)writeTileImage:(NSURL *)tileCacheFileDirectory withTileCacheFilePath:(NSURL *)tileCacheFilePath withTileData:(NSData *)data -{ - NSError *error; - - if (![[NSFileManager defaultManager] fileExistsAtPath:[tileCacheFileDirectory path]]) { - [[NSFileManager defaultManager] createDirectoryAtPath:[tileCacheFileDirectory path] withIntermediateDirectories:YES attributes:nil error:&error]; - if (error) { - NSLog(@"Error: %@", error); - return; - } - } - - [[NSFileManager defaultManager] createFileAtPath:[tileCacheFilePath path] contents:data attributes:nil]; - NSLog(@"tileCache SAVED tile %@", [tileCacheFilePath path]); -} - -- (void)createTileCacheDirectory -{ - NSError *error; - NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentsDirectory = [paths objectAtIndex:0]; - NSString *tileCacheBaseDirectory = [NSString stringWithFormat:@"%@/tileCache", documentsDirectory]; - self.tileCachePath = [NSURL fileURLWithPath:tileCacheBaseDirectory isDirectory:YES]; - - if (![[NSFileManager defaultManager] fileExistsAtPath:[self.tileCachePath path]]) - [[NSFileManager defaultManager] createDirectoryAtPath:[self.tileCachePath path] withIntermediateDirectories:NO attributes:nil error:&error]; -} - -- (void)createURLSession -{ - if (!_urlSession) { - _urlSession = [NSURLSession sharedSession]; - } -} - -- (void)checkForRefresh:(MKTileOverlayPath)path fromFilePath:(NSURL *)tileCacheFilePath -{ - if ([self doesFileNeedRefresh:path fromFilePath:tileCacheFilePath withMaxAge:self.tileCacheMaxAge]) { - dispatch_async(dispatch_get_global_queue(QOS_CLASS_UTILITY, 0), ^ { - // This code runs asynchronously! - if ([self doesFileNeedRefresh:path fromFilePath:tileCacheFilePath withMaxAge:self.tileCacheMaxAge]) { - if (!_urlSession) [self createURLSession]; - - [[_urlSession dataTaskWithURL:[self URLForTilePath:path] - completionHandler:^(NSData *data, - NSURLResponse *response, - NSError *error) { - if (!error) { - [[NSFileManager defaultManager] createFileAtPath:[tileCacheFilePath path] contents:data attributes:nil]; - NSLog(@"tileCache File refreshed at %@", [tileCacheFilePath path]); - } - }] resume]; - } - }); - } -} - -- (BOOL)doesFileNeedRefresh:(MKTileOverlayPath)path fromFilePath:(NSURL *)tileCacheFilePath withMaxAge:(NSInteger)tileCacheMaxAge -{ - NSError *error; - NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[tileCacheFilePath path] error:&error]; - - if (fileAttributes) { - NSDate *modificationDate = fileAttributes[@"NSFileModificationDate"]; - if (modificationDate) { - if (-1 * (int)modificationDate.timeIntervalSinceNow > tileCacheMaxAge) { - return YES; - } - } - } - - return NO; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.h deleted file mode 100644 index 6f6eefae0fce26..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ABI46_0_0AIRMapUrlTileManager.h -// AirMaps -// -// Created by cascadian on 3/19/16. -// Copyright © 2016. All rights reserved. -// - - -#import - -@interface ABI46_0_0AIRMapUrlTileManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.m deleted file mode 100644 index 133ee1ff7508cf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapUrlTileManager.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// ABI46_0_0AIRMapUrlTileManager.m -// AirMaps -// -// Created by cascadian on 3/19/16. -// Copyright © 2016. All rights reserved. -// - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapUrlTile.h" - -#import "ABI46_0_0AIRMapUrlTileManager.h" - -@interface ABI46_0_0AIRMapUrlTileManager() - -@end - -@implementation ABI46_0_0AIRMapUrlTileManager - - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapUrlTile *tile = [ABI46_0_0AIRMapUrlTile new]; - return tile; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(urlTemplate, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumNativeZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(flipY, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(shouldReplaceMapContent, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileSize, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileCachePath, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileCacheMaxAge, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(offlineMode, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.h deleted file mode 100644 index 43639a38503665..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// ABI46_0_0AIRMapWMSTile.h -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - - -#import -#import -#import - -#import -#import -#import "ABI46_0_0AIRMapCoordinate.h" -#import "ABI46_0_0AIRMap.h" -#import "ABI46_0_0RCTConvert+AirMap.h" -#import "ABI46_0_0AIRMapUrlTile.h" -#import "ABI46_0_0AIRMapUrlTileCachedOverlay.h" - -@interface ABI46_0_0AIRMapWMSTile : ABI46_0_0AIRMapUrlTile -@end - -@interface ABI46_0_0AIRMapWMSTileOverlay : MKTileOverlay -@end - -@interface ABI46_0_0AIRMapWMSTileCachedOverlay : ABI46_0_0AIRMapUrlTileCachedOverlay -@end - -@interface ABI46_0_0AIRMapWMSTileHelper : NSObject - -+ (NSURL *)URLForTilePath:(MKTileOverlayPath)path withURLTemplate:(NSString *)URLTemplate withTileSize:(NSInteger)tileSize; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.m deleted file mode 100644 index 4dc19e65c127a6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTile.m +++ /dev/null @@ -1,116 +0,0 @@ -// -// ABI46_0_0AIRMapWMSTile.m -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - -#import "ABI46_0_0AIRMapWMSTile.h" -#import - -@implementation ABI46_0_0AIRMapWMSTile - -- (void)createTileOverlayAndRendererIfPossible -{ - if (!_urlTemplateSet) return; - if (_tileCachePathSet || _maximumNativeZSet) { - NSLog(@"tileCache new overlay dir %@", self.tileCachePath); - NSLog(@"tileCache %d", _tileCachePathSet); - NSLog(@"tileCache %d", _maximumNativeZSet); - self.tileOverlay = [[ABI46_0_0AIRMapWMSTileCachedOverlay alloc] initWithURLTemplate:self.urlTemplate]; - _cachedOverlayCreated = YES; - if (_tileCachePathSet) { - NSURL *urlPath = [NSURL URLWithString:[self.tileCachePath stringByAppendingString:@"/"]]; - if (urlPath.fileURL) { - self.tileOverlay.tileCachePath = urlPath; - } else { - NSURL *filePath = [NSURL fileURLWithPath:self.tileCachePath isDirectory:YES]; - self.tileOverlay.tileCachePath = filePath; - } - - if (_tileCacheMaxAgeSet) { - self.tileOverlay.tileCacheMaxAge = self.tileCacheMaxAge; - } - } - } else { - NSLog(@"tileCache normal overlay"); - self.tileOverlay = [[ABI46_0_0AIRMapWMSTileOverlay alloc] initWithURLTemplate:self.urlTemplate]; - _cachedOverlayCreated = NO; - } - - [self updateProperties]; - - self.renderer = [[MKTileOverlayRenderer alloc] initWithTileOverlay:self.tileOverlay]; - if (_opacitySet) { - self.renderer.alpha = self.opacity; - } -} - -@end - - -@implementation ABI46_0_0AIRMapWMSTileOverlay - -- (id)initWithURLTemplate:(NSString *)URLTemplate -{ - self = [super initWithURLTemplate:URLTemplate]; - return self; -} - -- (NSURL *)URLForTilePath:(MKTileOverlayPath)path -{ - return [ABI46_0_0AIRMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width]; -} - -@end - - -@implementation ABI46_0_0AIRMapWMSTileCachedOverlay - -- (id)initWithURLTemplate:(NSString *)URLTemplate -{ - self = [super initWithURLTemplate:URLTemplate]; - return self; -} - -- (NSURL *)URLForTilePath:(MKTileOverlayPath)path -{ - return [ABI46_0_0AIRMapWMSTileHelper URLForTilePath:path withURLTemplate:self.URLTemplate withTileSize:self.tileSize.width]; -} - -@end - - -@implementation ABI46_0_0AIRMapWMSTileHelper -+ (NSURL *)URLForTilePath:(MKTileOverlayPath)path withURLTemplate:(NSString *)URLTemplate withTileSize:(NSInteger)tileSize -{ - NSArray *bb = [self getBoundBox:path.x yAxis:path.y zoom:path.z]; - NSMutableString *url = [URLTemplate mutableCopy]; - [url replaceOccurrencesOfString: @"{minX}" withString:[NSString stringWithFormat:@"%@", bb[0]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{minY}" withString:[NSString stringWithFormat:@"%@", bb[1]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{maxX}" withString:[NSString stringWithFormat:@"%@", bb[2]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{maxY}" withString:[NSString stringWithFormat:@"%@", bb[3]] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{width}" withString:[NSString stringWithFormat:@"%d", (int)tileSize] options:0 range:NSMakeRange(0, url.length)]; - [url replaceOccurrencesOfString: @"{height}" withString:[NSString stringWithFormat:@"%d", (int)tileSize] options:0 range:NSMakeRange(0, url.length)]; - return [NSURL URLWithString:url]; -} - -+ (NSArray *)getBoundBox:(NSInteger)x yAxis:(NSInteger)y zoom:(NSInteger)zoom -{ - double MapX = -20037508.34789244; - double MapY = 20037508.34789244; - double FULL = 20037508.34789244 * 2; - double tile = FULL / pow(2.0, (double)zoom); - - NSArray *result =[[NSArray alloc] initWithObjects: - [NSNumber numberWithDouble:MapX + (double)x * tile], - [NSNumber numberWithDouble:MapY - (double)(y + 1) * tile], - [NSNumber numberWithDouble:MapX + (double)(x + 1) * tile], - [NSNumber numberWithDouble:MapY - (double)y * tile], - nil]; - - return result; -} - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.h deleted file mode 100644 index fbed1c71c57548..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// ABI46_0_0AIRMapWMSTileManager.h -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - - -#import - -@interface ABI46_0_0AIRMapWMSTileManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.m deleted file mode 100644 index a263a9e0dad814..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRMapWMSTileManager.m +++ /dev/null @@ -1,47 +0,0 @@ -// -// ABI46_0_0AIRMapWMSTileManager.m -// AirMaps -// -// Created by nizam on 10/28/18. -// Copyright © 2018. All rights reserved. -// - - -#import -#import -#import -#import -#import -#import -#import "ABI46_0_0AIRMapMarker.h" -#import "ABI46_0_0AIRMapWMSTile.h" - -#import "ABI46_0_0AIRMapWMSTileManager.h" - -@interface ABI46_0_0AIRMapWMSTileManager() - -@end - -@implementation ABI46_0_0AIRMapWMSTileManager - - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0AIRMapWMSTile *tile = [ABI46_0_0AIRMapWMSTile new]; - return tile; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(urlTemplate, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumNativeZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumZ, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(shouldReplaceMapContent, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileSize, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileCachePath, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tileCacheMaxAge, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(offlineMode, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.h deleted file mode 100644 index f39484236292c8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import -#import "ABI46_0_0AIRMap.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0AIRWeakMapReference : NSObject - -@property (nonatomic, weak) ABI46_0_0AIRMap *mapView; - -- (instancetype)initWithMapView:(ABI46_0_0AIRMap *)mapView; - - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.m deleted file mode 100644 index ed87489d9f7e2a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakMapReference.m +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRWeakMapReference.h" - -@implementation ABI46_0_0AIRWeakMapReference - - -- (instancetype)initWithMapView:(ABI46_0_0AIRMap *)mapView { - self = [super init]; - if (self) { - _mapView = mapView; - } - return self; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.h deleted file mode 100644 index 6c870ec0da9963..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.h +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0AIRWeakTimerReference : NSObject - -- (instancetype)initWithTarget:(id)target andSelector:(SEL)selector; -- (void)timerDidFire:(NSTimer *)timer; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.m deleted file mode 100644 index 496cfe796976e9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0AIRWeakTimerReference.m +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -#import "ABI46_0_0AIRWeakTimerReference.h" - -@implementation ABI46_0_0AIRWeakTimerReference -{ - __weak NSObject *_target; - SEL _selector; -} - - -- (instancetype)initWithTarget:(id)target andSelector:(SEL)selector { - self = [super init]; - if (self) { - _target = target; - _selector = selector; - } - return self; -} - - -- (void)timerDidFire:(NSTimer *)timer -{ - if(_target) - { - [_target performSelector:_selector withObject:timer]; - } - else - { - [timer invalidate]; - } -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.h deleted file mode 100644 index 5872498d319cf7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import -#import -#import - -@interface ABI46_0_0RCTConvert (AirMap) - -+ (MKCoordinateSpan)MKCoordinateSpan:(id)json; -+ (MKCoordinateRegion)MKCoordinateRegion:(id)json; -+ (MKMapCamera*)MKMapCamera:(id)json; -+ (MKMapCamera*)MKMapCameraWithDefaults:(id)json existingCamera:(MKMapCamera*)camera; -+ (MKMapType)MKMapType:(id)json; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.m deleted file mode 100644 index 312b4f289a9120..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/ABI46_0_0RCTConvert+AirMap.m +++ /dev/null @@ -1,88 +0,0 @@ -// -// Created by Leland Richardson on 12/27/15. -// Copyright (c) 2015 Facebook. All rights reserved. -// - -#import "ABI46_0_0RCTConvert+AirMap.h" - -#import -#import "ABI46_0_0AIRMapCoordinate.h" - -@implementation ABI46_0_0RCTConvert (AirMap) - -+ (MKCoordinateSpan)MKCoordinateSpan:(id)json -{ - json = [self NSDictionary:json]; - return (MKCoordinateSpan){ - [self CLLocationDegrees:json[@"latitudeDelta"]], - [self CLLocationDegrees:json[@"longitudeDelta"]] - }; -} - -+ (MKCoordinateRegion)MKCoordinateRegion:(id)json -{ - return (MKCoordinateRegion){ - [self CLLocationCoordinate2D:json], - [self MKCoordinateSpan:json] - }; -} - -+ (MKMapCamera*)MKMapCamera:(id)json -{ - json = [self NSDictionary:json]; - return [ABI46_0_0RCTConvert MKMapCameraWithDefaults:json existingCamera:nil]; -} - -+ (MKMapCamera*)MKMapCameraWithDefaults:(id)json existingCamera:(MKMapCamera*)camera -{ - json = [self NSDictionary:json]; - if (camera == nil) { - camera = [[MKMapCamera alloc] init]; - } else { - camera = [camera copy]; - } - if (json[@"center"]) { - camera.centerCoordinate = [self CLLocationCoordinate2D:json[@"center"]]; - } - if (json[@"pitch"]) { - camera.pitch = [self double:json[@"pitch"]]; - } - if (json[@"altitude"]) { - camera.altitude = [self double:json[@"altitude"]]; - } - if (json[@"heading"]) { - camera.heading = [self double:json[@"heading"]]; - } - return camera; -} - - -ABI46_0_0RCT_ENUM_CONVERTER(MKMapType, (@{ - @"standard": @(MKMapTypeStandard), - @"satellite": @(MKMapTypeSatellite), - @"hybrid": @(MKMapTypeHybrid), - @"satelliteFlyover": @(MKMapTypeSatelliteFlyover), - @"hybridFlyover": @(MKMapTypeHybridFlyover), - @"mutedStandard": @(MKMapTypeMutedStandard) -}), MKMapTypeStandard, integerValue) - -// NOTE(lmr): -// This is a bit of a hack, but I'm using this class to simply wrap -// around a `CLLocationCoordinate2D`, since I was unable to figure out -// how to handle an array of structs like CLLocationCoordinate2D. Would love -// to get rid of this if someone can show me how... -+ (ABI46_0_0AIRMapCoordinate *)ABI46_0_0AIRMapCoordinate:(id)json -{ - ABI46_0_0AIRMapCoordinate *coord = [ABI46_0_0AIRMapCoordinate new]; - coord.coordinate = [self CLLocationCoordinate2D:json]; - return coord; -} - -ABI46_0_0RCT_ARRAY_CONVERTER(ABI46_0_0AIRMapCoordinate) - -+ (NSArray *> *)ABI46_0_0AIRMapCoordinateArrayArray:(id)json -{ - return ABI46_0_0RCTConvertArrayValue(@selector(ABI46_0_0AIRMapCoordinateArray:), json); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.h deleted file mode 100644 index 9aaac3951736a0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.h +++ /dev/null @@ -1,204 +0,0 @@ -#import -#import - -/* - -ABI46_0_0SMCalloutView -------------- -Created by Nick Farina (nfarina@gmail.com) -Version 2.1.2 - -*/ - -/// options for which directions the callout is allowed to "point" in. -typedef NS_OPTIONS(NSUInteger, ABI46_0_0SMCalloutArrowDirection) { - ABI46_0_0SMCalloutArrowDirectionUp = 1 << 0, - ABI46_0_0SMCalloutArrowDirectionDown = 1 << 1, - ABI46_0_0SMCalloutArrowDirectionAny = ABI46_0_0SMCalloutArrowDirectionUp | ABI46_0_0SMCalloutArrowDirectionDown -}; - -/// options for the callout present/dismiss animation -typedef NS_ENUM(NSInteger, ABI46_0_0SMCalloutAnimation) { - /// the "bounce" animation we all know and love from @c UIAlertView - ABI46_0_0SMCalloutAnimationBounce, - /// a simple fade in or out - ABI46_0_0SMCalloutAnimationFade, - /// grow or shrink linearly, like in the iPad Calendar app - ABI46_0_0SMCalloutAnimationStretch -}; - -NS_ASSUME_NONNULL_BEGIN - -/// when delaying our popup in order to scroll content into view, you can use this amount to match the -/// animation duration of UIScrollView when using @c -setContentOffset:animated. -extern NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView; - -@protocol ABI46_0_0SMCalloutViewDelegate; -@class ABI46_0_0SMCalloutBackgroundView; - -// -// Callout view. -// - -#if __IPHONE_OS_VERSION_MAX_ALLOWED < 100000 -@interface ABI46_0_0SMCalloutView : UIView -#else -@interface ABI46_0_0SMCalloutView : UIView -#endif - -@property (nonatomic, weak, nullable) id delegate; -/// title/titleView relationship mimics UINavigationBar. -@property (nonatomic, copy, nullable) NSString *title; -@property (nonatomic, copy, nullable) NSString *subtitle; - -/// Left accessory view for the call out -@property (nonatomic, strong, nullable) UIView *leftAccessoryView; -/// Right accessoty view for the call out -@property (nonatomic, strong, nullable) UIView *rightAccessoryView; -/// Default @c ABI46_0_0SMCalloutArrowDirectionDown -@property (nonatomic, assign) ABI46_0_0SMCalloutArrowDirection permittedArrowDirection; -/// The current arrow direction -@property (nonatomic, readonly) ABI46_0_0SMCalloutArrowDirection currentArrowDirection; -/// if the @c UIView you're constraining to has portions that are overlapped by nav bar, tab bar, etc. you'll need to tell us those insets. -@property (nonatomic, assign) UIEdgeInsets constrainedInsets; -/// default is @c ABI46_0_0SMCalloutMaskedBackgroundView, or @c ABI46_0_0SMCalloutDrawnBackgroundView when using @c ABI46_0_0SMClassicCalloutView -@property (nonatomic, strong) ABI46_0_0SMCalloutBackgroundView *backgroundView; - -/** - @brief Custom title view. - - @disucssion Keep in mind that @c ABI46_0_0SMCalloutView calls @c -sizeThatFits on titleView/subtitleView if defined, so your view - may be resized as a result of that (especially if you're using @c UILabel/UITextField). You may want to subclass and override @c -sizeThatFits, or just wrap your view in a "generic" @c UIView if you do not want it to be auto-sized. - - @warning If this is set, the respective @c title property will be ignored. - */ -@property (nonatomic, strong, nullable) UIView *titleView; - -/** - @brief Custom subtitle view. - - @discussion Keep in mind that @c ABI46_0_0SMCalloutView calls @c -sizeThatFits on subtitleView if defined, so your view - may be resized as a result of that (especially if you're using @c UILabel/UITextField). You may want to subclass and override @c -sizeThatFits, or just wrap your view in a "generic" @c UIView if you do not want it to be auto-sized. - - @warning If this is set, the respective @c subtitle property will be ignored. - */ -@property (nonatomic, strong, nullable) UIView *subtitleView; - -/// Custom "content" view that can be any width/height. If this is set, title/subtitle/titleView/subtitleView are all ignored. -@property (nonatomic, retain, nullable) UIView *contentView; - -/// Custom content view margin -@property (nonatomic, assign) UIEdgeInsets contentViewInset; - -/// calloutOffset is the offset in screen points from the top-middle of the target view, where the anchor of the callout should be shown. -@property (nonatomic, assign) CGPoint calloutOffset; - -/// default ABI46_0_0SMCalloutAnimationBounce, ABI46_0_0SMCalloutAnimationFade respectively -@property (nonatomic, assign) ABI46_0_0SMCalloutAnimation presentAnimation, dismissAnimation; - -/// Returns a new instance of ABI46_0_0SMCalloutView if running on iOS 7 or better, otherwise a new instance of ABI46_0_0SMClassicCalloutView if available. -+ (ABI46_0_0SMCalloutView *)platformCalloutView; - -/** - @brief Presents a callout view by adding it to "inView" and pointing at the given rect of inView's bounds. - - @discussion Constrains the callout to the bounds of the given view. Optionally scrolls the given rect into view (plus margins) - if @c -delegate is set and responds to @c -delayForRepositionWithSize. - - @param rect @c CGRect to present the view from - @param view view to 'constrain' the @c constrainedView to - @param constrainedView @c UIView to be constrainted in @c view - @param animated @c BOOL if presentation should be animated - */ -- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated; - -/** - @brief Present a callout layer in the `layer` and pointing at the given rect of the `layer` bounds - - @discussion Same as the view-based presentation, but inserts the callout into a CALayer hierarchy instead. - @note Be aware that you'll have to direct your own touches to any accessory views, since CALayer doesn't relay touch events. - - @param rect @c CGRect to present the view from - @param layer layer to 'constrain' the @c constrainedLayer to - @param constrainedLayer @c CALayer to be constrained in @c layer - @param animated @c BOOL if presentation should be animated - */ -- (void)presentCalloutFromRect:(CGRect)rect inLayer:(CALayer *)layer constrainedToLayer:(CALayer *)constrainedLayer animated:(BOOL)animated; - -/** - Dismiss the callout view - - @param animated @c BOOL if dismissal should be animated - */ -- (void)dismissCalloutAnimated:(BOOL)animated; - -/// For subclassers. You can override this method to provide your own custom animation for presenting/dismissing the callout. -- (CAAnimation *)animationWithType:(ABI46_0_0SMCalloutAnimation)type presenting:(BOOL)presenting; - -@end - -// -// Background view - default draws the iOS 7 system background style (translucent white with rounded arrow). -// - -/// Abstract base class -@interface ABI46_0_0SMCalloutBackgroundView : UIView -/// indicates where the tip of the arrow should be drawn, as a pixel offset -@property (nonatomic, assign) CGPoint arrowPoint; -/// will be set by the callout when the callout is in a highlighted state -@property (nonatomic, assign) BOOL highlighted; -/// returns an optional layer whose contents should mask the callout view's contents (not honored by @c ABI46_0_0SMClassicCalloutView ) -@property (nonatomic, assign) CALayer *contentMask; -/// height of the callout "arrow" -@property (nonatomic, assign) CGFloat anchorHeight; -/// the smallest possible distance from the edge of our control to the "tip" of the anchor, from either left or right -@property (nonatomic, assign) CGFloat anchorMargin; -@end - -/// Default for iOS 7, this reproduces the "masked" behavior of the iOS 7-style callout view. -/// Accessories are masked by the shape of the callout (including the arrow itself). -@interface ABI46_0_0SMCalloutMaskedBackgroundView : ABI46_0_0SMCalloutBackgroundView -@end - -// -// Delegate methods -// - -@protocol ABI46_0_0SMCalloutViewDelegate -@optional - -/// Controls whether the callout "highlights" when pressed. default YES. You must also respond to @c -calloutViewClicked below. -/// Not honored by @c ABI46_0_0SMClassicCalloutView. -- (BOOL)calloutViewShouldHighlight:(ABI46_0_0SMCalloutView *)calloutView; - -/// Called when the callout view is clicked. Not honored by @c ABI46_0_0SMClassicCalloutView. -- (void)calloutViewClicked:(ABI46_0_0SMCalloutView *)calloutView; - -/** - Called when the callout view detects that it will be outside the constrained view when it appears, - or if the target rect was already outside the constrained view. You can implement this selector - to respond to this situation by repositioning your content first in order to make everything visible. - The @c CGSize passed is the calculated offset necessary to make everything visible (plus a nice margin). - It expects you to return the amount of time you need to reposition things so the popup can be delayed. - Typically you would return @c kSMCalloutViewRepositionDelayForUIScrollView if you're repositioning by calling @c [UIScrollView @c setContentOffset:animated:]. - - @param calloutView the @c ABI46_0_0SMCalloutView to reposition - @param offset calculated offset necessary to make everything visible - @returns @c NSTimeInterval to delay the repositioning - */ -- (NSTimeInterval)calloutView:(ABI46_0_0SMCalloutView *)calloutView delayForRepositionWithSize:(CGSize)offset; - -/// Called before the callout view appears on screen, or before the appearance animation will start. -- (void)calloutViewWillAppear:(ABI46_0_0SMCalloutView *)calloutView; - -/// Called after the callout view appears on screen, or after the appearance animation is complete. -- (void)calloutViewDidAppear:(ABI46_0_0SMCalloutView *)calloutView; - -/// Called before the callout view is removed from the screen, or before the disappearance animation is complete. -- (void)calloutViewWillDisappear:(ABI46_0_0SMCalloutView *)calloutView; - -/// Called after the callout view is removed from the screen, or after the disappearance animation is complete. -- (void)calloutViewDidDisappear:(ABI46_0_0SMCalloutView *)calloutView; - -NS_ASSUME_NONNULL_END -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.m deleted file mode 100644 index 76e84bfb3ea525..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Maps/Callout/ABI46_0_0SMCalloutView.m +++ /dev/null @@ -1,858 +0,0 @@ -#import "ABI46_0_0SMCalloutView.h" - -// -// UIView frame helpers - we do a lot of UIView frame fiddling in this class; these functions help keep things readable. -// - -@interface UIView (ABI46_0_0SMFrameAdditions) -@property (nonatomic, assign) CGPoint frameOrigin; -@property (nonatomic, assign) CGSize frameSize; -@property (nonatomic, assign) CGFloat frameX, frameY, frameWidth, frameHeight; // normal rect properties -@property (nonatomic, assign) CGFloat frameLeft, frameTop, frameRight, frameBottom; // these will stretch/shrink the rect -@end - -// -// Callout View. -// - -#define CALLOUT_DEFAULT_CONTAINER_HEIGHT 44 // height of just the main portion without arrow -#define CALLOUT_SUB_DEFAULT_CONTAINER_HEIGHT 52 // height of just the main portion without arrow (when subtitle is present) -#define CALLOUT_MIN_WIDTH 61 // minimum width of system callout -#define TITLE_HMARGIN 12 // the title/subtitle view's normal horizontal margin from the edges of our callout view or from the accessories -#define TITLE_TOP 11 // the top of the title view when no subtitle is present -#define TITLE_SUB_TOP 4 // the top of the title view when a subtitle IS present -#define TITLE_HEIGHT 21 // title height, fixed -#define SUBTITLE_TOP 28 // the top of the subtitle, when present -#define SUBTITLE_HEIGHT 15 // subtitle height, fixed -#define BETWEEN_ACCESSORIES_MARGIN 7 // margin between accessories when no title/subtitle is present -#define TOP_ANCHOR_MARGIN 13 // all the above measurements assume a bottom anchor! if we're pointing "up" we'll need to add this top margin to everything. -#define COMFORTABLE_MARGIN 10 // when we try to reposition content to be visible, we'll consider this margin around your target rect - -NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0; - -@interface ABI46_0_0SMCalloutView () -@property (nonatomic, strong) UIButton *containerView; // for masking and interaction -@property (nonatomic, strong) UILabel *titleLabel, *subtitleLabel; -@property (nonatomic, assign) ABI46_0_0SMCalloutArrowDirection currentArrowDirection; -@property (nonatomic, assign) BOOL popupCancelled; -@end - -@implementation ABI46_0_0SMCalloutView - -+ (ABI46_0_0SMCalloutView *)platformCalloutView { - - // if you haven't compiled ABI46_0_0SMClassicCalloutView into your app, then we can't possibly create an instance of it! - if (!NSClassFromString(@"ABI46_0_0SMClassicCalloutView")) - return [ABI46_0_0SMCalloutView new]; - - // ok we have both - so choose the best one based on current platform - if (floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1) - return [ABI46_0_0SMCalloutView new]; // iOS 7+ - else - return [NSClassFromString(@"ABI46_0_0SMClassicCalloutView") new]; -} - -- (id)initWithFrame:(CGRect)frame { - if (self = [super initWithFrame:frame]) { - self.permittedArrowDirection = ABI46_0_0SMCalloutArrowDirectionDown; - self.presentAnimation = ABI46_0_0SMCalloutAnimationBounce; - self.dismissAnimation = ABI46_0_0SMCalloutAnimationFade; - self.backgroundColor = [UIColor clearColor]; - self.containerView = [UIButton new]; - self.containerView.isAccessibilityElement = NO; - self.isAccessibilityElement = NO; - self.contentViewInset = UIEdgeInsetsMake(12, 12, 12, 12); - - [self.containerView addTarget:self action:@selector(highlightIfNecessary) forControlEvents:UIControlEventTouchDown | UIControlEventTouchDragInside]; - [self.containerView addTarget:self action:@selector(unhighlightIfNecessary) forControlEvents:UIControlEventTouchDragOutside | UIControlEventTouchCancel | UIControlEventTouchUpOutside | UIControlEventTouchUpInside]; - [self.containerView addTarget:self action:@selector(calloutClicked) forControlEvents:UIControlEventTouchUpInside]; - } - return self; -} - -- (BOOL)supportsHighlighting { - if (![self.delegate respondsToSelector:@selector(calloutViewClicked:)]) - return NO; - if ([self.delegate respondsToSelector:@selector(calloutViewShouldHighlight:)]) - return [self.delegate calloutViewShouldHighlight:self]; - return YES; -} - -- (void)highlightIfNecessary { if (self.supportsHighlighting) self.backgroundView.highlighted = YES; } -- (void)unhighlightIfNecessary { if (self.supportsHighlighting) self.backgroundView.highlighted = NO; } - -- (void)calloutClicked { - if ([self.delegate respondsToSelector:@selector(calloutViewClicked:)]) - [self.delegate calloutViewClicked:self]; -} - -- (UIView *)titleViewOrDefault { - if (self.titleView) - // if you have a custom title view defined, return that. - return self.titleView; - else { - if (!self.titleLabel) { - // create a default titleView - self.titleLabel = [UILabel new]; - self.titleLabel.frameHeight = TITLE_HEIGHT; - self.titleLabel.opaque = NO; - self.titleLabel.backgroundColor = [UIColor clearColor]; - self.titleLabel.font = [UIFont systemFontOfSize:17]; - self.titleLabel.textColor = [UIColor blackColor]; - } - return self.titleLabel; - } -} - -- (UIView *)subtitleViewOrDefault { - if (self.subtitleView) - // if you have a custom subtitle view defined, return that. - return self.subtitleView; - else { - if (!self.subtitleLabel) { - // create a default subtitleView - self.subtitleLabel = [UILabel new]; - self.subtitleLabel.frameHeight = SUBTITLE_HEIGHT; - self.subtitleLabel.opaque = NO; - self.subtitleLabel.backgroundColor = [UIColor clearColor]; - self.subtitleLabel.font = [UIFont systemFontOfSize:12]; - self.subtitleLabel.textColor = [UIColor blackColor]; - } - return self.subtitleLabel; - } -} - -- (ABI46_0_0SMCalloutBackgroundView *)backgroundView { - // create our default background on first access only if it's nil, since you might have set your own background anyway. - return _backgroundView ? _backgroundView : (_backgroundView = [self defaultBackgroundView]); -} - -- (ABI46_0_0SMCalloutBackgroundView *)defaultBackgroundView { - return [ABI46_0_0SMCalloutMaskedBackgroundView new]; -} - -- (void)rebuildSubviews { - // remove and re-add our appropriate subviews in the appropriate order - [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; - [self.containerView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; - [self setNeedsDisplay]; - - [self addSubview:self.backgroundView]; - [self addSubview:self.containerView]; - - if (self.contentView) { - [self.containerView addSubview:self.contentView]; - } - else { - if (self.titleViewOrDefault) [self.containerView addSubview:self.titleViewOrDefault]; - if (self.subtitleViewOrDefault) [self.containerView addSubview:self.subtitleViewOrDefault]; - } - if (self.leftAccessoryView) [self.containerView addSubview:self.leftAccessoryView]; - if (self.rightAccessoryView) [self.containerView addSubview:self.rightAccessoryView]; -} - -// Accessory margins. Accessories are centered vertically when shorter -// than the callout, otherwise they grow from the upper corner. - -- (CGFloat)leftAccessoryVerticalMargin { - if (self.leftAccessoryView.frameHeight < self.calloutContainerHeight) - return roundf((self.calloutContainerHeight - self.leftAccessoryView.frameHeight) / 2); - else - return 0; -} - -- (CGFloat)leftAccessoryHorizontalMargin { - return fminf(self.leftAccessoryVerticalMargin, TITLE_HMARGIN); -} - -- (CGFloat)rightAccessoryVerticalMargin { - if (self.rightAccessoryView.frameHeight < self.calloutContainerHeight) - return roundf((self.calloutContainerHeight - self.rightAccessoryView.frameHeight) / 2); - else - return 0; -} - -- (CGFloat)rightAccessoryHorizontalMargin { - return fminf(self.rightAccessoryVerticalMargin, TITLE_HMARGIN); -} - -- (CGFloat)innerContentMarginLeft { - if (self.leftAccessoryView) - return self.leftAccessoryHorizontalMargin + self.leftAccessoryView.frameWidth + TITLE_HMARGIN; - else - return self.contentViewInset.left; -} - -- (CGFloat)innerContentMarginRight { - if (self.rightAccessoryView) - return self.rightAccessoryHorizontalMargin + self.rightAccessoryView.frameWidth + TITLE_HMARGIN; - else - return self.contentViewInset.right; -} - -- (CGFloat)calloutHeight { - return self.calloutContainerHeight + self.backgroundView.anchorHeight; -} - -- (CGFloat)calloutContainerHeight { - if (self.contentView) - return self.contentView.frameHeight + self.contentViewInset.bottom + self.contentViewInset.top; - else if (self.subtitleView || self.subtitle.length > 0) - return CALLOUT_SUB_DEFAULT_CONTAINER_HEIGHT; - else - return CALLOUT_DEFAULT_CONTAINER_HEIGHT; -} - -- (CGSize)sizeThatFits:(CGSize)size { - - // calculate how much non-negotiable space we need to reserve for margin and accessories - CGFloat margin = self.innerContentMarginLeft + self.innerContentMarginRight; - - // how much room is left for text? - CGFloat availableWidthForText = size.width - margin - 1; - - // no room for text? then we'll have to squeeze into the given size somehow. - if (availableWidthForText < 0) - availableWidthForText = 0; - - CGSize preferredTitleSize = [self.titleViewOrDefault sizeThatFits:CGSizeMake(availableWidthForText, TITLE_HEIGHT)]; - CGSize preferredSubtitleSize = [self.subtitleViewOrDefault sizeThatFits:CGSizeMake(availableWidthForText, SUBTITLE_HEIGHT)]; - - // total width we'd like - CGFloat preferredWidth; - - if (self.contentView) { - - // if we have a content view, then take our preferred size directly from that - preferredWidth = self.contentView.frameWidth + margin; - } - else if (preferredTitleSize.width >= 0.000001 || preferredSubtitleSize.width >= 0.000001) { - - // if we have a title or subtitle, then our assumed margins are valid, and we can apply them - preferredWidth = fmaxf(preferredTitleSize.width, preferredSubtitleSize.width) + margin; - } - else { - // ok we have no title or subtitle to speak of. In this case, the system callout would actually not display - // at all! But we can handle it. - preferredWidth = self.leftAccessoryView.frameWidth + self.rightAccessoryView.frameWidth + self.leftAccessoryHorizontalMargin + self.rightAccessoryHorizontalMargin; - - if (self.leftAccessoryView && self.rightAccessoryView) - preferredWidth += BETWEEN_ACCESSORIES_MARGIN; - } - - // ensure we're big enough to fit our graphics! - preferredWidth = fmaxf(preferredWidth, CALLOUT_MIN_WIDTH); - - // ask to be smaller if we have space, otherwise we'll fit into what we have by truncating the title/subtitle. - return CGSizeMake(fminf(preferredWidth, size.width), self.calloutHeight); -} - -- (CGSize)offsetToContainRect:(CGRect)innerRect inRect:(CGRect)outerRect { - CGFloat nudgeRight = fmaxf(0, CGRectGetMinX(outerRect) - CGRectGetMinX(innerRect)); - CGFloat nudgeLeft = fminf(0, CGRectGetMaxX(outerRect) - CGRectGetMaxX(innerRect)); - CGFloat nudgeTop = fmaxf(0, CGRectGetMinY(outerRect) - CGRectGetMinY(innerRect)); - CGFloat nudgeBottom = fminf(0, CGRectGetMaxY(outerRect) - CGRectGetMaxY(innerRect)); - return CGSizeMake(nudgeLeft ? nudgeLeft : nudgeRight, nudgeTop ? nudgeTop : nudgeBottom); -} - -- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated { - [self presentCalloutFromRect:rect inLayer:view.layer ofView:view constrainedToLayer:constrainedView.layer animated:animated]; -} - -- (void)presentCalloutFromRect:(CGRect)rect inLayer:(CALayer *)layer constrainedToLayer:(CALayer *)constrainedLayer animated:(BOOL)animated { - [self presentCalloutFromRect:rect inLayer:layer ofView:nil constrainedToLayer:constrainedLayer animated:animated]; -} - -// this private method handles both CALayer and UIView parents depending on what's passed. -- (void)presentCalloutFromRect:(CGRect)rect inLayer:(CALayer *)layer ofView:(UIView *)view constrainedToLayer:(CALayer *)constrainedLayer animated:(BOOL)animated { - - // Sanity check: dismiss this callout immediately if it's displayed somewhere - if (self.layer.superlayer) [self dismissCalloutAnimated:NO]; - - // cancel any presenting animation that may be in progress - [self.layer removeAnimationForKey:@"present"]; - - // figure out the constrained view's rect in our popup view's coordinate system - CGRect constrainedRect = [constrainedLayer convertRect:constrainedLayer.bounds toLayer:layer]; - - // apply our edge constraints - constrainedRect = UIEdgeInsetsInsetRect(constrainedRect, self.constrainedInsets); - - constrainedRect = CGRectInset(constrainedRect, COMFORTABLE_MARGIN, COMFORTABLE_MARGIN); - - // form our subviews based on our content set so far - [self rebuildSubviews]; - - // apply title/subtitle (if present - self.titleLabel.text = self.title; - self.subtitleLabel.text = self.subtitle; - - // size the callout to fit the width constraint as best as possible - self.frameSize = [self sizeThatFits:CGSizeMake(constrainedRect.size.width, self.calloutHeight)]; - - // how much room do we have in the constraint box, both above and below our target rect? - CGFloat topSpace = CGRectGetMinY(rect) - CGRectGetMinY(constrainedRect); - CGFloat bottomSpace = CGRectGetMaxY(constrainedRect) - CGRectGetMaxY(rect); - - // we prefer to point our arrow down. - ABI46_0_0SMCalloutArrowDirection bestDirection = ABI46_0_0SMCalloutArrowDirectionDown; - - // we'll point it up though if that's the only option you gave us. - if (self.permittedArrowDirection == ABI46_0_0SMCalloutArrowDirectionUp) - bestDirection = ABI46_0_0SMCalloutArrowDirectionUp; - - // or, if we don't have enough space on the top and have more space on the bottom, and you - // gave us a choice, then pointing up is the better option. - if (self.permittedArrowDirection == ABI46_0_0SMCalloutArrowDirectionAny && topSpace < self.calloutHeight && bottomSpace > topSpace) - bestDirection = ABI46_0_0SMCalloutArrowDirectionUp; - - self.currentArrowDirection = bestDirection; - - // we want to point directly at the horizontal center of the given rect. calculate our "anchor point" in terms of our - // target view's coordinate system. make sure to offset the anchor point as requested if necessary. - CGFloat anchorX = self.calloutOffset.x + CGRectGetMidX(rect); - CGFloat anchorY = self.calloutOffset.y + (bestDirection == ABI46_0_0SMCalloutArrowDirectionDown ? CGRectGetMinY(rect) : CGRectGetMaxY(rect)); - - // we prefer to sit centered directly above our anchor - CGFloat calloutX = roundf(anchorX - self.frameWidth / 2); - - // but not if it's going to get too close to the edge of our constraints - if (calloutX < constrainedRect.origin.x) - calloutX = constrainedRect.origin.x; - - if (calloutX > constrainedRect.origin.x+constrainedRect.size.width-self.frameWidth) - calloutX = constrainedRect.origin.x+constrainedRect.size.width-self.frameWidth; - - // what's the farthest to the left and right that we could point to, given our background image constraints? - CGFloat minPointX = calloutX + self.backgroundView.anchorMargin; - CGFloat maxPointX = calloutX + self.frameWidth - self.backgroundView.anchorMargin; - - // we may need to scoot over to the left or right to point at the correct spot - CGFloat adjustX = 0; - if (anchorX < minPointX) adjustX = anchorX - minPointX; - if (anchorX > maxPointX) adjustX = anchorX - maxPointX; - - // add the callout to the given layer (or view if possible, to receive touch events) - if (view) - [view addSubview:self]; - else - [layer addSublayer:self.layer]; - - CGPoint calloutOrigin = { - .x = calloutX + adjustX, - .y = bestDirection == ABI46_0_0SMCalloutArrowDirectionDown ? (anchorY - self.calloutHeight) : anchorY - }; - - self.frameOrigin = calloutOrigin; - - // now set the *actual* anchor point for our layer so that our "popup" animation starts from this point. - CGPoint anchorPoint = [layer convertPoint:CGPointMake(anchorX, anchorY) toLayer:self.layer]; - - // pass on the anchor point to our background view so it knows where to draw the arrow - self.backgroundView.arrowPoint = anchorPoint; - - // adjust it to unit coordinates for the actual layer.anchorPoint property - anchorPoint.x /= self.frameWidth; - anchorPoint.y /= self.frameHeight; - self.layer.anchorPoint = anchorPoint; - - // setting the anchor point moves the view a bit, so we need to reset - self.frameOrigin = calloutOrigin; - - // make sure our frame is not on half-pixels or else we may be blurry! - CGFloat scale = [UIScreen mainScreen].scale; - self.frameX = floorf(self.frameX*scale)/scale; - self.frameY = floorf(self.frameY*scale)/scale; - - // layout now so we can immediately start animating to the final position if needed - [self setNeedsLayout]; - [self layoutIfNeeded]; - - // if we're outside the bounds of our constraint rect, we'll give our delegate an opportunity to shift us into position. - // consider both our size and the size of our target rect (which we'll assume to be the size of the content you want to scroll into view. - CGRect contentRect = CGRectUnion(self.frame, rect); - CGSize offset = [self offsetToContainRect:contentRect inRect:constrainedRect]; - - NSTimeInterval delay = 0; - self.popupCancelled = NO; // reset this before calling our delegate below - - if ([self.delegate respondsToSelector:@selector(calloutView:delayForRepositionWithSize:)] && !CGSizeEqualToSize(offset, CGSizeZero)) - delay = [self.delegate calloutView:(id)self delayForRepositionWithSize:offset]; - - // there's a chance that user code in the delegate method may have called -dismissCalloutAnimated to cancel things; if that - // happened then we need to bail! - if (self.popupCancelled) return; - - // now we want to mask our contents to our background view (if requested) to match the iOS 7 style - self.containerView.layer.mask = self.backgroundView.contentMask; - - // if we need to delay, we don't want to be visible while we're delaying, so hide us in preparation for our popup - self.hidden = YES; - - // create the appropriate animation, even if we're not animated - CAAnimation *animation = [self animationWithType:self.presentAnimation presenting:YES]; - - // nuke the duration if no animation requested - we'll still need to "run" the animation to get delays and callbacks - if (!animated) - animation.duration = 0.0000001; // can't be zero or the animation won't "run" - - animation.beginTime = CACurrentMediaTime() + delay; - animation.delegate = self; - - [self.layer addAnimation:animation forKey:@"present"]; -} - -- (void)animationDidStart:(CAAnimation *)anim { - BOOL presenting = [[anim valueForKey:@"presenting"] boolValue]; - - if (presenting) { - if ([_delegate respondsToSelector:@selector(calloutViewWillAppear:)]) - [_delegate calloutViewWillAppear:(id)self]; - - // ok, animation is on, let's make ourselves visible! - self.hidden = NO; - } - else if (!presenting) { - if ([_delegate respondsToSelector:@selector(calloutViewWillDisappear:)]) - [_delegate calloutViewWillDisappear:(id)self]; - } -} - -- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)finished { - BOOL presenting = [[anim valueForKey:@"presenting"] boolValue]; - - if (presenting && finished) { - if ([_delegate respondsToSelector:@selector(calloutViewDidAppear:)]) - [_delegate calloutViewDidAppear:(id)self]; - } - else if (!presenting && finished) { - - [self removeFromParent]; - [self.layer removeAnimationForKey:@"dismiss"]; - - if ([_delegate respondsToSelector:@selector(calloutViewDidDisappear:)]) - [_delegate calloutViewDidDisappear:(id)self]; - } -} - -- (void)dismissCalloutAnimated:(BOOL)animated { - - // cancel all animations that may be in progress - [self.layer removeAnimationForKey:@"present"]; - [self.layer removeAnimationForKey:@"dismiss"]; - - self.popupCancelled = YES; - - if (animated) { - CAAnimation *animation = [self animationWithType:self.dismissAnimation presenting:NO]; - animation.delegate = self; - [self.layer addAnimation:animation forKey:@"dismiss"]; - } - else { - [self removeFromParent]; - } -} - -- (void)removeFromParent { - if (self.superview) - [self removeFromSuperview]; - else { - // removing a layer from a superlayer causes an implicit fade-out animation that we wish to disable. - [CATransaction begin]; - [CATransaction setDisableActions:YES]; - [self.layer removeFromSuperlayer]; - [CATransaction commit]; - } -} - -- (CAAnimation *)animationWithType:(ABI46_0_0SMCalloutAnimation)type presenting:(BOOL)presenting { - CAAnimation *animation = nil; - - if (type == ABI46_0_0SMCalloutAnimationBounce) { - - CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fade.duration = 0.23; - fade.fromValue = presenting ? @0.0 : @1.0; - fade.toValue = presenting ? @1.0 : @0.0; - fade.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; - - CABasicAnimation *bounce = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; - bounce.duration = 0.23; - bounce.fromValue = presenting ? @0.7 : @1.0; - bounce.toValue = presenting ? @1.0 : @0.7; - bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367:0.12066:0.18878:1.5814]; - - CAAnimationGroup *group = [CAAnimationGroup animation]; - group.animations = @[fade, bounce]; - group.duration = 0.23; - - animation = group; - } - else if (type == ABI46_0_0SMCalloutAnimationFade) { - CABasicAnimation *fade = [CABasicAnimation animationWithKeyPath:@"opacity"]; - fade.duration = 1.0/3.0; - fade.fromValue = presenting ? @0.0 : @1.0; - fade.toValue = presenting ? @1.0 : @0.0; - animation = fade; - } - else if (type == ABI46_0_0SMCalloutAnimationStretch) { - CABasicAnimation *stretch = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; - stretch.duration = 0.1; - stretch.fromValue = presenting ? @0.0 : @1.0; - stretch.toValue = presenting ? @1.0 : @0.0; - animation = stretch; - } - - // CAAnimation is KVC compliant, so we can store whether we're presenting for lookup in our delegate methods - [animation setValue:@(presenting) forKey:@"presenting"]; - - animation.fillMode = kCAFillModeForwards; - animation.removedOnCompletion = NO; - return animation; -} - -- (void)layoutSubviews { - - self.containerView.frame = self.bounds; - self.backgroundView.frame = self.bounds; - - // if we're pointing up, we'll need to push almost everything down a bit - CGFloat dy = self.currentArrowDirection == ABI46_0_0SMCalloutArrowDirectionUp ? TOP_ANCHOR_MARGIN : 0; - - self.titleViewOrDefault.frameX = self.innerContentMarginLeft; - self.titleViewOrDefault.frameY = (self.subtitleView || self.subtitle.length ? TITLE_SUB_TOP : TITLE_TOP) + dy; - self.titleViewOrDefault.frameWidth = self.frameWidth - self.innerContentMarginLeft - self.innerContentMarginRight; - - self.subtitleViewOrDefault.frameX = self.titleViewOrDefault.frameX; - self.subtitleViewOrDefault.frameY = SUBTITLE_TOP + dy; - self.subtitleViewOrDefault.frameWidth = self.titleViewOrDefault.frameWidth; - - self.leftAccessoryView.frameX = self.leftAccessoryHorizontalMargin; - self.leftAccessoryView.frameY = self.leftAccessoryVerticalMargin + dy; - - self.rightAccessoryView.frameX = self.frameWidth - self.rightAccessoryHorizontalMargin - self.rightAccessoryView.frameWidth; - self.rightAccessoryView.frameY = self.rightAccessoryVerticalMargin + dy; - - if (self.contentView) { - self.contentView.frameX = self.innerContentMarginLeft; - self.contentView.frameY = self.contentViewInset.top + dy; - } -} - -#pragma mark - Accessibility - -- (NSInteger)accessibilityElementCount { - return (!!self.leftAccessoryView + !!self.titleViewOrDefault + - !!self.subtitleViewOrDefault + !!self.rightAccessoryView); -} - -- (id)accessibilityElementAtIndex:(NSInteger)index { - if (index == 0) { - return self.leftAccessoryView ? self.leftAccessoryView : self.titleViewOrDefault; - } - if (index == 1) { - return self.leftAccessoryView ? self.titleViewOrDefault : self.subtitleViewOrDefault; - } - if (index == 2) { - return self.leftAccessoryView ? self.subtitleViewOrDefault : self.rightAccessoryView; - } - if (index == 3) { - return self.leftAccessoryView ? self.rightAccessoryView : nil; - } - return nil; -} - -- (NSInteger)indexOfAccessibilityElement:(id)element { - if (element == nil) return NSNotFound; - if (element == self.leftAccessoryView) return 0; - if (element == self.titleViewOrDefault) { - return self.leftAccessoryView ? 1 : 0; - } - if (element == self.subtitleViewOrDefault) { - return self.leftAccessoryView ? 2 : 1; - } - if (element == self.rightAccessoryView) { - return self.leftAccessoryView ? 3 : 2; - } - return NSNotFound; -} - -@end - -// import this known "private API" from ABI46_0_0SMCalloutBackgroundView -@interface ABI46_0_0SMCalloutBackgroundView (EmbeddedImages) -+ (UIImage *)embeddedImageNamed:(NSString *)name; -@end - -// -// Callout Background View. -// - -@interface ABI46_0_0SMCalloutMaskedBackgroundView () -@property (nonatomic, strong) UIView *containerView, *containerBorderView, *arrowView; -@property (nonatomic, strong) UIImageView *arrowImageView, *arrowHighlightedImageView, *arrowBorderView; -@end - -static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage = nil; - -@implementation ABI46_0_0SMCalloutMaskedBackgroundView - -- (id)initWithFrame:(CGRect)frame { - if (self = [super initWithFrame:frame]) { - - // Here we're mimicking the very particular (and odd) structure of the system callout view. - // The hierarchy and view/layer values were discovered by inspecting map kit using Reveal.app - - self.containerView = [UIView new]; - self.containerView.backgroundColor = [UIColor whiteColor]; - self.containerView.alpha = 0.96; - self.containerView.layer.cornerRadius = 8; - self.containerView.layer.shadowRadius = 30; - self.containerView.layer.shadowOpacity = 0.1; - - self.containerBorderView = [UIView new]; - self.containerBorderView.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor; - self.containerBorderView.layer.borderWidth = 0.5; - self.containerBorderView.layer.cornerRadius = 8.5; - - if (!blackArrowImage) { - blackArrowImage = [ABI46_0_0SMCalloutBackgroundView embeddedImageNamed:@"CalloutArrow"]; - whiteArrowImage = [self image:blackArrowImage withColor:[UIColor whiteColor]]; - grayArrowImage = [self image:blackArrowImage withColor:[UIColor colorWithWhite:0.85 alpha:1]]; - } - - self.anchorHeight = 13; - self.anchorMargin = 27; - - self.arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, blackArrowImage.size.width, blackArrowImage.size.height)]; - self.arrowView.alpha = 0.96; - self.arrowImageView = [[UIImageView alloc] initWithImage:whiteArrowImage]; - self.arrowHighlightedImageView = [[UIImageView alloc] initWithImage:grayArrowImage]; - self.arrowHighlightedImageView.hidden = YES; - self.arrowBorderView = [[UIImageView alloc] initWithImage:blackArrowImage]; - self.arrowBorderView.alpha = 0.1; - self.arrowBorderView.frameY = 0.5; - - [self addSubview:self.containerView]; - [self.containerView addSubview:self.containerBorderView]; - [self addSubview:self.arrowView]; - [self.arrowView addSubview:self.arrowBorderView]; - [self.arrowView addSubview:self.arrowImageView]; - [self.arrowView addSubview:self.arrowHighlightedImageView]; - } - return self; -} - -// Make sure we relayout our images when our arrow point changes! -- (void)setArrowPoint:(CGPoint)arrowPoint { - [super setArrowPoint:arrowPoint]; - [self setNeedsLayout]; -} - -- (void)setHighlighted:(BOOL)highlighted { - [super setHighlighted:highlighted]; - self.containerView.backgroundColor = highlighted ? [UIColor colorWithWhite:0.85 alpha:1] : [UIColor whiteColor]; - self.arrowImageView.hidden = highlighted; - self.arrowHighlightedImageView.hidden = !highlighted; -} - -- (UIImage *)image:(UIImage *)image withColor:(UIColor *)color { - - UIGraphicsBeginImageContextWithOptions(image.size, NO, 0); - CGRect imageRect = (CGRect){.size=image.size}; - CGContextRef c = UIGraphicsGetCurrentContext(); - CGContextTranslateCTM(c, 0, image.size.height); - CGContextScaleCTM(c, 1, -1); - CGContextClipToMask(c, imageRect, image.CGImage); - [color setFill]; - CGContextFillRect(c, imageRect); - UIImage *whiteImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - return whiteImage; -} - -- (void)layoutSubviews { - - BOOL pointingUp = self.arrowPoint.y < self.frameHeight/2; - - // if we're pointing up, we'll need to push almost everything down a bit - CGFloat dy = pointingUp ? TOP_ANCHOR_MARGIN : 0; - - self.containerView.frame = CGRectMake(0, dy, self.frameWidth, self.frameHeight - self.arrowView.frameHeight + 0.5); - self.containerBorderView.frame = CGRectInset(self.containerView.bounds, -0.5, -0.5); - - self.arrowView.frameX = roundf(self.arrowPoint.x - self.arrowView.frameWidth / 2); - - if (pointingUp) { - self.arrowView.frameY = 1; - self.arrowView.transform = CGAffineTransformMakeRotation(M_PI); - } - else { - self.arrowView.frameY = self.containerView.frameHeight - 0.5; - self.arrowView.transform = CGAffineTransformIdentity; - } -} - -- (CALayer *)contentMask { - - UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0); - - [self.layer renderInContext:UIGraphicsGetCurrentContext()]; - - UIImage *maskImage = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - CALayer *layer = [CALayer layer]; - layer.frame = self.bounds; - layer.contents = (id)maskImage.CGImage; - return layer; -} - -@end - -@implementation ABI46_0_0SMCalloutBackgroundView - -+ (NSData *)dataWithBase64EncodedString:(NSString *)string { - // - // NSData+Base64.m - // - // Version 1.0.2 - // - // Created by Nick Lockwood on 12/01/2012. - // Copyright (C) 2012 Charcoal Design - // - // Distributed under the permissive zlib License - // Get the latest version from here: - // - // https://github.com/nicklockwood/Base64 - // - // This software is provided 'as-is', without any express or implied - // warranty. In no event will the authors be held liable for any damages - // arising from the use of this software. - // - // Permission is granted to anyone to use this software for any purpose, - // including commercial applications, and to alter it and redistribute it - // freely, subject to the following restrictions: - // - // 1. The origin of this software must not be misrepresented; you must not - // claim that you wrote the original software. If you use this software - // in a product, an acknowledgment in the product documentation would be - // appreciated but is not required. - // - // 2. Altered source versions must be plainly marked as such, and must not be - // misrepresented as being the original software. - // - // 3. This notice may not be removed or altered from any source distribution. - // - const char lookup[] = { - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, - 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63, - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99, - 99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, - 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99, - 99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, - 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99 - }; - - NSData *inputData = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES]; - long long inputLength = [inputData length]; - const unsigned char *inputBytes = [inputData bytes]; - - long long maxOutputLength = (inputLength / 4 + 1) * 3; - NSMutableData *outputData = [NSMutableData dataWithLength:(NSUInteger)maxOutputLength]; - unsigned char *outputBytes = (unsigned char *)[outputData mutableBytes]; - - int accumulator = 0; - long long outputLength = 0; - unsigned char accumulated[] = {0, 0, 0, 0}; - for (long long i = 0; i < inputLength; i++) { - unsigned char decoded = lookup[inputBytes[i] & 0x7F]; - if (decoded != 99) { - accumulated[accumulator] = decoded; - if (accumulator == 3) { - outputBytes[outputLength++] = (accumulated[0] << 2) | (accumulated[1] >> 4); - outputBytes[outputLength++] = (accumulated[1] << 4) | (accumulated[2] >> 2); - outputBytes[outputLength++] = (accumulated[2] << 6) | accumulated[3]; - } - accumulator = (accumulator + 1) % 4; - } - } - - //handle left-over data - if (accumulator > 0) outputBytes[outputLength] = (accumulated[0] << 2) | (accumulated[1] >> 4); - if (accumulator > 1) outputBytes[++outputLength] = (accumulated[1] << 4) | (accumulated[2] >> 2); - if (accumulator > 2) outputLength++; - - //truncate data to match actual output length - outputData.length = (NSUInteger)outputLength; - return outputLength? outputData: nil; -} - -+ (UIImage *)embeddedImageNamed:(NSString *)name { - CGFloat screenScale = [UIScreen mainScreen].scale; - if (screenScale > 1.0) { - name = [name stringByAppendingString:@"_2x"]; - screenScale = 2.0; - } - - SEL selector = NSSelectorFromString(name); - - if (![(id)self respondsToSelector:selector]) { - NSLog(@"Could not find an embedded image. Ensure that you've added a class-level method named +%@", name); - return nil; - } - - // We need to hush the compiler here - but we know what we're doing! -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Warc-performSelector-leaks" - NSString *base64String = [(id)self performSelector:selector]; -#pragma clang diagnostic pop - - UIImage *rawImage = [UIImage imageWithData:[self dataWithBase64EncodedString:base64String]]; - return [UIImage imageWithCGImage:rawImage.CGImage scale:screenScale orientation:UIImageOrientationUp]; -} - -+ (NSString *)CalloutArrow { return @"iVBORw0KGgoAAAANSUhEUgAAACcAAAANCAYAAAAqlHdlAAAAHGlET1QAAAACAAAAAAAAAAcAAAAoAAAABwAAAAYAAADJEgYpIwAAAJVJREFUOBFiYIAAdn5+fkFOTkE5Dg5eW05O3lJOTr6zQPyfDhhoD28pxF5BOZA7gE5ih7oLN8XJyR8MdNwrGjkQaC5/MG7biZDh4OBXBDruLpUdeBdkLhHWE1bCzs6nAnTcUyo58DnIPMK2kqAC6DALIP5JoQNB+i1IsJZ4pcBEm0iJ40D6ibeNDJVAx00k04ETSbUOAAAA//+SwicfAAAAe0lEQVRjYCAdMHNy8u7l5OT7Tzzm3Qu0hpl0q8jQwcPDIwp02B0iHXeHl5dXhAxryNfCzc2tC3TcJwIO/ARSR74tFOjk4uL1BzruHw4H/gPJU2A85Vq5uPjTgY77g+bAPyBxyk2nggkcHPxOnJz8B4AOfAGiQXwqGMsAACGK1kPPMHNBAAAAAElFTkSuQmCC"; } - -+ (NSString *)CalloutArrow_2x { return @"iVBORw0KGgoAAAANSUhEUgAAAE4AAAAaCAYAAAAZtWr8AAAACXBIWXMAABYlAAAWJQFJUiTwAAAAHGlET1QAAAACAAAAAAAAAA0AAAAoAAAADQAAAA0AAAFMRh0LGwAAARhJREFUWAnclbENwjAQRZ0mih2fDYgsQEVDxQZMgKjpWYAJkBANI8AGDIEoM0WkzBDRAf8klB44g0OkU1zE3/+9RIpS7VVY730/y/woTWlsjJ9iPcN9pbXfY85auyvm/qcDNmb0e2Z+sk/ZBTthN0oVttX12mJIWeaWEFf+kbySmZQa0msu3nzaGJprTXV3BVLNDG/if7bNOTeAvFP35NGJu39GL7Abb27bFXncVQBZLgJf3jp+ebSWIxZMgrxdvPJoJ4gqHpXgV36ITR46HUGaiNMKB6YQd4lI3gV8qTBjmDhrbQFxVQTyKu4ShjJQap7nE4hrfiiv4Q6B8MLGat1bQNztB/JwZm8Rli5wujFu821xfGZgLPUAAAD//4wvm4gAAAD7SURBVOWXMQ6CMBiFgaFpi6VyBEedXJy4hMQTeBSvRDgJEySegI3EQWOivkZnqUB/k0LyL7R9L++D9G+DwP0TCZGUqCdRlYgUuY9F4JCmqQa0hgBcY7wIItFZMLZYS5l0ruAZbXhs6BIROgmhcoB7OIAHTZUTRqG3wp9xmhqc0aRPQu8YAlwxIbwCEUL6GH9wfDcLXY2HpyvvmkHf9+BcrwCuHQGvNRp9Pl6OY0PPAO42AB7WqMxLKLahpFR7gLv/AA9zPe+gtvAMCIC7WMC7CqEPtrqzmBfHyy3A1V/g1Th27GYBY0BIxrk6Ap65254/VZp30GID9JwteQEZrVMWXqGn8gAAAABJRU5ErkJggg=="; } - -@end - -// -// Our UIView frame helpers implementation -// - -@implementation UIView (ABI46_0_0SMFrameAdditions) - -- (CGPoint)frameOrigin { return self.frame.origin; } -- (void)setFrameOrigin:(CGPoint)origin { self.frame = (CGRect){ .origin=origin, .size=self.frame.size }; } - -- (CGFloat)frameX { return self.frame.origin.x; } -- (void)setFrameX:(CGFloat)x { self.frame = (CGRect){ .origin.x=x, .origin.y=self.frame.origin.y, .size=self.frame.size }; } - -- (CGFloat)frameY { return self.frame.origin.y; } -- (void)setFrameY:(CGFloat)y { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=y, .size=self.frame.size }; } - -- (CGSize)frameSize { return self.frame.size; } -- (void)setFrameSize:(CGSize)size { self.frame = (CGRect){ .origin=self.frame.origin, .size=size }; } - -- (CGFloat)frameWidth { return self.frame.size.width; } -- (void)setFrameWidth:(CGFloat)width { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=width, .size.height=self.frame.size.height }; } - -- (CGFloat)frameHeight { return self.frame.size.height; } -- (void)setFrameHeight:(CGFloat)height { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=height }; } - -- (CGFloat)frameLeft { return self.frame.origin.x; } -- (void)setFrameLeft:(CGFloat)left { self.frame = (CGRect){ .origin.x=left, .origin.y=self.frame.origin.y, .size.width=fmaxf(self.frame.origin.x+self.frame.size.width-left,0), .size.height=self.frame.size.height }; } - -- (CGFloat)frameTop { return self.frame.origin.y; } -- (void)setFrameTop:(CGFloat)top { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=top, .size.width=self.frame.size.width, .size.height=fmaxf(self.frame.origin.y+self.frame.size.height-top,0) }; } - -- (CGFloat)frameRight { return self.frame.origin.x + self.frame.size.width; } -- (void)setFrameRight:(CGFloat)right { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=fmaxf(right-self.frame.origin.x,0), .size.height=self.frame.size.height }; } - -- (CGFloat)frameBottom { return self.frame.origin.y + self.frame.size.height; } -- (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=fmaxf(bottom-self.frame.origin.y,0) }; } - -@end \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.h deleted file mode 100644 index 46c911279da857..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface ABI46_0_0RNCMaskedView : ABI46_0_0RCTView - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.m deleted file mode 100644 index 3df7de4e0ca45d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedView.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCMaskedView.h" - -#import - -@implementation ABI46_0_0RNCMaskedView - -- (void)didUpdateABI46_0_0ReactSubviews -{ - // ABI46_0_0RNCMaskedView expects that the first subview rendered is the mask. - UIView *maskView = [self.ABI46_0_0ReactSubviews firstObject]; - self.maskView = maskView; - - // Add the other subviews to the view hierarchy - for (NSUInteger i = 1; i < self.ABI46_0_0ReactSubviews.count; i++) { - UIView *subview = [self.ABI46_0_0ReactSubviews objectAtIndex:i]; - [self addSubview:subview]; - } -} - -- (void)displayLayer:(CALayer *)layer -{ - // ABI46_0_0RCTView uses displayLayer to do border rendering. - // We don't need to do that in ABI46_0_0RNCMaskedView, so we - // stub this method and override the default implementation. -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.h deleted file mode 100644 index 85ce327bc2869f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCMaskedViewManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.m deleted file mode 100644 index 7802ee5b92fa8f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/MaskedView/ABI46_0_0RNCMaskedViewManager.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCMaskedViewManager.h" - -#import "ABI46_0_0RNCMaskedView.h" - -@implementation ABI46_0_0RNCMaskedViewManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ABI46_0_0RNCMaskedView new]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.h deleted file mode 100644 index b3145a4afc66a3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import "ABI46_0_0RNCPickerLabel.h" - -@interface ABI46_0_0RNCPicker : UIPickerView - -@property (nonatomic, copy) NSArray *items; -@property (nonatomic, assign) NSInteger selectedIndex; - -@property (nonatomic, strong) UIColor *color; -@property (nonatomic, strong) UIFont *font; -@property (nonatomic, assign) NSTextAlignment textAlign; - -@property (nonatomic, assign) NSInteger numberOfLines; - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onChange; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.m deleted file mode 100644 index 20bddf2203c515..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPicker.m +++ /dev/null @@ -1,140 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCPicker.h" - -#import -#import - -@interface ABI46_0_0RNCPicker() -@end - -@implementation ABI46_0_0RNCPicker - -- (instancetype)initWithFrame:(CGRect)frame -{ - if ((self = [super initWithFrame:frame])) { - _color = [UIColor blackColor]; - _font = [UIFont systemFontOfSize:21]; // TODO: selected title default should be 23.5 - _selectedIndex = NSNotFound; - _textAlign = NSTextAlignmentCenter; - _numberOfLines = 1; - self.delegate = self; - self.dataSource = self; - [self selectRow:0 inComponent:0 animated:YES]; // Workaround for missing selection indicator lines (see https://stackoverflow.com/questions/39564660/uipickerview-selection-indicator-not-visible-in-ios10) - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)initWithCoder:(NSCoder *)aDecoder) - -- (void)setItems:(NSArray *)items -{ - _items = [items copy]; - [self setNeedsLayout]; -} - -- (void)setSelectedIndex:(NSInteger)selectedIndex -{ - if (_selectedIndex != selectedIndex) { - BOOL animated = _selectedIndex != NSNotFound; // Don't animate the initial value - _selectedIndex = selectedIndex; - dispatch_async(dispatch_get_main_queue(), ^{ - [self selectRow:selectedIndex inComponent:0 animated:animated]; - }); - } -} - -- (void)setNumberOfLines:(NSInteger)numberOfLines -{ - _numberOfLines = numberOfLines; - [self reloadAllComponents]; - [self setNeedsLayout]; -} - -- (void) setFont:(UIFont *)font -{ - _font = font; - [self reloadAllComponents]; - [self setNeedsLayout]; -} - -#pragma mark - UIPickerViewDataSource protocol - -- (NSInteger)numberOfComponentsInPickerView:(__unused UIPickerView *)pickerView -{ - return 1; -} - -- (NSInteger)pickerView:(__unused UIPickerView *)pickerView -numberOfRowsInComponent:(__unused NSInteger)component -{ - return _items.count; -} - -#pragma mark - UIPickerViewDelegate methods - -- (NSString *)pickerView:(__unused UIPickerView *)pickerView - titleForRow:(NSInteger)row - forComponent:(__unused NSInteger)component -{ - return [ABI46_0_0RCTConvert NSString:_items[row][@"label"]]; -} - -- (CGFloat)pickerView:(__unused UIPickerView *)pickerView rowHeightForComponent:(__unused NSInteger) component { - return (_font.lineHeight) * _numberOfLines + 20; -} - -- (UIView *)pickerView:(UIPickerView *)pickerView - viewForRow:(NSInteger)row - forComponent:(NSInteger)component - reusingView:(UIView *)view -{ - if (!view) { - CGFloat rowHeight = [pickerView rowSizeForComponent:component].height; - CGFloat rowWidth = [pickerView rowSizeForComponent:component].width; - view = [[UIView alloc] initWithFrame:CGRectZero]; - ABI46_0_0RNCPickerLabel* label = [[ABI46_0_0RNCPickerLabel alloc] initWithFrame:(CGRect) { - CGPointZero, - { - rowWidth, - rowHeight, - } - }]; - [view insertSubview:label atIndex:0]; - } - - ABI46_0_0RNCPickerLabel* label = view.subviews[0]; - label.font = _font; - - label.textColor = [ABI46_0_0RCTConvert UIColor:_items[row][@"textColor"]] ?: _color; - - label.textAlignment = _textAlign; - label.text = [self pickerView:pickerView titleForRow:row forComponent:component]; - label.accessibilityIdentifier = _items[row][@"testID"]; - - label.numberOfLines = _numberOfLines; - - label.leftInset = 20.0; - label.rightInset = 20.0; - - return view; -} - -- (void)pickerView:(__unused UIPickerView *)pickerView - didSelectRow:(NSInteger)row inComponent:(__unused NSInteger)component -{ - _selectedIndex = row; - if (_onChange && _items.count > (NSUInteger)row) { - _onChange(@{ - @"newIndex": @(row), - @"newValue": ABI46_0_0RCTNullIfNil(_items[row][@"value"]), - }); - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.h deleted file mode 100644 index 52267b99dd25fc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.h +++ /dev/null @@ -1,10 +0,0 @@ -#import - -@interface ABI46_0_0RNCPickerLabel : UILabel - -@property (nonatomic, assign) CGFloat topInset; -@property (nonatomic, assign) CGFloat bottomInset; -@property (nonatomic, assign) CGFloat leftInset; -@property (nonatomic, assign) CGFloat rightInset; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.m deleted file mode 100644 index 119788457f5e41..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerLabel.m +++ /dev/null @@ -1,31 +0,0 @@ -#import "ABI46_0_0RNCPickerLabel.h" - -@implementation ABI46_0_0RNCPickerLabel - -- (instancetype)initWithFrame:(CGRect)frame -{ - self = [super initWithFrame:frame]; - if (self) { - self.topInset = 0.0; - self.bottomInset = 0.0; - self.leftInset = 0.0; - self.rightInset = 0.0; - } - return self; -} - -- (void)drawTextInRect:(CGRect)rect -{ - UIEdgeInsets insets = UIEdgeInsetsMake(self.topInset, self.leftInset, self.bottomInset, self.rightInset); - [super drawTextInRect:UIEdgeInsetsInsetRect(rect, insets)]; -} - -- (CGSize)intrinsicContentSize -{ - CGSize intrinsicSuperViewContentSize = [super intrinsicContentSize]; - intrinsicSuperViewContentSize.height += self.topInset + self.bottomInset; - intrinsicSuperViewContentSize.width += self.leftInset + self.rightInset; - return intrinsicSuperViewContentSize; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.h deleted file mode 100644 index bba7346508a404..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCPickerManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.m deleted file mode 100644 index e0a414010b5a1d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Picker/ABI46_0_0RNCPickerManager.m +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCPickerManager.h" -#import "ABI46_0_0RNCPicker.h" - -#import -#import - -@implementation ABI46_0_0RNCPickerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - return [ABI46_0_0RNCPicker new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(items, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(selectedIndex, NSInteger) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onChange, ABI46_0_0RCTBubblingEventBlock) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(color, UIColor) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(textAlign, NSTextAlignment) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(numberOfLines, NSInteger) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontSize, NSNumber, ABI46_0_0RNCPicker) -{ - view.font = [ABI46_0_0RCTFont updateFont:view.font withSize:json ?: @(defaultView.font.pointSize)]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontWeight, NSString, __unused ABI46_0_0RNCPicker) -{ - view.font = [ABI46_0_0RCTFont updateFont:view.font withWeight:json]; // defaults to normal -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontStyle, NSString, __unused ABI46_0_0RNCPicker) -{ - view.font = [ABI46_0_0RCTFont updateFont:view.font withStyle:json]; // defaults to normal -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontFamily, NSString, ABI46_0_0RNCPicker) -{ - view.font = [ABI46_0_0RCTFont updateFont:view.font withFamily:json ?: defaultView.font.familyName]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(themeVariant, NSString, ABI46_0_0RNCPicker) -{ - if (@available(iOS 13.4, *)) { - if (json) { - if ([json isEqual:@"dark"]) - view.overrideUserInterfaceStyle = UIUserInterfaceStyleDark; - else if ([json isEqual:@"light"]) - view.overrideUserInterfaceStyle = UIUserInterfaceStyleLight; - else - view.overrideUserInterfaceStyle = UIUserInterfaceStyleUnspecified; - } - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.h deleted file mode 100644 index 1bdc33d6cc5973..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.h +++ /dev/null @@ -1,27 +0,0 @@ -// -// ABI46_0_0RNSharedElementContent_h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementContent_h -#define ABI46_0_0RNSharedElementContent_h - -#import -#import "ABI46_0_0RNSharedElementTypes.h" - -@interface ABI46_0_0RNSharedElementContent : NSObject -@property (nonatomic, readonly) id data; -@property (nonatomic, readonly) ABI46_0_0RNSharedElementContentType type; -@property (nonatomic, readonly) UIEdgeInsets insets; - -- (instancetype)initWithData:(id) data type:(ABI46_0_0RNSharedElementContentType)type insets:(UIEdgeInsets)insets; -- (NSString*) typeName; - -+ (BOOL) isKindOfImageView:(UIView*) view; -+ (UIImageView*) imageViewFromView:(UIView*) view; - -+ (CGRect) layoutForRect:(CGRect)layout content:(ABI46_0_0RNSharedElementContent*) content contentMode:(UIViewContentMode) contentMode reverse:(BOOL)reverse; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.m deleted file mode 100644 index a6a5d2577369d8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementContent.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// ABI46_0_0RNSharedElementContent_m -// ABI46_0_0React-native-shared-element -// - -#import "ABI46_0_0RNSharedElementContent.h" - -@implementation ABI46_0_0RNSharedElementContent -{ - // nop -} - -- (instancetype)initWithData:(id) data type:(ABI46_0_0RNSharedElementContentType)type insets:(UIEdgeInsets)insets -{ - _data = data; - _type = type; - _insets = insets; - return self; -} - -+ (BOOL) isKindOfImageView:(UIView*) view -{ - return ( - [view isKindOfClass:[UIImageView class]] || - [NSStringFromClass(view.class) isEqualToString:@"ABI46_0_0RCTImageView"] - ); -} - -+ (UIImageView*) imageViewFromView:(UIView*) view -{ - if ([view isKindOfClass:[UIImageView class]]) { - return (UIImageView*) view; - } else if ([NSStringFromClass(view.class) isEqualToString:@"ABI46_0_0RCTImageView"]) { - // As of ABI46_0_0React-native 0.60, ABI46_0_0RCTImageView is no longer inherited from - // UIImageView, but has a UIImageView as child. That will cause this code-path - // to be executed, where the first child view is returned. - return (UIImageView*) view.subviews.firstObject; - } else { - // Error - return nil; - } -} - -- (NSString*) typeName -{ - switch(_type) { - case ABI46_0_0RNSharedElementContentTypeNone: return @"none"; - case ABI46_0_0RNSharedElementContentTypeRawImage: return @"image"; - case ABI46_0_0RNSharedElementContentTypeSnapshotView: return @"snapshotView"; - case ABI46_0_0RNSharedElementContentTypeSnapshotImage: return @"snapshotImage"; - default: return @"unknown"; - } -} - -+ (CGSize) sizeForRect:(CGRect)layout content:(ABI46_0_0RNSharedElementContent*)content -{ - if (content == nil || content.data == nil) return layout.size; - if (content.type != ABI46_0_0RNSharedElementContentTypeRawImage) return layout.size; - CGSize size = layout.size; - return [content.data isKindOfClass:[UIImage class]] ? ((UIImage*)content.data).size : size; -} - -+ (CGRect) layoutForRect:(CGRect)layout content:(ABI46_0_0RNSharedElementContent*) content contentMode:(UIViewContentMode) contentMode reverse:(BOOL)reverse -{ - if (content == nil || content.data == nil) return layout; - if (content.type != ABI46_0_0RNSharedElementContentTypeRawImage) return layout; - CGSize size = layout.size; - size.width -= (content.insets.left + content.insets.right); - size.height -= (content.insets.top + content.insets.bottom); - CGSize contentSize = [ABI46_0_0RNSharedElementContent sizeForRect:layout content:content]; - CGFloat contentAspectRatio = (contentSize.width / contentSize.height); - BOOL lo = (size.width / size.height) < contentAspectRatio; - BOOL aspectRatioCriteria = reverse ? !lo : lo; - switch (contentMode) { - case UIViewContentModeScaleToFill: // stretch - break; - case UIViewContentModeScaleAspectFit: // contain - if (aspectRatioCriteria) { - size.height = size.width / contentAspectRatio; - } else { - size.width = size.height * contentAspectRatio; - } - break; - case UIViewContentModeScaleAspectFill: // cover - if (aspectRatioCriteria) { - size.width = size.height * contentAspectRatio; - } else { - size.height = size.width / contentAspectRatio; - } - break; - case UIViewContentModeCenter: // center - size = contentSize; - break; - default: - break; - } - CGRect contentLayout = layout; - contentLayout.origin.x += (contentLayout.size.width - size.width) / 2; - contentLayout.origin.y += (contentLayout.size.height - size.height) / 2; - contentLayout.size = size; - return contentLayout; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.h deleted file mode 100644 index 6831d9da2b3c18..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// ABI46_0_0RNSharedElementCornerRadii_h -// ABI46_0_0React-native-shared-element -// - -#import -#import - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSharedElementCorner) { - ABI46_0_0RNSharedElementCornerAll = 0, - ABI46_0_0RNSharedElementCornerTopLeft = 1, - ABI46_0_0RNSharedElementCornerTopRight = 2, - ABI46_0_0RNSharedElementCornerBottomLeft = 3, - ABI46_0_0RNSharedElementCornerBottomRight = 4, - ABI46_0_0RNSharedElementCornerTopStart = 5, - ABI46_0_0RNSharedElementCornerTopEnd = 6, - ABI46_0_0RNSharedElementCornerBottomStart = 7, - ABI46_0_0RNSharedElementCornerBottomEnd = 8 -}; - -@interface ABI46_0_0RNSharedElementCornerRadii : NSObject - -@property (nonatomic, assign) UIUserInterfaceLayoutDirection layoutDirection; - -- (instancetype)init; - -- (CGFloat)radiusForCorner:(ABI46_0_0RNSharedElementCorner)corner; -- (BOOL)setRadius:(CGFloat)radius corner:(ABI46_0_0RNSharedElementCorner)corner; - -- (void)updateClipMaskForLayer:(CALayer *)layer bounds:(CGRect)bounds; -- (void)updateShadowPathForLayer:(CALayer *)layer bounds:(CGRect)bounds; -- (ABI46_0_0RCTCornerRadii)radiiForBounds:(CGRect)bounds; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.m deleted file mode 100644 index a9f62d171651ad..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementCornerRadii.m +++ /dev/null @@ -1,162 +0,0 @@ -// -// ABI46_0_0RNSharedElementCornerRadii_m -// ABI46_0_0React-native-shared-element -// - -#import "ABI46_0_0RNSharedElementCornerRadii.h" -#import -#import - -static CGFloat ABI46_0_0RNSharedElementDefaultIfNegativeTo(CGFloat defaultValue, CGFloat x) -{ - return x >= 0 ? x : defaultValue; -}; - -#define RADII_COUNT 9 - -@implementation ABI46_0_0RNSharedElementCornerRadii { - CGFloat _radii[RADII_COUNT]; - BOOL _invalidated; - CGRect _cachedBounds; - ABI46_0_0RCTCornerRadii _cachedRadii; -} - -- (instancetype)init -{ - if (self = [super init]) { - _invalidated = YES; - _layoutDirection = UIUserInterfaceLayoutDirectionLeftToRight; - for (int i = 0; i < RADII_COUNT; i++) { - _radii[i] = -1; - } - } - return self; -} - - -#pragma mark Properties - -- (void)setLayoutDirection:(UIUserInterfaceLayoutDirection)layoutDirection -{ - if (_layoutDirection != layoutDirection) { - _layoutDirection = layoutDirection; - _invalidated = YES; - } -} - - -#pragma mark Methods - -- (CGFloat)radiusForCorner:(ABI46_0_0RNSharedElementCorner)corner -{ - return _radii[corner]; -} - -- (BOOL)setRadius:(CGFloat)radius corner:(ABI46_0_0RNSharedElementCorner)corner -{ - if (_radii[corner] != radius) { - _radii[corner] = radius; - _invalidated = YES; - return YES; - } - return NO; -} - -- (void)updateClipMaskForLayer:(CALayer *)layer bounds:(CGRect)bounds -{ - ABI46_0_0RCTCornerRadii radii = [self radiiForBounds:bounds]; - - CALayer *mask = nil; - CGFloat cornerRadius = 0; - - if (ABI46_0_0RCTCornerRadiiAreEqual(radii)) { - cornerRadius = radii.topLeft; - } else { - CAShapeLayer *shapeLayer = [CAShapeLayer layer]; - ABI46_0_0RCTCornerInsets cornerInsets = ABI46_0_0RCTGetCornerInsets(radii, UIEdgeInsetsZero); - CGPathRef path = ABI46_0_0RCTPathCreateWithRoundedRect(bounds, cornerInsets, NULL); - shapeLayer.path = path; - CGPathRelease(path); - mask = shapeLayer; - } - - layer.cornerRadius = cornerRadius; - layer.mask = mask; -} - -- (void)updateShadowPathForLayer:(CALayer *)layer bounds:(CGRect)bounds -{ - ABI46_0_0RCTCornerRadii radii = [self radiiForBounds:bounds]; - - BOOL hasShadow = layer.shadowOpacity * CGColorGetAlpha(layer.shadowColor) > 0; - if (!hasShadow) { - layer.shadowPath = nil; - return; - } - - ABI46_0_0RCTCornerInsets cornerInsets = ABI46_0_0RCTGetCornerInsets(radii, UIEdgeInsetsZero); - CGPathRef path = ABI46_0_0RCTPathCreateWithRoundedRect(bounds, cornerInsets, NULL); - layer.shadowPath = path; - CGPathRelease(path); -} - -- (ABI46_0_0RCTCornerRadii)radiiForBounds:(CGRect)bounds; -{ - if (!_invalidated && CGRectEqualToRect(_cachedBounds, bounds)) { - return _cachedRadii; - } - - const BOOL isRTL = _layoutDirection == UIUserInterfaceLayoutDirectionRightToLeft; - const CGFloat radius = MAX(0, _radii[ABI46_0_0RNSharedElementCornerAll]); - ABI46_0_0RCTCornerRadii result; - - if ([[ABI46_0_0RCTI18nUtil sharedInstance] doLeftAndRightSwapInRTL]) { - const CGFloat topStartRadius = ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerTopLeft], _radii[ABI46_0_0RNSharedElementCornerTopStart]); - const CGFloat topEndRadius = ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerTopRight], _radii[ABI46_0_0RNSharedElementCornerTopEnd]); - const CGFloat bottomStartRadius = ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerBottomLeft], _radii[ABI46_0_0RNSharedElementCornerBottomStart]); - const CGFloat bottomEndRadius = ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerBottomRight], _radii[ABI46_0_0RNSharedElementCornerBottomEnd]); - - const CGFloat directionAwareTopLeftRadius = isRTL ? topEndRadius : topStartRadius; - const CGFloat directionAwareTopRightRadius = isRTL ? topStartRadius : topEndRadius; - const CGFloat directionAwareBottomLeftRadius = isRTL ? bottomEndRadius : bottomStartRadius; - const CGFloat directionAwareBottomRightRadius = isRTL ? bottomStartRadius : bottomEndRadius; - - result.topLeft = ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopLeftRadius); - result.topRight = ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, directionAwareTopRightRadius); - result.bottomLeft = ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomLeftRadius); - result.bottomRight = ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, directionAwareBottomRightRadius); - } else { - const CGFloat directionAwareTopLeftRadius = isRTL ? _radii[ABI46_0_0RNSharedElementCornerTopEnd] : _radii[ABI46_0_0RNSharedElementCornerTopStart]; - const CGFloat directionAwareTopRightRadius = isRTL ? _radii[ABI46_0_0RNSharedElementCornerTopStart] : _radii[ABI46_0_0RNSharedElementCornerTopEnd]; - const CGFloat directionAwareBottomLeftRadius = isRTL ? _radii[ABI46_0_0RNSharedElementCornerBottomEnd] : _radii[ABI46_0_0RNSharedElementCornerBottomStart]; - const CGFloat directionAwareBottomRightRadius = isRTL ? _radii[ABI46_0_0RNSharedElementCornerBottomStart] : _radii[ABI46_0_0RNSharedElementCornerBottomEnd]; - - result.topLeft = - ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerTopLeft], directionAwareTopLeftRadius)); - result.topRight = - ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerTopRight], directionAwareTopRightRadius)); - result.bottomLeft = - ABI46_0_0RNSharedElementDefaultIfNegativeTo(radius, ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerBottomLeft], directionAwareBottomLeftRadius)); - result.bottomRight = ABI46_0_0RNSharedElementDefaultIfNegativeTo( - radius, ABI46_0_0RNSharedElementDefaultIfNegativeTo(_radii[ABI46_0_0RNSharedElementCornerBottomRight], directionAwareBottomRightRadius)); - } - - // Get scale factors required to prevent radii from overlapping - const CGFloat topScaleFactor = ABI46_0_0RCTZeroIfNaN(MIN(1, bounds.size.width / (result.topLeft + result.topRight))); - const CGFloat bottomScaleFactor = ABI46_0_0RCTZeroIfNaN(MIN(1, bounds.size.width / (result.bottomLeft + result.bottomRight))); - const CGFloat rightScaleFactor = ABI46_0_0RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topRight + result.bottomRight))); - const CGFloat leftScaleFactor = ABI46_0_0RCTZeroIfNaN(MIN(1, bounds.size.height / (result.topLeft + result.bottomLeft))); - - result.topLeft *= MIN(topScaleFactor, leftScaleFactor); - result.topRight *= MIN(topScaleFactor, rightScaleFactor); - result.bottomLeft *= MIN(bottomScaleFactor, leftScaleFactor); - result.bottomRight *= MIN(bottomScaleFactor, rightScaleFactor); - - _cachedBounds = bounds; - _cachedRadii = result; - _invalidated = NO; - - return result; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementDelegate.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementDelegate.h deleted file mode 100644 index a75148fdb996d4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementDelegate.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// ABI46_0_0RNSharedElementDelegate.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementDelegate_h -#define ABI46_0_0RNSharedElementDelegate_h - -#import "ABI46_0_0RNSharedElementStyle.h" -#import "ABI46_0_0RNSharedElementContent.h" -#import "ABI46_0_0RNSharedElementTypes.h" - -@protocol ABI46_0_0RNSharedElementDelegate -- (void) didLoadStyle:(ABI46_0_0RNSharedElementStyle*)style node:(id)node; -- (void) didLoadContent:(ABI46_0_0RNSharedElementContent*)content node:(id)node; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.h deleted file mode 100644 index 0b5b1903a585d1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ABI46_0_0RNSharedElementNode.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementNode_h -#define ABI46_0_0RNSharedElementNode_h - -#import "ABI46_0_0RNSharedElementDelegate.h" - -@interface ABI46_0_0RNSharedElementNode : NSObject - -@property (nonatomic, readonly) NSNumber* ABI46_0_0ReactTag; -@property (nonatomic, readonly) BOOL isParent; -@property (nonatomic) long refCount; -@property (nonatomic) long hideRefCount; - -- (instancetype)init:(NSNumber *)ABI46_0_0ReactTag view:(UIView*) view isParent:(BOOL)isParent; - -- (void) requestContent:(id ) delegate; -- (void) requestStyle:(id ) delegate; -- (void) cancelRequests:(id ) delegate; - -+ (void) setImageResolvers:(NSArray*) imageResolvers; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.m deleted file mode 100644 index 752c35838656e9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNode.m +++ /dev/null @@ -1,408 +0,0 @@ -// -// ABI46_0_0RNSharedElementNode.m -// ABI46_0_0React-native-shared-element -// - -#import -#import -#import "ABI46_0_0RNSharedElementNode.h" -#import "ABI46_0_0RNSharedElementContent.h" -#import - -@interface ABI46_0_0RNSharedElementNodeResolvedSource : NSObject -@property (nonatomic, readonly) UIView* view; -@property (nonatomic, readonly) BOOL hasChildImageView; -- (instancetype)initWithView:(UIView*) view hasChildImageView:(BOOL)hasChildImageView; -@end -@implementation ABI46_0_0RNSharedElementNodeResolvedSource -- (instancetype)initWithView:(UIView*) view hasChildImageView:(BOOL)hasChildImageView -{ - _view = view; - _hasChildImageView = hasChildImageView; - return self; -} -+ (instancetype)sourceWithView:(UIView*) view { - return [[ABI46_0_0RNSharedElementNodeResolvedSource alloc]initWithView:view hasChildImageView:NO]; -} -+ (instancetype)sourceWithView:(UIView*) view hasChildImageView:(BOOL)hasChildImageView { - return [[ABI46_0_0RNSharedElementNodeResolvedSource alloc]initWithView:view hasChildImageView:hasChildImageView]; -} -- (UIView*) contentView { - return (_hasChildImageView && _view.subviews.count) ? _view.subviews[0] : _view; -} -@end - -@implementation ABI46_0_0RNSharedElementNode -{ - long _refCount; - long _hideRefCount; - - NSMutableArray* _contentRequests; - ABI46_0_0RNSharedElementContent* _contentCache; - CFTimeInterval _contentCacheTimeInterval; - - NSMutableArray* _styleRequests; - ABI46_0_0RNSharedElementStyle* _styleCache; - CFTimeInterval _styleCacheTimeInterval; - - CADisplayLink* _displayLink; - - __weak UIView* _sourceView; - ABI46_0_0RNSharedElementNodeResolvedSource* _resolvedSource; -} - -@synthesize ABI46_0_0ReactTag = _ABI46_0_0ReactTag; - -static NSArray* _imageResolvers; - -+ (void) setImageResolvers:(NSArray*) imageResolvers -{ - _imageResolvers = imageResolvers; -} - -- (instancetype)init:(NSNumber *)ABI46_0_0ReactTag view:(UIView*) view isParent:(BOOL)isParent -{ - _ABI46_0_0ReactTag = ABI46_0_0ReactTag; - _sourceView = view; - _isParent = isParent; - _refCount = 1; - _hideRefCount = 0; - _contentRequests = nil; - _contentCache = nil; - _contentCacheTimeInterval = 0.0; - _styleRequests = nil; - _styleCache = nil; - _styleCacheTimeInterval = 0.0; - _displayLink = nil; - _resolvedSource = [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:nil]; - [self updateResolvedSource:YES]; - if (_isParent) [self addStyleObservers:_sourceView]; - return self; -} - -- (UIView*) view -{ - return _resolvedSource ? _resolvedSource.view : nil; -} - -- (void) updateResolvedSource:(BOOL)noReset -{ - ABI46_0_0RNSharedElementNodeResolvedSource* resolvedSource = noReset - ? [ABI46_0_0RNSharedElementNode resolveSource:_isParent ? _sourceView.subviews.firstObject : _sourceView] - : [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:nil]; - - if ((_resolvedSource.view == resolvedSource.view) && (_resolvedSource.contentView == resolvedSource.contentView)) return; - - // Remove old observers - if (_resolvedSource.view != nil && _resolvedSource.view != resolvedSource.view) { - if (_hideRefCount) _resolvedSource.view.hidden = NO; - [self removeStyleObservers: _resolvedSource.view]; - } - if (_resolvedSource.contentView != nil && _resolvedSource.contentView != resolvedSource.contentView) { - [self removeContentObservers: _resolvedSource.contentView]; - } - - // Add new observers - if (resolvedSource.view != nil && _resolvedSource.view != resolvedSource.view) { - if (_hideRefCount) resolvedSource.view.hidden = YES; - [self addStyleObservers:resolvedSource.view]; - } - if (resolvedSource.contentView != nil && _resolvedSource.contentView != resolvedSource.contentView) { - [self addContentObservers:resolvedSource.contentView]; - } - - // Update resolved source - _resolvedSource = resolvedSource; -} - -+ (ABI46_0_0RNSharedElementNodeResolvedSource*) resolveSource:(UIView*) view -{ - if (view == nil || _imageResolvers == nil) return [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:view]; - - // If the view is an ImageView, then use that. - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:view]) { - return [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:view]; - } - - // In case the view contains a single UIImageView child - // which is also the same size as the parent, then - // use child image-view. This fixes . - UIView* subview = view; - for (int i = 0; i < 2; i++) { - if (subview.subviews.count != 1) break; - subview = subview.subviews.firstObject; - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:subview]) { - CGRect bounds = view.bounds; - if ([view isKindOfClass:[ABI46_0_0RCTView class]]) { - ABI46_0_0RCTView* rctView = (ABI46_0_0RCTView*) view; - CGFloat borderWidth = rctView.borderWidth; - if (borderWidth > 0.0f) { - bounds.origin.x += borderWidth; - bounds.origin.y += borderWidth; - bounds.size.width -= (borderWidth * 2.0f); - bounds.size.height -= (borderWidth * 2.0f); - } - } - if (CGRectEqualToRect(subview.frame, bounds)) { - //NSLog(@"RESOLVED IMAGE VIEW, frame: %@, bounds: %@", NSStringFromCGRect(subview.frame), NSStringFromCGRect(bounds)); - return [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:view hasChildImageView:YES]; - } - } - } - - // Resolve the underlying ImageViews of well known - // ABI46_0_0React-native libs (e.g. ABI46_0_0React-native-fast-image) - for (NSArray* imageResolver in _imageResolvers) { - NSArray* subviews = @[view]; - UIView* foundImageView = nil; - for (NSString* name in imageResolver) { - foundImageView = nil; - for (UIView* subview in subviews) { - if ([name isEqualToString:NSStringFromClass(subview.class)]) { - foundImageView = subview; - subviews = subview.subviews; - break; - } - } - } - if (foundImageView != nil) { - return [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:foundImageView]; - } - } - return [ABI46_0_0RNSharedElementNodeResolvedSource sourceWithView:view]; -} - -- (void) addStyleObservers:(UIView*)view -{ - [view addObserver:self forKeyPath:@"bounds" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; - [view addObserver:self forKeyPath:@"frame" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; -} - -- (void) removeStyleObservers:(UIView*)view -{ - [view removeObserver:self forKeyPath:@"bounds"]; - [view removeObserver:self forKeyPath:@"frame"]; -} - -- (void) addContentObservers:(UIView*)view -{ - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:view]) { - UIImageView* imageView = [ABI46_0_0RNSharedElementContent imageViewFromView:view]; - [imageView addObserver:self forKeyPath:@"image" options:NSKeyValueObservingOptionNew | NSKeyValueObservingOptionOld context:nil]; - } -} - -- (void) removeContentObservers:(UIView*)view -{ - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:view]) { - UIImageView* imageView = [ABI46_0_0RNSharedElementContent imageViewFromView:view]; - [imageView removeObserver:self forKeyPath:@"image"]; - } -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context -{ - //NSLog(@"observeValueForKeyPath: %@, changed: %@", keyPath, change); - if ([keyPath isEqualToString:@"image"]) { - [self updateContent]; - } else { - [self updateStyle]; - } -} - -- (void) setRefCount:(long)refCount { - _refCount = refCount; - if (_refCount == 0) { - if (_displayLink != nil) { - [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; - _displayLink = nil; - } - [self updateResolvedSource:NO]; - if (_isParent && (_sourceView != nil)) { - [self removeStyleObservers:_sourceView]; - } - } -} - -- (long) refCount { - return _refCount; -} - -- (void) setHideRefCount:(long)refCount -{ - _hideRefCount = refCount; - if (_hideRefCount == 1) { - if (_resolvedSource.view != nil) _resolvedSource.view.hidden = YES; - } - else if (_hideRefCount == 0) { - if (_resolvedSource.view != nil) _resolvedSource.view.hidden = NO; - } -} - -- (long) hideRefCount -{ - return _hideRefCount; -} - -- (void) requestContent:(__weak id ) delegate -{ - if (_contentCache != nil && ((CACurrentMediaTime() - _contentCacheTimeInterval) <= 0.3)) { - [delegate didLoadContent:_contentCache node:self]; - return; - } - - if (_contentRequests == nil) _contentRequests = [[NSMutableArray alloc]init]; - [_contentRequests addObject:delegate]; - - [self updateContent]; -} - -- (void) updateContent -{ - // Update the resolved source - [self updateResolvedSource:YES]; - ABI46_0_0RNSharedElementNodeResolvedSource* resolvedSource = _resolvedSource; - UIView* view = resolvedSource.view; - UIView* contentView = resolvedSource.contentView; - if (view == nil) return; - if (_contentRequests == nil) return; - - CGRect bounds = view.bounds; - CGRect frame = contentView.frame; - if (!bounds.size.width || !bounds.size.height) { - return; - } - - // Obtain snapshot content - ABI46_0_0RNSharedElementContent* content; - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:contentView]) { - UIImageView* imageView = [ABI46_0_0RNSharedElementContent imageViewFromView:contentView]; - UIImage* image = imageView.image; - UIEdgeInsets imageInsets = UIEdgeInsetsZero; - if (contentView != view) { - imageInsets.left = frame.origin.x; - imageInsets.top = frame.origin.y; - imageInsets.right = bounds.size.width - frame.size.width - frame.origin.x; - imageInsets.bottom = bounds.size.height - frame.size.height - frame.origin.y; - } - content = [[ABI46_0_0RNSharedElementContent alloc]initWithData:image type:ABI46_0_0RNSharedElementContentTypeRawImage insets:imageInsets]; - } - else if ([NSStringFromClass(view.class) isEqualToString:@"ABI46_0_0RCTView"] && !view.subviews.count) { - UIView* dummyView = [[UIView alloc]init]; - content = [[ABI46_0_0RNSharedElementContent alloc]initWithData:dummyView type:ABI46_0_0RNSharedElementContentTypeSnapshotView insets:UIEdgeInsetsZero]; - } - else { - UIView* snapshotView = [view snapshotViewAfterScreenUpdates:NO]; - content = [[ABI46_0_0RNSharedElementContent alloc]initWithData:snapshotView type:ABI46_0_0RNSharedElementContentTypeSnapshotView insets:UIEdgeInsetsZero]; - } - /*else { - NSLog(@"drawViewHierarchyInRect: bounds: %@", NSStringFromCGRect(bounds)); - UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 0.0f); - BOOL res = [view drawViewHierarchyInRect:bounds afterScreenUpdates:NO]; // NEVER USE YES, IT CREATED VISUAL ABI46_0_0ARTEFACTS ON THE CREEN - UIImage* image = res ? UIGraphicsGetImageFromCurrentImageContext() : nil; - UIGraphicsEndImageContext(); - NSLog(@"drawViewHierarchyInRect: RESULT: %li", res); - content = image; - contentType = ABI46_0_0RNSharedElementContentTypeSnapshotImage; - }*/ - - // If the content could not be obtained, then try again later - if (content == nil || content.data == nil) { - return [self updateRetryLoop]; - } - // NSLog(@"Content fetched: %@, size: %@", content, NSStringFromCGSize(bounds.size)); - - _contentCache = content; - _contentCacheTimeInterval = CACurrentMediaTime(); - - NSArray* delegates = _contentRequests; - _contentRequests = nil; - [self updateRetryLoop]; - for (__weak id delegate in delegates) { - if (delegate != nil) { - [delegate didLoadContent:content node:self]; - } - } -} - -- (void) requestStyle:(__weak id ) delegate -{ - if (_styleCache != nil && ((CACurrentMediaTime() - _styleCacheTimeInterval) <= 0.3)) { - [delegate didLoadStyle:_styleCache node:self]; - return; - } - - if (_styleRequests == nil) _styleRequests = [[NSMutableArray alloc]init]; - [_styleRequests addObject:delegate]; - - [self updateStyle]; -} - -- (void) updateStyle -{ - [self updateResolvedSource:YES]; - ABI46_0_0RNSharedElementNodeResolvedSource* resolvedSource = _resolvedSource; - UIView* view = resolvedSource.view; - UIView* contentView = resolvedSource.contentView; - if (_styleRequests == nil) return; - if (view == nil) return; - - // If the window could not be obtained, then try again later - if (view.window == nil) { - return [self updateRetryLoop]; - } - - // Get absolute layout - CGRect layout = [view convertRect:view.bounds toView:nil]; - if (CGRectIsEmpty(layout)) return; - - // Create style - ABI46_0_0RNSharedElementStyle* style = [[ABI46_0_0RNSharedElementStyle alloc]initWithView:view]; - style.layout = layout; - if ([ABI46_0_0RNSharedElementContent isKindOfImageView:contentView]) { - UIImageView* imageView = [ABI46_0_0RNSharedElementContent imageViewFromView:contentView]; - style.contentMode = imageView.contentMode; - } else { - style.contentMode = view.contentMode; - } - /* NSLog(@"Style fetched, window: %@, alpha: %f, hidden: %@, parent: %@, layout: %@, realSize: %@, opacity: %lf, transform: %@, borderWidth: %lf, contentMode: %ld", view.window, view.alpha, @(view.hidden), @(_isParent), NSStringFromCGRect(layout), NSStringFromCGSize(style.size), style.opacity, [ABI46_0_0RNSharedElementStyle stringFromTransform:style.transform], style.borderWidth, style.contentMode); */ - - _styleCache = style; - _styleCacheTimeInterval = CACurrentMediaTime(); - - NSArray* delegates = _styleRequests; - _styleRequests = nil; - [self updateRetryLoop]; - for (__weak id delegate in delegates) { - if (delegate != nil) { - [delegate didLoadStyle:style node:self]; - } - } -} - -- (void) cancelRequests:(id ) delegate -{ - if (_styleRequests != nil) [_styleRequests removeObject:delegate]; - if (_contentRequests != nil) [_contentRequests removeObject:delegate]; -} - -- (void)updateRetryLoop -{ - BOOL shouldRun = _styleRequests != nil || _contentRequests != nil; - if (shouldRun && _displayLink == nil) { - _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onDisplayLinkUpdate:)]; - [_displayLink addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; - } else if (!shouldRun && _displayLink != nil) { - [_displayLink removeFromRunLoop:[NSRunLoop mainRunLoop] forMode:NSDefaultRunLoopMode]; - _displayLink = nil; - } -} - -- (void)onDisplayLinkUpdate:(CADisplayLink *)sender -{ - // NSLog(@"onDisplayLinkUpdate"); - if (_styleRequests != nil) [self updateStyle]; - if (_contentRequests != nil) [self updateContent]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.h deleted file mode 100644 index c88847f2bd9fbb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// ABI46_0_0RNSharedElementNodeManager.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementNodeManager_h -#define ABI46_0_0RNSharedElementNodeManager_h - -#import "ABI46_0_0RNSharedElementNode.h" - -@interface ABI46_0_0RNSharedElementNodeManager : NSObject - -- (instancetype)init; -- (ABI46_0_0RNSharedElementNode*) acquire:(NSNumber*) ABI46_0_0ReactTag view:(UIView*)view isParent:(BOOL)isParent; -- (long) release:(ABI46_0_0RNSharedElementNode*) node; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.m deleted file mode 100644 index 82b159cabeb02b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementNodeManager.m +++ /dev/null @@ -1,50 +0,0 @@ -// -// ABI46_0_0RCTMagicMoveCloneDataManager.m -// ABI46_0_0React-native-shared-element -// - -#import -#import "ABI46_0_0RNSharedElementNodeManager.h" - -@implementation ABI46_0_0RNSharedElementNodeManager -{ - NSMutableDictionary* _items; -} - -- (instancetype)init -{ - _items = [[NSMutableDictionary alloc]init]; - return self; -} - -- (ABI46_0_0RNSharedElementNode*) acquire:(NSNumber*) ABI46_0_0ReactTag view:(UIView*)view isParent:(BOOL)isParent -{ - @synchronized(_items) - { - ABI46_0_0RNSharedElementNode* node = [_items objectForKey:ABI46_0_0ReactTag]; - if (node != nil) { - node.refCount = node.refCount + 1; - return node; - } - node = [[ABI46_0_0RNSharedElementNode alloc]init:ABI46_0_0ReactTag view:view isParent:isParent]; - [_items setObject:node forKey:ABI46_0_0ReactTag]; - return node; - } -} - -- (long) release:(ABI46_0_0RNSharedElementNode*) node -{ - @synchronized(_items) - { - node.refCount = node.refCount - 1; - if (node.refCount == 0) { - ABI46_0_0RNSharedElementNode* dictItem = [_items objectForKey:node.ABI46_0_0ReactTag]; - if (dictItem == node) { - [_items removeObjectForKey:node.ABI46_0_0ReactTag]; - } - } - return node.refCount; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.h deleted file mode 100644 index 1983756476f258..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.h +++ /dev/null @@ -1,37 +0,0 @@ -// -// ABI46_0_0RNSharedElementStyle_h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementStyle_h -#define ABI46_0_0RNSharedElementStyle_h - -#import -#import "ABI46_0_0RNSharedElementCornerRadii.h" - -@interface ABI46_0_0RNSharedElementStyle : NSObject -@property (nonatomic, weak) UIView *view; -@property (nonatomic, assign) CGRect layout; -@property (nonatomic, assign) CGSize size; -@property (nonatomic, assign) CATransform3D transform; -@property (nonatomic, assign) UIViewContentMode contentMode; -@property (nonatomic, assign) CGFloat opacity; -@property (nonatomic, strong) UIColor *backgroundColor; -@property (nonatomic, readonly) ABI46_0_0RNSharedElementCornerRadii *cornerRadii; -@property (nonatomic, assign) CGFloat borderWidth; -@property (nonatomic, strong) UIColor *borderColor; -@property (nonatomic, assign) CGFloat shadowOpacity; -@property (nonatomic, assign) CGFloat shadowRadius; -@property (nonatomic, assign) CGSize shadowOffset; -@property (nonatomic, strong) UIColor *shadowColor; -- (instancetype)init; -- (instancetype)initWithView:(UIView*) view; - -+ (NSString*) stringFromTransform:(CATransform3D) transform; -+ (CATransform3D) getAbsoluteViewTransform:(UIView*) view; -+ (UIColor*) getInterpolatedColor:(UIColor*)color1 color2:(UIColor*)color2 position:(CGFloat)position; -+ (ABI46_0_0RNSharedElementStyle*) getInterpolatedStyle:(ABI46_0_0RNSharedElementStyle*)style1 style2:(ABI46_0_0RNSharedElementStyle*)style2 position:(CGFloat) position; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.m deleted file mode 100644 index 0e8610d3e9c7ea..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementStyle.m +++ /dev/null @@ -1,149 +0,0 @@ -// -// ABI46_0_0RNSharedElementStyle.m -// ABI46_0_0React-native-shared-element -// - -#import "ABI46_0_0RNSharedElementStyle.h" -#import -#import - -@implementation ABI46_0_0RNSharedElementStyle - -- (instancetype)init -{ - if ((self = [super init])) { - _cornerRadii = [ABI46_0_0RNSharedElementCornerRadii new]; - } - return self; -} - -- (instancetype)initWithView:(UIView*) view -{ - if ((self = [super init])) { - _view = view; - _size = view.bounds.size; - _transform = [ABI46_0_0RNSharedElementStyle getAbsoluteViewTransform:view]; - - // Set base props from style - CALayer* layer = view.layer; - _opacity = layer.opacity; - _borderWidth = layer.borderWidth; - _borderColor = layer.borderColor ? [UIColor colorWithCGColor:layer.borderColor] : [UIColor clearColor]; - _backgroundColor = layer.backgroundColor ? [UIColor colorWithCGColor:layer.backgroundColor] : [UIColor clearColor]; - _shadowColor = layer.shadowColor ? [UIColor colorWithCGColor:layer.shadowColor] : [UIColor clearColor]; - _shadowOffset = layer.shadowOffset; - _shadowRadius = layer.shadowRadius; - _shadowOpacity = layer.shadowOpacity; - - // On ABI46_0_0RN60 and beyond, certain styles are not immediately applied to the view/layer - // when a borderWidth is set on the view. Therefore, as a fail-safe we also try to - // get the props from the ABI46_0_0RCTView directly, when possible. - if ([view isKindOfClass:[ABI46_0_0RCTView class]]) { - ABI46_0_0RCTView* rctView = (ABI46_0_0RCTView*) view; - _cornerRadii = [ABI46_0_0RNSharedElementStyle cornerRadiiFromABI46_0_0RCTView: rctView]; - _borderWidth = rctView.borderWidth >= 0.0f ? rctView.borderWidth : 0.0f; - _backgroundColor = rctView.backgroundColor ? rctView.backgroundColor : [UIColor clearColor]; - - // As of ABI46_0_0React-native 0.65, the borderColor type was changed from CGColorRef to UIColor* - objc_property_t propertyType = class_getProperty([ABI46_0_0RCTView class], "borderColor"); - const char *propertyAttrs = property_getAttributes(propertyType); - BOOL isUIColor = [[NSString stringWithUTF8String:propertyAttrs] containsString:@"UIColor"]; - _borderColor = rctView.borderColor ? (isUIColor ? (UIColor*) rctView.borderColor : [UIColor colorWithCGColor:(CGColorRef) rctView.borderColor]) : [UIColor clearColor]; - - } else { - _cornerRadii = [ABI46_0_0RNSharedElementCornerRadii new]; - [_cornerRadii setRadius:layer.cornerRadius corner:ABI46_0_0RNSharedElementCornerAll]; - } - } - - return self; -} - -+ (NSString*) stringFromTransform:(CATransform3D) transform { - BOOL isAffine = CATransform3DIsAffine(transform); - if (isAffine) { - CGAffineTransform affine = CATransform3DGetAffineTransform(transform); - return [NSString stringWithFormat:@"tx=%f, ty=%f, sx=%f, sy=%f, ro=%f", - affine.tx, affine.ty, affine.a, affine.d, atan2f(affine.b, affine.a) * (180 / M_PI)]; - } else { - return [NSString stringWithFormat:@"x=%f, y=%f, z=%f", - transform.m41, transform.m42, transform.m43]; - } -} - -+ (CATransform3D) getAbsoluteViewTransform:(UIView*) view -{ - CATransform3D transform = view.layer.transform; - view = view.superview; - while (view != nil) { - transform = CATransform3DConcat(transform, view.layer.transform); - view = view.superview; - } - return transform; -} - -+ (UIColor*) getInterpolatedColor:(UIColor*)color1 color2:(UIColor*)color2 position:(CGFloat)position -{ - CGFloat red1, green1, blue1, alpha1; - CGFloat red2, green2, blue2, alpha2; - [color1 getRed:&red1 green:&green1 blue:&blue1 alpha:&alpha1]; - [color2 getRed:&red2 green:&green2 blue:&blue2 alpha:&alpha2]; - CGFloat alpha = alpha1 + ((alpha2 - alpha1) * position); - CGFloat red = red1 + ((red2 - red1) * position); - CGFloat green = green1 + ((green2 - green1) * position); - CGFloat blue = blue1 + ((blue2 - blue1) * position); - if ((alpha1 == 0.0f) && (alpha2 != 0.0f)) { - red = red2; - green = green2; - blue = blue2; - } else if ((alpha2 == 0.0f) && (alpha1 != 0.0f)) { - red = red1; - green = green1; - blue = blue1; - } - return [UIColor colorWithRed:red green:green blue:blue alpha:alpha]; -} - -+ (ABI46_0_0RNSharedElementStyle*) getInterpolatedStyle:(ABI46_0_0RNSharedElementStyle*)style1 style2:(ABI46_0_0RNSharedElementStyle*)style2 position:(CGFloat) position -{ - ABI46_0_0RNSharedElementStyle* style = [[ABI46_0_0RNSharedElementStyle alloc]init]; - style.opacity = style1.opacity + ((style2.opacity - style1.opacity) * position); - - CGRect radiiRect = CGRectMake(0, 0, 1000000, 1000000); - ABI46_0_0RCTCornerRadii radii1 = [style1.cornerRadii radiiForBounds:radiiRect]; - ABI46_0_0RCTCornerRadii radii2 = [style2.cornerRadii radiiForBounds:radiiRect]; - [style.cornerRadii setRadius:radii1.topLeft + ((radii2.topLeft - radii1.topLeft) * position) corner:ABI46_0_0RNSharedElementCornerTopLeft]; - [style.cornerRadii setRadius:radii1.topRight + ((radii2.topRight - radii1.topRight) * position) corner:ABI46_0_0RNSharedElementCornerTopRight]; - [style.cornerRadii setRadius:radii1.bottomLeft + ((radii2.bottomLeft - radii1.bottomLeft) * position) corner:ABI46_0_0RNSharedElementCornerBottomLeft]; - [style.cornerRadii setRadius:radii1.bottomRight + ((radii2.bottomRight - radii1.bottomRight) * position) corner:ABI46_0_0RNSharedElementCornerBottomRight]; - - style.borderWidth = style1.borderWidth + ((style2.borderWidth - style1.borderWidth) * position); - style.borderColor = [ABI46_0_0RNSharedElementStyle getInterpolatedColor:style1.borderColor color2:style2.borderColor position:position]; - style.backgroundColor = [ABI46_0_0RNSharedElementStyle getInterpolatedColor:style1.backgroundColor color2:style2.backgroundColor position:position]; - style.shadowOpacity = style1.shadowOpacity + ((style2.shadowOpacity - style1.shadowOpacity) * position); - style.shadowRadius = style1.shadowRadius + ((style2.shadowRadius - style1.shadowRadius) * position); - style.shadowOffset = CGSizeMake( - style1.shadowOffset.width + ((style2.shadowOffset.width - style1.shadowOffset.width) * position), - style1.shadowOffset.height + ((style2.shadowOffset.height - style1.shadowOffset.height) * position) - ); - style.shadowColor = [ABI46_0_0RNSharedElementStyle getInterpolatedColor:style1.shadowColor color2:style2.shadowColor position:position]; - return style; -} - -+ (ABI46_0_0RNSharedElementCornerRadii *)cornerRadiiFromABI46_0_0RCTView:(ABI46_0_0RCTView *)rctView -{ - ABI46_0_0RNSharedElementCornerRadii *cornerRadii = [ABI46_0_0RNSharedElementCornerRadii new]; - [cornerRadii setRadius:[rctView borderRadius] corner:ABI46_0_0RNSharedElementCornerAll]; - [cornerRadii setRadius:[rctView borderTopLeftRadius] corner:ABI46_0_0RNSharedElementCornerTopLeft]; - [cornerRadii setRadius:[rctView borderTopRightRadius] corner:ABI46_0_0RNSharedElementCornerTopRight]; - [cornerRadii setRadius:[rctView borderTopStartRadius] corner:ABI46_0_0RNSharedElementCornerTopStart]; - [cornerRadii setRadius:[rctView borderTopEndRadius] corner:ABI46_0_0RNSharedElementCornerTopEnd]; - [cornerRadii setRadius:[rctView borderBottomLeftRadius] corner:ABI46_0_0RNSharedElementCornerBottomLeft]; - [cornerRadii setRadius:[rctView borderBottomRightRadius] corner:ABI46_0_0RNSharedElementCornerBottomRight]; - [cornerRadii setRadius:[rctView borderBottomStartRadius] corner:ABI46_0_0RNSharedElementCornerBottomStart]; - [cornerRadii setRadius:[rctView borderBottomEndRadius] corner:ABI46_0_0RNSharedElementCornerBottomEnd]; - [cornerRadii setLayoutDirection:[rctView ABI46_0_0ReactLayoutDirection]]; - return cornerRadii; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.h deleted file mode 100644 index a5269482bf0a92..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransition.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementTransition_h -#define ABI46_0_0RNSharedElementTransition_h - -#import -#import -#import "ABI46_0_0RNSharedElementNodeManager.h" -#import "ABI46_0_0RNSharedElementDelegate.h" - -@interface ABI46_0_0RNSharedElementTransition : UIView - -@property (nonatomic, assign) CGFloat nodePosition; -@property (nonatomic, assign) ABI46_0_0RNSharedElementAnimation animation; -@property (nonatomic, assign) ABI46_0_0RNSharedElementResize resize; -@property (nonatomic, assign) ABI46_0_0RNSharedElementAlign align; -@property (nonatomic, strong) ABI46_0_0RNSharedElementNode* startNode; -@property (nonatomic, strong) ABI46_0_0RNSharedElementNode* startAncestor; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onMeasureNode; -@property (nonatomic, strong) ABI46_0_0RNSharedElementNode* endNode; -@property (nonatomic, strong) ABI46_0_0RNSharedElementNode* endAncestor; - -- (instancetype)initWithNodeManager:(ABI46_0_0RNSharedElementNodeManager*)nodeManager; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.m deleted file mode 100644 index 9a9dd3f45a5bf0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransition.m +++ /dev/null @@ -1,678 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransition.m -// ABI46_0_0React-native-shared-element -// - -#import -#import -#import -#import -#import -#import "ABI46_0_0RNSharedElementTransition.h" -#import "ABI46_0_0RNSharedElementTransitionItem.h" - -#define ITEM_START_ANCESTOR 0 -#define ITEM_END_ANCESTOR 1 -#define ITEM_START 2 -#define ITEM_END 3 - -#ifdef DEBUG -#define DebugLog(...) NSLog(__VA_ARGS__) -#else -#define DebugLog(...) (void)0 -#endif - -@implementation ABI46_0_0RNSharedElementTransition -{ - NSArray* _items; - UIView* _outerStyleView; - UIView* _innerClipView; - UIImageView* _primaryImageView; - UIImageView* _secondaryImageView; - BOOL _ABI46_0_0ReactFrameSet; - BOOL _initialLayoutPassCompleted; - int _initialVisibleAncestorIndex; -} - -- (instancetype)initWithNodeManager:(ABI46_0_0RNSharedElementNodeManager*)nodeManager -{ - if ((self = [super init])) { - _items = @[ - [[ABI46_0_0RNSharedElementTransitionItem alloc]initWithNodeManager:nodeManager name:@"startAncestor" isAncestor:YES], - [[ABI46_0_0RNSharedElementTransitionItem alloc]initWithNodeManager:nodeManager name:@"endAncestor" isAncestor:YES], - [[ABI46_0_0RNSharedElementTransitionItem alloc]initWithNodeManager:nodeManager name:@"startNode" isAncestor:NO], - [[ABI46_0_0RNSharedElementTransitionItem alloc]initWithNodeManager:nodeManager name:@"endNode" isAncestor:NO] - ]; - _nodePosition = 0.0f; - _animation = ABI46_0_0RNSharedElementAnimationMove; - _resize = ABI46_0_0RNSharedElementResizeStretch; - _align = ABI46_0_0RNSharedElementAlignCenterCenter; - _ABI46_0_0ReactFrameSet = NO; - _initialLayoutPassCompleted = NO; - _initialVisibleAncestorIndex = -1; - self.userInteractionEnabled = NO; - - _outerStyleView = [[UIImageView alloc]init]; - _outerStyleView.userInteractionEnabled = NO; - _outerStyleView.frame = self.bounds; - [self addSubview:_outerStyleView]; - - _innerClipView = [[UIImageView alloc]init]; - _innerClipView.userInteractionEnabled = NO; - _innerClipView.frame = self.bounds; - _innerClipView.layer.masksToBounds = YES; - [_outerStyleView addSubview:_innerClipView]; - - _primaryImageView = [self createImageView]; - _secondaryImageView = [self createImageView]; - } - - return self; -} - -- (void)removeFromSuperview -{ - [super removeFromSuperview]; - - for (ABI46_0_0RNSharedElementTransitionItem* item in _items) { - if (item.node != nil) [item.node cancelRequests:self]; - } -} - -- (void)dealloc -{ - for (ABI46_0_0RNSharedElementTransitionItem* item in _items) { - item.node = nil; - } -} - -- (UIImageView*) createImageView -{ - UIImageView* imageView = [[UIImageView alloc]init]; - imageView.contentMode = UIViewContentModeScaleToFill; - imageView.userInteractionEnabled = NO; - imageView.frame = self.bounds; - return imageView; -} - -- (ABI46_0_0RNSharedElementTransitionItem*) findItemForNode:(ABI46_0_0RNSharedElementNode*) node -{ - for (ABI46_0_0RNSharedElementTransitionItem* item in _items) { - if (item.node == node) { - return item; - } - } - return nil; -} - -- (void)setStartNode:(ABI46_0_0RNSharedElementNode *)startNode -{ - ((ABI46_0_0RNSharedElementTransitionItem*)[_items objectAtIndex:ITEM_START]).node = startNode; -} - -- (void)setEndNode:(ABI46_0_0RNSharedElementNode *)endNode -{ - ((ABI46_0_0RNSharedElementTransitionItem*)[_items objectAtIndex:ITEM_END]).node = endNode; -} - -- (void)setStartAncestor:(ABI46_0_0RNSharedElementNode *)startNodeAncestor -{ - ((ABI46_0_0RNSharedElementTransitionItem*)[_items objectAtIndex:ITEM_START_ANCESTOR]).node = startNodeAncestor; -} - -- (void)setEndAncestor:(ABI46_0_0RNSharedElementNode *)endNodeAncestor -{ - ((ABI46_0_0RNSharedElementTransitionItem*)[_items objectAtIndex:ITEM_END_ANCESTOR]).node = endNodeAncestor; -} - -- (void)setNodePosition:(CGFloat)nodePosition -{ - if (_nodePosition != nodePosition) { - _nodePosition = nodePosition; - [self updateStyle]; - } -} - -- (void) setAnimation:(ABI46_0_0RNSharedElementAnimation)animation -{ - if (_animation != animation) { - _animation = animation; - [self updateStyle]; - } -} - -- (void) setResize:(ABI46_0_0RNSharedElementResize)resize -{ - if (_resize != resize) { - _resize = resize; - [self updateStyle]; - } -} - -- (void) setAlign:(ABI46_0_0RNSharedElementAlign)align -{ - if (_align != align) { - _align = align; - [self updateStyle]; - } -} - -- (void)updateNodeVisibility -{ - for (ABI46_0_0RNSharedElementTransitionItem* item in _items) { - BOOL hidden = _initialLayoutPassCompleted && item.style != nil && item.content != nil; - if (hidden && (_animation == ABI46_0_0RNSharedElementAnimationFadeIn) && [item.name isEqualToString:@"startNode"]) hidden = NO; - if (hidden && (_animation == ABI46_0_0RNSharedElementAnimationFadeOut) && [item.name isEqualToString:@"endNode"]) hidden = NO; - item.hidden = hidden; - } -} - -- (void) didSetProps:(NSArray *)changedProps -{ - for (ABI46_0_0RNSharedElementTransitionItem* item in _items) { - if (_initialLayoutPassCompleted && item.needsLayout) { - item.needsLayout = NO; - [item.node requestStyle:self]; - } - } - [self updateNodeVisibility]; -} - -- (void)updateViewWithImage:(UIImageView*)view image:(UIImage *)image -{ - if (!image) { - view.image = nil; - return; - } - - // Apply trilinear filtering to smooth out mis-sized images - view.layer.minificationFilter = kCAFilterTrilinear; - view.layer.magnificationFilter = kCAFilterTrilinear; - - // NSLog(@"updateWithImage: %@", NSStringFromCGRect(self.frame)); - view.image = image; -} - -- (void) didLoadContent:(ABI46_0_0RNSharedElementContent*)content node:(id)node -{ - // NSLog(@"didLoadContent: %@", content); - ABI46_0_0RNSharedElementTransitionItem* item = [self findItemForNode:node]; - if (item == nil) return; - item.content = content; - if ((content.type == ABI46_0_0RNSharedElementContentTypeSnapshotImage) || (content.type == ABI46_0_0RNSharedElementContentTypeRawImage)) { - UIImage* image = (UIImage*) content.data; - if (_animation == ABI46_0_0RNSharedElementAnimationMove) { - if (_primaryImageView.image == nil) { - [self updateViewWithImage:_primaryImageView image:image]; - } else if ((image.size.width * image.size.height) > (_primaryImageView.image.size.width * _primaryImageView.image.size.height)) { - [self updateViewWithImage:_primaryImageView image:image]; - } - } else { - if (item == _items[ITEM_START]) { - [self updateViewWithImage:_primaryImageView image:image]; - } else { - [self updateViewWithImage:_secondaryImageView image:image]; - } - } - } - [self updateStyle]; - [self updateNodeVisibility]; -} - -- (void) didLoadStyle:(ABI46_0_0RNSharedElementStyle *)style node:(ABI46_0_0RNSharedElementNode*)node -{ - // NSLog(@"didLoadStyle: %@", NSStringFromCGRect(style.layout)); - ABI46_0_0RNSharedElementTransitionItem* item = [self findItemForNode:node]; - if (item == nil) return; - item.style = style; - [self updateStyle]; - [self updateNodeVisibility]; -} - -- (CGRect)normalizeLayout:(CGRect)layout - compensateForTransforms:(BOOL)compensateForTransforms - ancestor:(ABI46_0_0RNSharedElementTransitionItem*)ancestor - otherAncestor:(ABI46_0_0RNSharedElementTransitionItem*)otherAncestor - -{ - // Compensate for any transforms that have been applied to the scene by the - // navigator. For instance, a navigator may translate the scene to the right, - // outside of the screen, in order to show it using a slide animation. - // In such a case, remove that transform in order to obtain the "real" - // size and position on the screen. - if (compensateForTransforms && (ancestor.style != nil)) { - - // Calculate "real" size and position of the ancestor (undo its transform) - ABI46_0_0RNSharedElementStyle* ancestorStyle = ancestor.style; - ABI46_0_0RNSharedElementStyle* otherAncestorStyle = otherAncestor ? otherAncestor.style : nil; - CATransform3D transform = otherAncestorStyle ? CATransform3DConcat(ancestorStyle.transform, CATransform3DInvert(otherAncestorStyle.transform)) : ancestorStyle.transform; - CGRect ancestorLayout = ancestorStyle.layout; - CGRect normalizedAncestorLayout = ancestorLayout; - if (CATransform3DIsAffine(transform)) { - CGAffineTransform affineTransform = CATransform3DGetAffineTransform(CATransform3DInvert(transform)); - // Apply the transform on the center - normalizedAncestorLayout.origin = CGPointMake((ancestorLayout.size.width / -2.0), (ancestorLayout.size.height / -2.0)); - CGPoint diff = CGPointMake(ancestorLayout.origin.x - normalizedAncestorLayout.origin.x, ancestorLayout.origin.y - normalizedAncestorLayout.origin.y); - normalizedAncestorLayout = CGRectApplyAffineTransform(normalizedAncestorLayout, affineTransform); - // Undo centering - normalizedAncestorLayout.origin = CGPointMake(normalizedAncestorLayout.origin.x + diff.x,normalizedAncestorLayout.origin.y + diff.y); - } else { - // Fallback, supports only translation - normalizedAncestorLayout.origin.x -= transform.m41; - normalizedAncestorLayout.origin.y -= transform.m42; - } - - // Calculate size and position of element within the normalized ancestor - CGFloat scaleX = normalizedAncestorLayout.size.width / ancestorLayout.size.width; - CGFloat scaleY = normalizedAncestorLayout.size.height / ancestorLayout.size.height; - layout = CGRectMake( - ((layout.origin.x - ancestorLayout.origin.x) * scaleX) + normalizedAncestorLayout.origin.x, - ((layout.origin.y - ancestorLayout.origin.y) * scaleY) + normalizedAncestorLayout.origin.y, - layout.size.width * scaleX, - layout.size.height * scaleY - ); - } - - // Convert to render overlay coordinates - return [self.superview convertRect:layout fromView:nil]; -} - -- (CGFloat) getAncestorVisibility:(ABI46_0_0RNSharedElementStyle*)ancestorStyle -{ - CGRect intersection = CGRectIntersection(self.superview.bounds, [self.superview convertRect:ancestorStyle.layout fromView:nil]); - if (CGRectIsNull(intersection)) return 0; - CGFloat superVolume = self.superview.bounds.size.width * self.superview.bounds.size.height; - CGFloat intersectionVolume = intersection.size.width * intersection.size.height; - CGFloat ancestorVolume = ancestorStyle.layout.size.width * ancestorStyle.layout.size.height; - return (intersectionVolume / superVolume) * (intersectionVolume / ancestorVolume); -} - -- (CGRect) getInterpolatedLayout:(CGRect)layout1 layout2:(CGRect)layout2 position:(CGFloat) position -{ - return CGRectMake( - layout1.origin.x + ((layout2.origin.x - layout1.origin.x) * position), - layout1.origin.y + ((layout2.origin.y - layout1.origin.y) * position), - layout1.size.width + ((layout2.size.width - layout1.size.width) * position), - layout1.size.height + ((layout2.size.height - layout1.size.height) * position) - ); -} - -- (UIEdgeInsets) getClipInsets:(CGRect)layout visibleLayout:(CGRect)visibleLayout -{ - return UIEdgeInsetsMake( - visibleLayout.origin.y - layout.origin.y, - visibleLayout.origin.x - layout.origin.x, - (layout.origin.y + layout.size.height) - (visibleLayout.origin.y + visibleLayout.size.height), - (layout.origin.x + layout.size.width) - (visibleLayout.origin.x + visibleLayout.size.width) - ); -} - -- (UIEdgeInsets) getInterpolatedClipInsets:(CGRect)interpolatedLayout startClipInsets:(UIEdgeInsets)startClipInsets startVisibleLayout:(CGRect)startVisibleLayout endClipInsets:(UIEdgeInsets)endClipInsets endVisibleLayout:(CGRect)endVisibleLayout -{ - UIEdgeInsets clipInsets = UIEdgeInsetsZero; - - // Top - if (!endClipInsets.top && startClipInsets.top && startVisibleLayout.origin.y <= endVisibleLayout.origin.y) { - clipInsets.top = MAX(0.0f, startVisibleLayout.origin.y - interpolatedLayout.origin.y); - } else if (!startClipInsets.top && endClipInsets.top && endVisibleLayout.origin.y <= startVisibleLayout.origin.y) { - clipInsets.top = MAX(0.0f, endVisibleLayout.origin.y - interpolatedLayout.origin.y); - } else { - clipInsets.top = startClipInsets.top + ((endClipInsets.top - startClipInsets.top) * _nodePosition); - } - - // Bottom - if (!endClipInsets.bottom && startClipInsets.bottom && (startVisibleLayout.origin.y + startVisibleLayout.size.height) >= (endVisibleLayout.origin.y + endVisibleLayout.size.height)) { - clipInsets.bottom = MAX(0.0f, (interpolatedLayout.origin.y + interpolatedLayout.size.height) - (startVisibleLayout.origin.y + startVisibleLayout.size.height)); - } else if (!startClipInsets.bottom && endClipInsets.bottom && (endVisibleLayout.origin.y + endVisibleLayout.size.height) >= (startVisibleLayout.origin.y + startVisibleLayout.size.height)) { - clipInsets.bottom = MAX(0.0f, (interpolatedLayout.origin.y + interpolatedLayout.size.height) - (endVisibleLayout.origin.y + endVisibleLayout.size.height)); - } else { - clipInsets.bottom = startClipInsets.bottom + ((endClipInsets.bottom - startClipInsets.bottom) * _nodePosition); - } - - // Left - if (!endClipInsets.left && startClipInsets.left && startVisibleLayout.origin.x <= endVisibleLayout.origin.x) { - clipInsets.left = MAX(0.0f, startVisibleLayout.origin.x - interpolatedLayout.origin.x); - } else if (!startClipInsets.left && endClipInsets.left && endVisibleLayout.origin.x <= startVisibleLayout.origin.x) { - clipInsets.left = MAX(0.0f, endVisibleLayout.origin.x - interpolatedLayout.origin.x); - } else { - clipInsets.left = startClipInsets.left + ((endClipInsets.left - startClipInsets.left) * _nodePosition); - } - - // Right - if (!endClipInsets.right && startClipInsets.right && (startVisibleLayout.origin.x + startVisibleLayout.size.width) >= (endVisibleLayout.origin.x + endVisibleLayout.size.width)) { - clipInsets.right = MAX(0.0f, (interpolatedLayout.origin.x + interpolatedLayout.size.width) - (startVisibleLayout.origin.x + startVisibleLayout.size.width)); - } else if (!startClipInsets.right && endClipInsets.right && (endVisibleLayout.origin.x + endVisibleLayout.size.width) >= (startVisibleLayout.origin.x + startVisibleLayout.size.width)) { - clipInsets.right = MAX(0.0f, (interpolatedLayout.origin.x + interpolatedLayout.size.width) - (endVisibleLayout.origin.x + endVisibleLayout.size.width)); - } else { - clipInsets.right = startClipInsets.right + ((endClipInsets.right - startClipInsets.right) * _nodePosition); - } - - return clipInsets; -} - -- (void) applyStyle:(ABI46_0_0RNSharedElementStyle*)style view:(UIView*)view -{ - CALayer *layer = view.layer; - - layer.opacity = style.opacity; - layer.backgroundColor = style.backgroundColor.CGColor; - layer.borderWidth = style.borderWidth; - layer.borderColor = style.borderColor.CGColor; - layer.shadowOpacity = style.shadowOpacity; - layer.shadowRadius = style.shadowRadius; - layer.shadowOffset = style.shadowOffset; - layer.shadowColor = style.shadowColor.CGColor; - [style.cornerRadii updateShadowPathForLayer:layer bounds:view.bounds]; - [style.cornerRadii updateClipMaskForLayer:layer bounds:view.bounds]; -} - -- (void) fireMeasureEvent:(ABI46_0_0RNSharedElementTransitionItem*) item layout:(CGRect)layout visibleLayout:(CGRect)visibleLayout contentLayout:(CGRect)contentLayout -{ - if (!self.onMeasureNode) return; - ABI46_0_0RCTCornerRadii cornerRadii = [item.style.cornerRadii radiiForBounds:_outerStyleView.bounds]; - NSDictionary* eventData = @{ - @"node": item.name, - @"layout": @{ - @"x": @(layout.origin.x), - @"y": @(layout.origin.y), - @"width": @(layout.size.width), - @"height": @(layout.size.height), - @"visibleX": @(visibleLayout.origin.x), - @"visibleY": @(visibleLayout.origin.y), - @"visibleWidth": @(visibleLayout.size.width), - @"visibleHeight": @(visibleLayout.size.height), - @"contentX": @(contentLayout.origin.x), - @"contentY": @(contentLayout.origin.y), - @"contentWidth": @(contentLayout.size.width), - @"contentHeight": @(contentLayout.size.height), - }, - @"contentType": item.content ? item.content.typeName : @"none", - @"style": @{ - @"borderTopLeftRadius": @(cornerRadii.topLeft), - @"borderTopRightRadius": @(cornerRadii.topRight), - @"borderBottomLeftRadius": @(cornerRadii.bottomLeft), - @"borderBotomRightRadius": @(cornerRadii.bottomRight) - } - }; - self.onMeasureNode(eventData); -} - -- (void) updateStyle -{ - if (!_initialLayoutPassCompleted) return; - - // Local data - ABI46_0_0RNSharedElementTransitionItem* startItem = [_items objectAtIndex:ITEM_START]; - ABI46_0_0RNSharedElementTransitionItem* startAncestor = [_items objectAtIndex:ITEM_START_ANCESTOR]; - ABI46_0_0RNSharedElementTransitionItem* endItem = [_items objectAtIndex:ITEM_END]; - ABI46_0_0RNSharedElementTransitionItem* endAncestor = [_items objectAtIndex:ITEM_END_ANCESTOR]; - ABI46_0_0RNSharedElementStyle* startStyle = startItem.style; - ABI46_0_0RNSharedElementStyle* endStyle = endItem.style; - - // Determine starting scene that is currently visible to the user - if (_initialVisibleAncestorIndex < 0) { - ABI46_0_0RNSharedElementStyle* startAncenstorStyle = startAncestor.style; - ABI46_0_0RNSharedElementStyle* endAncestorStyle = endAncestor.style; - if (startAncenstorStyle && !endAncestorStyle) { - _initialVisibleAncestorIndex = 0; - } else if (!startAncenstorStyle && endAncestorStyle) { - _initialVisibleAncestorIndex = 1; - } else if (startAncenstorStyle && endAncestorStyle){ - CGFloat startAncestorVisibility = [self getAncestorVisibility:startAncenstorStyle]; - CGFloat endAncestorVisibility = [self getAncestorVisibility:endAncestorStyle]; - _initialVisibleAncestorIndex = endAncestorVisibility > startAncestorVisibility ? 1 : 0; - } - } - - // Get start layout - BOOL startCompensate = _initialVisibleAncestorIndex == 1; - CGRect startLayout = startStyle ? [self normalizeLayout:startStyle.layout compensateForTransforms:startCompensate ancestor:startAncestor otherAncestor:endAncestor] : CGRectZero; - CGRect startVisibleLayout = startStyle ? [self normalizeLayout:[startItem visibleLayoutForAncestor:startAncestor] compensateForTransforms:startCompensate ancestor:startAncestor otherAncestor:endAncestor] : CGRectZero; - CGRect startContentLayout = startStyle ? [self normalizeLayout:[startItem contentLayoutForContent:startItem.content] compensateForTransforms:startCompensate ancestor:startAncestor otherAncestor:endAncestor] : CGRectZero; - UIEdgeInsets startClipInsets = [self getClipInsets:startLayout visibleLayout:startVisibleLayout]; - - // Get end layout - BOOL endCompensate = _initialVisibleAncestorIndex == 0; - CGRect endLayout = endStyle ? [self normalizeLayout:endStyle.layout compensateForTransforms:endCompensate ancestor:endAncestor otherAncestor:startAncestor] : CGRectZero; - CGRect endVisibleLayout = endStyle ? [self normalizeLayout:[endItem visibleLayoutForAncestor:endAncestor] compensateForTransforms:endCompensate ancestor:endAncestor otherAncestor:startAncestor] : CGRectZero; - CGRect endContentLayout = endStyle ? [self normalizeLayout:[endItem contentLayoutForContent:(endItem.content ? endItem.content : startItem.content)] compensateForTransforms:endCompensate ancestor:endAncestor otherAncestor:startAncestor] : CGRectZero; - UIEdgeInsets endClipInsets = [self getClipInsets:endLayout visibleLayout:endVisibleLayout]; - - // Get interpolated style & layout - ABI46_0_0RNSharedElementStyle* interpolatedStyle; - CGRect interpolatedLayout; - CGRect interpolatedContentLayout; - UIEdgeInsets interpolatedClipInsets; - if (!startStyle && !endStyle) return; - if (startStyle && endStyle) { - interpolatedStyle = [ABI46_0_0RNSharedElementStyle getInterpolatedStyle:startStyle style2:endStyle position:_nodePosition]; - interpolatedLayout = [self getInterpolatedLayout:startLayout layout2:endLayout position:_nodePosition]; - interpolatedClipInsets = [self getInterpolatedClipInsets:interpolatedLayout startClipInsets:startClipInsets startVisibleLayout:startVisibleLayout endClipInsets:endClipInsets endVisibleLayout:endVisibleLayout]; - interpolatedContentLayout = [self getInterpolatedLayout:startContentLayout layout2:endContentLayout position:_nodePosition]; - } else if (startStyle) { - interpolatedStyle = startStyle; - interpolatedLayout = startLayout; - interpolatedClipInsets = startClipInsets; - interpolatedContentLayout = startContentLayout; - } else { - interpolatedStyle = endStyle; - interpolatedLayout = endLayout; - interpolatedClipInsets = endClipInsets; - interpolatedContentLayout = endContentLayout; - } - - // Update frame - CGRect parentBounds = self.superview.bounds; - [super ABI46_0_0ReactSetFrame:parentBounds]; - - // Update clipping mask (handles scrollview/parent clipping) - // This kind of clipping is performed at the top level. - CGFloat clipLeft = interpolatedClipInsets.left != 0.0f ? interpolatedClipInsets.left + interpolatedLayout.origin.x : 0.0f; - CGFloat clipTop = interpolatedClipInsets.top != 0.0f ? interpolatedClipInsets.top + interpolatedLayout.origin.y : 0.0f; - CGFloat clipBottom = interpolatedClipInsets.bottom != 0.0f ? parentBounds.size.height - (interpolatedLayout.origin.y + interpolatedLayout.size.height) + interpolatedClipInsets.bottom : 0.0f; - CGFloat clipRight = interpolatedClipInsets.right != 0.0f ? parentBounds.size.width - (interpolatedLayout.origin.x + interpolatedLayout.size.width) + interpolatedClipInsets.right : 0.0f; - CGRect clipFrame = CGRectMake( - clipLeft, - clipTop, - parentBounds.size.width - clipLeft - clipRight, - parentBounds.size.height - clipTop - clipBottom); - CALayer *maskLayer = [[CALayer alloc] init]; - maskLayer.backgroundColor = [UIColor whiteColor].CGColor; - maskLayer.frame = clipFrame; - self.layer.mask = maskLayer; - - // Update outer style view. This view has all styles such as border-color, - // background color, and shadow. Because of the shadow, the view itsself - // does not mask its bounds, otherwise the shadow isn't visible. - _outerStyleView.frame = interpolatedLayout; - [self applyStyle:interpolatedStyle view:_outerStyleView]; - - // Update inner clip view. This view holds the image/content views - // inside and clips their content. - CGRect innerClipFrame = interpolatedLayout; - innerClipFrame.origin.x = 0; - innerClipFrame.origin.y = 0; - _innerClipView.frame = innerClipFrame; - [interpolatedStyle.cornerRadii updateClipMaskForLayer:_innerClipView.layer bounds:_innerClipView.bounds]; - _innerClipView.layer.masksToBounds = _resize != ABI46_0_0RNSharedElementResizeNone; - - // Update content - UIView* contentView1 = (startItem.content && startItem.content.type == ABI46_0_0RNSharedElementContentTypeSnapshotView) ? startItem.content.data : _primaryImageView; - if (contentView1.superview != _innerClipView) [_innerClipView addSubview:contentView1]; - if (_animation == ABI46_0_0RNSharedElementAnimationMove) { - - // In case of move, we correctly calculate the content-frame - // and interpolate between the start- and end-state, assuming - // that the start- and end-content (image) has the same aspect-ratio - CGRect contentFrame = interpolatedContentLayout; - contentFrame.origin.x -= interpolatedLayout.origin.x; - contentFrame.origin.y -= interpolatedLayout.origin.y; - contentView1.frame = contentFrame; - } - else { - // Update content-view 2 - UIView* contentView2 = (endItem.content && endItem.content.type == ABI46_0_0RNSharedElementContentTypeSnapshotView) ? endItem.content.data : _secondaryImageView; - if (contentView2.superview != _innerClipView) [_innerClipView addSubview:contentView2]; - - // In all other cases, animate and interpolate both the start- and - // end views to look like each other - CGRect startContentLayout2 = startStyle ? [ABI46_0_0RNSharedElementContent layoutForRect:endStyle ? endContentLayout : startContentLayout content:startItem.content contentMode:startStyle.contentMode reverse:YES] : CGRectZero; - CGRect endContentLayout1 = endStyle ? [ABI46_0_0RNSharedElementContent layoutForRect:startStyle ? startContentLayout : endContentLayout content:endItem.content contentMode:endStyle.contentMode reverse:YES] : CGRectZero; - - // Calculate interpolated layout - CGRect startInterpolatedContentLayout = [self getInterpolatedLayout:startContentLayout layout2:startContentLayout2 position:_nodePosition]; - CGRect endInterpolatedContentLayout = [self getInterpolatedLayout:endContentLayout1 layout2:endContentLayout position:_nodePosition]; - - // Calculate new size - switch (_resize) { - case ABI46_0_0RNSharedElementResizeAuto: - // Nothing to do - break; - case ABI46_0_0RNSharedElementResizeStretch: - // TODO - break; - case ABI46_0_0RNSharedElementResizeClip: - case ABI46_0_0RNSharedElementResizeNone: - startInterpolatedContentLayout.size = startContentLayout.size; - endInterpolatedContentLayout.size = endContentLayout.size; - break; - } - - // Calculate new origin - switch (_align) { - case ABI46_0_0RNSharedElementAlignLeftTop: - startInterpolatedContentLayout.origin.x = 0; - startInterpolatedContentLayout.origin.y = 0; - endInterpolatedContentLayout.origin.x = 0; - endInterpolatedContentLayout.origin.y = 0; - break; - case ABI46_0_0RNSharedElementAlignLeftCenter: - startInterpolatedContentLayout.origin.x = 0; - startInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - startInterpolatedContentLayout.size.height) / 2; - endInterpolatedContentLayout.origin.x = 0; - endInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - endInterpolatedContentLayout.size.height) / 2; - break; - case ABI46_0_0RNSharedElementAlignLeftBottom: - startInterpolatedContentLayout.origin.x = 0; - startInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - startInterpolatedContentLayout.size.height; - endInterpolatedContentLayout.origin.x = 0; - endInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - endInterpolatedContentLayout.size.height; - break; - case ABI46_0_0RNSharedElementAlignRightTop: - startInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - startInterpolatedContentLayout.size.width; - startInterpolatedContentLayout.origin.y = 0; - endInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - endInterpolatedContentLayout.size.width; - endInterpolatedContentLayout.origin.y = 0; - break; - case ABI46_0_0RNSharedElementAlignRightCenter: - startInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - startInterpolatedContentLayout.size.width; - startInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - startInterpolatedContentLayout.size.height) / 2; - endInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - endInterpolatedContentLayout.size.width; - endInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - endInterpolatedContentLayout.size.height) / 2; - break; - case ABI46_0_0RNSharedElementAlignRightBottom: - startInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - startInterpolatedContentLayout.size.width; - startInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - startInterpolatedContentLayout.size.height; - endInterpolatedContentLayout.origin.x = interpolatedLayout.size.width - endInterpolatedContentLayout.size.width; - endInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - endInterpolatedContentLayout.size.height; - break; - case ABI46_0_0RNSharedElementAlignCenterTop: - startInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - startInterpolatedContentLayout.size.width) / 2; - startInterpolatedContentLayout.origin.y = 0; - endInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - endInterpolatedContentLayout.size.width) / 2; - endInterpolatedContentLayout.origin.y = 0; - break; - case ABI46_0_0RNSharedElementAlignAuto: - case ABI46_0_0RNSharedElementAlignCenterCenter: - startInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - startInterpolatedContentLayout.size.width) / 2; - startInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - startInterpolatedContentLayout.size.height) / 2; - endInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - endInterpolatedContentLayout.size.width) / 2; - endInterpolatedContentLayout.origin.y = (interpolatedLayout.size.height - endInterpolatedContentLayout.size.height) / 2; - break; - case ABI46_0_0RNSharedElementAlignCenterBottom: - startInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - startInterpolatedContentLayout.size.width) / 2; - startInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - startInterpolatedContentLayout.size.height; - endInterpolatedContentLayout.origin.x = (interpolatedLayout.size.width - endInterpolatedContentLayout.size.width) / 2; - endInterpolatedContentLayout.origin.y = interpolatedLayout.size.height - endInterpolatedContentLayout.size.height; - break; - } - - // Update start node - contentView1.frame = startInterpolatedContentLayout; - - // Update end node - contentView2.frame = endInterpolatedContentLayout; - - // Fade - if (_animation == ABI46_0_0RNSharedElementAnimationFadeIn) { - // Fade-in - contentView1.layer.opacity = 0.0f; - contentView2.layer.opacity = MIN(MAX(_nodePosition, 0.0f), 1.0f); - } - else if (_animation == ABI46_0_0RNSharedElementAnimationFadeOut) { - // Fade-out - contentView1.layer.opacity = 1.0f - MIN(MAX(_nodePosition, 0.0f), 1.0f); - contentView2.layer.opacity = 0.0f; - } - else { - // Cross-fade - contentView1.layer.opacity = 1.0f - MIN(MAX(_nodePosition, 0.0f), 1.0f); - contentView2.layer.opacity = MIN(MAX(_nodePosition, 0.0f), 1.0f); - } - } - - // Fire events - if ((startAncestor.style != nil) && !startAncestor.hasCalledOnMeasure) { - startAncestor.hasCalledOnMeasure = YES; - startItem.hasCalledOnMeasure = NO; - CGRect ancestorLayout = [self.superview convertRect:startAncestor.style.layout fromView:nil]; - [self fireMeasureEvent:startAncestor layout:ancestorLayout visibleLayout:ancestorLayout contentLayout:ancestorLayout]; - } - if ((startItem.style != nil) && !startItem.hasCalledOnMeasure) { - startItem.hasCalledOnMeasure = YES; - [self fireMeasureEvent:startItem layout:startLayout visibleLayout:startVisibleLayout contentLayout:startContentLayout]; - } - if ((endAncestor.style != nil) && !endAncestor.hasCalledOnMeasure) { - endAncestor.hasCalledOnMeasure = YES; - endItem.hasCalledOnMeasure = NO; - CGRect ancestorLayout = [self.superview convertRect:endAncestor.style.layout fromView:nil]; - [self fireMeasureEvent:endAncestor layout:ancestorLayout visibleLayout:ancestorLayout contentLayout:ancestorLayout]; - } - if ((endItem.style != nil) && !endItem.hasCalledOnMeasure) { - endItem.hasCalledOnMeasure = YES; - [self fireMeasureEvent:endItem layout:endLayout visibleLayout:endVisibleLayout contentLayout:endContentLayout]; - } -} - -- (void) ABI46_0_0ReactSetFrame:(CGRect)frame -{ - // Only after the frame bounds have been set by the ABI46_0_0RN layout-system - // we schedule a layout-fetch to run after these updates to ensure - // that Yoga/UIManager has finished the initial layout pass. - if (_ABI46_0_0ReactFrameSet == NO) { - //NSLog(@"ABI46_0_0ReactSetFrame: %@", NSStringFromCGRect(frame)); - _ABI46_0_0ReactFrameSet = YES; - dispatch_async(dispatch_get_main_queue(), ^{ - for (ABI46_0_0RNSharedElementTransitionItem* item in self->_items) { - if (item.needsLayout) { - item.needsLayout = NO; - [item.node requestStyle:self]; - } - if (item.needsContent) { - item.needsContent = NO; - [item.node requestContent:self]; - } - } - self->_initialLayoutPassCompleted = YES; - [self updateStyle]; - [self updateNodeVisibility]; - }); - } - - // When ABI46_0_0React attempts to change the frame on this view, - // override that and apply our own measured frame and styles - [self updateStyle]; - [self updateNodeVisibility]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.h deleted file mode 100644 index 62f7eda7b02483..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.h +++ /dev/null @@ -1,31 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransition.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementTransitionItem_h -#define ABI46_0_0RNSharedElementTransitionItem_h - -#import "ABI46_0_0RNSharedElementNodeManager.h" - -@interface ABI46_0_0RNSharedElementTransitionItem : NSObject - -@property (nonatomic, readonly) ABI46_0_0RNSharedElementNodeManager* nodeManager; -@property (nonatomic, readonly) BOOL isAncestor; -@property (nonatomic, readonly) NSString* name; -@property (nonatomic, strong) ABI46_0_0RNSharedElementNode* node; -@property (nonatomic, assign) BOOL hidden; -@property (nonatomic, assign) BOOL needsLayout; -@property (nonatomic, assign) BOOL needsContent; -@property (nonatomic, assign) BOOL hasCalledOnMeasure; -@property (nonatomic, strong) ABI46_0_0RNSharedElementStyle* style; -@property (nonatomic, strong) ABI46_0_0RNSharedElementContent* content; - -- (instancetype)initWithNodeManager:(ABI46_0_0RNSharedElementNodeManager*)nodeManager name:(NSString*)name isAncestor:(BOOL)isAncestor; - -- (CGRect) contentLayoutForContent:(ABI46_0_0RNSharedElementContent*)content; -- (CGRect) visibleLayoutForAncestor:(ABI46_0_0RNSharedElementTransitionItem*) ancestor; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.m deleted file mode 100644 index c58bf9710ade56..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionItem.m +++ /dev/null @@ -1,111 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransitionItem.m -// ABI46_0_0React-native-shared-element -// - -#import -#import -#import "ABI46_0_0RNSharedElementTransitionItem.h" - -#ifdef DEBUG -#define DebugLog(...) NSLog(__VA_ARGS__) -#else -#define DebugLog(...) (void)0 -#endif - -@implementation ABI46_0_0RNSharedElementTransitionItem { - - CGRect _visibleLayoutCache; -} -- (instancetype)initWithNodeManager:(ABI46_0_0RNSharedElementNodeManager*)nodeManager name:(NSString*)name isAncestor:(BOOL)isAncestor -{ - _visibleLayoutCache = CGRectNull; - _nodeManager = nodeManager; - _name = name; - _isAncestor = isAncestor; - _node = nil; - _needsLayout = NO; - _needsContent = NO; - _content = nil; - _style = nil; - _hidden = NO; - return self; -} - -- (void) setNode:(ABI46_0_0RNSharedElementNode *)node -{ - if (_node == node) { - if (node != nil) [_nodeManager release:node]; - return; - } - if (_node != nil) { - if (_hidden) _node.hideRefCount--; - [_nodeManager release:_node]; - } - _node = node; - _needsLayout = node != nil; - _needsContent = !_isAncestor && (node != nil); - _content = nil; - _style = nil; - _hidden = NO; -} - -- (void) setHidden:(BOOL)hidden -{ - if (_hidden == hidden) return; - _hidden = hidden; - if (hidden) { - _node.hideRefCount++; - } else { - _node.hideRefCount--; - } -} - -- (CGRect) contentLayoutForContent:(ABI46_0_0RNSharedElementContent*)content -{ - if (!content || !_style) return CGRectZero; - return [ABI46_0_0RNSharedElementContent layoutForRect:_style.layout content:content contentMode:_style.contentMode reverse:NO]; -} - -- (CGRect) visibleLayoutForAncestor:(ABI46_0_0RNSharedElementTransitionItem*) ancestor -{ - if (!CGRectIsNull(_visibleLayoutCache) || !_style) return _visibleLayoutCache; - if (!ancestor.style) return _style.layout; - - // Get visible area (some parts may be clipped in a scrollview or something) - CGRect visibleLayout = _style.layout; - UIView* superview = _style.view.superview; - while (superview != nil) { - if (superview.layer.masksToBounds || (superview.layer.mask != nil)) { - CGRect superLayout = [superview convertRect:superview.bounds toView:nil]; - CGRect intersectedLayout = CGRectIntersection(visibleLayout, superLayout); - if (isinf(intersectedLayout.origin.x) || isinf(intersectedLayout.origin.y) || CGRectIsEmpty(intersectedLayout)) { - if ((visibleLayout.origin.y + visibleLayout.size.height) < superLayout.origin.y) { - visibleLayout.origin.y = superLayout.origin.y; - visibleLayout.size.height = 0; - } - if (visibleLayout.origin.y > (superLayout.origin.y + superLayout.size.height)) { - visibleLayout.origin.y = superLayout.origin.y + superLayout.size.height; - visibleLayout.size.height = 0; - } - if ((visibleLayout.origin.x + visibleLayout.size.width) < superLayout.origin.x) { - visibleLayout.origin.x = superLayout.origin.x; - visibleLayout.size.width = 0; - } - if (visibleLayout.origin.x > (superLayout.origin.x + superLayout.size.width)) { - visibleLayout.origin.x = superLayout.origin.x + superLayout.size.width; - visibleLayout.size.width = 0; - } - break; - } - visibleLayout = intersectedLayout; - } - if (superview == ancestor.style.view) break; - superview = superview.superview; - } - _visibleLayoutCache = visibleLayout; - return visibleLayout; -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.h deleted file mode 100644 index 7823d51fdf0fba..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.h +++ /dev/null @@ -1,16 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransitionManager.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementTransitionManager_h -#define ABI46_0_0RNSharedElementTransitionManager_h - -#import -#import - -@interface ABI46_0_0RNSharedElementTransitionManager : ABI46_0_0RCTViewManager - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.m deleted file mode 100644 index 33e1026122488f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTransitionManager.m +++ /dev/null @@ -1,83 +0,0 @@ -// -// ABI46_0_0RNSharedElementTransitionManager.m -// ABI46_0_0React-native-shared-element -// - -#import -#import -#import "ABI46_0_0RNSharedElementTransitionManager.h" -#import "ABI46_0_0RNSharedElementTransition.h" -#import "ABI46_0_0RNSharedElementNodeManager.h" -#import "ABI46_0_0RNSharedElementTypes.h" - -@implementation ABI46_0_0RNSharedElementTransitionManager -{ - ABI46_0_0RNSharedElementNodeManager* _nodeManager; -} - -ABI46_0_0RCT_EXPORT_MODULE(ABI46_0_0RNSharedElementTransition); - -- (instancetype) init -{ - if ((self = [super init])) { - _nodeManager = [[ABI46_0_0RNSharedElementNodeManager alloc]init]; - } - return self; -} - -- (UIView *)view -{ - return [[ABI46_0_0RNSharedElementTransition alloc] initWithNodeManager:_nodeManager]; -} - -- (dispatch_queue_t)methodQueue -{ - return self.bridge.uiManager.methodQueue; -} - -- (ABI46_0_0RNSharedElementNode*) nodeFromJson:(NSDictionary*)json -{ - if (json == nil) return nil; - NSNumber* nodeHandle = [json valueForKey:@"nodeHandle"]; - NSNumber* isParent = [json valueForKey:@"isParent"]; - if ([nodeHandle isKindOfClass:[NSNumber class]]) { - UIView *sourceView = [self.bridge.uiManager viewForABI46_0_0ReactTag:nodeHandle]; - return [_nodeManager acquire:nodeHandle view:sourceView isParent:[isParent boolValue]]; - } - return nil; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(nodePosition, CGFloat); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(animation, NSInteger); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(resize, NSInteger); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSInteger); -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(startNode, NSObject, ABI46_0_0RNSharedElementTransition) -{ - view.startNode = [self nodeFromJson:[json valueForKey:@"node"]]; - view.startAncestor = [self nodeFromJson:[json valueForKey:@"ancestor"]]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(endNode, NSObject, ABI46_0_0RNSharedElementTransition) -{ - view.endNode = [self nodeFromJson:[json valueForKey:@"node"]]; - view.endAncestor = [self nodeFromJson:[json valueForKey:@"ancestor"]]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onMeasureNode, ABI46_0_0RCTDirectEventBlock); - -ABI46_0_0RCT_REMAP_METHOD(configure, - config:(NSDictionary *)config - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - NSArray* imageResolvers = [config valueForKey:@"imageResolvers"]; - if (imageResolvers != nil) { - [ABI46_0_0RNSharedElementNode setImageResolvers:imageResolvers]; - } - resolve(@(YES)); -} - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTypes.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTypes.h deleted file mode 100644 index 53a25dcde1c383..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/SharedElement/ABI46_0_0RNSharedElementTypes.h +++ /dev/null @@ -1,44 +0,0 @@ -// -// ABI46_0_0RNSharedElementTypes.h -// ABI46_0_0React-native-shared-element -// - -#ifndef ABI46_0_0RNSharedElementTypes_h -#define ABI46_0_0RNSharedElementTypes_h - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSharedElementContentType) { - ABI46_0_0RNSharedElementContentTypeNone = 0, - ABI46_0_0RNSharedElementContentTypeSnapshotView = 1, - ABI46_0_0RNSharedElementContentTypeSnapshotImage = 2, - ABI46_0_0RNSharedElementContentTypeRawImage = 3 -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSharedElementAnimation) { - ABI46_0_0RNSharedElementAnimationMove = 0, - ABI46_0_0RNSharedElementAnimationFade = 1, - ABI46_0_0RNSharedElementAnimationFadeIn = 2, - ABI46_0_0RNSharedElementAnimationFadeOut = 3 -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSharedElementResize) { - ABI46_0_0RNSharedElementResizeAuto = 0, - ABI46_0_0RNSharedElementResizeStretch = 1, - ABI46_0_0RNSharedElementResizeClip = 2, - ABI46_0_0RNSharedElementResizeNone = 3 -}; - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSharedElementAlign) { - ABI46_0_0RNSharedElementAlignAuto = 0, - ABI46_0_0RNSharedElementAlignLeftTop = 1, - ABI46_0_0RNSharedElementAlignLeftCenter = 2, - ABI46_0_0RNSharedElementAlignLeftBottom = 3, - ABI46_0_0RNSharedElementAlignRightTop = 4, - ABI46_0_0RNSharedElementAlignRightCenter = 5, - ABI46_0_0RNSharedElementAlignRightBottom = 6, - ABI46_0_0RNSharedElementAlignCenterTop = 7, - ABI46_0_0RNSharedElementAlignCenterCenter = 8, - ABI46_0_0RNSharedElementAlignCenterBottom = 9 -}; - - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.h deleted file mode 100644 index 7d1297aad285ff..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -@interface ABI46_0_0RNCSlider : UISlider - -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onRNCSliderValueChange; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onRNCSliderSlidingStart; -@property (nonatomic, copy) ABI46_0_0RCTBubblingEventBlock onRNCSliderSlidingComplete; - -@property (nonatomic, assign) float step; -@property (nonatomic, assign) float lastValue; -@property (nonatomic, assign) bool isSliding; - -@property (nonatomic, strong) UIImage *trackImage; -@property (nonatomic, strong) UIImage *minimumTrackImage; -@property (nonatomic, strong) UIImage *maximumTrackImage; -@property (nonatomic, strong) UIImage *thumbImage; -@property (nonatomic, assign) bool tapToSeek; -@property (nonatomic, strong) NSString *accessibilityUnits; -@property (nonatomic, strong) NSArray *accessibilityIncrements; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.m deleted file mode 100644 index 455a6e4b75e1d6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSlider.m +++ /dev/null @@ -1,133 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCSlider.h" - -@implementation ABI46_0_0RNCSlider -{ - float _unclippedValue; - bool _minimumTrackImageSet; - bool _maximumTrackImageSet; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - return [super initWithFrame:frame]; -} - -- (void)setValue:(float)value -{ - _unclippedValue = value; - super.value = value; - [self setupAccessibility:value]; -} - -- (void)setValue:(float)value animated:(BOOL)animated -{ - _unclippedValue = value; - [super setValue:value animated:animated]; - [self setupAccessibility:value]; -} - -- (void)setupAccessibility:(float)value -{ - if (self.accessibilityUnits && self.accessibilityIncrements && [self.accessibilityIncrements count] - 1 == (int)self.maximumValue) { - int index = (int)value; - NSString *sliderValue = (NSString *)[self.accessibilityIncrements objectAtIndex:index]; - NSUInteger stringLength = [self.accessibilityUnits length]; - - NSString *spokenUnits = [NSString stringWithString:self.accessibilityUnits]; - if (sliderValue && [sliderValue intValue] == 1) { - spokenUnits = [spokenUnits substringToIndex:stringLength-1]; - } - - self.accessibilityValue = [NSString stringWithFormat:@"%@ %@", sliderValue, spokenUnits]; - } -} - -- (void)setMinimumValue:(float)minimumValue -{ - super.minimumValue = minimumValue; - super.value = _unclippedValue; -} - -- (void)setMaximumValue:(float)maximumValue -{ - super.maximumValue = maximumValue; - super.value = _unclippedValue; -} - -- (void)setTrackImage:(UIImage *)trackImage -{ - if (trackImage != _trackImage) { - _trackImage = trackImage; - CGFloat width = trackImage.size.width / 2; - if (!_minimumTrackImageSet) { - UIImage *minimumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; - } - if (!_maximumTrackImageSet) { - UIImage *maximumTrackImage = [trackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, width, 0, width - } resizingMode:UIImageResizingModeStretch]; - [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; - } - } -} - -- (void)setMinimumTrackImage:(UIImage *)minimumTrackImage -{ - _trackImage = nil; - _minimumTrackImageSet = true; - minimumTrackImage = [minimumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, minimumTrackImage.size.width, 0, 0 - } resizingMode:UIImageResizingModeStretch]; - [self setMinimumTrackImage:minimumTrackImage forState:UIControlStateNormal]; -} - -- (UIImage *)minimumTrackImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -- (void)setMaximumTrackImage:(UIImage *)maximumTrackImage -{ - _trackImage = nil; - _maximumTrackImageSet = true; - maximumTrackImage = [maximumTrackImage resizableImageWithCapInsets:(UIEdgeInsets){ - 0, 0, 0, maximumTrackImage.size.width - } resizingMode:UIImageResizingModeStretch]; - [self setMaximumTrackImage:maximumTrackImage forState:UIControlStateNormal]; -} - -- (UIImage *)maximumTrackImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -- (void)setThumbImage:(UIImage *)thumbImage -{ - [self setThumbImage:thumbImage forState:UIControlStateNormal]; -} - -- (UIImage *)thumbImage -{ - return [self thumbImageForState:UIControlStateNormal]; -} - -- (void)setInverted:(BOOL)inverted -{ - if (inverted) { - self.transform = CGAffineTransformMakeScale(-1, 1); - } else { - self.transform = CGAffineTransformMakeScale(1, 1); - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.h deleted file mode 100644 index 7e4922550e31f6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNCSliderManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.m deleted file mode 100644 index 20de923562643c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Slider/ABI46_0_0RNCSliderManager.m +++ /dev/null @@ -1,202 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNCSliderManager.h" - -#import -#import -#import "ABI46_0_0RNCSlider.h" -#import - -@implementation ABI46_0_0RNCSliderManager -{ - BOOL _isSliding; -} - -ABI46_0_0RCT_EXPORT_MODULE() - -- (UIView *)view -{ - ABI46_0_0RNCSlider *slider = [ABI46_0_0RNCSlider new]; - [slider addTarget:self action:@selector(sliderValueChanged:) - forControlEvents:UIControlEventValueChanged]; - [slider addTarget:self action:@selector(sliderTouchStart:) - forControlEvents:UIControlEventTouchDown]; - [slider addTarget:self action:@selector(sliderTouchEnd:) - forControlEvents:(UIControlEventTouchUpInside | - UIControlEventTouchUpOutside | - UIControlEventTouchCancel)]; - - UITapGestureRecognizer *tapGesturer; - tapGesturer = [[UITapGestureRecognizer alloc] initWithTarget: self action:@selector(tapHandler:)]; - [tapGesturer setNumberOfTapsRequired: 1]; - [slider addGestureRecognizer:tapGesturer]; - - return slider; -} - -- (void)tapHandler:(UITapGestureRecognizer *)gesture { - if ([gesture.view class] != [ABI46_0_0RNCSlider class]) { - return; - } - ABI46_0_0RNCSlider *slider = (ABI46_0_0RNCSlider *)gesture.view; - slider.isSliding = _isSliding; - - // Ignore this tap if in the middle of a slide. - if (_isSliding) { - return; - } - - if (!slider.tapToSeek) { - return; - } - - CGPoint touchPoint = [gesture locationInView:slider]; - float rangeWidth = slider.maximumValue - slider.minimumValue; - float sliderPercent = touchPoint.x / slider.bounds.size.width; - slider.lastValue = slider.value; - float value = slider.minimumValue + (rangeWidth * sliderPercent); - - [slider setValue:discreteValue(slider, value) animated: YES]; - - if (slider.onRNCSliderSlidingStart) { - slider.onRNCSliderSlidingStart(@{ - @"value": @(slider.lastValue), - }); - } - - // Trigger onValueChange to address https://github.com/ABI46_0_0React-native-community/ABI46_0_0React-native-slider/issues/212 - if (slider.onRNCSliderValueChange) { - slider.onRNCSliderValueChange(@{ - @"value": @(slider.value), - }); - } - - if (slider.onRNCSliderSlidingComplete) { - slider.onRNCSliderSlidingComplete(@{ - @"value": @(slider.value), - }); - } -} - -static float discreteValue(ABI46_0_0RNCSlider *sender, float value) { - // Check if thumb should reach the maximum value and put it on the end of track if yes. - // To avoid affecting the thumb when on maximum, the `step >= (value - maximum)` is not checked. - if (sender.step > 0 && value >= sender.maximumValue) { - return sender.maximumValue; - } - - // If step is set and less than or equal to difference between max and min values, - // pick the closest discrete multiple of step to return. - if (sender.step > 0 && sender.step <= (sender.maximumValue - sender.minimumValue)) { - - // Round up when increase, round down when decrease. - double (^_round)(double) = ^(double x) { - if (!UIAccessibilityIsVoiceOverRunning()) { - return round(x); - } else if (sender.lastValue > value) { - return floor(x); - } else { - return ceil(x); - } - }; - - return - MAX(sender.minimumValue, - MIN(sender.maximumValue, - sender.minimumValue + _round((value - sender.minimumValue) / sender.step) * sender.step - ) - ); - } - - // Otherwise, leave value unchanged. - return value; -} - -static void ABI46_0_0RNCSendSliderEvent(ABI46_0_0RNCSlider *sender, BOOL continuous, BOOL isSlidingStart) -{ - float value = discreteValue(sender, sender.value); - - if(!sender.isSliding) { - [sender setValue:value animated:NO]; - } - - if (continuous) { - if (sender.onRNCSliderValueChange && sender.lastValue != value) { - sender.onRNCSliderValueChange(@{ - @"value": @(value), - }); - } - } else { - if (sender.onRNCSliderSlidingComplete && !isSlidingStart) { - sender.onRNCSliderSlidingComplete(@{ - @"value": @(value), - }); - } - if (sender.onRNCSliderSlidingStart && isSlidingStart) { - sender.onRNCSliderSlidingStart(@{ - @"value": @(value), - }); - } - } - - sender.lastValue = value; -} - -- (void)sliderValueChanged:(ABI46_0_0RNCSlider *)sender -{ - ABI46_0_0RNCSendSliderEvent(sender, YES, NO); -} - -- (void)sliderTouchStart:(ABI46_0_0RNCSlider *)sender -{ - ABI46_0_0RNCSendSliderEvent(sender, NO, YES); - _isSliding = YES; - sender.isSliding = YES; -} - -- (void)sliderTouchEnd:(ABI46_0_0RNCSlider *)sender -{ - ABI46_0_0RNCSendSliderEvent(sender, NO, NO); - _isSliding = NO; - sender.isSliding = NO; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(value, float, ABI46_0_0RNCSlider) -{ - if (!view.isSliding) { - view.value = [ABI46_0_0RCTConvert float:json]; - } -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(step, float); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(trackImage, UIImage); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumTrackImage, UIImage); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumTrackImage, UIImage); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumValue, float); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumValue, float); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minimumTrackTintColor, UIColor); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maximumTrackTintColor, UIColor); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onRNCSliderValueChange, ABI46_0_0RCTBubblingEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onRNCSliderSlidingStart, ABI46_0_0RCTBubblingEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onRNCSliderSlidingComplete, ABI46_0_0RCTBubblingEventBlock); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(thumbTintColor, UIColor); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(thumbImage, UIImage); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(inverted, BOOL); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(tapToSeek, BOOL); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(accessibilityUnits, NSString); -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(accessibilityIncrements, NSArray); - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, ABI46_0_0RNCSlider) -{ - if (json) { - view.enabled = !([ABI46_0_0RCTConvert BOOL:json]); - } else { - view.enabled = defaultView.enabled; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGContainer.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGContainer.h deleted file mode 100644 index aa7af694a5b888..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGContainer.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@protocol ABI46_0_0RNSVGContainer - -// This is used as a hook for child to mark it's parent as dirty. -// This bubbles up to the root which gets marked as dirty. -- (void)invalidate; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.h deleted file mode 100644 index 2bb5fa57b4fb4f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.h +++ /dev/null @@ -1,141 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import "ABI46_0_0RNSVGCGFCRule.h" -#import "ABI46_0_0RNSVGSvgView.h" -@class ABI46_0_0RNSVGGroup; - -/** - * ABI46_0_0RNSVG nodes are implemented as base NSViews/UIViews. They should be implementation for all basic - *interfaces for all non-definition nodes. - */ - -@interface ABI46_0_0RNSVGNode : ABI46_0_0RNSVGView - -/* - N[1/Sqrt[2], 36] - The inverse of the square root of 2. - Provide enough digits for the 128-bit IEEE quad (36 significant digits). - */ -extern CGFloat const ABI46_0_0RNSVG_M_SQRT1_2l; -extern CGFloat const ABI46_0_0RNSVG_DEFAULT_FONT_SIZE; - -@property (nonatomic, strong) NSString *name; -@property (nonatomic, strong) NSString *display; -@property (nonatomic, assign) CGFloat opacity; -@property (nonatomic, assign) ABI46_0_0RNSVGCGFCRule clipRule; -@property (nonatomic, strong) NSString *clipPath; -@property (nonatomic, strong) NSString *mask; -@property (nonatomic, strong) NSString *markerStart; -@property (nonatomic, strong) NSString *markerMid; -@property (nonatomic, strong) NSString *markerEnd; - -/** - * Used to control how touch events are processed. - */ -@property (nonatomic, assign) ABI46_0_0RCTPointerEvents pointerEvents; -@property (nonatomic, assign) BOOL responsible; - -@property (nonatomic, assign) CGAffineTransform ctm; -@property (nonatomic, assign) CGAffineTransform screenCTM; -@property (nonatomic, assign) CGAffineTransform matrix; -@property (nonatomic, assign) CGAffineTransform transforms; -@property (nonatomic, assign) CGAffineTransform invmatrix; -@property (nonatomic, assign) CGAffineTransform invTransform; -@property (nonatomic, assign) BOOL active; -@property (nonatomic, assign) BOOL dirty; -@property (nonatomic, assign) BOOL merging; -@property (nonatomic, assign) BOOL skip; -@property (nonatomic, assign) CGPathRef path; -@property (nonatomic, assign) CGPathRef strokePath; -@property (nonatomic, assign) CGPathRef markerPath; -@property (nonatomic, assign) CGRect clientRect; -@property (nonatomic, assign) CGRect pathBounds; -@property (nonatomic, assign) CGRect fillBounds; -@property (nonatomic, assign) CGRect strokeBounds; -@property (nonatomic, assign) CGRect markerBounds; -@property (nonatomic, copy) ABI46_0_0RCTDirectEventBlock onLayout; - - -/** - * ABI46_0_0RNSVGSvgView which ownes current ABI46_0_0RNSVGNode - */ -@property (nonatomic, readonly, weak) ABI46_0_0RNSVGSvgView *svgView; -@property (nonatomic, readonly, weak) ABI46_0_0RNSVGGroup *textRoot; - -- (void)invalidate; - -- (ABI46_0_0RNSVGGroup *)getParentTextRoot; - -- (void)renderTo:(CGContextRef)context rect:(CGRect)rect; - -/** - * @abstract - * renderTo will take opacity into account and draw renderLayerTo off-screen if there is opacity - * specified, then composite that onto the context. renderLayerTo always draws at opacity=1. - */ -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect; - -/** - * get clipPath from cache - */ -- (CGPathRef)getClipPath; - -/** - * get clipPath through context - */ -- (CGPathRef)getClipPath:(CGContextRef)context; - -/** - * clip node by clipPath - */ -- (void)clip:(CGContextRef)context; - -/** - * getPath will return the path inside node as a ClipPath. - */ -- (CGPathRef)getPath:(CGContextRef) context; - -- (CGFloat)relativeOnWidthString:(NSString *)length; - -- (CGFloat)relativeOnHeightString:(NSString *)length; - -- (CGFloat)relativeOnOtherString:(NSString *)length; - -- (CGFloat)relativeOn:(ABI46_0_0RNSVGLength *)length relative:(CGFloat)relative; - -- (CGFloat)relativeOnWidth:(ABI46_0_0RNSVGLength *)length; - -- (CGFloat)relativeOnHeight:(ABI46_0_0RNSVGLength *)length; - -- (CGFloat)relativeOnOther:(ABI46_0_0RNSVGLength *)length; - -- (CGFloat)getFontSizeFromContext; - -- (CGFloat)getContextWidth; - -- (CGFloat)getContextHeight; - -/** - * save element`s reference into svg element. - */ -- (void)parseReference; - -- (void)beginTransparencyLayer:(CGContextRef)context; - -- (void)endTransparencyLayer:(CGContextRef)context; - -- (void)traverseSubviews:(BOOL (^)(__kindof ABI46_0_0RNSVGView *node))block; - -- (void)clearChildCache; - -- (void)clearPath; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.m deleted file mode 100644 index 667912bc7a60b1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGNode.m +++ /dev/null @@ -1,582 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGContainer.h" -#import "ABI46_0_0RNSVGClipPath.h" -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGGlyphContext.h" - -@interface ABI46_0_0RNSVGNode() -@property (nonatomic, readwrite, weak) ABI46_0_0RNSVGSvgView *svgView; -@property (nonatomic, readwrite, weak) ABI46_0_0RNSVGGroup *textRoot; -@end - -@implementation ABI46_0_0RNSVGNode -{ - ABI46_0_0RNSVGGlyphContext *glyphContext; - BOOL _transparent; - ABI46_0_0RNSVGClipPath *_clipNode; - CGPathRef _cachedClipPath; - CGFloat canvasWidth; - CGFloat canvasHeight; - CGFloat canvasDiagonal; -} - -CGFloat const ABI46_0_0RNSVG_M_SQRT1_2l = (CGFloat)0.707106781186547524400844362104849039; -CGFloat const ABI46_0_0RNSVG_DEFAULT_FONT_SIZE = 12; - -- (instancetype)init -{ - if (self = [super init]) { - self.opacity = 1; - self.opaque = false; - self.matrix = CGAffineTransformIdentity; - self.transforms = CGAffineTransformIdentity; - self.invTransform = CGAffineTransformIdentity; - _merging = false; - _dirty = false; - } - return self; -} - -- (void)insertABI46_0_0ReactSubview:(ABI46_0_0RNSVGView *)subview atIndex:(NSInteger)atIndex -{ - [super insertABI46_0_0ReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeABI46_0_0ReactSubview:(ABI46_0_0RNSVGView *)subview -{ - [super removeABI46_0_0ReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateABI46_0_0ReactSubviews -{ - // Do nothing, as subviews are inserted by insertABI46_0_0ReactSubview: -} - -- (void)invalidate -{ - if (_dirty || _merging) { - return; - } - _dirty = true; - id container = (id)self.superview; - [container invalidate]; - [self clearPath]; - canvasWidth = -1; - canvasHeight = -1; - canvasDiagonal = -1; -} - -- (void)clearPath -{ - CGPathRelease(_path); - self.path = nil; -} - -- (void)clearChildCache -{ - [self clearPath]; - for (__kindof ABI46_0_0RNSVGNode *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - [node clearChildCache]; - } - } -} - -- (void)clearParentCache -{ - ABI46_0_0RNSVGNode* node = self; - while (node != nil) { - ABI46_0_0RNSVGPlatformView* parent = [node superview]; - - if (![parent isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - return; - } - node = (ABI46_0_0RNSVGNode*)parent; - if (!node.path) { - return; - } - [node clearPath]; - } -} - -- (ABI46_0_0RNSVGGroup *)textRoot -{ - if (_textRoot) { - return _textRoot; - } - - ABI46_0_0RNSVGNode* node = self; - while (node != nil) { - if ([node isKindOfClass:[ABI46_0_0RNSVGGroup class]] && [((ABI46_0_0RNSVGGroup*) node) getGlyphContext] != nil) { - _textRoot = (ABI46_0_0RNSVGGroup*)node; - break; - } - - ABI46_0_0RNSVGPlatformView* parent = [node superview]; - - if (![node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - node = nil; - } else { - node = (ABI46_0_0RNSVGNode*)parent; - } - } - - return _textRoot; -} - -- (ABI46_0_0RNSVGGroup *)getParentTextRoot -{ - ABI46_0_0RNSVGNode* parent = (ABI46_0_0RNSVGGroup*)[self superview]; - if (![parent isKindOfClass:[ABI46_0_0RNSVGGroup class]]) { - return nil; - } else { - return parent.textRoot; - } -} - -- (CGFloat)getFontSizeFromContext -{ - ABI46_0_0RNSVGGroup* root = self.textRoot; - if (root == nil) { - return ABI46_0_0RNSVG_DEFAULT_FONT_SIZE; - } - - if (glyphContext == nil) { - glyphContext = [root getGlyphContext]; - } - - return [glyphContext getFontSize]; -} - -- (void)ABI46_0_0ReactSetInheritedBackgroundColor:(ABI46_0_0RNSVGColor *)inheritedBackgroundColor -{ - self.backgroundColor = inheritedBackgroundColor; -} - -- (void)setPointerEvents:(ABI46_0_0RCTPointerEvents)pointerEvents -{ - _pointerEvents = pointerEvents; - self.userInteractionEnabled = (pointerEvents != ABI46_0_0RCTPointerEventsNone); - if (pointerEvents == ABI46_0_0RCTPointerEventsBoxNone) { -#if TARGET_OS_OSX - self.accessibilityModal = NO; -#else - self.accessibilityViewIsModal = NO; -#endif - } -} - -- (void)setName:(NSString *)name -{ - if ([name isEqualToString:_name]) { - return; - } - - [self invalidate]; - _name = name; -} - -- (void)setDisplay:(NSString *)display -{ - if ([display isEqualToString:_display]) { - return; - } - - [self invalidate]; - _display = display; -} - -- (void)setOpacity:(CGFloat)opacity -{ - if (opacity == _opacity) { - return; - } - - if (opacity <= 0) { - opacity = 0; - } else if (opacity > 1) { - opacity = 1; - } - - [self invalidate]; - _transparent = opacity < 1; - _opacity = opacity; -} - -- (void)setMatrix:(CGAffineTransform)matrix -{ - if (CGAffineTransformEqualToTransform(matrix, _matrix)) { - return; - } - _matrix = matrix; - _invmatrix = CGAffineTransformInvert(matrix); - id container = (id)self.superview; - [container invalidate]; -} - -- (void)setClientRect:(CGRect)clientRect { - if (CGRectEqualToRect(_clientRect, clientRect)) { - return; - } - _clientRect = clientRect; - if (self.onLayout) { - self.onLayout(@{ - @"layout": @{ - @"x": @(_clientRect.origin.x), - @"y": @(_clientRect.origin.y), - @"width": @(_clientRect.size.width), - @"height": @(_clientRect.size.height), - } - }); - - } -} - -- (void)setClipPath:(NSString *)clipPath -{ - if ([_clipPath isEqualToString:clipPath]) { - return; - } - CGPathRelease(_cachedClipPath); - _cachedClipPath = nil; - _clipPath = clipPath; - [self invalidate]; -} - -- (void)setClipRule:(ABI46_0_0RNSVGCGFCRule)clipRule -{ - if (_clipRule == clipRule) { - return; - } - CGPathRelease(_cachedClipPath); - _cachedClipPath = nil; - _clipRule = clipRule; - [self invalidate]; -} - -- (void)setMask:(NSString *)mask -{ - if ([_mask isEqualToString:mask]) { - return; - } - _mask = mask; - [self invalidate]; -} - -- (void)setMarkerStart:(NSString *)markerStart -{ - if ([_markerStart isEqualToString:markerStart]) { - return; - } - _markerStart = markerStart; - [self invalidate]; -} - -- (void)setMarkerMid:(NSString *)markerMid -{ - if ([_markerMid isEqualToString:markerMid]) { - return; - } - _markerMid = markerMid; - [self invalidate]; -} - -- (void)setMarkerEnd:(NSString *)markerEnd -{ - if ([_markerEnd isEqualToString:markerEnd]) { - return; - } - _markerEnd = markerEnd; - [self invalidate]; -} - -- (void)beginTransparencyLayer:(CGContextRef)context -{ - if (_transparent) { - CGContextBeginTransparencyLayer(context, NULL); - } -} - -- (void)endTransparencyLayer:(CGContextRef)context -{ - if (_transparent) { - CGContextEndTransparencyLayer(context); - } -} - -- (void)renderTo:(CGContextRef)context rect:(CGRect)rect -{ - self.dirty = false; - // abstract -} - -- (CGPathRef)getClipPath -{ - return _cachedClipPath; -} - -- (CGPathRef)getClipPath:(CGContextRef)context -{ - if (self.clipPath) { - _clipNode = (ABI46_0_0RNSVGClipPath*)[self.svgView getDefinedClipPath:self.clipPath]; - if (_cachedClipPath) { - CGPathRelease(_cachedClipPath); - } - CGAffineTransform transform = CGAffineTransformConcat(_clipNode.matrix, _clipNode.transforms); - _cachedClipPath = CGPathCreateCopyByTransformingPath([_clipNode getPath:context], &transform); - } - - return _cachedClipPath; -} - -- (void)clip:(CGContextRef)context -{ - CGPathRef clipPath = [self getClipPath:context]; - - if (clipPath) { - CGContextAddPath(context, clipPath); - if (_clipRule == kRNSVGCGFCRuleEvenodd) { - CGContextEOClip(context); - } else { - CGContextClip(context); - } - } -} - -- (CGPathRef)getPath: (CGContextRef)context -{ - // abstract - return nil; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - // abstract -} - -// hitTest delagate -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - - // abstract - return nil; -} - -- (ABI46_0_0RNSVGSvgView *)svgView -{ - if (_svgView) { - return _svgView; - } - - __kindof ABI46_0_0RNSVGPlatformView *parent = self.superview; - - if ([parent class] == [ABI46_0_0RNSVGSvgView class]) { - _svgView = parent; - } else if ([parent isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - _svgView = ((ABI46_0_0RNSVGNode *)parent).svgView; - } else { - ABI46_0_0RCTLogError(@"ABI46_0_0RNSVG: %@ should be descendant of a SvgViewShadow.", NSStringFromClass(self.class)); - } - - return _svgView; -} - -- (CGFloat)relativeOnWidthString:(NSString *)length -{ - return [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:length - relative:[self getCanvasWidth] - fontSize:[self getFontSizeFromContext]]; -} - -- (CGFloat)relativeOnHeightString:(NSString *)length -{ - return [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:length - relative:[self getCanvasHeight] - fontSize:[self getFontSizeFromContext]]; -} - -- (CGFloat)relativeOnOtherString:(NSString *)length -{ - return [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:length - relative:[self getCanvasDiagonal] - fontSize:[self getFontSizeFromContext]]; -} - -- (CGFloat)relativeOn:(ABI46_0_0RNSVGLength *)length relative:(CGFloat)relative -{ - ABI46_0_0RNSVGLengthUnitType unit = length.unit; - if (unit == SVG_LENGTHTYPE_NUMBER){ - return length.value; - } else if (unit == SVG_LENGTHTYPE_PERCENTAGE){ - return length.value / 100 * relative; - } - return [self fromRelative:length]; -} - -- (CGFloat)relativeOnWidth:(ABI46_0_0RNSVGLength *)length -{ - ABI46_0_0RNSVGLengthUnitType unit = length.unit; - if (unit == SVG_LENGTHTYPE_NUMBER){ - return length.value; - } else if (unit == SVG_LENGTHTYPE_PERCENTAGE){ - return length.value / 100 * [self getCanvasWidth]; - } - return [self fromRelative:length]; -} - -- (CGFloat)relativeOnHeight:(ABI46_0_0RNSVGLength *)length -{ - ABI46_0_0RNSVGLengthUnitType unit = length.unit; - if (unit == SVG_LENGTHTYPE_NUMBER){ - return length.value; - } else if (unit == SVG_LENGTHTYPE_PERCENTAGE){ - return length.value / 100 * [self getCanvasHeight]; - } - return [self fromRelative:length]; -} - -- (CGFloat)relativeOnOther:(ABI46_0_0RNSVGLength *)length -{ - ABI46_0_0RNSVGLengthUnitType unit = length.unit; - if (unit == SVG_LENGTHTYPE_NUMBER){ - return length.value; - } else if (unit == SVG_LENGTHTYPE_PERCENTAGE){ - return length.value / 100 * [self getCanvasDiagonal]; - } - return [self fromRelative:length]; -} - -- (CGFloat)fromRelative:(ABI46_0_0RNSVGLength*)length { - CGFloat unit; - switch (length.unit) { - case SVG_LENGTHTYPE_EMS: - unit = [self getFontSizeFromContext]; - break; - case SVG_LENGTHTYPE_EXS: - unit = [self getFontSizeFromContext] / 2; - break; - - case SVG_LENGTHTYPE_CM: - unit = (CGFloat)35.43307; - break; - case SVG_LENGTHTYPE_MM: - unit = (CGFloat)3.543307; - break; - case SVG_LENGTHTYPE_IN: - unit = 90; - break; - case SVG_LENGTHTYPE_PT: - unit = 1.25; - break; - case SVG_LENGTHTYPE_PC: - unit = 15; - break; - - default: - unit = 1; - } - return length.value * unit; -} - -- (CGRect)getContextBounds -{ - return CGContextGetClipBoundingBox(UIGraphicsGetCurrentContext()); -} - -- (CGFloat)getContextWidth -{ - return CGRectGetWidth([self getContextBounds]); -} - -- (CGFloat)getContextHeight -{ - return CGRectGetHeight([self getContextBounds]); -} - -- (CGFloat)getContextDiagonal { - CGRect bounds = [self getContextBounds]; - CGFloat width = CGRectGetWidth(bounds); - CGFloat height = CGRectGetHeight(bounds); - CGFloat powX = width * width; - CGFloat powY = height * height; - CGFloat r = sqrt(powX + powY) * ABI46_0_0RNSVG_M_SQRT1_2l; - return r; -} - -- (CGFloat) getCanvasWidth { - if (canvasWidth != -1) { - return canvasWidth; - } - ABI46_0_0RNSVGGroup* root = [self textRoot]; - if (root == nil) { - canvasWidth = [self getContextWidth]; - } else { - canvasWidth = [[root getGlyphContext] getWidth]; - } - - return canvasWidth; -} - -- (CGFloat) getCanvasHeight { - if (canvasHeight != -1) { - return canvasHeight; - } - ABI46_0_0RNSVGGroup* root = [self textRoot]; - if (root == nil) { - canvasHeight = [self getContextHeight]; - } else { - canvasHeight = [[root getGlyphContext] getHeight]; - } - - return canvasHeight; -} - -- (CGFloat) getCanvasDiagonal { - if (canvasDiagonal != -1) { - return canvasDiagonal; - } - CGFloat width = [self getCanvasWidth]; - CGFloat height = [self getCanvasHeight]; - CGFloat powX = width * width; - CGFloat powY = height * height; - canvasDiagonal = sqrt(powX + powY) * ABI46_0_0RNSVG_M_SQRT1_2l; - return canvasDiagonal; -} - -- (void)parseReference -{ - self.dirty = false; - if (self.name) { - typeof(self) __weak weakSelf = self; - [self.svgView defineTemplate:weakSelf templateName:self.name]; - } -} - -- (void)traverseSubviews:(BOOL (^)(__kindof ABI46_0_0RNSVGView *node))block -{ - for (ABI46_0_0RNSVGView *node in self.subviews) { - if (!block(node)) { - break; - } - } -} - -- (void)dealloc -{ - CGPathRelease(_cachedClipPath); - CGPathRelease(_strokePath); - CGPathRelease(_path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.h deleted file mode 100644 index 3d3dbc54daa631..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.h +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGBrush.h" -#import "ABI46_0_0RNSVGCGFCRule.h" -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGLength.h" -#import "ABI46_0_0RNSVGVectorEffect.h" - -@interface ABI46_0_0RNSVGRenderable : ABI46_0_0RNSVGNode - -@property (class) ABI46_0_0RNSVGRenderable *contextElement; -@property (nonatomic, strong) ABI46_0_0RNSVGBrush *fill; -@property (nonatomic, assign) CGFloat fillOpacity; -@property (nonatomic, assign) ABI46_0_0RNSVGCGFCRule fillRule; -@property (nonatomic, strong) ABI46_0_0RNSVGBrush *stroke; -@property (nonatomic, assign) CGFloat strokeOpacity; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *strokeWidth; -@property (nonatomic, assign) CGLineCap strokeLinecap; -@property (nonatomic, assign) CGLineJoin strokeLinejoin; -@property (nonatomic, assign) CGFloat strokeMiterlimit; -@property (nonatomic, strong) NSArray *strokeDasharray; -@property (nonatomic, assign) CGFloat strokeDashoffset; -@property (nonatomic, assign) ABI46_0_0RNSVGVectorEffect vectorEffect; -@property (nonatomic, copy) NSArray *propList; -@property (nonatomic, assign) CGPathRef hitArea; - -- (void)setHitArea:(CGPathRef)path; - -- (NSArray *)getAttributeList; - -- (void)mergeProperties:(__kindof ABI46_0_0RNSVGRenderable *)target; - -- (void)resetProperties; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.m deleted file mode 100644 index 6cdcffeae9ecc2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGRenderable.m +++ /dev/null @@ -1,618 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNSVGRenderable.h" -#import "ABI46_0_0RNSVGClipPath.h" -#import "ABI46_0_0RNSVGMask.h" -#import "ABI46_0_0RNSVGViewBox.h" -#import "ABI46_0_0RNSVGVectorEffect.h" -#import "ABI46_0_0RNSVGBezierElement.h" -#import "ABI46_0_0RNSVGMarker.h" -#import "ABI46_0_0RNSVGMarkerPosition.h" - -@implementation ABI46_0_0RNSVGRenderable -{ - NSMutableDictionary *_originProperties; - NSArray *_lastMergedList; - NSArray *_attributeList; - NSArray *_sourceStrokeDashArray; - CGFloat *_strokeDashArrayData; - CGPathRef _srcHitPath; -} - -static ABI46_0_0RNSVGRenderable * _contextElement; -+ (ABI46_0_0RNSVGRenderable *)contextElement { return _contextElement; } -+ (void)setContextElement:(ABI46_0_0RNSVGRenderable *)contextElement { _contextElement = contextElement; } - -- (id)init -{ - if (self = [super init]) { - _fillOpacity = 1; - _strokeOpacity = 1; - _strokeWidth = [ABI46_0_0RNSVGLength lengthWithNumber:1]; - _fillRule = kRNSVGCGFCRuleNonzero; - } - return self; -} - -- (void)invalidate -{ - _sourceStrokeDashArray = nil; - if (self.dirty || self.merging) { - return; - } - _srcHitPath = nil; - [super invalidate]; - self.dirty = true; -} - -- (void)setFill:(ABI46_0_0RNSVGBrush *)fill -{ - if (fill == _fill) { - return; - } - [self invalidate]; - _fill = fill; -} - -- (void)setFillOpacity:(CGFloat)fillOpacity -{ - if (fillOpacity == _fillOpacity) { - return; - } - [self invalidate]; - _fillOpacity = fillOpacity; -} - -- (void)setFillRule:(ABI46_0_0RNSVGCGFCRule)fillRule -{ - if (fillRule == _fillRule) { - return; - } - [self invalidate]; - _fillRule = fillRule; -} - -- (void)setStroke:(ABI46_0_0RNSVGBrush *)stroke -{ - if (stroke == _stroke) { - return; - } - [self invalidate]; - _stroke = stroke; -} - -- (void)setStrokeOpacity:(CGFloat)strokeOpacity -{ - if (strokeOpacity == _strokeOpacity) { - return; - } - [self invalidate]; - _strokeOpacity = strokeOpacity; -} - -- (void)setStrokeWidth:(ABI46_0_0RNSVGLength*)strokeWidth -{ - if ([strokeWidth isEqualTo:_strokeWidth]) { - return; - } - [self invalidate]; - _strokeWidth = strokeWidth; -} - -- (void)setStrokeLinecap:(CGLineCap)strokeLinecap -{ - if (strokeLinecap == _strokeLinecap) { - return; - } - [self invalidate]; - _strokeLinecap = strokeLinecap; -} - -- (void)setStrokeJoin:(CGLineJoin)strokeLinejoin -{ - if (strokeLinejoin == _strokeLinejoin) { - return; - } - [self invalidate]; - _strokeLinejoin = strokeLinejoin; -} - -- (void)setStrokeMiterlimit:(CGFloat)strokeMiterlimit -{ - if (strokeMiterlimit == _strokeMiterlimit) { - return; - } - [self invalidate]; - _strokeMiterlimit = strokeMiterlimit; -} - -- (void)setStrokeDasharray:(NSArray *)strokeDasharray -{ - if (strokeDasharray == _strokeDasharray) { - return; - } - [self invalidate]; - _strokeDasharray = strokeDasharray; -} - -- (void)setStrokeDashoffset:(CGFloat)strokeDashoffset -{ - if (strokeDashoffset == _strokeDashoffset) { - return; - } - [self invalidate]; - _strokeDashoffset = strokeDashoffset; -} - -- (void)setVectorEffect:(ABI46_0_0RNSVGVectorEffect)vectorEffect -{ - if (vectorEffect == _vectorEffect) { - return; - } - [self invalidate]; - _vectorEffect = vectorEffect; -} - -- (void)setPropList:(NSArray *)propList -{ - if (propList == _propList) { - return; - } - - _propList = _attributeList = propList; - [self invalidate]; -} - -- (void)dealloc -{ - CGPathRelease(_hitArea); - _sourceStrokeDashArray = nil; - if (_strokeDashArrayData) { - free(_strokeDashArrayData); - } - _strokeDashArrayData = nil; -} - -UInt32 ABI46_0_0saturate(CGFloat value) { - return value <= 0 ? 0 : value >= 255 ? 255 : (UInt32)value; -} - -- (void)renderTo:(CGContextRef)context rect:(CGRect)rect -{ - self.dirty = false; - // This needs to be painted on a layer before being composited. - CGContextSaveGState(context); - CGContextConcatCTM(context, self.matrix); - CGContextConcatCTM(context, self.transforms); - CGContextSetAlpha(context, self.opacity); - - [self beginTransparencyLayer:context]; - - if (self.mask) { - // https://www.w3.org/TR/SVG11/masking.html#MaskElement - ABI46_0_0RNSVGMask *_maskNode = (ABI46_0_0RNSVGMask*)[self.svgView getDefinedMask:self.mask]; - CGRect bounds = CGContextGetClipBoundingBox(context); - CGSize boundsSize = bounds.size; - CGFloat height = boundsSize.height; - CGFloat width = boundsSize.width; -#if TARGET_OS_OSX - CGFloat scale = [[NSScreen mainScreen] backingScaleFactor]; -#else - CGFloat scale = [[UIScreen mainScreen] scale]; -#endif - NSUInteger iheight = (NSUInteger)height; - NSUInteger iwidth = (NSUInteger)width; - NSUInteger iscale = (NSUInteger)scale; - NSUInteger scaledHeight = iheight * iscale; - NSUInteger scaledWidth = iwidth * iscale; - NSUInteger npixels = scaledHeight * scaledWidth; - CGRect drawBounds = CGRectMake(0, 0, width, height); - - // Allocate pixel buffer and bitmap context for mask - NSUInteger bytesPerPixel = 4; - NSUInteger bitsPerComponent = 8; - NSUInteger bytesPerRow = bytesPerPixel * scaledWidth; - CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); - UInt32 * pixels = (UInt32 *) calloc(npixels, sizeof(UInt32)); - CGContextRef bcontext = CGBitmapContextCreate(pixels, scaledWidth, scaledHeight, bitsPerComponent, bytesPerRow, colorSpace, kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big); - CGContextScaleCTM(bcontext, iscale, iscale); - - // Clip to mask bounds and render the mask - CGFloat x = [self relativeOn:[_maskNode x] - relative:width]; - CGFloat y = [self relativeOn:[_maskNode y] - relative:height]; - CGFloat w = [self relativeOn:[_maskNode maskwidth] - relative:width]; - CGFloat h = [self relativeOn:[_maskNode maskheight] - relative:height]; - CGRect maskBounds = CGRectMake(x, y, w, h); - CGContextClipToRect(bcontext, maskBounds); - [_maskNode renderLayerTo:bcontext rect:rect]; - - // Apply luminanceToAlpha filter primitive - // https://www.w3.org/TR/SVG11/filters.html#feColorMatrixElement - UInt32 * currentPixel = pixels; - for (NSUInteger i = 0; i < npixels; i++) { - UInt32 color = *currentPixel; - - UInt32 r = color & 0xFF; - UInt32 g = (color >> 8) & 0xFF; - UInt32 b = (color >> 16) & 0xFF; - - CGFloat luma = (CGFloat)(0.299 * r + 0.587 * g + 0.144 * b); - *currentPixel = ABI46_0_0saturate(luma) << 24; - currentPixel++; - } - - // Create mask image and release memory - CGImageRef maskImage = CGBitmapContextCreateImage(bcontext); - CGColorSpaceRelease(colorSpace); - CGContextRelease(bcontext); - free(pixels); - - // Render content of current SVG Renderable to image - UIGraphicsBeginImageContextWithOptions(boundsSize, NO, 0.0); - CGContextRef newContext = UIGraphicsGetCurrentContext(); - CGContextTranslateCTM(newContext, 0.0, height); - CGContextScaleCTM(newContext, 1.0, -1.0); - [self renderLayerTo:newContext rect:rect]; - CGImageRef contentImage = CGBitmapContextCreateImage(newContext); - UIGraphicsEndImageContext(); - - // Blend current element and mask - UIGraphicsBeginImageContextWithOptions(boundsSize, NO, 0.0); - newContext = UIGraphicsGetCurrentContext(); - CGContextTranslateCTM(newContext, 0.0, height); - CGContextScaleCTM(newContext, 1.0, -1.0); - - CGContextSetBlendMode(newContext, kCGBlendModeCopy); - CGContextDrawImage(newContext, drawBounds, maskImage); - CGImageRelease(maskImage); - - CGContextSetBlendMode(newContext, kCGBlendModeSourceIn); - CGContextDrawImage(newContext, drawBounds, contentImage); - CGImageRelease(contentImage); - - CGImageRef blendedImage = CGBitmapContextCreateImage(newContext); - UIGraphicsEndImageContext(); - - // Render blended result into current render context - CGContextDrawImage(context, drawBounds, blendedImage); - CGImageRelease(blendedImage); - } else { - [self renderLayerTo:context rect:rect]; - } - [self endTransparencyLayer:context]; - - CGContextRestoreGState(context); - - [self renderMarkers:context path:self.path rect:&rect]; -} - -- (void)prepareStrokeDash:(NSUInteger)count strokeDasharray:(NSArray *)strokeDasharray { - if (strokeDasharray != _sourceStrokeDashArray) { - CGFloat *dash = _strokeDashArrayData; - _strokeDashArrayData = realloc(dash, sizeof(CGFloat) * count); - if (!_strokeDashArrayData) { - free(dash); - return; - } - _sourceStrokeDashArray = strokeDasharray; - for (NSUInteger i = 0; i < count; i++) { - _strokeDashArrayData[i] = (CGFloat)[self relativeOnOther:strokeDasharray[i]]; - } - } -} - -- (void)renderMarkers:(CGContextRef)context path:(CGPathRef)path rect:(const CGRect *)rect { - ABI46_0_0RNSVGMarker *markerStart = (ABI46_0_0RNSVGMarker*)[self.svgView getDefinedMarker:self.markerStart]; - ABI46_0_0RNSVGMarker *markerMid = (ABI46_0_0RNSVGMarker*)[self.svgView getDefinedMarker:self.markerMid]; - ABI46_0_0RNSVGMarker *markerEnd = (ABI46_0_0RNSVGMarker*)[self.svgView getDefinedMarker:self.markerEnd]; - if (markerStart || markerMid || markerEnd) { - _contextElement = self; - NSArray* positions = [ABI46_0_0RNSVGMarkerPosition fromCGPath:path]; - CGFloat width = self.strokeWidth ? [self relativeOnOther:self.strokeWidth] : 1; - __block CGRect bounds = CGRectNull; - CGMutablePathRef markerPath = CGPathCreateMutable(); - for (ABI46_0_0RNSVGMarkerPosition* position in positions) { - ABI46_0_0RNSVGMarkerType type = [position type]; - ABI46_0_0RNSVGMarker *marker; - switch (type) { - case kStartMarker: - marker = markerStart; - break; - - case kMidMarker: - marker = markerMid; - break; - - case kEndMarker: - marker = markerEnd; - break; - } - if (!marker) { - continue; - } - - [marker renderMarker:context rect:*rect position:position strokeWidth:width]; - CGAffineTransform transform = marker.transform; - CGPathRef hitArea = marker.hitArea; - CGPathAddPath(markerPath, &transform, hitArea); - CGRect nodeRect = marker.pathBounds; - if (!CGRectIsEmpty(nodeRect)) { - bounds = CGRectUnion(bounds, CGRectApplyAffineTransform(nodeRect, transform)); - } - } - self.markerBounds = bounds; - self.markerPath = markerPath; - _contextElement = nil; - } -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - CGPathRef path = self.path; - if (!path) { - path = [self getPath:context]; - if (!self.path) { - self.path = CGPathRetain(path); - } - [self setHitArea:path]; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); - self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); - } - const CGRect pathBounds = self.pathBounds; - - CGAffineTransform current = CGContextGetCTM(context); - CGAffineTransform svgToClientTransform = CGAffineTransformConcat(current, self.svgView.invInitialCTM); - CGRect clientRect = CGRectApplyAffineTransform(pathBounds, svgToClientTransform); - - self.ctm = svgToClientTransform; - self.clientRect = clientRect; - self.screenCTM = current; - - if (_vectorEffect == kRNSVGVectorEffectNonScalingStroke) { - path = CGPathCreateCopyByTransformingPath(path, &svgToClientTransform); - CGContextConcatCTM(context, CGAffineTransformInvert(svgToClientTransform)); - } - - CGAffineTransform vbmatrix = self.svgView.getViewBoxTransform; - CGAffineTransform transform = CGAffineTransformConcat(self.matrix, self.transforms); - CGAffineTransform matrix = CGAffineTransformConcat(transform, vbmatrix); - - CGRect bounds = CGRectMake(0, 0, CGRectGetWidth(clientRect), CGRectGetHeight(clientRect)); - CGPoint mid = CGPointMake(CGRectGetMidX(pathBounds), CGRectGetMidY(pathBounds)); - CGPoint center = CGPointApplyAffineTransform(mid, matrix); - - self.bounds = bounds; - if (!isnan(center.x) && !isnan(center.y)) { - self.center = center; - } - self.frame = clientRect; - - if (self.skip || self.opacity == 0) { - return; - } - - if (!self.fill && !self.stroke) { - return; - } - - CGPathDrawingMode mode = kCGPathStroke; - BOOL fillColor = NO; - [self clip:context]; - - BOOL evenodd = self.fillRule == kRNSVGCGFCRuleEvenodd; - - if (self.fill) { - if (self.fill.class == ABI46_0_0RNSVGBrush.class) { - CGContextSetFillColorWithColor(context, [self.tintColor CGColor]); - fillColor = YES; - } else { - fillColor = [self.fill applyFillColor:context opacity:self.fillOpacity]; - } - - if (fillColor) { - mode = evenodd ? kCGPathEOFill : kCGPathFill; - } else { - CGContextSaveGState(context); - CGContextAddPath(context, path); - evenodd ? CGContextEOClip(context) : CGContextClip(context); - [self.fill paint:context - opacity:self.fillOpacity - painter:[self.svgView getDefinedPainter:self.fill.brushRef] - bounds:pathBounds - ]; - CGContextRestoreGState(context); - - if (!self.stroke) { - return; - } - } - } - - if (self.stroke) { - CGFloat width = self.strokeWidth ? [self relativeOnOther:self.strokeWidth] : 1; - CGContextSetLineWidth(context, width); - CGContextSetLineCap(context, self.strokeLinecap); - CGContextSetLineJoin(context, self.strokeLinejoin); - NSArray* strokeDasharray = self.strokeDasharray; - NSUInteger count = strokeDasharray.count; - - if (count) { - [self prepareStrokeDash:count strokeDasharray:strokeDasharray]; - if (_strokeDashArrayData) { - CGContextSetLineDash(context, self.strokeDashoffset, _strokeDashArrayData, count); - } - } - - if (!fillColor) { - CGContextAddPath(context, path); - CGContextReplacePathWithStrokedPath(context); - CGContextClip(context); - } - - BOOL strokeColor; - - if (self.stroke.class == ABI46_0_0RNSVGBrush.class) { - CGContextSetStrokeColorWithColor(context,[self.tintColor CGColor]); - strokeColor = YES; - } else { - strokeColor = [self.stroke applyStrokeColor:context opacity:self.strokeOpacity]; - } - - if (strokeColor && fillColor) { - mode = evenodd ? kCGPathEOFillStroke : kCGPathFillStroke; - } else if (!strokeColor) { - // draw fill - if (fillColor) { - CGContextAddPath(context, path); - CGContextDrawPath(context, mode); - } - - // draw stroke - CGContextAddPath(context, path); - CGContextReplacePathWithStrokedPath(context); - evenodd ? CGContextEOClip(context) : CGContextClip(context); - - [self.stroke paint:context - opacity:self.strokeOpacity - painter:[self.svgView getDefinedPainter:self.stroke.brushRef] - bounds:pathBounds - ]; - return; - } - } - - CGContextAddPath(context, path); - CGContextDrawPath(context, mode); -} - -- (void)setHitArea:(CGPathRef)path -{ - if (_srcHitPath == path) { - return; - } - _srcHitPath = path; - CGPathRelease(_hitArea); - CGPathRelease(self.strokePath); - _hitArea = CGPathCreateCopy(path); - self.strokePath = nil; - if (self.stroke && self.strokeWidth) { - // Add stroke to hitArea - CGFloat width = [self relativeOnOther:self.strokeWidth]; - self.strokePath = CGPathRetain(CFAutorelease(CGPathCreateCopyByStrokingPath(path, nil, width, self.strokeLinecap, self.strokeLinejoin, self.strokeMiterlimit))); - // TODO add dashing - // CGPathCreateCopyByDashingPath(CGPathRef _Nullable path, const CGAffineTransform * _Nullable transform, CGFloat phase, const CGFloat * _Nullable lengths, size_t count) - } -} - -- (BOOL)isUserInteractionEnabled -{ - return NO; -} - -// hitTest delegate -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - if (!_hitArea) { - return nil; - } - - BOOL canReceiveTouchEvents = (self.pointerEvents != ABI46_0_0RCTPointerEventsNone && ![self isHidden]); - if(!canReceiveTouchEvents) { - return nil; - } - - if (self.active) { - if (!event) { - self.active = NO; - } - return self; - } - - CGPoint transformed = CGPointApplyAffineTransform(point, self.invmatrix); - transformed = CGPointApplyAffineTransform(transformed, self.invTransform); - - if (!CGRectContainsPoint(self.pathBounds, transformed) && - !CGRectContainsPoint(self.markerBounds, transformed)) { - return nil; - } - - BOOL evenodd = self.fillRule == kRNSVGCGFCRuleEvenodd; - if (!CGPathContainsPoint(_hitArea, nil, transformed, evenodd) && - !CGPathContainsPoint(self.strokePath, nil, transformed, NO) && - !CGPathContainsPoint(self.markerPath, nil, transformed, NO)) { - return nil; - } - - if (self.clipPath) { - ABI46_0_0RNSVGClipPath *clipNode = (ABI46_0_0RNSVGClipPath*)[self.svgView getDefinedClipPath:self.clipPath]; - if ([clipNode isSimpleClipPath]) { - CGPathRef clipPath = [self getClipPath]; - if (clipPath && !CGPathContainsPoint(clipPath, nil, transformed, clipNode.clipRule == kRNSVGCGFCRuleEvenodd)) { - return nil; - } - } else { - ABI46_0_0RNSVGRenderable *clipGroup = (ABI46_0_0RNSVGRenderable*)clipNode; - if (![clipGroup hitTest:transformed withEvent:event]) { - return nil; - } - } - } - - return self; -} - -- (NSArray *)getAttributeList -{ - return _attributeList; -} - -- (void)mergeProperties:(__kindof ABI46_0_0RNSVGRenderable *)target -{ - NSArray *targetAttributeList = [target getAttributeList]; - - if (targetAttributeList.count == 0) { - return; - } - self.merging = true; - - NSMutableArray* attributeList = self.propList ? [self.propList mutableCopy] : [[NSMutableArray alloc] init]; - _originProperties = [[NSMutableDictionary alloc] init]; - - for (NSString *key in targetAttributeList) { - [_originProperties setValue:[self valueForKey:key] forKey:key]; - if (![attributeList containsObject:key]) { - [attributeList addObject:key]; - [self setValue:[target valueForKey:key] forKey:key]; - } - } - - _lastMergedList = targetAttributeList; - _attributeList = [attributeList copy]; - self.merging = false; -} - -- (void)resetProperties -{ - self.merging = true; - for (NSString *key in _lastMergedList) { - [self setValue:[_originProperties valueForKey:key] forKey:key]; - } - - _lastMergedList = nil; - _attributeList = _propList; - self.merging = false; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGUIKit.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGUIKit.h deleted file mode 100644 index dfd88ea398a428..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ABI46_0_0RNSVGUIKit.h +++ /dev/null @@ -1,42 +0,0 @@ -// Most (if not all) of this file could probably go away once ABI46_0_0React-native-macos's version of ABI46_0_0RCTUIKit.h makes its way upstream. -// https://github.com/microsoft/ABI46_0_0React-native-macos/issues/242 - -#if !TARGET_OS_OSX - -#import - -#define ABI46_0_0RNSVGColor UIColor -#define ABI46_0_0RNSVGPlatformView UIView -#define ABI46_0_0RNSVGTextView UILabel -#define ABI46_0_0RNSVGView UIView - -#else // TARGET_OS_OSX [ - -#import - -#define ABI46_0_0RNSVGColor NSColor -#define ABI46_0_0RNSVGPlatformView NSView -#define ABI46_0_0RNSVGTextView NSTextView - -@interface ABI46_0_0RNSVGView : ABI46_0_0RCTUIView - -@property CGPoint center; -@property (nonatomic, strong) ABI46_0_0RNSVGColor *tintColor; - -@end - -// TODO: These could probably be a part of ABI46_0_0React-native-macos -// See https://github.com/microsoft/ABI46_0_0React-native-macos/issues/658 and https://github.com/microsoft/ABI46_0_0React-native-macos/issues/659 -@interface NSImage (ABI46_0_0RNSVGMacOSExtensions) -@property (readonly) CGImageRef CGImage; -@end - -@interface NSValue (ABI46_0_0RNSVGMacOSExtensions) -+ (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform; -+ (NSValue *)valueWithCGPoint:(CGPoint)point; - -@property (readonly) CGAffineTransform CGAffineTransformValue; -@property (readonly) CGPoint CGPointValue; -@end - -#endif // ] TARGET_OS_OSX diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.h deleted file mode 100644 index fc262f9d2bd033..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import "ABI46_0_0RNSVGPainter.h" - -@interface ABI46_0_0RNSVGBrush : NSObject - -@property (nonatomic, strong) NSString* brushRef; - -/* @abstract */ -- (instancetype)initWithArray:(NSArray *)data; - -/** - * @abstract - * For certain brushes we can fast path a combined fill and stroke. - * For those brushes we override applyFillColor which sets the fill - * color to be used by those batch paints. Those return YES. - * We can't batch gradient painting in CoreGraphics, so those will - * return NO and paint gets called instead. - */ -- (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity; - -- (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity; - -- (CGColorRef)getColorWithOpacity:(CGFloat)opacity; - -/** - * @abstract - * paint fills the context with a brush. The context is assumed to - * be clipped. - */ -- (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(ABI46_0_0RNSVGPainter *)painter bounds:(CGRect)bounds; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.m deleted file mode 100644 index 8583bede5e7e68..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrush.m +++ /dev/null @@ -1,43 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGBrush.h" -#import - -@implementation ABI46_0_0RNSVGBrush - -- (instancetype)initWithArray:(NSArray *)data -{ - return [super init]; -} - -- (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(ABI46_0_0RNSVGPainter *)painter bounds:(CGRect)bounds -{ - -} - -- (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - return NO; -} - -- (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - return NO; -} - -- (CGColorRef)getColorWithOpacity:(CGFloat)opacity -{ - return nil; -} - -- (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(ABI46_0_0RNSVGPainter *)painter -{ - // abstract -} -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrushType.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrushType.h deleted file mode 100644 index 3efdf200279502..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGBrushType.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -typedef enum { - kRNSVGUndefinedType, - kRNSVGLinearGradient, - kRNSVGRadialGradient, - kRNSVGPattern -} ABI46_0_0RNSVGBrushType; diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.h deleted file mode 100644 index 9b5c39027e2bcd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2015-present, ABI46_0_0React-native-community. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGBrush.h" - -@interface ABI46_0_0RNSVGContextBrush : ABI46_0_0RNSVGBrush - -- (instancetype)initFill; -- (instancetype)initStroke; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.m deleted file mode 100644 index 9cecefa32dd28e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGContextBrush.m +++ /dev/null @@ -1,85 +0,0 @@ -/** - * Copyright (c) 2015-present, ABI46_0_0React-native-community. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGContextBrush.h" -#import "ABI46_0_0RNSVGRenderable.h" -#import "ABI46_0_0RNSVGNode.h" - -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import - -@implementation ABI46_0_0RNSVGContextBrush -{ - BOOL _isStroke; -} - -- (instancetype)initFill -{ - if ((self = [super initWithArray:nil])) { - _isStroke = NO; - } - return self; -} - -- (instancetype)initStroke -{ - if ((self = [super initWithArray:nil])) { - _isStroke = YES; - } - return self; -} - -- (void)dealloc -{ -} - -- (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - ABI46_0_0RNSVGRenderable *element = ABI46_0_0RNSVGRenderable.contextElement; - if (!element) { - return NO; - } - - ABI46_0_0RNSVGBrush *brush = _isStroke ? element.stroke : element.fill; - - BOOL fillColor; - - if (brush.class == ABI46_0_0RNSVGBrush.class) { - CGContextSetFillColorWithColor(context, [element.tintColor CGColor]); - fillColor = YES; - } else { - fillColor = [brush applyFillColor:context opacity:opacity]; - } - - return fillColor; -} - - - -- (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - ABI46_0_0RNSVGRenderable *element = ABI46_0_0RNSVGRenderable.contextElement; - if (!element) { - return NO; - } - - ABI46_0_0RNSVGBrush *brush = _isStroke ? element.stroke : element.fill; - - BOOL strokeColor; - - if (brush.class == ABI46_0_0RNSVGBrush.class) { - CGContextSetStrokeColorWithColor(context, [element.tintColor CGColor]); - strokeColor = YES; - } else { - strokeColor = [brush applyStrokeColor:context opacity:opacity]; - } - - return YES; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.h deleted file mode 100644 index c1efc6f205687c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.h +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import "ABI46_0_0RNSVGBrushType.h" -#import "ABI46_0_0RNSVGUnits.h" -#import "ABI46_0_0RNSVGLength.h" - -@class ABI46_0_0RNSVGPattern; - -@interface ABI46_0_0RNSVGPainter : NSObject - -@property (nonatomic, assign) ABI46_0_0RNSVGPattern* pattern; -@property (nonatomic, assign) CGRect paintBounds; -@property (nonatomic, assign) bool useObjectBoundingBoxForContentUnits; -@property (nonatomic, assign) CGRect bounds; - -- (instancetype)initWithPointsArray:(NSArray *)pointsArray NS_DESIGNATED_INITIALIZER; - -- (void)paint:(CGContextRef)context bounds:(CGRect)bounds; - -- (void)setUnits:(ABI46_0_0RNSVGUnits)unit; - -- (void)setContentUnits:(ABI46_0_0RNSVGUnits)unit; - -- (void)setUserSpaceBoundingBox:(CGRect)userSpaceBoundingBox; - -- (void)setTransform:(CGAffineTransform)transform; - -- (void)setLinearGradientColors:(NSArray *)colors; - -- (void)setRadialGradientColors:(NSArray *)colors; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.m deleted file mode 100644 index 65427710a53ceb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainter.m +++ /dev/null @@ -1,255 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGPattern.h" -#import "ABI46_0_0RNSVGViewBox.h" - -@implementation ABI46_0_0RNSVGPainter -{ - NSArray *_points; - NSArray *_colors; - ABI46_0_0RNSVGBrushType _type; - BOOL _useObjectBoundingBox; - BOOL _useContentObjectBoundingBox; - CGAffineTransform _transform; - CGRect _userSpaceBoundingBox; -} - -- (instancetype)initWithPointsArray:(NSArray *)pointsArray -{ - if ((self = [super init])) { - _points = pointsArray; - } - return self; -} - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (instancetype)init) - -- (void)setUnits:(ABI46_0_0RNSVGUnits)unit -{ - _useObjectBoundingBox = unit == kRNSVGUnitsObjectBoundingBox; -} - -- (void)setContentUnits:(ABI46_0_0RNSVGUnits)unit -{ - _useContentObjectBoundingBox = unit == kRNSVGUnitsObjectBoundingBox; -} - -- (void)setUserSpaceBoundingBox:(CGRect)userSpaceBoundingBox -{ - _userSpaceBoundingBox = userSpaceBoundingBox; -} - -- (void)setTransform:(CGAffineTransform)transform -{ - _transform = transform; -} - -- (void)setPattern:(ABI46_0_0RNSVGPattern *)pattern -{ - if (_type != kRNSVGUndefinedType) { - // todo: throw error - return; - } - - _type = kRNSVGPattern; - _pattern = pattern; -} - -- (void)setLinearGradientColors:(NSArray *)colors -{ - if (_type != kRNSVGUndefinedType) { - // todo: throw error - return; - } - - _type = kRNSVGLinearGradient; - _colors = colors; -} - -- (void)setRadialGradientColors:(NSArray *)colors -{ - if (_type != kRNSVGUndefinedType) { - // todo: throw error - return; - } - - _type = kRNSVGRadialGradient; - _colors = colors; -} - -- (void)paint:(CGContextRef)context bounds:(CGRect)bounds -{ - if (_type == kRNSVGLinearGradient) { - [self paintLinearGradient:context bounds:bounds]; - } else if (_type == kRNSVGRadialGradient) { - [self paintRadialGradient:context bounds:bounds]; - } else if (_type == kRNSVGPattern) { - [self paintPattern:context bounds:bounds]; - } -} - -- (CGRect)getPaintRect:(CGContextRef)context bounds:(CGRect)bounds -{ - CGRect rect = _useObjectBoundingBox ? bounds : _userSpaceBoundingBox; - CGFloat height = CGRectGetHeight(rect); - CGFloat width = CGRectGetWidth(rect); - CGFloat x = 0.0; - CGFloat y = 0.0; - - if (_useObjectBoundingBox) { - x = CGRectGetMinX(rect); - y = CGRectGetMinY(rect); - } - - return CGRectMake(x, y, width, height); -} - -void ABI46_0_0PatternFunction(void* info, CGContextRef context) -{ - ABI46_0_0RNSVGPainter *_painter = (__bridge ABI46_0_0RNSVGPainter *)info; - ABI46_0_0RNSVGPattern *_pattern = [_painter pattern]; - CGRect rect = _painter.paintBounds; - CGFloat minX = _pattern.minX; - CGFloat minY = _pattern.minY; - CGFloat vbWidth = _pattern.vbWidth; - CGFloat vbHeight = _pattern.vbHeight; - if (vbWidth > 0 && vbHeight > 0) { - CGRect vbRect = CGRectMake(minX, minY, vbWidth, vbHeight); - CGAffineTransform _viewBoxTransform = [ABI46_0_0RNSVGViewBox - getTransform:vbRect - eRect:rect - align:_pattern.align - meetOrSlice:_pattern.meetOrSlice]; - CGContextConcatCTM(context, _viewBoxTransform); - } - - if (_painter.useObjectBoundingBoxForContentUnits) { - CGRect bounds = _painter.bounds; - CGContextConcatCTM(context, CGAffineTransformMakeScale(bounds.size.width, bounds.size.height)); - } - - [_pattern renderTo:context rect:rect]; -} - -- (CGFloat)getVal:(ABI46_0_0RNSVGLength*)length relative:(CGFloat)relative -{ - ABI46_0_0RNSVGLengthUnitType unit = [length unit]; - CGFloat val = [ABI46_0_0RNSVGPropHelper fromRelative:length - relative:relative]; - return _useObjectBoundingBox && - unit == SVG_LENGTHTYPE_NUMBER ? val * relative : val; -} - -- (void)paintPattern:(CGContextRef)context bounds:(CGRect)bounds -{ - CGRect rect = [self getPaintRect:context bounds:bounds]; - CGFloat height = CGRectGetHeight(rect); - CGFloat width = CGRectGetWidth(rect); - - CGFloat x = [self getVal:[_points objectAtIndex:0] relative:width]; - CGFloat y = [self getVal:[_points objectAtIndex:1] relative:height]; - CGFloat w = [self getVal:[_points objectAtIndex:2] relative:width]; - CGFloat h = [self getVal:[_points objectAtIndex:3] relative:height]; - - CGAffineTransform viewbox = [self.pattern.svgView getViewBoxTransform]; -#if TARGET_OS_OSX - // This is needed because macOS and iOS have different conventions for where the origin is. - // For macOS, it's in the bottom-left corner. For iOS, it's in the top-left corner. - viewbox = CGAffineTransformScale(viewbox, 1, -1); -#endif - CGRect newBounds = CGRectMake(x, y, w, h); - CGSize size = newBounds.size; - self.useObjectBoundingBoxForContentUnits = _useContentObjectBoundingBox; - self.paintBounds = newBounds; - self.bounds = rect; - - const CGPatternCallbacks callbacks = { 0, &ABI46_0_0PatternFunction, NULL }; - CGColorSpaceRef patternSpace = CGColorSpaceCreatePattern(NULL); - CGContextSetFillColorSpace(context, patternSpace); - CGColorSpaceRelease(patternSpace); - - CGPatternRef pattern = CGPatternCreate((__bridge void * _Nullable)(self), - newBounds, - viewbox, - size.width, - size.height, - kCGPatternTilingConstantSpacing, - true, - &callbacks); - CGFloat alpha = 1.0; - CGContextSetFillPattern(context, pattern, &alpha); - CGPatternRelease(pattern); - - CGContextFillRect(context, bounds); -} - -- (void)paintLinearGradient:(CGContextRef)context bounds:(CGRect)bounds -{ - if ([_colors count] == 0) { - ABI46_0_0RCTLogWarn(@"No stops in gradient"); - return; - } - CGGradientRef gradient = CGGradientRetain([ABI46_0_0RCTConvert ABI46_0_0RNSVGCGGradient:_colors]); - CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - - CGRect rect = [self getPaintRect:context bounds:bounds]; - CGFloat height = CGRectGetHeight(rect); - CGFloat width = CGRectGetWidth(rect); - CGFloat offsetX = CGRectGetMinX(rect); - CGFloat offsetY = CGRectGetMinY(rect); - - CGFloat x1 = [self getVal:[_points objectAtIndex:0] relative:width] + offsetX; - CGFloat y1 = [self getVal:[_points objectAtIndex:1] relative:height] + offsetY; - CGFloat x2 = [self getVal:[_points objectAtIndex:2] relative:width] + offsetX; - CGFloat y2 = [self getVal:[_points objectAtIndex:3] relative:height] + offsetY; - - CGContextConcatCTM(context, _transform); - CGContextDrawLinearGradient(context, gradient, CGPointMake(x1, y1), CGPointMake(x2, y2), extendOptions); - CGGradientRelease(gradient); -} - -- (void)paintRadialGradient:(CGContextRef)context bounds:(CGRect)bounds -{ - if ([_colors count] == 0) { - ABI46_0_0RCTLogWarn(@"No stops in gradient"); - return; - } - CGGradientRef gradient = CGGradientRetain([ABI46_0_0RCTConvert ABI46_0_0RNSVGCGGradient:_colors]); - CGGradientDrawingOptions extendOptions = kCGGradientDrawsBeforeStartLocation | kCGGradientDrawsAfterEndLocation; - - CGRect rect = [self getPaintRect:context bounds:bounds]; - - CGFloat width = CGRectGetWidth(rect); - CGFloat height = CGRectGetHeight(rect); - - CGFloat offsetX = CGRectGetMinX(rect); - CGFloat offsetY = CGRectGetMinY(rect); - - CGFloat rx = [self getVal:[_points objectAtIndex:2] relative:width]; - CGFloat ry = [self getVal:[_points objectAtIndex:3] relative:height]; - - double ratio = ry / rx; - - CGFloat fx = [self getVal:[_points objectAtIndex:0] relative:width] + offsetX; - CGFloat fy = ([self getVal:[_points objectAtIndex:1] relative:height] + offsetY) / ratio; - - CGFloat cx = [self getVal:[_points objectAtIndex:4] relative:width] + offsetX; - CGFloat cy = ([self getVal:[_points objectAtIndex:5] relative:height] + offsetY) / ratio; - - CGAffineTransform transform = CGAffineTransformMakeScale(1, ratio); - CGContextConcatCTM(context, transform); - - CGContextConcatCTM(context, _transform); - CGContextDrawRadialGradient(context, gradient, CGPointMake(fx, fy), 0, CGPointMake(cx, cy), rx, extendOptions); - CGGradientRelease(gradient); -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.h deleted file mode 100644 index 024079f350f5f5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGBrush.h" - -@interface ABI46_0_0RNSVGPainterBrush : ABI46_0_0RNSVGBrush - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.m deleted file mode 100644 index ad8bd8dd7214c5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGPainterBrush.m +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPainterBrush.h" -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import - -@implementation ABI46_0_0RNSVGPainterBrush - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - if (array.count != 2) { - ABI46_0_0RCTLogError(@"-[%@ %@] expects 2 elements, received %@", - self.class, NSStringFromSelector(_cmd), array); - return nil; - } - - self.brushRef = [array objectAtIndex:1]; - } - return self; -} - -- (void)paint:(CGContextRef)context opacity:(CGFloat)opacity painter:(ABI46_0_0RNSVGPainter *)painter bounds:(CGRect)bounds -{ - BOOL transparency = opacity < 1; - if (transparency) { - CGContextSetAlpha(context, opacity); - CGContextBeginTransparencyLayer(context, NULL); - } - - [painter paint:context bounds:bounds]; - - if (transparency) { - CGContextEndTransparencyLayer(context); - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.h deleted file mode 100644 index b02ecfb082f551..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGBrush.h" - -@interface ABI46_0_0RNSVGSolidColorBrush : ABI46_0_0RNSVGBrush - -- (instancetype)initWithNumber:(NSNumber *)number; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.m deleted file mode 100644 index b29e233ec479f6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Brushes/ABI46_0_0RNSVGSolidColorBrush.m +++ /dev/null @@ -1,64 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGSolidColorBrush.h" -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import - -@implementation ABI46_0_0RNSVGSolidColorBrush -{ - ABI46_0_0RNSVGColor *_color; -} - -- (instancetype)initWithArray:(NSArray *)array -{ - if ((self = [super initWithArray:array])) { - _color = [ABI46_0_0RCTConvert ABI46_0_0RNSVGColor:array offset:1]; - } - return self; -} - -- (instancetype)initWithNumber:(NSNumber *)number -{ - if ((self = [super init])) { - _color = [ABI46_0_0RCTConvert ABI46_0_0RNSVGColor:number]; - } - return self; -} - -- (void)dealloc -{ - _color = nil; -} - -- (CGColorRef)getColorWithOpacity:(CGFloat)opacity -{ - CGColorRef baseColor = _color.CGColor; - CGColorRef color = CGColorCreateCopyWithAlpha(baseColor, opacity * CGColorGetAlpha(baseColor)); - return color; -} - -- (BOOL)applyFillColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - CGColorRef color = [self getColorWithOpacity:opacity]; - CGContextSetFillColorWithColor(context, color); - CGColorRelease(color); - return YES; -} - -- (BOOL)applyStrokeColor:(CGContextRef)context opacity:(CGFloat)opacity -{ - CGColorRef color = [self getColorWithOpacity:opacity]; - CGContextSetStrokeColorWithColor(context, color); - CGColorRelease(color); - return YES; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.h deleted file mode 100644 index 97197700d957e9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.h +++ /dev/null @@ -1,19 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGContainer.h" -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGSvgView.h" - -@interface ABI46_0_0RNSVGClipPath : ABI46_0_0RNSVGGroup - -- (BOOL)isSimpleClipPath; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.m deleted file mode 100644 index 74213ea865ee72..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGClipPath.m +++ /dev/null @@ -1,32 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGClipPath.h" - -@implementation ABI46_0_0RNSVGClipPath - -- (void)parseReference -{ - self.dirty = false; - [self.svgView defineClipPath:self clipPathName:self.name]; -} - - -- (BOOL)isSimpleClipPath -{ - NSArray *children = self.subviews; - if (children.count == 1) { - ABI46_0_0RNSVGView* child = children[0]; - if ([child class] != [ABI46_0_0RNSVGGroup class]) { - return true; - } - } - return false; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.h deleted file mode 100644 index ae77af2b02f846..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNode.h" - -/** - * ABI46_0_0RNSVG defination are implemented as abstract views for all elements inside Defs. - */ - -@interface ABI46_0_0RNSVGDefs : ABI46_0_0RNSVGNode - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.m deleted file mode 100644 index b282e196b0b82e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGDefs.m +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGDefs.h" - -@class ABI46_0_0RNSVGNode; - -@implementation ABI46_0_0RNSVGDefs - -- (void)renderTo:(CGContextRef)context -{ - // Defs do not render -} - -- (void)parseReference -{ - self.dirty = false; - [self traverseSubviews:^(ABI46_0_0RNSVGNode *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - [node parseReference]; - } - return YES; - }]; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.h deleted file mode 100644 index 35f4e8352f8603..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.h +++ /dev/null @@ -1,12 +0,0 @@ - -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGForeignObject : ABI46_0_0RNSVGGroup - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *foreignObjectwidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *foreignObjectheight; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.m deleted file mode 100644 index 1e85181d8d17f8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGForeignObject.m +++ /dev/null @@ -1,160 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGForeignObject.h" -#import "ABI46_0_0RNSVGClipPath.h" -#import "ABI46_0_0RNSVGMask.h" -#import "ABI46_0_0RNSVGNode.h" - -@implementation ABI46_0_0RNSVGForeignObject - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - [self clip:context]; - CGContextTranslateCTM(context, [self relativeOnWidth:self.x], [self relativeOnHeight:self.y]); - CGRect clip = CGRectMake( - 0, - 0, - [self relativeOnWidth:self.foreignObjectwidth], - [self relativeOnHeight:self.foreignObjectheight] - ); - CGContextClipToRect(context, clip); - [super renderLayerTo:context rect:rect]; -} - -- (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect -{ - [self pushGlyphContext]; - - __block CGRect bounds = CGRectNull; - - [self traverseSubviews:^(ABI46_0_0RNSVGView *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGMask class]] || [node isKindOfClass:[ABI46_0_0RNSVGClipPath class]]) { - // no-op - } else if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - ABI46_0_0RNSVGNode* svgNode = (ABI46_0_0RNSVGNode*)node; - if (svgNode.display && [@"none" isEqualToString:svgNode.display]) { - return YES; - } - if (svgNode.responsible && !self.svgView.responsible) { - self.svgView.responsible = YES; - } - - if ([node isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)node mergeProperties:self]; - } - - [svgNode renderTo:context rect:rect]; - - CGRect nodeRect = svgNode.clientRect; - if (!CGRectIsEmpty(nodeRect)) { - bounds = CGRectUnion(bounds, nodeRect); - } - - if ([node isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)node resetProperties]; - } - } else if ([node isKindOfClass:[ABI46_0_0RNSVGSvgView class]]) { - ABI46_0_0RNSVGSvgView* svgView = (ABI46_0_0RNSVGSvgView*)node; - CGFloat width = [self relativeOnWidth:svgView.bbWidth]; - CGFloat height = [self relativeOnHeight:svgView.bbHeight]; - CGRect rect = CGRectMake(0, 0, width, height); - CGContextClipToRect(context, rect); - [svgView drawToContext:context withRect:rect]; - } else { - node.hidden = false; - [node.layer renderInContext:context]; - node.hidden = true; - } - - return YES; - }]; - CGPathRef path = [self getPath:context]; - [self setHitArea:path]; - if (!CGRectEqualToRect(bounds, CGRectNull)) { - self.clientRect = bounds; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); - self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); - - CGAffineTransform current = CGContextGetCTM(context); - CGAffineTransform svgToClientTransform = CGAffineTransformConcat(current, self.svgView.invInitialCTM); - - self.ctm = svgToClientTransform; - self.screenCTM = current; - - CGAffineTransform transform = CGAffineTransformConcat(self.matrix, self.transforms); - CGPoint mid = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); - CGPoint center = CGPointApplyAffineTransform(mid, transform); - - self.bounds = bounds; - if (!isnan(center.x) && !isnan(center.y)) { - self.center = center; - } - self.frame = bounds; - } - - [self popGlyphContext]; -} - -- (void)drawRect:(CGRect)rect -{ - [self invalidate]; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - - _x = x; - [self invalidate]; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - - _y = y; - [self invalidate]; -} - -- (void)setForeignObjectwidth:(ABI46_0_0RNSVGLength *)foreignObjectwidth -{ - if ([foreignObjectwidth isEqualTo:_foreignObjectwidth]) { - return; - } - - _foreignObjectwidth = foreignObjectwidth; - [self invalidate]; -} - -- (void)setForeignObjectheight:(ABI46_0_0RNSVGLength *)foreignObjectheight -{ - if ([foreignObjectheight isEqualTo:_foreignObjectheight]) { - return; - } - - _foreignObjectheight = foreignObjectheight; - [self invalidate]; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.h deleted file mode 100644 index 8ac26d3bf8b02e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.h +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGContainer.h" -#import "ABI46_0_0RNSVGCGFCRule.h" -#import "ABI46_0_0RNSVGSvgView.h" -#import "ABI46_0_0RNSVGPath.h" -#import "ABI46_0_0RNSVGGlyphContext.h" - -@interface ABI46_0_0RNSVGGroup : ABI46_0_0RNSVGPath - -@property (nonatomic, strong) NSDictionary *font; - -- (void)renderPathTo:(CGContextRef)context rect:(CGRect)rect; -- (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect; - -- (ABI46_0_0RNSVGGlyphContext *)getGlyphContext; -- (void)pushGlyphContext; -- (void)popGlyphContext; -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.m deleted file mode 100644 index 427afb78d0b10c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGGroup.m +++ /dev/null @@ -1,252 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGClipPath.h" -#import "ABI46_0_0RNSVGMask.h" - -@implementation ABI46_0_0RNSVGGroup -{ - ABI46_0_0RNSVGGlyphContext *_glyphContext; -} - -- (void)setFont:(NSDictionary*)font -{ - if (font == _font) { - return; - } - - [self invalidate]; - _font = font; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - [self clip:context]; - [self setupGlyphContext:context]; - [self renderGroupTo:context rect:rect]; -} - -- (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect -{ - [self pushGlyphContext]; - - __block CGRect bounds = CGRectNull; - - [self traverseSubviews:^(ABI46_0_0RNSVGView *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGMask class]] || [node isKindOfClass:[ABI46_0_0RNSVGClipPath class]]) { - // no-op - } else if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - ABI46_0_0RNSVGNode* svgNode = (ABI46_0_0RNSVGNode*)node; - if (svgNode.display && [@"none" isEqualToString:svgNode.display]) { - return YES; - } - if (svgNode.responsible && !self.svgView.responsible) { - self.svgView.responsible = YES; - } - - if ([node isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)node mergeProperties:self]; - } - - [svgNode renderTo:context rect:rect]; - - CGRect nodeRect = svgNode.clientRect; - if (!CGRectIsEmpty(nodeRect)) { - bounds = CGRectUnion(bounds, nodeRect); - } - - if ([node isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)node resetProperties]; - } - } else if ([node isKindOfClass:[ABI46_0_0RNSVGSvgView class]]) { - ABI46_0_0RNSVGSvgView* svgView = (ABI46_0_0RNSVGSvgView*)node; - CGFloat width = [self relativeOnWidth:svgView.bbWidth]; - CGFloat height = [self relativeOnHeight:svgView.bbHeight]; - CGRect rect = CGRectMake(0, 0, width, height); - CGContextClipToRect(context, rect); - [svgView drawToContext:context withRect:rect]; - } else { - [node drawRect:rect]; - } - - return YES; - }]; - CGPathRef path = [self getPath:context]; - [self setHitArea:path]; - if (!CGRectEqualToRect(bounds, CGRectNull)) { - self.clientRect = bounds; - self.fillBounds = CGPathGetBoundingBox(path); - self.strokeBounds = CGPathGetBoundingBox(self.strokePath); - self.pathBounds = CGRectUnion(self.fillBounds, self.strokeBounds); - - CGAffineTransform current = CGContextGetCTM(context); - CGAffineTransform svgToClientTransform = CGAffineTransformConcat(current, self.svgView.invInitialCTM); - - self.ctm = svgToClientTransform; - self.screenCTM = current; - - CGAffineTransform transform = CGAffineTransformConcat(self.matrix, self.transforms); - CGPoint mid = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); - CGPoint center = CGPointApplyAffineTransform(mid, transform); - - self.bounds = bounds; - if (!isnan(center.x) && !isnan(center.y)) { - self.center = center; - } - self.frame = bounds; - } - - [self popGlyphContext]; -} - -- (void)setupGlyphContext:(CGContextRef)context -{ - CGRect clipBounds = CGContextGetClipBoundingBox(context); - clipBounds = CGRectApplyAffineTransform(clipBounds, self.matrix); - clipBounds = CGRectApplyAffineTransform(clipBounds, self.transforms); - CGFloat width = CGRectGetWidth(clipBounds); - CGFloat height = CGRectGetHeight(clipBounds); - - _glyphContext = [[ABI46_0_0RNSVGGlyphContext alloc] initWithWidth:width - height:height]; -} - -- (ABI46_0_0RNSVGGlyphContext *)getGlyphContext -{ - return _glyphContext; -} - -- (void)pushGlyphContext -{ - __weak typeof(self) weakSelf = self; - [[self.textRoot getGlyphContext] pushContext:weakSelf font:self.font]; -} - -- (void)popGlyphContext -{ - [[self.textRoot getGlyphContext] popContext]; -} - -- (void)renderPathTo:(CGContextRef)context rect:(CGRect)rect -{ - [super renderLayerTo:context rect:rect]; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGPathRef cached = self.path; - if (cached) { - return cached; - } - CGMutablePathRef __block path = CGPathCreateMutable(); - [self traverseSubviews:^(ABI46_0_0RNSVGNode *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]] && ![node isKindOfClass:[ABI46_0_0RNSVGMask class]]) { - CGAffineTransform transform = CGAffineTransformConcat(node.matrix, node.transforms); - CGPathAddPath(path, &transform, [node getPath:context]); - CGPathAddPath(path, &transform, [node markerPath]); - node.dirty = false; - } - return YES; - }]; - - cached = CGPathRetain(CFAutorelease(path)); - self.path = cached; - return cached; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - CGPoint transformed = CGPointApplyAffineTransform(point, self.invmatrix); - transformed = CGPointApplyAffineTransform(transformed, self.invTransform); - - if (!CGRectContainsPoint(self.pathBounds, transformed)) { - return nil; - } - - if (self.clipPath) { - ABI46_0_0RNSVGClipPath *clipNode = (ABI46_0_0RNSVGClipPath*)[self.svgView getDefinedClipPath:self.clipPath]; - if ([clipNode isSimpleClipPath]) { - CGPathRef clipPath = [self getClipPath]; - if (clipPath && !CGPathContainsPoint(clipPath, nil, transformed, clipNode.clipRule == kRNSVGCGFCRuleEvenodd)) { - return nil; - } - } else { - ABI46_0_0RNSVGRenderable *clipGroup = (ABI46_0_0RNSVGRenderable*)clipNode; - if (![clipGroup hitTest:transformed withEvent:event]) { - return nil; - } - } - } - - if (!event) { - NSPredicate *const anyActive = [NSPredicate predicateWithFormat:@"self isKindOfClass: %@ AND active == TRUE", [ABI46_0_0RNSVGNode class]]; - NSArray *const filtered = [self.subviews filteredArrayUsingPredicate:anyActive]; - if ([filtered count] != 0) { - return [filtered.lastObject hitTest:transformed withEvent:event]; - } - } - - for (ABI46_0_0RNSVGView *node in [self.subviews reverseObjectEnumerator]) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - if ([node isKindOfClass:[ABI46_0_0RNSVGMask class]]) { - continue; - } - ABI46_0_0RNSVGNode* svgNode = (ABI46_0_0RNSVGNode*)node; - if (event) { - svgNode.active = NO; - } - ABI46_0_0RNSVGPlatformView *hitChild = [svgNode hitTest:transformed withEvent:event]; - if (hitChild) { - svgNode.active = YES; - return (svgNode.responsible || (svgNode != hitChild)) ? hitChild : self; - } - } else if ([node isKindOfClass:[ABI46_0_0RNSVGSvgView class]]) { - ABI46_0_0RNSVGSvgView* svgView = (ABI46_0_0RNSVGSvgView*)node; - ABI46_0_0RNSVGPlatformView *hitChild = [svgView hitTest:transformed withEvent:event]; - if (hitChild) { - return hitChild; - } - } - } - - ABI46_0_0RNSVGPlatformView *hitSelf = [super hitTest:transformed withEvent:event]; - if (hitSelf) { - return hitSelf; - } - - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - if (self.name) { - typeof(self) __weak weakSelf = self; - [self.svgView defineTemplate:weakSelf templateName:self.name]; - } - - [self traverseSubviews:^(ABI46_0_0RNSVGNode *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - [node parseReference]; - } - return YES; - }]; -} - -- (void)resetProperties -{ - [self traverseSubviews:^(__kindof ABI46_0_0RNSVGNode *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)node resetProperties]; - } - return YES; - }]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.h deleted file mode 100644 index 7c12e8df6c8db9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.h +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import -#import "ABI46_0_0RNSVGRenderable.h" -#import "ABI46_0_0RNSVGVBMOS.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGImage : ABI46_0_0RNSVGRenderable - -@property (nonatomic, weak) ABI46_0_0RCTBridge *bridge; -@property (nonatomic, assign) id src; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* imagewidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* imageheight; -@property (nonatomic, strong) NSString *align; -@property (nonatomic, assign) ABI46_0_0RNSVGVBMOS meetOrSlice; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.m deleted file mode 100644 index ab3d80e8844cae..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGImage.m +++ /dev/null @@ -1,194 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGImage.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import - -#if __has_include() - -#import - -#else - -#import -#import -#import -#import - -#endif - -#import -#import "ABI46_0_0RNSVGViewBox.h" - -@implementation ABI46_0_0RNSVGImage -{ - CGImageRef _image; - CGSize _imageSize; - ABI46_0_0RCTImageLoaderCancellationBlock _reloadImageCancellationBlock; -} - -- (void)setSrc:(id)src -{ - if (src == _src) { - return; - } - _src = src; - CGImageRelease(_image); - _image = nil; - ABI46_0_0RCTImageSource *source = [ABI46_0_0RCTConvert ABI46_0_0RCTImageSource:src]; - if (source.size.width != 0 && source.size.height != 0) { - _imageSize = source.size; - } else { - _imageSize = CGSizeMake(0, 0); - } - - ABI46_0_0RCTImageLoaderCancellationBlock previousCancellationBlock = _reloadImageCancellationBlock; - if (previousCancellationBlock) { - previousCancellationBlock(); - _reloadImageCancellationBlock = nil; - } - - _reloadImageCancellationBlock = [[self.bridge moduleForName:@"ImageLoader"] loadImageWithURLRequest:[ABI46_0_0RCTConvert NSURLRequest:src] callback:^(NSError *error, UIImage *image) { - dispatch_async(dispatch_get_main_queue(), ^{ - self->_image = CGImageRetain(image.CGImage); - self->_imageSize = CGSizeMake(CGImageGetWidth(self->_image), CGImageGetHeight(self->_image)); - [self invalidate]; - }); - }]; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - [self invalidate]; - _x = x; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - [self invalidate]; - _y = y; -} - -- (void)setImagewidth:(ABI46_0_0RNSVGLength *)width -{ - if ([width isEqualTo:_imagewidth]) { - return; - } - [self invalidate]; - _imagewidth = width; -} - -- (void)setImageheight:(ABI46_0_0RNSVGLength *)height -{ - if ([height isEqualTo:_imageheight]) { - return; - } - [self invalidate]; - _imageheight = height; -} - -- (void)setAlign:(NSString *)align -{ - if ([align isEqualToString:_align]) { - return; - } - [self invalidate]; - _align = align; -} - -- (void)setMeetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - if (meetOrSlice == _meetOrSlice) { - return; - } - [self invalidate]; - _meetOrSlice = meetOrSlice; -} - -- (void)dealloc -{ - CGImageRelease(_image); -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - if (CGSizeEqualToSize(CGSizeZero, _imageSize)) { - return; - } - CGContextSaveGState(context); - - // add hit area - CGRect hitArea = [self getHitArea]; - CGPathRef hitAreaPath = CGPathCreateWithRect(hitArea, nil); - [self setHitArea:hitAreaPath]; - CGPathRelease(hitAreaPath); - self.pathBounds = hitArea; - self.fillBounds = hitArea; - self.strokeBounds = hitArea; - - // apply viewBox transform on Image render. - CGRect imageBounds = CGRectMake(0, 0, _imageSize.width, _imageSize.height); - CGAffineTransform viewbox = [ABI46_0_0RNSVGViewBox getTransform:imageBounds eRect:hitArea align:self.align meetOrSlice:self.meetOrSlice]; - - [self clip:context]; - CGContextClipToRect(context, hitArea); - CGContextConcatCTM(context, viewbox); - CGContextTranslateCTM(context, 0, imageBounds.size.height); - CGContextScaleCTM(context, 1, -1); - CGContextDrawImage(context, imageBounds, _image); - CGContextRestoreGState(context); - - CGRect bounds = hitArea; - self.clientRect = bounds; - - CGAffineTransform current = CGContextGetCTM(context); - CGAffineTransform svgToClientTransform = CGAffineTransformConcat(current, self.svgView.invInitialCTM); - - self.ctm = svgToClientTransform; - self.screenCTM = current; - - CGAffineTransform transform = CGAffineTransformConcat(self.matrix, self.transforms); - CGPoint mid = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); - CGPoint center = CGPointApplyAffineTransform(mid, transform); - - self.bounds = bounds; - if (!isnan(center.x) && !isnan(center.y)) { - self.center = center; - } - self.frame = bounds; -} - -- (CGRect)getHitArea -{ - CGFloat x = [self relativeOnWidth:self.x]; - CGFloat y = [self relativeOnHeight:self.y]; - CGFloat width = [self relativeOnWidth:self.imagewidth]; - CGFloat height = [self relativeOnHeight:self.imageheight]; - if (width == 0) { - width = _imageSize.width; - } - if (height == 0) { - height = _imageSize.height; - } - - return CGRectMake(x, y, width, height); -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - return (CGPathRef)CFAutorelease(CGPathCreateWithRect([self getHitArea], nil)); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.h deleted file mode 100644 index c4781f1aa77037..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGLinearGradient : ABI46_0_0RNSVGNode - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x1; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y1; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x2; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y2; -@property (nonatomic, copy) NSArray *gradient; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits gradientUnits; -@property (nonatomic, assign) CGAffineTransform gradientTransform; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.m deleted file mode 100644 index d57282718236ff..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGLinearGradient.m +++ /dev/null @@ -1,109 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGLinearGradient.h" -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGBrushType.h" - -@implementation ABI46_0_0RNSVGLinearGradient - -- (instancetype)init -{ - if (self = [super init]) { - _gradientTransform = CGAffineTransformIdentity; - } - return self; -} - -- (void)setX1:(ABI46_0_0RNSVGLength *)x1 -{ - if ([x1 isEqualTo:_x1]) { - return; - } - - _x1 = x1; - [self invalidate]; -} - -- (void)setY1:(ABI46_0_0RNSVGLength *)y1 -{ - if ([y1 isEqualTo:_y1]) { - return; - } - - _y1 = y1; - [self invalidate]; -} - -- (void)setX2:(ABI46_0_0RNSVGLength *)x2 -{ - if ([x2 isEqualTo:_x2]) { - return; - } - - _x2 = x2; - [self invalidate]; -} - -- (void)setY2:(ABI46_0_0RNSVGLength *)y2 -{ - if ([y2 isEqualTo:_y2]) { - return; - } - - _y2 = y2; - [self invalidate]; -} - -- (void)setGradient:(NSArray *)gradient -{ - if (gradient == _gradient) { - return; - } - - _gradient = gradient; - [self invalidate]; -} - -- (void)setGradientUnits:(ABI46_0_0RNSVGUnits)gradientUnits -{ - if (gradientUnits == _gradientUnits) { - return; - } - - _gradientUnits = gradientUnits; - [self invalidate]; -} - -- (void)setGradientTransform:(CGAffineTransform)gradientTransform -{ - _gradientTransform = gradientTransform; - [self invalidate]; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - NSArray *points = @[self.x1, self.y1, self.x2, self.y2]; - ABI46_0_0RNSVGPainter *painter = [[ABI46_0_0RNSVGPainter alloc] initWithPointsArray:points]; - [painter setUnits:self.gradientUnits]; - [painter setTransform:self.gradientTransform]; - [painter setLinearGradientColors:self.gradient]; - - if (self.gradientUnits == kRNSVGUnitsUserSpaceOnUse) { - [painter setUserSpaceBoundingBox:[self.svgView getContextBounds]]; - } - - [self.svgView definePainter:painter painterName:self.name]; -} -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.h deleted file mode 100644 index 4a738e2216557f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.h +++ /dev/null @@ -1,24 +0,0 @@ - -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGLength.h" -#import "ABI46_0_0RNSVGMarkerPosition.h" - -@interface ABI46_0_0RNSVGMarker : ABI46_0_0RNSVGGroup - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *refX; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *refY; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *markerWidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *markerHeight; -@property (nonatomic, strong) NSString *markerUnits; -@property (nonatomic, strong) NSString *orient; - -@property (nonatomic, assign) CGFloat minX; -@property (nonatomic, assign) CGFloat minY; -@property (nonatomic, assign) CGFloat vbWidth; -@property (nonatomic, assign) CGFloat vbHeight; -@property (nonatomic, strong) NSString *align; -@property (nonatomic, assign) ABI46_0_0RNSVGVBMOS meetOrSlice; - -- (void)renderMarker:(CGContextRef)context rect:(CGRect)rect position:(ABI46_0_0RNSVGMarkerPosition*)position strokeWidth:(CGFloat)strokeWidth; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.m deleted file mode 100644 index 1b48cc00e2b8aa..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMarker.m +++ /dev/null @@ -1,200 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGMarker.h" -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGBrushType.h" -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGViewBox.h" - -@implementation ABI46_0_0RNSVGMarker - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - [self.svgView defineMarker:self markerName:self.name]; - [self traverseSubviews:^(ABI46_0_0RNSVGNode *node) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - [node parseReference]; - } - return YES; - }]; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)refX -{ - if ([refX isEqualTo:_refX]) { - return; - } - - _refX = refX; - [self invalidate]; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)refY -{ - if ([refY isEqualTo:_refY]) { - return; - } - - _refY = refY; - [self invalidate]; -} - -- (void)setMarkerWidth:(ABI46_0_0RNSVGLength *)markerWidth -{ - if ([markerWidth isEqualTo:_markerWidth]) { - return; - } - - _markerWidth = markerWidth; - [self invalidate]; -} - -- (void)setMarkerHeight:(ABI46_0_0RNSVGLength *)markerHeight -{ - if ([markerHeight isEqualTo:_markerHeight]) { - return; - } - - _markerHeight = markerHeight; - [self invalidate]; -} - -- (void)setMarkerUnits:(NSString *)markerUnits -{ - if ([_markerUnits isEqualToString:markerUnits]) { - return; - } - - _markerUnits = markerUnits; - [self invalidate]; -} - -- (void)setOrient:(NSString *)orient -{ - if ([orient isEqualToString:_orient]) { - return; - } - - [self invalidate]; - _orient = orient; -} - -- (void)setMinX:(CGFloat)minX -{ - if (minX == _minX) { - return; - } - - [self invalidate]; - _minX = minX; -} - -- (void)setMinY:(CGFloat)minY -{ - if (minY == _minY) { - return; - } - - [self invalidate]; - _minY = minY; -} - -- (void)setVbWidth:(CGFloat)vbWidth -{ - if (vbWidth == _vbWidth) { - return; - } - - [self invalidate]; - _vbWidth = vbWidth; -} - -- (void)setVbHeight:(CGFloat)vbHeight -{ - if (_vbHeight == vbHeight) { - return; - } - - [self invalidate]; - _vbHeight = vbHeight; -} - -- (void)setAlign:(NSString *)align -{ - if ([align isEqualToString:_align]) { - return; - } - - [self invalidate]; - _align = align; -} - -- (void)setMeetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - if (meetOrSlice == _meetOrSlice) { - return; - } - - [self invalidate]; - _meetOrSlice = meetOrSlice; -} - -static CGFloat ABI46_0_0RNSVG_degToRad = (CGFloat)M_PI / 180; - -double ABI46_0_0deg2rad(CGFloat deg) { - return deg * ABI46_0_0RNSVG_degToRad; -} - -- (void)renderMarker:(CGContextRef)context rect:(CGRect)rect position:(ABI46_0_0RNSVGMarkerPosition*)position strokeWidth:(CGFloat)strokeWidth -{ - CGContextSaveGState(context); - - CGPoint origin = [position origin]; - CGAffineTransform transform = CGAffineTransformMakeTranslation(origin.x, origin.y); - - float markerAngle = [@"auto" isEqualToString:_orient] ? -1 : [_orient doubleValue]; - float angle = 180 + (markerAngle == -1 ? [position angle] : markerAngle); - float rad = ABI46_0_0deg2rad(angle); - transform = CGAffineTransformRotate(transform, rad); - - bool useStrokeWidth = [@"strokeWidth" isEqualToString:_markerUnits]; - if (useStrokeWidth) { - transform = CGAffineTransformScale(transform, strokeWidth, strokeWidth); - } - - CGFloat width = [self relativeOnWidth:self.markerWidth]; - CGFloat height = [self relativeOnHeight:self.markerHeight]; - CGRect eRect = CGRectMake(0, 0, width, height); - if (self.align) { - CGAffineTransform viewBoxTransform = [ABI46_0_0RNSVGViewBox getTransform:CGRectMake(self.minX, self.minY, self.vbWidth, self.vbHeight) - eRect:eRect - align:self.align - meetOrSlice:self.meetOrSlice]; - transform = CGAffineTransformScale(transform, viewBoxTransform.a, viewBoxTransform.d); - } - - CGFloat x = [self relativeOnWidth:self.refX]; - CGFloat y = [self relativeOnHeight:self.refY]; - transform = CGAffineTransformTranslate(transform, -x, -y); - - self.transform = transform; - CGContextConcatCTM(context, transform); - - [self renderGroupTo:context rect:eRect]; - - CGContextRestoreGState(context); -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.h deleted file mode 100644 index 13218f38ad79f8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.h +++ /dev/null @@ -1,15 +0,0 @@ - -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGMask : ABI46_0_0RNSVGGroup - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *maskwidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *maskheight; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits maskUnits; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits maskContentUnits; -@property (nonatomic, assign) CGAffineTransform maskTransform; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.m deleted file mode 100644 index bf15f9e0ce90a7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGMask.m +++ /dev/null @@ -1,93 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGMask.h" -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGBrushType.h" -#import "ABI46_0_0RNSVGNode.h" - -@implementation ABI46_0_0RNSVGMask - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - [self.svgView defineMask:self maskName:self.name]; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - - _x = x; - [self invalidate]; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - - _y = y; - [self invalidate]; -} - -- (void)setMaskwidth:(ABI46_0_0RNSVGLength *)maskwidth -{ - if ([maskwidth isEqualTo:_maskwidth]) { - return; - } - - _maskwidth = maskwidth; - [self invalidate]; -} - -- (void)setMaskheight:(ABI46_0_0RNSVGLength *)maskheight -{ - if ([maskheight isEqualTo:_maskheight]) { - return; - } - - _maskheight = maskheight; - [self invalidate]; -} - -- (void)setMaskUnits:(ABI46_0_0RNSVGUnits)maskUnits -{ - if (maskUnits == _maskUnits) { - return; - } - - _maskUnits = maskUnits; - [self invalidate]; -} - -- (void)setMaskContentUnits:(ABI46_0_0RNSVGUnits)maskContentUnits -{ - if (maskContentUnits == _maskContentUnits) { - return; - } - - _maskContentUnits = maskContentUnits; - [self invalidate]; -} - -- (void)setMaskTransform:(CGAffineTransform)maskTransform -{ - _maskTransform = maskTransform; - [self invalidate]; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.h deleted file mode 100644 index 1d95cd16e27624..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNSVGPathParser.h" -#import "ABI46_0_0RNSVGRenderable.h" - -@interface ABI46_0_0RNSVGPath : ABI46_0_0RNSVGRenderable - -@property (nonatomic, strong) ABI46_0_0RNSVGPathParser *d; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.m deleted file mode 100644 index 117a4845cb09e9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPath.m +++ /dev/null @@ -1,38 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPath.h" - -@implementation ABI46_0_0RNSVGPath -{ - CGPathRef _path; -} - -- (void)setD:(ABI46_0_0RNSVGPathParser *)d -{ - if (d == _d) { - return; - } - - [self invalidate]; - _d = d; - CGPathRelease(_path); - _path = CGPathRetain([d getPath]); -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - return _path; -} - -- (void)dealloc -{ - CGPathRelease(_path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.h deleted file mode 100644 index 2ba8869ff3f554..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.h +++ /dev/null @@ -1,22 +0,0 @@ - -#import "ABI46_0_0RNSVGGroup.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGPattern : ABI46_0_0RNSVGGroup - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *patternwidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *patternheight; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits patternUnits; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits patternContentUnits; -@property (nonatomic, assign) CGAffineTransform patternTransform; - -@property (nonatomic, assign) CGFloat minX; -@property (nonatomic, assign) CGFloat minY; -@property (nonatomic, assign) CGFloat vbWidth; -@property (nonatomic, assign) CGFloat vbHeight; -@property (nonatomic, strong) NSString *align; -@property (nonatomic, assign) ABI46_0_0RNSVGVBMOS meetOrSlice; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.m deleted file mode 100644 index bd23f77b41ffea..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGPattern.m +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGPattern.h" -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGBrushType.h" -#import "ABI46_0_0RNSVGNode.h" - -@implementation ABI46_0_0RNSVGPattern - -- (instancetype)init -{ - if (self = [super init]) { - _patternTransform = CGAffineTransformIdentity; - } - return self; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - NSArray *points = @[self.x, self.y, self.patternwidth, self.patternheight]; - ABI46_0_0RNSVGPainter *painter = [[ABI46_0_0RNSVGPainter alloc] initWithPointsArray:points]; - [painter setUnits:self.patternUnits]; - [painter setContentUnits:self.patternContentUnits]; - [painter setTransform:self.patternTransform]; - [painter setPattern:self]; - - if (self.patternUnits == kRNSVGUnitsUserSpaceOnUse || self.patternContentUnits == kRNSVGUnitsUserSpaceOnUse) { - [painter setUserSpaceBoundingBox:[self.svgView getContextBounds]]; - } - - [self.svgView definePainter:painter painterName:self.name]; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - - _x = x; - [self invalidate]; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - - _y = y; - [self invalidate]; -} - -- (void)setPatternwidth:(ABI46_0_0RNSVGLength *)patternwidth -{ - if ([patternwidth isEqualTo:_patternwidth]) { - return; - } - - _patternwidth = patternwidth; - [self invalidate]; -} - -- (void)setPatternheight:(ABI46_0_0RNSVGLength *)patternheight -{ - if ([patternheight isEqualTo:_patternheight]) { - return; - } - - _patternheight = patternheight; - [self invalidate]; -} - -- (void)setPatternUnits:(ABI46_0_0RNSVGUnits)patternUnits -{ - if (patternUnits == _patternUnits) { - return; - } - - _patternUnits = patternUnits; - [self invalidate]; -} - -- (void)setPatternContentUnits:(ABI46_0_0RNSVGUnits)patternContentUnits -{ - if (patternContentUnits == _patternContentUnits) { - return; - } - - _patternContentUnits = patternContentUnits; - [self invalidate]; -} - -- (void)setPatternTransform:(CGAffineTransform)patternTransform -{ - _patternTransform = patternTransform; - [self invalidate]; -} - -- (void)setMinX:(CGFloat)minX -{ - if (minX == _minX) { - return; - } - - [self invalidate]; - _minX = minX; -} - -- (void)setMinY:(CGFloat)minY -{ - if (minY == _minY) { - return; - } - - [self invalidate]; - _minY = minY; -} - -- (void)setVbWidth:(CGFloat)vbWidth -{ - if (vbWidth == _vbWidth) { - return; - } - - [self invalidate]; - _vbWidth = vbWidth; -} - -- (void)setVbHeight:(CGFloat)vbHeight -{ - if (_vbHeight == vbHeight) { - return; - } - - [self invalidate]; - _vbHeight = vbHeight; -} - -- (void)setAlign:(NSString *)align -{ - if ([align isEqualToString:_align]) { - return; - } - - [self invalidate]; - _align = align; -} - -- (void)setMeetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - if (meetOrSlice == _meetOrSlice) { - return; - } - - [self invalidate]; - _meetOrSlice = meetOrSlice; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.h deleted file mode 100644 index fd3276d5e62bab..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGRadialGradient : ABI46_0_0RNSVGNode - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *fx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *fy; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *rx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *ry; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *cx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *cy; -@property (nonatomic, copy) NSArray *gradient; -@property (nonatomic, assign) ABI46_0_0RNSVGUnits gradientUnits; -@property (nonatomic, assign) CGAffineTransform gradientTransform; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.m deleted file mode 100644 index adc8c35b72f5bf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGRadialGradient.m +++ /dev/null @@ -1,128 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGRadialGradient.h" - -@implementation ABI46_0_0RNSVGRadialGradient - -- (instancetype)init -{ - if (self = [super init]) { - _gradientTransform = CGAffineTransformIdentity; - } - return self; -} - -- (void)setFx:(ABI46_0_0RNSVGLength *)fx -{ - if ([fx isEqualTo:_fx]) { - return; - } - - _fx = fx; - [self invalidate]; -} - -- (void)setFy:(ABI46_0_0RNSVGLength *)fy -{ - if ([fy isEqualTo:_fy]) { - return; - } - - _fy = fy; - [self invalidate]; -} - -- (void)setRx:(ABI46_0_0RNSVGLength *)rx -{ - if ([rx isEqualTo:_rx]) { - return; - } - - _rx = rx; - [self invalidate]; -} - -- (void)setRy:(ABI46_0_0RNSVGLength *)ry -{ - if ([ry isEqualTo:_ry]) { - return; - } - - _ry = ry; - [self invalidate]; -} - -- (void)setCx:(ABI46_0_0RNSVGLength *)cx -{ - if ([cx isEqualTo:_cx]) { - return; - } - - _cx = cx; - [self invalidate]; -} - -- (void)setCy:(ABI46_0_0RNSVGLength *)cy -{ - if ([cy isEqualTo:_cy]) { - return; - } - - _cy = cy; - [self invalidate]; -} - -- (void)setGradient:(NSArray *)gradient -{ - if (gradient == _gradient) { - return; - } - - _gradient = gradient; - [self invalidate]; -} - -- (void)setGradientUnits:(ABI46_0_0RNSVGUnits)gradientUnits -{ - if (gradientUnits == _gradientUnits) { - return; - } - - _gradientUnits = gradientUnits; - [self invalidate]; -} - -- (void)setGradientTransform:(CGAffineTransform)gradientTransform -{ - _gradientTransform = gradientTransform; - [self invalidate]; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - return nil; -} - -- (void)parseReference -{ - self.dirty = false; - NSArray *points = @[self.fx, self.fy, self.rx, self.ry, self.cx, self.cy]; - ABI46_0_0RNSVGPainter *painter = [[ABI46_0_0RNSVGPainter alloc] initWithPointsArray:points]; - [painter setUnits:self.gradientUnits]; - [painter setTransform:self.gradientTransform]; - [painter setRadialGradientColors:self.gradient]; - - if (self.gradientUnits == kRNSVGUnitsUserSpaceOnUse) { - [painter setUserSpaceBoundingBox:[self.svgView getContextBounds]]; - } - - [self.svgView definePainter:painter painterName:self.name]; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.h deleted file mode 100644 index 12caad04e23363..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGPainter.h" -#import "ABI46_0_0RNSVGContainer.h" -#import "ABI46_0_0RNSVGVBMOS.h" - -@class ABI46_0_0RNSVGNode; - -@interface ABI46_0_0RNSVGSvgView : ABI46_0_0RNSVGView - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *bbWidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *bbHeight; -@property (nonatomic, assign) CGFloat minX; -@property (nonatomic, assign) CGFloat minY; -@property (nonatomic, assign) CGFloat vbWidth; -@property (nonatomic, assign) CGFloat vbHeight; -@property (nonatomic, strong) NSString *align; -@property (nonatomic, assign) ABI46_0_0RNSVGVBMOS meetOrSlice; -@property (nonatomic, assign) BOOL responsible; -@property (nonatomic, assign) BOOL active; -@property (nonatomic, assign) CGRect boundingBox; -@property (nonatomic, assign) CGAffineTransform initialCTM; -@property (nonatomic, assign) CGAffineTransform invInitialCTM; -@property (nonatomic, assign) CGAffineTransform viewBoxTransform; - -/** - * define content as clipPath template. - */ -- (void)defineClipPath:(__kindof ABI46_0_0RNSVGNode *)clipPath clipPathName:(NSString *)clipPathName; - -- (ABI46_0_0RNSVGNode *)getDefinedClipPath:(NSString *)clipPathName; - -- (void)defineTemplate:(__kindof ABI46_0_0RNSVGNode *)template templateName:(NSString *)templateName; - -- (ABI46_0_0RNSVGNode *)getDefinedTemplate:(NSString *)templateName; - -- (void)definePainter:(ABI46_0_0RNSVGPainter *)painter painterName:(NSString *)painterName; - -- (ABI46_0_0RNSVGPainter *)getDefinedPainter:(NSString *)painterName; - -- (void)defineMarker:(ABI46_0_0RNSVGNode *)marker markerName:(NSString *)markerName; - -- (ABI46_0_0RNSVGNode *)getDefinedMarker:(NSString *)markerName; - -- (void)defineMask:(ABI46_0_0RNSVGNode *)mask maskName:(NSString *)maskName; - -- (ABI46_0_0RNSVGNode *)getDefinedMask:(NSString *)maskName; - -- (NSString *)getDataURL; - -- (NSString *)getDataURLwithBounds:(CGRect)bounds; - -- (CGRect)getContextBounds; - -- (void)drawRect:(CGRect)rect; - -- (void)drawToContext:(CGContextRef)context withRect:(CGRect)rect; - -- (CGAffineTransform)getViewBoxTransform; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.m deleted file mode 100644 index 9db0d1c5810628..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSvgView.m +++ /dev/null @@ -1,365 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGSvgView.h" -#import "ABI46_0_0RNSVGViewBox.h" -#import "ABI46_0_0RNSVGNode.h" -#import - -@implementation ABI46_0_0RNSVGSvgView -{ - NSMutableDictionary *_clipPaths; - NSMutableDictionary *_templates; - NSMutableDictionary *_painters; - NSMutableDictionary *_markers; - NSMutableDictionary *_masks; - CGAffineTransform _invviewBoxTransform; - bool rendered; -} - -- (instancetype)initWithFrame:(CGRect)frame -{ - if (self = [super initWithFrame:frame]) { -#if !TARGET_OS_OSX // Not available on macOS - // This is necessary to ensure that [self setNeedsDisplay] actually triggers - // a redraw when our parent transitions between hidden and visible. - self.contentMode = UIViewContentModeRedraw; -#endif - rendered = false; - } - return self; -} - -- (void)insertABI46_0_0ReactSubview:(ABI46_0_0RNSVGView *)subview atIndex:(NSInteger)atIndex -{ - [super insertABI46_0_0ReactSubview:subview atIndex:atIndex]; - [self insertSubview:subview atIndex:atIndex]; - [self invalidate]; -} - -- (void)removeABI46_0_0ReactSubview:(ABI46_0_0RNSVGView *)subview -{ - [super removeABI46_0_0ReactSubview:subview]; - [self invalidate]; -} - -- (void)didUpdateABI46_0_0ReactSubviews -{ - // Do nothing, as subviews are inserted by insertABI46_0_0ReactSubview: -} - -- (void)clearChildCache -{ - if (!rendered) { - return; - } - rendered = false; - for (__kindof ABI46_0_0RNSVGNode *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - [node clearChildCache]; - } - } -} - -- (void)invalidate -{ - ABI46_0_0RNSVGPlatformView* parent = self.superview; - if ([parent isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - if (!rendered) { - return; - } - ABI46_0_0RNSVGNode* svgNode = (ABI46_0_0RNSVGNode*)parent; - [svgNode invalidate]; - rendered = false; - return; - } - [self setNeedsDisplay]; -} - -- (void)tintColorDidChange -{ - [self invalidate]; - [self clearChildCache]; -} - -- (void)setMinX:(CGFloat)minX -{ - if (minX == _minX) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _minX = minX; -} - -- (void)setMinY:(CGFloat)minY -{ - if (minY == _minY) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _minY = minY; -} - -- (void)setVbWidth:(CGFloat)vbWidth -{ - if (vbWidth == _vbWidth) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _vbWidth = vbWidth; -} - -- (void)setVbHeight:(CGFloat)vbHeight -{ - if (_vbHeight == vbHeight) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _vbHeight = vbHeight; -} - -- (void)setBbWidth:(ABI46_0_0RNSVGLength *)bbWidth -{ - if ([bbWidth isEqualTo:_bbWidth]) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _bbWidth = bbWidth; -} - -- (void)setBbHeight:(ABI46_0_0RNSVGLength *)bbHeight -{ - if ([bbHeight isEqualTo:_bbHeight]) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _bbHeight = bbHeight; -} - -- (void)setAlign:(NSString *)align -{ - if ([align isEqualToString:_align]) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _align = align; -} - -- (void)setMeetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - if (meetOrSlice == _meetOrSlice) { - return; - } - - [self invalidate]; - [self clearChildCache]; - _meetOrSlice = meetOrSlice; -} - -- (void)drawToContext:(CGContextRef)context withRect:(CGRect)rect { - rendered = true; - self.initialCTM = CGContextGetCTM(context); - self.invInitialCTM = CGAffineTransformInvert(self.initialCTM); - if (self.align) { - CGRect tRect = CGRectMake(self.minX, self.minY, self.vbWidth, self.vbHeight); - _viewBoxTransform = [ABI46_0_0RNSVGViewBox getTransform:tRect - eRect:rect - align:self.align - meetOrSlice:self.meetOrSlice]; - _invviewBoxTransform = CGAffineTransformInvert(_viewBoxTransform); - CGContextConcatCTM(context, _viewBoxTransform); - } else { - _viewBoxTransform = CGAffineTransformIdentity; - _invviewBoxTransform = CGAffineTransformIdentity; - } - - for (ABI46_0_0RNSVGView *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - ABI46_0_0RNSVGNode *svg = (ABI46_0_0RNSVGNode *)node; - [svg renderTo:context - rect:rect]; - } else { - [node drawRect:rect]; - } - } -} - -- (void)drawRect:(CGRect)rect -{ - ABI46_0_0RNSVGPlatformView* parent = self.superview; - if ([parent isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - return; - } - rendered = true; - _clipPaths = nil; - _templates = nil; - _painters = nil; - _boundingBox = rect; - CGContextRef context = UIGraphicsGetCurrentContext(); - - for (ABI46_0_0RNSVGPlatformView *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - ABI46_0_0RNSVGNode *svg = (ABI46_0_0RNSVGNode *)node; - if (svg.responsible && !self.responsible) { - self.responsible = YES; - } - - [svg parseReference]; - } - } - - [self drawToContext:context withRect:rect]; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event -{ - CGPoint transformed = point; - if (self.align) { - transformed = CGPointApplyAffineTransform(transformed, _invviewBoxTransform); - } - for (ABI46_0_0RNSVGNode *node in [self.subviews reverseObjectEnumerator]) { - if (![node isKindOfClass:[ABI46_0_0RNSVGNode class]]) { - continue; - } - - if (event) { - node.active = NO; - } - - ABI46_0_0RNSVGPlatformView *hitChild = [node hitTest:transformed withEvent:event]; - - if (hitChild) { - node.active = YES; - return (node.responsible || (node != hitChild)) ? hitChild : self; - } - } - return nil; -} - -- (NSString *)getDataURL -{ - UIGraphicsBeginImageContextWithOptions(_boundingBox.size, NO, 0); - [self clearChildCache]; - [self drawRect:_boundingBox]; - [self clearChildCache]; - [self invalidate]; - NSData *imageData = UIImagePNGRepresentation(UIGraphicsGetImageFromCurrentImageContext()); - NSString *base64 = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; - UIGraphicsEndImageContext(); - return base64; -} - -- (NSString *)getDataURLwithBounds:(CGRect)bounds -{ - UIGraphicsBeginImageContextWithOptions(bounds.size, NO, 1); - [self clearChildCache]; - [self drawRect:bounds]; - [self clearChildCache]; - [self invalidate]; - NSData *imageData = UIImagePNGRepresentation(UIGraphicsGetImageFromCurrentImageContext()); - NSString *base64 = [imageData base64EncodedStringWithOptions:NSDataBase64Encoding64CharacterLineLength]; - UIGraphicsEndImageContext(); - return base64; -} - -- (void)ABI46_0_0ReactSetInheritedBackgroundColor:(ABI46_0_0RNSVGColor *)inheritedBackgroundColor -{ - self.backgroundColor = inheritedBackgroundColor; -} - -- (void)defineClipPath:(__kindof ABI46_0_0RNSVGNode *)clipPath clipPathName:(NSString *)clipPathName -{ - if (!_clipPaths) { - _clipPaths = [[NSMutableDictionary alloc] init]; - } - [_clipPaths setObject:clipPath forKey:clipPathName]; -} - -- (ABI46_0_0RNSVGNode *)getDefinedClipPath:(NSString *)clipPathName -{ - return _clipPaths ? [_clipPaths objectForKey:clipPathName] : nil; -} - -- (void)defineTemplate:(ABI46_0_0RNSVGNode *)template templateName:(NSString *)templateName -{ - if (!_templates) { - _templates = [[NSMutableDictionary alloc] init]; - } - [_templates setObject:template forKey:templateName]; -} - -- (ABI46_0_0RNSVGNode *)getDefinedTemplate:(NSString *)templateName -{ - return _templates ? [_templates objectForKey:templateName] : nil; -} - - -- (void)definePainter:(ABI46_0_0RNSVGPainter *)painter painterName:(NSString *)painterName -{ - if (!_painters) { - _painters = [[NSMutableDictionary alloc] init]; - } - [_painters setObject:painter forKey:painterName]; -} - -- (ABI46_0_0RNSVGPainter *)getDefinedPainter:(NSString *)painterName; -{ - return _painters ? [_painters objectForKey:painterName] : nil; -} - -- (void)defineMarker:(ABI46_0_0RNSVGNode *)marker markerName:(NSString *)markerName -{ - if (!_markers) { - _markers = [[NSMutableDictionary alloc] init]; - } - [_markers setObject:marker forKey:markerName]; -} - -- (ABI46_0_0RNSVGNode *)getDefinedMarker:(NSString *)markerName; -{ - return _markers ? [_markers objectForKey:markerName] : nil; -} - -- (void)defineMask:(ABI46_0_0RNSVGNode *)mask maskName:(NSString *)maskName -{ - if (!_masks) { - _masks = [[NSMutableDictionary alloc] init]; - } - [_masks setObject:mask forKey:maskName]; -} - -- (ABI46_0_0RNSVGNode *)getDefinedMask:(NSString *)maskName; -{ - return _masks ? [_masks objectForKey:maskName] : nil; -} - -- (CGRect)getContextBounds -{ - return CGContextGetClipBoundingBox(UIGraphicsGetCurrentContext()); -} - -- (CGAffineTransform)getViewBoxTransform -{ - return _viewBoxTransform; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.h deleted file mode 100644 index 7a8cc5f08cf95a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.h +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroup.h" - -/** - * ABI46_0_0RNSVG defination are implemented as abstract UIViews for all elements inside Defs. - */ - -@interface ABI46_0_0RNSVGSymbol : ABI46_0_0RNSVGGroup - -@property (nonatomic, assign) CGFloat minX; -@property (nonatomic, assign) CGFloat minY; -@property (nonatomic, assign) CGFloat vbWidth; -@property (nonatomic, assign) CGFloat vbHeight; -@property (nonatomic, strong) NSString *align; -@property (nonatomic, assign) ABI46_0_0RNSVGVBMOS meetOrSlice; - -- (void)renderSymbolTo:(CGContextRef)context width:(CGFloat)width height:(CGFloat)height; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.m deleted file mode 100644 index b7bdcb40c2dcc2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGSymbol.m +++ /dev/null @@ -1,97 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGSymbol.h" -#import "ABI46_0_0RNSVGViewBox.h" - -@class ABI46_0_0RNSVGNode; - -@implementation ABI46_0_0RNSVGSymbol - -- (void)setMinX:(CGFloat)minX -{ - if (minX == _minX) { - return; - } - - [self invalidate]; - _minX = minX; -} - -- (void)setMinY:(CGFloat)minY -{ - if (minY == _minY) { - return; - } - - [self invalidate]; - _minY = minY; -} - -- (void)setVbWidth:(CGFloat)vbWidth -{ - if (vbWidth == _vbWidth) { - return; - } - - [self invalidate]; - _vbWidth = vbWidth; -} - -- (void)setVbHeight:(CGFloat)vbHeight -{ - if (_vbHeight == vbHeight) { - return; - } - - [self invalidate]; - _vbHeight = vbHeight; -} - -- (void)setAlign:(NSString *)align -{ - if ([align isEqualToString:_align]) { - return; - } - - [self invalidate]; - _align = align; -} - -- (void)setMeetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - if (meetOrSlice == _meetOrSlice) { - return; - } - - [self invalidate]; - _meetOrSlice = meetOrSlice; -} - -- (void)renderTo:(CGContextRef)context rect:(CGRect)rect -{ - self.dirty = false; - // Do not render Symbol -} - -- (void)renderSymbolTo:(CGContextRef)context width:(CGFloat)width height:(CGFloat)height -{ - CGRect eRect = CGRectMake(0, 0, width, height); - if (self.align) { - - CGAffineTransform viewBoxTransform = [ABI46_0_0RNSVGViewBox getTransform:CGRectMake(self.minX, self.minY, self.vbWidth, self.vbHeight) - eRect:eRect - align:self.align - meetOrSlice:self.meetOrSlice]; - - CGContextConcatCTM(context, viewBoxTransform); - } - [self renderGroupTo:context rect:eRect]; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.h deleted file mode 100644 index f084d2dadf98d8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderable.h" -#import "ABI46_0_0RNSVGLength.h" - -/** - * ABI46_0_0RNSVG defination are implemented as abstract UIViews for all elements inside Defs. - */ - -@interface ABI46_0_0RNSVGUse : ABI46_0_0RNSVGRenderable - -@property (nonatomic, strong) NSString *href; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *usewidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *useheight; -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.m deleted file mode 100644 index ac19357aa70133..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Elements/ABI46_0_0RNSVGUse.m +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGUse.h" -#import "ABI46_0_0RNSVGSymbol.h" -#import - -@implementation ABI46_0_0RNSVGUse - -- (void)setHref:(NSString *)href -{ - if ([href isEqualToString:_href]) { - return; - } - - [self invalidate]; - _href = href; -} - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - - [self invalidate]; - _x = x; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - - [self invalidate]; - _y = y; -} - - -- (void)setUsewidth:(ABI46_0_0RNSVGLength *)usewidth -{ - if ([usewidth isEqualTo:_usewidth]) { - return; - } - - [self invalidate]; - _usewidth = usewidth; -} - -- (void)setUseheight:(ABI46_0_0RNSVGLength *)useheight -{ - if ([useheight isEqualTo:_useheight]) { - return; - } - - [self invalidate]; - _useheight = useheight; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - CGContextTranslateCTM(context, [self relativeOnWidth:self.x], [self relativeOnHeight:self.y]); - ABI46_0_0RNSVGNode* template = [self.svgView getDefinedTemplate:self.href]; - if (template) { - [self beginTransparencyLayer:context]; - [self clip:context]; - - if ([template isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)template mergeProperties:self]; - } - - if ([template class] == [ABI46_0_0RNSVGSymbol class]) { - ABI46_0_0RNSVGSymbol *symbol = (ABI46_0_0RNSVGSymbol*)template; - [symbol renderSymbolTo:context width:[self relativeOnWidth:self.usewidth] height:[self relativeOnHeight:self.useheight]]; - } else { - [template renderTo:context rect:rect]; - } - - if ([template isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - [(ABI46_0_0RNSVGRenderable*)template resetProperties]; - } - - [self endTransparencyLayer:context]; - } else if (self.href) { - // TODO: calling yellow box here - ABI46_0_0RCTLogWarn(@"`Use` element expected a pre-defined svg template as `href` prop, template named: %@ is not defined.", self.href); - return; - } else { - return; - } - CGRect bounds = template.clientRect; - self.clientRect = bounds; - - CGAffineTransform current = CGContextGetCTM(context); - CGAffineTransform svgToClientTransform = CGAffineTransformConcat(current, self.svgView.invInitialCTM); - - self.ctm = svgToClientTransform; - self.screenCTM = current; - - CGAffineTransform transform = CGAffineTransformConcat(self.matrix, self.transforms); - CGPoint mid = CGPointMake(CGRectGetMidX(bounds), CGRectGetMidY(bounds)); - CGPoint center = CGPointApplyAffineTransform(mid, transform); - - self.bounds = bounds; - if (!isnan(center.x) && !isnan(center.y)) { - self.center = center; - } - self.frame = bounds; -} - -- (ABI46_0_0RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event { - CGPoint transformed = CGPointApplyAffineTransform(point, self.invmatrix); - transformed = CGPointApplyAffineTransform(transformed, self.invTransform); - ABI46_0_0RNSVGNode const* template = [self.svgView getDefinedTemplate:self.href]; - if (event) { - self.active = NO; - } else if (self.active) { - return self; - } - ABI46_0_0RNSVGPlatformView const* hitChild = [template hitTest:transformed withEvent:event]; - if (hitChild) { - self.active = YES; - return self; - } - return nil; -} - -- (CGPathRef)getPath: (CGContextRef)context -{ - CGAffineTransform transform = CGAffineTransformMakeTranslation([self relativeOnWidth:self.x], [self relativeOnHeight:self.y]); - ABI46_0_0RNSVGNode const* template = [self.svgView getDefinedTemplate:self.href]; - if (!template) { - return nil; - } - CGPathRef path = [template getPath:context]; - return CGPathCreateCopyByTransformingPath(path, &transform); -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.h deleted file mode 100644 index 6a2b8aa826e8ac..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGPath.h" - -@interface ABI46_0_0RNSVGCircle : ABI46_0_0RNSVGRenderable - -@property (nonatomic, strong) ABI46_0_0RNSVGLength* cx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* cy; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* r; - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.m deleted file mode 100644 index 8b80449336f81d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGCircle.m +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGCircle.h" -#import - -@implementation ABI46_0_0RNSVGCircle - -- (void)setCx:(ABI46_0_0RNSVGLength *)cx -{ - if ([cx isEqualTo:_cx]) { - return; - } - [self invalidate]; - _cx = cx; -} - -- (void)setCy:(ABI46_0_0RNSVGLength *)cy -{ - if ([cy isEqualTo:_cy]) { - return; - } - [self invalidate]; - _cy = cy; -} - -- (void)setR:(ABI46_0_0RNSVGLength *)r -{ - if ([r isEqualTo:_r]) { - return; - } - [self invalidate]; - _r = r; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGMutablePathRef path = CGPathCreateMutable(); - CGFloat cx = [self relativeOnWidth:self.cx]; - CGFloat cy = [self relativeOnHeight:self.cy]; - CGFloat r = [self relativeOnOther:self.r]; - CGPathAddArc(path, nil, cx, cy, r, 0, 2 * (CGFloat)M_PI, NO); - return (CGPathRef)CFAutorelease(path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.h deleted file mode 100644 index 76289b4567af97..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGPath.h" - -@interface ABI46_0_0RNSVGEllipse : ABI46_0_0RNSVGRenderable -@property (nonatomic, strong) ABI46_0_0RNSVGLength* cx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* cy; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* rx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* ry; -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.m deleted file mode 100644 index 266e61059d71c8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGEllipse.m +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGEllipse.h" -#import - -@implementation ABI46_0_0RNSVGEllipse - -- (void)setCx:(ABI46_0_0RNSVGLength *)cx -{ - if ([cx isEqualTo:_cx]) { - return; - } - [self invalidate]; - _cx = cx; -} - -- (void)setCy:(ABI46_0_0RNSVGLength *)cy -{ - if ([cy isEqualTo:_cy]) { - return; - } - [self invalidate]; - _cy = cy; -} - -- (void)setRx:(ABI46_0_0RNSVGLength *)rx -{ - if ([rx isEqualTo:_rx]) { - return; - } - [self invalidate]; - _rx = rx; -} - -- (void)setRy:(ABI46_0_0RNSVGLength *)ry -{ - if ([ry isEqualTo:_ry]) { - return; - } - [self invalidate]; - _ry = ry; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGMutablePathRef path = CGPathCreateMutable(); - CGFloat cx = [self relativeOnWidth:self.cx]; - CGFloat cy = [self relativeOnHeight:self.cy]; - CGFloat rx = [self relativeOnWidth:self.rx]; - CGFloat ry = [self relativeOnHeight:self.ry]; - CGPathAddEllipseInRect(path, nil, CGRectMake(cx - rx, cy - ry, rx * 2, ry * 2)); - return (CGPathRef)CFAutorelease(path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.h deleted file mode 100644 index 7f309d24e30978..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGPath.h" - -@interface ABI46_0_0RNSVGLine : ABI46_0_0RNSVGRenderable -@property (nonatomic, strong) ABI46_0_0RNSVGLength* x1; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* y1; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* x2; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* y2; -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.m deleted file mode 100644 index d5e53f898225ee..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGLine.m +++ /dev/null @@ -1,63 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGLine.h" -#import - -@implementation ABI46_0_0RNSVGLine - -- (void)setX1:(ABI46_0_0RNSVGLength *)x1 -{ - if ([x1 isEqualTo:_x1]) { - return; - } - [self invalidate]; - _x1 = x1; -} - -- (void)setY1:(ABI46_0_0RNSVGLength *)y1 -{ - if ([y1 isEqualTo:_y1]) { - return; - } - [self invalidate]; - _y1 = y1; -} - -- (void)setX2:(ABI46_0_0RNSVGLength *)x2 -{ - if ([x2 isEqualTo:_x2]) { - return; - } - [self invalidate]; - _x2 = x2; -} - -- (void)setY2:(ABI46_0_0RNSVGLength *)y2 -{ - if ([y2 isEqualTo:_y2]) { - return; - } - [self invalidate]; - _y2 = y2; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGMutablePathRef path = CGPathCreateMutable(); - CGFloat x1 = [self relativeOnWidth:self.x1]; - CGFloat y1 = [self relativeOnHeight:self.y1]; - CGFloat x2 = [self relativeOnWidth:self.x2]; - CGFloat y2 = [self relativeOnHeight:self.y2]; - CGPathMoveToPoint(path, nil, x1, y1); - CGPathAddLineToPoint(path, nil, x2, y2); - - return (CGPathRef)CFAutorelease(path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.h deleted file mode 100644 index 33596a520cf8f1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import "ABI46_0_0RNSVGPath.h" - -@interface ABI46_0_0RNSVGRect : ABI46_0_0RNSVGRenderable - -@property (nonatomic, strong) ABI46_0_0RNSVGLength* x; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* y; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* rectwidth; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* rectheight; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* rx; -@property (nonatomic, strong) ABI46_0_0RNSVGLength* ry; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.m deleted file mode 100644 index 053633e118af7d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Shapes/ABI46_0_0RNSVGRect.m +++ /dev/null @@ -1,106 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRect.h" -#import - -@implementation ABI46_0_0RNSVGRect - -- (void)setX:(ABI46_0_0RNSVGLength *)x -{ - if ([x isEqualTo:_x]) { - return; - } - [self invalidate]; - _x = x; -} - -- (void)setY:(ABI46_0_0RNSVGLength *)y -{ - if ([y isEqualTo:_y]) { - return; - } - [self invalidate]; - _y = y; -} - -- (void)setRectwidth:(ABI46_0_0RNSVGLength *)rectwidth -{ - if ([rectwidth isEqualTo:_rectwidth]) { - return; - } - [self invalidate]; - _rectwidth = rectwidth; -} - -- (void)setRectheight:(ABI46_0_0RNSVGLength *)rectheight -{ - if ([rectheight isEqualTo:_rectheight]) { - return; - } - [self invalidate]; - _rectheight = rectheight; -} - -- (void)setRx:(ABI46_0_0RNSVGLength *)rx -{ - if ([rx isEqualTo:_rx]) { - return; - } - [self invalidate]; - _rx = rx; -} - -- (void)setRy:(ABI46_0_0RNSVGLength *)ry -{ - if ([ry isEqualTo:_ry]) { - return; - } - [self invalidate]; - _ry = ry; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGMutablePathRef path = CGPathCreateMutable(); - CGFloat x = [self relativeOnWidth:self.x]; - CGFloat y = [self relativeOnHeight:self.y]; - CGFloat width = [self relativeOnWidth:self.rectwidth]; - CGFloat height = [self relativeOnHeight:self.rectheight]; - - if (self.rx != nil || self.ry != nil) { - CGFloat rx = 0; - CGFloat ry = 0; - if (self.rx == nil) { - ry = [self relativeOnHeight:self.ry]; - rx = ry; - } else if (self.ry == nil) { - rx = [self relativeOnWidth:self.rx]; - ry = rx; - } else { - rx = [self relativeOnWidth:self.rx]; - ry = [self relativeOnHeight:self.ry]; - } - - if (rx > width / 2) { - rx = width / 2; - } - - if (ry > height / 2) { - ry = height / 2; - } - - CGPathAddRoundedRect(path, nil, CGRectMake(x, y, width, height), rx, ry); - } else { - CGPathAddRect(path, nil, CGRectMake(x, y, width, height)); - } - - return (CGPathRef)CFAutorelease(path); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.h deleted file mode 100644 index 12657c64fbef7e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.h +++ /dev/null @@ -1,37 +0,0 @@ -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGTextProperties.h" -#import "ABI46_0_0RNSVGPropHelper.h" - -@interface ABI46_0_0RNSVGFontData : NSObject { -@public - CGFloat fontSize; - NSString * fontSize_; - NSString *fontFamily; - enum ABI46_0_0RNSVGFontStyle fontStyle; - NSDictionary * fontData; - enum ABI46_0_0RNSVGFontWeight fontWeight; - int absoluteFontWeight; - NSString *fontFeatureSettings; - enum ABI46_0_0RNSVGFontVariantLigatures fontVariantLigatures; - enum ABI46_0_0RNSVGTextAnchor textAnchor; - enum ABI46_0_0RNSVGTextDecoration textDecoration; - CGFloat kerning; - CGFloat wordSpacing; - CGFloat letterSpacing; - bool manualKerning; -} - -+ (instancetype)Defaults; - -+ (CGFloat)toAbsoluteWithNSString:(NSString *)string - fontSize:(CGFloat)fontSize; - -+ (instancetype)initWithNSDictionary:(NSDictionary *)font - parent:(ABI46_0_0RNSVGFontData *)parent; - -@end - -#define ABI46_0_0RNSVGFontData_DEFAULT_FONT_SIZE 12.0 diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.m deleted file mode 100644 index ccbfd662044f3e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGFontData.m +++ /dev/null @@ -1,200 +0,0 @@ -#import "ABI46_0_0RNSVGFontData.h" -#import "ABI46_0_0RNSVGPropHelper.h" -#import "ABI46_0_0RNSVGTextProperties.h" -#import "ABI46_0_0RNSVGNode.h" - -#define ABI46_0_0RNSVG_DEFAULT_KERNING 0.0 -#define ABI46_0_0RNSVG_DEFAULT_WORD_SPACING 0.0 -#define ABI46_0_0RNSVG_DEFAULT_LETTER_SPACING 0.0 -static NSString *KERNING = @"kerning"; -static NSString *FONT_SIZE = @"fontSize"; -static NSString *FONT_DATA = @"fontData"; -static NSString *FONT_STYLE = @"fontStyle"; -static NSString *FONT_WEIGHT = @"fontWeight"; -static NSString *FONT_FAMILY = @"fontFamily"; -static NSString *TEXT_ANCHOR = @"textAnchor"; -static NSString *WORD_SPACING = @"wordSpacing"; -static NSString *LETTER_SPACING = @"letterSpacing"; -static NSString *TEXT_DECORATION = @"textDecoration"; -static NSString *FONT_FEATURE_SETTINGS = @"fontFeatureSettings"; -static NSString *FONT_VARIANT_LIGATURES = @"fontVariantLigatures"; - -ABI46_0_0RNSVGFontData *ABI46_0_0RNSVGFontData_Defaults; - -@implementation ABI46_0_0RNSVGFontData - -+ (instancetype)Defaults { - if (!ABI46_0_0RNSVGFontData_Defaults) { - ABI46_0_0RNSVGFontData *self = [ABI46_0_0RNSVGFontData alloc]; - self->fontData = nil; - self->fontFamily = @""; - self->fontStyle = ABI46_0_0RNSVGFontStyleNormal; - self->fontWeight = ABI46_0_0RNSVGFontWeightNormal; - self->absoluteFontWeight = 400; - self->fontFeatureSettings = @""; - self->fontVariantLigatures = ABI46_0_0RNSVGFontVariantLigaturesNormal; - self->textAnchor = ABI46_0_0RNSVGTextAnchorStart; - self->textDecoration = ABI46_0_0RNSVGTextDecorationNone; - self->manualKerning = false; - self->kerning = ABI46_0_0RNSVG_DEFAULT_KERNING; - self->fontSize = ABI46_0_0RNSVG_DEFAULT_FONT_SIZE; - self->wordSpacing = ABI46_0_0RNSVG_DEFAULT_WORD_SPACING; - self->letterSpacing = ABI46_0_0RNSVG_DEFAULT_LETTER_SPACING; - ABI46_0_0RNSVGFontData_Defaults = self; - } - return ABI46_0_0RNSVGFontData_Defaults; -} - -+ (CGFloat)toAbsoluteWithNSString:(NSString *)string - fontSize:(CGFloat)fontSize { - return [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:string - relative:0 - fontSize:fontSize]; -} - -- (void)setInheritedWeight:(ABI46_0_0RNSVGFontData*) parent { - absoluteFontWeight = parent->absoluteFontWeight; - fontWeight = parent->fontWeight; -} - -ABI46_0_0RNSVGFontWeight ABI46_0_0nearestFontWeight(int absoluteFontWeight) { - return ABI46_0_0RNSVGFontWeights[(int)round(absoluteFontWeight / 100.0)]; -} - -- (void)handleNumericWeight:(ABI46_0_0RNSVGFontData*)parent weight:(double)weight { - long roundWeight = round(weight); - if (roundWeight >= 1 && roundWeight <= 1000) { - absoluteFontWeight = (int)roundWeight; - fontWeight = ABI46_0_0nearestFontWeight(absoluteFontWeight); - } else { - [self setInheritedWeight:parent]; - } -} - -// https://drafts.csswg.org/css-fonts-4/#relative-weights -int ABI46_0_0AbsoluteFontWeight(ABI46_0_0RNSVGFontWeight fontWeight, ABI46_0_0RNSVGFontData* parent) { - if (fontWeight == ABI46_0_0RNSVGFontWeightBolder) { - return ABI46_0_0bolder(parent->absoluteFontWeight); - } else if (fontWeight == ABI46_0_0RNSVGFontWeightLighter) { - return ABI46_0_0lighter(parent->absoluteFontWeight); - } else { - return ABI46_0_0RNSVGAbsoluteFontWeights[fontWeight]; - } -} - -int ABI46_0_0bolder(int inherited) { - if (inherited < 350) { - return 400; - } else if (inherited < 550) { - return 700; - } else if (inherited < 900) { - return 900; - } else { - return inherited; - } -} - -int ABI46_0_0lighter(int inherited) { - if (inherited < 100) { - return inherited; - } else if (inherited < 550) { - return 100; - } else if (inherited < 750) { - return 400; - } else { - return 700; - } -} - -+ (instancetype)initWithNSDictionary:(NSDictionary *)font - parent:(ABI46_0_0RNSVGFontData *)parent { - ABI46_0_0RNSVGFontData *data = [ABI46_0_0RNSVGFontData alloc]; - CGFloat parentFontSize = parent->fontSize; - if ([font objectForKey:FONT_SIZE]) { - id fontSize = [font objectForKey:FONT_SIZE]; - if ([fontSize isKindOfClass:NSNumber.class]) { - NSNumber* fs = fontSize; - data->fontSize = (CGFloat)[fs doubleValue]; - } else { - data->fontSize = [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:fontSize - relative:parentFontSize - fontSize:parentFontSize]; - } - } - else { - data->fontSize = parentFontSize; - } - - if ([font objectForKey:FONT_WEIGHT]) { - id fontWeight = [font objectForKey:FONT_WEIGHT]; - if ([fontWeight isKindOfClass:NSNumber.class]) { - [data handleNumericWeight:parent weight:[fontWeight doubleValue]]; - } else { - NSString* weight = fontWeight; - NSInteger fw = ABI46_0_0RNSVGFontWeightFromString(weight); - if (fw != -1) { - data->absoluteFontWeight = ABI46_0_0AbsoluteFontWeight(fw, parent); - data->fontWeight = ABI46_0_0nearestFontWeight(data->absoluteFontWeight); - } else if ([weight length] != 0) { - [data handleNumericWeight:parent weight:[weight doubleValue]]; - } else { - [data setInheritedWeight:parent]; - } - } - } else { - [data setInheritedWeight:parent]; - } - - data->fontData = [font objectForKey:FONT_DATA] ? [font objectForKey:FONT_DATA] : parent->fontData; - data->fontFamily = [font objectForKey:FONT_FAMILY] ? [font objectForKey:FONT_FAMILY] : parent->fontFamily; - NSString* style = [font objectForKey:FONT_STYLE]; - data->fontStyle = style ? ABI46_0_0RNSVGFontStyleFromString(style) : parent->fontStyle; - NSString* feature = [font objectForKey:FONT_FEATURE_SETTINGS]; - data->fontFeatureSettings = feature ? [font objectForKey:FONT_FEATURE_SETTINGS] : parent->fontFeatureSettings; - NSString* variant = [font objectForKey:FONT_VARIANT_LIGATURES]; - data->fontVariantLigatures = variant ? ABI46_0_0RNSVGFontVariantLigaturesFromString(variant) : parent->fontVariantLigatures; - NSString* anchor = [font objectForKey:TEXT_ANCHOR]; - data->textAnchor = anchor ? ABI46_0_0RNSVGTextAnchorFromString(anchor) : parent->textAnchor; - NSString* decoration = [font objectForKey:TEXT_DECORATION]; - data->textDecoration = decoration ? ABI46_0_0RNSVGTextDecorationFromString(decoration) : parent->textDecoration; - - CGFloat fontSize = data->fontSize; - id kerning = [font objectForKey:KERNING]; - data->manualKerning = (kerning || parent->manualKerning ); - if ([kerning isKindOfClass:NSNumber.class]) { - NSNumber* kern = kerning; - data->kerning = (CGFloat)[kern doubleValue]; - } else { - data->kerning = kerning ? - [ABI46_0_0RNSVGFontData toAbsoluteWithNSString:kerning - fontSize:fontSize] - : parent->kerning; - } - - id wordSpacing = [font objectForKey:WORD_SPACING]; - if ([wordSpacing isKindOfClass:NSNumber.class]) { - NSNumber* ws = wordSpacing; - data->wordSpacing = (CGFloat)[ws doubleValue]; - } else { - data->wordSpacing = wordSpacing ? - [ABI46_0_0RNSVGFontData toAbsoluteWithNSString:wordSpacing - fontSize:fontSize] - : parent->wordSpacing; - } - - id letterSpacing = [font objectForKey:LETTER_SPACING]; - if ([letterSpacing isKindOfClass:NSNumber.class]) { - NSNumber* ls = letterSpacing; - data->wordSpacing = (CGFloat)[ls doubleValue]; - } else { - data->letterSpacing = letterSpacing ? - [ABI46_0_0RNSVGFontData toAbsoluteWithNSString:letterSpacing - fontSize:fontSize] - : parent->letterSpacing; - } - - return data; -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.h deleted file mode 100644 index 523bccf0efeaf1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.h +++ /dev/null @@ -1,49 +0,0 @@ -#import -#import -#import "ABI46_0_0RNSVGFontData.h" - -@class ABI46_0_0RNSVGText; -@class ABI46_0_0RNSVGGroup; -@class ABI46_0_0RNSVGGlyphContext; - -@interface ABI46_0_0RNSVGGlyphContext : NSObject - -- (CTFontRef)getGlyphFont; - -- (instancetype)initWithWidth:(CGFloat)width - height:(CGFloat)height; - -- (ABI46_0_0RNSVGFontData *)getFont; - -- (CGFloat)getFontSize; - -- (CGFloat)getHeight; - -- (CGFloat)getWidth; - -- (CGFloat)nextDeltaX; - -- (CGFloat)nextDeltaY; - -- (CGFloat)nextRotation; - -- (CGFloat)nextXWithDouble:(CGFloat)advance; - -- (CGFloat)nextY; - -- (void)popContext; - -- (void)pushContext:(ABI46_0_0RNSVGText*)node - font:(NSDictionary*)font - x:(NSArray*)x - y:(NSArray*)y - deltaX:(NSArray*)deltaX - deltaY:(NSArray*)deltaY - rotate:(NSArray*)rotate; - -- (void)pushContext:(ABI46_0_0RNSVGGroup*)node - font:(NSDictionary *)font; - -- (NSArray*)getFontContext; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.m deleted file mode 100644 index 58d469e1e71665..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGGlyphContext.m +++ /dev/null @@ -1,525 +0,0 @@ -#import "ABI46_0_0RNSVGGlyphContext.h" -#import -#import "ABI46_0_0RNSVGNode.h" -#import "ABI46_0_0RNSVGPropHelper.h" -#import "ABI46_0_0RNSVGFontData.h" -#import "ABI46_0_0RNSVGText.h" - -// https://www.w3.org/TR/SVG/text.html#TSpanElement -@interface ABI46_0_0RNSVGGlyphContext () { -@public - // Current stack (one per node push/pop) - NSMutableArray *mFontContext_; - - // Unique input attribute lists (only added if node sets a value) - NSMutableArray*> *mXsContext_; - NSMutableArray*> *mYsContext_; - NSMutableArray*> *mDXsContext_; - NSMutableArray*> *mDYsContext_; - NSMutableArray*> *mRsContext_; - - // Unique index into attribute list (one per unique list) - NSMutableArray *mXIndices_; - NSMutableArray *mYIndices_; - NSMutableArray *mDXIndices_; - NSMutableArray *mDYIndices_; - NSMutableArray *mRIndices_; - - // Index of unique context used (one per node push/pop) - NSMutableArray *mXsIndices_; - NSMutableArray *mYsIndices_; - NSMutableArray *mDXsIndices_; - NSMutableArray *mDYsIndices_; - NSMutableArray *mRsIndices_; - - // Calculated on push context, percentage and em length depends on parent font size - CGFloat mFontSize_; - ABI46_0_0RNSVGFontData *topFont_; - - // Current accumulated values - // https://www.w3.org/TR/SVG/types.html#DataTypeCoordinate - // syntax is the same as that for - CGFloat mX_; - CGFloat mY_; - - // https://www.w3.org/TR/SVG/types.html#Length - CGFloat mDX_; - CGFloat mDY_; - - // Current SVGLengthList - // https://www.w3.org/TR/SVG/types.html#InterfaceSVGLengthList - // https://www.w3.org/TR/SVG/types.html#DataTypeCoordinates - - // https://www.w3.org/TR/SVG/text.html#TSpanElementXAttribute - NSArray *mXs_; - - // https://www.w3.org/TR/SVG/text.html#TSpanElementYAttribute - NSArray *mYs_; - - // Current SVGLengthList - // https://www.w3.org/TR/SVG/types.html#DataTypeLengths - - // https://www.w3.org/TR/SVG/text.html#TSpanElementDXAttribute - NSArray *mDXs_; - - // https://www.w3.org/TR/SVG/text.html#TSpanElementDYAttribute - NSArray *mDYs_; - - // Current SVGLengthList - // https://www.w3.org/TR/SVG/types.html#DataTypeNumbers - - // https://www.w3.org/TR/SVG/text.html#TSpanElementRotateAttribute - NSArray *mRs_; - - // Current attribute list index - long mXsIndex_; - long mYsIndex_; - long mDXsIndex_; - long mDYsIndex_; - long mRsIndex_; - - // Current value index in current attribute list - long mXIndex_; - long mYIndex_; - long mDXIndex_; - long mDYIndex_; - long mRIndex_; - - // Top index of stack - long mTop_; - - // Constructor parameters - CGFloat mWidth_; - CGFloat mHeight_; -} - -- (void)pushContext:(ABI46_0_0RNSVGText*)node - font:(NSDictionary*)font - x:(NSArray*)x - y:(NSArray*)y - deltaX:(NSArray*)deltaX - deltaY:(NSArray*)deltaY - rotate:(NSArray*)rotate; - -- (void)pushContext:(ABI46_0_0RNSVGGroup*)node - font:(NSDictionary *)font; -@end - -@implementation ABI46_0_0RNSVGGlyphContext - -- (NSArray*)getFontContext { - return mFontContext_; -} - -- (CTFontRef)getGlyphFont -{ - CGFloat size = topFont_->fontSize; - NSString *fontFamily = topFont_->fontFamily; - NSString *fontStyle = ABI46_0_0RNSVGFontStyleStrings[topFont_->fontStyle]; - NSString *fontWeight = ABI46_0_0RNSVGFontWeightStrings[topFont_->fontWeight]; - UIFont *font = [ABI46_0_0RCTFont updateFont:nil - withFamily:[fontFamily isEqualToString:@""] ? nil : fontFamily - size:@(isnan(size) ? 0 : size) - weight:fontWeight - style:fontStyle - variant:nil - scaleMultiplier:1.0]; - CTFontRef ref = (__bridge CTFontRef)font; - - double weight = topFont_->absoluteFontWeight; - if (weight == 400) { - return ref; - } - - CFArrayRef cgAxes = CTFontCopyVariationAxes(ref); - if (cgAxes == 0) { - return ref; - } - CFIndex cgAxisCount = CFArrayGetCount(cgAxes); - CFNumberRef wght_id = 0; - - for (CFIndex i = 0; i < cgAxisCount; ++i) { - CFTypeRef cgAxis = CFArrayGetValueAtIndex(cgAxes, i); - if (CFGetTypeID(cgAxis) != CFDictionaryGetTypeID()) { - continue; - } - - CFDictionaryRef cgAxisDict = (CFDictionaryRef)cgAxis; - CFTypeRef axisName = CFDictionaryGetValue(cgAxisDict, kCTFontVariationAxisNameKey); - - if (!axisName || CFGetTypeID(axisName) != CFStringGetTypeID()) { - continue; - } - CFStringRef axisNameString = (CFStringRef)axisName; - NSString *axisNameNSString = (__bridge NSString *)(axisNameString); - if (![@"Weight" isEqualToString:axisNameNSString] && ![@"Size" isEqualToString:axisNameNSString]) { - continue; - } - - CFTypeRef axisMinValue = CFDictionaryGetValue(cgAxisDict, kCTFontVariationAxisMinimumValueKey); - if (axisMinValue && CFGetTypeID(axisMinValue) == CFNumberGetTypeID()) { - CFNumberRef axisMinValueNumber = (CFNumberRef)axisMinValue; - double axisMinValueDouble; - if (CFNumberGetValue(axisMinValueNumber, kCFNumberDoubleType, &axisMinValueDouble)) - { - weight = fmax(axisMinValueDouble, weight); - } - } - - CFTypeRef axisMaxValue = CFDictionaryGetValue(cgAxisDict, kCTFontVariationAxisMaximumValueKey); - if (axisMaxValue && CFGetTypeID(axisMaxValue) == CFNumberGetTypeID()) { - CFNumberRef axisMaxValueNumber = (CFNumberRef)axisMaxValue; - double axisMaxValueDouble; - if (CFNumberGetValue(axisMaxValueNumber, kCFNumberDoubleType, &axisMaxValueDouble)) - { - weight = fmin(axisMaxValueDouble, weight); - } - } - - CFTypeRef axisId = CFDictionaryGetValue(cgAxisDict, kCTFontVariationAxisIdentifierKey); - if (!axisId || CFGetTypeID(axisId) != CFNumberGetTypeID()) { - continue; - } - wght_id = (CFNumberRef)axisId; - break; - } - - if (wght_id == 0) { - return ref; - } - UIFontDescriptor *uifd = font.fontDescriptor; - CTFontDescriptorRef ctfd = (__bridge CTFontDescriptorRef)(uifd); - CTFontDescriptorRef newfd = CTFontDescriptorCreateCopyWithVariation(ctfd, wght_id, (CGFloat)weight); - CTFontRef newfont = CTFontCreateCopyWithAttributes(ref, size, nil, newfd); - - CFRelease(newfd); - - return (CTFontRef)CFAutorelease(newfont); -} - -- (void)pushIndices -{ - [self->mXsIndices_ addObject:[NSNumber numberWithLong:self->mXsIndex_]]; - [self->mYsIndices_ addObject:[NSNumber numberWithLong:self->mYsIndex_]]; - [self->mDXsIndices_ addObject:[NSNumber numberWithLong:self->mDXsIndex_]]; - [self->mDYsIndices_ addObject:[NSNumber numberWithLong:self->mDYsIndex_]]; - [self->mRsIndices_ addObject:[NSNumber numberWithLong:self->mRsIndex_]]; -} - -- (instancetype)initWithWidth:(CGFloat)width - height:(CGFloat)height { - self = [super init]; - self->mFontContext_ = [[NSMutableArray alloc]init]; - self->mXsContext_ = [[NSMutableArray alloc]init]; - self->mYsContext_ = [[NSMutableArray alloc]init]; - self->mDXsContext_ = [[NSMutableArray alloc]init]; - self->mDYsContext_ = [[NSMutableArray alloc]init]; - self->mRsContext_ = [[NSMutableArray alloc]init]; - - self->mXIndices_ = [[NSMutableArray alloc]init]; - self->mYIndices_ = [[NSMutableArray alloc]init]; - self->mDXIndices_ = [[NSMutableArray alloc]init]; - self->mDYIndices_ = [[NSMutableArray alloc]init]; - self->mRIndices_ = [[NSMutableArray alloc]init]; - - self->mXsIndices_ = [[NSMutableArray alloc]init]; - self->mYsIndices_ = [[NSMutableArray alloc]init]; - self->mDXsIndices_ = [[NSMutableArray alloc]init]; - self->mDYsIndices_ = [[NSMutableArray alloc]init]; - self->mRsIndices_ = [[NSMutableArray alloc]init]; - - self->mFontSize_ = ABI46_0_0RNSVGFontData_DEFAULT_FONT_SIZE; - self->topFont_ = [ABI46_0_0RNSVGFontData Defaults]; - - self->mXs_ = [[NSArray alloc]init]; - self->mYs_ = [[NSArray alloc]init]; - self->mDXs_ = [[NSArray alloc]init]; - self->mDYs_ = [[NSArray alloc]init]; - self->mRs_ = [[NSArray alloc]initWithObjects:[ABI46_0_0RNSVGLength lengthWithNumber:0], nil]; - - self->mXIndex_ = -1; - self->mYIndex_ = -1; - self->mDXIndex_ = -1; - self->mDYIndex_ = -1; - self->mRIndex_ = -1; - - self->mWidth_ = width; - self->mHeight_ = height; - - [self->mXsContext_ addObject:self->mXs_]; - [self->mYsContext_ addObject:self->mYs_]; - [self->mDXsContext_ addObject:self->mDXs_]; - [self->mDYsContext_ addObject:self->mDYs_]; - [self->mRsContext_ addObject:self->mRs_]; - - [self->mXIndices_ addObject:[NSNumber numberWithLong:self->mXIndex_]]; - [self->mYIndices_ addObject:[NSNumber numberWithLong:self->mYIndex_]]; - [self->mDXIndices_ addObject:[NSNumber numberWithLong:self->mDXIndex_]]; - [self->mDYIndices_ addObject:[NSNumber numberWithLong:self->mDYIndex_]]; - [self->mRIndices_ addObject:[NSNumber numberWithLong:self->mRIndex_]]; - - [self->mFontContext_ addObject:self->topFont_]; - [self pushIndices]; - return self; -} - -- (ABI46_0_0RNSVGFontData *)getFont { - return topFont_; -} - -- (ABI46_0_0RNSVGFontData *)getTopOrParentFont:(ABI46_0_0RNSVGGroup *)child -{ - if (self->mTop_ > 0) { - return self->topFont_; - } else { - ABI46_0_0RNSVGGroup *parentRoot = [child getParentTextRoot]; - ABI46_0_0RNSVGFontData *Defaults = [ABI46_0_0RNSVGFontData Defaults]; - while (parentRoot != nil) { - ABI46_0_0RNSVGFontData *map = [[parentRoot getGlyphContext] getFont]; - if (map != Defaults) { - return map; - } - parentRoot = [parentRoot getParentTextRoot]; - } - return Defaults; - } -} - -- (void)pushNode:(ABI46_0_0RNSVGGroup *)node andFont:(NSDictionary *)font -{ - ABI46_0_0RNSVGFontData *parent = [self getTopOrParentFont:node]; - self->mTop_++; - if (font == nil) { - [self->mFontContext_ addObject:parent]; - return; - } - ABI46_0_0RNSVGFontData *data = [ABI46_0_0RNSVGFontData initWithNSDictionary:font - parent:parent]; - self->mFontSize_ = data->fontSize; - [self->mFontContext_ addObject:data]; - self->topFont_ = data; -} - -- (void)pushContext:(ABI46_0_0RNSVGGroup*)node - font:(NSDictionary*)font { - [self pushNode:node andFont:font]; - [self pushIndices]; -} - -- (void)pushContext:(ABI46_0_0RNSVGText*)node - font:(NSDictionary*)font - x:(NSArray*)x - y:(NSArray*)y - deltaX:(NSArray*)deltaX - deltaY:(NSArray*)deltaY - rotate:(NSArray*)rotate { - [self pushNode:(ABI46_0_0RNSVGGroup*)node andFont:font]; - if (x != nil && [x count] != 0) { - mXsIndex_++; - mXIndex_ = -1; - [mXIndices_ addObject:[NSNumber numberWithLong:mXIndex_]]; - mXs_ = x; - [mXsContext_ addObject:mXs_]; - } - if (y != nil && [y count] != 0) { - mYsIndex_++; - mYIndex_ = -1; - [mYIndices_ addObject:[NSNumber numberWithLong:mYIndex_]]; - mYs_ = y; - [mYsContext_ addObject:mYs_]; - } - if (deltaX != nil && [deltaX count] != 0) { - mDXsIndex_++; - mDXIndex_ = -1; - [mDXIndices_ addObject:[NSNumber numberWithLong:mDXIndex_]]; - mDXs_ = deltaX; - [mDXsContext_ addObject:mDXs_]; - } - if (deltaY != nil && [deltaY count] != 0) { - mDYsIndex_++; - mDYIndex_ = -1; - [mDYIndices_ addObject:[NSNumber numberWithLong:mDYIndex_]]; - mDYs_ = deltaY; - [mDYsContext_ addObject:mDYs_]; - } - if (rotate != nil && [rotate count] != 0) { - mRsIndex_++; - mRIndex_ = -1; - [mRIndices_ addObject:[NSNumber numberWithLong:mRIndex_]]; - mRs_ = rotate; - [mRsContext_ addObject:mRs_]; - } - [self pushIndices]; -} - -- (void)popContext { - [mFontContext_ removeLastObject]; - [mXsIndices_ removeLastObject]; - [mYsIndices_ removeLastObject]; - [mDXsIndices_ removeLastObject]; - [mDYsIndices_ removeLastObject]; - [mRsIndices_ removeLastObject]; - - mTop_--; - - long x = mXsIndex_; - long y = mYsIndex_; - long dx = mDXsIndex_; - long dy = mDYsIndex_; - long r = mRsIndex_; - - topFont_ = [mFontContext_ lastObject]; - - mXsIndex_ = [[mXsIndices_ lastObject] longValue]; - mYsIndex_ = [[mYsIndices_ lastObject] longValue]; - mDXsIndex_ = [[mDXsIndices_ lastObject] longValue]; - mDYsIndex_ = [[mDYsIndices_ lastObject] longValue]; - mRsIndex_ = [[mRsIndices_ lastObject] longValue]; - - if (x != mXsIndex_) { - [mXsContext_ removeObjectAtIndex:x]; - mXs_ = [mXsContext_ objectAtIndex:mXsIndex_]; - mXIndex_ = [[mXIndices_ objectAtIndex:mXsIndex_] longValue]; - } - if (y != mYsIndex_) { - [mYsContext_ removeObjectAtIndex:y]; - mYs_ = [mYsContext_ objectAtIndex:mYsIndex_]; - mYIndex_ = [[mYIndices_ objectAtIndex:mYsIndex_] longValue]; - } - if (dx != mDXsIndex_) { - [mDXsContext_ removeObjectAtIndex:dx]; - mDXs_ = [mDXsContext_ objectAtIndex:mDXsIndex_]; - mDXIndex_ = [[mDXIndices_ objectAtIndex:mDXsIndex_] longValue]; - } - if (dy != mDYsIndex_) { - [mDYsContext_ removeObjectAtIndex:dy]; - mDYs_ = [mDYsContext_ objectAtIndex:mDYsIndex_]; - mDYIndex_ = [[mDYIndices_ objectAtIndex:mDYsIndex_] longValue]; - } - if (r != mRsIndex_) { - [mRsContext_ removeObjectAtIndex:r]; - mRs_ = [mRsContext_ objectAtIndex:mRsIndex_]; - mRIndex_ = [[mRIndices_ objectAtIndex:mRsIndex_] longValue]; - } -} - -+ (void)incrementIndices:(NSMutableArray *)indices topIndex:(long)topIndex -{ - for (long index = topIndex; index >= 0; index--) { - long xIndex = [[indices objectAtIndex:index] longValue]; - [indices setObject:[NSNumber numberWithLong:xIndex + 1] atIndexedSubscript:index]; - } -} - -// https://www.w3.org/TR/SVG11/text.html#FontSizeProperty - -/** - * Get font size from context. - *

- * ‘font-size’ - * Value: < absolute-size > | < relative-size > | < length > | < percentage > | inherit - * Initial: medium - * Applies to: text content elements - * Inherited: yes, the computed value is inherited - * Percentages: refer to parent element's font size - * Media: visual - * Animatable: yes - *

- * This property refers to the size of the font from baseline to - * baseline when multiple lines of text are set solid in a multiline - * layout environment. - *

- * For SVG, if a < length > is provided without a unit identifier - * (e.g., an unqualified number such as 128), the SVG user agent - * processes the < length > as a height value in the current user - * coordinate system. - *

- * If a < length > is provided with one of the unit identifiers - * (e.g., 12pt or 10%), then the SVG user agent converts the - * < length > into a corresponding value in the current user - * coordinate system by applying the rules described in Units. - *

- * Except for any additional information provided in this specification, - * the normative definition of the property is in CSS2 ([CSS2], section 15.2.4). - */ -- (CGFloat)getFontSize { - return mFontSize_; -} - -- (CGFloat)nextXWithDouble:(CGFloat)advance { - [ABI46_0_0RNSVGGlyphContext incrementIndices:mXIndices_ topIndex:mXsIndex_]; - long nextIndex = mXIndex_ + 1; - if (nextIndex < [mXs_ count]) { - mDX_ = 0; - mXIndex_ = nextIndex; - ABI46_0_0RNSVGLength *length = [mXs_ objectAtIndex:nextIndex]; - mX_ = [ABI46_0_0RNSVGPropHelper fromRelative:length - relative:mWidth_ - fontSize:mFontSize_]; - } - mX_ += advance; - return mX_; -} - -- (CGFloat)nextY { - [ABI46_0_0RNSVGGlyphContext incrementIndices:mYIndices_ topIndex:mYsIndex_]; - long nextIndex = mYIndex_ + 1; - if (nextIndex < [mYs_ count]) { - mDY_ = 0; - mYIndex_ = nextIndex; - ABI46_0_0RNSVGLength *length = [mYs_ objectAtIndex:nextIndex]; - mY_ = [ABI46_0_0RNSVGPropHelper fromRelative:length - relative:mHeight_ - fontSize:mFontSize_]; - } - return mY_; -} - -- (CGFloat)nextDeltaX { - [ABI46_0_0RNSVGGlyphContext incrementIndices:mDXIndices_ topIndex:mDXsIndex_]; - long nextIndex = mDXIndex_ + 1; - if (nextIndex < [mDXs_ count]) { - mDXIndex_ = nextIndex; - ABI46_0_0RNSVGLength *length = [mDXs_ objectAtIndex:nextIndex]; - CGFloat val = [ABI46_0_0RNSVGPropHelper fromRelative:length - relative:mWidth_ - fontSize:mFontSize_]; - mDX_ += val; - } - return mDX_; -} - -- (CGFloat)nextDeltaY { - [ABI46_0_0RNSVGGlyphContext incrementIndices:mDYIndices_ topIndex:mDYsIndex_]; - long nextIndex = mDYIndex_ + 1; - if (nextIndex < [mDYs_ count]) { - mDYIndex_ = nextIndex; - ABI46_0_0RNSVGLength *length = [mDYs_ objectAtIndex:nextIndex]; - CGFloat val = [ABI46_0_0RNSVGPropHelper fromRelative:length - relative:mHeight_ - fontSize:mFontSize_]; - mDY_ += val; - } - return mDY_; -} - -- (CGFloat)nextRotation { - [ABI46_0_0RNSVGGlyphContext incrementIndices:mRIndices_ topIndex:mRsIndex_]; - long nextIndex = mRIndex_ + 1; - long count = [mRs_ count]; - if (nextIndex < count) { - mRIndex_ = nextIndex; - } else { - mRIndex_ = count - 1; - } - return [mRs_[mRIndex_] value]; -} - -- (CGFloat)getWidth { - return mWidth_; -} - -- (CGFloat)getHeight { - return mHeight_; -} -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.h deleted file mode 100644 index 023b27c6420ca3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.h +++ /dev/null @@ -1,22 +0,0 @@ -#import -#import -#import "ABI46_0_0RNSVGLength.h" - -#ifndef ABI46_0_0RNSVGPropHelper_h -#define ABI46_0_0RNSVGPropHelper_h - -@interface ABI46_0_0RNSVGPropHelper : NSObject - -+ (CGFloat) fromRelativeWithNSString:(NSString *)length - relative:(CGFloat)relative - fontSize:(CGFloat)fontSize; - -+ (CGFloat) fromRelative:(ABI46_0_0RNSVGLength*)length - relative:(CGFloat)relative - fontSize:(CGFloat)fontSize; - -+ (CGFloat)fromRelative:(ABI46_0_0RNSVGLength*)length - relative:(CGFloat)relative; -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.m deleted file mode 100644 index ad6faf7c47a757..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGPropHelper.m +++ /dev/null @@ -1,138 +0,0 @@ -#include "ABI46_0_0RNSVGPropHelper.h" -@implementation ABI46_0_0RNSVGPropHelper - -+ (CGFloat)fromRelativeWithNSString:(NSString *)length - relative:(CGFloat)relative - fontSize:(CGFloat)fontSize { - length = [length stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - NSUInteger stringLength = [length length]; - NSInteger percentIndex = stringLength - 1; - if (stringLength == 0) { - return 0; - } - else if ([length characterAtIndex:percentIndex] == '%') { - return (CGFloat)[[length substringWithRange:NSMakeRange(0, percentIndex)] doubleValue] / 100 * relative; - } - else { - NSInteger twoLetterUnitIndex = stringLength - 2; - if (twoLetterUnitIndex > 0) { - NSString *lastTwo = [length substringFromIndex:twoLetterUnitIndex]; - NSUInteger end = twoLetterUnitIndex; - CGFloat unit = 1; - if ([lastTwo isEqualToString:@"px"]) { - - } else if ([lastTwo isEqualToString:@"em"]) { - unit = fontSize; - } else if ([lastTwo isEqualToString:@"ex"]) { - unit = fontSize / 2; - } else if ([lastTwo isEqualToString:@"pt"]) { - unit = 1.25; - } else if ([lastTwo isEqualToString:@"pc"]) { - unit = 15; - } else if ([lastTwo isEqualToString:@"mm"]) { - unit = (CGFloat)3.543307; - } else if ([lastTwo isEqualToString:@"cm"]) { - unit = (CGFloat)35.43307; - } else if ([lastTwo isEqualToString:@"in"]) { - unit = 90; - } else { - end = stringLength; - } - - return (CGFloat)[[length substringWithRange:NSMakeRange(0, end)] doubleValue] * unit; - } else { - return (CGFloat)[length doubleValue]; - } - } -} - -+ (CGFloat)fromRelative:(ABI46_0_0RNSVGLength*)length - relative:(CGFloat)relative - fontSize:(CGFloat)fontSize { - ABI46_0_0RNSVGLengthUnitType unitType = length.unit; - CGFloat value = length.value; - CGFloat unit = 1; - switch (unitType) { - case SVG_LENGTHTYPE_NUMBER: - case SVG_LENGTHTYPE_PX: - return value; - break; - - case SVG_LENGTHTYPE_PERCENTAGE: - return value / 100 * relative; - - case SVG_LENGTHTYPE_EMS: - unit = fontSize; - break; - case SVG_LENGTHTYPE_EXS: - unit = fontSize / 2; - break; - - case SVG_LENGTHTYPE_CM: - unit = (CGFloat)35.43307; - break; - case SVG_LENGTHTYPE_MM: - unit = (CGFloat)3.543307; - break; - case SVG_LENGTHTYPE_IN: - unit = 90; - break; - case SVG_LENGTHTYPE_PT: - unit = 1.25; - break; - case SVG_LENGTHTYPE_PC: - unit = 15; - break; - - default: - case SVG_LENGTHTYPE_UNKNOWN: - return value; - } - return value * unit; -} - -+ (CGFloat)fromRelative:(ABI46_0_0RNSVGLength*)length - relative:(CGFloat)relative { - ABI46_0_0RNSVGLengthUnitType unitType = length.unit; - CGFloat value = length.value; - CGFloat unit = 1; - switch (unitType) { - case SVG_LENGTHTYPE_NUMBER: - case SVG_LENGTHTYPE_PX: - return value; - break; - - case SVG_LENGTHTYPE_PERCENTAGE: - return value / 100 * relative; - - case SVG_LENGTHTYPE_EMS: - unit = 12; - break; - case SVG_LENGTHTYPE_EXS: - unit = 6; - break; - - case SVG_LENGTHTYPE_CM: - unit = (CGFloat)35.43307; - break; - case SVG_LENGTHTYPE_MM: - unit = (CGFloat)3.543307; - break; - case SVG_LENGTHTYPE_IN: - unit = 90; - break; - case SVG_LENGTHTYPE_PT: - unit = 1.25; - break; - case SVG_LENGTHTYPE_PC: - unit = 15; - break; - - default: - case SVG_LENGTHTYPE_UNKNOWN: - return value; - } - return value * unit; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.h deleted file mode 100644 index 339e6078f6ea48..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.h +++ /dev/null @@ -1,20 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGText.h" - -@interface ABI46_0_0RNSVGTSpan : ABI46_0_0RNSVGText - -@property (nonatomic, strong) NSString *content; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.m deleted file mode 100644 index 9984e8dad46ed0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTSpan.m +++ /dev/null @@ -1,1066 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ -#import "ABI46_0_0RNSVGTSpan.h" -#import "ABI46_0_0RNSVGUIKit.h" -#import "ABI46_0_0RNSVGText.h" -#import "ABI46_0_0RNSVGTextPath.h" -#import "ABI46_0_0RNSVGTextProperties.h" -#import "ABI46_0_0RNSVGTopAlignedLabel.h" -#import "ABI46_0_0RNSVGPathMeasure.h" -#import "ABI46_0_0RNSVGFontData.h" - -static NSCharacterSet *ABI46_0_0RNSVGTSpan_separators = nil; -static CGFloat ABI46_0_0RNSVGTSpan_radToDeg = 180 / (CGFloat)M_PI; - -@implementation ABI46_0_0RNSVGTSpan -{ - CGFloat startOffset; - ABI46_0_0RNSVGTextPath *textPath; - NSMutableArray *emoji; - NSMutableArray *emojiTransform; - CGFloat cachedAdvance; - CTFontRef fontRef; - CGFloat firstX; - CGFloat firstY; - ABI46_0_0RNSVGPathMeasure *measure; -} - -- (id)init -{ - self = [super init]; - - if (ABI46_0_0RNSVGTSpan_separators == nil) { - ABI46_0_0RNSVGTSpan_separators = [NSCharacterSet whitespaceCharacterSet]; - } - - emoji = [NSMutableArray arrayWithCapacity:0]; - emojiTransform = [NSMutableArray arrayWithCapacity:0]; - measure = [[ABI46_0_0RNSVGPathMeasure alloc]init]; - - return self; -} - -- (void)clearPath -{ - [super clearPath]; - cachedAdvance = NAN; -} - -- (void)setContent:(NSString *)content -{ - if ([content isEqualToString:_content]) { - return; - } - [self invalidate]; - _content = content; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - if (self.content) { - ABI46_0_0RNSVGGlyphContext* gc = [self.textRoot getGlyphContext]; - if (self.inlineSize != nil && self.inlineSize.value != 0) { - if (self.fill) { - if (self.fill.class == ABI46_0_0RNSVGBrush.class) { - CGColorRef color = [self.tintColor CGColor]; - [self drawWrappedText:context gc:gc rect:rect color:color]; - } else { - CGColorRef color = [self.fill getColorWithOpacity:self.fillOpacity]; - [self drawWrappedText:context gc:gc rect:rect color:color]; - CGColorRelease(color); - } - } - if (self.stroke) { - if (self.stroke.class == ABI46_0_0RNSVGBrush.class) { - CGColorRef color = [self.tintColor CGColor]; - [self drawWrappedText:context gc:gc rect:rect color:color]; - } else { - CGColorRef color = [self.stroke getColorWithOpacity:self.strokeOpacity]; - [self drawWrappedText:context gc:gc rect:rect color:color]; - CGColorRelease(color); - } - } - } else { - if (self.path) { - NSUInteger count = [emoji count]; - CGFloat fontSize = [gc getFontSize]; - for (NSUInteger i = 0; i < count; i++) { - ABI46_0_0RNSVGPlatformView *label = [emoji objectAtIndex:i]; - NSValue *transformValue = [emojiTransform objectAtIndex:i]; - CGAffineTransform transform = [transformValue CGAffineTransformValue]; - CGContextConcatCTM(context, transform); - CGContextTranslateCTM(context, 0, -fontSize); - [label.layer renderInContext:context]; - CGContextTranslateCTM(context, 0, fontSize); - CGContextConcatCTM(context, CGAffineTransformInvert(transform)); - } - } - [self renderPathTo:context rect:rect]; - } - } else { - [self clip:context]; - [self renderGroupTo:context rect:rect]; - } -} - -- (NSMutableDictionary *)getAttributes:(ABI46_0_0RNSVGFontData *)fontdata { - NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init]; - - if (fontRef != nil) { - attrs[NSFontAttributeName] = (__bridge id)fontRef; - } - - CGFloat letterSpacing = fontdata->letterSpacing; - bool allowOptionalLigatures = letterSpacing == 0 && fontdata->fontVariantLigatures == ABI46_0_0RNSVGFontVariantLigaturesNormal; - NSNumber *lig = [NSNumber numberWithInt:allowOptionalLigatures ? 2 : 1]; - attrs[NSLigatureAttributeName] = lig; - - CGFloat kerning = fontdata->kerning; - float kern = (float)(letterSpacing + kerning); - NSNumber *kernAttr = [NSNumber numberWithFloat:kern]; -#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES - if (___useiOS6Attributes) - { - [attrs setObject:kernAttr forKey:NSKernAttributeName]; - } - else -#endif - { - [attrs setObject:kernAttr forKey:(id)kCTKernAttributeName]; - } - - return attrs; -} - -static ABI46_0_0RNSVGTopAlignedLabel *label; -- (void)drawWrappedText:(CGContextRef)context gc:(ABI46_0_0RNSVGGlyphContext *)gc rect:(CGRect)rect color:(CGColorRef)color { - [self pushGlyphContext]; - if (fontRef != nil) { - CFRelease(fontRef); - } - fontRef = [self getFontFromContext]; - ABI46_0_0RNSVGFontData* fontdata = [gc getFont]; - CFStringRef string = (__bridge CFStringRef)self.content; - NSMutableDictionary * attrs = [self getAttributes:fontdata]; - CFMutableDictionaryRef attributes = (__bridge CFMutableDictionaryRef)attrs; - CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes); - - enum ABI46_0_0RNSVGTextAnchor textAnchor = fontdata->textAnchor; - NSTextAlignment align; - switch (textAnchor) { - case ABI46_0_0RNSVGTextAnchorStart: - align = NSTextAlignmentLeft; - break; - - case ABI46_0_0RNSVGTextAnchorMiddle: - align = NSTextAlignmentCenter; - break; - - case ABI46_0_0RNSVGTextAnchorEnd: - align = NSTextAlignmentRight; - break; - - default: - align = NSTextAlignmentLeft; - break; - } - - UIFont *font = (__bridge UIFont *)(fontRef); - if (!label) { - label = [[ABI46_0_0RNSVGTopAlignedLabel alloc] init]; - } - label.attributedText = (__bridge NSAttributedString * _Nullable)(attrString); - label.lineBreakMode = NSLineBreakByWordWrapping; - label.backgroundColor = ABI46_0_0RNSVGColor.clearColor; - label.textAlignment = align; - label.numberOfLines = 0; -#if !TARGET_OS_OSX // On macOS, views are transparent by default - label.opaque = NO; -#endif - label.font = font; - label.textColor = [ABI46_0_0RNSVGColor colorWithCGColor:color]; - - CGFloat fontSize = [gc getFontSize]; - CGFloat height = CGRectGetHeight(rect); - CGFloat width = [ABI46_0_0RNSVGPropHelper fromRelative:self.inlineSize - relative:[gc getWidth] - fontSize:fontSize]; - CGRect constrain = CGRectMake(0, 0, width, height); - CGRect s = [self.content - boundingRectWithSize:constrain.size - options:NSStringDrawingUsesLineFragmentOrigin - attributes:attrs - context:nil]; - - CGRect bounds = CGRectMake(0, 0, width, s.size.height); - label.frame = bounds; - label.bounds = bounds; - - firstX = [gc nextXWithDouble:0]; - firstY = [gc nextY] - font.ascender; - CGFloat dx = firstX; - CGFloat dy = firstY; - CGContextTranslateCTM(context, dx, dy); - [label.layer renderInContext:context]; - CGContextTranslateCTM(context, -dx, -dy); - [self popGlyphContext]; - [self renderPathTo:context rect:rect]; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGPathRef path = self.path; - if (path) { - return path; - } - - NSString *text = self.content; - if (!text) { - return [self getGroupPath:context]; - } - - if (self.inlineSize != nil && self.inlineSize.value != 0) { - CGAffineTransform transform = CGAffineTransformMakeTranslation(firstX, firstY); - path = CGPathCreateWithRect(label.bounds, &transform); - self.path = CGPathRetain(path); - self.skip = true; - return path; - } - - [self setupTextPath:context]; - - [self pushGlyphContext]; - - path = [self getLinePath:text context:context]; - - self.path = CGPathRetain(path); - - [self popGlyphContext]; - - return path; -} - -- (CGFloat)getSubtreeTextChunksTotalAdvance -{ - if (!isnan(cachedAdvance)) { - return cachedAdvance; - } - CGFloat advance = 0; - - NSString *str = self.content; - if (!str) { - for (ABI46_0_0RNSVGView *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGText class]]) { - ABI46_0_0RNSVGText *text = (ABI46_0_0RNSVGText*)node; - advance += [text getSubtreeTextChunksTotalAdvance]; - } - } - cachedAdvance = advance; - return advance; - } - - // Create a dictionary for this font - fontRef = [self getFontFromContext]; - ABI46_0_0RNSVGGlyphContext *gc = [self.textRoot getGlyphContext]; - ABI46_0_0RNSVGFontData *fontdata = [gc getFont]; - NSMutableDictionary *attrs = [self getAttributes:fontdata]; - - CFStringRef string = (__bridge CFStringRef)str; - CFMutableDictionaryRef attributes = (__bridge CFMutableDictionaryRef)attrs; - CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes); - CTLineRef line = CTLineCreateWithAttributedString(attrString); - - CGRect textBounds = CTLineGetBoundsWithOptions(line, 0); - CGFloat textMeasure = CGRectGetWidth(textBounds); - cachedAdvance = textMeasure; - - CFRelease(attrString); - CFRelease(line); - - return textMeasure; -} - -- (CGPathRef)getLinePath:(NSString *)str context:(CGContextRef)context -{ - // Create a dictionary for this font - fontRef = [self getFontFromContext]; - CGMutablePathRef path = CGPathCreateMutable(); - ABI46_0_0RNSVGGlyphContext *gc = [self.textRoot getGlyphContext]; - ABI46_0_0RNSVGFontData *font = [gc getFont]; - NSUInteger n = str.length; - /* - * - * Three properties affect the space between characters and words: - * - * ‘kerning’ indicates whether the user agent should adjust inter-glyph spacing - * based on kerning tables that are included in the relevant font - * (i.e., enable auto-kerning) or instead disable auto-kerning - * and instead set inter-character spacing to a specific length (typically, zero). - * - * ‘letter-spacing’ indicates an amount of space that is to be added between text - * characters supplemental to any spacing due to the ‘kerning’ property. - * - * ‘word-spacing’ indicates the spacing behavior between words. - * - * Letter-spacing is applied after bidi reordering and is in addition to any word-spacing. - * Depending on the justification rules in effect, user agents may further increase - * or decrease the space between typographic character units in order to justify text. - * - * */ - CGFloat kerning = font->kerning; - CGFloat wordSpacing = font->wordSpacing; - CGFloat letterSpacing = font->letterSpacing; - bool autoKerning = !font->manualKerning; - - /* - 11.1.2. Fonts and glyphs - - A font consists of a collection of glyphs together with other information (collectively, - the font tables) necessary to use those glyphs to present characters on some visual medium. - - The combination of the collection of glyphs and the font tables is called the font data. - - A font may supply substitution and positioning tables that can be used by a formatter - (text shaper) to re-order, combine and position a sequence of glyphs to form one or more - composite glyphs. - - The combining may be as simple as a ligature, or as complex as an indic syllable which - combines, usually with some re-ordering, multiple consonants and vowel glyphs. - - The tables may be language dependent, allowing the use of language appropriate letter forms. - - When a glyph, simple or composite, represents an indivisible unit for typesetting purposes, - it is know as a typographic character. - - Ligatures are an important feature of advance text layout. - - Some ligatures are discretionary while others (e.g. in Arabic) are required. - - The following explicit rules apply to ligature formation: - - Ligature formation should not be enabled when characters are in different DOM text nodes; - thus, characters separated by markup should not use ligatures. - - Ligature formation should not be enabled when characters are in different text chunks. - - Discretionary ligatures should not be used when the spacing between two characters is not - the same as the default space (e.g. when letter-spacing has a non-default value, - or text-align has a value of justify and text-justify has a value of distribute). - (See CSS Text Module Level 3, ([css-text-3]). - - SVG attributes such as ‘dx’, ‘textLength’, and ‘spacing’ (in ‘textPath’) that may reposition - typographic characters do not break discretionary ligatures. - - If discretionary ligatures are not desired - they can be turned off by using the font-variant-ligatures property. - - When the effective letter-spacing between two characters is not zero - (due to either justification or non-zero computed ‘letter-spacing’), - user agents should not apply optional ligatures. - https://www.w3.org/TR/css-text-3/#letter-spacing-property - */ - bool allowOptionalLigatures = letterSpacing == 0 && font->fontVariantLigatures == ABI46_0_0RNSVGFontVariantLigaturesNormal; - - /* - For OpenType fonts, discretionary ligatures include those enabled by - the liga, clig, dlig, hlig, and cala features; - required ligatures are found in the rlig feature. - https://svgwg.org/svg2-draft/text.html#FontsGlyphs - - http://dev.w3.org/csswg/css-fonts/#propdef-font-feature-settings - - https://www.microsoft.com/typography/otspec/featurelist.htm - https://www.microsoft.com/typography/otspec/featuretags.htm - https://www.microsoft.com/typography/otspec/features_pt.htm - https://www.microsoft.com/typography/otfntdev/arabicot/features.aspx - http://unifraktur.sourceforge.net/testcases/enable_opentype_features/ - https://en.wikipedia.org/wiki/List_of_typographic_features - http://ilovetypography.com/OpenType/opentype-features.html - https://www.typotheque.com/articles/opentype_features_in_css - https://practice.typekit.com/lesson/caring-about-opentype-features/ - http://stateofwebtype.com/ - - 6.12. Low-level font feature settings control: the font-feature-settings property - - Name: font-feature-settings - Value: normal | # - Initial: normal - Applies to: all elements - Inherited: yes - Percentages: N/A - Media: visual - Computed value: as specified - Animatable: no - - https://drafts.csswg.org/css-fonts-3/#default-features - - 7.1. Default features - - For OpenType fonts, user agents must enable the default features defined in the OpenType - documentation for a given script and writing mode. - - Required ligatures, common ligatures and contextual forms must be enabled by default - (OpenType features: rlig, liga, clig, calt), - along with localized forms (OpenType feature: locl), - and features required for proper display of composed characters and marks - (OpenType features: ccmp, mark, mkmk). - - These features must always be enabled, even when the value of the ‘font-variant’ and - ‘font-feature-settings’ properties is ‘normal’. - - Individual features are only disabled when explicitly overridden by the author, - as when ‘font-variant-ligatures’ is set to ‘no-common-ligatures’. - - TODO For handling complex scripts such as Arabic, Mongolian or Devanagari additional features - are required. - - TODO For upright text within vertical text runs, - vertical alternates (OpenType feature: vert) must be enabled. - */ - // OpenType.js font data - NSDictionary * fontData = font->fontData; - NSMutableDictionary *attrs = [[NSMutableDictionary alloc] init]; - CFMutableDictionaryRef attributes = (__bridge CFMutableDictionaryRef)attrs; - - NSNumber *lig = [NSNumber numberWithInt:allowOptionalLigatures ? 2 : 1]; - attrs[NSLigatureAttributeName] = lig; - if (fontRef != nil) { - attrs[NSFontAttributeName] = (__bridge id)fontRef; - } - if (!autoKerning) { - NSNumber *noAutoKern = [NSNumber numberWithFloat:0.0f]; - -#if DTCORETEXT_SUPPORT_NS_ATTRIBUTES - if (___useiOS6Attributes) - { - [attrs setObject:noAutoKern forKey:NSKernAttributeName]; - } - else -#endif - { - [attrs setObject:noAutoKern forKey:(id)kCTKernAttributeName]; - } - } - - CFStringRef string = (__bridge CFStringRef)str; - CFAttributedStringRef attrString = CFAttributedStringCreate(kCFAllocatorDefault, string, attributes); - CTLineRef line = CTLineCreateWithAttributedString(attrString); - - /* - Determine the startpoint-on-the-path for the first glyph using attribute ‘startOffset’ - and property text-anchor. - - For text-anchor:start, startpoint-on-the-path is the point - on the path which represents the point on the path which is ‘startOffset’ distance - along the path from the start of the path, calculated using the user agent's distance - along the path algorithm. - - For text-anchor:middle, startpoint-on-the-path is the point - on the path which represents the point on the path which is [ ‘startOffset’ minus half - of the total advance values for all of the glyphs in the ‘textPath’ element ] distance - along the path from the start of the path, calculated using the user agent's distance - along the path algorithm. - - For text-anchor:end, startpoint-on-the-path is the point on - the path which represents the point on the path which is [ ‘startOffset’ minus the - total advance values for all of the glyphs in the ‘textPath’ element ]. - - Before rendering the first glyph, the horizontal component of the startpoint-on-the-path - is adjusted to take into account various horizontal alignment text properties and - attributes, such as a ‘dx’ attribute value on a ‘tspan’ element. - */ - enum ABI46_0_0RNSVGTextAnchor textAnchor = font->textAnchor; - ABI46_0_0RNSVGText *anchorRoot = [self getTextAnchorRoot]; - CGFloat textMeasure = [anchorRoot getSubtreeTextChunksTotalAdvance]; - CGFloat offset = [ABI46_0_0RNSVGTSpan getTextAnchorOffset:textAnchor width:textMeasure]; - - bool hasTextPath = textPath != nil; - - int side = 1; - CGFloat startOfRendering = 0; - CGFloat endOfRendering = measure.pathLength; - CGFloat fontSize = [gc getFontSize]; - //bool sharpMidLine = false; - if (hasTextPath) { - //sharpMidLine = ABI46_0_0RNSVGTextPathMidLineFromString([textPath midLine]) == ABI46_0_0RNSVGTextPathMidLineSharp; - /* - Name - side - Value - left | right - initial value - left - Animatable - yes - - Determines the side of the path the text is placed on - (relative to the path direction). - - Specifying a value of right effectively reverses the path. - - Added in SVG 2 to allow text either inside or outside closed subpaths - and basic shapes (e.g. rectangles, circles, and ellipses). - - Adding 'side' was resolved at the Sydney (2015) meeting. - */ - side = ABI46_0_0RNSVGTextPathSideFromString([textPath side]) == ABI46_0_0RNSVGTextPathSideRight ? -1 : 1; - /* - Name - startOffset - Value - | | - initial value - 0 - Animatable - yes - - An offset from the start of the path for the initial current text position, - calculated using the user agent's distance along the path algorithm, - after converting the path to the ‘textPath’ element's coordinate system. - - If a other than a percentage is given, then the ‘startOffset’ - represents a distance along the path measured in the current user coordinate - system for the ‘textPath’ element. - - If a percentage is given, then the ‘startOffset’ represents a percentage - distance along the entire path. Thus, startOffset="0%" indicates the start - point of the path and startOffset="100%" indicates the end point of the path. - - Negative values and values larger than the path length (e.g. 150%) are allowed. - - Any typographic characters with mid-points that are not on the path are not rendered - - For paths consisting of a single closed subpath (including an equivalent path for a - basic shape), typographic characters are rendered along one complete circuit of the - path. The text is aligned as determined by the text-anchor property to a position - along the path set by the ‘startOffset’ attribute. - - For the start (end) value, the text is rendered from the start (end) of the line - until the initial position along the path is reached again. - - For the middle, the text is rendered from the middle point in both directions until - a point on the path equal distance in both directions from the initial position on - the path is reached. - */ - CGFloat absoluteStartOffset = [ABI46_0_0RNSVGPropHelper fromRelative:textPath.startOffset - relative:measure.pathLength - fontSize:fontSize]; - offset += absoluteStartOffset; - if (measure.isClosed) { - CGFloat halfPathDistance = measure.pathLength / 2; - startOfRendering = absoluteStartOffset + (textAnchor == ABI46_0_0RNSVGTextAnchorMiddle ? -halfPathDistance : 0); - endOfRendering = startOfRendering + measure.pathLength; - } - /* - ABI46_0_0RNSVGTextPathSpacing spacing = textPath.getSpacing(); - if (spacing == ABI46_0_0RNSVGTextPathSpacing.auto) { - // Hmm, what to do here? - // https://svgwg.org/svg2-draft/text.html#TextPathElementSpacingAttribute - } - */ - } - - /* - Name - method - Value - align | stretch - initial value - align - Animatable - yes - Indicates the method by which text should be rendered along the path. - - A value of align indicates that the typographic character should be rendered using - simple 2×3 matrix transformations such that there is no stretching/warping of the - typographic characters. Typically, supplemental rotation, scaling and translation - transformations are done for each typographic characters to be rendered. - - As a result, with align, in fonts where the typographic characters are designed to be - connected (e.g., cursive fonts), the connections may not align properly when text is - rendered along a path. - - A value of stretch indicates that the typographic character outlines will be converted - into paths, and then all end points and control points will be adjusted to be along the - perpendicular vectors from the path, thereby stretching and possibly warping the glyphs. - - With this approach, connected typographic characters, such as in cursive scripts, - will maintain their connections. (Non-vertical straight path segments should be - converted to Bézier curves in such a way that horizontal straight paths have an - (approximately) constant offset from the path along which the typographic characters - are rendered.) - - TODO implement stretch - */ - - /* - Name Value Initial value Animatable - textLength | | See below yes - - The author's computation of the total sum of all of the advance values that correspond - to character data within this element, including the advance value on the glyph - (horizontal or vertical), the effect of properties letter-spacing and word-spacing and - adjustments due to attributes ‘dx’ and ‘dy’ on this ‘text’ or ‘tspan’ element or any - descendants. This value is used to calibrate the user agent's own calculations with - that of the author. - - The purpose of this attribute is to allow the author to achieve exact alignment, - in visual rendering order after any bidirectional reordering, for the first and - last rendered glyphs that correspond to this element; thus, for the last rendered - character (in visual rendering order after any bidirectional reordering), - any supplemental inter-character spacing beyond normal glyph advances are ignored - (in most cases) when the user agent determines the appropriate amount to expand/compress - the text string to fit within a length of ‘textLength’. - - If attribute ‘textLength’ is specified on a given element and also specified on an - ancestor, the adjustments on all character data within this element are controlled by - the value of ‘textLength’ on this element exclusively, with the possible side-effect - that the adjustment ratio for the contents of this element might be different than the - adjustment ratio used for other content that shares the same ancestor. The user agent - must assume that the total advance values for the other content within that ancestor is - the difference between the advance value on that ancestor and the advance value for - this element. - - This attribute is not intended for use to obtain effects such as shrinking or - expanding text. - - A negative value is an error (see Error processing). - - The ‘textLength’ attribute is only applied when the wrapping area is not defined by the - TODO shape-inside or the inline-size properties. It is also not applied for any ‘text’ or - TODO ‘tspan’ element that has forced line breaks (due to a white-space value of pre or - pre-line). - - If the attribute is not specified anywhere within a ‘text’ element, the effect is as if - the author's computation exactly matched the value calculated by the user agent; - thus, no advance adjustments are made. - */ - CGFloat scaleSpacingAndGlyphs = 1; - ABI46_0_0RNSVGLength *mTextLength = [self textLength]; - enum ABI46_0_0RNSVGTextLengthAdjust mLengthAdjust = ABI46_0_0RNSVGTextLengthAdjustFromString([self lengthAdjust]); - if (mTextLength != nil) { - CGFloat author = [ABI46_0_0RNSVGPropHelper fromRelative:mTextLength - relative:[gc getWidth] - fontSize:fontSize]; - if (author < 0) { - NSException *e = [NSException - exceptionWithName:@"NegativeTextLength" - reason:@"Negative textLength value" - userInfo:nil]; - @throw e; - } - switch (mLengthAdjust) { - default: - case ABI46_0_0RNSVGTextLengthAdjustSpacing: - // TODO account for ligatures - letterSpacing += (author - textMeasure) / (n - 1); - break; - case ABI46_0_0RNSVGTextLengthAdjustSpacingAndGlyphs: - scaleSpacingAndGlyphs = author / textMeasure; - break; - } - } - CGFloat scaledDirection = scaleSpacingAndGlyphs * side; - - /* - https://developer.mozilla.org/en/docs/Web/CSS/vertical-align - https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6bsln.html - https://www.microsoft.com/typography/otspec/base.htm - http://apike.ca/prog_svg_text_style.html - https://www.w3schools.com/tags/canvas_textbaseline.asp - http://vanseodesign.com/web-design/svg-text-baseline-alignment/ - https://iamvdo.me/en/blog/css-font-metrics-line-height-and-vertical-align - https://tympanus.net/codrops/css_reference/vertical-align/ - - https://svgwg.org/svg2-draft/text.html#AlignmentBaselineProperty - 11.10.2.6. The ‘alignment-baseline’ property - - This property is defined in the CSS Line Layout Module 3 specification. See 'alignment-baseline'. [css-inline-3] - https://drafts.csswg.org/css-inline/#propdef-alignment-baseline - - The vertical-align property shorthand should be preferred in new content. - - SVG 2 introduces some changes to the definition of this property. - In particular: the values 'auto', 'before-edge', and 'after-edge' have been removed. - For backwards compatibility, 'text-before-edge' should be mapped to 'text-top' and - 'text-after-edge' should be mapped to 'text-bottom'. - - Neither 'text-before-edge' nor 'text-after-edge' should be used with the vertical-align property. - */ - /* - CGRect fontBounds = CTFontGetBoundingBox(fontRef); - CGFloat textHeight = CGRectGetHeight(textBounds); - CGFloat fontWidth = CGRectGetWidth(textBounds); - CGPoint fontOrigin = fontBounds.origin; - - CGFloat fontMinX = fontOrigin.x; - CGFloat fontMinY = fontOrigin.y; - CGFloat fontMaxX = fontMinX + fontWidth; - CGFloat fontMaxY = fontMinY + textHeight; - */ - // TODO - CGFloat descenderDepth = CTFontGetDescent(fontRef); - CGFloat bottom = descenderDepth + CTFontGetLeading(fontRef); - CGFloat ascenderHeight = CTFontGetAscent(fontRef); - CGFloat top = ascenderHeight; - CGFloat totalHeight = top + bottom; - CGFloat baselineShift = 0; - NSString *baselineShiftString = self.baselineShift; - enum ABI46_0_0RNSVGAlignmentBaseline baseline = ABI46_0_0RNSVGAlignmentBaselineFromString(self.alignmentBaseline); - if (baseline != ABI46_0_0RNSVGAlignmentBaselineBaseline) { - // TODO alignment-baseline, test / verify behavior - // TODO get per glyph baselines from font baseline table, for high-precision alignment - CGFloat xHeight = CTFontGetXHeight(fontRef); - switch (baseline) { - // https://wiki.apache.org/xmlgraphics-fop/LineLayout/AlignmentHandling - default: - case ABI46_0_0RNSVGAlignmentBaselineBaseline: - // Use the dominant baseline choice of the parent. - // Match the box’s corresponding baseline to that of its parent. - baselineShift = 0; - break; - - case ABI46_0_0RNSVGAlignmentBaselineTextBottom: - case ABI46_0_0RNSVGAlignmentBaselineAfterEdge: - case ABI46_0_0RNSVGAlignmentBaselineTextAfterEdge: - // Match the bottom of the box to the bottom of the parent’s content area. - // text-after-edge = text-bottom - // text-after-edge = descender depth - baselineShift = -descenderDepth; - break; - - case ABI46_0_0RNSVGAlignmentBaselineAlphabetic: - // Match the box’s alphabetic baseline to that of its parent. - // alphabetic = 0 - baselineShift = 0; - break; - - case ABI46_0_0RNSVGAlignmentBaselineIdeographic: - // Match the box’s ideographic character face under-side baseline to that of its parent. - // ideographic = descender depth - baselineShift = -descenderDepth; - break; - - case ABI46_0_0RNSVGAlignmentBaselineMiddle: - // Align the vertical midpoint of the box with the baseline of the parent box plus half the x-height of the parent. TODO - // middle = x height / 2 - baselineShift = xHeight / 2; - break; - - case ABI46_0_0RNSVGAlignmentBaselineCentral: - // Match the box’s central baseline to the central baseline of its parent. - // central = (ascender height - descender depth) / 2 - baselineShift = (ascenderHeight - descenderDepth) / 2; - break; - - case ABI46_0_0RNSVGAlignmentBaselineMathematical: - // Match the box’s mathematical baseline to that of its parent. - // Hanging and mathematical baselines - // There are no obvious formulas to calculate the position of these baselines. - // At the time of writing FOP puts the hanging baseline at 80% of the ascender - // height and the mathematical baseline at 50%. - baselineShift = (CGFloat)0.5 * ascenderHeight; - break; - - case ABI46_0_0RNSVGAlignmentBaselineHanging: - baselineShift = (CGFloat)0.8 * ascenderHeight; - break; - - case ABI46_0_0RNSVGAlignmentBaselineTextTop: - case ABI46_0_0RNSVGAlignmentBaselineBeforeEdge: - case ABI46_0_0RNSVGAlignmentBaselineTextBeforeEdge: - // Match the top of the box to the top of the parent’s content area. - // text-before-edge = text-top - // text-before-edge = ascender height - baselineShift = ascenderHeight; - break; - - case ABI46_0_0RNSVGAlignmentBaselineBottom: - // Align the top of the aligned subtree with the top of the line box. - baselineShift = bottom; - break; - - case ABI46_0_0RNSVGAlignmentBaselineCenter: - // Align the center of the aligned subtree with the center of the line box. - baselineShift = totalHeight / 2; - break; - - case ABI46_0_0RNSVGAlignmentBaselineTop: - // Align the bottom of the aligned subtree with the bottom of the line box. - baselineShift = top; - break; - } - } - /* - 2.2.2. Alignment Shift: baseline-shift longhand - - This property specifies by how much the box is shifted up from its alignment point. - It does not apply when alignment-baseline is top or bottom. - - Authors should use the vertical-align shorthand instead of this property. - - Values have the following meanings: - - - Raise (positive value) or lower (negative value) by the specified length. - - Raise (positive value) or lower (negative value) by the specified percentage of the line-height. - TODO sub - Lower by the offset appropriate for subscripts of the parent’s box. - (The UA should use the parent’s font data to find this offset whenever possible.) - TODO super - Raise by the offset appropriate for superscripts of the parent’s box. - (The UA should use the parent’s font data to find this offset whenever possible.) - - User agents may additionally support the keyword baseline as computing to 0 - if is necessary for them to support legacy SVG content. - Issue: We would prefer to remove this, - and are looking for feedback from SVG user agents as to whether it’s necessary. - - https://www.w3.org/TR/css-inline-3/#propdef-baseline-shift - */ - if (baselineShiftString != nil && ![baselineShiftString isEqualToString:@""]) { - switch (baseline) { - case ABI46_0_0RNSVGAlignmentBaselineTop: - case ABI46_0_0RNSVGAlignmentBaselineBottom: - break; - - default: - if (fontData != nil && [baselineShiftString isEqualToString:@"sub"]) { - // TODO - NSDictionary* tables = [fontData objectForKey:@"tables"]; - NSNumber* unitsPerEm = [fontData objectForKey:@"unitsPerEm"]; - NSDictionary* os2 = [tables objectForKey:@"os2"]; - NSNumber* ySubscriptYOffset = [os2 objectForKey:@"ySubscriptYOffset"]; - if (ySubscriptYOffset) { - CGFloat subOffset = (CGFloat)[ySubscriptYOffset doubleValue]; - baselineShift += fontSize * subOffset / [unitsPerEm doubleValue]; - } - } else if (fontData != nil && [baselineShiftString isEqualToString:@"super"]) { - // TODO - NSDictionary* tables = [fontData objectForKey:@"tables"]; - NSNumber* unitsPerEm = [fontData objectForKey:@"unitsPerEm"]; - NSDictionary* os2 = [tables objectForKey:@"os2"]; - NSNumber* ySuperscriptYOffset = [os2 objectForKey:@"ySuperscriptYOffset"]; - if (ySuperscriptYOffset) { - CGFloat superOffset = (CGFloat)[ySuperscriptYOffset doubleValue]; - baselineShift -= fontSize * superOffset / [unitsPerEm doubleValue]; - } - } else if ([baselineShiftString isEqualToString:@"baseline"]) { - } else { - baselineShift -= [ABI46_0_0RNSVGPropHelper fromRelativeWithNSString:baselineShiftString - relative:fontSize - fontSize:fontSize]; - } - break; - } - } - - [emoji removeAllObjects]; - [emojiTransform removeAllObjects]; - - CFArrayRef runs = CTLineGetGlyphRuns(line); - CFIndex runEnd = CFArrayGetCount(runs); - for (CFIndex ri = 0; ri < runEnd; ri++) { - CTRunRef run = CFArrayGetValueAtIndex(runs, ri); - CFIndex runGlyphCount = CTRunGetGlyphCount(run); - CFIndex indices[runGlyphCount]; - CGSize advances[runGlyphCount]; - CGGlyph glyphs[runGlyphCount]; - - // Grab the glyphs and font - CTRunGetGlyphs(run, CFRangeMake(0, 0), glyphs); - CTRunGetStringIndices(run, CFRangeMake(0, 0), indices); - CTFontRef runFont = CFDictionaryGetValue(CTRunGetAttributes(run), kCTFontAttributeName); - CTFontGetAdvancesForGlyphs(runFont, kCTFontOrientationHorizontal, glyphs, advances, runGlyphCount); - CFIndex nextOrEndRunIndex = n; - if (ri + 1 < runEnd) { - CTRunRef nextRun = CFArrayGetValueAtIndex(runs, ri + 1); - CFIndex nextRunGlyphCount = CTRunGetGlyphCount(nextRun); - CFIndex nextIndices[nextRunGlyphCount]; - CTRunGetStringIndices(nextRun, CFRangeMake(0, 0), nextIndices); - nextOrEndRunIndex = nextIndices[0]; - } - - for(CFIndex g = 0; g < runGlyphCount; g++) { - CGGlyph glyph = glyphs[g]; - - /* - Determine the glyph's charwidth (i.e., the amount which the current text position - advances horizontally when the glyph is drawn using horizontal text layout). - - For each subsequent glyph, set a new startpoint-on-the-path as the previous - endpoint-on-the-path, but with appropriate adjustments taking into account - horizontal kerning tables in the font and current values of various attributes - and properties, including spacing properties (e.g. letter-spacing and word-spacing) - and ‘tspan’ elements with values provided for attributes ‘dx’ and ‘dy’. All - adjustments are calculated as distance adjustments along the path, calculated - using the user agent's distance along the path algorithm. - */ - CGFloat charWidth = advances[g].width * scaleSpacingAndGlyphs; - - CFIndex currIndex = indices[g]; - unichar currentChar = [str characterAtIndex:currIndex]; - bool isWordSeparator = [ABI46_0_0RNSVGTSpan_separators characterIsMember:currentChar]; - CGFloat wordSpace = isWordSeparator ? wordSpacing : 0; - CGFloat spacing = wordSpace + letterSpacing; - CGFloat advance = charWidth + spacing; - - CGFloat x = [gc nextXWithDouble:kerning + advance]; - CGFloat y = [gc nextY]; - CGFloat dx = [gc nextDeltaX]; - CGFloat dy = [gc nextDeltaY]; - CGFloat r = [gc nextRotation] / ABI46_0_0RNSVGTSpan_radToDeg; - - if (isWordSeparator) { - continue; - } - - CFIndex endIndex = g + 1 == runGlyphCount ? nextOrEndRunIndex : indices[g + 1]; - while (++currIndex < endIndex) { - // Skip rendering other grapheme clusters of ligatures (already rendered), - // And, make sure to increment index positions by making gc.next() calls. - [gc nextXWithDouble:0]; - [gc nextY]; - [gc nextDeltaX]; - [gc nextDeltaY]; - [gc nextRotation]; - } - CGPathRef glyphPath = CTFontCreatePathForGlyph(runFont, glyph, nil); - - advance *= side; - charWidth *= side; - CGFloat cursor = offset + (x + dx) * side; - CGFloat startPoint = cursor - advance; - - CGAffineTransform transform = CGAffineTransformIdentity; - if (hasTextPath) { - /* - Determine the point on the curve which is charwidth distance along the path from - the startpoint-on-the-path for this glyph, calculated using the user agent's - distance along the path algorithm. This point is the endpoint-on-the-path for - the glyph. - */ - // TODO CGFloat endPoint = startPoint + charWidth; - - /* - Determine the midpoint-on-the-path, which is the point on the path which is - "halfway" (user agents can choose either a distance calculation or a parametric - calculation) between the startpoint-on-the-path and the endpoint-on-the-path. - */ - CGFloat halfWay = charWidth / 2; - CGFloat midPoint = startPoint + halfWay; - - // Glyphs whose midpoint-on-the-path are off the path are not rendered. - if (midPoint > endOfRendering) { - CGPathRelease(glyphPath); - continue; - } else if (midPoint < startOfRendering) { - CGPathRelease(glyphPath); - continue; - } - - CGFloat angle; - CGFloat px; - CGFloat py; - [measure getPosAndTan:&angle midPoint:midPoint x:&px y:&py]; - - transform = CGAffineTransformConcat(CGAffineTransformMakeTranslation(px, py), transform); - transform = CGAffineTransformConcat(CGAffineTransformMakeRotation(angle + r), transform); - transform = CGAffineTransformScale(transform, scaledDirection, side); - transform = CGAffineTransformConcat(CGAffineTransformMakeTranslation(-halfWay, y + dy + baselineShift), transform); - } else { - transform = CGAffineTransformMakeTranslation(startPoint, y + dy + baselineShift); - transform = CGAffineTransformConcat(CGAffineTransformMakeRotation(r), transform); - } - - CGRect box = CGPathGetBoundingBox(glyphPath); - CGFloat width = box.size.width; - - if (width == 0) { // Render unicode emoji - ABI46_0_0RNSVGTextView *label = [[ABI46_0_0RNSVGTextView alloc] init]; - CFIndex startIndex = indices[g]; - long len = MAX(1, endIndex - startIndex); - NSRange range = NSMakeRange(startIndex, len); - NSString* currChars = [str substringWithRange:range]; -#if TARGET_OS_OSX - label.string = currChars; -#else - label.text = currChars; - label.opaque = NO; -#endif - label.backgroundColor = ABI46_0_0RNSVGColor.clearColor; - UIFont * customFont = [UIFont systemFontOfSize:fontSize]; - - CGSize measuredSize = [currChars sizeWithAttributes: - @{NSFontAttributeName:customFont}]; - label.font = customFont; - CGFloat width = ceil(measuredSize.width); - CGFloat height = ceil(measuredSize.height); - CGRect bounds = CGRectMake(0, 0, width, height); - label.frame = bounds; - - CGContextConcatCTM(context, transform); - CGContextTranslateCTM(context, 0, -fontSize); - [label.layer renderInContext:context]; - CGContextTranslateCTM(context, 0, fontSize); - CGContextConcatCTM(context, CGAffineTransformInvert(transform)); - - [emoji addObject:label]; - [emojiTransform addObject:[NSValue valueWithCGAffineTransform:transform]]; - } else { - transform = CGAffineTransformScale(transform, 1.0, -1.0); - CGPathAddPath(path, &transform, glyphPath); - } - CGPathRelease(glyphPath); - } - } - - CFRelease(attrString); - CFRelease(line); - - return (CGPathRef)CFAutorelease(path); -} - -+ (CGFloat)getTextAnchorOffset:(ABI46_0_0RNSVGTextAnchor)textAnchor width:(CGFloat) width -{ - switch (textAnchor) { - case ABI46_0_0RNSVGTextAnchorStart: - return 0; - case ABI46_0_0RNSVGTextAnchorMiddle: - return -width / 2; - case ABI46_0_0RNSVGTextAnchorEnd: - return -width; - } - - return 0; -} - -- (void)setupTextPath:(CGContextRef)context -{ - textPath = nil; - ABI46_0_0RNSVGText *parent = (ABI46_0_0RNSVGText*)[self superview]; - CGPathRef path = nil; - while (parent) { - if ([parent class] == [ABI46_0_0RNSVGTextPath class]) { - textPath = (ABI46_0_0RNSVGTextPath*) parent; - ABI46_0_0RNSVGNode *template = [self.svgView getDefinedTemplate:textPath.href]; - path = [template getPath:context]; - [measure extractPathData:path]; - break; - } else if (![parent isKindOfClass:[ABI46_0_0RNSVGText class]]) { - break; - } - parent = (ABI46_0_0RNSVGText*)[parent superview]; - } - if (!path) { - [measure reset]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.h deleted file mode 100644 index b4bc6188f584be..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.h +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNSVGGroup.h" - -@interface ABI46_0_0RNSVGText : ABI46_0_0RNSVGGroup - -@property (nonatomic, strong) ABI46_0_0RNSVGLength *inlineSize; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *textLength; -@property (nonatomic, strong) NSString *baselineShift; -@property (nonatomic, strong) NSString *lengthAdjust; -@property (nonatomic, strong) NSString *alignmentBaseline; -@property (nonatomic, strong) NSArray *deltaX; -@property (nonatomic, strong) NSArray *deltaY; -@property (nonatomic, strong) NSArray *positionX; -@property (nonatomic, strong) NSArray *positionY; -@property (nonatomic, strong) NSArray *rotate; - -- (CGPathRef)getGroupPath:(CGContextRef)context; -- (CTFontRef)getFontFromContext; -- (CGFloat)getSubtreeTextChunksTotalAdvance; -- (ABI46_0_0RNSVGText*)getTextAnchorRoot; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.m deleted file mode 100644 index 1c3a02d3bea9bc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGText.m +++ /dev/null @@ -1,304 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGText.h" -#import "ABI46_0_0RNSVGTextPath.h" -#import -#import -#import "ABI46_0_0RNSVGGlyphContext.h" -#import "ABI46_0_0RNSVGTextProperties.h" - -@implementation ABI46_0_0RNSVGText -{ - ABI46_0_0RNSVGGlyphContext *_glyphContext; - NSString *_alignmentBaseline; - NSString *_baselineShift; - CGFloat cachedAdvance; -} - -- (void)invalidate -{ - if (self.dirty || self.merging) { - return; - } - [super invalidate]; - [self clearChildCache]; -} - -- (void)clearPath -{ - [super clearPath]; - cachedAdvance = NAN; -} - -- (void)setInlineSize:(ABI46_0_0RNSVGLength *)inlineSize -{ - if ([inlineSize isEqualTo:_inlineSize]) { - return; - } - [self invalidate]; - _inlineSize = inlineSize; -} - -- (void)setTextLength:(ABI46_0_0RNSVGLength *)textLength -{ - if ([textLength isEqualTo:_textLength]) { - return; - } - [self invalidate]; - _textLength = textLength; -} - -- (void)setBaselineShift:(NSString *)baselineShift -{ - if ([baselineShift isEqualToString:_baselineShift]) { - return; - } - [self invalidate]; - _baselineShift = baselineShift; -} - -- (void)setLengthAdjust:(NSString *)lengthAdjust -{ - if ([lengthAdjust isEqualToString:_lengthAdjust]) { - return; - } - [self invalidate]; - _lengthAdjust = lengthAdjust; -} - -- (void)setAlignmentBaseline:(NSString *)alignmentBaseline -{ - if ([alignmentBaseline isEqualToString:_alignmentBaseline]) { - return; - } - [self invalidate]; - _alignmentBaseline = alignmentBaseline; -} - -- (void)setDeltaX:(NSArray *)deltaX -{ - if (deltaX == _deltaX) { - return; - } - [self invalidate]; - _deltaX = deltaX; -} - -- (void)setDeltaY:(NSArray *)deltaY -{ - if (deltaY == _deltaY) { - return; - } - [self invalidate]; - _deltaY = deltaY; -} - -- (void)setPositionX:(NSArray*)positionX -{ - if (positionX == _positionX) { - return; - } - [self invalidate]; - _positionX = positionX; -} - -- (void)setPositionY:(NSArray*)positionY -{ - if (positionY == _positionY) { - return; - } - [self invalidate]; - _positionY = positionY; -} - -- (void)setRotate:(NSArray *)rotate -{ - if (rotate == _rotate) { - return; - } - [self invalidate]; - _rotate = rotate; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - CGContextSaveGState(context); - [self clip:context]; - [self setupGlyphContext:context]; - [self pushGlyphContext]; - [super renderGroupTo:context rect:rect]; - [self popGlyphContext]; - CGContextRestoreGState(context); -} - -- (void)setupGlyphContext:(CGContextRef)context -{ - CGRect bounds = CGContextGetClipBoundingBox(context); - CGSize size = bounds.size; - _glyphContext = [[ABI46_0_0RNSVGGlyphContext alloc] initWithWidth:size.width - height:size.height]; -} - -- (CGPathRef)getGroupPath:(CGContextRef)context -{ - CGPathRef path = self.path; - if (path) { - return path; - } - [self pushGlyphContext]; - path = [super getPath:context]; - [self popGlyphContext]; - self.path = path; - return path; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - CGPathRef path = self.path; - if (path) { - return path; - } - [self setupGlyphContext:context]; - return [self getGroupPath:context]; -} - -- (void)renderGroupTo:(CGContextRef)context rect:(CGRect)rect -{ - [self pushGlyphContext]; - [super renderGroupTo:context rect:rect]; - [self popGlyphContext]; -} - -// TODO: Optimisation required -- (ABI46_0_0RNSVGText *)textRoot -{ - ABI46_0_0RNSVGText *root = self; - while (root && [root class] != [ABI46_0_0RNSVGText class]) { - if (![root isKindOfClass:[ABI46_0_0RNSVGText class]]) { - //todo: throw exception here - break; - } - root = (ABI46_0_0RNSVGText*)[root superview]; - } - - return root; -} - -- (NSString *)alignmentBaseline -{ - if (_alignmentBaseline != nil) { - return _alignmentBaseline; - } - - ABI46_0_0RNSVGPlatformView* parent = self.superview; - while (parent != nil) { - if ([parent isKindOfClass:[ABI46_0_0RNSVGText class]]) { - ABI46_0_0RNSVGText* node = (ABI46_0_0RNSVGText*)parent; - NSString* baseline = node.alignmentBaseline; - if (baseline != nil) { - _alignmentBaseline = baseline; - return baseline; - } - } - parent = [parent superview]; - } - - if (_alignmentBaseline == nil) { - _alignmentBaseline = ABI46_0_0RNSVGAlignmentBaselineStrings[0]; - } - return _alignmentBaseline; -} - -- (NSString *)baselineShift -{ - if (_baselineShift != nil) { - return _baselineShift; - } - - ABI46_0_0RNSVGPlatformView* parent = [self superview]; - while (parent != nil) { - if ([parent isKindOfClass:[ABI46_0_0RNSVGText class]]) { - ABI46_0_0RNSVGText* node = (ABI46_0_0RNSVGText*)parent; - NSString* baselineShift = node.baselineShift; - if (baselineShift != nil) { - _baselineShift = baselineShift; - return baselineShift; - } - } - parent = [parent superview]; - } - - // set default value - _baselineShift = @""; - - return _baselineShift; -} - -- (ABI46_0_0RNSVGGlyphContext *)getGlyphContext -{ - return _glyphContext; -} - -- (void)pushGlyphContext -{ - [[self.textRoot getGlyphContext] pushContext:self - font:self.font - x:self.positionX - y:self.positionY - deltaX:self.deltaX - deltaY:self.deltaY - rotate:self.rotate]; -} - -- (void)popGlyphContext -{ - [[self.textRoot getGlyphContext] popContext]; -} - -- (CTFontRef)getFontFromContext -{ - return [[self.textRoot getGlyphContext] getGlyphFont]; -} - -- (ABI46_0_0RNSVGText*)getTextAnchorRoot -{ - ABI46_0_0RNSVGGlyphContext* gc = [self.textRoot getGlyphContext]; - NSArray* font = [gc getFontContext]; - ABI46_0_0RNSVGText* node = self; - ABI46_0_0RNSVGPlatformView* parent = [self superview]; - for (NSInteger i = [font count] - 1; i >= 0; i--) { - ABI46_0_0RNSVGFontData* fontData = [font objectAtIndex:i]; - if (![parent isKindOfClass:[ABI46_0_0RNSVGText class]] || - fontData->textAnchor == ABI46_0_0RNSVGTextAnchorStart || - node.positionX != nil) { - return node; - } - node = (ABI46_0_0RNSVGText*) parent; - parent = [node superview]; - } - return node; -} - -- (CGFloat)getSubtreeTextChunksTotalAdvance -{ - if (!isnan(cachedAdvance)) { - return cachedAdvance; - } - CGFloat advance = 0; - for (ABI46_0_0RNSVGView *node in self.subviews) { - if ([node isKindOfClass:[ABI46_0_0RNSVGText class]]) { - ABI46_0_0RNSVGText *text = (ABI46_0_0RNSVGText*)node; - advance += [text getSubtreeTextChunksTotalAdvance]; - } - } - cachedAdvance = advance; - return advance; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.h deleted file mode 100644 index 1c48a0338c066a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.h +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import "ABI46_0_0RNSVGText.h" -#import "ABI46_0_0RNSVGLength.h" - -@interface ABI46_0_0RNSVGTextPath : ABI46_0_0RNSVGText - -@property (nonatomic, strong) NSString *href; -@property (nonatomic, strong) NSString *side; -@property (nonatomic, strong) NSString *method; -@property (nonatomic, strong) NSString *midLine; -@property (nonatomic, strong) NSString *spacing; -@property (nonatomic, strong) ABI46_0_0RNSVGLength *startOffset; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.m deleted file mode 100644 index 6161074c38a9bc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextPath.m +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import "ABI46_0_0RNSVGTextPath.h" - -@implementation ABI46_0_0RNSVGTextPath - -- (void)setHref:(NSString *)href -{ - if ([href isEqualToString:_href]) { - return; - } - [self invalidate]; - _href = href; -} - -- (void)setSide:(NSString *)side -{ - if ([side isEqualToString:_side]) { - return; - } - [self invalidate]; - _side = side; -} - -- (void)setMethod:(NSString *)method -{ - if ([method isEqualToString:_method]) { - return; - } - [self invalidate]; - _method = method; -} - -- (void)setMidLine:(NSString *)midLine -{ - if ([midLine isEqualToString:_midLine]) { - return; - } - [self invalidate]; - _midLine = midLine; -} - -- (void)setSpacing:(NSString *)spacing -{ - if ([spacing isEqualToString:_spacing]) { - return; - } - [self invalidate]; - _spacing = spacing; -} - -- (void)setStartOffset:(ABI46_0_0RNSVGLength *)startOffset -{ - if ([startOffset isEqualTo:_startOffset]) { - return; - } - [self invalidate]; - _startOffset = startOffset; -} - -- (void)renderLayerTo:(CGContextRef)context rect:(CGRect)rect -{ - [self renderGroupTo:context rect:rect]; -} - -- (CGPathRef)getPath:(CGContextRef)context -{ - return [self getGroupPath:context]; -} - -- (void)pushGlyphContext -{ - // TextPath do not affect the glyphContext -} - -- (void)popGlyphContext -{ - // TextPath do not affect the glyphContext -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.h deleted file mode 100644 index bb04c8025425d2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.h +++ /dev/null @@ -1,217 +0,0 @@ -#import - -#ifndef ABI46_0_0RNTextProperties_h -#define ABI46_0_0RNTextProperties_h - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGAlignmentBaseline) { - ABI46_0_0RNSVGAlignmentBaselineBaseline, - ABI46_0_0RNSVGAlignmentBaselineTextBottom, - ABI46_0_0RNSVGAlignmentBaselineAlphabetic, - ABI46_0_0RNSVGAlignmentBaselineIdeographic, - ABI46_0_0RNSVGAlignmentBaselineMiddle, - ABI46_0_0RNSVGAlignmentBaselineCentral, - ABI46_0_0RNSVGAlignmentBaselineMathematical, - ABI46_0_0RNSVGAlignmentBaselineTextTop, - ABI46_0_0RNSVGAlignmentBaselineBottom, - ABI46_0_0RNSVGAlignmentBaselineCenter, - ABI46_0_0RNSVGAlignmentBaselineTop, - /* - SVG implementations may support the following aliases in order to support legacy content: - - text-before-edge = text-top - text-after-edge = text-bottom - */ - ABI46_0_0RNSVGAlignmentBaselineTextBeforeEdge, - ABI46_0_0RNSVGAlignmentBaselineTextAfterEdge, - // SVG 1.1 - ABI46_0_0RNSVGAlignmentBaselineBeforeEdge, - ABI46_0_0RNSVGAlignmentBaselineAfterEdge, - ABI46_0_0RNSVGAlignmentBaselineHanging, - ABI46_0_0RNSVGAlignmentBaselineDEFAULT = ABI46_0_0RNSVGAlignmentBaselineBaseline -}; - -static NSString* const ABI46_0_0RNSVGAlignmentBaselineStrings[] = { - @"baseline", - @"text-bottom", - @"alphabetic", - @"ideographic", - @"middle", - @"central", - @"mathematical", - @"text-top", - @"bottom", - @"center", - @"top", - @"text-before-edge", - @"text-after-edge", - @"before-edge", - @"after-edge", - @"hanging", - @"central", - @"mathematical", - @"text-top", - @"bottom", - @"center", - @"top", - nil -}; - -NSString* ABI46_0_0RNSVGAlignmentBaselineToString( enum ABI46_0_0RNSVGAlignmentBaseline fw ); - -enum ABI46_0_0RNSVGAlignmentBaseline ABI46_0_0RNSVGAlignmentBaselineFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGFontStyle) { - ABI46_0_0RNSVGFontStyleNormal, - ABI46_0_0RNSVGFontStyleItalic, - ABI46_0_0RNSVGFontStyleOblique, - ABI46_0_0RNSVGFontStyleDEFAULT = ABI46_0_0RNSVGFontStyleNormal, -}; - -static NSString* const ABI46_0_0RNSVGFontStyleStrings[] = {@"normal", @"italic", @"oblique", nil}; - -NSString* ABI46_0_0RNSVGFontStyleToString( enum ABI46_0_0RNSVGFontStyle fw ); - -enum ABI46_0_0RNSVGFontStyle ABI46_0_0RNSVGFontStyleFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGFontVariantLigatures) { - ABI46_0_0RNSVGFontVariantLigaturesNormal, - ABI46_0_0RNSVGFontVariantLigaturesNone, - ABI46_0_0RNSVGFontVariantLigaturesDEFAULT = ABI46_0_0RNSVGFontVariantLigaturesNormal, -}; - -static NSString* const ABI46_0_0RNSVGFontVariantLigaturesStrings[] = {@"normal", @"none", nil}; - -NSString* ABI46_0_0RNSVGFontVariantLigaturesToString( enum ABI46_0_0RNSVGFontVariantLigatures fw ); - -enum ABI46_0_0RNSVGFontVariantLigatures ABI46_0_0RNSVGFontVariantLigaturesFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGFontWeight) { - // Absolute - ABI46_0_0RNSVGFontWeightNormal, - ABI46_0_0RNSVGFontWeightBold, - ABI46_0_0RNSVGFontWeight100, - ABI46_0_0RNSVGFontWeight200, - ABI46_0_0RNSVGFontWeight300, - ABI46_0_0RNSVGFontWeight400, - ABI46_0_0RNSVGFontWeight500, - ABI46_0_0RNSVGFontWeight600, - ABI46_0_0RNSVGFontWeight700, - ABI46_0_0RNSVGFontWeight800, - ABI46_0_0RNSVGFontWeight900, - // Relative - ABI46_0_0RNSVGFontWeightBolder, - ABI46_0_0RNSVGFontWeightLighter, - ABI46_0_0RNSVGFontWeightDEFAULT = ABI46_0_0RNSVGFontWeightNormal, -}; - -static NSString* const ABI46_0_0RNSVGFontWeightStrings[] = {@"normal", @"bold", @"100", @"200", @"300", @"400", @"500", @"600", @"700", @"800", @"900", @"bolder", @"lighter", nil}; - -static int const ABI46_0_0RNSVGAbsoluteFontWeights[] = {400, 700, 100, 200, 300, 400, 500, 600, 700, 800, 900}; - -static ABI46_0_0RNSVGFontWeight const ABI46_0_0RNSVGFontWeights[] = { - ABI46_0_0RNSVGFontWeight100, - ABI46_0_0RNSVGFontWeight100, - ABI46_0_0RNSVGFontWeight200, - ABI46_0_0RNSVGFontWeight300, - ABI46_0_0RNSVGFontWeightNormal, - ABI46_0_0RNSVGFontWeight500, - ABI46_0_0RNSVGFontWeight600, - ABI46_0_0RNSVGFontWeightBold, - ABI46_0_0RNSVGFontWeight800, - ABI46_0_0RNSVGFontWeight900, - ABI46_0_0RNSVGFontWeight900 -}; - -NSString* ABI46_0_0RNSVGFontWeightToString( enum ABI46_0_0RNSVGFontWeight fw ); - -enum ABI46_0_0RNSVGFontWeight ABI46_0_0RNSVGFontWeightFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextAnchor) { - ABI46_0_0RNSVGTextAnchorStart, - ABI46_0_0RNSVGTextAnchorMiddle, - ABI46_0_0RNSVGTextAnchorEnd, - ABI46_0_0RNSVGTextAnchorDEFAULT = ABI46_0_0RNSVGTextAnchorStart, -}; - -static NSString* const ABI46_0_0RNSVGTextAnchorStrings[] = {@"start", @"middle", @"end", nil}; - -NSString* ABI46_0_0RNSVGTextAnchorToString( enum ABI46_0_0RNSVGTextAnchor fw ); - -enum ABI46_0_0RNSVGTextAnchor ABI46_0_0RNSVGTextAnchorFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextDecoration) { - ABI46_0_0RNSVGTextDecorationNone, - ABI46_0_0RNSVGTextDecorationUnderline, - ABI46_0_0RNSVGTextDecorationOverline, - ABI46_0_0RNSVGTextDecorationLineThrough, - ABI46_0_0RNSVGTextDecorationBlink, - ABI46_0_0RNSVGTextDecorationDEFAULT = ABI46_0_0RNSVGTextDecorationNone, -}; - -static NSString* const ABI46_0_0RNSVGTextDecorationStrings[] = {@"None", @"Underline", @"Overline", @"LineThrough", @"Blink", nil}; - -NSString* ABI46_0_0RNSVGTextDecorationToString( enum ABI46_0_0RNSVGTextDecoration fw ); - -enum ABI46_0_0RNSVGTextDecoration ABI46_0_0RNSVGTextDecorationFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextLengthAdjust) { - ABI46_0_0RNSVGTextLengthAdjustSpacing, - ABI46_0_0RNSVGTextLengthAdjustSpacingAndGlyphs, - ABI46_0_0RNSVGTextLengthAdjustDEFAULT = ABI46_0_0RNSVGTextLengthAdjustSpacing, -}; - -static NSString* const ABI46_0_0RNSVGTextLengthAdjustStrings[] = {@"spacing", @"spacingAndGlyphs", nil}; - -NSString* ABI46_0_0RNSVGTextLengthAdjustToString( enum ABI46_0_0RNSVGTextLengthAdjust fw ); - -enum ABI46_0_0RNSVGTextLengthAdjust ABI46_0_0RNSVGTextLengthAdjustFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextPathMethod) { - ABI46_0_0RNSVGTextPathMethodAlign, - ABI46_0_0RNSVGTextPathMethodStretch, - ABI46_0_0RNSVGTextPathMethodDEFAULT = ABI46_0_0RNSVGTextPathMethodAlign, -}; - -static NSString* const ABI46_0_0RNSVGTextPathMethodStrings[] = {@"align", @"stretch", nil}; - -NSString* ABI46_0_0RNSVGTextPathMethodToString( enum ABI46_0_0RNSVGTextPathMethod fw ); - -enum ABI46_0_0RNSVGTextPathMethod ABI46_0_0RNSVGTextPathMethodFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextPathMidLine) { - ABI46_0_0RNSVGTextPathMidLineSharp, - ABI46_0_0RNSVGTextPathMidLineSmooth, - ABI46_0_0RNSVGTextPathMidLineDEFAULT = ABI46_0_0RNSVGTextPathMidLineSharp, -}; - -static NSString* const ABI46_0_0RNSVGTextPathMidLineStrings[] = {@"sharp", @"smooth", nil}; - -NSString* ABI46_0_0RNSVGTextPathMidLineToString( enum ABI46_0_0RNSVGTextPathMidLine fw ); - -enum ABI46_0_0RNSVGTextPathMidLine ABI46_0_0RNSVGTextPathMidLineFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextPathSide) { - ABI46_0_0RNSVGTextPathSideLeft, - ABI46_0_0RNSVGTextPathSideRight, - ABI46_0_0RNSVGTextPathSideDEFAULT = ABI46_0_0RNSVGTextPathSideLeft, -}; - -static NSString* const ABI46_0_0RNSVGTextPathSideStrings[] = {@"left", @"right", nil}; - -NSString* ABI46_0_0RNSVGTextPathSideToString( enum ABI46_0_0RNSVGTextPathSide fw ); - -enum ABI46_0_0RNSVGTextPathSide ABI46_0_0RNSVGTextPathSideFromString( NSString* s ); - -typedef NS_ENUM(NSInteger, ABI46_0_0RNSVGTextPathSpacing) { - ABI46_0_0RNSVGTextPathSpacingAutoSpacing, - ABI46_0_0RNSVGTextPathSpacingExact, - ABI46_0_0RNSVGTextPathSpacingDEFAULT = ABI46_0_0RNSVGTextPathSpacingAutoSpacing, -}; - -static NSString* const ABI46_0_0RNSVGTextPathSpacingStrings[] = {@"auto", @"exact", nil}; - -NSString* ABI46_0_0RNSVGTextPathSpacingToString( enum ABI46_0_0RNSVGTextPathSpacing fw ); - -enum ABI46_0_0RNSVGTextPathSpacing ABI46_0_0RNSVGTextPathSpacingFromString( NSString* s ); - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.m deleted file mode 100644 index ef3d553e63e182..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTextProperties.m +++ /dev/null @@ -1,232 +0,0 @@ -#import "ABI46_0_0RNSVGTextProperties.h" - -#pragma mark - ABI46_0_0RNSVGAlignmentBaseline - -NSString* ABI46_0_0RNSVGAlignmentBaselineToString( enum ABI46_0_0RNSVGAlignmentBaseline fw ) -{ - return ABI46_0_0RNSVGAlignmentBaselineStrings[fw]; -} - -enum ABI46_0_0RNSVGAlignmentBaseline ABI46_0_0RNSVGAlignmentBaselineFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGAlignmentBaselineDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGAlignmentBaselineStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGAlignmentBaselineStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGAlignmentBaselineDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGFontStyle - -NSString* ABI46_0_0RNSVGFontStyleToString( enum ABI46_0_0RNSVGFontStyle fw ) -{ - return ABI46_0_0RNSVGFontStyleStrings[fw]; -} - -enum ABI46_0_0RNSVGFontStyle ABI46_0_0RNSVGFontStyleFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGFontStyleDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGFontStyleStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGFontStyleStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGFontStyleDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGFontVariantLigatures - -NSString* ABI46_0_0RNSVGFontVariantLigaturesToString( enum ABI46_0_0RNSVGFontVariantLigatures fw ) -{ - return ABI46_0_0RNSVGFontVariantLigaturesStrings[fw]; -} - -enum ABI46_0_0RNSVGFontVariantLigatures ABI46_0_0RNSVGFontVariantLigaturesFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGFontVariantLigaturesDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGFontVariantLigaturesStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGFontVariantLigaturesStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGFontVariantLigaturesDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGFontWeight - -NSString* ABI46_0_0RNSVGFontWeightToString( enum ABI46_0_0RNSVGFontWeight fw ) -{ - return ABI46_0_0RNSVGFontWeightStrings[fw]; -} - -NSInteger ABI46_0_0RNSVGFontWeightFromString( NSString* s ) -{ - if ([s length] == 0) { - return -1; - } - const NSInteger l = sizeof(ABI46_0_0RNSVGFontWeightStrings) / sizeof(NSString*); - for (NSInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGFontWeightStrings[i]]) { - return i; - } - } - return -1; -} - -#pragma mark - ABI46_0_0RNSVGTextAnchor - -NSString* ABI46_0_0RNSVGTextAnchorToString( enum ABI46_0_0RNSVGTextAnchor fw ) -{ - return ABI46_0_0RNSVGTextAnchorStrings[fw]; -} - -enum ABI46_0_0RNSVGTextAnchor ABI46_0_0RNSVGTextAnchorFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextAnchorDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextAnchorStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextAnchorStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextAnchorDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextDecoration - -NSString* ABI46_0_0RNSVGTextDecorationToString( enum ABI46_0_0RNSVGTextDecoration fw ) -{ - return ABI46_0_0RNSVGTextDecorationStrings[fw]; -} - -enum ABI46_0_0RNSVGTextDecoration ABI46_0_0RNSVGTextDecorationFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextDecorationDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextDecorationStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextDecorationStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextDecorationDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextLengthAdjust - -NSString* ABI46_0_0RNSVGTextLengthAdjustToString( enum ABI46_0_0RNSVGTextLengthAdjust fw ) -{ - return ABI46_0_0RNSVGTextLengthAdjustStrings[fw]; -} - -enum ABI46_0_0RNSVGTextLengthAdjust ABI46_0_0RNSVGTextLengthAdjustFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextLengthAdjustDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextLengthAdjustStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextLengthAdjustStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextLengthAdjustDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextPathMethod - -NSString* ABI46_0_0RNSVGTextPathMethodToString( enum ABI46_0_0RNSVGTextPathMethod fw ) -{ - return ABI46_0_0RNSVGTextPathMethodStrings[fw]; -} - -enum ABI46_0_0RNSVGTextPathMethod ABI46_0_0RNSVGTextPathMethodFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextPathMethodDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextPathMethodStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextPathMethodStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextPathMethodDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextPathMidLine - -NSString* ABI46_0_0RNSVGTextPathMidLineToString( enum ABI46_0_0RNSVGTextPathMidLine fw ) -{ - return ABI46_0_0RNSVGTextPathMidLineStrings[fw]; -} - -enum ABI46_0_0RNSVGTextPathMidLine ABI46_0_0RNSVGTextPathMidLineFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextPathMidLineDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextPathMidLineStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextPathMidLineStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextPathMidLineDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextPathSide - -NSString* ABI46_0_0RNSVGTextPathSideToString( enum ABI46_0_0RNSVGTextPathSide fw ) -{ - return ABI46_0_0RNSVGTextPathSideStrings[fw]; -} - -enum ABI46_0_0RNSVGTextPathSide ABI46_0_0RNSVGTextPathSideFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextPathSideDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextPathSideStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextPathSideStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextPathSideDEFAULT; -} - -#pragma mark - ABI46_0_0RNSVGTextPathSpacing - -NSString* ABI46_0_0RNSVGTextPathSpacingToString( enum ABI46_0_0RNSVGTextPathSpacing fw ) -{ - return ABI46_0_0RNSVGTextPathSpacingStrings[fw]; -} - -enum ABI46_0_0RNSVGTextPathSpacing ABI46_0_0RNSVGTextPathSpacingFromString( NSString* s ) -{ - if ([s length] == 0) { - return ABI46_0_0RNSVGTextPathSpacingDEFAULT; - } - const NSUInteger l = sizeof(ABI46_0_0RNSVGTextPathSpacingStrings) / sizeof(NSString*); - for (NSUInteger i = 0; i < l; i++) { - if ([s isEqualToString:ABI46_0_0RNSVGTextPathSpacingStrings[i]]) { - return i; - } - } - return ABI46_0_0RNSVGTextPathSpacingDEFAULT; -} diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.h deleted file mode 100644 index 436daf30e54b84..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.h +++ /dev/null @@ -1,14 +0,0 @@ -#import "ABI46_0_0RNSVGUIKit.h" -#if TARGET_OS_OSX -#import -@interface ABI46_0_0RNSVGTopAlignedLabel : NSTextView - -@property NSAttributedString *attributedText; -@property NSLineBreakMode lineBreakMode; -@property NSInteger numberOfLines; -@property NSString *text; -@property NSTextAlignment textAlignment; -#else -@interface ABI46_0_0RNSVGTopAlignedLabel : UILabel -#endif -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.ios.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.ios.m deleted file mode 100644 index ee539fb59e2791..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Text/ABI46_0_0RNSVGTopAlignedLabel.ios.m +++ /dev/null @@ -1,17 +0,0 @@ -#import "ABI46_0_0RNSVGTopAlignedLabel.h" - -@implementation ABI46_0_0RNSVGTopAlignedLabel - -- (void)drawTextInRect:(CGRect) rect -{ - NSAttributedString *attributedText = [[NSAttributedString alloc] initWithString:self.text attributes:@{NSFontAttributeName:self.font}]; - rect.size.height = [attributedText boundingRectWithSize:rect.size - options:NSStringDrawingUsesLineFragmentOrigin - context:nil].size.height; - if (self.numberOfLines != 0) { - rect.size.height = MIN(rect.size.height, self.numberOfLines * self.font.lineHeight); - } - [super drawTextInRect:rect]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.h deleted file mode 100644 index 6965cb101537dd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.h +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import -#import "ABI46_0_0RNSVGCGFCRule.h" -#import "ABI46_0_0RNSVGVBMOS.h" -#import "ABI46_0_0RNSVGUnits.h" -#import "ABI46_0_0RNSVGLength.h" -#import "ABI46_0_0RNSVGPathParser.h" - -@class ABI46_0_0RNSVGBrush; - -@interface ABI46_0_0RCTConvert (ABI46_0_0RNSVG) - -+ (ABI46_0_0RNSVGLength*)ABI46_0_0RNSVGLength:(id)json; -+ (NSArray*)ABI46_0_0RNSVGLengthArray:(id)json; -+ (ABI46_0_0RNSVGCGFCRule)ABI46_0_0RNSVGCGFCRule:(id)json; -+ (ABI46_0_0RNSVGVBMOS)ABI46_0_0RNSVGVBMOS:(id)json; -+ (ABI46_0_0RNSVGUnits)ABI46_0_0RNSVGUnits:(id)json; -+ (ABI46_0_0RNSVGBrush *)ABI46_0_0RNSVGBrush:(id)json; -+ (ABI46_0_0RNSVGPathParser *)ABI46_0_0RNSVGCGPath:(NSString *)d; -+ (CGRect)ABI46_0_0RNSVGCGRect:(id)json offset:(NSUInteger)offset; -+ (ABI46_0_0RNSVGColor *)ABI46_0_0RNSVGColor:(id)json offset:(NSUInteger)offset; -+ (CGGradientRef)ABI46_0_0RNSVGCGGradient:(id)json; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.m deleted file mode 100644 index 6afb474d301bf2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RCTConvert+RNSVG.m +++ /dev/null @@ -1,184 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RCTConvert+RNSVG.h" - -#import "ABI46_0_0RNSVGPainterBrush.h" -#import "ABI46_0_0RNSVGSolidColorBrush.h" -#import "ABI46_0_0RNSVGContextBrush.h" -#import -#import - -NSRegularExpression *ABI46_0_0RNSVGDigitRegEx; - -@implementation ABI46_0_0RCTConvert (ABI46_0_0RNSVG) - -ABI46_0_0RCT_ENUM_CONVERTER(ABI46_0_0RNSVGCGFCRule, (@{ - @"evenodd": @(kRNSVGCGFCRuleEvenodd), - @"nonzero": @(kRNSVGCGFCRuleNonzero), - }), kRNSVGCGFCRuleNonzero, intValue) - -ABI46_0_0RCT_ENUM_CONVERTER(ABI46_0_0RNSVGVBMOS, (@{ - @"meet": @(kRNSVGVBMOSMeet), - @"slice": @(kRNSVGVBMOSSlice), - @"none": @(kRNSVGVBMOSNone) - }), kRNSVGVBMOSMeet, intValue) - -ABI46_0_0RCT_ENUM_CONVERTER(ABI46_0_0RNSVGUnits, (@{ - @"objectBoundingBox": @(kRNSVGUnitsObjectBoundingBox), - @"userSpaceOnUse": @(kRNSVGUnitsUserSpaceOnUse), - }), kRNSVGUnitsObjectBoundingBox, intValue) - -+ (ABI46_0_0RNSVGBrush *)ABI46_0_0RNSVGBrush:(id)json -{ - if ([json isKindOfClass:[NSNumber class]]) { - return [[ABI46_0_0RNSVGSolidColorBrush alloc] initWithNumber:json]; - } - if ([json isKindOfClass:[NSString class]]) { - NSString *value = [self NSString:json]; - if (!ABI46_0_0RNSVGDigitRegEx) { - ABI46_0_0RNSVGDigitRegEx = [NSRegularExpression regularExpressionWithPattern:@"[0-9.-]+" options:NSRegularExpressionCaseInsensitive error:nil]; - } - NSArray *_matches = [ABI46_0_0RNSVGDigitRegEx matchesInString:value options:0 range:NSMakeRange(0, [value length])]; - NSMutableArray *output = [NSMutableArray array]; - NSUInteger i = 0; - [output addObject:[NSNumber numberWithInteger:0]]; - for (NSTextCheckingResult *match in _matches) { - NSString* strNumber = [value substringWithRange:match.range]; - [output addObject:[NSNumber numberWithDouble:(i++ < 3 ? strNumber.doubleValue / 255 : strNumber.doubleValue)]]; - } - if ([output count] < 5) { - [output addObject:[NSNumber numberWithDouble:1]]; - } - return [[ABI46_0_0RNSVGSolidColorBrush alloc] initWithArray:output]; - } - NSArray *arr = [self NSArray:json]; - NSUInteger type = [self NSUInteger:arr.firstObject]; - - switch (type) { - case 0: // solid color - // These are probably expensive allocations since it's often the same value. - // We should memoize colors but look ups may be just as expensive. - return [[ABI46_0_0RNSVGSolidColorBrush alloc] initWithArray:arr]; - case 1: // brush - return [[ABI46_0_0RNSVGPainterBrush alloc] initWithArray:arr]; - case 2: // currentColor - return [[ABI46_0_0RNSVGBrush alloc] initWithArray:nil]; - case 3: // context-fill - return [[ABI46_0_0RNSVGContextBrush alloc] initFill]; - case 4: // context-stroke - return [[ABI46_0_0RNSVGContextBrush alloc] initStroke]; - default: - ABI46_0_0RCTLogError(@"Unknown brush type: %zd", (unsigned long)type); - return nil; - } -} - -+ (ABI46_0_0RNSVGPathParser *)ABI46_0_0RNSVGCGPath:(NSString *)d -{ - return [[ABI46_0_0RNSVGPathParser alloc] initWithPathString: d]; -} - -+ (ABI46_0_0RNSVGLength *)ABI46_0_0RNSVGLength:(id)json -{ - if ([json isKindOfClass:[NSNumber class]]) { - return [ABI46_0_0RNSVGLength lengthWithNumber:(CGFloat)[json doubleValue]]; - } else if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - return [ABI46_0_0RNSVGLength lengthWithString:stringValue]; - } else { - return [[ABI46_0_0RNSVGLength alloc] init]; - } -} - -+ (NSArray*)ABI46_0_0RNSVGLengthArray:(id)json -{ - if ([json isKindOfClass:[NSNumber class]]) { - ABI46_0_0RNSVGLength* length = [ABI46_0_0RNSVGLength lengthWithNumber:(CGFloat)[json doubleValue]]; - return [NSArray arrayWithObject:length]; - } else if ([json isKindOfClass:[NSArray class]]) { - NSArray *arrayValue = (NSArray*)json; - NSMutableArray* lengths = [NSMutableArray arrayWithCapacity:[arrayValue count]]; - for (id obj in arrayValue) { - [lengths addObject:[self ABI46_0_0RNSVGLength:obj]]; - } - return lengths; - } else if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - ABI46_0_0RNSVGLength* length = [ABI46_0_0RNSVGLength lengthWithString:stringValue]; - return [NSArray arrayWithObject:length]; - } else { - return nil; - } -} - -+ (CGRect)ABI46_0_0RNSVGCGRect:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count < offset + 4) { - ABI46_0_0RCTLogError(@"Too few elements in array (expected at least %zd): %@", (ssize_t)(4 + offset), arr); - return CGRectZero; - } - return (CGRect){ - {[self CGFloat:arr[offset]], [self CGFloat:arr[offset + 1]]}, - {[self CGFloat:arr[offset + 2]], [self CGFloat:arr[offset + 3]]}, - }; -} - -+ (ABI46_0_0RNSVGColor *)ABI46_0_0RNSVGColor:(id)json offset:(NSUInteger)offset -{ - NSArray *arr = [self NSArray:json]; - if (arr.count == offset + 1) { - return [self ABI46_0_0RNSVGColor:[arr objectAtIndex:offset]]; - } - if (arr.count < offset + 4) { - ABI46_0_0RCTLogError(@"Too few elements in array (expected at least %zd): %@", (ssize_t)(4 + offset), arr); - return nil; - } - return [self ABI46_0_0RNSVGColor:[arr subarrayWithRange:(NSRange){offset, 4}]]; -} - -+ (CGGradientRef)ABI46_0_0RNSVGCGGradient:(id)json -{ - NSArray *arr = [self NSArray:json]; - NSUInteger count = arr.count / 2; - NSUInteger values = count * 5; - NSUInteger offsetIndex = values - count; - CGFloat colorsAndOffsets[values]; - for (NSUInteger i = 0; i < count; i++) { - NSUInteger stopIndex = i * 2; - CGFloat offset = (CGFloat)[arr[stopIndex] doubleValue]; - NSUInteger argb = [self NSUInteger:arr[stopIndex + 1]]; - - CGFloat a = ((argb >> 24) & 0xFF) / 255.0; - CGFloat r = ((argb >> 16) & 0xFF) / 255.0; - CGFloat g = ((argb >> 8) & 0xFF) / 255.0; - CGFloat b = (argb & 0xFF) / 255.0; - - NSUInteger colorIndex = i * 4; - colorsAndOffsets[colorIndex] = r; - colorsAndOffsets[colorIndex + 1] = g; - colorsAndOffsets[colorIndex + 2] = b; - colorsAndOffsets[colorIndex + 3] = a; - - colorsAndOffsets[offsetIndex + i] = fmax(0, fmin(offset, 1)); - } - - CGColorSpaceRef rgb = CGColorSpaceCreateDeviceRGB(); - CGGradientRef gradient = CGGradientCreateWithColorComponents( - rgb, - colorsAndOffsets, - colorsAndOffsets + offsetIndex, - count - ); - CGColorSpaceRelease(rgb); - return (CGGradientRef)CFAutorelease(gradient); -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.h deleted file mode 100644 index bebbde92a7bad1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.h +++ /dev/null @@ -1,26 +0,0 @@ -/* - - Erica Sadun, http://ericasadun.com - https://github.com/erica/iOS-Drawing/tree/master/C08/Quartz%20Book%20Pack/Bezier - */ - -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -#define ABI46_0_0RNSVGNULLPOINT CGRectNull.origin - -@interface ABI46_0_0RNSVGBezierElement : NSObject - -// Element storage -@property (nonatomic, assign) CGPathElementType elementType; -@property (nonatomic, assign) CGPoint point; -@property (nonatomic, assign) CGPoint controlPoint1; -@property (nonatomic, assign) CGPoint controlPoint2; - -// Instance creation -+ (instancetype) elementWithPathElement: (CGPathElement) element; -+ (NSArray *) elementsFromCGPath:(CGPathRef)path; - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.m deleted file mode 100644 index 61198868f9d738..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGBezierElement.m +++ /dev/null @@ -1,77 +0,0 @@ -/* - - Erica Sadun, http://ericasadun.com - https://github.com/erica/iOS-Drawing/tree/master/C08/Quartz%20Book%20Pack/Bezier - */ - -#import "ABI46_0_0RNSVGBezierElement.h" - -#pragma mark - Bezier Element - - -@implementation ABI46_0_0RNSVGBezierElement -- (instancetype) init -{ - self = [super init]; - if (self) - { - _elementType = kCGPathElementMoveToPoint; - _point = ABI46_0_0RNSVGNULLPOINT; - _controlPoint1 = ABI46_0_0RNSVGNULLPOINT; - _controlPoint2 = ABI46_0_0RNSVGNULLPOINT; - } - return self; -} - -+ (instancetype) elementWithPathElement: (CGPathElement) element -{ - ABI46_0_0RNSVGBezierElement *newElement = [[self alloc] init]; - newElement.elementType = element.type; - - switch (newElement.elementType) - { - case kCGPathElementCloseSubpath: - break; - case kCGPathElementMoveToPoint: - case kCGPathElementAddLineToPoint: - { - newElement.point = element.points[0]; - break; - } - case kCGPathElementAddQuadCurveToPoint: - { - newElement.point = element.points[1]; - newElement.controlPoint1 = element.points[0]; - break; - } - case kCGPathElementAddCurveToPoint: - { - newElement.point = element.points[2]; - newElement.controlPoint1 = element.points[0]; - newElement.controlPoint2 = element.points[1]; - break; - } - default: - break; - } - - return newElement; -} - -// Convert one element to ABI46_0_0RNSVGBezierElement and save to array -void ABI46_0_0RNSVGBezierElement_getBezierElements(void *info, const CGPathElement *element) -{ - NSMutableArray *bezierElements = (__bridge NSMutableArray *)info; - if (element) - [bezierElements addObject:[ABI46_0_0RNSVGBezierElement elementWithPathElement:*element]]; -} - -// Retrieve array of component elements -+ (NSArray *) elementsFromCGPath:(CGPathRef)path -{ - NSMutableArray *elements = [NSMutableArray array]; - CGPathApply(path, (__bridge void *)elements, ABI46_0_0RNSVGBezierElement_getBezierElements); - return elements; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGCGFCRule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGCGFCRule.h deleted file mode 100644 index 53d5354c483014..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGCGFCRule.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -typedef CF_ENUM(int32_t, ABI46_0_0RNSVGCGFCRule) { - kRNSVGCGFCRuleEvenodd, - kRNSVGCGFCRuleNonzero -}; \ No newline at end of file diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.h deleted file mode 100644 index c3edd05d9804e1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.h +++ /dev/null @@ -1,32 +0,0 @@ -#import "ABI46_0_0RNSVGUIKit.h" - -#ifndef ABI46_0_0RNSVGLength_h -#define ABI46_0_0RNSVGLength_h - -// https://www.w3.org/TR/SVG/types.html#InterfaceSVGLength -typedef CF_ENUM(unsigned short, ABI46_0_0RNSVGLengthUnitType) { - SVG_LENGTHTYPE_UNKNOWN, - SVG_LENGTHTYPE_NUMBER, - SVG_LENGTHTYPE_PERCENTAGE, - SVG_LENGTHTYPE_EMS, - SVG_LENGTHTYPE_EXS, - SVG_LENGTHTYPE_PX, - SVG_LENGTHTYPE_CM, - SVG_LENGTHTYPE_MM, - SVG_LENGTHTYPE_IN, - SVG_LENGTHTYPE_PT, - SVG_LENGTHTYPE_PC, -}; - -@interface ABI46_0_0RNSVGLength : NSObject - -@property (nonatomic, assign) CGFloat value; -@property (nonatomic, assign) ABI46_0_0RNSVGLengthUnitType unit; - -+ (instancetype) lengthWithNumber: (CGFloat) number; -+ (instancetype) lengthWithString: (NSString *) lengthString; -- (BOOL) isEqualTo: (ABI46_0_0RNSVGLength *)other; - -@end - -#endif /* ABI46_0_0RNSVGLength_h */ diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.m deleted file mode 100644 index 7ba4c9ad3f1ef0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGLength.m +++ /dev/null @@ -1,75 +0,0 @@ -#import -#import "ABI46_0_0RNSVGLength.h" - -@implementation ABI46_0_0RNSVGLength - -- (instancetype) init -{ - self = [super init]; - if (self) - { - _value = 0; - _unit = SVG_LENGTHTYPE_UNKNOWN; - } - return self; -} - -+ (instancetype) lengthWithNumber:(CGFloat)number -{ - ABI46_0_0RNSVGLength *length = [[self alloc] init]; - length.unit = SVG_LENGTHTYPE_NUMBER; - length.value = number; - return length; -} - -+ (instancetype) lengthWithString: (NSString *) lengthString { - NSString *length = [lengthString stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; - NSUInteger stringLength = [length length]; - NSInteger percentIndex = stringLength - 1; - ABI46_0_0RNSVGLength *output = [ABI46_0_0RNSVGLength alloc]; - if (stringLength == 0) { - output.unit = SVG_LENGTHTYPE_UNKNOWN; - output.value = 0; - return output; - } else if ([length characterAtIndex:percentIndex] == '%') { - output.unit = SVG_LENGTHTYPE_PERCENTAGE; - output.value = (CGFloat)[[length substringWithRange:NSMakeRange(0, percentIndex)] doubleValue]; - } else { - NSInteger twoLetterUnitIndex = stringLength - 2; - ABI46_0_0RNSVGLengthUnitType unit = SVG_LENGTHTYPE_NUMBER; - if (twoLetterUnitIndex > 0) { - NSString *lastTwo = [length substringFromIndex:twoLetterUnitIndex]; - NSUInteger end = twoLetterUnitIndex; - if ([lastTwo isEqualToString:@"px"]) { - unit = SVG_LENGTHTYPE_PX; - } else if ([lastTwo isEqualToString:@"em"]) { - unit = SVG_LENGTHTYPE_EMS; - } else if ([lastTwo isEqualToString:@"ex"]) { - unit = SVG_LENGTHTYPE_EXS; - } else if ([lastTwo isEqualToString:@"pt"]) { - unit = SVG_LENGTHTYPE_PT; - } else if ([lastTwo isEqualToString:@"pc"]) { - unit = SVG_LENGTHTYPE_PC; - } else if ([lastTwo isEqualToString:@"mm"]) { - unit = SVG_LENGTHTYPE_MM; - } else if ([lastTwo isEqualToString:@"cm"]) { - unit = SVG_LENGTHTYPE_CM; - } else if ([lastTwo isEqualToString:@"in"]) { - unit = SVG_LENGTHTYPE_IN; - } else { - end = stringLength; - } - output.value = (CGFloat)[[length substringWithRange:NSMakeRange(0, end)] doubleValue]; - } else { - output.value = (CGFloat)[length doubleValue]; - } - output.unit = unit; - } - return output; -} - -- (BOOL) isEqualTo: (ABI46_0_0RNSVGLength *)other { - return self.unit == other.unit && self.value == other.value; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.h deleted file mode 100644 index f18eaae62e09ca..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.h +++ /dev/null @@ -1,25 +0,0 @@ -#import - -#import "ABI46_0_0RNSVGUIKit.h" - -typedef enum ABI46_0_0RNSVGMarkerType { - kStartMarker, - kMidMarker, - kEndMarker -} ABI46_0_0RNSVGMarkerType; - -#define ABI46_0_0RNSVGZEROPOINT CGRectZero.origin - -@interface ABI46_0_0RNSVGMarkerPosition : NSObject - -// Element storage -@property (nonatomic, assign) ABI46_0_0RNSVGMarkerType type; -@property (nonatomic, assign) CGPoint origin; -@property (nonatomic, assign) float angle; - -// Instance creation -+ (instancetype) markerPosition:(ABI46_0_0RNSVGMarkerType)type origin:(CGPoint)origin angle:(float)angle; - -+ (NSArray*) fromCGPath:(CGPathRef)path; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.m deleted file mode 100644 index 0d38effe847b1c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGMarkerPosition.m +++ /dev/null @@ -1,161 +0,0 @@ - -#import "ABI46_0_0RNSVGMarkerPosition.h" - -@implementation ABI46_0_0RNSVGMarkerPosition -- (instancetype) init -{ - self = [super init]; - if (self) - { - _type = kStartMarker; - _origin = ABI46_0_0RNSVGZEROPOINT; - _angle = 0; - } - return self; -} - -+ (instancetype) markerPosition:(ABI46_0_0RNSVGMarkerType)type origin:(CGPoint)origin angle:(float)angle { - ABI46_0_0RNSVGMarkerPosition *newElement = [[self alloc] init]; - newElement.type = type; - newElement.origin = origin; - newElement.angle = angle; - return newElement; -} - -+ (NSArray*) fromCGPath:(CGPathRef)path { - ABI46_0_0positions_ = [[NSMutableArray alloc] init]; - ABI46_0_0element_index_ = 0; - ABI46_0_0origin_ = ABI46_0_0RNSVGZEROPOINT; - ABI46_0_0subpath_start_ = ABI46_0_0RNSVGZEROPOINT; - CGPathApply(path, (__bridge void *)ABI46_0_0positions_, ABI46_0_0UpdateFromPathElement); - ABI46_0_0PathIsDone(); - return ABI46_0_0positions_; -} - -void ABI46_0_0PathIsDone() { - float angle = ABI46_0_0CurrentAngle(kEndMarker); - [ABI46_0_0positions_ addObject:[ABI46_0_0RNSVGMarkerPosition markerPosition:kEndMarker origin:ABI46_0_0origin_ angle:angle]]; -} - -static double BisectingAngle(double in_angle, double out_angle) { - // WK193015: Prevent bugs due to angles being non-continuous. - if (fabs(in_angle - out_angle) > 180) - in_angle += 360; - return (in_angle + out_angle) / 2; -} - -static CGFloat ABI46_0_0RNSVG_radToDeg = 180 / (CGFloat)M_PI; - -double ABI46_0_0rad2deg(CGFloat rad) { - return rad * ABI46_0_0RNSVG_radToDeg; -} - -CGFloat ABI46_0_0SlopeAngleRadians(CGSize p) { - CGFloat angle = atan2(p.height, p.width); - return angle; -} - -double ABI46_0_0CurrentAngle(ABI46_0_0RNSVGMarkerType type) { - // For details of this calculation, see: - // http://www.w3.org/TR/SVG/single-page.html#painting-MarkerElement - double in_angle = ABI46_0_0rad2deg(ABI46_0_0SlopeAngleRadians(ABI46_0_0in_slope_)); - double out_angle = ABI46_0_0rad2deg(ABI46_0_0SlopeAngleRadians(ABI46_0_0out_slope_)); - switch (type) { - case kStartMarker: - if (ABI46_0_0auto_start_reverse_) - out_angle += 180; - return out_angle; - case kMidMarker: - return BisectingAngle(in_angle, out_angle); - case kEndMarker: - return in_angle; - } - return 0; -} - -typedef struct SegmentData { - CGSize start_tangent; // Tangent in the start point of the segment. - CGSize end_tangent; // Tangent in the end point of the segment. - CGPoint position; // The end point of the segment. -} SegmentData; - -CGSize ABI46_0_0subtract(CGPoint* p1, CGPoint* p2) { - return CGSizeMake(p2->x - p1->x, p2->y - p1->y); -} - -static void ComputeQuadTangents(SegmentData* data, - CGPoint* start, - CGPoint* control, - CGPoint* end) { - data->start_tangent = ABI46_0_0subtract(control, start); - data->end_tangent = ABI46_0_0subtract(end, control); - if (CGSizeEqualToSize(CGSizeZero, data->start_tangent)) - data->start_tangent = data->end_tangent; - else if (CGSizeEqualToSize(CGSizeZero, data->end_tangent)) - data->end_tangent = data->start_tangent; -} - -SegmentData ABI46_0_0ExtractPathElementFeatures(const CGPathElement* element) { - SegmentData data; - CGPoint* points = element->points; - switch (element->type) { - case kCGPathElementAddCurveToPoint: - data.position = points[2]; - data.start_tangent = ABI46_0_0subtract(&points[0], &ABI46_0_0origin_); - data.end_tangent = ABI46_0_0subtract(&points[2], &points[1]); - if (CGSizeEqualToSize(CGSizeZero, data.start_tangent)) - ComputeQuadTangents(&data, &points[0], &points[1], &points[2]); - else if (CGSizeEqualToSize(CGSizeZero, data.end_tangent)) - ComputeQuadTangents(&data, &ABI46_0_0origin_, &points[0], &points[1]); - break; - case kCGPathElementAddQuadCurveToPoint: - data.position = points[1]; - ComputeQuadTangents(&data, &ABI46_0_0origin_, &points[0], &points[1]); - break; - case kCGPathElementMoveToPoint: - case kCGPathElementAddLineToPoint: - data.position = points[0]; - data.start_tangent = ABI46_0_0subtract(&data.position, &ABI46_0_0origin_); - data.end_tangent = ABI46_0_0subtract(&data.position, &ABI46_0_0origin_); - break; - case kCGPathElementCloseSubpath: - data.position = ABI46_0_0subpath_start_; - data.start_tangent = ABI46_0_0subtract(&data.position, &ABI46_0_0origin_); - data.end_tangent = ABI46_0_0subtract(&data.position, &ABI46_0_0origin_); - break; - } - return data; -} - -void ABI46_0_0UpdateFromPathElement(void *info, const CGPathElement *element) { - SegmentData segment_data = ABI46_0_0ExtractPathElementFeatures(element); - // First update the outgoing slope for the previous element. - ABI46_0_0out_slope_ = segment_data.start_tangent; - // Record the marker for the previous element. - if (ABI46_0_0element_index_ > 0) { - ABI46_0_0RNSVGMarkerType marker_type = - ABI46_0_0element_index_ == 1 ? kStartMarker : kMidMarker; - float angle = ABI46_0_0CurrentAngle(marker_type); - [ABI46_0_0positions_ addObject:[ABI46_0_0RNSVGMarkerPosition markerPosition:marker_type origin:ABI46_0_0origin_ angle:angle]]; - } - // Update the incoming slope for this marker position. - ABI46_0_0in_slope_ = segment_data.end_tangent; - // Update marker position. - ABI46_0_0origin_ = segment_data.position; - // If this is a 'move to' segment, save the point for use with 'close'. - if (element->type == kCGPathElementMoveToPoint) - ABI46_0_0subpath_start_ = element->points[0]; - else if (element->type == kCGPathElementCloseSubpath) - ABI46_0_0subpath_start_ = CGPointZero; - ++ABI46_0_0element_index_; -} - -NSMutableArray* ABI46_0_0positions_; -unsigned ABI46_0_0element_index_; -CGPoint ABI46_0_0origin_; -CGPoint ABI46_0_0subpath_start_; -CGSize ABI46_0_0in_slope_; -CGSize ABI46_0_0out_slope_; -bool ABI46_0_0auto_start_reverse_; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.h deleted file mode 100644 index 282177835ad680..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.h +++ /dev/null @@ -1,24 +0,0 @@ -/** - * Copyright (c) 2015-present, ABI46_0_0React-native-community. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGUIKit.h" - -@interface ABI46_0_0RNSVGPathMeasure : NSObject - -@property CGFloat pathLength; -@property CGPathRef path; -@property NSMutableArray *lengths; -@property NSMutableArray *lines; -@property NSUInteger lineCount; -@property BOOL isClosed; - -- (void)reset; -- (void)extractPathData:(CGPathRef)path; -- (void)getPosAndTan:(CGFloat *)angle midPoint:(CGFloat)midPoint x:(CGFloat *)x y:(CGFloat *)y; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.m deleted file mode 100644 index 475c51b9df848b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathMeasure.m +++ /dev/null @@ -1,227 +0,0 @@ -#import "ABI46_0_0RNSVGPathMeasure.h" -#import "ABI46_0_0RNSVGBezierElement.h" - -/* Some Bezier logic from PerformanceBezier */ -/* - - ## License - - Creative Commons License
This work is licensed under a Creative Commons Attribution 3.0 United States License. - - For attribution, please include: - - 1. Mention original author "Adam Wulf for Loose Leaf app" - 2. Link to https://getlooseleaf.com/opensource/ - 3. Link to https://github.com/adamwulf/PerformanceBezier - - */ -static CGFloat idealFlatness = (CGFloat).01; - -/** - * returns the ABI46_0_0distance between two points - */ -CGFloat ABI46_0_0distance(CGPoint p1, CGPoint p2) -{ - CGFloat dx = p2.x - p1.x; - CGFloat dy = p2.y - p1.y; - return hypot(dx, dy); -} - -// Subdivide a Bézier (specific division) -/* - * (c) 2004 Alastair J. Houghton - * All Rights Reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. The name of the author of this software may not be used to endorse - * or promote products derived from the software without specific prior - * written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER "AS IS" AND ANY ABI46_0_0EXPRESS - * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - * IN NO EVENT SHALL THE COPYRIGHT OWNER BE LIABLE FOR ANY DIRECT, INDIRECT, - * SPECIAL, ABI46_0_0EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - * - */ -void ABI46_0_0subdivideBezierAtT(const CGPoint bez[4], CGPoint bez1[4], CGPoint bez2[4], CGFloat t) -{ - CGPoint q; - CGFloat mt = 1 - t; - - bez1[0].x = bez[0].x; - bez1[0].y = bez[0].y; - bez2[3].x = bez[3].x; - bez2[3].y = bez[3].y; - - q.x = mt * bez[1].x + t * bez[2].x; - q.y = mt * bez[1].y + t * bez[2].y; - bez1[1].x = mt * bez[0].x + t * bez[1].x; - bez1[1].y = mt * bez[0].y + t * bez[1].y; - bez2[2].x = mt * bez[2].x + t * bez[3].x; - bez2[2].y = mt * bez[2].y + t * bez[3].y; - - bez1[2].x = mt * bez1[1].x + t * q.x; - bez1[2].y = mt * bez1[1].y + t * q.y; - bez2[1].x = mt * q.x + t * bez2[2].x; - bez2[1].y = mt * q.y + t * bez2[2].y; - - bez1[3].x = bez2[0].x = mt * bez1[2].x + t * bez2[1].x; - bez1[3].y = bez2[0].y = mt * bez1[2].y + t * bez2[1].y; -} - -@implementation ABI46_0_0RNSVGPathMeasure - -- (void)addLine:(CGPoint *)last next:(const CGPoint *)next { - NSArray *line = @[[NSValue valueWithCGPoint:*last], [NSValue valueWithCGPoint:*next]]; - _pathLength += ABI46_0_0distance(*last, *next); - [_lengths addObject:[NSNumber numberWithDouble:_pathLength]]; - [_lines addObject:line]; - *last = *next; -} - -- (void)reset { - _lengths = nil; - _lines = nil; - _isClosed = NO; - _lineCount = 0; - _pathLength = 0; - _path = nil; -} - -- (void)extractPathData:(CGPathRef)path { - if (path == _path) { - return; - } - _path = path; - CGPoint origin = CGPointMake (0.0, 0.0); - CGPoint last = CGPointMake (0.0, 0.0); - _lengths = [NSMutableArray array]; - _lines = [NSMutableArray array]; - _isClosed = NO; - _lineCount = 0; - _pathLength = 0; - NSArray *elements = [ABI46_0_0RNSVGBezierElement elementsFromCGPath:path]; - for (ABI46_0_0RNSVGBezierElement *element in elements) { - switch (element.elementType) - { - case kCGPathElementMoveToPoint: - origin = last = element.point; - break; - - case kCGPathElementAddLineToPoint: { - CGPoint next = element.point; - [self addLine:&last next:&next]; - _lineCount++; - break; - } - case kCGPathElementAddQuadCurveToPoint: - case kCGPathElementAddCurveToPoint: - { - // handle both curve types gracefully - CGPoint curveTo = element.point; - CGPoint ctrl1 = element.controlPoint1; - CGPoint ctrl2 = element.elementType == kCGPathElementAddQuadCurveToPoint ? ctrl1 : element.controlPoint2; - - // this is the bezier for our current element - CGPoint bezier[4] = { last, ctrl1, ctrl2, curveTo }; - NSValue *arr = [NSValue valueWithBytes:&bezier objCType:@encode(CGPoint[4])]; - NSMutableArray *curves = [NSMutableArray arrayWithObjects:arr, nil]; - - for (NSInteger curveIndex = 0; curveIndex >= 0; curveIndex--) { - CGPoint bez[4]; - [curves[curveIndex] getValue:&bez]; - [curves removeLastObject]; - - // calculate the error rate of the curve vs - // a line segment between the start and end points - CGPoint ctrl1 = bez[1]; - CGPoint ctrl2 = bez[2]; - CGPoint next = bez[3]; - CGFloat polyLen = - ABI46_0_0distance(last, ctrl1) + - ABI46_0_0distance(ctrl1, ctrl2) + - ABI46_0_0distance(ctrl2, next); - CGFloat chordLen = ABI46_0_0distance(last, next); - CGFloat error = polyLen - chordLen; - - // if the error is less than our accepted level of error - // then add a line, else, split the curve in half - if (error <= idealFlatness) { - [self addLine:&last next:&next]; - _lineCount++; - } else { - CGPoint bez1[4], bez2[4]; - ABI46_0_0subdivideBezierAtT(bez, bez1, bez2, .5); - [curves addObject:[NSValue valueWithBytes:&bez2 objCType:@encode(CGPoint[4])]]; - [curves addObject:[NSValue valueWithBytes:&bez1 objCType:@encode(CGPoint[4])]]; - curveIndex += 2; - } - } - break; - } - - case kCGPathElementCloseSubpath: { - CGPoint next = origin; - [self addLine:&last next:&next]; - _lineCount++; - _isClosed = YES; - break; - } - - default: - break; - } - } -} - -- (void)getPosAndTan:(CGFloat *)angle midPoint:(CGFloat)midPoint x:(CGFloat *)x y:(CGFloat *)y { - // Investigation suggests binary search is faster at lineCount >= 16 - // https://gist.github.com/msand/4c7993319425f9d7933be58ad9ada1a4 - NSUInteger i = _lineCount < 16 ? - [_lengths - indexOfObjectPassingTest:^(NSNumber* length, NSUInteger index, BOOL * _Nonnull stop) { - BOOL contains = midPoint <= [length doubleValue]; - return contains; - }] - : - [_lengths - indexOfObject:[NSNumber numberWithDouble:midPoint] - inSortedRange:NSMakeRange(0, _lineCount) - options:NSBinarySearchingInsertionIndex - usingComparator:^(NSNumber* obj1, NSNumber* obj2) { - return [obj1 compare:obj2]; - }]; - - CGFloat totalLength = (CGFloat)[_lengths[i] doubleValue]; - CGFloat prevLength = i == 0 ? 0 : (CGFloat)[_lengths[i - 1] doubleValue]; - - CGFloat length = totalLength - prevLength; - CGFloat percent = (midPoint - prevLength) / length; - - NSArray * points = [_lines objectAtIndex: i]; - CGPoint p1 = [[points objectAtIndex: 0] CGPointValue]; - CGPoint p2 = [[points objectAtIndex: 1] CGPointValue]; - - CGFloat ldx = p2.x - p1.x; - CGFloat ldy = p2.y - p1.y; - *angle = atan2(ldy, ldx); - *x = p1.x + ldx * percent; - *y = p1.y + ldy * percent; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.h deleted file mode 100644 index a75d510e5bd8d6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGUIKit.h" - -@interface ABI46_0_0RNSVGPathParser : NSObject - -- (instancetype) initWithPathString:(NSString *)d; -- (CGPathRef)getPath; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.m deleted file mode 100644 index 20ac91dfc6b354..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGPathParser.m +++ /dev/null @@ -1,595 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPathParser.h" -#import -#import -#import "ABI46_0_0RNSVGBezierElement.h" - -@implementation ABI46_0_0RNSVGPathParser -{ - char prev_cmd; - NSUInteger i; - NSUInteger l; - NSString* s; - float _penX; - float _penY; - float _penDownX; - float _penDownY; - float _pivotX; - float _pivotY; - BOOL _valid; - BOOL _penDownSet; -} - -- (instancetype)initWithPathString:(NSString *)d -{ - if (self = [super init]) { - prev_cmd = ' '; - l = [d length]; - i = 0; - s = d; - } - return self; -} - -#define NEXT_FLOAT [self parse_list_number] -#define NEXT_BOOL [self parse_flag] - -- (CGPathRef)getPath -{ - CGMutablePathRef path = CGPathCreateMutable(); - while (i < l) { - [self skip_spaces]; - - if (i >= l) { - break; - } - - bool has_prev_cmd = prev_cmd != ' '; - char first_char = [s characterAtIndex:i]; - - if (!has_prev_cmd && first_char != 'M' && first_char != 'm') { - // The first segment must be a MoveTo. - ABI46_0_0RCTLogError(@"UnexpectedData: %@", s); - CGPathRelease(path); - return nil; - } - - // TODO: simplify - bool is_implicit_move_to = false; - char cmd = ' '; - if ([self is_cmd:first_char]) { - is_implicit_move_to = false; - cmd = first_char; - i += 1; - } else if ([self is_number_start:first_char] && has_prev_cmd) { - if (prev_cmd == 'Z' || prev_cmd == 'z') { - // ClosePath cannot be followed by a number. - ABI46_0_0RCTLogError(@"UnexpectedData: %@", s); - CGPathRelease(path); - return nil; - } - - if (prev_cmd == 'M' || prev_cmd == 'm') { - // 'If a moveto is followed by multiple pairs of coordinates, - // the subsequent pairs are treated as implicit lineto commands.' - // So we parse them as LineTo. - is_implicit_move_to = true; - if ([self is_absolute:prev_cmd]) { - cmd = 'L'; - } else { - cmd = 'l'; - } - } else { - is_implicit_move_to = false; - cmd = prev_cmd; - } - } else { - ABI46_0_0RCTLogError(@"UnexpectedData: %@", s); - CGPathRelease(path); - return nil; - } - - bool absolute = [self is_absolute:cmd]; - switch (cmd) { - case 'm': { - [self move:path x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'M': { - [self moveTo:path x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'l': { - [self line:path x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'L': { - [self lineTo:path x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'h': { - [self line:path x:NEXT_FLOAT y:0]; - break; - } - case 'H': { - [self lineTo:path x:NEXT_FLOAT y:_penY]; - break; - } - case 'v': { - [self line:path x:0 y:NEXT_FLOAT]; - break; - } - case 'V': { - [self lineTo:path x:_penX y:NEXT_FLOAT]; - break; - } - case 'c': { - [self curve:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT c2x:NEXT_FLOAT c2y:NEXT_FLOAT ex:NEXT_FLOAT ey:NEXT_FLOAT]; - break; - } - case 'C': { - [self curveTo:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT c2x:NEXT_FLOAT c2y:NEXT_FLOAT ex:NEXT_FLOAT ey:NEXT_FLOAT]; - break; - } - case 's': { - [self smoothCurve:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT ex:NEXT_FLOAT ey:NEXT_FLOAT]; - break; - } - case 'S': { - [self smoothCurveTo:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT ex:NEXT_FLOAT ey:NEXT_FLOAT]; - break; - } - case 'q': { - [self quadraticBezierCurve:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT c2x:NEXT_FLOAT c2y:NEXT_FLOAT]; - break; - } - case 'Q': { - [self quadraticBezierCurveTo:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT c2x:NEXT_FLOAT c2y:NEXT_FLOAT]; - break; - } - case 't': { - [self smoothQuadraticBezierCurve:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT]; - break; - } - case 'T': { - [self smoothQuadraticBezierCurveTo:path c1x:NEXT_FLOAT c1y:NEXT_FLOAT]; - break; - } - case 'a': { - [self arc:path rx:NEXT_FLOAT ry:NEXT_FLOAT rotation:NEXT_FLOAT outer:NEXT_BOOL clockwise:NEXT_BOOL x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'A': { - [self arcTo:path rx:NEXT_FLOAT ry:NEXT_FLOAT rotation:NEXT_FLOAT outer:NEXT_BOOL clockwise:NEXT_BOOL x:NEXT_FLOAT y:NEXT_FLOAT]; - break; - } - case 'z': - case 'Z': { - [self close:path]; - break; - } - default: { - ABI46_0_0RCTLogError(@"UnexpectedData: %@", s); - CGPathRelease(path); - return nil; - } - } - - - if (is_implicit_move_to) { - if (absolute) { - prev_cmd = 'M'; - } else { - prev_cmd = 'm'; - } - } else { - prev_cmd = cmd; - } - - } - - return (CGPathRef)CFAutorelease(path); -} - -- (void)move:(CGMutablePathRef)path x:(float)x y:(float)y -{ - [self moveTo:path x:x + _penX y:y + _penY]; -} - -- (void)moveTo:(CGMutablePathRef)path x:(float)x y:(float)y -{ - //ABI46_0_0RCTLogInfo(@"move x: %f y: %f", x, y); - _penDownX = _pivotX = _penX = x; - _penDownY = _pivotY = _penY = y; - CGPathMoveToPoint(path, nil, x, y); -} - -- (void)line:(CGMutablePathRef)path x:(float)x y:(float)y -{ - [self lineTo:path x:x + _penX y:y + _penY]; -} - -- (void)lineTo:(CGMutablePathRef)path x:(float)x y:(float)y{ - //ABI46_0_0RCTLogInfo(@"line x: %f y: %f", x, y); - [self setPenDown]; - _pivotX = _penX = x; - _pivotY = _penY = y; - CGPathAddLineToPoint(path, nil, x, y); -} - -- (void)curve:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey -{ - [self curveTo:path c1x:c1x + _penX - c1y:c1y + _penY - c2x:c2x + _penX - c2y:c2y + _penY - ex:ex + _penX - ey:ey + _penY]; -} - -- (void)curveTo:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey -{ - //ABI46_0_0RCTLogInfo(@"curve c1x: %f c1y: %f c2x: %f c2y: %f ex: %f ey: %f", c1x, c1y, c2x, c2y, ex, ey); - _pivotX = c2x; - _pivotY = c2y; - [self curveToPoint:path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey]; -} - -- (void)curveToPoint:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey -{ - [self setPenDown]; - _penX = ex; - _penY = ey; - CGPathAddCurveToPoint(path, nil, c1x, c1y, c2x, c2y, ex, ey); -} - -- (void)smoothCurve:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y ex:(float)ex ey:(float)ey -{ - [self smoothCurveTo:path c1x:c1x + _penX c1y:c1y + _penY ex:ex + _penX ey:ey + _penY]; -} - -- (void)smoothCurveTo:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y ex:(float)ex ey:(float)ey -{ - //ABI46_0_0RCTLogInfo(@"smoothcurve c1x: %f c1y: %f ex: %f ey: %f", c1x, c1y, ex, ey); - float c2x = c1x; - float c2y = c1y; - c1x = (_penX * 2) - _pivotX; - c1y = (_penY * 2) - _pivotY; - _pivotX = c2x; - _pivotY = c2y; - [self curveToPoint:path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey]; -} - -- (void)quadraticBezierCurve:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y -{ - [self quadraticBezierCurveTo:path c1x:(float)c1x + _penX c1y:(float)c1y + _penY c2x:(float)c2x + _penX c2y:(float)c2y + _penY]; -} - -- (void)quadraticBezierCurveTo:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y -{ - //ABI46_0_0RCTLogInfo(@"quad c1x: %f c1y: %f c2x: %f c2y: %f", c1x, c1y, c2x, c2y); - _pivotX = c1x; - _pivotY = c1y; - float ex = c2x; - float ey = c2y; - c2x = (ex + c1x * 2) / 3; - c2y = (ey + c1y * 2) / 3; - c1x = (_penX + c1x * 2) / 3; - c1y = (_penY + c1y * 2) / 3; - [self curveToPoint:path c1x:(float)c1x c1y:(float)c1y c2x:(float)c2x c2y:(float)c2y ex:(float)ex ey:(float)ey]; -} - -- (void)smoothQuadraticBezierCurve:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y -{ - [self smoothQuadraticBezierCurveTo:path c1x:c1x + _penX c1y:c1y + _penY]; -} - -- (void)smoothQuadraticBezierCurveTo:(CGMutablePathRef)path c1x:(float)c1x c1y:(float)c1y -{ - //ABI46_0_0RCTLogInfo(@"smoothquad c1x: %f c1y: %f", c1x, c1y); - float c2x = c1x; - float c2y = c1y; - c1x = (_penX * 2) - _pivotX; - c1y = (_penY * 2) - _pivotY; - [self quadraticBezierCurveTo:path c1x:c1x c1y:c1y c2x:c2x c2y:c2y]; -} - -- (void)arc:(CGMutablePathRef)path rx:(float)rx ry:(float)ry rotation:(float)rotation outer:(BOOL)outer clockwise:(BOOL)clockwise x:(float)x y:(float)y -{ - [self arcTo:path rx:rx ry:ry rotation:rotation outer:outer clockwise:clockwise x:x + _penX y:y + _penY]; -} - -- (void)arcTo:(CGMutablePathRef)path rx:(float)rx ry:(float)ry rotation:(float)rotation outer:(BOOL)outer clockwise:(BOOL)clockwise x:(float)x y:(float)y -{ - //ABI46_0_0RCTLogInfo(@"arc rx: %f ry: %f rotation: %f outer: %i clockwise: %i x: %f y: %f", rx, ry, rotation, outer, clockwise, x, y); - float tX = _penX; - float tY = _penY; - - ry = fabsf(ry == 0 ? (rx == 0 ? (y - tY) : rx) : ry); - rx = fabsf(rx == 0 ? (x - tX) : rx); - - if (rx == 0 || ry == 0 || (x == tX && y == tY)) { - [self lineTo:path x:x y:y]; - return; - } - - - float rad = rotation * (float)M_PI / 180; - float cosed = cosf(rad); - float sined = sinf(rad); - x -= tX; - y -= tY; - // Ellipse Center - float cx = cosed * x / 2 + sined * y / 2; - float cy = -sined * x / 2 + cosed * y / 2; - float rxry = rx * rx * ry * ry; - float rycx = ry * ry * cx * cx; - float rxcy = rx * rx * cy * cy; - float a = rxry - rxcy - rycx; - - if (a < 0){ - a = sqrtf(1 - a / rxry); - rx *= a; - ry *= a; - cx = x / 2; - cy = y / 2; - } else { - a = sqrtf(a / (rxcy + rycx)); - - if (outer == clockwise) { - a = -a; - } - float cxd = -a * cy * rx / ry; - float cyd = a * cx * ry / rx; - cx = cosed * cxd - sined * cyd + x / 2; - cy = sined * cxd + cosed * cyd + y / 2; - } - - // Rotation + Scale Transform - float xx = cosed / rx; - float yx = sined / rx; - float xy = -sined / ry; - float yy = cosed / ry; - - // Start and End Angle - float sa = atan2f(xy * -cx + yy * -cy, xx * -cx + yx * -cy); - float ea = atan2f(xy * (x - cx) + yy * (y - cy), xx * (x - cx) + yx * (y - cy)); - - cx += tX; - cy += tY; - x += tX; - y += tY; - - [self setPenDown]; - - _penX = _pivotX = x; - _penY = _pivotY = y; - - [self arcToBezier:path cx:cx cy:cy rx:rx ry:ry sa:sa ea:ea clockwise:clockwise rad:rad]; -} - -- (void)arcToBezier:(CGMutablePathRef)path cx:(float)cx cy:(float)cy rx:(float)rx ry:(float)ry sa:(float)sa ea:(float)ea clockwise:(BOOL)clockwise rad:(float)rad -{ - // Inverse Rotation + Scale Transform - float cosed = cosf(rad); - float sined = sinf(rad); - float xx = cosed * rx; - float yx = -sined * ry; - float xy = sined * rx; - float yy = cosed * ry; - - // Bezier Curve Approximation - float arc = ea - sa; - if (arc < 0 && clockwise) { - arc += M_PI * 2; - } else if (arc > 0 && !clockwise) { - arc -= M_PI * 2; - } - - int n = (int)ceilf(fabsf(arc / ((float)M_PI / 2))); - - float step = arc / n; - float k = (4.0f / 3.0f) * tanf(step / 4); - - float x = cosf(sa); - float y = sinf(sa); - - for (int i = 0; i < n; i++){ - float cp1x = x - k * y; - float cp1y = y + k * x; - - sa += step; - x = cosf(sa); - y = sinf(sa); - - float cp2x = x + k * y; - float cp2y = y - k * x; - - float c1x = cx + xx * cp1x + yx * cp1y; - float c1y = cy + xy * cp1x + yy * cp1y; - float c2x = cx + xx * cp2x + yx * cp2y; - float c2y = cy + xy * cp2x + yy * cp2y; - float ex = cx + xx * x + yx * y; - float ey = cy + xy * x + yy * y; - CGPathAddCurveToPoint(path, nil, c1x, c1y, c2x, c2y, ex, ey); - } -} - -- (void)close:(CGMutablePathRef)path -{ - if (_penDownSet) { - _penX = _penDownX; - _penY = _penDownY; - _penDownSet = NO; - CGPathCloseSubpath(path); - } -} - -- (void)setPenDown -{ - if (!_penDownSet) { - _penDownX = _penX; - _penDownY = _penY; - _penDownSet = YES; - } -} - -- (void)skip_spaces { - while (i < l && [[NSCharacterSet whitespaceAndNewlineCharacterSet] characterIsMember:[s characterAtIndex:i]]) i++; -} - -- (bool)is_cmd:(char)c { - switch (c) { - case 'M': - case 'm': - case 'Z': - case 'z': - case 'L': - case 'l': - case 'H': - case 'h': - case 'V': - case 'v': - case 'C': - case 'c': - case 'S': - case 's': - case 'Q': - case 'q': - case 'T': - case 't': - case 'A': - case 'a': - return true; - } - return false; -} - -- (bool)is_number_start:(char)c { - return (c >= '0' && c <= '9') || c == '.' || c == '-' || c == '+'; -} - -- (bool)is_absolute:(char)c { - return [[NSCharacterSet uppercaseLetterCharacterSet] characterIsMember:c]; -} - -// By the SVG spec 'large-arc' and 'sweep' must contain only one char -// and can be written without any separators, e.g.: 10 20 30 01 10 20. -- (bool)parse_flag { - [self skip_spaces]; - - char c = [s characterAtIndex:i]; - switch (c) { - case '0': - case '1': { - i += 1; - if (i < l && [s characterAtIndex:i] == ',') { - i += 1; - } - [self skip_spaces]; - break; - } - default: - ABI46_0_0RCTLogError(@"UnexpectedData: %@", s); - } - - return c == '1'; -} - -- (float)parse_list_number { - if (i == l) { - ABI46_0_0RCTLogError(@"UnexpectedEnd: %@", s); - } - - float n = [self parse_number]; - [self skip_spaces]; - [self parse_list_separator]; - - return n; -} - -- (float)parse_number { - // Strip off leading whitespaces. - [self skip_spaces]; - - if (i == l) { - ABI46_0_0RCTLogError(@"InvalidNumber: %@", s); - } - - NSUInteger start = i; - - char c = [s characterAtIndex:i]; - - // Consume sign. - if (c == '-' || c == '+') { - i += 1; - c = [s characterAtIndex:i]; - } - - // Consume integer. - if (c >= '0' && c <= '9') { - [self skip_digits]; - if (i < l) { - c = [s characterAtIndex:i]; - } - } else if (c != '.') { - ABI46_0_0RCTLogError(@"InvalidNumber: %@", s); - } - - // Consume fraction. - if (c == '.') { - i += 1; - [self skip_digits]; - if (i < l) { - c = [s characterAtIndex:i]; - } - } - - if ((c == 'e' || c == 'E') && i + 1 < l) { - char c2 = [s characterAtIndex:i + 1]; - // Check for `em`/`ex`. - if (c2 != 'm' && c2 != 'x') { - i += 1; - c = [s characterAtIndex:i]; - - if (c == '+' || c == '-') { - i += 1; - [self skip_digits]; - } else if (c >= '0' && c <= '9') { - [self skip_digits]; - } else { - ABI46_0_0RCTLogError(@"InvalidNumber: %@", s); - } - } - } - - NSString* num = [s substringWithRange:NSMakeRange(start, i - start)]; - float n = [num floatValue]; - - // inf, nan, etc. are an error. - if (!isfinite(n)) { - ABI46_0_0RCTLogError(@"InvalidNumber: %@", s); - } - - return n; -} - -- (void)parse_list_separator { - if (i < l && [s characterAtIndex:i] == ',') { - i += 1; - } -} - -- (void)skip_digits { - while (i < l && [[NSCharacterSet decimalDigitCharacterSet] characterIsMember:[s characterAtIndex:i]]) i++; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGUnits.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGUnits.h deleted file mode 100644 index 52cb6b74e5107b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGUnits.h +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -typedef CF_ENUM(int32_t, ABI46_0_0RNSVGUnits) { - kRNSVGUnitsObjectBoundingBox, - kRNSVGUnitsUserSpaceOnUse -}; diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVBMOS.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVBMOS.h deleted file mode 100644 index 5e0ece08412920..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVBMOS.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -typedef CF_ENUM(int32_t, ABI46_0_0RNSVGVBMOS) { - kRNSVGVBMOSMeet, - kRNSVGVBMOSSlice, - kRNSVGVBMOSNone -}; diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVectorEffect.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVectorEffect.h deleted file mode 100644 index 3508a4fe54bd63..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGVectorEffect.h +++ /dev/null @@ -1,14 +0,0 @@ -/** - * Copyright (c) 2015-present, ABI46_0_0React-native-community. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -typedef CF_ENUM(int32_t, ABI46_0_0RNSVGVectorEffect) { - kRNSVGVectorEffectDefault, - kRNSVGVectorEffectNonScalingStroke, - kRNSVGVectorEffectInherit, - kRNSVGVectorEffectUri -}; diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.h deleted file mode 100644 index 03253f398c1f00..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.h +++ /dev/null @@ -1,17 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGUIKit.h" - -#import "ABI46_0_0RNSVGVBMOS.h" - -@interface ABI46_0_0RNSVGViewBox : NSObject - -+ (CGAffineTransform)getTransform:(CGRect)vbRect eRect:(CGRect)eRect align:(NSString *)align meetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.m deleted file mode 100644 index be9832adf4acb9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/Utils/ABI46_0_0RNSVGViewBox.m +++ /dev/null @@ -1,98 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import "ABI46_0_0RNSVGViewBox.h" -#import "ABI46_0_0RNSVGUse.h" - -@implementation ABI46_0_0RNSVGViewBox - -+ (CGAffineTransform)getTransform:(CGRect)vbRect eRect:(CGRect)eRect align:(NSString *)align meetOrSlice:(ABI46_0_0RNSVGVBMOS)meetOrSlice -{ - // based on https://svgwg.org/svg2-draft/coords.html#ComputingAViewportsTransform - - // Let vb-x, vb-y, vb-width, vb-height be the min-x, min-y, width and height values of the viewBox attribute respectively. - CGFloat vbX = CGRectGetMinX(vbRect); - CGFloat vbY = CGRectGetMinY(vbRect); - CGFloat vbWidth = CGRectGetWidth(vbRect); - CGFloat vbHeight = CGRectGetHeight(vbRect); - - // Let e-x, e-y, e-width, e-height be the position and size of the element respectively. - CGFloat eX = CGRectGetMinX(eRect); - CGFloat eY = CGRectGetMinY(eRect); - CGFloat eWidth = CGRectGetWidth(eRect); - CGFloat eHeight = CGRectGetHeight(eRect); - - // Let align be the align value of preserveAspectRatio, or 'xMidyMid' if preserveAspectRatio is not defined. - - // Let meetOrSlice be the meetOrSlice value of preserveAspectRatio, or 'meet' if preserveAspectRatio is not defined or if meetOrSlice is missing from this value. - - // Initialize scale-x to e-width/vb-width. - CGFloat scaleX = eWidth / vbWidth; - - // Initialize scale-y to e-height/vb-height. - CGFloat scaleY = eHeight / vbHeight; - - // Initialize translate-x to e-x - (vb-x * scale-x). - // Initialize translate-y to e-y - (vb-y * scale-y). - CGFloat translateX = eX - (vbX * scaleX); - CGFloat translateY = eY - (vbY * scaleY); - - // If align is 'none' - if (meetOrSlice == kRNSVGVBMOSNone) { - // Let scale be set the smaller value of scale-x and scale-y. - // Assign scale-x and scale-y to scale. - CGFloat scale = scaleX = scaleY = fmin(scaleX, scaleY); - - // If scale is greater than 1 - if (scale > 1) { - // Minus translateX by (eWidth / scale - vbWidth) / 2 - // Minus translateY by (eHeight / scale - vbHeight) / 2 - translateX -= (eWidth / scale - vbWidth) / 2; - translateY -= (eHeight / scale - vbHeight) / 2; - } else { - translateX -= (eWidth - vbWidth * scale) / 2; - translateY -= (eHeight - vbHeight * scale) / 2; - } - } else { - // If align is not 'none' and meetOrSlice is 'meet', set the larger of scale-x and scale-y to the smaller. - // Otherwise, if align is not 'none' and meetOrSlice is 'slice', set the smaller of scale-x and scale-y to the larger. - if (![align isEqualToString: @"none"] && meetOrSlice == kRNSVGVBMOSMeet) { - scaleX = scaleY = fmin(scaleX, scaleY); - } else if (![align isEqualToString: @"none"] && meetOrSlice == kRNSVGVBMOSSlice) { - scaleX = scaleY = fmax(scaleX, scaleY); - } - - // If align contains 'xMid', add (e-width - vb-width * scale-x) / 2 to translate-x. - if ([align containsString:@"xMid"]) { - translateX += (eWidth - vbWidth * scaleX) / 2.0; - } - - // If align contains 'xMax', add (e-width - vb-width * scale-x) to translate-x. - if ([align containsString:@"xMax"]) { - translateX += (eWidth - vbWidth * scaleX); - } - - // If align contains 'yMid', add (e-height - vb-height * scale-y) / 2 to translate-y. - if ([align containsString:@"YMid"]) { - translateY += (eHeight - vbHeight * scaleY) / 2.0; - } - - // If align contains 'yMax', add (e-height - vb-height * scale-y) to translate-y. - if ([align containsString:@"YMax"]) { - translateY += (eHeight - vbHeight * scaleY); - } - } - - // The transform applied to content contained by the element is given by - // translate(translate-x, translate-y) scale(scale-x, scale-y). - CGAffineTransform transform = CGAffineTransformMakeTranslation(translateX, translateY); - return CGAffineTransformScale(transform, scaleX, scaleY); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.h deleted file mode 100644 index ec3b083943c105..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGCircleManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.m deleted file mode 100644 index 096614555c2cb4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGCircleManager.m +++ /dev/null @@ -1,27 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGCircleManager.h" - -#import "ABI46_0_0RNSVGCircle.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGCircleManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGCircle new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cy, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(r, ABI46_0_0RNSVGLength*) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.h deleted file mode 100644 index 6d872438f14687..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" - -@interface ABI46_0_0RNSVGClipPathManager : ABI46_0_0RNSVGNodeManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.m deleted file mode 100644 index 9391086283a77c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGClipPathManager.m +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGClipPathManager.h" -#import "ABI46_0_0RNSVGClipPath.h" - -@implementation ABI46_0_0RNSVGClipPathManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGClipPath new]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.h deleted file mode 100644 index 4df7d3c72a5e0d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.h +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNSVGDefsManager : ABI46_0_0RCTViewManager - -@end - -#import "ABI46_0_0RNSVGNode.h" diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.m deleted file mode 100644 index 6027a699ae5525..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGDefsManager.m +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGDefsManager.h" -#import "ABI46_0_0RNSVGDefs.h" - -@implementation ABI46_0_0RNSVGDefsManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGDefs *)node -{ - return [ABI46_0_0RNSVGDefs new]; -} - -- (ABI46_0_0RNSVGView *)view -{ - return [self node]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.h deleted file mode 100644 index a7fbd9a3f6789a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGEllipseManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.m deleted file mode 100644 index e0b0c78552afaa..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGEllipseManager.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGEllipseManager.h" - -#import "ABI46_0_0RNSVGEllipse.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGEllipseManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGEllipse new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cy, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(ry, ABI46_0_0RNSVGLength*) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.h deleted file mode 100644 index ede557f867016d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroupManager.h" - -@interface ABI46_0_0RNSVGForeignObjectManager : ABI46_0_0RNSVGGroupManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.m deleted file mode 100644 index 9c8a92428ea23b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGForeignObjectManager.m +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGForeignObjectManager.h" -#import "ABI46_0_0RNSVGForeignObject.h" - -@implementation ABI46_0_0RNSVGForeignObjectManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGForeignObject *)node -{ - return [ABI46_0_0RNSVGForeignObject new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(foreignObjectheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(foreignObjectwidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGForeignObject) -{ - view.foreignObjectheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGForeignObject) -{ - view.foreignObjectwidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.h deleted file mode 100644 index a5977989099c1f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGGroupManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.m deleted file mode 100644 index b0fa67d368b4ea..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGGroupManager.m +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroupManager.h" -#import "ABI46_0_0RNSVGCGFCRule.h" -#import "ABI46_0_0RNSVGGroup.h" - -@implementation ABI46_0_0RNSVGGroupManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGGroup new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(font, NSDictionary) - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontSize, id, ABI46_0_0RNSVGGroup) -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - view.font = @{ @"fontSize": stringValue }; - } else { - NSNumber* number = (NSNumber*)json; - double num = [number doubleValue]; - view.font = @{@"fontSize": [NSNumber numberWithDouble:num] }; - } -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontWeight, id, ABI46_0_0RNSVGGroup) -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - view.font = @{ @"fontWeight": stringValue }; - } else { - NSNumber* number = (NSNumber*)json; - double num = [number doubleValue]; - view.font = @{@"fontWeight": [NSNumber numberWithDouble:num] }; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.h deleted file mode 100644 index 999030a15ce4fa..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGImageManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.m deleted file mode 100644 index a8314dd44c2515..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGImageManager.m +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGImageManager.h" -#import "ABI46_0_0RNSVGVBMOS.h" -#import "ABI46_0_0RNSVGImage.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGImageManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - ABI46_0_0RNSVGImage *svgImage = [ABI46_0_0RNSVGImage new]; - svgImage.bridge = self.bridge; - - return svgImage; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(imagewidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(imageheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGImage) -{ - view.imagewidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGImage) -{ - view.imageheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(src, id) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, ABI46_0_0RNSVGVBMOS) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.h deleted file mode 100644 index d2bb25f7c0e032..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGLineManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.m deleted file mode 100644 index bf77f06f8c098a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLineManager.m +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGLineManager.h" - -#import "ABI46_0_0RNSVGLine.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGLineManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGLine new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x1, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y1, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x2, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y2, ABI46_0_0RNSVGLength*) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.h deleted file mode 100644 index ad4cf7d14a8874..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" - -@interface ABI46_0_0RNSVGLinearGradientManager : ABI46_0_0RNSVGNodeManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.m deleted file mode 100644 index 901b8007228fab..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGLinearGradientManager.m +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGLinearGradientManager.h" -#import "ABI46_0_0RNSVGLinearGradient.h" - -@implementation ABI46_0_0RNSVGLinearGradientManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGLinearGradient new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x1, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y1, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x2, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y2, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradient, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradientUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradientTransform, CGAffineTransform) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.h deleted file mode 100644 index 44350e2fa8d41b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroupManager.h" - -@interface ABI46_0_0RNSVGMarkerManager : ABI46_0_0RNSVGGroupManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.m deleted file mode 100644 index 2394fce0140428..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMarkerManager.m +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGMarkerManager.h" -#import "ABI46_0_0RNSVGMarker.h" - -@implementation ABI46_0_0RNSVGMarkerManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGMarker *)node -{ - return [ABI46_0_0RNSVGMarker new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(refX, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(refY, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerHeight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerWidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerUnits, NSString*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(orient, NSString*) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minX, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minY, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbHeight, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, ABI46_0_0RNSVGVBMOS) - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.h deleted file mode 100644 index 2ee4f1d7d1b5b8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroupManager.h" - -@interface ABI46_0_0RNSVGMaskManager : ABI46_0_0RNSVGGroupManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.m deleted file mode 100644 index 98480d43874c71..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGMaskManager.m +++ /dev/null @@ -1,37 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGMaskManager.h" -#import "ABI46_0_0RNSVGMask.h" - -@implementation ABI46_0_0RNSVGMaskManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGMask *)node -{ - return [ABI46_0_0RNSVGMask new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maskheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maskwidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGMask) -{ - view.maskheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGMask) -{ - view.maskwidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maskUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maskContentUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(maskTransform, CGAffineTransform) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.h deleted file mode 100644 index bda2c6193b0d99..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNode.h" -#import - -@interface ABI46_0_0RNSVGNodeManager : ABI46_0_0RCTViewManager - -- (ABI46_0_0RNSVGNode *)node; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.m deleted file mode 100644 index 0764b5df9876be..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGNodeManager.m +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" - -#import "ABI46_0_0RNSVGNode.h" - -static const NSUInteger kMatrixArrayLength = 4 * 4; - -@implementation ABI46_0_0RNSVGNodeManager - -+ (CGFloat)convertToRadians:(id)json -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - if ([stringValue hasSuffix:@"deg"]) { - CGFloat degrees = [[stringValue substringToIndex:stringValue.length - 3] floatValue]; - return degrees * (CGFloat)M_PI / 180; - } - if ([stringValue hasSuffix:@"rad"]) { - return [[stringValue substringToIndex:stringValue.length - 3] floatValue]; - } - } - return [json floatValue]; -} - -+ (CATransform3D)CATransform3DFromMatrix:(id)json -{ - CATransform3D transform = CATransform3DIdentity; - if (!json) { - return transform; - } - if (![json isKindOfClass:[NSArray class]]) { - ABI46_0_0RCTLogConvertError(json, @"a CATransform3D. Expected array for transform matrix."); - return transform; - } - NSArray *array = json; - if ([array count] != kMatrixArrayLength) { - ABI46_0_0RCTLogConvertError(json, @"a CATransform3D. Expected 4x4 matrix array."); - return transform; - } - for (NSUInteger i = 0; i < kMatrixArrayLength; i++) { - ((CGFloat *)&transform)[i] = [ABI46_0_0RCTConvert CGFloat:array[i]]; - } - return transform; -} - -+ (CATransform3D)CATransform3D:(id)json -{ - CATransform3D transform = CATransform3DIdentity; - if (!json) { - return transform; - } - if (![json isKindOfClass:[NSArray class]]) { - ABI46_0_0RCTLogConvertError(json, @"a CATransform3D. Did you pass something other than an array?"); - return transform; - } - // legacy matrix support - if ([(NSArray *)json count] == kMatrixArrayLength && [json[0] isKindOfClass:[NSNumber class]]) { - ABI46_0_0RCTLogWarn(@"[ABI46_0_0RCTConvert CATransform3D:] has deprecated a matrix as input. Pass an array of configs (which can contain a matrix key) instead."); - return [self CATransform3DFromMatrix:json]; - } - - CGFloat zeroScaleThreshold = FLT_EPSILON; - - for (NSDictionary *transformConfig in (NSArray *)json) { - if (transformConfig.count != 1) { - ABI46_0_0RCTLogConvertError(json, @"a CATransform3D. You must specify exactly one property per transform object."); - return transform; - } - NSString *property = transformConfig.allKeys[0]; - id value = transformConfig[property]; - - if ([property isEqualToString:@"matrix"]) { - transform = [self CATransform3DFromMatrix:value]; - - } else if ([property isEqualToString:@"perspective"]) { - transform.m34 = -1 / [value floatValue]; - - } else if ([property isEqualToString:@"rotateX"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 1, 0, 0); - - } else if ([property isEqualToString:@"rotateY"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 0, 1, 0); - - } else if ([property isEqualToString:@"rotate"] || [property isEqualToString:@"rotateZ"]) { - CGFloat rotate = [self convertToRadians:value]; - transform = CATransform3DRotate(transform, rotate, 0, 0, 1); - - } else if ([property isEqualToString:@"scale"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, scale, scale, 1); - - } else if ([property isEqualToString:@"scaleX"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, scale, 1, 1); - - } else if ([property isEqualToString:@"scaleY"]) { - CGFloat scale = [value floatValue]; - scale = ABS(scale) < zeroScaleThreshold ? zeroScaleThreshold : scale; - transform = CATransform3DScale(transform, 1, scale, 1); - - } else if ([property isEqualToString:@"translate"]) { - NSArray *array = (NSArray *)value; - CGFloat translateX = [array[0] floatValue]; - CGFloat translateY = [array[1] floatValue]; - CGFloat translateZ = array.count > 2 ? [array[2] floatValue] : 0; - transform = CATransform3DTranslate(transform, translateX, translateY, translateZ); - - } else if ([property isEqualToString:@"translateX"]) { - CGFloat translate = [value floatValue]; - transform = CATransform3DTranslate(transform, translate, 0, 0); - - } else if ([property isEqualToString:@"translateY"]) { - CGFloat translate = [value floatValue]; - transform = CATransform3DTranslate(transform, 0, translate, 0); - - } else if ([property isEqualToString:@"skewX"]) { - CGFloat skew = [self convertToRadians:value]; - transform.m21 = tanf((float)skew); - - } else if ([property isEqualToString:@"skewY"]) { - CGFloat skew = [self convertToRadians:value]; - transform.m12 = tanf((float)skew); - - } else { - ABI46_0_0RCTLogError(@"Unsupported transform type for a CATransform3D: %@.", property); - } - } - return transform; -} - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGNode new]; -} - -- (ABI46_0_0RNSVGView *)view -{ - return [self node]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(name, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(opacity, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(matrix, CGAffineTransform) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(transform, CATransform3D, ABI46_0_0RNSVGNode) -{ - CATransform3D transform3d = json ? [ABI46_0_0RNSVGNodeManager CATransform3D:json] : defaultView.layer.transform; - CGAffineTransform transform = CATransform3DGetAffineTransform(transform3d); - view.invTransform = CGAffineTransformInvert(transform); - view.transforms = transform; - [view invalidate]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(mask, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerStart, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerMid, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(markerEnd, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(clipPath, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(clipRule, ABI46_0_0RNSVGCGFCRule) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(responsible, BOOL) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(onLayout, ABI46_0_0RCTDirectEventBlock) - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(top, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(right, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(start, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(end, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(bottom, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(left, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(width, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(height, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(minWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(maxWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(minHeight, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(maxHeight, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderTopWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderRightWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderBottomWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderLeftWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderStartWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderEndWidth, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(borderWidth, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginTop, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginRight, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginBottom, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginLeft, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginStart, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginEnd, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginVertical, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(marginHorizontal, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(margin, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingTop, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingRight, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingBottom, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingLeft, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingStart, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingEnd, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingVertical, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(paddingHorizontal, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(padding, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flex, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flexGrow, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flexShrink, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flexBasis, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flexDirection, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(flexWrap, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(justifyContent, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(alignItems, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(alignSelf, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(alignContent, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(position, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(aspectRatio, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(overflow, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(display, id, ABI46_0_0RNSVGNode) {} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(display, id, ABI46_0_0RNSVGNode) -{ - view.display = json; -} - -ABI46_0_0RCT_CUSTOM_SHADOW_PROPERTY(direction, id, ABI46_0_0RNSVGNode) {} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(pointerEvents, ABI46_0_0RCTPointerEvents, ABI46_0_0RNSVGNode) -{ - view.pointerEvents = json ? [ABI46_0_0RCTConvert ABI46_0_0RCTPointerEvents:json] : defaultView.pointerEvents; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.h deleted file mode 100644 index 7d797a7db95489..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGPathManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.m deleted file mode 100644 index 86edab4bc53572..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPathManager.m +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPathManager.h" - -#import "ABI46_0_0RNSVGPath.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGPathManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGPath new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(d, ABI46_0_0RNSVGCGPath) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.h deleted file mode 100644 index e9b319a2450d65..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGGroupManager.h" - -@interface ABI46_0_0RNSVGPatternManager : ABI46_0_0RNSVGGroupManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.m deleted file mode 100644 index e19be0883b2bd0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGPatternManager.m +++ /dev/null @@ -1,45 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGPatternManager.h" -#import "ABI46_0_0RNSVGPattern.h" - -@implementation ABI46_0_0RNSVGPatternManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGPattern *)node -{ - return [ABI46_0_0RNSVGPattern new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(patternheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(patternwidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGPattern) -{ - view.patternheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGPattern) -{ - view.patternwidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(patternUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(patternContentUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(patternTransform, CGAffineTransform) - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minX, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minY, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbHeight, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, ABI46_0_0RNSVGVBMOS) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.h deleted file mode 100644 index bfb54a3c3a33c5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" - -@interface ABI46_0_0RNSVGRadialGradientManager : ABI46_0_0RNSVGNodeManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.m deleted file mode 100644 index b7b00dfbd89df9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRadialGradientManager.m +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRadialGradientManager.h" -#import "ABI46_0_0RNSVGRadialGradient.h" - -@implementation ABI46_0_0RNSVGRadialGradientManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGRadialGradient new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fy, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(cy, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(ry, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradient, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradientUnits, ABI46_0_0RNSVGUnits) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(gradientTransform, CGAffineTransform) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.h deleted file mode 100644 index c07f3acdc7e469..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGRectManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.m deleted file mode 100644 index e9c8385e69e919..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRectManager.m +++ /dev/null @@ -1,39 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRectManager.h" - -#import "ABI46_0_0RNSVGRect.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGRectManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGRect new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(x, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(y, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rectheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rectwidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGRect) -{ - view.rectheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGRect) -{ - view.rectwidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(rx, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(ry, ABI46_0_0RNSVGLength*) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.h deleted file mode 100644 index 525142b5e6c30a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.h +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" -#import "ABI46_0_0RNSVGRenderable.h" - -@interface ABI46_0_0RNSVGRenderableManager : ABI46_0_0RNSVGNodeManager - -- (ABI46_0_0RNSVGRenderable *)node; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.m deleted file mode 100644 index 3339a77d5543ba..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGRenderableManager.m +++ /dev/null @@ -1,244 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import -#import "ABI46_0_0RNSVGRenderableManager.h" -#import "ABI46_0_0RNSVGPathMeasure.h" - -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import "ABI46_0_0RNSVGCGFCRule.h" - -@implementation ABI46_0_0RNSVGRenderableManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGRenderable new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fill, ABI46_0_0RNSVGBrush) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillOpacity, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(fillRule, ABI46_0_0RNSVGCGFCRule) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(stroke, ABI46_0_0RNSVGBrush) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeOpacity, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeWidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeLinecap, CGLineCap) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeLinejoin, CGLineJoin) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeDasharray, NSArray) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeDashoffset, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(strokeMiterlimit, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vectorEffect, int) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(propList, NSArray) - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isPointInFill:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return [NSNumber numberWithBool:false]; - } - if (options == nil) { - ABI46_0_0RCTLogError(@"Invalid options given to isPointInFill, got: %@", options); - return [NSNumber numberWithBool:false]; - } - id xo = [options objectForKey:@"x"]; - id yo = [options objectForKey:@"y"]; - if (![xo isKindOfClass:NSNumber.class] || - ![yo isKindOfClass:NSNumber.class]) { - ABI46_0_0RCTLogError(@"Invalid x or y given to isPointInFill"); - return [NSNumber numberWithBool:false]; - } - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGFloat x = (CGFloat)[xo doubleValue]; - CGFloat y = (CGFloat)[yo doubleValue]; - CGPoint point = CGPointMake(x, y); - ABI46_0_0RNSVGPlatformView *target = [svg hitTest:point withEvent:nil]; - BOOL hit = target != nil; - return [NSNumber numberWithBool:hit]; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(isPointInStroke:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return [NSNumber numberWithBool:false]; - } - if (options == nil) { - ABI46_0_0RCTLogError(@"Invalid options given to isPointInFill, got: %@", options); - return [NSNumber numberWithBool:false]; - } - id xo = [options objectForKey:@"x"]; - id yo = [options objectForKey:@"y"]; - if (![xo isKindOfClass:NSNumber.class] || - ![yo isKindOfClass:NSNumber.class]) { - ABI46_0_0RCTLogError(@"Invalid x or y given to isPointInFill"); - return [NSNumber numberWithBool:false]; - } - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGFloat x = (CGFloat)[xo doubleValue]; - CGFloat y = (CGFloat)[yo doubleValue]; - CGPoint point = CGPointMake(x, y); - BOOL hit = CGPathContainsPoint(svg.strokePath, nil, point, NO); - - return [NSNumber numberWithBool:hit]; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getTotalLength:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return [NSNumber numberWithDouble:0]; - } - - ABI46_0_0RNSVGPathMeasure *measure = [[ABI46_0_0RNSVGPathMeasure alloc]init]; - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGPathRef target = [svg getPath:nil]; - [measure extractPathData:target]; - - return [NSNumber numberWithDouble:measure.pathLength]; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getPointAtLength:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return nil; - } - - CGFloat position = (CGFloat)[[options objectForKey:@"length"] doubleValue]; - ABI46_0_0RNSVGPathMeasure *measure = [[ABI46_0_0RNSVGPathMeasure alloc]init]; - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGPathRef target = [svg getPath:nil]; - [measure extractPathData:target]; - - CGFloat x; - CGFloat y; - CGFloat angle; - double midPoint = fmax(0, fmin(position, measure.pathLength)); - [measure getPosAndTan:&angle midPoint:midPoint x:&x y:&y]; - - return @{ - @"x":@(x), - @"y":@(y), - @"angle":@(angle) - }; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getBBox:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return nil; - } - - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - BOOL fill = [[options objectForKey:@"fill"] boolValue]; - BOOL stroke = [[options objectForKey:@"stroke"] boolValue]; - BOOL markers = [[options objectForKey:@"markers"] boolValue]; - BOOL clipped = [[options objectForKey:@"clipped"] boolValue]; - [svg getPath:nil]; - - CGRect bounds = CGRectZero; - if (fill) { - bounds = CGRectUnion(bounds, svg.fillBounds); - } - if (stroke) { - bounds = CGRectUnion(bounds, svg.strokeBounds); - } - if (markers) { - bounds = CGRectUnion(bounds, svg.markerBounds); - } - if (clipped) { - CGPathRef clipPath = [svg getClipPath]; - CGRect clipBounds = CGPathGetBoundingBox(clipPath); - if (clipPath && !CGRectIsEmpty(clipBounds)) { - bounds = CGRectIntersection(bounds, clipBounds); - } - } - - CGPoint origin = bounds.origin; - CGSize size = bounds.size; - return @{ - @"x":@(origin.x), - @"y":@(origin.y), - @"width":@(size.width), - @"height":@(size.height) - }; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getCTM:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return nil; - } - - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGAffineTransform ctm = svg.ctm; - return @{ - @"a":@(ctm.a), - @"b":@(ctm.b), - @"c":@(ctm.c), - @"d":@(ctm.d), - @"e":@(ctm.tx), - @"f":@(ctm.ty) - }; -} - -ABI46_0_0RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getScreenCTM:(nonnull NSNumber *)ABI46_0_0ReactTag) -{ - __block ABI46_0_0RNSVGPlatformView *view; - dispatch_sync(dispatch_get_main_queue(), ^{ - view = [self.bridge.uiManager viewForABI46_0_0ReactTag:ABI46_0_0ReactTag]; - }); - if (![view isKindOfClass:[ABI46_0_0RNSVGRenderable class]]) { - ABI46_0_0RCTLogError(@"Invalid svg returned from registry, expecting ABI46_0_0RNSVGRenderable, got: %@", view); - return nil; - } - - ABI46_0_0RNSVGRenderable *svg = (ABI46_0_0RNSVGRenderable *)view; - CGAffineTransform ctm = svg.ctm; - return @{ - @"a":@(ctm.a), - @"b":@(ctm.b), - @"c":@(ctm.c), - @"d":@(ctm.d), - @"e":@(ctm.tx), - @"f":@(ctm.ty) - }; -} - -@end - - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.h deleted file mode 100644 index 722fcd8fbb2235..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RNSVGSvgViewManager : ABI46_0_0RCTViewManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.m deleted file mode 100644 index 029e387118eb91..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSvgViewManager.m +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import -#import "ABI46_0_0RNSVGSvgViewManager.h" -#import "ABI46_0_0RNSVGSvgView.h" - -@implementation ABI46_0_0RNSVGSvgViewManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGView *)view -{ - return [ABI46_0_0RNSVGSvgView new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(bbWidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(bbHeight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minX, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minY, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbHeight, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, ABI46_0_0RNSVGVBMOS) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(tintColor, id, ABI46_0_0RNSVGSvgView) -{ - view.tintColor = [ABI46_0_0RCTConvert UIColor:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(color, id, ABI46_0_0RNSVGSvgView) -{ - view.tintColor = [ABI46_0_0RCTConvert UIColor:json]; -} - - -- (void)toDataURL:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options callback:(ABI46_0_0RCTResponseSenderBlock)callback attempt:(int)attempt { - [self.bridge.uiManager addUIBlock:^(ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - __kindof ABI46_0_0RNSVGView *view = viewRegistry[ABI46_0_0ReactTag]; - NSString * b64; - if ([view isKindOfClass:[ABI46_0_0RNSVGSvgView class]]) { - ABI46_0_0RNSVGSvgView *svg = view; - if (options == nil) { - b64 = [svg getDataURL]; - } else { - id width = [options objectForKey:@"width"]; - id height = [options objectForKey:@"height"]; - if (![width isKindOfClass:NSNumber.class] || - ![height isKindOfClass:NSNumber.class]) { - ABI46_0_0RCTLogError(@"Invalid width or height given to toDataURL"); - return; - } - NSNumber* w = width; - NSInteger wi = (NSInteger)[w intValue]; - NSNumber* h = height; - NSInteger hi = (NSInteger)[h intValue]; - - CGRect bounds = CGRectMake(0, 0, wi, hi); - b64 = [svg getDataURLwithBounds:bounds]; - } - } else { - ABI46_0_0RCTLogError(@"Invalid svg returned frin registry, expecting ABI46_0_0RNSVGSvgView, got: %@", view); - return; - } - if (b64) { - callback(@[b64]); - } else if (attempt < 1) { - void (^retryBlock)(void) = ^{ - [self toDataURL:ABI46_0_0ReactTag options:options callback:callback attempt:(attempt + 1)]; - }; - - ABI46_0_0RCTExecuteOnUIManagerQueue(retryBlock); - } else { - callback(@[]); - } - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(toDataURL:(nonnull NSNumber *)ABI46_0_0ReactTag options:(NSDictionary *)options callback:(ABI46_0_0RCTResponseSenderBlock)callback) -{ - [self toDataURL:ABI46_0_0ReactTag options:options callback:callback attempt:0]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.h deleted file mode 100644 index 639adf1c6acbba..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGNodeManager.h" - -@interface ABI46_0_0RNSVGSymbolManager : ABI46_0_0RNSVGNodeManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.m deleted file mode 100644 index ed1b42c0f74d16..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGSymbolManager.m +++ /dev/null @@ -1,31 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGSymbolManager.h" -#import "ABI46_0_0RNSVGRenderable.h" -#import "ABI46_0_0RNSVGSymbol.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" -#import "ABI46_0_0RNSVGVBMOS.h" - -@implementation ABI46_0_0RNSVGSymbolManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGSymbol new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minX, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(minY, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbWidth, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(vbHeight, CGFloat) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(align, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, ABI46_0_0RNSVGVBMOS) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.h deleted file mode 100644 index 942b4389a0dfea..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGTextManager.h" - -@interface ABI46_0_0RNSVGTSpanManager : ABI46_0_0RNSVGTextManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.m deleted file mode 100644 index f51b3f4d163d94..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTSpanManager.m +++ /dev/null @@ -1,25 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGTSpanManager.h" - -#import "ABI46_0_0RNSVGTSpan.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGTSpanManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGTSpan new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(content, NSString) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.h deleted file mode 100644 index 376bec1d131755..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGTextManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.m deleted file mode 100644 index 696ace9b50f373..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextManager.m +++ /dev/null @@ -1,99 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGTextManager.h" - -#import "ABI46_0_0RNSVGText.h" -#import "ABI46_0_0RCTConvert+RNSVG.h" - -@implementation ABI46_0_0RNSVGTextManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGText new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(textAnchor, ABI46_0_0RNSVGTextAnchor) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(dx, id, ABI46_0_0RNSVGText) -{ - view.deltaX = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(dy, id, ABI46_0_0RNSVGText) -{ - view.deltaY = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(positionX, id, ABI46_0_0RNSVGText) -{ - view.positionX = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(positionY, id, ABI46_0_0RNSVGText) -{ - view.positionY = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(x, id, ABI46_0_0RNSVGText) -{ - view.positionX = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(y, id, ABI46_0_0RNSVGText) -{ - view.positionY = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(rotate, id, ABI46_0_0RNSVGText) -{ - view.rotate = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLengthArray:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(font, NSDictionary) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(inlineSize, id, ABI46_0_0RNSVGText) -{ - view.inlineSize = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(textLength, id, ABI46_0_0RNSVGText) -{ - view.textLength = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(baselineShift, id, ABI46_0_0RNSVGText) -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - view.baselineShift = stringValue; - } else { - view.baselineShift = [NSString stringWithFormat:@"%f", [json doubleValue]]; - } -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(lengthAdjust, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(alignmentBaseline, NSString) - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontSize, id, ABI46_0_0RNSVGText) -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - view.font = @{ @"fontSize": stringValue }; - } else { - NSNumber* number = (NSNumber*)json; - double num = [number doubleValue]; - view.font = @{@"fontSize": [NSNumber numberWithDouble:num] }; - } -} - -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(fontWeight, id, ABI46_0_0RNSVGText) -{ - if ([json isKindOfClass:[NSString class]]) { - NSString *stringValue = (NSString *)json; - view.font = @{ @"fontWeight": stringValue }; - } else { - NSNumber* number = (NSNumber*)json; - double num = [number doubleValue]; - view.font = @{@"fontWeight": [NSNumber numberWithDouble:num] }; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.h deleted file mode 100644 index 950e81c8b55f9e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGTextManager.h" - -@interface ABI46_0_0RNSVGTextPathManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.m deleted file mode 100644 index 5f3eb378b6e223..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGTextPathManager.m +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGTextPathManager.h" - -#import "ABI46_0_0RNSVGTextPath.h" - -@implementation ABI46_0_0RNSVGTextPathManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGRenderable *)node -{ - return [ABI46_0_0RNSVGTextPath new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(href, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(side, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(method, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(midLine, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(spacing, NSString) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(startOffset, ABI46_0_0RNSVGLength*) - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.h deleted file mode 100644 index 4730bd841efac4..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.h +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGRenderableManager.h" - -@interface ABI46_0_0RNSVGUseManager : ABI46_0_0RNSVGRenderableManager - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.m deleted file mode 100644 index 0ff392f2eadbd9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/Components/Svg/ViewManagers/ABI46_0_0RNSVGUseManager.m +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2015-present, Horcrux. - * All rights reserved. - * - * This source code is licensed under the MIT-style license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RNSVGUseManager.h" -#import "ABI46_0_0RNSVGUse.h" - -@implementation ABI46_0_0RNSVGUseManager - -ABI46_0_0RCT_EXPORT_MODULE() - -- (ABI46_0_0RNSVGNode *)node -{ - return [ABI46_0_0RNSVGUse new]; -} - -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(href, NSString) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(x, id, ABI46_0_0RNSVGUse) -{ - view.x = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(y, id, ABI46_0_0RNSVGUse) -{ - view.y = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(useheight, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_EXPORT_VIEW_PROPERTY(usewidth, ABI46_0_0RNSVGLength*) -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(height, id, ABI46_0_0RNSVGUse) -{ - view.useheight = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} -ABI46_0_0RCT_CUSTOM_VIEW_PROPERTY(width, id, ABI46_0_0RNSVGUse) -{ - view.usewidth = [ABI46_0_0RCTConvert ABI46_0_0RNSVGLength:json]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.h deleted file mode 100644 index e61b6343255b1e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.h +++ /dev/null @@ -1,7 +0,0 @@ - -#import - -@interface ABI46_0_0RNViewShot : NSObject - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.m deleted file mode 100644 index 6ef171ac43ce8a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Api/ViewShot/ABI46_0_0RNViewShot.m +++ /dev/null @@ -1,186 +0,0 @@ -#import "ABI46_0_0RNViewShot.h" -#import -#import -#import -#import -#import -#import -#import -#if __has_include() -#import -#endif -#import - -@implementation ABI46_0_0RNViewShot - -ABI46_0_0RCT_EXPORT_MODULE() - -@synthesize bridge = _bridge; - -- (dispatch_queue_t)methodQueue -{ - return ABI46_0_0RCTGetUIManagerQueue(); -} - -ABI46_0_0RCT_EXPORT_METHOD(captureScreen: (NSDictionary *)options - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self captureRef: [NSNumber numberWithInt:-1] withOptions:options resolve:resolve reject:reject]; -} - -ABI46_0_0RCT_EXPORT_METHOD(releaseCapture:(nonnull NSString *)uri) -{ - NSString *directory = [NSTemporaryDirectory() stringByAppendingPathComponent:@"ABI46_0_0ReactNative"]; - // Ensure it's a valid file in the tmp directory - if ([uri hasPrefix:directory] && ![uri isEqualToString:directory]) { - NSFileManager *fileManager = [NSFileManager new]; - if ([fileManager fileExistsAtPath:uri]) { - [fileManager removeItemAtPath:uri error:NULL]; - } - } -} - -ABI46_0_0RCT_EXPORT_METHOD(captureRef:(nonnull NSNumber *)target - withOptions:(NSDictionary *)options - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [self.bridge.uiManager addUIBlock:^(__unused ABI46_0_0RCTUIManager *uiManager, NSDictionary *viewRegistry) { - - // Get view - UIView *view; - - if ([target intValue] == -1) { - UIWindow *window = [[UIApplication sharedApplication] keyWindow]; - view = window; - } else { - view = viewRegistry[target]; - } - - if (!view) { - reject(ABI46_0_0RCTErrorUnspecified, [NSString stringWithFormat:@"No view found with ABI46_0_0ReactTag: %@", target], nil); - return; - } - - // Get options - CGSize size = [ABI46_0_0RCTConvert CGSize:options]; - NSString *format = [ABI46_0_0RCTConvert NSString:options[@"format"]]; - NSString *result = [ABI46_0_0RCTConvert NSString:options[@"result"]]; - BOOL renderInContext = [ABI46_0_0RCTConvert BOOL:options[@"useRenderInContext"]]; - BOOL snapshotContentContainer = [ABI46_0_0RCTConvert BOOL:options[@"snapshotContentContainer"]]; - - // Capture image - BOOL success; - - UIView* rendered; - UIScrollView* scrollView; - if (snapshotContentContainer) { - if (![view isKindOfClass:[ABI46_0_0RCTScrollView class]]) { - reject(ABI46_0_0RCTErrorUnspecified, [NSString stringWithFormat:@"snapshotContentContainer can only be used on a ABI46_0_0RCTScrollView. instead got: %@", view], nil); - return; - } - ABI46_0_0RCTScrollView* rctScrollView = (ABI46_0_0RCTScrollView *)view; - scrollView = rctScrollView.scrollView; - rendered = scrollView; - } - else { - rendered = view; - } - - if (size.width < 0.1 || size.height < 0.1) { - size = snapshotContentContainer ? scrollView.contentSize : view.bounds.size; - } - if (size.width < 0.1 || size.height < 0.1) { - reject(ABI46_0_0RCTErrorUnspecified, [NSString stringWithFormat:@"The content size must not be zero or negative. Got: (%g, %g)", size.width, size.height], nil); - return; - } - - CGPoint savedContentOffset; - CGRect savedFrame; - if (snapshotContentContainer) { - // Save scroll & frame and set it temporarily to the full content size - savedContentOffset = scrollView.contentOffset; - savedFrame = scrollView.frame; - scrollView.contentOffset = CGPointZero; - scrollView.frame = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height); - } - - UIGraphicsBeginImageContextWithOptions(size, NO, 0); - - if (renderInContext) { - // this comes with some trade-offs such as inability to capture gradients or scrollview's content in full but it works for large views - [rendered.layer renderInContext: UIGraphicsGetCurrentContext()]; - success = YES; - } - else { - // this doesn't work for large views and reports incorrect success even though the image is blank - success = [rendered drawViewHierarchyInRect:(CGRect){CGPointZero, size} afterScreenUpdates:YES]; - } - UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); - UIGraphicsEndImageContext(); - - if (snapshotContentContainer) { - // Restore scroll & frame - scrollView.contentOffset = savedContentOffset; - scrollView.frame = savedFrame; - } - - if (!success) { - reject(ABI46_0_0RCTErrorUnspecified, @"The view cannot be captured. drawViewHierarchyInRect was not successful. This is a potential technical or security limitation.", nil); - return; - } - - if (!image) { - reject(ABI46_0_0RCTErrorUnspecified, @"Failed to capture view snapshot. UIGraphicsGetImageFromCurrentImageContext() returned nil!", nil); - return; - } - - // Convert image to data (on a background thread) - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ - - NSData *data; - if ([format isEqualToString:@"jpg"]) { - CGFloat quality = [ABI46_0_0RCTConvert CGFloat:options[@"quality"]]; - data = UIImageJPEGRepresentation(image, quality); - } - else { - data = UIImagePNGRepresentation(image); - } - - NSError *error = nil; - NSString *res = nil; - if ([result isEqualToString:@"base64"]) { - // Return as a base64 raw string - res = [data base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength]; - } - else if ([result isEqualToString:@"data-uri"]) { - // Return as a base64 data uri string - NSString *base64 = [data base64EncodedStringWithOptions: NSDataBase64Encoding64CharacterLineLength]; - NSString *imageFormat = ([format isEqualToString:@"jpg"]) ? @"jpeg" : format; - res = [NSString stringWithFormat:@"data:image/%@;base64,%@", imageFormat, base64]; - } - else { - // Save to a temp file - NSString *path = ABI46_0_0RCTTempFilePath(format, &error); - if (path && !error) { - if ([data writeToFile:path options:(NSDataWritingOptions)0 error:&error]) { - res = path; - } - } - } - - if (res && !error) { - resolve(res); - return; - } - - // If we reached here, something went wrong - if (error) reject(ABI46_0_0RCTErrorUnspecified, error.localizedDescription, error); - else reject(ABI46_0_0RCTErrorUnspecified, @"viewshot unknown error", nil); - }); - }]; -} - - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.h deleted file mode 100644 index 1706c0e150724d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXAppState : ABI46_0_0RCTEventEmitter - -/** - * Kernel manages the state of each bridge and passes it here. - */ -- (void)setState:(NSString *)state; - -@property (nonatomic, strong, readonly) NSString *lastKnownState; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.m deleted file mode 100644 index 5405b1ac274433..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXAppState.m +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXAppState.h" -#import "ABI46_0_0EXScopedModuleRegistry.h" - -#import -#import - -#import -#import -#import -#import - -@interface ABI46_0_0EXAppState () - -@property (nonatomic, assign) BOOL isObserving; - -@end - -@implementation ABI46_0_0EXAppState - -+ (NSString *)moduleName { return @"ABI46_0_0RCTAppState"; } - -- (instancetype)init -{ - if (self = [super init]) { - _lastKnownState = @"active"; - } - return self; -} - -+ (BOOL)requiresMainQueueSetup -{ - return YES; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (NSDictionary *)constantsToExport -{ - return @{@"initialAppState": @"active"}; -} - -#pragma mark - Lifecycle - -- (NSArray *)supportedEvents -{ - return @[@"appStateDidChange", @"memoryWarning"]; -} - -- (void)startObserving -{ - _isObserving = YES; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(handleMemoryWarning) - name:UIApplicationDidReceiveMemoryWarningNotification - object:nil]; -} - -- (void)stopObserving -{ - _isObserving = NO; - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -#pragma mark - App Notification Methods - -- (void)handleMemoryWarning -{ - [self sendEventWithName:@"memoryWarning" body:nil]; -} - -- (void)setState:(NSString *)state -{ - if (![state isEqualToString:_lastKnownState]) { - _lastKnownState = state; - if (_isObserving) { - [self sendEventWithName:@"appStateDidChange" - body:@{@"app_state": _lastKnownState}]; - } - - // change state on universal modules - // TODO: just make ABI46_0_0EXAppState an expo module implementing ABI46_0_0EXAppLifecycleService - id lifeCycleManager = [[[self.bridge moduleForClass:[ABI46_0_0EXModuleRegistryHolderReactModule class]] exModuleRegistry] getModuleImplementingProtocol:@protocol(ABI46_0_0EXAppLifecycleService)]; - if ([state isEqualToString:@"background"]) { - [lifeCycleManager setAppStateToBackground]; - } else if ([state isEqualToString:@"active"]) { - [lifeCycleManager setAppStateToForeground]; - } - } -} - -ABI46_0_0RCT_EXPORT_METHOD(getCurrentAppState:(ABI46_0_0RCTResponseSenderBlock)callback - error:(__unused ABI46_0_0RCTResponseSenderBlock)error) -{ - callback(@[@{@"app_state": _lastKnownState}]); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.h deleted file mode 100644 index 9c08eb52b0fd19..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -#import "ABI46_0_0EXScopedEventEmitter.h" - -@protocol ABI46_0_0EXLinkingManagerScopedModuleDelegate - -- (void)linkingModule:(id)linkingModule didOpenUrl:(NSString *)url; - -/** - * @return whether the url should be routed internally as an expo url, - * vs. fall back to the iOS system handler. - */ -- (BOOL)linkingModule:(id)linkingModule shouldOpenExpoUrl:(NSURL *)url; - -@end - -@interface ABI46_0_0EXLinkingManager : ABI46_0_0EXScopedEventEmitter - -- (void)dispatchOpenUrlEvent: (NSURL *)url; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.m deleted file mode 100644 index 844e668ee3801c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXLinkingManager.m +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXLinkingManager.h" -#import "ABI46_0_0EXScopedModuleRegistry.h" -#import "ABI46_0_0EXUtil.h" - -#import -#import -#import - -NSString * const ABI46_0_0EXLinkingEventOpenUrl = @"url"; - -@interface ABI46_0_0EXLinkingManager () - -@property (nonatomic, weak) id kernelLinkingDelegate; -@property (nonatomic, strong) NSURL *initialUrl; -@property (nonatomic) BOOL hasListeners; - -@end - -@implementation ABI46_0_0EXLinkingManager - -ABI46_0_0EX_EXPORT_SCOPED_MODULE(ABI46_0_0RCTLinkingManager, KernelLinkingManager); - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params -{ - if (self = [super initWithExperienceStableLegacyId:experienceStableLegacyId - scopeKey:scopeKey - easProjectId:easProjectId - kernelServiceDelegate:kernelServiceInstance - params:params]) { - _kernelLinkingDelegate = kernelServiceInstance; - _initialUrl = params[@"initialUri"]; - if (_initialUrl == [NSNull null]) { - _initialUrl = nil; - } - } - return self; -} - -#pragma mark - ABI46_0_0RCTEventEmitter methods - -- (NSArray *)supportedEvents -{ - return @[ABI46_0_0EXLinkingEventOpenUrl]; -} - -- (void)startObserving -{ - _hasListeners = YES; -} - -- (void)stopObserving -{ - _hasListeners = NO; -} - -#pragma mark - Linking methods - -- (void)dispatchOpenUrlEvent:(NSURL *)url -{ - if (!url || !url.absoluteString) { - ABI46_0_0RCTFatal(ABI46_0_0RCTErrorWithMessage([NSString stringWithFormat:@"Tried to open a deep link to an invalid url: %@", url])); - return; - } - if (_hasListeners) { - [self sendEventWithName:ABI46_0_0EXLinkingEventOpenUrl body:@{@"url": url.absoluteString}]; - } -} - -ABI46_0_0RCT_EXPORT_METHOD(openURL:(NSURL *)URL - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - if ([_kernelLinkingDelegate linkingModule:self shouldOpenExpoUrl:URL]) { - [_kernelLinkingDelegate linkingModule:self didOpenUrl:URL.absoluteString]; - resolve(@YES); - } else { - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - [ABI46_0_0RCTSharedApplication() openURL:URL options:@{} completionHandler:^(BOOL success) { - if (success) { - resolve(nil); - } else { - reject(ABI46_0_0RCTErrorUnspecified, [NSString stringWithFormat:@"Unable to open URL: %@", URL], nil); - } - }]; - }]; - } -} - -ABI46_0_0RCT_EXPORT_METHOD(canOpenURL:(NSURL *)URL - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - __block BOOL canOpen = [_kernelLinkingDelegate linkingModule:self shouldOpenExpoUrl:URL]; - if (!canOpen) { - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - canOpen = [ABI46_0_0RCTSharedApplication() canOpenURL:URL]; - }]; - } - resolve(@(canOpen)); -} - -ABI46_0_0RCT_EXPORT_METHOD(openSettings:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - [ABI46_0_0EXUtil performSynchronouslyOnMainThread:^{ - NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString]; - [ABI46_0_0RCTSharedApplication() openURL:url options:@{} completionHandler:^(BOOL success) { - if (success) { - resolve(nil); - } else { - reject(ABI46_0_0RCTErrorUnspecified, @"Unable to open app settings", nil); - } - }]; - }]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getInitialURL:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - resolve(ABI46_0_0RCTNullIfNil(_initialUrl.absoluteString)); -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.h deleted file mode 100644 index 2ef868166ea54c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.h +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXNativeModuleIntrospection : NSObject - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.m deleted file mode 100644 index b3c68424544db7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXNativeModuleIntrospection.m +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXNativeModuleIntrospection.h" - -#import -#import -#import - -@implementation ABI46_0_0EXNativeModuleIntrospection - -@synthesize bridge = _bridge; - -ABI46_0_0RCT_EXPORT_MODULE(ExpoNativeModuleIntrospection) - -ABI46_0_0RCT_REMAP_METHOD(getNativeModuleNamesAsync, - nativeModuleNamesWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) { - NSError *error; - NSDictionary *moduleDataByName = [self _moduleDataFromBridge:&error]; - if (!moduleDataByName) { - reject(error.domain, error.userInfo[NSLocalizedDescriptionKey], error); - return; - } - - NSArray *moduleNames = moduleDataByName.allKeys; - resolve(moduleNames); -} - -ABI46_0_0RCT_REMAP_METHOD(introspectNativeModuleAsync, - introspectNativeModule:(NSString *)name - resolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) { - NSError *error; - NSDictionary *moduleDataByName = [self _moduleDataFromBridge:&error]; - if (!moduleDataByName) { - reject(error.domain, error.userInfo[NSLocalizedDescriptionKey], error); - return; - } - - ABI46_0_0RCTModuleData *moduleData = moduleDataByName[name]; - if (!moduleData) { - resolve(nil); - return; - } - - NSArray> *moduleMethods = moduleData.methods; - NSMutableDictionary *> *methodDescriptions = [NSMutableDictionary dictionaryWithCapacity:moduleMethods.count]; - for (id method in moduleMethods) { - NSString *methodName = [NSString stringWithCString:method.JSMethodName encoding:NSASCIIStringEncoding]; - NSString *functionType = [NSString stringWithCString:ABI46_0_0RCTFunctionDescriptorFromType(method.functionType) - encoding:NSASCIIStringEncoding]; - methodDescriptions[methodName] = @{ @"type": functionType }; - } - - resolve(@{ @"methods": methodDescriptions }); -} - -- (NSDictionary *)_moduleDataFromBridge:(NSError **)error { - ABI46_0_0RCTBridge *bridge = _bridge; - if (![NSStringFromClass(bridge.class) isEqualToString:@"ABI46_0_0RCTCxxBridge"]) { - if (error) { - *error = [NSError errorWithDomain:@"E_NATIVEMODULEINTROSPECTION_INCOMPATIBLE_BRIDGE" code:0 userInfo:@{ - NSLocalizedDescriptionKey: @"Native module introspection is compatible only with the C++ bridge", - }]; - } - return nil; - } - - NSDictionary *moduleDataByName; - @try { - moduleDataByName = [bridge valueForKey:@"_moduleDataByName"]; - } - @catch (NSException *e) { - if (![e.name isEqualToString:NSUndefinedKeyException]) { - @throw; - } - - if (error) { - NSString *variableName = e.userInfo[@"NSUnknownUserInfoKey"]; - *error = [NSError errorWithDomain:@"E_NATIVEMODULEINTROSPECTION_INCOMPATIBLE_BRIDGE" code:0 userInfo:@{ - NSLocalizedDescriptionKey: [NSString stringWithFormat:@"Bridge does not define expected variable: %@", variableName], - }]; - } - return nil; - } - - return moduleDataByName; -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXResourceLoader.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXResourceLoader.h deleted file mode 100644 index 9cf0aeaaddd518..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXResourceLoader.h +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -NS_ASSUME_NONNULL_BEGIN - -/** - * This is the versioned protocol for ABI46_0_0EXCachedResource, this also defines some - * of the types used when interacting with ABI46_0_0EXCachedResource instances. This is - * used with the ABI46_0_0EXCachedResourceManager service to be able to create ABI46_0_0EXCachedResource - * instances in versioned code. - * - * **Avoid making breaking changes to this and if you do make sure to edit all - * versions of this file.** - */ - -@interface ABI46_0_0EXLoadingProgress : NSObject - -@property (nonatomic, copy) NSString *status; -@property (nonatomic, strong) NSNumber *done; -@property (nonatomic, strong) NSNumber *total; - -@end - -typedef void (^ABI46_0_0EXCachedResourceSuccessBlock)(NSData *data); -typedef void (^ABI46_0_0EXCachedResourceErrorBlock)(NSError *error); -typedef void (^ABI46_0_0EXCachedResourceProgressBlock)(ABI46_0_0EXLoadingProgress *progress); - -typedef enum ABI46_0_0EXCachedResourceBehavior { - // load the resource without using any cache. - ABI46_0_0EXCachedResourceNoCache, - // load the resource without reading from the cache, but still write the loaded resource to the cache. - ABI46_0_0EXCachedResourceWriteToCache, - // return immediately with cached data if it exists, then try to download the resource and replace the cache in the background. - ABI46_0_0EXCachedResourceUseCacheImmediately, - // return immediately with cached data if it exists, and only try to download the resource if cached data is not found. - ABI46_0_0EXCachedResourceFallBackToNetwork, - // try to download the resource, but fall back to the cached version if the download fails. - ABI46_0_0EXCachedResourceFallBackToCache, - // use a cache if it exists, otherwise fail. (don't download anything) - ABI46_0_0EXCachedResourceOnlyCache, -} ABI46_0_0EXCachedResourceBehavior; - -typedef enum ABI46_0_0EXManifestCacheBehavior { - // load the manifest without using any cache. - ABI46_0_0EXManifestNoCache, - // use a cache if it exists, otherwise fail. (don't download anything) - ABI46_0_0EXManifestOnlyCache, - // load the resource without reading from the cache, but still prepare to write the loaded resource to the cache. - ABI46_0_0EXManifestPrepareToCache, -} ABI46_0_0EXManifestCacheBehavior; - -@protocol ABI46_0_0EXResourceLoader - -- (void)loadResourceWithBehavior:(ABI46_0_0EXCachedResourceBehavior)behavior - progressBlock:(__nullable ABI46_0_0EXCachedResourceProgressBlock)progressBlock - successBlock:(ABI46_0_0EXCachedResourceSuccessBlock)successBlock - errorBlock:(ABI46_0_0EXCachedResourceErrorBlock)errorBlock; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.h deleted file mode 100644 index b13722dbcbf762..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.h +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import - -#import "ABI46_0_0EXScopedBridgeModule.h" - -// used for initializing scoped modules which don't tie in to any kernel service. -#define ABI46_0_0EX_KERNEL_SERVICE_NONE @"ABI46_0_0EXKernelServiceNone" - -/** - * Use this in place of ABI46_0_0RCT_EXPORT_MODULE() to auto-init an instance of your scoped module on ABI46_0_0RCTBridge instances. - * @param js_name same as ABI46_0_0RCT_EXPORT_MODULE(), the module name available in JS - * @param kernel_service_class if specified, your module will be passed an unversioned instance of this kernel service at runtime. - * e.g. MyKernelService -> an instance of ABI46_0_0EXMyKernelService - */ -#define ABI46_0_0EX_EXPORT_SCOPED_MODULE(js_name, kernel_service_class) \ -ABI46_0_0RCT_EXTERN void ABI46_0_0EXRegisterScopedModule(Class, ...); \ -+ (NSString *)moduleName { return @#js_name; } \ -+ (void)load { ABI46_0_0EXRegisterScopedModule(self, @#kernel_service_class, nil); } - -/** - * Use this in place of ABI46_0_0EX_EXPORT_SCOPED_MODULE() if the module requires more than one kernel service. - * @param js_name same as ABI46_0_0RCT_EXPORT_MODULE(), the module name available in JS - * @param ... strings representing names of kernel services to be passed to th emodule at runtime. - * e.g. @"MyKernelService" -> an instance of ABI46_0_0EXMyKernelService - */ -#define ABI46_0_0EX_EXPORT_SCOPED_MULTISERVICE_MODULE(js_name, ...) \ -ABI46_0_0RCT_EXTERN void ABI46_0_0EXRegisterScopedModule(Class, ...); \ -+ (NSString *)moduleName { return @#js_name; } \ -+ (void)load { ABI46_0_0EXRegisterScopedModule(self, __VA_ARGS__, nil); } - -/** - * Provides a namespace/bottleneck through which scoped modules - * can make themselves accessible to other modules. - * - * e.g. ABI46_0_0EX_DECLARE_SCOPED_MODULE_GETTER(ABI46_0_0EXCoolClass, coolClass) - * provides the getter `_bridge.scopedModules.coolClass`. - */ -#define ABI46_0_0EX_DECLARE_SCOPED_MODULE_GETTER(className, getter) \ -@interface ABI46_0_0EXScopedModuleRegistry (className) \ -@property (nonatomic, readonly) className *__nonnull getter; \ -@end\ - -/** - * Use in conjunction with ABI46_0_0EX_DECLARE_SCOPED_MODULE_GETTER, but in the corresponding implementation file. - */ -#define ABI46_0_0EX_DEFINE_SCOPED_MODULE_GETTER(className, getter) \ -@implementation ABI46_0_0EXScopedModuleRegistry (className) \ -- (className *)getter { return [self.bridge moduleForClass:[className class]]; } \ -@end\ - -@interface ABI46_0_0EXScopedModuleRegistry : NSObject - -@end - -@class ABI46_0_0RCTBridge; - -@interface ABI46_0_0RCTBridge (ABI46_0_0EXScopedModuleRegistry) - -@property (nonatomic, readonly) ABI46_0_0EXScopedModuleRegistry *scopedModules; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.m deleted file mode 100644 index 7c85ce8e101176..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXScopedModuleRegistry.m +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedModuleRegistry.h" -#import "ABI46_0_0EXUnversioned.h" - -static NSMutableDictionary *ABI46_0_0EXScopedModuleClasses; - -NSDictionary * ABI46_0_0EXGetScopedModuleClasses(void); -NSDictionary * ABI46_0_0EXGetScopedModuleClasses() -{ - return ABI46_0_0EXScopedModuleClasses; -} - -void ABI46_0_0EXRegisterScopedModule(Class, ...); -void ABI46_0_0EXRegisterScopedModule(Class moduleClass, ...) -{ - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - ABI46_0_0EXScopedModuleClasses = [NSMutableDictionary dictionary]; - }); - - NSString *kernelServiceClassName; - va_list argumentList; - NSMutableDictionary *unversionedKernelServiceClassNames = [[NSMutableDictionary alloc] init]; - - va_start(argumentList, moduleClass); - while ((kernelServiceClassName = va_arg(argumentList, NSString*))) { - if ([kernelServiceClassName isEqualToString:@"nil"]) { - unversionedKernelServiceClassNames[kernelServiceClassName] = ABI46_0_0EX_KERNEL_SERVICE_NONE; - } else { - unversionedKernelServiceClassNames[kernelServiceClassName] = [@"EX" stringByAppendingString:kernelServiceClassName]; - } - } - va_end(argumentList); - - NSString *moduleClassName = NSStringFromClass(moduleClass); - if (moduleClassName) { - ABI46_0_0EXScopedModuleClasses[moduleClassName] = unversionedKernelServiceClassNames; - } -} - -@implementation ABI46_0_0EXScopedModuleRegistry - -ABI46_0_0RCT_EXPORT_MODULE(ExponentScopedModuleRegistry); - -@synthesize bridge = _bridge; - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - _bridge = bridge; -} - -@end - -@implementation ABI46_0_0RCTBridge (ABI46_0_0EXScopedModuleRegistry) - -- (ABI46_0_0EXScopedModuleRegistry *)scopedModules -{ - return [self moduleForClass:[ABI46_0_0EXScopedModuleRegistry class]]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.h deleted file mode 100644 index 40794c1747a227..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.h +++ /dev/null @@ -1,18 +0,0 @@ - -#import - -#import -#import - -@interface ABI46_0_0RCTConvert (ABI46_0_0EXStatusBar) - -#if !TARGET_OS_TV -+ (UIStatusBarStyle)UIStatusBarStyle:(id)json; -+ (UIStatusBarAnimation)UIStatusBarAnimation:(id)json; -#endif - -@end - -@interface ABI46_0_0EXStatusBarManager : ABI46_0_0RCTEventEmitter - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.m deleted file mode 100644 index 3d9355071d9b7c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/ABI46_0_0EXStatusBarManager.m +++ /dev/null @@ -1,220 +0,0 @@ - -#import "ABI46_0_0EXStatusBarManager.h" -#import "ABI46_0_0EXUnversioned.h" - -#import -#import -#import - -#if !TARGET_OS_TV -@implementation ABI46_0_0RCTConvert (ABI46_0_0EXStatusBar) - -ABI46_0_0RCT_ENUM_CONVERTER(UIStatusBarStyle, (@{ - @"default": @(UIStatusBarStyleDefault), - @"light-content": @(UIStatusBarStyleLightContent), - @"dark-content": @(UIStatusBarStyleDefault), -}), UIStatusBarStyleDefault, integerValue); - -ABI46_0_0RCT_ENUM_CONVERTER(UIStatusBarAnimation, (@{ - @"none": @(UIStatusBarAnimationNone), - @"fade": @(UIStatusBarAnimationFade), - @"slide": @(UIStatusBarAnimationSlide), -}), UIStatusBarAnimationNone, integerValue); - -@end -#endif - -@interface ABI46_0_0EXStatusBarManager () - -@property (nonatomic, strong) NSMutableDictionary *capturedStatusBarProperties; - -@end - -@implementation ABI46_0_0EXStatusBarManager - -+ (NSString *)moduleName { return @"ABI46_0_0RCTStatusBarManager"; } - -- (NSArray *)supportedEvents -{ - return @[@"statusBarFrameDidChange", - @"statusBarFrameWillChange"]; -} - -#if !TARGET_OS_TV - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - [super setBridge:bridge]; - _capturedStatusBarProperties = [[self _currentStatusBarProperties] mutableCopy]; - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_bridgeDidForeground:) - name:@"EXKernelBridgeDidForegroundNotification" - object:self.bridge]; - - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(_bridgeDidBackground:) - name:@"EXKernelBridgeDidBackgroundNotification" - object:self.bridge]; -} - -- (void)dealloc -{ - [self stopObserving]; -} - -- (void)startObserving -{ - NSNotificationCenter *nc = [NSNotificationCenter defaultCenter]; - [nc addObserver:self selector:@selector(applicationDidChangeStatusBarFrame:) name:UIApplicationDidChangeStatusBarFrameNotification object:nil]; - [nc addObserver:self selector:@selector(applicationWillChangeStatusBarFrame:) name:UIApplicationWillChangeStatusBarFrameNotification object:nil]; -} - -- (void)stopObserving -{ - [[NSNotificationCenter defaultCenter] removeObserver:self]; -} - -- (dispatch_queue_t)methodQueue -{ - return dispatch_get_main_queue(); -} - -- (void)emitEvent:(NSString *)eventName forNotification:(NSNotification *)notification -{ - CGRect frame = [notification.userInfo[UIApplicationStatusBarFrameUserInfoKey] CGRectValue]; - NSDictionary *event = @{ - @"frame": @{ - @"x": @(frame.origin.x), - @"y": @(frame.origin.y), - @"width": @(frame.size.width), - @"height": @(frame.size.height), - }, - }; - [self sendEventWithName:eventName body:event]; -} - -- (void)applicationDidChangeStatusBarFrame:(NSNotification *)notification -{ - [self emitEvent:@"statusBarFrameDidChange" forNotification:notification]; -} - -- (void)applicationWillChangeStatusBarFrame:(NSNotification *)notification -{ - [self emitEvent:@"statusBarFrameWillChange" forNotification:notification]; -} - -ABI46_0_0RCT_EXPORT_METHOD(getHeight:(ABI46_0_0RCTResponseSenderBlock)callback) -{ - callback(@[@{ - @"height": @([UIApplication sharedApplication].statusBarFrame.size.height), - }]); -} - -ABI46_0_0RCT_EXPORT_METHOD(setStyle:(UIStatusBarStyle)statusBarStyle - animated:(BOOL)animated) -{ - if ([[self class] _viewControllerBasedStatusBarAppearance]) { - ABI46_0_0RCTLogError(@"ABI46_0_0RCTStatusBarManager module requires that the \ - UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [ABI46_0_0RCTSharedApplication() setStatusBarStyle:statusBarStyle - animated:animated]; - _capturedStatusBarProperties[@"style"] = @(statusBarStyle); -#pragma clang diagnostic pop - } -} - -ABI46_0_0RCT_EXPORT_METHOD(setHidden:(BOOL)hidden - withAnimation:(UIStatusBarAnimation)animation) -{ - if ([[self class] _viewControllerBasedStatusBarAppearance]) { - ABI46_0_0RCTLogError(@"ABI46_0_0RCTStatusBarManager module requires that the \ - UIViewControllerBasedStatusBarAppearance key in the Info.plist is set to NO"); - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [ABI46_0_0RCTSharedApplication() setStatusBarHidden:hidden - withAnimation:animation]; - _capturedStatusBarProperties[@"hidden"] = @(hidden); -#pragma clang diagnostic pop - } -} - -ABI46_0_0RCT_EXPORT_METHOD(setNetworkActivityIndicatorVisible:(BOOL)visible) -{ - ABI46_0_0RCTSharedApplication().networkActivityIndicatorVisible = visible; - _capturedStatusBarProperties[@"networkActivityIndicatorVisible"] = @(visible); -} - -/** - * Used by the expo menu to restore status bar state between bridges. - * Normally nobody should use this method because it bypasses the JS state used by the StatusBar component. - */ -ABI46_0_0RCT_REMAP_METHOD(_captureProperties, - _capturePropertiesWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - resolve([self _currentStatusBarProperties]); -} - -/** - * Used by the expo menu to restore status bar state between bridges. - * Normally nobody should use this method because it bypasses the JS state used by the StatusBar component. - */ -ABI46_0_0RCT_EXPORT_METHOD(_applyPropertiesAndForget:(NSDictionary *)properties) -{ - [self _applyCapturedProperties:properties]; -} - -#pragma mark - internal - -+ (BOOL)_viewControllerBasedStatusBarAppearance -{ - static BOOL value; - static dispatch_once_t onceToken; - dispatch_once(&onceToken, ^{ - value = [[[NSBundle mainBundle] objectForInfoDictionaryKey: - @"UIViewControllerBasedStatusBarAppearance"] ?: @YES boolValue]; - }); - - return value; -} - -- (NSDictionary *)_currentStatusBarProperties -{ - UIApplication *currentApplication = ABI46_0_0RCTSharedApplication(); - return @{ - @"style": @(currentApplication.statusBarStyle), - @"networkActivityIndicatorVisible": @(currentApplication.isNetworkActivityIndicatorVisible), - @"hidden": @(currentApplication.isStatusBarHidden), - }; -} - -- (void)_applyCapturedProperties:(NSDictionary *)properties -{ - UIApplication *currentApplication = ABI46_0_0RCTSharedApplication(); - if (![[self class] _viewControllerBasedStatusBarAppearance]) { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [currentApplication setStatusBarStyle:(UIStatusBarStyle)[properties[@"style"] integerValue] animated:NO]; - [currentApplication setStatusBarHidden:[properties[@"hidden"] boolValue] withAnimation:UIStatusBarAnimationNone]; -#pragma clang diagnostic pop - } - currentApplication.networkActivityIndicatorVisible = [properties[@"networkActivityIndicatorVisible"] boolValue]; -} - -- (void)_bridgeDidForeground:(__unused NSNotification *)notif -{ - [self _applyCapturedProperties:_capturedStatusBarProperties]; -} - -- (void)_bridgeDidBackground:(__unused NSNotification *)notif -{ - _capturedStatusBarProperties = [[self _currentStatusBarProperties] mutableCopy]; -} - -#endif //TARGET_OS_TV - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.h deleted file mode 100644 index 9bc7796ce6837a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXDevSettings : ABI46_0_0RCTDevSettings - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithScopeKey:(NSString *)scopeKey - isDevelopment:(BOOL)isDevelopment NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.m deleted file mode 100644 index 35aa376896ae0f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettings.m +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXDevSettings.h" -#import "ABI46_0_0EXDevSettingsDataSource.h" - -// redefined from ABI46_0_0RCTDevMenu.mm -NSString *const kABI46_0_0RCTDevSettingShakeToShowDevMenu = @"shakeToShow"; -NSString *const kABI46_0_0RCTDevSettingLiveReloadEnabled = @"liveReloadEnabled"; -NSString *const kABI46_0_0RCTDevSettingHotLoadingEnabled = @"hotLoadingEnabled"; - -@implementation ABI46_0_0EXDevSettings - -+ (NSString *)moduleName { return @"ABI46_0_0RCTDevSettings"; } - -- (instancetype)initWithScopeKey:(NSString *)scopeKey isDevelopment:(BOOL)isDevelopment -{ - NSDictionary *defaultValues = @{ - kABI46_0_0RCTDevSettingShakeToShowDevMenu: @YES, - kABI46_0_0RCTDevSettingHotLoadingEnabled: @YES, - kABI46_0_0RCTDevSettingLiveReloadEnabled: @NO, - }; - ABI46_0_0EXDevSettingsDataSource *dataSource = [[ABI46_0_0EXDevSettingsDataSource alloc] initWithDefaultValues:defaultValues - forScopeKey:scopeKey - isDevelopment:isDevelopment]; - return [super initWithDataSource:dataSource]; -} - -- (NSArray *)supportedEvents -{ - return [super supportedEvents]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.h deleted file mode 100644 index 4d2547aed08ceb..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import - -@interface ABI46_0_0EXDevSettingsDataSource : NSObject - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithDefaultValues:(NSDictionary *)defaultValues - forScopeKey:(NSString *)scopeKey - isDevelopment:(BOOL)isDevelopment NS_DESIGNATED_INITIALIZER; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.m deleted file mode 100644 index 30197fe95b8569..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDevSettingsDataSource.m +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXDevSettingsDataSource.h" - -#import -#import - -// redefined from ABI46_0_0RCTDevMenu.mm -NSString *const ABI46_0_0EXDevSettingsUserDefaultsKey = @"ABI46_0_0RCTDevMenu"; -NSString *const ABI46_0_0EXDevSettingShakeToShowDevMenu = @"shakeToShow"; -NSString *const ABI46_0_0EXDevSettingProfilingEnabled = @"profilingEnabled"; -NSString *const ABI46_0_0EXDevSettingHotLoadingEnabled = @"hotLoadingEnabled"; -NSString *const ABI46_0_0EXDevSettingLiveReloadEnabled = @"liveReloadEnabled"; -NSString *const ABI46_0_0EXDevSettingIsInspectorShown = @"showInspector"; -NSString *const ABI46_0_0EXDevSettingIsDebuggingRemotely = @"isDebuggingRemotely"; - -@interface ABI46_0_0EXDevSettingsDataSource () - -@property (nonatomic, strong) NSString *scopeKey; -@property (nonatomic, readonly) NSSet *settingsDisabledInProduction; - -@end - -@implementation ABI46_0_0EXDevSettingsDataSource { - NSMutableDictionary *_settings; - NSUserDefaults *_userDefaults; - BOOL _isDevelopment; -} - -- (instancetype)initWithDefaultValues:(NSDictionary *)defaultValues - forScopeKey:(NSString *)scopeKey - isDevelopment:(BOOL)isDevelopment -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _userDefaults = [NSUserDefaults standardUserDefaults]; - _isDevelopment = isDevelopment; - _settingsDisabledInProduction = [NSSet setWithArray:@[ - ABI46_0_0EXDevSettingShakeToShowDevMenu, - ABI46_0_0EXDevSettingProfilingEnabled, - ABI46_0_0EXDevSettingHotLoadingEnabled, - ABI46_0_0EXDevSettingLiveReloadEnabled, - ABI46_0_0EXDevSettingIsInspectorShown, - ABI46_0_0EXDevSettingIsDebuggingRemotely, - ]]; - if (defaultValues) { - [self _reloadWithDefaults:defaultValues]; - } - } - return self; -} - -- (void)updateSettingWithValue:(id)value forKey:(NSString *)key -{ - ABI46_0_0RCTAssert((key != nil), @"%@", [NSString stringWithFormat:@"%@: Tried to update nil key", [self class]]); - - id currentValue = [self settingForKey:key]; - if (currentValue == value || [currentValue isEqual:value]) { - return; - } - if (value) { - _settings[key] = value; - } else { - [_settings removeObjectForKey:key]; - } - [_userDefaults setObject:_settings forKey:[self _userDefaultsKey]]; -} - -- (id)settingForKey:(NSString *)key -{ - // live reload is always disabled in ABI46_0_0React-native@>=0.61 due to fast refresh - // we can remove this when live reload is completely removed from the - // ABI46_0_0React-native runtime - if ([key isEqualToString:ABI46_0_0EXDevSettingLiveReloadEnabled]) { - return @NO; - } - - // prohibit these settings if not serving the experience as a developer - if (!_isDevelopment && [_settingsDisabledInProduction containsObject:key]) { - return @NO; - } - return _settings[key]; -} - -#pragma mark - internal - -- (void)_reloadWithDefaults:(NSDictionary *)defaultValues -{ - NSString *defaultsKey = [self _userDefaultsKey]; - NSDictionary *existingSettings = [_userDefaults objectForKey:defaultsKey]; - _settings = existingSettings ? [existingSettings mutableCopy] : [NSMutableDictionary dictionary]; - for (NSString *key in [defaultValues keyEnumerator]) { - if (!_settings[key]) { - _settings[key] = defaultValues[key]; - } - } - [_userDefaults setObject:_settings forKey:defaultsKey]; -} - -- (NSString *)_userDefaultsKey -{ - if (_scopeKey) { - return [NSString stringWithFormat:@"%@/%@", _scopeKey, ABI46_0_0EXDevSettingsUserDefaultsKey]; - } else { - ABI46_0_0RCTLogWarn(@"Can't scope dev settings because bridge is not set"); - return ABI46_0_0EXDevSettingsUserDefaultsKey; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.h deleted file mode 100644 index 90b1fa66fca2e0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import -#import - -@interface ABI46_0_0EXDisabledDevLoadingView : ABI46_0_0RCTEventEmitter - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.m deleted file mode 100644 index c85b3df4db5ef5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevLoadingView.m +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -@import UIKit; - -#import "ABI46_0_0EXDisabledDevLoadingView.h" -#import "ABI46_0_0EXDevSettings.h" - -@implementation ABI46_0_0EXDisabledDevLoadingView { - BOOL _isObserving; -} - -+ (NSString *)moduleName { return @"ABI46_0_0RCTDevLoadingView"; } - - -ABI46_0_0RCT_EXPORT_METHOD(hide) -{ - ABI46_0_0RCTDevSettings *settings = [[super bridge] devSettings]; - BOOL isFastRefreshEnabled = [settings isHotLoadingEnabled]; - if (_isObserving && isFastRefreshEnabled) { - [self sendEventWithName:@"devLoadingView:hide" body:@{}]; - } -} - -ABI46_0_0RCT_EXPORT_METHOD(showMessage:(NSString *)message color:(UIColor *)color backgroundColor:(UIColor *)backgroundColor) -{ - ABI46_0_0RCTDevSettings *settings = [[super bridge] devSettings]; - BOOL isFastRefreshEnabled = [settings isHotLoadingEnabled]; - if (_isObserving && isFastRefreshEnabled) { - [self sendEventWithName:@"devLoadingView:showMessage" body:@{@"message":message}]; - } -} - -- (NSArray *)supportedEvents -{ - return @[@"devLoadingView:showMessage", @"devLoadingView:hide"]; -} - -- (void)startObserving -{ - _isObserving = YES; -} - -- (void)stopObserving -{ - _isObserving = NO; -} - -// ABI46_0_0RCTDevLoadingViewProtocol implementations - -+ (void)setEnabled:(BOOL)enabled -{ - -} - -- (void)showWithURL:(NSURL *)URL -{ - -} - -- (void)updateProgress:(ABI46_0_0RCTLoadingProgress *)progress -{ - -} - -@end - diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.h deleted file mode 100644 index fb5b788d4df832..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import - -@interface ABI46_0_0EXDisabledDevMenu : NSObject - -@property (nonatomic) BOOL shakeToShow; -@property (nonatomic) BOOL profilingEnabled; -@property (nonatomic) BOOL liveReloadEnabled; -@property (nonatomic) BOOL showFPS; - -- (void)show; -- (void)reload; -- (void)addItem:(NSString *)title handler:(dispatch_block_t)handler DEPRECATED_ATTRIBUTE; -- (void)addItem:(ABI46_0_0RCTDevMenuItem *)item; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.mm b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.mm deleted file mode 100644 index 2fc3b327608c9b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledDevMenu.mm +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXDisabledDevMenu.h" - -@implementation ABI46_0_0EXDisabledDevMenu - -+ (NSString *)moduleName { return @"ABI46_0_0RCTDevMenu"; } - -ABI46_0_0RCT_NOT_IMPLEMENTED(- (void)show) -ABI46_0_0RCT_NOT_IMPLEMENTED(- (void)reload) - -// Stub out methods that are called but don't need to do anything -- (void)addItem:(NSString *)title handler:(dispatch_block_t)handler {} -- (void)addItem:(ABI46_0_0RCTDevMenuItem *)item {} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.h deleted file mode 100644 index 13b37d8d77467c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.h +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXDisabledRedBox : ABI46_0_0RCTRedBox - -- (void)showError:(NSError *)message; -- (void)showErrorMessage:(NSString *)message; -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details; -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack; -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack errorCookie:(int)errorCookie; -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack; -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack; -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow; -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack errorCookie:(int)errorCookie; -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack errorCookie:(int)errorCookie; -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack; -- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack; -- (void)showErrorMessage:(NSString *)message - withParsedStack:(NSArray *)stack - errorCookie:(int)errorCookie; -- (void)updateErrorMessage:(NSString *)message - withParsedStack:(NSArray *)stack - errorCookie:(int)errorCookie; - -- (void)dismiss; - -- (void)setOverrideReloadAction:(dispatch_block_t __unused)block; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.mm b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.mm deleted file mode 100644 index bfe3136db3d699..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/DevSupport/ABI46_0_0EXDisabledRedBox.mm +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXDisabledRedBox.h" - -@implementation ABI46_0_0EXDisabledRedBox - -+ (NSString *)moduleName { return @"ABI46_0_0RCTRedBox"; } - -- (void)showError:(NSError *)message {} -- (void)showErrorMessage:(NSString *)message {} -- (void)showErrorMessage:(NSString *)message withDetails:(NSString *)details {} -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack {} -- (void)showErrorMessage:(NSString *)message withRawStack:(NSString *)rawStack errorCookie:(int)errorCookie {} -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack {} -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack {} -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack showIfHidden:(BOOL)shouldShow {} -- (void)showErrorMessage:(NSString *)message withStack:(NSArray *)stack errorCookie:(int)errorCookie {} -- (void)updateErrorMessage:(NSString *)message withStack:(NSArray *)stack errorCookie:(int)errorCookie {} -- (void)showErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack {} -- (void)updateErrorMessage:(NSString *)message withParsedStack:(NSArray *)stack {} -- (void)showErrorMessage:(NSString *)message - withParsedStack:(NSArray *)stack - errorCookie:(int)errorCookie {} -- (void)updateErrorMessage:(NSString *)message - withParsedStack:(NSArray *)stack - errorCookie:(int)errorCookie {} - -- (void)dismiss {} - -- (void)setOverrideReloadAction:(dispatch_block_t __unused)block {} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.h deleted file mode 100644 index 20f3345071d20c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -FOUNDATION_EXPORT NSNotificationName ABI46_0_0EXTestSuiteCompletedNotification; - -typedef enum ABI46_0_0EXTestEnvironment { - ABI46_0_0EXTestEnvironmentNone = 0, - ABI46_0_0EXTestEnvironmentLocal = 1, - ABI46_0_0EXTestEnvironmentCI = 2, -} ABI46_0_0EXTestEnvironment; - -@interface ABI46_0_0EXTest : NSObject - -- (instancetype)initWithEnvironment:(ABI46_0_0EXTestEnvironment)environment NS_DESIGNATED_INITIALIZER; -- (instancetype)init NS_UNAVAILABLE; - -+ (ABI46_0_0EXTestEnvironment)testEnvironmentFromString:(NSString *)testEnvironmentString; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.m deleted file mode 100644 index 2c4096c332e30f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/Internal/Test/ABI46_0_0EXTest.m +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXTest.h" -#import "ABI46_0_0EXUnversioned.h" - -#import - -NSNotificationName ABI46_0_0EXTestSuiteCompletedNotification = @"ABI46_0_0EXTestSuiteCompletedNotification"; - -@interface ABI46_0_0EXTest () - -@property (class, nonatomic, assign, readonly) os_log_t log; -@property (nonatomic, assign) ABI46_0_0EXTestEnvironment environment; - -@end - -@implementation ABI46_0_0EXTest - -ABI46_0_0RCT_EXPORT_MODULE(ExponentTest); - -+ (os_log_t)log { - static os_log_t log; - static dispatch_once_t once; - dispatch_once(&once, ^{ - log = os_log_create("host.exp.Exponent", "test"); - }); - return log; -} - -- (instancetype)initWithEnvironment:(ABI46_0_0EXTestEnvironment)environment -{ - if (self = [super init]) { - _environment = environment; - } - return self; -} - -- (NSDictionary *)constantsToExport -{ - return @{ - @"isInCI": @(_environment == ABI46_0_0EXTestEnvironmentCI), - }; -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -ABI46_0_0RCT_EXPORT_METHOD(log:(NSString *)message) -{ - os_log(ABI46_0_0EXTest.log, "%{public}@", message); -} - -ABI46_0_0RCT_EXPORT_METHOD(completed:(NSString *)jsonStringifiedResult) -{ - NSDictionary *failedResult = @{ @"failed": @(1) }; - - NSError *jsonError; - NSData *jsonData = [jsonStringifiedResult dataUsingEncoding:NSUTF8StringEncoding]; - id resultObj = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:&jsonError]; - if (jsonError) { - resultObj = failedResult; - } - - [[NSNotificationCenter defaultCenter] postNotificationName:@"EXTestSuiteCompletedNotification" - object:nil - userInfo:resultObj]; - - // Apple's unified logging more precisely ensures the output is visible in a standalone app built - // for release and for us to filter for this message - os_log(ABI46_0_0EXTest.log, "[TEST-SUITE-END] %{public}@", jsonStringifiedResult); -} - -ABI46_0_0RCT_REMAP_METHOD(action, - actionWithParams:(NSDictionary *)params - withResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - // stub on iOS - resolve(@{}); -} - -ABI46_0_0RCT_REMAP_METHOD(shouldSkipTestsRequiringPermissionsAsync, - shouldSkipTestsRequiringPermissionsWithResolver:(ABI46_0_0RCTPromiseResolveBlock)resolve - rejecter:(__unused ABI46_0_0RCTPromiseRejectBlock)reject) -{ - resolve(@(_environment == ABI46_0_0EXTestEnvironmentCI)); -} - -#pragma mark - util - -+ (ABI46_0_0EXTestEnvironment)testEnvironmentFromString:(NSString *)testEnvironmentString -{ - if ([testEnvironmentString isEqualToString:@"local"]) { - return ABI46_0_0EXTestEnvironmentLocal; - } else if ([testEnvironmentString isEqualToString:@"ci"]) { - return ABI46_0_0EXTestEnvironmentCI; - } - return ABI46_0_0EXTestEnvironmentNone; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.h deleted file mode 100644 index cef975a3ff9ffe..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.h +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import -#import - -@interface ABI46_0_0EXScopedBridgeModule : NSObject - -- (instancetype)init NS_UNAVAILABLE; - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegates:(NSDictionary *)kernelServiceInstances - params:(NSDictionary *)params NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readonly) NSString *scopeKey; -@property (nonatomic, readonly, nullable) NSString *experienceStableLegacyId; -@property (nonatomic, readonly, nullable) NSString *easProjectId; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.m deleted file mode 100644 index 6b3ac7b0f59769..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedBridgeModule.m +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedBridgeModule.h" - -@implementation ABI46_0_0EXScopedBridgeModule - -+ (NSString *)moduleName -{ - NSAssert(NO, @"ABI46_0_0EXScopedBridgeModule is abstract, you should only export subclasses to the bridge."); - return @"ExponentScopedBridgeModule"; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params -{ - if (self = [super init]) { - _experienceStableLegacyId = experienceStableLegacyId; - _scopeKey = scopeKey; - _easProjectId = easProjectId; - } - return self; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegates:(NSDictionary *)kernelServiceInstances - params:(NSDictionary *)params -{ - if (self = [super init]) { - _experienceStableLegacyId = experienceStableLegacyId; - _scopeKey = scopeKey; - _easProjectId = easProjectId; - } - return self; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.h deleted file mode 100644 index 58fffb240a1019..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXScopedEventEmitter : ABI46_0_0RCTEventEmitter - -+ (NSString *)getScopeKeyFromEventEmitter:(id)eventEmitter; - -- (instancetype)init NS_UNAVAILABLE; - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params NS_DESIGNATED_INITIALIZER; - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegates:(NSDictionary *)kernelServiceInstances - params:(NSDictionary *)params NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readonly) NSString *scopeKey; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.m deleted file mode 100644 index 00055715edff07..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/ScopedModule/ABI46_0_0EXScopedEventEmitter.m +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedEventEmitter.h" - -@implementation ABI46_0_0EXScopedEventEmitter - -+ (NSString *)moduleName -{ - NSAssert(NO, @"ABI46_0_0EXScopedEventEmitter is abstract, you should only export subclasses to the bridge."); - return @"ExponentScopedEventEmitter"; -} - -+ (NSString *)getScopeKeyFromEventEmitter:(id)eventEmitter -{ - if (eventEmitter) { - return ((ABI46_0_0EXScopedEventEmitter *)eventEmitter).scopeKey; - } - return nil; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegate:(id)kernelServiceInstance - params:(NSDictionary *)params -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -- (instancetype)initWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - easProjectId:(NSString *)easProjectId - kernelServiceDelegates:(NSDictionary *)kernelServiceInstances - params:(NSDictionary *)params -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -- (NSArray *)supportedEvents -{ - return @[]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.h deleted file mode 100644 index 125f1c61c43607..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. -#import - -#if __has_include() -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXConstantsBinding : ABI46_0_0EXConstantsService - -@property (nonatomic, readonly) NSString *appOwnership; - -- (instancetype)initWithParams:(NSDictionary *)params; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.m deleted file mode 100644 index b1a3b774a28b71..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXConstantsBinding.m +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXConstantsBinding.h" -#import "ABI46_0_0EXUnversioned.h" - -@interface ABI46_0_0EXConstantsBinding () - -@property (nonatomic, strong) NSString *appOwnership; -@property (nonatomic, strong) NSDictionary *unversionedConstants; - -@end - -@implementation ABI46_0_0EXConstantsBinding : ABI46_0_0EXConstantsService - -- (instancetype)initWithParams:(NSDictionary *)params -{ - if (self = [super init]) { - _unversionedConstants = params[@"constants"]; - if (_unversionedConstants && _unversionedConstants[@"appOwnership"]) { - _appOwnership = _unversionedConstants[@"appOwnership"]; - } - } - return self; -} - -- (NSDictionary *)constants -{ - NSMutableDictionary *constants = [[super constants] mutableCopy]; - - [constants setValue:[self expoClientVersion] forKey:@"expoVersion"]; - - BOOL isDetached = NO; -#ifdef ABI46_0_0EX_DETACHED - isDetached = YES; -#endif - - constants[@"isDetached"] = @(isDetached); - - if (_unversionedConstants) { - [constants addEntriesFromDictionary:_unversionedConstants]; - } - - if ([constants[@"appOwnership"] isEqualToString:@"expo"]) { - NSMutableDictionary *platform = [constants[@"platform"] mutableCopy]; - NSMutableDictionary *ios = [platform[@"ios"] mutableCopy]; - [ios setValue:[NSNull null] forKey:@"buildNumber"]; - [platform setValue:ios forKey:@"ios"]; - [constants setValue:platform forKey:@"platform"]; - } - - return constants; -} - -- (NSString *)expoClientVersion -{ - NSString *expoClientVersion = _unversionedConstants[@"expoRuntimeVersion"]; - if (expoClientVersion) { - return expoClientVersion; - } else { - // not correct in standalone apps - return [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.h deleted file mode 100644 index bde33397184f43..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import -#import -#import - -@interface ABI46_0_0EXExpoUserNotificationCenterProxy : NSObject - -- (instancetype)initWithUserNotificationCenter:(id)userNotificationCenter; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.m deleted file mode 100644 index fd62795896ce3a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXExpoUserNotificationCenterProxy.m +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright © 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXExpoUserNotificationCenterProxy.h" - -@interface ABI46_0_0EXExpoUserNotificationCenterProxy () - -@property (nonatomic, weak) id userNotificationCenter; - -@end - -@implementation ABI46_0_0EXExpoUserNotificationCenterProxy - -- (instancetype)initWithUserNotificationCenter:(id)userNotificationCenter -{ - if (self = [super init]) { - _userNotificationCenter = userNotificationCenter; - } - return self; -} - -+ (const NSArray *)exportedInterfaces -{ - return @[@protocol(ABI46_0_0EXUserNotificationCenterProxyInterface)]; -} - -- (void)getNotificationSettingsWithCompletionHandler:(void(^)(UNNotificationSettings *settings))completionHandler -{ - [_userNotificationCenter getNotificationSettingsWithCompletionHandler:completionHandler]; -} - -- (void)requestAuthorizationWithOptions:(UNAuthorizationOptions)options completionHandler:(void (^)(BOOL granted, NSError *__nullable error))completionHandler -{ - [_userNotificationCenter requestAuthorizationWithOptions:options completionHandler:completionHandler]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.h deleted file mode 100644 index 9c5c6b1d806d13..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.h +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ABI46_0_0EXBranchScopedModuleDelegate - -- (void)branchModuleDidInit:(id _Nonnull)branchModule; - -@end - -@interface ABI46_0_0EXScopedBranch : ABI46_0_0RNBranch - -@property (nonatomic, strong) NSString *scopeKey; - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.m deleted file mode 100644 index a6390ca9ed5a05..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedBranch.m +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2019-present 650 Industries. All rights reserved. -#if __has_include() -#import "ABI46_0_0EXScopedBranch.h" - -@interface ABI46_0_0EXScopedBranch () - -@property (nonatomic, weak) ABI46_0_0EXModuleRegistry *exModuleRegistry; - -@end - -@protocol ABI46_0_0EXDummyBranchProtocol -@end - -@implementation ABI46_0_0EXScopedBranch - -@synthesize bridge = _bridge; - -+ (const NSArray *)exportedInterfaces -{ - return @[@protocol(ABI46_0_0EXDummyBranchProtocol)]; -} - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - [[NSNotificationCenter defaultCenter] removeObserver:self name:ABI46_0_0RNBranchLinkOpenedNotification object:nil]; - _scopeKey = scopeKey; - } - return self; -} - -- (void)setModuleRegistry:(ABI46_0_0EXModuleRegistry *)exModuleRegistry -{ - _exModuleRegistry = exModuleRegistry; - [(id)[_exModuleRegistry getSingletonModuleForName:@"BranchManager"] branchModuleDidInit:self]; -} - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - _bridge = bridge; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wundeclared-selector" - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onInitSessionFinished:) name:ABI46_0_0RNBranchLinkOpenedNotification object:nil]; -#pragma clang diagnostic pop -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.h deleted file mode 100644 index 280c90353ffc53..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.h +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() -#import - -@interface ABI46_0_0EXScopedErrorRecoveryModule : ABI46_0_0EXErrorRecoveryModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.m deleted file mode 100644 index 5808bee3d7c336..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedErrorRecoveryModule.m +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedErrorRecoveryModule.h" - -@interface ABI46_0_0EXScopedErrorRecoveryModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedErrorRecoveryModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -- (BOOL)setRecoveryProps:(NSString *)props -{ - NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; - NSDictionary *errorRecoveryStore = [preferences dictionaryForKey:[self userDefaultsKey]] ?: @{}; - NSMutableDictionary *newStore = [errorRecoveryStore mutableCopy]; - newStore[_scopeKey] = props; - [preferences setObject:newStore forKey:[self userDefaultsKey]]; - return [preferences synchronize]; -} - -- (NSString *)consumeRecoveryProps -{ - NSUserDefaults *preferences = [NSUserDefaults standardUserDefaults]; - NSDictionary *errorRecoveryStore = [preferences dictionaryForKey:[self userDefaultsKey]]; - if (errorRecoveryStore) { - NSString *props = errorRecoveryStore[_scopeKey]; - if (props) { - NSMutableDictionary *storeWithRemovedProps = [errorRecoveryStore mutableCopy]; - [storeWithRemovedProps removeObjectForKey:_scopeKey]; - [preferences setObject:storeWithRemovedProps forKey:[self userDefaultsKey]]; - [preferences synchronize]; - return props; - } - } - return nil; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.h deleted file mode 100644 index cfefa59f004c38..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2020-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedFirebaseCore : ABI46_0_0EXFirebaseCore - -- (instancetype)initWithScopeKey:(NSString *)scopeKey manifest:(ABI46_0_0EXManifestsManifest *)manifest constantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding; - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.m deleted file mode 100644 index 286f044d2d9faf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFirebaseCore.m +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2020-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedFirebaseCore.h" -#import -#import - -@interface NSObject (Private) -- (NSString*)_methodDescription; -@end - -@implementation ABI46_0_0EXScopedFirebaseCore { - NSDictionary* _protectedAppNames; -} - -- (instancetype)initWithScopeKey:(NSString *)scopeKey manifest:(ABI46_0_0EXManifestsManifest *)manifest constantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding -{ - if (![@"expo" isEqualToString:constantsBinding.appOwnership]) { - return [super init]; - } - - // Setup the protected app names - NSMutableDictionary* protectedAppNames = [NSMutableDictionary dictionaryWithDictionary:@{ - @"__FIRAPP_DEFAULT": @YES, - @"[DEFAULT]": @YES - }]; - _protectedAppNames = protectedAppNames; - - // Make sure the [DEFAULT] app is initialized - NSString *path = [[NSBundle mainBundle] pathForResource:@"GoogleService-Info" ofType:@"plist"]; - if (path && ![FIRApp defaultApp]) { - [FIRApp configure]; - } - if ([FIRApp defaultApp]) [protectedAppNames setValue:@YES forKey:[FIRApp defaultApp].name]; - - // Determine project app name & options - NSString *encodedScopeKey = [self.class encodedResourceName:scopeKey]; - NSString* appName = [NSString stringWithFormat:@"__sandbox_%@", encodedScopeKey]; - NSDictionary* googleServicesFile = [self.class googleServicesFileFromManifest:manifest]; - FIROptions* options = [self.class optionsWithGoogleServicesFile:googleServicesFile]; - - // Delete all previously created (project) apps, except for the currently - // loaded project and the "protected" ones - NSDictionary* apps = [FIRApp allApps]; - NSArray* names = [apps allKeys]; - for (NSString* name in names) { - if (!protectedAppNames[name] && (!options || ![name isEqualToString:appName])) { - [[FIRApp appNamed:name] deleteApp:^(BOOL success) { - if (!success) { - ABI46_0_0EXLogWarn(@"Failed to delete Firebase app: %@", name); - } - }]; - } - } - - // Initialize the sandboxed firebase app - return [super initWithAppName:appName options:options]; -} - -# pragma mark - Overriden methods - -- (BOOL)isAppAccessible:(nonnull NSString *)name -{ - // Deny access to the protected default app on the Expo Go - if (_protectedAppNames && _protectedAppNames[name]) { - return NO; - } - return [super isAppAccessible:name]; -} - - -# pragma mark - Project methods - -+ (NSString *)encodedResourceName:(NSString *)name -{ - NSData *data = [name dataUsingEncoding:NSUTF8StringEncoding]; - NSString *base64 = [data base64EncodedStringWithOptions:kNilOptions]; - return [base64 stringByTrimmingCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"="]]; -} - -+ (nullable NSDictionary *)googleServicesFileFromManifest:(ABI46_0_0EXManifestsManifest *)manifest -{ - // load GoogleService-Info.plist from manifest - @try { - NSString* googleServicesFile = manifest.iosGoogleServicesFile; - if (!googleServicesFile) return nil; - NSData *data = [[NSData alloc] initWithBase64EncodedString:googleServicesFile options:0]; - NSError* error; - NSDictionary* plist = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:nil error:&error]; - if (error) ABI46_0_0EXLogWarn(@"Invalid googleServicesFile: %@", error); - return plist; - } - @catch(NSException* exception) { - ABI46_0_0EXLogWarn(@"Invalid googleServicesFile: %@", exception); - return nil; - } -} - -+ (nullable FIROptions *)optionsWithGoogleServicesFile:(nullable NSDictionary *)plist -{ - if (!plist) return nil; - - FIROptions *firOptions = [[FIROptions alloc] initWithGoogleAppID:plist[@"GOOGLE_APP_ID"] GCMSenderID:plist[@"GCM_SENDER_ID"]]; - - firOptions.APIKey = plist[@"API_KEY"]; - firOptions.bundleID = plist[@"BUNDLE_ID"]; - firOptions.clientID = plist[@"CLIENT_ID"]; - firOptions.trackingID = plist[@"TRACKING_ID"]; - firOptions.projectID = plist[@"PROJECT_ID"]; - firOptions.androidClientID = plist[@"ANDROID_CLIENT_ID"]; - firOptions.databaseURL = plist[@"DATABASE_URL"]; - firOptions.storageBucket = plist[@"STORAGE_BUCKET"]; - - return firOptions; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.h deleted file mode 100644 index 41c14eed3e536d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedFontLoader : ABI46_0_0EXFontLoader - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.m deleted file mode 100644 index c5998d8e0a0d30..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedFontLoader.m +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedFontLoader.h" -#import "ABI46_0_0EXConstantsBinding.h" -#import - -NS_ASSUME_NONNULL_BEGIN - -NSString * const ABI46_0_0EXFontFamilyPrefix = @"ExpoFont-"; - -@implementation ABI46_0_0EXScopedFontLoader - -- (instancetype)init { - return [super initWithFontFamilyPrefix:ABI46_0_0EXFontFamilyPrefix]; -} - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.h deleted file mode 100644 index 4c9b1b53d07397..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedLocalAuthentication : ABI46_0_0EXLocalAuthentication - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.m deleted file mode 100644 index e57b7eab1ffc93..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedLocalAuthentication.m +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import - -#import "ABI46_0_0EXScopedLocalAuthentication.h" -#import "ABI46_0_0EXConstantsBinding.h" - -@interface ABI46_0_0EXScopedLocalAuthentication () - -@property (nonatomic, assign) BOOL isInExpoClient; - -@end - -@implementation ABI46_0_0EXScopedLocalAuthentication - -- (void)setModuleRegistry:(ABI46_0_0EXModuleRegistry *)moduleRegistry -{ - _isInExpoClient = [((ABI46_0_0EXConstantsBinding *)[moduleRegistry getModuleImplementingProtocol:@protocol(ABI46_0_0EXConstantsInterface)]).appOwnership isEqualToString:@"expo"]; -} - -ABI46_0_0EX_EXPORT_METHOD_AS(authenticateAsync, - authenticateWithOptions:(NSDictionary *)options - resolve:(ABI46_0_0EXPromiseResolveBlock)resolve - reject:(ABI46_0_0EXPromiseRejectBlock)reject) -{ - BOOL isInExpoClient = _isInExpoClient; - [super authenticateWithOptions:options resolve:^(NSDictionary *result) { - if (isInExpoClient && [[self class] isFaceIdDevice]) { - NSString *usageDescription = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"NSFaceIDUsageDescription"]; - - if (!usageDescription) { - NSMutableDictionary *scopedResult = [[NSMutableDictionary alloc] initWithDictionary:result]; - scopedResult[@"warning"] = @"Face ID is not available in Expo Go. You can use it in a standalone Expo app by providing `NSFaceIDUsageDescription`."; - resolve(scopedResult); - return; - } - } - resolve(result); - } reject:reject]; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.h deleted file mode 100644 index c77e807d3c3942..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import -#import -#import - -@interface ABI46_0_0EXScopedModuleRegistryAdapter : ABI46_0_0EXModuleRegistryAdapter - -- (ABI46_0_0EXModuleRegistry *)moduleRegistryForParams:(NSDictionary *)params - forExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - manifest:(ABI46_0_0EXManifestsManifest *)manifest - withKernelServices:(NSDictionary *)kernelServices; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.m deleted file mode 100644 index e1f818c3cd0cda..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryAdapter.m +++ /dev/null @@ -1,204 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedModuleRegistry.h" - -#import "ABI46_0_0EXScopedModuleRegistryAdapter.h" -#import "ABI46_0_0EXSensorsManagerBinding.h" -#import "ABI46_0_0EXConstantsBinding.h" -#import "ABI46_0_0EXScopedFileSystemModule.h" -#import "ABI46_0_0EXUnversioned.h" -#import "ABI46_0_0EXScopedFilePermissionModule.h" -#import "ABI46_0_0EXScopedFontLoader.h" -#import "ABI46_0_0EXScopedSecureStore.h" -#import "ABI46_0_0EXScopedPermissions.h" -#import "ABI46_0_0EXScopedSegment.h" -#import "ABI46_0_0EXScopedLocalAuthentication.h" -#import "ABI46_0_0EXScopedBranch.h" -#import "ABI46_0_0EXScopedErrorRecoveryModule.h" -#import "ABI46_0_0EXScopedFacebook.h" -#import "ABI46_0_0EXScopedFirebaseCore.h" -#import "ABI46_0_0EXUpdatesBinding.h" - -#import "ABI46_0_0EXScopedReactNativeAdapter.h" -#import "ABI46_0_0EXExpoUserNotificationCenterProxy.h" - -#import "ABI46_0_0EXScopedNotificationsEmitter.h" -#import "ABI46_0_0EXScopedNotificationsHandlerModule.h" -#import "ABI46_0_0EXScopedNotificationBuilder.h" -#import "ABI46_0_0EXScopedNotificationSchedulerModule.h" -#import "ABI46_0_0EXScopedNotificationPresentationModule.h" -#import "ABI46_0_0EXScopedNotificationCategoriesModule.h" -#import "ABI46_0_0EXScopedServerRegistrationModule.h" - -#if __has_include() -#import -#endif - -@implementation ABI46_0_0EXScopedModuleRegistryAdapter - -- (ABI46_0_0EXModuleRegistry *)moduleRegistryForParams:(NSDictionary *)params - forExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - manifest:(ABI46_0_0EXManifestsManifest *)manifest - withKernelServices:(NSDictionary *)kernelServices -{ - ABI46_0_0EXModuleRegistry *moduleRegistry = [self.moduleRegistryProvider moduleRegistry]; - -#if __has_include() - ABI46_0_0EXUpdatesBinding *updatesBinding = [[ABI46_0_0EXUpdatesBinding alloc] initWithScopeKey:scopeKey - updatesKernelService:kernelServices[@"EXUpdatesManager"] - databaseKernelService:kernelServices[@"EXUpdatesDatabaseManager"]]; - [moduleRegistry registerInternalModule:updatesBinding]; -#endif - -#if __has_include() - ABI46_0_0EXConstantsBinding *constantsBinding = [[ABI46_0_0EXConstantsBinding alloc] initWithParams:params]; - [moduleRegistry registerInternalModule:constantsBinding]; -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedFacebook *scopedFacebook = [[ABI46_0_0EXScopedFacebook alloc] initWithScopeKey:scopeKey manifest:manifest]; - [moduleRegistry registerExportedModule:scopedFacebook]; - } -#endif - -#if __has_include() - ABI46_0_0EXScopedFileSystemModule *fileSystemModule; - if (params[@"fileSystemDirectories"]) { - NSString *documentDirectory = params[@"fileSystemDirectories"][@"documentDirectory"]; - NSString *cachesDirectory = params[@"fileSystemDirectories"][@"cachesDirectory"]; - fileSystemModule = [[ABI46_0_0EXScopedFileSystemModule alloc] initWithDocumentDirectory:documentDirectory - cachesDirectory:cachesDirectory - bundleDirectory:nil]; - } else { - fileSystemModule = [ABI46_0_0EXScopedFileSystemModule new]; - } - [moduleRegistry registerExportedModule:fileSystemModule]; - [moduleRegistry registerInternalModule:fileSystemModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedFontLoader *fontModule = [[ABI46_0_0EXScopedFontLoader alloc] init]; - [moduleRegistry registerExportedModule:fontModule]; -#endif - -#if __has_include() - ABI46_0_0EXSensorsManagerBinding *sensorsManagerBinding = [[ABI46_0_0EXSensorsManagerBinding alloc] initWithScopeKey:scopeKey andKernelService:kernelServices[@"EXSensorManager"]]; - [moduleRegistry registerInternalModule:sensorsManagerBinding]; -#endif - - ABI46_0_0EXScopedReactNativeAdapter *ABI46_0_0ReactNativeAdapter = [[ABI46_0_0EXScopedReactNativeAdapter alloc] init]; - [moduleRegistry registerInternalModule:ABI46_0_0ReactNativeAdapter]; - - ABI46_0_0EXExpoUserNotificationCenterProxy *userNotificationCenter = [[ABI46_0_0EXExpoUserNotificationCenterProxy alloc] initWithUserNotificationCenter:kernelServices[@"EXUserNotificationCenter"]]; - [moduleRegistry registerInternalModule:userNotificationCenter]; - -#if __has_include() - ABI46_0_0EXScopedFilePermissionModule *filePermissionModule = [[ABI46_0_0EXScopedFilePermissionModule alloc] init]; - [moduleRegistry registerInternalModule:filePermissionModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedSecureStore *secureStoreModule = [[ABI46_0_0EXScopedSecureStore alloc] initWithScopeKey:scopeKey andConstantsBinding:constantsBinding]; - [moduleRegistry registerExportedModule:secureStoreModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedPermissions *permissionsModule = [[ABI46_0_0EXScopedPermissions alloc] initWithScopeKey:scopeKey andConstantsBinding:constantsBinding]; - [moduleRegistry registerExportedModule:permissionsModule]; - [moduleRegistry registerInternalModule:permissionsModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedSegment *segmentModule = [[ABI46_0_0EXScopedSegment alloc] init]; - [moduleRegistry registerExportedModule:segmentModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedBranch *branchModule = [[ABI46_0_0EXScopedBranch alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerInternalModule:branchModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedLocalAuthentication *localAuthenticationModule = [[ABI46_0_0EXScopedLocalAuthentication alloc] init]; - [moduleRegistry registerExportedModule:localAuthenticationModule]; -#endif - -#if __has_include() - // TODO: Make scoped task manager when adding support for bare ABI46_0_0React Native - ABI46_0_0EXTaskManager *taskManagerModule = [[ABI46_0_0EXTaskManager alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerInternalModule:taskManagerModule]; - [moduleRegistry registerExportedModule:taskManagerModule]; -#endif - -#if __has_include() - ABI46_0_0EXScopedErrorRecoveryModule *errorRecovery = [[ABI46_0_0EXScopedErrorRecoveryModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:errorRecovery]; -#endif - -#if __has_include() - ABI46_0_0EXScopedFirebaseCore *firebaseCoreModule = [[ABI46_0_0EXScopedFirebaseCore alloc] initWithScopeKey:scopeKey manifest:manifest constantsBinding:constantsBinding]; - [moduleRegistry registerExportedModule:firebaseCoreModule]; - [moduleRegistry registerInternalModule:firebaseCoreModule]; -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedNotificationsEmitter *notificationsEmmitter = [[ABI46_0_0EXScopedNotificationsEmitter alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:notificationsEmmitter]; - } -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedNotificationsHandlerModule *notificationsHandler = [[ABI46_0_0EXScopedNotificationsHandlerModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:notificationsHandler]; - } -#endif - -#if __has_include() - ABI46_0_0EXScopedNotificationBuilder *notificationsBuilder = [[ABI46_0_0EXScopedNotificationBuilder alloc] initWithScopeKey:scopeKey - andConstantsBinding:constantsBinding]; - [moduleRegistry registerInternalModule:notificationsBuilder]; -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedNotificationSchedulerModule *schedulerModule = [[ABI46_0_0EXScopedNotificationSchedulerModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:schedulerModule]; - } -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedNotificationPresentationModule *notificationPresentationModule = [[ABI46_0_0EXScopedNotificationPresentationModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:notificationPresentationModule]; - } -#endif - -#if __has_include() - // only override in Expo Go - if ([params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]) { - ABI46_0_0EXScopedNotificationCategoriesModule *scopedCategoriesModule = [[ABI46_0_0EXScopedNotificationCategoriesModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:scopedCategoriesModule]; - } - [ABI46_0_0EXScopedNotificationCategoriesModule maybeMigrateLegacyCategoryIdentifiersForProjectWithExperienceStableLegacyId:experienceStableLegacyId - scopeKey:scopeKey - isInExpoGo:[params[@"constants"][@"appOwnership"] isEqualToString:@"expo"]]; -#endif - -#if __has_include() - ABI46_0_0EXScopedServerRegistrationModule *serverRegistrationModule = [[ABI46_0_0EXScopedServerRegistrationModule alloc] initWithScopeKey:scopeKey]; - [moduleRegistry registerExportedModule:serverRegistrationModule]; -#endif - - return moduleRegistry; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.h deleted file mode 100644 index b8016b369c0cf7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.h +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import -#import -#import - -@interface ABI46_0_0EXScopedModuleRegistryDelegate : NSObject - -- (instancetype)initWithParams:(NSDictionary *)params; - -- (id)pickInternalModuleImplementingInterface:(Protocol *)interface fromAmongModules:(NSArray> *)internalModules; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.m deleted file mode 100644 index 257aeba0721495..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedModuleRegistryDelegate.m +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedModuleRegistryDelegate.h" - -@implementation ABI46_0_0EXScopedModuleRegistryDelegate - -- (instancetype)initWithParams:(NSDictionary *)params -{ - return self = [super init]; -} - -- (id)pickInternalModuleImplementingInterface:(Protocol *)interface fromAmongModules:(NSArray> *)internalModules -{ - // In ExpoKit we know all the overlapping classes -- the only ones are added - // in ABI46_0_0EXScopedModuleRegistryAdapter at the last moment before conflict resolution, - // so they'll be at the end of the array. - return [internalModules lastObject]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.h deleted file mode 100644 index 7b6560f77a27e3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.h +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import - -@interface ABI46_0_0EXScopedReactNativeAdapter : ABI46_0_0EXReactNativeAdapter - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.m deleted file mode 100644 index 4858ec569be6ef..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedReactNativeAdapter.m +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedReactNativeAdapter.h" -#import "ABI46_0_0EXUnversioned.h" - -@interface ABI46_0_0EXReactNativeAdapter (Protected) - -- (void)startObserving; - -@end - -@implementation ABI46_0_0EXScopedReactNativeAdapter - -- (void)setBridge:(ABI46_0_0RCTBridge *)bridge -{ - if (bridge) { - [super setBridge:bridge]; - [self setAppStateToForeground]; - } -} - -- (void)startObserving -{ - // ABI46_0_0EXAppState and ABI46_0_0EXKernel handle this for us -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.h deleted file mode 100644 index 58930b10906e62..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.h +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import - -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedSecureStore : ABI46_0_0EXSecureStore - -- (instancetype)initWithScopeKey:(NSString *)scopeKey - andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding; - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.m deleted file mode 100644 index fecbafcbf2a4d1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSecureStore.m +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedSecureStore.h" - -@interface ABI46_0_0EXSecureStore (Protected) - -- (NSString *)validatedKey:(NSString *)key; -- (NSData *)_searchKeychainWithKey:(NSString *)key withOptions:(NSDictionary *)options error:(NSError **)error; -- (BOOL)_setValue:(NSString *)value withKey:(NSString *)key withOptions:(NSDictionary *)options error:(NSError **)error; -- (void)_deleteValueWithKey:(NSString *)key withOptions:(NSDictionary *)options; -+ (NSString *) _messageForError:(NSError *)error; - -@end - -@interface ABI46_0_0EXScopedSecureStore () - -@property (strong, nonatomic) NSString *scopeKey; -@property (nonatomic) BOOL isStandaloneApp; - -@end - -@implementation ABI46_0_0EXScopedSecureStore - -- (instancetype)initWithScopeKey:(NSString *)scopeKey - andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _isStandaloneApp = ![@"expo" isEqualToString:constantsBinding.appOwnership]; - } - return self; -} - -- (NSString *)validatedKey:(NSString *)key { - if (![super validatedKey:key]) { - return nil; - } - - return _isStandaloneApp ? key : [NSString stringWithFormat:@"%@-%@", _scopeKey, key]; -} - -// We must override this method so that items saved in standalone apps on SDK 40 and below, -// which were scoped by prefixing the validated key with the scopeKey, can still be -// found in SDK 41 and up. This override can be removed in SDK 45. -- (NSString *)_getValueWithKey:(NSString *)key - withOptions:(NSDictionary *)options - error:(NSError **)error __deprecated_msg("To be removed once SDK 41 is phased out") -{ - NSError *searchError; - NSData *data = [self _searchKeychainWithKey:key - withOptions:options - error:&searchError]; - if (data) { - NSString *value = [[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding]; - return value; - } else if (_isStandaloneApp) { - NSString *scopedKey = [NSString stringWithFormat:@"%@-%@", _scopeKey, key]; - NSString *scopedValue = [self getValueWithScopedKey:scopedKey - withOptions:options]; - if (scopedValue) { - [self migrateValue:scopedValue - fromScopedKey:scopedKey - toNewKey:key - withOptions:options]; - return scopedValue; - } - // If we don't find anything under the scopedKey, we want to return - // the original error from searching for the unscoped key. - } - - *error = searchError; - return nil; -} - -- (NSString *)getValueWithScopedKey:(NSString *)scopedKey withOptions:(NSDictionary *)options -{ - NSError *searchError; - NSData *data = [self _searchKeychainWithKey:scopedKey - withOptions:options - error:&searchError]; - if (data) { - NSString *value = [[NSString alloc] initWithData:data - encoding:NSUTF8StringEncoding]; - return value; - } - return nil; -} - -- (void)migrateValue:(NSString *)value - fromScopedKey:(NSString *)scopedKey - toNewKey:(NSString *)newKey - withOptions:(NSDictionary *)options -{ - // Migrate the value to unscoped storage, then delete the legacy - // value if successful. - NSError *error; - BOOL setValue = [self _setValue:value - withKey:newKey - withOptions:options - error:&error]; - if (setValue) { - [self _deleteValueWithKey:scopedKey - withOptions:options]; - } else { - ABI46_0_0EXLogWarn(@"Encountered an error while saving SecureStore data: %@.", [[super class] _messageForError:error]); - } -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.h deleted file mode 100644 index 853eb56119c7a6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedSegment : ABI46_0_0EXSegment - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.m deleted file mode 100644 index 124b0443ed8314..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXScopedSegment.m +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright © 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedSegment.h" -#import "ABI46_0_0EXConstantsBinding.h" -#import - -@interface ABI46_0_0EXScopedSegment () - -@property (nonatomic, assign) BOOL isInExpoClient; - -@end - -@implementation ABI46_0_0EXScopedSegment - -- (void)setModuleRegistry:(ABI46_0_0EXModuleRegistry *)moduleRegistry -{ - _isInExpoClient = [((ABI46_0_0EXConstantsBinding *)[moduleRegistry getModuleImplementingProtocol:@protocol(ABI46_0_0EXConstantsInterface)]).appOwnership isEqualToString:@"expo"]; -} - -ABI46_0_0EX_EXPORT_METHOD_AS(setEnabledAsync, - setEnabled:(BOOL)enabled - withResolver:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject) -{ - if (_isInExpoClient) { - reject(@"E_UNSUPPORTED", @"Setting Segment's `enabled` is not supported in Expo Go.", nil); - return; - } - - [super setEnabled:enabled withResolver:resolve rejecter:reject]; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.h deleted file mode 100644 index 3614878750410f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.h +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import -#import -#import -#import -#import -#import -#import -#import - -@protocol ABI46_0_0EXSensorsManagerBindingDelegate - -- (void)sensorModuleDidSubscribeForAccelerometerUpdatesOfExperience:(NSString *)scopeKey withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForAccelerometerUpdatesOfExperience:(NSString *)scopeKey; -- (void)setAccelerometerUpdateInterval:(NSTimeInterval)intervalMs; - -- (float)getGravity; -- (void)sensorModuleDidSubscribeForDeviceMotionUpdatesOfExperience:(NSString *)scopeKey withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForDeviceMotionUpdatesOfExperience:(NSString *)scopeKey; -- (void)setDeviceMotionUpdateInterval:(NSTimeInterval)intervalMs; - -- (void)sensorModuleDidSubscribeForGyroscopeUpdatesOfExperience:(NSString *)scopeKey withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForGyroscopeUpdatesOfExperience:(NSString *)scopeKey; -- (void)setGyroscopeUpdateInterval:(NSTimeInterval)intervalMs; - -- (void)sensorModuleDidSubscribeForMagnetometerUpdatesOfExperience:(NSString *)scopeKey withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForMagnetometerUpdatesOfExperience:(NSString *)scopeKey; -- (void)setMagnetometerUpdateInterval:(NSTimeInterval)intervalMs; - -- (void)sensorModuleDidSubscribeForMagnetometerUncalibratedUpdatesOfExperience:(NSString *)scopeKey - withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForMagnetometerUncalibratedUpdatesOfExperience:(NSString *)scopeKey; -- (void)setMagnetometerUncalibratedUpdateInterval:(NSTimeInterval)intervalMs; - -- (void)sensorModuleDidSubscribeForBarometerUpdatesOfExperience:(NSString *)scopeKey withHandler:(void (^)(NSDictionary *event))handlerBlock; -- (void)sensorModuleDidUnsubscribeForBarometerUpdatesOfExperience:(NSString *)scopeKey; -- (void)setBarometerUpdateInterval:(NSTimeInterval)intervalMs; - -- (BOOL)isBarometerAvailable; -- (BOOL)isAccelerometerAvailable; -- (BOOL)isDeviceMotionAvailable; -- (BOOL)isGyroAvailable; -- (BOOL)isMagnetometerAvailable; -- (BOOL)isMagnetometerUncalibratedAvailable; - -@end - -@interface ABI46_0_0EXSensorsManagerBinding : NSObject - -- (instancetype)initWithScopeKey:(NSString *)scopeKey andKernelService:(id)kernelService; - -- (void)sensorModuleDidSubscribeForAccelerometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidSubscribeForDeviceMotionUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidSubscribeForGyroscopeUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidSubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidSubscribeForMagnetometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidSubscribeForBarometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock; -- (void)sensorModuleDidUnsubscribeForAccelerometerUpdates:(id)scopedSensorModule; -- (void)sensorModuleDidUnsubscribeForDeviceMotionUpdates:(id)scopedSensorModule; -- (void)sensorModuleDidUnsubscribeForGyroscopeUpdates:(id)scopedSensorModule; -- (void)sensorModuleDidUnsubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule; -- (void)sensorModuleDidUnsubscribeForMagnetometerUpdates:(id)scopedSensorModule; -- (void)sensorModuleDidUnsubscribeForBarometerUpdates:(id)scopedSensorModule; -- (void)setAccelerometerUpdateInterval:(NSTimeInterval)intervalMs; -- (void)setDeviceMotionUpdateInterval:(NSTimeInterval)intervalMs; -- (void)setGyroscopeUpdateInterval:(NSTimeInterval)intervalMs; -- (void)setMagnetometerUncalibratedUpdateInterval:(NSTimeInterval)intervalMs; -- (void)setMagnetometerUpdateInterval:(NSTimeInterval)intervalMs; -- (void)setBarometerUpdateInterval:(NSTimeInterval)intervalMs; - -- (BOOL)isBarometerAvailable; - -- (BOOL)isAccelerometerAvailable; -- (BOOL)isDeviceMotionAvailable; -- (BOOL)isGyroAvailable; -- (BOOL)isMagnetometerAvailable; -- (BOOL)isMagnetometerUncalibratedAvailable; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.m deleted file mode 100644 index 8d79cb3c22f356..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXSensorsManagerBinding.m +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright © 2018 650 Industries. All rights reserved. - -#import "ABI46_0_0EXSensorsManagerBinding.h" - -@interface ABI46_0_0EXSensorsManagerBinding () - -@property (nonatomic, strong) NSString *scopeKey; -@property (nonatomic, weak) id kernelService; - -@end - -@implementation ABI46_0_0EXSensorsManagerBinding - -- (instancetype)initWithScopeKey:(NSString *)scopeKey andKernelService:(id)kernelService -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _kernelService = kernelService; - } - return self; -} - -- (void)sensorModuleDidSubscribeForAccelerometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForAccelerometerUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidSubscribeForDeviceMotionUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForDeviceMotionUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidSubscribeForGyroscopeUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForGyroscopeUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidSubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForMagnetometerUncalibratedUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidSubscribeForMagnetometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForMagnetometerUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidSubscribeForBarometerUpdates:(id)scopedSensorModule withHandler:(void (^)(NSDictionary *))handlerBlock { - [_kernelService sensorModuleDidSubscribeForBarometerUpdatesOfExperience:_scopeKey withHandler:handlerBlock]; -} - -- (void)sensorModuleDidUnsubscribeForAccelerometerUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForAccelerometerUpdatesOfExperience:_scopeKey]; -} - -- (void)sensorModuleDidUnsubscribeForDeviceMotionUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForDeviceMotionUpdatesOfExperience:_scopeKey]; -} - -- (void)sensorModuleDidUnsubscribeForGyroscopeUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForGyroscopeUpdatesOfExperience:_scopeKey]; -} - -- (void)sensorModuleDidUnsubscribeForMagnetometerUncalibratedUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForMagnetometerUncalibratedUpdatesOfExperience:_scopeKey]; -} - -- (void)sensorModuleDidUnsubscribeForMagnetometerUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForMagnetometerUpdatesOfExperience:_scopeKey]; -} - -- (void)sensorModuleDidUnsubscribeForBarometerUpdates:(id)scopedSensorModule { - [_kernelService sensorModuleDidUnsubscribeForBarometerUpdatesOfExperience:_scopeKey]; -} - -- (void)setAccelerometerUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setAccelerometerUpdateInterval:intervalMs]; -} - -- (BOOL)isAccelerometerAvailable { - return [_kernelService isAccelerometerAvailable]; -} - -- (void)setDeviceMotionUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setDeviceMotionUpdateInterval:intervalMs]; -} - -- (float)getGravity { - return [_kernelService getGravity]; -} - -- (BOOL)isDeviceMotionAvailable { - return [_kernelService isDeviceMotionAvailable]; -} - -- (void)setGyroscopeUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setGyroscopeUpdateInterval:intervalMs]; -} - -- (BOOL)isGyroAvailable { - return [_kernelService isGyroAvailable]; -} - -- (void)setMagnetometerUncalibratedUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setMagnetometerUncalibratedUpdateInterval:intervalMs]; -} - -- (BOOL)isMagnetometerUncalibratedAvailable { - return [_kernelService isMagnetometerUncalibratedAvailable]; -} - -- (void)setMagnetometerUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setMagnetometerUpdateInterval:intervalMs]; -} - -- (BOOL)isMagnetometerAvailable { - return [_kernelService isMagnetometerAvailable]; -} - -- (void)setBarometerUpdateInterval:(NSTimeInterval)intervalMs { - [_kernelService setBarometerUpdateInterval:intervalMs]; -} - -- (BOOL)isBarometerAvailable { - return [_kernelService isBarometerAvailable]; -} - - -+ (const NSArray *)exportedInterfaces { - return @[@protocol(ABI46_0_0EXAccelerometerInterface), @protocol(ABI46_0_0EXBarometerInterface), @protocol(ABI46_0_0EXDeviceMotionInterface), @protocol(ABI46_0_0EXGyroscopeInterface), @protocol(ABI46_0_0EXMagnetometerInterface), @protocol(ABI46_0_0EXMagnetometerUncalibratedInterface)]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.h deleted file mode 100644 index 980686326ef84d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.h +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2020-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import -#import -#import -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol ABI46_0_0EXUpdatesBindingDelegate - -- (ABI46_0_0EXUpdatesConfig *)configForScopeKey:(NSString *)scopeKey; -- (ABI46_0_0EXUpdatesSelectionPolicy *)selectionPolicyForScopeKey:(NSString *)scopeKey; -- (nullable ABI46_0_0EXUpdatesUpdate *)launchedUpdateForScopeKey:(NSString *)scopeKey; -- (nullable NSDictionary *)assetFilesMapForScopeKey:(NSString *)scopeKey; -- (BOOL)isUsingEmbeddedAssetsForScopeKey:(NSString *)scopeKey; -- (BOOL)isStartedForScopeKey:(NSString *)scopeKey; -- (BOOL)isEmergencyLaunchForScopeKey:(NSString *)scopeKey; -- (void)requestRelaunchForScopeKey:(NSString *)scopeKey withCompletion:(ABI46_0_0EXUpdatesAppRelaunchCompletionBlock)completion; - -@end - -@protocol ABI46_0_0EXUpdatesDatabaseBindingDelegate - -@property (nonatomic, strong, readonly) NSURL *updatesDirectory; -@property (nonatomic, strong, readonly) ABI46_0_0EXUpdatesDatabase *database; - -@end - -@interface ABI46_0_0EXUpdatesBinding : ABI46_0_0EXUpdatesService - -- (instancetype)initWithScopeKey:(NSString *)scopeKey updatesKernelService:(id)updatesKernelService databaseKernelService:(id)databaseKernelService; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.m deleted file mode 100644 index b572a3a5ebab8a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/ABI46_0_0EXUpdatesBinding.m +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2020-present 650 Industries. All rights reserved. - -#if __has_include() - -#import "ABI46_0_0EXUpdatesBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXUpdatesBinding () - -@property (nonatomic, strong) NSString *scopeKey; -@property (nonatomic, weak) id updatesKernelService; -@property (nonatomic, weak) id databaseKernelService; - -@end - -@implementation ABI46_0_0EXUpdatesBinding : ABI46_0_0EXUpdatesService - -- (instancetype)initWithScopeKey:(NSString *)scopeKey updatesKernelService:(id)updatesKernelService databaseKernelService:(id)databaseKernelService -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _updatesKernelService = updatesKernelService; - _databaseKernelService = databaseKernelService; - } - return self; -} - -- (ABI46_0_0EXUpdatesConfig *)config -{ - return [_updatesKernelService configForScopeKey:_scopeKey]; -} - -- (ABI46_0_0EXUpdatesDatabase *)database -{ - return _databaseKernelService.database; -} - -- (ABI46_0_0EXUpdatesSelectionPolicy *)selectionPolicy -{ - return [_updatesKernelService selectionPolicyForScopeKey:_scopeKey]; -} - -- (NSURL *)directory -{ - return _databaseKernelService.updatesDirectory; -} - -- (nullable ABI46_0_0EXUpdatesUpdate *)embeddedUpdate -{ - return nil; -} - -- (nullable ABI46_0_0EXUpdatesUpdate *)launchedUpdate -{ - return [_updatesKernelService launchedUpdateForScopeKey:_scopeKey]; -} - -- (nullable NSDictionary *)assetFilesMap -{ - return [_updatesKernelService assetFilesMapForScopeKey:_scopeKey]; -} - -- (BOOL)isUsingEmbeddedAssets -{ - return [_updatesKernelService isUsingEmbeddedAssetsForScopeKey:_scopeKey]; -} - -- (BOOL)isStarted -{ - return [_updatesKernelService isStartedForScopeKey:_scopeKey]; -} - -- (BOOL)isEmergencyLaunch -{ - return [_updatesKernelService isEmergencyLaunchForScopeKey:_scopeKey]; -} - -- (BOOL)canRelaunch -{ - return YES; -} - -- (void)requestRelaunchWithCompletion:(ABI46_0_0EXUpdatesAppRelaunchCompletionBlock)completion -{ - return [_updatesKernelService requestRelaunchForScopeKey:_scopeKey withCompletion:completion]; -} - -- (void)resetSelectionPolicy -{ - // no-op in managed -} - -+ (const NSArray *)exportedInterfaces { - return @[@protocol(ABI46_0_0EXUpdatesModuleInterface)]; -} - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.h deleted file mode 100644 index 116d4ab2019a18..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.h +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import -#import - -@interface ABI46_0_0EXScopedFacebook : ABI46_0_0EXFacebook - -- (instancetype)initWithScopeKey:(NSString *)scopeKey manifest:(ABI46_0_0EXManifestsManifest *)manifest; - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.m deleted file mode 100644 index 7c9a82bed7e31e..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXFacebook/ABI46_0_0EXScopedFacebook.m +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedFacebook.h" -#import -#import -#import - -@interface ABI46_0_0EXFacebook (ExportedMethods) - -- (void)initializeAsync:(NSDictionary *)options - resolver:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject; - -- (void)logInWithReadPermissionsWithConfig:(NSDictionary *)config - resolver:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject; - -- (void)logOutAsync:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject; - -- (void)getAuthenticationCredentialAsync:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject; - -- (void)setAutoInitEnabled:(BOOL)enabled - resolver:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject; - -@end - -static NSString *AUTO_INIT_KEY = @"autoInitEnabled"; - -@interface ABI46_0_0EXScopedFacebook () - -@property (nonatomic, assign) BOOL isInitialized; -@property (nonatomic, strong) NSString *appId; -@property (nonatomic, strong) NSString *displayName; -@property (nonatomic, strong) NSUserDefaults *settings; - -@end - -// Expo Go-only ABI46_0_0EXFacebook module, which ensures that Facebook SDK configurations -// of different projects don't collide. - -@implementation ABI46_0_0EXScopedFacebook : ABI46_0_0EXFacebook - -- (instancetype)initWithScopeKey:(NSString *)scopeKey manifest:(ABI46_0_0EXManifestsManifest *)manifest -{ - if (self = [super init]) { - NSString *suiteName = [NSString stringWithFormat:@"%@#%@", NSStringFromClass(self.class), scopeKey]; - _settings = [[NSUserDefaults alloc] initWithSuiteName:suiteName]; - - BOOL hasPreviouslySetAutoInitEnabled = [_settings boolForKey:AUTO_INIT_KEY]; - BOOL manifestDefinesAutoInitEnabled = manifest.facebookAutoInitEnabled; - - NSString *scopedFacebookAppId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"]; - NSString *manifestFacebookAppId = manifest.facebookAppId; - - if (hasPreviouslySetAutoInitEnabled || manifestDefinesAutoInitEnabled) { - // This happens even before the app foregrounds, which mimics - // the mechanism behind ABI46_0_0EXFacebookAppDelegate. - // Check for FacebookAppId in case this is a custom client build - if (scopedFacebookAppId) { - [FBSDKApplicationDelegate initializeSDK:nil]; - _isInitialized = YES; - if (manifestFacebookAppId) { - ABI46_0_0EXLogInfo(@"Overriding Facebook App ID with Expo Go's. To test your own Facebook App ID, you'll need to build a standalone app. Refer to our documentation for more info- https://docs.expo.io/versions/latest/sdk/facebook/"); - } - } else { - ABI46_0_0EXLogWarn(@"FacebookAutoInit is enabled, but no FacebookAppId has been provided. Facebook SDK initialization aborted."); - } - } - } - return self; -} - -- (void)initializeAsync:(NSDictionary *)options - resolver:(ABI46_0_0EXPromiseResolveBlock)resolve - rejecter:(ABI46_0_0EXPromiseRejectBlock)reject -{ - _isInitialized = YES; - if (options[@"appId"]) { - ABI46_0_0EXLogInfo(@"Overriding Facebook App ID with Expo Go's. To test your own Facebook App ID, you'll need to build a standalone app. Refer to our documentation for more info- https://docs.expo.io/versions/latest/sdk/facebook/"); - } - - NSString *scopedFacebookAppId = [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FacebookAppID"]; - - NSMutableDictionary *nativeOptions = [NSMutableDictionary dictionaryWithDictionary:options]; - // Overwrite the incoming app id with the Expo Facebook SDK app id. - nativeOptions[@"appId"] = scopedFacebookAppId; - - [super initializeAsync:nativeOptions resolver:resolve rejecter:reject]; -} - -- (void)setAutoInitEnabled:(BOOL)enabled resolver:(ABI46_0_0EXPromiseResolveBlock)resolve rejecter:(ABI46_0_0EXPromiseRejectBlock)reject -{ - if (enabled) { - [_settings setBool:enabled forKey:AUTO_INIT_KEY]; - // Facebook SDK on iOS is initialized when `setAutoInitEnabled` is called with `YES`. - _isInitialized = YES; - } - [super setAutoInitEnabled:enabled resolver:resolve rejecter:reject]; -} - -- (void)logInWithReadPermissionsWithConfig:(NSDictionary *)config resolver:(ABI46_0_0EXPromiseResolveBlock)resolve rejecter:(ABI46_0_0EXPromiseRejectBlock)reject -{ - // If the developer didn't initialize the SDK, let them know. - if (!_isInitialized) { - reject(@"ERR_FACEBOOK_UNINITIALIZED", @"Facebook SDK has not been initialized yet.", nil); - return; - } - [super logInWithReadPermissionsWithConfig:config resolver:resolve rejecter:reject]; -} - -- (void)getAuthenticationCredentialAsync:(ABI46_0_0EXPromiseResolveBlock)resolve rejecter:(ABI46_0_0EXPromiseRejectBlock)reject -{ - // If the developer didn't initialize the SDK, let them know. - if (!_isInitialized) { - reject(@"ERR_FACEBOOK_UNINITIALIZED", @"Facebook SDK has not been initialized yet.", nil); - return; - } - [super getAuthenticationCredentialAsync:resolve rejecter:reject]; -} - -- (void)logOutAsync:(ABI46_0_0EXPromiseResolveBlock)resolve rejecter:(ABI46_0_0EXPromiseRejectBlock)reject -{ - // If the developer didn't initialize the SDK, let them know. - if (!_isInitialized) { - reject(@"ERR_FACEBOOK_UNINITIALIZED", @"Facebook SDK has not been initialized yet.", nil); - return; - } - [super logOutAsync:resolve rejecter:reject]; -} - -# pragma mark - ABI46_0_0EXModuleRegistryConsumer - -- (void)setModuleRegistry:(ABI46_0_0EXModuleRegistry *)moduleRegistry -{ - [super setModuleRegistry:moduleRegistry]; - - id appLifecycleService = [moduleRegistry getModuleImplementingProtocol:@protocol(ABI46_0_0EXAppLifecycleService)]; - [appLifecycleService registerAppLifecycleListener:self]; -} - -# pragma mark - ABI46_0_0EXAppLifecycleListener - -- (void)onAppBackgrounded { - // Save SDK settings state - _appId = [FBSDKSettings appID]; - _displayName = [FBSDKSettings displayName]; - [FBSDKSettings setAppID:nil]; - [FBSDKSettings setDisplayName:nil]; -} - -- (void)onAppForegrounded { - // Restore SDK settings state - if (_appId) { - [FBSDKSettings setAppID:_appId]; - } - if (_displayName) { - [FBSDKSettings setDisplayName:_displayName]; - } -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.h deleted file mode 100644 index 511b59915aebf7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.h +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationBuilder : ABI46_0_0EXNotificationBuilder - -- (instancetype)initWithScopeKey:(NSString *)scopeKey - andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.m deleted file mode 100644 index 686984bebbb4b7..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationBuilder.m +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationBuilder.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@interface ABI46_0_0EXScopedNotificationBuilder () - -@property (nonatomic, strong) NSString *scopeKey; -@property (nonatomic, assign) BOOL isInExpoGo; - -@end - -@implementation ABI46_0_0EXScopedNotificationBuilder - -- (instancetype)initWithScopeKey:(NSString *)scopeKey - andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _isInExpoGo = [@"expo" isEqualToString:constantsBinding.appOwnership]; - } - - return self; -} - -- (UNNotificationContent *)notificationContentFromRequest:(NSDictionary *)request -{ - UNMutableNotificationContent *content = [super notificationContentFromRequest:request]; - NSMutableDictionary *userInfo = [content.userInfo mutableCopy]; - if (!userInfo) { - userInfo = [NSMutableDictionary dictionary]; - } - userInfo[@"experienceId"] = _scopeKey; - userInfo[@"scopeKey"] = _scopeKey; - [content setUserInfo:userInfo]; - - if (content.categoryIdentifier && _isInExpoGo) { - NSString *scopedCategoryIdentifier = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:content.categoryIdentifier - forExperience:_scopeKey]; - [content setCategoryIdentifier:scopedCategoryIdentifier]; - } - - return content; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.h deleted file mode 100644 index 817a36eb046f29..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.h +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationCategoriesModule : ABI46_0_0EXNotificationCategoriesModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -+ (void)maybeMigrateLegacyCategoryIdentifiersForProjectWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - isInExpoGo:(BOOL)isInExpoGo; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.m deleted file mode 100644 index a6a24f3832a262..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoriesModule.m +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationCategoriesModule.h" -#import "ABI46_0_0EXScopedNotificationCategoryMigrator.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@interface ABI46_0_0EXScopedNotificationCategoriesModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedNotificationCategoriesModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -- (void)getNotificationCategoriesAsyncWithResolver:(ABI46_0_0EXPromiseResolveBlock)resolve reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - [[UNUserNotificationCenter currentNotificationCenter] getNotificationCategoriesWithCompletionHandler:^(NSSet *categories) { - NSMutableArray* existingCategories = [NSMutableArray new]; - for (UNNotificationCategory *category in categories) { - if ([ABI46_0_0EXScopedNotificationsUtils isId:category.identifier scopedByExperience:self->_scopeKey]) { - [existingCategories addObject:[self serializeCategory:category]]; - } - } - resolve(existingCategories); - }]; -} - -- (void)setNotificationCategoryWithCategoryId:(NSString *)categoryId - actions:(NSArray *)actions - options:(NSDictionary *)options - resolve:(ABI46_0_0EXPromiseResolveBlock)resolve - reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - NSString *scopedCategoryIdentifier = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:categoryId - forExperience:_scopeKey]; - [super setNotificationCategoryWithCategoryId:scopedCategoryIdentifier - actions:actions - options:options - resolve:resolve - reject:reject]; -} - -- (void)deleteNotificationCategoryWithCategoryId:(NSString *)categoryId - resolve:(ABI46_0_0EXPromiseResolveBlock)resolve - reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - NSString *scopedCategoryIdentifier = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:categoryId - forExperience:_scopeKey]; - [super deleteNotificationCategoryWithCategoryId:scopedCategoryIdentifier - resolve:resolve - reject:reject]; -} - -- (NSMutableDictionary *)serializeCategory:(UNNotificationCategory *)category -{ - NSMutableDictionary* serializedCategory = [super serializeCategory:category]; - serializedCategory[@"identifier"] = [ABI46_0_0EXScopedNotificationsUtils getScopeAndIdentifierFromScopedIdentifier:serializedCategory[@"identifier"]].identifier; - - return serializedCategory; -} - -#pragma mark - static method for migrating categories in both Expo Go and standalones. Added in SDK 41. TODO(Cruzan): Remove in SDK 47 - -+ (void)maybeMigrateLegacyCategoryIdentifiersForProjectWithExperienceStableLegacyId:(NSString *)experienceStableLegacyId - scopeKey:(NSString *)scopeKey - isInExpoGo:(BOOL)isInExpoGo __deprecated_msg("To be removed once SDK 43 is phased out") -{ - if (isInExpoGo) { - // Changed scoping prefix in SDK 41 FROM "experienceId-" to ESCAPED "experienceId/" - [ABI46_0_0EXScopedNotificationCategoryMigrator migrateLegacyScopedCategoryIdentifiersForProjectWithScopeKey:scopeKey]; - } else { - // Used to prefix with "experienceId-" even in standalone apps in SDKs <= 40, so we need to unscope those - [ABI46_0_0EXScopedNotificationCategoryMigrator unscopeLegacyCategoryIdentifiersForProjectWithScopeKey:scopeKey]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.h deleted file mode 100644 index 3b6cce81473ab2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.h +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2021-present 650 Industries. All rights reserved. - -#import -#import - -@interface ABI46_0_0EXScopedNotificationCategoryMigrator : NSObject - -+ (void)unscopeLegacyCategoryIdentifiersForProjectWithScopeKey:(NSString *)scopeKey; -+ (void)migrateLegacyScopedCategoryIdentifiersForProjectWithScopeKey:(NSString *)scopeKey; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.m deleted file mode 100644 index 63d9fc33a31643..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationCategoryMigrator.m +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2021-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationCategoryMigrator.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@implementation ABI46_0_0EXScopedNotificationCategoryMigrator - -+ (void)migrateLegacyScopedCategoryIdentifiersForProjectWithScopeKey:(NSString *)scopeKey -{ - [ABI46_0_0EXScopedNotificationCategoryMigrator renameLegacyCategoryIdentifiersForExperienceWithScopeKey:scopeKey withBlock:^(UNNotificationCategory *oldCategory) { - NSString *unscopedLegacyCategoryId = [ABI46_0_0EXScopedNotificationsUtils unscopedLegacyCategoryIdentifierWithId:oldCategory.identifier forScopeKey:scopeKey]; - NSString *newCategoryId = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:unscopedLegacyCategoryId - forExperience:scopeKey]; - UNNotificationCategory *newCategory = [ABI46_0_0EXScopedNotificationCategoryMigrator createNewCategoryFrom:oldCategory withNewIdentifier:newCategoryId]; - return newCategory; - }]; -} - -+ (void)unscopeLegacyCategoryIdentifiersForProjectWithScopeKey:(NSString *)scopeKey -{ - [ABI46_0_0EXScopedNotificationCategoryMigrator renameLegacyCategoryIdentifiersForExperienceWithScopeKey:scopeKey withBlock:^(UNNotificationCategory *oldCategory) { - NSString *unscopedCategoryId = [ABI46_0_0EXScopedNotificationsUtils unscopedLegacyCategoryIdentifierWithId:oldCategory.identifier forScopeKey:scopeKey]; - UNNotificationCategory *newCategory = [ABI46_0_0EXScopedNotificationCategoryMigrator createNewCategoryFrom:oldCategory withNewIdentifier:unscopedCategoryId]; - return newCategory; - }]; -} - -+ (void)renameLegacyCategoryIdentifiersForExperienceWithScopeKey:(NSString *)scopeKey withBlock:(UNNotificationCategory *(^)(UNNotificationCategory *category))renameCategoryBlock -{ - [[UNUserNotificationCenter currentNotificationCenter] getNotificationCategoriesWithCompletionHandler:^(NSSet *categories) { - NSMutableSet *newCategories = [categories mutableCopy]; - BOOL didChangeCategories = NO; - for (UNNotificationCategory *previousCategory in categories) { - if ([ABI46_0_0EXScopedNotificationsUtils isLegacyCategoryId:previousCategory.identifier scopedByScopeKey:scopeKey]) { - UNNotificationCategory *newCategory = renameCategoryBlock(previousCategory); - [newCategories removeObject:previousCategory]; - [newCategories addObject:newCategory]; - didChangeCategories = YES; - } - } - if (didChangeCategories) { - [[UNUserNotificationCenter currentNotificationCenter] setNotificationCategories:newCategories]; - } - }]; -} - -+ (UNNotificationCategory *)createNewCategoryFrom:(UNNotificationCategory *)originalCategory withNewIdentifier:(NSString *)newCategoryId -{ - if (@available(iOS 12, *)) { - return [UNNotificationCategory categoryWithIdentifier:newCategoryId - actions:originalCategory.actions - intentIdentifiers:originalCategory.intentIdentifiers - hiddenPreviewsBodyPlaceholder:originalCategory.hiddenPreviewsBodyPlaceholder - categorySummaryFormat:originalCategory.categorySummaryFormat - options:originalCategory.options]; - } else if (@available(iOS 11, *)) { - return [UNNotificationCategory categoryWithIdentifier:newCategoryId - actions:originalCategory.actions - intentIdentifiers:originalCategory.intentIdentifiers - hiddenPreviewsBodyPlaceholder:originalCategory.hiddenPreviewsBodyPlaceholder - options:originalCategory.options]; - } else { - return [UNNotificationCategory categoryWithIdentifier:newCategoryId - actions:originalCategory.actions - intentIdentifiers:originalCategory.intentIdentifiers - options:originalCategory.options]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.h deleted file mode 100644 index 5a40040af1cafc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationPresentationModule : ABI46_0_0EXNotificationPresentationModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.m deleted file mode 100644 index ac8f0fe70255e1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationPresentationModule.m +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationPresentationModule.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" -#import "ABI46_0_0EXScopedNotificationSerializer.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@interface ABI46_0_0EXScopedNotificationPresentationModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedNotificationPresentationModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - - return self; -} - -- (NSArray * _Nonnull)serializeNotifications:(NSArray * _Nonnull)notifications -{ - NSMutableArray *serializedNotifications = [NSMutableArray new]; - for (UNNotification *notification in notifications) { - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:_scopeKey]) { - [serializedNotifications addObject:[ABI46_0_0EXScopedNotificationSerializer serializedNotification:notification]]; - } - } - return serializedNotifications; -} - -- (void)dismissNotificationWithIdentifier:(NSString *)identifier resolve:(ABI46_0_0EXPromiseResolveBlock)resolve reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - __block NSString *scopeKey = _scopeKey; - [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray * _Nonnull notifications) { - for (UNNotification *notification in notifications) { - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:scopeKey]) { - // Usually we would scope the input ID and then check equality, but remote notifications do not - // have the scoping prefix, so instead let's remove the scope if there is one, then check for - // equality against the input - NSString *unscopedIdentifier = [ABI46_0_0EXScopedNotificationsUtils getScopeAndIdentifierFromScopedIdentifier:notification.request.identifier].identifier; - if ([unscopedIdentifier isEqualToString:identifier]) { - [[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers:@[notification.request.identifier]]; - } - break; - } - } - resolve(nil); - }]; -} - -- (void)dismissAllNotificationsWithResolver:(ABI46_0_0EXPromiseResolveBlock)resolve reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - __block NSString *scopeKey = _scopeKey; - [[UNUserNotificationCenter currentNotificationCenter] getDeliveredNotificationsWithCompletionHandler:^(NSArray * _Nonnull notifications) { - NSMutableArray *toDismiss = [NSMutableArray new]; - for (UNNotification *notification in notifications) { - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:scopeKey]) { - [toDismiss addObject:notification.request.identifier]; - } - } - [[UNUserNotificationCenter currentNotificationCenter] removeDeliveredNotificationsWithIdentifiers:toDismiss]; - resolve(nil); - }]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.h deleted file mode 100644 index 7295835e0bdd7a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationSchedulerModule : ABI46_0_0EXNotificationSchedulerModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.m deleted file mode 100644 index bb71335a20af2f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSchedulerModule.m +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationSchedulerModule.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" -#import "ABI46_0_0EXScopedNotificationSerializer.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@interface ABI46_0_0EXScopedNotificationSchedulerModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedNotificationSchedulerModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - - return self; -} - -- (UNNotificationRequest *)buildNotificationRequestWithIdentifier:(NSString *)identifier - content:(NSDictionary *)contentInput - trigger:(NSDictionary *)triggerInput -{ - NSString *scopedIdentifier = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:identifier - forExperience:_scopeKey]; - return [super buildNotificationRequestWithIdentifier:scopedIdentifier content:contentInput trigger:triggerInput]; -} - -- (NSArray * _Nonnull)serializeNotificationRequests:(NSArray * _Nonnull) requests; -{ - NSMutableArray *serializedRequests = [NSMutableArray new]; - for (UNNotificationRequest *request in requests) { - if ([ABI46_0_0EXScopedNotificationsUtils isId:request.identifier scopedByExperience:_scopeKey]) { - [serializedRequests addObject:[ABI46_0_0EXScopedNotificationSerializer serializedNotificationRequest:request]]; - } - } - return serializedRequests; -} - - -- (void)cancelNotification:(NSString *)identifier resolve:(ABI46_0_0EXPromiseResolveBlock)resolve rejecting:(ABI46_0_0EXPromiseRejectBlock)reject -{ - NSString *scopedIdentifier = [ABI46_0_0EXScopedNotificationsUtils scopedIdentifierFromId:identifier - forExperience:_scopeKey]; - [super cancelNotification:scopedIdentifier resolve:resolve rejecting:reject]; -} - -- (void)cancelAllNotificationsWithResolver:(ABI46_0_0EXPromiseResolveBlock)resolve rejecting:(ABI46_0_0EXPromiseRejectBlock)reject -{ - __block NSString *scopeKey = _scopeKey; - [[UNUserNotificationCenter currentNotificationCenter] getPendingNotificationRequestsWithCompletionHandler:^(NSArray * _Nonnull requests) { - NSMutableArray *toRemove = [NSMutableArray new]; - for (UNNotificationRequest *request in requests) { - if ([ABI46_0_0EXScopedNotificationsUtils isId:request.identifier scopedByExperience:scopeKey]) { - [toRemove addObject:request.identifier]; - } - } - [[UNUserNotificationCenter currentNotificationCenter] removePendingNotificationRequestsWithIdentifiers:toRemove]; - resolve(nil); - }]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.h deleted file mode 100644 index 5cfcf811bcec8d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationSerializer : ABI46_0_0EXNotificationSerializer - -+ (NSDictionary *)serializedNotificationResponse:(UNNotificationResponse *)response; -+ (NSDictionary *)serializedNotification:(UNNotification *)notification; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.m deleted file mode 100644 index c1b5f1b41624c2..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationSerializer.m +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationSerializer.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -NS_ASSUME_NONNULL_BEGIN - -@implementation ABI46_0_0EXScopedNotificationSerializer - -+ (NSDictionary *)serializedNotificationResponse:(UNNotificationResponse *)response -{ - NSDictionary *serializedResponse = [super serializedNotificationResponse:response]; - NSMutableDictionary *serializedResponseMutable = [serializedResponse mutableCopy]; - serializedResponseMutable[@"notification"] = [self serializedNotification:response.notification]; - - return [serializedResponseMutable copy]; -} - -+ (NSDictionary *)serializedNotification:(UNNotification *)notification -{ - NSDictionary *serializedNotification = [super serializedNotification:notification]; - NSMutableDictionary *serializedNotificationMutable = [serializedNotification mutableCopy]; - serializedNotificationMutable[@"request"] = [self serializedNotificationRequest:notification.request]; - - return [serializedNotificationMutable copy]; -} - -+ (NSDictionary *)serializedNotificationContent:(UNNotificationRequest *)request -{ - NSDictionary *serializedContent = [super serializedNotificationContent:request]; - NSMutableDictionary *serializedContentMutable = [serializedContent mutableCopy]; - serializedContentMutable[@"categoryIdentifier"] = request.content.categoryIdentifier ? [ABI46_0_0EXScopedNotificationsUtils getScopeAndIdentifierFromScopedIdentifier:request.content.categoryIdentifier].identifier : [NSNull null]; - - return [serializedContentMutable copy]; -} - -+ (NSDictionary *)serializedNotificationRequest:(UNNotificationRequest *)request -{ - NSDictionary* serializedRequest = [super serializedNotificationRequest:request]; - NSMutableDictionary *serializedRequestMutable = [serializedRequest mutableCopy]; - serializedRequestMutable[@"identifier"] = [ABI46_0_0EXScopedNotificationsUtils getScopeAndIdentifierFromScopedIdentifier:request.identifier].identifier; - - return [serializedRequestMutable copy]; -} - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.h deleted file mode 100644 index 4bdf04ebe25e6a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationsEmitter : ABI46_0_0EXNotificationsEmitter - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.m deleted file mode 100644 index 531503d5794e16..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsEmitter.m +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import "ABI46_0_0EXScopedNotificationsEmitter.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" -#import "ABI46_0_0EXScopedNotificationSerializer.h" - -@interface ABI46_0_0EXScopedNotificationsEmitter () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@interface ABI46_0_0EXNotificationsEmitter (Protected) - -- (NSDictionary *)serializedNotification:(UNNotification *)notification; -- (NSDictionary *)serializedNotificationResponse:(UNNotificationResponse *)notificationResponse; - -@end - -@implementation ABI46_0_0EXScopedNotificationsEmitter - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - - return self; -} - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center didReceiveNotificationResponse:(UNNotificationResponse *)response withCompletionHandler:(void (^)(void))completionHandler -{ - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:response.notification beHandledByExperience:_scopeKey]) { - [super userNotificationCenter:center didReceiveNotificationResponse:response withCompletionHandler:completionHandler]; - } else { - completionHandler(); - } -} - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler -{ - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:_scopeKey]) { - [super userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler]; - } else { - completionHandler(UNNotificationPresentationOptionNone); - } -} - -- (NSDictionary *)serializedNotification:(UNNotification *)notification -{ - return [ABI46_0_0EXScopedNotificationSerializer serializedNotification:notification]; -} - -- (NSDictionary *)serializedNotificationResponse:(UNNotificationResponse *)notificationResponse -{ - return [ABI46_0_0EXScopedNotificationSerializer serializedNotificationResponse:notificationResponse]; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.h deleted file mode 100644 index 217df40d132698..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedNotificationsHandlerModule : ABI46_0_0EXNotificationsHandlerModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.m deleted file mode 100644 index 5f1b89591e5f1d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsHandlerModule.m +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationsHandlerModule.h" -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@interface ABI46_0_0EXScopedNotificationsHandlerModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedNotificationsHandlerModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - - return self; -} - -- (void)userNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(UNNotificationPresentationOptions))completionHandler -{ - if ([ABI46_0_0EXScopedNotificationsUtils shouldNotification:notification beHandledByExperience:_scopeKey]) { - [super userNotificationCenter:center willPresentNotification:notification withCompletionHandler:completionHandler]; - } -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.h deleted file mode 100644 index 18ac9d1f944f3a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.h +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import - -NS_ASSUME_NONNULL_BEGIN - -typedef struct { - NSString *scopeKey; - NSString *identifier; -} ScopedIdentifierComponents; - -@interface ABI46_0_0EXScopedNotificationsUtils : NSObject - -+ (BOOL)shouldNotificationRequest:(UNNotificationRequest *)request beHandledByExperience:(NSString *)scopeKey; - -+ (BOOL)shouldNotification:(UNNotification *)notification beHandledByExperience:(NSString *)scopeKey; - -+ (NSString *)scopedIdentifierFromId:(NSString *)unscopedId forExperience:(NSString *)scopeKey; - -+ (BOOL)isId:(NSString *)identifier scopedByExperience:(NSString *)scopeKey; - -+ (ScopedIdentifierComponents)getScopeAndIdentifierFromScopedIdentifier:(NSString *)scopedIdentifier; - -+ (BOOL)isLegacyCategoryId:(NSString *)scopedCategoryId scopedByScopeKey:(NSString *)scopeKey; - -+ (NSString *)unscopedLegacyCategoryIdentifierWithId:(NSString *)scopedCategoryId - forScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.m deleted file mode 100644 index 8c329b99a4bdb9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedNotificationsUtils.m +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#import "ABI46_0_0EXScopedNotificationsUtils.h" - -@implementation ABI46_0_0EXScopedNotificationsUtils - -+ (BOOL)shouldNotificationRequest:(UNNotificationRequest *)request beHandledByExperience:(NSString *)scopeKey -{ - NSString *notificationScopeKey = request.content.userInfo[@"experienceId"]; - if (!notificationScopeKey) { - return true; - } - return [notificationScopeKey isEqual:scopeKey]; -} - -+ (BOOL)shouldNotification:(UNNotification *)notification beHandledByExperience:(NSString *)scopeKey -{ - return [ABI46_0_0EXScopedNotificationsUtils shouldNotificationRequest:notification.request beHandledByExperience:scopeKey]; -} - -+ (NSString *)scopedIdentifierFromId:(NSString *)unscopedId forExperience:(NSString *)scopeKey -{ - NSString *scope = [ABI46_0_0EXScopedNotificationsUtils escapedString:scopeKey]; - NSString *escapedCategoryId = [ABI46_0_0EXScopedNotificationsUtils escapedString:unscopedId]; - return [NSString stringWithFormat:@"%@/%@", scope, escapedCategoryId]; -} - -+ (BOOL)isId:(NSString *)identifier scopedByExperience:(NSString *)scopeKey -{ - NSString *scopeFromCategoryId = [ABI46_0_0EXScopedNotificationsUtils getScopeAndIdentifierFromScopedIdentifier:identifier].scopeKey; - return [scopeFromCategoryId isEqualToString:scopeKey]; -} - -+ (ScopedIdentifierComponents)getScopeAndIdentifierFromScopedIdentifier:(NSString *)scopedIdentifier -{ - NSString *scope = @""; - NSString *identifier = @""; - NSString *pattern = @"^" - "((?:[^/\\\\]|\\\\[/\\\\])*)" // escaped scope key - "/" // delimiter - "((?:[^/\\\\]|\\\\[/\\\\])*)" // escaped original category identifier - "$"; - NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern - options:0 - error:nil]; - NSTextCheckingResult *match = [regex firstMatchInString:scopedIdentifier - options:0 - range:NSMakeRange(0, scopedIdentifier.length)]; - if (!match) { - // No delimiter found, so no scope associated with this identifier - identifier = scopedIdentifier; - } else { - scope = [scopedIdentifier substringWithRange:[match rangeAtIndex:1]]; - identifier = [scopedIdentifier substringWithRange:[match rangeAtIndex:2]]; - } - ScopedIdentifierComponents components; - components.scopeKey = [ABI46_0_0EXScopedNotificationsUtils unescapedString:scope]; - components.identifier = [ABI46_0_0EXScopedNotificationsUtils unescapedString:identifier]; - return components; -} - -+ (NSString *)escapedString:(NSString*)string -{ - return [[string stringByReplacingOccurrencesOfString:@"\\" withString:@"\\\\"] - stringByReplacingOccurrencesOfString:@"/" withString:@"\\/"]; -} - -+ (NSString *)unescapedString:(NSString*)string -{ - return [[string stringByReplacingOccurrencesOfString:@"\\/" withString:@"/"] - stringByReplacingOccurrencesOfString:@"\\\\" withString:@"\\"]; -} - -# pragma mark Legacy notification category scoping - -+ (BOOL)isLegacyCategoryId:(NSString *)scopedCategoryId scopedByScopeKey:(NSString *)scopeKey -{ - NSString* legacyScopingPrefix = [NSString stringWithFormat:@"%@-", scopeKey]; - return [scopedCategoryId hasPrefix:legacyScopingPrefix]; -} - -// legacy categories were stored under an unescaped experienceId -+ (NSString *)unscopedLegacyCategoryIdentifierWithId:(NSString *)scopedCategoryId - forScopeKey:(NSString *)scopeKey -{ - NSString* legacyScopingPrefix = [NSString stringWithFormat:@"%@-", scopeKey]; - return [scopedCategoryId stringByReplacingOccurrencesOfString:legacyScopingPrefix - withString:@"" - options:NSAnchoredSearch - range:NSMakeRange(0, [scopedCategoryId length])]; -} - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.h deleted file mode 100644 index 83cb43f9d57fc3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.h +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedServerRegistrationModule : ABI46_0_0EXServerRegistrationModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey; - -@end - -NS_ASSUME_NONNULL_END - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.m deleted file mode 100644 index 13fd13abea136f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXNotifications/ABI46_0_0EXScopedServerRegistrationModule.m +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2018-present 650 Industries. All rights reserved. - -#if __has_include() - -#import "ABI46_0_0EXScopedServerRegistrationModule.h" -#import "ABI46_0_0EXUnversioned.h" - -static NSString * const kEXRegistrationInfoKey = @"EXNotificationRegistrationInfoKey"; - -@interface ABI46_0_0EXServerRegistrationModule (Protected) - -- (NSDictionary *)registrationSearchQueryMerging:(NSDictionary *)dictionaryToMerge; -- (NSDictionary *)keychainSearchQueryFor:(NSString *)key merging:(NSDictionary *)dictionaryToMerge; - -@end - -@interface ABI46_0_0EXScopedServerRegistrationModule () - -@property (nonatomic, strong) NSString *scopeKey; - -@end - -@implementation ABI46_0_0EXScopedServerRegistrationModule - -- (instancetype)initWithScopeKey:(NSString *)scopeKey -{ - if (self = [super init]) { - _scopeKey = scopeKey; - } - return self; -} - -- (NSDictionary *)registrationSearchQueryMerging:(NSDictionary *)dictionaryToMerge -{ - NSString *scopedKey = [kEXRegistrationInfoKey stringByAppendingFormat:@"-%@", _scopeKey]; - return [self keychainSearchQueryFor:scopedKey merging:dictionaryToMerge]; -} - -@end - -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.h deleted file mode 100644 index 1b6a4006d67048..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.h +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedFilePermissionModule : ABI46_0_0EXFilePermissionModule - -- (instancetype)initWithConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding; - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.m deleted file mode 100644 index f63b5ee32ddc03..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFilePermissionModule.m +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedFilePermissionModule.h" -#import - -@interface ABI46_0_0EXFilePermissionModule (Protected) - -- (ABI46_0_0EXFileSystemPermissionFlags)getExternalPathPermissions:(NSString *)path; - -@end - -@interface ABI46_0_0EXScopedFilePermissionModule () - -@property (nonatomic, assign) BOOL isDetached; - -@end - -@implementation ABI46_0_0EXScopedFilePermissionModule - -- (instancetype)initWithConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding -{ - if (self = [super init]) { - _isDetached = ![constantsBinding.appOwnership isEqualToString:@"expo"]; - } - return self; -} - -- (ABI46_0_0EXFileSystemPermissionFlags)getExternalPathPermissions:(NSString *)path -{ - // may block access to external paths which contain "ExponentExperienceData" - if (![self shouldForbidAccessToExternalDirectories] || (![path containsString:@"ExponentExperienceData"])) { - return [super getExternalPathPermissions:path]; - } - return ABI46_0_0EXFileSystemPermissionNone; -} - -- (BOOL)shouldForbidAccessToExternalDirectories { - return !_isDetached; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.h deleted file mode 100644 index ede60a15712cb8..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.h +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@interface ABI46_0_0EXScopedFileSystemModule : ABI46_0_0EXFileSystem - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.m deleted file mode 100644 index 504e7adc328f0c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/EXScopedFileSystem/ABI46_0_0EXScopedFileSystemModule.m +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015-present 650 Industries. All rights reserved. - -#if __has_include() -#import "ABI46_0_0EXScopedFileSystemModule.h" -#import "ABI46_0_0EXUtil.h" - -// TODO @sjchmiela: Should this be versioned? It is only used in detached scenario. -NSString * const ABI46_0_0EXShellManifestResourceName = @"shell-app-manifest"; - -@implementation ABI46_0_0EXScopedFileSystemModule - -- (NSDictionary *)constantsToExport -{ - NSMutableDictionary *constants = [[NSMutableDictionary alloc] initWithDictionary:[super constantsToExport]]; - constants[@"bundledAssets"] = [self bundledAssets] ?: [NSNull null]; - return constants; -} - -- (NSArray *)bundledAssets -{ - static NSArray *bundledAssets = nil; - static dispatch_once_t once; - dispatch_once(&once, ^{ - NSString *manifestBundlePath = [[NSBundle mainBundle] pathForResource:ABI46_0_0EXShellManifestResourceName ofType:@"json"]; - NSData *data = [NSData dataWithContentsOfFile:manifestBundlePath]; - if (data.length == 0) { - return; - } - __block NSError *error; - id manifest = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error]; - if (error) { - ABI46_0_0EXLogError(@"Error parsing bundled manifest: %@", error); - return; - } - bundledAssets = manifest[@"bundledAssets"]; - }); - return bundledAssets; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.h b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.h deleted file mode 100644 index e7f64bb0b25270..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2019-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import -#import "ABI46_0_0EXConstantsBinding.h" - -NS_ASSUME_NONNULL_BEGIN - -@protocol ABI46_0_0EXPermissionsScopedModuleDelegate - -- (ABI46_0_0EXPermissionStatus)getPermission:(NSString *)permissionType forExperience:(NSString *)scopeKey; -- (BOOL)savePermission:(NSDictionary *)permission ofType:(NSString *)type forExperience:(NSString *)scopeKey; - -@end - -@interface ABI46_0_0EXScopedPermissions : ABI46_0_0EXPermissionsService - -- (instancetype)initWithScopeKey:(NSString *)scopeKey andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding; - -@end - -NS_ASSUME_NONNULL_END -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.m b/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.m deleted file mode 100644 index ec35518c512c67..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/Expo/ExpoKit/Core/UniversalModules/Permissions/ABI46_0_0EXScopedPermissions.m +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2016-present 650 Industries. All rights reserved. - -#if __has_include() -#import -#import - -#import "ABI46_0_0EXScopedPermissions.h" - -@interface ABI46_0_0EXScopedPermissions () - -@property (nonatomic, strong) NSString *scopeKey; -@property (nonatomic, weak) id permissionsService; -@property (nonatomic, weak) id utils; -@property (nonatomic, weak) ABI46_0_0EXConstantsBinding *constantsBinding; - -@end - -@implementation ABI46_0_0EXScopedPermissions - -- (instancetype)initWithScopeKey:(NSString *)scopeKey andConstantsBinding:(ABI46_0_0EXConstantsBinding *)constantsBinding -{ - if (self = [super init]) { - _scopeKey = scopeKey; - _constantsBinding = constantsBinding; - } - return self; -} - -- (void)setModuleRegistry:(ABI46_0_0EXModuleRegistry *)moduleRegistry -{ - [super setModuleRegistry:moduleRegistry]; - _utils = [moduleRegistry getModuleImplementingProtocol:@protocol(ABI46_0_0EXUtilitiesInterface)]; - _permissionsService = [moduleRegistry getSingletonModuleForName:@"Permissions"]; -} - -# pragma mark - permission requesters / getters - -// overriding ABI46_0_0EXPermission to inject scoped permission logic -- (NSDictionary *)getPermissionUsingRequesterClass:(Class)requesterClass -{ - NSDictionary *globalPermission = [super getPermissionUsingRequesterClass:requesterClass]; - return [self getScopedPermissionForType:[requesterClass permissionType] withGlobalPermission:globalPermission]; -} - -- (NSString *)getScopedPermissionStatus:(NSString *)permissionType { - if (!_permissionsService) { - return [[self class] permissionStringForStatus:ABI46_0_0EXPermissionStatusGranted]; - } - - return [[self class] permissionStringForStatus:[_permissionsService getPermission:permissionType forExperience:_scopeKey]]; -} - -- (BOOL)hasGrantedScopedPermission:(NSString *)permissionType -{ - if (!_permissionsService || ![self shouldVerifyScopedPermission:permissionType]) { - return YES; - } - - return [_permissionsService getPermission:permissionType forExperience:_scopeKey] == ABI46_0_0EXPermissionStatusGranted; -} - -- (void)askForPermissionUsingRequesterClass:(Class)requesterClass - resolve:(ABI46_0_0EXPromiseResolveBlock)resolve - reject:(ABI46_0_0EXPromiseRejectBlock)reject -{ - NSDictionary *globalPermissions = [super getPermissionUsingRequesterClass:requesterClass]; - NSString *permissionType = [requesterClass permissionType]; - ABI46_0_0EX_WEAKIFY(self) - if (![globalPermissions[@"status"] isEqualToString:@"granted"]) { - // first group - // ask for permission. If granted then save it as scope permission - void (^customOnResults)(NSDictionary *) = ^(NSDictionary *permission){ - ABI46_0_0EX_ENSURE_STRONGIFY(self) - // if permission should be scoped save it - if ([self shouldVerifyScopedPermission:permissionType]) { - [self.permissionsService savePermission:permission ofType:permissionType forExperience:self.scopeKey]; - } - resolve(permission); - }; - - return [self askForGlobalPermissionUsingRequesterClass:requesterClass withResolver:customOnResults withRejecter:reject]; - } else if ([_constantsBinding.appOwnership isEqualToString:@"expo"] && - ![self hasGrantedScopedPermission:permissionType]) { - // second group - // had to reinitilize UIAlertActions between alertShow invocations - UIAlertAction *allowAction = [UIAlertAction actionWithTitle:@"Allow" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - ABI46_0_0EX_ENSURE_STRONGIFY(self); - NSMutableDictionary *permission = [globalPermissions mutableCopy]; - // try to save scoped permissions - if fails than permission is denied - if (![self.permissionsService savePermission:permission ofType:permissionType forExperience:self.scopeKey]) { - permission[@"status"] = [[self class] permissionStringForStatus:ABI46_0_0EXPermissionStatusDenied]; - permission[@"granted"] = @(NO); - } - resolve(permission); - }]; - - UIAlertAction *denyAction = [UIAlertAction actionWithTitle:@"Deny" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) { - ABI46_0_0EX_ENSURE_STRONGIFY(self); - NSMutableDictionary *permission = [globalPermissions mutableCopy]; - permission[@"status"] = [[self class] permissionStringForStatus:ABI46_0_0EXPermissionStatusDenied]; - permission[@"granted"] = @(NO); - resolve([NSDictionary dictionaryWithDictionary:permission]); - }]; - - return [self showPermissionRequestAlert:permissionType withAllowAction:allowAction withDenyAction:denyAction]; - } - - resolve(globalPermissions); // third group -} - -# pragma mark - helpers - -- (NSDictionary *)getScopedPermissionForType:(NSString *)permissionType withGlobalPermission:(NSDictionary *)globalPermission -{ - if (!globalPermission) { - return nil; - } - NSMutableDictionary *permission = [NSMutableDictionary dictionaryWithDictionary:globalPermission]; - - if ([_constantsBinding.appOwnership isEqualToString:@"expo"] - && [self shouldVerifyScopedPermission:permissionType] - && [ABI46_0_0EXPermissionsService statusForPermission:permission] == ABI46_0_0EXPermissionStatusGranted) { - permission[@"status"] = [self getScopedPermissionStatus:permissionType]; - permission[@"granted"] = [permission[@"status"] isEqual:@"granted"] ? @YES : @NO; - } - return permission; -} - -- (void)showPermissionRequestAlert:(NSString *)permissionType - withAllowAction:(UIAlertAction *)allow - withDenyAction:(UIAlertAction *)deny -{ - NSString *experienceName = self.scopeKey; // TODO: we might want to use name from the manifest? - NSString *messageTemplate = @"%1$@ needs permissions for %2$@. You\'ve already granted permission to another Expo experience. Allow %1$@ to also use it?"; - NSString *permissionString = [[self class] textForPermissionType:permissionType]; - - NSString *message = [NSString stringWithFormat:messageTemplate, experienceName, permissionString]; - UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Experience needs permissions" - message:message - preferredStyle:UIAlertControllerStyleAlert]; - [alert addAction:deny]; - [alert addAction:allow]; - - ABI46_0_0EX_WEAKIFY(self); - [ABI46_0_0EXUtilities performSynchronouslyOnMainThread:^{ - ABI46_0_0EX_ENSURE_STRONGIFY(self); - // TODO: below line is sometimes failing with: "Presenting view controllers on detached view controllers is discourage" - [self->_utils.currentViewController presentViewController:alert animated:YES completion:nil]; - }]; -} - -+ (NSString *)textForPermissionType:(NSString *)type -{ - if ([type isEqualToString:@"audioRecording"]) { - return @"recording audio"; - } else if ([type isEqualToString:@"cameraRoll"]) { - return @"photos"; - } - - return type; -} - -- (BOOL)shouldVerifyScopedPermission:(NSString *)permissionType -{ - // temporarily exclude notifactions from permissions per experience; system brightness is always granted - return ![@[@"notifications", @"userFacingNotifications", @"systemBrightness"] containsObject:permissionType]; -} - -@end -#endif diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React-Core.podspec b/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React-Core.podspec deleted file mode 100644 index b5f3743197f48c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React-Core.podspec +++ /dev/null @@ -1,89 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -version = package['version'] - - - -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2021.07.22.00' -boost_compiler_flags = '-Wno-documentation' - -header_subspecs = { - 'CoreModulesHeaders' => 'React/CoreModules/**/*.h', - 'RCTActionSheetHeaders' => 'Libraries/ActionSheetIOS/*.h', - 'RCTAnimationHeaders' => 'Libraries/NativeAnimation/{Drivers/*,Nodes/*,*}.{h}', - 'RCTBlobHeaders' => 'Libraries/Blob/{ABI46_0_0RCTBlobManager,ABI46_0_0RCTFileReaderModule}.h', - 'RCTImageHeaders' => 'Libraries/Image/*.h', - 'RCTLinkingHeaders' => 'Libraries/LinkingIOS/*.h', - 'RCTNetworkHeaders' => 'Libraries/Network/*.h', - 'RCTPushNotificationHeaders' => 'Libraries/PushNotificationIOS/*.h', - 'RCTSettingsHeaders' => 'Libraries/Settings/*.h', - 'RCTTextHeaders' => 'Libraries/Text/**/*.h', - 'RCTVibrationHeaders' => 'Libraries/Vibration/*.h', -} - -Pod::Spec.new do |s| - s.name = "ABI46_0_0React-Core" - s.version = version - s.summary = "The core of React Native." - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "12.4" } - s.source = { :path => "." } - s.resource_bundle = { "ABI46_0_0AccessibilityResources" => ["React/AccessibilityResources/*.lproj"]} - s.compiler_flags = folly_compiler_flags + ' ' + boost_compiler_flags - s.header_dir = "ABI46_0_0React" - s.framework = "JavaScriptCore" - s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_TARGET_SRCROOT)/ReactCommon\" \"$(PODS_ROOT)/boost\" \"$(PODS_ROOT)/DoubleConversion\" \"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-hermes\" \"${PODS_ROOT}/Headers/Public/hermes-engine\" \"${PODS_ROOT}/Headers/Public/FlipperKit\" \"$(PODS_ROOT)/Headers/Public/ReactCommon\" \"$(PODS_ROOT)/Headers/Public/React-RCTFabric\"", "DEFINES_MODULE" => "YES" } - s.user_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/Headers/Private/ABI46_0_0React-Core\""} - s.default_subspec = "Default" - - s.subspec "Default" do |ss| - ss.source_files = "React/**/*.{c,h,m,mm,S,cpp}" - ss.exclude_files = "React/CoreModules/**/*", - "React/DevSupport/**/*", - "React/Fabric/**/*", - "React/FBReactNativeSpec/**/*", - "React/Tests/**/*", - "React/Inspector/**/*" - ss.private_header_files = "React/Cxx*/*.h" - end - - s.subspec "DevSupport" do |ss| - ss.source_files = "React/DevSupport/*.{h,mm,m}", - "React/Inspector/*.{h,mm,m}" - - ss.dependency "ABI46_0_0React-Core/Default", version - ss.dependency "ABI46_0_0React-Core/RCTWebSocket", version - ss.dependency "ABI46_0_0React-jsinspector", version - end - - s.subspec "RCTWebSocket" do |ss| - ss.source_files = "Libraries/WebSocket/*.{h,m}" - ss.dependency "ABI46_0_0React-Core/Default", version - end - - # Add a subspec containing just the headers for each - # pod that should live under - header_subspecs.each do |name, headers| - s.subspec name do |ss| - ss.source_files = headers - ss.dependency "ABI46_0_0React-Core/Default" - end - end - - s.dependency "RCT-Folly", folly_version - s.dependency "ABI46_0_0React-cxxreact", version - s.dependency "ABI46_0_0React-perflogger", version - s.dependency "ABI46_0_0React-jsi", version - s.dependency "ABI46_0_0React-jsiexecutor", version - s.dependency "ABI46_0_0Yoga" - s.dependency "glog" -end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React.podspec b/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React.podspec deleted file mode 100644 index 46f0521cb1601b..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/ABI46_0_0React.podspec +++ /dev/null @@ -1,56 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "package.json"))) -version = package['version'] - -source = { :git => 'https://github.com/facebook/ABI46_0_0react-native.git' } -if version == '1000.0.0' - # This is an unpublished version, use the latest commit hash of the ABI46_0_0react-native repo, which we’re presumably in. - source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1") -else - source[:tag] = "v#{version}" -end - -Pod::Spec.new do |s| - s.name = "ABI46_0_0React" - s.version = version - s.summary = package["description"] - s.description = <<-DESC - React Native apps are built using the React JS - framework, and render directly to native UIKit - elements using a fully asynchronous architecture. - There is no browser and no HTML. We have picked what - we think is the best set of features from these and - other technologies to build what we hope to become - the best product development framework available, - with an emphasis on iteration speed, developer - delight, continuity of technology, and absolutely - beautiful and fast products with no compromises in - quality or capability. - DESC - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "12.4" } - s.source = { :path => "." } - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.cocoapods_version = ">= 1.10.1" - - s.dependency "ABI46_0_0React-Core", version - s.dependency "ABI46_0_0React-Core/DevSupport", version - s.dependency "ABI46_0_0React-Core/RCTWebSocket", version - s.dependency "ABI46_0_0React-RCTActionSheet", version - s.dependency "ABI46_0_0React-RCTAnimation", version - s.dependency "ABI46_0_0React-RCTBlob", version - s.dependency "ABI46_0_0React-RCTImage", version - s.dependency "ABI46_0_0React-RCTLinking", version - s.dependency "ABI46_0_0React-RCTNetwork", version - s.dependency "ABI46_0_0React-RCTSettings", version - s.dependency "ABI46_0_0React-RCTText", version - s.dependency "ABI46_0_0React-RCTVibration", version -end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/.npmignore b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/.npmignore deleted file mode 100644 index c912533dd7d2dd..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/.npmignore +++ /dev/null @@ -1 +0,0 @@ -__tests__ diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/ActionSheetIOS/ABI46_0_0React-RCTActionSheet.podspec b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/ActionSheetIOS/ABI46_0_0React-RCTActionSheet.podspec deleted file mode 100644 index dd0af7deb3fc38..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/ActionSheetIOS/ABI46_0_0React-RCTActionSheet.podspec +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - - - -Pod::Spec.new do |s| - s.name = "ABI46_0_0React-RCTActionSheet" - s.version = version - s.summary = "An API for displaying iOS action sheets and share sheets." - s.homepage = "https://reactnative.dev/" - s.documentation_url = "https://reactnative.dev/docs/actionsheetios" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "12.4" } - s.source = { :path => "." } - s.source_files = "*.{m}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "ABI46_0_0RCTActionSheet" - - s.dependency "ABI46_0_0React-Core/RCTActionSheetHeaders", version -end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.h b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.h deleted file mode 100644 index 6459aa6d8b7846..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -using namespace ABI46_0_0facebook; - -@class ABI46_0_0RCTBlobManager; - -namespace ABI46_0_0facebook { -namespace ABI46_0_0React { - -class JSI_EXPORT ABI46_0_0RCTBlobCollector : public jsi::HostObject { - public: - ABI46_0_0RCTBlobCollector(ABI46_0_0RCTBlobManager *blobManager, const std::string &blobId); - ~ABI46_0_0RCTBlobCollector(); - - static void install(ABI46_0_0RCTBlobManager *blobManager); - - private: - const std::string blobId_; - ABI46_0_0RCTBlobManager *blobManager_; -}; - -} // namespace ABI46_0_0React -} // namespace ABI46_0_0facebook diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.mm b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.mm deleted file mode 100644 index 086ff58ff220a6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobCollector.mm +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import "ABI46_0_0RCTBlobCollector.h" - -#import -#import - -namespace ABI46_0_0facebook { -namespace ABI46_0_0React { - -ABI46_0_0RCTBlobCollector::ABI46_0_0RCTBlobCollector(ABI46_0_0RCTBlobManager *blobManager, const std::string &blobId) -: blobId_(blobId), blobManager_(blobManager) {} - -ABI46_0_0RCTBlobCollector::~ABI46_0_0RCTBlobCollector() { - ABI46_0_0RCTBlobManager *blobManager = blobManager_; - NSString *blobId = [NSString stringWithUTF8String:blobId_.c_str()]; - dispatch_async([blobManager_ methodQueue], ^{ - [blobManager remove:blobId]; - }); -} - -void ABI46_0_0RCTBlobCollector::install(ABI46_0_0RCTBlobManager *blobManager) { - __weak ABI46_0_0RCTCxxBridge *cxxBridge = (ABI46_0_0RCTCxxBridge *)blobManager.bridge; - [cxxBridge dispatchBlock:^{ - if (!cxxBridge || cxxBridge.runtime == nullptr) { - return; - } - jsi::Runtime &runtime = *(jsi::Runtime *)cxxBridge.runtime; - runtime.global().setProperty( - runtime, - "__blobCollectorProvider", - jsi::Function::createFromHostFunction( - runtime, - jsi::PropNameID::forAscii(runtime, "__blobCollectorProvider"), - 1, - [blobManager](jsi::Runtime& rt, const jsi::Value& thisVal, const jsi::Value* args, size_t count) { - auto blobId = args[0].asString(rt).utf8(rt); - auto blobCollector = std::make_shared(blobManager, blobId); - return jsi::Object::createFromHostObject(rt, blobCollector); - } - ) - ); - } queue:ABI46_0_0RCTJSThread]; -} - -} // namespace ABI46_0_0React -} // namespace ABI46_0_0facebook diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.h b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.h deleted file mode 100755 index b08479731f2d1a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.h +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import -#import -#import -#import - -@interface ABI46_0_0RCTBlobManager : NSObject - -- (NSString *)store:(NSData *)data; - -- (void)store:(NSData *)data withId:(NSString *)blobId; - -- (NSData *)resolve:(NSDictionary *)blob; - -- (NSData *)resolve:(NSString *)blobId offset:(NSInteger)offset size:(NSInteger)size; - -- (NSData *)resolveURL:(NSURL *)url; - -- (void)remove:(NSString *)blobId; - -- (void)createFromParts:(NSArray *> *)parts withId:(NSString *)blobId; - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.mm b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.mm deleted file mode 100755 index 98f454fa7cedd5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobManager.mm +++ /dev/null @@ -1,320 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -#import - -#import -#import -#import -#import -#import - -#import "ABI46_0_0RCTBlobPlugins.h" -#import "ABI46_0_0RCTBlobCollector.h" - -static NSString *const kBlobURIScheme = @"blob"; - -@interface ABI46_0_0RCTBlobManager () - -@end - -@implementation ABI46_0_0RCTBlobManager -{ - // Blobs should be thread safe since they are used from the websocket and networking module, - // make sure to use proper locking when accessing this. - NSMutableDictionary *_blobs; - std::mutex _blobsMutex; - - NSOperationQueue *_queue; -} - -ABI46_0_0RCT_EXPORT_MODULE(BlobModule) - -@synthesize bridge = _bridge; -@synthesize moduleRegistry = _moduleRegistry; -@synthesize methodQueue = _methodQueue; - -- (void)initialize -{ - std::lock_guard lock(_blobsMutex); - _blobs = [NSMutableDictionary new]; - - ABI46_0_0facebook::ABI46_0_0React::ABI46_0_0RCTBlobCollector::install(self); -} - -+ (BOOL)requiresMainQueueSetup -{ - return NO; -} - -- (NSDictionary *)constantsToExport -{ - return [self getConstants]; -} - -- (NSDictionary *)getConstants -{ - return @{ - @"BLOB_URI_SCHEME": kBlobURIScheme, - @"BLOB_URI_HOST": [NSNull null], - }; -} - -- (NSString *)store:(NSData *)data -{ - NSString *blobId = [NSUUID UUID].UUIDString; - [self store:data withId:blobId]; - return blobId; -} - -- (void)store:(NSData *)data withId:(NSString *)blobId -{ - std::lock_guard lock(_blobsMutex); - _blobs[blobId] = data; -} - -- (NSData *)resolve:(NSDictionary *)blob -{ - NSString *blobId = [ABI46_0_0RCTConvert NSString:blob[@"blobId"]]; - NSNumber *offset = [ABI46_0_0RCTConvert NSNumber:blob[@"offset"]]; - NSNumber *size = [ABI46_0_0RCTConvert NSNumber:blob[@"size"]]; - return [self resolve:blobId - offset:offset ? [offset integerValue] : 0 - size:size ? [size integerValue] : -1]; -} - -- (NSData *)resolve:(NSString *)blobId offset:(NSInteger)offset size:(NSInteger)size -{ - NSData *data; - { - std::lock_guard lock(_blobsMutex); - data = _blobs[blobId]; - } - if (!data) { - return nil; - } - if (offset != 0 || (size != -1 && size != data.length)) { - data = [data subdataWithRange:NSMakeRange(offset, size)]; - } - return data; -} - -- (NSData *)resolveURL:(NSURL *)url -{ - NSURLComponents *components = [[NSURLComponents alloc] initWithURL:url resolvingAgainstBaseURL:NO]; - - NSString *blobId = components.path; - NSInteger offset = 0; - NSInteger size = -1; - - if (components.queryItems) { - for (NSURLQueryItem *queryItem in components.queryItems) { - if ([queryItem.name isEqualToString:@"offset"]) { - offset = [queryItem.value integerValue]; - } - if ([queryItem.name isEqualToString:@"size"]) { - size = [queryItem.value integerValue]; - } - } - } - - if (blobId) { - return [self resolve:blobId offset:offset size:size]; - } - return nil; -} - -- (void)remove:(NSString *)blobId -{ - std::lock_guard lock(_blobsMutex); - [_blobs removeObjectForKey:blobId]; -} - -ABI46_0_0RCT_EXPORT_METHOD(addNetworkingHandler) -{ - ABI46_0_0RCTNetworking *const networking = [_moduleRegistry moduleForName:"Networking"]; - - // TODO(T63516227): Why can methodQueue be nil here? - // We don't want to do anything when methodQueue is nil. - if (!networking.methodQueue) { - return; - } - - dispatch_async(networking.methodQueue, ^{ - [networking addRequestHandler:self]; - [networking addResponseHandler:self]; - }); -} - -ABI46_0_0RCT_EXPORT_METHOD(addWebSocketHandler:(double)socketID) -{ - dispatch_async(((ABI46_0_0RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:self forSocketID:[NSNumber numberWithDouble:socketID]]; - }); -} - -ABI46_0_0RCT_EXPORT_METHOD(removeWebSocketHandler:(double)socketID) -{ - dispatch_async(((ABI46_0_0RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] setContentHandler:nil forSocketID:[NSNumber numberWithDouble:socketID]]; - }); -} - -// @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -ABI46_0_0RCT_EXPORT_METHOD(sendOverSocket:(NSDictionary *)blob socketID:(double)socketID) -{ - dispatch_async(((ABI46_0_0RCTWebSocketModule *)[_moduleRegistry moduleForName:"WebSocketModule"]).methodQueue, ^{ - [[self->_moduleRegistry moduleForName:"WebSocketModule"] sendData:[self resolve:blob] forSocketID:[NSNumber numberWithDouble:socketID]]; - }); -} - -ABI46_0_0RCT_EXPORT_METHOD(createFromParts:(NSArray *> *)parts withId:(NSString *)blobId) -{ - NSMutableData *data = [NSMutableData new]; - for (NSDictionary *part in parts) { - NSString *type = [ABI46_0_0RCTConvert NSString:part[@"type"]]; - - if ([type isEqualToString:@"blob"]) { - NSData *partData = [self resolve:part[@"data"]]; - [data appendData:partData]; - } else if ([type isEqualToString:@"string"]) { - NSData *partData = [[ABI46_0_0RCTConvert NSString:part[@"data"]] dataUsingEncoding:NSUTF8StringEncoding]; - [data appendData:partData]; - } else { - [NSException raise:@"Invalid type for blob" format:@"%@ is invalid", type]; - } - } - [self store:data withId:blobId]; -} - -ABI46_0_0RCT_EXPORT_METHOD(release:(NSString *)blobId) -{ - [self remove:blobId]; -} - -#pragma mark - ABI46_0_0RCTURLRequestHandler methods - -- (BOOL)canHandleRequest:(NSURLRequest *)request -{ - return [request.URL.scheme caseInsensitiveCompare:kBlobURIScheme] == NSOrderedSame; -} - -- (id)sendRequest:(NSURLRequest *)request withDelegate:(id)delegate -{ - // Lazy setup - if (!_queue) { - _queue = [NSOperationQueue new]; - _queue.maxConcurrentOperationCount = 2; - } - - __weak __typeof(self) weakSelf = self; - __weak __block NSBlockOperation *weakOp; - __block NSBlockOperation *op = [NSBlockOperation blockOperationWithBlock:^{ - __typeof(self) strongSelf = weakSelf; - if (!strongSelf) { - return; - } - NSURLResponse *response = [[NSURLResponse alloc] initWithURL:request.URL - MIMEType:nil - expectedContentLength:-1 - textEncodingName:nil]; - - [delegate URLRequest:weakOp didReceiveResponse:response]; - - NSData *data = [strongSelf resolveURL:response.URL]; - NSError *error; - if (data) { - [delegate URLRequest:weakOp didReceiveData:data]; - } else { - error = [[NSError alloc] initWithDomain:NSURLErrorDomain code:NSURLErrorBadURL userInfo:nil]; - } - [delegate URLRequest:weakOp didCompleteWithError:error]; - }]; - - weakOp = op; - [_queue addOperation:op]; - return op; -} - -- (void)cancelRequest:(NSOperation *)op -{ - [op cancel]; -} - -#pragma mark - ABI46_0_0RCTNetworkingRequestHandler methods - -// @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -- (BOOL)canHandleNetworkingRequest:(NSDictionary *)data -{ - return data[@"blob"] != nil; -} - -// @lint-ignore FBOBJCUNTYPEDCOLLECTION1 -- (NSDictionary *)handleNetworkingRequest:(NSDictionary *)data -{ - // @lint-ignore FBOBJCUNTYPEDCOLLECTION1 - NSDictionary *blob = [ABI46_0_0RCTConvert NSDictionary:data[@"blob"]]; - - NSString *contentType = @"application/octet-stream"; - NSString *blobType = [ABI46_0_0RCTConvert NSString:ABI46_0_0RCTNilIfNull(blob[@"type"])]; - if (blobType != nil && blobType.length > 0) { - contentType = blob[@"type"]; - } - - return @{@"body": [self resolve:blob], @"contentType": contentType}; -} - -- (BOOL)canHandleNetworkingResponse:(NSString *)responseType -{ - return [responseType isEqualToString:@"blob"]; -} - -- (id)handleNetworkingResponse:(NSURLResponse *)response data:(NSData *)data -{ - // An empty body will have nil for data, in this case we need to return - // an empty blob as per the XMLHttpRequest spec. - data = data ?: [NSData new]; - return @{ - @"blobId": [self store:data], - @"offset": @0, - @"size": @(data.length), - @"name": ABI46_0_0RCTNullIfNil([response suggestedFilename]), - @"type": ABI46_0_0RCTNullIfNil([response MIMEType]), - }; -} - -#pragma mark - ABI46_0_0RCTWebSocketContentHandler methods - -- (id)processWebsocketMessage:(id)message - forSocketID:(NSNumber *)socketID - withType:(NSString *__autoreleasing _Nonnull *)type -{ - if (![message isKindOfClass:[NSData class]]) { - *type = @"text"; - return message; - } - - *type = @"blob"; - return @{ - @"blobId": [self store:message], - @"offset": @0, - @"size": @(((NSData *)message).length), - }; -} - -- (std::shared_ptr)getTurboModule:(const ABI46_0_0facebook::ABI46_0_0React::ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -Class ABI46_0_0RCTBlobManagerCls(void) { - return ABI46_0_0RCTBlobManager.class; -} diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.h b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.h deleted file mode 100644 index 784f6aeadcc41d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.h +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @generated by an internal plugin build system - */ - -#ifdef ABI46_0_0RN_DISABLE_OSS_PLUGIN_HEADER - -// FB Internal: FBABI46_0_0RCTBlobPlugins.h is autogenerated by the build system. -#import - -#else - -// OSS-compatibility layer - -#import - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wreturn-type-c-linkage" - -#ifdef __cplusplus -extern "C" { -#endif - -// ABI46_0_0RCTTurboModuleManagerDelegate should call this to resolve module classes. -Class ABI46_0_0RCTBlobClassProvider(const char *name); - -// Lookup functions -Class ABI46_0_0RCTFileReaderModuleCls(void) __attribute__((used)); -Class ABI46_0_0RCTBlobManagerCls(void) __attribute__((used)); - -#ifdef __cplusplus -} -#endif - -#pragma GCC diagnostic pop - -#endif // ABI46_0_0RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.mm b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.mm deleted file mode 100644 index 20350f54ba862f..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTBlobPlugins.mm +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @generated by an internal plugin build system - */ - -#ifndef ABI46_0_0RN_DISABLE_OSS_PLUGIN_HEADER - -// OSS-compatibility layer - -#import "ABI46_0_0RCTBlobPlugins.h" - -#import -#import - -Class ABI46_0_0RCTBlobClassProvider(const char *name) { - // Intentionally leak to avoid crashing after static destructors are run. - static const auto sCoreModuleClassMap = new const std::unordered_map{ - {"FileReaderModule", ABI46_0_0RCTFileReaderModuleCls}, - {"BlobModule", ABI46_0_0RCTBlobManagerCls}, - }; - - auto p = sCoreModuleClassMap->find(name); - if (p != sCoreModuleClassMap->end()) { - auto classFunc = p->second; - return classFunc(); - } - return nil; -} - -#endif // ABI46_0_0RN_DISABLE_OSS_PLUGIN_HEADER diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.h b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.h deleted file mode 100644 index 3418ff77cda125..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.h +++ /dev/null @@ -1,12 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - -#import - -@interface ABI46_0_0RCTFileReaderModule : NSObject - -@end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.mm b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.mm deleted file mode 100644 index 000fd4b8116c3d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0RCTFileReaderModule.mm +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - */ - - -#import - -#import -#import -#import - -#import - -#import "ABI46_0_0RCTBlobPlugins.h" - -@interface ABI46_0_0RCTFileReaderModule() -@end - -@implementation ABI46_0_0RCTFileReaderModule - -ABI46_0_0RCT_EXPORT_MODULE(FileReaderModule) - -@synthesize moduleRegistry = _moduleRegistry; - -ABI46_0_0RCT_EXPORT_METHOD(readAsText:(NSDictionary *)blob - encoding:(NSString *)encoding - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - ABI46_0_0RCTBlobManager *blobManager = [_moduleRegistry moduleForName:"BlobModule"]; - dispatch_async(blobManager.methodQueue, ^{ - NSData *data = [blobManager resolve:blob]; - - if (data == nil) { - reject(ABI46_0_0RCTErrorUnspecified, - [NSString stringWithFormat:@"Unable to resolve data for blob: %@", [ABI46_0_0RCTConvert NSString:blob[@"blobId"]]], nil); - } else { - NSStringEncoding stringEncoding; - - if (encoding == nil) { - stringEncoding = NSUTF8StringEncoding; - } else { - stringEncoding = CFStringConvertEncodingToNSStringEncoding(CFStringConvertIANACharSetNameToEncoding((CFStringRef) encoding)); - } - - NSString *text = [[NSString alloc] initWithData:data encoding:stringEncoding]; - - resolve(text); - } - }); -} - -ABI46_0_0RCT_EXPORT_METHOD(readAsDataURL:(NSDictionary *)blob - resolve:(ABI46_0_0RCTPromiseResolveBlock)resolve - reject:(ABI46_0_0RCTPromiseRejectBlock)reject) -{ - ABI46_0_0RCTBlobManager *blobManager = [_moduleRegistry moduleForName:"BlobModule"]; - dispatch_async(blobManager.methodQueue, ^{ - NSData *data = [blobManager resolve:blob]; - - if (data == nil) { - reject(ABI46_0_0RCTErrorUnspecified, - [NSString stringWithFormat:@"Unable to resolve data for blob: %@", [ABI46_0_0RCTConvert NSString:blob[@"blobId"]]], nil); - } else { - NSString *type = [ABI46_0_0RCTConvert NSString:blob[@"type"]]; - NSString *text = [NSString stringWithFormat:@"data:%@;base64,%@", - type != nil && [type length] > 0 ? type : @"application/octet-stream", - [data base64EncodedStringWithOptions:0]]; - - resolve(text); - } - }); -} - -- (std::shared_ptr)getTurboModule:(const ABI46_0_0facebook::ABI46_0_0React::ObjCTurboModule::InitParams &)params -{ - return std::make_shared(params); -} - -@end - -Class ABI46_0_0RCTFileReaderModuleCls(void) -{ - return ABI46_0_0RCTFileReaderModule.class; -} diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0React-RCTBlob.podspec b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0React-RCTBlob.podspec deleted file mode 100644 index 13c05856d5bcbc..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Blob/ABI46_0_0React-RCTBlob.podspec +++ /dev/null @@ -1,43 +0,0 @@ -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -require "json" - -package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json"))) -version = package['version'] - - - -folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' -folly_version = '2021.07.22.00' - -Pod::Spec.new do |s| - s.name = "ABI46_0_0React-RCTBlob" - s.version = version - s.summary = "An API for displaying iOS action sheets and share sheets." - s.homepage = "https://reactnative.dev/" - s.license = package["license"] - s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "12.4" } - s.compiler_flags = folly_compiler_flags + ' -Wno-nullability-completeness' - s.source = { :path => "." } - s.source_files = "*.{h,m,mm}" - s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" - s.header_dir = "ABI46_0_0RCTBlob" - s.pod_target_xcconfig = { - "USE_HEADERMAP" => "YES", - "CLANG_CXX_LANGUAGE_STANDARD" => "c++17", - "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/RCT-Folly\" \"${PODS_ROOT}/Headers/Public/React-Codegen/react/renderer/components\" \"${PODS_CONFIGURATION_BUILD_DIR}/React-Codegen/React_Codegen.framework/Headers\"" - } - - s.dependency "RCT-Folly", folly_version - s.dependency "ABI46_0_0React-Codegen", version - s.dependency "ABI46_0_0ReactCommon/turbomodule/core", version - s.dependency "ABI46_0_0React-jsi", version - s.dependency "ABI46_0_0React-Core/RCTBlobHeaders", version - s.dependency "ABI46_0_0React-Core/RCTWebSocket", version - s.dependency "ABI46_0_0React-RCTNetwork", version - s.dependency "ABI46_0_0React-jsi", version -end diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap deleted file mode 100644 index 4326d7f8ae20f3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ActivityIndicator/__tests__/__snapshots__/ActivityIndicator-test.js.snap +++ /dev/null @@ -1,46 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DatePicker/__tests__/__snapshots__/DatePickerIOS-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DatePicker/__tests__/__snapshots__/DatePickerIOS-test.js.snap deleted file mode 100644 index 55ce6c2067146c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DatePicker/__tests__/__snapshots__/DatePickerIOS-test.js.snap +++ /dev/null @@ -1,99 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`DatePickerIOS should render DatePicker with the datetime mode if no mode is passed inside the props: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[`DatePickerIOS should render DatePicker with the datetime mode if no mode is passed inside the props: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[`DatePickerIOS should render DatePicker with the datetime mode if no mode is passed inside the props: should shallow render as when mocked 1`] = ` - -`; - -exports[`DatePickerIOS should render DatePicker with the datetime mode if no mode is passed inside the props: should shallow render as when not mocked 1`] = ` - -`; - -exports[`DatePickerIOS should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[`DatePickerIOS should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[`DatePickerIOS should render as expected: should shallow render as when mocked 1`] = ` - -`; - -exports[`DatePickerIOS should render as expected: should shallow render as when not mocked 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap deleted file mode 100644 index 19a7303e92abbf..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/DrawerAndroid/__tests__/__snapshots__/DrawerAndroid-test.js.snap +++ /dev/null @@ -1,121 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/MaskedView/__tests__/__snapshots__/MaskedViewIOS-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/MaskedView/__tests__/__snapshots__/MaskedViewIOS-test.js.snap deleted file mode 100644 index 65d8046eb1a11c..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/MaskedView/__tests__/__snapshots__/MaskedViewIOS-test.js.snap +++ /dev/null @@ -1,77 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - - - Basic Mask - - - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - - - Basic Mask - - - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - - - Basic Mask - - - } -> - - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - - - Basic Mask - - - } -> - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Pressable/__tests__/__snapshots__/Pressable-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Pressable/__tests__/__snapshots__/Pressable-test.js.snap deleted file mode 100644 index 821d4f41ea56e5..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Pressable/__tests__/__snapshots__/Pressable-test.js.snap +++ /dev/null @@ -1,331 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true: should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true: should shallow render as when not mocked 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true and accessibilityState is empty: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true and accessibilityState is empty: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true and accessibilityState is empty: should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should be disabled when disabled is true and accessibilityState is empty: should shallow render as when not mocked 1`] = ` - - - -`; - -exports[` should keep accessibilityState when disabled is true: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should keep accessibilityState when disabled is true: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should keep accessibilityState when disabled is true: should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should keep accessibilityState when disabled is true: should shallow render as when not mocked 1`] = ` - - - -`; - -exports[` should overwrite accessibilityState with value of disabled prop: should deep render when mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should overwrite accessibilityState with value of disabled prop: should deep render when not mocked (please verify output manually) 1`] = ` - - - -`; - -exports[` should overwrite accessibilityState with value of disabled prop: should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should overwrite accessibilityState with value of disabled prop: should shallow render as when not mocked 1`] = ` - - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressBarAndroid/__tests__/__snapshots__/ProgressBarAndroid-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressBarAndroid/__tests__/__snapshots__/ProgressBarAndroid-test.js.snap deleted file mode 100644 index f1985dfedb660a..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressBarAndroid/__tests__/__snapshots__/ProgressBarAndroid-test.js.snap +++ /dev/null @@ -1,31 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressViewIOS/__tests__/__snapshots__/ProgressViewIOS-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressViewIOS/__tests__/__snapshots__/ProgressViewIOS-test.js.snap deleted file mode 100644 index b405e6ac316a5d..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ProgressViewIOS/__tests__/__snapshots__/ProgressViewIOS-test.js.snap +++ /dev/null @@ -1,41 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap deleted file mode 100644 index b23f900172c9f6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/SafeAreaView/__tests__/__snapshots__/SafeAreaView-test.js.snap +++ /dev/null @@ -1,45 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - - Hello World! - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - - Hello World! - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - - - - Hello World! - - - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - - - - Hello World! - - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap deleted file mode 100644 index e4723b567bc504..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/ScrollView/__tests__/__snapshots__/ScrollView-test.js.snap +++ /dev/null @@ -1,86 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - - - - - Hello World! - - - - -`; - -exports[` should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - - - - - Hello World! - - - - -`; - -exports[` should render as expected: should shallow render as when mocked 1`] = ` - - - - Hello World! - - - -`; - -exports[` should render as expected: should shallow render as when not mocked 1`] = ` - - - - Hello World! - - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/InputAccessoryView-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/InputAccessoryView-test.js.snap deleted file mode 100644 index d9e53dc1a5bba6..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/InputAccessoryView-test.js.snap +++ /dev/null @@ -1,49 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` should render as when mocked 1`] = ` - - - -`; - -exports[` should render as when not mocked 1`] = ` - - - -`; - -exports[` should shallow render as when mocked 1`] = ` - - - -`; - -exports[` should shallow render as when not mocked 1`] = ` - - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap deleted file mode 100644 index 874fae2b158a92..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/TextInput/__tests__/__snapshots__/TextInput-test.js.snap +++ /dev/null @@ -1,63 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TextInput tests should render as expected: should deep render when mocked (please verify output manually) 1`] = ` - -`; - -exports[`TextInput tests should render as expected: should deep render when not mocked (please verify output manually) 1`] = ` - -`; - -exports[`TextInput tests should render as expected: should shallow render as when mocked 1`] = ``; - -exports[`TextInput tests should render as expected: should shallow render as when not mocked 1`] = ``; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap deleted file mode 100644 index 70eaabe704a1f0..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableHighlight-test.js.snap +++ /dev/null @@ -1,126 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TouchableHighlight renders correctly 1`] = ` - - - Touchable - - -`; - -exports[`TouchableHighlight with disabled state should be disabled when disabled is true 1`] = ` - - - -`; - -exports[`TouchableHighlight with disabled state should be disabled when disabled is true and accessibilityState is empty 1`] = ` - - - -`; - -exports[`TouchableHighlight with disabled state should disable button when accessibilityState is disabled 1`] = ` - - - -`; - -exports[`TouchableHighlight with disabled state should keep accessibilityState when disabled is true 1`] = ` - - - -`; - -exports[`TouchableHighlight with disabled state should overwrite accessibilityState with value of disabled prop 1`] = ` - - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableNativeFeedback-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableNativeFeedback-test.js.snap deleted file mode 100644 index 64b098803b11c3..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableNativeFeedback-test.js.snap +++ /dev/null @@ -1,127 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TouchableWithoutFeedback renders correctly 1`] = ` - - Touchable - -`; - -exports[` should render as expected 1`] = ` - -`; - -exports[` should be disabled when disabled is true 1`] = ` - -`; - -exports[` should be disabled when disabled is true and accessibilityState is empty 1`] = ` - -`; - -exports[` should keep accessibilityState when disabled is true 1`] = ` - -`; - -exports[` should overwrite accessibilityState with value of disabled prop 1`] = ` - -`; - -exports[` should overwrite accessibilityState with value of disabled prop 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableOpacity-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableOpacity-test.js.snap deleted file mode 100644 index 4d3f11bc92ef35..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableOpacity-test.js.snap +++ /dev/null @@ -1,83 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TouchableOpacity renders correctly 1`] = ` - - - Touchable - - -`; - -exports[`TouchableOpacity renders in disabled state when a disabled prop is passed 1`] = ` - - - Touchable - - -`; - -exports[`TouchableOpacity renders in disabled state when a key disabled in accessibilityState is passed 1`] = ` - - - Touchable - - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableWithoutFeedback-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableWithoutFeedback-test.js.snap deleted file mode 100644 index 545e77e54e3bd9..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/Touchable/__tests__/__snapshots__/TouchableWithoutFeedback-test.js.snap +++ /dev/null @@ -1,113 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`TouchableWithoutFeedback renders correctly 1`] = ` - - Touchable - -`; - -exports[`TouchableWithoutFeedback with disabled state should be disabled when disabled is true 1`] = ` - -`; - -exports[`TouchableWithoutFeedback with disabled state should be disabled when disabled is true and accessibilityState is empty 1`] = ` - -`; - -exports[`TouchableWithoutFeedback with disabled state should disable button when accessibilityState is disabled 1`] = ` - -`; - -exports[`TouchableWithoutFeedback with disabled state should keep accessibilityState when disabled is true 1`] = ` - -`; - -exports[`TouchableWithoutFeedback with disabled state should overwrite accessibilityState with value of disabled prop 1`] = ` - -`; diff --git a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/__tests__/__snapshots__/Button-test.js.snap b/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/__tests__/__snapshots__/Button-test.js.snap deleted file mode 100644 index 8f31a7be12dea1..00000000000000 --- a/ios/versioned-react-native/ABI46_0_0/ReactNative/Libraries/Components/__tests__/__snapshots__/Button-test.js.snap +++ /dev/null @@ -1,361 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`