Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(25)

Side by Side Diff: cc/test/fake_scrollbar.cc

Issue 2640983002: Rename paint data structures (Closed)
Patch Set: DrawingDisplayItem Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_scrollbar.h ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "third_party/skia/include/core/SkCanvas.h"
8 #include "ui/gfx/skia_util.h" 7 #include "ui/gfx/skia_util.h"
9 8
10 namespace cc { 9 namespace cc {
11 10
12 FakeScrollbar::FakeScrollbar() 11 FakeScrollbar::FakeScrollbar()
13 : FakeScrollbar(false, false, HORIZONTAL, false, false) {} 12 : FakeScrollbar(false, false, HORIZONTAL, false, false) {}
14 13
15 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay) 14 FakeScrollbar::FakeScrollbar(bool paint, bool has_thumb, bool is_overlay)
16 : FakeScrollbar(paint, has_thumb, HORIZONTAL, false, is_overlay) {} 15 : FakeScrollbar(paint, has_thumb, HORIZONTAL, false, is_overlay) {}
17 16
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 float FakeScrollbar::ThumbOpacity() const { 63 float FakeScrollbar::ThumbOpacity() const {
65 return thumb_opacity_; 64 return thumb_opacity_;
66 } 65 }
67 66
68 bool FakeScrollbar::NeedsPaintPart(ScrollbarPart part) const { 67 bool FakeScrollbar::NeedsPaintPart(ScrollbarPart part) const {
69 if (part == THUMB) 68 if (part == THUMB)
70 return needs_paint_thumb_; 69 return needs_paint_thumb_;
71 return needs_paint_track_; 70 return needs_paint_track_;
72 } 71 }
73 72
74 void FakeScrollbar::PaintPart(SkCanvas* canvas, 73 void FakeScrollbar::PaintPart(PaintCanvas* canvas,
75 ScrollbarPart part, 74 ScrollbarPart part,
76 const gfx::Rect& content_rect) { 75 const gfx::Rect& content_rect) {
77 if (!paint_) 76 if (!paint_)
78 return; 77 return;
79 78
80 // Fill the scrollbar with a different color each time. 79 // Fill the scrollbar with a different color each time.
81 fill_color_++; 80 fill_color_++;
82 SkPaint paint; 81 SkPaint paint;
83 paint.setAntiAlias(false); 82 paint.setAntiAlias(false);
84 paint.setColor(paint_fill_color()); 83 paint.setColor(paint_fill_color());
85 paint.setStyle(SkPaint::kFill_Style); 84 paint.setStyle(SkPaint::kFill_Style);
86 85
87 // Emulate the how the real scrollbar works by using scrollbar's rect for 86 // Emulate the how the real scrollbar works by using scrollbar's rect for
88 // TRACK and the given content_rect for the THUMB 87 // TRACK and the given content_rect for the THUMB
89 SkRect rect = part == TRACK ? RectToSkRect(TrackRect()) 88 SkRect rect = part == TRACK ? RectToSkRect(TrackRect())
90 : RectToSkRect(content_rect); 89 : RectToSkRect(content_rect);
91 canvas->drawRect(rect, paint); 90 canvas->drawRect(rect, paint);
92 } 91 }
93 92
94 } // namespace cc 93 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/fake_scrollbar.h ('k') | cc/test/skia_common.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698