Chromium Code Reviews| 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..9ba1e51170c020f5d593f19f2a8f515123a8cef3 |
| --- /dev/null |
| +++ b/remoting/client/display/drawable.h |
| @@ -0,0 +1,52 @@ |
| +// 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 { |
|
Sergey Ulanov
2017/01/10 23:24:01
please nest it in Drawable class. Otherwise the va
nicholss
2017/01/11 18:56:43
The intent was that these are guide-lines and if w
|
| + AUTO = -1, |
| + DESKTOP = 100, |
| + CURSOR_FEEDBACK = 200, |
| + CURSOR = 300, |
| +}; |
| + |
| +class Drawable { |
|
Sergey Ulanov
2017/01/10 23:24:01
add a short comment to explain what this class is
|
| + public: |
| + Drawable() {} |
| + virtual ~Drawable(){}; |
|
Sergey Ulanov
2017/01/10 23:24:01
remove ;
|
| + |
| + // Sets the canvas on which the object will be drawn. |
| + // If |canvas| is nullptr, nothing will happen when calling Draw(). |
| + virtual void SetCanvas(base::WeakPtr<Canvas> canvas) = 0; |
| + |
| + // Draws the object on the canvas. |
| + // Returns true if there is a pending 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_; }; |
|
Sergey Ulanov
2017/01/10 23:24:01
get_z_index()?
nicholss
2017/01/11 18:56:43
I am not sure what this comment is asking for. Get
Yuwei
2017/01/11 19:16:58
Getters and setters are often named with underscor
Sergey Ulanov
2017/01/11 22:47:31
Normally set_var() naming is used only for methods
Sergey Ulanov
2017/01/11 22:47:31
Sorry, ignore this comment please - I wrote it bef
|
| + |
| + // 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; |
|
Sergey Ulanov
2017/01/10 23:24:01
I don't think we need SetZIndex or z_index_. Inste
nicholss
2017/01/11 18:56:43
Done.
|
| + |
| + DISALLOW_COPY_AND_ASSIGN(Drawable); |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ |