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

Side by Side Diff: remoting/ios/ui/scene_view.h

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/pin_entry_view_controller_iphone.xib ('k') | remoting/ios/ui/scene_view.mm » ('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 #ifndef REMOTING_IOS_UI_SCENE_VIEW_H_
6 #define REMOTING_IOS_UI_SCENE_VIEW_H_
7
8 #import <Foundation/Foundation.h>
9 #import <GLKit/GLKit.h>
10
11 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
12
13 typedef struct {
14 bool left;
15 bool right;
16 bool top;
17 bool bottom;
18 } AnchorPosition;
19
20 typedef struct {
21 int left;
22 int right;
23 int top;
24 int bottom;
25 } MarginQuad;
26
27 typedef struct {
28 CGPoint geometryVertex;
29 CGPoint textureVertex;
30 } TexturedVertex;
31
32 typedef struct {
33 TexturedVertex bl;
34 TexturedVertex br;
35 TexturedVertex tl;
36 TexturedVertex tr;
37 } TexturedQuad;
38
39 @interface SceneView : NSObject {
40 @private
41
42 // GL name
43 GLuint _textureId;
44
45 GLKMatrix4 _projectionMatrix;
46 GLKMatrix4 _modelViewMatrix;
47
48 // The draw surface is a triangle strip (triangles defined by the intersecting
49 // vertexes) to create a rectangle surface.
50 // 1****3
51 // | / |
52 // | / |
53 // 2****4
54 // This also determines the resolution of our surface, being a unit (NxN) grid
55 // with finite divisions. For our surface N = 1, and the number of divisions
56 // respects the CLIENT's desktop resolution.
57 TexturedQuad _glQuad;
58
59 // Cache of the CLIENT's desktop resolution.
60 webrtc::DesktopSize _contentSize;
61 // Cache of the HOST's desktop resolution.
62 webrtc::DesktopSize _frameSize;
63
64 // Location of the mouse according to the CLIENT in the prospective of the
65 // HOST resolution
66 webrtc::DesktopVector _mousePosition;
67
68 // When a user pans they expect the view to experience acceleration after
69 // they release the pan gesture. We track that velocity vector as a position
70 // delta factored over the frame rate of the GL Context. Velocity is
71 // accounted as a float.
72 CGPoint _panVelocity;
73 }
74
75 // The position of the scene is tracked in the prospective of the CLIENT
76 // resolution. The Z-axis is used to track the scale of the render, our scene
77 // never changes position on the Z-axis.
78 @property(nonatomic, readonly) GLKVector3 position;
79
80 // Space around border consumed by non-scene elements, we can not draw here
81 @property(nonatomic, readonly) MarginQuad margin;
82
83 @property(nonatomic, readonly) AnchorPosition anchored;
84
85 - (const GLKMatrix4&)projectionMatrix;
86
87 // calculate and return the current model view matrix
88 - (const GLKMatrix4&)modelViewMatrix;
89
90 - (const webrtc::DesktopSize&)contentSize;
91
92 // Update the CLIENT resolution and draw scene size, accounting for margins
93 - (void)setContentSize:(const CGSize&)size;
94
95 - (const webrtc::DesktopSize&)frameSize;
96
97 // Update the HOST resolution and reinitialize the scene positioning
98 - (void)setFrameSize:(const webrtc::DesktopSize&)size;
99
100 - (const webrtc::DesktopVector&)mousePosition;
101
102 - (void)setPanVelocity:(const CGPoint&)delta;
103
104 - (void)setMarginsFromLeft:(int)left
105 right:(int)right
106 top:(int)top
107 bottom:(int)bottom;
108
109 // Draws to a GL Context
110 - (void)draw;
111
112 - (BOOL)containsTouchPoint:(CGPoint)point;
113
114 // Applies translation and zoom. Translation is bounded to screen edges.
115 // Zooming is bounded on the lower side to the maximum of width and height, and
116 // on the upper side by a constant, experimentally chosen.
117 - (void)panAndZoom:(CGPoint)translation scaleBy:(float)scale;
118
119 // Mouse is tracked in the perspective of the HOST desktop, but the projection
120 // to the user is in the perspective of the CLIENT resolution. Find the HOST
121 // position that is the center of the current CLIENT view. If the mouse is in
122 // the half of the CLIENT screen that is closest to an anchor, then move the
123 // mouse, otherwise the mouse should be centered.
124 - (void)updateMousePositionAndAnchorsWithTranslation:(CGPoint)translation
125 scale:(float)scale;
126
127 // When zoom is changed the scene is translated to keep an anchored point
128 // (an anchored edge, or the spot the user is touching) at the same place in the
129 // User's perspective. Return the delta of the position of the lower endpoint
130 // of the axis
131 + (float)positionDeltaFromScaling:(float)ratio
132 position:(float)position
133 length:(float)length
134 anchor:(float)anchor;
135
136 // Return the delta of the position of the lower endpoint of the axis
137 + (int)positionDeltaFromTranslation:(int)translation
138 position:(int)position
139 freeSpace:(int)freeSpace
140 scaleingPositionDelta:(int)scaleingPositionDelta
141 isAnchoredLow:(BOOL)isAnchoredLow
142 isAnchoredHigh:(BOOL)isAnchoredHigh;
143
144 // |position + delta| is snapped to the bounds, return the delta in respect to
145 // the bounding.
146 + (int)boundDeltaFromPosition:(float)position
147 delta:(int)delta
148 lowerBound:(int)lowerBound
149 upperBound:(int)upperBound;
150
151 // Return |nextPosition| when it is anchored and still in the respective 1/2 of
152 // the screen. When |nextPosition| is outside scene's edge, snap to edge.
153 // Otherwise return |centerPosition|
154 + (int)boundMouseGivenNextPosition:(int)nextPosition
155 maxPosition:(int)maxPosition
156 centerPosition:(int)centerPosition
157 isAnchoredLow:(BOOL)isAnchoredLow
158 isAnchoredHigh:(BOOL)isAnchoredHigh;
159
160 // If the mouse is at an edge return zero, otherwise return |velocity|
161 + (float)boundVelocity:(float)velocity
162 axisLength:(int)axisLength
163 mousePosition:(int)mousePosition;
164
165 // Update the scene acceleration vector.
166 // Returns true if velocity before 'ticking' is non-zero.
167 - (BOOL)tickPanVelocity;
168
169 @end
170
171 #endif // REMOTING_IOS_UI_SCENE_VIEW_H_
OLDNEW
« no previous file with comments | « remoting/ios/ui/pin_entry_view_controller_iphone.xib ('k') | remoting/ios/ui/scene_view.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698