void onDraw(SkCanvas* canvas) override { SkScalar angle = kAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI); SkScalar size = SkIntToScalar(SkMin32(kWidth, kHeight)); SkPoint center = SkPoint::Make(SkScalarHalf(kWidth), SkScalarHalf(kHeight)); SkScalar length = 5; SkScalar step = angle; SkPath path; path.moveTo(center); while (length < (SkScalarHalf(size) - 10.f)) { SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX, length*SkScalarSin(step) + center.fY); path.lineTo(rp); length += angle / SkScalarHalf(SK_ScalarPI); step += angle; } path.close(); SkPaint paint; paint.setAntiAlias(true); paint.setStyle(SkPaint::kStroke_Style); paint.setColor(sk_tool_utils::color_to_565(0xFF007700)); canvas->drawPath(path, paint); }
PathTexture* PathCache::getArc(float width, float height, float startAngle, float sweepAngle, bool useCenter, const SkPaint* paint) { PathDescription entry(kShapeArc, paint); entry.shape.arc.mWidth = width; entry.shape.arc.mHeight = height; entry.shape.arc.mStartAngle = startAngle; entry.shape.arc.mSweepAngle = sweepAngle; entry.shape.arc.mUseCenter = useCenter; PathTexture* texture = get(entry); if (!texture) { SkPath path; SkRect r; r.set(0.0f, 0.0f, width, height); if (useCenter) { path.moveTo(r.centerX(), r.centerY()); } path.arcTo(r, startAngle, sweepAngle, !useCenter); if (useCenter) { path.close(); } texture = addTexture(entry, &path, paint); } return texture; }
void onDrawContent(SkCanvas* canvas) override { SkScalar angle = fAngle*SK_ScalarPI + SkScalarHalf(SK_ScalarPI); SkPoint center = SkPoint::Make(SkScalarHalf(this->width()), SkScalarHalf(this->height())); SkScalar length = 5; SkScalar step = angle; SkPath path; path.moveTo(center); while (length < (SkScalarHalf(SkMinScalar(this->width(), this->height())) - 10.f)) { SkPoint rp = SkPoint::Make(length*SkScalarCos(step) + center.fX, length*SkScalarSin(step) + center.fY); path.lineTo(rp); length += SkScalarDiv(angle, SkScalarHalf(SK_ScalarPI)); step += angle; } path.close(); SkPaint paint; paint.setAntiAlias(true); paint.setStyle(SkPaint::kStroke_Style); paint.setColor(0xFF007700); canvas->drawPath(path, paint); }
void FatBits::drawTriangle(SkCanvas* canvas, SkPoint pts[3]) { SkPaint paint; fInverse.mapPoints(pts, 3); if (fGrid) { apply_grid(pts, 3); } SkPath path; path.moveTo(pts[0]); path.lineTo(pts[1]); path.lineTo(pts[2]); path.close(); erase(fMinSurface.get()); this->setupPaint(&paint); paint.setColor(FAT_PIXEL_COLOR); fMinSurface->getCanvas()->drawPath(path, paint); this->copyMinToMax(); SkCanvas* max = fMaxSurface->getCanvas(); fMatrix.mapPoints(pts, 3); this->drawTriangleSkeleton(max, pts); fMaxSurface->draw(canvas, 0, 0, nullptr); }
void ACanvasSkia::FillPolygon(APoint* pts,int count) { if( count == 1 ) { _clip(); _SetPaint_Fill(); m_pCanvas->drawPoint(SkIntToScalar(pts[0].x),SkIntToScalar(pts[0].y),m_Paint); Reset(); } else if( count < 1 ) { //do nothing } else { _SetPaint_Fill(); SkPath path; path.moveTo(SkIntToScalar(pts[0].x),SkIntToScalar(pts[0].y)); for(int i=1;i<count;i++) { //path.moveTo(SkIntToScalar(pts[i].x),SkIntToScalar(pts[i].y)); path.lineTo(SkIntToScalar(pts[i].x),SkIntToScalar(pts[i].y)); } path.close(); m_pCanvas->drawPath(path,m_Paint); } }
static SkPath make_path() { SkPath path; int numOps = R(30); for (int i = 0; i < numOps; ++i) { switch (R(6)) { case 0: path.moveTo(make_scalar(), make_scalar()); break; case 1: path.lineTo(make_scalar(), make_scalar()); break; case 2: path.quadTo(make_scalar(), make_scalar(), make_scalar(), make_scalar()); break; case 3: path.conicTo(make_scalar(), make_scalar(), make_scalar(), make_scalar(), make_scalar()); break; case 4: path.cubicTo(make_scalar(), make_scalar(), make_scalar(), make_scalar(), make_scalar(), make_scalar()); break; case 5: default: path.arcTo(make_scalar(), make_scalar(), make_scalar(), make_scalar(), make_scalar()); break; } } path.close(); return path; }
/* Two invariants are tested: How does an empty/degenerate path draw? * - if the path is drawn inverse, it should draw everywhere * - if the path is drawn non-inverse, it should draw nowhere * * Things to iterate on: * - path (empty, degenerate line/quad/cubic w/ and w/o close * - paint style * - path filltype * - path stroke variants (e.g. caps, joins, width) */ static void test_emptydrawing(skiatest::Reporter* reporter) { static void (*gMakeProc[])(SkPath*) = { make_empty, make_M, make_MM, make_MZM, make_L, make_Q, make_C }; static SkPath::FillType gFills[] = { SkPath::kWinding_FillType, SkPath::kEvenOdd_FillType, SkPath::kInverseWinding_FillType, SkPath::kInverseEvenOdd_FillType }; for (int doClose = 0; doClose < 2; ++doClose) { for (size_t i = 0; i < SK_ARRAY_COUNT(gMakeProc); ++i) { SkPath path; gMakeProc[i](&path); if (doClose) { path.close(); } for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) { path.setFillType(gFills[fill]); bool shouldDraw = path.isInverseFillType(); iter_paint(reporter, path, shouldDraw); } } } }
static SkPoint AddMoveLineClose(SkPath& path, SkPoint& startPt) { SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); path.moveTo(moveToPt); path.lineTo(endPt); path.close(); return endPt; }
static SkPath make_convex_path() { SkPath path; path.lineTo(100, 0); path.lineTo(50, 100); path.close(); return path; }
static void testLine1() { SkPath path; path.moveTo(2,0); path.lineTo(1,1); path.lineTo(0,0); path.close(); test(path); }
// Make an equilateral triangle path with its top corner at (originX, originY) static SkPath make_tri_path(SkScalar originX, SkScalar originY) { SkPath tri; tri.moveTo(originX, originY); tri.rLineTo(SkScalarHalf(kTriSide), 1.5f * kTriSide / kRoot3); tri.rLineTo(-kTriSide, 0); tri.close(); return tri; }
SkPath SubsetContours::getSubsetPath() const { SkPath result; result.setFillType(fPath.getFillType()); if (!fSelected.count()) { return result; } SkPath::RawIter iter(fPath); uint8_t verb; SkPoint pts[4]; int contourCount = 0; bool enabled = fSelected[0]; bool addMoveTo = true; while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { if (enabled && addMoveTo) { result.moveTo(pts[0]); addMoveTo = false; } switch (verb) { case SkPath::kMove_Verb: break; case SkPath::kLine_Verb: if (enabled) { result.lineTo(pts[1]); } break; case SkPath::kQuad_Verb: if (enabled) { result.quadTo(pts[1], pts[2]); } break; case SkPath::kConic_Verb: if (enabled) { result.conicTo(pts[1], pts[2], iter.conicWeight()); } break; case SkPath::kCubic_Verb: if (enabled) { result.cubicTo(pts[1], pts[2], pts[3]); } break; case SkPath::kClose_Verb: if (enabled) { result.close(); } if (++contourCount >= fSelected.count()) { break; } enabled = fSelected[contourCount]; addMoveTo = true; continue; default: SkDEBUGFAIL("bad verb"); return result; } } return result; }
static SkPoint AddMoveQuadClose(SkPath& path, SkPoint& startPt) { SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); SkPoint midPt = moveToPt + SkPoint::Make(20*SK_Scalar1, 5*SK_Scalar1); SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); path.moveTo(moveToPt); path.quadTo(midPt, endPt); path.close(); return endPt; }
SkPath create_convex_path(const SkPoint& offset) { SkPath convexPath; convexPath.moveTo(kMin, kMin); convexPath.lineTo(kMax, kMax); convexPath.lineTo(kMin, kMax); convexPath.close(); convexPath.offset(offset.fX, offset.fY); return convexPath; }
static SkPoint AddMoveCubicClose(SkPath& path, SkPoint& startPt) { SkPoint moveToPt = startPt + SkPoint::Make(0, 10*SK_Scalar1); SkPoint t1Pt = moveToPt + SkPoint::Make(15*SK_Scalar1, 5*SK_Scalar1); SkPoint t2Pt = moveToPt + SkPoint::Make(25*SK_Scalar1, 5*SK_Scalar1); SkPoint endPt = moveToPt + SkPoint::Make(40*SK_Scalar1, 0); path.moveTo(moveToPt); path.cubicTo(t1Pt, t2Pt, endPt); path.close(); return endPt; }
static void draw_path(SkCanvas* canvas, const SkRect& r, const SkPaint& p) { SkPath path; path.moveTo(r.fLeft, r.fTop); path.lineTo(r.fLeft, r.fBottom); path.lineTo(r.fRight, r.fBottom); path.close(); canvas->drawPath(path, p); }
// Create a hexagon centered at (originX, originY) static SkPath make_hex_path(SkScalar originX, SkScalar originY) { SkPath hex; hex.moveTo(originX-kHexSide, originY); hex.rLineTo(SkScalarHalf(kHexSide), kRoot3Over2 * kHexSide); hex.rLineTo(SkIntToScalar(kHexSide), 0); hex.rLineTo(SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2); hex.rLineTo(-SkScalarHalf(kHexSide), -kHexSide * kRoot3Over2); hex.rLineTo(-SkIntToScalar(kHexSide), 0); hex.close(); return hex; }
static void fuzz_59(skiatest::Reporter* reporter, const char* filename) { SkPath path; path.moveTo(SkBits2Float(0x430c0000), SkBits2Float(0xce58f41c)); // 140, -9.09969e+08f path.lineTo(SkBits2Float(0x43480000), SkBits2Float(0xce58f419)); // 200, -9.09969e+08f path.lineTo(SkBits2Float(0x42200000), SkBits2Float(0xce58f41b)); // 40, -9.09969e+08f path.lineTo(SkBits2Float(0x43700000), SkBits2Float(0xce58f41b)); // 240, -9.09969e+08f path.lineTo(SkBits2Float(0x428c0000), SkBits2Float(0xce58f419)); // 70, -9.09969e+08f path.lineTo(SkBits2Float(0x430c0000), SkBits2Float(0xce58f41c)); // 140, -9.09969e+08f path.close(); testSimplifyFuzz(reporter, path, filename); }
/* Generated on a Mac with: * paint.setTypeface(SkTypeface::CreateByName("Hiragino Maru Gothic Pro")); * const unsigned char hyphen[] = { 0xE3, 0x83, 0xBC }; * paint.getTextPath(hyphen, SK_ARRAY_COUNT(hyphen), 400, 80, &textPath); */ static SkPath hiragino_maru_gothic_pro_dash() { SkPath path; path.moveTo(488, 55.1f); path.cubicTo(490.5f, 55.1f, 491.9f, 53.5f, 491.9f, 50.8f); path.cubicTo(491.9f, 48.2f, 490.5f, 46.3f, 487.9f, 46.3f); path.lineTo(412, 46.3f); path.cubicTo(409.4f, 46.3f, 408, 48.2f, 408, 50.8f); path.cubicTo(408, 53.5f, 409.4f, 55.1f, 411.9f, 55.1f); path.lineTo(488, 55.1f); path.close(); return path; }
/** * Called on a background thread. Here we can only modify fBackPaths. */ void runAnimationTask(double t, double dt, int w, int h) override { const float tsec = static_cast<float>(t); this->INHERITED::runAnimationTask(t, 0.5 * dt, w, h); for (int i = 0; i < kNumPaths; ++i) { const Glyph& glyph = fGlyphs[i]; const SkMatrix& backMatrix = fBackMatrices[i]; const Sk2f matrix[3] = { Sk2f(backMatrix.getScaleX(), backMatrix.getSkewY()), Sk2f(backMatrix.getSkewX(), backMatrix.getScaleY()), Sk2f(backMatrix.getTranslateX(), backMatrix.getTranslateY()) }; SkPath* backpath = &fBackPaths[i]; backpath->reset(); backpath->setFillType(SkPath::kEvenOdd_FillType); SkPath::RawIter iter(glyph.fPath); SkPath::Verb verb; SkPoint pts[4]; while ((verb = iter.next(pts)) != SkPath::kDone_Verb) { switch (verb) { case SkPath::kMove_Verb: { SkPoint pt = fWaves.apply(tsec, matrix, pts[0]); backpath->moveTo(pt.x(), pt.y()); break; } case SkPath::kLine_Verb: { SkPoint endpt = fWaves.apply(tsec, matrix, pts[1]); backpath->lineTo(endpt.x(), endpt.y()); break; } case SkPath::kQuad_Verb: { SkPoint controlPt = fWaves.apply(tsec, matrix, pts[1]); SkPoint endpt = fWaves.apply(tsec, matrix, pts[2]); backpath->quadTo(controlPt.x(), controlPt.y(), endpt.x(), endpt.y()); break; } case SkPath::kClose_Verb: { backpath->close(); break; } case SkPath::kCubic_Verb: case SkPath::kConic_Verb: case SkPath::kDone_Verb: SK_ABORT("Unexpected path verb"); break; } } } }
void FatBits::drawTriangleSkeleton(SkCanvas* max, const SkPoint pts[]) { SkPaint paint; this->setupSkeletonPaint(&paint); SkPath path; path.moveTo(pts[0]); path.lineTo(pts[1]); path.lineTo(pts[2]); path.close(); max->drawPath(path, paint); }
static void one_d_pe(SkPaint* paint) { SkPath path; path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1])); for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1])); path.close(); path.offset(SkIntToScalar(-6), 0); scale(&path, 1.5f); paint->setPathEffect(SkPath1DPathEffect::Create(path, SkIntToScalar(21), 0, SkPath1DPathEffect::kRotate_Style))->unref(); compose_pe(paint); }
static void fuzz_drawPath(Fuzz* fuzz) { SkPaint p; init_paint(fuzz, &p); sk_sp<SkSurface> surface; init_surface(fuzz, &surface); // TODO(kjlubick): put the ability to fuzz a path in shared file, with // other common things (e.g. rects, lines) uint8_t i, j; fuzz->nextRange(&i, 0, 10); // set i to number of operations to perform SkPath path; SkScalar a, b, c, d, e, f; for (int k = 0; k < i; ++k) { fuzz->nextRange(&j, 0, 5); // set j to choose operation to perform switch (j) { case 0: fuzz->next(&a, &b); path.moveTo(a, b); break; case 1: fuzz->next(&a, &b); path.lineTo(a, b); break; case 2: fuzz->next(&a, &b, &c, &d); path.quadTo(a, b, c, d); break; case 3: fuzz->next(&a, &b, &c, &d, &e); path.conicTo(a, b, c, d, e); break; case 4: fuzz->next(&a, &b, &c, &d, &e, &f); path.cubicTo(a, b, c, d, e, f); break; case 5: fuzz->next(&a, &b, &c, &d, &e); path.arcTo(a, b, c, d, e); break; } } path.close(); SkCanvas* cnv = surface->getCanvas(); cnv->drawPath(path, p); bool bl; fuzz->next(&bl); cnv->clipPath(path, kIntersect_SkClipOp, bl); }
static bool test_pathregion() { SkPath path; SkRegion region; path.moveTo(25071800.f, -141823808.f); path.lineTo(25075500.f, -141824000.f); path.lineTo(25075400.f, -141827712.f); path.lineTo(25071810.f, -141827600.f); path.close(); SkIRect bounds; path.getBounds().round(&bounds); SkRegion clip(bounds); return region.setPath(path, clip); // <-- !! DOWN !! }
void onDrawContent(SkCanvas* canvas) override { const float SCALE = 1; canvas->translate(30, 40); canvas->scale(SCALE, SCALE); SkPoint p1 = SkPoint::Make(50, 50); SkPoint p2 = SkPoint::Make(80, 50); SkPath path; switch (fPathType) { case 0: path = quadPath(p1, p2); break; case 1: path = linSemicirclePath(p1, p2); break; case 2: path = rectPath(p1); break; default: path = quadPath(p1, p2); break; } if (fClosePath) { path.close(); } SkPaint p; p.setColor(SK_ColorRED); p.setAntiAlias(true); p.setStyle(SkPaint::kStroke_Style); p.setStrokeWidth(fStroke); canvas->drawPath(path, p); if (fDrawFillPath) { SkPath fillpath; p.getFillPath(path, &fillpath); SkPaint fillp; fillp.setColor(SK_ColorBLACK); fillp.setAntiAlias(true); fillp.setStyle(SkPaint::kStroke_Style); canvas->drawPath(fillpath, fillp); } }
static sk_sp<SkPathEffect> make_warp_pe(SkScalar phase) { SkPath path; path.moveTo(SkIntToScalar(gXY[0]), SkIntToScalar(gXY[1])); for (unsigned i = 2; i < SK_ARRAY_COUNT(gXY); i += 2) { path.lineTo(SkIntToScalar(gXY[i]), SkIntToScalar(gXY[i+1])); } path.close(); path.offset(SkIntToScalar(-6), 0); auto outer = SkPath1DPathEffect::Make( path, 12, phase, SkPath1DPathEffect::kMorph_Style); auto inner = SkCornerPathEffect::Make(SkIntToScalar(CORNER_RADIUS)); return SkComposePathEffect::Make(outer, inner); }
static void fuzz_k1(skiatest::Reporter* reporter, const char* filename) { SkPath path; path.setFillType(SkPath::kWinding_FillType); path.moveTo(SkBits2Float(0x00000000), SkBits2Float(0x00000000)); // 0, 0 path.conicTo(SkBits2Float(0x2073732f), SkBits2Float(0x73f17f00), SkBits2Float(0x737b7b73), SkBits2Float(0x73916773), SkBits2Float(0x00738773)); // 2.0621e-19f, 3.82666e+31f, 1.99245e+31f, 2.30402e+31f, 1.06097e-38f path.lineTo(SkBits2Float(0x5803736d), SkBits2Float(0x807b5ba1)); // 5.78127e+14f, -1.13286e-38f path.cubicTo(SkBits2Float(0x7b7f7f7b), SkBits2Float(0x7373737b), SkBits2Float(0x1b617380), SkBits2Float(0x48541b10), SkBits2Float(0x73817373), SkBits2Float(0x00717373)); // 1.32662e+36f, 1.92882e+31f, 1.86489e-22f, 217196, 2.05123e+31f, 1.04188e-38f path.moveTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b738364), SkBits2Float(0x73607380), SkBits2Float(0x7b738362), SkBits2Float(0x00007180), SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.26439e+36f, 1.77829e+31f, 1.26439e+36f, 4.07161e-41f, 1.92882e+31f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b737364), SkBits2Float(0x73607380), SkBits2Float(0x7b738366), SkBits2Float(0x73737380), SkBits2Float(0x73738873), SkBits2Float(0x96737353)); // 1.26407e+36f, 1.77829e+31f, 1.26439e+36f, 1.92882e+31f, 1.92947e+31f, -1.96658e-25f path.moveTo(SkBits2Float(0x00640000), SkBits2Float(0x73737373)); // 9.18355e-39f, 1.92882e+31f path.lineTo(SkBits2Float(0x40005d7b), SkBits2Float(0x58435460)); // 2.00571f, 8.59069e+14f path.cubicTo(SkBits2Float(0x7b7f7f7b), SkBits2Float(0x7373737b), SkBits2Float(0x1b617380), SkBits2Float(0x48400010), SkBits2Float(0x73817373), SkBits2Float(0x00717373)); // 1.32662e+36f, 1.92882e+31f, 1.86489e-22f, 196608, 2.05123e+31f, 1.04188e-38f path.moveTo(SkBits2Float(0x06737376), SkBits2Float(0x50001073)); // 4.5788e-35f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b737364), SkBits2Float(0x73737373), SkBits2Float(0x53737388), SkBits2Float(0x00967373), SkBits2Float(0x00640000), SkBits2Float(0x73737373)); // 1.26407e+36f, 1.92882e+31f, 1.04562e+12f, 1.38167e-38f, 9.18355e-39f, 1.92882e+31f path.lineTo(SkBits2Float(0x40005d7b), SkBits2Float(0x5843546d)); // 2.00571f, 8.59069e+14f path.cubicTo(SkBits2Float(0x7b7f7f7b), SkBits2Float(0x7373737b), SkBits2Float(0x1b617380), SkBits2Float(0x4840001e), SkBits2Float(0x73817373), SkBits2Float(0x007e7373)); // 1.32662e+36f, 1.92882e+31f, 1.86489e-22f, 196608, 2.05123e+31f, 1.16127e-38f path.moveTo(SkBits2Float(0x06737376), SkBits2Float(0x50001073)); // 4.5788e-35f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b737364), SkBits2Float(0x73607380), SkBits2Float(0x01008366), SkBits2Float(0x73737380), SkBits2Float(0x737d8873), SkBits2Float(0x7b4e7b53)); // 1.26407e+36f, 1.77829e+31f, 2.36042e-38f, 1.92882e+31f, 2.0087e+31f, 1.07211e+36f path.cubicTo(SkBits2Float(0x667b7b7b), SkBits2Float(0x73737b7b), SkBits2Float(0x73739167), SkBits2Float(0x40007387), SkBits2Float(0x5803736d), SkBits2Float(0x807b5ba1)); // 2.96898e+23f, 1.92907e+31f, 1.92974e+31f, 2.00705f, 5.78127e+14f, -1.13286e-38f path.cubicTo(SkBits2Float(0x7b7f7f7b), SkBits2Float(0x7373737b), SkBits2Float(0x1b617380), SkBits2Float(0x48401b10), SkBits2Float(0x73817373), SkBits2Float(0x00717373)); // 1.32662e+36f, 1.92882e+31f, 1.86489e-22f, 196716, 2.05123e+31f, 1.04188e-38f path.moveTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b737364), SkBits2Float(0x73607380), SkBits2Float(0x7b738366), SkBits2Float(0x00007180), SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.26407e+36f, 1.77829e+31f, 1.26439e+36f, 4.07161e-41f, 1.92882e+31f, 8.59425e+09f path.cubicTo(SkBits2Float(0x7b737364), SkBits2Float(0x73607380), SkBits2Float(0x79738366), SkBits2Float(0x79797979), SkBits2Float(0xff000079), SkBits2Float(0xf2f2f2ff)); // 1.26407e+36f, 1.77829e+31f, 7.90246e+34f, 8.09591e+34f, -1.70144e+38f, -9.62421e+30f path.cubicTo(SkBits2Float(0x6579796a), SkBits2Float(0x79795979), SkBits2Float(0x4d4d7b57), SkBits2Float(0x4d574d66), SkBits2Float(0x7968ac4d), SkBits2Float(0x79797979)); // 7.36318e+22f, 8.09185e+34f, 2.15463e+08f, 2.25761e+08f, 7.55067e+34f, 8.09591e+34f path.quadTo(SkBits2Float(0xf2f27b79), SkBits2Float(0x867b9c7b), SkBits2Float(0xddf2f2f2), SkBits2Float(0x1379796a)); // -9.60571e+30f, -4.73228e-35f, -2.18829e+18f, 3.14881e-27f path.lineTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.close(); path.moveTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.quadTo(SkBits2Float(0xe7797979), SkBits2Float(0xf2794d4d), SkBits2Float(0x79a8ddf2), SkBits2Float(0x13132513)); // -1.17811e+24f, -4.93793e+30f, 1.09601e+35f, 1.85723e-27f path.lineTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.close(); path.moveTo(SkBits2Float(0x7373739a), SkBits2Float(0x50001073)); // 1.92882e+31f, 8.59425e+09f path.quadTo(SkBits2Float(0x7b9c7b79), SkBits2Float(0xf4f2d886), SkBits2Float(0xf4f4f4f4), SkBits2Float(0xf4f4f4f4)); // 1.62501e+36f, -1.53922e+32f, -1.5526e+32f, -1.5526e+32f testSimplifyFuzz(reporter, path, filename); }
void skiaDrawTriangle(caskbench_context_t *ctx, shapes_t *args) { // Temporarily disable anti-aliasing to work around crash in GlShader ctx->skia_paint->setAntiAlias(false); path.reset(); path.moveTo(args->x, args->y + 2*args->radius); path.rLineTo(2*args->radius, 0); path.rLineTo(-args->radius, -2*args->radius); path.close(); ctx->skia_canvas->drawPath(path, *(ctx->skia_paint)); ctx->skia_paint->setAntiAlias(true); }
static void test_pathregion() { SkPath path; SkRegion region; path.moveTo(25071800.f, -141823808.f); path.lineTo(25075500.f, -141824000.f); path.lineTo(25075400.f, -141827712.f); path.lineTo(25071810.f, -141827600.f); path.close(); SkIRect bounds; path.getBounds().round(&bounds); SkRegion clip(bounds); bool result = region.setPath(path, clip); // <-- !! DOWN !! SkDebugf("----- result %d\n", result); }
SkPath create_concave_path(const SkPoint& offset) { SkPath concavePath; concavePath.moveTo(kMin, kMin); concavePath.lineTo(kMid, 105.0f); concavePath.lineTo(kMax, kMin); concavePath.lineTo(295.0f, kMid); concavePath.lineTo(kMax, kMax); concavePath.lineTo(kMid, 295.0f); concavePath.lineTo(kMin, kMax); concavePath.lineTo(105.0f, kMid); concavePath.close(); concavePath.offset(offset.fX, offset.fY); return concavePath; }