OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROMECAST_PUBLIC_OSD_PLANE_H_ | 5 #ifndef CHROMECAST_PUBLIC_OSD_PLANE_H_ |
6 #define CHROMECAST_PUBLIC_OSD_PLANE_H_ | 6 #define CHROMECAST_PUBLIC_OSD_PLANE_H_ |
7 | 7 |
8 namespace chromecast { | 8 namespace chromecast { |
9 | 9 |
10 class OsdSurface; | 10 class OsdSurface; |
11 struct Rect; | 11 struct Rect; |
12 struct Size; | 12 struct Size; |
13 | 13 |
14 // Abstract graphics plane for OSD, to be implemented in platform-specific way. | 14 // Abstract graphics plane for OSD, to be implemented in platform-specific way. |
15 // Platform must composite this plane on top of main (GL-based) graphics plane. | 15 // Platform must composite this plane on top of main (GL-based) graphics plane. |
16 class OsdPlane { | 16 class OsdPlane { |
17 public: | 17 public: |
18 virtual ~OsdPlane() {} | 18 virtual ~OsdPlane() {} |
19 | 19 |
20 // Creates a surface for offscreen drawing. | 20 // Creates a surface for offscreen drawing. |
21 virtual OsdSurface* CreateSurface(const Size& size) = 0; | 21 virtual OsdSurface* CreateSurface(const Size& size) = 0; |
22 | 22 |
23 // Sets a clip rectangle, client should call before drawing to back buffer | 23 // Sets a clip rectangle, client should call before drawing to back buffer |
24 // to specify the area they intend to draw on. Platforms may reduce memory | 24 // to specify the area they intend to draw on. Platforms may reduce memory |
25 // usage by only allocating back buffer to cover this area. Areas outside | 25 // usage by only allocating back buffer to cover this area. Areas outside |
26 // clip rectangle must display as fully transparent. In particular, setting | 26 // clip rectangle must display as fully transparent. In particular, setting |
27 // an empty clip rectangle and calling Flip should clear the plane. | 27 // an empty clip rectangle and calling Flip should clear the plane. |
28 virtual void SetClipRectangle(const Rect& rect) = 0; | 28 // |osd_res| gives the resolution of the full OSD plane, i.e. |rect| is |
| 29 // a subrectangle of this area. |output_scale| specifies the current scaling |
| 30 // from |osd_res| to output screen resolution. |
| 31 virtual void SetClipRectangle(const Rect& rect, |
| 32 const Size& osd_res, |
| 33 float output_scale) = 0; |
29 | 34 |
30 // Gets the current back buffer surface. Valid until next call to Flip or | 35 // Gets the current back buffer surface. Valid until next call to Flip or |
31 // SetClipRectangle. | 36 // SetClipRectangle. |
32 virtual OsdSurface* GetBackBuffer() = 0; | 37 virtual OsdSurface* GetBackBuffer() = 0; |
33 | 38 |
34 // Presents current back buffer to screen. | 39 // Presents current back buffer to screen. |
35 virtual void Flip() = 0; | 40 virtual void Flip() = 0; |
36 }; | 41 }; |
37 | 42 |
38 } // namespace chromecast | 43 } // namespace chromecast |
39 | 44 |
40 #endif // CHROMECAST_PUBLIC_OSD_PLANE_H | 45 #endif // CHROMECAST_PUBLIC_OSD_PLANE_H |
OLD | NEW |