| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 pictureBuilder.endRecording()->playback(canvas); | 61 pictureBuilder.endRecording()->playback(canvas); |
| 62 } | 62 } |
| 63 | 63 |
| 64 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) | 64 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, const Web
Rect& rect) |
| 65 { | 65 { |
| 66 IntRect intRect(rect); | 66 IntRect intRect(rect); |
| 67 SkPictureBuilder pictureBuilder(intRect); | 67 SkPictureBuilder pictureBuilder(intRect); |
| 68 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 68 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
| 69 m_theme->paintTrackBackground(&pictureBuilder.context(), m_scrollbar.get(),
intRect); | 69 m_theme->paintTrackBackground(&pictureBuilder.context(), m_scrollbar.get(),
intRect); |
| 70 pictureBuilder.endRecording()->playback(canvas); | 70 pictureBuilder.endRecording()->playback(canvas); |
| 71 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) |
| 72 m_scrollbar->setTrackNeedsRepaint(false); |
| 71 } | 73 } |
| 72 | 74 |
| 73 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) | 75 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, const WebRe
ct& rect) |
| 74 { | 76 { |
| 75 IntRect intRect(rect); | 77 IntRect intRect(rect); |
| 76 SkPictureBuilder pictureBuilder(intRect); | 78 SkPictureBuilder pictureBuilder(intRect); |
| 77 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 79 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
| 78 m_theme->paintTrackPiece(&pictureBuilder.context(), m_scrollbar.get(), intRe
ct, BackTrackPart); | 80 m_theme->paintTrackPiece(&pictureBuilder.context(), m_scrollbar.get(), intRe
ct, BackTrackPart); |
| 79 pictureBuilder.endRecording()->playback(canvas); | 81 pictureBuilder.endRecording()->playback(canvas); |
| 80 } | 82 } |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 pictureBuilder.endRecording()->playback(canvas); | 135 pictureBuilder.endRecording()->playback(canvas); |
| 134 } | 136 } |
| 135 | 137 |
| 136 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) | 138 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, const WebRect& rect
) |
| 137 { | 139 { |
| 138 IntRect intRect(rect); | 140 IntRect intRect(rect); |
| 139 SkPictureBuilder pictureBuilder(intRect); | 141 SkPictureBuilder pictureBuilder(intRect); |
| 140 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); | 142 pictureBuilder.context().setDeviceScaleFactor(m_deviceScaleFactor); |
| 141 m_theme->paintThumb(&pictureBuilder.context(), m_scrollbar.get(), intRect); | 143 m_theme->paintThumb(&pictureBuilder.context(), m_scrollbar.get(), intRect); |
| 142 pictureBuilder.endRecording()->playback(canvas); | 144 pictureBuilder.endRecording()->playback(canvas); |
| 145 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) |
| 146 m_scrollbar->setThumbNeedsRepaint(false); |
| 143 } | 147 } |
| 144 | 148 |
| 145 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme* theme, Scroll
bar* scrollbar, float deviceScaleFactor) | 149 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme* theme, Scroll
bar* scrollbar, float deviceScaleFactor) |
| 146 : m_theme(theme) | 150 : m_theme(theme) |
| 147 , m_scrollbar(scrollbar) | 151 , m_scrollbar(scrollbar) |
| 148 , m_deviceScaleFactor(deviceScaleFactor) | 152 , m_deviceScaleFactor(deviceScaleFactor) |
| 149 { | 153 { |
| 150 } | 154 } |
| 151 | 155 |
| 156 float WebScrollbarThemePainter::thumbOpacity() const |
| 157 { |
| 158 return m_theme->thumbOpacity(m_scrollbar.get()); |
| 159 } |
| 160 |
| 161 bool WebScrollbarThemePainter::trackNeedsRepaint() const |
| 162 { |
| 163 return m_scrollbar->trackNeedsRepaint(); |
| 164 } |
| 165 |
| 166 bool WebScrollbarThemePainter::thumbNeedsRepaint() const |
| 167 { |
| 168 return m_scrollbar->thumbNeedsRepaint(); |
| 169 } |
| 170 |
| 152 } // namespace blink | 171 } // namespace blink |
| OLD | NEW |