Skip to content

Commit

Permalink
Remove FML dependency on geometry, tessellator (flutter#59)
Browse files Browse the repository at this point in the history
* Remove FML dependency on geometry, tessellator

* update readme
  • Loading branch information
dnfield committed Apr 27, 2022
1 parent 0936dfa commit 6da61e7
Show file tree
Hide file tree
Showing 16 changed files with 63 additions and 25 deletions.
4 changes: 3 additions & 1 deletion impeller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ Impeller itself may not depend on anything in `//flutter` except `//flutter/fml`
and `flutter/display_list`. FML is a base library for C++ projects and Impeller
implements the display list dispatcher interface to make it easy for Flutter to
swap the renderer with Impeller. Impeller is meant to be used by the Flow
(`//flutter/flow`) subsystem. Hence the name.
(`//flutter/flow`) subsystem. Hence the name. The tessellator and geometry
libraries are exceptions - they unconditionally may not depend on anything from
`//flutter`.

An overview of the major sub-frameworks, their responsibilities, and, relative
states of completion:
Expand Down
8 changes: 8 additions & 0 deletions impeller/aiks/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ impeller_component("aiks") {
"../entity",
"../geometry",
]

deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
]
}

impeller_component("aiks_unittests") {
Expand Down
9 changes: 8 additions & 1 deletion impeller/archivist/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,14 @@ impeller_component("archivist") {

public_deps = [ "../base" ]

deps = [ "//third_party/sqlite" ]
deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
"//third_party/sqlite",
]
}

impeller_component("archivist_unittests") {
Expand Down
8 changes: 8 additions & 0 deletions impeller/base/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ impeller_component("base") {
"validation.cc",
"validation.h",
]

deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
]
}

impeller_component("base_unittests") {
Expand Down
2 changes: 0 additions & 2 deletions impeller/base/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#pragma once

#include "flutter/fml/build_config.h"

#if defined(__GNUC__) || defined(__clang__)
#define IMPELLER_COMPILER_CLANG 1
#else // defined(__GNUC__) || defined(__clang__)
Expand Down
9 changes: 9 additions & 0 deletions impeller/entity/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@ impeller_component("entity") {
"../renderer",
"../typographer",
]


deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
]
}

impeller_component("entity_unittests") {
Expand Down
1 change: 0 additions & 1 deletion impeller/geometry/matrix_decomposition.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#pragma once

#include "flutter/fml/macros.h"
#include "impeller/geometry/quaternion.h"
#include "impeller/geometry/scalar.h"
#include "impeller/geometry/shear.h"
Expand Down
3 changes: 0 additions & 3 deletions impeller/geometry/path.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

#include <optional>

#include "flutter/fml/logging.h"
#include "impeller/geometry/path_component.h"

namespace impeller {
Expand All @@ -19,8 +18,6 @@ Path::~Path() = default;

std::tuple<size_t, size_t> Path::Polyline::GetContourPointBounds(
size_t contour_index) const {
FML_DCHECK(contour_index < contours.size());

const size_t start_index = contours[contour_index].start_index;
const size_t end_index = (contour_index >= contours.size() - 1)
? points.size()
Expand Down
4 changes: 2 additions & 2 deletions impeller/geometry/path_builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

#pragma once

#include "flutter/fml/macros.h"
#include "impeller/geometry/path.h"
#include "impeller/geometry/rect.h"
#include "impeller/geometry/scalar.h"
Expand Down Expand Up @@ -109,7 +108,8 @@ class PathBuilder {

Point ReflectedCubicControlPoint1() const;

FML_DISALLOW_COPY_AND_ASSIGN(PathBuilder);
PathBuilder(const PathBuilder&) = delete;
PathBuilder& operator=(const PathBuilder&&) = delete;
};

} // namespace impeller
2 changes: 0 additions & 2 deletions impeller/geometry/scalar.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#include <cfloat>
#include <valarray>

#include "flutter/fml/logging.h"
#include "impeller/geometry/constants.h"

namespace impeller {
Expand All @@ -17,7 +16,6 @@ using Scalar = float;
constexpr inline bool ScalarNearlyEqual(Scalar x,
Scalar y,
Scalar tolerance = 1e-3) {
FML_DCHECK(tolerance >= 0);
return std::abs(x - y) <= tolerance;
}

Expand Down
11 changes: 9 additions & 2 deletions impeller/image/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,19 @@ impeller_component("image") {
"decompressed_image.cc",
]

deps = [ "//third_party/skia" ]

public_deps = [
"../base",
"../geometry",
]

deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
"//third_party/skia",
]
}

impeller_component("image_unittests") {
Expand Down
8 changes: 8 additions & 0 deletions impeller/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,14 @@ impeller_component("renderer") {
"../tessellator",
]

deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
]

frameworks = [ "Metal.framework" ]
}

Expand Down
1 change: 0 additions & 1 deletion impeller/tessellator/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ shared_library("tessellator_shared") {

deps = [
"../geometry",
"//flutter/fml",
"//third_party/libtess2",
]
}
3 changes: 0 additions & 3 deletions impeller/tessellator/tessellator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

#include "impeller/tessellator/tessellator.h"

#include "flutter/fml/logging.h"
#include "flutter/fml/trace_event.h"
#include "third_party/libtess2/Include/tesselator.h"

namespace impeller {
Expand Down Expand Up @@ -38,7 +36,6 @@ static void DestroyTessellator(TESStesselator* tessellator) {

bool Tessellator::Tessellate(const Path::Polyline& polyline,
VertexCallback callback) const {
TRACE_EVENT0("impeller", "Tessellator::Tessellate");
if (!callback) {
return false;
}
Expand Down
7 changes: 0 additions & 7 deletions impeller/tools/impeller.gni
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,6 @@ template("impeller_component") {
cflags_objcc += flutter_cflags_objcc_arc + objc_warning_flags

public_configs += [ "//flutter/impeller:impeller_public_config" ]

deps += [
"//flutter/fml",

# For tracing, seems to be pulled in by FML. Must be removed.
"//flutter/runtime:libdart",
]
}
}

Expand Down
8 changes: 8 additions & 0 deletions impeller/typographer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,14 @@ impeller_component("typographer") {
"../renderer",
"//third_party/skia",
]

deps = [
"//flutter/fml",

# FML depends on the Dart VM for tracing and getting the current
# timepoint.
"//flutter/runtime:libdart",
]
}

impeller_component("typographer_unittests") {
Expand Down

0 comments on commit 6da61e7

Please sign in to comment.