| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 SkIRect canvas_clip; | 193 SkIRect canvas_clip; |
| 194 canvas->getClipDeviceBounds(&canvas_clip); | 194 canvas->getClipDeviceBounds(&canvas_clip); |
| 195 gfx::Rect clip = gfx::SkIRectToRect(canvas_clip); | 195 gfx::Rect clip = gfx::SkIRectToRect(canvas_clip); |
| 196 | 196 |
| 197 gfx::Transform transform(gfx::Transform::kSkipInitialization); | 197 gfx::Transform transform(gfx::Transform::kSkipInitialization); |
| 198 transform.matrix() = canvas->getTotalMatrix(); // Converts 3x3 matrix to 4x4. | 198 transform.matrix() = canvas->getTotalMatrix(); // Converts 3x3 matrix to 4x4. |
| 199 | 199 |
| 200 surface_size_ = gfx::Size(canvas->getDeviceSize().width(), | 200 surface_size_ = gfx::Size(canvas->getDeviceSize().width(), |
| 201 canvas->getDeviceSize().height()); | 201 canvas->getDeviceSize().height()); |
| 202 | 202 |
| 203 // Resourceless software draw does not need viewport_for_tiling. | 203 // Pass in the cached hw viewport and transform for tile priority to avoid |
| 204 gfx::Rect empty; | 204 // tile thrashing when the WebView is alternating between hardware and |
| 205 InvokeComposite(transform, clip, clip, empty, gfx::Transform(), false); | 205 // software draws. |
| 206 InvokeComposite(transform, |
| 207 clip, |
| 208 clip, |
| 209 cached_hw_viewport_rect_for_tile_priority_, |
| 210 cached_hw_transform_for_tile_priority_, |
| 211 false); |
| 206 | 212 |
| 207 return frame_holder_.Pass(); | 213 return frame_holder_.Pass(); |
| 208 } | 214 } |
| 209 | 215 |
| 210 void SynchronousCompositorOutputSurface::InvokeComposite( | 216 void SynchronousCompositorOutputSurface::InvokeComposite( |
| 211 const gfx::Transform& transform, | 217 const gfx::Transform& transform, |
| 212 gfx::Rect viewport, | 218 gfx::Rect viewport, |
| 213 gfx::Rect clip, | 219 gfx::Rect clip, |
| 214 gfx::Rect viewport_rect_for_tile_priority, | 220 gfx::Rect viewport_rect_for_tile_priority, |
| 215 gfx::Transform transform_for_tile_priority, | 221 gfx::Transform transform_for_tile_priority, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { | 292 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { |
| 287 return BrowserThread::CurrentlyOn(BrowserThread::UI); | 293 return BrowserThread::CurrentlyOn(BrowserThread::UI); |
| 288 } | 294 } |
| 289 | 295 |
| 290 SynchronousCompositorOutputSurfaceDelegate* | 296 SynchronousCompositorOutputSurfaceDelegate* |
| 291 SynchronousCompositorOutputSurface::GetDelegate() { | 297 SynchronousCompositorOutputSurface::GetDelegate() { |
| 292 return SynchronousCompositorImpl::FromRoutingID(routing_id_); | 298 return SynchronousCompositorImpl::FromRoutingID(routing_id_); |
| 293 } | 299 } |
| 294 | 300 |
| 295 } // namespace content | 301 } // namespace content |
| OLD | NEW |