Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(569)

Side by Side Diff: dm/DM.cpp

Issue 830333005: add --rasterPDF flag to DM (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: compile on win (try again) Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Main binary for DM. 1 // Main binary for DM.
2 // For a high-level overview, please see dm/README. 2 // For a high-level overview, please see dm/README.
3 3
4 #include "CrashHandler.h" 4 #include "CrashHandler.h"
5 #include "LazyDecodeBitmap.h" 5 #include "LazyDecodeBitmap.h"
6 #include "SkCommonFlags.h" 6 #include "SkCommonFlags.h"
7 #include "SkForceLinking.h" 7 #include "SkForceLinking.h"
8 #include "SkGraphics.h" 8 #include "SkGraphics.h"
9 #include "SkOSFile.h" 9 #include "SkOSFile.h"
10 #include "SkPicture.h" 10 #include "SkPicture.h"
11 #include "SkString.h" 11 #include "SkString.h"
12 #include "SkTaskGroup.h" 12 #include "SkTaskGroup.h"
13 #include "Test.h" 13 #include "Test.h"
14 #include "gm.h" 14 #include "gm.h"
15 #include "sk_tool_utils.h" 15 #include "sk_tool_utils.h"
16 #include "sk_tool_utils_flags.h" 16 #include "sk_tool_utils_flags.h"
17 17
18 #include "DMCpuGMTask.h" 18 #include "DMCpuGMTask.h"
19 #include "DMGpuGMTask.h" 19 #include "DMGpuGMTask.h"
20 #include "DMGpuSupport.h" 20 #include "DMGpuSupport.h"
21 #include "DMImageTask.h" 21 #include "DMImageTask.h"
22 #include "DMJsonWriter.h" 22 #include "DMJsonWriter.h"
23 #include "DMPDFTask.h" 23 #include "DMPDFTask.h"
24 #include "DMPDFRasterizeTask.h"
24 #include "DMReporter.h" 25 #include "DMReporter.h"
25 #include "DMSKPTask.h" 26 #include "DMSKPTask.h"
26 #include "DMTask.h" 27 #include "DMTask.h"
27 #include "DMTaskRunner.h" 28 #include "DMTaskRunner.h"
28 #include "DMTestTask.h" 29 #include "DMTestTask.h"
29 30
30 #ifdef SK_BUILD_POPPLER 31 #ifdef SK_BUILD_POPPLER
31 # include "SkPDFRasterizer.h" 32 # include "SkPDFRasterizer.h"
32 # define RASTERIZE_PDF_PROC SkPopplerRasterizePDF 33 # define RASTERIZE_PDF_PROC SkPopplerRasterizePDF
33 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS) 34 #elif defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
(...skipping 11 matching lines...) Expand all
45 using skiatest::TestRegistry; 46 using skiatest::TestRegistry;
46 47
47 static const char kGpuAPINameGL[] = "gl"; 48 static const char kGpuAPINameGL[] = "gl";
48 static const char kGpuAPINameGLES[] = "gles"; 49 static const char kGpuAPINameGLES[] = "gles";
49 50
50 DEFINE_bool(gms, true, "Run GMs?"); 51 DEFINE_bool(gms, true, "Run GMs?");
51 DEFINE_bool(tests, true, "Run tests?"); 52 DEFINE_bool(tests, true, "Run tests?");
52 DEFINE_bool(reportUsedChars, false, "Output test font construction data to be pa sted into" 53 DEFINE_bool(reportUsedChars, false, "Output test font construction data to be pa sted into"
53 " create_test_font.cpp."); 54 " create_test_font.cpp.");
54 DEFINE_string(images, "resources", "Path to directory containing images to decod e."); 55 DEFINE_string(images, "resources", "Path to directory containing images to decod e.");
56 DEFINE_bool(rasterPDF, true, "Rasterize PDFs?");
55 57
56 __SK_FORCE_IMAGE_DECODER_LINKING; 58 __SK_FORCE_IMAGE_DECODER_LINKING;
57 59
60 static DM::RasterizePdfProc get_pdf_rasterizer_proc() {
61 return reinterpret_cast<DM::RasterizePdfProc>(
62 FLAGS_rasterPDF ? RASTERIZE_PDF_PROC : NULL);
63 }
64
58 // "FooBar" -> "foobar". Obviously, ASCII only. 65 // "FooBar" -> "foobar". Obviously, ASCII only.
59 static SkString lowercase(SkString s) { 66 static SkString lowercase(SkString s) {
60 for (size_t i = 0; i < s.size(); i++) { 67 for (size_t i = 0; i < s.size(); i++) {
61 s[i] = tolower(s[i]); 68 s[i] = tolower(s[i]);
62 } 69 }
63 return s; 70 return s;
64 } 71 }
65 72
66 static const GrContextFactory::GLContextType native = GrContextFactory::kNative_ GLContextType; 73 static const GrContextFactory::GLContextType native = GrContextFactory::kNative_ GLContextType;
67 static const GrContextFactory::GLContextType nvpr = GrContextFactory::kNVPR_GL ContextType; 74 static const GrContextFactory::GLContextType nvpr = GrContextFactory::kNVPR_GL ContextType;
(...skipping 27 matching lines...) Expand all
95 START("nvprmsaa16", GpuGMTask, nvpr, gpuAPI, 16, false); 102 START("nvprmsaa16", GpuGMTask, nvpr, gpuAPI, 16, false);
96 START("gpudft", GpuGMTask, native, gpuAPI, 0, true); 103 START("gpudft", GpuGMTask, native, gpuAPI, 0, true);
97 START("gpunull", GpuGMTask, null, gpuAPI, 0, false); 104 START("gpunull", GpuGMTask, null, gpuAPI, 0, false);
98 START("gpudebug", GpuGMTask, debug, gpuAPI, 0, false); 105 START("gpudebug", GpuGMTask, debug, gpuAPI, 0, false);
99 #if SK_ANGLE 106 #if SK_ANGLE
100 START("angle", GpuGMTask, angle, gpuAPI, 0, false); 107 START("angle", GpuGMTask, angle, gpuAPI, 0, false);
101 #endif 108 #endif
102 #if SK_MESA 109 #if SK_MESA
103 START("mesa", GpuGMTask, mesa, gpuAPI, 0, false); 110 START("mesa", GpuGMTask, mesa, gpuAPI, 0, false);
104 #endif 111 #endif
105 START("pdf", PDFTask, RASTERIZE_PDF_PROC); 112 START("pdf", PDFTask, get_pdf_rasterizer_proc());
106 } 113 }
107 } 114 }
108 #undef START 115 #undef START
109 } 116 }
110 117
111 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests, 118 static void kick_off_tests(const SkTDArray<TestRegistry::Factory>& tests,
112 DM::Reporter* reporter, 119 DM::Reporter* reporter,
113 DM::TaskRunner* tasks) { 120 DM::TaskRunner* tasks) {
114 for (int i = 0; i < tests.count(); i++) { 121 for (int i = 0; i < tests.count(); i++) {
115 SkAutoTDelete<Test> test(tests[i](NULL)); 122 SkAutoTDelete<Test> test(tests[i](NULL));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 158 }
152 SkAutoTUnref<SkPicture> pic( 159 SkAutoTUnref<SkPicture> pic(
153 SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeB itmap)); 160 SkPicture::CreateFromStream(stream.get(), &sk_tools::LazyDecodeB itmap));
154 if (pic.get() == NULL) { 161 if (pic.get() == NULL) {
155 SkDebugf("Could not read %s as an SkPicture.\n", skps[i].c_str()); 162 SkDebugf("Could not read %s as an SkPicture.\n", skps[i].c_str());
156 exit(1); 163 exit(1);
157 } 164 }
158 165
159 SkString filename = SkOSPath::Basename(skps[i].c_str()); 166 SkString filename = SkOSPath::Basename(skps[i].c_str());
160 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename))); 167 tasks->add(SkNEW_ARGS(DM::SKPTask, (reporter, tasks, pic, filename)));
161 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename, RAST ERIZE_PDF_PROC))); 168 tasks->add(SkNEW_ARGS(DM::PDFTask, (reporter, tasks, pic, filename,
169 get_pdf_rasterizer_proc())));
162 } 170 }
163 } 171 }
164 172
165 static void kick_off_images(const SkTArray<SkString>& images, 173 static void kick_off_images(const SkTArray<SkString>& images,
166 DM::Reporter* reporter, 174 DM::Reporter* reporter,
167 DM::TaskRunner* tasks) { 175 DM::TaskRunner* tasks) {
168 for (int i = 0; i < images.count(); i++) { 176 for (int i = 0; i < images.count(); i++) {
169 SkAutoTUnref<SkData> image(SkData::NewFromFileName(images[i].c_str())); 177 SkAutoTUnref<SkData> image(SkData::NewFromFileName(images[i].c_str()));
170 if (!image) { 178 if (!image) {
171 SkDebugf("Could not read %s.\n", images[i].c_str()); 179 SkDebugf("Could not read %s.\n", images[i].c_str());
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
281 report_failures(failures); 289 report_failures(failures);
282 return failures.count() > 0; 290 return failures.count() > 0;
283 } 291 }
284 292
285 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL) 293 #if !defined(SK_BUILD_FOR_IOS) && !defined(SK_BUILD_FOR_NACL)
286 int main(int argc, char** argv) { 294 int main(int argc, char** argv) {
287 SkCommandLineFlags::Parse(argc, argv); 295 SkCommandLineFlags::Parse(argc, argv);
288 return dm_main(); 296 return dm_main();
289 } 297 }
290 #endif 298 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698