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

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

Issue 607023003: cc: Unify the occlusion access by adding an ability to scale transform. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: +tests Created 6 years, 2 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
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/picture_layer_impl.h" 5 #include "cc/layers/picture_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 158
159 SharedQuadState* shared_quad_state = 159 SharedQuadState* shared_quad_state =
160 render_pass->CreateAndAppendSharedQuadState(); 160 render_pass->CreateAndAppendSharedQuadState();
161 161
162 if (pile_->is_solid_color()) { 162 if (pile_->is_solid_color()) {
163 PopulateSharedQuadState(shared_quad_state); 163 PopulateSharedQuadState(shared_quad_state);
164 164
165 AppendDebugBorderQuad( 165 AppendDebugBorderQuad(
166 render_pass, content_bounds(), shared_quad_state, append_quads_data); 166 render_pass, content_bounds(), shared_quad_state, append_quads_data);
167 167
168 SolidColorLayerImpl::AppendSolidQuads( 168 SolidColorLayerImpl::AppendSolidQuads(render_pass,
169 render_pass, 169 occlusion_tracker,
170 occlusion_tracker, 170 shared_quad_state,
171 shared_quad_state, 171 content_bounds(),
172 content_bounds(), 172 draw_transform(),
173 draw_properties().target_space_transform, 173 pile_->solid_color(),
174 pile_->solid_color(), 174 append_quads_data);
175 append_quads_data);
176 return; 175 return;
177 } 176 }
178 177
178 Occlusion occlusion =
179 occlusion_tracker.GetCurrentOcclusionForLayer(draw_transform());
180
179 float max_contents_scale = MaximumTilingContentsScale(); 181 float max_contents_scale = MaximumTilingContentsScale();
180 gfx::Transform scaled_draw_transform = draw_transform(); 182 gfx::Transform scaled_draw_transform = draw_transform();
181 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale, 183 scaled_draw_transform.Scale(SK_MScalar1 / max_contents_scale,
182 SK_MScalar1 / max_contents_scale); 184 SK_MScalar1 / max_contents_scale);
183 gfx::Size scaled_content_bounds = 185 gfx::Size scaled_content_bounds =
184 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale)); 186 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale));
185
186 gfx::Rect scaled_visible_content_rect = 187 gfx::Rect scaled_visible_content_rect =
187 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale); 188 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale);
188 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds)); 189 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
189 190 Occlusion scaled_occlusion = occlusion.GetOcclusionWithScaledDrawTransform(
190 Occlusion occlusion = 191 SK_MScalar1 / max_contents_scale, SK_MScalar1 / max_contents_scale);
191 occlusion_tracker.GetCurrentOcclusionForLayer(scaled_draw_transform);
192 192
193 shared_quad_state->SetAll(scaled_draw_transform, 193 shared_quad_state->SetAll(scaled_draw_transform,
194 scaled_content_bounds, 194 scaled_content_bounds,
195 scaled_visible_content_rect, 195 scaled_visible_content_rect,
196 draw_properties().clip_rect, 196 draw_properties().clip_rect,
197 draw_properties().is_clipped, 197 draw_properties().is_clipped,
198 draw_properties().opacity, 198 draw_properties().opacity,
199 blend_mode(), 199 blend_mode(),
200 sorting_context_id_); 200 sorting_context_id_);
201 201
202 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { 202 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) {
203 AppendDebugBorderQuad( 203 AppendDebugBorderQuad(
204 render_pass, 204 render_pass,
205 scaled_content_bounds, 205 scaled_content_bounds,
206 shared_quad_state, 206 shared_quad_state,
207 append_quads_data, 207 append_quads_data,
208 DebugColors::DirectPictureBorderColor(), 208 DebugColors::DirectPictureBorderColor(),
209 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); 209 DebugColors::DirectPictureBorderWidth(layer_tree_impl()));
210 210
211 gfx::Rect geometry_rect = scaled_visible_content_rect; 211 gfx::Rect geometry_rect = scaled_visible_content_rect;
212 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 212 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
213 gfx::Rect visible_geometry_rect = 213 gfx::Rect visible_geometry_rect =
214 occlusion.GetUnoccludedContentRect(geometry_rect); 214 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
215 if (visible_geometry_rect.IsEmpty()) 215 if (visible_geometry_rect.IsEmpty())
216 return; 216 return;
217 217
218 gfx::Size texture_size = scaled_visible_content_rect.size(); 218 gfx::Size texture_size = scaled_visible_content_rect.size();
219 gfx::RectF texture_rect = gfx::RectF(texture_size); 219 gfx::RectF texture_rect = gfx::RectF(texture_size);
220 gfx::Rect quad_content_rect = scaled_visible_content_rect; 220 gfx::Rect quad_content_rect = scaled_visible_content_rect;
221 221
222 PictureDrawQuad* quad = 222 PictureDrawQuad* quad =
223 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 223 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
224 quad->SetNew(shared_quad_state, 224 quad->SetNew(shared_quad_state,
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 size_t on_demand_missing_tile_count = 0u; 299 size_t on_demand_missing_tile_count = 0u;
300 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(), 300 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(),
301 max_contents_scale, 301 max_contents_scale,
302 scaled_visible_content_rect, 302 scaled_visible_content_rect,
303 ideal_contents_scale_); 303 ideal_contents_scale_);
304 iter; 304 iter;
305 ++iter) { 305 ++iter) {
306 gfx::Rect geometry_rect = iter.geometry_rect(); 306 gfx::Rect geometry_rect = iter.geometry_rect();
307 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 307 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
308 gfx::Rect visible_geometry_rect = 308 gfx::Rect visible_geometry_rect =
309 occlusion.GetUnoccludedContentRect(geometry_rect); 309 scaled_occlusion.GetUnoccludedContentRect(geometry_rect);
310 if (visible_geometry_rect.IsEmpty()) 310 if (visible_geometry_rect.IsEmpty())
311 continue; 311 continue;
312 312
313 append_quads_data->visible_content_area += 313 append_quads_data->visible_content_area +=
314 visible_geometry_rect.width() * visible_geometry_rect.height(); 314 visible_geometry_rect.width() * visible_geometry_rect.height();
315 315
316 bool has_draw_quad = false; 316 bool has_draw_quad = false;
317 if (*iter && iter->IsReadyToDraw()) { 317 if (*iter && iter->IsReadyToDraw()) {
318 const ManagedTileState::DrawInfo& draw_info = iter->draw_info(); 318 const ManagedTileState::DrawInfo& draw_info = iter->draw_info();
319 switch (draw_info.mode()) { 319 switch (draw_info.mode()) {
(...skipping 1474 matching lines...) Expand 10 before | Expand all | Expand 10 after
1794 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange(); 1794 PictureLayerTilingSet::TilingRange tiling_range = CurrentTilingRange();
1795 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start; 1795 size_t current_tiling_range_offset = current_tiling_ - tiling_range.start;
1796 return tiling_range.end - 1 - current_tiling_range_offset; 1796 return tiling_range.end - 1 - current_tiling_range_offset;
1797 } 1797 }
1798 } 1798 }
1799 NOTREACHED(); 1799 NOTREACHED();
1800 return 0; 1800 return 0;
1801 } 1801 }
1802 1802
1803 } // namespace cc 1803 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698