1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "android_webview/browser/gfx/aw_gl_surface.h" 6 7 #include <utility> 8 9 #include "android_webview/browser/gfx/scoped_app_gl_state_restore.h" 10 11 namespace android_webview { 12 AwGLSurface()13AwGLSurface::AwGLSurface() : size_(1, 1) {} 14 ~AwGLSurface()15AwGLSurface::~AwGLSurface() {} 16 Destroy()17void AwGLSurface::Destroy() { 18 } 19 IsOffscreen()20bool AwGLSurface::IsOffscreen() { 21 return false; 22 } 23 GetBackingFramebufferObject()24unsigned int AwGLSurface::GetBackingFramebufferObject() { 25 return ScopedAppGLStateRestore::Current()->framebuffer_binding_ext(); 26 } 27 SwapBuffers(PresentationCallback callback)28gfx::SwapResult AwGLSurface::SwapBuffers(PresentationCallback callback) { 29 DCHECK(!pending_presentation_callback_); 30 pending_presentation_callback_ = std::move(callback); 31 return gfx::SwapResult::SWAP_ACK; 32 } 33 GetSize()34gfx::Size AwGLSurface::GetSize() { 35 return size_; 36 } 37 GetHandle()38void* AwGLSurface::GetHandle() { 39 return NULL; 40 } 41 GetDisplay()42void* AwGLSurface::GetDisplay() { 43 return NULL; 44 } 45 GetFormat()46gl::GLSurfaceFormat AwGLSurface::GetFormat() { 47 return gl::GLSurfaceFormat(); 48 } 49 Resize(const gfx::Size & size,float scale_factor,const gfx::ColorSpace & color_space,bool has_alpha)50bool AwGLSurface::Resize(const gfx::Size& size, 51 float scale_factor, 52 const gfx::ColorSpace& color_space, 53 bool has_alpha) { 54 size_ = size; 55 return true; 56 } 57 SetSize(const gfx::Size & size)58void AwGLSurface::SetSize(const gfx::Size& size) { 59 size_ = size; 60 } 61 MaybeDidPresent(gfx::PresentationFeedback feedback)62void AwGLSurface::MaybeDidPresent(gfx::PresentationFeedback feedback) { 63 if (!pending_presentation_callback_) 64 return; 65 std::move(pending_presentation_callback_).Run(std::move(feedback)); 66 } 67 68 } // namespace android_webview 69