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

Unified Diff: ui/base/native_theme/native_theme_win.cc

Issue 10807023: Fix scrollbar transparency / opacity issues on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/base/native_theme/native_theme_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « ui/base/native_theme/native_theme_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698