| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/native_theme/native_theme_win.h" | 5 #include "ui/native_theme/native_theme_win.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <uxtheme.h> | 9 #include <uxtheme.h> |
| 10 #include <vsstyle.h> | 10 #include <vsstyle.h> |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 PaintMenuBackground(canvas, rect); | 250 PaintMenuBackground(canvas, rect); |
| 251 return; | 251 return; |
| 252 case kMenuItemBackground: | 252 case kMenuItemBackground: |
| 253 CommonThemePaintMenuItemBackground(this, canvas, state, rect, | 253 CommonThemePaintMenuItemBackground(this, canvas, state, rect, |
| 254 extra.menu_item); | 254 extra.menu_item); |
| 255 return; | 255 return; |
| 256 default: | 256 default: |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 | 259 |
| 260 bool needs_paint_indirect = false; | |
| 261 if (!skia::SupportsPlatformPaint(canvas)) { | |
| 262 // This block will only get hit with --enable-accelerated-drawing flag. | |
| 263 needs_paint_indirect = true; | |
| 264 } else { | |
| 265 // Scrollbar components on Windows Classic theme (on all Windows versions) | |
| 266 // have particularly problematic alpha values, so always draw them | |
| 267 // indirectly. In addition, scrollbar thumbs and grippers for the Windows XP | |
| 268 // theme (available only on Windows XP) also need their alpha values | |
| 269 // fixed. | |
| 270 switch (part) { | |
| 271 case kScrollbarDownArrow: | |
| 272 case kScrollbarUpArrow: | |
| 273 case kScrollbarLeftArrow: | |
| 274 case kScrollbarRightArrow: | |
| 275 needs_paint_indirect = !GetThemeHandle(SCROLLBAR); | |
| 276 break; | |
| 277 case kScrollbarHorizontalThumb: | |
| 278 case kScrollbarVerticalThumb: | |
| 279 case kScrollbarHorizontalGripper: | |
| 280 case kScrollbarVerticalGripper: | |
| 281 needs_paint_indirect = !GetThemeHandle(SCROLLBAR) || | |
| 282 base::win::GetVersion() == base::win::VERSION_XP; | |
| 283 break; | |
| 284 default: | |
| 285 break; | |
| 286 } | |
| 287 } | |
| 288 | |
| 289 skia::ScopedPlatformPaint paint(canvas); | 260 skia::ScopedPlatformPaint paint(canvas); |
| 290 HDC surface = paint.GetPlatformSurface(); | 261 HDC surface = paint.GetPlatformSurface(); |
| 291 if (needs_paint_indirect) | 262 |
| 263 // When drawing the task manager or the bookmark editor, we draw into an |
| 264 // offscreen buffer, where we can use OS-specific drawing routines for |
| 265 // UI features like scrollbars. However, we need to set up that buffer, |
| 266 // and then read it back when it's done and blit it onto the screen. |
| 267 |
| 268 if (skia::SupportsPlatformPaint(canvas)) |
| 269 PaintDirect(canvas, surface, part, state, rect, extra); |
| 270 else |
| 292 PaintIndirect(canvas, surface, part, state, rect, extra); | 271 PaintIndirect(canvas, surface, part, state, rect, extra); |
| 293 else | |
| 294 PaintDirect(canvas, surface, part, state, rect, extra); | |
| 295 } | 272 } |
| 296 | 273 |
| 297 NativeThemeWin::NativeThemeWin() | 274 NativeThemeWin::NativeThemeWin() |
| 298 : draw_theme_(NULL), | 275 : draw_theme_(NULL), |
| 299 draw_theme_ex_(NULL), | 276 draw_theme_ex_(NULL), |
| 300 get_theme_color_(NULL), | 277 get_theme_color_(NULL), |
| 301 get_theme_content_rect_(NULL), | 278 get_theme_content_rect_(NULL), |
| 302 get_theme_part_size_(NULL), | 279 get_theme_part_size_(NULL), |
| 303 open_theme_(NULL), | 280 open_theme_(NULL), |
| 304 close_theme_(NULL), | 281 close_theme_(NULL), |
| (...skipping 1778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2083 break; | 2060 break; |
| 2084 case LAST: | 2061 case LAST: |
| 2085 NOTREACHED(); | 2062 NOTREACHED(); |
| 2086 break; | 2063 break; |
| 2087 } | 2064 } |
| 2088 theme_handles_[theme_name] = handle; | 2065 theme_handles_[theme_name] = handle; |
| 2089 return handle; | 2066 return handle; |
| 2090 } | 2067 } |
| 2091 | 2068 |
| 2092 } // namespace ui | 2069 } // namespace ui |
| OLD | NEW |