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 "content/browser/renderer_host/compositor_impl_android.h" | 5 #include "content/browser/renderer_host/compositor_impl_android.h" |
6 | 6 |
7 #include <android/bitmap.h> | 7 #include <android/bitmap.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, | 87 base::Bind(&OutputSurfaceWithoutParent::OnSwapBuffersCompleted, |
88 base::Unretained(this))) { | 88 base::Unretained(this))) { |
89 capabilities_.adjust_deadline_for_parent = false; | 89 capabilities_.adjust_deadline_for_parent = false; |
90 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; | 90 capabilities_.max_frames_pending = kMaxDisplaySwapBuffers; |
91 } | 91 } |
92 | 92 |
93 ~OutputSurfaceWithoutParent() override { compositor_->RemoveObserver(this); } | 93 ~OutputSurfaceWithoutParent() override { compositor_->RemoveObserver(this); } |
94 | 94 |
95 void SwapBuffers(cc::CompositorFrame* frame) override { | 95 void SwapBuffers(cc::CompositorFrame* frame) override { |
96 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); | 96 GetCommandBufferProxy()->SetLatencyInfo(frame->metadata.latency_info); |
97 DCHECK(frame->gl_frame_data->sub_buffer_rect == | 97 // Partial swap is not supported, so if the |sub_buffer_rect| is non-empty |
98 gfx::Rect(frame->gl_frame_data->size)); | 98 // swap the whole buffer. Otherwise, there is no damage, so don't |
99 context_provider_->ContextSupport()->Swap(); | 99 // swap at all. |
100 client_->DidSwapBuffers(); | 100 if (!frame->gl_frame_data->sub_buffer_rect.IsEmpty()) { |
| 101 context_provider_->ContextSupport()->Swap(); |
| 102 client_->DidSwapBuffers(); |
| 103 } else { |
| 104 client_->DidSwapBuffers(); |
| 105 OutputSurface::OnSwapBuffersComplete(); |
| 106 } |
101 } | 107 } |
102 | 108 |
103 bool BindToClient(cc::OutputSurfaceClient* client) override { | 109 bool BindToClient(cc::OutputSurfaceClient* client) override { |
104 if (!OutputSurface::BindToClient(client)) | 110 if (!OutputSurface::BindToClient(client)) |
105 return false; | 111 return false; |
106 | 112 |
107 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( | 113 GetCommandBufferProxy()->SetSwapBuffersCompletionCallback( |
108 swap_buffers_completion_callback_.callback()); | 114 swap_buffers_completion_callback_.callback()); |
109 | 115 |
110 populate_gpu_capabilities_callback_.Run( | 116 populate_gpu_capabilities_callback_.Run( |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 805 |
800 void CompositorImpl::SetNeedsAnimate() { | 806 void CompositorImpl::SetNeedsAnimate() { |
801 needs_animate_ = true; | 807 needs_animate_ = true; |
802 if (!host_->visible()) | 808 if (!host_->visible()) |
803 return; | 809 return; |
804 | 810 |
805 host_->SetNeedsAnimate(); | 811 host_->SetNeedsAnimate(); |
806 } | 812 } |
807 | 813 |
808 } // namespace content | 814 } // namespace content |
OLD | NEW |