• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 
11 class SkFILEWStream;
12 class SkPath;
13 
14 namespace 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
22     // only one set of aggregation arrays will be written per program
23     // 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 
47 #endif
48