Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Unified Diff: src/core/SkRegion_path.cpp

Issue 348143002: speed up rgn building by inlining memcmp for 32bit values (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: clean up Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRegion_path.cpp
diff --git a/src/core/SkRegion_path.cpp b/src/core/SkRegion_path.cpp
index 03830e6ce542a1864f5a6ad144ad8b027c8090b7..108511c6c5d905eeb0df1186267a269b3e29bc8a 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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698