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..640c9d7d0fe71d4c200f22703fa85df5a34a5036 |
| --- /dev/null |
| +++ b/remoting/client/display/drawable.h |
| @@ -0,0 +1,50 @@ |
| +// 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; |
| + |
| +// Interface for drawing on a Canvas from a renderer. |
| +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(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; |
| + |
| + // ZIndexDefault is a recommendation for Z Index of drawable components. |
| + enum ZIndexDefault { |
|
Sergey Ulanov
2017/01/11 22:47:31
I'm not sure we need 'Default' part of the name -
nicholss
2017/01/11 23:43:25
Done.
|
| + DESKTOP = 100, |
| + CURSOR_FEEDBACK = 200, |
| + CURSOR = 300, |
| + }; |
| + |
| + // A higher Z Index shiould be draw ontop of a lower z index. Elements with |
| + // the |
|
Sergey Ulanov
2017/01/11 22:47:31
nit: comment formatting
nicholss
2017/01/11 23:43:25
some magic from git cl format.
|
| + // same Z Index should draw in order inserted into the renderer. |
| + virtual int ZIndex() = 0; |
|
Sergey Ulanov
2017/01/11 22:47:31
GetZIndex()
nicholss
2017/01/11 23:43:25
Done.
|
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(Drawable); |
| +}; |
| + |
| +} // namespace remoting |
| + |
| +#endif // REMOTING_CLIENT_DISPLAY_DRAWABLE_H_ |