diff --git a/engine/src/flutter/impeller/impeller/entity/Color.cc b/engine/src/flutter/impeller/impeller/entity/Color.cc index 502e668824..311d1ab517 100644 --- a/engine/src/flutter/impeller/impeller/entity/Color.cc +++ b/engine/src/flutter/impeller/impeller/entity/Color.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Color.h" #include @@ -28,8 +27,9 @@ ColorHSB ColorHSB::FromRGB(Color rgb) { v = fmax(R, G); v = fmax(v, B); - if (v == x) + if (v == x) { return ColorHSB(0.0, 0.0, v, rgb.alpha); + } f = (R == x) ? G - B : ((G == x) ? B - R : R - G); i = (R == x) ? 3 : ((G == x) ? 5 : 1); @@ -48,18 +48,21 @@ Color ColorHSB::toRGBA() const { int64_t i = 0; - if (h == 0) + if (h == 0) { h = 0.01; + } - if (h == 0.0) + if (h == 0.0) { return Color(v, v, v, alpha); + } i = static_cast(floor(h)); f = h - i; - if (!(i & 1)) + if (!(i & 1)) { f = 1 - f; + } m = v * (1 - s); n = v * (1 - s * f); diff --git a/engine/src/flutter/impeller/impeller/entity/Color.h b/engine/src/flutter/impeller/impeller/entity/Color.h index a625dd281d..e00d8e428d 100644 --- a/engine/src/flutter/impeller/impeller/entity/Color.h +++ b/engine/src/flutter/impeller/impeller/entity/Color.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/entity/Entity.cc b/engine/src/flutter/impeller/impeller/entity/Entity.cc index 772ceef394..ba2670c5c1 100644 --- a/engine/src/flutter/impeller/impeller/entity/Entity.cc +++ b/engine/src/flutter/impeller/impeller/entity/Entity.cc @@ -1,17 +1,13 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Entity.h" namespace rl { namespace entity { -Entity::Entity() - : _anchorPoint(geom::Point(0.5, 0.5)), _opacity(1.0), _strokeSize(1.0) {} - -Entity::Entity(Entity&&) = default; +Entity::Entity() = default; Entity::~Entity() = default; diff --git a/engine/src/flutter/impeller/impeller/entity/Entity.h b/engine/src/flutter/impeller/impeller/entity/Entity.h index c1e9e4d557..b827798985 100644 --- a/engine/src/flutter/impeller/impeller/entity/Entity.h +++ b/engine/src/flutter/impeller/impeller/entity/Entity.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once @@ -16,50 +15,8 @@ namespace entity { class Entity { public: - using PropertyMaskType = uint16_t; - - enum class Property : PropertyMaskType { - None, - - AddedTo, - RemovedFrom, - Bounds, - Position, - AnchorPoint, - Transformation, - BackgroundColor, - Contents, - Path, - Opacity, - StrokeSize, - StrokeColor, - MakeRoot, - - Sentinel, - }; - -#define RL_MASK(x) x##Mask = (1 << static_cast(Property::x)) - enum PropertyMask { - RL_MASK(AddedTo), - RL_MASK(RemovedFrom), - RL_MASK(Bounds), - RL_MASK(Position), - RL_MASK(AnchorPoint), - RL_MASK(Transformation), - RL_MASK(BackgroundColor), - RL_MASK(Contents), - RL_MASK(Path), - RL_MASK(Opacity), - RL_MASK(StrokeSize), - RL_MASK(StrokeColor), - RL_MASK(MakeRoot), - }; -#undef RL_MASK - Entity(); - Entity(Entity&& entity); - ~Entity(); /** @@ -187,14 +144,14 @@ class Entity { private: geom::Rect _bounds; geom::Point _position; - geom::Point _anchorPoint; + geom::Point _anchorPoint = {0.5, 0.5}; geom::Matrix _transformation; Color _backgroundColor; geom::Path _path; - double _opacity; - Color _strokeColor; - double _strokeSize; + double _opacity = 1.0; + Color _strokeColor = Color::Black(); + double _strokeSize = 1.0; FML_DISALLOW_COPY_AND_ASSIGN(Entity); }; diff --git a/engine/src/flutter/impeller/impeller/geometry/Matrix.cc b/engine/src/flutter/impeller/impeller/geometry/Matrix.cc index 8909df29bd..9fe2161373 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Matrix.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Matrix.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Matrix.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Matrix.h b/engine/src/flutter/impeller/impeller/geometry/Matrix.h index add1b681b5..58d224a684 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Matrix.h +++ b/engine/src/flutter/impeller/impeller/geometry/Matrix.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Path.cc b/engine/src/flutter/impeller/impeller/geometry/Path.cc index 8651108f9c..b8c9ec6e5e 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Path.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Path.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Path.h" diff --git a/engine/src/flutter/impeller/impeller/geometry/Path.h b/engine/src/flutter/impeller/impeller/geometry/Path.h index d36b730074..8d2abcacae 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Path.h +++ b/engine/src/flutter/impeller/impeller/geometry/Path.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/PathBuilder.cc b/engine/src/flutter/impeller/impeller/geometry/PathBuilder.cc index 35a8b718ed..5bfe23dbeb 100644 --- a/engine/src/flutter/impeller/impeller/geometry/PathBuilder.cc +++ b/engine/src/flutter/impeller/impeller/geometry/PathBuilder.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "PathBuilder.h" diff --git a/engine/src/flutter/impeller/impeller/geometry/PathBuilder.h b/engine/src/flutter/impeller/impeller/geometry/PathBuilder.h index ba023508b9..161aabc5ff 100644 --- a/engine/src/flutter/impeller/impeller/geometry/PathBuilder.h +++ b/engine/src/flutter/impeller/impeller/geometry/PathBuilder.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/PathComponent.cc b/engine/src/flutter/impeller/impeller/geometry/PathComponent.cc index f1ddeac764..2540e3082b 100644 --- a/engine/src/flutter/impeller/impeller/geometry/PathComponent.cc +++ b/engine/src/flutter/impeller/impeller/geometry/PathComponent.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "PathComponent.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/PathComponent.h b/engine/src/flutter/impeller/impeller/geometry/PathComponent.h index 0acf40266d..b1746b22ab 100644 --- a/engine/src/flutter/impeller/impeller/geometry/PathComponent.h +++ b/engine/src/flutter/impeller/impeller/geometry/PathComponent.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Point.cc b/engine/src/flutter/impeller/impeller/geometry/Point.cc index b7cfd3805f..9b8d6976f2 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Point.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Point.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Point.h" #include @@ -22,5 +21,15 @@ void Point::fromString(const std::string& str) { stream >> y; } +double Point::distanceSquared(const Point& p) const { + double dx = p.x - x; + double dy = p.y - y; + return dx * dx + dy * dy; +} + +double Point::distance(const Point& p) const { + return sqrt(distanceSquared(p)); +} + } // namespace geom } // namespace rl diff --git a/engine/src/flutter/impeller/impeller/geometry/Point.h b/engine/src/flutter/impeller/impeller/geometry/Point.h index 77f3cc37e4..1e246b1dd8 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Point.h +++ b/engine/src/flutter/impeller/impeller/geometry/Point.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once @@ -16,13 +15,15 @@ struct Point { double x; double y; - Point() : x(0.0), y(0.0) {} - Point(double x, double y) : x(x), y(y) {} + constexpr Point() : x(0.0), y(0.0) {} + + constexpr Point(double x, double y) : x(x), y(y) {} /* * Operator overloads */ bool operator==(const Point& p) const { return p.x == x && p.y == y; } + bool operator!=(const Point& p) const { return p.x != x || p.y != y; } Point operator-() const { return {-x, -y}; } @@ -41,13 +42,9 @@ struct Point { Point operator/(const Point& p) const { return {x / p.x, y / p.y}; } Point operator/(const Size& s) const { return {x / s.width, y / s.height}; } - double distanceSquared(const Point& p) const { - double dx = p.x - x; - double dy = p.y - y; - return dx * dx + dy * dy; - } + double distanceSquared(const Point& p) const; - double distance(const Point& p) const { return sqrt(distanceSquared(p)); } + double distance(const Point& p) const; std::string toString() const; diff --git a/engine/src/flutter/impeller/impeller/geometry/Quaternion.cc b/engine/src/flutter/impeller/impeller/geometry/Quaternion.cc index bae8cdd541..58ef20c051 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Quaternion.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Quaternion.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Quaternion.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Quaternion.h b/engine/src/flutter/impeller/impeller/geometry/Quaternion.h index 2b97e4da81..ec5e6eb608 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Quaternion.h +++ b/engine/src/flutter/impeller/impeller/geometry/Quaternion.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Rect.cc b/engine/src/flutter/impeller/impeller/geometry/Rect.cc index 878270f17c..a718e746fc 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Rect.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Rect.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Rect.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Rect.h b/engine/src/flutter/impeller/impeller/geometry/Rect.h index 21abc492a0..1cc5e39f1c 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Rect.h +++ b/engine/src/flutter/impeller/impeller/geometry/Rect.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Shear.cc b/engine/src/flutter/impeller/impeller/geometry/Shear.cc index dd880a9761..fc0cae787a 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Shear.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Shear.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Shear.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Shear.h b/engine/src/flutter/impeller/impeller/geometry/Shear.h index f229d08699..dd5d402bc9 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Shear.h +++ b/engine/src/flutter/impeller/impeller/geometry/Shear.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Size.cc b/engine/src/flutter/impeller/impeller/geometry/Size.cc index 6bc5febf74..d6f7f9da19 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Size.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Size.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Size.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Size.h b/engine/src/flutter/impeller/impeller/geometry/Size.h index b2f2ab8229..bc064fb9b2 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Size.h +++ b/engine/src/flutter/impeller/impeller/geometry/Size.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/geometry/Vector.cc b/engine/src/flutter/impeller/impeller/geometry/Vector.cc index ad20c487e6..2d33a39bdf 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Vector.cc +++ b/engine/src/flutter/impeller/impeller/geometry/Vector.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Vector.h" #include diff --git a/engine/src/flutter/impeller/impeller/geometry/Vector.h b/engine/src/flutter/impeller/impeller/geometry/Vector.h index 0457d1911a..69c4324622 100644 --- a/engine/src/flutter/impeller/impeller/geometry/Vector.h +++ b/engine/src/flutter/impeller/impeller/geometry/Vector.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/image/Image.cc b/engine/src/flutter/impeller/impeller/image/Image.cc index bf0bf186cc..79b0c19f69 100644 --- a/engine/src/flutter/impeller/impeller/image/Image.cc +++ b/engine/src/flutter/impeller/impeller/image/Image.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "Image.h" #include diff --git a/engine/src/flutter/impeller/impeller/image/Image.h b/engine/src/flutter/impeller/impeller/image/Image.h index 40b5471cef..cf4641b5b6 100644 --- a/engine/src/flutter/impeller/impeller/image/Image.h +++ b/engine/src/flutter/impeller/impeller/image/Image.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once diff --git a/engine/src/flutter/impeller/impeller/image/ImageResult.cc b/engine/src/flutter/impeller/impeller/image/ImageResult.cc index 09c4ea10eb..66783483ed 100644 --- a/engine/src/flutter/impeller/impeller/image/ImageResult.cc +++ b/engine/src/flutter/impeller/impeller/image/ImageResult.cc @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "ImageResult.h" diff --git a/engine/src/flutter/impeller/impeller/image/ImageResult.h b/engine/src/flutter/impeller/impeller/image/ImageResult.h index 8943dc02d7..28dfc18f32 100644 --- a/engine/src/flutter/impeller/impeller/image/ImageResult.h +++ b/engine/src/flutter/impeller/impeller/image/ImageResult.h @@ -1,7 +1,6 @@ -/* - * This source file is part of the Radar project. - * Licensed under the MIT License. See LICENSE file for details. - */ +// Copyright 2013 The Flutter Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #pragma once