OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkImage.h" | 10 #include "SkImage.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 | 22 |
23 paint.setStyle(SkPaint::kStroke_Style); | 23 paint.setStyle(SkPaint::kStroke_Style); |
24 for (int i = 0; i < 20; ++i) { | 24 for (int i = 0; i < 20; ++i) { |
25 canvas->drawCircle(-4, 25, 20, paint); | 25 canvas->drawCircle(-4, 25, 20, paint); |
26 canvas->translate(25, 0); | 26 canvas->translate(25, 0); |
27 } | 27 } |
28 return surface->newImageSnapshot(); | 28 return surface->newImageSnapshot(); |
29 } | 29 } |
30 | 30 |
31 static void test_mip(SkCanvas* canvas) { | 31 static void test_mip(SkCanvas* canvas) { |
32 SkAutoTUnref<SkImage> img(make_image());//SkImage::NewFromData(data)); | 32 SkAutoTUnref<SkImage> img(make_image());//SkImage::NewFromEncoded(data)); |
33 | 33 |
34 SkPaint paint; | 34 SkPaint paint; |
35 const SkRect dst = SkRect::MakeWH(177, 15); | 35 const SkRect dst = SkRect::MakeWH(177, 15); |
36 | 36 |
37 paint.setTextSize(30); | 37 paint.setTextSize(30); |
38 SkString str; | 38 SkString str; |
39 str.printf("scale %g %g", dst.width() / img->width(), dst.height() / img->he
ight()); | 39 str.printf("scale %g %g", dst.width() / img->width(), dst.height() / img->he
ight()); |
40 // canvas->drawText(str.c_str(), str.size(), 300, 100, paint); | 40 // canvas->drawText(str.c_str(), str.size(), 300, 100, paint); |
41 | 41 |
42 canvas->translate(20, 20); | 42 canvas->translate(20, 20); |
(...skipping 16 matching lines...) Expand all Loading... |
59 | 59 |
60 void onDraw(SkCanvas* canvas) override { | 60 void onDraw(SkCanvas* canvas) override { |
61 test_mip(canvas); | 61 test_mip(canvas); |
62 } | 62 } |
63 | 63 |
64 private: | 64 private: |
65 typedef skiagm::GM INHERITED; | 65 typedef skiagm::GM INHERITED; |
66 }; | 66 }; |
67 DEF_GM( return new MipMapGM; ) | 67 DEF_GM( return new MipMapGM; ) |
68 | 68 |
OLD | NEW |