OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "cc/input/scrollbar.h" | 9 #include "cc/input/scrollbar.h" |
10 #include "cc/layers/painted_scrollbar_layer.h" | 10 #include "cc/layers/painted_scrollbar_layer.h" |
11 #include "cc/layers/solid_color_layer.h" | 11 #include "cc/layers/solid_color_layer.h" |
| 12 #include "cc/paint/paint_canvas.h" |
| 13 #include "cc/paint/paint_flags.h" |
12 #include "cc/test/layer_tree_pixel_test.h" | 14 #include "cc/test/layer_tree_pixel_test.h" |
13 #include "cc/test/test_in_process_context_provider.h" | 15 #include "cc/test/test_in_process_context_provider.h" |
14 #include "gpu/command_buffer/client/gles2_interface.h" | 16 #include "gpu/command_buffer/client/gles2_interface.h" |
15 | 17 |
16 #if !defined(OS_ANDROID) | 18 #if !defined(OS_ANDROID) |
17 | 19 |
18 namespace cc { | 20 namespace cc { |
19 namespace { | 21 namespace { |
20 | 22 |
21 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest { | 23 class LayerTreeHostScrollbarsPixelTest : public LayerTreePixelTest { |
(...skipping 19 matching lines...) Expand all Loading... |
41 ScrollbarOrientation Orientation() const override { return VERTICAL; } | 43 ScrollbarOrientation Orientation() const override { return VERTICAL; } |
42 bool IsLeftSideVerticalScrollbar() const override { return false; } | 44 bool IsLeftSideVerticalScrollbar() const override { return false; } |
43 gfx::Point Location() const override { return gfx::Point(); } | 45 gfx::Point Location() const override { return gfx::Point(); } |
44 bool IsOverlay() const override { return false; } | 46 bool IsOverlay() const override { return false; } |
45 bool HasThumb() const override { return thumb_; } | 47 bool HasThumb() const override { return thumb_; } |
46 int ThumbThickness() const override { return rect_.width(); } | 48 int ThumbThickness() const override { return rect_.width(); } |
47 int ThumbLength() const override { return rect_.height(); } | 49 int ThumbLength() const override { return rect_.height(); } |
48 gfx::Rect TrackRect() const override { return rect_; } | 50 gfx::Rect TrackRect() const override { return rect_; } |
49 float ThumbOpacity() const override { return 1.f; } | 51 float ThumbOpacity() const override { return 1.f; } |
50 bool NeedsPaintPart(ScrollbarPart part) const override { return true; } | 52 bool NeedsPaintPart(ScrollbarPart part) const override { return true; } |
51 void PaintPart(SkCanvas* canvas, | 53 void PaintPart(PaintCanvas* canvas, |
52 ScrollbarPart part, | 54 ScrollbarPart part, |
53 const gfx::Rect& content_rect) override { | 55 const gfx::Rect& content_rect) override { |
54 SkPaint paint; | 56 PaintFlags paint; |
55 paint.setStyle(SkPaint::kStroke_Style); | 57 paint.setStyle(PaintFlags::kStroke_Style); |
56 paint.setStrokeWidth(SkIntToScalar(paint_scale_)); | 58 paint.setStrokeWidth(SkIntToScalar(paint_scale_)); |
57 paint.setColor(color_); | 59 paint.setColor(color_); |
58 | 60 |
59 gfx::Rect inset_rect = content_rect; | 61 gfx::Rect inset_rect = content_rect; |
60 while (!inset_rect.IsEmpty()) { | 62 while (!inset_rect.IsEmpty()) { |
61 int big = paint_scale_ + 2; | 63 int big = paint_scale_ + 2; |
62 int small = paint_scale_; | 64 int small = paint_scale_; |
63 inset_rect.Inset(big, big, small, small); | 65 inset_rect.Inset(big, big, small, small); |
64 canvas->drawRect(RectToSkRect(inset_rect), paint); | 66 canvas->drawRect(RectToSkRect(inset_rect), paint); |
65 inset_rect.Inset(big, big, small, small); | 67 inset_rect.Inset(big, big, small, small); |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 layer->SetTransform(scale_transform); | 165 layer->SetTransform(scale_transform); |
164 | 166 |
165 RunPixelTest(PIXEL_TEST_GL, background, | 167 RunPixelTest(PIXEL_TEST_GL, background, |
166 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); | 168 base::FilePath(FILE_PATH_LITERAL("spiral_64_scale.png"))); |
167 } | 169 } |
168 | 170 |
169 } // namespace | 171 } // namespace |
170 } // namespace cc | 172 } // namespace cc |
171 | 173 |
172 #endif // OS_ANDROID | 174 #endif // OS_ANDROID |
OLD | NEW |