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

Side by Side Diff: samplecode/SamplePath.cpp

Issue 1841123002: Reverse dependency between SkScalar.h and SkFixed.h (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « include/utils/SkRandom.h ('k') | src/core/SkFDot6.h » ('j') | 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkAnimTimer.h" 9 #include "SkAnimTimer.h"
10 #include "SkView.h" 10 #include "SkView.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 } 46 }
47 #endif 47 #endif
48 } 48 }
49 49
50 static void test_cubic2() { 50 static void test_cubic2() {
51 const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L224 2 -590088Z"; 51 const char* str = "M2242 -590088L-377758 9.94099e+07L-377758 9.94099e+07L224 2 -590088Z";
52 SkPath path; 52 SkPath path;
53 SkParsePath::FromSVGString(str, &path); 53 SkParsePath::FromSVGString(str, &path);
54 54
55 { 55 {
56 #ifdef SK_BUILD_FOR_WIN
57 // windows doesn't have strtof
58 float x = (float)strtod("9.94099e+07", nullptr);
59 #else
60 float x = strtof("9.94099e+07", nullptr);
61 #endif
62 int ix = (int)x;
63 int fx = (int)(x * 65536);
64 int ffx = SkScalarToFixed(x);
65 SkDebugf("%g %x %x %x\n", x, ix, fx, ffx);
66
67 SkRect r = path.getBounds(); 56 SkRect r = path.getBounds();
68 SkIRect ir; 57 SkIRect ir;
69 r.round(&ir); 58 r.round(&ir);
70 SkDebugf("[%g %g %g %g] [%x %x %x %x]\n", 59 SkDebugf("[%g %g %g %g] [%x %x %x %x]\n",
71 SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop), 60 SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop),
72 SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom), 61 SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom),
73 ir.fLeft, ir.fTop, ir.fRight, ir.fBottom); 62 ir.fLeft, ir.fTop, ir.fRight, ir.fBottom);
74 } 63 }
75 64
76 SkBitmap bitmap; 65 SkBitmap bitmap;
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 return click; 326 return click;
338 } 327 }
339 } 328 }
340 return this->INHERITED::onFindClickHandler(x, y, modi); 329 return this->INHERITED::onFindClickHandler(x, y, modi);
341 } 330 }
342 331
343 private: 332 private:
344 typedef SampleView INHERITED; 333 typedef SampleView INHERITED;
345 }; 334 };
346 DEF_SAMPLE( return new ArcToView; ) 335 DEF_SAMPLE( return new ArcToView; )
OLDNEW
« no previous file with comments | « include/utils/SkRandom.h ('k') | src/core/SkFDot6.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698