| Index: chromecast/ui/gfx/gfx_plane.h
|
| diff --git a/chromecast/ui/gfx/gfx_plane.h b/chromecast/ui/gfx/gfx_plane.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..7d52cde3aa493a62796b5bfe26c7873c27fa4eb1
|
| --- /dev/null
|
| +++ b/chromecast/ui/gfx/gfx_plane.h
|
| @@ -0,0 +1,116 @@
|
| +// Copyright (c) 2014 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 CHROMECAST_UI_GFX_GFX_PLANE_H_
|
| +#define CHROMECAST_UI_GFX_GFX_PLANE_H_
|
| +
|
| +#include <list>
|
| +
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "chromecast/ui/gfx/surface.h"
|
| +#include "ui/gfx/rect.h"
|
| +
|
| +namespace base {
|
| +class CommandLine;
|
| +}
|
| +
|
| +namespace gfx {
|
| +
|
| +class Point;
|
| +class Size;
|
| +
|
| +namespace chromecast {
|
| +
|
| +class Osd {
|
| + public:
|
| + explicit Osd(Surface* surface);
|
| + ~Osd();
|
| +
|
| + Surface* surface() const { return surface_.get(); }
|
| + const Size& size() const { return surface_->size(); }
|
| +
|
| + private:
|
| + const scoped_ptr<Surface> surface_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(Osd);
|
| +};
|
| +
|
| +// Abstract GFX plane for graphics and OSD.
|
| +class GfxPlane {
|
| + public:
|
| + // For primary GFX plane.
|
| + static GfxPlane* CreatePrimary(const base::CommandLine& command_line,
|
| + const Size& requested_screen_size);
|
| + static void DestroyPrimary();
|
| + static GfxPlane* GetPrimary() { return primary_; }
|
| +
|
| + // For OSD GFX plane.
|
| + static GfxPlane* CreateOsdPlane();
|
| + static void DestroyOsdPlane();
|
| + static GfxPlane* GetOsdPlane();
|
| + // Resizes the osd plane once screen resolution info becomes available.
|
| + static void ResizeOsdPlane(const Size& size);
|
| +
|
| + GfxPlane();
|
| + virtual ~GfxPlane();
|
| +
|
| + // Creates a surface on top of this plane.
|
| + virtual Surface* CreateSurface(const Size& size) = 0;
|
| +
|
| + // Returns true if this plane is only for OSD.
|
| + virtual bool IsOsdPlane() const;
|
| + // Creates an OSD on top of this plane.
|
| + Osd* CreateOsd(const Size& size);
|
| + // Adds an OSD to display. The OSD newly added has highest priority.
|
| + void AddOsd(Osd* osd, const Point& frame_buffer_point);
|
| + // Removes the first (highest order of) OSD from the list.
|
| + void RemoveOsd(Osd* osd, const Point& frame_buffer_point);
|
| +
|
| + // Displays a surface to screen. It blits to the frame buffer. If any osd
|
| + // surfaces exist, it composites all osd overlapped with given area before
|
| + // blitting to the frame buffer.
|
| + void Display(Surface* surface, const Rect& rect,
|
| + const Point& frame_buffer_point);
|
| +
|
| + // Refreshes the screen in given area. If OSD's are changed, it must be called
|
| + // to refresh the screen.
|
| + virtual void Refresh(const Rect& frame_buffer_rect);
|
| +
|
| + // Returns the screen size of this plane.
|
| + virtual const Size size() const;
|
| +
|
| + int& num_surfaces() { return num_surfaces_; }
|
| +
|
| + Surface* frame_buffer() const { return frame_buffer_.get(); }
|
| + void set_frame_buffer(Surface* surface) { frame_buffer_.reset(surface); }
|
| +
|
| + // Returns true if we allow 1080p graphics
|
| + static bool Is1080pAllowed();
|
| +
|
| + protected:
|
| + struct OsdAndRect {
|
| + Osd* osd;
|
| + Rect rect; // Overlaid area in frame buffer.
|
| + };
|
| +
|
| + // Called when a surface on this gfx plane is removed.
|
| + virtual void OnRemoved(Surface* surface);
|
| +
|
| + std::list<OsdAndRect> osd_and_rects_;
|
| +
|
| + private:
|
| + friend class Surface; // For OnRemoved().
|
| +
|
| + static GfxPlane* primary_;
|
| +
|
| + int num_surfaces_;
|
| + scoped_ptr<Surface> frame_buffer_;
|
| +
|
| + Surface* current_surface_; // Non-OSD surface which called Display() last.
|
| +};
|
| +
|
| +} // namespace chromecast
|
| +} // namespace gfx
|
| +
|
| +#endif // CHROMECAST_UI_GFX_GFX_PLANE_H_
|
|
|