Chromium Code Reviews| Index: src/gpu/GrInOrderDrawBuffer.cpp |
| diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp |
| index dfff24792ea66dedd83490e16c5b26ab60a18bb5..225d38cf29bd54380f80d835f0ef1a7cc2539c4d 100644 |
| --- a/src/gpu/GrInOrderDrawBuffer.cpp |
| +++ b/src/gpu/GrInOrderDrawBuffer.cpp |
| @@ -13,6 +13,7 @@ |
| #include "GrGpu.h" |
| #include "GrIndexBuffer.h" |
| #include "GrPath.h" |
| +#include "GrPathRange.h" |
| #include "GrRenderTarget.h" |
| #include "GrTemplates.h" |
| #include "GrTexture.h" |
| @@ -419,10 +420,9 @@ GrInOrderDrawBuffer::DrawPaths::~DrawPaths() { |
| if (fTransforms) { |
| SkDELETE_ARRAY(fTransforms); |
| } |
| - for (int i = 0; i < fPathCount; ++i) { |
| - fPaths[i]->unref(); |
| + if (fIndices) { |
| + SkDELETE_ARRAY(fIndices); |
| } |
| - SkDELETE_ARRAY(fPaths); |
| } |
| void GrInOrderDrawBuffer::onStencilPath(const GrPath* path, SkPath::FillType fill) { |
| @@ -457,13 +457,10 @@ void GrInOrderDrawBuffer::onDrawPath(const GrPath* path, |
| } |
| } |
| -void GrInOrderDrawBuffer::onDrawPaths(int pathCount, const GrPath** paths, |
| - const SkMatrix* transforms, |
| - SkPath::FillType fill, |
| - SkStrokeRec::Style stroke, |
| - const GrDeviceCoordTexture* dstCopy) { |
| - SkASSERT(pathCount); |
| - |
| +void GrInOrderDrawBuffer::onDrawPaths(const GrPathRange* pathRange, |
| + const uint32_t indices[], int count, |
| + const float transforms[], GrTransformFormat transformsFormat, |
| + SkPath::FillType fill, const GrDeviceCoordTexture* dstCopy) { |
| if (this->needsNewClip()) { |
| this->recordClip(); |
| } |
| @@ -471,18 +468,16 @@ void GrInOrderDrawBuffer::onDrawPaths(int pathCount, const GrPath** paths, |
| this->recordState(); |
| } |
| DrawPaths* dp = this->recordDrawPaths(); |
| - dp->fPathCount = pathCount; |
| - dp->fPaths = SkNEW_ARRAY(const GrPath*, pathCount); |
| - memcpy(dp->fPaths, paths, sizeof(GrPath*) * pathCount); |
| - for (int i = 0; i < pathCount; ++i) { |
| - dp->fPaths[i]->ref(); |
| - } |
| + dp->fPathRange = pathRange; |
| + dp->fIndices = SkNEW_ARRAY(uint32_t, count); // TODO: Accomplish this without a malloc |
|
bsalomon
2014/07/17 17:27:28
What's the plan here? An immutable ref-cnt'ed arra
Chris Dalton
2014/07/17 18:15:19
I don't quite see where you are going with the imm
bsalomon
2014/07/21 14:11:08
I was thinking that drawPaths() could take a index
|
| + memcpy(dp->fIndices, indices, sizeof(uint32_t) * count); |
| + dp->fCount = count; |
| - dp->fTransforms = SkNEW_ARRAY(SkMatrix, pathCount); |
| - memcpy(dp->fTransforms, transforms, sizeof(SkMatrix) * pathCount); |
| + dp->fTransforms = SkNEW_ARRAY(float, GrTransformSize(transformsFormat) * count); |
| + memcpy(dp->fTransforms, transforms, sizeof(float) * GrTransformSize(transformsFormat) * count); |
| + dp->fTransformsFormat = transformsFormat; |
| dp->fFill = fill; |
| - dp->fStroke = stroke; |
| if (NULL != dstCopy) { |
| dp->fDstCopy = *dstCopy; |
| @@ -633,9 +628,13 @@ void GrInOrderDrawBuffer::flush() { |
| SkAssertResult(drawPathsIter.next()); |
| const GrDeviceCoordTexture* dstCopy = |
| NULL !=drawPathsIter->fDstCopy.texture() ? &drawPathsIter->fDstCopy : NULL; |
| - fDstGpu->executeDrawPaths(drawPathsIter->fPathCount, drawPathsIter->fPaths, |
| - drawPathsIter->fTransforms, drawPathsIter->fFill, |
| - drawPathsIter->fStroke, dstCopy); |
| + fDstGpu->executeDrawPaths(drawPathsIter->fPathRange.get(), |
| + drawPathsIter->fIndices, |
| + drawPathsIter->fCount, |
| + drawPathsIter->fTransforms, |
| + drawPathsIter->fTransformsFormat, |
| + drawPathsIter->fFill, |
| + dstCopy); |
| break; |
| } |
| case kSetState_Cmd: |