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

Unified Diff: src/core/SkMath.cpp

Issue 617003004: Archive more dead code. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove header from .gypi 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 | « include/core/SkFixed.h ('k') | src/core/SkMiniData.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMath.cpp
diff --git a/src/core/SkMath.cpp b/src/core/SkMath.cpp
index aeacebecd4549a57fdc1bf92fc4506e5a51ca549..e33fe55e015a26f684424efcd8c5820b25c23cd7 100644
--- a/src/core/SkMath.cpp
+++ b/src/core/SkMath.cpp
@@ -174,116 +174,3 @@ float SkScalarSinCos(float radians, float* cosValue) {
}
return sinValue;
}
-
-#define INTERP_SINTABLE
-#define BUILD_TABLE_AT_RUNTIMEx
-
-#define kTableSize 256
-
-#ifdef BUILD_TABLE_AT_RUNTIME
- static uint16_t gSkSinTable[kTableSize];
-
- static void build_sintable(uint16_t table[]) {
- for (int i = 0; i < kTableSize; i++) {
- double rad = i * 3.141592653589793 / (2*kTableSize);
- double val = sin(rad);
- int ival = (int)(val * SK_Fixed1);
- table[i] = SkToU16(ival);
- }
- }
-#else
- #include "SkSinTable.h"
-#endif
-
-#define SK_Fract1024SizeOver2PI 0x28BE60 /* floatToFract(1024 / 2PI) */
-
-#ifdef INTERP_SINTABLE
-static SkFixed interp_table(const uint16_t table[], int index, int partial255) {
- SkASSERT((unsigned)index < kTableSize);
- SkASSERT((unsigned)partial255 <= 255);
-
- SkFixed lower = table[index];
- SkFixed upper = (index == kTableSize - 1) ? SK_Fixed1 : table[index + 1];
-
- SkASSERT(lower < upper);
- SkASSERT(lower >= 0);
- SkASSERT(upper <= SK_Fixed1);
-
- partial255 += (partial255 >> 7);
- return lower + ((upper - lower) * partial255 >> 8);
-}
-#endif
-
-SkFixed SkFixedSinCos(SkFixed radians, SkFixed* cosValuePtr) {
- SkASSERT(SK_ARRAY_COUNT(gSkSinTable) == kTableSize);
-
-#ifdef BUILD_TABLE_AT_RUNTIME
- static bool gFirstTime = true;
- if (gFirstTime) {
- build_sintable(gSinTable);
- gFirstTime = false;
- }
-#endif
-
- // make radians positive
- SkFixed sinValue, cosValue;
- int32_t cosSign = 0;
- int32_t sinSign = SkExtractSign(radians);
- radians = SkApplySign(radians, sinSign);
- // scale it to 0...1023 ...
-
-#ifdef INTERP_SINTABLE
- radians = SkMulDiv(radians, 2 * kTableSize * 256, SK_FixedPI);
- int findex = radians & (kTableSize * 256 - 1);
- int index = findex >> 8;
- int partial = findex & 255;
- sinValue = interp_table(gSkSinTable, index, partial);
-
- findex = kTableSize * 256 - findex - 1;
- index = findex >> 8;
- partial = findex & 255;
- cosValue = interp_table(gSkSinTable, index, partial);
-
- int quad = ((unsigned)radians / (kTableSize * 256)) & 3;
-#else
- radians = SkMulDiv(radians, 2 * kTableSize, SK_FixedPI);
- int index = radians & (kTableSize - 1);
-
- if (index == 0) {
- sinValue = 0;
- cosValue = SK_Fixed1;
- } else {
- sinValue = gSkSinTable[index];
- cosValue = gSkSinTable[kTableSize - index];
- }
- int quad = ((unsigned)radians / kTableSize) & 3;
-#endif
-
- if (quad & 1) {
- SkTSwap<SkFixed>(sinValue, cosValue);
- }
- if (quad & 2) {
- sinSign = ~sinSign;
- }
- if (((quad - 1) & 2) == 0) {
- cosSign = ~cosSign;
- }
-
- // restore the sign for negative angles
- sinValue = SkApplySign(sinValue, sinSign);
- cosValue = SkApplySign(cosValue, cosSign);
-
-#ifdef SK_DEBUG
- if (1) {
- SkFixed sin2 = SkFixedMul(sinValue, sinValue);
- SkFixed cos2 = SkFixedMul(cosValue, cosValue);
- int diff = cos2 + sin2 - SK_Fixed1;
- SkASSERT(SkAbs32(diff) <= 7);
- }
-#endif
-
- if (cosValuePtr) {
- *cosValuePtr = cosValue;
- }
- return sinValue;
-}
« no previous file with comments | « include/core/SkFixed.h ('k') | src/core/SkMiniData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698