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

Unified Diff: ui/gl/gl_surface_egl.cc

Issue 1285183008: Ozone integration. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add missing license header Created 5 years, 4 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
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_egl.cc
diff --git a/ui/gl/gl_surface_egl.cc b/ui/gl/gl_surface_egl.cc
index 9e679799ff9b3d8a7d1e676e5b48430b24437720..23e1851cbdaeff40feb7ad6c26fe47b1f7330b2e 100644
--- a/ui/gl/gl_surface_egl.cc
+++ b/ui/gl/gl_surface_egl.cc
@@ -30,7 +30,8 @@ extern "C" {
#endif
#if defined (USE_OZONE)
-#include "ui/ozone/public/surface_factory_ozone.h"
+#include "ui/ozone/public/ozone_platform.h" // nogncheck
+#include "ui/ozone/public/surface_factory_ozone.h" // nogncheck
#endif
#if !defined(EGL_FIXED_SIZE_ANGLE)
@@ -142,7 +143,7 @@ void* GetEGLConfig(const EGLNativeWindowType window,
switches::kEnableUnsafeES3APIs)) {
renderable_type = EGL_OPENGL_ES3_BIT;
}
- EGLint config_attribs[] = {
+ EGLint kConfigAttribs[] = {
EGL_BUFFER_SIZE, configuration.alpha_bits +
configuration.red_bits +
configuration.green_bits +
@@ -161,16 +162,19 @@ void* GetEGLConfig(const EGLNativeWindowType window,
};
#if defined(USE_OZONE)
- config_attribs =
- ui::SurfaceFactoryOzone::GetInstance()->GetEGLSurfaceProperties(
- config_attribs);
+ const EGLint* config_attribs = ui::OzonePlatform::GetInstance()
+ ->GetSurfaceFactoryOzone()
+ ->GetEGLSurfaceProperties(kConfigAttribs);
#elif defined(USE_X11)
+ EGLint* config_attribs = kConfigAttribs;
// Try matching the window depth with an alpha channel,
// because we're worried the destination alpha width could
// constrain blending precision.
const int kBufferSizeOffset = 1;
const int kAlphaSizeOffset = 3;
config_attribs[kBufferSizeOffset] = win_attribs.depth;
+#else
+ const EGLint* config_attribs = kConfigAttribs;
#endif
EGLint num_configs;
@@ -446,7 +450,7 @@ bool NativeViewGLSurfaceEGL::IsOffscreen() {
return false;
}
-bool NativeViewGLSurfaceEGL::SwapBuffers() {
+gfx::SwapResult NativeViewGLSurfaceEGL::SwapBuffers() {
TRACE_EVENT2("gpu", "NativeViewGLSurfaceEGL:RealSwapBuffers",
"width", GetSize().width(),
"height", GetSize().height());
@@ -454,10 +458,10 @@ bool NativeViewGLSurfaceEGL::SwapBuffers() {
if (!eglSwapBuffers(GetDisplay(), surface_)) {
DVLOG(1) << "eglSwapBuffers failed with error "
<< GetLastEGLErrorString();
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
- return true;
+ return gfx::SwapResult::SWAP_ACK;
}
gfx::Size NativeViewGLSurfaceEGL::GetSize() {
@@ -516,15 +520,15 @@ bool NativeViewGLSurfaceEGL::SupportsPostSubBuffer() {
return supports_post_sub_buffer_;
}
-bool NativeViewGLSurfaceEGL::PostSubBuffer(
+gfx::SwapResult NativeViewGLSurfaceEGL::PostSubBuffer(
int x, int y, int width, int height) {
DCHECK(supports_post_sub_buffer_);
if (!eglPostSubBufferNV(GetDisplay(), surface_, x, y, width, height)) {
DVLOG(1) << "eglPostSubBufferNV failed with error "
<< GetLastEGLErrorString();
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
- return true;
+ return gfx::SwapResult::SWAP_ACK;
}
VSyncProvider* NativeViewGLSurfaceEGL::GetVSyncProvider() {
@@ -614,9 +618,9 @@ bool PbufferGLSurfaceEGL::IsOffscreen() {
return true;
}
-bool PbufferGLSurfaceEGL::SwapBuffers() {
+gfx::SwapResult PbufferGLSurfaceEGL::SwapBuffers() {
NOTREACHED() << "Attempted to call SwapBuffers on a PbufferGLSurfaceEGL.";
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
gfx::Size PbufferGLSurfaceEGL::GetSize() {
@@ -702,9 +706,9 @@ bool SurfacelessEGL::IsSurfaceless() const {
return true;
}
-bool SurfacelessEGL::SwapBuffers() {
+gfx::SwapResult SurfacelessEGL::SwapBuffers() {
LOG(ERROR) << "Attempted to call SwapBuffers with SurfacelessEGL.";
- return false;
+ return gfx::SwapResult::SWAP_FAILED;
}
gfx::Size SurfacelessEGL::GetSize() {
« no previous file with comments | « ui/gl/gl_surface_egl.h ('k') | ui/gl/gl_surface_glx.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698