99 auto gp = this->
makeGP(*caps, arena);
108 std::move(appliedClip),
110 std::move(fProcessorSet),
112 renderPassXferBarriers,
126 flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds);
127 flushState->bindTextures(fProgramInfo->
geomProc(),
nullptr, fProgramInfo->
pipeline());
128 flushState->drawMesh(*
fMesh);
153 const char*
name() const final {
return "BezierConicTestOp"; }
159 return GrOp::Make<BezierConicTestOp>(context,
rect,
color, klm);
186 Vertex* verts =
reinterpret_cast<Vertex*
>(helper.vertices());
192 for (
int v = 0; v < 4; ++v) {
197 fMesh = helper.mesh();
202 inline static constexpr int kVertsPerCubic = 4;
203 inline static constexpr int kIndicesPerCubic = 6;
215 this->setBGColor(0xFFFFFFFF);
230 *errorMsg = kErrorMsg_DrawSkippedGpuOnly;
238 { { 0.31f *
w, 0.01f *
h}, { 0.48f *
w, 0.74f *
h }, { 0.19f *
w, 0.33f *
h } },
239 { { 0.00f *
w, 0.07f *
h}, { 0.30f *
w, 0.70f *
h }, { 0.47f *
w, 0.37f *
h } },
240 { { 0.15f *
w, 0.23f *
h}, { 0.49f *
w, 0.87f *
h }, { 0.85f *
w, 0.66f *
h } },
241 { { 0.09f *
w, 0.15f *
h}, { 0.42f *
w, 0.33f *
h }, { 0.17f *
w, 0.38f *
h } },
242 { { 0.98f *
w, 0.54f *
h}, { 0.83f *
w, 0.91f *
h }, { 0.62f *
w, 0.40f *
h } },
243 { { 0.96f *
w, 0.65f *
h}, { 0.03f *
w, 0.79f *
h }, { 0.24f *
w, 0.56f *
h } },
244 { { 0.57f *
w, 0.12f *
h}, { 0.33f *
w, 0.67f *
h }, { 0.59f *
w, 0.33f *
h } },
245 { { 0.12f *
w, 0.72f *
h}, { 0.69f *
w, 0.85f *
h }, { 0.46f *
w, 0.32f *
h } },
246 { { 0.27f *
w, 0.49f *
h}, { 0.41f *
w, 0.02f *
h }, { 0.11f *
w, 0.42f *
h } },
247 { { 0.40f *
w, 0.13f *
h}, { 0.83f *
w, 0.30f *
h }, { 0.31f *
w, 0.68f *
h } },
250 0.66f, 0.15f, 0.14f, 0.61f, 1.4f };
273 {
x + baseControlPts[row][0].
fX,
y + baseControlPts[row][0].
fY},
274 {
x + baseControlPts[row][1].
fX,
y + baseControlPts[row][1].
fY},
275 {
x + baseControlPts[row][2].
fX,
y + baseControlPts[row][2].
fY}
278 for (
int i = 0;
i < 3; ++
i) {
279 canvas->
drawCircle(controlPts[
i], 6.f, ctrlPtPaint);
286 int cnt = ChopConic(controlPts,
dst, weights[row]);
289 for (
int c = 0; c < cnt; ++c) {
291 for (
int i = 0;
i < 3; ++
i) {
302 sdc->addDrawOp(std::move(op));
317 if (t == 0 || t == 1) {
340 int conicCnt = SplitConic(
src, dstTemp, weight);
342 int conicCnt2 = SplitConic(dstTemp[0].
fPts,
dst, dstTemp[0].fW);
343 conicCnt = conicCnt2 + SplitConic(dstTemp[1].
fPts, &
dst[conicCnt2], dstTemp[1].fW);
350 using INHERITED = GM;
358 const char*
name()
const override {
return "BezierQuadTestOp"; }
364 return GrOp::Make<BezierQuadTestOp>(context,
rect,
color, devToUV);
373 , fDevToUV(devToUV) {}
392 Vertex* verts =
reinterpret_cast<Vertex*
>(helper.vertices());
400 fMesh = helper.mesh();
405 inline static constexpr int kVertsPerCubic = 4;
406 inline static constexpr int kIndicesPerCubic = 6;
417 this->setBGColor(0xFFFFFFFF);
432 *errorMsg = kErrorMsg_DrawSkippedGpuOnly;
440 { { 0.31f *
w, 0.01f *
h}, { 0.48f *
w, 0.74f *
h }, { 0.19f *
w, 0.33f *
h } },
441 { { 0.00f *
w, 0.07f *
h}, { 0.30f *
w, 0.70f *
h }, { 0.47f *
w, 0.37f *
h } },
442 { { 0.15f *
w, 0.23f *
h}, { 0.49f *
w, 0.87f *
h }, { 0.85f *
w, 0.66f *
h } },
443 { { 0.09f *
w, 0.15f *
h}, { 0.42f *
w, 0.33f *
h }, { 0.17f *
w, 0.38f *
h } },
444 { { 0.98f *
w, 0.54f *
h}, { 0.83f *
w, 0.91f *
h }, { 0.62f *
w, 0.40f *
h } },
463 for (
int row = 0; row <
kNumQuads; ++row) {
467 {
x + baseControlPts[row][0].
fX,
y + baseControlPts[row][0].
fY},
468 {
x + baseControlPts[row][1].
fX,
y + baseControlPts[row][1].
fY},
469 {
x + baseControlPts[row][2].
fX,
y + baseControlPts[row][2].
fY}
472 for (
int i = 0;
i < 3; ++
i) {
473 canvas->
drawCircle(controlPts[
i], 6.f, ctrlPtPaint);
481 for (
int c = 0; c < cnt; ++c) {
482 SkPoint* pts = chopped + 2 * c;
484 for (
int i = 0;
i < 3; ++
i) {
497 sdc->addDrawOp(std::move(op));
505 using INHERITED =
GM;
508DEF_GM(
return new BezierConicEffects;)
509DEF_GM(
return new BezierQuadEffects;)
#define DEFINE_OP_CLASS_ID
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
constexpr SkColor SK_ColorRED
SkScalar SkFindQuadMaxCurvature(const SkPoint src[3])
int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
static GrGeometryProcessor * Make(SkArenaAlloc *arena, const SkPMColor4f &color, const SkMatrix &viewMatrix, const GrCaps &caps, const SkMatrix &localMatrix, bool usesLocalCoords, uint8_t coverage=0xff)
void createProgramInfo(const GrCaps *caps, SkArenaAlloc *arena, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&appliedClip, const GrDstProxyView &dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
GrMeshDrawOp(uint32_t classID)
std::unique_ptr< GrOp > Owner
void setBounds(const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
void apply(void *vertices, int vertexCount, size_t stride, size_t uvOffset) const
void visitProxies(const GrVisitProxyFunc &) const
Analysis finalize(const GrProcessorAnalysisColor &, const GrProcessorAnalysisCoverage, const GrAppliedClip *, const GrUserStencilSettings *, const GrCaps &, GrClampType, SkPMColor4f *inputColorOverride)
const GrPipeline & pipeline() const
const GrGeometryProcessor & geomProc() const
void visitFPProxies(const GrVisitProxyFunc &func) const
static GrGeometryProcessor * Make(SkArenaAlloc *arena, const SkPMColor4f &color, const SkMatrix &viewMatrix, const GrCaps &caps, const SkMatrix &localMatrix, bool usesLocalCoords, uint8_t coverage=0xff)
static GrProgramInfo * CreateProgramInfo(const GrCaps *, SkArenaAlloc *, const GrPipeline *, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrGeometryProcessor *, GrPrimitiveType, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp, const GrUserStencilSettings *=&GrUserStencilSettings::kUnused)
void drawRect(const SkRect &rect, const SkPaint &paint)
void drawPoints(PointMode mode, size_t count, const SkPoint pts[], const SkPaint &paint)
@ kPolygon_PointMode
draw the array of points as a open polygon
void drawCircle(SkScalar cx, SkScalar cy, SkScalar radius, const SkPaint &paint)
void mapHomogeneousPoints(SkPoint3 dst[], const SkPoint3 src[], int count) const
static const SkMatrix & I()
void setStyle(Style style)
void setColor(SkColor color)
@ kStroke_Style
set to stroke geometry
void setStrokeWidth(SkScalar width)
static void SetRectTriStrip(SkPoint v[], SkScalar l, SkScalar t, SkScalar r, SkScalar b, size_t stride)
static const int kCellHeight
SkString getName() const override
static const int kNumConics
DrawResult onDraw(GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg) override
SkISize getISize() override
static const int kCellWidth
DEFINE_OP_CLASS_ID const char * name() const final
static GrOp::Owner Make(GrRecordingContext *context, const SkRect &rect, const SkPMColor4f &color, const SkMatrix &klm)
DrawResult onDraw(GrRecordingContext *rContext, SkCanvas *canvas, SkString *errorMsg) override
static const int kCellWidth
SkString getName() const override
static const int kNumQuads
SkISize getISize() override
static const int kCellHeight
DEFINE_OP_CLASS_ID const char * name() const override
static GrOp::Owner Make(GrRecordingContext *context, const SkRect &rect, const SkPMColor4f &color, const GrPathUtils::QuadUVMatrix &devToUV)
const SkRect & rect() const
void visitProxies(const GrVisitProxyFunc &func) const override
void onExecute(GrOpFlushState *flushState, const SkRect &chainBounds) final
void onCreateProgramInfo(const GrCaps *caps, SkArenaAlloc *arena, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&appliedClip, const GrDstProxyView &dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) override
BezierTestOp(const SkRect &rect, const SkPMColor4f &color, int32_t classID)
GrProcessorSet::Analysis finalize(const GrCaps &caps, const GrAppliedClip *clip, GrClampType clampType) override
GrProgramInfo * programInfo() override
FixedFunctionFlags fixedFunctionFlags() const override
virtual GrGeometryProcessor * makeGP(const GrCaps &caps, SkArenaAlloc *arena)=0
const SkPMColor4f & color() const
FlutterSemanticsFlag flags
void getConicKLM(const SkPoint p[3], const SkScalar weight, SkMatrix *klm)
Optional< SkRect > bounds
constexpr int kOpaqueBlack
SurfaceDrawContext * TopDeviceSurfaceDrawContext(const SkCanvas *canvas)
DEF_GM(return F(C(clipbox), 0.0f, 0.0f, {})) DEF_GM(return F(C(clipbox)
static const GrUserStencilSettings & kUnused
static constexpr SkISize Make(int32_t w, int32_t h)
constexpr float y() const
constexpr float x() const
static SkRGBA4f FromBytes_RGBA(uint32_t color)