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/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 AppendDebugBorderQuad( | 194 AppendDebugBorderQuad( |
195 render_pass, bounds(), shared_quad_state, append_quads_data); | 195 render_pass, bounds(), shared_quad_state, append_quads_data); |
196 | 196 |
197 SolidColorLayerImpl::AppendSolidQuads( | 197 SolidColorLayerImpl::AppendSolidQuads( |
198 render_pass, draw_properties().occlusion_in_content_space, | 198 render_pass, draw_properties().occlusion_in_content_space, |
199 shared_quad_state, visible_layer_rect(), | 199 shared_quad_state, visible_layer_rect(), |
200 raster_source_->GetSolidColor(), append_quads_data); | 200 raster_source_->GetSolidColor(), append_quads_data); |
201 return; | 201 return; |
202 } | 202 } |
203 | 203 |
| 204 float device_scale_factor = |
| 205 layer_tree_impl() ? layer_tree_impl()->device_scale_factor() : 1; |
204 float max_contents_scale = MaximumTilingContentsScale(); | 206 float max_contents_scale = MaximumTilingContentsScale(); |
205 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale, | 207 PopulateScaledSharedQuadState(shared_quad_state, max_contents_scale, |
206 max_contents_scale); | 208 max_contents_scale); |
207 Occlusion scaled_occlusion = | 209 Occlusion scaled_occlusion = |
208 draw_properties() | 210 draw_properties() |
209 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( | 211 .occlusion_in_content_space.GetOcclusionWithGivenDrawTransform( |
210 shared_quad_state->quad_to_target_transform); | 212 shared_quad_state->quad_to_target_transform); |
211 | 213 |
212 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { | 214 if (current_draw_mode_ == DRAW_MODE_RESOURCELESS_SOFTWARE) { |
213 AppendDebugBorderQuad( | 215 AppendDebugBorderQuad( |
214 render_pass, shared_quad_state->quad_layer_bounds, shared_quad_state, | 216 render_pass, shared_quad_state->quad_layer_bounds, shared_quad_state, |
215 append_quads_data, DebugColors::DirectPictureBorderColor(), | 217 append_quads_data, DebugColors::DirectPictureBorderColor(), |
216 DebugColors::DirectPictureBorderWidth(layer_tree_impl())); | 218 DebugColors::DirectPictureBorderWidth(device_scale_factor)); |
217 | 219 |
218 gfx::Rect geometry_rect = shared_quad_state->visible_quad_layer_rect; | 220 gfx::Rect geometry_rect = shared_quad_state->visible_quad_layer_rect; |
219 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); | 221 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); |
220 gfx::Rect visible_geometry_rect = | 222 gfx::Rect visible_geometry_rect = |
221 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); | 223 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); |
222 | 224 |
223 // The raster source may not be valid over the entire visible rect, | 225 // The raster source may not be valid over the entire visible rect, |
224 // and rastering outside of that may cause incorrect pixels. | 226 // and rastering outside of that may cause incorrect pixels. |
225 gfx::Rect scaled_recorded_viewport = gfx::ScaleToEnclosingRect( | 227 gfx::Rect scaled_recorded_viewport = gfx::ScaleToEnclosingRect( |
226 raster_source_->RecordedViewport(), max_contents_scale); | 228 raster_source_->RecordedViewport(), max_contents_scale); |
(...skipping 26 matching lines...) Expand all Loading... |
253 for (PictureLayerTilingSet::CoverageIterator iter( | 255 for (PictureLayerTilingSet::CoverageIterator iter( |
254 tilings_.get(), max_contents_scale, | 256 tilings_.get(), max_contents_scale, |
255 shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); | 257 shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); |
256 iter; ++iter) { | 258 iter; ++iter) { |
257 SkColor color; | 259 SkColor color; |
258 float width; | 260 float width; |
259 if (*iter && iter->draw_info().IsReadyToDraw()) { | 261 if (*iter && iter->draw_info().IsReadyToDraw()) { |
260 TileDrawInfo::Mode mode = iter->draw_info().mode(); | 262 TileDrawInfo::Mode mode = iter->draw_info().mode(); |
261 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { | 263 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { |
262 color = DebugColors::SolidColorTileBorderColor(); | 264 color = DebugColors::SolidColorTileBorderColor(); |
263 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 265 width = DebugColors::SolidColorTileBorderWidth(device_scale_factor); |
264 } else if (mode == TileDrawInfo::OOM_MODE) { | 266 } else if (mode == TileDrawInfo::OOM_MODE) { |
265 color = DebugColors::OOMTileBorderColor(); | 267 color = DebugColors::OOMTileBorderColor(); |
266 width = DebugColors::OOMTileBorderWidth(layer_tree_impl()); | 268 width = DebugColors::OOMTileBorderWidth(device_scale_factor); |
267 } else if (iter->draw_info().has_compressed_resource()) { | 269 } else if (iter->draw_info().has_compressed_resource()) { |
268 color = DebugColors::CompressedTileBorderColor(); | 270 color = DebugColors::CompressedTileBorderColor(); |
269 width = DebugColors::CompressedTileBorderWidth(layer_tree_impl()); | 271 width = DebugColors::CompressedTileBorderWidth(device_scale_factor); |
270 } else if (iter.resolution() == HIGH_RESOLUTION) { | 272 } else if (iter.resolution() == HIGH_RESOLUTION) { |
271 color = DebugColors::HighResTileBorderColor(); | 273 color = DebugColors::HighResTileBorderColor(); |
272 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 274 width = DebugColors::HighResTileBorderWidth(device_scale_factor); |
273 } else if (iter.resolution() == LOW_RESOLUTION) { | 275 } else if (iter.resolution() == LOW_RESOLUTION) { |
274 color = DebugColors::LowResTileBorderColor(); | 276 color = DebugColors::LowResTileBorderColor(); |
275 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 277 width = DebugColors::LowResTileBorderWidth(device_scale_factor); |
276 } else if (iter->contents_scale() > max_contents_scale) { | 278 } else if (iter->contents_scale() > max_contents_scale) { |
277 color = DebugColors::ExtraHighResTileBorderColor(); | 279 color = DebugColors::ExtraHighResTileBorderColor(); |
278 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 280 width = DebugColors::ExtraHighResTileBorderWidth(device_scale_factor); |
279 } else { | 281 } else { |
280 color = DebugColors::ExtraLowResTileBorderColor(); | 282 color = DebugColors::ExtraLowResTileBorderColor(); |
281 width = DebugColors::ExtraLowResTileBorderWidth(layer_tree_impl()); | 283 width = DebugColors::ExtraLowResTileBorderWidth(device_scale_factor); |
282 } | 284 } |
283 } else { | 285 } else { |
284 color = DebugColors::MissingTileBorderColor(); | 286 color = DebugColors::MissingTileBorderColor(); |
285 width = DebugColors::MissingTileBorderWidth(layer_tree_impl()); | 287 width = DebugColors::MissingTileBorderWidth(device_scale_factor); |
286 } | 288 } |
287 | 289 |
288 DebugBorderDrawQuad* debug_border_quad = | 290 DebugBorderDrawQuad* debug_border_quad = |
289 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); | 291 render_pass->CreateAndAppendDrawQuad<DebugBorderDrawQuad>(); |
290 gfx::Rect geometry_rect = iter.geometry_rect(); | 292 gfx::Rect geometry_rect = iter.geometry_rect(); |
291 gfx::Rect visible_geometry_rect = geometry_rect; | 293 gfx::Rect visible_geometry_rect = geometry_rect; |
292 debug_border_quad->SetNew(shared_quad_state, | 294 debug_border_quad->SetNew(shared_quad_state, |
293 geometry_rect, | 295 geometry_rect, |
294 visible_geometry_rect, | 296 visible_geometry_rect, |
295 color, | 297 color, |
(...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1261 std::max(GetIdealContentsScale(), min_contents_scale)); | 1263 std::max(GetIdealContentsScale(), min_contents_scale)); |
1262 ideal_source_scale_ = | 1264 ideal_source_scale_ = |
1263 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; | 1265 ideal_contents_scale_ / ideal_page_scale_ / ideal_device_scale_; |
1264 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.IdealContentsScale", | 1266 UMA_HISTOGRAM_CUSTOM_COUNTS("Renderer4.IdealContentsScale", |
1265 ideal_contents_scale_, 1, 10000, 50); | 1267 ideal_contents_scale_, 1, 10000, 50); |
1266 } | 1268 } |
1267 | 1269 |
1268 void PictureLayerImpl::GetDebugBorderProperties( | 1270 void PictureLayerImpl::GetDebugBorderProperties( |
1269 SkColor* color, | 1271 SkColor* color, |
1270 float* width) const { | 1272 float* width) const { |
| 1273 float device_scale_factor = |
| 1274 layer_tree_impl() ? layer_tree_impl()->device_scale_factor() : 1; |
| 1275 |
1271 if (is_directly_composited_image_) { | 1276 if (is_directly_composited_image_) { |
1272 *color = DebugColors::ImageLayerBorderColor(); | 1277 *color = DebugColors::ImageLayerBorderColor(); |
1273 *width = DebugColors::ImageLayerBorderWidth(layer_tree_impl()); | 1278 *width = DebugColors::ImageLayerBorderWidth(device_scale_factor); |
1274 } else { | 1279 } else { |
1275 *color = DebugColors::TiledContentLayerBorderColor(); | 1280 *color = DebugColors::TiledContentLayerBorderColor(); |
1276 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 1281 *width = DebugColors::TiledContentLayerBorderWidth(device_scale_factor); |
1277 } | 1282 } |
1278 } | 1283 } |
1279 | 1284 |
1280 void PictureLayerImpl::GetAllPrioritizedTilesForTracing( | 1285 void PictureLayerImpl::GetAllPrioritizedTilesForTracing( |
1281 std::vector<PrioritizedTile>* prioritized_tiles) const { | 1286 std::vector<PrioritizedTile>* prioritized_tiles) const { |
1282 if (!tilings_) | 1287 if (!tilings_) |
1283 return; | 1288 return; |
1284 tilings_->GetAllPrioritizedTilesForTracing(prioritized_tiles); | 1289 tilings_->GetAllPrioritizedTilesForTracing(prioritized_tiles); |
1285 } | 1290 } |
1286 | 1291 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1387 } | 1392 } |
1388 | 1393 |
1389 invalidation_.Union(invalidation); | 1394 invalidation_.Union(invalidation); |
1390 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); | 1395 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); |
1391 SetNeedsPushProperties(); | 1396 SetNeedsPushProperties(); |
1392 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1397 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
1393 "Invalidation", invalidation.ToString()); | 1398 "Invalidation", invalidation.ToString()); |
1394 } | 1399 } |
1395 | 1400 |
1396 } // namespace cc | 1401 } // namespace cc |
OLD | NEW |