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

Side by Side Diff: Source/core/paint/PartPainter.cpp

Issue 1220583004: Refactor DrawingRecorders to check for cached drawings earlier (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 5 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/core/paint/ObjectPainter.cpp ('k') | Source/core/paint/ReplacedPainter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/paint/PartPainter.h" 6 #include "core/paint/PartPainter.h"
7 7
8 #include "core/layout/LayoutPart.h" 8 #include "core/layout/LayoutPart.h"
9 #include "core/paint/BoxPainter.h" 9 #include "core/paint/BoxPainter.h"
10 #include "core/paint/DeprecatedPaintLayer.h" 10 #include "core/paint/DeprecatedPaintLayer.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 -(m_layoutPart.paddingLeft() + m_layoutPart.borderLeft())), 56 -(m_layoutPart.paddingLeft() + m_layoutPart.borderLeft())),
57 true, true); 57 true, true);
58 clipper.emplace(m_layoutPart, paintInfo, borderRect, roundedInnerRec t, ApplyToDisplayListIfEnabled); 58 clipper.emplace(m_layoutPart, paintInfo, borderRect, roundedInnerRec t, ApplyToDisplayListIfEnabled);
59 } 59 }
60 60
61 if (m_layoutPart.widget()) 61 if (m_layoutPart.widget())
62 m_layoutPart.paintContents(paintInfo, paintOffset); 62 m_layoutPart.paintContents(paintInfo, paintOffset);
63 } 63 }
64 64
65 // Paint a partially transparent wash over selected widgets. 65 // Paint a partially transparent wash over selected widgets.
66 if (m_layoutPart.isSelected() && !m_layoutPart.document().printing()) { 66 if (m_layoutPart.isSelected() && !m_layoutPart.document().printing() && !Lay outObjectDrawingRecorder::useCachedDrawingIfPossible(*paintInfo.context, m_layou tPart, paintInfo.phase)) {
67 LayoutRect rect = m_layoutPart.localSelectionRect(); 67 LayoutRect rect = m_layoutPart.localSelectionRect();
68 rect.moveBy(adjustedPaintOffset); 68 rect.moveBy(adjustedPaintOffset);
69 IntRect selectionRect = pixelSnappedIntRect(rect); 69 IntRect selectionRect = pixelSnappedIntRect(rect);
70 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Part, paintInfo.phase, selectionRect); 70 LayoutObjectDrawingRecorder drawingRecorder(*paintInfo.context, m_layout Part, paintInfo.phase, selectionRect);
71 if (!drawingRecorder.canUseCachedDrawing()) 71 paintInfo.context->fillRect(selectionRect, m_layoutPart.selectionBackgro undColor());
72 paintInfo.context->fillRect(selectionRect, m_layoutPart.selectionBac kgroundColor());
73 } 72 }
74 73
75 if (m_layoutPart.canResize()) 74 if (m_layoutPart.canResize())
76 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect); 75 ScrollableAreaPainter(*m_layoutPart.layer()->scrollableArea()).paintResi zer(paintInfo.context, roundedIntPoint(adjustedPaintOffset), paintInfo.rect);
77 } 76 }
78 77
79 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset) 78 void PartPainter::paintContents(const PaintInfo& paintInfo, const LayoutPoint& p aintOffset)
80 { 79 {
81 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location(); 80 LayoutPoint adjustedPaintOffset = paintOffset + m_layoutPart.location();
82 81
(...skipping 10 matching lines...) Expand all
93 IntSize widgetPaintOffset = paintLocation - widgetLocation; 92 IntSize widgetPaintOffset = paintLocation - widgetLocation;
94 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer, 93 // When painting widgets into compositing layers, tx and ty are relative to the enclosing compositing layer,
95 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plugin drawing. 94 // not the root. In this case, shift the CTM and adjust the paintRect to be root-relative to fix plugin drawing.
96 TransformRecorder transform(*paintInfo.context, m_layoutPart, 95 TransformRecorder transform(*paintInfo.context, m_layoutPart,
97 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse t.height())); 96 AffineTransform::translation(widgetPaintOffset.width(), widgetPaintOffse t.height()));
98 paintRect.move(-widgetPaintOffset); 97 paintRect.move(-widgetPaintOffset);
99 widget->paint(paintInfo.context, paintRect); 98 widget->paint(paintInfo.context, paintRect);
100 } 99 }
101 100
102 } // namespace blink 101 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/paint/ObjectPainter.cpp ('k') | Source/core/paint/ReplacedPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698