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

Unified Diff: src/gpu/GrDrawTarget.cpp

Issue 511593004: Make setVertexAttribs in GrDrawState take a stride parameter. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Release Fix Created 6 years, 4 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/GrDrawState.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.cpp
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 2d27859c3ee5fd61aef50ac5e64300e2dc66ac09..9605781d34d62f625fcb2c46efeff0d8238ed9b1 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -195,10 +195,10 @@ bool GrDrawTarget::reserveVertexAndIndexSpace(int vertexCount,
int indexCount,
void** vertices,
void** indices) {
- size_t vertexSize = this->drawState()->getVertexSize();
+ size_t vertexStride = this->drawState()->getVertexStride();
this->willReserveVertexAndIndexSpace(vertexCount, indexCount);
if (vertexCount) {
- if (!this->reserveVertexSpace(vertexSize, vertexCount, vertices)) {
+ if (!this->reserveVertexSpace(vertexStride, vertexCount, vertices)) {
if (indexCount) {
this->resetIndexSource();
}
@@ -278,7 +278,7 @@ void GrDrawTarget::setVertexSourceToArray(const void* vertexArray,
this->releasePreviousVertexSource();
GeometrySrcState& geoSrc = fGeoSrcStateStack.back();
geoSrc.fVertexSrc = kArray_GeometrySrcType;
- geoSrc.fVertexSize = this->drawState()->getVertexSize();
+ geoSrc.fVertexSize = this->drawState()->getVertexStride();
geoSrc.fVertexCount = vertexCount;
this->onSetVertexSourceToArray(vertexArray, vertexCount);
}
@@ -298,7 +298,7 @@ void GrDrawTarget::setVertexSourceToBuffer(const GrVertexBuffer* buffer) {
geoSrc.fVertexSrc = kBuffer_GeometrySrcType;
geoSrc.fVertexBuffer = buffer;
buffer->ref();
- geoSrc.fVertexSize = this->drawState()->getVertexSize();
+ geoSrc.fVertexSize = this->drawState()->getVertexStride();
}
void GrDrawTarget::setIndexSourceToBuffer(const GrIndexBuffer* buffer) {
@@ -673,9 +673,9 @@ extern const GrVertexAttrib gBWRectPosUVAttribs[] = {
void set_vertex_attributes(GrDrawState* drawState, bool hasUVs) {
if (hasUVs) {
- drawState->setVertexAttribs<gBWRectPosUVAttribs>(2);
+ drawState->setVertexAttribs<gBWRectPosUVAttribs>(2, 2 * sizeof(SkPoint));
} else {
- drawState->setVertexAttribs<gBWRectPosUVAttribs>(1);
+ drawState->setVertexAttribs<gBWRectPosUVAttribs>(1, sizeof(SkPoint));
}
}
@@ -693,16 +693,16 @@ void GrDrawTarget::onDrawRect(const SkRect& rect,
return;
}
- size_t vsize = this->drawState()->getVertexSize();
- geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize);
+ size_t vstride = this->drawState()->getVertexStride();
+ geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vstride);
if (NULL != localRect) {
SkPoint* coords = GrTCast<SkPoint*>(GrTCast<intptr_t>(geo.vertices()) +
sizeof(SkPoint));
coords->setRectFan(localRect->fLeft, localRect->fTop,
localRect->fRight, localRect->fBottom,
- vsize);
+ vstride);
if (NULL != localMatrix) {
- localMatrix->mapPointsWithStride(coords, vsize, 4);
+ localMatrix->mapPointsWithStride(coords, vstride, 4);
}
}
SkRect bounds;
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698