1 // Copyright 2015 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.
5 #include "base/memory/scoped_ptr.h"
6 #include "chromecast/public/graphics_types.h"
7 #include "chromecast/public/osd_plane.h"
8 #include "chromecast/public/osd_plane_shlib.h"
9 #include "chromecast/public/osd_surface.h"
11 namespace chromecast
{
14 // Default no-op OsdSurface implementation
15 class OsdSurfaceDefault
: public OsdSurface
{
17 OsdSurfaceDefault(const Size
& size
) : size_(size
) {}
19 // OsdSurface implementation:
20 void Blit(OsdSurface
* src_surface
,
22 const Point
& dst_point
) override
{}
23 void Composite(OsdSurface
* src_surface
,
25 const Point
& dst_point
) override
{}
26 void CopyBitmap(char* src_bitmap
,
28 const Rect
& damage_rect
,
29 const Point
& dst_point
) override
{}
30 void Fill(const Rect
& rect
, int argb
) override
{}
32 const Size
& size() const override
{ return size_
; }
37 DISALLOW_COPY_AND_ASSIGN(OsdSurfaceDefault
);
40 // Default no-op OsdPlane implementation
41 class OsdPlaneDefault
: public OsdPlane
{
43 OsdPlaneDefault() : size_(0, 0) {}
45 // OsdPlane implementation:
46 OsdSurface
* CreateSurface(const Size
& size
) override
{
47 return new OsdSurfaceDefault(size
);
49 void SetClipRectangle(const Rect
& rect
) override
{
50 size_
= Size(rect
.width
, rect
.height
);
52 OsdSurface
* GetBackBuffer() override
{
54 back_buffer_
.reset(new OsdSurfaceDefault(size_
));
55 return back_buffer_
.get();
58 void Flip() override
{}
61 scoped_ptr
<OsdSurface
> back_buffer_
;
64 DISALLOW_COPY_AND_ASSIGN(OsdPlaneDefault
);
69 OsdPlane
* OsdPlaneShlib::Create(const std::vector
<std::string
>& argv
) {
70 return new OsdPlaneDefault
;
73 } // namespace chromecast