Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(259)

Unified Diff: src/gpu/batches/GrDrawPathBatch.cpp

Issue 1337513002: Late creation of GrPathProcessor (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/batches/GrDrawPathBatch.h ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrDrawPathBatch.cpp
diff --git a/src/gpu/batches/GrDrawPathBatch.cpp b/src/gpu/batches/GrDrawPathBatch.cpp
index 300024ee2f3deaf41d268c0e3abf4c32080efdad..3e4c863e33abfa406a037bc1bdfac55045ab59b9 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -15,9 +15,13 @@ SkString GrDrawPathBatch::dumpInfo() const {
void GrDrawPathBatch::onDraw(GrBatchFlushState* state) {
GrProgramDesc desc;
- state->gpu()->buildProgramDesc(&desc, *this->pathProcessor(),
+
+ SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
+ this->opts(),
+ this->viewMatrix()));
+ state->gpu()->buildProgramDesc(&desc, *pathProc,
*this->pipeline(), *this->tracker());
- GrPathRendering::DrawPathArgs args(this->pathProcessor(), this->pipeline(),
+ GrPathRendering::DrawPathArgs args(pathProc, this->pipeline(),
&desc, this->tracker(), &this->stencilSettings());
state->gpu()->pathRendering()->drawPath(args, fPath.get());
}
@@ -52,10 +56,11 @@ bool GrDrawPathRangeBatch::isWinding() const {
return isWinding;
}
-GrDrawPathRangeBatch::GrDrawPathRangeBatch(const GrPathProcessor* pathProc,
- GrPathRangeDraw* pathRangeDraw)
- : INHERITED(pathProc)
- , fDraws(4) {
+GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
+ GrColor color, GrPathRangeDraw* pathRangeDraw)
+ : INHERITED(viewMatrix, color)
+ , fDraws(4)
+ , fLocalMatrix(localMatrix) {
SkDEBUGCODE(pathRangeDraw->fUsedInBatch = true;)
this->initClassID<GrDrawPathRangeBatch>();
fDraws.addToHead(SkRef(pathRangeDraw));
@@ -75,8 +80,9 @@ bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
if (!GrPipeline::AreEqual(*this->pipeline(), *that->pipeline(), false)) {
return false;
}
- if (!this->pathProcessor()->isEqual(*this->tracker(), *that->pathProcessor(),
- *that->tracker())) {
+ if (this->color() != that->color() ||
+ !this->viewMatrix().cheapEqualTo(that->viewMatrix()) ||
+ !fLocalMatrix.cheapEqualTo(that->fLocalMatrix)) {
return false;
}
// TODO: Check some other things here. (winding, opaque, pathProc color, vm, ...)
@@ -103,9 +109,13 @@ bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
GrProgramDesc desc;
- state->gpu()->buildProgramDesc(&desc, *this->pathProcessor(), *this->pipeline(),
- *this->tracker());
- GrPathRendering::DrawPathArgs args(this->pathProcessor(), this->pipeline(),
+ SkAutoTUnref<GrPathProcessor> pathProc(GrPathProcessor::Create(this->color(),
+ this->opts(),
+ this->viewMatrix(),
+ fLocalMatrix));
+ state->gpu()->buildProgramDesc(&desc, *pathProc, *this->pipeline(),
+ *this->tracker());
+ GrPathRendering::DrawPathArgs args(pathProc, this->pipeline(),
&desc, this->tracker(), &this->stencilSettings());
if (fDraws.count() == 1) {
const GrPathRangeDraw& draw = **fDraws.head();
« no previous file with comments | « src/gpu/batches/GrDrawPathBatch.h ('k') | src/gpu/batches/GrStencilAndCoverPathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698