mirror of
https://github.com/status-im/react-native.git
synced 2025-02-25 15:45:32 +00:00
Fabric: Making fabric/graphics
compilable on Android
Summary: @public This compiles but this does not work. To make it actually work we have to implement all missing functions in `Color.cpp` and co. Reviewed By: fkgozali Differential Revision: D8655537 fbshipit-source-id: 564fb7131445af81cf05407239dc6ba870cf6b83
This commit is contained in:
parent
6a16bec882
commit
5786db3a26
@ -12,12 +12,15 @@ if not IS_OSS_BUILD:
|
||||
rn_xplat_cxx_library(
|
||||
name = "graphics",
|
||||
srcs = glob(
|
||||
["**/*.cpp"],
|
||||
exclude = glob(["tests/**/*.cpp"]),
|
||||
[
|
||||
"*.cpp",
|
||||
],
|
||||
),
|
||||
headers = glob(
|
||||
["**/*.h"],
|
||||
exclude = glob(["tests/**/*.h"]),
|
||||
headers = subdir_glob(
|
||||
[
|
||||
("", "*.h"),
|
||||
],
|
||||
prefix = "",
|
||||
),
|
||||
header_namespace = "",
|
||||
exported_headers = subdir_glob(
|
||||
@ -32,6 +35,17 @@ rn_xplat_cxx_library(
|
||||
"-std=c++14",
|
||||
"-Wall",
|
||||
],
|
||||
fbandroid_exported_headers = subdir_glob(
|
||||
[
|
||||
("platform/android", "**/*.h"),
|
||||
],
|
||||
prefix = "fabric/graphics",
|
||||
),
|
||||
fbandroid_srcs = glob(
|
||||
[
|
||||
"platform/android/**/*.cpp",
|
||||
],
|
||||
),
|
||||
fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
|
||||
fbobjc_preprocessor_flags = get_debug_preprocessor_flags() + get_apple_inspector_flags(),
|
||||
fbobjc_tests = [
|
||||
@ -43,6 +57,22 @@ rn_xplat_cxx_library(
|
||||
"$SDKROOT/System/Library/Frameworks/Foundation.framework",
|
||||
"$SDKROOT/System/Library/Frameworks/UIKit.framework",
|
||||
],
|
||||
ios_deps = [
|
||||
"xplat//js:RCTImage",
|
||||
"xplat//js/react-native-github:RCTCxxBridge",
|
||||
],
|
||||
ios_exported_headers = subdir_glob(
|
||||
[
|
||||
("platform/ios", "*.h"),
|
||||
],
|
||||
prefix = "fabric/graphics",
|
||||
),
|
||||
ios_srcs = glob(
|
||||
[
|
||||
"platform/ios/**/*.cpp",
|
||||
"platform/ios/**/*.mm",
|
||||
],
|
||||
),
|
||||
macosx_tests_override = [],
|
||||
platforms = (ANDROID, APPLE),
|
||||
preprocessor_flags = [
|
||||
|
21
ReactCommon/fabric/graphics/ColorComponents.h
Normal file
21
ReactCommon/fabric/graphics/ColorComponents.h
Normal file
@ -0,0 +1,21 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
struct ColorComponents {
|
||||
float red {0};
|
||||
float green {0};
|
||||
float blue {0};
|
||||
float alpha {0};
|
||||
};
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
@ -8,25 +8,11 @@
|
||||
#include <algorithm>
|
||||
#include <tuple>
|
||||
|
||||
#include <CoreGraphics/CGBase.h>
|
||||
#include <fabric/graphics/Float.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/*
|
||||
* Exact type of float numbers which ideally should match a type behing
|
||||
* platform- and chip-architecture-specific float type.
|
||||
*/
|
||||
using Float = CGFloat;
|
||||
|
||||
/*
|
||||
* Large positive number signifies that the `Float` values is `undefined`.
|
||||
*/
|
||||
const Float kFloatUndefined = CGFLOAT_MAX;
|
||||
|
||||
const Float kFloatMax = CGFLOAT_MAX;
|
||||
const Float kFloatMin = CGFLOAT_MIN;
|
||||
|
||||
/*
|
||||
* Point
|
||||
*/
|
||||
|
24
ReactCommon/fabric/graphics/platform/android/Color.cpp
Normal file
24
ReactCommon/fabric/graphics/platform/android/Color.cpp
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include "Color.h"
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
SharedColor colorFromComponents(ColorComponents components) {
|
||||
// Not implemented.
|
||||
return {};
|
||||
}
|
||||
|
||||
ColorComponents colorComponentsFromColor(SharedColor color) {
|
||||
// Not implemented.
|
||||
return {};
|
||||
}
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
24
ReactCommon/fabric/graphics/platform/android/Color.h
Normal file
24
ReactCommon/fabric/graphics/platform/android/Color.h
Normal file
@ -0,0 +1,24 @@
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <fabric/graphics/ColorComponents.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
using Color = float;
|
||||
using SharedColor = std::shared_ptr<Color>;
|
||||
|
||||
SharedColor colorFromComponents(ColorComponents components);
|
||||
ColorComponents colorComponentsFromColor(SharedColor color);
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
28
ReactCommon/fabric/graphics/platform/android/Float.h
Normal file
28
ReactCommon/fabric/graphics/platform/android/Float.h
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (c) 2004-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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/*
|
||||
* Exact type of float numbers which ideally should match a type behing
|
||||
* platform- and chip-architecture-specific float type.
|
||||
*/
|
||||
using Float = float;
|
||||
|
||||
/*
|
||||
* Large positive number signifies that the `Float` values is `undefined`.
|
||||
*/
|
||||
const Float kFloatUndefined = std::numeric_limits<Float>::max();
|
||||
|
||||
const Float kFloatMax = std::numeric_limits<Float>::max();
|
||||
const Float kFloatMin = std::numeric_limits<Float>::min();
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
@ -6,9 +6,6 @@
|
||||
*/
|
||||
|
||||
#include "Color.h"
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#include <CoreGraphics/CGColor.h>
|
||||
#include <cassert>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
@ -7,22 +7,18 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
#include <memory>
|
||||
|
||||
#include <fabric/graphics/Float.h>
|
||||
|
||||
#include <fabric/graphics/ColorComponents.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
using Color = CGColor;
|
||||
using SharedColor = std::shared_ptr<Color>;
|
||||
|
||||
struct ColorComponents {
|
||||
float red {0};
|
||||
float green {0};
|
||||
float blue {0};
|
||||
float alpha {0};
|
||||
};
|
||||
|
||||
SharedColor colorFromComponents(ColorComponents components);
|
||||
ColorComponents colorComponentsFromColor(SharedColor color);
|
||||
|
29
ReactCommon/fabric/graphics/platform/ios/Float.h
Normal file
29
ReactCommon/fabric/graphics/platform/ios/Float.h
Normal file
@ -0,0 +1,29 @@
|
||||
// Copyright (c) 2004-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.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <limits>
|
||||
#include <CoreGraphics/CoreGraphics.h>
|
||||
|
||||
namespace facebook {
|
||||
namespace react {
|
||||
|
||||
/*
|
||||
* Exact type of float numbers which ideally should match a type behing
|
||||
* platform- and chip-architecture-specific float type.
|
||||
*/
|
||||
using Float = CGFloat;
|
||||
|
||||
/*
|
||||
* Large positive number signifies that the `Float` values is `undefined`.
|
||||
*/
|
||||
const Float kFloatUndefined = std::numeric_limits<Float>::max();
|
||||
|
||||
const Float kFloatMax = std::numeric_limits<Float>::max();
|
||||
const Float kFloatMin = std::numeric_limits<Float>::min();
|
||||
|
||||
} // namespace react
|
||||
} // namespace facebook
|
Loading…
x
Reference in New Issue
Block a user