| OLD | NEW |
| 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 #include "GrTessellatingPathRenderer.h" | 8 #include "GrTessellatingPathRenderer.h" |
| 9 | 9 |
| 10 #include "GrAuditTrail.h" | 10 #include "GrAuditTrail.h" |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 bool canMapVB = GrCaps::kNone_MapFlags != target->caps().mapBufferFlags(
); | 180 bool canMapVB = GrCaps::kNone_MapFlags != target->caps().mapBufferFlags(
); |
| 181 StaticVertexAllocator allocator(rp, canMapVB); | 181 StaticVertexAllocator allocator(rp, canMapVB); |
| 182 int count = GrTessellator::PathToTriangles(path, tol, fClipBounds, &allo
cator, &isLinear); | 182 int count = GrTessellator::PathToTriangles(path, tol, fClipBounds, &allo
cator, &isLinear); |
| 183 if (count == 0) { | 183 if (count == 0) { |
| 184 return; | 184 return; |
| 185 } | 185 } |
| 186 this->drawVertices(target, gp, allocator.vertexBuffer(), 0, count); | 186 this->drawVertices(target, gp, allocator.vertexBuffer(), 0, count); |
| 187 TessInfo info; | 187 TessInfo info; |
| 188 info.fTolerance = isLinear ? 0 : tol; | 188 info.fTolerance = isLinear ? 0 : tol; |
| 189 info.fCount = count; | 189 info.fCount = count; |
| 190 SkAutoTUnref<SkData> data(SkData::NewWithCopy(&info, sizeof(info))); | 190 key.setCustomData(SkData::MakeWithCopy(&info, sizeof(info))); |
| 191 key.setCustomData(data.get()); | |
| 192 rp->assignUniqueKeyToResource(key, allocator.vertexBuffer()); | 191 rp->assignUniqueKeyToResource(key, allocator.vertexBuffer()); |
| 193 } | 192 } |
| 194 | 193 |
| 195 void onPrepareDraws(Target* target) const override { | 194 void onPrepareDraws(Target* target) const override { |
| 196 sk_sp<GrGeometryProcessor> gp; | 195 sk_sp<GrGeometryProcessor> gp; |
| 197 { | 196 { |
| 198 using namespace GrDefaultGeoProcFactory; | 197 using namespace GrDefaultGeoProcFactory; |
| 199 | 198 |
| 200 Color color(fColor); | 199 Color color(fColor); |
| 201 LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ? | 200 LocalCoords localCoords(fPipelineInfo.readsLocalCoords() ? |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 vmi.mapRect(&clipBounds); | 296 vmi.mapRect(&clipBounds); |
| 298 GrStyle style; | 297 GrStyle style; |
| 299 do { | 298 do { |
| 300 GrTest::TestStyle(random, &style); | 299 GrTest::TestStyle(random, &style); |
| 301 } while (style.strokeRec().isHairlineStyle()); | 300 } while (style.strokeRec().isHairlineStyle()); |
| 302 GrShape shape(path, style); | 301 GrShape shape(path, style); |
| 303 return TessellatingPathBatch::Create(color, shape, viewMatrix, clipBounds); | 302 return TessellatingPathBatch::Create(color, shape, viewMatrix, clipBounds); |
| 304 } | 303 } |
| 305 | 304 |
| 306 #endif | 305 #endif |
| OLD | NEW |