Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | 10 #include "cc/quads/render_pass_draw_quad.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 SetNextCommitWaitsForActivation(); | 100 SetNextCommitWaitsForActivation(); |
| 101 } | 101 } |
| 102 | 102 |
| 103 void DelegatedRendererLayer::SetDisplaySize(gfx::Size size) { | 103 void DelegatedRendererLayer::SetDisplaySize(gfx::Size size) { |
| 104 if (display_size_ == size) | 104 if (display_size_ == size) |
| 105 return; | 105 return; |
| 106 display_size_ = size; | 106 display_size_ = size; |
| 107 SetNeedsCommit(); | 107 SetNeedsCommit(); |
| 108 } | 108 } |
| 109 | 109 |
| 110 static bool FrameDataHasFilter(DelegatedFrameData* frame) { | 110 static bool FrameDataRequiresOffscreenContext(const DelegatedFrameData* frame) { |
|
danakj
2013/11/13 21:02:03
bikeshed: RequiresFilterContext()? this would matc
rosca
2013/11/14 21:56:34
It matches with the getter's name "needs_offscreen
danakj
2013/11/20 03:32:50
The idea was the setter has some more context abou
rosca
2013/11/20 21:52:04
It makes sense now, thanks! Done.
| |
| 111 for (size_t i = 0; i < frame->render_pass_list.size(); ++i) { | 111 for (size_t i = 0; i < frame->render_pass_list.size(); ++i) { |
| 112 const QuadList& quad_list = frame->render_pass_list[i]->quad_list; | 112 const QuadList& quad_list = frame->render_pass_list[i]->quad_list; |
| 113 for (size_t j = 0; j < quad_list.size(); ++j) { | 113 for (size_t j = 0; j < quad_list.size(); ++j) { |
| 114 if (quad_list[j]->material != DrawQuad::RENDER_PASS) | 114 if (quad_list[j]->material != DrawQuad::RENDER_PASS) |
| 115 continue; | 115 continue; |
| 116 const RenderPassDrawQuad* render_pass_quad = | 116 const RenderPassDrawQuad* render_pass_quad = |
| 117 RenderPassDrawQuad::MaterialCast(quad_list[j]); | 117 RenderPassDrawQuad::MaterialCast(quad_list[j]); |
| 118 if (!render_pass_quad->filters.IsEmpty() || | 118 if (!render_pass_quad->filters.IsEmpty() || |
| 119 !render_pass_quad->background_filters.IsEmpty()) | 119 !render_pass_quad->background_filters.IsEmpty() || |
| 120 render_pass_quad->shared_quad_state->blend_mode != | |
|
danakj
2013/11/13 21:02:03
IIUC there is a plan to support blend mode for any
rosca
2013/11/14 21:56:34
Yes, I should have checked blend mode for all type
| |
| 121 SkXfermode::kSrcOver_Mode) | |
| 120 return true; | 122 return true; |
| 121 } | 123 } |
| 122 } | 124 } |
| 123 return false; | 125 return false; |
| 124 } | 126 } |
| 125 | 127 |
| 126 bool DelegatedRendererLayer::Update(ResourceUpdateQueue* queue, | 128 bool DelegatedRendererLayer::Update(ResourceUpdateQueue* queue, |
| 127 const OcclusionTracker* occlusion) { | 129 const OcclusionTracker* occlusion) { |
| 128 bool updated = Layer::Update(queue, occlusion); | 130 bool updated = Layer::Update(queue, occlusion); |
| 129 if (!should_collect_new_frame_) | 131 if (!should_collect_new_frame_) |
| 130 return updated; | 132 return updated; |
| 131 | 133 |
| 132 frame_data_ = | 134 frame_data_ = |
| 133 frame_provider_->GetFrameDataAndRefResources(this, &frame_damage_); | 135 frame_provider_->GetFrameDataAndRefResources(this, &frame_damage_); |
| 134 should_collect_new_frame_ = false; | 136 should_collect_new_frame_ = false; |
| 135 | 137 |
| 136 // If any quad has a filter operation, then we need a filter context to draw | 138 // If any quad has a filter operation, then we need a filter context to draw |
| 137 // this layer's content. | 139 // this layer's content. |
| 138 if (FrameDataHasFilter(frame_data_) && layer_tree_host()) | 140 if (layer_tree_host() && !layer_tree_host()->needs_offscreen_context() && |
|
danakj
2013/11/13 21:02:03
nit: no real need to check needs_offscreen_context
rosca
2013/11/14 21:56:34
I checked this to limit the number of FrameDataReq
danakj
2013/11/20 03:32:50
This will only avoid the call when we've already s
rosca
2013/11/20 21:52:04
Done.
| |
| 141 FrameDataRequiresOffscreenContext(frame_data_)) | |
| 139 layer_tree_host()->set_needs_filter_context(); | 142 layer_tree_host()->set_needs_filter_context(); |
| 140 | 143 |
| 141 return true; | 144 return true; |
| 142 } | 145 } |
| 143 | 146 |
| 144 } // namespace cc | 147 } // namespace cc |
| OLD | NEW |