OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/gl/gl_surface.h" | 5 #include "ui/gl/gl_surface.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 bool GLSurface::SupportsPostSubBuffer() { | 190 bool GLSurface::SupportsPostSubBuffer() { |
191 return false; | 191 return false; |
192 } | 192 } |
193 | 193 |
194 unsigned int GLSurface::GetBackingFrameBufferObject() { | 194 unsigned int GLSurface::GetBackingFrameBufferObject() { |
195 return 0; | 195 return 0; |
196 } | 196 } |
197 | 197 |
198 bool GLSurface::SwapBuffersAsync(const SwapCompletionCallback& callback) { | 198 bool GLSurface::SwapBuffersAsync(const SwapCompletionCallback& callback) { |
199 DCHECK(!IsSurfaceless()); | 199 DCHECK(!IsSurfaceless()); |
200 bool success = SwapBuffers(); | 200 gfx::SwapResult result = SwapBuffers(); |
201 callback.Run(); | 201 callback.Run(result); |
202 return success; | 202 return result == gfx::SwapResult::SWAP_ACK; |
203 } | 203 } |
204 | 204 |
205 bool GLSurface::PostSubBuffer(int x, int y, int width, int height) { | 205 gfx::SwapResult GLSurface::PostSubBuffer(int x, int y, int width, int height) { |
206 return false; | 206 return gfx::SwapResult::SWAP_FAILED; |
207 } | 207 } |
208 | 208 |
209 bool GLSurface::PostSubBufferAsync(int x, | 209 bool GLSurface::PostSubBufferAsync(int x, |
210 int y, | 210 int y, |
211 int width, | 211 int width, |
212 int height, | 212 int height, |
213 const SwapCompletionCallback& callback) { | 213 const SwapCompletionCallback& callback) { |
214 bool success = PostSubBuffer(x, y, width, height); | 214 gfx::SwapResult result = PostSubBuffer(x, y, width, height); |
215 callback.Run(); | 215 callback.Run(result); |
216 return success; | 216 return result == gfx::SwapResult::SWAP_ACK; |
217 } | 217 } |
218 | 218 |
219 bool GLSurface::OnMakeCurrent(GLContext* context) { | 219 bool GLSurface::OnMakeCurrent(GLContext* context) { |
220 return true; | 220 return true; |
221 } | 221 } |
222 | 222 |
223 void GLSurface::NotifyWasBound() { | 223 void GLSurface::NotifyWasBound() { |
224 } | 224 } |
225 | 225 |
226 bool GLSurface::SetBackbufferAllocation(bool allocated) { | 226 bool GLSurface::SetBackbufferAllocation(bool allocated) { |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 } | 317 } |
318 | 318 |
319 bool GLSurfaceAdapter::DeferDraws() { | 319 bool GLSurfaceAdapter::DeferDraws() { |
320 return surface_->DeferDraws(); | 320 return surface_->DeferDraws(); |
321 } | 321 } |
322 | 322 |
323 bool GLSurfaceAdapter::IsOffscreen() { | 323 bool GLSurfaceAdapter::IsOffscreen() { |
324 return surface_->IsOffscreen(); | 324 return surface_->IsOffscreen(); |
325 } | 325 } |
326 | 326 |
327 bool GLSurfaceAdapter::SwapBuffers() { | 327 gfx::SwapResult GLSurfaceAdapter::SwapBuffers() { |
328 return surface_->SwapBuffers(); | 328 return surface_->SwapBuffers(); |
329 } | 329 } |
330 | 330 |
331 bool GLSurfaceAdapter::SwapBuffersAsync( | 331 bool GLSurfaceAdapter::SwapBuffersAsync( |
332 const SwapCompletionCallback& callback) { | 332 const SwapCompletionCallback& callback) { |
333 return surface_->SwapBuffersAsync(callback); | 333 return surface_->SwapBuffersAsync(callback); |
334 } | 334 } |
335 | 335 |
336 bool GLSurfaceAdapter::PostSubBuffer(int x, int y, int width, int height) { | 336 gfx::SwapResult GLSurfaceAdapter::PostSubBuffer( |
| 337 int x, int y, int width, int height) { |
337 return surface_->PostSubBuffer(x, y, width, height); | 338 return surface_->PostSubBuffer(x, y, width, height); |
338 } | 339 } |
339 | 340 |
340 bool GLSurfaceAdapter::PostSubBufferAsync( | 341 bool GLSurfaceAdapter::PostSubBufferAsync( |
341 int x, int y, int width, int height, | 342 int x, int y, int width, int height, |
342 const SwapCompletionCallback& callback) { | 343 const SwapCompletionCallback& callback) { |
343 return surface_->PostSubBufferAsync(x, y, width, height, callback); | 344 return surface_->PostSubBufferAsync(x, y, width, height, callback); |
344 } | 345 } |
345 | 346 |
346 bool GLSurfaceAdapter::SupportsPostSubBuffer() { | 347 bool GLSurfaceAdapter::SupportsPostSubBuffer() { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 z_order, transform, image, bounds_rect, crop_rect); | 401 z_order, transform, image, bounds_rect, crop_rect); |
401 } | 402 } |
402 | 403 |
403 bool GLSurfaceAdapter::IsSurfaceless() const { | 404 bool GLSurfaceAdapter::IsSurfaceless() const { |
404 return surface_->IsSurfaceless(); | 405 return surface_->IsSurfaceless(); |
405 } | 406 } |
406 | 407 |
407 GLSurfaceAdapter::~GLSurfaceAdapter() {} | 408 GLSurfaceAdapter::~GLSurfaceAdapter() {} |
408 | 409 |
409 } // namespace gfx | 410 } // namespace gfx |
OLD | NEW |