Index: ui/base/native_theme/native_theme_win.cc |
diff --git a/ui/base/native_theme/native_theme_win.cc b/ui/base/native_theme/native_theme_win.cc |
index 4f9b9306f38b50238eb132a87daa17263c67cc8b..ffaff44d7de48b5acc341c4b51533bc667a464db 100644 |
--- a/ui/base/native_theme/native_theme_win.cc |
+++ b/ui/base/native_theme/native_theme_win.cc |
@@ -287,12 +287,43 @@ void NativeThemeWin::Paint(SkCanvas* canvas, |
State state, |
const gfx::Rect& rect, |
const ExtraParams& extra) const { |
+ bool needsPaintIndirect = false; |
brettw
2012/07/23 21:27:07
Style: "needs_paint_indirect"
ccameron
2012/07/23 23:20:36
Done.
|
if (!skia::SupportsPlatformPaint(canvas)) { |
// This block will only get hit with --enable-accelerated-drawing flag. |
- PaintToNonPlatformCanvas(canvas, part, state, rect, extra); |
- return; |
+ needsPaintIndirect = true; |
+ } else { |
+ // Scrollbars on Windows XP and the Windows Classic theme have particularly |
+ // problematic alpha values, so always draw them indirectly. |
+ switch (part) { |
+ case kScrollbarDownArrow: |
+ case kScrollbarUpArrow: |
+ case kScrollbarLeftArrow: |
+ case kScrollbarRightArrow: |
+ case kScrollbarHorizontalThumb: |
+ case kScrollbarVerticalThumb: |
+ case kScrollbarHorizontalGripper: |
+ case kScrollbarVerticalGripper: |
+ if (!GetThemeHandle(SCROLLBAR)) { |
brettw
2012/07/23 21:27:07
No {} for single-line conditionals (to match surro
ccameron
2012/07/23 23:20:36
Done (and made this change to the "if (needs_paint
|
+ needsPaintIndirect = true; |
+ } |
+ break; |
+ default: |
+ break; |
+ } |
+ } |
+ |
+ if (needsPaintIndirect) { |
+ PaintIndirect(canvas, part, state, rect, extra); |
+ } else { |
+ PaintDirect(canvas, part, state, rect, extra); |
} |
+} |
+void NativeThemeWin::PaintDirect(SkCanvas* canvas, |
+ Part part, |
+ State state, |
+ const gfx::Rect& rect, |
+ const ExtraParams& extra) const { |
skia::ScopedPlatformPaint scoped_platform_paint(canvas); |
HDC hdc = scoped_platform_paint.GetPlatformSurface(); |
@@ -440,11 +471,11 @@ SkColor NativeThemeWin::GetSystemColor(ColorId color_id) const { |
return kInvalidColorIdColor; |
} |
-void NativeThemeWin::PaintToNonPlatformCanvas(SkCanvas* canvas, |
- Part part, |
- State state, |
- const gfx::Rect& rect, |
- const ExtraParams& extra) const { |
+void NativeThemeWin::PaintIndirect(SkCanvas* canvas, |
+ Part part, |
+ State state, |
+ const gfx::Rect& rect, |
+ const ExtraParams& extra) const { |
// TODO(asvitkine): This path is pretty inefficient - for each paint operation |
// it creates a new offscreen bitmap Skia canvas. This can |
// be sped up by doing it only once per part/state and |
@@ -482,7 +513,11 @@ void NativeThemeWin::PaintToNonPlatformCanvas(SkCanvas* canvas, |
default: break; |
} |
// Draw the theme controls using existing HDC-drawing code. |
- Paint(offscreen_canvas.get(), part, state, adjusted_rect, adjusted_extra); |
+ PaintDirect(offscreen_canvas.get(), |
+ part, |
+ state, |
+ adjusted_rect, |
+ adjusted_extra); |
// Copy the pixels to a bitmap that has ref-counted pixel storage, which is |
// necessary to have when drawing to a SkPicture. |