Index: src/core/SkRegion_path.cpp |
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp |
index 03830e6ce542a1864f5a6ad144ad8b027c8090b7..0c97eb9ce9f6879716e64b77154e69e23b53d37f 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,38 @@ |
* found in the LICENSE file. |
*/ |
- |
#include "SkRegionPriv.h" |
#include "SkBlitter.h" |
#include "SkScan.h" |
#include "SkTDArray.h" |
#include "SkPath.h" |
+#define SK_USE_INLINE_MEMEQ32 |
+ |
+static bool sk_memeq32(const int32_t* SK_RESTRICT a, const int32_t* SK_RESTRICT b, int count) { |
+#ifdef SK_USE_INLINE_MEMEQ32 |
+#if 0 |
Tom Hudson
2014/06/20 18:50:05
Nit: would we want to replace 10 lines of dead cod
mtklein
2014/06/20 19:20:38
We _could_ write this with SSE or Neon, and SSE wo
|
+ const int count4 = count >> 2; |
+ for (int i = 0; i < count4; ++i) { |
+ if ((a[0] ^ b[0]) | (a[1] ^ b[1]) | (a[2] ^ b[2]) | (a[3] ^ b[3])) { |
+ return false; |
+ } |
+ a += 4; |
+ b += 4; |
+ } |
+ count &= 3; |
+#endif |
+ for (int i = 0; i < count; ++i) { |
+ if (a[i] != b[i]) { |
+ return false; |
+ } |
+ } |
+ return true; |
+#else |
+ return !memcmp(a, b, count << 2); |
Tom Hudson
2014/06/20 18:50:05
Nit: * sizeof(int32_t) is a little more intelligib
|
+#endif |
+} |
+ |
class SkRgnBuilder : public SkBlitter { |
public: |
SkRgnBuilder(); |
@@ -87,9 +111,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; |