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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrDashingEffect.h" | 9 #include "GrDashingEffect.h" |
10 | 10 |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 GrEffectEdgeType edgeType= useAA ? kFillAA_GrEffectEdgeType : | 343 GrEffectEdgeType edgeType= useAA ? kFillAA_GrEffectEdgeType : |
344 kFillBW_GrEffectEdgeType; | 344 kFillBW_GrEffectEdgeType; |
345 bool isRoundCap = SkPaint::kRound_Cap == cap; | 345 bool isRoundCap = SkPaint::kRound_Cap == cap; |
346 GrDashingEffect::DashCap capType = isRoundCap ? GrDashingEffect::kRound_
DashCap : | 346 GrDashingEffect::DashCap capType = isRoundCap ? GrDashingEffect::kRound_
DashCap : |
347 GrDashingEffect::kNonRou
nd_DashCap; | 347 GrDashingEffect::kNonRou
nd_DashCap; |
348 drawState->addCoverageEffect( | 348 drawState->addCoverageEffect( |
349 GrDashingEffect::Create(edgeType, devInfo, strokeWidth, capType), 1)
->unref(); | 349 GrDashingEffect::Create(edgeType, devInfo, strokeWidth, capType), 1)
->unref(); |
350 } | 350 } |
351 | 351 |
352 // Set up the vertex data for the line and start/end dashes | 352 // Set up the vertex data for the line and start/end dashes |
353 drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLine
VertexAttribs)); | 353 drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLine
VertexAttribs), |
| 354 sizeof(DashLineVertex)); |
354 | 355 |
355 int totalRectCnt = 0; | 356 int totalRectCnt = 0; |
356 | 357 |
357 totalRectCnt += !lineDone ? 1 : 0; | 358 totalRectCnt += !lineDone ? 1 : 0; |
358 totalRectCnt += hasStartRect ? 1 : 0; | 359 totalRectCnt += hasStartRect ? 1 : 0; |
359 totalRectCnt += hasEndRect ? 1 : 0; | 360 totalRectCnt += hasEndRect ? 1 : 0; |
360 | 361 |
361 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); | 362 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); |
362 if (!geo.succeeded()) { | 363 if (!geo.succeeded()) { |
363 GrPrintf("Failed to get space for vertices!\n"); | 364 GrPrintf("Failed to get space for vertices!\n"); |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 switch (cap) { | 848 switch (cap) { |
848 case GrDashingEffect::kRound_DashCap: | 849 case GrDashingEffect::kRound_DashCap: |
849 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 850 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
850 case GrDashingEffect::kNonRound_DashCap: | 851 case GrDashingEffect::kNonRound_DashCap: |
851 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 852 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
852 default: | 853 default: |
853 SkFAIL("Unexpected dashed cap."); | 854 SkFAIL("Unexpected dashed cap."); |
854 } | 855 } |
855 return NULL; | 856 return NULL; |
856 } | 857 } |
OLD | NEW |