diff options
author | 2014-06-20 13:59:15 -0700 | |
---|---|---|
committer | 2014-06-20 13:59:15 -0700 | |
commit | b8f07988494a62fbe8fba70129b1bb9366e9f6ee (patch) | |
tree | 27dc0d16f2d3798398a58a38817ab9be20ff979c /src | |
parent | 61843107f681b57c2467a304dd9534c656034740 (diff) |
speed up rgn building by inlining memcmp for 32bit values
on mac/clang, using circularclips gm/bench
- before: 400ms
- after: 250ms
BUG=skia:
R=tomhudson@chromium.org, mtklein@google.com
Author: reed@google.com
Review URL: https://codereview.chromium.org/348143002
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkRegion_path.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp index 03830e6ce5..108511c6c5 100644 --- a/src/core/SkRegion_path.cpp +++ b/src/core/SkRegion_path.cpp @@ -1,4 +1,3 @@ - /* * Copyright 2006 The Android Open Source Project * @@ -6,13 +5,23 @@ * found in the LICENSE file. */ - #include "SkRegionPriv.h" #include "SkBlitter.h" #include "SkScan.h" #include "SkTDArray.h" #include "SkPath.h" +// The rgnbuilder caller *seems* to pass short counts, possible often seens early failure, so +// we may not want to promote this to a "std" routine just yet. +static bool sk_memeq32(const int32_t* SK_RESTRICT a, const int32_t* SK_RESTRICT b, int count) { + for (int i = 0; i < count; ++i) { + if (a[i] != b[i]) { + return false; + } + } + return true; +} + class SkRgnBuilder : public SkBlitter { public: SkRgnBuilder(); @@ -87,9 +96,7 @@ private: if (fPrevScanline != NULL && fPrevScanline->fLastY + 1 == fCurrScanline->fLastY && fPrevScanline->fXCount == fCurrScanline->fXCount && - !memcmp(fPrevScanline->firstX(), - fCurrScanline->firstX(), - fCurrScanline->fXCount * sizeof(SkRegion::RunType))) + sk_memeq32(fPrevScanline->firstX(), fCurrScanline->firstX(), fCurrScanline->fXCount)) { // update the height of fPrevScanline fPrevScanline->fLastY = fCurrScanline->fLastY; |