| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <limits> | 9 #include <limits> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 tilings_.get(), max_contents_scale, | 218 tilings_.get(), max_contents_scale, |
| 219 shared_quad_state->visible_content_rect, ideal_contents_scale_); | 219 shared_quad_state->visible_content_rect, ideal_contents_scale_); |
| 220 iter; ++iter) { | 220 iter; ++iter) { |
| 221 SkColor color; | 221 SkColor color; |
| 222 float width; | 222 float width; |
| 223 if (*iter && iter->IsReadyToDraw()) { | 223 if (*iter && iter->IsReadyToDraw()) { |
| 224 TileDrawInfo::Mode mode = iter->draw_info().mode(); | 224 TileDrawInfo::Mode mode = iter->draw_info().mode(); |
| 225 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { | 225 if (mode == TileDrawInfo::SOLID_COLOR_MODE) { |
| 226 color = DebugColors::SolidColorTileBorderColor(); | 226 color = DebugColors::SolidColorTileBorderColor(); |
| 227 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); | 227 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); |
| 228 } else if (mode == TileDrawInfo::PICTURE_PILE_MODE) { | 228 } else if (mode == TileDrawInfo::OOM_MODE) { |
| 229 color = DebugColors::PictureTileBorderColor(); | 229 color = DebugColors::OOMTileBorderColor(); |
| 230 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); | 230 width = DebugColors::OOMTileBorderWidth(layer_tree_impl()); |
| 231 } else if (iter.resolution() == HIGH_RESOLUTION) { | 231 } else if (iter.resolution() == HIGH_RESOLUTION) { |
| 232 color = DebugColors::HighResTileBorderColor(); | 232 color = DebugColors::HighResTileBorderColor(); |
| 233 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); | 233 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); |
| 234 } else if (iter.resolution() == LOW_RESOLUTION) { | 234 } else if (iter.resolution() == LOW_RESOLUTION) { |
| 235 color = DebugColors::LowResTileBorderColor(); | 235 color = DebugColors::LowResTileBorderColor(); |
| 236 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); | 236 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); |
| 237 } else if (iter->contents_scale() > max_contents_scale) { | 237 } else if (iter->contents_scale() > max_contents_scale) { |
| 238 color = DebugColors::ExtraHighResTileBorderColor(); | 238 color = DebugColors::ExtraHighResTileBorderColor(); |
| 239 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); | 239 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); |
| 240 } else { | 240 } else { |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 306 |
| 307 TileDrawQuad* quad = | 307 TileDrawQuad* quad = |
| 308 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); | 308 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
| 309 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, | 309 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, |
| 310 visible_geometry_rect, draw_info.resource_id(), | 310 visible_geometry_rect, draw_info.resource_id(), |
| 311 texture_rect, draw_info.resource_size(), | 311 texture_rect, draw_info.resource_size(), |
| 312 draw_info.contents_swizzled(), nearest_neighbor_); | 312 draw_info.contents_swizzled(), nearest_neighbor_); |
| 313 has_draw_quad = true; | 313 has_draw_quad = true; |
| 314 break; | 314 break; |
| 315 } | 315 } |
| 316 case TileDrawInfo::PICTURE_PILE_MODE: { | |
| 317 if (!layer_tree_impl() | |
| 318 ->GetRendererCapabilities() | |
| 319 .allow_rasterize_on_demand) { | |
| 320 ++on_demand_missing_tile_count; | |
| 321 break; | |
| 322 } | |
| 323 | |
| 324 gfx::RectF texture_rect = iter.texture_rect(); | |
| 325 | |
| 326 ResourceProvider* resource_provider = | |
| 327 layer_tree_impl()->resource_provider(); | |
| 328 ResourceFormat format = | |
| 329 resource_provider->memory_efficient_texture_format(); | |
| 330 PictureDrawQuad* quad = | |
| 331 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); | |
| 332 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, | |
| 333 visible_geometry_rect, texture_rect, | |
| 334 iter->desired_texture_size(), nearest_neighbor_, format, | |
| 335 iter->content_rect(), iter->contents_scale(), | |
| 336 raster_source_); | |
| 337 has_draw_quad = true; | |
| 338 break; | |
| 339 } | |
| 340 case TileDrawInfo::SOLID_COLOR_MODE: { | 316 case TileDrawInfo::SOLID_COLOR_MODE: { |
| 341 SolidColorDrawQuad* quad = | 317 SolidColorDrawQuad* quad = |
| 342 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 318 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 343 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, | 319 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, |
| 344 draw_info.solid_color(), false); | 320 draw_info.solid_color(), false); |
| 345 has_draw_quad = true; | 321 has_draw_quad = true; |
| 346 break; | 322 break; |
| 347 } | 323 } |
| 324 case TileDrawInfo::OOM_MODE: |
| 325 break; // Checkerboard. |
| 348 } | 326 } |
| 349 } | 327 } |
| 350 | 328 |
| 351 if (!has_draw_quad) { | 329 if (!has_draw_quad) { |
| 352 if (draw_checkerboard_for_missing_tiles()) { | 330 if (draw_checkerboard_for_missing_tiles()) { |
| 353 CheckerboardDrawQuad* quad = | 331 CheckerboardDrawQuad* quad = |
| 354 render_pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>(); | 332 render_pass->CreateAndAppendDrawQuad<CheckerboardDrawQuad>(); |
| 355 SkColor color = DebugColors::DefaultCheckerboardColor(); | 333 SkColor color = DebugColors::DefaultCheckerboardColor(); |
| 356 quad->SetNew( | 334 quad->SetNew( |
| 357 shared_quad_state, geometry_rect, visible_geometry_rect, color); | 335 shared_quad_state, geometry_rect, visible_geometry_rect, color); |
| (...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 | 1189 |
| 1212 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1190 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1213 return !layer_tree_impl()->IsRecycleTree(); | 1191 return !layer_tree_impl()->IsRecycleTree(); |
| 1214 } | 1192 } |
| 1215 | 1193 |
| 1216 bool PictureLayerImpl::HasValidTilePriorities() const { | 1194 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1217 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1195 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
| 1218 } | 1196 } |
| 1219 | 1197 |
| 1220 } // namespace cc | 1198 } // namespace cc |
| OLD | NEW |