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/browser/android/in_process/synchronous_compositor_output_surfa
ce.h" | 5 #include "content/browser/android/in_process/synchronous_compositor_output_surfa
ce.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/begin_frame_args.h" | 9 #include "cc/output/begin_frame_args.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { | 143 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { |
144 // CC's draw origin starts at the viewport. | 144 // CC's draw origin starts at the viewport. |
145 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); | 145 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); |
146 } | 146 } |
147 } // namespace | 147 } // namespace |
148 | 148 |
149 bool SynchronousCompositorOutputSurface::InitializeHwDraw( | 149 bool SynchronousCompositorOutputSurface::InitializeHwDraw( |
150 scoped_refptr<cc::ContextProvider> onscreen_context_provider) { | 150 scoped_refptr<cc::ContextProvider> onscreen_context_provider) { |
151 DCHECK(CalledOnValidThread()); | 151 DCHECK(CalledOnValidThread()); |
152 DCHECK(HasClient()); | 152 DCHECK(HasClient()); |
153 DCHECK(!context_provider_); | 153 DCHECK(!context_provider_.get()); |
154 | 154 |
155 return InitializeAndSetContext3d(onscreen_context_provider); | 155 return InitializeAndSetContext3d(onscreen_context_provider); |
156 } | 156 } |
157 | 157 |
158 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { | 158 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { |
159 DCHECK(CalledOnValidThread()); | 159 DCHECK(CalledOnValidThread()); |
160 cc::OutputSurface::ReleaseGL(); | 160 cc::OutputSurface::ReleaseGL(); |
161 } | 161 } |
162 | 162 |
163 scoped_ptr<cc::CompositorFrame> | 163 scoped_ptr<cc::CompositorFrame> |
164 SynchronousCompositorOutputSurface::DemandDrawHw( | 164 SynchronousCompositorOutputSurface::DemandDrawHw( |
165 gfx::Size surface_size, | 165 gfx::Size surface_size, |
166 const gfx::Transform& transform, | 166 const gfx::Transform& transform, |
167 gfx::Rect viewport, | 167 gfx::Rect viewport, |
168 gfx::Rect clip, | 168 gfx::Rect clip, |
169 gfx::Rect viewport_rect_for_tile_priority, | 169 gfx::Rect viewport_rect_for_tile_priority, |
170 const gfx::Transform& transform_for_tile_priority) { | 170 const gfx::Transform& transform_for_tile_priority) { |
171 DCHECK(CalledOnValidThread()); | 171 DCHECK(CalledOnValidThread()); |
172 DCHECK(HasClient()); | 172 DCHECK(HasClient()); |
173 DCHECK(context_provider_); | 173 DCHECK(context_provider_.get()); |
174 | 174 |
175 surface_size_ = surface_size; | 175 surface_size_ = surface_size; |
176 InvokeComposite(transform, | 176 InvokeComposite(transform, |
177 viewport, | 177 viewport, |
178 clip, | 178 clip, |
179 viewport_rect_for_tile_priority, | 179 viewport_rect_for_tile_priority, |
180 transform_for_tile_priority, | 180 transform_for_tile_priority, |
181 true); | 181 true); |
182 | 182 |
183 return frame_holder_.Pass(); | 183 return frame_holder_.Pass(); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 292 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
293 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 293 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
294 } | 294 } |
295 | 295 |
296 SynchronousCompositorOutputSurfaceDelegate* | 296 SynchronousCompositorOutputSurfaceDelegate* |
297 SynchronousCompositorOutputSurface::GetDelegate() { | 297 SynchronousCompositorOutputSurface::GetDelegate() { |
298 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 298 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
299 } | 299 } |
300 | 300 |
301 } // namespace content | 301 } // namespace content |
OLD | NEW |