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.h" | 5 #include "cc/picture_layer.h" |
6 | 6 |
7 #include "cc/layer_tree_impl.h" | 7 #include "cc/layer_tree_impl.h" |
8 #include "cc/picture_layer_impl.h" | 8 #include "cc/picture_layer_impl.h" |
9 #include "ui/gfx/rect_conversions.h" | 9 #include "ui/gfx/rect_conversions.h" |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... | |
39 layer_impl->CreateTilingSet(); | 39 layer_impl->CreateTilingSet(); |
40 layer_impl->invalidation_.Clear(); | 40 layer_impl->invalidation_.Clear(); |
41 layer_impl->invalidation_.Swap(pile_invalidation_); | 41 layer_impl->invalidation_.Swap(pile_invalidation_); |
42 pile_->PushPropertiesTo(layer_impl->pile_); | 42 pile_->PushPropertiesTo(layer_impl->pile_); |
43 | 43 |
44 layer_impl->SyncFromActiveLayer(); | 44 layer_impl->SyncFromActiveLayer(); |
45 } | 45 } |
46 | 46 |
47 void PictureLayer::setLayerTreeHost(LayerTreeHost* host) { | 47 void PictureLayer::setLayerTreeHost(LayerTreeHost* host) { |
48 Layer::setLayerTreeHost(host); | 48 Layer::setLayerTreeHost(host); |
49 if (host) | 49 if (host) { |
50 pile_->SetMinContentsScale(host->settings().minimumContentsScale); | 50 pile_->SetMinContentsScale(host->settings().minimumContentsScale); |
51 gfx::Size tile_size = host->settings().defaultTileSize; | |
52 float scale = host->deviceScaleFactor(); | |
53 gfx::Size tile_grid_size( | |
54 static_cast<int>(ceil(tile_size.width() / scale)), | |
55 static_cast<int>(ceil(tile_size.height() / scale))); | |
56 int border_pixels = static_cast<int>(ceil(1.0f / scale)); | |
enne (OOO)
2013/02/21 18:23:13
I agree that the border pixels are scaled as well,
| |
57 pile_->SetTileGridSize(tile_grid_size, border_pixels); | |
58 } | |
51 } | 59 } |
52 | 60 |
53 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { | 61 void PictureLayer::setNeedsDisplayRect(const gfx::RectF& layer_rect) { |
54 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); | 62 gfx::Rect rect = gfx::ToEnclosedRect(layer_rect); |
55 if (!rect.IsEmpty()) { | 63 if (!rect.IsEmpty()) { |
56 // Clamp invalidation to the layer bounds. | 64 // Clamp invalidation to the layer bounds. |
57 rect.Intersect(gfx::Rect(bounds())); | 65 rect.Intersect(gfx::Rect(bounds())); |
58 pending_invalidation_.Union(rect); | 66 pending_invalidation_.Union(rect); |
59 } | 67 } |
60 Layer::setNeedsDisplayRect(layer_rect); | 68 Layer::setNeedsDisplayRect(layer_rect); |
(...skipping 14 matching lines...) Expand all Loading... | |
75 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( | 83 gfx::Rect visible_layer_rect = gfx::ToEnclosingRect( |
76 gfx::ScaleRect(visibleContentRect(), 1.f / contentsScaleX())); | 84 gfx::ScaleRect(visibleContentRect(), 1.f / contentsScaleX())); |
77 pile_->Update(client_, pile_invalidation_, visible_layer_rect, stats); | 85 pile_->Update(client_, pile_invalidation_, visible_layer_rect, stats); |
78 } | 86 } |
79 | 87 |
80 void PictureLayer::setIsMask(bool is_mask) { | 88 void PictureLayer::setIsMask(bool is_mask) { |
81 is_mask_ = is_mask; | 89 is_mask_ = is_mask; |
82 } | 90 } |
83 | 91 |
84 } // namespace cc | 92 } // namespace cc |
OLD | NEW |