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

Unified Diff: ui/ozone/platform/cast/surface_factory_cast.cc

Issue 1478753003: [Chromecast] Support software rendering when disable-gpu used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use disable-gpu to enable software canvas Created 5 years 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: ui/ozone/platform/cast/surface_factory_cast.cc
diff --git a/ui/ozone/platform/cast/surface_factory_cast.cc b/ui/ozone/platform/cast/surface_factory_cast.cc
index 4d5c57e020ce644111d1fdb0e02fcb51b7c375a1..29ee30a525953441a4610947c9c065d2f2c448eb 100644
--- a/ui/ozone/platform/cast/surface_factory_cast.cc
+++ b/ui/ozone/platform/cast/surface_factory_cast.cc
@@ -10,9 +10,12 @@
#include "base/callback_helpers.h"
#include "chromecast/public/cast_egl_platform.h"
#include "chromecast/public/graphics_types.h"
+#include "third_party/skia/include/core/SkSurface.h"
#include "ui/gfx/geometry/quad_f.h"
+#include "ui/gfx/vsync_provider.h"
#include "ui/ozone/platform/cast/surface_ozone_egl_cast.h"
#include "ui/ozone/public/native_pixmap.h"
+#include "ui/ozone/public/surface_ozone_canvas.h"
using chromecast::CastEglPlatform;
@@ -37,8 +40,39 @@ gfx::Size GetMinDisplaySize() {
return gfx::Size(1280, 720);
}
+class DummySurface : public SurfaceOzoneCanvas {
+ public:
+ DummySurface() {}
+ ~DummySurface() override {}
+
+ // SurfaceOzoneCanvas implementation:
+ skia::RefPtr<SkSurface> GetSurface() override { return surface_; }
+
+ void ResizeCanvas(const gfx::Size& viewport_size) override {
+ surface_ = skia::AdoptRef(SkSurface::NewRaster(SkImageInfo::MakeN32Premul(
+ viewport_size.width(), viewport_size.height())));
+ }
+
+ void PresentCanvas(const gfx::Rect& damage) override {}
+
+ scoped_ptr<gfx::VSyncProvider> CreateVSyncProvider() override {
+ return nullptr;
+ }
+
+ private:
slan 2015/12/08 22:40:25 nit: DISALLOW....
halliwell 2015/12/08 23:27:56 Done.
+ skia::RefPtr<SkSurface> surface_;
+};
+
} // namespace
+SurfaceFactoryCast::SurfaceFactoryCast()
derekjchow1 2015/12/08 22:03:15 Can this call the constructor on line 76 and pass
slan 2015/12/08 22:40:25 +1, now valid in chrome to forward.
halliwell 2015/12/08 23:27:56 Done.
+ : state_(kUninitialized),
+ display_type_(0),
+ have_display_type_(false),
+ window_(0),
+ display_size_(GetInitialDisplaySize()),
+ new_display_size_(GetInitialDisplaySize()) {}
+
SurfaceFactoryCast::SurfaceFactoryCast(scoped_ptr<CastEglPlatform> egl_platform)
: state_(kUninitialized),
display_type_(0),
@@ -97,6 +131,14 @@ void SurfaceFactoryCast::ShutdownHardware() {
state_ = kUninitialized;
}
+scoped_ptr<SurfaceOzoneCanvas> SurfaceFactoryCast::CreateCanvasForWidget(
+ gfx::AcceleratedWidget w) {
+ // Software canvas support only in headless mode
+ if (egl_platform_)
+ return nullptr;
+ return make_scoped_ptr<SurfaceOzoneCanvas>(new DummySurface());
+}
+
intptr_t SurfaceFactoryCast::GetNativeDisplay() {
CreateDisplayTypeAndWindowIfNeeded();
return reinterpret_cast<intptr_t>(display_type_);

Powered by Google App Engine
This is Rietveld 408576698