| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrDashingEffect.h" | 8 #include "GrDashingEffect.h" |
| 9 | 9 |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 529 | 529 |
| 530 const GrVertexBuffer* vertexBuffer; | 530 const GrVertexBuffer* vertexBuffer; |
| 531 int firstVertex; | 531 int firstVertex; |
| 532 | 532 |
| 533 size_t vertexStride = gp->getVertexStride(); | 533 size_t vertexStride = gp->getVertexStride(); |
| 534 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, | 534 void* vertices = batchTarget->vertexPool()->makeSpace(vertexStride, |
| 535 totalRectCount * k
VertsPerDash, | 535 totalRectCount * k
VertsPerDash, |
| 536 &vertexBuffer, | 536 &vertexBuffer, |
| 537 &firstVertex); | 537 &firstVertex); |
| 538 | 538 |
| 539 if (!vertices || !batchTarget->quadIndexBuffer()) { |
| 540 SkDebugf("Could not allocate buffers\n"); |
| 541 return; |
| 542 } |
| 543 |
| 539 int curVIdx = 0; | 544 int curVIdx = 0; |
| 540 int rectIndex = 0; | 545 int rectIndex = 0; |
| 541 for (int i = 0; i < instanceCount; i++) { | 546 for (int i = 0; i < instanceCount; i++) { |
| 542 Geometry& args = fGeoData[i]; | 547 Geometry& args = fGeoData[i]; |
| 543 | 548 |
| 544 if (!draws[i].fLineDone) { | 549 if (!draws[i].fLineDone) { |
| 545 if (fullDash) { | 550 if (fullDash) { |
| 546 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, args.
fSrcRotInv, | 551 setup_dashed_rect(rects[rectIndex], vertices, curVIdx, args.
fSrcRotInv, |
| 547 draws[i].fStartOffset, draws[i].fDevBloat, | 552 draws[i].fStartOffset, draws[i].fDevBloat, |
| 548 draws[i].fLineLength, draws[i].fHalfDevStr
oke, | 553 draws[i].fLineLength, draws[i].fHalfDevStr
oke, |
| (...skipping 703 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1252 switch (cap) { | 1257 switch (cap) { |
| 1253 case kRound_DashCap: | 1258 case kRound_DashCap: |
| 1254 return DashingCircleEffect::Create(color, edgeType, localMatrix); | 1259 return DashingCircleEffect::Create(color, edgeType, localMatrix); |
| 1255 case kNonRound_DashCap: | 1260 case kNonRound_DashCap: |
| 1256 return DashingLineEffect::Create(color, edgeType, localMatrix); | 1261 return DashingLineEffect::Create(color, edgeType, localMatrix); |
| 1257 default: | 1262 default: |
| 1258 SkFAIL("Unexpected dashed cap."); | 1263 SkFAIL("Unexpected dashed cap."); |
| 1259 } | 1264 } |
| 1260 return NULL; | 1265 return NULL; |
| 1261 } | 1266 } |
| OLD | NEW |