diff options
author | 2018-03-29 11:46:24 -0400 | |
---|---|---|
committer | 2018-03-29 17:18:05 +0000 | |
commit | 3746ac21df90e44ed1ed9ec2f1e4694fbcd1d840 (patch) | |
tree | de1fff31711fa4c41e849d0281c8a2c5b400db88 /src/gpu/ops/GrDrawPathOp.cpp | |
parent | c3bc425bd4d630f4c6b69f38473fc69b77a1d5b9 (diff) |
Remove path ranges from gpu.
These appear to have been added to handle glyph paths with nvpr and no
longer appear to be used.
Change-Id: Id75e2e85ab837a5808e7641873d217c844cd827c
Reviewed-on: https://skia-review.googlesource.com/117103
Reviewed-by: Chris Dalton <csmartdalton@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Diffstat (limited to 'src/gpu/ops/GrDrawPathOp.cpp')
-rw-r--r-- | src/gpu/ops/GrDrawPathOp.cpp | 148 |
1 files changed, 0 insertions, 148 deletions
diff --git a/src/gpu/ops/GrDrawPathOp.cpp b/src/gpu/ops/GrDrawPathOp.cpp index 7b7d394f20..b79654c6ca 100644 --- a/src/gpu/ops/GrDrawPathOp.cpp +++ b/src/gpu/ops/GrDrawPathOp.cpp @@ -75,154 +75,6 @@ void GrDrawPathOp::onExecute(GrOpFlushState* state) { ////////////////////////////////////////////////////////////////////////////// -SkString GrDrawPathRangeOp::dumpInfo() const { - SkString string; - string.printf("RANGE: 0x%p COUNTS: [", fPathRange.get()); - for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { - string.appendf("%d, ", iter.get()->fInstanceData->count()); - } - string.remove(string.size() - 2, 2); - string.append("]"); - string.append(INHERITED::dumpInfo()); - return string; -} - -GrDrawPathRangeOp::GrDrawPathRangeOp(const SkMatrix& viewMatrix, SkScalar scale, SkScalar x, - SkScalar y, GrPaint&& paint, GrPathRendering::FillType fill, - GrAAType aaType, GrPathRange* range, - const InstanceData* instanceData, const SkRect& bounds) - : INHERITED(ClassID(), viewMatrix, std::move(paint), fill, aaType) - , fPathRange(range) - , fTotalPathCount(instanceData->count()) - , fScale(scale) { - fDraws.addToHead()->set(instanceData, x, y); - this->setBounds(bounds, HasAABloat::kNo, IsZeroArea::kNo); -} - -static void pre_translate_transform_values(const float* xforms, - GrPathRendering::PathTransformType type, int count, - SkScalar x, SkScalar y, float* dst); - -bool GrDrawPathRangeOp::onCombineIfPossible(GrOp* t, const GrCaps& caps) { - GrDrawPathRangeOp* that = t->cast<GrDrawPathRangeOp>(); - if (this->fPathRange.get() != that->fPathRange.get() || - this->transformType() != that->transformType() || this->fScale != that->fScale || - this->color() != that->color() || !this->viewMatrix().cheapEqualTo(that->viewMatrix())) { - return false; - } - if (this->processors() != that->processors()) { - return false; - } - if (this->pipelineSRGBFlags() != that->pipelineSRGBFlags()) { - return false; - } - switch (fDraws.head()->fInstanceData->transformType()) { - case GrPathRendering::kNone_PathTransformType: - if (this->fDraws.head()->fX != that->fDraws.head()->fX || - this->fDraws.head()->fY != that->fDraws.head()->fY) { - return false; - } - break; - case GrPathRendering::kTranslateX_PathTransformType: - if (this->fDraws.head()->fY != that->fDraws.head()->fY) { - return false; - } - break; - case GrPathRendering::kTranslateY_PathTransformType: - if (this->fDraws.head()->fX != that->fDraws.head()->fX) { - return false; - } - break; - default: - break; - } - // TODO: Check some other things here. (winding, opaque, pathProc color, vm, ...) - // Try to combine this call with the previous DrawPaths. We do this by stenciling all the - // paths together and then covering them in a single pass. This is not equivalent to two - // separate draw calls, so we can only do it if there is no blending (no overlap would also - // work). Note that it's also possible for overlapping paths to cancel each other's winding - // numbers, and we only partially account for this by not allowing even/odd paths to be - // combined. (Glyphs in the same font tend to wind the same direction so it works out OK.) - - if (GrPathRendering::kWinding_FillType != this->fillType() || - GrPathRendering::kWinding_FillType != that->fillType()) { - return false; - } - if (!this->processorAnalysis().canCombineOverlappedStencilAndCover()) { - return false; - } - fTotalPathCount += that->fTotalPathCount; - while (Draw* head = that->fDraws.head()) { - Draw* draw = fDraws.addToTail(); - draw->fInstanceData.reset(head->fInstanceData.release()); - draw->fX = head->fX; - draw->fY = head->fY; - that->fDraws.popHead(); - } - this->joinBounds(*that); - return true; -} - -void GrDrawPathRangeOp::onExecute(GrOpFlushState* state) { - const Draw& head = *fDraws.head(); - - SkMatrix drawMatrix(this->viewMatrix()); - drawMatrix.preScale(fScale, fScale); - drawMatrix.preTranslate(head.fX, head.fY); - - SkMatrix localMatrix; - localMatrix.setScale(fScale, fScale); - localMatrix.preTranslate(head.fX, head.fY); - - sk_sp<GrPathProcessor> pathProc( - GrPathProcessor::Create(this->color(), drawMatrix, localMatrix)); - - GrPipeline pipeline(this->pipelineInitArgs(*state), this->detachProcessors(), - state->detachAppliedClip()); - GrStencilSettings stencil; - init_stencil_pass_settings(*state, this->fillType(), &stencil); - if (fDraws.count() == 1) { - const InstanceData& instances = *head.fInstanceData; - state->gpu()->pathRendering()->drawPaths(pipeline, - *pathProc, - stencil, - fPathRange.get(), - instances.indices(), - GrPathRange::kU16_PathIndexType, - instances.transformValues(), - instances.transformType(), - instances.count()); - } else { - int floatsPerTransform = GrPathRendering::PathTransformSize(this->transformType()); - SkAutoSTMalloc<4096, float> transformStorage(floatsPerTransform * fTotalPathCount); - SkAutoSTMalloc<2048, uint16_t> indexStorage(fTotalPathCount); - int idx = 0; - for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) { - const Draw& draw = *iter.get(); - const InstanceData& instances = *draw.fInstanceData; - memcpy(&indexStorage[idx], instances.indices(), instances.count() * sizeof(uint16_t)); - pre_translate_transform_values(instances.transformValues(), this->transformType(), - instances.count(), draw.fX - head.fX, draw.fY - head.fY, - &transformStorage[floatsPerTransform * idx]); - idx += instances.count(); - - // TODO: Support mismatched transform types if we start using more types other than 2D. - SkASSERT(instances.transformType() == this->transformType()); - } - SkASSERT(idx == fTotalPathCount); - - state->gpu()->pathRendering()->drawPaths(pipeline, - *pathProc, - stencil, - fPathRange.get(), - indexStorage, - GrPathRange::kU16_PathIndexType, - transformStorage, - this->transformType(), - fTotalPathCount); - } -} - inline void pre_translate_transform_values(const float* xforms, GrPathRendering::PathTransformType type, int count, SkScalar x, SkScalar y, float* dst) { |