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

Side by Side Diff: tools/gpuveto.cpp

Issue 259663004: gpuveto tool (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: added comment Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « gyp/tools.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 /*
2 * Copyright 2014 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
8 #include "LazyDecodeBitmap.h"
9 #include "SkCommandLineFlags.h"
10 #include "SkPicture.h"
11 #include "SkPictureRecorder.h"
12 #include "SkStream.h"
13
14 DEFINE_string2(readFile, r, "", "skp file to process.");
15 DEFINE_bool2(quiet, q, false, "quiet");
16
17 // This tool just loads a single skp, replays into a new SkPicture (to
18 // regenerate the GPU-specific tracking information) and reports
19 // the value of the suitableForGpuRasterization method.
20 // Return codes:
21 static const int kSuccess = 0;
22 static const int kError = 1;
23
24 int tool_main(int argc, char** argv);
25 int tool_main(int argc, char** argv) {
26 #if SK_SUPPORT_GPU
27 SkCommandLineFlags::SetUsage("Reports on an skp file's suitability for GPU r asterization");
28 SkCommandLineFlags::Parse(argc, argv);
29
30 if (FLAGS_readFile.count() != 1) {
31 if (!FLAGS_quiet) {
32 SkDebugf("Missing input file\n");
33 }
34 return kError;
35 }
36
37 SkFILEStream inputStream(FLAGS_readFile[0]);
38 if (!inputStream.isValid()) {
39 if (!FLAGS_quiet) {
40 SkDebugf("Couldn't open file\n");
41 }
42 return kError;
43 }
44
45 SkPicture::InstallPixelRefProc proc = &sk_tools::LazyDecodeBitmap;
46
47 SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, pr oc));
48 if (NULL == picture.get()) {
49 if (!FLAGS_quiet) {
50 SkDebugf("Could not read the SkPicture\n");
51 }
52 return kError;
53 }
54
55 // The SkPicture tracking information is only generated during recording
56 // an isn't serialized. Replay the picture to regenerated the tracking data.
57 SkPictureRecorder recorder;
58 picture->draw(recorder.beginRecording(picture->width(), picture->height(), N ULL, 0));
59 SkAutoTUnref<SkPicture> recorded(recorder.endRecording());
60
61 if (recorded->suitableForGpuRasterization(NULL)) {
bsalomon 2014/04/25 19:41:31 don't we need to pass a grcontext? I guess the cur
robertphillips 2014/04/25 21:05:08 Right - this is just the first pass. We will also
62 SkDebugf("suitable\n");
63 } else {
64 SkDebugf("unsuitable\n");
65 }
66
67 return kSuccess;
68 #else
69 SkDebugf("gpuveto is only useful when GPU rendering is enabled\n");
70 return kError;
71 #endif
72 }
73
74 #if !defined SK_BUILD_FOR_IOS
75 int main(int argc, char * const argv[]) {
76 return tool_main(argc, (char**) argv);
77 }
78 #endif
OLDNEW
« no previous file with comments | « gyp/tools.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698