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

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

Issue 1512533003: Remove uniform color for GrDistanceFieldGeoProc (Closed) Base URL: https://skia.googlesource.com/skia.git@cleanuptext4
Patch Set: Created 5 years 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 | « no previous file | src/gpu/batches/GrAtlasTextBatch.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index 0b14e4df4ecfdc757c18732935ba18fdb593544a..a365474c38cc4d56f576cd767cafcaac3b56b289 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)),
« no previous file with comments | « no previous file | src/gpu/batches/GrAtlasTextBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698