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

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: Fix some !'s and &&'s. De Morgan would be proud. Created 5 years, 6 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/web/WebLocalFrameImpl.cpp
diff --git a/Source/web/WebLocalFrameImpl.cpp b/Source/web/WebLocalFrameImpl.cpp
index 3df622c6a65f3df19209258b24f9a049d57bc149..d2c96fc3a352aa0880278eba1a7bfdb07c5c6862 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;

Powered by Google App Engine
This is Rietveld 408576698