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

Unified Diff: remoting/client/gl_cursor_feedback.h

Issue 2148743005: [Remoting Android] Cursor & Cursor Feedback for OpenGL Renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Swap BGRA to RGBA Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: remoting/client/gl_cursor_feedback.h
diff --git a/remoting/client/gl_cursor_feedback.h b/remoting/client/gl_cursor_feedback.h
new file mode 100644
index 0000000000000000000000000000000000000000..89532e8e2294516eb97e18f96dc1e700afce9043
--- /dev/null
+++ b/remoting/client/gl_cursor_feedback.h
@@ -0,0 +1,56 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_
+#define REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/time/time.h"
+
+namespace remoting {
+
+class GlCanvas;
+class GlRenderLayer;
+
+// This class draws the cursor feedback on the canvas.
+class GlCursorFeedback {
+ public:
+ GlCursorFeedback();
+ ~GlCursorFeedback();
+
+ // Sets the canvas on which the cursor feedback will be drawn. Resumes the
+ // feedback texture to the context of the new canvas.
+ // If |canvas| is nullptr, nothing will happen when calling Draw().
+ void SetCanvas(GlCanvas* canvas);
+
+ void StartAnimation(float normalized_x,
+ float normalized_y,
+ float normalized_width,
+ float normalized_height);
+
+ // Returns true if animation is not finished, false otherwise. Does nothing
+ // if the animation has stopped.
+ bool Draw();
+
+ private:
+ // Returns the feedback texture. Creates the texture if it doesn't exist.
+ static const uint8_t* GetFeedbackTexture();
+ static std::unique_ptr<uint8_t[]> texture_;
+
+ std::unique_ptr<GlRenderLayer> layer_;
+ float max_width_ = 0;
+ float max_height_ = 0;
+ float cursor_x_ = 0;
+ float cursor_y_ = 0;
+ base::TimeTicks animation_start_time_;
+
+ DISALLOW_COPY_AND_ASSIGN(GlCursorFeedback);
+};
+
+} // namespace remoting
+#endif // REMOTING_CLIENT_OPENGL_GL_CURSOR_FEEDBACK_H_

Powered by Google App Engine
This is Rietveld 408576698