OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 * Simple tool to generate SKP files for testing. | 7 * Simple tool to generate SKP files for testing. |
8 */ | 8 */ |
9 | 9 |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 DEFINE_int32(height, 200, "Height of canvas to create."); | 25 DEFINE_int32(height, 200, "Height of canvas to create."); |
26 DEFINE_int32(red, 128, "Value of red color channel in image, 0-255."); | 26 DEFINE_int32(red, 128, "Value of red color channel in image, 0-255."); |
27 DEFINE_int32(width, 300, "Width of canvas to create."); | 27 DEFINE_int32(width, 300, "Width of canvas to create."); |
28 DEFINE_string(writePath, "", "Filepath to write the SKP into."); | 28 DEFINE_string(writePath, "", "Filepath to write the SKP into."); |
29 | 29 |
30 // Create a 'width' by 'height' skp with a 'border'-wide black border around | 30 // Create a 'width' by 'height' skp with a 'border'-wide black border around |
31 // a 'color' rectangle. | 31 // a 'color' rectangle. |
32 static void make_skp(SkScalar width, SkScalar height, SkScalar border, SkColor c
olor, | 32 static void make_skp(SkScalar width, SkScalar height, SkScalar border, SkColor c
olor, |
33 const char *writePath) { | 33 const char *writePath) { |
34 SkPictureRecorder recorder; | 34 SkPictureRecorder recorder; |
35 SkCanvas* canvas = recorder.beginRecording(width, height, NULL, 0); | 35 SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); |
36 SkPaint paint; | 36 SkPaint paint; |
37 paint.setStyle(SkPaint::kFill_Style); | 37 paint.setStyle(SkPaint::kFill_Style); |
38 paint.setColor(SK_ColorBLACK); | 38 paint.setColor(SK_ColorBLACK); |
39 SkRect r = SkRect::MakeWH(width, height); | 39 SkRect r = SkRect::MakeWH(width, height); |
40 canvas->drawRect(r, paint); | 40 canvas->drawRect(r, paint); |
41 paint.setColor(color); | 41 paint.setColor(color); |
42 r.inset(border, border); | 42 r.inset(border, border); |
43 canvas->drawRect(r, paint); | 43 canvas->drawRect(r, paint); |
44 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); | 44 SkAutoTUnref<SkPicture> pict(recorder.endRecording()); |
45 SkFILEWStream stream(writePath); | 45 SkFILEWStream stream(writePath); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 SkIntToScalar(FLAGS_border), | 83 SkIntToScalar(FLAGS_border), |
84 color, FLAGS_writePath[0]); | 84 color, FLAGS_writePath[0]); |
85 return 0; | 85 return 0; |
86 } | 86 } |
87 | 87 |
88 #if !defined SK_BUILD_FOR_IOS | 88 #if !defined SK_BUILD_FOR_IOS |
89 int main(int argc, char * const argv[]) { | 89 int main(int argc, char * const argv[]) { |
90 return tool_main(argc, (char**) argv); | 90 return tool_main(argc, (char**) argv); |
91 } | 91 } |
92 #endif | 92 #endif |
OLD | NEW |