| 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 "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 SkScalar temp = SkScalarDiv(totalLen, srcIntervalLen); | 72 SkScalar temp = SkScalarDiv(totalLen, srcIntervalLen); |
| 73 SkScalar numFullIntervals = SkScalarFloorToScalar(temp); | 73 SkScalar numFullIntervals = SkScalarFloorToScalar(temp); |
| 74 *endingInt = totalLen - numFullIntervals * srcIntervalLen + info.fPhase; | 74 *endingInt = totalLen - numFullIntervals * srcIntervalLen + info.fPhase; |
| 75 temp = SkScalarDiv(*endingInt, srcIntervalLen); | 75 temp = SkScalarDiv(*endingInt, srcIntervalLen); |
| 76 *endingInt = *endingInt - SkScalarFloorToScalar(temp) * srcIntervalLen; | 76 *endingInt = *endingInt - SkScalarFloorToScalar(temp) * srcIntervalLen; |
| 77 if (0 == *endingInt) { | 77 if (0 == *endingInt) { |
| 78 *endingInt = srcIntervalLen; | 78 *endingInt = srcIntervalLen; |
| 79 } | 79 } |
| 80 if (*endingInt > info.fIntervals[0]) { | 80 if (*endingInt > info.fIntervals[0]) { |
| 81 if (0 == info.fIntervals[0]) { | 81 if (0 == info.fIntervals[0]) { |
| 82 *endingInt -= 0.01; // make sure we capture the last zero size pnt (
used if has caps) | 82 *endingInt -= 0.01f; // make sure we capture the last zero size pnt
(used if has caps) |
| 83 } | 83 } |
| 84 return *endingInt - info.fIntervals[0]; | 84 return *endingInt - info.fIntervals[0]; |
| 85 } | 85 } |
| 86 return 0; | 86 return 0; |
| 87 } | 87 } |
| 88 | 88 |
| 89 | 89 |
| 90 bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const SkPaint& paint, S
kGpuDevice* dev) { | 90 bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const SkPaint& paint, S
kGpuDevice* dev) { |
| 91 GrContext* context = dev->context(); | 91 GrContext* context = dev->context(); |
| 92 if (context->getRenderTarget()->isMultisampled()) { | 92 if (context->getRenderTarget()->isMultisampled()) { |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 effect = DashingLineEffect::Create(edgeType, info, m, strokeWidth); | 488 effect = DashingLineEffect::Create(edgeType, info, m, strokeWidth); |
| 489 return effect; | 489 return effect; |
| 490 } | 490 } |
| 491 | 491 |
| 492 ////////////////////////////////////////////////////////////////////////////// | 492 ////////////////////////////////////////////////////////////////////////////// |
| 493 | 493 |
| 494 GrEffectRef* GrDashingEffect::Create(GrEffectEdgeType edgeType, const SkPathEffe
ct::DashInfo& info, | 494 GrEffectRef* GrDashingEffect::Create(GrEffectEdgeType edgeType, const SkPathEffe
ct::DashInfo& info, |
| 495 const SkMatrix& matrix, SkScalar strokeWidt
h) { | 495 const SkMatrix& matrix, SkScalar strokeWidt
h) { |
| 496 return DashingLineEffect::Create(edgeType, info, matrix, strokeWidth); | 496 return DashingLineEffect::Create(edgeType, info, matrix, strokeWidth); |
| 497 } | 497 } |
| OLD | NEW |