diff options
author | reed <reed@google.com> | 2015-02-06 14:18:46 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-06 14:18:46 -0800 |
commit | 38f1c00772539dcbeccbfa3c45d94bdc4acf3518 (patch) | |
tree | 854eec9bfa4e013c5a028ef691225f406eed4c86 /src/core/SkLineClipper.cpp | |
parent | 37a473697136a57138bf069121ebdcc8652f10d4 (diff) |
faster edge re-sort, drop trailing edges
1. drop edges that are wholly on the right (in the non-convex walker)
2. scan and swap once, instead of swapping as we go during re-sort
BUG=skia:
Review URL: https://codereview.chromium.org/891613003
Diffstat (limited to 'src/core/SkLineClipper.cpp')
-rw-r--r-- | src/core/SkLineClipper.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/core/SkLineClipper.cpp b/src/core/SkLineClipper.cpp index 1645917d70..9d72ea513a 100644 --- a/src/core/SkLineClipper.cpp +++ b/src/core/SkLineClipper.cpp @@ -173,7 +173,7 @@ static void sect_with_horizontal_test_for_pin_results() { #endif int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, - SkPoint lines[]) { + SkPoint lines[], bool canClipToTheRight) { #ifdef SK_DEBUG { static bool gOnce; @@ -241,6 +241,9 @@ int SkLineClipper::ClipLine(const SkPoint pts[], const SkRect& clip, result = tmp; reverse = false; } else if (tmp[index0].fX >= clip.fRight) { // wholly to the right + if (canClipToTheRight) { + return 0; + } tmp[0].fX = tmp[1].fX = clip.fRight; result = tmp; reverse = false; |