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 "../GrAARectRenderer.h" | 10 #include "../GrAARectRenderer.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
47 return false; | 47 return false; |
48 } | 48 } |
49 | 49 |
50 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo(); | 50 const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo(); |
51 if (0 == info.fIntervals[0] && 0 == info.fIntervals[1]) { | 51 if (0 == info.fIntervals[0] && 0 == info.fIntervals[1]) { |
52 return false; | 52 return false; |
53 } | 53 } |
54 | 54 |
55 SkPaint::Cap cap = strokeInfo.getStrokeRec().getCap(); | 55 SkPaint::Cap cap = strokeInfo.getStrokeRec().getCap(); |
56 // Current we do don't handle Round or Square cap dashes | 56 // Current we do don't handle Round or Square cap dashes |
57 if (SkPaint::kRound_Cap == cap) { | 57 if (SkPaint::kRound_Cap == cap && info.fIntervals[0] != 0.f) { |
58 return false; | 58 return false; |
59 } | 59 } |
60 | 60 |
61 return true; | 61 return true; |
62 } | 62 } |
63 | 63 |
64 namespace { | 64 namespace { |
65 | 65 |
66 struct DashLineVertex { | 66 struct DashLineVertex { |
67 SkPoint fPos; | 67 SkPoint fPos; |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
197 memcpy(ptsRot, pts, 2 * sizeof(SkPoint)); | 197 memcpy(ptsRot, pts, 2 * sizeof(SkPoint)); |
198 } | 198 } |
199 | 199 |
200 bool useAA = paint.isAntiAlias(); | 200 bool useAA = paint.isAntiAlias(); |
201 | 201 |
202 // Scale corrections of intervals and stroke from view matrix | 202 // Scale corrections of intervals and stroke from view matrix |
203 SkScalar parallelScale; | 203 SkScalar parallelScale; |
204 SkScalar perpScale; | 204 SkScalar perpScale; |
205 calc_dash_scaling(¶llelScale, &perpScale, vm, ptsRot); | 205 calc_dash_scaling(¶llelScale, &perpScale, vm, ptsRot); |
206 | 206 |
207 bool hasCap = SkPaint::kSquare_Cap == cap && 0 != srcStrokeWidth; | 207 bool hasCap = SkPaint::kButt_Cap != cap && 0 != srcStrokeWidth; |
208 | 208 |
209 // We always want to at least stroke out half a pixel on each side in device space | 209 // We always want to at least stroke out half a pixel on each side in device space |
210 // so 0.5f / perpScale gives us this min in src space | 210 // so 0.5f / perpScale gives us this min in src space |
211 SkScalar halfSrcStroke = SkMaxScalar(srcStrokeWidth * 0.5f, 0.5f / perpScale ); | 211 SkScalar halfSrcStroke = SkMaxScalar(srcStrokeWidth * 0.5f, 0.5f / perpScale ); |
212 | 212 |
213 SkScalar strokeAdj; | 213 SkScalar strokeAdj; |
214 if (!hasCap) { | 214 if (!hasCap) { |
215 strokeAdj = 0.f; | 215 strokeAdj = 0.f; |
216 } else { | 216 } else { |
217 strokeAdj = halfSrcStroke; | 217 strokeAdj = halfSrcStroke; |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
334 } | 334 } |
335 devIntervals[0] = lineLength; | 335 devIntervals[0] = lineLength; |
336 } | 336 } |
337 if (devIntervals[1] > 0.f || useAA) { | 337 if (devIntervals[1] > 0.f || useAA) { |
338 SkPathEffect::DashInfo devInfo; | 338 SkPathEffect::DashInfo devInfo; |
339 devInfo.fPhase = devPhase; | 339 devInfo.fPhase = devPhase; |
340 devInfo.fCount = 2; | 340 devInfo.fCount = 2; |
341 devInfo.fIntervals = devIntervals; | 341 devInfo.fIntervals = devIntervals; |
342 GrEffectEdgeType edgeType= useAA ? kFillAA_GrEffectEdgeType : | 342 GrEffectEdgeType edgeType= useAA ? kFillAA_GrEffectEdgeType : |
343 kFillBW_GrEffectEdgeType; | 343 kFillBW_GrEffectEdgeType; |
344 bool isRoundCap = SkPaint::kRound_Cap == cap && srcStrokeWidth != 0; | |
344 drawState->addCoverageEffect( | 345 drawState->addCoverageEffect( |
345 GrDashingEffect::Create(edgeType, devInfo, strokeWidth), 1)->unref() ; | 346 GrDashingEffect::Create(edgeType, devInfo, strokeWidth, isRoundCap), 1)->unref(); |
346 } | 347 } |
347 | 348 |
348 // Set up the vertex data for the line and start/end dashes | 349 // Set up the vertex data for the line and start/end dashes |
349 drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLine VertexAttribs)); | 350 drawState->setVertexAttribs<gDashLineVertexAttribs>(SK_ARRAY_COUNT(gDashLine VertexAttribs)); |
350 | 351 |
351 int totalRectCnt = 0; | 352 int totalRectCnt = 0; |
352 | 353 |
353 totalRectCnt += !lineDone ? 1 : 0; | 354 totalRectCnt += !lineDone ? 1 : 0; |
354 totalRectCnt += hasStartRect ? 1 : 0; | 355 totalRectCnt += hasStartRect ? 1 : 0; |
355 totalRectCnt += hasEndRect ? 1 : 0; | 356 totalRectCnt += hasEndRect ? 1 : 0; |
356 | 357 |
357 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); | 358 GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0); |
358 if (!geo.succeeded()) { | 359 if (!geo.succeeded()) { |
359 GrPrintf("Failed to get space for vertices!\n"); | 360 GrPrintf("Failed to get space for vertices!\n"); |
360 return false; | 361 return false; |
361 } | 362 } |
362 | 363 |
363 DashLineVertex* verts = reinterpret_cast<DashLineVertex*>(geo.vertices()); | 364 DashLineVertex* verts = reinterpret_cast<DashLineVertex*>(geo.vertices()); |
364 | 365 |
365 int curVIdx = 0; | 366 int curVIdx = 0; |
366 | 367 |
368 if (SkPaint::kRound_Cap == cap && 0 != srcStrokeWidth) { | |
369 // need to adjust this for round caps to correctly set the dashPos attri b on vertices | |
370 startOffset -= halfDevStroke; | |
371 } | |
372 | |
367 // Draw interior part of dashed line | 373 // Draw interior part of dashed line |
368 if (!lineDone) { | 374 if (!lineDone) { |
369 SkPoint devicePts[2]; | 375 SkPoint devicePts[2]; |
370 vm.mapPoints(devicePts, ptsRot, 2); | 376 vm.mapPoints(devicePts, ptsRot, 2); |
371 SkScalar lineLength = SkPoint::Distance(devicePts[0], devicePts[1]); | 377 SkScalar lineLength = SkPoint::Distance(devicePts[0], devicePts[1]); |
372 if (hasCap) { | 378 if (hasCap) { |
373 lineLength += 2.f * halfDevStroke; | 379 lineLength += 2.f * halfDevStroke; |
374 } | 380 } |
375 | 381 |
376 SkRect bounds; | 382 SkRect bounds; |
(...skipping 20 matching lines...) Expand all Loading... | |
397 } | 403 } |
398 | 404 |
399 target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer()); | 405 target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer()); |
400 target->drawIndexedInstances(kTriangles_GrPrimitiveType, totalRectCnt, 4, 6) ; | 406 target->drawIndexedInstances(kTriangles_GrPrimitiveType, totalRectCnt, 4, 6) ; |
401 target->resetIndexSource(); | 407 target->resetIndexSource(); |
402 return true; | 408 return true; |
403 } | 409 } |
404 | 410 |
405 ////////////////////////////////////////////////////////////////////////////// | 411 ////////////////////////////////////////////////////////////////////////////// |
406 | 412 |
413 class GLDashingCircleEffect; | |
414 | |
415 class DashingCircleEffect : public GrVertexEffect { | |
416 public: | |
417 typedef SkPathEffect::DashInfo DashInfo; | |
418 | |
419 /** | |
420 * The effect calculates the coverage for the case of a horizontal line in d evice space. | |
421 * The matrix that is passed in should be able to convert a line in source s pace to a | |
422 * horizontal line in device space. Additionally, the coord transform matrix should translate | |
423 * the the start of line to origin, and the shift it along the positive x-ax is by the phase | |
424 * and half the off interval. | |
425 */ | |
426 static GrEffectRef* Create(GrEffectEdgeType edgeType, const DashInfo& info, | |
427 SkScalar strokeWidth); | |
428 | |
429 virtual ~DashingCircleEffect(); | |
430 | |
431 static const char* Name() { return "DashingCircleEffect"; } | |
432 | |
433 GrEffectEdgeType getEdgeType() const { return fEdgeType; } | |
434 | |
435 SkScalar getRadius() const { return fRadius; } | |
436 | |
437 SkScalar getCenterX() const { return fCenterX; } | |
438 | |
439 SkScalar getIntervalLength() const { return fIntervalLength; } | |
440 | |
441 typedef GLDashingCircleEffect GLEffect; | |
442 | |
443 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags ) const SK_OVERRIDE; | |
444 | |
445 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE; | |
446 | |
447 private: | |
448 DashingCircleEffect(GrEffectEdgeType edgeType, const DashInfo& info, SkScala r strokeWidth); | |
449 | |
450 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; | |
451 | |
452 GrEffectEdgeType fEdgeType; | |
453 SkScalar fIntervalLength; | |
454 SkScalar fRadius; | |
455 SkScalar fCenterX; | |
456 | |
457 GR_DECLARE_EFFECT_TEST; | |
458 | |
459 typedef GrVertexEffect INHERITED; | |
460 }; | |
461 | |
462 ////////////////////////////////////////////////////////////////////////////// | |
463 | |
464 class GLDashingCircleEffect : public GrGLVertexEffect { | |
465 public: | |
466 GLDashingCircleEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | |
467 | |
468 virtual void emitCode(GrGLFullShaderBuilder* builder, | |
469 const GrDrawEffect& drawEffect, | |
470 EffectKey key, | |
471 const char* outputColor, | |
472 const char* inputColor, | |
473 const TransformedCoordsArray&, | |
474 const TextureSamplerArray&) SK_OVERRIDE; | |
475 | |
476 static inline EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&); | |
477 | |
478 virtual void setData(const GrGLUniformManager&, const GrDrawEffect&) SK_OVER RIDE; | |
479 | |
480 private: | |
481 GrGLUniformManager::UniformHandle fParamUniform; | |
482 SkScalar fPrevRadius; | |
483 SkScalar fPrevCenterX; | |
484 SkScalar fPrevIntervalLength; | |
485 typedef GrGLVertexEffect INHERITED; | |
486 }; | |
487 | |
488 GLDashingCircleEffect::GLDashingCircleEffect(const GrBackendEffectFactory& facto ry, | |
489 const GrDrawEffect& drawEffect) | |
490 : INHERITED (factory) { | |
491 fPrevRadius = SK_ScalarMin; | |
492 fPrevCenterX = SK_ScalarMin; | |
493 fPrevIntervalLength = SK_ScalarMax; | |
494 } | |
495 | |
496 void GLDashingCircleEffect::emitCode(GrGLFullShaderBuilder* builder, | |
497 const GrDrawEffect& drawEffect, | |
498 EffectKey key, | |
499 const char* outputColor, | |
500 const char* inputColor, | |
501 const TransformedCoordsArray&, | |
502 const TextureSamplerArray& samplers) { | |
503 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>( ); | |
504 const char *paramName; | |
505 // The param uniforms, xyz, refer to circle radius - 0.5, cicles center x co ord, and | |
506 // the total interval length of the dash. | |
507 fParamUniform = builder->addUniform(GrGLShaderBuilder::kFragment_Visibility, | |
508 kVec3f_GrSLType, | |
509 "params", | |
510 ¶mName); | |
511 | |
512 const char *vsCoordName, *fsCoordName; | |
513 builder->addVarying(kVec2f_GrSLType, "Coord", &vsCoordName, &fsCoordName); | |
514 const SkString* attr0Name = | |
515 builder->getEffectAttributeName(drawEffect.getVertexAttribIndices()[0]); | |
516 builder->vsCodeAppendf("\t%s = %s;\n", vsCoordName, attr0Name->c_str()); | |
517 | |
518 // transforms all points so that we can compare them to our test rect | |
bsalomon
2014/06/25 14:20:44
test circle?
| |
519 builder->fsCodeAppendf("\t\tfloat xShifted = %s.x - floor(%s.x / %s.z) * %s. z;\n", | |
520 fsCoordName, fsCoordName, paramName, paramName); | |
521 builder->fsCodeAppendf("\t\tvec2 fragPosShifted = vec2(xShifted, %s.y);\n", fsCoordName); | |
522 builder->fsCodeAppendf("\t\tvec2 center = vec2(%s.y, 0.0);\n", paramName); | |
523 builder->fsCodeAppend("\t\tfloat dist = length(center - fragPosShifted);\n") ; | |
524 if (GrEffectEdgeTypeIsAA(dce.getEdgeType())) { | |
525 // The amount of coverage removed in x and y by the edges is computed as a pair of negative | |
bsalomon
2014/06/25 14:20:44
This comment should be removed right?
| |
526 // numbers, xSub and ySub. | |
527 builder->fsCodeAppendf("\t\tfloat diff = dist - %s.x;\n", paramName); | |
528 builder->fsCodeAppend("\t\tdiff = 1 - diff;\n"); | |
529 builder->fsCodeAppend("\t\tfloat alpha = clamp(diff, 0.0, 1.0);\n"); | |
530 } else { | |
531 // Assuming the bounding geometry is tight so no need to check y values | |
532 builder->fsCodeAppendf("\t\tfloat alpha = 1.0;\n"); | |
533 builder->fsCodeAppendf("\t\talpha *= dist < %s.x + 0.5 ? 1.0 : 0.0;\n", paramName); | |
534 } | |
535 builder->fsCodeAppendf("\t\t%s = %s;\n", outputColor, | |
536 (GrGLSLExpr4(inputColor) * GrGLSLExpr1("alpha")).c_st r()); | |
537 } | |
538 | |
539 void GLDashingCircleEffect::setData(const GrGLUniformManager& uman, const GrDraw Effect& drawEffect) { | |
540 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>( ); | |
541 SkScalar radius = dce.getRadius(); | |
542 SkScalar centerX = dce.getCenterX(); | |
543 SkScalar intervalLength = dce.getIntervalLength(); | |
544 if (radius != fPrevRadius || centerX != fPrevCenterX || intervalLength != fP revIntervalLength) { | |
545 uman.set3f(fParamUniform, radius - 0.5f, centerX, intervalLength); | |
546 fPrevRadius = radius; | |
547 fPrevCenterX = centerX; | |
548 fPrevIntervalLength = intervalLength; | |
549 } | |
550 } | |
551 | |
552 GrGLEffect::EffectKey GLDashingCircleEffect::GenKey(const GrDrawEffect& drawEffe ct, | |
553 const GrGLCaps&) { | |
554 const DashingCircleEffect& dce = drawEffect.castEffect<DashingCircleEffect>( ); | |
555 return dce.getEdgeType(); | |
556 } | |
557 | |
558 ////////////////////////////////////////////////////////////////////////////// | |
559 | |
560 GrEffectRef* DashingCircleEffect::Create(GrEffectEdgeType edgeType, const DashIn fo& info, | |
561 SkScalar strokeWidth) { | |
562 if (info.fCount != 2 || info.fIntervals[0] != 0) { | |
563 return NULL; | |
564 } | |
565 | |
566 return CreateEffectRef(AutoEffectUnref(SkNEW_ARGS(DashingCircleEffect, | |
567 (edgeType, info, strokeWid th)))); | |
568 } | |
569 | |
570 DashingCircleEffect::~DashingCircleEffect() {} | |
571 | |
572 void DashingCircleEffect::getConstantColorComponents(GrColor* color, uint32_t* v alidFlags) const { | |
573 *validFlags = 0; | |
574 } | |
575 | |
576 const GrBackendEffectFactory& DashingCircleEffect::getFactory() const { | |
577 return GrTBackendEffectFactory<DashingCircleEffect>::getInstance(); | |
578 } | |
579 | |
580 DashingCircleEffect::DashingCircleEffect(GrEffectEdgeType edgeType, const DashIn fo& info, | |
581 SkScalar strokeWidth) | |
582 : fEdgeType(edgeType) { | |
583 SkScalar onLen = info.fIntervals[0]; | |
584 SkScalar offLen = info.fIntervals[1]; | |
585 fIntervalLength = onLen + offLen; | |
586 fRadius = SkScalarHalf(strokeWidth); | |
587 fCenterX = SkScalarHalf(offLen); | |
588 | |
589 this->addVertexAttrib(kVec2f_GrSLType); | |
590 } | |
591 | |
592 bool DashingCircleEffect::onIsEqual(const GrEffect& other) const { | |
593 const DashingCircleEffect& dce = CastEffect<DashingCircleEffect>(other); | |
594 return (fEdgeType == dce.fEdgeType && | |
595 fIntervalLength == dce.fIntervalLength && | |
596 fRadius == dce.fRadius && | |
597 fCenterX == dce.fCenterX); | |
598 } | |
599 | |
600 GR_DEFINE_EFFECT_TEST(DashingCircleEffect); | |
601 | |
602 GrEffectRef* DashingCircleEffect::TestCreate(SkRandom* random, | |
603 GrContext*, | |
604 const GrDrawTargetCaps& caps, | |
605 GrTexture*[]) { | |
606 GrEffectRef* effect; | |
607 GrEffectEdgeType edgeType = static_cast<GrEffectEdgeType>(random->nextULessT han( | |
608 kGrEffectEdgeTypeCnt)); | |
609 SkScalar strokeWidth = random->nextRangeScalar(0, 100.f); | |
610 DashInfo info; | |
611 info.fCount = 2; | |
612 SkAutoTArray<SkScalar> intervals(info.fCount); | |
613 info.fIntervals = intervals.get(); | |
614 info.fIntervals[0] = random->nextRangeScalar(0, 10.f); | |
615 info.fIntervals[1] = random->nextRangeScalar(0, 10.f); | |
616 info.fPhase = random->nextRangeScalar(0, info.fIntervals[0] + info.fInterval s[1]); | |
617 | |
618 effect = DashingCircleEffect::Create(edgeType, info, strokeWidth); | |
619 return effect; | |
620 } | |
621 | |
622 ////////////////////////////////////////////////////////////////////////////// | |
623 | |
407 class GLDashingLineEffect; | 624 class GLDashingLineEffect; |
408 | 625 |
409 class DashingLineEffect : public GrVertexEffect { | 626 class DashingLineEffect : public GrVertexEffect { |
410 public: | 627 public: |
411 typedef SkPathEffect::DashInfo DashInfo; | 628 typedef SkPathEffect::DashInfo DashInfo; |
412 | 629 |
413 /** | 630 /** |
414 * The effect calculates the coverage for the case of a horizontal line in d evice space. | 631 * The effect calculates the coverage for the case of a horizontal line in d evice space. |
415 * The matrix that is passed in should be able to convert a line in source s pace to a | 632 * The matrix that is passed in should be able to convert a line in source s pace to a |
416 * horizontal line in device space. Additionally, the coord transform matrix should translate | 633 * horizontal line in device space. Additionally, the coord transform matrix should translate |
(...skipping 23 matching lines...) Expand all Loading... | |
440 DashingLineEffect(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth); | 657 DashingLineEffect(GrEffectEdgeType edgeType, const DashInfo& info, SkScalar strokeWidth); |
441 | 658 |
442 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; | 659 virtual bool onIsEqual(const GrEffect& other) const SK_OVERRIDE; |
443 | 660 |
444 GrEffectEdgeType fEdgeType; | 661 GrEffectEdgeType fEdgeType; |
445 SkRect fRect; | 662 SkRect fRect; |
446 SkScalar fIntervalLength; | 663 SkScalar fIntervalLength; |
447 | 664 |
448 GR_DECLARE_EFFECT_TEST; | 665 GR_DECLARE_EFFECT_TEST; |
449 | 666 |
450 typedef GrEffect INHERITED; | 667 typedef GrVertexEffect INHERITED; |
451 }; | 668 }; |
452 | 669 |
453 ////////////////////////////////////////////////////////////////////////////// | 670 ////////////////////////////////////////////////////////////////////////////// |
454 | 671 |
455 class GLDashingLineEffect : public GrGLVertexEffect { | 672 class GLDashingLineEffect : public GrGLVertexEffect { |
456 public: | 673 public: |
457 GLDashingLineEffect(const GrBackendEffectFactory&, const GrDrawEffect&); | 674 GLDashingLineEffect(const GrBackendEffectFactory&, const GrDrawEffect&); |
458 | 675 |
459 virtual void emitCode(GrGLFullShaderBuilder* builder, | 676 virtual void emitCode(GrGLFullShaderBuilder* builder, |
460 const GrDrawEffect& drawEffect, | 677 const GrDrawEffect& drawEffect, |
(...skipping 13 matching lines...) Expand all Loading... | |
474 SkRect fPrevRect; | 691 SkRect fPrevRect; |
475 SkScalar fPrevIntervalLength; | 692 SkScalar fPrevIntervalLength; |
476 typedef GrGLVertexEffect INHERITED; | 693 typedef GrGLVertexEffect INHERITED; |
477 }; | 694 }; |
478 | 695 |
479 GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory, | 696 GLDashingLineEffect::GLDashingLineEffect(const GrBackendEffectFactory& factory, |
480 const GrDrawEffect& drawEffect) | 697 const GrDrawEffect& drawEffect) |
481 : INHERITED (factory) { | 698 : INHERITED (factory) { |
482 fPrevRect.fLeft = SK_ScalarNaN; | 699 fPrevRect.fLeft = SK_ScalarNaN; |
483 fPrevIntervalLength = SK_ScalarMax; | 700 fPrevIntervalLength = SK_ScalarMax; |
484 | |
485 } | 701 } |
486 | 702 |
487 void GLDashingLineEffect::emitCode(GrGLFullShaderBuilder* builder, | 703 void GLDashingLineEffect::emitCode(GrGLFullShaderBuilder* builder, |
488 const GrDrawEffect& drawEffect, | 704 const GrDrawEffect& drawEffect, |
489 EffectKey key, | 705 EffectKey key, |
490 const char* outputColor, | 706 const char* outputColor, |
491 const char* inputColor, | 707 const char* inputColor, |
492 const TransformedCoordsArray&, | 708 const TransformedCoordsArray&, |
493 const TextureSamplerArray& samplers) { | 709 const TextureSamplerArray& samplers) { |
494 const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>(); | 710 const DashingLineEffect& de = drawEffect.castEffect<DashingLineEffect>(); |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
616 info.fIntervals[1] = random->nextRangeScalar(0, 10.f); | 832 info.fIntervals[1] = random->nextRangeScalar(0, 10.f); |
617 info.fPhase = random->nextRangeScalar(0, info.fIntervals[0] + info.fInterval s[1]); | 833 info.fPhase = random->nextRangeScalar(0, info.fIntervals[0] + info.fInterval s[1]); |
618 | 834 |
619 effect = DashingLineEffect::Create(edgeType, info, strokeWidth); | 835 effect = DashingLineEffect::Create(edgeType, info, strokeWidth); |
620 return effect; | 836 return effect; |
621 } | 837 } |
622 | 838 |
623 ////////////////////////////////////////////////////////////////////////////// | 839 ////////////////////////////////////////////////////////////////////////////// |
624 | 840 |
625 GrEffectRef* GrDashingEffect::Create(GrEffectEdgeType edgeType, const SkPathEffe ct::DashInfo& info, | 841 GrEffectRef* GrDashingEffect::Create(GrEffectEdgeType edgeType, const SkPathEffe ct::DashInfo& info, |
626 SkScalar strokeWidth) { | 842 SkScalar strokeWidth, bool isRoundCaps) { |
843 if (isRoundCaps) { | |
844 return DashingCircleEffect::Create(edgeType, info, strokeWidth); | |
845 //return NULL; | |
846 } | |
627 return DashingLineEffect::Create(edgeType, info, strokeWidth); | 847 return DashingLineEffect::Create(edgeType, info, strokeWidth); |
628 } | 848 } |
OLD | NEW |