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

Side by Side Diff: third_party/WebKit/Source/platform/exported/WebScrollbarThemePainter.cpp

Issue 2690583002: Make cc/paint have concrete types (Closed)
Patch Set: PaintRecord as typedef, fixup playback calls Created 3 years, 9 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
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 47
48 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas, 48 void WebScrollbarThemePainter::paintScrollbarBackground(WebCanvas* canvas,
49 const WebRect& rect) { 49 const WebRect& rect) {
50 SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height); 50 SkRect clip = SkRect::MakeXYWH(rect.x, rect.y, rect.width, rect.height);
51 canvas->clipRect(clip); 51 canvas->clipRect(clip);
52 52
53 IntRect intRect(rect); 53 IntRect intRect(rect);
54 PaintRecordBuilder builder(intRect); 54 PaintRecordBuilder builder(intRect);
55 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 55 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
56 m_theme->paintScrollbarBackground(builder.context(), *m_scrollbar); 56 m_theme->paintScrollbarBackground(builder.context(), *m_scrollbar);
57 builder.endRecording()->playback(canvas); 57 canvas->drawPicture(builder.endRecording());
58 } 58 }
59 59
60 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas, 60 void WebScrollbarThemePainter::paintTrackBackground(WebCanvas* canvas,
61 const WebRect& rect) { 61 const WebRect& rect) {
62 IntRect intRect(rect); 62 IntRect intRect(rect);
63 PaintRecordBuilder builder(intRect); 63 PaintRecordBuilder builder(intRect);
64 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 64 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
65 m_theme->paintTrackBackground(builder.context(), *m_scrollbar, intRect); 65 m_theme->paintTrackBackground(builder.context(), *m_scrollbar, intRect);
66 builder.endRecording()->playback(canvas); 66 canvas->drawPicture(builder.endRecording());
67 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) 67 if (!m_theme->shouldRepaintAllPartsOnInvalidation())
68 m_scrollbar->clearTrackNeedsRepaint(); 68 m_scrollbar->clearTrackNeedsRepaint();
69 } 69 }
70 70
71 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas, 71 void WebScrollbarThemePainter::paintBackTrackPart(WebCanvas* canvas,
72 const WebRect& rect) { 72 const WebRect& rect) {
73 IntRect intRect(rect); 73 IntRect intRect(rect);
74 PaintRecordBuilder builder(intRect); 74 PaintRecordBuilder builder(intRect);
75 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 75 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
76 m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect, 76 m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect,
77 BackTrackPart); 77 BackTrackPart);
78 builder.endRecording()->playback(canvas); 78 canvas->drawPicture(builder.endRecording());
79 } 79 }
80 80
81 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas, 81 void WebScrollbarThemePainter::paintForwardTrackPart(WebCanvas* canvas,
82 const WebRect& rect) { 82 const WebRect& rect) {
83 IntRect intRect(rect); 83 IntRect intRect(rect);
84 PaintRecordBuilder builder(intRect); 84 PaintRecordBuilder builder(intRect);
85 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 85 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
86 m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect, 86 m_theme->paintTrackPiece(builder.context(), *m_scrollbar, intRect,
87 ForwardTrackPart); 87 ForwardTrackPart);
88 builder.endRecording()->playback(canvas); 88 canvas->drawPicture(builder.endRecording());
89 } 89 }
90 90
91 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas, 91 void WebScrollbarThemePainter::paintBackButtonStart(WebCanvas* canvas,
92 const WebRect& rect) { 92 const WebRect& rect) {
93 IntRect intRect(rect); 93 IntRect intRect(rect);
94 PaintRecordBuilder builder(intRect); 94 PaintRecordBuilder builder(intRect);
95 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 95 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
96 m_theme->paintButton(builder.context(), *m_scrollbar, intRect, 96 m_theme->paintButton(builder.context(), *m_scrollbar, intRect,
97 BackButtonStartPart); 97 BackButtonStartPart);
98 builder.endRecording()->playback(canvas); 98 canvas->drawPicture(builder.endRecording());
99 } 99 }
100 100
101 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas, 101 void WebScrollbarThemePainter::paintBackButtonEnd(WebCanvas* canvas,
102 const WebRect& rect) { 102 const WebRect& rect) {
103 IntRect intRect(rect); 103 IntRect intRect(rect);
104 PaintRecordBuilder builder(intRect); 104 PaintRecordBuilder builder(intRect);
105 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 105 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
106 m_theme->paintButton(builder.context(), *m_scrollbar, intRect, 106 m_theme->paintButton(builder.context(), *m_scrollbar, intRect,
107 BackButtonEndPart); 107 BackButtonEndPart);
108 builder.endRecording()->playback(canvas); 108 canvas->drawPicture(builder.endRecording());
109 } 109 }
110 110
111 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas, 111 void WebScrollbarThemePainter::paintForwardButtonStart(WebCanvas* canvas,
112 const WebRect& rect) { 112 const WebRect& rect) {
113 IntRect intRect(rect); 113 IntRect intRect(rect);
114 PaintRecordBuilder builder(intRect); 114 PaintRecordBuilder builder(intRect);
115 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 115 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
116 m_theme->paintButton(builder.context(), *m_scrollbar, intRect, 116 m_theme->paintButton(builder.context(), *m_scrollbar, intRect,
117 ForwardButtonStartPart); 117 ForwardButtonStartPart);
118 builder.endRecording()->playback(canvas); 118 canvas->drawPicture(builder.endRecording());
119 } 119 }
120 120
121 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas, 121 void WebScrollbarThemePainter::paintForwardButtonEnd(WebCanvas* canvas,
122 const WebRect& rect) { 122 const WebRect& rect) {
123 IntRect intRect(rect); 123 IntRect intRect(rect);
124 PaintRecordBuilder builder(intRect); 124 PaintRecordBuilder builder(intRect);
125 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 125 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
126 m_theme->paintButton(builder.context(), *m_scrollbar, intRect, 126 m_theme->paintButton(builder.context(), *m_scrollbar, intRect,
127 ForwardButtonEndPart); 127 ForwardButtonEndPart);
128 builder.endRecording()->playback(canvas); 128 canvas->drawPicture(builder.endRecording());
129 } 129 }
130 130
131 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas, 131 void WebScrollbarThemePainter::paintTickmarks(WebCanvas* canvas,
132 const WebRect& rect) { 132 const WebRect& rect) {
133 IntRect intRect(rect); 133 IntRect intRect(rect);
134 PaintRecordBuilder builder(intRect); 134 PaintRecordBuilder builder(intRect);
135 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 135 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
136 m_theme->paintTickmarks(builder.context(), *m_scrollbar, intRect); 136 m_theme->paintTickmarks(builder.context(), *m_scrollbar, intRect);
137 builder.endRecording()->playback(canvas); 137 canvas->drawPicture(builder.endRecording());
138 } 138 }
139 139
140 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas, 140 void WebScrollbarThemePainter::paintThumb(WebCanvas* canvas,
141 const WebRect& rect) { 141 const WebRect& rect) {
142 IntRect intRect(rect); 142 IntRect intRect(rect);
143 PaintRecordBuilder builder(intRect); 143 PaintRecordBuilder builder(intRect);
144 builder.context().setDeviceScaleFactor(m_deviceScaleFactor); 144 builder.context().setDeviceScaleFactor(m_deviceScaleFactor);
145 m_theme->paintThumb(builder.context(), *m_scrollbar, intRect); 145 m_theme->paintThumb(builder.context(), *m_scrollbar, intRect);
146 builder.endRecording()->playback(canvas); 146 canvas->drawPicture(builder.endRecording());
147 if (!m_theme->shouldRepaintAllPartsOnInvalidation()) 147 if (!m_theme->shouldRepaintAllPartsOnInvalidation())
148 m_scrollbar->clearThumbNeedsRepaint(); 148 m_scrollbar->clearThumbNeedsRepaint();
149 } 149 }
150 150
151 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme, 151 WebScrollbarThemePainter::WebScrollbarThemePainter(ScrollbarTheme& theme,
152 Scrollbar& scrollbar, 152 Scrollbar& scrollbar,
153 float deviceScaleFactor) 153 float deviceScaleFactor)
154 : m_theme(&theme), 154 : m_theme(&theme),
155 m_scrollbar(&scrollbar), 155 m_scrollbar(&scrollbar),
156 m_deviceScaleFactor(deviceScaleFactor) {} 156 m_deviceScaleFactor(deviceScaleFactor) {}
157 157
158 float WebScrollbarThemePainter::thumbOpacity() const { 158 float WebScrollbarThemePainter::thumbOpacity() const {
159 return m_theme->thumbOpacity(*m_scrollbar); 159 return m_theme->thumbOpacity(*m_scrollbar);
160 } 160 }
161 161
162 bool WebScrollbarThemePainter::trackNeedsRepaint() const { 162 bool WebScrollbarThemePainter::trackNeedsRepaint() const {
163 return m_scrollbar->trackNeedsRepaint(); 163 return m_scrollbar->trackNeedsRepaint();
164 } 164 }
165 165
166 bool WebScrollbarThemePainter::thumbNeedsRepaint() const { 166 bool WebScrollbarThemePainter::thumbNeedsRepaint() const {
167 return m_scrollbar->thumbNeedsRepaint(); 167 return m_scrollbar->thumbNeedsRepaint();
168 } 168 }
169 169
170 bool WebScrollbarThemePainter::usesNinePatchThumbResource() const { 170 bool WebScrollbarThemePainter::usesNinePatchThumbResource() const {
171 return m_theme->usesNinePatchThumbResource(); 171 return m_theme->usesNinePatchThumbResource();
172 } 172 }
173 173
174 } // namespace blink 174 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698