blob: d05ad16c9a9f0079668ff9271286a2b41177a2a4 [file] [log] [blame]
robertphillips@google.comd3d377f2012-12-07 20:56:13 +00001/*
2 * Copyright 2012 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#ifndef path_utils_DEFINED
9#define path_utils_DEFINED
10
11class SkFILEWStream;
12class SkPath;
13
14namespace sk_tools {
15 // These utilities help write paths to a .cpp file in a compileable form.
16 // To use call them in the order:
17 // dump_path_prefix - once per program invocation
18 // dump_path - once for each path of interest
19 // dump_path_suffix - once per program invocation
20 //
21 // The output system relies on a global current path ID and assumes that
skia.committer@gmail.comc1f224a2012-12-08 02:01:38 +000022 // only one set of aggregation arrays will be written per program
robertphillips@google.comd3d377f2012-12-07 20:56:13 +000023 // invocation. These utilities are not thread safe.
24
25 // Write of the headers needed to compile the resulting .cpp file
26 void dump_path_prefix(SkFILEWStream* pathStream);
27
28 // Write out a single path in the form:
29 // static const int numPts# = ...;
30 // SkPoint pts#[] = { ... };
31 // static const int numVerbs# = ...;
32 // uint8_t verbs#[] = { ... };
33 // Where # is a globally unique identifier
34 void dump_path(SkFILEWStream* pathStream, const SkPath& path);
35
36 // Write out structures to aggregate info about the written paths:
37 // int numPaths = ...;
38 // int sizes[] = {
39 // numPts#, numVerbs#,
40 // ...
41 // };
42 // const SkPoint* points[] = { pts#, ... };
43 // const uint8_t* verbs[] = { verbs#, ... };
44 void dump_path_suffix(SkFILEWStream* pathStream);
45}
46
skia.committer@gmail.comc1f224a2012-12-08 02:01:38 +000047#endif