55 void setPatch(
const SkPoint pts[12]) {
59 void setBounds(
int w,
int h) { fW =
w; fH =
h; }
62 bool doTextures,
bool doColors);
73 samples[0] =
cubic[0];
74 for (
int i = 1;
i < segs;
i++) {
80static void eval_sheet(
const SkPoint edge[],
int nu,
int nv,
int iu,
int iv,
84 const int BR = TR + nv;
85 const int BL =
BR + nu;
98 SkScalar x = (1 - v) * edge[TL+iu].fX + u * edge[TR+iv].fX +
99 v * edge[
BR+nu-iu].fX + (1 - u) * edge[
BL+nv-iv].
fX - x0;
100 SkScalar y = (1 - v) * edge[TL+iu].fY + u * edge[TR+iv].fY +
101 v * edge[
BR+nu-iu].fY + (1 - u) * edge[
BL+nv-iv].
fY - y0;
110 bool doTextures,
bool doColors) {
111 if (nu < 1 || nv < 1) {
115 int i, npts = (nu + nv) * 2;
116 std::unique_ptr<SkPoint[]> storage(
new SkPoint[npts + 1]);
117 SkPoint* edge0 = storage.get();
123 eval_patch_edge(
fPts + 0, edge0, nu);
124 eval_patch_edge(
fPts + 3, edge1, nv);
125 eval_patch_edge(
fPts + 6, edge2, nu);
126 eval_patch_edge(
fPts + 9, edge3, nv);
127 edge3[nv] = edge0[0];
129 for (
i = 0;
i < npts;
i++) {
133 int row, vertCount = (nu + 1) * (nv + 1);
134 std::unique_ptr<SkPoint[]> vertStorage(
new SkPoint[vertCount]);
135 SkPoint* verts = vertStorage.get();
138 memcpy(verts, edge0, (nu + 1) *
sizeof(
SkPoint));
141 for (row = 1; row < nv; row++) {
143 r[0] = edge3[nv - row];
144 for (
int col = 1; col < nu; col++) {
145 eval_sheet(edge0, nu, nv, col, row, &r[col]);
150 SkPoint* last = verts + nv * (nu + 1);
151 for (
i = 0;
i <= nu;
i++) {
152 last[
i] = edge2[nu -
i];
157 int stripCount = (nu + 1) * 2;
158 std::unique_ptr<SkPoint[]> stripStorage(
new SkPoint[stripCount * 2]);
159 std::unique_ptr<SkColor[]> colorStorage(
new SkColor[stripCount]);
160 SkPoint* strip = stripStorage.get();
161 SkPoint* tex = strip + stripCount;
167 for (row = 0; row < nv; row++) {
172 for (
i = 0;
i <= nu;
i++) {
173 strip[
i*2 + 0] = *upper++;
174 strip[
i*2 + 1] = *
lower++;
175 tex[
i*2 + 0].
set(
s, t);
176 tex[
i*2 + 1].
set(
s, t + dt);
177 colors[
i*2 + 0] = make_color(
s/fW, t/fH);
178 colors[
i*2 + 1] = make_color(
s/fW, (t + dt)/fH);
183 strip, doTextures ? tex :
nullptr,
184 doColors ?
colors :
nullptr),
193 patch->draw(canvas,
paint, nu, nv,
false,
false);
195 patch->draw(canvas,
paint, nu, nv,
true,
false);
197 patch->draw(canvas,
paint, nu, nv,
false,
true);
199 patch->draw(canvas,
paint, nu, nv,
true,
true);
229 PatchSlide() {
fName =
"Patch"; }
234 if (fSize0.
fX == 0 || fSize0.
fY == 0) {
248 paint.setDither(
true);
254 paint.setShader(fShader0);
255 if (fSize0.
fX == 0) {
258 if (fSize0.
fY == 0) {
261 patch.setBounds(fSize0.
fX, fSize0.
fY);
263 patch.setPatch(
fPts);
264 drawpatches(canvas,
paint, nu, nv, &patch);
266 paint.setShader(
nullptr);
267 paint.setAntiAlias(
true);
273 paint.setAntiAlias(
false);
274 paint.setShader(fShader1);
278 paint.setShader(
paint.getShader()->makeWithLocalMatrix(
m));
283 paint.setShader(
paint.getShader()->makeWithLocalMatrix(
m));
285 patch.setBounds(fSize1.fX, fSize1.fY);
286 drawpatches(canvas,
paint, nu, nv, &patch);
289 bool animate(
double nanos)
override {
295 class PtClick :
public Click {
298 PtClick(
int index) : fIndex(index) {}
306 return new PtClick((
int)
i);
312 bool onClick(Click* click)
override {
313 fPts[((PtClick*)click)->fIndex].
set(click->fCurr.fX - DX, click->fCurr.fY - DY);
342 if (!meas->getMatrix(
distance, &mx)) {
349 int vertCount = pts.
size();
353 vertCount, indexCount,
flags);
356 for (
int i = 0;
i < vertCount; ++
i) {
359 SkDebugf(
"vert count = %d\n", vertCount);
368 SkPaint fSkeletonP, fStrokeP, fVertsP;
382 bool animate(
double nanos)
override {
return true; }
386 for (
int i = 0;
i <
N; ++
i) {
387 fVertices[
i] = make_verts(
fPath, 30);
391 for (
int i = 0;
i <
N; ++
i) {
401 Click* click =
new Click();
407 bool onClick(Click* click)
override {
408 switch (click->fState) {
static int step(int x, SkScalar min, SkScalar max)
sk_bzero(glyphs, sizeof(glyphs))
static bool hittest(const SkPoint &target, SkScalar x, SkScalar y)
#define SkASSERT_RELEASE(cond)
static U8CPU SkUnitScalarClampToByte(SkScalar x)
constexpr SkColor SK_ColorGRAY
constexpr SkColor SK_ColorBLUE
constexpr SkColor SK_ColorRED
static constexpr SkColor SkColorSetARGB(U8CPU a, U8CPU r, U8CPU g, U8CPU b)
constexpr SkColor SK_ColorGREEN
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
void SkEvalCubicAt(const SkPoint src[4], SkScalar t, SkPoint *loc, SkVector *tangent, SkVector *curvature)
static void draw(SkCanvas *canvas, SkRect &target, int x, int y)
virtual bool onClick(Click *)=0
virtual Click * onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey modi)=0
sk_sp< SkShader > makeShader(SkTileMode tmx, SkTileMode tmy, const SkSamplingOptions &, const SkMatrix *localMatrix=nullptr) const
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
void translate(SkScalar dx, SkScalar dy)
void clear(SkColor color)
void drawVertices(const SkVertices *vertices, SkBlendMode mode, const SkPaint &paint)
@ kPoints_PointMode
draw each point separately
sk_sp< SkContourMeasure > next()
static sk_sp< SkShader > MakeLinear(const SkPoint pts[2], const SkColor colors[], const SkScalar pos[], int count, SkTileMode mode, uint32_t flags=0, const SkMatrix *localMatrix=nullptr)
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
void setStyle(Style style)
void setColor(SkColor color)
void setAntiAlias(bool aa)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
SkPath & moveTo(SkScalar x, SkScalar y)
SkPath & lineTo(SkScalar x, SkScalar y)
static sk_sp< SkVertices > MakeCopy(VertexMode mode, int vertexCount, const SkPoint positions[], const SkPoint texs[], const SkColor colors[], int indexCount, const uint16_t indices[])
@ kTriangleStrip_VertexMode
virtual void load(SkScalar winWidth, SkScalar winHeight)
virtual bool animate(double nanos)
virtual void draw(SkCanvas *canvas)=0
FlutterSemanticsFlag flags
PODArray< SkColor > colors
static float Scaled(float time, float speed, float period=0)
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
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
SkSamplingOptions(SkFilterMode::kLinear))
void set(int32_t x, int32_t y)
void set(float x, float y)
static float Length(float x, float y)
static sk_sp< SkShader > make_shader1(int w, int h)
static sk_sp< SkShader > make_shader0(int w, int h)