mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
58a7ddd55d
Summary: Here I'm implementing equality methods for ARTGroup, ARTShape and ARTText and I'm using these methods to update the state only when it is necessary. This will improve perf in rendering of ART changelog: [Internal] Reviewed By: JoshuaGross Differential Revision: D21695127 fbshipit-source-id: b438ddea4c34bd7a0bdf26a6aac4fd62a9f78b49
60 lines
1.4 KiB
C++
60 lines
1.4 KiB
C++
/*
|
|
* 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.
|
|
*/
|
|
|
|
#include <react/components/art/ARTText.h>
|
|
#include <react/components/art/ARTElement.h>
|
|
#include <react/components/art/conversions.h>
|
|
|
|
namespace facebook {
|
|
namespace react {
|
|
|
|
bool ARTText::operator==(const ARTElement &rhs) const {
|
|
if (rhs.elementType != ARTElementType::Text) {
|
|
return false;
|
|
}
|
|
auto text = (const ARTText &)(rhs);
|
|
return std::tie(
|
|
elementType,
|
|
opacity,
|
|
transform,
|
|
d,
|
|
stroke,
|
|
strokeDash,
|
|
fill,
|
|
strokeWidth,
|
|
strokeCap,
|
|
strokeJoin,
|
|
alignment,
|
|
frame) ==
|
|
std::tie(
|
|
text.elementType,
|
|
text.opacity,
|
|
text.transform,
|
|
text.d,
|
|
text.stroke,
|
|
text.strokeDash,
|
|
text.fill,
|
|
text.strokeWidth,
|
|
text.strokeCap,
|
|
text.strokeJoin,
|
|
text.alignment,
|
|
text.frame);
|
|
}
|
|
|
|
bool ARTText::operator!=(const ARTElement &rhs) const {
|
|
return !(*this == rhs);
|
|
}
|
|
|
|
#ifdef ANDROID
|
|
folly::dynamic ARTText::getDynamic() const {
|
|
return toDynamic(*this);
|
|
}
|
|
#endif
|
|
|
|
} // namespace react
|
|
} // namespace facebook
|