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

Side by Side Diff: remoting/ios/ui/desktop_texture.mm

Issue 475333004: Remove old Chromoting iOS client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
« no previous file with comments | « remoting/ios/ui/desktop_texture.h ('k') | remoting/ios/ui/help_view_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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/ios/ui/desktop_texture.h"
10
11 @implementation DesktopTexture
12
13 - (const webrtc::DesktopSize&)textureSize {
14 return _textureSize;
15 }
16
17 - (void)setTextureSize:(const webrtc::DesktopSize&)size {
18 if (!_textureSize.equals(size)) {
19 _textureSize.set(size.width(), size.height());
20 _needInitialize = true;
21 }
22 }
23
24 - (void)bindToEffect:(GLKEffectPropertyTexture*)effectProperty {
25 glGenTextures(1, &_textureId);
26 [Utility bindTextureForIOS:_textureId];
27
28 // This is the HOST Desktop layer, and each draw will always replace what is
29 // currently in the draw context
30 effectProperty.target = GLKTextureTarget2D;
31 effectProperty.name = _textureId;
32 effectProperty.envMode = GLKTextureEnvModeReplace;
33 effectProperty.enabled = GL_TRUE;
34
35 [Utility logGLErrorCode:@"DesktopTexture bindToTexture"];
36 // Release context
37 glBindTexture(GL_TEXTURE_2D, 0);
38 }
39
40 - (BOOL)needDraw {
41 return _needInitialize;
42 }
43
44 - (void)drawRegion:(GLRegion*)region rect:(CGRect)rect {
45 if (_textureSize.height() == 0 && _textureSize.width() == 0) {
46 return;
47 }
48
49 [Utility bindTextureForIOS:_textureId];
50
51 if (_needInitialize) {
52 glTexImage2D(GL_TEXTURE_2D,
53 0,
54 GL_RGBA,
55 _textureSize.width(),
56 _textureSize.height(),
57 0,
58 GL_RGBA,
59 GL_UNSIGNED_BYTE,
60 NULL);
61
62 [Utility logGLErrorCode:@"DesktopTexture initializeTextureSurfaceWithSize"];
63 _needInitialize = false;
64 }
65
66 [Utility drawSubRectToGLFromRectOfSize:_textureSize
67 subRect:webrtc::DesktopRect::MakeXYWH(
68 region->offset->x(),
69 region->offset->y(),
70 region->image->size().width(),
71 region->image->size().height())
72 data:region->image->data()];
73
74 [Utility logGLErrorCode:@"DesktopTexture drawRegion"];
75 // Release context
76 glBindTexture(GL_TEXTURE_2D, 0);
77 }
78
79 - (void)releaseTexture {
80 glDeleteTextures(1, &_textureId);
81 }
82
83 @end
OLDNEW
« no previous file with comments | « remoting/ios/ui/desktop_texture.h ('k') | remoting/ios/ui/help_view_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698