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

Side by Side Diff: cc/surfaces/display.cc

Issue 506273002: Aggregate damage rects in surface aggregator (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/surfaces/display.h ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "cc/surfaces/display.h" 5 #include "cc/surfaces/display.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "cc/output/compositor_frame.h" 9 #include "cc/output/compositor_frame.h"
10 #include "cc/output/compositor_frame_ack.h" 10 #include "cc/output/compositor_frame_ack.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 bool Display::Draw() { 84 bool Display::Draw() {
85 if (current_surface_id_.is_null()) 85 if (current_surface_id_.is_null())
86 return false; 86 return false;
87 87
88 InitializeOutputSurface(); 88 InitializeOutputSurface();
89 if (!output_surface_) 89 if (!output_surface_)
90 return false; 90 return false;
91 91
92 contained_surfaces_.clear();
93
94 scoped_ptr<CompositorFrame> frame = 92 scoped_ptr<CompositorFrame> frame =
95 aggregator_->Aggregate(current_surface_id_, &contained_surfaces_); 93 aggregator_->Aggregate(current_surface_id_);
96 if (!frame) 94 if (!frame)
97 return false; 95 return false;
98 96
99 TRACE_EVENT0("cc", "Display::Draw"); 97 TRACE_EVENT0("cc", "Display::Draw");
100 DelegatedFrameData* frame_data = frame->delegated_frame_data.get(); 98 DelegatedFrameData* frame_data = frame->delegated_frame_data.get();
101 99
102 // Only reshape when we know we are going to draw. Otherwise, the reshape 100 // Only reshape when we know we are going to draw. Otherwise, the reshape
103 // can leave the window at the wrong size if we never draw and the proper 101 // can leave the window at the wrong size if we never draw and the proper
104 // viewport size is never set. 102 // viewport size is never set.
105 output_surface_->Reshape(current_surface_size_, 1.f); 103 output_surface_->Reshape(current_surface_size_, 1.f);
106 float device_scale_factor = 1.0f; 104 float device_scale_factor = 1.0f;
107 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); 105 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_);
108 gfx::Rect device_clip_rect = device_viewport_rect; 106 gfx::Rect device_clip_rect = device_viewport_rect;
109 bool disable_picture_quad_image_filtering = false; 107 bool disable_picture_quad_image_filtering = false;
110 108
111 renderer_->DecideRenderPassAllocationsForFrame(frame_data->render_pass_list); 109 renderer_->DecideRenderPassAllocationsForFrame(frame_data->render_pass_list);
112 renderer_->DrawFrame(&frame_data->render_pass_list, 110 renderer_->DrawFrame(&frame_data->render_pass_list,
113 device_scale_factor, 111 device_scale_factor,
114 device_viewport_rect, 112 device_viewport_rect,
115 device_clip_rect, 113 device_clip_rect,
116 disable_picture_quad_image_filtering); 114 disable_picture_quad_image_filtering);
117 CompositorFrameMetadata metadata; 115 CompositorFrameMetadata metadata;
118 renderer_->SwapBuffers(metadata); 116 renderer_->SwapBuffers(metadata);
119 for (std::set<SurfaceId>::iterator it = contained_surfaces_.begin(); 117 for (SurfaceAggregator::SurfaceIndexMap::iterator it =
120 it != contained_surfaces_.end(); 118 aggregator_->previous_contained_surfaces().begin();
119 it != aggregator_->previous_contained_surfaces().end();
121 ++it) { 120 ++it) {
122 Surface* surface = manager_->GetSurfaceForId(*it); 121 Surface* surface = manager_->GetSurfaceForId(it->first);
123 if (surface) 122 if (surface)
124 surface->RunDrawCallbacks(); 123 surface->RunDrawCallbacks();
125 } 124 }
126 return true; 125 return true;
127 } 126 }
128 127
129 void Display::OnSurfaceDamaged(SurfaceId surface) { 128 void Display::OnSurfaceDamaged(SurfaceId surface) {
130 if (contained_surfaces_.find(surface) != contained_surfaces_.end()) 129 if (aggregator_ && aggregator_->previous_contained_surfaces().count(surface))
131 client_->DisplayDamaged(); 130 client_->DisplayDamaged();
132 } 131 }
133 132
134 SurfaceId Display::CurrentSurfaceId() { 133 SurfaceId Display::CurrentSurfaceId() {
135 return current_surface_id_; 134 return current_surface_id_;
136 } 135 }
137 136
138 } // namespace cc 137 } // namespace cc
OLDNEW
« no previous file with comments | « cc/surfaces/display.h ('k') | cc/surfaces/surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698