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/picture_layer_impl.h" | 5 #include "cc/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include "base/time.h" | 7 #include "base/time.h" |
| 8 #include "cc/append_quads_data.h" | 8 #include "cc/append_quads_data.h" |
| 9 #include "cc/checkerboard_draw_quad.h" | 9 #include "cc/checkerboard_draw_quad.h" |
| 10 #include "cc/debug_border_draw_quad.h" | 10 #include "cc/debug_border_draw_quad.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); | 89 appendDebugBorderQuad(quadSink, sharedQuadState, appendQuadsData); |
| 90 | 90 |
| 91 bool clipped = false; | 91 bool clipped = false; |
| 92 gfx::QuadF target_quad = MathUtil::mapQuad( | 92 gfx::QuadF target_quad = MathUtil::mapQuad( |
| 93 drawTransform(), | 93 drawTransform(), |
| 94 gfx::QuadF(rect), | 94 gfx::QuadF(rect), |
| 95 clipped); | 95 clipped); |
| 96 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); | 96 bool isAxisAlignedInTarget = !clipped && target_quad.IsRectilinear(); |
| 97 bool useAA = !isAxisAlignedInTarget; | 97 bool useAA = !isAxisAlignedInTarget; |
| 98 | 98 |
| 99 bool isPixelAligned = isAxisAlignedInTarget && drawTransform().IsIdentityOrInt egerTranslation(); | |
|
brianderson
2013/02/13 00:10:19
Note: the logic here reflects the logic used to de
| |
| 100 PictureLayerTiling::LayerDeviceAlignment layerDeviceAlignment = | |
| 101 isPixelAligned ? PictureLayerTiling::LayerAlignedToDevice | |
| 102 : PictureLayerTiling::LayerNotAlignedToDevice; | |
| 103 | |
| 99 if (showDebugBorders()) { | 104 if (showDebugBorders()) { |
| 100 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), | 105 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), |
| 101 contentsScaleX(), | 106 contentsScaleX(), |
| 102 rect, | 107 rect, |
| 103 ideal_contents_scale_); | 108 ideal_contents_scale_, |
| 109 layerDeviceAlignment); | |
| 104 iter; | 110 iter; |
| 105 ++iter) { | 111 ++iter) { |
| 106 SkColor color; | 112 SkColor color; |
| 107 float width; | 113 float width; |
| 108 if (*iter && iter->GetResourceId()) { | 114 if (*iter && iter->GetResourceId()) { |
| 109 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { | 115 if (iter->priority(ACTIVE_TREE).resolution == HIGH_RESOLUTION) { |
| 110 color = DebugColors::HighResTileBorderColor(); | 116 color = DebugColors::HighResTileBorderColor(); |
| 111 width = DebugColors::HighResTileBorderWidth(layerTreeImpl()); | 117 width = DebugColors::HighResTileBorderWidth(layerTreeImpl()); |
| 112 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { | 118 } else if (iter->priority(ACTIVE_TREE).resolution == LOW_RESOLUTION) { |
| 113 color = DebugColors::LowResTileBorderColor(); | 119 color = DebugColors::LowResTileBorderColor(); |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 132 } | 138 } |
| 133 } | 139 } |
| 134 | 140 |
| 135 // Keep track of the tilings that were used so that tilings that are | 141 // Keep track of the tilings that were used so that tilings that are |
| 136 // unused can be considered for removal. | 142 // unused can be considered for removal. |
| 137 std::vector<PictureLayerTiling*> seen_tilings; | 143 std::vector<PictureLayerTiling*> seen_tilings; |
| 138 | 144 |
| 139 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), | 145 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), |
| 140 contentsScaleX(), | 146 contentsScaleX(), |
| 141 rect, | 147 rect, |
| 142 ideal_contents_scale_); | 148 ideal_contents_scale_, |
| 149 layerDeviceAlignment); | |
| 143 iter; | 150 iter; |
| 144 ++iter) { | 151 ++iter) { |
| 145 ResourceProvider::ResourceId resource = 0; | 152 ResourceProvider::ResourceId resource = 0; |
| 146 if (*iter) | 153 if (*iter) |
| 147 resource = iter->GetResourceId(); | 154 resource = iter->GetResourceId(); |
| 148 | 155 |
| 149 gfx::Rect geometry_rect = iter.geometry_rect(); | 156 gfx::Rect geometry_rect = iter.geometry_rect(); |
| 150 | 157 |
| 151 if (!resource) { | 158 if (!resource) { |
| 152 if (drawCheckerboardForMissingTiles()) { | 159 if (drawCheckerboardForMissingTiles()) { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 419 if (tilings_) | 426 if (tilings_) |
| 420 tilings_->RemoveAllTiles(); | 427 tilings_->RemoveAllTiles(); |
| 421 } | 428 } |
| 422 | 429 |
| 423 ResourceProvider::ResourceId PictureLayerImpl::contentsResourceId() const { | 430 ResourceProvider::ResourceId PictureLayerImpl::contentsResourceId() const { |
| 424 gfx::Rect content_rect(gfx::Point(), contentBounds()); | 431 gfx::Rect content_rect(gfx::Point(), contentBounds()); |
| 425 float scale = contentsScaleX(); | 432 float scale = contentsScaleX(); |
| 426 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), | 433 for (PictureLayerTilingSet::Iterator iter(tilings_.get(), |
| 427 scale, | 434 scale, |
| 428 content_rect, | 435 content_rect, |
| 429 ideal_contents_scale_); | 436 ideal_contents_scale_, |
| 437 PictureLayerTiling::LayerDeviceAlign mentUnknown); | |
| 430 iter; | 438 iter; |
| 431 ++iter) { | 439 ++iter) { |
| 432 // Mask resource not ready yet. | 440 // Mask resource not ready yet. |
| 433 if (!*iter || !iter->GetResourceId()) | 441 if (!*iter || !iter->GetResourceId()) |
| 434 return 0; | 442 return 0; |
| 435 // Masks only supported if they fit on exactly one tile. | 443 // Masks only supported if they fit on exactly one tile. |
| 436 if (iter.geometry_rect() != content_rect) | 444 if (iter.geometry_rect() != content_rect) |
| 437 return 0; | 445 return 0; |
| 438 return iter->GetResourceId(); | 446 return iter->GetResourceId(); |
| 439 } | 447 } |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 467 | 475 |
| 468 Region missing_region = rect; | 476 Region missing_region = rect; |
| 469 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 477 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 470 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 478 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 471 | 479 |
| 472 if (tiling->contents_scale() < min_acceptable_scale) | 480 if (tiling->contents_scale() < min_acceptable_scale) |
| 473 continue; | 481 continue; |
| 474 | 482 |
| 475 for (PictureLayerTiling::Iterator iter(tiling, | 483 for (PictureLayerTiling::Iterator iter(tiling, |
| 476 contentsScaleX(), | 484 contentsScaleX(), |
| 477 rect); | 485 rect, |
| 486 PictureLayerTiling::LayerDeviceAlignm entUnknown); | |
| 478 iter; | 487 iter; |
| 479 ++iter) { | 488 ++iter) { |
| 480 // A null tile (i.e. no recording) is considered "ready". | 489 // A null tile (i.e. no recording) is considered "ready". |
| 481 if (!*iter || iter->GetResourceId()) | 490 if (!*iter || iter->GetResourceId()) |
| 482 missing_region.Subtract(iter.geometry_rect()); | 491 missing_region.Subtract(iter.geometry_rect()); |
| 483 } | 492 } |
| 484 } | 493 } |
| 485 | 494 |
| 486 return missing_region.IsEmpty(); | 495 return missing_region.IsEmpty(); |
| 487 } | 496 } |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 713 return twin; | 722 return twin; |
| 714 } | 723 } |
| 715 | 724 |
| 716 void PictureLayerImpl::getDebugBorderProperties( | 725 void PictureLayerImpl::getDebugBorderProperties( |
| 717 SkColor* color, float* width) const { | 726 SkColor* color, float* width) const { |
| 718 *color = DebugColors::TiledContentLayerBorderColor(); | 727 *color = DebugColors::TiledContentLayerBorderColor(); |
| 719 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); | 728 *width = DebugColors::TiledContentLayerBorderWidth(layerTreeImpl()); |
| 720 } | 729 } |
| 721 | 730 |
| 722 } // namespace cc | 731 } // namespace cc |
| OLD | NEW |