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

Side by Side Diff: tests/Sk64Test.cpp

Issue 113873008: remove unused SkFixed and SkFract functions (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years 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 unified diff | Download patch | Annotate | Revision Log
« experimental/Intersection/SkAntiEdge.cpp ('K') | « tests/MathTest.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "Test.h" 8 #include "Test.h"
9 #include "TestClassDef.h" 9 #include "TestClassDef.h"
10 #include "SkRandom.h" 10 #include "SkRandom.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 SkLONGLONG w = wide.getLongLong(); 167 SkLONGLONG w = wide.getLongLong();
168 168
169 REPORTER_ASSERT(reporter, check == w); 169 REPORTER_ASSERT(reporter, check == w);
170 170
171 wide.setMul(rand.nextS(), rand.nextS()); 171 wide.setMul(rand.nextS(), rand.nextS());
172 wide.abs(); 172 wide.abs();
173 denom = wide.getSqrt(); 173 denom = wide.getSqrt();
174 int32_t ck = (int32_t)sqrt((double)wide.getLongLong()); 174 int32_t ck = (int32_t)sqrt((double)wide.getLongLong());
175 int diff = denom - ck; 175 int diff = denom - ck;
176 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1); 176 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
177
178 wide.setMul(rand.nextS(), rand.nextS());
179 Sk64 dwide;
180 dwide.setMul(rand.nextS(), rand.nextS());
181 SkFixed fixdiv = wide.getFixedDiv(dwide);
182 double dnumer = (double)wide.getLongLong();
183 double ddenom = (double)dwide.getLongLong();
184 double ddiv = dnumer / ddenom;
185 SkFixed dfixdiv;
186 if (ddiv >= (double)SK_MaxS32 / (double)SK_Fixed1)
187 dfixdiv = SK_MaxS32;
188 else if (ddiv <= -(double)SK_MaxS32 / (double)SK_Fixed1)
189 dfixdiv = SK_MinS32;
190 else
191 dfixdiv = SkFloatToFixed(dnumer / ddenom);
192 diff = fixdiv - dfixdiv;
193
194 if (SkAbs32(diff) > 1) {
195 SkDebugf(" %d === numer %g denom %g div %g xdiv %x fxdiv %x\n",
196 i, dnumer, ddenom, ddiv, dfixdiv, fixdiv);
197 }
198 REPORTER_ASSERT(reporter, SkAbs32(diff) <= 1);
199 } 177 }
200 #endif 178 #endif
201 } 179 }
OLDNEW
« experimental/Intersection/SkAntiEdge.cpp ('K') | « tests/MathTest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698