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 #if SK_SUPPORT_GPU | 10 #if SK_SUPPORT_GPU |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 { fixed * 4, fixed * 4 / 5 }, // shrink in Y | 86 { fixed * 4, fixed * 4 / 5 }, // shrink in Y |
87 { fixed * 4, fixed * 4 } | 87 { fixed * 4, fixed * 4 } |
88 }; | 88 }; |
89 | 89 |
90 canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL); | 90 canvas->drawBitmap(bm, SkIntToScalar(10), SkIntToScalar(10), NULL); |
91 | 91 |
92 SkScalar x = SkIntToScalar(100); | 92 SkScalar x = SkIntToScalar(100); |
93 SkScalar y = SkIntToScalar(100); | 93 SkScalar y = SkIntToScalar(100); |
94 | 94 |
95 SkPaint paint; | 95 SkPaint paint; |
96 paint.setFilterBitmap(true); | 96 paint.setFilterLevel(SkPaint::kLow_FilterLevel); |
97 | 97 |
98 for (int iy = 0; iy < 2; ++iy) { | 98 for (int iy = 0; iy < 2; ++iy) { |
99 for (int ix = 0; ix < 2; ++ix) { | 99 for (int ix = 0; ix < 2; ++ix) { |
100 int i = ix * 2 + iy; | 100 int i = ix * 2 + iy; |
101 SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed, | 101 SkRect r = SkRect::MakeXYWH(x + ix * fixed, y + iy * fixed, |
102 size[i].width(), size[i].height()); | 102 size[i].width(), size[i].height()); |
103 canvas->drawBitmapNine(bm, center, r, &paint); | 103 canvas->drawBitmapNine(bm, center, r, &paint); |
104 } | 104 } |
105 } | 105 } |
106 } | 106 } |
107 | 107 |
108 private: | 108 private: |
109 typedef GM INHERITED; | 109 typedef GM INHERITED; |
110 }; | 110 }; |
111 | 111 |
112 ////////////////////////////////////////////////////////////////////////////// | 112 ////////////////////////////////////////////////////////////////////////////// |
113 | 113 |
114 static GM* MyFactory(void*) { return new NinePatchStretchGM; } | 114 static GM* MyFactory(void*) { return new NinePatchStretchGM; } |
115 static GMRegistry reg(MyFactory); | 115 static GMRegistry reg(MyFactory); |
116 | 116 |
117 } | 117 } |
OLD | NEW |