Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 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_CLIENT_DISPLAY_DRAWABLE_H_ | |
| 6 #define REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ | |
| 7 | |
| 8 #include "base/macros.h" | |
| 9 #include "base/memory/weak_ptr.h" | |
| 10 | |
| 11 namespace remoting { | |
| 12 | |
| 13 class Canvas; | |
| 14 | |
| 15 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
| |
| 16 AUTO = -1, | |
| 17 DESKTOP = 100, | |
| 18 CURSOR_FEEDBACK = 200, | |
| 19 CURSOR = 300, | |
| 20 }; | |
| 21 | |
| 22 class Drawable { | |
|
Sergey Ulanov
2017/01/10 23:24:01
add a short comment to explain what this class is
| |
| 23 public: | |
| 24 Drawable() {} | |
| 25 virtual ~Drawable(){}; | |
|
Sergey Ulanov
2017/01/10 23:24:01
remove ;
| |
| 26 | |
| 27 // Sets the canvas on which the object will be drawn. | |
| 28 // If |canvas| is nullptr, nothing will happen when calling Draw(). | |
| 29 virtual void SetCanvas(base::WeakPtr<Canvas> canvas) = 0; | |
| 30 | |
| 31 // Draws the object on the canvas. | |
| 32 // Returns true if there is a pending next frame. | |
| 33 virtual bool Draw() = 0; | |
| 34 | |
| 35 // Used for the renderer to keep a stack of drawables. | |
| 36 virtual base::WeakPtr<Drawable> GetWeakPtr() = 0; | |
| 37 | |
| 38 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
| |
| 39 | |
| 40 // Specify the Z Index for this drawable. A higher Z Index will draw after a | |
| 41 // lower z index. Elements with the same Z Index will draw in order inserted. | |
| 42 void SetZIndex(int z_index) { z_index_ = z_index; }; | |
| 43 | |
| 44 private: | |
| 45 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.
| |
| 46 | |
| 47 DISALLOW_COPY_AND_ASSIGN(Drawable); | |
| 48 }; | |
| 49 | |
| 50 } // namespace remoting | |
| 51 | |
| 52 #endif // REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ | |
| OLD | NEW |