| 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/test/fake_scrollbar.h" | 5 #include "cc/test/fake_scrollbar.h" |
| 6 | 6 |
| 7 #include "cc/paint/paint_flags.h" |
| 7 #include "ui/gfx/skia_util.h" | 8 #include "ui/gfx/skia_util.h" |
| 8 | 9 |
| 9 namespace cc { | 10 namespace cc { |
| 10 | 11 |
| 11 FakeScrollbar::FakeScrollbar() | 12 FakeScrollbar::FakeScrollbar() |
| 12 : FakeScrollbar(false, false, HORIZONTAL, false, false) {} | 13 : FakeScrollbar(false, false, HORIZONTAL, false, false) {} |
| 13 | 14 |
| 14 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay) | 15 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay) |
| 15 : FakeScrollbar(paint, has_thumb, HORIZONTAL, false, is_overlay) {} | 16 : FakeScrollbar(paint, has_thumb, HORIZONTAL, false, is_overlay) {} |
| 16 | 17 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 72 } |
| 72 | 73 |
| 73 void FakeScrollbar::PaintPart(PaintCanvas* canvas, | 74 void FakeScrollbar::PaintPart(PaintCanvas* canvas, |
| 74 ScrollbarPart part, | 75 ScrollbarPart part, |
| 75 const gfx::Rect& content_rect) { | 76 const gfx::Rect& content_rect) { |
| 76 if (!paint_) | 77 if (!paint_) |
| 77 return; | 78 return; |
| 78 | 79 |
| 79 // Fill the scrollbar with a different color each time. | 80 // Fill the scrollbar with a different color each time. |
| 80 fill_color_++; | 81 fill_color_++; |
| 81 SkPaint paint; | 82 PaintFlags flags; |
| 82 paint.setAntiAlias(false); | 83 flags.setAntiAlias(false); |
| 83 paint.setColor(paint_fill_color()); | 84 flags.setColor(paint_fill_color()); |
| 84 paint.setStyle(SkPaint::kFill_Style); | 85 flags.setStyle(PaintFlags::kFill_Style); |
| 85 | 86 |
| 86 // Emulate the how the real scrollbar works by using scrollbar's rect for | 87 // Emulate the how the real scrollbar works by using scrollbar's rect for |
| 87 // TRACK and the given content_rect for the THUMB | 88 // TRACK and the given content_rect for the THUMB |
| 88 SkRect rect = part == TRACK ? RectToSkRect(TrackRect()) | 89 SkRect rect = part == TRACK ? RectToSkRect(TrackRect()) |
| 89 : RectToSkRect(content_rect); | 90 : RectToSkRect(content_rect); |
| 90 canvas->drawRect(rect, paint); | 91 canvas->drawRect(rect, flags); |
| 91 } | 92 } |
| 92 | 93 |
| 93 } // namespace cc | 94 } // namespace cc |
| OLD | NEW |