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 | |
| 10 | #include "gm.h" |
| 11 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 12 | #if SK_SUPPORT_GPU |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 13 | |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 14 | #include "GrRenderTargetContextPriv.h" |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 15 | #include "GrContext.h" |
| 16 | #include "GrPathUtils.h" |
| 17 | #include "GrTest.h" |
| 18 | #include "SkColorPriv.h" |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 19 | #include "SkGeometry.h" |
| 20 | |
Brian Salomon | 8952743 | 2016-12-16 09:52:16 -0500 | [diff] [blame] | 21 | #include "ops/GrTestMeshDrawOp.h" |
joshualitt | 2771b56 | 2015-08-07 12:46:26 -0700 | [diff] [blame] | 22 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 23 | #include "effects/GrBezierEffect.h" |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 24 | |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 25 | static inline SkScalar eval_line(const SkPoint& p, const SkScalar lineEq[3], SkScalar sign) { |
| 26 | return sign * (lineEq[0] * p.fX + lineEq[1] * p.fY + lineEq[2]); |
| 27 | } |
| 28 | |
| 29 | namespace skiagm { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 30 | |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 31 | class BezierCubicOrConicTestOp : public GrTestMeshDrawOp { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 32 | public: |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 33 | DEFINE_OP_CLASS_ID |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 34 | |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 35 | const char* name() const override { return "BezierCubicOrConicTestOp"; } |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 36 | |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 37 | static std::unique_ptr<GrDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds, |
| 38 | GrColor color, const SkScalar klmEqs[9], SkScalar sign) { |
| 39 | return std::unique_ptr<GrDrawOp>( |
| 40 | new BezierCubicOrConicTestOp(gp, bounds, color, klmEqs, sign)); |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 41 | } |
| 42 | |
| 43 | private: |
| 44 | BezierCubicOrConicTestOp(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds, GrColor color, |
| 45 | const SkScalar klmEqs[9], SkScalar sign) |
| 46 | : INHERITED(ClassID(), bounds, color), fGeometryProcessor(std::move(gp)) { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 47 | for (int i = 0; i < 9; i++) { |
| 48 | fKlmEqs[i] = klmEqs[i]; |
| 49 | } |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 50 | fSign = sign; |
| 51 | } |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 52 | struct Vertex { |
| 53 | SkPoint fPosition; |
| 54 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 55 | }; |
| 56 | |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 57 | void onPrepareDraws(Target* target) const override { |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 58 | QuadHelper helper; |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 59 | size_t vertexStride = fGeometryProcessor->getVertexStride(); |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 60 | SkASSERT(vertexStride == sizeof(Vertex)); |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 61 | Vertex* verts = reinterpret_cast<Vertex*>(helper.init(target, vertexStride, 1)); |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 62 | if (!verts) { |
joshualitt | 4b31de8 | 2015-03-05 14:33:41 -0800 | [diff] [blame] | 63 | return; |
| 64 | } |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 65 | const SkRect& bounds = this->bounds(); |
| 66 | verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 67 | sizeof(Vertex)); |
| 68 | for (int v = 0; v < 4; ++v) { |
| 69 | verts[v].fKLM[0] = eval_line(verts[v].fPosition, fKlmEqs + 0, fSign); |
| 70 | verts[v].fKLM[1] = eval_line(verts[v].fPosition, fKlmEqs + 3, fSign); |
| 71 | verts[v].fKLM[2] = eval_line(verts[v].fPosition, fKlmEqs + 6, 1.f); |
| 72 | } |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 73 | helper.recordDraw(target, fGeometryProcessor.get()); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 74 | } |
| 75 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 76 | SkScalar fKlmEqs[9]; |
| 77 | SkScalar fSign; |
| 78 | sk_sp<GrGeometryProcessor> fGeometryProcessor; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 79 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 80 | static constexpr int kVertsPerCubic = 4; |
| 81 | static constexpr int kIndicesPerCubic = 6; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 82 | |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 83 | typedef GrTestMeshDrawOp INHERITED; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 84 | }; |
| 85 | |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 86 | /** |
| 87 | * This GM directly exercises effects that draw Bezier curves in the GPU backend. |
| 88 | */ |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 89 | class BezierCubicEffects : public GM { |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 90 | public: |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 91 | BezierCubicEffects() { |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 92 | this->setBGColor(0xFFFFFFFF); |
| 93 | } |
| 94 | |
| 95 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 96 | SkString onShortName() override { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 97 | return SkString("bezier_cubic_effects"); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 98 | } |
| 99 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 100 | SkISize onISize() override { |
tfarina | f539318 | 2014-06-09 23:59:03 -0700 | [diff] [blame] | 101 | return SkISize::Make(800, 800); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 102 | } |
| 103 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 104 | void onDraw(SkCanvas* canvas) override { |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 105 | GrRenderTargetContext* renderTargetContext = |
| 106 | canvas->internal_private_accessTopLayerRenderTargetContext(); |
| 107 | if (!renderTargetContext) { |
halcanary | 2a24338 | 2015-09-09 08:16:41 -0700 | [diff] [blame] | 108 | skiagm::GM::DrawGpuOnlyMessage(canvas); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 109 | return; |
| 110 | } |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 111 | |
robertphillips | 175dd9b | 2016-04-28 14:32:04 -0700 | [diff] [blame] | 112 | GrContext* context = canvas->getGrContext(); |
| 113 | if (!context) { |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 114 | return; |
| 115 | } |
| 116 | |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 117 | struct Vertex { |
| 118 | SkPoint fPosition; |
| 119 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 120 | }; |
| 121 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 122 | constexpr int kNumCubics = 15; |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 123 | SkRandom rand; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 124 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 125 | // Mult by 3 for each edge effect type |
| 126 | int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumCubics*3))); |
| 127 | int numRows = SkScalarCeilToInt(SkIntToScalar(kNumCubics*3) / numCols); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 128 | SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols; |
| 129 | SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 130 | int row = 0; |
| 131 | int col = 0; |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 132 | constexpr GrColor color = 0xff000000; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 133 | |
| 134 | for (int i = 0; i < kNumCubics; ++i) { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 135 | SkPoint baseControlPts[] = { |
| 136 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 137 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 138 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 139 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 140 | }; |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 141 | for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 142 | sk_sp<GrGeometryProcessor> gp; |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 143 | GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 144 | gp = GrCubicEffect::Make(color, SkMatrix::I(), et, *context->caps()); |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 145 | if (!gp) { |
| 146 | continue; |
commit-bot@chromium.org | cabf4b2 | 2014-03-05 18:27:43 +0000 | [diff] [blame] | 147 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 148 | SkScalar x = SkScalarMul(col, w); |
| 149 | SkScalar y = SkScalarMul(row, h); |
| 150 | SkPoint controlPts[] = { |
| 151 | {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
| 152 | {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
| 153 | {x + baseControlPts[2].fX, y + baseControlPts[2].fY}, |
| 154 | {x + baseControlPts[3].fX, y + baseControlPts[3].fY} |
| 155 | }; |
| 156 | SkPoint chopped[10]; |
| 157 | SkScalar klmEqs[9]; |
| 158 | SkScalar klmSigns[3]; |
| 159 | int cnt = GrPathUtils::chopCubicAtLoopIntersection(controlPts, |
| 160 | chopped, |
| 161 | klmEqs, |
| 162 | klmSigns); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 163 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 164 | SkPaint ctrlPtPaint; |
| 165 | ctrlPtPaint.setColor(rand.nextU() | 0xFF000000); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 166 | for (int i = 0; i < 4; ++i) { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 167 | canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 168 | } |
| 169 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 170 | SkPaint polyPaint; |
| 171 | polyPaint.setColor(0xffA0A0A0); |
| 172 | polyPaint.setStrokeWidth(0); |
| 173 | polyPaint.setStyle(SkPaint::kStroke_Style); |
| 174 | canvas->drawPoints(SkCanvas::kPolygon_PointMode, 4, controlPts, polyPaint); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 175 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 176 | SkPaint choppedPtPaint; |
| 177 | choppedPtPaint.setColor(~ctrlPtPaint.getColor() | 0xFF000000); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 178 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 179 | for (int c = 0; c < cnt; ++c) { |
| 180 | SkPoint* pts = chopped + 3 * c; |
| 181 | |
| 182 | for (int i = 0; i < 4; ++i) { |
| 183 | canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint); |
| 184 | } |
| 185 | |
| 186 | SkRect bounds; |
| 187 | bounds.set(pts, 4); |
| 188 | |
| 189 | SkPaint boundsPaint; |
| 190 | boundsPaint.setColor(0xff808080); |
| 191 | boundsPaint.setStrokeWidth(0); |
| 192 | boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 193 | canvas->drawRect(bounds, boundsPaint); |
| 194 | |
robertphillips | 28a838e | 2016-06-23 14:07:00 -0700 | [diff] [blame] | 195 | GrPaint grPaint; |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 196 | grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 197 | |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 198 | std::unique_ptr<GrDrawOp> op = |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 199 | BezierCubicOrConicTestOp::Make(gp, bounds, color, klmEqs, klmSigns[c]); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 200 | |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 201 | renderTargetContext->priv().testingOnly_addDrawOp( |
| 202 | std::move(grPaint), GrAAType::kNone, std::move(op)); |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 203 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 204 | ++col; |
| 205 | if (numCols == col) { |
| 206 | col = 0; |
| 207 | ++row; |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 208 | } |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 209 | } |
| 210 | } |
| 211 | } |
| 212 | |
| 213 | private: |
| 214 | typedef GM INHERITED; |
| 215 | }; |
| 216 | |
| 217 | ////////////////////////////////////////////////////////////////////////////// |
| 218 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 219 | /** |
| 220 | * This GM directly exercises effects that draw Bezier curves in the GPU backend. |
| 221 | */ |
| 222 | class BezierConicEffects : public GM { |
| 223 | public: |
| 224 | BezierConicEffects() { |
| 225 | this->setBGColor(0xFFFFFFFF); |
| 226 | } |
| 227 | |
| 228 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 229 | SkString onShortName() override { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 230 | return SkString("bezier_conic_effects"); |
| 231 | } |
| 232 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 233 | SkISize onISize() override { |
tfarina | f539318 | 2014-06-09 23:59:03 -0700 | [diff] [blame] | 234 | return SkISize::Make(800, 800); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 235 | } |
| 236 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 237 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 238 | void onDraw(SkCanvas* canvas) override { |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 239 | GrRenderTargetContext* renderTargetContext = |
| 240 | canvas->internal_private_accessTopLayerRenderTargetContext(); |
| 241 | if (!renderTargetContext) { |
halcanary | 2a24338 | 2015-09-09 08:16:41 -0700 | [diff] [blame] | 242 | skiagm::GM::DrawGpuOnlyMessage(canvas); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 243 | return; |
| 244 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 245 | |
robertphillips | 175dd9b | 2016-04-28 14:32:04 -0700 | [diff] [blame] | 246 | GrContext* context = canvas->getGrContext(); |
| 247 | if (!context) { |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 248 | return; |
| 249 | } |
| 250 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 251 | struct Vertex { |
| 252 | SkPoint fPosition; |
| 253 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 254 | }; |
| 255 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 256 | constexpr int kNumConics = 10; |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 257 | SkRandom rand; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 258 | |
| 259 | // Mult by 3 for each edge effect type |
| 260 | int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumConics*3))); |
| 261 | int numRows = SkScalarCeilToInt(SkIntToScalar(kNumConics*3) / numCols); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 262 | SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols; |
| 263 | SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 264 | int row = 0; |
| 265 | int col = 0; |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 266 | constexpr GrColor color = 0xff000000; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 267 | |
| 268 | for (int i = 0; i < kNumConics; ++i) { |
| 269 | SkPoint baseControlPts[] = { |
| 270 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 271 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 272 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
| 273 | }; |
| 274 | SkScalar weight = rand.nextRangeF(0.f, 2.f); |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 275 | for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 276 | sk_sp<GrGeometryProcessor> gp; |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 277 | GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 278 | gp = GrConicEffect::Make(color, SkMatrix::I(), et, |
| 279 | *context->caps(), SkMatrix::I(), false); |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 280 | if (!gp) { |
| 281 | continue; |
commit-bot@chromium.org | cabf4b2 | 2014-03-05 18:27:43 +0000 | [diff] [blame] | 282 | } |
| 283 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 284 | SkScalar x = SkScalarMul(col, w); |
| 285 | SkScalar y = SkScalarMul(row, h); |
| 286 | SkPoint controlPts[] = { |
| 287 | {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
| 288 | {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
| 289 | {x + baseControlPts[2].fX, y + baseControlPts[2].fY} |
| 290 | }; |
| 291 | SkConic dst[4]; |
| 292 | SkScalar klmEqs[9]; |
| 293 | int cnt = chop_conic(controlPts, dst, weight); |
| 294 | GrPathUtils::getConicKLM(controlPts, weight, klmEqs); |
| 295 | |
| 296 | SkPaint ctrlPtPaint; |
| 297 | ctrlPtPaint.setColor(rand.nextU() | 0xFF000000); |
| 298 | for (int i = 0; i < 3; ++i) { |
| 299 | canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint); |
| 300 | } |
| 301 | |
| 302 | SkPaint polyPaint; |
| 303 | polyPaint.setColor(0xffA0A0A0); |
| 304 | polyPaint.setStrokeWidth(0); |
| 305 | polyPaint.setStyle(SkPaint::kStroke_Style); |
| 306 | canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, controlPts, polyPaint); |
| 307 | |
| 308 | SkPaint choppedPtPaint; |
| 309 | choppedPtPaint.setColor(~ctrlPtPaint.getColor() | 0xFF000000); |
| 310 | |
| 311 | for (int c = 0; c < cnt; ++c) { |
| 312 | SkPoint* pts = dst[c].fPts; |
| 313 | for (int i = 0; i < 3; ++i) { |
| 314 | canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint); |
| 315 | } |
| 316 | |
| 317 | SkRect bounds; |
| 318 | //SkPoint bPts[] = {{0.f, 0.f}, {800.f, 800.f}}; |
| 319 | //bounds.set(bPts, 2); |
| 320 | bounds.set(pts, 3); |
| 321 | |
| 322 | SkPaint boundsPaint; |
| 323 | boundsPaint.setColor(0xff808080); |
| 324 | boundsPaint.setStrokeWidth(0); |
| 325 | boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 326 | canvas->drawRect(bounds, boundsPaint); |
| 327 | |
robertphillips | 28a838e | 2016-06-23 14:07:00 -0700 | [diff] [blame] | 328 | GrPaint grPaint; |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 329 | grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 330 | |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 331 | std::unique_ptr<GrDrawOp> op = |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 332 | BezierCubicOrConicTestOp::Make(gp, bounds, color, klmEqs, 1.f); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 333 | |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 334 | renderTargetContext->priv().testingOnly_addDrawOp( |
| 335 | std::move(grPaint), GrAAType::kNone, std::move(op)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 336 | } |
| 337 | ++col; |
| 338 | if (numCols == col) { |
| 339 | col = 0; |
| 340 | ++row; |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | } |
| 345 | |
| 346 | private: |
| 347 | // Uses the max curvature function for quads to estimate |
| 348 | // where to chop the conic. If the max curvature is not |
| 349 | // found along the curve segment it will return 1 and |
| 350 | // dst[0] is the original conic. If it returns 2 the dst[0] |
| 351 | // and dst[1] are the two new conics. |
| 352 | int split_conic(const SkPoint src[3], SkConic dst[2], const SkScalar weight) { |
| 353 | SkScalar t = SkFindQuadMaxCurvature(src); |
| 354 | if (t == 0) { |
| 355 | if (dst) { |
| 356 | dst[0].set(src, weight); |
| 357 | } |
| 358 | return 1; |
| 359 | } else { |
| 360 | if (dst) { |
| 361 | SkConic conic; |
| 362 | conic.set(src, weight); |
caryclark | 414c429 | 2016-09-26 11:03:54 -0700 | [diff] [blame] | 363 | if (!conic.chopAt(t, dst)) { |
| 364 | dst[0].set(src, weight); |
| 365 | return 1; |
| 366 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 367 | } |
| 368 | return 2; |
| 369 | } |
| 370 | } |
| 371 | |
| 372 | // Calls split_conic on the entire conic and then once more on each subsection. |
| 373 | // Most cases will result in either 1 conic (chop point is not within t range) |
| 374 | // or 3 points (split once and then one subsection is split again). |
| 375 | int chop_conic(const SkPoint src[3], SkConic dst[4], const SkScalar weight) { |
| 376 | SkConic dstTemp[2]; |
| 377 | int conicCnt = split_conic(src, dstTemp, weight); |
| 378 | if (2 == conicCnt) { |
| 379 | int conicCnt2 = split_conic(dstTemp[0].fPts, dst, dstTemp[0].fW); |
| 380 | conicCnt = conicCnt2 + split_conic(dstTemp[1].fPts, &dst[conicCnt2], dstTemp[1].fW); |
| 381 | } else { |
| 382 | dst[0] = dstTemp[0]; |
| 383 | } |
| 384 | return conicCnt; |
| 385 | } |
| 386 | |
| 387 | typedef GM INHERITED; |
| 388 | }; |
| 389 | |
| 390 | ////////////////////////////////////////////////////////////////////////////// |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 391 | |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 392 | class BezierQuadTestOp : public GrTestMeshDrawOp { |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 393 | public: |
Brian Salomon | 25a8809 | 2016-12-01 09:36:50 -0500 | [diff] [blame] | 394 | DEFINE_OP_CLASS_ID |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 395 | const char* name() const override { return "BezierQuadTestOp"; } |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 396 | |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 397 | static std::unique_ptr<GrDrawOp> Make(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds, |
| 398 | GrColor color, const GrPathUtils::QuadUVMatrix& devToUV) { |
| 399 | return std::unique_ptr<GrDrawOp>(new BezierQuadTestOp(gp, bounds, color, devToUV)); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 400 | } |
| 401 | |
| 402 | private: |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 403 | BezierQuadTestOp(sk_sp<GrGeometryProcessor> gp, const SkRect& bounds, GrColor color, |
| 404 | const GrPathUtils::QuadUVMatrix& devToUV) |
| 405 | : INHERITED(ClassID(), bounds, color) |
| 406 | , fDevToUV(devToUV) |
| 407 | , fGeometryProcessor(std::move(gp)) {} |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 408 | |
| 409 | struct Vertex { |
| 410 | SkPoint fPosition; |
| 411 | float fKLM[4]; // The last value is ignored. The effect expects a vec4f. |
| 412 | }; |
| 413 | |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 414 | void onPrepareDraws(Target* target) const override { |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 415 | QuadHelper helper; |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 416 | size_t vertexStride = fGeometryProcessor->getVertexStride(); |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 417 | SkASSERT(vertexStride == sizeof(Vertex)); |
bsalomon | 7539856 | 2015-08-17 12:55:38 -0700 | [diff] [blame] | 418 | Vertex* verts = reinterpret_cast<Vertex*>(helper.init(target, vertexStride, 1)); |
bsalomon | b5238a7 | 2015-05-05 07:49:49 -0700 | [diff] [blame] | 419 | if (!verts) { |
joshualitt | 4b31de8 | 2015-03-05 14:33:41 -0800 | [diff] [blame] | 420 | return; |
| 421 | } |
bsalomon | 342bfc2 | 2016-04-01 06:06:20 -0700 | [diff] [blame] | 422 | const SkRect& bounds = this->bounds(); |
| 423 | verts[0].fPosition.setRectFan(bounds.fLeft, bounds.fTop, bounds.fRight, bounds.fBottom, |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 424 | sizeof(Vertex)); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 425 | fDevToUV.apply<4, sizeof(Vertex), sizeof(SkPoint)>(verts); |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 426 | helper.recordDraw(target, fGeometryProcessor.get()); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 427 | } |
| 428 | |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 429 | GrPathUtils::QuadUVMatrix fDevToUV; |
| 430 | sk_sp<GrGeometryProcessor> fGeometryProcessor; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 431 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 432 | static constexpr int kVertsPerCubic = 4; |
| 433 | static constexpr int kIndicesPerCubic = 6; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 434 | |
Brian Salomon | 6b316e9 | 2016-12-16 09:35:49 -0500 | [diff] [blame] | 435 | typedef GrTestMeshDrawOp INHERITED; |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 436 | }; |
| 437 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 438 | /** |
| 439 | * This GM directly exercises effects that draw Bezier quad curves in the GPU backend. |
| 440 | */ |
| 441 | class BezierQuadEffects : public GM { |
| 442 | public: |
| 443 | BezierQuadEffects() { |
| 444 | this->setBGColor(0xFFFFFFFF); |
| 445 | } |
| 446 | |
| 447 | protected: |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 448 | SkString onShortName() override { |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 449 | return SkString("bezier_quad_effects"); |
| 450 | } |
| 451 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 452 | SkISize onISize() override { |
tfarina | f539318 | 2014-06-09 23:59:03 -0700 | [diff] [blame] | 453 | return SkISize::Make(800, 800); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 454 | } |
| 455 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 456 | |
mtklein | 36352bf | 2015-03-25 18:17:31 -0700 | [diff] [blame] | 457 | void onDraw(SkCanvas* canvas) override { |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 458 | GrRenderTargetContext* renderTargetContext = |
| 459 | canvas->internal_private_accessTopLayerRenderTargetContext(); |
| 460 | if (!renderTargetContext) { |
halcanary | 2a24338 | 2015-09-09 08:16:41 -0700 | [diff] [blame] | 461 | skiagm::GM::DrawGpuOnlyMessage(canvas); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 462 | return; |
| 463 | } |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 464 | |
robertphillips | 175dd9b | 2016-04-28 14:32:04 -0700 | [diff] [blame] | 465 | GrContext* context = canvas->getGrContext(); |
| 466 | if (!context) { |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 467 | return; |
| 468 | } |
| 469 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 470 | struct Vertex { |
| 471 | SkPoint fPosition; |
| 472 | float fUV[4]; // The last two values are ignored. The effect expects a vec4f. |
| 473 | }; |
| 474 | |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 475 | constexpr int kNumQuads = 5; |
commit-bot@chromium.org | e0e7cfe | 2013-09-09 20:09:12 +0000 | [diff] [blame] | 476 | SkRandom rand; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 477 | |
| 478 | int numCols = SkScalarCeilToInt(SkScalarSqrt(SkIntToScalar(kNumQuads*3))); |
| 479 | int numRows = SkScalarCeilToInt(SkIntToScalar(kNumQuads*3) / numCols); |
Brian Osman | 1105224 | 2016-10-27 14:47:55 -0400 | [diff] [blame] | 480 | SkScalar w = SkIntToScalar(renderTargetContext->width()) / numCols; |
| 481 | SkScalar h = SkIntToScalar(renderTargetContext->height()) / numRows; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 482 | int row = 0; |
| 483 | int col = 0; |
mtklein | dbfd7ab | 2016-09-01 11:24:54 -0700 | [diff] [blame] | 484 | constexpr GrColor color = 0xff000000; |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 485 | |
| 486 | for (int i = 0; i < kNumQuads; ++i) { |
| 487 | SkPoint baseControlPts[] = { |
| 488 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 489 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)}, |
| 490 | {rand.nextRangeF(0.f, w), rand.nextRangeF(0.f, h)} |
| 491 | }; |
joshualitt | b0a8a37 | 2014-09-23 09:50:21 -0700 | [diff] [blame] | 492 | for(int edgeType = 0; edgeType < kGrProcessorEdgeTypeCnt; ++edgeType) { |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 493 | sk_sp<GrGeometryProcessor> gp; |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 494 | GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)edgeType; |
bungeman | 06ca8ec | 2016-06-09 08:01:03 -0700 | [diff] [blame] | 495 | gp = GrQuadEffect::Make(color, SkMatrix::I(), et, |
| 496 | *context->caps(), SkMatrix::I(), false); |
joshualitt | f5883a6 | 2016-01-13 07:47:38 -0800 | [diff] [blame] | 497 | if (!gp) { |
| 498 | continue; |
commit-bot@chromium.org | cabf4b2 | 2014-03-05 18:27:43 +0000 | [diff] [blame] | 499 | } |
| 500 | |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 501 | SkScalar x = SkScalarMul(col, w); |
| 502 | SkScalar y = SkScalarMul(row, h); |
| 503 | SkPoint controlPts[] = { |
| 504 | {x + baseControlPts[0].fX, y + baseControlPts[0].fY}, |
| 505 | {x + baseControlPts[1].fX, y + baseControlPts[1].fY}, |
| 506 | {x + baseControlPts[2].fX, y + baseControlPts[2].fY} |
| 507 | }; |
| 508 | SkPoint chopped[5]; |
| 509 | int cnt = SkChopQuadAtMaxCurvature(controlPts, chopped); |
| 510 | |
| 511 | SkPaint ctrlPtPaint; |
| 512 | ctrlPtPaint.setColor(rand.nextU() | 0xFF000000); |
| 513 | for (int i = 0; i < 3; ++i) { |
| 514 | canvas->drawCircle(controlPts[i].fX, controlPts[i].fY, 6.f, ctrlPtPaint); |
| 515 | } |
| 516 | |
| 517 | SkPaint polyPaint; |
| 518 | polyPaint.setColor(0xffA0A0A0); |
| 519 | polyPaint.setStrokeWidth(0); |
| 520 | polyPaint.setStyle(SkPaint::kStroke_Style); |
| 521 | canvas->drawPoints(SkCanvas::kPolygon_PointMode, 3, controlPts, polyPaint); |
| 522 | |
| 523 | SkPaint choppedPtPaint; |
| 524 | choppedPtPaint.setColor(~ctrlPtPaint.getColor() | 0xFF000000); |
| 525 | |
| 526 | for (int c = 0; c < cnt; ++c) { |
| 527 | SkPoint* pts = chopped + 2 * c; |
| 528 | |
| 529 | for (int i = 0; i < 3; ++i) { |
| 530 | canvas->drawCircle(pts[i].fX, pts[i].fY, 3.f, choppedPtPaint); |
| 531 | } |
| 532 | |
| 533 | SkRect bounds; |
| 534 | bounds.set(pts, 3); |
| 535 | |
| 536 | SkPaint boundsPaint; |
| 537 | boundsPaint.setColor(0xff808080); |
| 538 | boundsPaint.setStrokeWidth(0); |
| 539 | boundsPaint.setStyle(SkPaint::kStroke_Style); |
| 540 | canvas->drawRect(bounds, boundsPaint); |
| 541 | |
robertphillips | 28a838e | 2016-06-23 14:07:00 -0700 | [diff] [blame] | 542 | GrPaint grPaint; |
Brian Salomon | a163392 | 2017-01-09 11:46:10 -0500 | [diff] [blame] | 543 | grPaint.setXPFactory(GrPorterDuffXPFactory::Get(SkBlendMode::kSrc)); |
joshualitt | 3f284d7 | 2015-02-11 11:34:58 -0800 | [diff] [blame] | 544 | |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 545 | GrPathUtils::QuadUVMatrix DevToUV(pts); |
| 546 | |
Brian Salomon | f833478 | 2017-01-03 09:42:58 -0500 | [diff] [blame] | 547 | std::unique_ptr<GrDrawOp> op = |
| 548 | BezierQuadTestOp::Make(gp, bounds, color, DevToUV); |
joshualitt | 95964c6 | 2015-02-11 13:45:50 -0800 | [diff] [blame] | 549 | |
Brian Salomon | 82f4431 | 2017-01-11 13:42:54 -0500 | [diff] [blame] | 550 | renderTargetContext->priv().testingOnly_addDrawOp( |
| 551 | std::move(grPaint), GrAAType::kNone, std::move(op)); |
commit-bot@chromium.org | 53a0b6c | 2013-08-23 18:05:01 +0000 | [diff] [blame] | 552 | } |
| 553 | ++col; |
| 554 | if (numCols == col) { |
| 555 | col = 0; |
| 556 | ++row; |
| 557 | } |
| 558 | } |
| 559 | } |
| 560 | } |
| 561 | |
| 562 | private: |
| 563 | typedef GM INHERITED; |
| 564 | }; |
| 565 | |
halcanary | 385fe4d | 2015-08-26 13:07:48 -0700 | [diff] [blame] | 566 | DEF_GM(return new BezierCubicEffects;) |
| 567 | DEF_GM(return new BezierConicEffects;) |
| 568 | DEF_GM(return new BezierQuadEffects;) |
commit-bot@chromium.org | 78a1078 | 2013-08-21 19:27:48 +0000 | [diff] [blame] | 569 | } |
| 570 | |
| 571 | #endif |