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

Side by Side 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, 9 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrInOrderDrawBuffer_DEFINED 8 #ifndef GrInOrderDrawBuffer_DEFINED
9 #define GrInOrderDrawBuffer_DEFINED 9 #define GrInOrderDrawBuffer_DEFINED
10 10
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 bool insideClip, 52 bool insideClip,
53 GrRenderTarget* renderTarget) SK_OVERRIDE; 53 GrRenderTarget* renderTarget) SK_OVERRIDE;
54 54
55 void discard(GrRenderTarget*) SK_OVERRIDE; 55 void discard(GrRenderTarget*) SK_OVERRIDE;
56 56
57 protected: 57 protected:
58 void willReserveVertexAndIndexSpace(int vertexCount, 58 void willReserveVertexAndIndexSpace(int vertexCount,
59 size_t vertexStride, 59 size_t vertexStride,
60 int indexCount); 60 int indexCount);
61 61
62 void appendIndicesAndTransforms(const void* indexValues, PathIndexType index Type,
63 const float* transformValues, PathTransformT ype transformType,
64 int count, char** indicesLocation, float** x formsLocation) {
65 int indexBytes = GrPathRange::PathIndexSizeInBytes(indexType);
66 *indicesLocation = (char*) fPathIndexBuffer.alloc(count * indexBytes,
67 SkChunkAlloc::kThrow_A llocFailType);
68 SkASSERT(SkIsAlign4((uintptr_t)*indicesLocation));
69 memcpy(*indicesLocation, reinterpret_cast<const char*>(indexValues), cou nt * indexBytes);
70
71 const int xformBytes = GrPathRendering::PathTransformSize(transformType) * sizeof(float);
72 *xformsLocation = NULL;
73
74 if (0 != xformBytes) {
75 *xformsLocation = (float*) fPathTransformBuffer.alloc(count * xformB ytes,
76 SkChunkAlloc::kTh row_AllocFailType);
77 SkASSERT(SkIsAlign4((uintptr_t)*xformsLocation));
78 memcpy(*xformsLocation, transformValues, count * xformBytes);
79 }
80 }
81
82 bool canConcatToIndexBuffer(const GrIndexBuffer** ib) {
83 const GrDrawTarget::GeometrySrcState& geomSrc = this->getGeomSrc();
84
85 // we only attempt to concat when reserved verts are used with a client- specified
86 // index buffer. To make this work with client-specified VBs we'd need t o know if the VB
87 // was updated between draws.
88 if (kReserved_GeometrySrcType != geomSrc.fVertexSrc ||
89 kBuffer_GeometrySrcType != geomSrc.fIndexSrc) {
90 return false;
91 }
92
93 *ib = geomSrc.fIndexBuffer;
94 return true;
95 }
96
62 private: 97 private:
63 typedef GrGpu::DrawArgs DrawArgs; 98 typedef GrGpu::DrawArgs DrawArgs;
64 99
65 struct SetState; 100 struct SetState;
66 101
67 struct Cmd : ::SkNoncopyable { 102 struct Cmd : ::SkNoncopyable {
68 enum { 103 enum {
69 kDraw_Cmd = 1, 104 kDraw_Cmd = 1,
70 kStencilPath_Cmd = 2, 105 kStencilPath_Cmd = 2,
71 kSetState_Cmd = 3, 106 kSetState_Cmd = 3,
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 DrawBatch* fDrawBatch; 361 DrawBatch* fDrawBatch;
327 362
328 // This will go away when everything uses batch. However, in the short term anything which 363 // This will go away when everything uses batch. However, in the short term anything which
329 // might be put into the GrInOrderDrawBuffer needs to make sure it closes th e last batch 364 // might be put into the GrInOrderDrawBuffer needs to make sure it closes th e last batch
330 inline void closeBatch(); 365 inline void closeBatch();
331 366
332 typedef GrFlushToGpuDrawTarget INHERITED; 367 typedef GrFlushToGpuDrawTarget INHERITED;
333 }; 368 };
334 369
335 #endif 370 #endif
OLDNEW
« 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