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

Unified Diff: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp

Issue 2022563002: Remove display item scope (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/platform/graphics/paint/README.md ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
diff --git a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
index 24a23eb9dea15d6035a6cc9568e802983c4e90e0..a2d0d895440779cac5a962587cad4c14d671fcb2 100644
--- a/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
+++ b/third_party/WebKit/Source/web/WebLocalFrameImpl.cpp
@@ -149,7 +149,6 @@
#include "core/page/Page.h"
#include "core/page/PrintContext.h"
#include "core/paint/PaintLayer.h"
-#include "core/paint/ScopeRecorder.h"
#include "core/paint/TransformRecorder.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
@@ -172,6 +171,7 @@
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/GraphicsLayerClient.h"
#include "platform/graphics/paint/ClipRecorder.h"
+#include "platform/graphics/paint/DisplayItemCacheSkipper.h"
#include "platform/graphics/paint/DrawingRecorder.h"
#include "platform/graphics/paint/SkPictureBuilder.h"
#include "platform/graphics/skia/SkiaUtils.h"
@@ -338,39 +338,42 @@ public:
SkPictureBuilder pictureBuilder(allPagesRect, &skia::GetMetaData(*canvas));
pictureBuilder.context().setPrinting(true);
- GraphicsContext& context = pictureBuilder.context();
-
- // Fill the whole background by white.
{
- DrawingRecorder backgroundRecorder(context, pictureBuilder, DisplayItem::PrintedContentBackground, allPagesRect);
- context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::white);
- }
+ GraphicsContext& context = pictureBuilder.context();
+ DisplayItemCacheSkipper skipper(context);
- int currentHeight = 0;
- for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
- ScopeRecorder scopeRecorder(context);
- // Draw a line for a page boundary if this isn't the first page.
- if (pageIndex > 0) {
- DrawingRecorder lineBoundaryRecorder(context, pictureBuilder, DisplayItem::PrintedContentLineBoundary, allPagesRect);
- context.save();
- context.setStrokeColor(Color(0, 0, 255));
- context.setFillColor(Color(0, 0, 255));
- context.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth, currentHeight));
- context.restore();
+ // Fill the whole background by white.
+ {
+ DrawingRecorder backgroundRecorder(context, pictureBuilder, DisplayItem::PrintedContentBackground, allPagesRect);
+ context.fillRect(FloatRect(0, 0, pageWidth, totalHeight), Color::white);
}
- AffineTransform transform;
- transform.translate(0, currentHeight);
+
+ int currentHeight = 0;
+ for (size_t pageIndex = 0; pageIndex < numPages; pageIndex++) {
+ // Draw a line for a page boundary if this isn't the first page.
+ if (pageIndex > 0) {
+ DrawingRecorder lineBoundaryRecorder(context, pictureBuilder, DisplayItem::PrintedContentLineBoundary, allPagesRect);
+ 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;
+ transform.translate(0, currentHeight);
#if OS(WIN) || OS(MACOSX)
- // Account for the disabling of scaling in spoolPage. In the context
- // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied.
- float scale = getPageShrink(pageIndex);
- transform.scale(scale, scale);
+ // Account for the disabling of scaling in spoolPage. In the context
+ // of spoolAllPagesWithBoundaries the scale HAS NOT been pre-applied.
+ float scale = getPageShrink(pageIndex);
+ transform.scale(scale, scale);
#endif
- TransformRecorder transformRecorder(context, pictureBuilder, transform);
- spoolPage(pictureBuilder, pageIndex);
+ TransformRecorder transformRecorder(context, pictureBuilder, transform);
+ spoolPage(pictureBuilder, pageIndex);
- currentHeight += pageSizeInPixels.height() + 1;
+ currentHeight += pageSizeInPixels.height() + 1;
+ }
}
pictureBuilder.endRecording()->playback(canvas);
}
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/paint/README.md ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698