| OLD | NEW |
| (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 #ifndef REMOTING_CLIENT_IOS_UTILITY_H_ | |
| 6 #define REMOTING_CLIENT_IOS_UTILITY_H_ | |
| 7 | |
| 8 #import <Foundation/Foundation.h> | |
| 9 #import <GLKit/GLKit.h> | |
| 10 #import <OpenGLES/ES2/gl.h> | |
| 11 #include <memory> | |
| 12 | |
| 13 #include "third_party/webrtc/modules/desktop_capture/desktop_frame.h" | |
| 14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h" | |
| 15 | |
| 16 #import "remoting/client/ios/bridge/host_proxy.h" | |
| 17 | |
| 18 #define CRD_LOCALIZED_STRING(stringId) \ | |
| 19 [Utility localizedStringForKey:@ #stringId dummyId:stringId] | |
| 20 | |
| 21 typedef struct { | |
| 22 GLKVector2 geometryVertex; | |
| 23 GLKVector2 textureVertex; | |
| 24 } TexturedVertex; | |
| 25 | |
| 26 typedef struct { | |
| 27 TexturedVertex bl; | |
| 28 TexturedVertex br; | |
| 29 TexturedVertex tl; | |
| 30 TexturedVertex tr; | |
| 31 } TexturedQuad; | |
| 32 | |
| 33 typedef struct { | |
| 34 GLuint name; | |
| 35 webrtc::DesktopRect rect; | |
| 36 // The draw surface is a triangle strip (triangles defined by the intersecting | |
| 37 // vertexes) to create a rectangle surface. | |
| 38 // 1****3 | |
| 39 // | / | | |
| 40 // | / | | |
| 41 // 2****4 | |
| 42 // This also determines the resolution of our surface, being a unit (NxN) grid | |
| 43 // with finite divisions. For our surface N = 1, and the number of divisions | |
| 44 // respects the CLIENT's desktop resolution. | |
| 45 TexturedQuad quad; | |
| 46 } TextureContainer; | |
| 47 | |
| 48 typedef struct { | |
| 49 std::unique_ptr<webrtc::BasicDesktopFrame> image; | |
| 50 std::unique_ptr<webrtc::DesktopVector> offset; | |
| 51 } GLRegion; | |
| 52 | |
| 53 @interface Utility : NSObject | |
| 54 | |
| 55 + (BOOL)isPad; | |
| 56 | |
| 57 + (BOOL)isInLandscapeMode; | |
| 58 | |
| 59 // Return the resolution in respect to orientation. | |
| 60 + (CGSize)getOrientatedSize:(CGSize)size | |
| 61 shouldWidthBeLongestSide:(BOOL)shouldWidthBeLongestSide; | |
| 62 | |
| 63 + (void)showAlert:(NSString*)title message:(NSString*)message; | |
| 64 | |
| 65 + (NSString*)appVersionNumberDisplayString; | |
| 66 | |
| 67 // GL Binding Context requires some specific flags for the type of textures | |
| 68 // being drawn. | |
| 69 + (void)bindTextureForIOS:(GLuint)glName; | |
| 70 | |
| 71 // Sometimes it is necessary to read gl errors. This is called in various | |
| 72 // places while working in the GL Context. | |
| 73 + (void)logGLErrorCode:(NSString*)funcName; | |
| 74 | |
| 75 + (void)drawSubRectToGLFromRectOfSize:(const webrtc::DesktopSize&)rectSize | |
| 76 subRect:(const webrtc::DesktopRect&)subRect | |
| 77 data:(const uint8_t*)data; | |
| 78 | |
| 79 + (void)moveMouse:(HostProxy*)controller at:(const webrtc::DesktopVector&)point; | |
| 80 | |
| 81 + (void)leftClickOn:(HostProxy*)controller | |
| 82 at:(const webrtc::DesktopVector&)point; | |
| 83 | |
| 84 + (void)middleClickOn:(HostProxy*)controller | |
| 85 at:(const webrtc::DesktopVector&)point; | |
| 86 | |
| 87 + (void)rightClickOn:(HostProxy*)controller | |
| 88 at:(const webrtc::DesktopVector&)point; | |
| 89 | |
| 90 + (void)mouseScroll:(HostProxy*)controller | |
| 91 at:(const webrtc::DesktopVector&)point | |
| 92 delta:(const webrtc::DesktopVector&)delta; | |
| 93 | |
| 94 // Wrapper around NSLocalizedString. Don't call this directly. Use | |
| 95 // CRD_LOCALIZED_STRING instead. |dummyId| is ignored. It's used by | |
| 96 // CRD_LOCALIZED_STRING to force the compiler to resolve the constant name. | |
| 97 + (NSString*)localizedStringForKey:(NSString*)key dummyId:(int)dummyId; | |
| 98 | |
| 99 // Objective-C friendly wrapper around ReplaceStringPlaceholders. | |
| 100 + (NSString*)stringWithL10nFormat:(NSString*)format | |
| 101 withReplacements:(NSArray*)replacements; | |
| 102 | |
| 103 @end | |
| 104 | |
| 105 #endif // REMOTING_CLIENT_IOS_UTILITY_H_ | |
| OLD | NEW |