Flutter Engine
The Flutter Engine
SkEdgeBuilder.h
Go to the documentation of this file.
1/*
2 * Copyright 2011 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 SkEdgeBuilder_DEFINED
8#define SkEdgeBuilder_DEFINED
9
10#include "include/core/SkRect.h"
13
14#include <cstddef>
15
16class SkPath;
17struct SkAnalyticEdge;
18struct SkEdge;
19struct SkPoint;
20
22public:
23 int buildEdges(const SkPath& path,
24 const SkIRect* shiftedClip);
25
26protected:
27 SkEdgeBuilder() = default;
28 virtual ~SkEdgeBuilder() = default;
29
30 // In general mode we allocate pointers in fList and fEdgeList points to its head.
31 // In polygon mode we preallocated edges contiguously in fAlloc and fEdgeList points there.
32 void** fEdgeList = nullptr;
35
36 enum Combine {
40 };
41
42private:
43 int build (const SkPath& path, const SkIRect* clip, bool clipToTheRight);
44 int buildPoly(const SkPath& path, const SkIRect* clip, bool clipToTheRight);
45
46 virtual char* allocEdges(size_t n, size_t* sizeof_edge) = 0;
47 virtual SkRect recoverClip(const SkIRect&) const = 0;
48
49 virtual void addLine (const SkPoint pts[]) = 0;
50 virtual void addQuad (const SkPoint pts[]) = 0;
51 virtual void addCubic(const SkPoint pts[]) = 0;
52 virtual Combine addPolyLine(const SkPoint pts[], char* edge, char** edgePtr) = 0;
53};
54
55class SkBasicEdgeBuilder final : public SkEdgeBuilder {
56public:
57 explicit SkBasicEdgeBuilder(int clipShift) : fClipShift(clipShift) {}
58
59 SkEdge** edgeList() { return (SkEdge**)fEdgeList; }
60
61private:
62 Combine combineVertical(const SkEdge* edge, SkEdge* last);
63
64 char* allocEdges(size_t, size_t*) override;
65 SkRect recoverClip(const SkIRect&) const override;
66
67 void addLine (const SkPoint pts[]) override;
68 void addQuad (const SkPoint pts[]) override;
69 void addCubic(const SkPoint pts[]) override;
70 Combine addPolyLine(const SkPoint pts[], char* edge, char** edgePtr) override;
71
72 const int fClipShift;
73};
74
76public:
78
80
81private:
82 Combine combineVertical(const SkAnalyticEdge* edge, SkAnalyticEdge* last);
83
84 char* allocEdges(size_t, size_t*) override;
85 SkRect recoverClip(const SkIRect&) const override;
86
87 void addLine (const SkPoint pts[]) override;
88 void addQuad (const SkPoint pts[]) override;
89 void addCubic(const SkPoint pts[]) override;
90 Combine addPolyLine(const SkPoint pts[], char* edge, char** edgePtr) override;
91};
92#endif
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
SkAnalyticEdge ** analyticEdgeList()
Definition: SkEdgeBuilder.h:79
SkEdge ** edgeList()
Definition: SkEdgeBuilder.h:59
SkBasicEdgeBuilder(int clipShift)
Definition: SkEdgeBuilder.h:57
virtual void addLine(const SkPoint pts[])=0
virtual SkRect recoverClip(const SkIRect &) const =0
SkTDArray< void * > fList
Definition: SkEdgeBuilder.h:33
virtual void addCubic(const SkPoint pts[])=0
virtual void addQuad(const SkPoint pts[])=0
void ** fEdgeList
Definition: SkEdgeBuilder.h:32
SkSTArenaAlloc< 512 > fAlloc
Definition: SkEdgeBuilder.h:34
int buildEdges(const SkPath &path, const SkIRect *shiftedClip)
virtual char * allocEdges(size_t n, size_t *sizeof_edge)=0
virtual Combine addPolyLine(const SkPoint pts[], char *edge, char **edgePtr)=0
virtual ~SkEdgeBuilder()=default
SkEdgeBuilder()=default
Definition: SkPath.h:59
Definition: build.py:1
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
Definition: SkEdge.h:27
Definition: SkRect.h:32