| 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 "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 namespace cc { | 26 namespace cc { |
| 27 | 27 |
| 28 scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( | 28 scoped_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( |
| 29 LayerTreeImpl* tree_impl) { | 29 LayerTreeImpl* tree_impl) { |
| 30 return PaintedScrollbarLayerImpl::Create( | 30 return PaintedScrollbarLayerImpl::Create( |
| 31 tree_impl, id(), scrollbar_->Orientation()); | 31 tree_impl, id(), scrollbar_->Orientation()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( | 34 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( |
| 35 const LayerSettings& settings, |
| 35 scoped_ptr<Scrollbar> scrollbar, | 36 scoped_ptr<Scrollbar> scrollbar, |
| 36 int scroll_layer_id) { | 37 int scroll_layer_id) { |
| 37 return make_scoped_refptr( | 38 return make_scoped_refptr( |
| 38 new PaintedScrollbarLayer(scrollbar.Pass(), scroll_layer_id)); | 39 new PaintedScrollbarLayer(settings, scrollbar.Pass(), scroll_layer_id)); |
| 39 } | 40 } |
| 40 | 41 |
| 41 PaintedScrollbarLayer::PaintedScrollbarLayer(scoped_ptr<Scrollbar> scrollbar, | 42 PaintedScrollbarLayer::PaintedScrollbarLayer(const LayerSettings& settings, |
| 43 scoped_ptr<Scrollbar> scrollbar, |
| 42 int scroll_layer_id) | 44 int scroll_layer_id) |
| 43 : scrollbar_(scrollbar.Pass()), | 45 : Layer(settings), |
| 46 scrollbar_(scrollbar.Pass()), |
| 44 scroll_layer_id_(scroll_layer_id), | 47 scroll_layer_id_(scroll_layer_id), |
| 45 clip_layer_id_(Layer::INVALID_ID), | 48 clip_layer_id_(Layer::INVALID_ID), |
| 46 internal_contents_scale_(0.f), | 49 internal_contents_scale_(0.f), |
| 47 thumb_thickness_(scrollbar_->ThumbThickness()), | 50 thumb_thickness_(scrollbar_->ThumbThickness()), |
| 48 thumb_length_(scrollbar_->ThumbLength()), | 51 thumb_length_(scrollbar_->ThumbLength()), |
| 49 is_overlay_(scrollbar_->IsOverlay()), | 52 is_overlay_(scrollbar_->IsOverlay()), |
| 50 has_thumb_(scrollbar_->HasThumb()) { | 53 has_thumb_(scrollbar_->HasThumb()) { |
| 51 if (!scrollbar_->IsOverlay()) | 54 if (!scrollbar_->IsOverlay()) |
| 52 SetShouldScrollOnMainThread(true); | 55 SetShouldScrollOnMainThread(true); |
| 53 } | 56 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 316 |
| 314 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 317 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
| 315 // Make sure that the pixels are no longer mutable to unavoid unnecessary | 318 // Make sure that the pixels are no longer mutable to unavoid unnecessary |
| 316 // allocation and copying. | 319 // allocation and copying. |
| 317 skbitmap.setImmutable(); | 320 skbitmap.setImmutable(); |
| 318 | 321 |
| 319 return UIResourceBitmap(skbitmap); | 322 return UIResourceBitmap(skbitmap); |
| 320 } | 323 } |
| 321 | 324 |
| 322 } // namespace cc | 325 } // namespace cc |
| OLD | NEW |