aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar reed <reed@chromium.org>2015-03-19 04:10:42 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-03-19 04:10:42 -0700
commiteffcba4a4d1a6fdfdd5ec440e10e1424b768182d (patch)
tree322abf0c7d61041a683b5c8c4ea99680758c94fb
parent562d0e1cd2286945cb73fca0233560071b052129 (diff)
Revert of replace SkFixedDiv impl with native 64bit math (patchset #2 id:20001 of https://codereview.chromium.org/1022543003/)
Reason for revert: http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/53096 layouttests failures Original issue's description: > replace SkFixedDiv impl with native 64bit math > > BUG=skia: > TBR= > > Committed: https://skia.googlesource.com/skia/+/7c44ca926bf42b3b2e56131f250c0fd58f87ac71 TBR= NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1018523008
-rw-r--r--bench/MathBench.cpp44
-rw-r--r--include/core/SkFixed.h5
2 files changed, 1 insertions, 48 deletions
diff --git a/bench/MathBench.cpp b/bench/MathBench.cpp
index e0d519407f..5b46d1c704 100644
--- a/bench/MathBench.cpp
+++ b/bench/MathBench.cpp
@@ -545,50 +545,6 @@ private:
///////////////////////////////////////////////////////////////////////////////
-class DivBitsBench : public Benchmark {
-protected:
- enum {
- N = 1000
- };
- volatile int32_t fSrc[N], fDst[N];
-public:
- DivBitsBench() {
- SkRandom rand;
- for (int i = 0; i < N; ++i) {
- fSrc[i] = rand.nextU();
- }
- }
-protected:
- virtual void onDraw(const int loops, SkCanvas*) {
- for (int j = 0; j < loops; ++j) {
- for (int i = 0; i < N - 4; ++i) {
- fDst[i] = SkDivBits(fSrc[i], fSrc[i] >> 3, 16);
- }
- }
- }
- virtual const char* onGetName() {
- return "divbits";
- }
-};
-DEF_BENCH( return new DivBitsBench; )
-
-class FixedDivBench : public DivBitsBench {
-protected:
- virtual void onDraw(const int loops, SkCanvas*) {
- for (int j = 0; j < loops; ++j) {
- for (int i = 0; i < N - 4; ++i) {
- fDst[i] = SkFixedDiv(fSrc[i], fSrc[i] >> 3);
- }
- }
- }
- virtual const char* onGetName() {
- return "fixeddiv";
- }
-};
-DEF_BENCH( return new FixedDivBench; )
-
-///////////////////////////////////////////////////////////////////////////////
-
template <typename T>
class DivModBench : public Benchmark {
SkString fName;
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index f920fea736..8cf7a5679c 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -78,10 +78,7 @@ typedef int32_t SkFixed;
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
-static inline int32_t SkFixedDiv(int32_t numer, int32_t denom) {
- int64_t tmp = ((int64_t)numer << 16) / denom;
- return (int32_t)tmp;
-}
+#define SkFixedDiv(numer, denom) SkDivBits(numer, denom, 16)
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)