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 #include "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 for (int width = -1; width <= 1; width++) { | 64 for (int width = -1; width <= 1; width++) { |
65 canvas->save(); | 65 canvas->save(); |
66 circle(canvas, width, false); | 66 circle(canvas, width, false); |
67 canvas->translate(0, dy); | 67 canvas->translate(0, dy); |
68 circle(canvas, width, true); | 68 circle(canvas, width, true); |
69 canvas->restore(); | 69 canvas->restore(); |
70 canvas->translate(dx, 0); | 70 canvas->translate(dx, 0); |
71 } | 71 } |
72 } | 72 } |
73 | 73 |
| 74 static void blowup(SkCanvas* canvas, const SkIRect& src, const SkRect& dst)
{ |
| 75 SkBaseDevice* device = canvas->getDevice(); |
| 76 const SkBitmap& bm = device->accessBitmap(false); |
| 77 canvas->drawBitmapRect(bm, &src, dst, NULL); |
| 78 } |
| 79 |
74 static void make_poly(SkPath* path, int n) { | 80 static void make_poly(SkPath* path, int n) { |
75 if (n <= 0) { | 81 if (n <= 0) { |
76 return; | 82 return; |
77 } | 83 } |
78 path->incReserve(n + 1); | 84 path->incReserve(n + 1); |
79 path->moveTo(SK_Scalar1, 0); | 85 path->moveTo(SK_Scalar1, 0); |
80 SkScalar step = SK_ScalarPI * 2 / n; | 86 SkScalar step = SK_ScalarPI * 2 / n; |
81 SkScalar angle = 0; | 87 SkScalar angle = 0; |
82 for (int i = 1; i < n; i++) { | 88 for (int i = 1; i < n; i++) { |
83 angle += step; | 89 angle += step; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 }; | 124 }; |
119 | 125 |
120 const SkScalar CircleView::ANIM_DX(SK_Scalar1 / 67); | 126 const SkScalar CircleView::ANIM_DX(SK_Scalar1 / 67); |
121 const SkScalar CircleView::ANIM_DY(SK_Scalar1 / 29); | 127 const SkScalar CircleView::ANIM_DY(SK_Scalar1 / 29); |
122 const SkScalar CircleView::ANIM_RAD(SK_Scalar1 / 19); | 128 const SkScalar CircleView::ANIM_RAD(SK_Scalar1 / 19); |
123 | 129 |
124 ////////////////////////////////////////////////////////////////////////////// | 130 ////////////////////////////////////////////////////////////////////////////// |
125 | 131 |
126 static SkView* MyFactory() { return new CircleView; } | 132 static SkView* MyFactory() { return new CircleView; } |
127 static SkViewRegister reg(MyFactory); | 133 static SkViewRegister reg(MyFactory); |
OLD | NEW |