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/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/numerics/safe_conversions.h" | 8 #include "base/numerics/safe_conversions.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
523 } | 523 } |
524 | 524 |
525 scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) { | 525 scoped_ptr<LayerImpl> LayerImpl::CreateLayerImpl(LayerTreeImpl* tree_impl) { |
526 return LayerImpl::Create(tree_impl, layer_id_, scroll_offset_); | 526 return LayerImpl::Create(tree_impl, layer_id_, scroll_offset_); |
527 } | 527 } |
528 | 528 |
529 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { | 529 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
530 layer->SetTransformOrigin(transform_origin_); | 530 layer->SetTransformOrigin(transform_origin_); |
531 layer->SetBackgroundColor(background_color_); | 531 layer->SetBackgroundColor(background_color_); |
532 layer->SetBounds(bounds_); | 532 layer->SetBounds(bounds_); |
533 layer->SetContentBounds(bounds_); | |
534 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 533 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
535 layer->SetDoubleSided(double_sided_); | 534 layer->SetDoubleSided(double_sided_); |
536 layer->SetDrawCheckerboardForMissingTiles( | 535 layer->SetDrawCheckerboardForMissingTiles( |
537 draw_checkerboard_for_missing_tiles_); | 536 draw_checkerboard_for_missing_tiles_); |
538 layer->SetDrawsContent(DrawsContent()); | 537 layer->SetDrawsContent(DrawsContent()); |
539 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 538 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
540 layer->SetHasRenderSurface(!!render_surface()); | 539 layer->SetHasRenderSurface(!!render_surface()); |
541 layer->SetFilters(filters()); | 540 layer->SetFilters(filters()); |
542 layer->SetBackgroundFilters(background_filters()); | 541 layer->SetBackgroundFilters(background_filters()); |
543 layer->SetMasksToBounds(masks_to_bounds_); | 542 layer->SetMasksToBounds(masks_to_bounds_); |
(...skipping 597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 | 1140 |
1142 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { | 1141 void LayerImpl::SetUpdateRect(const gfx::Rect& update_rect) { |
1143 update_rect_ = update_rect; | 1142 update_rect_ = update_rect; |
1144 SetNeedsPushProperties(); | 1143 SetNeedsPushProperties(); |
1145 } | 1144 } |
1146 | 1145 |
1147 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { | 1146 void LayerImpl::AddDamageRect(const gfx::RectF& damage_rect) { |
1148 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); | 1147 damage_rect_ = gfx::UnionRects(damage_rect_, damage_rect); |
1149 } | 1148 } |
1150 | 1149 |
1151 // TODO(danakj): Remove this after impl_side_painting. | |
1152 void LayerImpl::SetContentBounds(const gfx::Size& content_bounds) { | |
1153 } | |
1154 | |
1155 void LayerImpl::SetContentsScale(float contents_scale_x, | 1150 void LayerImpl::SetContentsScale(float contents_scale_x, |
1156 float contents_scale_y) { | 1151 float contents_scale_y) { |
1157 if (this->contents_scale_x() == contents_scale_x && | 1152 if (this->contents_scale_x() == contents_scale_x && |
1158 this->contents_scale_y() == contents_scale_y) | 1153 this->contents_scale_y() == contents_scale_y) |
1159 return; | 1154 return; |
1160 | 1155 |
1161 draw_properties_.contents_scale_x = contents_scale_x; | 1156 draw_properties_.contents_scale_x = contents_scale_x; |
1162 draw_properties_.contents_scale_y = contents_scale_y; | 1157 draw_properties_.contents_scale_y = contents_scale_y; |
1163 NoteLayerPropertyChanged(); | 1158 NoteLayerPropertyChanged(); |
1164 } | 1159 } |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1692 gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const { | 1687 gfx::Rect LayerImpl::GetScaledEnclosingRectInTargetSpace(float scale) const { |
1693 gfx::Transform scaled_draw_transform = | 1688 gfx::Transform scaled_draw_transform = |
1694 draw_properties_.target_space_transform; | 1689 draw_properties_.target_space_transform; |
1695 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1690 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1696 gfx::Size scaled_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale)); | 1691 gfx::Size scaled_bounds = gfx::ToCeiledSize(gfx::ScaleSize(bounds(), scale)); |
1697 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1692 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1698 gfx::Rect(scaled_bounds)); | 1693 gfx::Rect(scaled_bounds)); |
1699 } | 1694 } |
1700 | 1695 |
1701 } // namespace cc | 1696 } // namespace cc |
OLD | NEW |