commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2013 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 | // This test only works with the GPU backend. |
| 9 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 10 | #include "gm/gm.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 11 | #include "include/core/SkBlendMode.h" |
| 12 | #include "include/core/SkCanvas.h" |
| 13 | #include "include/core/SkMatrix.h" |
| 14 | #include "include/core/SkPaint.h" |
| 15 | #include "include/core/SkPoint.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 16 | #include "include/core/SkPoint3.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 17 | #include "include/core/SkRect.h" |
| 18 | #include "include/core/SkRefCnt.h" |
| 19 | #include "include/core/SkScalar.h" |
| 20 | #include "include/core/SkSize.h" |
| 21 | #include "include/core/SkString.h" |
| 22 | #include "include/core/SkTypes.h" |
Robert Phillips | b7bfbc2 | 2020-07-01 12:55:01 -0400 | [diff] [blame] | 23 | #include "include/gpu/GrRecordingContext.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 24 | #include "include/private/GrSharedEnums.h" |
| 25 | #include "include/private/GrTypesPriv.h" |
| 26 | #include "include/private/SkColorData.h" |
| 27 | #include "include/utils/SkRandom.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 28 | #include "src/core/SkGeometry.h" |
| 29 | #include "src/core/SkPointPriv.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 30 | #include "src/gpu/GrCaps.h" |
Adlai Holler | a069304 | 2020-10-14 11:23:11 -0400 | [diff] [blame^] | 31 | #include "src/gpu/GrDirectContextPriv.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 32 | #include "src/gpu/GrGeometryProcessor.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 33 | #include "src/gpu/GrMemoryPool.h" |
| 34 | #include "src/gpu/GrOpFlushState.h" |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 35 | #include "src/gpu/GrOpsRenderPass.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 36 | #include "src/gpu/GrPaint.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 37 | #include "src/gpu/GrProcessorAnalysis.h" |
| 38 | #include "src/gpu/GrProcessorSet.h" |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 39 | #include "src/gpu/GrProgramInfo.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 40 | #include "src/gpu/GrRecordingContextPriv.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 41 | #include "src/gpu/GrRenderTargetContext.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 42 | #include "src/gpu/GrRenderTargetContextPriv.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 43 | #include "src/gpu/GrUserStencilSettings.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 44 | #include "src/gpu/effects/GrBezierEffect.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 45 | #include "src/gpu/effects/GrPorterDuffXferProcessor.h" |
Michael Ludwig | 663afe5 | 2019-06-03 16:46:19 -0400 | [diff] [blame] | 46 | #include "src/gpu/geometry/GrPathUtils.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 47 | #include "src/gpu/ops/GrDrawOp.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 48 | #include "src/gpu/ops/GrMeshDrawOp.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 49 | #include "src/gpu/ops/GrOp.h" |
Robert Phillips | 3968fcb | 2019-12-05 16:40:31 -0500 | [diff] [blame] | 50 | #include "src/gpu/ops/GrSimpleMeshDrawOpHelper.h" |
Ben Wagner | 6a34f3a | 2019-05-01 10:59:30 -0400 | [diff] [blame] | 51 | |
| 52 | #include <memory> |
| 53 | #include <utility> |
| 54 | |
| 55 | class GrAppliedClip; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 56 | |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 57 | namespace skiagm { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 58 | |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 59 | class BezierTestOp : public GrMeshDrawOp { |
| 60 | public: |
| 61 | FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } |
| 62 | |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 63 | GrProcessorSet::Analysis finalize( |
| 64 | const GrCaps& caps, const GrAppliedClip* clip, bool hasMixedSampledCoverage, |
| 65 | GrClampType clampType) override { |
Chris Dalton | b8fff0d | 2019-03-05 10:11:58 -0700 | [diff] [blame] | 66 | return fProcessorSet.finalize( |
| 67 | fColor, GrProcessorAnalysisCoverage::kSingleChannel, clip, |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 68 | &GrUserStencilSettings::kUnused, hasMixedSampledCoverage, caps, clampType, &fColor); |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 69 | } |
| 70 | |
Chris Dalton | 1706cbf | 2019-05-21 19:35:29 -0600 | [diff] [blame] | 71 | void visitProxies(const VisitProxyFunc& func) const override { |
Robert Phillips | 4f93c57 | 2020-03-18 08:13:53 -0400 | [diff] [blame] | 72 | if (fProgramInfo) { |
| 73 | fProgramInfo->visitFPProxies(func); |
| 74 | } else { |
| 75 | fProcessorSet.visitProxies(func); |
| 76 | } |
Robert Phillips | b493eeb | 2017-09-13 13:10:52 -0400 | [diff] [blame] | 77 | } |
| 78 | |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 79 | protected: |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 80 | BezierTestOp(const SkRect& rect, const SkPMColor4f& color, int32_t classID) |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 81 | : INHERITED(classID) |
| 82 | , fRect(rect) |
| 83 | , fColor(color) |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 84 | , fProcessorSet(SkBlendMode::kSrc) { |
Greg Daniel | 5faf474 | 2019-10-01 15:14:44 -0400 | [diff] [blame] | 85 | this->setBounds(rect, HasAABloat::kYes, IsHairline::kNo); |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 86 | } |
| 87 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 88 | virtual GrGeometryProcessor* makeGP(const GrCaps& caps, SkArenaAlloc* arena) = 0; |
Robert Phillips | 3968fcb | 2019-12-05 16:40:31 -0500 | [diff] [blame] | 89 | |
Robert Phillips | 2669a7b | 2020-03-12 12:07:19 -0400 | [diff] [blame] | 90 | GrProgramInfo* programInfo() override { return fProgramInfo; } |
| 91 | |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 92 | void onCreateProgramInfo(const GrCaps* caps, |
| 93 | SkArenaAlloc* arena, |
Brian Salomon | 8afde5f | 2020-04-01 16:22:00 -0400 | [diff] [blame] | 94 | const GrSurfaceProxyView* writeView, |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 95 | GrAppliedClip&& appliedClip, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 96 | const GrXferProcessor::DstProxyView& dstProxyView, |
| 97 | GrXferBarrierFlags renderPassXferBarriers) override { |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 98 | auto gp = this->makeGP(*caps, arena); |
| 99 | if (!gp) { |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 100 | return; |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | GrPipeline::InputFlags flags = GrPipeline::InputFlags::kNone; |
| 104 | |
Brian Salomon | 8afde5f | 2020-04-01 16:22:00 -0400 | [diff] [blame] | 105 | fProgramInfo = GrSimpleMeshDrawOpHelper::CreateProgramInfo(caps, arena, writeView, |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 106 | std::move(appliedClip), |
| 107 | dstProxyView, gp, |
| 108 | std::move(fProcessorSet), |
| 109 | GrPrimitiveType::kTriangles, |
Greg Daniel | d358cbe | 2020-09-11 09:33:54 -0400 | [diff] [blame] | 110 | renderPassXferBarriers, |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 111 | flags); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 112 | } |
| 113 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 114 | void onExecute(GrOpFlushState* flushState, const SkRect& chainBounds) final { |
| 115 | if (!fProgramInfo) { |
Robert Phillips | 4133dc4 | 2020-03-11 15:55:55 -0400 | [diff] [blame] | 116 | this->createProgramInfo(flushState); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | if (!fProgramInfo) { |
| 120 | return; |
| 121 | } |
| 122 | |
Chris Dalton | 765ed36 | 2020-03-16 17:34:44 -0600 | [diff] [blame] | 123 | flushState->bindPipelineAndScissorClip(*fProgramInfo, chainBounds); |
| 124 | flushState->bindTextures(fProgramInfo->primProc(), nullptr, fProgramInfo->pipeline()); |
| 125 | flushState->drawMesh(*fMesh); |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 126 | } |
| 127 | |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 128 | const SkRect& rect() const { return fRect; } |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 129 | const SkPMColor4f& color() const { return fColor; } |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 130 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 131 | protected: |
Chris Dalton | eb694b7 | 2020-03-16 09:25:50 -0600 | [diff] [blame] | 132 | GrSimpleMesh* fMesh = nullptr; // filled in by the derived classes |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 133 | |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 134 | private: |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 135 | SkRect fRect; |
| 136 | SkPMColor4f fColor; |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 137 | GrProcessorSet fProcessorSet; |
| 138 | GrProgramInfo* fProgramInfo = nullptr; |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 139 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 140 | using INHERITED = GrMeshDrawOp; |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 141 | }; |
| 142 | |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 143 | /** |
| 144 | * This GM directly exercises effects that draw Bezier curves in the GPU backend. |
| 145 | */ |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 146 | class BezierConicTestOp : public BezierTestOp { |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 147 | public: |
| 148 | DEFINE_OP_CLASS_ID |
| 149 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 150 | const char* name() const final { return "BezierConicTestOp"; } |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 151 | |
Robert Phillips | be9aff2 | 2019-02-15 11:33:22 -0500 | [diff] [blame] | 152 | static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context, |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 153 | const SkRect& rect, |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 154 | const SkPMColor4f& color, |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 155 | const SkMatrix& klm) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 156 | GrOpMemoryPool* pool = context->priv().opMemoryPool(); |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 157 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 158 | return pool->allocate<BezierConicTestOp>(rect, color, klm); |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 159 | } |
| 160 | |
| 161 | private: |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 162 | friend class ::GrOpMemoryPool; // for ctor |
| 163 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 164 | BezierConicTestOp(const SkRect& rect, const SkPMColor4f& color, const SkMatrix& klm) |
| 165 | : INHERITED(rect, color, ClassID()) |
| 166 | , fKLM(klm) {} |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 167 | |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 168 | struct Vertex { |
| 169 | SkPoint fPosition; |
| 170 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 171 | }; |
| 172 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 173 | GrGeometryProcessor* makeGP(const GrCaps& caps, SkArenaAlloc* arena) final { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 174 | auto tmp = GrConicEffect::Make(arena, this->color(), SkMatrix::I(), caps, SkMatrix::I(), |
| 175 | false); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 176 | if (!tmp) { |
| 177 | return nullptr; |
Robert Phillips | 7cd0bfe | 2019-11-20 16:08:10 -0500 | [diff] [blame] | 178 | } |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 179 | SkASSERT(tmp->vertexStride() == sizeof(Vertex)); |
| 180 | return tmp; |
| 181 | } |
Robert Phillips | 7cd0bfe | 2019-11-20 16:08:10 -0500 | [diff] [blame] | 182 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 183 | void onPrepareDraws(Target* target) final { |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame] | 184 | QuadHelper helper(target, sizeof(Vertex), 1); |
| 185 | Vertex* verts = reinterpret_cast<Vertex*>(helper.vertices()); |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 186 | if (!verts) { |
| 187 | return; |
| 188 | } |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 189 | SkRect rect = this->rect(); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 190 | SkPointPriv::SetRectTriStrip(&verts[0].fPosition, rect, sizeof(Vertex)); |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 191 | for (int v = 0; v < 4; ++v) { |
Cary Clark | e4442cb | 2017-10-18 11:46:18 -0400 | [diff] [blame] | 192 | SkPoint3 pt3 = {verts[v].fPosition.x(), verts[v].fPosition.y(), 1.f}; |
| 193 | fKLM.mapHomogeneousPoints((SkPoint3* ) verts[v].fKLM, &pt3, 1); |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 194 | } |
Chris Dalton | 07cdcfc9 | 2019-02-26 11:13:22 -0700 | [diff] [blame] | 195 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 196 | fMesh = helper.mesh(); |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 197 | } |
| 198 | |
| 199 | SkMatrix fKLM; |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 200 | |
| 201 | static constexpr int kVertsPerCubic = 4; |
| 202 | static constexpr int kIndicesPerCubic = 6; |
| 203 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 204 | using INHERITED = BezierTestOp; |
Chris Dalton | febbffa | 2017-06-08 13:12:02 -0600 | [diff] [blame] | 205 | }; |
| 206 | |
| 207 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 208 | /** |
| 209 | * This GM directly exercises effects that draw Bezier curves in the GPU backend. |
| 210 | */ |
Chris Dalton | 3a77837 | 2019-02-07 15:23:36 -0700 | [diff] [blame] | 211 | class BezierConicEffects : public GpuGM { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 212 | public: |
| 213 | BezierConicEffects() { |
| 214 | this->setBGColor(0xFFFFFFFF); |
| 215 | } |
| 216 | |
| 217 | protected: |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 218 | static const int kNumConics = 10; |
| 219 | static const int kCellWidth = 128; |
| 220 | static const int kCellHeight = 128; |
| 221 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 222 | SkString onShortName() override { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 223 | return SkString("bezier_conic_effects"); |
| 224 | } |
| 225 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 226 | SkISize onISize() override { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 227 | return SkISize::Make(kCellWidth, kNumConics*kCellHeight); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 228 | } |
| 229 | |
Robert Phillips | 95c250c | 2020-06-29 15:36:12 -0400 | [diff] [blame] | 230 | void onDraw(GrRecordingContext* context, GrRenderTargetContext* renderTargetContext, |
Chris Dalton | 3a77837 | 2019-02-07 15:23:36 -0700 | [diff] [blame] | 231 | SkCanvas* canvas) override { |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 232 | |
| 233 | const SkScalar w = kCellWidth, h = kCellHeight; |
| 234 | const SkPMColor4f kOpaqueBlack = SkPMColor4f::FromBytes_RGBA(0xff000000); |
| 235 | |
| 236 | const SkPoint baseControlPts[kNumConics][3] = { |
| 237 | { { 0.31f * w, 0.01f * h}, { 0.48f * w, 0.74f * h }, { 0.19f * w, 0.33f * h } }, |
| 238 | { { 0.00f * w, 0.07f * h}, { 0.30f * w, 0.70f * h }, { 0.47f * w, 0.37f * h } }, |
| 239 | { { 0.15f * w, 0.23f * h}, { 0.49f * w, 0.87f * h }, { 0.85f * w, 0.66f * h } }, |
| 240 | { { 0.09f * w, 0.15f * h}, { 0.42f * w, 0.33f * h }, { 0.17f * w, 0.38f * h } }, |
| 241 | { { 0.98f * w, 0.54f * h}, { 0.83f * w, 0.91f * h }, { 0.62f * w, 0.40f * h } }, |
| 242 | { { 0.96f * w, 0.65f * h}, { 0.03f * w, 0.79f * h }, { 0.24f * w, 0.56f * h } }, |
| 243 | { { 0.57f * w, 0.12f * h}, { 0.33f * w, 0.67f * h }, { 0.59f * w, 0.33f * h } }, |
| 244 | { { 0.12f * w, 0.72f * h}, { 0.69f * w, 0.85f * h }, { 0.46f * w, 0.32f * h } }, |
| 245 | { { 0.27f * w, 0.49f * h}, { 0.41f * w, 0.02f * h }, { 0.11f * w, 0.42f * h } }, |
| 246 | { { 0.40f * w, 0.13f * h}, { 0.83f * w, 0.30f * h }, { 0.31f * w, 0.68f * h } }, |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 247 | }; |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 248 | const SkScalar weights[kNumConics] = { 0.62f, 0.01f, 0.95f, 1.48f, 0.37f, |
| 249 | 0.66f, 0.15f, 0.14f, 0.61f, 1.4f }; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 250 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 251 | SkPaint ctrlPtPaint; |
| 252 | ctrlPtPaint.setColor(SK_ColorRED); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 253 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 254 | SkPaint choppedPtPaint; |
| 255 | choppedPtPaint.setColor(~ctrlPtPaint.getColor() | 0xFF000000); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 256 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 257 | SkPaint polyPaint; |
| 258 | polyPaint.setColor(0xffA0A0A0); |
| 259 | polyPaint.setStrokeWidth(0); |
| 260 | polyPaint.setStyle(SkPaint::kStroke_Style); |
| 261 | |
| 262 | SkPaint boundsPaint; |
| 263 | boundsPaint.setColor(0xff808080); |
| 264 | boundsPaint.setStrokeWidth(0); |
| 265 | boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 266 | |
| 267 | |
| 268 | for (int row = 0; row < kNumConics; ++row) { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 269 | SkScalar x = 0; |
| 270 | SkScalar y = row * h; |
| 271 | SkPoint controlPts[] = { |
| 272 | {x + baseControlPts[row][0].fX, y + baseControlPts[row][0].fY}, |
| 273 | {x + baseControlPts[row][1].fX, y + baseControlPts[row][1].fY}, |
| 274 | {x + baseControlPts[row][2].fX, y + baseControlPts[row][2].fY} |
| 275 | }; |
commit-bot@chromium.org | cabf4b2 | 2014-03-05 18:27:43 +0000 | [diff] [blame] | 276 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 277 | for (int i = 0; i < 3; ++i) { |
| 278 | canvas->drawCircle(controlPts[i], 6.f, ctrlPtPaint); |
| 279 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 280 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 281 | canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, controlPts, polyPaint); |
| 282 | |
| 283 | SkConic dst[4]; |
| 284 | SkMatrix klm; |
| 285 | int cnt = ChopConic(controlPts, dst, weights[row]); |
| 286 | GrPathUtils::getConicKLM(controlPts, weights[row], &klm); |
| 287 | |
| 288 | for (int c = 0; c < cnt; ++c) { |
| 289 | SkPoint* pts = dst[c].fPts; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 290 | for (int i = 0; i < 3; ++i) { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 291 | canvas->drawCircle(pts[i], 3.f, choppedPtPaint); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 292 | } |
| 293 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 294 | SkRect bounds; |
| 295 | bounds.setBounds(pts, 3); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 296 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 297 | canvas->drawRect(bounds, boundsPaint); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 298 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 299 | std::unique_ptr<GrDrawOp> op = BezierConicTestOp::Make(context, bounds, |
| 300 | kOpaqueBlack, klm); |
| 301 | renderTargetContext->priv().testingOnly_addDrawOp(std::move(op)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 302 | } |
| 303 | } |
| 304 | } |
| 305 | |
| 306 | private: |
| 307 | // Uses the max curvature function for quads to estimate |
| 308 | // where to chop the conic. If the max curvature is not |
| 309 | // found along the curve segment it will return 1 and |
| 310 | // dst[0] is the original conic. If it returns 2 the dst[0] |
| 311 | // and dst[1] are the two new conics. |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 312 | static int SplitConic(const SkPoint src[3], SkConic dst[2], const SkScalar weight) { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 313 | SkScalar t = SkFindQuadMaxCurvature(src); |
Chris Dalton | 1d474dd | 2018-07-24 01:08:31 -0600 | [diff] [blame] | 314 | if (t == 0 || t == 1) { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 315 | if (dst) { |
| 316 | dst[0].set(src, weight); |
| 317 | } |
| 318 | return 1; |
| 319 | } else { |
| 320 | if (dst) { |
| 321 | SkConic conic; |
| 322 | conic.set(src, weight); |
caryclark | 414c429 | 2016-09-26 11:03:54 -0700 | [diff] [blame] | 323 | if (!conic.chopAt(t, dst)) { |
| 324 | dst[0].set(src, weight); |
| 325 | return 1; |
| 326 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 327 | } |
| 328 | return 2; |
| 329 | } |
| 330 | } |
| 331 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 332 | // Calls SplitConic on the entire conic and then once more on each subsection. |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 333 | // Most cases will result in either 1 conic (chop point is not within t range) |
| 334 | // or 3 points (split once and then one subsection is split again). |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 335 | static int ChopConic(const SkPoint src[3], SkConic dst[4], const SkScalar weight) { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 336 | SkConic dstTemp[2]; |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 337 | int conicCnt = SplitConic(src, dstTemp, weight); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 338 | if (2 == conicCnt) { |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 339 | int conicCnt2 = SplitConic(dstTemp[0].fPts, dst, dstTemp[0].fW); |
| 340 | conicCnt = conicCnt2 + SplitConic(dstTemp[1].fPts, &dst[conicCnt2], dstTemp[1].fW); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 341 | } else { |
| 342 | dst[0] = dstTemp[0]; |
| 343 | } |
| 344 | return conicCnt; |
| 345 | } |
| 346 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 347 | using INHERITED = GM; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 348 | }; |
| 349 | |
| 350 | ////////////////////////////////////////////////////////////////////////////// |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 351 | |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 352 | class BezierQuadTestOp : public BezierTestOp { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 353 | public: |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 354 | DEFINE_OP_CLASS_ID |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 355 | const char* name() const override { return "BezierQuadTestOp"; } |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 356 | |
Michael Ludwig | 28b0c5d | 2019-12-19 14:51:00 -0500 | [diff] [blame] | 357 | static std::unique_ptr<GrDrawOp> Make(GrRecordingContext* context, |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 358 | const SkRect& rect, |
Brian Osman | cf86085 | 2018-10-31 14:04:39 -0400 | [diff] [blame] | 359 | const SkPMColor4f& color, |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 360 | const GrPathUtils::QuadUVMatrix& devToUV) { |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 361 | GrOpMemoryPool* pool = context->priv().opMemoryPool(); |
Robert Phillips | c994a93 | 2018-06-19 13:09:54 -0400 | [diff] [blame] | 362 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 363 | return pool->allocate<BezierQuadTestOp>(rect, color, devToUV); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 364 | } |
| 365 | |
| 366 | private: |
Robert Phillips | 7c525e6 | 2018-06-12 10:11:12 -0400 | [diff] [blame] | 367 | friend class ::GrOpMemoryPool; // for ctor |
| 368 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 369 | BezierQuadTestOp(const SkRect& rect, const SkPMColor4f& color, |
| 370 | const GrPathUtils::QuadUVMatrix& devToUV) |
| 371 | : INHERITED(rect, color, ClassID()) |
| 372 | , fDevToUV(devToUV) {} |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 373 | |
| 374 | struct Vertex { |
| 375 | SkPoint fPosition; |
| 376 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 377 | }; |
| 378 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 379 | GrGeometryProcessor* makeGP(const GrCaps& caps, SkArenaAlloc* arena) final { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 380 | auto tmp = GrQuadEffect::Make(arena, this->color(), SkMatrix::I(), caps, SkMatrix::I(), |
| 381 | false); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 382 | if (!tmp) { |
| 383 | return nullptr; |
Robert Phillips | 7cd0bfe | 2019-11-20 16:08:10 -0500 | [diff] [blame] | 384 | } |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 385 | SkASSERT(tmp->vertexStride() == sizeof(Vertex)); |
| 386 | return tmp; |
| 387 | } |
Robert Phillips | 7cd0bfe | 2019-11-20 16:08:10 -0500 | [diff] [blame] | 388 | |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 389 | void onPrepareDraws(Target* target) final { |
Brian Salomon | 7eae3e0 | 2018-08-07 14:02:38 +0000 | [diff] [blame] | 390 | QuadHelper helper(target, sizeof(Vertex), 1); |
| 391 | Vertex* verts = reinterpret_cast<Vertex*>(helper.vertices()); |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 392 | if (!verts) { |
joshualitt | 4b31de8 | 2015-03-05 14:33:41 -0800 | [diff] [blame] | 393 | return; |
| 394 | } |
Brian Salomon | 477d0ef | 2017-07-14 10:12:26 -0400 | [diff] [blame] | 395 | SkRect rect = this->rect(); |
Brian Salomon | ec42e15 | 2018-05-18 12:52:22 -0400 | [diff] [blame] | 396 | SkPointPriv::SetRectTriStrip(&verts[0].fPosition, rect, sizeof(Vertex)); |
Brian Osman | 568bec7 | 2018-12-26 16:48:25 -0500 | [diff] [blame] | 397 | fDevToUV.apply(verts, 4, sizeof(Vertex), sizeof(SkPoint)); |
Robert Phillips | ce97857 | 2020-02-28 11:56:44 -0500 | [diff] [blame] | 398 | |
| 399 | fMesh = helper.mesh(); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 400 | } |
| 401 | |
Brian Salomon | 9e50f7b | 2017-03-06 12:02:34 -0500 | [diff] [blame] | 402 | GrPathUtils::QuadUVMatrix fDevToUV; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 403 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 404 | static constexpr int kVertsPerCubic = 4; |
| 405 | static constexpr int kIndicesPerCubic = 6; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 406 | |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 407 | using INHERITED = BezierTestOp; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 408 | }; |
| 409 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 410 | /** |
| 411 | * This GM directly exercises effects that draw Bezier quad curves in the GPU backend. |
| 412 | */ |
Chris Dalton | 3a77837 | 2019-02-07 15:23:36 -0700 | [diff] [blame] | 413 | class BezierQuadEffects : public GpuGM { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 414 | public: |
| 415 | BezierQuadEffects() { |
| 416 | this->setBGColor(0xFFFFFFFF); |
| 417 | } |
| 418 | |
| 419 | protected: |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 420 | static const int kNumQuads = 5; |
| 421 | static const int kCellWidth = 128; |
| 422 | static const int kCellHeight = 128; |
| 423 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 424 | SkString onShortName() override { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 425 | return SkString("bezier_quad_effects"); |
| 426 | } |
| 427 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 428 | SkISize onISize() override { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 429 | return SkISize::Make(kCellWidth, kNumQuads*kCellHeight); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 430 | } |
| 431 | |
Robert Phillips | 95c250c | 2020-06-29 15:36:12 -0400 | [diff] [blame] | 432 | void onDraw(GrRecordingContext* context, GrRenderTargetContext* renderTargetContext, |
Chris Dalton | 3a77837 | 2019-02-07 15:23:36 -0700 | [diff] [blame] | 433 | SkCanvas* canvas) override { |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 434 | |
| 435 | const SkScalar w = kCellWidth, h = kCellHeight; |
| 436 | const SkPMColor4f kOpaqueBlack = SkPMColor4f::FromBytes_RGBA(0xff000000); |
| 437 | |
| 438 | const SkPoint baseControlPts[kNumQuads][3] = { |
| 439 | { { 0.31f * w, 0.01f * h}, { 0.48f * w, 0.74f * h }, { 0.19f * w, 0.33f * h } }, |
| 440 | { { 0.00f * w, 0.07f * h}, { 0.30f * w, 0.70f * h }, { 0.47f * w, 0.37f * h } }, |
| 441 | { { 0.15f * w, 0.23f * h}, { 0.49f * w, 0.87f * h }, { 0.85f * w, 0.66f * h } }, |
| 442 | { { 0.09f * w, 0.15f * h}, { 0.42f * w, 0.33f * h }, { 0.17f * w, 0.38f * h } }, |
| 443 | { { 0.98f * w, 0.54f * h}, { 0.83f * w, 0.91f * h }, { 0.62f * w, 0.40f * h } }, |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 444 | }; |
| 445 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 446 | SkPaint ctrlPtPaint; |
| 447 | ctrlPtPaint.setColor(SK_ColorRED); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 448 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 449 | SkPaint choppedPtPaint; |
| 450 | choppedPtPaint.setColor(~ctrlPtPaint.getColor() | 0xFF000000); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 451 | |
Robert Phillips | 98f3fd9 | 2019-11-21 13:16:21 -0500 | [diff] [blame] | 452 | SkPaint polyPaint; |
| 453 | polyPaint.setColor(0xffA0A0A0); |
| 454 | polyPaint.setStrokeWidth(0); |
| 455 | polyPaint.setStyle(SkPaint::kStroke_Style); |
| 456 | |
| 457 | SkPaint boundsPaint; |
| 458 | boundsPaint.setColor(0xff808080); |
| 459 | boundsPaint.setStrokeWidth(0); |
| 460 | boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 461 | |
| 462 | for (int row = 0; row < kNumQuads; ++row) { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 463 | SkScalar x = 0; |
| 464 | SkScalar y = row * h; |
| 465 | SkPoint controlPts[] = { |
| 466 | {x + baseControlPts[row][0].fX, y + baseControlPts[row][0].fY}, |
| 467 | {x + baseControlPts[row][1].fX, y + baseControlPts[row][1].fY}, |
| 468 | {x + baseControlPts[row][2].fX, y + baseControlPts[row][2].fY} |
| 469 | }; |
commit-bot@chromium.org | cabf4b2 | 2014-03-05 18:27:43 +0000 | [diff] [blame] | 470 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 471 | for (int i = 0; i < 3; ++i) { |
| 472 | canvas->drawCircle(controlPts[i], 6.f, ctrlPtPaint); |
| 473 | } |
| 474 | |
| 475 | canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, controlPts, polyPaint); |
| 476 | |
| 477 | SkPoint chopped[5]; |
| 478 | int cnt = SkChopQuadAtMaxCurvature(controlPts, chopped); |
| 479 | |
| 480 | for (int c = 0; c < cnt; ++c) { |
| 481 | SkPoint* pts = chopped + 2 * c; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 482 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 483 | for (int i = 0; i < 3; ++i) { |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 484 | canvas->drawCircle(pts[i], 3.f, choppedPtPaint); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 485 | } |
| 486 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 487 | SkRect bounds; |
| 488 | bounds.setBounds(pts, 3); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 489 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 490 | canvas->drawRect(bounds, boundsPaint); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 491 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 492 | GrPathUtils::QuadUVMatrix DevToUV(pts); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 493 | |
John Stiles | 3b2c06c | 2020-06-17 12:45:57 -0400 | [diff] [blame] | 494 | std::unique_ptr<GrDrawOp> op = BezierQuadTestOp::Make(context, bounds, |
| 495 | kOpaqueBlack, DevToUV); |
| 496 | renderTargetContext->priv().testingOnly_addDrawOp(std::move(op)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 497 | } |
| 498 | } |
| 499 | } |
| 500 | |
| 501 | private: |
John Stiles | 7571f9e | 2020-09-02 22:42:33 -0400 | [diff] [blame] | 502 | using INHERITED = GM; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 503 | }; |
| 504 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 505 | DEF_GM(return new BezierConicEffects;) |
| 506 | DEF_GM(return new BezierQuadEffects;) |
John Stiles | a6841be | 2020-08-06 14:11:56 -0400 | [diff] [blame] | 507 | } // namespace skiagm |