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

Side by Side Diff: remoting/client/ios/chromiumoting/example_view_controller.mm

Issue 2555803002: Adding the iOS app and integration example with GlRenderer. (Closed)
Patch Set: Adjusting how gl_renderer draws layers and added a demo app for CRD iOS. Created 3 years, 12 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
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #if !defined(__has_feature) || !__has_feature(objc_arc)
6 #error "This file requires ARC support."
7 #endif
8
9 #import "remoting/client/ios/chromiumoting/example_view_controller.h"
10
11 #import "remoting/client/sys_opengl.h"
12
13 #include "base/message_loop/message_loop.h"
14 #include "remoting/protocol/frame_stats.h"
15 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h"
16 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
17
18 @interface ExampleViewController ()
19
20 // Helper functions dealing with the GL Context.
21 - (void)setupGL;
22 - (void)tearDownGL;
23
24 @end
25
26 @implementation ExampleViewController
27
28 #pragma mark - UIViewController
29
30 - (void)viewDidLoad {
31 [super viewDidLoad];
32 _gestures = [[ClientGestures alloc] initWithView:self.view];
33 _context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
Yuwei 2016/12/19 23:26:09 The renderer has optimizations that are only for G
34 _runtime = new remoting::ios::AppRuntime();
35 static_cast<GLKView*>(self.view).context = _context;
36 [self setupGL];
37 }
38
39 - (void)viewDidUnload {
40 [super viewDidUnload];
41 [self tearDownGL];
42
43 if ([EAGLContext currentContext] == _context) {
44 [EAGLContext setCurrentContext:nil];
45 }
46 _context = nil;
47 }
48
49 - (void)setupGL {
50 displayHandler = [[GlDisplayHandler alloc] initWithRuntime:_runtime];
51 [displayHandler created];
52 }
53
54 - (void)tearDownGL {
55 // TODO(nicholss): Implement this in a real application.
56 }
57
58 - (void)viewWillAppear:(BOOL)animated {
59 [super viewWillAppear:animated];
60 }
61
62 - (void)viewDidAppear:(BOOL)animated {
63 video_renderer_ =
64 (remoting::SoftwareVideoRenderer*)[displayHandler CreateVideoRenderer]
65 .get();
66 }
67
68 - (void)viewWillDisappear:(BOOL)animated {
69 [super viewWillDisappear:NO];
70 }
71
72 - (void)viewDidLayoutSubviews {
73 [super viewDidLayoutSubviews];
74 }
75
76 #pragma mark - GLKViewDelegate
77
78 // In general, avoid expensive work in this function to maximize frame rate.
79 - (void)glkView:(GLKView*)view drawInRect:(CGRect)rect {
80 if (displayHandler) {
81 [displayHandler glkView:view drawInRect:rect];
82 [displayHandler draw];
83 }
84 }
85
86 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698