Flutter Engine
The Flutter Engine
Classes | Macros | Functions
QuadStrokerSlide.cpp File Reference
#include "include/core/SkBlendMode.h"
#include "include/core/SkCanvas.h"
#include "include/core/SkColor.h"
#include "include/core/SkFont.h"
#include "include/core/SkImageInfo.h"
#include "include/core/SkMatrix.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
#include "include/core/SkPathMeasure.h"
#include "include/core/SkPathUtils.h"
#include "include/core/SkPoint.h"
#include "include/core/SkRRect.h"
#include "include/core/SkRect.h"
#include "include/core/SkRefCnt.h"
#include "include/core/SkScalar.h"
#include "include/core/SkShader.h"
#include "include/core/SkString.h"
#include "include/core/SkSurface.h"
#include "include/core/SkTypes.h"
#include "include/private/base/SkTArray.h"
#include "include/private/base/SkTemplates.h"
#include "include/utils/SkTextUtils.h"
#include "src/core/SkGeometry.h"
#include "src/core/SkPathPriv.h"
#include "src/core/SkPointPriv.h"
#include "src/core/SkStroke.h"
#include "tools/ToolUtils.h"
#include "tools/fonts/FontToolUtils.h"
#include "tools/viewer/ClickHandlerSlide.h"
#include <cfloat>

Go to the source code of this file.

Classes

struct  StrokeTypeButton
 
struct  CircleTypeButton
 
class  QuadStrokerSlide
 
class  QuadStrokerSlide::MyClick
 

Macros

#define kWidthMin   1
 
#define kWidthMax   100
 

Functions

static bool hittest (const SkPoint &target, SkScalar x, SkScalar y)
 
static int getOnCurvePoints (const SkPath &path, SkPoint storage[])
 
static void getContourCounts (const SkPath &path, TArray< int > *contourCounts)
 
static void erase (const sk_sp< SkSurface > &surface)
 

Macro Definition Documentation

◆ kWidthMax

#define kWidthMax   100

Definition at line 154 of file QuadStrokerSlide.cpp.

◆ kWidthMin

#define kWidthMin   1

Definition at line 153 of file QuadStrokerSlide.cpp.

Function Documentation

◆ erase()

static void erase ( const sk_sp< SkSurface > &  surface)
static

Definition at line 95 of file QuadStrokerSlide.cpp.

95 {
96 SkCanvas* canvas = surface->getCanvas();
97 if (canvas) {
99 }
100}
constexpr SkColor SK_ColorTRANSPARENT
Definition: SkColor.h:99
void clear(SkColor color)
Definition: SkCanvas.h:1199
VkSurfaceKHR surface
Definition: main.cc:49

◆ getContourCounts()

static void getContourCounts ( const SkPath path,
TArray< int > *  contourCounts 
)
static

Definition at line 67 of file QuadStrokerSlide.cpp.

67 {
68 int count = 0;
69 for (auto [verb, pts, w] : SkPathPriv::Iterate(path)) {
70 switch (verb) {
73 count += 1;
74 break;
77 count += 2;
78 break;
80 count += 3;
81 break;
83 contourCounts->push_back(count);
84 count = 0;
85 break;
86 default:
87 break;
88 }
89 }
90 if (count > 0) {
91 contourCounts->push_back(count);
92 }
93}
int count
Definition: FontMgrTest.cpp:50
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
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
SkScalar w

◆ getOnCurvePoints()

static int getOnCurvePoints ( const SkPath path,
SkPoint  storage[] 
)
static

Definition at line 49 of file QuadStrokerSlide.cpp.

49 {
50 int count = 0;
51 for (auto [verb, pts, w] : SkPathPriv::Iterate(path)) {
52 switch (verb) {
58 storage[count++] = pts[0];
59 break;
60 default:
61 break;
62 }
63 }
64 return count;
65}

◆ hittest()

static bool hittest ( const SkPoint target,
SkScalar  x,
SkScalar  y 
)
static

Definition at line 44 of file QuadStrokerSlide.cpp.

44 {
45 const SkScalar TOL = 7;
46 return SkPoint::Distance(target, SkPoint::Make(x, y)) <= TOL;
47}
float SkScalar
Definition: extension.cpp:12
uint32_t * target
double y
double x
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
static float Distance(const SkPoint &a, const SkPoint &b)
Definition: SkPoint_impl.h:508