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

Side by Side Diff: Source/web/WebPluginContainerImpl.cpp

Issue 1315993004: Implement a paint offset cache for slimming paint v2 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase more (world moved in the past hour) Created 5 years, 3 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
« no previous file with comments | « Source/platform/graphics/paint/DrawingRecorder.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * Copyright (C) 2014 Opera Software ASA. All rights reserved. 3 * Copyright (C) 2014 Opera Software ASA. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 void WebPluginContainerImpl::paint(GraphicsContext* context, const IntRect& rect ) 112 void WebPluginContainerImpl::paint(GraphicsContext* context, const IntRect& rect )
113 { 113 {
114 if (!parent()) 114 if (!parent())
115 return; 115 return;
116 116
117 // Don't paint anything if the plugin doesn't intersect. 117 // Don't paint anything if the plugin doesn't intersect.
118 if (!frameRect().intersects(rect)) 118 if (!frameRect().intersects(rect))
119 return; 119 return;
120 120
121 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele ment->layoutObject(), DisplayItem::Type::WebPlugin)) 121 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*context, *m_ele ment->layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint()))
122 return; 122 return;
123 123
124 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje ct(), DisplayItem::Type::WebPlugin, rect); 124 LayoutObjectDrawingRecorder drawingRecorder(*context, *m_element->layoutObje ct(), DisplayItem::Type::WebPlugin, rect, LayoutPoint());
125 context->save(); 125 context->save();
126 126
127 ASSERT(parent()->isFrameView()); 127 ASSERT(parent()->isFrameView());
128 FrameView* view = toFrameView(parent()); 128 FrameView* view = toFrameView(parent());
129 129
130 // The plugin is positioned in the root frame's coordinates, so it needs to 130 // The plugin is positioned in the root frame's coordinates, so it needs to
131 // be painted in them too. 131 // be painted in them too.
132 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0)); 132 IntPoint origin = view->contentsToRootFrame(IntPoint(0, 0));
133 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig in.y())); 133 context->translate(static_cast<float>(-origin.x()), static_cast<float>(-orig in.y()));
134 134
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions); 336 return m_webPlugin->getPrintPresetOptionsFromDocument(presetOptions);
337 } 337 }
338 338
339 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const 339 int WebPluginContainerImpl::printBegin(const WebPrintParams& printParams) const
340 { 340 {
341 return m_webPlugin->printBegin(printParams); 341 return m_webPlugin->printBegin(printParams);
342 } 342 }
343 343
344 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext* gc, cons t IntRect& printRect) 344 void WebPluginContainerImpl::printPage(int pageNumber, GraphicsContext* gc, cons t IntRect& printRect)
345 { 345 {
346 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*gc, *m_element- >layoutObject(), DisplayItem::Type::WebPlugin)) 346 if (LayoutObjectDrawingRecorder::useCachedDrawingIfPossible(*gc, *m_element- >layoutObject(), DisplayItem::Type::WebPlugin, LayoutPoint()))
347 return; 347 return;
348 348
349 LayoutObjectDrawingRecorder drawingRecorder(*gc, *m_element->layoutObject(), DisplayItem::Type::WebPlugin, printRect); 349 LayoutObjectDrawingRecorder drawingRecorder(*gc, *m_element->layoutObject(), DisplayItem::Type::WebPlugin, printRect, LayoutPoint());
350 gc->save(); 350 gc->save();
351 WebCanvas* canvas = gc->canvas(); 351 WebCanvas* canvas = gc->canvas();
352 m_webPlugin->printPage(pageNumber, canvas); 352 m_webPlugin->printPage(pageNumber, canvas);
353 gc->restore(); 353 gc->restore();
354 } 354 }
355 355
356 void WebPluginContainerImpl::printEnd() 356 void WebPluginContainerImpl::printEnd()
357 { 357 {
358 m_webPlugin->printEnd(); 358 m_webPlugin->printEnd();
359 } 359 }
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 clipRect.move(-windowRect.x(), -windowRect.y()); 960 clipRect.move(-windowRect.x(), -windowRect.y());
961 unobscuredRect.move(-windowRect.x(), -windowRect.y()); 961 unobscuredRect.move(-windowRect.x(), -windowRect.y());
962 962
963 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects); 963 getPluginOcclusions(m_element, this->parent(), frameRect(), cutOutRects);
964 // Convert to the plugin position. 964 // Convert to the plugin position.
965 for (size_t i = 0; i < cutOutRects.size(); i++) 965 for (size_t i = 0; i < cutOutRects.size(); i++)
966 cutOutRects[i].move(-frameRect().x(), -frameRect().y()); 966 cutOutRects[i].move(-frameRect().x(), -frameRect().y());
967 } 967 }
968 968
969 } // namespace blink 969 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/graphics/paint/DrawingRecorder.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698