Index: cc/output/direct_renderer.cc |
diff --git a/cc/output/direct_renderer.cc b/cc/output/direct_renderer.cc |
index cc7fd12c67002cf9dd367ff183eebf9d9792a2d6..00852b405b0189414b0a4a8f714eaf4cabebc8fa 100644 |
--- a/cc/output/direct_renderer.cc |
+++ b/cc/output/direct_renderer.cc |
@@ -166,6 +166,8 @@ void DirectRenderer::SetVisible(bool visible) { |
void DirectRenderer::DecideRenderPassAllocationsForFrame( |
const RenderPassList& render_passes_in_draw_order) { |
render_pass_bypass_quads_.clear(); |
+ render_pass_filters_.clear(); |
danakj
2016/12/01 01:50:46
This isn't part of allocating.. while I appreciate
ajuma
2016/12/13 15:08:11
Done.
|
+ render_pass_background_filters_.clear(); |
std::unordered_map<RenderPassId, gfx::Size, RenderPassIdHash> |
render_passes_in_frame; |
@@ -173,10 +175,19 @@ void DirectRenderer::DecideRenderPassAllocationsForFrame( |
for (size_t i = 0; i < render_passes_in_draw_order.size(); ++i) { |
RenderPass* pass = render_passes_in_draw_order[i].get(); |
if (pass != root_render_pass) { |
+ if (!pass->filters.IsEmpty()) |
+ render_pass_filters_.push_back(std::make_pair(pass->id, pass->filters)); |
danakj
2016/12/01 01:50:46
why copy the filters, you could store a pointer to
weiliangc
2016/12/01 21:20:54
I mean we store the filters pointers here, and whe
danakj
2016/12/01 21:26:02
i'm not totally sure what you mean, but what i mea
ajuma
2016/12/13 15:08:11
Changed to storing a pointer to the RenderPass's f
|
+ if (!pass->background_filters.IsEmpty()) { |
+ render_pass_background_filters_.push_back( |
+ std::make_pair(pass->id, pass->background_filters)); |
+ } |
if (const TileDrawQuad* tile_quad = CanPassBeDrawnDirectly(pass)) { |
render_pass_bypass_quads_[pass->id] = *tile_quad; |
continue; |
} |
+ } else { |
+ DCHECK(pass->filters.IsEmpty()); |
+ DCHECK(pass->background_filters.IsEmpty()); |
} |
render_passes_in_frame.insert(std::pair<RenderPassId, gfx::Size>( |
pass->id, RenderPassTextureSize(pass))); |
@@ -277,7 +288,8 @@ void DirectRenderer::DrawFrame(RenderPassList* render_passes_in_draw_order, |
// Attempt to replace some or all of the quads of the root render pass with |
// overlays. |
overlay_processor_->ProcessForOverlays( |
- resource_provider_, root_render_pass, &frame.overlay_list, |
+ resource_provider_, root_render_pass, render_pass_filters_, |
+ render_pass_background_filters_, &frame.overlay_list, |
&frame.ca_layer_overlay_list, &frame.root_damage_rect); |
// We can skip all drawing if the damage rect is now empty. |
@@ -405,6 +417,26 @@ void DirectRenderer::DoDrawPolygon(const DrawPolygon& poly, |
} |
} |
+const FilterOperations* DirectRenderer::FiltersForPass(RenderPassId id) const { |
danakj
2016/12/01 01:50:46
const&?
weiliangc
2016/12/01 21:20:54
like mentioned in line 179, if we store pointers,
danakj
2016/12/01 21:26:02
here I'm talking about the |id|
ajuma
2016/12/13 15:08:11
Changed |id| to const&, but then changed back to p
|
+ auto it = |
+ std::find_if(render_pass_filters_.begin(), render_pass_filters_.end(), |
+ [id](const std::pair<RenderPassId, FilterOperations>& p) { |
+ return p.first == id; |
+ }); |
+ return it == render_pass_filters_.end() ? nullptr : &it->second; |
+} |
+ |
+const FilterOperations* DirectRenderer::BackgroundFiltersForPass( |
+ RenderPassId id) const { |
danakj
2016/12/01 01:50:46
const&
ajuma
2016/12/13 15:08:11
Done.
|
+ auto it = |
+ std::find_if(render_pass_background_filters_.begin(), |
+ render_pass_background_filters_.end(), |
+ [id](const std::pair<RenderPassId, FilterOperations>& p) { |
+ return p.first == id; |
+ }); |
+ return it == render_pass_background_filters_.end() ? nullptr : &it->second; |
+} |
+ |
void DirectRenderer::FlushPolygons( |
std::deque<std::unique_ptr<DrawPolygon>>* poly_list, |
DrawingFrame* frame, |