Chromium Code Reviews| Index: ui/ozone/platform/cast/gl_surface_cast.cc |
| diff --git a/ui/ozone/platform/cast/gl_surface_cast.cc b/ui/ozone/platform/cast/gl_surface_cast.cc |
| index 05b337735b2cbfb15b99be6de4c3dd36fd59ae2a..9515ee5108e103763d8c1886f011a6388eb0177c 100644 |
| --- a/ui/ozone/platform/cast/gl_surface_cast.cc |
| +++ b/ui/ozone/platform/cast/gl_surface_cast.cc |
| @@ -13,10 +13,17 @@ GLSurfaceCast::GLSurfaceCast(gfx::AcceleratedWidget widget, |
| SurfaceFactoryCast* parent) |
| : NativeViewGLSurfaceEGL(parent->GetNativeWindow()), |
| widget_(widget), |
| - parent_(parent) { |
| + parent_(parent), |
| + supports_swap_buffer_with_bounds_( |
| + base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + switches::kEnableSwapBuffersWithBounds)) { |
| DCHECK(parent_); |
| } |
| +bool GLSurfaceCast::SupportsSwapBuffersWithBounds() { |
| + return supports_swap_buffer_with_bounds_; |
| +} |
| + |
| gfx::SwapResult GLSurfaceCast::SwapBuffers() { |
| gfx::SwapResult result = NativeViewGLSurfaceEGL::SwapBuffers(); |
| if (result == gfx::SwapResult::SWAP_ACK) |
| @@ -25,15 +32,23 @@ gfx::SwapResult GLSurfaceCast::SwapBuffers() { |
| return result; |
| } |
| -gfx::SwapResult GLSurfaceCast::SwapBuffersWithDamage(int x, |
| - int y, |
| - int width, |
| - int height) { |
| +gfx::SwapResult GLSurfaceCast::SwapBuffersWithBounds( |
| + const std::vector<gfx::Rect>& rects) { |
| + DCHECK(supports_swap_buffer_with_bounds_); |
| + |
| + // TODO(halliwell): request new EGL extension so we're not abusing |
|
meacer
2017/02/02 21:42:33
nit: request -> Request
halliwell
2017/02/03 20:17:00
Done.
|
| + // SwapBuffersWithDamage here. |
| + std::vector<int> rects_data(rects.size() * 4); |
| + for (size_t i = 0; i != rects.size(); ++i) { |
| + rects_data[i * 4 + 0] = rects[i].x(); |
| + rects_data[i * 4 + 1] = rects[i].y(); |
| + rects_data[i * 4 + 2] = rects[i].width(); |
| + rects_data[i * 4 + 3] = rects[i].height(); |
| + } |
| gfx::SwapResult result = |
| - NativeViewGLSurfaceEGL::SwapBuffersWithDamage(x, y, width, height); |
| + NativeViewGLSurfaceEGL::SwapBuffersWithDamage(rects_data); |
| if (result == gfx::SwapResult::SWAP_ACK) |
| parent_->OnSwapBuffers(); |
| - |
| return result; |
| } |