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

Side by Side Diff: tools/path_utils.cpp

Issue 324273002: Delete unused path_utils.* component. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 6 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 | « tools/path_utils.h ('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')
OLDNEW
(Empty)
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 #include "path_utils.h"
9 #include "SkPath.h"
10 #include "SkStream.h"
11
12 namespace sk_tools {
13 static int gCurPathID = 0;
14
15 void dump_path_prefix(SkFILEWStream* pathStream) {
16 if (NULL == pathStream) {
17 return;
18 }
19
20 pathStream->writeText("#include \"SkScalar.h\"\n");
21 pathStream->writeText("#include \"SkPoint.h\"\n");
22 pathStream->writeText("#include \"SkBitmap.h\"\n");
23 pathStream->writeText("#include \"SkDevice.h\"\n");
24 pathStream->writeText("#include \"SkString.h\"\n");
25 pathStream->writeText("#include \"SkImageEncoder.h\"\n");
26 }
27
28 void dump_path(SkFILEWStream* pathStream, const SkPath& path) {
29 if (NULL == pathStream) {
30 return;
31 }
32
33 static const int kMaxPts = 200;
34 static const int kMaxVerbs = 200;
35
36 int numPts = path.countPoints();
37 int numVerbs = path.countVerbs();
38
39 SkASSERT(numPts <= kMaxPts);
40 SkASSERT(numVerbs <= kMaxVerbs);
41
42 SkPoint pts[kMaxPts];
43 uint8_t verbs[kMaxVerbs];
44
45 path.getPoints(pts, kMaxPts);
46 path.getVerbs(verbs, kMaxVerbs);
47
48 const char* gStrs[] = {
49 "kMove_Verb",
50 "kLine_Verb",
51 "kQuad_Verb",
52 "kCubic_Verb",
53 "kClose_Verb",
54 "kDone_Verb"
55 };
56
57 pathStream->writeText("static const int numPts");
58 pathStream->writeDecAsText(gCurPathID);
59 pathStream->writeText(" = ");
60 pathStream->writeDecAsText(numPts);
61 pathStream->writeText(";\n");
62
63 pathStream->writeText("SkPoint pts");
64 pathStream->writeDecAsText(gCurPathID);
65 pathStream->writeText("[] = {\n");
66
67 for (int i = 0; i < numPts; ++i) {
68 SkString temp;
69
70 pathStream->writeText(" { ");
71 temp.appendScalar(pts[i].fX);
72 temp.append("f, ");
73 temp.appendScalar(pts[i].fY);
74 temp.append("f },\n");
75 pathStream->writeText(temp.c_str());
76 }
77 pathStream->writeText("};\n");
78
79 pathStream->writeText("static const int numVerbs");
80 pathStream->writeDecAsText(gCurPathID);
81 pathStream->writeText(" = ");
82 pathStream->writeDecAsText(numVerbs);
83 pathStream->writeText(";\n");
84
85 pathStream->writeText("uint8_t verbs");
86 pathStream->writeDecAsText(gCurPathID);
87 pathStream->writeText("[] = {\n");
88
89 for (int i = 0; i < numVerbs; ++i) {
90 pathStream->writeText("\tSkPath::");
91 pathStream->writeText(gStrs[verbs[i]]);
92 pathStream->writeText(",\n");
93 }
94 pathStream->writeText("};\n");
95
96 gCurPathID++;
97 }
98
99 void dump_path_suffix(SkFILEWStream* pathStream) {
100 if (NULL == pathStream) {
101 return;
102 }
103
104 pathStream->writeText("int numPaths = ");
105 pathStream->writeDecAsText(gCurPathID);
106 pathStream->writeText(";\n");
107
108 pathStream->writeText("int sizes[] = {\n");
109 for (int i = 0; i < gCurPathID; ++i) {
110 pathStream->writeText("\t numPts");
111 pathStream->writeDecAsText(i);
112 pathStream->writeText(", numVerbs");
113 pathStream->writeDecAsText(i);
114 pathStream->writeText(",\n");
115 }
116 pathStream->writeText("};\n");
117
118 pathStream->writeText("const SkPoint* points[] = {\n");
119 for (int i = 0; i < gCurPathID; ++i) {
120 pathStream->writeText("\tpts");
121 pathStream->writeDecAsText(i);
122 pathStream->writeText(",\n");
123 }
124 pathStream->writeText("};\n");
125
126 pathStream->writeText("const uint8_t* verbs[] = {\n");
127 for (int i = 0; i < gCurPathID; ++i) {
128 pathStream->writeText("\t(const uint8_t*)verbs");
129 pathStream->writeDecAsText(i);
130 pathStream->writeText(",\n");
131 }
132 pathStream->writeText("};\n");
133 }
134 }
OLDNEW
« no previous file with comments | « tools/path_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698