Commit 19ac9b0d authored by Skia_Android Canary Bot's avatar Skia_Android Canary Bot
Browse files

Merge "speed up rgn building by inlining memcmp for 32bit values" into master-skia

https://skia.googlesource.com/skia/+/b8f0798

Change-Id: Id52032b965e487637b59321e6110e1f7e6547740
parents 848634ce b8f07988
/*
* 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;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment