Fabric: SharedColor for Android

Summary:
@public
On Android, a color can be represented as 32 bits integer, so there is no need to instantiate complex color objects and then pass them as shared pointers.  Hense instead of using shared_ptr, we use a simple wrapper class which provides a pointer-like interface.

Reviewed By: mdvacca

Differential Revision: D8742014

fbshipit-source-id: 14109b61fd84a34989538a15bc6fe4e2a8ce83a6
This commit is contained in:
Valentin Shergin
2018-07-17 18:05:40 -07:00
committed by Facebook Github Bot
parent 50a481d23a
commit 2d1fabbab2
3 changed files with 57 additions and 12 deletions

View File

@@ -31,8 +31,8 @@ public:
#pragma mark - Fields
// Color
SharedColor foregroundColor {nullptr};
SharedColor backgroundColor {nullptr};
SharedColor foregroundColor {};
SharedColor backgroundColor {};
Float opacity {std::numeric_limits<Float>::quiet_NaN()};
// Font
@@ -51,7 +51,7 @@ public:
folly::Optional<WritingDirection> baseWritingDirection {};
// Decoration
SharedColor textDecorationColor {nullptr};
SharedColor textDecorationColor {};
folly::Optional<TextDecorationLineType> textDecorationLineType {};
folly::Optional<TextDecorationLineStyle> textDecorationLineStyle {};
folly::Optional<TextDecorationLinePattern> textDecorationLinePattern {};
@@ -60,7 +60,7 @@ public:
// TODO: Use `Point` type instead of `Size` for `textShadowOffset` attribute.
folly::Optional<Size> textShadowOffset {};
Float textShadowRadius {std::numeric_limits<Float>::quiet_NaN()};
SharedColor textShadowColor {nullptr};
SharedColor textShadowColor {};
// Special
folly::Optional<bool> isHighlighted {};