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

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

Issue 150603004: Fixed rounding issue on scrollbar rasterization. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« cc/test/fake_scrollbar.h ('K') | « cc/test/fake_scrollbar.h ('k') | no next file » | 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" 7 #include "third_party/skia/include/core/SkCanvas.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 : paint_(false), 13 : paint_(false),
13 has_thumb_(false), 14 has_thumb_(false),
14 is_overlay_(false), 15 is_overlay_(false),
15 thumb_thickness_(10), 16 thumb_thickness_(10),
16 thumb_length_(5), 17 thumb_length_(5),
17 track_rect_(0, 0, 100, 10), 18 track_rect_(0, 0, 100, 10),
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 } 56 }
56 57
57 void FakeScrollbar::PaintPart(SkCanvas* canvas, 58 void FakeScrollbar::PaintPart(SkCanvas* canvas,
58 ScrollbarPart part, 59 ScrollbarPart part,
59 const gfx::Rect& content_rect) { 60 const gfx::Rect& content_rect) {
60 if (!paint_) 61 if (!paint_)
61 return; 62 return;
62 63
63 // Fill the scrollbar with a different color each time. 64 // Fill the scrollbar with a different color each time.
64 fill_color_++; 65 fill_color_++;
65 canvas->clear(SK_ColorBLACK | fill_color_); 66
67 if (part == TRACK) {
68 SkPaint paint;
69 paint.setAntiAlias(false);
70 paint.setColor(get_color());
71 paint.setStyle(SkPaint::kFill_Style);
72 canvas->drawRect(RectToSkRect(TrackRect()), paint);
danakj 2014/02/18 20:43:30 Hm.. why isn't this able to just paint the |conten
bokan 2014/02/18 21:48:15 The real ScrollbarImpl's PaintPart method only use
73 } else {
74 canvas->clear(get_color());
75 }
66 } 76 }
67 77
68 } // namespace cc 78 } // namespace cc
OLDNEW
« cc/test/fake_scrollbar.h ('K') | « cc/test/fake_scrollbar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698