OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #import "SkSampleUIView.h" | 8 #import "SkSampleUIView.h" |
9 | 9 |
10 //#define SKGL_CONFIG kEAGLColorFormatRGB565 | 10 //#define SKGL_CONFIG kEAGLColorFormatRGB565 |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithO
bjectsAndKeys:[NSNull null], @"onOrderIn", | 309 NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithO
bjectsAndKeys:[NSNull null], @"onOrderIn", |
310 [NSNull null], @"onOrderOut", | 310 [NSNull null], @"onOrderOut", |
311 [NSNull null], @"sublayers", | 311 [NSNull null], @"sublayers", |
312 [NSNull null], @"contents", | 312 [NSNull null], @"contents", |
313 [NSNull null], @"bounds", | 313 [NSNull null], @"bounds", |
314 nil]; | 314 nil]; |
315 fGLLayer.actions = newActions; | 315 fGLLayer.actions = newActions; |
316 fRasterLayer.actions = newActions; | 316 fRasterLayer.actions = newActions; |
317 [newActions release]; | 317 [newActions release]; |
318 | 318 |
| 319 // rebuild argc and argv from process info |
| 320 NSArray* arguments = [[NSProcessInfo processInfo] arguments]; |
| 321 int argc = [arguments count]; |
| 322 char** argv = new char*[argc]; |
| 323 for (int i = 0; i < argc; ++i) { |
| 324 NSString* arg = [arguments objectAtIndex:i]; |
| 325 int strlen = [arg lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; |
| 326 argv[i] = new char[strlen+1]; |
| 327 [arg getCString:argv[i] maxLength:strlen+1 encoding:NSUTF8StringEnco
ding]; |
| 328 } |
| 329 |
319 fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer); | 330 fDevManager = new SkiOSDeviceManager(fGL.fFramebuffer); |
320 static char* kDummyArgv = const_cast<char*>("dummyExecutableName"); | 331 fWind = new SampleWindow(self, argc, argv, fDevManager); |
321 fWind = new SampleWindow(self, 1, &kDummyArgv, fDevManager); | |
322 | 332 |
323 fWind->resize(self.frame.size.width, self.frame.size.height, | 333 fWind->resize(self.frame.size.width, self.frame.size.height, |
324 kN32_SkColorType); | 334 kN32_SkColorType); |
| 335 |
| 336 for (int i = 0; i < argc; ++i) { |
| 337 delete [] argv[i]; |
| 338 } |
| 339 delete [] argv; |
325 } | 340 } |
326 return self; | 341 return self; |
327 } | 342 } |
328 | 343 |
329 - (void)dealloc { | 344 - (void)dealloc { |
330 delete fDevManager; | 345 delete fDevManager; |
331 delete fFPSState; | 346 delete fFPSState; |
332 self.fRasterLayer = nil; | 347 self.fRasterLayer = nil; |
333 self.fGLLayer = nil; | 348 self.fGLLayer = nil; |
334 [fGL.fContext release]; | 349 [fGL.fContext release]; |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); | 486 glBindRenderbuffer(GL_RENDERBUFFER, fGL.fRenderbuffer); |
472 glGetRenderbufferParameteriv(GL_RENDERBUFFER, | 487 glGetRenderbufferParameteriv(GL_RENDERBUFFER, |
473 GL_RENDERBUFFER_STENCIL_SIZE, | 488 GL_RENDERBUFFER_STENCIL_SIZE, |
474 &info->fStencilBits); | 489 &info->fStencilBits); |
475 glGetRenderbufferParameteriv(GL_RENDERBUFFER, | 490 glGetRenderbufferParameteriv(GL_RENDERBUFFER, |
476 GL_RENDERBUFFER_SAMPLES_APPLE, | 491 GL_RENDERBUFFER_SAMPLES_APPLE, |
477 &info->fSampleCount); | 492 &info->fSampleCount); |
478 } | 493 } |
479 | 494 |
480 @end | 495 @end |
OLD | NEW |