| 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" |
| 11 #include "cc/input/main_thread_scrolling_reason.h" | 11 #include "cc/input/main_thread_scrolling_reason.h" |
| 12 #include "cc/layers/painted_scrollbar_layer_impl.h" | 12 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 13 #include "cc/resources/ui_resource_bitmap.h" | 13 #include "cc/resources/ui_resource_bitmap.h" |
| 14 #include "cc/trees/draw_property_utils.h" | 14 #include "cc/trees/draw_property_utils.h" |
| 15 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
| 16 #include "cc/trees/layer_tree_impl.h" | 16 #include "cc/trees/layer_tree_impl.h" |
| 17 #include "skia/ext/platform_canvas.h" | 17 #include "skia/ext/platform_canvas.h" |
| 18 #include "third_party/skia/include/core/SkBitmap.h" | 18 #include "third_party/skia/include/core/SkBitmap.h" |
| 19 #include "third_party/skia/include/core/SkCanvas.h" | 19 #include "third_party/skia/include/core/SkCanvas.h" |
| 20 #include "third_party/skia/include/core/SkSize.h" | 20 #include "third_party/skia/include/core/SkSize.h" |
| 21 #include "ui/gfx/geometry/size_conversions.h" | 21 #include "ui/gfx/geometry/size_conversions.h" |
| 22 #include "ui/gfx/skia_util.h" | 22 #include "ui/gfx/skia_util.h" |
| 23 | 23 |
| 24 namespace cc { | 24 namespace cc { |
| 25 | 25 |
| 26 std::unique_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( | 26 std::unique_ptr<LayerImpl> PaintedScrollbarLayer::CreateLayerImpl( |
| 27 LayerTreeImpl* tree_impl) { | 27 LayerTreeImpl* tree_impl) { |
| 28 return PaintedScrollbarLayerImpl::Create( | 28 return PaintedScrollbarLayerImpl::Create( |
| 29 tree_impl, id(), scrollbar_->Orientation()); | 29 tree_impl, id(), scrollbar_->Orientation(), |
| 30 scrollbar_->IsLeftSideVerticalScrollbar(), scrollbar_->IsOverlay()); |
| 30 } | 31 } |
| 31 | 32 |
| 32 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( | 33 scoped_refptr<PaintedScrollbarLayer> PaintedScrollbarLayer::Create( |
| 33 std::unique_ptr<Scrollbar> scrollbar, | 34 std::unique_ptr<Scrollbar> scrollbar, |
| 34 int scroll_layer_id) { | 35 int scroll_layer_id) { |
| 35 return make_scoped_refptr( | 36 return make_scoped_refptr( |
| 36 new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id)); | 37 new PaintedScrollbarLayer(std::move(scrollbar), scroll_layer_id)); |
| 37 } | 38 } |
| 38 | 39 |
| 39 PaintedScrollbarLayer::PaintedScrollbarLayer( | 40 PaintedScrollbarLayer::PaintedScrollbarLayer( |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 | 284 |
| 284 scrollbar_->PaintPart(&skcanvas, part, layer_rect); | 285 scrollbar_->PaintPart(&skcanvas, part, layer_rect); |
| 285 // 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 |
| 286 // allocation and copying. | 287 // allocation and copying. |
| 287 skbitmap.setImmutable(); | 288 skbitmap.setImmutable(); |
| 288 | 289 |
| 289 return UIResourceBitmap(skbitmap); | 290 return UIResourceBitmap(skbitmap); |
| 290 } | 291 } |
| 291 | 292 |
| 292 } // namespace cc | 293 } // namespace cc |
| OLD | NEW |