Home | History | Annotate | Download | only in ui
      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_CURSOR_TEXTURE_H_
      6 #define REMOTING_IOS_UI_CURSOR_TEXTURE_H_
      7 
      8 #import <Foundation/Foundation.h>
      9 #import <GLKit/GLKit.h>
     10 
     11 #import "base/memory/scoped_ptr.h"
     12 
     13 #import "remoting/ios/utility.h"
     14 #include "third_party/webrtc/modules/desktop_capture/desktop_geometry.h"
     15 #include "third_party/webrtc/modules/desktop_capture/mouse_cursor.h"
     16 
     17 @interface CursorTexture : NSObject {
     18  @private
     19   // GL name
     20   GLuint _textureId;
     21   webrtc::DesktopSize _textureSize;
     22   BOOL _needInitialize;
     23 
     24   // The current cursor
     25   scoped_ptr<webrtc::MouseCursor> _cursor;
     26 
     27   BOOL _needCursorRedraw;
     28 
     29   // Rectangle of the most recent cursor drawn to a GL Texture.  On each
     30   // successive frame when a new cursor is available this region is cleared on
     31   // the GL Texture, so that the GL Texture is completely transparent again, and
     32   // the cursor is then redrawn.
     33   webrtc::DesktopRect _cursorDrawnToGL;
     34 }
     35 
     36 - (const webrtc::DesktopSize&)textureSize;
     37 
     38 - (void)setTextureSize:(const webrtc::DesktopSize&)size;
     39 
     40 - (const webrtc::MouseCursor&)cursor;
     41 
     42 - (void)setCursor:(webrtc::MouseCursor*)cursor;
     43 
     44 // bind this object to an effect's via the effects properties
     45 - (void)bindToEffect:(GLKEffectPropertyTexture*)effectProperty;
     46 
     47 // True if the cursor has changed in a way that requires it to be redrawn
     48 - (BOOL)needDrawAtPosition:(const webrtc::DesktopVector&)position;
     49 
     50 // needDrawAtPosition must be checked prior to calling drawWithMousePosition.
     51 // Draw mouse at the new position.
     52 - (void)drawWithMousePosition:(const webrtc::DesktopVector&)position;
     53 
     54 - (void)releaseTexture;
     55 
     56 @end
     57 
     58 #endif  // REMOTING_IOS_UI_CURSOR_TEXTURE_H_