| Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| index 0b14e4df4ecfdc757c18732935ba18fdb593544a..2024b53a7a7bb0c5ae1e25d6c6ec5c1a19502095 100644
|
| --- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| +++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
|
| @@ -212,7 +212,7 @@ private:
|
|
|
| // allocate vertices
|
| size_t vertexStride = dfProcessor->getVertexStride();
|
| - SkASSERT(vertexStride == 2 * sizeof(SkPoint));
|
| + SkASSERT(vertexStride == 2 * sizeof(SkPoint) + sizeof(GrColor));
|
|
|
| const GrVertexBuffer* vertexBuffer;
|
| void* vertices = target->makeVertexSpace(vertexStride,
|
| @@ -278,12 +278,12 @@ private:
|
| // Now set vertices
|
| intptr_t offset = reinterpret_cast<intptr_t>(vertices);
|
| offset += i * kVerticesPerQuad * vertexStride;
|
| - SkPoint* positions = reinterpret_cast<SkPoint*>(offset);
|
| this->writePathVertices(target,
|
| atlas,
|
| this->pipeline(),
|
| dfProcessor,
|
| - positions,
|
| + offset,
|
| + this->color(),
|
| vertexStride,
|
| this->viewMatrix(),
|
| args.fPath,
|
| @@ -437,7 +437,8 @@ private:
|
| GrBatchAtlas* atlas,
|
| const GrPipeline* pipeline,
|
| const GrGeometryProcessor* gp,
|
| - SkPoint* positions,
|
| + intptr_t offset,
|
| + GrColor color,
|
| size_t vertexStride,
|
| const SkMatrix& viewMatrix,
|
| const SkPath& path,
|
| @@ -460,13 +461,21 @@ private:
|
| SkFixed tw = SkScalarToFixed(pathData->fBounds.width());
|
| SkFixed th = SkScalarToFixed(pathData->fBounds.height());
|
|
|
| + SkPoint* positions = reinterpret_cast<SkPoint*>(offset);
|
| +
|
| // vertex positions
|
| // TODO make the vertex attributes a struct
|
| SkRect r = SkRect::MakeXYWH(dx, dy, width, height);
|
| positions->setRectFan(r.left(), r.top(), r.right(), r.bottom(), vertexStride);
|
|
|
| + // colors
|
| + for (int i = 0; i < kVerticesPerQuad; i++) {
|
| + GrColor* colorPtr = (GrColor*)(offset + sizeof(SkPoint) + i * vertexStride);
|
| + *colorPtr = color;
|
| + }
|
| +
|
| // vertex texture coords
|
| - SkPoint* textureCoords = positions + 1;
|
| + SkPoint* textureCoords = (SkPoint*)(offset + sizeof(SkPoint) + sizeof(GrColor));
|
| textureCoords->setRectFan(SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx)),
|
| SkFixedToFloat(texture->texturePriv().normalizeFixedY(ty)),
|
| SkFixedToFloat(texture->texturePriv().normalizeFixedX(tx + tw)),
|
| @@ -496,12 +505,7 @@ private:
|
| return false;
|
| }
|
|
|
| - // TODO we could actually probably do a bunch of this work on the CPU, ie map viewMatrix,
|
| - // maybe upload color via attribute
|
| - if (this->color() != that->color()) {
|
| - return false;
|
| - }
|
| -
|
| + // TODO We can position on the cpu
|
| if (!this->viewMatrix().cheapEqualTo(that->viewMatrix())) {
|
| return false;
|
| }
|
|
|