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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 if (devIntervals[1] > 0.f || useAA) { | 338 if (devIntervals[1] > 0.f || useAA) { |
339 SkPathEffect::DashInfo devInfo; | 339 SkPathEffect::DashInfo devInfo; |
340 devInfo.fPhase = devPhase; | 340 devInfo.fPhase = devPhase; |
341 devInfo.fCount = 2; | 341 devInfo.fCount = 2; |
342 devInfo.fIntervals = devIntervals; | 342 devInfo.fIntervals = devIntervals; |
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->setGeometryProcessor( |
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 sizeof(DashLineVertex)); |
355 | 355 |
356 int totalRectCnt = 0; | 356 int totalRectCnt = 0; |
357 | 357 |
358 totalRectCnt += !lineDone ? 1 : 0; | 358 totalRectCnt += !lineDone ? 1 : 0; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 switch (cap) { | 848 switch (cap) { |
849 case GrDashingEffect::kRound_DashCap: | 849 case GrDashingEffect::kRound_DashCap: |
850 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); | 850 return DashingCircleEffect::Create(edgeType, info, SkScalarHalf(stro
keWidth)); |
851 case GrDashingEffect::kNonRound_DashCap: | 851 case GrDashingEffect::kNonRound_DashCap: |
852 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 852 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
853 default: | 853 default: |
854 SkFAIL("Unexpected dashed cap."); | 854 SkFAIL("Unexpected dashed cap."); |
855 } | 855 } |
856 return NULL; | 856 return NULL; |
857 } | 857 } |
OLD | NEW |