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 | 9 |
10 #include "SkPictureImageFilter.h" | 10 #include "SkPictureImageFilter.h" |
11 | 11 |
12 // This GM exercises the SkPictureImageFilter ImageFilter class. | 12 // This GM exercises the SkPictureImageFilter ImageFilter class. |
13 | 13 |
14 class PictureImageFilterGM : public skiagm::GM { | 14 class PictureImageFilterGM : public skiagm::GM { |
15 public: | 15 public: |
16 PictureImageFilterGM() { | 16 PictureImageFilterGM() { |
17 } | 17 } |
18 | 18 |
19 protected: | 19 protected: |
20 virtual SkString onShortName() SK_OVERRIDE { | 20 virtual SkString onShortName() SK_OVERRIDE { |
21 return SkString("pictureimagefilter"); | 21 return SkString("pictureimagefilter"); |
22 } | 22 } |
23 | 23 |
24 void makePicture() { | 24 void makePicture() { |
25 SkPictureRecorder recorder; | 25 SkPictureRecorder recorder; |
26 SkCanvas* canvas = recorder.beginRecording(100, 100); | 26 SkCanvas* canvas = recorder.beginRecording(100, 100, NULL, 0); |
27 canvas->clear(0x00000000); | 27 canvas->clear(0x00000000); |
28 SkPaint paint; | 28 SkPaint paint; |
29 paint.setAntiAlias(true); | 29 paint.setAntiAlias(true); |
30 paint.setColor(0xFFFFFFFF); | 30 paint.setColor(0xFFFFFFFF); |
31 paint.setTextSize(SkIntToScalar(96)); | 31 paint.setTextSize(SkIntToScalar(96)); |
32 const char* str = "e"; | 32 const char* str = "e"; |
33 canvas->drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70),
paint); | 33 canvas->drawText(str, strlen(str), SkIntToScalar(20), SkIntToScalar(70),
paint); |
34 fPicture.reset(recorder.endRecording()); | 34 fPicture.reset(recorder.endRecording()); |
35 } | 35 } |
36 | 36 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 } | 83 } |
84 | 84 |
85 private: | 85 private: |
86 SkAutoTUnref<SkPicture> fPicture; | 86 SkAutoTUnref<SkPicture> fPicture; |
87 typedef GM INHERITED; | 87 typedef GM INHERITED; |
88 }; | 88 }; |
89 | 89 |
90 /////////////////////////////////////////////////////////////////////////////// | 90 /////////////////////////////////////////////////////////////////////////////// |
91 | 91 |
92 DEF_GM( return new PictureImageFilterGM; ) | 92 DEF_GM( return new PictureImageFilterGM; ) |
OLD | NEW |