OLD | NEW |
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 "gm.h" | 8 #include "gm.h" |
9 | 9 |
10 static void make_bitmap(SkBitmap* bitmap, SkIRect* center) { | 10 static void make_bitmap(SkBitmap* bitmap, SkIRect* center) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 { fixed * 4, fixed * 4 / 5 }, // shrink in Y | 66 { fixed * 4, fixed * 4 / 5 }, // shrink in Y |
67 { fixed * 4, fixed * 4 } | 67 { fixed * 4, fixed * 4 } |
68 }; | 68 }; |
69 | 69 |
70 canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL); | 70 canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL); |
71 | 71 |
72 SkScalar x = SkIntToScalar(100); | 72 SkScalar x = SkIntToScalar(100); |
73 SkScalar y = SkIntToScalar(100); | 73 SkScalar y = SkIntToScalar(100); |
74 | 74 |
75 SkPaint paint; | 75 SkPaint paint; |
76 paint.setFilterLevel(SkPaint::kLow_FilterLevel); | 76 paint.setFilterQuality(kLow_SkFilterQuality); |
77 | 77 |
78 for (int iy = 0; iy < 2; ++iy) { | 78 for (int iy = 0; iy < 2; ++iy) { |
79 for (int ix = 0; ix < 2; ++ix) { | 79 for (int ix = 0; ix < 2; ++ix) { |
80 int i = ix * 2 + iy; | 80 int i = ix * 2 + iy; |
81 SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed, | 81 SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed, |
82 size[i].width(), size[i].height()); | 82 size[i].width(), size[i].height()); |
83 canvas->drawBitmapNine(bm, center, r, &paint); | 83 canvas->drawBitmapNine(bm, center, r, &paint); |
84 } | 84 } |
85 } | 85 } |
86 } | 86 } |
87 | 87 |
88 private: | 88 private: |
89 typedef GM INHERITED; | 89 typedef GM INHERITED; |
90 }; | 90 }; |
91 | 91 |
92 ////////////////////////////////////////////////////////////////////////////// | 92 ////////////////////////////////////////////////////////////////////////////// |
93 | 93 |
94 static GM* MyFactory(void*) { return new NinePatchStretchGM; } | 94 static GM* MyFactory(void*) { return new NinePatchStretchGM; } |
95 static GMRegistry reg(MyFactory); | 95 static GMRegistry reg(MyFactory); |
96 | 96 |
97 } | 97 } |
OLD | NEW |