diff options
author | 2016-06-02 05:21:34 -0700 | |
---|---|---|
committer | 2016-06-02 05:21:34 -0700 | |
commit | 0851d2d04716ad4a7c7a646a5846a81db3d5b925 (patch) | |
tree | 17c3acb01bd0dde2b4af923b51cffe05e723ca40 /src/core/SkPoint.cpp | |
parent | 99600d0a158e3b2f1ff077a6fd102e78ce9db0e4 (diff) |
Handle stroked single line special case in Ganesh
This CL roughly halves the time spent on the captured stroked lines skp.
On my Linux desktop it boosts the external benchmark from 2618 to 5007.
This is a companion to: https://codereview.chromium.org/2019193002/ (Add new GM to exercise stroked line special case)
The idea is to land the GM first so any regressions are visible.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2023693002
Review-Url: https://codereview.chromium.org/2023693002
Diffstat (limited to 'src/core/SkPoint.cpp')
-rw-r--r-- | src/core/SkPoint.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp index 490e4a2d2d..162c62acad 100644 --- a/src/core/SkPoint.cpp +++ b/src/core/SkPoint.cpp @@ -88,8 +88,8 @@ static inline float getLengthSquared(float dx, float dy) { // This logic is encapsulated in a helper method to make it explicit that we // always perform this check in the same manner, to avoid inconsistencies // (see http://code.google.com/p/skia/issues/detail?id=560 ). -static inline bool isLengthNearlyZero(float dx, float dy, - float *lengthSquared) { +static inline bool is_length_nearly_zero(float dx, float dy, + float *lengthSquared) { *lengthSquared = getLengthSquared(dx, dy); return *lengthSquared <= (SK_ScalarNearlyZero * SK_ScalarNearlyZero); } @@ -98,7 +98,7 @@ SkScalar SkPoint::Normalize(SkPoint* pt) { float x = pt->fX; float y = pt->fY; float mag2; - if (isLengthNearlyZero(x, y, &mag2)) { + if (is_length_nearly_zero(x, y, &mag2)) { pt->set(0, 0); return 0; } @@ -146,7 +146,7 @@ SkScalar SkPoint::Length(SkScalar dx, SkScalar dy) { */ bool SkPoint::setLength(float x, float y, float length) { float mag2; - if (isLengthNearlyZero(x, y, &mag2)) { + if (is_length_nearly_zero(x, y, &mag2)) { this->set(0, 0); return false; } @@ -183,7 +183,7 @@ bool SkPoint::setLengthFast(float length) { bool SkPoint::setLengthFast(float x, float y, float length) { float mag2; - if (isLengthNearlyZero(x, y, &mag2)) { + if (is_length_nearly_zero(x, y, &mag2)) { this->set(0, 0); return false; } |