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

Unified Diff: Source/platform/scroll/ScrollbarThemeMock.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 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
Index: Source/platform/scroll/ScrollbarThemeMock.cpp
diff --git a/Source/platform/scroll/ScrollbarThemeMock.cpp b/Source/platform/scroll/ScrollbarThemeMock.cpp
index 96c10024c24bec6b5e48c6deb8b35dbb05abab8c..7303704e616abf2f564146d7e054563c36063540 100644
--- a/Source/platform/scroll/ScrollbarThemeMock.cpp
+++ b/Source/platform/scroll/ScrollbarThemeMock.cpp
@@ -52,20 +52,23 @@ bool ScrollbarThemeMock::usesOverlayScrollbars() const
void ScrollbarThemeMock::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& trackRect)
{
- DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarTrackBackground, trackRect);
- if (recorder.canUseCachedDrawing())
+ if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, DisplayItem::ScrollbarTrackBackground))
return;
+
+ DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarTrackBackground, trackRect);
context->fillRect(trackRect, scrollbar->enabled() ? Color::lightGray : Color(0xFFE0E0E0));
}
void ScrollbarThemeMock::paintThumb(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& thumbRect)
{
- if (scrollbar->enabled()) {
- DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarThumb, thumbRect);
- if (recorder.canUseCachedDrawing())
- return;
- context->fillRect(thumbRect, Color::darkGray);
- }
+ if (!scrollbar->enabled())
+ return;
+
+ if (DrawingRecorder::useCachedDrawingIfPossible(*context, *scrollbar, DisplayItem::ScrollbarThumb))
+ return;
+
+ DrawingRecorder recorder(*context, *scrollbar, DisplayItem::ScrollbarThumb, thumbRect);
+ context->fillRect(thumbRect, Color::darkGray);
}
}
« no previous file with comments | « Source/platform/scroll/ScrollbarThemeMacOverlayAPI.mm ('k') | Source/platform/scroll/ScrollbarThemeNonMacCommon.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698