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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 break; | 278 break; |
279 } | 279 } |
280 | 280 |
281 HDC surface = skia::GetNativeDrawingContext(canvas); | 281 HDC surface = skia::GetNativeDrawingContext(canvas); |
282 | 282 |
283 // When drawing the task manager or the bookmark editor, we draw into an | 283 // When drawing the task manager or the bookmark editor, we draw into an |
284 // offscreen buffer, where we can use OS-specific drawing routines for | 284 // offscreen buffer, where we can use OS-specific drawing routines for |
285 // UI features like scrollbars. However, we need to set up that buffer, | 285 // UI features like scrollbars. However, we need to set up that buffer, |
286 // and then read it back when it's done and blit it onto the screen. | 286 // and then read it back when it's done and blit it onto the screen. |
287 | 287 |
288 if (skia::SupportsPlatformPaint(canvas)) | 288 if (surface) |
289 PaintDirect(canvas, surface, part, state, rect, extra); | 289 PaintDirect(canvas, surface, part, state, rect, extra); |
290 else | 290 else |
291 PaintIndirect(canvas, surface, part, state, rect, extra); | 291 PaintIndirect(canvas, part, state, rect, extra); |
292 } | 292 } |
293 | 293 |
294 NativeThemeWin::NativeThemeWin() | 294 NativeThemeWin::NativeThemeWin() |
295 : draw_theme_(NULL), | 295 : draw_theme_(NULL), |
296 draw_theme_ex_(NULL), | 296 draw_theme_ex_(NULL), |
297 get_theme_color_(NULL), | 297 get_theme_color_(NULL), |
298 get_theme_content_rect_(NULL), | 298 get_theme_content_rect_(NULL), |
299 get_theme_part_size_(NULL), | 299 get_theme_part_size_(NULL), |
300 open_theme_(NULL), | 300 open_theme_(NULL), |
301 close_theme_(NULL), | 301 close_theme_(NULL), |
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 return kProminentButtonColorInvert; | 666 return kProminentButtonColorInvert; |
667 default: | 667 default: |
668 return color_utils::InvertColor(GetAuraColor(color_id, this)); | 668 return color_utils::InvertColor(GetAuraColor(color_id, this)); |
669 } | 669 } |
670 } | 670 } |
671 | 671 |
672 return GetAuraColor(color_id, this); | 672 return GetAuraColor(color_id, this); |
673 } | 673 } |
674 | 674 |
675 void NativeThemeWin::PaintIndirect(SkCanvas* destination_canvas, | 675 void NativeThemeWin::PaintIndirect(SkCanvas* destination_canvas, |
676 HDC destination_hdc, | |
677 Part part, | 676 Part part, |
678 State state, | 677 State state, |
679 const gfx::Rect& rect, | 678 const gfx::Rect& rect, |
680 const ExtraParams& extra) const { | 679 const ExtraParams& extra) const { |
681 // TODO(asvitkine): This path is pretty inefficient - for each paint operation | 680 // TODO(asvitkine): This path is pretty inefficient - for each paint operation |
682 // it creates a new offscreen bitmap Skia canvas. This can | 681 // it creates a new offscreen bitmap Skia canvas. This can |
683 // be sped up by doing it only once per part/state and | 682 // be sped up by doing it only once per part/state and |
684 // keeping a cache of the resulting bitmaps. | 683 // keeping a cache of the resulting bitmaps. |
685 | 684 |
686 // If this process doesn't have access to GDI, we'd need to use shared memory | 685 // If this process doesn't have access to GDI, we'd need to use shared memory |
(...skipping 1417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2104 break; | 2103 break; |
2105 case LAST: | 2104 case LAST: |
2106 NOTREACHED(); | 2105 NOTREACHED(); |
2107 break; | 2106 break; |
2108 } | 2107 } |
2109 theme_handles_[theme_name] = handle; | 2108 theme_handles_[theme_name] = handle; |
2110 return handle; | 2109 return handle; |
2111 } | 2110 } |
2112 | 2111 |
2113 } // namespace ui | 2112 } // namespace ui |
OLD | NEW |