Flutter Engine
The Flutter Engine
MergePaths.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2020 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
13#include "src/utils/SkJSON.h"
14
15#include <algorithm>
16#include <cstddef>
17#include <utility>
18#include <vector>
19
20namespace skottie {
21namespace internal {
22class AnimationBuilder;
23
26 std::vector<sksg::Merge::Rec> merge_recs;
27 merge_recs.reserve(geos.size());
28
29 for (auto& geo : geos) {
30 merge_recs.push_back(
31 {std::move(geo), merge_recs.empty() ? sksg::Merge::Mode::kMerge : mode});
32 }
33
34 return sksg::Merge::Make(std::move(merge_recs));
35}
36
37std::vector<sk_sp<sksg::GeometryNode>> ShapeBuilder::AttachMergeGeometryEffect(
38 const skjson::ObjectValue& jmerge, const AnimationBuilder*,
39 std::vector<sk_sp<sksg::GeometryNode>>&& geos) {
40 static constexpr sksg::Merge::Mode gModes[] = {
45 sksg::Merge::Mode::kXOR , // "mm": 5
46 };
47
48 const auto mode = gModes[std::min<size_t>(ParseDefault<size_t>(jmerge["mm"], 1) - 1,
49 std::size(gModes) - 1)];
50
51 std::vector<sk_sp<sksg::GeometryNode>> merged;
52 merged.push_back(ShapeBuilder::MergeGeometry(std::move(geos), mode));
53
54 return merged;
55}
56
57} // namespace internal
58} // namespace skottie
constexpr SkBlendMode gModes[]
Definition: aarectmodes.cpp:73
static std::vector< sk_sp< sksg::GeometryNode > > AttachMergeGeometryEffect(const skjson::ObjectValue &, const AnimationBuilder *, std::vector< sk_sp< sksg::GeometryNode > > &&)
Definition: MergePaths.cpp:37
static sk_sp< sksg::Merge > MergeGeometry(std::vector< sk_sp< sksg::GeometryNode > > &&, sksg::Merge::Mode)
Definition: MergePaths.cpp:24
static sk_sp< Merge > Make(std::vector< Rec > &&recs)
Definition: SkSGMerge.h:49
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:228
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259