| 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkCommandLineFlags.h" | 9 #include "SkCommandLineFlags.h" |
| 10 #include "SkData.h" | 10 #include "SkData.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 SkFILEWStream stream(path); | 41 SkFILEWStream stream(path); |
| 42 return stream.write(data->data(), data->size()); | 42 return stream.write(data->data(), data->size()); |
| 43 } | 43 } |
| 44 | 44 |
| 45 static bool do_document(int w, int h, const char path[], const char text[], | 45 static bool do_document(int w, int h, const char path[], const char text[], |
| 46 const SkPaint& paint) { | 46 const SkPaint& paint) { |
| 47 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path)); | 47 SkAutoTUnref<SkDocument> doc(SkDocument::CreatePDF(path)); |
| 48 if (doc.get()) { | 48 if (doc.get()) { |
| 49 SkScalar width = SkIntToScalar(w); | 49 SkScalar width = SkIntToScalar(w); |
| 50 SkScalar height = SkIntToScalar(h); | 50 SkScalar height = SkIntToScalar(h); |
| 51 doDraw(doc->beginPage(width, height, NULL), paint, text); | 51 doDraw(doc->beginPage(SkSize::Make(width, height), NULL), paint, text); |
| 52 return true; | 52 return true; |
| 53 } | 53 } |
| 54 return false; | 54 return false; |
| 55 } | 55 } |
| 56 | 56 |
| 57 int tool_main(int argc, char** argv); | 57 int tool_main(int argc, char** argv); |
| 58 int tool_main(int argc, char** argv) { | 58 int tool_main(int argc, char** argv) { |
| 59 SkCommandLineFlags::SetUsage(""); | 59 SkCommandLineFlags::SetUsage(""); |
| 60 SkCommandLineFlags::Parse(argc, argv); | 60 SkCommandLineFlags::Parse(argc, argv); |
| 61 | 61 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 } | 98 } |
| 99 } | 99 } |
| 100 return 0; | 100 return 0; |
| 101 } | 101 } |
| 102 | 102 |
| 103 #if !defined SK_BUILD_FOR_IOS | 103 #if !defined SK_BUILD_FOR_IOS |
| 104 int main(int argc, char * const argv[]) { | 104 int main(int argc, char * const argv[]) { |
| 105 return tool_main(argc, (char**) argv); | 105 return tool_main(argc, (char**) argv); |
| 106 } | 106 } |
| 107 #endif | 107 #endif |
| OLD | NEW |