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

Side by Side Diff: src/gpu/batches/GrDrawVerticesBatch.h

Issue 2104383003: Hide GrDrawVerticesBatch::Geometry and rename to Mesh (Closed) Base URL: https://chromium.googlesource.com/skia.git@moremore
Patch Set: Created 4 years, 5 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 | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawVerticesBatch.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 2015 Google Inc. 2 * Copyright 2015 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 GrDrawVerticesBatch_DEFINED 8 #ifndef GrDrawVerticesBatch_DEFINED
9 #define GrDrawVerticesBatch_DEFINED 9 #define GrDrawVerticesBatch_DEFINED
10 10
11 #include "GrColor.h" 11 #include "GrColor.h"
12 #include "GrTypes.h" 12 #include "GrTypes.h"
13 #include "GrVertexBatch.h" 13 #include "GrVertexBatch.h"
14 #include "SkMatrix.h" 14 #include "SkMatrix.h"
15 #include "SkRect.h" 15 #include "SkRect.h"
16 #include "SkTDArray.h" 16 #include "SkTDArray.h"
17 17
18 class GrBatchFlushState; 18 class GrBatchFlushState;
19 struct GrInitInvariantOutput; 19 struct GrInitInvariantOutput;
20 20
21 class GrDrawVerticesBatch : public GrVertexBatch { 21 class GrDrawVerticesBatch : public GrVertexBatch {
22 public: 22 public:
23 DEFINE_BATCH_CLASS_ID 23 DEFINE_BATCH_CLASS_ID
24 24
25 struct Geometry {
26 GrColor fColor; // Only used if there are no per-vertex colors
27 SkTDArray<SkPoint> fPositions;
28 SkTDArray<uint16_t> fIndices;
29 SkTDArray<GrColor> fColors;
30 SkTDArray<SkPoint> fLocalCoords;
31 };
32 25
33 static GrDrawBatch* Create(const Geometry& geometry, GrPrimitiveType primiti veType, 26 GrDrawVerticesBatch(GrColor color, GrPrimitiveType primitiveType,
34 const SkMatrix& viewMatrix, 27 const SkMatrix& viewMatrix,
35 const SkPoint* positions, int vertexCount, 28 const SkPoint* positions, int vertexCount,
36 const uint16_t* indices, int indexCount, 29 const uint16_t* indices, int indexCount,
37 const GrColor* colors, const SkPoint* localCoords , 30 const GrColor* colors, const SkPoint* localCoords, const SkRect& bounds);
38 const SkRect& bounds) {
39 return new GrDrawVerticesBatch(geometry, primitiveType, viewMatrix, posi tions, vertexCount,
40 indices, indexCount, colors, localCoords, bounds);
41 }
42 31
43 const char* name() const override { return "DrawVerticesBatch"; } 32 const char* name() const override { return "DrawVerticesBatch"; }
44 33
45 void computePipelineOptimizations(GrInitInvariantOutput* color, 34 void computePipelineOptimizations(GrInitInvariantOutput* color,
46 GrInitInvariantOutput* coverage, 35 GrInitInvariantOutput* coverage,
47 GrBatchToXPOverrides* overrides) const ove rride; 36 GrBatchToXPOverrides* overrides) const ove rride;
48 37
49 SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; }
50
51 private: 38 private:
52 void onPrepareDraws(Target*) const override; 39 void onPrepareDraws(Target*) const override;
53 void initBatchTracker(const GrXPOverridesForBatch&) override; 40 void initBatchTracker(const GrXPOverridesForBatch&) override;
54 41
55 GrDrawVerticesBatch(const Geometry& geometry, GrPrimitiveType primitiveType,
56 const SkMatrix& viewMatrix,
57 const SkPoint* positions, int vertexCount,
58 const uint16_t* indices, int indexCount,
59 const GrColor* colors, const SkPoint* localCoords, const SkRect& bounds);
60
61 GrPrimitiveType primitiveType() const { return fPrimitiveType; } 42 GrPrimitiveType primitiveType() const { return fPrimitiveType; }
62 bool batchablePrimitiveType() const { 43 bool batchablePrimitiveType() const {
63 return kTriangles_GrPrimitiveType == fPrimitiveType || 44 return kTriangles_GrPrimitiveType == fPrimitiveType ||
64 kLines_GrPrimitiveType == fPrimitiveType || 45 kLines_GrPrimitiveType == fPrimitiveType ||
65 kPoints_GrPrimitiveType == fPrimitiveType; 46 kPoints_GrPrimitiveType == fPrimitiveType;
66 } 47 }
67 48
68 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override; 49 bool onCombineIfPossible(GrBatch* t, const GrCaps&) override;
69 50
51 struct Mesh {
52 GrColor fColor; // Only used if there are no per-vertex colors
53 SkTDArray<SkPoint> fPositions;
54 SkTDArray<uint16_t> fIndices;
55 SkTDArray<GrColor> fColors;
56 SkTDArray<SkPoint> fLocalCoords;
57 };
58
70 GrPrimitiveType fPrimitiveType; 59 GrPrimitiveType fPrimitiveType;
71 SkMatrix fViewMatrix; 60 SkMatrix fViewMatrix;
72 bool fVariableColor; 61 bool fVariableColor;
73 int fVertexCount; 62 int fVertexCount;
74 int fIndexCount; 63 int fIndexCount;
75 bool fCoverageIgnored; // comes from initBatchTracker. 64 bool fCoverageIgnored; // comes from initBatchTracker.
76 65
77 SkSTArray<1, Geometry, true> fGeoData; 66 SkSTArray<1, Mesh, true> fMeshes;
78 67
79 typedef GrVertexBatch INHERITED; 68 typedef GrVertexBatch INHERITED;
80 }; 69 };
81 70
82 #endif 71 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrDrawContext.cpp ('k') | src/gpu/batches/GrDrawVerticesBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698