Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: content/browser/android/in_process/synchronous_compositor_output_surface.cc

Issue 517893002: Cleanup resourceless_software_draw() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 16 matching lines...) Expand all
232 // After software draws (which might move the viewport arbitrarily), restore 238 // After software draws (which might move the viewport arbitrarily), restore
233 // the previous hardware viewport to allow CC's tile manager to prioritize 239 // the previous hardware viewport to allow CC's tile manager to prioritize
234 // properly. 240 // properly.
235 if (hardware_draw) { 241 if (hardware_draw) {
236 cached_hw_transform_ = adjusted_transform; 242 cached_hw_transform_ = adjusted_transform;
237 cached_hw_viewport_ = viewport; 243 cached_hw_viewport_ = viewport;
238 cached_hw_clip_ = clip; 244 cached_hw_clip_ = clip;
239 cached_hw_viewport_rect_for_tile_priority_ = 245 cached_hw_viewport_rect_for_tile_priority_ =
240 viewport_rect_for_tile_priority; 246 viewport_rect_for_tile_priority;
241 cached_hw_transform_for_tile_priority_ = transform_for_tile_priority; 247 cached_hw_transform_for_tile_priority_ = transform_for_tile_priority;
242 } else {
243 bool resourceless_software_draw = false;
244 SetExternalDrawConstraints(cached_hw_transform_,
boliu 2014/08/29 02:01:41 we still want this to restore draw viewports and w
hush (inactive) 2014/08/29 02:20:57 Done.
245 cached_hw_viewport_,
246 cached_hw_clip_,
247 cached_hw_viewport_rect_for_tile_priority_,
248 cached_hw_transform_for_tile_priority_,
249 resourceless_software_draw);
250 } 248 }
251 249
252 if (frame_holder_.get()) 250 if (frame_holder_.get())
253 client_->DidSwapBuffersComplete(); 251 client_->DidSwapBuffersComplete();
254 252
255 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate(); 253 SynchronousCompositorOutputSurfaceDelegate* delegate = GetDelegate();
256 if (delegate) 254 if (delegate)
257 delegate->SetContinuousInvalidate(needs_begin_frame_); 255 delegate->SetContinuousInvalidate(needs_begin_frame_);
258 } 256 }
259 257
(...skipping 26 matching lines...) Expand all
286 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const { 284 bool SynchronousCompositorOutputSurface::CalledOnValidThread() const {
287 return BrowserThread::CurrentlyOn(BrowserThread::UI); 285 return BrowserThread::CurrentlyOn(BrowserThread::UI);
288 } 286 }
289 287
290 SynchronousCompositorOutputSurfaceDelegate* 288 SynchronousCompositorOutputSurfaceDelegate*
291 SynchronousCompositorOutputSurface::GetDelegate() { 289 SynchronousCompositorOutputSurface::GetDelegate() {
292 return SynchronousCompositorImpl::FromRoutingID(routing_id_); 290 return SynchronousCompositorImpl::FromRoutingID(routing_id_);
293 } 291 }
294 292
295 } // namespace content 293 } // namespace content
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698