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

Unified Diff: Source/web/WebLocalFrameImpl.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
« no previous file with comments | « Source/web/WebGraphicsContextImpl.cpp ('k') | Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index f1e1db030342a77460108de87045e783cfa43ed5..500d2154b9af46b469d41da83fbec5e8f94c17d2 100644
--- a/Source/web/WebLocalFrameImpl.cpp
+++ b/Source/web/WebLocalFrameImpl.cpp
@@ -395,25 +395,22 @@ public:
GraphicsContext& context = pictureBuilder.context();
// Fill the whole background by white.
- {
+ if (!DrawingRecorder::useCachedDrawingIfPossible(context, *this, DisplayItem::PrintedContentBackground)) {
DrawingRecorder backgroundRecorder(context, *this, DisplayItem::PrintedContentBackground, allPagesRect);
- if (!backgroundRecorder.canUseCachedDrawing())
- context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::white);
+ context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::white);
}
int currentHeight = 0;
for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
ScopeRecorder scopeRecorder(context, *this);
// Draw a line for a page boundary if this isn't the first page.
- if (pageIndex > 0) {
+ if (pageIndex > 0 && !DrawingRecorder::useCachedDrawingIfPossible(context, *this, DisplayItem::PrintedContentLineBoundary)) {
DrawingRecorder lineBoundaryRecorder(context, *this, DisplayItem::PrintedContentLineBoundary, allPagesRect);
- if (!lineBoundaryRecorder.canUseCachedDrawing()) {
- context.save();
- context.setStrokeColor(Color(0, 0, 255));
- context.setFillColor(Color(0, 0, 255));
- context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth, currentHeight));
- context.restore();
- }
+ context.save();
+ context.setStrokeColor(Color(0, 0, 255));
+ context.setFillColor(Color(0, 0, 255));
+ context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth, currentHeight));
+ context.restore();
}
AffineTransform transform;
« no previous file with comments | « Source/web/WebGraphicsContextImpl.cpp ('k') | Source/web/WebPluginContainerImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698