From e7fbafe1da930eba9e24f60fefef5a440f715219 Mon Sep 17 00:00:00 2001 From: Chris Dalton Date: Mon, 16 Apr 2018 22:45:32 +0000 Subject: Revert "ccpr: Implement conics" This reverts commit 98b241573e6083c4c7f0ce9e30cc214c4da1a8ba. Reason for revert: TSAN not happy Original change's description: > ccpr: Implement conics > > Bug: skia: > Change-Id: I4bae8b059072af987abb7b2d9c57fe08f783d680 > Reviewed-on: https://skia-review.googlesource.com/120040 > Commit-Queue: Chris Dalton > Reviewed-by: Greg Daniel TBR=egdaniel@google.com,bsalomon@google.com,csmartdalton@google.com Change-Id: Ic29bf660f042c20b7e4492b03400412e378dbb8a No-Presubmit: true No-Tree-Checks: true No-Try: true Bug: skia: Reviewed-on: https://skia-review.googlesource.com/121717 Reviewed-by: Chris Dalton Commit-Queue: Chris Dalton --- samplecode/SampleCCPRGeometry.cpp | 78 ++++++++------------------------------- 1 file changed, 15 insertions(+), 63 deletions(-) (limited to 'samplecode') diff --git a/samplecode/SampleCCPRGeometry.cpp b/samplecode/SampleCCPRGeometry.cpp index 52e1181e8c..a6e408749a 100644 --- a/samplecode/SampleCCPRGeometry.cpp +++ b/samplecode/SampleCCPRGeometry.cpp @@ -63,8 +63,6 @@ private: SkPoint fPoints[4] = { {100.05f, 100.05f}, {400.75f, 100.05f}, {400.75f, 300.95f}, {100.05f, 300.95f}}; - float fConicWeight = .5; - SkTArray fTriPointInstances; SkTArray fQuadPointInstances; @@ -150,22 +148,14 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) { SkPath outline; outline.moveTo(fPoints[0]); - switch (fPrimitiveType) { - case PrimitiveType::kTriangles: - case PrimitiveType::kWeightedTriangles: - outline.lineTo(fPoints[1]); - outline.lineTo(fPoints[3]); - outline.close(); - break; - case PrimitiveType::kQuadratics: - outline.quadTo(fPoints[1], fPoints[3]); - break; - case PrimitiveType::kCubics: - outline.cubicTo(fPoints[1], fPoints[2], fPoints[3]); - break; - case PrimitiveType::kConics: - outline.conicTo(fPoints[1], fPoints[3], fConicWeight); - break; + if (PrimitiveType::kCubics == fPrimitiveType) { + outline.cubicTo(fPoints[1], fPoints[2], fPoints[3]); + } else if (PrimitiveType::kQuadratics == fPrimitiveType) { + outline.quadTo(fPoints[1], fPoints[3]); + } else { + outline.lineTo(fPoints[1]); + outline.lineTo(fPoints[3]); + outline.close(); } SkPaint outlinePaint; @@ -218,8 +208,6 @@ void CCPRGeometryView::onDrawContent(SkCanvas* canvas) { GrCCCoverageProcessor::PrimitiveTypeName(fPrimitiveType)); if (PrimitiveType::kCubics == fPrimitiveType) { caption.appendf(" (%s)", SkCubicTypeName(fCubicType)); - } else if (PrimitiveType::kConics == fPrimitiveType) { - caption.appendf(" (w=%f)", fConicWeight); } } else { caption = "Use GPU backend to visualize geometry."; @@ -276,18 +264,13 @@ void CCPRGeometryView::updateGpuData() { continue; } } - } else if (PrimitiveType::kTriangles != fPrimitiveType) { + } else if (PrimitiveType::kQuadratics == fPrimitiveType) { SkPoint P3[3] = {fPoints[0], fPoints[1], fPoints[3]}; GrCCGeometry geometry; geometry.beginContour(P3[0]); - if (PrimitiveType::kQuadratics == fPrimitiveType) { - geometry.quadraticTo(P3); - } else { - SkASSERT(PrimitiveType::kConics == fPrimitiveType); - geometry.conicTo(P3, fConicWeight); - } + geometry.quadraticTo(P3); geometry.endContour(); - int ptsIdx = 0, conicWeightIdx = 0; + int ptsIdx = 0; for (GrCCGeometry::Verb verb : geometry.verbs()) { if (GrCCGeometry::Verb::kBeginContour == verb || GrCCGeometry::Verb::kEndOpenContour == verb || @@ -298,16 +281,8 @@ void CCPRGeometryView::updateGpuData() { ++ptsIdx; continue; } - SkASSERT(GrCCGeometry::Verb::kMonotonicQuadraticTo == verb || - GrCCGeometry::Verb::kMonotonicConicTo == verb); - if (PrimitiveType::kQuadratics == fPrimitiveType && - GrCCGeometry::Verb::kMonotonicQuadraticTo == verb) { - fTriPointInstances.push_back().set(&geometry.points()[ptsIdx], Sk2f(0, 0)); - } else if (PrimitiveType::kConics == fPrimitiveType && - GrCCGeometry::Verb::kMonotonicConicTo == verb) { - fQuadPointInstances.push_back().setW(&geometry.points()[ptsIdx], Sk2f(0, 0), - geometry.getConicWeight(conicWeightIdx++)); - } + SkASSERT(GrCCGeometry::Verb::kMonotonicQuadraticTo == verb); + fTriPointInstances.push_back().set(&geometry.points()[ptsIdx], Sk2f(0, 0)); ptsIdx += 2; } } else { @@ -326,8 +301,7 @@ void CCPRGeometryView::DrawCoverageCountOp::onExecute(GrOpFlushState* state) { SkDEBUGCODE(proc.enableDebugBloat(kDebugBloat)); SkSTArray<1, GrMesh> mesh; - if (PrimitiveType::kCubics == fView->fPrimitiveType || - PrimitiveType::kConics == fView->fPrimitiveType) { + if (PrimitiveType::kCubics == fView->fPrimitiveType) { sk_sp instBuff(rp->createBuffer( fView->fQuadPointInstances.count() * sizeof(QuadPointInstance), kVertex_GrBufferType, kDynamic_GrAccessPattern, @@ -415,7 +389,7 @@ bool CCPRGeometryView::onQuery(SkEvent* evt) { } SkUnichar unichar; if (SampleCode::CharQ(*evt, &unichar)) { - if (unichar >= '1' && unichar <= '4') { + if (unichar >= '1' && unichar <= '3') { fPrimitiveType = PrimitiveType(unichar - '1'); if (fPrimitiveType >= PrimitiveType::kWeightedTriangles) { fPrimitiveType = (PrimitiveType) ((int)fPrimitiveType + 1); @@ -423,28 +397,6 @@ bool CCPRGeometryView::onQuery(SkEvent* evt) { this->updateAndInval(); return true; } - if (PrimitiveType::kConics == fPrimitiveType) { - if (unichar == '+') { - fConicWeight *= 2; - this->updateAndInval(); - return true; - } - if (unichar == '+' || unichar == '=') { - fConicWeight *= 5/4.f; - this->updateAndInval(); - return true; - } - if (unichar == '-') { - fConicWeight *= 4/5.f; - this->updateAndInval(); - return true; - } - if (unichar == '_') { - fConicWeight *= .5f; - this->updateAndInval(); - return true; - } - } if (unichar == 'D') { SkDebugf(" SkPoint fPoints[4] = {\n"); SkDebugf(" {%ff, %ff},\n", fPoints[0].x(), fPoints[0].y()); -- cgit v1.2.3