| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "services/ui/surfaces/direct_output_surface.h" | 5 #include "services/ui/surfaces/direct_output_surface.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 void DirectOutputSurface::EnsureBackbuffer() {} | 42 void DirectOutputSurface::EnsureBackbuffer() {} |
| 43 | 43 |
| 44 void DirectOutputSurface::DiscardBackbuffer() { | 44 void DirectOutputSurface::DiscardBackbuffer() { |
| 45 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); | 45 context_provider()->ContextGL()->DiscardBackbufferCHROMIUM(); |
| 46 } | 46 } |
| 47 | 47 |
| 48 void DirectOutputSurface::BindFramebuffer() { | 48 void DirectOutputSurface::BindFramebuffer() { |
| 49 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); | 49 context_provider()->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, 0); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void DirectOutputSurface::Reshape(const gfx::Size& size, |
| 53 float device_scale_factor, |
| 54 const gfx::ColorSpace& color_space, |
| 55 bool has_alpha) { |
| 56 context_provider()->ContextGL()->ResizeCHROMIUM( |
| 57 size.width(), size.height(), device_scale_factor, has_alpha); |
| 58 } |
| 59 |
| 52 void DirectOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { | 60 void DirectOutputSurface::SwapBuffers(cc::OutputSurfaceFrame frame) { |
| 53 DCHECK(context_provider_); | 61 DCHECK(context_provider_); |
| 54 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) { | 62 if (frame.sub_buffer_rect == gfx::Rect(frame.size)) { |
| 55 context_provider_->ContextSupport()->Swap(); | 63 context_provider_->ContextSupport()->Swap(); |
| 56 } else { | 64 } else { |
| 57 context_provider_->ContextSupport()->PartialSwapBuffers( | 65 context_provider_->ContextSupport()->PartialSwapBuffers( |
| 58 frame.sub_buffer_rect); | 66 frame.sub_buffer_rect); |
| 59 } | 67 } |
| 60 | 68 |
| 61 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); | 69 gpu::gles2::GLES2Interface* gl = context_provider_->ContextGL(); |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 synthetic_begin_frame_source_->OnUpdateVSyncParameters( | 114 synthetic_begin_frame_source_->OnUpdateVSyncParameters( |
| 107 timebase, | 115 timebase, |
| 108 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); | 116 interval.is_zero() ? cc::BeginFrameArgs::DefaultInterval() : interval); |
| 109 } | 117 } |
| 110 | 118 |
| 111 void DirectOutputSurface::OnSwapBuffersComplete() { | 119 void DirectOutputSurface::OnSwapBuffersComplete() { |
| 112 client_->DidSwapBuffersComplete(); | 120 client_->DidSwapBuffersComplete(); |
| 113 } | 121 } |
| 114 | 122 |
| 115 } // namespace ui | 123 } // namespace ui |
| OLD | NEW |