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 "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 class StaticVertexAllocator : public GrTessellator::VertexAllocator { | 62 class StaticVertexAllocator : public GrTessellator::VertexAllocator { |
63 public: | 63 public: |
64 StaticVertexAllocator(GrResourceProvider* resourceProvider, bool canMapVB) | 64 StaticVertexAllocator(GrResourceProvider* resourceProvider, bool canMapVB) |
65 : fResourceProvider(resourceProvider) | 65 : fResourceProvider(resourceProvider) |
66 , fCanMapVB(canMapVB) | 66 , fCanMapVB(canMapVB) |
67 , fVertices(nullptr) { | 67 , fVertices(nullptr) { |
68 } | 68 } |
69 SkPoint* lock(int vertexCount) override { | 69 SkPoint* lock(int vertexCount) override { |
70 size_t size = vertexCount * sizeof(SkPoint); | 70 size_t size = vertexCount * sizeof(SkPoint); |
71 fVertexBuffer.reset(fResourceProvider->createBuffer( | 71 fVertexBuffer.reset(fResourceProvider->createBuffer( |
72 kVertex_GrBufferType, size, kStatic_GrAccessPattern, 0)); | 72 size, kVertex_GrBufferType, kStatic_GrAccessPattern, 0)); |
73 if (!fVertexBuffer.get()) { | 73 if (!fVertexBuffer.get()) { |
74 return nullptr; | 74 return nullptr; |
75 } | 75 } |
76 if (fCanMapVB) { | 76 if (fCanMapVB) { |
77 fVertices = static_cast<SkPoint*>(fVertexBuffer->map()); | 77 fVertices = static_cast<SkPoint*>(fVertexBuffer->map()); |
78 } else { | 78 } else { |
79 fVertices = new SkPoint[vertexCount]; | 79 fVertices = new SkPoint[vertexCount]; |
80 } | 80 } |
81 return fVertices; | 81 return fVertices; |
82 } | 82 } |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 bool result = viewMatrix.invert(&vmi); | 319 bool result = viewMatrix.invert(&vmi); |
320 if (!result) { | 320 if (!result) { |
321 SkFAIL("Cannot invert matrix\n"); | 321 SkFAIL("Cannot invert matrix\n"); |
322 } | 322 } |
323 vmi.mapRect(&clipBounds); | 323 vmi.mapRect(&clipBounds); |
324 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); | 324 GrStrokeInfo strokeInfo = GrTest::TestStrokeInfo(random); |
325 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); | 325 return TessellatingPathBatch::Create(color, path, strokeInfo, viewMatrix, cl
ipBounds); |
326 } | 326 } |
327 | 327 |
328 #endif | 328 #endif |
OLD | NEW |