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

Side by Side Diff: experimental/SkV8Example/SkV8Example.cpp

Issue 2206633004: Move off SK_SUPPORT_LEGACY_DATA_FACTORIES. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Gotta catch 'em all. Created 4 years, 4 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
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 * 7 *
8 */ 8 */
9 #include <v8.h> 9 #include <v8.h>
10 #include <include/libplatform/libplatform.h> 10 #include <include/libplatform/libplatform.h>
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 exit(1); 193 exit(1);
194 } 194 }
195 195
196 const char* script = 196 const char* script =
197 "function onDraw(canvas) { \n" 197 "function onDraw(canvas) { \n"
198 " canvas.fillStyle = '#00FF00'; \n" 198 " canvas.fillStyle = '#00FF00'; \n"
199 " canvas.fillRect(20, 20, 100, 100); \n" 199 " canvas.fillRect(20, 20, 100, 100); \n"
200 " canvas.inval(); \n" 200 " canvas.inval(); \n"
201 "} \n"; 201 "} \n";
202 202
203 SkAutoTUnref<SkData> data; 203 sk_sp<SkData> data;
204 if (FLAGS_infile.count()) { 204 if (FLAGS_infile.count()) {
205 data.reset(SkData::NewFromFileName(FLAGS_infile[0])); 205 data = SkData::MakeFromFileName(FLAGS_infile[0]);
206 script = static_cast<const char*>(data->data()); 206 script = static_cast<const char*>(data->data());
207 } 207 }
208 if (NULL == script) { 208 if (NULL == script) {
209 printf("Could not load file: %s.\n", FLAGS_infile[0]); 209 printf("Could not load file: %s.\n", FLAGS_infile[0]);
210 exit(1); 210 exit(1);
211 } 211 }
212 Path2DBuilder::AddToGlobal(global); 212 Path2DBuilder::AddToGlobal(global);
213 Path2D::AddToGlobal(global); 213 Path2D::AddToGlobal(global);
214 214
215 if (!global->parseScript(script)) { 215 if (!global->parseScript(script)) {
216 printf("Failed to parse file: %s.\n", FLAGS_infile[0]); 216 printf("Failed to parse file: %s.\n", FLAGS_infile[0]);
217 exit(1); 217 exit(1);
218 } 218 }
219 219
220 220
221 JsContext* jsContext = new JsContext(global); 221 JsContext* jsContext = new JsContext(global);
222 222
223 if (!jsContext->initialize()) { 223 if (!jsContext->initialize()) {
224 printf("Failed to initialize.\n"); 224 printf("Failed to initialize.\n");
225 exit(1); 225 exit(1);
226 } 226 }
227 SkV8ExampleWindow* win = new SkV8ExampleWindow(hwnd, jsContext); 227 SkV8ExampleWindow* win = new SkV8ExampleWindow(hwnd, jsContext);
228 global->setWindow(win); 228 global->setWindow(win);
229 229
230 return win; 230 return win;
231 } 231 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698