Flutter Engine
The Flutter Engine
SkPathMakers.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 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
8#ifndef SkPathMakers_DEFINED
9#define SkPathMakers_DEFINED
10
14
15template <unsigned N> class SkPath_PointIterator {
16public:
18 : fCurrent(startIndex % N)
19 , fAdvance(dir == SkPathDirection::kCW ? 1 : N - 1) { }
20
21 const SkPoint& current() const {
22 SkASSERT(fCurrent < N);
23 return fPts[fCurrent];
24 }
25
26 const SkPoint& next() {
27 fCurrent = (fCurrent + fAdvance) % N;
28 return this->current();
29 }
30
31 protected:
33
34 private:
35 unsigned fCurrent;
36 unsigned fAdvance;
37};
38
40public:
42 : SkPath_PointIterator(dir, startIndex) {
43
44 fPts[0] = SkPoint::Make(rect.fLeft, rect.fTop);
45 fPts[1] = SkPoint::Make(rect.fRight, rect.fTop);
46 fPts[2] = SkPoint::Make(rect.fRight, rect.fBottom);
47 fPts[3] = SkPoint::Make(rect.fLeft, rect.fBottom);
48 }
49};
50
52public:
54 : SkPath_PointIterator(dir, startIndex) {
55
56 const SkScalar cx = oval.centerX();
57 const SkScalar cy = oval.centerY();
58
59 fPts[0] = SkPoint::Make(cx, oval.fTop);
60 fPts[1] = SkPoint::Make(oval.fRight, cy);
62 fPts[3] = SkPoint::Make(oval.fLeft, cy);
63 }
64};
65
67public:
69 : SkPath_PointIterator(dir, startIndex) {
70
71 const SkRect& bounds = rrect.getBounds();
72 const SkScalar L = bounds.fLeft;
73 const SkScalar T = bounds.fTop;
74 const SkScalar R = bounds.fRight;
75 const SkScalar B = bounds.fBottom;
76
85 }
86};
87
88#endif
#define SkASSERT(cond)
Definition: SkAssert.h:116
SkPathDirection
Definition: SkPathTypes.h:34
#define N
Definition: beziers.cpp:19
SkPath_OvalPointIterator(const SkRect &oval, SkPathDirection dir, unsigned startIndex)
Definition: SkPathMakers.h:53
const SkPoint & current() const
Definition: SkPathMakers.h:21
const SkPoint & next()
Definition: SkPathMakers.h:26
SkPath_PointIterator(SkPathDirection dir, unsigned startIndex)
Definition: SkPathMakers.h:17
SkPath_RRectPointIterator(const SkRRect &rrect, SkPathDirection dir, unsigned startIndex)
Definition: SkPathMakers.h:68
SkPath_RectPointIterator(const SkRect &rect, SkPathDirection dir, unsigned startIndex)
Definition: SkPathMakers.h:41
SkVector radii(Corner corner) const
Definition: SkRRect.h:271
@ kUpperLeft_Corner
index of top-left corner radii
Definition: SkRRect.h:252
@ kLowerRight_Corner
index of bottom-right corner radii
Definition: SkRRect.h:254
@ kUpperRight_Corner
index of top-right corner radii
Definition: SkRRect.h:253
@ kLowerLeft_Corner
index of bottom-left corner radii
Definition: SkRRect.h:255
const SkRect & getBounds() const
Definition: SkRRect.h:279
float SkScalar
Definition: extension.cpp:12
#define R(r)
Optional< SkRect > bounds
Definition: SkRecords.h:189
SkRRect rrect
Definition: SkRecords.h:232
SkRect oval
Definition: SkRecords.h:249
sk_sp< SkBlender > blender SkRect rect
Definition: SkRecords.h:350
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 to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition: switches.h:145
#define T
Definition: precompiler.cc:65
float fX
x-axis value
Definition: SkPoint_impl.h:164
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
float fY
y-axis value
Definition: SkPoint_impl.h:165
SkScalar fBottom
larger y-axis bounds
Definition: extension.cpp:17
SkScalar fLeft
smaller x-axis bounds
Definition: extension.cpp:14
SkScalar fRight
larger x-axis bounds
Definition: extension.cpp:16
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float centerY() const
Definition: SkRect.h:785
SkScalar fTop
smaller y-axis bounds
Definition: extension.cpp:15