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

Unified Diff: chromecast/graphics/osd_plane_default.cc

Issue 1104853002: Adds public API and loads Cast OSD plane implementation from shared lib (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: chromecast/graphics/osd_plane_default.cc
diff --git a/chromecast/graphics/osd_plane_default.cc b/chromecast/graphics/osd_plane_default.cc
new file mode 100644
index 0000000000000000000000000000000000000000..ca13d137a0b1158a05c1d5e4f2979b556ebf9762
--- /dev/null
+++ b/chromecast/graphics/osd_plane_default.cc
@@ -0,0 +1,69 @@
+// Copyright 2015 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.
+
+#include "base/memory/scoped_ptr.h"
+#include "chromecast/public/osd_plane.h"
+#include "chromecast/public/osd_plane_shlib.h"
+#include "chromecast/public/osd_surface.h"
+#include "chromecast/public/rect.h"
+#include "chromecast/public/size.h"
+
+namespace chromecast {
+namespace {
+
+// Default no-op OsdSurface implementation
+class OsdSurfaceDefault : public OsdSurface {
+ public:
+ OsdSurfaceDefault(const Size& size) : size_(size) {}
+
+ void Blit(OsdSurface* src_surface,
byungchul 2015/04/27 16:55:03 // OsdSurface implementation:
halliwell 2015/04/27 21:30:42 Done.
+ const Rect& src_rect,
+ const Point& dst_point) override {}
+ void Composite(OsdSurface* src_surface,
+ const Rect& src_rect,
+ const Point& dst_point) override {}
+ void CopyBitmap(char* src_bitmap,
+ const Rect& src_rect,
+ const Rect& damage_rect,
+ const Point& dst_point) override {}
+ void Fill(const Rect& rect, int argb) override {}
+
+ const Size& size() const override { return size_; }
+
+ private:
+ Size size_;
gunsch 2015/04/27 16:40:27 nit: DISALLOW_COPY_AND_ASSIGN
halliwell 2015/04/27 21:30:42 Done.
+};
+
+// Default no-op OsdPlane implementation
+class OsdPlaneDefault : public OsdPlane {
+ public:
+ OsdPlaneDefault() : size_(0, 0) {}
+
+ OsdSurface* CreateSurface(const Size& size) override {
byungchul 2015/04/27 16:55:03 // OsdPlane implementation:
halliwell 2015/04/27 21:30:42 Done.
+ return new OsdSurfaceDefault(size);
+ }
+ void SetClipRectangle(const Rect& rect) override {
+ size_ = Size(rect.width, rect.height);
+ }
+ OsdSurface* GetBackBuffer() override {
+ if (!back_buffer_) {
+ back_buffer_.reset(new OsdSurfaceDefault(size_));
+ }
byungchul 2015/04/27 16:55:03 remove {}
halliwell 2015/04/27 21:30:42 Done.
+ return back_buffer_.get();
+ }
+
+ void Flip() override {}
+
+ private:
+ scoped_ptr<OsdSurface> back_buffer_;
+ Size size_;
byungchul 2015/04/27 16:55:03 DISALLOW_...
halliwell 2015/04/27 21:30:41 Done.
+};
+
+} // namespace
+
+OsdPlane* OsdPlaneShlib::Create(const std::vector<std::string>& argv) {
+ return new OsdPlaneDefault;
+}
+
+} // namespace chromecast

Powered by Google App Engine
This is Rietveld 408576698