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

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

Issue 384643002: cc: Avoid redundant SQS setting and locals. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: avoid extra local rect. Created 6 years, 5 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 | « no previous file | no next file » | 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/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 9
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 SK_MScalar1 / max_contents_scale); 147 SK_MScalar1 / max_contents_scale);
148 gfx::Size scaled_content_bounds = 148 gfx::Size scaled_content_bounds =
149 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale)); 149 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), max_contents_scale));
150 150
151 gfx::Rect scaled_visible_content_rect = 151 gfx::Rect scaled_visible_content_rect =
152 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale); 152 gfx::ScaleToEnclosingRect(visible_content_rect(), max_contents_scale);
153 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds)); 153 scaled_visible_content_rect.Intersect(gfx::Rect(scaled_content_bounds));
154 154
155 SharedQuadState* shared_quad_state = 155 SharedQuadState* shared_quad_state =
156 render_pass->CreateAndAppendSharedQuadState(); 156 render_pass->CreateAndAppendSharedQuadState();
157 PopulateSharedQuadState(shared_quad_state);
158 shared_quad_state->SetAll(scaled_draw_transform, 157 shared_quad_state->SetAll(scaled_draw_transform,
159 scaled_content_bounds, 158 scaled_content_bounds,
160 scaled_visible_content_rect, 159 scaled_visible_content_rect,
161 draw_properties().clip_rect, 160 draw_properties().clip_rect,
162 draw_properties().is_clipped, 161 draw_properties().is_clipped,
163 draw_properties().opacity, 162 draw_properties().opacity,
164 blend_mode(), 163 blend_mode(),
165 sorting_context_id_); 164 sorting_context_id_);
166 165
167 gfx::Rect rect = scaled_visible_content_rect;
168
169 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { 166 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) {
170 AppendDebugBorderQuad( 167 AppendDebugBorderQuad(
171 render_pass, 168 render_pass,
172 scaled_content_bounds, 169 scaled_content_bounds,
173 shared_quad_state, 170 shared_quad_state,
174 append_quads_data, 171 append_quads_data,
175 DebugColors::DirectPictureBorderColor(), 172 DebugColors::DirectPictureBorderColor(),
176 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); 173 DebugColors::DirectPictureBorderWidth(layer_tree_impl()));
177 174
178 gfx::Rect geometry_rect = rect; 175 gfx::Rect geometry_rect = scaled_visible_content_rect;
179 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); 176 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect();
180 gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect( 177 gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect(
181 geometry_rect, scaled_draw_transform); 178 geometry_rect, scaled_draw_transform);
182 if (visible_geometry_rect.IsEmpty()) 179 if (visible_geometry_rect.IsEmpty())
183 return; 180 return;
184 181
185 gfx::Size texture_size = rect.size(); 182 gfx::Size texture_size = scaled_visible_content_rect.size();
186 gfx::RectF texture_rect = gfx::RectF(texture_size); 183 gfx::RectF texture_rect = gfx::RectF(texture_size);
187 gfx::Rect quad_content_rect = rect; 184 gfx::Rect quad_content_rect = scaled_visible_content_rect;
188 185
189 PictureDrawQuad* quad = 186 PictureDrawQuad* quad =
190 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 187 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
191 quad->SetNew(shared_quad_state, 188 quad->SetNew(shared_quad_state,
192 geometry_rect, 189 geometry_rect,
193 opaque_rect, 190 opaque_rect,
194 visible_geometry_rect, 191 visible_geometry_rect,
195 texture_rect, 192 texture_rect,
196 texture_size, 193 texture_size,
197 RGBA_8888, 194 RGBA_8888,
198 quad_content_rect, 195 quad_content_rect,
199 max_contents_scale, 196 max_contents_scale,
200 pile_); 197 pile_);
201 append_quads_data->num_missing_tiles++; 198 append_quads_data->num_missing_tiles++;
202 return; 199 return;
203 } 200 }
204 201
205 AppendDebugBorderQuad( 202 AppendDebugBorderQuad(
206 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data); 203 render_pass, scaled_content_bounds, shared_quad_state, append_quads_data);
207 204
208 if (ShowDebugBorders()) { 205 if (ShowDebugBorders()) {
209 for (PictureLayerTilingSet::CoverageIterator iter( 206 for (PictureLayerTilingSet::CoverageIterator iter(
210 tilings_.get(), max_contents_scale, rect, ideal_contents_scale_); 207 tilings_.get(),
208 max_contents_scale,
209 scaled_visible_content_rect,
210 ideal_contents_scale_);
211 iter; 211 iter;
212 ++iter) { 212 ++iter) {
213 SkColor color; 213 SkColor color;
214 float width; 214 float width;
215 if (*iter && iter->IsReadyToDraw()) { 215 if (*iter && iter->IsReadyToDraw()) {
216 ManagedTileState::TileVersion::Mode mode = 216 ManagedTileState::TileVersion::Mode mode =
217 iter->GetTileVersionForDrawing().mode(); 217 iter->GetTileVersionForDrawing().mode();
218 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) { 218 if (mode == ManagedTileState::TileVersion::SOLID_COLOR_MODE) {
219 color = DebugColors::SolidColorTileBorderColor(); 219 color = DebugColors::SolidColorTileBorderColor();
220 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 220 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
(...skipping 29 matching lines...) Expand all
250 width); 250 width);
251 } 251 }
252 } 252 }
253 253
254 // Keep track of the tilings that were used so that tilings that are 254 // Keep track of the tilings that were used so that tilings that are
255 // unused can be considered for removal. 255 // unused can be considered for removal.
256 std::vector<PictureLayerTiling*> seen_tilings; 256 std::vector<PictureLayerTiling*> seen_tilings;
257 257
258 size_t missing_tile_count = 0u; 258 size_t missing_tile_count = 0u;
259 size_t on_demand_missing_tile_count = 0u; 259 size_t on_demand_missing_tile_count = 0u;
260 for (PictureLayerTilingSet::CoverageIterator iter( 260 for (PictureLayerTilingSet::CoverageIterator iter(tilings_.get(),
261 tilings_.get(), max_contents_scale, rect, ideal_contents_scale_); 261 max_contents_scale,
262 scaled_visible_content_rect,
263 ideal_contents_scale_);
262 iter; 264 iter;
263 ++iter) { 265 ++iter) {
264 gfx::Rect geometry_rect = iter.geometry_rect(); 266 gfx::Rect geometry_rect = iter.geometry_rect();
265 gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect( 267 gfx::Rect visible_geometry_rect = occlusion_tracker.UnoccludedContentRect(
266 geometry_rect, scaled_draw_transform); 268 geometry_rect, scaled_draw_transform);
267 if (visible_geometry_rect.IsEmpty()) 269 if (visible_geometry_rect.IsEmpty())
268 continue; 270 continue;
269 271
270 append_quads_data->visible_content_area += 272 append_quads_data->visible_content_area +=
271 visible_geometry_rect.width() * visible_geometry_rect.height(); 273 visible_geometry_rect.width() * visible_geometry_rect.height();
(...skipping 1357 matching lines...) Expand 10 before | Expand all | Expand 10 after
1629 return iterator_index_ < iterators_.size(); 1631 return iterator_index_ < iterators_.size();
1630 } 1632 }
1631 1633
1632 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( 1634 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType(
1633 PictureLayerTiling::TilingEvictionTileIterator* it) const { 1635 PictureLayerTiling::TilingEvictionTileIterator* it) const {
1634 return it->get_type() == iteration_stage_ && 1636 return it->get_type() == iteration_stage_ &&
1635 (**it)->required_for_activation() == required_for_activation_; 1637 (**it)->required_for_activation() == required_for_activation_;
1636 } 1638 }
1637 1639
1638 } // namespace cc 1640 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698