| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 #include "SampleCode.h" | 9 #include "SampleCode.h" |
| 10 #include "SkView.h" | 10 #include "SkView.h" |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 { | 54 { |
| 55 #ifdef SK_BUILD_FOR_WIN | 55 #ifdef SK_BUILD_FOR_WIN |
| 56 // windows doesn't have strtof | 56 // windows doesn't have strtof |
| 57 float x = (float)strtod("9.94099e+07", NULL); | 57 float x = (float)strtod("9.94099e+07", NULL); |
| 58 #else | 58 #else |
| 59 float x = strtof("9.94099e+07", NULL); | 59 float x = strtof("9.94099e+07", NULL); |
| 60 #endif | 60 #endif |
| 61 int ix = (int)x; | 61 int ix = (int)x; |
| 62 int fx = (int)(x * 65536); | 62 int fx = (int)(x * 65536); |
| 63 int ffx = SkScalarToFixed(x); | 63 int ffx = SkScalarToFixed(x); |
| 64 printf("%g %x %x %x\n", x, ix, fx, ffx); | 64 SkDebugf("%g %x %x %x\n", x, ix, fx, ffx); |
| 65 | 65 |
| 66 SkRect r = path.getBounds(); | 66 SkRect r = path.getBounds(); |
| 67 SkIRect ir; | 67 SkIRect ir; |
| 68 r.round(&ir); | 68 r.round(&ir); |
| 69 printf("[%g %g %g %g] [%x %x %x %x]\n", | 69 SkDebugf("[%g %g %g %g] [%x %x %x %x]\n", |
| 70 SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop), | 70 SkScalarToDouble(r.fLeft), SkScalarToDouble(r.fTop), |
| 71 SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom), | 71 SkScalarToDouble(r.fRight), SkScalarToDouble(r.fBottom), |
| 72 ir.fLeft, ir.fTop, ir.fRight, ir.fBottom); | 72 ir.fLeft, ir.fTop, ir.fRight, ir.fBottom); |
| 73 } | 73 } |
| 74 | 74 |
| 75 SkBitmap bitmap; | 75 SkBitmap bitmap; |
| 76 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 200); | 76 bitmap.setConfig(SkBitmap::kARGB_8888_Config, 300, 200); |
| 77 bitmap.allocPixels(); | 77 bitmap.allocPixels(); |
| 78 | 78 |
| 79 SkCanvas canvas(bitmap); | 79 SkCanvas canvas(bitmap); |
| 80 SkPaint paint; | 80 SkPaint paint; |
| 81 paint.setAntiAlias(true); | 81 paint.setAntiAlias(true); |
| 82 canvas.drawPath(path, paint); | 82 canvas.drawPath(path, paint); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 209 } |
| 210 | 210 |
| 211 private: | 211 private: |
| 212 typedef SampleView INHERITED; | 212 typedef SampleView INHERITED; |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 ////////////////////////////////////////////////////////////////////////////// | 215 ////////////////////////////////////////////////////////////////////////////// |
| 216 | 216 |
| 217 static SkView* MyFactory() { return new PathView; } | 217 static SkView* MyFactory() { return new PathView; } |
| 218 static SkViewRegister reg(MyFactory); | 218 static SkViewRegister reg(MyFactory); |
| OLD | NEW |