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

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

Issue 1374853004: Fix caching of nvpr glyphs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: MSVC warnings Created 5 years, 2 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') | no next file » | 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 c56c4ad2cd723d8fc7c04fb5a8db3ddab6b3466b..9beee8e7963553ee6d0f64f2e1696d50caccba35 100644
--- a/src/gpu/batches/GrDrawPathBatch.cpp
+++ b/src/gpu/batches/GrDrawPathBatch.cpp
@@ -56,13 +56,14 @@ bool GrDrawPathRangeBatch::isWinding() const {
}
GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkMatrix& localMatrix,
- GrColor color, GrPathRangeDraw* pathRangeDraw)
+ GrColor color, GrPathRange* range, GrPathRangeDraw* draw)
: INHERITED(ClassID(), viewMatrix, color)
+ , fPathRange(range)
, fDraws(4)
, fLocalMatrix(localMatrix) {
- SkDEBUGCODE(pathRangeDraw->fUsedInBatch = true;)
- fDraws.addToHead(SkRef(pathRangeDraw));
- fTotalPathCount = pathRangeDraw->count();
+ SkDEBUGCODE(draw->fUsedInBatch = true;)
+ fDraws.addToHead(SkRef(draw));
+ fTotalPathCount = draw->count();
// Don't compute a bounding box. For dst copy texture, we'll opt instead for it to just copy
// the entire dst. Realistically this is a moot point, because any context that supports
// NV_path_rendering will also support NV_blend_equation_advanced.
@@ -72,6 +73,9 @@ GrDrawPathRangeBatch::GrDrawPathRangeBatch(const SkMatrix& viewMatrix, const SkM
bool GrDrawPathRangeBatch::onCombineIfPossible(GrBatch* t, const GrCaps& caps) {
GrDrawPathRangeBatch* that = t->cast<GrDrawPathRangeBatch>();
+ if (this->fPathRange.get() != that->fPathRange.get()) {
+ return false;
+ }
if (!GrPathRangeDraw::CanMerge(**this->fDraws.head(), **that->fDraws.head())) {
return false;
}
@@ -116,13 +120,12 @@ void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
&desc, &this->stencilSettings());
if (fDraws.count() == 1) {
const GrPathRangeDraw& draw = **fDraws.head();
- state->gpu()->pathRendering()->drawPaths(args, draw.range(), draw.indices(),
+ state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), draw.indices(),
GrPathRange::kU16_PathIndexType, draw.transforms(), draw.transformType(),
draw.count());
return;
}
- const GrPathRange* range = (*fDraws.head())->range();
GrPathRendering::PathTransformType transformType = (*fDraws.head())->transformType();
int floatsPerTransform = GrPathRendering::PathTransformSize(transformType);
SkAutoSTMalloc<512, float> transformStorage(floatsPerTransform * fTotalPathCount);
@@ -131,7 +134,6 @@ void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
float* transforms = transformStorage.get();
for (DrawList::Iter iter(fDraws); iter.get(); iter.next()) {
SkASSERT((*iter.get())->transformType() == transformType);
- SkASSERT((*iter.get())->range() == range);
int cnt = (*iter.get())->count();
memcpy(indices, (*iter.get())->indices(), cnt * sizeof(uint16_t));
indices += cnt;
@@ -139,7 +141,7 @@ void GrDrawPathRangeBatch::onDraw(GrBatchFlushState* state) {
transforms += cnt * floatsPerTransform;
}
SkASSERT(indices - indexStorage.get() == fTotalPathCount);
- state->gpu()->pathRendering()->drawPaths(args, range, indexStorage.get(),
+ state->gpu()->pathRendering()->drawPaths(args, fPathRange.get(), indexStorage.get(),
GrPathRange::kU16_PathIndexType, transformStorage.get(), transformType,
fTotalPathCount);
}
« no previous file with comments | « src/gpu/batches/GrDrawPathBatch.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698