Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SubsetPath.h
Go to the documentation of this file.
1/*
2 * Copyright 2015 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#ifndef SubsetPath_DEFINED
8#define SubsetPath_DEFINED
9
10#include "include/core/SkPath.h"
12
13/* Given a path, generate a the desired minimal subset of the original.
14
15 This does a binary divide-and-conquer on the path, first splitting by
16 contours, and then by verbs. The caller passes whether the previous subset
17 behaved the same as the original. If not, the subset() call restores the
18 prior state before returning a new subset.
19
20 If a path fails a local test, this reduces the data to the
21 minimal set that fails using a pattern like:
22
23 bool testFailed = true;
24 SkPath minimal;
25 SubsetContours subsetContours(testPath);
26 while (subsetContours.subset(testFailed, &minimal)) {
27 testFailed = myPathTest(minimal);
28 }
29 testFailed = true;
30 SubsetVerbs subsetVerbs(testPath);
31 while (subsetVerbs.subset(testFailed, &minimal)) {
32 testFailed = myPathTest(minimal);
33 }
34*/
35
37public:
38 SubsetPath(const SkPath& path);
39 virtual ~SubsetPath() {}
40 bool subset(bool testFailed, SkPath* sub);
41protected:
42 int range(int* end) const;
43 virtual SkPath getSubsetPath() const = 0;
44
45 const SkPath& fPath;
48 int fTries;
49
50};
51
52class SubsetContours : public SubsetPath {
53public:
55protected:
56 SkPath getSubsetPath() const override;
57};
58
59class SubsetVerbs : public SubsetPath {
60public:
61 SubsetVerbs(const SkPath& path);
62protected:
63 SkPath getSubsetPath() const override;
64};
65
66#endif
Definition: SkPath.h:59
SkPath getSubsetPath() const override
Definition: SubsetPath.cpp:97
SubsetContours(const SkPath &path)
Definition: SubsetPath.cpp:67
SubsetPath(const SkPath &path)
Definition: SubsetPath.cpp:16
int fTries
Definition: SubsetPath.h:48
SkTDArray< bool > fSelected
Definition: SubsetPath.h:46
const SkPath & fPath
Definition: SubsetPath.h:45
int range(int *end) const
Definition: SubsetPath.cpp:21
int fSubset
Definition: SubsetPath.h:47
virtual ~SubsetPath()
Definition: SubsetPath.h:39
bool subset(bool testFailed, SkPath *sub)
Definition: SubsetPath.cpp:32
virtual SkPath getSubsetPath() const =0
SubsetVerbs(const SkPath &path)
Definition: SubsetPath.cpp:152
SkPath getSubsetPath() const override
Definition: SubsetPath.cpp:178
glong glong end
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57