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

Unified Diff: remoting/client/display/drawable.h

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: Cleanup and adding interfaces based on review feedback.: Created 3 years, 11 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/display/drawable.h
diff --git a/remoting/client/display/drawable.h b/remoting/client/display/drawable.h
new file mode 100644
index 0000000000000000000000000000000000000000..24f9b22c282cee3057da1d1fa08f8aecd45cdef8
--- /dev/null
+++ b/remoting/client/display/drawable.h
@@ -0,0 +1,62 @@
+// 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_DISPLAY_DRAWABLE_H_
+#define REMOTING_CLIENT_DISPLAY_DRAWABLE_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+
+namespace remoting {
+
+class Canvas;
+
+enum DrawableZIndex {
+ AUTO = -1,
+ DESKTOP = 100,
+ CURSOR_FEEDBACK = 200,
+ CURSOR = 300,
+};
+
+class Drawable {
+ public:
+ Drawable() {}
+ virtual ~Drawable(){};
+
+ // Sets the canvas on which the object will be drawn.
+ // If |canvas| is nullptr, nothing will happen when calling Draw().
+ virtual void SetCanvas(Canvas* canvas) = 0;
+
+ // Draws the object on the canvas.
+ // Return true if you have a next frame.
+ virtual bool Draw() = 0;
+
+ // Used for the renderer to keep a stack of drawables.
+ virtual base::WeakPtr<Drawable> GetWeakPtr() = 0;
+
+ int GetZIndex() { return z_index_; };
+
+ // Specify the Z Index for this drawable. A higher Z Index will draw after a
+ // lower z index. Elements with the same Z Index will draw in order inserted.
+ void SetZIndex(int z_index) { z_index_ = z_index; };
+
+ private:
+ int z_index_ = DrawableZIndex::AUTO;
+
+ DISALLOW_COPY_AND_ASSIGN(Drawable);
+};
+
+namespace drawable {
+
+struct {
+ bool operator()(base::WeakPtr<Drawable> a, base::WeakPtr<Drawable> b) {
+ return a->GetZIndex() < b->GetZIndex();
+ }
+} ZOrderComparator;
+
+} // namespace drawable
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_DISPLAY_DRAWABLE_H_

Powered by Google App Engine
This is Rietveld 408576698