OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 pictureBuilder.endRecording()->playback(canvas); | 59 pictureBuilder.endRecording()->playback(canvas); |
60 } | 60 } |
61 | 61 |
62 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) | 62 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) |
63 { | 63 { |
64 IntRect intRect(rect); | 64 IntRect intRect(rect); |
65 SkPictureBuilder pictureBuilder(intRect); | 65 SkPictureBuilder pictureBuilder(intRect); |
66 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 66 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
67 m_theme->paintTrackBackground(pictureBuilder.context(), *m_scrollbar, intRec
t); | 67 m_theme->paintTrackBackground(pictureBuilder.context(), *m_scrollbar, intRec
t); |
68 pictureBuilder.endRecording()->playback(canvas); | 68 pictureBuilder.endRecording()->playback(canvas); |
69 m_scrollbar->setTrackNeedsRepaint(false); | 69 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) |
| 70 m_scrollbar->setTrackNeedsRepaint(false); |
70 } | 71 } |
71 | 72 |
72 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) | 73 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) |
73 { | 74 { |
74 IntRect intRect(rect); | 75 IntRect intRect(rect); |
75 SkPictureBuilder pictureBuilder(intRect); | 76 SkPictureBuilder pictureBuilder(intRect); |
76 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 77 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
77 m_theme->paintTrackPiece(pictureBuilder.context(), *m_scrollbar, intRect, Ba
ckTrackPart); | 78 m_theme->paintTrackPiece(pictureBuilder.context(), *m_scrollbar, intRect, Ba
ckTrackPart); |
78 pictureBuilder.endRecording()->playback(canvas); | 79 pictureBuilder.endRecording()->playback(canvas); |
79 } | 80 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 pictureBuilder.endRecording()->playback(canvas); | 133 pictureBuilder.endRecording()->playback(canvas); |
133 } | 134 } |
134 | 135 |
135 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) | 136 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) |
136 { | 137 { |
137 IntRect intRect(rect); | 138 IntRect intRect(rect); |
138 SkPictureBuilder pictureBuilder(intRect); | 139 SkPictureBuilder pictureBuilder(intRect); |
139 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 140 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
140 m_theme->paintThumb(pictureBuilder.context(), *m_scrollbar, intRect); | 141 m_theme->paintThumb(pictureBuilder.context(), *m_scrollbar, intRect); |
141 pictureBuilder.endRecording()->playback(canvas); | 142 pictureBuilder.endRecording()->playback(canvas); |
142 m_scrollbar->setThumbNeedsRepaint(false); | 143 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) |
| 144 m_scrollbar->setThumbNeedsRepaint(false); |
143 } | 145 } |
144 | 146 |
145 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme, Scroll
bar& scrollbar, float deviceScaleFactor) | 147 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme, Scroll
bar& scrollbar, float deviceScaleFactor) |
146 : m_theme(&theme) | 148 : m_theme(&theme) |
147 , m_scrollbar(&scrollbar) | 149 , m_scrollbar(&scrollbar) |
148 , m_deviceScaleFactor(deviceScaleFactor) | 150 , m_deviceScaleFactor(deviceScaleFactor) |
149 { | 151 { |
150 } | 152 } |
151 | 153 |
152 float WebScrollbarThemePainter::thumbOpacity() const | 154 float WebScrollbarThemePainter::thumbOpacity() const |
153 { | 155 { |
154 return m_theme->thumbOpacity(*m_scrollbar); | 156 return m_theme->thumbOpacity(*m_scrollbar); |
155 } | 157 } |
156 | 158 |
157 bool WebScrollbarThemePainter::trackNeedsRepaint() const | 159 bool WebScrollbarThemePainter::trackNeedsRepaint() const |
158 { | 160 { |
159 return m_scrollbar->trackNeedsRepaint(); | 161 return m_scrollbar->trackNeedsRepaint(); |
160 } | 162 } |
161 | 163 |
162 bool WebScrollbarThemePainter::thumbNeedsRepaint() const | 164 bool WebScrollbarThemePainter::thumbNeedsRepaint() const |
163 { | 165 { |
164 return m_scrollbar->thumbNeedsRepaint(); | 166 return m_scrollbar->thumbNeedsRepaint(); |
165 } | 167 } |
166 | 168 |
167 } // namespace blink | 169 } // namespace blink |
OLD | NEW |