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

Unified Diff: Source/web/PageWidgetDelegate.cpp

Issue 1145103004: Switch PageWidgetDelegate to use an SkPictureBuilder. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/web/PageWidgetDelegate.cpp
diff --git a/Source/web/PageWidgetDelegate.cpp b/Source/web/PageWidgetDelegate.cpp
index 1dcf0f1e91710bc73455ca74d6f7a131f26c2961..f658284918bccb05054001b0005d335c20724703 100644
--- a/Source/web/PageWidgetDelegate.cpp
+++ b/Source/web/PageWidgetDelegate.cpp
@@ -42,8 +42,8 @@
#include "platform/Logging.h"
#include "platform/graphics/GraphicsContext.h"
#include "platform/graphics/paint/ClipRecorder.h"
-#include "platform/graphics/paint/DisplayItemListContextRecorder.h"
#include "platform/graphics/paint/DrawingRecorder.h"
+#include "platform/graphics/paint/SkPictureBuilder.h"
#include "platform/transforms/AffineTransform.h"
#include "public/web/WebInputEvent.h"
#include "web/PageOverlayList.h"
@@ -72,34 +72,33 @@ void PageWidgetDelegate::paint(Page& page, PageOverlayList* overlays, WebCanvas*
if (rect.isEmpty())
return;
- OwnPtr<GraphicsContext> context = GraphicsContext::deprecatedCreateWithCanvas(canvas);
- {
- DisplayItemListContextRecorder contextRecorder(*context);
- GraphicsContext& paintContext = contextRecorder.context();
-
- // FIXME: device scale factor settings are layering violations and should not
- // be used within Blink paint code.
- float scaleFactor = page.deviceScaleFactor();
- paintContext.setDeviceScaleFactor(scaleFactor);
-
- AffineTransform scale;
- scale.scale(scaleFactor);
- TransformRecorder scaleRecorder(paintContext, root, scale);
-
- IntRect dirtyRect(rect);
- FrameView* view = root.view();
- if (view) {
- ClipRecorder clipRecorder(paintContext, root, DisplayItem::PageWidgetDelegateClip, LayoutRect(dirtyRect));
-
- view->paint(&paintContext, dirtyRect);
- if (overlays)
- overlays->paintWebFrame(paintContext);
- } else {
- DrawingRecorder drawingRecorder(paintContext, root, DisplayItem::PageWidgetDelegateBackgroundFallback, dirtyRect);
- if (!drawingRecorder.canUseCachedDrawing())
- paintContext.fillRect(dirtyRect, Color::white);
- }
+ IntRect intRect(rect);
+ SkPictureBuilder builder(intRect);
+ GraphicsContext* context = &builder.context();
+
+ // FIXME: device scale factor settings are layering violations and should not
+ // be used within Blink paint code.
+ float scaleFactor = page.deviceScaleFactor();
+ context->setDeviceScaleFactor(scaleFactor);
+
+ AffineTransform scale;
+ scale.scale(scaleFactor);
+ TransformRecorder scaleRecorder(*context, root, scale);
+
+ IntRect dirtyRect(rect);
+ FrameView* view = root.view();
+ if (view) {
+ ClipRecorder clipRecorder(*context, root, DisplayItem::PageWidgetDelegateClip, LayoutRect(dirtyRect));
+
+ view->paint(context, dirtyRect);
+ if (overlays)
+ overlays->paintWebFrame(*context);
+ } else {
+ DrawingRecorder drawingRecorder(*context, root, DisplayItem::PageWidgetDelegateBackgroundFallback, dirtyRect);
+ if (!drawingRecorder.canUseCachedDrawing())
+ context->fillRect(dirtyRect, Color::white);
}
+ builder.endRecording()->playback(canvas);
}
bool PageWidgetDelegate::handleInputEvent(PageWidgetEventHandler& handler, const WebInputEvent& event, LocalFrame* root)
« 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