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

Unified Diff: remoting/client/gl_drawable.h

Issue 2591363002: Adding drawable to CRD andorid and iOS gl rendering pipeline. (Closed)
Patch Set: Minor cleanup of an unused const. Created 4 years 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_drawable.h
diff --git a/remoting/client/gl_drawable.h b/remoting/client/gl_drawable.h
new file mode 100644
index 0000000000000000000000000000000000000000..49a6db41cad70011dd6e75a0b73c64bfb23b7b58
--- /dev/null
+++ b/remoting/client/gl_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_GL_DRAWABLE_H_
+#define REMOTING_CLIENT_GL_DRAWABLE_H_
+
+#include "base/macros.h"
+#include "base/memory/weak_ptr.h"
+
+namespace remoting {
+
+class GlCanvas;
+
+enum DrawableZIndex {
joedow 2016/12/22 00:29:02 Z index is fine, but would it make sense to refer
+ AUTO = -1,
joedow 2016/12/22 00:29:02 DEFAULT instead of AUTO?
nicholss 2016/12/22 16:21:41 The default is AUTO, which is a css construct.
joedow 2016/12/22 19:18:09 Neither Android nor iOS use CSS so I wouldn't have
nicholss 2017/01/09 18:50:24 I don't really understand the issue leaning on a c
+ DESKTOP = 100,
+ CURSOR_FEEDBACK = 200,
+ CURSOR = 300,
+};
+
+class GlDrawable {
+ public:
+ GlDrawable() {}
+ virtual ~GlDrawable(){};
joedow 2016/12/22 00:29:02 space between () and {}
+
+ // Sets the canvas on which the object will be drawn.
+ // If |canvas| is nullptr, nothing will happen when calling Draw().
joedow 2016/12/22 00:29:02 What should Draw() return if |canvas| is nullptr?
nicholss 2017/01/09 18:50:24 It would depend on the implementation. Draw return
+ virtual void SetCanvas(GlCanvas* 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.
joedow 2016/12/22 00:29:02 This could be used for other reasons too (i.e. if
+ virtual base::WeakPtr<GlDrawable> GetWeakPtr() = 0;
+
+ int GetZIndex() { return z_index_; };
+
+ // Specify the Z Index for this drawable. A higher Z Index will draw after a
joedow 2016/12/22 00:29:02 There is a lot of renderer impl details in the com
nicholss 2017/01/09 18:50:24 Normally interfaces are where behaviors and side e
+ // 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(GlDrawable);
+};
+
+namespace drawable {
+
+struct {
Yuwei 2016/12/21 23:41:59 Why not put the name after `struct`?
nicholss 2017/01/09 18:50:24 old c habits.
+ bool operator()(base::WeakPtr<GlDrawable> a, base::WeakPtr<GlDrawable> b) {
joedow 2016/12/22 00:29:02 I don't think this belongs here. I feel like this
joedow 2016/12/22 00:29:02 Can these be const ref instead of passed by value?
+ return a->GetZIndex() < b->GetZIndex();
+ }
+} SortDrawablesZOrder;
Yuwei 2016/12/21 23:41:59 Since this is not a sorter, I think it makes more
nicholss 2017/01/09 18:50:24 Good suggestion.
+
+} // namespace drawable
+
+} // namespace remoting
+
+#endif // REMOTING_CLIENT_GL_DRAWABLE_H_

Powered by Google App Engine
This is Rietveld 408576698