Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move isColorMeaningful to platform specific code #31557

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions ReactCommon/react/renderer/components/view/ViewShadowNode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,6 @@ ViewShadowNode::ViewShadowNode(
initialize();
}

static bool isColorMeaningful(SharedColor const &color) noexcept {
if (!color) {
return false;
}

return colorComponentsFromColor(color).alpha > 0;
}

void ViewShadowNode::initialize() noexcept {
auto &viewProps = static_cast<ViewProps const &>(*props_);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@
namespace facebook {
namespace react {

bool isColorMeaningful(SharedColor const &color) noexcept {
if (!color) {
return false;
}

return colorComponentsFromColor(color).alpha > 0;
}

SharedColor colorFromComponents(ColorComponents components) {
float ratio = 255;
return SharedColor(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class SharedColor {
Color color_;
};

bool isColorMeaningful(SharedColor const &color) noexcept;
SharedColor colorFromComponents(ColorComponents components);
ColorComponents colorComponentsFromColor(SharedColor color);

Expand Down
8 changes: 8 additions & 0 deletions ReactCommon/react/renderer/graphics/platform/ios/Color.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@
namespace facebook {
namespace react {

bool isColorMeaningful(SharedColor const &color) noexcept {
if (!color) {
return false;
}

return colorComponentsFromColor(color).alpha > 0;
}

SharedColor colorFromComponents(ColorComponents components) {
float ratio = 255;
return SharedColor(
Expand Down
1 change: 1 addition & 0 deletions ReactCommon/react/renderer/graphics/platform/ios/Color.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ using Color = int32_t;

using SharedColor = better::optional<Color>;

bool isColorMeaningful(SharedColor const &color) noexcept;
SharedColor colorFromComponents(ColorComponents components);
ColorComponents colorComponentsFromColor(SharedColor color);

Expand Down