| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SkDebugf("[%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.allocN32Pixels(300, 200); |
| 77 bitmap.allocPixels(); | |
| 78 | 77 |
| 79 SkCanvas canvas(bitmap); | 78 SkCanvas canvas(bitmap); |
| 80 SkPaint paint; | 79 SkPaint paint; |
| 81 paint.setAntiAlias(true); | 80 paint.setAntiAlias(true); |
| 82 canvas.drawPath(path, paint); | 81 canvas.drawPath(path, paint); |
| 83 } | 82 } |
| 84 | 83 |
| 85 class PathView : public SampleView { | 84 class PathView : public SampleView { |
| 86 public: | 85 public: |
| 87 int fDStroke, fStroke, fMinStroke, fMaxStroke; | 86 int fDStroke, fStroke, fMinStroke, fMaxStroke; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 } | 208 } |
| 210 | 209 |
| 211 private: | 210 private: |
| 212 typedef SampleView INHERITED; | 211 typedef SampleView INHERITED; |
| 213 }; | 212 }; |
| 214 | 213 |
| 215 ////////////////////////////////////////////////////////////////////////////// | 214 ////////////////////////////////////////////////////////////////////////////// |
| 216 | 215 |
| 217 static SkView* MyFactory() { return new PathView; } | 216 static SkView* MyFactory() { return new PathView; } |
| 218 static SkViewRegister reg(MyFactory); | 217 static SkViewRegister reg(MyFactory); |
| OLD | NEW |