OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkImageSource.h" | 10 #include "SkImageSource.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 srcRect, | 80 srcRect, |
81 deviceSize, | 81 deviceSize, |
82 kMedium_SkFilterQuality); | 82 kMedium_SkFilterQuality); |
83 | 83 |
84 canvas->translate(srcRect.width() + SkIntToScalar(10), 0); | 84 canvas->translate(srcRect.width() + SkIntToScalar(10), 0); |
85 draw(canvas, | 85 draw(canvas, |
86 srcRect, | 86 srcRect, |
87 deviceSize, | 87 deviceSize, |
88 kHigh_SkFilterQuality); | 88 kHigh_SkFilterQuality); |
89 | 89 |
90 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(16, 16)); | 90 auto surface(SkSurface::MakeRasterN32Premul(16, 16)); |
91 SkCanvas* surfaceCanvas = surface->getCanvas(); | 91 SkCanvas* surfaceCanvas = surface->getCanvas(); |
92 surfaceCanvas->clear(0x000000); | 92 surfaceCanvas->clear(0x000000); |
93 { | 93 { |
94 SkPaint paint; | 94 SkPaint paint; |
95 paint.setColor(0xFF00FF00); | 95 paint.setColor(0xFF00FF00); |
96 SkRect ovalRect = SkRect::MakeWH(16, 16); | 96 SkRect ovalRect = SkRect::MakeWH(16, 16); |
97 ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3); | 97 ovalRect.inset(SkIntToScalar(2)/3, SkIntToScalar(2)/3); |
98 surfaceCanvas->drawOval(ovalRect, paint); | 98 surfaceCanvas->drawOval(ovalRect, paint); |
99 } | 99 } |
100 sk_sp<SkImage> image(surface->makeImageSnapshot()); | 100 sk_sp<SkImage> image(surface->makeImageSnapshot()); |
(...skipping 12 matching lines...) Expand all Loading... |
113 private: | 113 private: |
114 typedef GM INHERITED; | 114 typedef GM INHERITED; |
115 }; | 115 }; |
116 | 116 |
117 ////////////////////////////////////////////////////////////////////////////// | 117 ////////////////////////////////////////////////////////////////////////////// |
118 | 118 |
119 static GM* MyFactory(void*) { return new ResizeGM; } | 119 static GM* MyFactory(void*) { return new ResizeGM; } |
120 static GMRegistry reg(MyFactory); | 120 static GMRegistry reg(MyFactory); |
121 | 121 |
122 } | 122 } |
OLD | NEW |