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

Side by Side Diff: cc/layers/delegated_renderer_layer.cc

Issue 23451023: cc: Tell the LayerTreeHost that the filter context is needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: delegated-filters: add header Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/delegated_renderer_layer.h ('k') | cc/output/software_renderer.cc » ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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/layers/delegated_renderer_layer.h" 5 #include "cc/layers/delegated_renderer_layer.h"
6 6
7 #include "cc/layers/delegated_renderer_layer_client.h" 7 #include "cc/layers/delegated_renderer_layer_client.h"
8 #include "cc/layers/delegated_renderer_layer_impl.h" 8 #include "cc/layers/delegated_renderer_layer_impl.h"
9 #include "cc/output/delegated_frame_data.h" 9 #include "cc/output/delegated_frame_data.h"
10 #include "cc/quads/render_pass_draw_quad.h"
11 #include "cc/trees/layer_tree_host.h"
10 12
11 namespace cc { 13 namespace cc {
12 14
13 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create( 15 scoped_refptr<DelegatedRendererLayer> DelegatedRendererLayer::Create(
14 DelegatedRendererLayerClient* client) { 16 DelegatedRendererLayerClient* client) {
15 return scoped_refptr<DelegatedRendererLayer>( 17 return scoped_refptr<DelegatedRendererLayer>(
16 new DelegatedRendererLayer(client)); 18 new DelegatedRendererLayer(client));
17 } 19 }
18 20
19 DelegatedRendererLayer::DelegatedRendererLayer( 21 DelegatedRendererLayer::DelegatedRendererLayer(
20 DelegatedRendererLayerClient* client) 22 DelegatedRendererLayerClient* client)
21 : Layer(), 23 : Layer(),
22 client_(client) {} 24 client_(client),
25 needs_filter_context_(false) {}
23 26
24 DelegatedRendererLayer::~DelegatedRendererLayer() {} 27 DelegatedRendererLayer::~DelegatedRendererLayer() {}
25 28
26 scoped_ptr<LayerImpl> DelegatedRendererLayer::CreateLayerImpl( 29 scoped_ptr<LayerImpl> DelegatedRendererLayer::CreateLayerImpl(
27 LayerTreeImpl* tree_impl) { 30 LayerTreeImpl* tree_impl) {
28 return DelegatedRendererLayerImpl::Create( 31 return DelegatedRendererLayerImpl::Create(
29 tree_impl, layer_id_).PassAs<LayerImpl>(); 32 tree_impl, layer_id_).PassAs<LayerImpl>();
30 } 33 }
31 34
32 void DelegatedRendererLayer::SetLayerTreeHost(LayerTreeHost* host) { 35 void DelegatedRendererLayer::SetLayerTreeHost(LayerTreeHost* host) {
33 if (layer_tree_host() == host) { 36 if (layer_tree_host() == host) {
34 Layer::SetLayerTreeHost(host); 37 Layer::SetLayerTreeHost(host);
35 return; 38 return;
36 } 39 }
37 40
38 if (!host) { 41 if (!host) {
39 // The active frame needs to be removed from the active tree and resources 42 // The active frame needs to be removed from the active tree and resources
40 // returned before the commit is called complete. 43 // returned before the commit is called complete.
41 // TODO(danakj): Don't need to do this if the last frame commited was empty 44 // TODO(danakj): Don't need to do this if the last frame commited was empty
42 // or we never commited a frame with resources. 45 // or we never commited a frame with resources.
43 SetNextCommitWaitsForActivation(); 46 SetNextCommitWaitsForActivation();
47 } else {
48 if (needs_filter_context_)
49 host->set_needs_filter_context();
44 } 50 }
45 51
46 Layer::SetLayerTreeHost(host); 52 Layer::SetLayerTreeHost(host);
47 } 53 }
48 54
49 bool DelegatedRendererLayer::DrawsContent() const { 55 bool DelegatedRendererLayer::DrawsContent() const {
50 return Layer::DrawsContent() && !frame_size_.IsEmpty(); 56 return Layer::DrawsContent() && !frame_size_.IsEmpty();
51 } 57 }
52 58
53 void DelegatedRendererLayer::PushPropertiesTo(LayerImpl* impl) { 59 void DelegatedRendererLayer::PushPropertiesTo(LayerImpl* impl) {
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 &unused_resources_for_child_compositor_); 98 &unused_resources_for_child_compositor_);
93 } 99 }
94 frame_data_ = new_frame_data.Pass(); 100 frame_data_ = new_frame_data.Pass();
95 if (!frame_data_->render_pass_list.empty()) { 101 if (!frame_data_->render_pass_list.empty()) {
96 RenderPass* root_pass = frame_data_->render_pass_list.back(); 102 RenderPass* root_pass = frame_data_->render_pass_list.back();
97 damage_in_frame_.Union(root_pass->damage_rect); 103 damage_in_frame_.Union(root_pass->damage_rect);
98 frame_size_ = root_pass->output_rect.size(); 104 frame_size_ = root_pass->output_rect.size();
99 } else { 105 } else {
100 frame_size_ = gfx::Size(); 106 frame_size_ = gfx::Size();
101 } 107 }
108
109 // If any RenderPassDrawQuad has a filter operation, then we need a filter
110 // context to draw this layer's content.
111 for (size_t i = 0;
112 !needs_filter_context_ && i < frame_data_->render_pass_list.size();
113 ++i) {
114 const QuadList& quad_list = frame_data_->render_pass_list[i]->quad_list;
115 for (size_t j = 0; !needs_filter_context_ && j < quad_list.size(); ++j) {
116 if (quad_list[j]->material != DrawQuad::RENDER_PASS)
117 continue;
118 const RenderPassDrawQuad* render_pass_quad =
119 RenderPassDrawQuad::MaterialCast(quad_list[j]);
120 if (!render_pass_quad->filters.IsEmpty() ||
121 !render_pass_quad->background_filters.IsEmpty())
122 needs_filter_context_ = true;
123 }
124 }
125 if (needs_filter_context_ && layer_tree_host())
126 layer_tree_host()->set_needs_filter_context();
127
102 SetNeedsCommit(); 128 SetNeedsCommit();
103 // The active frame needs to be replaced and resources returned before the 129 // The active frame needs to be replaced and resources returned before the
104 // commit is called complete. 130 // commit is called complete.
105 SetNextCommitWaitsForActivation(); 131 SetNextCommitWaitsForActivation();
106 } 132 }
107 133
108 void DelegatedRendererLayer::TakeUnusedResourcesForChildCompositor( 134 void DelegatedRendererLayer::TakeUnusedResourcesForChildCompositor(
109 ReturnedResourceArray* array) { 135 ReturnedResourceArray* array) {
110 DCHECK(array->empty()); 136 DCHECK(array->empty());
111 array->clear(); 137 array->clear();
112 138
113 array->swap(unused_resources_for_child_compositor_); 139 array->swap(unused_resources_for_child_compositor_);
114 } 140 }
115 141
116 } // namespace cc 142 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/delegated_renderer_layer.h ('k') | cc/output/software_renderer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698