| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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/renderer/android/synchronous_compositor_output_surface.h" | 5 #include "content/renderer/android/synchronous_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "cc/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
| 10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 } | 126 } |
| 127 | 127 |
| 128 void SynchronousCompositorOutputSurface::Invalidate() { | 128 void SynchronousCompositorOutputSurface::Invalidate() { |
| 129 DCHECK(CalledOnValidThread()); | 129 DCHECK(CalledOnValidThread()); |
| 130 if (sync_client_) | 130 if (sync_client_) |
| 131 sync_client_->Invalidate(); | 131 sync_client_->Invalidate(); |
| 132 } | 132 } |
| 133 | 133 |
| 134 scoped_ptr<cc::CompositorFrame> | 134 scoped_ptr<cc::CompositorFrame> |
| 135 SynchronousCompositorOutputSurface::DemandDrawHw( | 135 SynchronousCompositorOutputSurface::DemandDrawHw( |
| 136 gfx::Size surface_size, | 136 const gfx::Size& surface_size, |
| 137 const gfx::Transform& transform, | 137 const gfx::Transform& transform, |
| 138 gfx::Rect viewport, | 138 const gfx::Rect& viewport, |
| 139 gfx::Rect clip, | 139 const gfx::Rect& clip, |
| 140 gfx::Rect viewport_rect_for_tile_priority, | 140 const gfx::Rect& viewport_rect_for_tile_priority, |
| 141 const gfx::Transform& transform_for_tile_priority) { | 141 const gfx::Transform& transform_for_tile_priority) { |
| 142 DCHECK(CalledOnValidThread()); | 142 DCHECK(CalledOnValidThread()); |
| 143 DCHECK(HasClient()); | 143 DCHECK(HasClient()); |
| 144 DCHECK(context_provider_.get()); | 144 DCHECK(context_provider_.get()); |
| 145 | 145 |
| 146 surface_size_ = surface_size; | 146 surface_size_ = surface_size; |
| 147 InvokeComposite(transform, viewport, clip, viewport_rect_for_tile_priority, | 147 InvokeComposite(transform, viewport, clip, viewport_rect_for_tile_priority, |
| 148 transform_for_tile_priority, true); | 148 transform_for_tile_priority, true); |
| 149 | 149 |
| 150 return frame_holder_.Pass(); | 150 return frame_holder_.Pass(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 176 clip, | 176 clip, |
| 177 cached_hw_viewport_rect_for_tile_priority_, | 177 cached_hw_viewport_rect_for_tile_priority_, |
| 178 cached_hw_transform_for_tile_priority_, | 178 cached_hw_transform_for_tile_priority_, |
| 179 false); | 179 false); |
| 180 | 180 |
| 181 return frame_holder_.Pass(); | 181 return frame_holder_.Pass(); |
| 182 } | 182 } |
| 183 | 183 |
| 184 void SynchronousCompositorOutputSurface::InvokeComposite( | 184 void SynchronousCompositorOutputSurface::InvokeComposite( |
| 185 const gfx::Transform& transform, | 185 const gfx::Transform& transform, |
| 186 gfx::Rect viewport, | 186 const gfx::Rect& viewport, |
| 187 gfx::Rect clip, | 187 const gfx::Rect& clip, |
| 188 gfx::Rect viewport_rect_for_tile_priority, | 188 const gfx::Rect& viewport_rect_for_tile_priority, |
| 189 gfx::Transform transform_for_tile_priority, | 189 const gfx::Transform& transform_for_tile_priority, |
| 190 bool hardware_draw) { | 190 bool hardware_draw) { |
| 191 DCHECK(!frame_holder_.get()); | 191 DCHECK(!frame_holder_.get()); |
| 192 | 192 |
| 193 gfx::Transform adjusted_transform = transform; | 193 gfx::Transform adjusted_transform = transform; |
| 194 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); | 194 adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); |
| 195 SetExternalDrawConstraints(adjusted_transform, viewport, clip, | 195 SetExternalDrawConstraints(adjusted_transform, viewport, clip, |
| 196 viewport_rect_for_tile_priority, | 196 viewport_rect_for_tile_priority, |
| 197 transform_for_tile_priority, !hardware_draw); | 197 transform_for_tile_priority, !hardware_draw); |
| 198 if (!hardware_draw || next_hardware_draw_needs_damage_) { | 198 if (!hardware_draw || next_hardware_draw_needs_damage_) { |
| 199 next_hardware_draw_needs_damage_ = false; | 199 next_hardware_draw_needs_damage_ = false; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = | 269 scoped_ptr<FrameSwapMessageQueue::SendMessageScope> send_message_scope = |
| 270 frame_swap_message_queue_->AcquireSendMessageScope(); | 270 frame_swap_message_queue_->AcquireSendMessageScope(); |
| 271 frame_swap_message_queue_->DrainMessages(messages); | 271 frame_swap_message_queue_->DrainMessages(messages); |
| 272 } | 272 } |
| 273 | 273 |
| 274 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 274 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 275 return thread_checker_.CalledOnValidThread(); | 275 return thread_checker_.CalledOnValidThread(); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace content | 278 } // namespace content |
| OLD | NEW |