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

Side by Side Diff: webrtc/sdk/objc/Framework/Classes/Metal/RTCMTLVideoView.m

Issue 2651743007: Add metal view, shaders and renderer. (Closed)
Patch Set: Rename subfolder:metal->Metal Created 3 years, 10 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 /*
2 * Copyright 2017 The WebRTC project authors. All Rights Reserved.
3 *
4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree.
9 */
10
11 #import "WebRTC/RTCMTLVideoView.h"
12
13 #import <Metal/Metal.h>
14 #import <MetalKit/MetalKit.h>
15
16 #import "RTCNV12Renderer.h"
17
18 @interface RTCMTLVideoView ()
19 @property (nonatomic) id<RTCMTLRenderer> renderer;
20 @property (nonatomic, strong) __kindof UIView *metalView;
21 @end
22
23 @implementation RTCMTLVideoView {
24 id<RTCMTLRenderer> _renderer;
25 }
26
27 @synthesize renderer = _renderer;
28 @synthesize metalView = _metalView;
29
30 - (instancetype)initWithFrame:(CGRect)frameRect {
31 self = [super initWithFrame:frameRect];
32 #if defined(__OBJC__) && COREVIDEO_SUPPORTS_METAL
33 if (self) {
34 _metalView = [[MTKView alloc] initWithFrame:frameRect];
35 [self addSubview:_metalView];
36 _metalView.translatesAutoresizingMaskIntoConstraints = NO;
37 UILayoutGuide *margins = self.layoutMarginsGuide;
38 [_metalView.topAnchor constraintEqualToAnchor:margins.topAnchor].active = YE S;
39 [_metalView.bottomAnchor constraintEqualToAnchor:margins.bottomAnchor].activ e = YES;
40 [_metalView.leftAnchor constraintEqualToAnchor:margins.leftAnchor].active = YES;
41 [_metalView.rightAnchor constraintEqualToAnchor:margins.rightAnchor].active = YES;
42
43 _renderer = [[RTCNV12Renderer alloc] initWithView:_metalView];
Chuck 2017/02/15 14:54:05 Is this indented 1 too many spaces?
44 }
45 #endif
46 return self;
47 }
48
49 - (BOOL)setupRenderer {
50 return [_renderer setup];
51 }
52
53 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698