Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
skp_parser.cpp File Reference
#include "include/core/SkPicture.h"
#include "include/core/SkStream.h"
#include "include/utils/SkNullCanvas.h"
#include "src/utils/SkJSONWriter.h"
#include "tools/UrlDataManager.h"
#include "tools/debugger/DebugCanvas.h"
#include <iostream>

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 40 of file skp_parser.cpp.

40 {
41 if (argc < 2) {
42 SkDebugf("Usage:\n %s SKP_FILE [DATA_URL]\n", argv[0]);
43 return 1;
44 }
45 SkFILEStream input(argv[1]);
46 if (!input.isValid()) {
47 SkDebugf("Bad file: '%s'\n", argv[1]);
48 return 2;
49 }
51 if (!pic) {
52 SkDebugf("Bad skp: '%s'\n", argv[1]);
53 return 3;
54 }
55 SkISize size = pic->cullRect().roundOut().size();
56 DebugCanvas debugCanvas(size.width(), size.height());
57 pic->playback(&debugCanvas);
58 std::unique_ptr<SkCanvas> nullCanvas = SkMakeNullCanvas();
59 UrlDataManager dataManager(SkString("data"));
62 writer.beginObject(); // root
63 debugCanvas.toJSON(writer, dataManager, nullCanvas.get());
64 writer.endObject(); // root
65 writer.flush();
66 if (argc > 2) {
67 if (UrlDataManager::UrlData* data =
68 dataManager.getDataFromUrl(SkString(argv[2]))) {
69 SkData* skdata = data->fData.get();
70 SkASSERT(skdata);
71 #ifdef SK_BUILD_FOR_WIN
72 fflush(stdout);
73 (void)_setmode(_fileno(stdout), _O_BINARY);
74 #endif
75 fwrite(skdata->data(), skdata->size(), 1, stdout);
76 } else {
77 SkDebugf("Bad data url.\n");
78 return 4;
79 }
80 } else {
81 sk_sp<SkData> data = stream.detachAsData();
82 fwrite(data->data(), data->size(), 1, stdout);
83 }
84 return 0;
85}
#define SkASSERT(cond)
Definition SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API std::unique_ptr< SkCanvas > SkMakeNullCanvas()
const void * data() const
Definition SkData.h:37
size_t size() const
Definition SkData.h:30
static sk_sp< SkPicture > MakeFromStream(SkStream *stream, const SkDeserialProcs *procs=nullptr)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition switches.h:259