| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/painted_scrollbar_layer.h" | 5 #include "cc/layers/painted_scrollbar_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "cc/base/math_util.h" | 10 #include "cc/base/math_util.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (has_thumb_) { | 163 if (has_thumb_) { |
| 164 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); | 164 UpdateProperty(scrollbar_->ThumbThickness(), &thumb_thickness_); |
| 165 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); | 165 UpdateProperty(scrollbar_->ThumbLength(), &thumb_length_); |
| 166 } else { | 166 } else { |
| 167 UpdateProperty(0, &thumb_thickness_); | 167 UpdateProperty(0, &thumb_thickness_); |
| 168 UpdateProperty(0, &thumb_length_); | 168 UpdateProperty(0, &thumb_length_); |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 | 171 |
| 172 void PaintedScrollbarLayer::UpdateInternalContentScale() { | 172 void PaintedScrollbarLayer::UpdateInternalContentScale() { |
| 173 float scale = GetLayerTree()->device_scale_factor(); | 173 float scale = layer_tree_host()->device_scale_factor(); |
| 174 if (layer_tree_host() | 174 if (layer_tree_host() |
| 175 ->GetSettings() | 175 ->GetSettings() |
| 176 .layer_transforms_should_scale_layer_contents) { | 176 .layer_transforms_should_scale_layer_contents) { |
| 177 gfx::Transform transform; | 177 gfx::Transform transform; |
| 178 transform = draw_property_utils::ScreenSpaceTransform( | 178 transform = draw_property_utils::ScreenSpaceTransform( |
| 179 this, GetLayerTree()->property_trees()->transform_tree); | 179 this, layer_tree_host()->property_trees()->transform_tree); |
| 180 | 180 |
| 181 gfx::Vector2dF transform_scales = | 181 gfx::Vector2dF transform_scales = |
| 182 MathUtil::ComputeTransform2dScaleComponents(transform, scale); | 182 MathUtil::ComputeTransform2dScaleComponents(transform, scale); |
| 183 scale = std::max(transform_scales.x(), transform_scales.y()); | 183 scale = std::max(transform_scales.x(), transform_scales.y()); |
| 184 } | 184 } |
| 185 bool changed = false; | 185 bool changed = false; |
| 186 changed |= UpdateProperty(scale, &internal_contents_scale_); | 186 changed |= UpdateProperty(scale, &internal_contents_scale_); |
| 187 changed |= | 187 changed |= |
| 188 UpdateProperty(gfx::ScaleToCeiledSize(bounds(), internal_contents_scale_), | 188 UpdateProperty(gfx::ScaleToCeiledSize(bounds(), internal_contents_scale_), |
| 189 &internal_content_bounds_); | 189 &internal_content_bounds_); |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 | 284 |
| 285 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 285 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
| 286 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 286 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
| 287 // allocation and copying. | 287 // allocation and copying. |
| 288 skbitmap.setImmutable(); | 288 skbitmap.setImmutable(); |
| 289 | 289 |
| 290 return UIResourceBitmap(skbitmap); | 290 return UIResourceBitmap(skbitmap); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // namespace cc | 293 } // namespace cc |
| OLD | NEW |