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

Side by Side Diff: chromecast/ui/gfx/gfx_plane.h

Issue 223143003: Initial checkin of chromecast content embedder (cast_shell) and related build scripts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an additional function in gl_surface_cast.cc Created 6 years, 8 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2014 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 CHROMECAST_UI_GFX_GFX_PLANE_H_
6 #define CHROMECAST_UI_GFX_GFX_PLANE_H_
7
8 #include <list>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "chromecast/ui/gfx/surface.h"
12 #include "ui/gfx/rect.h"
13
14 namespace base {
15 class CommandLine;
16 }
17
18 namespace gfx {
19
20 class Point;
21 class Size;
22
23 namespace chromecast {
24
25 class Osd {
26 public:
27 explicit Osd(Surface* surface);
28 ~Osd();
29
30 Surface* surface() const { return surface_.get(); }
31 const Size& size() const { return surface_->size(); }
32
33 private:
34 const scoped_ptr<Surface> surface_;
35
36 DISALLOW_COPY_AND_ASSIGN(Osd);
37 };
38
39 // Abstract GFX plane for graphics and OSD.
40 class GfxPlane {
41 public:
42 // For primary GFX plane.
43 static GfxPlane* CreatePrimary(const base::CommandLine& command_line,
44 const Size& requested_screen_size);
45 static void DestroyPrimary();
46 static GfxPlane* GetPrimary() { return primary_; }
47
48 // For OSD GFX plane.
49 static GfxPlane* CreateOsdPlane();
50 static void DestroyOsdPlane();
51 static GfxPlane* GetOsdPlane();
52 // Resizes the osd plane once screen resolution info becomes available.
53 static void ResizeOsdPlane(const Size& size);
54
55 GfxPlane();
56 virtual ~GfxPlane();
57
58 // Creates a surface on top of this plane.
59 virtual Surface* CreateSurface(const Size& size) = 0;
60
61 // Returns true if this plane is only for OSD.
62 virtual bool IsOsdPlane() const;
63 // Creates an OSD on top of this plane.
64 Osd* CreateOsd(const Size& size);
65 // Adds an OSD to display. The OSD newly added has highest priority.
66 void AddOsd(Osd* osd, const Point& frame_buffer_point);
67 // Removes the first (highest order of) OSD from the list.
68 void RemoveOsd(Osd* osd, const Point& frame_buffer_point);
69
70 // Displays a surface to screen. It blits to the frame buffer. If any osd
71 // surfaces exist, it composites all osd overlapped with given area before
72 // blitting to the frame buffer.
73 void Display(Surface* surface, const Rect& rect,
74 const Point& frame_buffer_point);
75
76 // Refreshes the screen in given area. If OSD's are changed, it must be called
77 // to refresh the screen.
78 virtual void Refresh(const Rect& frame_buffer_rect);
79
80 // Returns the screen size of this plane.
81 virtual const Size size() const;
82
83 int& num_surfaces() { return num_surfaces_; }
84
85 Surface* frame_buffer() const { return frame_buffer_.get(); }
86 void set_frame_buffer(Surface* surface) { frame_buffer_.reset(surface); }
87
88 // Returns true if we allow 1080p graphics
89 static bool Is1080pAllowed();
90
91 protected:
92 struct OsdAndRect {
93 Osd* osd;
94 Rect rect; // Overlaid area in frame buffer.
95 };
96
97 // Called when a surface on this gfx plane is removed.
98 virtual void OnRemoved(Surface* surface);
99
100 std::list<OsdAndRect> osd_and_rects_;
101
102 private:
103 friend class Surface; // For OnRemoved().
104
105 static GfxPlane* primary_;
106
107 int num_surfaces_;
108 scoped_ptr<Surface> frame_buffer_;
109
110 Surface* current_surface_; // Non-OSD surface which called Display() last.
111 };
112
113 } // namespace chromecast
114 } // namespace gfx
115
116 #endif // CHROMECAST_UI_GFX_GFX_PLANE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698