Add NetLog to CastBrowserProcess.
[chromium-blink-merge.git] / chromecast / graphics / osd_plane_default.cc
blob2c73edc531a7686004b100d212c44f5ebd1aad4a
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 {
12 namespace {
14 // Default no-op OsdSurface implementation
15 class OsdSurfaceDefault : public OsdSurface {
16 public:
17 OsdSurfaceDefault(const Size& size) : size_(size) {}
19 // OsdSurface implementation:
20 void Blit(OsdSurface* src_surface,
21 const Rect& src_rect,
22 const Point& dst_point) override {}
23 void Composite(OsdSurface* src_surface,
24 const Rect& src_rect,
25 const Point& dst_point) override {}
26 void CopyBitmap(char* src_bitmap,
27 const Rect& src_rect,
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_; }
34 private:
35 const Size size_;
37 DISALLOW_COPY_AND_ASSIGN(OsdSurfaceDefault);
40 // Default no-op OsdPlane implementation
41 class OsdPlaneDefault : public OsdPlane {
42 public:
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 {
53 if (!back_buffer_)
54 back_buffer_.reset(new OsdSurfaceDefault(size_));
55 return back_buffer_.get();
58 void Flip() override {}
60 private:
61 scoped_ptr<OsdSurface> back_buffer_;
62 Size size_;
64 DISALLOW_COPY_AND_ASSIGN(OsdPlaneDefault);
67 } // namespace
69 OsdPlane* OsdPlaneShlib::Create(const std::vector<std::string>& argv) {
70 return new OsdPlaneDefault;
73 } // namespace chromecast