Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2017 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 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 8 | #include "include/core/SkTypes.h" |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 9 | |
| 10 | #if SK_SUPPORT_GPU |
| 11 | |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 12 | #include "include/core/SkCanvas.h" |
| 13 | #include "include/core/SkPaint.h" |
| 14 | #include "include/core/SkPath.h" |
| 15 | #include "samplecode/Sample.h" |
| 16 | #include "src/core/SkMakeUnique.h" |
| 17 | #include "src/core/SkRectPriv.h" |
| 18 | #include "src/gpu/GrClip.h" |
| 19 | #include "src/gpu/GrContextPriv.h" |
| 20 | #include "src/gpu/GrMemoryPool.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 21 | #include "src/gpu/GrRenderTargetContext.h" |
| 22 | #include "src/gpu/GrRenderTargetContextPriv.h" |
| 23 | #include "src/gpu/GrResourceProvider.h" |
| 24 | #include "src/gpu/ccpr/GrCCCoverageProcessor.h" |
| 25 | #include "src/gpu/ccpr/GrCCFillGeometry.h" |
| 26 | #include "src/gpu/ccpr/GrCCStroker.h" |
| 27 | #include "src/gpu/ccpr/GrGSCoverageProcessor.h" |
| 28 | #include "src/gpu/ccpr/GrVSCoverageProcessor.h" |
Michael Ludwig | 663afe5 | 2019-06-03 16:46:19 -0400 | [diff] [blame] | 29 | #include "src/gpu/geometry/GrPathUtils.h" |
Mike Klein | c0bd9f9 | 2019-04-23 12:05:21 -0500 | [diff] [blame] | 30 | #include "src/gpu/gl/GrGLGpu.h" |
| 31 | #include "src/gpu/glsl/GrGLSLFragmentProcessor.h" |
| 32 | #include "src/gpu/ops/GrDrawOp.h" |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 33 | |
Chris Dalton | 84403d7 | 2018-02-13 21:46:17 -0500 | [diff] [blame] | 34 | using TriPointInstance = GrCCCoverageProcessor::TriPointInstance; |
| 35 | using QuadPointInstance = GrCCCoverageProcessor::QuadPointInstance; |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 36 | using PrimitiveType = GrCCCoverageProcessor::PrimitiveType; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 37 | |
Chris Dalton | a640c49 | 2017-09-11 22:04:03 -0700 | [diff] [blame] | 38 | static constexpr float kDebugBloat = 40; |
| 39 | |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 40 | /** |
| 41 | * This sample visualizes the AA bloat geometry generated by the ccpr geometry shaders. It |
| 42 | * increases the AA bloat by 50x and outputs color instead of coverage (coverage=+1 -> green, |
| 43 | * coverage=0 -> black, coverage=-1 -> red). Use the keys 1-7 to cycle through the different |
| 44 | * geometry processors. |
| 45 | */ |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 46 | class CCPRGeometryView : public Sample { |
Hal Canary | d7639af | 2019-07-17 09:08:11 -0400 | [diff] [blame] | 47 | void onOnceBeforeDraw() override { this->updateGpuData(); } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 48 | void onDrawContent(SkCanvas*) override; |
| 49 | |
Hal Canary | b1f411a | 2019-08-29 10:39:22 -0400 | [diff] [blame] | 50 | Sample::Click* onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) override; |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 51 | bool onClick(Sample::Click*) override; |
Hal Canary | 6cc65e1 | 2019-07-03 15:53:04 -0400 | [diff] [blame] | 52 | bool onChar(SkUnichar) override; |
Hal Canary | 8a02731 | 2019-07-03 10:55:44 -0400 | [diff] [blame] | 53 | SkString name() override { return SkString("CCPRGeometry"); } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 54 | |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 55 | class Click; |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 56 | class DrawCoverageCountOp; |
| 57 | class VisualizeCoverageCountFP; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 58 | |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 59 | void updateAndInval() { this->updateGpuData(); } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 60 | |
| 61 | void updateGpuData(); |
| 62 | |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 63 | PrimitiveType fPrimitiveType = PrimitiveType::kTriangles; |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 64 | SkCubicType fCubicType; |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 65 | SkMatrix fCubicKLM; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 66 | |
| 67 | SkPoint fPoints[4] = { |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 68 | {100.05f, 100.05f}, {400.75f, 100.05f}, {400.75f, 300.95f}, {100.05f, 300.95f}}; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 69 | |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 70 | float fConicWeight = .5; |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 71 | float fStrokeWidth = 40; |
| 72 | bool fDoStroke = false; |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 73 | |
Chris Dalton | 84403d7 | 2018-02-13 21:46:17 -0500 | [diff] [blame] | 74 | SkTArray<TriPointInstance> fTriPointInstances; |
| 75 | SkTArray<QuadPointInstance> fQuadPointInstances; |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 76 | SkPath fPath; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 77 | }; |
| 78 | |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 79 | class CCPRGeometryView::DrawCoverageCountOp : public GrDrawOp { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 80 | DEFINE_OP_CLASS_ID |
| 81 | |
| 82 | public: |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 83 | DrawCoverageCountOp(CCPRGeometryView* view) : INHERITED(ClassID()), fView(view) { |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 84 | this->setBounds(SkRect::MakeIWH(fView->width(), fView->height()), GrOp::HasAABloat::kNo, |
Greg Daniel | 5faf474 | 2019-10-01 15:14:44 -0400 | [diff] [blame] | 85 | GrOp::IsHairline::kNo); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 86 | } |
| 87 | |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 88 | const char* name() const override { |
| 89 | return "[Testing/Sample code] CCPRGeometryView::DrawCoverageCountOp"; |
| 90 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 91 | |
| 92 | private: |
| 93 | FixedFunctionFlags fixedFunctionFlags() const override { return FixedFunctionFlags::kNone; } |
Chris Dalton | 6ce447a | 2019-06-23 18:07:38 -0600 | [diff] [blame] | 94 | GrProcessorSet::Analysis finalize(const GrCaps&, const GrAppliedClip*, |
| 95 | bool hasMixedSampledCoverage, GrClampType) override { |
Chris Dalton | 4b62aed | 2019-01-15 11:53:00 -0700 | [diff] [blame] | 96 | return GrProcessorSet::EmptySetAnalysis(); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 97 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 98 | void onPrepare(GrOpFlushState*) override {} |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 99 | void onExecute(GrOpFlushState*, const SkRect& chainBounds) override; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 100 | |
| 101 | CCPRGeometryView* fView; |
| 102 | |
| 103 | typedef GrDrawOp INHERITED; |
| 104 | }; |
| 105 | |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 106 | class CCPRGeometryView::VisualizeCoverageCountFP : public GrFragmentProcessor { |
| 107 | public: |
| 108 | VisualizeCoverageCountFP() : GrFragmentProcessor(kTestFP_ClassID, kNone_OptimizationFlags) {} |
| 109 | |
| 110 | private: |
| 111 | const char* name() const override { |
| 112 | return "[Testing/Sample code] CCPRGeometryView::VisualizeCoverageCountFP"; |
| 113 | } |
| 114 | std::unique_ptr<GrFragmentProcessor> clone() const override { |
| 115 | return skstd::make_unique<VisualizeCoverageCountFP>(); |
| 116 | } |
| 117 | void onGetGLSLProcessorKey(const GrShaderCaps&, GrProcessorKeyBuilder*) const override {} |
| 118 | bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
| 119 | |
| 120 | class Impl : public GrGLSLFragmentProcessor { |
| 121 | void emitCode(EmitArgs& args) override { |
| 122 | GrGLSLFPFragmentBuilder* f = args.fFragBuilder; |
| 123 | f->codeAppendf("half count = %s.a;", args.fInputColor); |
| 124 | f->codeAppendf("%s = half4(clamp(-count, 0, 1), clamp(+count, 0, 1), 0, abs(count));", |
| 125 | args.fOutputColor); |
| 126 | } |
| 127 | }; |
| 128 | |
| 129 | GrGLSLFragmentProcessor* onCreateGLSLInstance() const override { return new Impl; } |
| 130 | }; |
| 131 | |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 132 | static void draw_klm_line(int w, int h, SkCanvas* canvas, const SkScalar line[3], SkColor color) { |
| 133 | SkPoint p1, p2; |
| 134 | if (SkScalarAbs(line[1]) > SkScalarAbs(line[0])) { |
| 135 | // Draw from vertical edge to vertical edge. |
| 136 | p1 = {0, -line[2] / line[1]}; |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 137 | p2 = {(SkScalar)w, (-line[2] - w * line[0]) / line[1]}; |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 138 | } else { |
| 139 | // Draw from horizontal edge to horizontal edge. |
| 140 | p1 = {-line[2] / line[0], 0}; |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 141 | p2 = {(-line[2] - h * line[1]) / line[0], (SkScalar)h}; |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 142 | } |
| 143 | |
| 144 | SkPaint linePaint; |
| 145 | linePaint.setColor(color); |
| 146 | linePaint.setAlpha(128); |
| 147 | linePaint.setStyle(SkPaint::kStroke_Style); |
| 148 | linePaint.setStrokeWidth(0); |
| 149 | linePaint.setAntiAlias(true); |
| 150 | canvas->drawLine(p1, p2, linePaint); |
| 151 | } |
| 152 | |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 153 | void CCPRGeometryView::onDrawContent(SkCanvas* canvas) { |
Chris Dalton | 8738cf4 | 2018-03-09 11:57:40 -0700 | [diff] [blame] | 154 | canvas->clear(SK_ColorBLACK); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 155 | |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 156 | if (!fDoStroke) { |
| 157 | SkPaint outlinePaint; |
| 158 | outlinePaint.setColor(0x80ffffff); |
| 159 | outlinePaint.setStyle(SkPaint::kStroke_Style); |
| 160 | outlinePaint.setStrokeWidth(0); |
| 161 | outlinePaint.setAntiAlias(true); |
| 162 | canvas->drawPath(fPath, outlinePaint); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 163 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 164 | |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 165 | #if 0 |
| 166 | SkPaint gridPaint; |
| 167 | gridPaint.setColor(0x10000000); |
| 168 | gridPaint.setStyle(SkPaint::kStroke_Style); |
| 169 | gridPaint.setStrokeWidth(0); |
| 170 | gridPaint.setAntiAlias(true); |
Chris Dalton | a640c49 | 2017-09-11 22:04:03 -0700 | [diff] [blame] | 171 | for (int y = 0; y < this->height(); y += kDebugBloat) { |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 172 | canvas->drawLine(0, y, this->width(), y, gridPaint); |
| 173 | } |
Chris Dalton | a640c49 | 2017-09-11 22:04:03 -0700 | [diff] [blame] | 174 | for (int x = 0; x < this->width(); x += kDebugBloat) { |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 175 | canvas->drawLine(x, 0, x, this->height(), outlinePaint); |
| 176 | } |
| 177 | #endif |
| 178 | |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 179 | SkString caption; |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 180 | if (GrRenderTargetContext* rtc = canvas->internal_private_accessTopLayerRenderTargetContext()) { |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 181 | // Render coverage count. |
| 182 | GrContext* ctx = canvas->getGrContext(); |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 183 | SkASSERT(ctx); |
| 184 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 185 | GrOpMemoryPool* pool = ctx->priv().opMemoryPool(); |
Ben Wagner | d4bffed | 2018-08-14 17:51:23 -0400 | [diff] [blame] | 186 | |
Brian Salomon | bf6b979 | 2019-08-21 09:38:10 -0400 | [diff] [blame] | 187 | auto ccbuff = ctx->priv().makeDeferredRenderTargetContext(SkBackingFit::kApprox, |
| 188 | this->width(), this->height(), |
| 189 | GrColorType::kAlpha_F16, nullptr); |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 190 | SkASSERT(ccbuff); |
Brian Osman | 9a9baae | 2018-11-05 15:06:26 -0500 | [diff] [blame] | 191 | ccbuff->clear(nullptr, SK_PMColor4fTRANSPARENT, |
| 192 | GrRenderTargetContext::CanClearFullscreen::kYes); |
Ben Wagner | d4bffed | 2018-08-14 17:51:23 -0400 | [diff] [blame] | 193 | ccbuff->priv().testingOnly_addDrawOp(pool->allocate<DrawCoverageCountOp>(this)); |
Chris Dalton | 8d38a7f | 2018-03-19 14:16:44 -0600 | [diff] [blame] | 194 | |
| 195 | // Visualize coverage count in main canvas. |
| 196 | GrPaint paint; |
| 197 | paint.addColorFragmentProcessor( |
| 198 | GrSimpleTextureEffect::Make(sk_ref_sp(ccbuff->asTextureProxy()), SkMatrix::I())); |
| 199 | paint.addColorFragmentProcessor( |
| 200 | skstd::make_unique<VisualizeCoverageCountFP>()); |
| 201 | paint.setPorterDuffXPFactory(SkBlendMode::kSrcOver); |
| 202 | rtc->drawRect(GrNoClip(), std::move(paint), GrAA::kNo, SkMatrix::I(), |
| 203 | SkRect::MakeIWH(this->width(), this->height())); |
| 204 | |
| 205 | // Add label. |
Chris Dalton | 703b476 | 2018-04-06 16:11:48 -0600 | [diff] [blame] | 206 | caption.appendf("PrimitiveType_%s", |
| 207 | GrCCCoverageProcessor::PrimitiveTypeName(fPrimitiveType)); |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 208 | if (PrimitiveType::kCubics == fPrimitiveType) { |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 209 | caption.appendf(" (%s)", SkCubicTypeName(fCubicType)); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 210 | } else if (PrimitiveType::kConics == fPrimitiveType) { |
| 211 | caption.appendf(" (w=%f)", fConicWeight); |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 212 | } |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 213 | if (fDoStroke) { |
| 214 | caption.appendf(" (stroke_width=%f)", fStrokeWidth); |
| 215 | } |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 216 | } else { |
| 217 | caption = "Use GPU backend to visualize geometry."; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 218 | } |
| 219 | |
| 220 | SkPaint pointsPaint; |
| 221 | pointsPaint.setColor(SK_ColorBLUE); |
| 222 | pointsPaint.setStrokeWidth(8); |
| 223 | pointsPaint.setAntiAlias(true); |
| 224 | |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 225 | if (PrimitiveType::kCubics == fPrimitiveType) { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 226 | canvas->drawPoints(SkCanvas::kPoints_PointMode, 4, fPoints, pointsPaint); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 227 | if (!fDoStroke) { |
| 228 | int w = this->width(), h = this->height(); |
| 229 | draw_klm_line(w, h, canvas, &fCubicKLM[0], SK_ColorYELLOW); |
| 230 | draw_klm_line(w, h, canvas, &fCubicKLM[3], SK_ColorBLUE); |
| 231 | draw_klm_line(w, h, canvas, &fCubicKLM[6], SK_ColorRED); |
| 232 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 233 | } else { |
| 234 | canvas->drawPoints(SkCanvas::kPoints_PointMode, 2, fPoints, pointsPaint); |
| 235 | canvas->drawPoints(SkCanvas::kPoints_PointMode, 1, fPoints + 3, pointsPaint); |
| 236 | } |
| 237 | |
Hal Canary | 4484b8f | 2019-01-08 14:00:08 -0500 | [diff] [blame] | 238 | SkFont font(nullptr, 20); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 239 | SkPaint captionPaint; |
Chris Dalton | 8738cf4 | 2018-03-09 11:57:40 -0700 | [diff] [blame] | 240 | captionPaint.setColor(SK_ColorWHITE); |
Hal Canary | 4484b8f | 2019-01-08 14:00:08 -0500 | [diff] [blame] | 241 | canvas->drawString(caption, 10, 30, font, captionPaint); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 242 | } |
| 243 | |
| 244 | void CCPRGeometryView::updateGpuData() { |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 245 | using Verb = GrCCFillGeometry::Verb; |
Chris Dalton | 84403d7 | 2018-02-13 21:46:17 -0500 | [diff] [blame] | 246 | fTriPointInstances.reset(); |
| 247 | fQuadPointInstances.reset(); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 248 | |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 249 | fPath.reset(); |
| 250 | fPath.moveTo(fPoints[0]); |
| 251 | |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 252 | if (PrimitiveType::kCubics == fPrimitiveType) { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 253 | double t[2], s[2]; |
Chris Dalton | be4ffab | 2017-12-08 10:59:58 -0700 | [diff] [blame] | 254 | fCubicType = GrPathUtils::getCubicKLM(fPoints, &fCubicKLM, t, s); |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 255 | GrCCFillGeometry geometry; |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 256 | geometry.beginContour(fPoints[0]); |
Chris Dalton | 7ca3b7b | 2018-04-10 00:21:19 -0600 | [diff] [blame] | 257 | geometry.cubicTo(fPoints, kDebugBloat / 2, kDebugBloat / 2); |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 258 | geometry.endContour(); |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 259 | int ptsIdx = 0; |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 260 | for (Verb verb : geometry.verbs()) { |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 261 | switch (verb) { |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 262 | case Verb::kLineTo: |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 263 | ++ptsIdx; |
| 264 | continue; |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 265 | case Verb::kMonotonicQuadraticTo: |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 266 | ptsIdx += 2; |
| 267 | continue; |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 268 | case Verb::kMonotonicCubicTo: |
Chris Dalton | 84403d7 | 2018-02-13 21:46:17 -0500 | [diff] [blame] | 269 | fQuadPointInstances.push_back().set(&geometry.points()[ptsIdx], 0, 0); |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 270 | ptsIdx += 3; |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 271 | continue; |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 272 | default: |
| 273 | continue; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 274 | } |
| 275 | } |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 276 | fPath.cubicTo(fPoints[1], fPoints[2], fPoints[3]); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 277 | } else if (PrimitiveType::kTriangles != fPrimitiveType) { |
Chris Dalton | 7ca3b7b | 2018-04-10 00:21:19 -0600 | [diff] [blame] | 278 | SkPoint P3[3] = {fPoints[0], fPoints[1], fPoints[3]}; |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 279 | GrCCFillGeometry geometry; |
Chris Dalton | 7ca3b7b | 2018-04-10 00:21:19 -0600 | [diff] [blame] | 280 | geometry.beginContour(P3[0]); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 281 | if (PrimitiveType::kQuadratics == fPrimitiveType) { |
| 282 | geometry.quadraticTo(P3); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 283 | fPath.quadTo(fPoints[1], fPoints[3]); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 284 | } else { |
| 285 | SkASSERT(PrimitiveType::kConics == fPrimitiveType); |
| 286 | geometry.conicTo(P3, fConicWeight); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 287 | fPath.conicTo(fPoints[1], fPoints[3], fConicWeight); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 288 | } |
Chris Dalton | c1e5963 | 2017-09-05 00:30:07 -0600 | [diff] [blame] | 289 | geometry.endContour(); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 290 | int ptsIdx = 0, conicWeightIdx = 0; |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 291 | for (Verb verb : geometry.verbs()) { |
| 292 | if (Verb::kBeginContour == verb || |
| 293 | Verb::kEndOpenContour == verb || |
| 294 | Verb::kEndClosedContour == verb) { |
Chris Dalton | c1e5963 | 2017-09-05 00:30:07 -0600 | [diff] [blame] | 295 | continue; |
| 296 | } |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 297 | if (Verb::kLineTo == verb) { |
Chris Dalton | 90e8fb1 | 2017-12-22 02:24:53 -0700 | [diff] [blame] | 298 | ++ptsIdx; |
| 299 | continue; |
| 300 | } |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 301 | SkASSERT(Verb::kMonotonicQuadraticTo == verb || Verb::kMonotonicConicTo == verb); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 302 | if (PrimitiveType::kQuadratics == fPrimitiveType && |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 303 | Verb::kMonotonicQuadraticTo == verb) { |
Chris Dalton | c3318f0 | 2019-07-19 14:20:53 -0600 | [diff] [blame] | 304 | fTriPointInstances.push_back().set( |
| 305 | &geometry.points()[ptsIdx], Sk2f(0, 0), |
| 306 | TriPointInstance::Ordering::kXYTransposed); |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 307 | } else if (PrimitiveType::kConics == fPrimitiveType && |
Chris Dalton | e163969 | 2018-08-20 14:00:30 -0600 | [diff] [blame] | 308 | Verb::kMonotonicConicTo == verb) { |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 309 | fQuadPointInstances.push_back().setW(&geometry.points()[ptsIdx], Sk2f(0, 0), |
| 310 | geometry.getConicWeight(conicWeightIdx++)); |
| 311 | } |
Chris Dalton | a3e9271 | 2017-12-04 11:45:51 -0700 | [diff] [blame] | 312 | ptsIdx += 2; |
Chris Dalton | b072bb6 | 2017-08-07 09:00:46 -0600 | [diff] [blame] | 313 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 314 | } else { |
Chris Dalton | c3318f0 | 2019-07-19 14:20:53 -0600 | [diff] [blame] | 315 | fTriPointInstances.push_back().set( |
| 316 | fPoints[0], fPoints[1], fPoints[3], Sk2f(0, 0), |
| 317 | TriPointInstance::Ordering::kXYTransposed); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 318 | fPath.lineTo(fPoints[1]); |
| 319 | fPath.lineTo(fPoints[3]); |
| 320 | fPath.close(); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 321 | } |
| 322 | } |
| 323 | |
Brian Salomon | 588cec7 | 2018-11-14 13:56:37 -0500 | [diff] [blame] | 324 | void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state, |
| 325 | const SkRect& chainBounds) { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 326 | GrResourceProvider* rp = state->resourceProvider(); |
| 327 | GrContext* context = state->gpu()->getContext(); |
Robert Phillips | 4217ea7 | 2019-01-30 13:08:28 -0500 | [diff] [blame] | 328 | GrGLGpu* glGpu = GrBackendApi::kOpenGL == context->backend() |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 329 | ? static_cast<GrGLGpu*>(state->gpu()) |
| 330 | : nullptr; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 331 | if (glGpu) { |
| 332 | glGpu->handleDirtyContext(); |
Chris Dalton | 8738cf4 | 2018-03-09 11:57:40 -0700 | [diff] [blame] | 333 | // GR_GL_CALL(glGpu->glInterface(), PolygonMode(GR_GL_FRONT_AND_BACK, GR_GL_LINE)); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 334 | GR_GL_CALL(glGpu->glInterface(), Enable(GR_GL_LINE_SMOOTH)); |
| 335 | } |
| 336 | |
Greg Daniel | 2c3398d | 2019-06-19 11:58:01 -0400 | [diff] [blame] | 337 | GrPipeline pipeline(GrScissorTest::kDisabled, SkBlendMode::kPlus, |
Robert Phillips | 405413f | 2019-10-04 10:39:28 -0400 | [diff] [blame^] | 338 | state->drawOpArgs().outputSwizzle()); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 339 | |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 340 | std::unique_ptr<GrCCCoverageProcessor> proc; |
| 341 | if (state->caps().shaderCaps()->geometryShaderSupport()) { |
| 342 | proc = skstd::make_unique<GrGSCoverageProcessor>(); |
| 343 | } else { |
| 344 | proc = skstd::make_unique<GrVSCoverageProcessor>(); |
| 345 | } |
| 346 | |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 347 | if (!fView->fDoStroke) { |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 348 | proc->reset(fView->fPrimitiveType, rp); |
| 349 | SkDEBUGCODE(proc->enableDebugBloat(kDebugBloat)); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 350 | |
| 351 | SkSTArray<1, GrMesh> mesh; |
| 352 | if (PrimitiveType::kCubics == fView->fPrimitiveType || |
| 353 | PrimitiveType::kConics == fView->fPrimitiveType) { |
Brian Salomon | dbf7072 | 2019-02-07 11:31:24 -0500 | [diff] [blame] | 354 | sk_sp<GrGpuBuffer> instBuff( |
Brian Salomon | ae64c19 | 2019-02-05 09:41:37 -0500 | [diff] [blame] | 355 | rp->createBuffer(fView->fQuadPointInstances.count() * sizeof(QuadPointInstance), |
| 356 | GrGpuBufferType::kVertex, kDynamic_GrAccessPattern, |
Brian Salomon | ae64c19 | 2019-02-05 09:41:37 -0500 | [diff] [blame] | 357 | fView->fQuadPointInstances.begin())); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 358 | if (!fView->fQuadPointInstances.empty() && instBuff) { |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 359 | proc->appendMesh(std::move(instBuff), fView->fQuadPointInstances.count(), 0, &mesh); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 360 | } |
| 361 | } else { |
Brian Salomon | dbf7072 | 2019-02-07 11:31:24 -0500 | [diff] [blame] | 362 | sk_sp<GrGpuBuffer> instBuff( |
Brian Salomon | ae64c19 | 2019-02-05 09:41:37 -0500 | [diff] [blame] | 363 | rp->createBuffer(fView->fTriPointInstances.count() * sizeof(TriPointInstance), |
| 364 | GrGpuBufferType::kVertex, kDynamic_GrAccessPattern, |
Brian Salomon | ae64c19 | 2019-02-05 09:41:37 -0500 | [diff] [blame] | 365 | fView->fTriPointInstances.begin())); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 366 | if (!fView->fTriPointInstances.empty() && instBuff) { |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 367 | proc->appendMesh(std::move(instBuff), fView->fTriPointInstances.count(), 0, &mesh); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 368 | } |
| 369 | } |
| 370 | |
| 371 | if (!mesh.empty()) { |
| 372 | SkASSERT(1 == mesh.count()); |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 373 | proc->draw(state, pipeline, nullptr, mesh.begin(), 1, this->bounds()); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 374 | } |
| 375 | } else if (PrimitiveType::kConics != fView->fPrimitiveType) { // No conic stroke support yet. |
| 376 | GrCCStroker stroker(0,0,0); |
| 377 | |
| 378 | SkPaint p; |
| 379 | p.setStyle(SkPaint::kStroke_Style); |
| 380 | p.setStrokeWidth(fView->fStrokeWidth); |
| 381 | p.setStrokeJoin(SkPaint::kMiter_Join); |
| 382 | p.setStrokeMiter(4); |
| 383 | // p.setStrokeCap(SkPaint::kRound_Cap); |
| 384 | stroker.parseDeviceSpaceStroke(fView->fPath, SkPathPriv::PointData(fView->fPath), |
| 385 | SkStrokeRec(p), p.getStrokeWidth(), GrScissorTest::kDisabled, |
| 386 | SkIRect::MakeWH(fView->width(), fView->height()), {0, 0}); |
| 387 | GrCCStroker::BatchID batchID = stroker.closeCurrentBatch(); |
| 388 | |
Robert Phillips | 9da87e0 | 2019-02-04 13:26:26 -0500 | [diff] [blame] | 389 | GrOnFlushResourceProvider onFlushRP(context->priv().drawingManager()); |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 390 | stroker.prepareToDraw(&onFlushRP); |
| 391 | |
| 392 | SkIRect ibounds; |
| 393 | this->bounds().roundOut(&ibounds); |
Chris Dalton | 2c5e011 | 2019-03-29 13:14:18 -0500 | [diff] [blame] | 394 | stroker.drawStrokes(state, proc.get(), batchID, ibounds); |
Chris Dalton | 2326177 | 2017-12-10 16:41:45 -0700 | [diff] [blame] | 395 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 396 | |
| 397 | if (glGpu) { |
| 398 | context->resetContext(kMisc_GrGLBackendState); |
| 399 | } |
| 400 | } |
| 401 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 402 | class CCPRGeometryView::Click : public Sample::Click { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 403 | public: |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 404 | Click(int ptIdx) : fPtIdx(ptIdx) {} |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 405 | |
| 406 | void doClick(SkPoint points[]) { |
| 407 | if (fPtIdx >= 0) { |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 408 | points[fPtIdx] += fCurr - fPrev; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 409 | } else { |
| 410 | for (int i = 0; i < 4; ++i) { |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 411 | points[i] += fCurr - fPrev; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 412 | } |
| 413 | } |
| 414 | } |
| 415 | |
| 416 | private: |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 417 | int fPtIdx; |
| 418 | }; |
| 419 | |
Hal Canary | b1f411a | 2019-08-29 10:39:22 -0400 | [diff] [blame] | 420 | Sample::Click* CCPRGeometryView::onFindClickHandler(SkScalar x, SkScalar y, skui::ModifierKey) { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 421 | for (int i = 0; i < 4; ++i) { |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 422 | if (PrimitiveType::kCubics != fPrimitiveType && 2 == i) { |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 423 | continue; |
| 424 | } |
| 425 | if (fabs(x - fPoints[i].x()) < 20 && fabsf(y - fPoints[i].y()) < 20) { |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 426 | return new Click(i); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 427 | } |
| 428 | } |
Hal Canary | fcf6359 | 2019-07-12 11:32:43 -0400 | [diff] [blame] | 429 | return new Click(-1); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 430 | } |
| 431 | |
Ben Wagner | b2c4ea6 | 2018-08-08 11:36:17 -0400 | [diff] [blame] | 432 | bool CCPRGeometryView::onClick(Sample::Click* click) { |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 433 | Click* myClick = (Click*)click; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 434 | myClick->doClick(fPoints); |
| 435 | this->updateAndInval(); |
| 436 | return true; |
| 437 | } |
| 438 | |
Hal Canary | 6cc65e1 | 2019-07-03 15:53:04 -0400 | [diff] [blame] | 439 | bool CCPRGeometryView::onChar(SkUnichar unichar) { |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 440 | if (unichar >= '1' && unichar <= '4') { |
Chris Dalton | 8dfc70f | 2018-03-26 19:15:22 -0600 | [diff] [blame] | 441 | fPrimitiveType = PrimitiveType(unichar - '1'); |
Chris Dalton | 703b476 | 2018-04-06 16:11:48 -0600 | [diff] [blame] | 442 | if (fPrimitiveType >= PrimitiveType::kWeightedTriangles) { |
| 443 | fPrimitiveType = (PrimitiveType) ((int)fPrimitiveType + 1); |
| 444 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 445 | this->updateAndInval(); |
| 446 | return true; |
| 447 | } |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 448 | float* valueToScale = nullptr; |
| 449 | if (fDoStroke) { |
| 450 | valueToScale = &fStrokeWidth; |
| 451 | } else if (PrimitiveType::kConics == fPrimitiveType) { |
| 452 | valueToScale = &fConicWeight; |
| 453 | } |
| 454 | if (valueToScale) { |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 455 | if (unichar == '+') { |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 456 | *valueToScale *= 2; |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 457 | this->updateAndInval(); |
| 458 | return true; |
| 459 | } |
| 460 | if (unichar == '+' || unichar == '=') { |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 461 | *valueToScale *= 5/4.f; |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 462 | this->updateAndInval(); |
| 463 | return true; |
| 464 | } |
| 465 | if (unichar == '-') { |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 466 | *valueToScale *= 4/5.f; |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 467 | this->updateAndInval(); |
| 468 | return true; |
| 469 | } |
| 470 | if (unichar == '_') { |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 471 | *valueToScale *= .5f; |
Chris Dalton | 9f2dab0 | 2018-04-18 14:07:03 -0600 | [diff] [blame] | 472 | this->updateAndInval(); |
| 473 | return true; |
| 474 | } |
| 475 | } |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 476 | if (unichar == 'D') { |
| 477 | SkDebugf(" SkPoint fPoints[4] = {\n"); |
Chris Dalton | 7f578bf | 2017-09-05 16:46:48 -0600 | [diff] [blame] | 478 | SkDebugf(" {%ff, %ff},\n", fPoints[0].x(), fPoints[0].y()); |
| 479 | SkDebugf(" {%ff, %ff},\n", fPoints[1].x(), fPoints[1].y()); |
| 480 | SkDebugf(" {%ff, %ff},\n", fPoints[2].x(), fPoints[2].y()); |
| 481 | SkDebugf(" {%ff, %ff}\n", fPoints[3].x(), fPoints[3].y()); |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 482 | SkDebugf(" };\n"); |
| 483 | return true; |
| 484 | } |
Chris Dalton | 09a7bb2 | 2018-08-31 19:53:15 +0800 | [diff] [blame] | 485 | if (unichar == 'S') { |
| 486 | fDoStroke = !fDoStroke; |
| 487 | this->updateAndInval(); |
| 488 | } |
Hal Canary | 6cc65e1 | 2019-07-03 15:53:04 -0400 | [diff] [blame] | 489 | return false; |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 490 | } |
| 491 | |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 492 | DEF_SAMPLE(return new CCPRGeometryView;) |
Chris Dalton | 1a325d2 | 2017-07-14 15:17:41 -0600 | [diff] [blame] | 493 | |
Chris Dalton | 383a2ef | 2018-01-08 17:21:41 -0500 | [diff] [blame] | 494 | #endif // SK_SUPPORT_GPU |