| OLD | NEW |
| 1 #include <sys/time.h> | 1 #include <sys/time.h> |
| 2 #include <sys/resource.h> | 2 #include <sys/resource.h> |
| 3 | 3 |
| 4 #include "SkCanvas.h" | 4 #include "SkCanvas.h" |
| 5 #include "SkCommandLineFlags.h" | 5 #include "SkCommandLineFlags.h" |
| 6 #include "SkData.h" | 6 #include "SkData.h" |
| 7 #include "SkForceLinking.h" | 7 #include "SkForceLinking.h" |
| 8 #include "SkGraphics.h" | 8 #include "SkGraphics.h" |
| 9 #include "SkImageEncoder.h" | 9 #include "SkImageEncoder.h" |
| 10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 int main(int argc, char** argv) { | 84 int main(int argc, char** argv) { |
| 85 SkCommandLineFlags::Parse(argc, argv); | 85 SkCommandLineFlags::Parse(argc, argv); |
| 86 SkAutoGraphics init; | 86 SkAutoGraphics init; |
| 87 | 87 |
| 88 if (FLAGS_out.count() == 0) { | 88 if (FLAGS_out.count() == 0) { |
| 89 perror("The --out flag must have an argument."); | 89 perror("The --out flag must have an argument."); |
| 90 return 1; | 90 return 1; |
| 91 } | 91 } |
| 92 SkFILEWStream stream(FLAGS_out[0]); | 92 SkFILEWStream stream(FLAGS_out[0]); |
| 93 | 93 |
| 94 SkImageInfo info = SkImageInfo::MakeN32(300, 300, kPremul_SkAlphaType); | 94 SkImageInfo info = SkImageInfo::MakeN32(256, 256, kPremul_SkAlphaType); |
| 95 SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info)); | 95 SkAutoTUnref<SkSurface> surface(SkSurface::NewRaster(info)); |
| 96 SkCanvas* canvas = surface->getCanvas(); | 96 SkCanvas* canvas = surface->getCanvas(); |
| 97 | 97 |
| 98 setLimits(); | 98 setLimits(); |
| 99 | 99 |
| 100 if (!install_syscall_filter()) { | 100 if (!install_syscall_filter()) { |
| 101 return 1; | 101 return 1; |
| 102 } | 102 } |
| 103 | 103 |
| 104 draw(canvas); | 104 draw(canvas); |
| 105 | 105 |
| 106 // Write out the image as a PNG. | 106 // Write out the image as a PNG. |
| 107 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); | 107 SkAutoTUnref<SkImage> image(surface->newImageSnapshot()); |
| 108 SkAutoTUnref<SkData> data(image->encode(SkImageEncoder::kPNG_Type, 100)); | 108 SkAutoTUnref<SkData> data(image->encode(SkImageEncoder::kPNG_Type, 100)); |
| 109 if (NULL == data.get()) { | 109 if (NULL == data.get()) { |
| 110 printf("Failed to encode\n"); | 110 printf("Failed to encode\n"); |
| 111 exit(1); | 111 exit(1); |
| 112 } | 112 } |
| 113 stream.write(data->data(), data->size()); | 113 stream.write(data->data(), data->size()); |
| 114 } | 114 } |
| OLD | NEW |