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

Unified Diff: ui/native_theme/native_theme_win.cc

Issue 2210923003: Simplify conditional call of PaintIndirect() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nits Created 4 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/native_theme/native_theme_win.cc
diff --git a/ui/native_theme/native_theme_win.cc b/ui/native_theme/native_theme_win.cc
index cc66d70f5633cb6f2fa40d6d801ec9a9a5f703cb..ce865996b534254d4ea8f2ba9bf7631511f01b3c 100644
--- a/ui/native_theme/native_theme_win.cc
+++ b/ui/native_theme/native_theme_win.cc
@@ -257,41 +257,18 @@ void NativeThemeWin::Paint(SkCanvas* canvas,
break;
}
- bool needs_paint_indirect = false;
- if (!skia::SupportsPlatformPaint(canvas)) {
- // This block will only get hit with --enable-accelerated-drawing flag.
- needs_paint_indirect = true;
- } else {
- // Scrollbar components on Windows Classic theme (on all Windows versions)
- // have particularly problematic alpha values, so always draw them
- // indirectly. In addition, scrollbar thumbs and grippers for the Windows XP
- // theme (available only on Windows XP) also need their alpha values
- // fixed.
- switch (part) {
- case kScrollbarDownArrow:
- case kScrollbarUpArrow:
- case kScrollbarLeftArrow:
- case kScrollbarRightArrow:
- needs_paint_indirect = !GetThemeHandle(SCROLLBAR);
- break;
- case kScrollbarHorizontalThumb:
- case kScrollbarVerticalThumb:
- case kScrollbarHorizontalGripper:
- case kScrollbarVerticalGripper:
- needs_paint_indirect = !GetThemeHandle(SCROLLBAR) ||
- base::win::GetVersion() == base::win::VERSION_XP;
- break;
- default:
- break;
- }
- }
-
skia::ScopedPlatformPaint paint(canvas);
HDC surface = paint.GetPlatformSurface();
- if (needs_paint_indirect)
- PaintIndirect(canvas, surface, part, state, rect, extra);
- else
+
+ // When drawing the task manager or the bookmark editor, we draw into an
+ // offscreen buffer, where we can use OS-specific drawing routines for
+ // UI features like scrollbars. However, we need to set up that buffer,
+ // and then read it back when it's done and blit it onto the screen.
+
+ if (skia::SupportsPlatformPaint(canvas))
PaintDirect(canvas, surface, part, state, rect, extra);
+ else
+ PaintIndirect(canvas, surface, part, state, rect, extra);
}
NativeThemeWin::NativeThemeWin()
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698