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

Unified Diff: src/gpu/GrInOrderDrawBuffer.h

Issue 969813003: Minor cleanup of GrInOrderDrawBuffer (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Clean up Created 5 years, 10 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 | « no previous file | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrInOrderDrawBuffer.h
diff --git a/src/gpu/GrInOrderDrawBuffer.h b/src/gpu/GrInOrderDrawBuffer.h
index ccda85111d10955eebed3f19f15978ca13fbb559..2c30fee426fc277eff704d36c96470884afba20b 100644
--- a/src/gpu/GrInOrderDrawBuffer.h
+++ b/src/gpu/GrInOrderDrawBuffer.h
@@ -59,6 +59,41 @@ protected:
size_t vertexStride,
int indexCount);
+ void appendIndicesAndTransforms(const void* indexValues, PathIndexType indexType,
+ const float* transformValues, PathTransformType transformType,
+ int count, char** indicesLocation, float** xformsLocation) {
+ int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
+ *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes,
+ SkChunkAlloc::kThrow_AllocFailType);
+ SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation));
+ memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), count * indexBytes);
+
+ const int xformBytes = GrPathRendering::PathTransformSize(transformType) * sizeof(float);
+ *xformsLocation = NULL;
+
+ if (0 != xformBytes) {
+ *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformBytes,
+ SkChunkAlloc::kThrow_AllocFailType);
+ SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation));
+ memcpy(*xformsLocation, transformValues, count * xformBytes);
+ }
+ }
+
+ bool canConcatToIndexBuffer(const GrIndexBuffer** ib) {
+ const GrDrawTarget::GeometrySrcState& geomSrc = this->getGeomSrc();
+
+ // we only attempt to concat when reserved verts are used with a client-specified
+ // index buffer. To make this work with client-specified VBs we'd need to know if the VB
+ // was updated between draws.
+ if (kReserved_GeometrySrcType != geomSrc.fVertexSrc ||
+ kBuffer_GeometrySrcType != geomSrc.fIndexSrc) {
+ return false;
+ }
+
+ *ib = geomSrc.fIndexBuffer;
+ return true;
+ }
+
private:
typedef GrGpu::DrawArgs DrawArgs;
« no previous file with comments | « no previous file | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698