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

Unified Diff: chromecast/ozone/surface_factory_cast.cc

Issue 1059073002: Loads CastEglPlatform implementation from shared library. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed all Chromium types from shared library interface Created 5 years, 9 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/ozone/surface_factory_cast.cc
diff --git a/chromecast/ozone/surface_factory_cast.cc b/chromecast/ozone/surface_factory_cast.cc
index a7ebe7d0a0d511d311d1401499db0a151df4fc2c..5ee914e24c422b3c1a5d42a95d817680322940e9 100644
--- a/chromecast/ozone/surface_factory_cast.cc
+++ b/chromecast/ozone/surface_factory_cast.cc
@@ -5,18 +5,26 @@
#include "chromecast/ozone/surface_factory_cast.h"
#include "base/callback_helpers.h"
-#include "chromecast/ozone/cast_egl_platform.h"
#include "chromecast/ozone/surface_ozone_egl_cast.h"
+#include "chromecast/public/cast_egl_platform.h"
namespace chromecast {
namespace ozone {
+namespace {
+CastEglPlatform::Size FromGfxSize(const gfx::Size& size) {
+ return CastEglPlatform::Size(size.width(), size.height());
+}
+gfx::Size ToGfxSize(const CastEglPlatform::Size& size) {
+ return gfx::Size(size.width_, size.height_);
+}
+}
SurfaceFactoryCast::SurfaceFactoryCast(scoped_ptr<CastEglPlatform> egl_platform)
: state_(kUninitialized),
destroy_window_pending_state_(kNoDestroyPending),
display_type_(0),
window_(0),
- default_display_size_(egl_platform->GetDefaultDisplaySize()),
+ default_display_size_(ToGfxSize(egl_platform->GetDefaultDisplaySize())),
display_size_(default_display_size_),
new_display_size_(default_display_size_),
egl_platform_(egl_platform.Pass()) {
@@ -63,9 +71,10 @@ void SurfaceFactoryCast::CreateDisplayTypeAndWindowIfNeeded() {
}
DCHECK_EQ(state_, kInitialized);
if (!display_type_) {
- display_type_ = egl_platform_->CreateDisplayType(display_size_);
+ CastEglPlatform::Size create_size = FromGfxSize(display_size_);
+ display_type_ = egl_platform_->CreateDisplayType(create_size);
if (display_type_) {
- window_ = egl_platform_->CreateWindow(display_type_, display_size_);
+ window_ = egl_platform_->CreateWindow(display_type_, create_size);
if (!window_) {
DestroyDisplayTypeAndWindow();
state_ = kFailed;
@@ -168,8 +177,17 @@ bool SurfaceFactoryCast::LoadEGLGLES2Bindings(
}
}
- return egl_platform_->LoadEGLGLES2Bindings(add_gl_library,
- set_gl_get_proc_address);
+ void* lib_egl = egl_platform_->GetEglLibrary();
+ void* lib_gles2 = egl_platform_->GetGles2Library();
+ GLGetProcAddressProc gl_proc = egl_platform_->GetGLProcAddressProc();
+ if (!lib_egl || !lib_gles2 || !gl_proc) {
+ return false;
+ }
+
+ set_gl_get_proc_address.Run(gl_proc);
+ add_gl_library.Run(lib_egl);
+ add_gl_library.Run(lib_gles2);
+ return true;
}
} // namespace ozone

Powered by Google App Engine
This is Rietveld 408576698