| 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)); | |
| 355 | 354 |
| 356 int totalRectCnt = 0; | 355 int totalRectCnt = 0; |
| 357 | 356 |
| 358 totalRectCnt += !lineDone ? 1 : 0; | 357 totalRectCnt += !lineDone ? 1 : 0; |
| 359 totalRectCnt += hasStartRect ? 1 : 0; | 358 totalRectCnt += hasStartRect ? 1 : 0; |
| 360 totalRectCnt += hasEndRect ? 1 : 0; | 359 totalRectCnt += hasEndRect ? 1 : 0; |
| 361 | 360 |
| 362 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); | 361 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); |
| 363 if (!geo.succeeded()) { | 362 if (!geo.succeeded()) { |
| 364 GrPrintf("Failed to get space for vertices!\n"); | 363 GrPrintf("Failed to get space for vertices!\n"); |
| (...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 switch (cap) { | 847 switch (cap) { |
| 849 case GrDashingEffect::kRound_DashCap: | 848 case GrDashingEffect::kRound_DashCap: |
| 850 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 849 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
| 851 case GrDashingEffect::kNonRound_DashCap: | 850 case GrDashingEffect::kNonRound_DashCap: |
| 852 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 851 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
| 853 default: | 852 default: |
| 854 SkFAIL("Unexpected dashed cap."); | 853 SkFAIL("Unexpected dashed cap."); |
| 855 } | 854 } |
| 856 return NULL; | 855 return NULL; |
| 857 } | 856 } |
| OLD | NEW |