OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/native_theme_win.h" | 5 #include "ui/gfx/native_theme_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <uxtheme.h> | 8 #include <uxtheme.h> |
9 #include <vsstyle.h> | 9 #include <vsstyle.h> |
10 #include <vssym32.h> | 10 #include <vssym32.h> |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ReleaseDC(NULL, hdc); | 125 ReleaseDC(NULL, hdc); |
126 | 126 |
127 return SUCCEEDED(hr) ? Size(size.cx, size.cy) : Size(); | 127 return SUCCEEDED(hr) ? Size(size.cx, size.cy) : Size(); |
128 } | 128 } |
129 | 129 |
130 void NativeThemeWin::Paint(SkCanvas* canvas, | 130 void NativeThemeWin::Paint(SkCanvas* canvas, |
131 Part part, | 131 Part part, |
132 State state, | 132 State state, |
133 const gfx::Rect& rect, | 133 const gfx::Rect& rect, |
134 const ExtraParams& extra) const { | 134 const ExtraParams& extra) const { |
135 HDC hdc = skia::BeginPlatformPaint(canvas); | 135 skia::ScopedPlatformPaint scoped_platform_paint(canvas); |
| 136 HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
136 | 137 |
137 switch (part) { | 138 switch (part) { |
138 case kCheckbox: | 139 case kCheckbox: |
139 PaintCheckbox(hdc, part, state, rect, extra.button); | 140 PaintCheckbox(hdc, part, state, rect, extra.button); |
140 break; | 141 break; |
141 case kRadio: | 142 case kRadio: |
142 PaintRadioButton(hdc, part, state, rect, extra.button); | 143 PaintRadioButton(hdc, part, state, rect, extra.button); |
143 break; | 144 break; |
144 case kPushButton: | 145 case kPushButton: |
145 PaintPushButton(hdc, part, state, rect, extra.button); | 146 PaintPushButton(hdc, part, state, rect, extra.button); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 PaintTextField(hdc, part, state, rect, extra.text_field); | 206 PaintTextField(hdc, part, state, rect, extra.text_field); |
206 break; | 207 break; |
207 | 208 |
208 case kSliderTrack: | 209 case kSliderTrack: |
209 case kSliderThumb: | 210 case kSliderThumb: |
210 default: | 211 default: |
211 // While transitioning NativeThemeWin to the single Paint() entry point, | 212 // While transitioning NativeThemeWin to the single Paint() entry point, |
212 // unsupported parts will DCHECK here. | 213 // unsupported parts will DCHECK here. |
213 DCHECK(false); | 214 DCHECK(false); |
214 } | 215 } |
215 | |
216 skia::EndPlatformPaint(canvas); | |
217 } | 216 } |
218 | 217 |
219 HRESULT NativeThemeWin::PaintScrollbarArrow( | 218 HRESULT NativeThemeWin::PaintScrollbarArrow( |
220 HDC hdc, | 219 HDC hdc, |
221 Part part, | 220 Part part, |
222 State state, | 221 State state, |
223 const gfx::Rect& rect, | 222 const gfx::Rect& rect, |
224 const ScrollbarArrowExtraParams& extra) const { | 223 const ScrollbarArrowExtraParams& extra) const { |
225 static int state_id_matrix[4][kMaxState] = { | 224 static int state_id_matrix[4][kMaxState] = { |
226 ABS_DOWNDISABLED, ABS_DOWNHOT, ABS_DOWNNORMAL, ABS_DOWNPRESSED, | 225 ABS_DOWNDISABLED, ABS_DOWNHOT, ABS_DOWNNORMAL, ABS_DOWNPRESSED, |
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1507 } | 1506 } |
1508 break; | 1507 break; |
1509 default: | 1508 default: |
1510 NOTREACHED() << "Invalid part: " << part; | 1509 NOTREACHED() << "Invalid part: " << part; |
1511 break; | 1510 break; |
1512 } | 1511 } |
1513 return state_id; | 1512 return state_id; |
1514 } | 1513 } |
1515 | 1514 |
1516 } // namespace gfx | 1515 } // namespace gfx |
OLD | NEW |