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

Side by Side Diff: third_party/WebKit/Source/web/PageWidgetDelegate.cpp

Issue 2755183002: Change drawPicture calls to playback to avoid culling (Closed)
Patch Set: Address review comments Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 static void paintInternal(Page& page, 62 static void paintInternal(Page& page,
63 WebCanvas* canvas, 63 WebCanvas* canvas,
64 const WebRect& rect, 64 const WebRect& rect,
65 LocalFrame& root, 65 LocalFrame& root,
66 const GlobalPaintFlags globalPaintFlags) { 66 const GlobalPaintFlags globalPaintFlags) {
67 if (rect.isEmpty()) 67 if (rect.isEmpty())
68 return; 68 return;
69 69
70 IntRect intRect(rect); 70 IntRect intRect(rect);
71 // TODO(enne): intRect is not correct: http://crbug.com/703231
71 PaintRecordBuilder builder(intRect); 72 PaintRecordBuilder builder(intRect);
72 { 73 {
73 GraphicsContext& paintContext = builder.context(); 74 GraphicsContext& paintContext = builder.context();
74 75
75 // FIXME: device scale factor settings are layering violations and should 76 // FIXME: device scale factor settings are layering violations and should
76 // not be used within Blink paint code. 77 // not be used within Blink paint code.
77 float scaleFactor = page.deviceScaleFactorDeprecated(); 78 float scaleFactor = page.deviceScaleFactorDeprecated();
78 paintContext.setDeviceScaleFactor(scaleFactor); 79 paintContext.setDeviceScaleFactor(scaleFactor);
79 80
80 AffineTransform scale; 81 AffineTransform scale;
81 scale.scale(scaleFactor); 82 scale.scale(scaleFactor);
82 TransformRecorder scaleRecorder(paintContext, builder, scale); 83 TransformRecorder scaleRecorder(paintContext, builder, scale);
83 84
84 IntRect dirtyRect(rect); 85 IntRect dirtyRect(rect);
85 FrameView* view = root.view(); 86 FrameView* view = root.view();
86 view->updateAllLifecyclePhasesExceptPaint(); 87 view->updateAllLifecyclePhasesExceptPaint();
87 if (view) { 88 if (view) {
88 ClipRecorder clipRecorder(paintContext, builder, 89 ClipRecorder clipRecorder(paintContext, builder,
89 DisplayItem::kPageWidgetDelegateClip, 90 DisplayItem::kPageWidgetDelegateClip,
90 dirtyRect); 91 dirtyRect);
91 view->paint(paintContext, globalPaintFlags, CullRect(dirtyRect)); 92 view->paint(paintContext, globalPaintFlags, CullRect(dirtyRect));
92 } else { 93 } else {
93 DrawingRecorder drawingRecorder( 94 DrawingRecorder drawingRecorder(
94 paintContext, builder, 95 paintContext, builder,
95 DisplayItem::kPageWidgetDelegateBackgroundFallback, dirtyRect); 96 DisplayItem::kPageWidgetDelegateBackgroundFallback, dirtyRect);
96 paintContext.fillRect(dirtyRect, Color::white); 97 paintContext.fillRect(dirtyRect, Color::white);
97 } 98 }
98 } 99 }
99 100
100 canvas->drawPicture(builder.endRecording()); 101 canvas->PlaybackPaintRecord(builder.endRecording());
101 } 102 }
102 103
103 void PageWidgetDelegate::paint(Page& page, 104 void PageWidgetDelegate::paint(Page& page,
104 WebCanvas* canvas, 105 WebCanvas* canvas,
105 const WebRect& rect, 106 const WebRect& rect,
106 LocalFrame& root) { 107 LocalFrame& root) {
107 paintInternal(page, canvas, rect, root, GlobalPaintNormalPhase); 108 paintInternal(page, canvas, rect, root, GlobalPaintNormalPhase);
108 } 109 }
109 110
110 void PageWidgetDelegate::paintIgnoringCompositing(Page& page, 111 void PageWidgetDelegate::paintIgnoringCompositing(Page& page,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
269 const WebTouchEvent& event, 270 const WebTouchEvent& event,
270 const std::vector<const WebInputEvent*>& coalescedEvents) { 271 const std::vector<const WebInputEvent*>& coalescedEvents) {
271 WebTouchEvent transformedEvent = 272 WebTouchEvent transformedEvent =
272 TransformWebTouchEvent(mainFrame.view(), event); 273 TransformWebTouchEvent(mainFrame.view(), event);
273 return mainFrame.eventHandler().handleTouchEvent( 274 return mainFrame.eventHandler().handleTouchEvent(
274 transformedEvent, 275 transformedEvent,
275 TransformWebTouchEventVector(mainFrame.view(), coalescedEvents)); 276 TransformWebTouchEventVector(mainFrame.view(), coalescedEvents));
276 } 277 }
277 278
278 } // namespace blink 279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698