OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #include "GrAADistanceFieldPathRenderer.h" | 9 #include "GrAADistanceFieldPathRenderer.h" |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 | 108 |
109 // padding around path bounds to allow for antialiased pixels | 109 // padding around path bounds to allow for antialiased pixels |
110 static const SkScalar kAntiAliasPad = 1.0f; | 110 static const SkScalar kAntiAliasPad = 1.0f; |
111 | 111 |
112 class AADistanceFieldPathBatch : public GrVertexBatch { | 112 class AADistanceFieldPathBatch : public GrVertexBatch { |
113 public: | 113 public: |
114 typedef GrAADistanceFieldPathRenderer::PathData PathData; | 114 typedef GrAADistanceFieldPathRenderer::PathData PathData; |
115 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; | 115 typedef SkTDynamicHash<PathData, PathData::Key> PathCache; |
116 typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList; | 116 typedef GrAADistanceFieldPathRenderer::PathDataList PathDataList; |
117 | 117 |
| 118 BATCH_CLASS_ID |
118 struct Geometry { | 119 struct Geometry { |
119 Geometry(const SkStrokeRec& stroke) : fStroke(stroke) {} | 120 Geometry(const SkStrokeRec& stroke) : fStroke(stroke) {} |
120 SkPath fPath; | 121 SkPath fPath; |
121 SkStrokeRec fStroke; | 122 SkStrokeRec fStroke; |
122 bool fAntiAlias; | 123 bool fAntiAlias; |
123 PathData* fPathData; | 124 PathData* fPathData; |
124 }; | 125 }; |
125 | 126 |
126 static GrDrawBatch* Create(const Geometry& geometry, GrColor color, const Sk
Matrix& viewMatrix, | 127 static GrDrawBatch* Create(const Geometry& geometry, GrColor color, const Sk
Matrix& viewMatrix, |
127 GrBatchAtlas* atlas, PathCache* pathCache, PathDa
taList* pathList) { | 128 GrBatchAtlas* atlas, PathCache* pathCache, PathDa
taList* pathList) { |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 geometry.fPath = GrTest::TestPath(random); | 618 geometry.fPath = GrTest::TestPath(random); |
618 geometry.fAntiAlias = random->nextBool(); | 619 geometry.fAntiAlias = random->nextBool(); |
619 | 620 |
620 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, | 621 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, |
621 gTestStruct.fAtlas, | 622 gTestStruct.fAtlas, |
622 &gTestStruct.fPathCache, | 623 &gTestStruct.fPathCache, |
623 &gTestStruct.fPathList); | 624 &gTestStruct.fPathList); |
624 } | 625 } |
625 | 626 |
626 #endif | 627 #endif |
OLD | NEW |