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

Unified Diff: src/core/SkFloat.h

Issue 619563003: Archive SkFloat (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 3 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 | « gyp/core.gypi ('k') | src/core/SkFloat.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFloat.h
diff --git a/src/core/SkFloat.h b/src/core/SkFloat.h
deleted file mode 100644
index 0d4f9b41a7441ee220417c4b2fca8b9d10563de1..0000000000000000000000000000000000000000
--- a/src/core/SkFloat.h
+++ /dev/null
@@ -1,107 +0,0 @@
-
-/*
- * Copyright 2008 The Android Open Source Project
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-
-#ifndef SkFloat_DEFINED
-#define SkFloat_DEFINED
-
-#include "SkFixed.h"
-
-class SkFloat {
-public:
- SkFloat() {}
-
- void setZero() { fPacked = 0; }
-// void setShift(int value, int shift) { fPacked = SetShift(value, shift); }
- void setInt(int value) { fPacked = SetShift(value, 0); }
- void setFixed(SkFixed value) { fPacked = SetShift(value, -16); }
-
-// int getShift(int shift) const { return GetShift(fPacked, shift); }
- int getInt() const { return GetShift(fPacked, 0); }
- SkFixed getFixed() const { return GetShift(fPacked, -16); }
-
- void abs() { fPacked = Abs(fPacked); }
- void negate() { fPacked = Neg(fPacked); }
-
- void shiftLeft(int bits) { fPacked = Shift(fPacked, bits); }
- void setShiftLeft(const SkFloat& a, int bits) { fPacked = Shift(a.fPacked, bits); }
-
- void shiftRight(int bits) { fPacked = Shift(fPacked, -bits); }
- void setShiftRight(const SkFloat& a, int bits) { fPacked = Shift(a.fPacked, -bits); }
-
- void add(const SkFloat& a) { fPacked = Add(fPacked, a.fPacked); }
- void setAdd(const SkFloat& a, const SkFloat& b) { fPacked = Add(a.fPacked, b.fPacked); }
-
- void sub(const SkFloat& a) { fPacked = Add(fPacked, Neg(a.fPacked)); }
- void setSub(const SkFloat& a, const SkFloat& b) { fPacked = Add(a.fPacked, Neg(b.fPacked)); }
-
- void mul(const SkFloat& a) { fPacked = Mul(fPacked, a.fPacked); }
- void setMul(const SkFloat& a, const SkFloat& b) { fPacked = Mul(a.fPacked, b.fPacked); }
-
- void div(const SkFloat& a) { fPacked = Div(fPacked, a.fPacked); }
- void setDiv(const SkFloat& a, const SkFloat& b) { fPacked = Div(a.fPacked, b.fPacked); }
-
- void sqrt() { fPacked = Sqrt(fPacked); }
- void setSqrt(const SkFloat& a) { fPacked = Sqrt(a.fPacked); }
- void cubeRoot() { fPacked = CubeRoot(fPacked); }
- void setCubeRoot(const SkFloat& a) { fPacked = CubeRoot(a.fPacked); }
-
- friend bool operator==(const SkFloat& a, const SkFloat& b) { return a.fPacked == b.fPacked; }
- friend bool operator!=(const SkFloat& a, const SkFloat& b) { return a.fPacked != b.fPacked; }
- friend bool operator<(const SkFloat& a, const SkFloat& b) { return Cmp(a.fPacked, b.fPacked) < 0; }
- friend bool operator<=(const SkFloat& a, const SkFloat& b) { return Cmp(a.fPacked, b.fPacked) <= 0; }
- friend bool operator>(const SkFloat& a, const SkFloat& b) { return Cmp(a.fPacked, b.fPacked) > 0; }
- friend bool operator>=(const SkFloat& a, const SkFloat& b) { return Cmp(a.fPacked, b.fPacked) >= 0; }
-
-#ifdef SK_DEBUG
- static void UnitTest();
-
- void assertEquals(float f, int tolerance = 0)
- {
- union {
- float fFloat;
- int32_t fPacked;
- } tmp;
-
- tmp.fFloat = f;
- int d = tmp.fPacked - fPacked;
- SkASSERT(SkAbs32(d) <= tolerance);
- }
- float getFloat() const
- {
- union {
- float fFloat;
- int32_t fPacked;
- } tmp;
-
- tmp.fPacked = fPacked;
- return tmp.fFloat;
- }
-#endif
-
-private:
- int32_t fPacked;
-
-public:
- static int GetShift(int32_t packed, int shift);
- static int32_t SetShift(int value, int shift);
- static int32_t Neg(int32_t);
- static int32_t Abs(int32_t packed) { return (uint32_t)(packed << 1) >> 1; }
- static int32_t Shift(int32_t, int bits);
- static int32_t Add(int32_t, int32_t);
- static int32_t Mul(int32_t, int32_t);
- static int32_t MulInt(int32_t, int);
- static int32_t Div(int32_t, int32_t);
- static int32_t DivInt(int32_t, int);
- static int32_t Invert(int32_t);
- static int32_t Sqrt(int32_t);
- static int32_t CubeRoot(int32_t);
- static int Cmp(int32_t, int32_t);
-};
-
-#endif
« no previous file with comments | « gyp/core.gypi ('k') | src/core/SkFloat.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698