| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 } | 163 } |
| 164 | 164 |
| 165 namespace { | 165 namespace { |
| 166 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { | 166 void AdjustTransform(gfx::Transform* transform, gfx::Rect viewport) { |
| 167 // CC's draw origin starts at the viewport. | 167 // CC's draw origin starts at the viewport. |
| 168 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); | 168 transform->matrix().postTranslate(-viewport.x(), -viewport.y(), 0); |
| 169 } | 169 } |
| 170 } // namespace | 170 } // namespace |
| 171 | 171 |
| 172 bool SynchronousCompositorOutputSurface::InitializeHwDraw( | 172 bool SynchronousCompositorOutputSurface::InitializeHwDraw( |
| 173 scoped_refptr<cc::ContextProvider> onscreen_context_provider, | 173 scoped_refptr<cc::ContextProvider> onscreen_context_provider) { |
| 174 scoped_refptr<cc::ContextProvider> offscreen_context_provider) { | |
| 175 DCHECK(CalledOnValidThread()); | 174 DCHECK(CalledOnValidThread()); |
| 176 DCHECK(HasClient()); | 175 DCHECK(HasClient()); |
| 177 DCHECK(!context_provider_); | 176 DCHECK(!context_provider_); |
| 178 | 177 |
| 179 return InitializeAndSetContext3d(onscreen_context_provider, | 178 return InitializeAndSetContext3d(onscreen_context_provider); |
| 180 offscreen_context_provider); | |
| 181 } | 179 } |
| 182 | 180 |
| 183 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { | 181 void SynchronousCompositorOutputSurface::ReleaseHwDraw() { |
| 184 DCHECK(CalledOnValidThread()); | 182 DCHECK(CalledOnValidThread()); |
| 185 cc::OutputSurface::ReleaseGL(); | 183 cc::OutputSurface::ReleaseGL(); |
| 186 } | 184 } |
| 187 | 185 |
| 188 bool SynchronousCompositorOutputSurface::DemandDrawHw( | 186 bool SynchronousCompositorOutputSurface::DemandDrawHw( |
| 189 gfx::Size surface_size, | 187 gfx::Size surface_size, |
| 190 const gfx::Transform& transform, | 188 const gfx::Transform& transform, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 279 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 282 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 280 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 283 } | 281 } |
| 284 | 282 |
| 285 SynchronousCompositorOutputSurfaceDelegate* | 283 SynchronousCompositorOutputSurfaceDelegate* |
| 286 SynchronousCompositorOutputSurface::GetDelegate() { | 284 SynchronousCompositorOutputSurface::GetDelegate() { |
| 287 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 285 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
| 288 } | 286 } |
| 289 | 287 |
| 290 } // namespace content | 288 } // namespace content |
| OLD | NEW |