Skip to content

Conversation

@zeyap
Copy link
Contributor

@zeyap zeyap commented Jul 10, 2024

Summary:

Changelog

As a followup to #45139

There I only implemented hostPlatformColorFromRGBA and alpha/red/green/blueFromHostPlatformColor on cxx platform, then used cxx platform specific method at some places. but really I should implement and use methods in Color.h that are platform agnostic

  • cxx/android: platform color format is int32_t, RGBA are 8bit unsigned int ([0,255])
  • windows: platform color format is winrt::Windows::UI::Color where RGBA props are 8bit unsigned ints ([0,255])
  • apple: platform color format is UIColor where RGBA props are floats in [0,1]

[Internal]

Differential Revision: D59593659

Summary:
## Changelog

As a followup to facebook#45139

There I only implemented `hostPlatformColorFromRGBA` and `alpha/red/green/blueFromHostPlatformColor` on cxx platform, then used cxx platform specific method at some places. but really I should implement and use methods in `Color.h` that are platform agnostic

* cxx/android: platform color format is int32_t, RGBA are 8bit unsigned int ([0,255])
* windows: platform color format is `winrt::Windows::UI::Color` where RGBA props are 8bit unsigned ints ([0,255])
* apple: platform color format is `UIColor` where RGBA props are floats in [0,1]

[Internal]

previous change D58872165

Differential Revision: D59593659
@facebook-github-bot facebook-github-bot added CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. p: Facebook Partner: Facebook Partner labels Jul 10, 2024
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D59593659

@analysis-bot
Copy link

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 21,234,713 -15
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 24,431,907 -15
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: 0fd4a94
Branch: main

@facebook-github-bot facebook-github-bot added the Merged This PR has been merged. label Jul 15, 2024
@facebook-github-bot
Copy link
Contributor

This pull request has been merged in 97882a1.

@github-actions
Copy link

This pull request was successfully merged by @zeyap in 97882a1

When will my fix make it into a release? | How to file a pick request?

zeyap added a commit to zeyap/react-native that referenced this pull request Jul 16, 2024
Summary:
## Changelog

the new functions I introduced in facebook#45365 to read color channel value, like `alphaFromColor`, will return float between 0~255 on iOS and 8bit unsigned ints on other platforms, because of different platform implementation. However that way we cannot assume consistent return value across platforms, which kind of contradicts with RN's cross platform design.

so here I make `alphaFromColor` in Color.h (the cross platform method) to always return uint8_t, while still allow `alphaFromHostPlatformColor` to return different result

Differential Revision: D59826142
facebook-github-bot pushed a commit that referenced this pull request Jul 16, 2024
Summary:
Pull Request resolved: #45485

## Changelog:

the new functions I introduced in #45365 to read color channel value, like `alphaFromColor`, will return float between 0~255 on iOS and 8bit unsigned ints on other platforms, because of different platform implementation. However that way we cannot assume consistent return value across platforms, which kind of contradicts with RN's cross platform design.

so here I make `alphaFromColor` in Color.h (the cross platform method) to always return uint8_t, while still allow `alphaFromHostPlatformColor` to return different result

[Internal] [Fixed] -

Reviewed By: christophpurrer

Differential Revision: D59826142

fbshipit-source-id: 4401918be29980474bdc8601443ae33155710f22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported Merged This PR has been merged. p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants